Hi Cole,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on nf-next/master]
[also build test WARNING on nf/master ipvs/master v5.12-rc8 next-20210421]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url:
https://github.com/0day-ci/linux/commits/Cole-Dishington/net-netfilter-Ad...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
config: mips-randconfig-r031-20210421 (attached as .config)
compiler: clang version 13.0.0 (
https://github.com/llvm/llvm-project
f5446b769a7929806f72256fccd4826d66502e59)
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
#
https://github.com/0day-ci/linux/commit/2198990eeb54f0fc1517731200e48b178...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Cole-Dishington/net-netfilter-Add-RFC-7597-Section-5-1-PSID-support/20210422-103613
git checkout 2198990eeb54f0fc1517731200e48b17851443af
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
> net/netfilter/nf_nat_core.c:425:6: warning: no previous prototype
for function 'nf_nat_l4proto_unique_tuple' [-Wmissing-prototypes]
void
nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple,
^
net/netfilter/nf_nat_core.c:425:1: note: declare 'static' if the function is
not intended to be used outside of this translation unit
void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple,
^
static
1 warning generated.
vim +/nf_nat_l4proto_unique_tuple +425 net/netfilter/nf_nat_core.c
419
420 /* Alter the per-proto part of the tuple (depending on maniptype), to
421 * give a unique tuple in the given range if possible.
422 *
423 * Per-protocol part of tuple is initialized to the incoming packet.
424 */
425 void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple
*tuple,
426 const struct nf_nat_range2 *range,
427 enum nf_nat_manip_type maniptype,
428 const struct nf_conn *ct)
429 {
430 unsigned int range_size, min, max, i, attempts;
431 __be16 *keyptr;
432 u16 off;
433 static const unsigned int max_attempts = 128;
434
435 switch (tuple->dst.protonum) {
436 case IPPROTO_ICMP:
437 case IPPROTO_ICMPV6:
438 /* id is same for either direction... */
439 keyptr = &tuple->src.u.icmp.id;
440 if (!(range->flags & NF_NAT_RANGE_PROTO_SPECIFIED)) {
441 min = 0;
442 range_size = 65536;
443 } else {
444 min = ntohs(range->min_proto.icmp.id);
445 range_size = ntohs(range->max_proto.icmp.id) -
446 ntohs(range->min_proto.icmp.id) + 1;
447 }
448 goto find_free_id;
449 #if IS_ENABLED(CONFIG_NF_CT_PROTO_GRE)
450 case IPPROTO_GRE:
451 /* If there is no master conntrack we are not PPTP,
452 do not change tuples */
453 if (!ct->master)
454 return;
455
456 if (maniptype == NF_NAT_MANIP_SRC)
457 keyptr = &tuple->src.u.gre.key;
458 else
459 keyptr = &tuple->dst.u.gre.key;
460
461 if (!(range->flags & NF_NAT_RANGE_PROTO_SPECIFIED)) {
462 min = 1;
463 range_size = 65535;
464 } else {
465 min = ntohs(range->min_proto.gre.key);
466 range_size = ntohs(range->max_proto.gre.key) - min + 1;
467 }
468 goto find_free_id;
469 #endif
470 case IPPROTO_UDP:
471 case IPPROTO_UDPLITE:
472 case IPPROTO_TCP:
473 case IPPROTO_SCTP:
474 case IPPROTO_DCCP:
475 if (maniptype == NF_NAT_MANIP_SRC)
476 keyptr = &tuple->src.u.all;
477 else
478 keyptr = &tuple->dst.u.all;
479
480 break;
481 default:
482 return;
483 }
484
485 if (range->flags & NF_NAT_RANGE_PSID) {
486 /* Find the non-PSID parts of the port.
487 * To do this we look for an unused port that is
488 * comprised of [t_chunk|PSID|b_chunk]. The size of
489 * these pieces is defined by the psid_length and
490 * offset.
491 */
492 int m = 16 - range->min_proto.psid.psid_length -
493 range->min_proto.psid.offset;
494 int available;
495 int range_count = ((1 << range->min_proto.psid.offset) - 1);
496
497 /* Calculate the size of the bottom block */
498 range_size = (1 << m);
499
500 /* Calculate the total IDs to check */
501 available = range_size * range_count;
502 if (!available)
503 available = range_size;
504
505 off = ntohs(*keyptr);
506 for (i = 0;; ++off) {
507 int b_chunk = off % range_size;
508 int t_chunk = 0;
509
510 /* Move up to avoid the all-zeroes reserved chunk
511 * (if there is one).
512 */
513 if (range->min_proto.psid.offset > 0) {
514 t_chunk = (off >> m) % range_count;
515 ++t_chunk;
516 t_chunk <<= (m +
517 range->min_proto.psid.psid_length);
518 }
519
520 *keyptr = htons(t_chunk |
521 (range->min_proto.psid.psid << m)
522 | b_chunk);
523
524 if (++i >= available || !nf_nat_used_tuple(tuple, ct))
525 return;
526 }
527 }
528
529 /* If no range specified... */
530 if (!(range->flags & NF_NAT_RANGE_PROTO_SPECIFIED)) {
531 /* If it's dst rewrite, can't change port */
532 if (maniptype == NF_NAT_MANIP_DST)
533 return;
534
535 if (ntohs(*keyptr) < 1024) {
536 /* Loose convention: >> 512 is credential passing */
537 if (ntohs(*keyptr) < 512) {
538 min = 1;
539 range_size = 511 - min + 1;
540 } else {
541 min = 600;
542 range_size = 1023 - min + 1;
543 }
544 } else {
545 min = 1024;
546 range_size = 65535 - 1024 + 1;
547 }
548 } else {
549 min = ntohs(range->min_proto.all);
550 max = ntohs(range->max_proto.all);
551 if (unlikely(max < min))
552 swap(max, min);
553 range_size = max - min + 1;
554 }
555
556 find_free_id:
557 if (range->flags & NF_NAT_RANGE_PROTO_OFFSET)
558 off = (ntohs(*keyptr) - ntohs(range->base_proto.all));
559 else
560 off = prandom_u32();
561
562 attempts = range_size;
563 if (attempts > max_attempts)
564 attempts = max_attempts;
565
566 /* We are in softirq; doing a search of the entire range risks
567 * soft lockup when all tuples are already used.
568 *
569 * If we can't find any free port from first offset, pick a new
570 * one and try again, with ever smaller search window.
571 */
572 another_round:
573 for (i = 0; i < attempts; i++, off++) {
574 *keyptr = htons(min + off % range_size);
575 if (!nf_nat_used_tuple(tuple, ct))
576 return;
577 }
578
579 if (attempts >= range_size || attempts < 16)
580 return;
581 attempts /= 2;
582 off = prandom_u32();
583 goto another_round;
584 }
585
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org