* [PATCH] wg: correct type for CTRL_ATTR_FAMILY_ID
@ 2017-10-31 8:55 Jörg Thalheim
2017-10-31 9:00 ` Jörg Thalheim
2017-10-31 9:19 ` Jason A. Donenfeld
0 siblings, 2 replies; 5+ messages in thread
From: Jörg Thalheim @ 2017-10-31 8:55 UTC (permalink / raw)
To: wireguard
Signed-off-by: Joerg Thalheim <joerg@thalheim.io>
---
src/tools/mnlg.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/tools/mnlg.c b/src/tools/mnlg.c
index 9135651..5ac72e2 100644
--- a/src/tools/mnlg.c
+++ b/src/tools/mnlg.c
@@ -19,7 +19,7 @@
struct mnlg_socket {
struct mnl_socket *nl;
char *buf;
- uint32_t id;
+ uint16_t id;
uint8_t version;
unsigned int seq;
unsigned int portid;
@@ -206,7 +206,7 @@ int mnlg_socket_group_add(struct mnlg_socket *nlg, const char *group_name)
nlh = __mnlg_msg_prepare(nlg, CTRL_CMD_GETFAMILY,
NLM_F_REQUEST | NLM_F_ACK, GENL_ID_CTRL, 1);
- mnl_attr_put_u32(nlh, CTRL_ATTR_FAMILY_ID, nlg->id);
+ mnl_attr_put_u16(nlh, CTRL_ATTR_FAMILY_ID, nlg->id);
err = mnlg_socket_send(nlg, nlh);
if (err < 0)
--
2.14.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wg: correct type for CTRL_ATTR_FAMILY_ID
2017-10-31 8:55 [PATCH] wg: correct type for CTRL_ATTR_FAMILY_ID Jörg Thalheim
@ 2017-10-31 9:00 ` Jörg Thalheim
2017-10-31 9:19 ` Jason A. Donenfeld
1 sibling, 0 replies; 5+ messages in thread
From: Jörg Thalheim @ 2017-10-31 9:00 UTC (permalink / raw)
To: wireguard
sorry for the duplicate messages. I had to resend this patch due wrong sender address and the resend dialog was a bit confusing.
On 2017-10-31 08:55, Jörg Thalheim wrote:
> Signed-off-by: Joerg Thalheim <joerg@thalheim.io>
> ---
> src/tools/mnlg.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/tools/mnlg.c b/src/tools/mnlg.c
> index 9135651..5ac72e2 100644
> --- a/src/tools/mnlg.c
> +++ b/src/tools/mnlg.c
> @@ -19,7 +19,7 @@
> struct mnlg_socket {
> struct mnl_socket *nl;
> char *buf;
> - uint32_t id;
> + uint16_t id;
> uint8_t version;
> unsigned int seq;
> unsigned int portid;
> @@ -206,7 +206,7 @@ int mnlg_socket_group_add(struct mnlg_socket *nlg, const char *group_name)
> nlh = __mnlg_msg_prepare(nlg, CTRL_CMD_GETFAMILY,
> NLM_F_REQUEST | NLM_F_ACK, GENL_ID_CTRL, 1);
> - mnl_attr_put_u32(nlh, CTRL_ATTR_FAMILY_ID, nlg->id);
> + mnl_attr_put_u16(nlh, CTRL_ATTR_FAMILY_ID, nlg->id);
> err = mnlg_socket_send(nlg, nlh);
> if (err < 0)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wg: correct type for CTRL_ATTR_FAMILY_ID
2017-10-31 8:55 [PATCH] wg: correct type for CTRL_ATTR_FAMILY_ID Jörg Thalheim
2017-10-31 9:00 ` Jörg Thalheim
@ 2017-10-31 9:19 ` Jason A. Donenfeld
2017-10-31 13:52 ` Jason A. Donenfeld
1 sibling, 1 reply; 5+ messages in thread
From: Jason A. Donenfeld @ 2017-10-31 9:19 UTC (permalink / raw)
To: Jörg Thalheim; +Cc: wireguard
Hey J=C3=B3rg,
Thanks for the patch. This seems correct to me. From net/netlink/genetlink.=
c:
static const struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] =3D {
[CTRL_ATTR_FAMILY_ID] =3D { .type =3D NLA_U16 },
So I'll apply it.
However, the reason it was like this is because I lifted most of that
file from iproute2:
https://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git/tre=
e/devlink/mnlg.c
I suspect the reason it's like this is because the original intention
was to use the same field for CTRL_ATTR_MCAST_GRP_ID, which eventually
got made into struct group_info instead.
Can you send this upstream too? You'll want to send it to
jiri@mellanox.com, stephen@networkplumber.org, and
netdev@vger.kernel.org, and put me in the CC.
Thanks,
Jason
On Tue, Oct 31, 2017 at 9:55 AM, J=C3=B6rg Thalheim <joerg@thalheim.io> wro=
te:
> Signed-off-by: Joerg Thalheim <joerg@thalheim.io>
> ---
> src/tools/mnlg.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/tools/mnlg.c b/src/tools/mnlg.c
> index 9135651..5ac72e2 100644
> --- a/src/tools/mnlg.c
> +++ b/src/tools/mnlg.c
> @@ -19,7 +19,7 @@
> struct mnlg_socket {
> struct mnl_socket *nl;
> char *buf;
> - uint32_t id;
> + uint16_t id;
> uint8_t version;
> unsigned int seq;
> unsigned int portid;
> @@ -206,7 +206,7 @@ int mnlg_socket_group_add(struct mnlg_socket *nlg, co=
nst char *group_name)
> nlh =3D __mnlg_msg_prepare(nlg, CTRL_CMD_GETFAMILY,
> NLM_F_REQUEST | NLM_F_ACK, GENL_ID_CTRL,=
1);
> - mnl_attr_put_u32(nlh, CTRL_ATTR_FAMILY_ID, nlg->id);
> + mnl_attr_put_u16(nlh, CTRL_ATTR_FAMILY_ID, nlg->id);
> err =3D mnlg_socket_send(nlg, nlh);
> if (err < 0)
> --
> 2.14.3
>
> _______________________________________________
> WireGuard mailing list
> WireGuard@lists.zx2c4.com
> https://lists.zx2c4.com/mailman/listinfo/wireguard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wg: correct type for CTRL_ATTR_FAMILY_ID
2017-10-31 9:19 ` Jason A. Donenfeld
@ 2017-10-31 13:52 ` Jason A. Donenfeld
2017-10-31 13:57 ` Jason A. Donenfeld
0 siblings, 1 reply; 5+ messages in thread
From: Jason A. Donenfeld @ 2017-10-31 13:52 UTC (permalink / raw)
To: Jörg Thalheim; +Cc: wireguard
This broke MIPS.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wg: correct type for CTRL_ATTR_FAMILY_ID
2017-10-31 13:52 ` Jason A. Donenfeld
@ 2017-10-31 13:57 ` Jason A. Donenfeld
0 siblings, 0 replies; 5+ messages in thread
From: Jason A. Donenfeld @ 2017-10-31 13:57 UTC (permalink / raw)
To: Jörg Thalheim; +Cc: wireguard
Ahh, looks like you forgot a few places to change, and the cast on big
endian was truncating. I rewrote the patch, rebased the branch, and
placed the final work here:
https://git.zx2c4.com/WireGuard/commit/?id=66384869d3f6e5f7a53b621901c9c7163a78855c
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-31 13:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-31 8:55 [PATCH] wg: correct type for CTRL_ATTR_FAMILY_ID Jörg Thalheim
2017-10-31 9:00 ` Jörg Thalheim
2017-10-31 9:19 ` Jason A. Donenfeld
2017-10-31 13:52 ` Jason A. Donenfeld
2017-10-31 13:57 ` Jason A. Donenfeld
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).