question about inet_insert_ifa and inet_del_ifa behaviour

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



By coincidence I noticed some odd behaviour when adding and deleting
IPv4 addresses to interfaces:
I can add the same IP address but with different netmasks to one interface
multiple times. So far so good, although right now I cannot think of a case
where this would make sense.
But when I want to delete these IP addresses the netmask does not seem
to be checked by the stack. The addresses are always deleted in the order
they have been added to the device. I cannot explicitly delete one IP address
with a certain netmask.

Example:

# ip addr add 10.1.1.1/24 dev eth0
# ip addr add 10.1.1.1/16 dev eth0

# ip addr ls dev eth0
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:0c:29:28:75:d1 brd ff:ff:ff:ff:ff:ff
    inet 9.152.242.95/25 brd 9.152.242.127 scope global eth0
    inet 10.1.1.1/24 scope global eth0
    inet 10.1.1.1/16 scope global eth0

# ip addr del 10.1.1.1/16
# ip addr ls dev eth0
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:0c:29:28:75:d1 brd ff:ff:ff:ff:ff:ff
    inet 9.152.242.95/25 brd 9.152.242.127 scope global eth0
    inet 10.1.1.1/16 scope global eth0

Address 10.1.1.1/16 has not been deleted. Instead a first in first out semantics is
used, i.e. the first address added is removed first. I can even call 'ip addr del'
without specifying a netmask and get the same behaviour.

Is this behaviour intended? If so, what's the idea behind it?

-- 
Regards,
Thomas.
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux