On Wed, Nov 02, 2016 at 09:36:55AM -0600, David Ahern wrote:
>
> Limited to raw sockets or are you looking at multiple spec options (dev,
> address, port)?
>
> I have not seen issues with tcp or udp. Running:
>
> ss -aK 'dev == red'
>
> drops all sockets bound to device 'red' (or at least signaling the socket
> failure for the app to handle):
Limited to raw socket. I didn't modify lookup kernel code but use already
existing helpers.
The tcp/udp sockets do use port value in lookup (iirc, don't have code under my
hand
at moment), in turn raw lookup uses only net,raw-protocol, src/dst and device
index.
In my test case the sokets were unconnected so the have no address but bound to
device and I hit mismatch. Then looking into inet matching code I found this
weird
snippet I posted previously.
>
> root@jessie4:~# ss -ap 'dev == red'
> Netid State Recv-Q Send-Q Local Address:Port
> Peer Address:Port
> udp UNCONN 0 0 *%red:12345
> *:* users:(("vrf-test",pid=765,fd=3))
> tcp LISTEN 0 1 *%red:12345
> *:* users:(("vrf-test",pid=766,fd=3))
> tcp ESTAB 0 0 10.100.1.4%red:ssh
> 10.100.1.254:60298 users:(("sshd",pid=738,fd=3))
>
> root@jessie4:~# ss -aKp 'dev == red'
> Netid State Recv-Q Send-Q Local Address:Port
> Peer Address:Port
> udp UNCONN 0 0 *%red:12345
> *:*
> users:(("vrf-test",pid=765,fd=3))
> tcp LISTEN 0 1 *%red:12345
> *:*
> users:(("vrf-test",pid=766,fd=3))
> tcp ESTAB 0 0 10.100.1.4%red:ssh
> 10.100.1.254:60298
> users:(("sshd",pid=738,fd=3))
>
> root@jessie4:~# ss -ap 'dev == red'
> Netid State Recv-Q Send-Q Local Address:Port
> Peer Address:Port
Cyrill