[PATCH] wg: correct type for CTRL_ATTR_FAMILY_ID
Jason A. Donenfeld
Jason at zx2c4.com
Tue Oct 31 10:19:23 CET 2017
Hey Jórg,
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] = {
[CTRL_ATTR_FAMILY_ID] = { .type = 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/tree/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 at mellanox.com, stephen at networkplumber.org, and
netdev at vger.kernel.org, and put me in the CC.
Thanks,
Jason
On Tue, Oct 31, 2017 at 9:55 AM, Jörg Thalheim <joerg at thalheim.io> wrote:
> Signed-off-by: Joerg Thalheim <joerg at 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
>
> _______________________________________________
> WireGuard mailing list
> WireGuard at lists.zx2c4.com
> https://lists.zx2c4.com/mailman/listinfo/wireguard
More information about the WireGuard
mailing list