net: xt_recent: fix (increase) ipv6 literal buffer length
Subsystems (3)
PATCH 1/1 net: xt_recent: fix (increase) ipv6 literal buffer length
From: Maciej Żenczykowski <[email protected]>
IPv4 in IPv6 is supported by in6_pton
(this is useful with DNS64/NAT64 networks for example):
# echo +aaaa:bbbb:cccc:dddd:eeee:ffff:1.2.3.4 > /proc/self/net/xt_recent/DEFAULT # cat /proc/self/net/xt_recent/DEFAULT src=aaaa:bbbb:cccc:dddd:eeee:ffff:0102:0304 ttl: 0 last_seen: 9733848829 oldest_pkt: 1 9733848829
but the provided buffer is too short:
# echo +aaaa:bbbb:cccc:dddd:eeee:ffff:255.255.255.255 > /proc/self/net/xt_recent/DEFAULT -bash: echo: write error: Invalid argument
--- net/netfilter/xt_recent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/xt_recent.c +1 -1
@@ -561,7 +561,7 @@ recent_mt_proc_write(struct file *file, const char __user *input, {struct recent_table *t =pde_data (file_inode (file));struct recent_entry *e; -char buf[sizeof ("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de" )]; +char buf[sizeof ("+b335:1d35:1e55:dead:c0de:1715:255.255.255.255" )];const char *c = buf;union nf_inet_addr addr = {};u_int16_t family;
Signature · 1 line
2.42.0.869.gea05f2083d-goog
Quoted 3 lines · Maciej Żenczykowski
IPv4 in IPv6 is supported by
in6_pton[...]
but the provided buffer is too short:
If in6_pton were to support tunnel traffic.. wait that sounds unusual, and would require dst to be at least 20 bytes, which the function documentation contradicts.
As the RFCs make no precise name proposition
(IPv6 Text Representation, third alternative, IPv4 "decimal value" of the "four low-order 8-bit pieces")
so let's just call it
"low-32-bit dot-decimal representation"
which should avoid the tunnel term.
Quoted 13 lines · Jan Engelhardt
Quoted 3 lines · Maciej Żenczykowski
IPv4 in IPv6 is supported by
in6_pton[...]
but the provided buffer is too short:If
in6_ptonwere to support tunnel traffic.. wait that sounds unusual, and would require dst to be at least 20 bytes, which the function documentation contradicts.As the RFCs make no precise name proposition
Quoted 8 lines
(IPv6 Text Representation, third alternative, IPv4 "decimal value" of the "four low-order 8-bit pieces")
so let's just call it
"low-32-bit dot-decimal representation"
which should avoid the tunnel term.
Resent [ https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/
], hopefully this is better.
Also:
- used your (Jan's) new email in the CC.
- changed net to netfilter in the commit title
(but as it is such a trivial bug fix, it does still feel like it
should go straight into net/main... rather than via netfilter repos)
Cheers,
Maciej