Hello Toke, thanks for this catch, for some weird reason we don't have an autotest for this.
Changed your code a bit to add an explicit typecast macro, as the original reason why this slipped through is that plain void pointer cast. Merged, thanks. Have a nice day! Maria On Tue, Feb 25, 2025 at 04:05:10PM +0100, Toke Høiland-Jørgensen via Bird-users wrote: > 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. > > Fixes: 69d1ffde4c72 ("Split route data structure to storage (ro) / > manipulation (rw) structures.") > Signed-off-by: Toke Høiland-Jørgensen <t...@toke.dk> > --- > sysdep/linux/netlink.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c > index 1703a67595d5..6cc0142c3e00 100644 > --- a/sysdep/linux/netlink.c > +++ b/sysdep/linux/netlink.c > @@ -1494,7 +1494,7 @@ nl_send_route(struct krt_proto *p, const rte *e, int op) > /* Add source address for IPv6 SADR routes */ > if (e->net->type == NET_IP6_SADR) > { > - net_addr_ip6_sadr *a = (void *) &e->net; > + net_addr_ip6_sadr *a = (void *) e->net; > nl_add_attr_ip6(&r->h, rsize, RTA_SRC, a->src_prefix); > r->r.rtm_src_len = a->src_pxlen; > } > -- > 2.48.1 > -- Maria Matejka (she/her) | BIRD Team Leader | CZ.NIC, z.s.p.o.