aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authoryupeng <yupeng0921@gmail.com>2018-12-05 18:56:28 -0800
committerDavid S. Miller <davem@davemloft.net>2018-12-07 16:11:54 -0800
commit0fbe82e628c817e292ff588cd5847fc935e025f2 (patch)
treecad44f26cb7fce8ba9c2ba294455b87a9d92c50b /tools
parentneighbor: Improve garbage collection (diff)
downloadlinux-dev-0fbe82e628c817e292ff588cd5847fc935e025f2.tar.xz
linux-dev-0fbe82e628c817e292ff588cd5847fc935e025f2.zip
net: call sk_dst_reset when set SO_DONTROUTE
after set SO_DONTROUTE to 1, the IP layer should not route packets if the dest IP address is not in link scope. But if the socket has cached the dst_entry, such packets would be routed until the sk_dst_cache expires. So we should clean the sk_dst_cache when a user set SO_DONTROUTE option. Below are server/client python scripts which could reprodue this issue: server side code: ========================================================================== import socket import struct import time s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(('0.0.0.0', 9000)) s.listen(1) sock, addr = s.accept() sock.setsockopt(socket.SOL_SOCKET, socket.SO_DONTROUTE, struct.pack('i', 1)) while True: sock.send(b'foo') time.sleep(1) ========================================================================== client side code: ========================================================================== import socket import time s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('server_address', 9000)) while True: data = s.recv(1024) print(data) ========================================================================== Signed-off-by: yupeng <yupeng0921@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions