]> git.ipfire.org Git - thirdparty/bird.git/commit
Fix source-specific routing in Bird 3
authorToke Høiland-Jørgensen via Bird-users <bird-users@network.cz>
Tue, 25 Feb 2025 15:05:10 +0000 (16:05 +0100)
committerMaria Matejka <mq@ucw.cz>
Wed, 26 Feb 2025 10:07:57 +0000 (11:07 +0100)
commit7eb9a24a96f5e88de0b92c65eae3dbc51fec9241
treeb065d26052ff8f6524de613c9095086742358c87
parent63c08fc653bcfcad742aa83c11f783d3b68c0f9a
Fix source-specific routing in Bird 3

Commit 69d1ffde4c72 ("Split route data structure to storage (ro) /
manipulation (rw) structures.") changed rte->net from a pointer to a
'struct network' to a 'struct net_addr', but kept the address-of (&)
operator before casting to 'net_addr_ip6_sadr *' when sending a
source-specific route to the kernel.

Because 'struct network' had an embedded struct member (struct
fib_node), the address-of was needed to get back to a pointer to the
data, but with the change in the commit mentioned above, e->net is now a
straight pointer to the address.

The bug meant that the source prefixes passed to the kernel were
essentially garbage, leading to routes in the kernel like:

default from b74:9e05:0:1:d8cf:c000::/86 via fe80::1 dev eth0 proto bird metric 32 pref medium

Fix this by getting rid of the address-of operator.

Note by commiter: used our TYPE_CAST macro instead of plain typecast
to avoid this kind of problem in future.

Fixes: 69d1ffde4c72 ("Split route data structure to storage (ro) / manipulation (rw) structures.")
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Maria Matejka <mq@jmq.cz>
sysdep/linux/netlink.c