Re: Byte order for conntrack fields over netlink

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jan,

But we don't send everything from kernel to userspace in network byte
order. Even on netlink I see some fields are sent in host byte order.
I see this specifically with conntrack fields that most of all are
sent in network byte order to userspace. Are you referring to
consistency with userspace for conntrack fields ( conntrack tools in
this case)?

Even with the conntrack I do see at least one field (id / CTA_ID)
which is sent in host order as well.

static int ctnetlink_dump_id(struct sk_buff *skb, const struct nf_conn *ct)
{
__be32 id = (__force __be32)nf_ct_get_id(ct);

if (nla_put_be32(skb, CTA_ID, id))
...
}

I don't see ntohl being done for this field.

Thanks,
Vimal

On Thu, Feb 20, 2025 at 1:33 PM Jan Engelhardt <ej@xxxxxxx> wrote:
>
> On Thursday 2025-02-20 07:03, Vimal Agrawal wrote:
>
> >Hi netfilter team,
> >
> >Why are all conntrack related fields converted from host to network
> >byte order by kernel before sending it to userspace over netlink and
> >again from network to host by
> >conntrack tools ( even though most fields are not related to network)?
> >I am referring to packet exchange during commands e.g. conntrack -L
> >etc.
> >
> >Is there any good reason for these conversions?
>
> To be consistent with the rest of networking (IP addresses are also
> passed MSB-first), which goes back to RFC 1700 and
> https://www.rfc-editor.org/ien/ien137.txt .





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux