[PATCH] wireguard: Add netlink attrs for binding to address and netdev

kernel test robot lkp at intel.com
Tue Oct 24 18:43:26 UTC 2023


Hi Daniel,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.6-rc7 next-20231024]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Daniel-Gr-ber/wireguard-Add-netlink-attrs-for-binding-to-address-and-netdev/20231024-000158
base:   linus/master
patch link:    https://lore.kernel.org/r/20231023160006.85992-1-dxld%40darkboxed.org
patch subject: [PATCH] wireguard: Add netlink attrs for binding to address and netdev
config: um-randconfig-002-20231024 (https://download.01.org/0day-ci/archive/20231025/202310250256.kXWoLwJm-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231025/202310250256.kXWoLwJm-lkp@intel.com/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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310250256.kXWoLwJm-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/net/wireguard/netlink.c: In function 'wg_get_device_dump':
>> drivers/net/wireguard/netlink.c:247:52: error: 'struct udp_port_cfg' has no member named 'local_ip6'; did you mean 'local_ip'?
     247 |                                      &wg->port_cfg.local_ip6))
         |                                                    ^~~~~~~~~
         |                                                    local_ip
   drivers/net/wireguard/netlink.c: In function 'set_port_cfg':
   drivers/net/wireguard/netlink.c:348:34: error: 'struct udp_port_cfg' has no member named 'local_ip6'; did you mean 'local_ip'?
     348 |                         port_cfg.local_ip6 = u_addr->addr6;
         |                                  ^~~~~~~~~
         |                                  local_ip


vim +247 drivers/net/wireguard/netlink.c

   211	
   212	static int wg_get_device_dump(struct sk_buff *skb, struct netlink_callback *cb)
   213	{
   214		struct wg_peer *peer, *next_peer_cursor;
   215		struct dump_ctx *ctx = DUMP_CTX(cb);
   216		struct wg_device *wg = ctx->wg;
   217		struct nlattr *peers_nest;
   218		int ret = -EMSGSIZE;
   219		bool done = true;
   220		void *hdr;
   221	
   222		rtnl_lock();
   223		mutex_lock(&wg->device_update_lock);
   224		cb->seq = wg->device_update_gen;
   225		next_peer_cursor = ctx->next_peer;
   226	
   227		hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq,
   228				  &genl_family, NLM_F_MULTI, WG_CMD_GET_DEVICE);
   229		if (!hdr)
   230			goto out;
   231		genl_dump_check_consistent(cb, hdr);
   232	
   233		if (!ctx->next_peer) {
   234			if (nla_put_u16(skb, WGDEVICE_A_LISTEN_PORT,
   235					ntohs(wg->port_cfg.local_udp_port)) ||
   236			    nla_put_u32(skb, WGDEVICE_A_LISTEN_IFINDEX, wg->port_cfg.bind_ifindex) ||
   237			    nla_put_u32(skb, WGDEVICE_A_FWMARK, wg->fwmark) ||
   238			    nla_put_u32(skb, WGDEVICE_A_IFINDEX, wg->dev->ifindex) ||
   239			    nla_put_string(skb, WGDEVICE_A_IFNAME, wg->dev->name))
   240				goto out;
   241		        if (wg->port_cfg.family == AF_INET &&
   242			    nla_put_in_addr(skb, WGDEVICE_A_LISTEN_ADDR,
   243					    wg->port_cfg.local_ip.s_addr))
   244					goto out;
   245		        if (wg->port_cfg.family == AF_INET6 &&
   246			    nla_put_in6_addr(skb, WGDEVICE_A_LISTEN_ADDR,
 > 247					     &wg->port_cfg.local_ip6))
   248					goto out;
   249	
   250			down_read(&wg->static_identity.lock);
   251			if (wg->static_identity.has_identity) {
   252				if (nla_put(skb, WGDEVICE_A_PRIVATE_KEY,
   253					    NOISE_PUBLIC_KEY_LEN,
   254					    wg->static_identity.static_private) ||
   255				    nla_put(skb, WGDEVICE_A_PUBLIC_KEY,
   256					    NOISE_PUBLIC_KEY_LEN,
   257					    wg->static_identity.static_public)) {
   258					up_read(&wg->static_identity.lock);
   259					goto out;
   260				}
   261			}
   262			up_read(&wg->static_identity.lock);
   263		}
   264	
   265		peers_nest = nla_nest_start(skb, WGDEVICE_A_PEERS);
   266		if (!peers_nest)
   267			goto out;
   268		ret = 0;
   269		/* If the last cursor was removed via list_del_init in peer_remove, then
   270		 * we just treat this the same as there being no more peers left. The
   271		 * reason is that seq_nr should indicate to userspace that this isn't a
   272		 * coherent dump anyway, so they'll try again.
   273		 */
   274		if (list_empty(&wg->peer_list) ||
   275		    (ctx->next_peer && list_empty(&ctx->next_peer->peer_list))) {
   276			nla_nest_cancel(skb, peers_nest);
   277			goto out;
   278		}
   279		lockdep_assert_held(&wg->device_update_lock);
   280		peer = list_prepare_entry(ctx->next_peer, &wg->peer_list, peer_list);
   281		list_for_each_entry_continue(peer, &wg->peer_list, peer_list) {
   282			if (get_peer(peer, skb, ctx)) {
   283				done = false;
   284				break;
   285			}
   286			next_peer_cursor = peer;
   287		}
   288		nla_nest_end(skb, peers_nest);
   289	
   290	out:
   291		if (!ret && !done && next_peer_cursor)
   292			wg_peer_get(next_peer_cursor);
   293		wg_peer_put(ctx->next_peer);
   294		mutex_unlock(&wg->device_update_lock);
   295		rtnl_unlock();
   296	
   297		if (ret) {
   298			genlmsg_cancel(skb, hdr);
   299			return ret;
   300		}
   301		genlmsg_end(skb, hdr);
   302		if (done) {
   303			ctx->next_peer = NULL;
   304			return 0;
   305		}
   306		ctx->next_peer = next_peer_cursor;
   307		return skb->len;
   308	
   309		/* At this point, we can't really deal ourselves with safely zeroing out
   310		 * the private key material after usage. This will need an additional API
   311		 * in the kernel for marking skbs as zero_on_free.
   312		 */
   313	}
   314	

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


More information about the WireGuard mailing list