Re: [PATCH v5] netfilter : add NAT support for shifted portmap ranges

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Thierry,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on nf/master]
[also build test ERROR on v4.16 next-20180403]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Thierry-Du-Tre/netfilter-add-NAT-support-for-shifted-portmap-ranges/20180404-074845
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git master
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   net/openvswitch/conntrack.c: In function 'ovs_ct_nat_execute':
>> net/openvswitch/conntrack.c:766:29: error: passing argument 2 of 'nf_nat_setup_info' from incompatible pointer type [-Werror=incompatible-pointer-types]
        ? nf_nat_setup_info(ct, range, maniptype)
                                ^~~~~
   In file included from include/net/netfilter/nf_nat_core.h:6:0,
                    from net/openvswitch/conntrack.c:29:
   include/net/netfilter/nf_nat.h:41:14: note: expected 'const struct nf_nat_range2 *' but argument is of type 'const struct nf_nat_range *'
    unsigned int nf_nat_setup_info(struct nf_conn *ct,
                 ^~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/nf_nat_setup_info +766 net/openvswitch/conntrack.c

7f8a436e Joe Stringer        2015-08-26  705  
05752523 Jarno Rajahalme     2016-03-10  706  #ifdef CONFIG_NF_NAT_NEEDED
05752523 Jarno Rajahalme     2016-03-10  707  /* Modelled after nf_nat_ipv[46]_fn().
05752523 Jarno Rajahalme     2016-03-10  708   * range is only used for new, uninitialized NAT state.
05752523 Jarno Rajahalme     2016-03-10  709   * Returns either NF_ACCEPT or NF_DROP.
05752523 Jarno Rajahalme     2016-03-10  710   */
05752523 Jarno Rajahalme     2016-03-10  711  static int ovs_ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct,
05752523 Jarno Rajahalme     2016-03-10  712  			      enum ip_conntrack_info ctinfo,
05752523 Jarno Rajahalme     2016-03-10  713  			      const struct nf_nat_range *range,
05752523 Jarno Rajahalme     2016-03-10  714  			      enum nf_nat_manip_type maniptype)
05752523 Jarno Rajahalme     2016-03-10  715  {
05752523 Jarno Rajahalme     2016-03-10  716  	int hooknum, nh_off, err = NF_ACCEPT;
05752523 Jarno Rajahalme     2016-03-10  717  
05752523 Jarno Rajahalme     2016-03-10  718  	nh_off = skb_network_offset(skb);
75f01a4c Lance Richardson    2017-01-12  719  	skb_pull_rcsum(skb, nh_off);
05752523 Jarno Rajahalme     2016-03-10  720  
05752523 Jarno Rajahalme     2016-03-10  721  	/* See HOOK2MANIP(). */
05752523 Jarno Rajahalme     2016-03-10  722  	if (maniptype == NF_NAT_MANIP_SRC)
05752523 Jarno Rajahalme     2016-03-10  723  		hooknum = NF_INET_LOCAL_IN; /* Source NAT */
05752523 Jarno Rajahalme     2016-03-10  724  	else
05752523 Jarno Rajahalme     2016-03-10  725  		hooknum = NF_INET_LOCAL_OUT; /* Destination NAT */
05752523 Jarno Rajahalme     2016-03-10  726  
05752523 Jarno Rajahalme     2016-03-10  727  	switch (ctinfo) {
05752523 Jarno Rajahalme     2016-03-10  728  	case IP_CT_RELATED:
05752523 Jarno Rajahalme     2016-03-10  729  	case IP_CT_RELATED_REPLY:
99b7248e Arnd Bergmann       2016-03-18  730  		if (IS_ENABLED(CONFIG_NF_NAT_IPV4) &&
99b7248e Arnd Bergmann       2016-03-18  731  		    skb->protocol == htons(ETH_P_IP) &&
05752523 Jarno Rajahalme     2016-03-10  732  		    ip_hdr(skb)->protocol == IPPROTO_ICMP) {
05752523 Jarno Rajahalme     2016-03-10  733  			if (!nf_nat_icmp_reply_translation(skb, ct, ctinfo,
05752523 Jarno Rajahalme     2016-03-10  734  							   hooknum))
05752523 Jarno Rajahalme     2016-03-10  735  				err = NF_DROP;
05752523 Jarno Rajahalme     2016-03-10  736  			goto push;
99b7248e Arnd Bergmann       2016-03-18  737  		} else if (IS_ENABLED(CONFIG_NF_NAT_IPV6) &&
99b7248e Arnd Bergmann       2016-03-18  738  			   skb->protocol == htons(ETH_P_IPV6)) {
05752523 Jarno Rajahalme     2016-03-10  739  			__be16 frag_off;
05752523 Jarno Rajahalme     2016-03-10  740  			u8 nexthdr = ipv6_hdr(skb)->nexthdr;
05752523 Jarno Rajahalme     2016-03-10  741  			int hdrlen = ipv6_skip_exthdr(skb,
05752523 Jarno Rajahalme     2016-03-10  742  						      sizeof(struct ipv6hdr),
05752523 Jarno Rajahalme     2016-03-10  743  						      &nexthdr, &frag_off);
05752523 Jarno Rajahalme     2016-03-10  744  
05752523 Jarno Rajahalme     2016-03-10  745  			if (hdrlen >= 0 && nexthdr == IPPROTO_ICMPV6) {
05752523 Jarno Rajahalme     2016-03-10  746  				if (!nf_nat_icmpv6_reply_translation(skb, ct,
05752523 Jarno Rajahalme     2016-03-10  747  								     ctinfo,
05752523 Jarno Rajahalme     2016-03-10  748  								     hooknum,
05752523 Jarno Rajahalme     2016-03-10  749  								     hdrlen))
05752523 Jarno Rajahalme     2016-03-10  750  					err = NF_DROP;
05752523 Jarno Rajahalme     2016-03-10  751  				goto push;
05752523 Jarno Rajahalme     2016-03-10  752  			}
05752523 Jarno Rajahalme     2016-03-10  753  		}
05752523 Jarno Rajahalme     2016-03-10  754  		/* Non-ICMP, fall thru to initialize if needed. */
279badc2 Gustavo A. R. Silva 2017-10-19  755  		/* fall through */
05752523 Jarno Rajahalme     2016-03-10  756  	case IP_CT_NEW:
05752523 Jarno Rajahalme     2016-03-10  757  		/* Seen it before?  This can happen for loopback, retrans,
05752523 Jarno Rajahalme     2016-03-10  758  		 * or local packets.
05752523 Jarno Rajahalme     2016-03-10  759  		 */
05752523 Jarno Rajahalme     2016-03-10  760  		if (!nf_nat_initialized(ct, maniptype)) {
05752523 Jarno Rajahalme     2016-03-10  761  			/* Initialize according to the NAT action. */
05752523 Jarno Rajahalme     2016-03-10  762  			err = (range && range->flags & NF_NAT_RANGE_MAP_IPS)
05752523 Jarno Rajahalme     2016-03-10  763  				/* Action is set up to establish a new
05752523 Jarno Rajahalme     2016-03-10  764  				 * mapping.
05752523 Jarno Rajahalme     2016-03-10  765  				 */
05752523 Jarno Rajahalme     2016-03-10 @766  				? nf_nat_setup_info(ct, range, maniptype)
05752523 Jarno Rajahalme     2016-03-10  767  				: nf_nat_alloc_null_binding(ct, hooknum);
05752523 Jarno Rajahalme     2016-03-10  768  			if (err != NF_ACCEPT)
05752523 Jarno Rajahalme     2016-03-10  769  				goto push;
05752523 Jarno Rajahalme     2016-03-10  770  		}
05752523 Jarno Rajahalme     2016-03-10  771  		break;
05752523 Jarno Rajahalme     2016-03-10  772  
05752523 Jarno Rajahalme     2016-03-10  773  	case IP_CT_ESTABLISHED:
05752523 Jarno Rajahalme     2016-03-10  774  	case IP_CT_ESTABLISHED_REPLY:
05752523 Jarno Rajahalme     2016-03-10  775  		break;
05752523 Jarno Rajahalme     2016-03-10  776  
05752523 Jarno Rajahalme     2016-03-10  777  	default:
05752523 Jarno Rajahalme     2016-03-10  778  		err = NF_DROP;
05752523 Jarno Rajahalme     2016-03-10  779  		goto push;
05752523 Jarno Rajahalme     2016-03-10  780  	}
05752523 Jarno Rajahalme     2016-03-10  781  
05752523 Jarno Rajahalme     2016-03-10  782  	err = nf_nat_packet(ct, ctinfo, hooknum, skb);
05752523 Jarno Rajahalme     2016-03-10  783  push:
05752523 Jarno Rajahalme     2016-03-10  784  	skb_push(skb, nh_off);
75f01a4c Lance Richardson    2017-01-12  785  	skb_postpush_rcsum(skb, skb->data, nh_off);
05752523 Jarno Rajahalme     2016-03-10  786  
05752523 Jarno Rajahalme     2016-03-10  787  	return err;
05752523 Jarno Rajahalme     2016-03-10  788  }
05752523 Jarno Rajahalme     2016-03-10  789  

:::::: The code at line 766 was first introduced by commit
:::::: 05752523e56502cd9975aec0a2ded465d51a71f3 openvswitch: Interface with NAT.

:::::: TO: Jarno Rajahalme <jarno@xxxxxxx>
:::::: CC: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux