[bug] network prefix applied to local instead of peer address
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#L... * 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
On Sun, Jan 24, 2021 at 05:23:30PM -0500, Etienne Champetier wrote:
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`
Hi It is true that for non-/32 prefix BIRD uses IFA_LOCAL instead of IFA_ADDRESS for prefix. For regular addresses (where local IP is from the range) it does not matter. For /32 PtP addresses it is handled properly. The only problematic case is PtP address with non-/32 prefix (like in your case), but this case is generally not supported by BIRD anyways, and would require some work to handle it properly. It is rather strange and asymetric network setup. Do you have any use cases for that? -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
Hi Ondrej, Le lun. 25 janv. 2021 à 10:03, Ondrej Zajicek <santiago@crfreenet.org> a écrit :
On Sun, Jan 24, 2021 at 05:23:30PM -0500, Etienne Champetier wrote:
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`
Hi
It is true that for non-/32 prefix BIRD uses IFA_LOCAL instead of IFA_ADDRESS for prefix. For regular addresses (where local IP is from the range) it does not matter. For /32 PtP addresses it is handled properly. The only problematic case is PtP address with non-/32 prefix (like in your case), but this case is generally not supported by BIRD anyways, and would require some work to handle it properly. It is rather strange and asymetric network setup. Do you have any use cases for that?
No, not at all, I was just curious if such setup even make sense at all Thanks for the answer Best Etienne
-- Elen sila lumenn' omentielvo
Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
participants (2)
-
Etienne Champetier -
Ondrej Zajicek