]> git.proxmox.com Git - mirror_iproute2.git/commit - ip/ipaddress.c
ip address: do not set home option for IPv4 addresses
authorAndrea Claudi <aclaudi@redhat.com>
Tue, 25 Jun 2019 10:29:56 +0000 (12:29 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 28 Jun 2019 22:18:28 +0000 (15:18 -0700)
commite4448b6c7de934f26654d4db84119c0423923719
tree526bb2ce0d0d254eed9abd6bff6da43102527214
parent8ae99cc46d7713069ee626a4ce4335aaeca9892f
ip address: do not set home option for IPv4 addresses

'home' option designates a IPv6 address as "home address" as
defined in RFC 6275. This option should be available only for
IPv6 addresses, as correctly stated in the manpage.

However it is possible to set home on IPv4 addresses, too:

$ ip link add dummy0 type dummy
$ ip -4 addr add 192.168.1.1 dev dummy0 home
$ ip a
1: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
   link/ether 1a:6d:c6:96:ca:f8 brd ff:ff:ff:ff:ff:ff
   inet 192.168.1.1/32 scope global home dummy0
      valid_lft forever preferred_lft forever

Fix this adding a check on the protocol family before setting
IFA_F_HOMEADDRESS flag.

Fixes: bac735c53a36d ("enabled to manipulate the flags of IFA_F_HOMEADDRESS or IFA_F_NODAD from ip.")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/ipaddress.c