mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
netlink: specs: tcp_metrics: fix the attribute length checks
TCP_FASTOPEN_COOKIE_MAX is the longest cookie we accept, not the shortest one. Cookies are even sized, from 4 bytes up, and the ones Linux itself generates are 8 bytes, so a 16 byte minimum declares all but the longest cookie invalid. The reference policy kept under #if 0 in tcp_metrics.c spells it as a maximum, which is what .len means for NLA_BINARY. The IPv6 addresses err the other way. The policy uses NLA_POLICY_EXACT_LEN() for both, so a request carrying a longer address is rejected with -ERANGE, even though the spec advertises 16 bytes as a mere minimum. Were the policy generated from this spec, as kernel-policy: global promises, the check would turn into NLA_POLICY_MIN_LEN() and start accepting over-long addresses, of which nla_get_in6_addr() would take the first 16 bytes. Nothing generated changes. fopen-cookie is reply-only so it never gets a policy entry, and exact-len only feeds the policy (and the fixed size array form, which needs a sub-type). Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn> Link: https://patch.msgid.link/20260912234337.308298-1-kuba@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
e8c06b8952
commit
4358a3e8e7
|
|
@ -32,7 +32,7 @@ attribute-sets:
|
|||
name: addr-ipv6
|
||||
type: binary
|
||||
checks:
|
||||
min-len: 16
|
||||
exact-len: 16
|
||||
byte-order: big-endian
|
||||
display-hint: ipv6
|
||||
-
|
||||
|
|
@ -63,7 +63,7 @@ attribute-sets:
|
|||
name: fopen-cookie
|
||||
type: binary
|
||||
checks:
|
||||
min-len: tcp-fastopen-cookie-max
|
||||
max-len: tcp-fastopen-cookie-max
|
||||
-
|
||||
name: saddr-ipv4
|
||||
type: u32
|
||||
|
|
@ -73,7 +73,7 @@ attribute-sets:
|
|||
name: saddr-ipv6
|
||||
type: binary
|
||||
checks:
|
||||
min-len: 16
|
||||
exact-len: 16
|
||||
byte-order: big-endian
|
||||
display-hint: ipv6
|
||||
-
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user