[bug] network prefix applied to local instead of peer address
Etienne Champetier
champetier.etienne at gmail.com
Sun Jan 24 23:23:30 CET 2021
Hi All,
When configuring a ptp interface, the local address is /32, and the
prefix is supposed to be applied to the peer address
I not using a non /32 peer but was curious when reading `man ip-address`
# ip link add name wg-test1 type wireguard
# ip link set wg-test1 up
# ip addr add dev wg-test1 1.2.3.4 peer 5.6.7.8/24
# ip addr show wg-test1
11: wg-test1: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue
state UNKNOWN group default qlen 1000
link/none
inet 1.2.3.4 peer 5.6.7.8/24 scope global wg-test1
valid_lft forever preferred_lft forever
# birdc show ospf interface
Interface wg-test1 (1.2.3.0/24)
Type: ptp
Area: 0.0.0.0 (0)
State: PtP
...
(we should see `Interface wg-test1 (peer 5.6.7.8/24)`)
# strace -f -s 10000 ip addr show wg-test1
recvmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0,
nl_groups=00000000}, msg_namelen=12, msg_iov=[{iov_base={{len=84,
type=RTM_NEWADDR, flags=NLM_F_MULTI|NLM_F_DUMP_FILTERED,
seq=1611526183, pid=25832}, {ifa_family=AF_INET, ifa_prefixlen=24,
ifa_flags=IFA_F_PERMANENT, ifa_scope=RT_SCOPE_UNIVERSE,
ifa_index=if_nametoindex("wg-test1")}, [{{nla_len=8,
nla_type=IFA_ADDRESS}, inet_addr("5.6.7.8")}, {{nla_len=8,
nla_type=IFA_LOCAL}, inet_addr("1.2.3.4")}, {{nla_len=13,
nla_type=IFA_LABEL}, "wg-test1"}, {{nla_len=8, nla_type=IFA_FLAGS},
IFA_F_PERMANENT}, {{nla_len=20, nla_type=IFA_CACHEINFO},
{ifa_prefered=4294967295, ifa_valid=4294967295, cstamp=2331331,
tstamp=2331331}}]}, iov_len=32768}], msg_iovlen=1, msg_controllen=0,
msg_flags=0}, 0) = 84
https://github.com/torvalds/linux/blob/master/include/uapi/linux/if_addr.h#L17
* IFA_ADDRESS is prefix address, rather than local interface address.
* It makes no difference for normally configured broadcast interfaces,
* but for point-to-point IFA_ADDRESS is DESTINATION address,
* local address is supplied in IFA_LOCAL attribute.
Best
Etienne
More information about the Bird-users
mailing list