OSDN Git Service

netlink: introduce NLA_POLICY_MAX_BE
authorFlorian Westphal <fw@strlen.de>
Mon, 5 Sep 2022 10:09:36 +0000 (12:09 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 7 Sep 2022 11:33:43 +0000 (12:33 +0100)
commit08724ef69907214ce622344fe4945412e38368f0
tree5c18735ab7ac018a60c46c9f6b415ec553ea0a89
parent98ba81081b429d147c0230f59a999aa80d0b9d33
netlink: introduce NLA_POLICY_MAX_BE

netlink allows to specify allowed ranges for integer types.
Unfortunately, nfnetlink passes integers in big endian, so the existing
NLA_POLICY_MAX() cannot be used.

At the moment, nfnetlink users, such as nf_tables, need to resort to
programmatic checking via helpers such as nft_parse_u32_check().

This is both cumbersome and error prone.  This adds NLA_POLICY_MAX_BE
which adds range check support for BE16, BE32 and BE64 integers.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/netlink.h
lib/nlattr.c