OSDN Git Service

tipc: support binding to specific ip address when activating UDP bearer
authorHoang Le <hoang.h.le@dektech.com.au>
Thu, 11 Oct 2018 01:43:08 +0000 (08:43 +0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 Oct 2018 04:56:56 +0000 (21:56 -0700)
commitacad76a5f6165dc451c5f35edb35d77def1f2e15
tree5147882333c6af295ec14678704799e64a55fc0a
parent1986647c2fc369b1865fb9bc9a213b48444580cb
tipc: support binding to specific ip address when activating UDP bearer

INADDR_ANY is hard-coded when activating UDP bearer. So, we could not
bind to a specific IP address even with replicast mode using - given
remote ip address instead of using multicast ip address.

In this commit, we fixed it by checking and switch to use appropriate
local ip address.

before:
$netstat -plu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address
udp        0      0 **0.0.0.0:6118**            0.0.0.0:*

after:
$netstat -plu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address
udp        0      0 **10.0.0.2:6118**           0.0.0.0:*

Acked-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/udp_media.c