[nf-next:testing 4/5] net/netfilter/nf_nat_masquerade.c:252:30: warning: variable 'newrange' set but not used

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next.git testing
head:   eb5a3496084f9a3ea3fb4c4d22b4c661d46a2743
commit: ecc701a3bd9890f83ea89337c64d4f14aba9f091 [4/5] netfilter: nf_nat: use skb_drop_reason
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20240922/202409220325.Fe1kvl39-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240922/202409220325.Fe1kvl39-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409220325.Fe1kvl39-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   net/netfilter/nf_nat_masquerade.c: In function 'nf_nat_masquerade_ipv6':
>> net/netfilter/nf_nat_masquerade.c:252:30: warning: variable 'newrange' set but not used [-Wunused-but-set-variable]
     252 |         struct nf_nat_range2 newrange;
         |                              ^~~~~~~~


vim +/newrange +252 net/netfilter/nf_nat_masquerade.c

d1aca8ab3104aa Florian Westphal 2019-02-19  243  
d1aca8ab3104aa Florian Westphal 2019-02-19  244  unsigned int
d1aca8ab3104aa Florian Westphal 2019-02-19  245  nf_nat_masquerade_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range,
d1aca8ab3104aa Florian Westphal 2019-02-19  246  		       const struct net_device *out)
d1aca8ab3104aa Florian Westphal 2019-02-19  247  {
d1aca8ab3104aa Florian Westphal 2019-02-19  248  	enum ip_conntrack_info ctinfo;
d1aca8ab3104aa Florian Westphal 2019-02-19  249  	struct nf_conn_nat *nat;
d1aca8ab3104aa Florian Westphal 2019-02-19  250  	struct in6_addr src;
d1aca8ab3104aa Florian Westphal 2019-02-19  251  	struct nf_conn *ct;
d1aca8ab3104aa Florian Westphal 2019-02-19 @252  	struct nf_nat_range2 newrange;
ecc701a3bd9890 Florian Westphal 2023-05-14  253  	int ret;
d1aca8ab3104aa Florian Westphal 2019-02-19  254  
d1aca8ab3104aa Florian Westphal 2019-02-19  255  	ct = nf_ct_get(skb, &ctinfo);
d1aca8ab3104aa Florian Westphal 2019-02-19  256  	WARN_ON(!(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED ||
d1aca8ab3104aa Florian Westphal 2019-02-19  257  			 ctinfo == IP_CT_RELATED_REPLY)));
d1aca8ab3104aa Florian Westphal 2019-02-19  258  
d1aca8ab3104aa Florian Westphal 2019-02-19  259  	if (nat_ipv6_dev_get_saddr(nf_ct_net(ct), out,
d1aca8ab3104aa Florian Westphal 2019-02-19  260  				   &ipv6_hdr(skb)->daddr, 0, &src) < 0)
ecc701a3bd9890 Florian Westphal 2023-05-14  261  		return NF_DROP_REASON(skb, SKB_DROP_REASON_NETFILTER_DROP, EADDRNOTAVAIL);
d1aca8ab3104aa Florian Westphal 2019-02-19  262  
d1aca8ab3104aa Florian Westphal 2019-02-19  263  	nat = nf_ct_nat_ext_add(ct);
d1aca8ab3104aa Florian Westphal 2019-02-19  264  	if (nat)
d1aca8ab3104aa Florian Westphal 2019-02-19  265  		nat->masq_index = out->ifindex;
d1aca8ab3104aa Florian Westphal 2019-02-19  266  
d1aca8ab3104aa Florian Westphal 2019-02-19  267  	newrange.flags		= range->flags | NF_NAT_RANGE_MAP_IPS;
d1aca8ab3104aa Florian Westphal 2019-02-19  268  	newrange.min_addr.in6	= src;
d1aca8ab3104aa Florian Westphal 2019-02-19  269  	newrange.max_addr.in6	= src;
d1aca8ab3104aa Florian Westphal 2019-02-19  270  	newrange.min_proto	= range->min_proto;
d1aca8ab3104aa Florian Westphal 2019-02-19  271  	newrange.max_proto	= range->max_proto;
d1aca8ab3104aa Florian Westphal 2019-02-19  272  
ecc701a3bd9890 Florian Westphal 2023-05-14  273  	if (ret == NF_DROP)
ecc701a3bd9890 Florian Westphal 2023-05-14  274  		return NF_DROP_REASON(skb, SKB_DROP_REASON_NETFILTER_DROP, EPERM);
ecc701a3bd9890 Florian Westphal 2023-05-14  275  
ecc701a3bd9890 Florian Westphal 2023-05-14  276  	return ret;
d1aca8ab3104aa Florian Westphal 2019-02-19  277  }
d1aca8ab3104aa Florian Westphal 2019-02-19  278  EXPORT_SYMBOL_GPL(nf_nat_masquerade_ipv6);
d1aca8ab3104aa Florian Westphal 2019-02-19  279  

:::::: The code at line 252 was first introduced by commit
:::::: d1aca8ab3104aa7131f5ab144c6f586b54df084b netfilter: nat: merge ipv4 and ipv6 masquerade functionality

:::::: TO: Florian Westphal <fw@xxxxxxxxx>
:::::: CC: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux