netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] tcp: Fix build break when CONFIG_IPV6=n
@ 2022-11-22  9:31 Saeed Mahameed
  2022-11-22  9:37 ` Geert Uytterhoeven
  0 siblings, 1 reply; 5+ messages in thread
From: Saeed Mahameed @ 2022-11-22  9:31 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: Saeed Mahameed, netdev, Tariq Toukan, Geert Uytterhoeven,
	Matthieu Baerts, Jamie Bainbridge

From: Saeed Mahameed <saeedm@nvidia.com>

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.

Fixes: d9282e48c608 ("tcp: Add listening address to SYN flood message")
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
CC: Matthieu Baerts <matthieu.baerts@tessares.net>
CC: Jamie Bainbridge <jamie.bainbridge@gmail.com>
---
 net/ipv4/tcp_input.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 0ae291e53eab..f8548a57a17a 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -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",
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] tcp: Fix build break when CONFIG_IPV6=n
  2022-11-22  9:31 [PATCH net-next] tcp: Fix build break when CONFIG_IPV6=n Saeed Mahameed
@ 2022-11-22  9:37 ` Geert Uytterhoeven
  2022-11-22 16:42   ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2022-11-22  9:37 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	Saeed Mahameed, netdev, Tariq Toukan, Geert Uytterhoeven,
	Matthieu Baerts, Jamie Bainbridge

Hi Saeed,

On Tue, Nov 22, 2022 at 10:31 AM Saeed Mahameed <saeed@kernel.org> wrote:
> From: Saeed Mahameed <saeedm@nvidia.com>
>
> 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.
>
> Fixes: d9282e48c608 ("tcp: Add listening address to SYN flood message")
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>

Thanks for your patch!

> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -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_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 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] tcp: Fix build break when CONFIG_IPV6=n
  2022-11-22  9:37 ` Geert Uytterhoeven
@ 2022-11-22 16:42   ` Eric Dumazet
  2022-11-22 18:30     ` Saeed Mahameed
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2022-11-22 16:42 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Saeed Mahameed, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Saeed Mahameed, netdev, Tariq Toukan, Geert Uytterhoeven,
	Matthieu Baerts, Jamie Bainbridge

On Tue, Nov 22, 2022 at 1:37 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Saeed,
>
> On Tue, Nov 22, 2022 at 10:31 AM Saeed Mahameed <saeed@kernel.org> wrote:
> > From: Saeed Mahameed <saeedm@nvidia.com>
> >
> > 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.
> >
> > Fixes: d9282e48c608 ("tcp: Add listening address to SYN flood message")
> > Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
>
> Thanks for your patch!
>
> > --- a/net/ipv4/tcp_input.c
> > +++ b/net/ipv4/tcp_input.c
> > @@ -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.

Agreed.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] tcp: Fix build break when CONFIG_IPV6=n
  2022-11-22 16:42   ` Eric Dumazet
@ 2022-11-22 18:30     ` Saeed Mahameed
  2022-11-22 19:01       ` Geert Uytterhoeven
  0 siblings, 1 reply; 5+ messages in thread
From: Saeed Mahameed @ 2022-11-22 18:30 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Geert Uytterhoeven, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Saeed Mahameed, netdev, Tariq Toukan, Geert Uytterhoeven,
	Matthieu Baerts, Jamie Bainbridge

On 22 Nov 08:42, Eric Dumazet wrote:
>On Tue, Nov 22, 2022 at 1:37 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>>
>> Hi Saeed,
>>
>> On Tue, Nov 22, 2022 at 10:31 AM Saeed Mahameed <saeed@kernel.org> wrote:
>> > From: Saeed Mahameed <saeedm@nvidia.com>
>> >
>> > 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.
>> >
>> > Fixes: d9282e48c608 ("tcp: Add listening address to SYN flood message")
>> > Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
>>
>> Thanks for your patch!
>>
>> > --- a/net/ipv4/tcp_input.c
>> > +++ b/net/ipv4/tcp_input.c
>> > @@ -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.
>
>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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] tcp: Fix build break when CONFIG_IPV6=n
  2022-11-22 18:30     ` Saeed Mahameed
@ 2022-11-22 19:01       ` Geert Uytterhoeven
  0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2022-11-22 19:01 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: Eric Dumazet, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Saeed Mahameed, netdev, Tariq Toukan, Geert Uytterhoeven,
	Matthieu Baerts, Jamie Bainbridge

Hi Saeed,

On Tue, Nov 22, 2022 at 7:30 PM Saeed Mahameed <saeed@kernel.org> wrote:
> On 22 Nov 08:42, Eric Dumazet wrote:
> >On Tue, Nov 22, 2022 at 1:37 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> >> On Tue, Nov 22, 2022 at 10:31 AM Saeed Mahameed <saeed@kernel.org> wrote:
> >> > From: Saeed Mahameed <saeedm@nvidia.com>
> >> >
> >> > 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.
> >> >
> >> > Fixes: d9282e48c608 ("tcp: Add listening address to SYN flood message")
> >> > Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> >>
> >> Thanks for your patch!
> >>
> >> > --- a/net/ipv4/tcp_input.c
> >> > +++ b/net/ipv4/tcp_input.c
> >> > @@ -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.
> >
> >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 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-22 19:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22  9:31 [PATCH net-next] tcp: Fix build break when CONFIG_IPV6=n Saeed Mahameed
2022-11-22  9:37 ` Geert Uytterhoeven
2022-11-22 16:42   ` Eric Dumazet
2022-11-22 18:30     ` Saeed Mahameed
2022-11-22 19:01       ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).