]> git.proxmox.com Git - mirror_iproute2.git/commit
iplink: fix incorrect any address handling for ip tunnels
authorHangbin Liu <liuhangbin@gmail.com>
Tue, 18 Sep 2018 09:48:40 +0000 (17:48 +0800)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 21 Sep 2018 18:28:33 +0000 (11:28 -0700)
commitfa1e658e84ab267bb98955e44774831bb36f3861
treeca69ffff95a8c26677cd3bb1e3f0df070775ac76
parent11152f0a0dbfbeb3130e23d8ab7179f3aac58706
iplink: fix incorrect any address handling for ip tunnels

After commit d42c7891d26e4 ("utils: Do not reset family for default, any,
all addresses"), when call get_addr() for any/all addresses, we will set
addr->flags to ADDRTYPE_INET_UNSPEC if family is AF_INET/AF_INET6, which
makes is_addrtype_inet() checking passed and assigns incorrect address
to kernel. The ip link cmd will return error like:

]# ip link add ipip1 type ipip local any remote 1.1.1.1
RTNETLINK answers: Numerical result out of range

Fix it by using is_addrtype_inet_not_unspec() to avoid unspec addresses.

geneve, vxlan are not affected as they use AF_UNSPEC family when call
get_addr()

Reported-by: Jianlin Shi <jishi@redhat.com>
Fixes: d42c7891d26e4 ("utils: Do not reset family for default, any, all addresses")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/link_gre.c
ip/link_gre6.c
ip/link_ip6tnl.c
ip/link_iptnl.c
ip/link_vti.c
ip/link_vti6.c