mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	ipv6: Fix getsockopt() for sockets with default IPV6_AUTOFLOWLABEL
Commit513674b5a2("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:513674b5a2("net: reevalulate autoflowlabel setting after sysctl ...") Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									02612bb05e
								
							
						
					
					
						commit
						e9191ffb65
					
				
					 3 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -331,6 +331,7 @@ int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq,
 | 
				
			||||||
			   int flags);
 | 
								   int flags);
 | 
				
			||||||
int ip6_flowlabel_init(void);
 | 
					int ip6_flowlabel_init(void);
 | 
				
			||||||
void ip6_flowlabel_cleanup(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)
 | 
					static inline void fl6_sock_release(struct ip6_flowlabel *fl)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -166,7 +166,7 @@ int ip6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
 | 
				
			||||||
			    !(IP6CB(skb)->flags & IP6SKB_REROUTED));
 | 
								    !(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)
 | 
						if (!np->autoflowlabel_set)
 | 
				
			||||||
		return ip6_default_np_autolabel(net);
 | 
							return ip6_default_np_autolabel(net);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1336,7 +1336,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case IPV6_AUTOFLOWLABEL:
 | 
						case IPV6_AUTOFLOWLABEL:
 | 
				
			||||||
		val = np->autoflowlabel;
 | 
							val = ip6_autoflowlabel(sock_net(sk), np);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case IPV6_RECVFRAGSIZE:
 | 
						case IPV6_RECVFRAGSIZE:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue