netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: don't warn in inet diag when IPV6 is disabled
@ 2019-07-01 15:23 Stephen Hemminger
  2019-07-02 21:23 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2019-07-01 15:23 UTC (permalink / raw)
  To: davem, kuznet, yoshfuji; +Cc: netdev, Stephen Hemminger

If IPV6 was disabled, then ss command would cause a kernel warning
because the command was attempting to dump IPV6 socke information.
This should not be a warning, instead just return a normal error
code.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202249
Fixes: 432490f9d455 ("net: ip, diag -- Add diag interface for raw sockets")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 net/ipv4/raw_diag.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/raw_diag.c b/net/ipv4/raw_diag.c
index 899e34ceb560..045485d39f23 100644
--- a/net/ipv4/raw_diag.c
+++ b/net/ipv4/raw_diag.c
@@ -19,9 +19,11 @@ raw_get_hashinfo(const struct inet_diag_req_v2 *r)
 {
 	if (r->sdiag_family == AF_INET) {
 		return &raw_v4_hashinfo;
-#if IS_ENABLED(CONFIG_IPV6)
 	} else if (r->sdiag_family == AF_INET6) {
+#if IS_ENABLED(CONFIG_IPV6)
 		return &raw_v6_hashinfo;
+#else
+		return ERR_PTR(-EOPNOTSUPP);
 #endif
 	} else {
 		pr_warn_once("Unexpected inet family %d\n",
-- 
2.20.1


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

* Re: [PATCH net] net: don't warn in inet diag when IPV6 is disabled
  2019-07-01 15:23 [PATCH net] net: don't warn in inet diag when IPV6 is disabled Stephen Hemminger
@ 2019-07-02 21:23 ` David Miller
  2019-07-02 22:14   ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2019-07-02 21:23 UTC (permalink / raw)
  To: stephen; +Cc: kuznet, yoshfuji, netdev

From: Stephen Hemminger <stephen@networkplumber.org>
Date: Mon,  1 Jul 2019 08:23:03 -0700

> @@ -19,9 +19,11 @@ raw_get_hashinfo(const struct inet_diag_req_v2 *r)
>  {
>  	if (r->sdiag_family == AF_INET) {
>  		return &raw_v4_hashinfo;
> -#if IS_ENABLED(CONFIG_IPV6)
>  	} else if (r->sdiag_family == AF_INET6) {
> +#if IS_ENABLED(CONFIG_IPV6)
>  		return &raw_v6_hashinfo;
> +#else
> +		return ERR_PTR(-EOPNOTSUPP);
>  #endif
>  	} else {
>  		pr_warn_once("Unexpected inet family %d\n",

Let's make some consistency in this area please.

The inet_diag code returns -EINVAL, and that's been that way forever.
It also doesn't print a weird warning for unexpected sdiag_family
values outside of AF_INET and AF_INET6.

That's been that way for so long that's probably the behavior to
revolve everything around.

Therefore, please just get rid of the warning message instead of
all of these other changes.

Thank you.

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

* Re: [PATCH net] net: don't warn in inet diag when IPV6 is disabled
  2019-07-02 21:23 ` David Miller
@ 2019-07-02 22:14   ` Stephen Hemminger
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2019-07-02 22:14 UTC (permalink / raw)
  To: David Miller; +Cc: kuznet, yoshfuji, netdev

On Tue, 02 Jul 2019 14:23:47 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> From: Stephen Hemminger <stephen@networkplumber.org>
> Date: Mon,  1 Jul 2019 08:23:03 -0700
> 
> > @@ -19,9 +19,11 @@ raw_get_hashinfo(const struct inet_diag_req_v2 *r)
> >  {
> >  	if (r->sdiag_family == AF_INET) {
> >  		return &raw_v4_hashinfo;
> > -#if IS_ENABLED(CONFIG_IPV6)
> >  	} else if (r->sdiag_family == AF_INET6) {
> > +#if IS_ENABLED(CONFIG_IPV6)
> >  		return &raw_v6_hashinfo;
> > +#else
> > +		return ERR_PTR(-EOPNOTSUPP);
> >  #endif
> >  	} else {
> >  		pr_warn_once("Unexpected inet family %d\n",  
> 
> Let's make some consistency in this area please.
> 
> The inet_diag code returns -EINVAL, and that's been that way forever.
> It also doesn't print a weird warning for unexpected sdiag_family
> values outside of AF_INET and AF_INET6.
> 
> That's been that way for so long that's probably the behavior to
> revolve everything around.
> 
> Therefore, please just get rid of the warning message instead of
> all of these other changes.
> 
> Thank you.

Sure, that makes sense.

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

end of thread, other threads:[~2019-07-03  1:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-01 15:23 [PATCH net] net: don't warn in inet diag when IPV6 is disabled Stephen Hemminger
2019-07-02 21:23 ` David Miller
2019-07-02 22:14   ` Stephen Hemminger

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).