tcp: Fix build break when CONFIG_IPV6=n
Subsystems (3)
PATCH 1/1 tcp: Fix build break when CONFIG_IPV6=n
From: Saeed Mahameed <[email protected]>
The cited commit caused the following build break when CONFIG_IPV6 was disabled
net/ipv4/tcp_input.c: In function ‘tcp_syn_flood_action’:include/net/sock.h:387:37: error: ‘const struct sock_common’ has no member named ‘skc_v6_rcv_saddr’; did you mean ‘skc_rcv_saddr’?
Fix by using inet6_rcv_saddr() macro which handles this situation nicely.
--- net/ipv4/tcp_input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/tcp_input.c +2 -2
@@ -6843,9 +6843,9 @@ static bool tcp_syn_flood_action(const struct sock *sk, const char *proto)if (!READ_ONCE (queue->synflood_warned) && syncookies !=2 &&xchg (&queue->synflood_warned,1 ) ==0 ) { -if (IS_ENABLED (CONFIG_IPV6 ) && sk->sk_family ==AF_INET6 ) { +if (sk->sk_family ==AF_INET6 ) {net_info_ratelimited ("%s: Possible SYN flooding on port [%pI6c]:%u. %s.\n" , - proto, &sk->sk_v6_rcv_saddr, + proto,inet6_rcv_saddr (sk), sk->sk_num, msg); }else { net_info_ratelimited("%s: Possible SYN flooding on port %pI4:%u. %s.\n",
Signature · 1 line
2.38.1
Hi Saeed,
Quoted 5 lines · Saeed Mahameed
From: Saeed Mahameed <[email protected]>
The cited commit caused the following build break when
CONFIG_IPV6was disabled
Quoted 8 lines
net/ipv4/tcp_input.c: In function ‘tcp_syn_flood_action’:include/net/sock.h:387:37: error: ‘const struct sock_common’ has no member named ‘skc_v6_rcv_saddr’; did you mean ‘skc_rcv_saddr’?Fix by using
inet6_rcv_saddr()macro which handles this situation nicely.Fixes d9282e48c608 ("tcp: Add listening address to SYN flood message")Signed-off-by Saeed Mahameed <[email protected]>
Thanks for your patch!
net/ipv4/tcp_input.c static bool tcp_syn_flood_action(const struct sock *sk, const char *proto) · line 6846
Quoted 8 lines
net/ipv4/tcp_input.c +1
-1@@ -6843,9 +6843,9 @@ static bool tcp_syn_flood_action(const struct sock *sk, const char *proto)if (!READ_ONCE (queue->synflood_warned) && syncookies !=2 &&xchg (&queue->synflood_warned,1 ) ==0 ) { -if (IS_ENABLED (CONFIG_IPV6 ) && sk->sk_family ==AF_INET6 ) { +if (sk->sk_family ==AF_INET6 ) {
I think the IS_ENABLED() should stay, to make sure the IPV6-only code is optimized away when IPv6-support is disabled.
net/ipv4/tcp_input.c static bool tcp_syn_flood_action(const struct sock *sk, const char *proto) · line 6851
Quoted 6 lines
net/ipv4/tcp_input.c +1
-1net_info_ratelimited ("%s: Possible SYN flooding on port [%pI6c]:%u. %s.\n" , - proto, &sk->sk_v6_rcv_saddr, + proto,inet6_rcv_saddr (sk), sk->sk_num, msg); }else { net_info_ratelimited("%s: Possible SYN flooding on port %pI4:%u. %s.\n",
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 24 lines · Geert Uytterhoeven
Hi Saeed,
Quoted 5 lines · Saeed Mahameed
From: Saeed Mahameed <[email protected]>
The cited commit caused the following build break when
CONFIG_IPV6was disabledQuoted 8 lines
net/ipv4/tcp_input.c: In function ‘tcp_syn_flood_action’:include/net/sock.h:387:37: error: ‘const struct sock_common’ has no member named ‘skc_v6_rcv_saddr’; did you mean ‘skc_rcv_saddr’?Fix by using
inet6_rcv_saddr()macro which handles this situation nicely.Fixes d9282e48c608 ("tcp: Add listening address to SYN flood message")Signed-off-by Saeed Mahameed <[email protected]>Thanks for your patch!
Quoted 4 lines
net/ipv4/tcp_input.c +0
-0@@ -6843,9 +6843,9 @@ static bool tcp_syn_flood_action(const struct sock *sk, const char *proto)
Quoted 7 lines
net/ipv4/tcp_input.c static bool tcp_syn_flood_action(const struct sock *sk, const char *proto) · line 6846
Quoted 4 lines
net/ipv4/tcp_input.c +1
-1if (!READ_ONCE (queue->synflood_warned) && syncookies !=2 &&xchg (&queue->synflood_warned,1 ) ==0 ) { -if (IS_ENABLED (CONFIG_IPV6 ) && sk->sk_family ==AF_INET6 ) { +if (sk->sk_family ==AF_INET6 ) {I think the
IS_ENABLED()should stay, to make sure the IPV6-only code is optimized away when IPv6-support is disabled.
Agreed.
Quoted 33 lines · Eric Dumazet
Quoted 24 lines · Geert Uytterhoeven
Hi Saeed,
Quoted 5 lines · Saeed Mahameed
From: Saeed Mahameed <[email protected]>
The cited commit caused the following build break when
CONFIG_IPV6was disabledQuoted 8 lines
net/ipv4/tcp_input.c: In function ‘tcp_syn_flood_action’:include/net/sock.h:387:37: error: ‘const struct sock_common’ has no member named ‘skc_v6_rcv_saddr’; did you mean ‘skc_rcv_saddr’?Fix by using
inet6_rcv_saddr()macro which handles this situation nicely.Fixes d9282e48c608 ("tcp: Add listening address to SYN flood message")Signed-off-by Saeed Mahameed <[email protected]>Thanks for your patch!
Quoted 4 lines
net/ipv4/tcp_input.c +0
-0@@ -6843,9 +6843,9 @@ static bool tcp_syn_flood_action(const struct sock *sk, const char *proto)Quoted 7 lines
net/ipv4/tcp_input.c static bool tcp_syn_flood_action(const struct sock *sk, const char *proto) · line 6846
Quoted 4 lines
net/ipv4/tcp_input.c +1
-1if (!READ_ONCE (queue->synflood_warned) && syncookies !=2 &&xchg (&queue->synflood_warned,1 ) ==0 ) { -if (IS_ENABLED (CONFIG_IPV6 ) && sk->sk_family ==AF_INET6 ) { +if (sk->sk_family ==AF_INET6 ) {I think the
IS_ENABLED()should stay, to make sure the IPV6-only code is optimized away when IPv6-support is disabled.
Quoted 1 line
Agreed.
sending V2.
but for the record, I don't think such a user exist. Simply if you care about such micro optimization, then you are serious enough not to disable IPv6.
Hi Saeed,
Quoted 31 lines · Saeed Mahameed
Quoted 30 lines · Eric Dumazet
Quoted 28 lines · Geert Uytterhoeven
Quoted 5 lines · Saeed Mahameed
From: Saeed Mahameed <[email protected]>
The cited commit caused the following build break when
CONFIG_IPV6was disabledQuoted 8 lines
net/ipv4/tcp_input.c: In function ‘tcp_syn_flood_action’:include/net/sock.h:387:37: error: ‘const struct sock_common’ has no member named ‘skc_v6_rcv_saddr’; did you mean ‘skc_rcv_saddr’?Fix by using
inet6_rcv_saddr()macro which handles this situation nicely.Fixes d9282e48c608 ("tcp: Add listening address to SYN flood message")Signed-off-by Saeed Mahameed <[email protected]>Thanks for your patch!
net/ipv4/tcp_input.c static bool tcp_syn_flood_action(const struct sock *sk, const char *proto) · line 6846
Quoted 8 lines
net/ipv4/tcp_input.c +1
-1@@ -6843,9 +6843,9 @@ static bool tcp_syn_flood_action(const struct sock *sk, const char *proto)if (!READ_ONCE (queue->synflood_warned) && syncookies !=2 &&xchg (&queue->synflood_warned,1 ) ==0 ) { -if (IS_ENABLED (CONFIG_IPV6 ) && sk->sk_family ==AF_INET6 ) { +if (sk->sk_family ==AF_INET6 ) {I think the
IS_ENABLED()should stay, to make sure the IPV6-only code is optimized away when IPv6-support is disabled.
Quoted 7 lines
Quoted 1 line
Agreed.
sending V2.
but for the record, I don't think such a user exist. Simply if you care about such micro optimization, then you are serious enough not to disable IPv6.
Sure we do. It's not a micro-optimization, as it gets rid of a printed string. Several defconfig disable CONFIG_IPV6. People who disable IPv6 because of limited memory welcome the removal of such unused code.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds