]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitd9c10ce74fcb9b002e43d511f013d96ce2f7d698
tree5c18735ab7ac018a60c46c9f6b415ec553ea0a89
parent6e59fc2a4a3fcf5cb4f568db2568d846d8464388
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