wireguard.lists.zx2c4.com archive mirror
 help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: Working on change for: genetlink: make policy common to family
Date: Wed, 15 May 2019 06:33:25 -0500	[thread overview]
Message-ID: <20190515113325.GA13034@wolff.to> (raw)
In-Reply-To: <20190515111830.GB12769@wolff.to>

[-- Attachment #1: Type: text/plain, Size: 405 bytes --]

On Wed, May 15, 2019 at 06:18:30 -0500,
  Bruno Wolff III <bruno@wolff.to> wrote:
>Now I'm looking at: f6ad55a6a184ebdf3d98a90eab0895f73ce9797e Merge 
>branch 'nla_nest_start', which looks like it might also cause a 
>problem.

Changing nla_nest_start to nla_nest_start_noflag didn't seem to help.

In case anyone else is working on getting wireguard to work with 5.2, 
I'm attaching my latest test diff.

[-- Attachment #2: test.diff --]
[-- Type: text/plain, Size: 3014 bytes --]

diff --git a/src/netlink.c b/src/netlink.c
index b179b3184725..dd46487e0888 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -74,7 +74,7 @@ static int get_allowedips(struct sk_buff *skb, const u8 *ip, u8 cidr,
 {
 	struct nlattr *allowedip_nest;
 
-	allowedip_nest = nla_nest_start(skb, 0);
+	allowedip_nest = nla_nest_start_noflag(skb, 0);
 	if (!allowedip_nest)
 		return -EMSGSIZE;
 
@@ -94,7 +94,7 @@ static int
 get_peer(struct wg_peer *peer, struct allowedips_node **next_allowedips_node,
 	 u64 *allowedips_seq, struct sk_buff *skb)
 {
-	struct nlattr *allowedips_nest, *peer_nest = nla_nest_start(skb, 0);
+	struct nlattr *allowedips_nest, *peer_nest = nla_nest_start_noflag(skb, 0);
 	struct allowedips_node *allowedips_node = *next_allowedips_node;
 	bool fail;
 
@@ -156,7 +156,7 @@ get_peer(struct wg_peer *peer, struct allowedips_node **next_allowedips_node,
 	else if (*allowedips_seq != peer->device->peer_allowedips.seq)
 		goto no_allowedips;
 
-	allowedips_nest = nla_nest_start(skb, WGPEER_A_ALLOWEDIPS);
+	allowedips_nest = nla_nest_start_noflag(skb, WGPEER_A_ALLOWEDIPS);
 	if (!allowedips_nest)
 		goto err;
 
@@ -190,7 +190,7 @@ static int wg_get_device_start(struct netlink_callback *cb)
 	struct wg_device *wg;
 	int ret;
 
-	ret = nlmsg_parse(cb->nlh, GENL_HDRLEN + genl_family.hdrsize, attrs,
+	ret = nlmsg_parse_deprecated(cb->nlh, GENL_HDRLEN + genl_family.hdrsize, attrs,
 			  genl_family.maxattr, device_policy, NULL);
 	if (ret < 0)
 		return ret;
@@ -247,7 +247,7 @@ static int wg_get_device_dump(struct sk_buff *skb, struct netlink_callback *cb)
 		up_read(&wg->static_identity.lock);
 	}
 
-	peers_nest = nla_nest_start(skb, WGDEVICE_A_PEERS);
+	peers_nest = nla_nest_start_noflag(skb, WGDEVICE_A_PEERS);
 	if (!peers_nest)
 		goto out;
 	ret = 0;
@@ -450,7 +450,7 @@ static int set_peer(struct wg_device *wg, struct nlattr **attrs)
 		int rem;
 
 		nla_for_each_nested(attr, attrs[WGPEER_A_ALLOWEDIPS], rem) {
-			ret = nla_parse_nested(allowedip, WGALLOWEDIP_A_MAX,
+			ret = nla_parse_nested_deprecated(allowedip, WGALLOWEDIP_A_MAX,
 					       attr, allowedip_policy, NULL);
 			if (ret < 0)
 				goto out;
@@ -561,7 +561,7 @@ static int wg_set_device(struct sk_buff *skb, struct genl_info *info)
 		int rem;
 
 		nla_for_each_nested(attr, info->attrs[WGDEVICE_A_PEERS], rem) {
-			ret = nla_parse_nested(peer, WGPEER_A_MAX, attr,
+			ret = nla_parse_nested_deprecated(peer, WGPEER_A_MAX, attr,
 					       peer_policy, NULL);
 			if (ret < 0)
 				goto out;
@@ -596,12 +596,10 @@ struct genl_ops genl_ops[] = {
 #endif
 		.dumpit = wg_get_device_dump,
 		.done = wg_get_device_done,
-		.policy = device_policy,
 		.flags = GENL_UNS_ADMIN_PERM
 	}, {
 		.cmd = WG_CMD_SET_DEVICE,
 		.doit = wg_set_device,
-		.policy = device_policy,
 		.flags = GENL_UNS_ADMIN_PERM
 	}
 };
@@ -617,6 +615,7 @@ __ro_after_init = {
 	.name = WG_GENL_NAME,
 	.version = WG_GENL_VERSION,
 	.maxattr = WGDEVICE_A_MAX,
+	.policy = device_policy,
 	.module = THIS_MODULE,
 	.netnsok = true
 };

[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

  reply	other threads:[~2019-05-15 11:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-13 19:52 Working on change for: genetlink: make policy common to family Bruno Wolff III
2019-05-13 20:24 ` Bruno Wolff III
2019-05-13 21:21   ` Bruno Wolff III
2019-05-14 20:50     ` Bruno Wolff III
2019-05-15 10:50       ` Bruno Wolff III
2019-05-15 11:06         ` Bruno Wolff III
2019-05-15 11:18           ` Bruno Wolff III
2019-05-15 11:33             ` Bruno Wolff III [this message]
2019-05-17 11:12               ` Jason A. Donenfeld
2019-05-17 13:36                 ` Bruno Wolff III
2019-05-19 22:26                   ` Robin Kauffman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190515113325.GA13034@wolff.to \
    --to=bruno@wolff.to \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).