linux/net
Shaohua Li 513674b5a2 net: reevalulate autoflowlabel setting after sysctl setting
sysctl.ip6.auto_flowlabels is default 1. In our hosts, we set it to 2.
If sockopt doesn't set autoflowlabel, outcome packets from the hosts are
supposed to not include flowlabel. This is true for normal packet, but
not for reset packet.

The reason is ipv6_pinfo.autoflowlabel is set in sock creation. Later if
we change sysctl.ip6.auto_flowlabels, the ipv6_pinfo.autoflowlabel isn't
changed, so the sock will keep the old behavior in terms of auto
flowlabel. Reset packet is suffering from this problem, because reset
packet is sent from a special control socket, which is created at boot
time. Since sysctl.ipv6.auto_flowlabels is 1 by default, the control
socket will always have its ipv6_pinfo.autoflowlabel set, even after
user set sysctl.ipv6.auto_flowlabels to 1, so reset packset will always
have flowlabel. Normal sock created before sysctl setting suffers from
the same issue. We can't even turn off autoflowlabel unless we kill all
socks in the hosts.

To fix this, if IPV6_AUTOFLOWLABEL sockopt is used, we use the
autoflowlabel setting from user, otherwise we always call
ip6_default_np_autolabel() which has the new settings of sysctl.

Note, this changes behavior a little bit. Before commit 42240901f7
(ipv6: Implement different admin modes for automatic flow labels), the
autoflowlabel behavior of a sock isn't sticky, eg, if sysctl changes,
existing connection will change autoflowlabel behavior. After that
commit, autoflowlabel behavior is sticky in the whole life of the sock.
With this patch, the behavior isn't sticky again.

Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Tom Herbert <tom@quantonium.net>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-21 13:07:20 -05:00
..
6lowpan
9p
802
8021q
appletalk
atm
ax25
batman-adv
bluetooth
bpf
bridge net: bridge: fix early call to br_stp_change_bridge_id and plug newlink leaks 2017-12-18 13:29:01 -05:00
caif
can
ceph
core net: Fix double free and memory corruption in get_net_ns_by_id() 2017-12-20 12:42:22 -05:00
dcb
dccp
decnet
dns_resolver
dsa
ethernet
hsr
ieee802154
ife
ipv4 ipv4: Fix use-after-free when flushing FIB tables 2017-12-20 15:12:39 -05:00
ipv6 net: reevalulate autoflowlabel setting after sysctl setting 2017-12-21 13:07:20 -05:00
ipx
iucv
kcm
key
l2tp
l3mdev
lapb
llc
mac80211
mac802154
mpls
ncsi
netfilter
netlabel
netlink
netrom
nfc
nsh
openvswitch openvswitch: Fix pop_vlan action for double tagged frames 2017-12-21 13:02:08 -05:00
packet
phonet
psample
qrtr
rds
rfkill
rose
rxrpc
sched cls_bpf: fix offload assumptions after callback conversion 2017-12-20 13:08:18 -05:00
sctp sctp: add SCTP_CID_RECONF conversion in sctp_cname 2017-12-18 13:21:46 -05:00
smc
strparser
sunrpc
switchdev
tipc tipc: remove joining group member from congested list 2017-12-20 14:56:48 -05:00
tls
unix
vmw_vsock
wimax
wireless cfg80211: ship certificates as hex files 2017-12-19 09:28:01 +01:00
x25
xfrm
compat.c
Kconfig
Makefile
socket.c
sysctl_net.c