Re: [PATCH nf-next,v2] netfilter: nft_fwd_netdev: allow to forward packets via neighbour layer

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

 



Hi Pablo,

I love your patch! Perhaps something to improve:

[auto build test WARNING on nf/master]
[also build test WARNING on v4.17-rc7 next-20180531]
[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/Pablo-Neira-Ayuso/netfilter-nft_fwd_netdev-allow-to-forward-packets-via-neighbour-layer/20180601-093630
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-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   net/netfilter/nft_fwd_netdev.c: In function 'nft_fwd_neigh_eval':
>> net/netfilter/nft_fwd_netdev.c:130:2: warning: 'neigh_table' may be used uninitialized in this function [-Wmaybe-uninitialized]
     neigh_xmit(neigh_table, dev, addr, skb);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/neigh_table +130 net/netfilter/nft_fwd_netdev.c

    76	
    77	static void nft_fwd_neigh_eval(const struct nft_expr *expr,
    78				      struct nft_regs *regs,
    79				      const struct nft_pktinfo *pkt)
    80	{
    81		struct nft_fwd_neigh *priv = nft_expr_priv(expr);
    82		void *addr = &regs->data[priv->sreg_addr];
    83		int oif = regs->data[priv->sreg_dev];
    84		unsigned int verdict = NF_STOLEN;
    85		struct sk_buff *skb = pkt->skb;
    86		struct net_device *dev;
    87		int neigh_table;
    88	
    89		dev = dev_get_by_index_rcu(nft_net(pkt), oif);
    90		if (dev == NULL)
    91			return;
    92	
    93		skb->dev = dev;
    94	
    95		switch (priv->nfproto) {
    96		case NFPROTO_IPV4: {
    97			struct iphdr *iph;
    98	
    99			if (skb->protocol != htons(ETH_P_IP)) {
   100				verdict = NFT_BREAK;
   101				goto out;
   102			}
   103			if (skb_try_make_writable(skb, sizeof(*iph))) {
   104				verdict = NF_DROP;
   105				goto out;
   106			}
   107			iph = ip_hdr(skb);
   108			ip_decrease_ttl(iph);
   109			neigh_table = NEIGH_ARP_TABLE;
   110			break;
   111			}
   112		case NFPROTO_IPV6: {
   113			struct ipv6hdr *ip6h;
   114	
   115			if (skb->protocol != htons(ETH_P_IPV6)) {
   116				verdict = NFT_BREAK;
   117				goto out;
   118			}
   119			if (skb_try_make_writable(skb, sizeof(*ip6h))) {
   120				verdict = NF_DROP;
   121				goto out;
   122			}
   123			ip6h = ipv6_hdr(skb);
   124			ip6h->hop_limit--;
   125			neigh_table = NEIGH_ND_TABLE;
   126			break;
   127			}
   128		}
   129	
 > 130		neigh_xmit(neigh_table, dev, addr, skb);
   131	out:
   132		regs->verdict.code = verdict;
   133	}
   134	

---
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