Subject: Re: [PATCH net-next v2 14/22] ovpn: implement peer lookup logic

From: kernel test robot <[email-masked]>
Date: Wed, 6 Mar 2024 08:11:04 +0800

Hi Antonio,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Antonio-Quartulli/netlink-add-NLA_POLICY_MAX_LEN-macro/20240304-232835
base:   net-next/main
patch link:    https://lore.kernel.org/r/20240304150914.11444-15-antonio%40openvpn.net
patch subject: [PATCH net-next v2 14/22] ovpn: implement peer lookup logic
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20240306/[email-masked]/config)
compiler: sh4-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240306/[email-masked]/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 <[email-masked]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email-masked]/

All warnings (new ones prefixed by >>):

>> drivers/net/ovpn/peer.c:289: warning: Function parameter or struct member 'src' not described in 'ovpn_nexthop_lookup4'
>> drivers/net/ovpn/peer.c:289: warning: Excess function parameter 'dst' description in 'ovpn_nexthop_lookup4'
>> drivers/net/ovpn/peer.c:325: warning: Function parameter or struct member 'addr' not described in 'ovpn_nexthop_lookup6'
>> drivers/net/ovpn/peer.c:325: warning: Excess function parameter 'dst' description in 'ovpn_nexthop_lookup6'

vim +289 drivers/net/ovpn/peer.c

   275	
   276	/**
   277	 * ovpn_nexthop_lookup4() - looks up the IP of the nexthop for the given destination
   278	 *
   279	 * Looks up in the IPv4 system routing table the IP of the nexthop to be used
   280	 * to reach the destination passed as argument. If no nexthop can be found, the
   281	 * destination itself is returned as it probably has to be used as nexthop.
   282	 *
   283	 * @ovpn: the private data representing the current VPN session
   284	 * @dst: the destination to be looked up
   285	 *
   286	 * Return the IP of the next hop if found or the dst itself otherwise
   287	 */
   288	static __be32 ovpn_nexthop_lookup4(struct ovpn_struct *ovpn, __be32 src)
 > 289	{
   290		struct rtable *rt;
   291		struct flowi4 fl = {
   292			.daddr = src
   293		};
   294	
   295		rt = ip_route_output_flow(dev_net(ovpn->dev), &fl, NULL);
   296		if (IS_ERR(rt)) {
   297			net_dbg_ratelimited("%s: no nexthop found for %pI4\n", ovpn->dev->name, &src);
   298			/* if we end up here this packet is probably going to be
   299			 * thrown away later
   300			 */
   301			return src;
   302		}
   303	
   304		if (!rt->rt_uses_gateway)
   305			goto out;
   306	
   307		src = rt->rt_gw4;
   308	out:
   309		return src;
   310	}
   311	
   312	/**
   313	 * ovpn_nexthop_lookup6() - looks up the IPv6 of the nexthop for the given destination
   314	 *
   315	 * Looks up in the IPv6 system routing table the IP of the nexthop to be used
   316	 * to reach the destination passed as argument. If no nexthop can be found, the
   317	 * destination itself is returned as it probably has to be used as nexthop.
   318	 *
   319	 * @ovpn: the private data representing the current VPN session
   320	 * @dst: the destination to be looked up
   321	 *
   322	 * Return the IP of the next hop if found or the dst itself otherwise
   323	 */
   324	static struct in6_addr ovpn_nexthop_lookup6(struct ovpn_struct *ovpn, struct in6_addr addr)
 > 325	{
   326	#if IS_ENABLED(CONFIG_IPV6)
   327		struct rt6_info *rt;
   328		struct flowi6 fl = {
   329			.daddr = addr,
   330		};
   331	
   332		rt = (struct rt6_info *)ipv6_stub->ipv6_dst_lookup_flow(dev_net(ovpn->dev), NULL, &fl,
   333									NULL);
   334		if (IS_ERR(rt)) {
   335			net_dbg_ratelimited("%s: no nexthop found for %pI6\n", ovpn->dev->name, &addr);
   336			/* if we end up here this packet is probably going to be thrown away later */
   337			return addr;
   338		}
   339	
   340		if (rt->rt6i_flags & RTF_GATEWAY)
   341			addr = rt->rt6i_gateway;
   342	
   343		dst_release((struct dst_entry *)rt);
   344	#endif
   345		return addr;
   346	}
   347	

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