diff options
author | Thomas Haller <thaller@redhat.com> | 2016-06-28 14:56:21 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-06-29 08:26:00 (GMT) |
commit | 83e851ca9c842ccb6dae411d3fff9c7e9561269a (patch) | |
tree | 63d1d2aac50b9fb89c8c175bb812c9cf0f752388 /include/netlink-private | |
parent | ca5d662e9d6aa67b1d75be19aea4e4a4585e41b8 (diff) | |
download | libnl-83e851ca9c842ccb6dae411d3fff9c7e9561269a.zip libnl-83e851ca9c842ccb6dae411d3fff9c7e9561269a.tar.gz libnl-83e851ca9c842ccb6dae411d3fff9c7e9561269a.tar.bz2 |
route/addr: fix ID comparison for AF_INET and AF_INET6 addresses
For AF_INET/IPv4 addresses, the ID equality comparison must include
the net-part of the peer address:
unshare -n
ip link add T type dummy
ip link set T up
ip addr add 192.168.5.10/24 dev T
ip addr add 192.168.5.10 peer 192.168.6.1/24 dev T
ip addr add 192.168.5.10 peer 192.168.7.1/24 dev T
ip addr add 192.168.5.10 peer 192.168.7.2/24 dev T
# RTNETLINK answers: File exists
ip addr change 192.168.5.10 peer 192.168.7.2/24 dev T
ip addr show | grep 192.168.7.
# inet 192.168.5.10 peer 192.168.7.1/24 scope global T
For AF_INET6/IPv6 addresses, the prefix length of the address
is not part of the ID:
unshare -n
ip link add T type dummy
ip link set T up
ip addr add 192.168.7.10/24 dev T
ip addr add 192.168.7.10/23 dev T
ip addr add 1:2:3:4:5::1/64 dev T
ip addr add 1:2:3:4:5::1/63 dev T
# RTNETLINK answers: File exists
ip addr change 1:2:3:4:5::1/63 dev T
ip addr show | grep 1:2:3:4:5::1
# inet6 1:2:3:4:5::1/64 scope global
*sigh*
http://lists.infradead.org/pipermail/libnl/2016-June/002158.html
Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'include/netlink-private')
-rw-r--r-- | include/netlink-private/types.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/netlink-private/types.h b/include/netlink-private/types.h index 5da8f59..0f67ddd 100644 --- a/include/netlink-private/types.h +++ b/include/netlink-private/types.h @@ -111,6 +111,7 @@ struct nl_cache_mngr struct nl_parser_param; #define LOOSE_COMPARISON 1 +#define ID_COMPARISON 2 #define NL_OBJ_MARK 1 |