Re: [PATCH net] netlink: specs: mptcp: fix port endianness

From: Matthieu Baerts
Date: Wed Sep 11 2024 - 11:08:09 EST


Hi Asbjørn,

On 11/09/2024 11:10, Asbjørn Sloth Tønnesen wrote:
> The MPTCP port attribute is in host endianness, but was documented
> as big-endian in the ynl specification.
>
> Below are two examples from net/mptcp/pm_netlink.c showing that the
> attribute is converted to/from host endianness for use with netlink.
>
> Import from netlink:
> addr->port = htons(nla_get_u16(tb[MPTCP_PM_ADDR_ATTR_PORT]))
>
> Export to netlink:
> nla_put_u16(skb, MPTCP_PM_ADDR_ATTR_PORT, ntohs(addr->port))
>
> Where addr->port is defined as __be16.
>
> No functional change intended.

Good catch. Indeed, this port attribute is supposed to be in host
endianness.

Reviewed-by: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>

This patch can be applied in netdev directly.

Cheers,
Matt
--
Sponsored by the NGI0 Core fund.