net: don't warn in inet diag when IPV6 is disabled
Subsystems (2)
PATCH 1/1 net: don't warn in inet diag when IPV6 is disabled
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
--- net/ipv4/raw_diag.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/raw_diag.c +3 -1
@@ -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",
Signature · 1 line
2.20.1
Quoted 23 lines · On Tue, 02 Jul 2019 14:23:47 -0700 (PDT) David Miller <[email protected]>…
From: Stephen Hemminger <[email protected]>
Date: Mon, 1 Jul 2019 08:23:03 -0700net/ipv4/raw_diag.c raw_get_hashinfo(const struct inet_diag_req_v2 *r) · line 29
Quoted 13 lines
net/ipv4/raw_diag.c +3
-1@@ -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_diagcode returns-EINVAL, and that's been that way forever. It also doesn't print a weird warning for unexpectedsdiag_familyvalues outside ofAF_INETandAF_INET6.
Quoted 7 lines
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.
David Miller
maintainerFrom: Stephen Hemminger <[email protected]>
Date: Mon, 1 Jul 2019 08:23:03 -0700
net/ipv4/raw_diag.c raw_get_hashinfo(const struct inet_diag_req_v2 *r) · line 29
Quoted 13 lines
net/ipv4/raw_diag.c +3
-1@@ -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.