Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

netlink: add NLA_POLICY_MAX_LEN macro

Similarly to NLA_POLICY_MIN_LEN, NLA_POLICY_MAX_LEN defines a policy
with a maximum length value.

The netlink generator for YAML specs has been extended accordingly.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://patch.msgid.link/20241029-b4-ovpn-v11-1-de4698c73a25@openvpn.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Antonio Quartulli and committed by
Jakub Kicinski
4138e9ec bd50c412

+4 -1
+1
include/net/netlink.h
··· 469 469 .max = _len \ 470 470 } 471 471 #define NLA_POLICY_MIN_LEN(_len) NLA_POLICY_MIN(NLA_BINARY, _len) 472 + #define NLA_POLICY_MAX_LEN(_len) NLA_POLICY_MAX(NLA_BINARY, _len) 472 473 473 474 /** 474 475 * struct nl_info - netlink source information
+3 -1
tools/net/ynl/ynl-gen-c.py
··· 481 481 pass 482 482 elif len(self.checks) == 1: 483 483 check_name = list(self.checks)[0] 484 - if check_name not in {'exact-len', 'min-len'}: 484 + if check_name not in {'exact-len', 'min-len', 'max-len'}: 485 485 raise Exception('Unsupported check for binary type: ' + check_name) 486 486 else: 487 487 raise Exception('More than one check for binary type not implemented, yet') ··· 492 492 mem = 'NLA_POLICY_EXACT_LEN(' + self.get_limit_str('exact-len') + ')' 493 493 elif 'min-len' in self.checks: 494 494 mem = '{ .len = ' + self.get_limit_str('min-len') + ', }' 495 + elif 'max-len' in self.checks: 496 + mem = 'NLA_POLICY_MAX_LEN(' + self.get_limit_str('max-len') + ')' 495 497 496 498 return mem 497 499