* [PATCH net] ipv6: Fix getsockopt() for sockets with default IPV6_AUTOFLOWLABEL
@ 2018-01-22 20:06 Ben Hutchings
2018-01-24 0:55 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2018-01-22 20:06 UTC (permalink / raw)
To: David S. Miller; +Cc: Alexey Kuznetsov, Hideaki YOSHIFUJI, netdev
Commit 513674b5a2c9 ("net: reevalulate autoflowlabel setting after
sysctl setting") removed the initialisation of
ipv6_pinfo::autoflowlabel and added a second flag to indicate
whether this field or the net namespace default should be used.
The getsockopt() handling for this case was not updated, so it
currently returns 0 for all sockets for which IPV6_AUTOFLOWLABEL is
not explicitly enabled. Fix it to return the effective value, whether
that has been set at the socket or net namespace level.
Fixes: 513674b5a2c9 ("net: reevalulate autoflowlabel setting after sysctl ...")
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
---
This will need to go to stable, as the earlier commit did.
Ben.
include/net/ipv6.h | 1 +
net/ipv6/ip6_output.c | 2 +-
net/ipv6/ipv6_sockglue.c | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index f73797e2fa60..221238254eb7 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -331,6 +331,7 @@ int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq,
int flags);
int ip6_flowlabel_init(void);
void ip6_flowlabel_cleanup(void);
+bool ip6_autoflowlabel(struct net *net, const struct ipv6_pinfo *np);
static inline void fl6_sock_release(struct ip6_flowlabel *fl)
{
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 688ba5f7516b..08446e0ca411 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -166,7 +166,7 @@ int ip6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
!(IP6CB(skb)->flags & IP6SKB_REROUTED));
}
-static bool ip6_autoflowlabel(struct net *net, const struct ipv6_pinfo *np)
+bool ip6_autoflowlabel(struct net *net, const struct ipv6_pinfo *np)
{
if (!np->autoflowlabel_set)
return ip6_default_np_autolabel(net);
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 2d4680e0376f..e8ffb5b5d84e 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -1336,7 +1336,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
break;
case IPV6_AUTOFLOWLABEL:
- val = np->autoflowlabel;
+ val = ip6_autoflowlabel(sock_net(sk), np);
break;
case IPV6_RECVFRAGSIZE:
--
2.15.0.rc0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] ipv6: Fix getsockopt() for sockets with default IPV6_AUTOFLOWLABEL
2018-01-22 20:06 [PATCH net] ipv6: Fix getsockopt() for sockets with default IPV6_AUTOFLOWLABEL Ben Hutchings
@ 2018-01-24 0:55 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-01-24 0:55 UTC (permalink / raw)
To: ben.hutchings; +Cc: kuznet, yoshfuji, netdev
From: Ben Hutchings <ben.hutchings@codethink.co.uk>
Date: Mon, 22 Jan 2018 20:06:42 +0000
> Commit 513674b5a2c9 ("net: reevalulate autoflowlabel setting after
> sysctl setting") removed the initialisation of
> ipv6_pinfo::autoflowlabel and added a second flag to indicate
> whether this field or the net namespace default should be used.
>
> The getsockopt() handling for this case was not updated, so it
> currently returns 0 for all sockets for which IPV6_AUTOFLOWLABEL is
> not explicitly enabled. Fix it to return the effective value, whether
> that has been set at the socket or net namespace level.
>
> Fixes: 513674b5a2c9 ("net: reevalulate autoflowlabel setting after sysctl ...")
> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
> ---
> This will need to go to stable, as the earlier commit did.
Applied and queued up for -stable, thanks Ben.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-24 0:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-22 20:06 [PATCH net] ipv6: Fix getsockopt() for sockets with default IPV6_AUTOFLOWLABEL Ben Hutchings
2018-01-24 0:55 ` David Miller
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).