From: Maria Matejka Date: Fri, 13 Oct 2023 09:04:39 +0000 (+0200) Subject: Merge commit 'e3c0eca9' into thread-next X-Git-Tag: v3.0.0~392 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21b75c472d9fab7942825d1a4b25f77e4a244d47;p=thirdparty%2Fbird.git Merge commit 'e3c0eca9' into thread-next --- 21b75c472d9fab7942825d1a4b25f77e4a244d47 diff --cc nest/iface.c index 31eb9de15,6c84cbcf0..5f42bac88 --- a/nest/iface.c +++ b/nest/iface.c @@@ -282,13 -143,11 +282,13 @@@ if_enqueue_notify(struct iface_notifica } static inline void -ifa_send_notify(struct proto *p, unsigned c, struct ifa *a) +ifa_send_notify(struct iface_subscription *s, unsigned c, struct ifa *a) { - if (p->ifa_notify && + struct proto *p = SKIP_BACK(struct proto, iface_sub, s); + + if (s->ifa_notify && (p->proto_state != PS_DOWN) && - (!p->vrf || p->vrf == a->iface->master)) - (!p->vrf_set || if_in_vrf(a->iface, p->vrf))) ++ (!p->vrf || if_in_vrf(a->iface, p->vrf))) { if (p->debug & D_IFACES) log(L_TRACE "%s < address %N on interface %s %s", @@@ -324,13 -181,11 +324,13 @@@ ifa_notify_change(unsigned c, struct if } static inline void -if_send_notify(struct proto *p, unsigned c, struct iface *i) +if_send_notify(struct iface_subscription *s, unsigned c, struct iface *i) { - if (p->if_notify && + struct proto *p = SKIP_BACK(struct proto, iface_sub, s); + + if (s->if_notify && (p->proto_state != PS_DOWN) && - (!p->vrf || p->vrf == i->master)) - (!p->vrf_set || if_in_vrf(i, p->vrf))) ++ (!p->vrf || if_in_vrf(i, p->vrf))) { if (p->debug & D_IFACES) log(L_TRACE "%s < interface %s %s", p->name, i->name, diff --cc nest/iface.h index 1411ac2a6,f8e928505..9a35ee142 --- a/nest/iface.h +++ b/nest/iface.h @@@ -124,11 -120,9 +125,14 @@@ struct iface *if_find_by_name(const cha struct iface *if_get_by_name(const char *); void if_recalc_all_preferred_addresses(void); + static inline int if_in_vrf(struct iface *i, struct iface *vrf) + { return (i->flags & IF_VRF) ? (i == vrf) : (i->master == vrf); } + +struct iface *if_walk_first(void); +struct iface *if_walk_next(struct iface *); +void if_walk_done(void); + +#define IFACE_WALK(_i) for (struct iface *_i = if_walk_first(); _i || (if_walk_done(), 0); _i = if_walk_next(_i)) /* The Neighbor Cache */ diff --cc nest/neighbor.c index 934cd35c3,2c2d3adfd..991ed0ead --- a/nest/neighbor.c +++ b/nest/neighbor.c @@@ -165,8 -152,8 +165,8 @@@ if_connected_any(ip_addr a, struct ifac *addr = NULL; /* Prefer SCOPE_HOST or longer prefix */ - WALK_LIST(i, iface_list) - if ((!vrf_set || if_in_vrf(i, vrf)) && ((s = if_connected(a, i, &b, flags)) >= 0)) + WALK_LIST(i, global_iface_list) - if ((!vrf || vrf == i->master) && ((s = if_connected(a, i, &b, flags)) >= 0)) ++ if ((!vrf || if_in_vrf(i,vrf)) && ((s = if_connected(a, i, &b, flags)) >= 0)) if (scope_better(s, scope) || (scope_remote(s, scope) && ifa_better(b, *addr))) { *iface = i; @@@ -432,7 -369,7 +432,7 @@@ neigh_update(neighbor *n, struct iface return; /* VRF-bound neighbors ignore changes in other VRFs */ - if (p->vrf && (p->vrf != iface->master)) - if (p->vrf_set && !if_in_vrf(iface, p->vrf)) ++ if (p->vrf && !if_in_vrf(iface, p->vrf)) return; scope = if_connected(n->addr, iface, &ifa, n->flags); diff --cc proto/babel/babel.c index 3dfb22d73,4187d258a..e215977de --- a/proto/babel/babel.c +++ b/proto/babel/babel.c @@@ -2060,9 -2058,11 +2060,9 @@@ babel_reconfigure_iface(struct babel_pr static void babel_reconfigure_ifaces(struct babel_proto *p, struct babel_config *cf) { - struct iface *iface; - - WALK_LIST(iface, iface_list) + IFACE_WALK(iface) { - if (p->p.vrf && p->p.vrf != iface->master) - if (p->p.vrf_set && !if_in_vrf(iface, p->p.vrf)) ++ if (p->p.vrf && !if_in_vrf(iface, p->p.vrf)) continue; if (!(iface->flags & IF_UP)) diff --cc proto/bgp/packets.c index 84e0cb730,dc52e8051..c7b3ac0e7 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@@ -1171,25 -1168,18 +1171,25 @@@ bgp_use_gateway(struct bgp_export_stat /* Handle next hop self option - also applies to gateway */ if (c->cf->next_hop_self && bgp_match_src(s, c->cf->next_hop_self)) - return 0; + return NULL; + + eattr *nhea = ea_find(ra, &ea_gen_nexthop); + if (!nhea) + return NULL; /* We need one valid global gateway */ - if ((ra->dest != RTD_UNICAST) || ra->nh.next || ipa_zero(ra->nh.gw) || ipa_is_link_local(ra->nh.gw)) - return 0; + struct nexthop_adata *nhad = (struct nexthop_adata *) nhea->u.ptr; + if (!NEXTHOP_IS_REACHABLE(nhad) || + !NEXTHOP_ONE(nhad) || ipa_zero(nhad->nh.gw) || + ipa_is_link_local(nhad->nh.gw)) + return NULL; /* Check for non-matching AF */ - if ((ipa_is_ip4(ra->nh.gw) != bgp_channel_is_ipv4(c)) && !c->ext_next_hop) - return 0; + if ((ipa_is_ip4(nhad->nh.gw) != bgp_channel_is_ipv4(c)) && !c->ext_next_hop) + return NULL; /* Do not use gateway from different VRF */ - if (p->p.vrf && nhad->nh.iface && (p->p.vrf != nhad->nh.iface->master)) - if (p->p.vrf_set && ra->nh.iface && !if_in_vrf(ra->nh.iface, p->p.vrf)) ++ if (p->p.vrf && nhad->nh.iface && !if_in_vrf(nhad->nh.iface, p->p.vrf)) return 0; /* Use it when exported to internal peers */ diff --cc proto/ospf/iface.c index c3ec4a4c5,dd922b00a..edfbcda43 --- a/proto/ospf/iface.c +++ b/proto/ospf/iface.c @@@ -1225,11 -1222,12 +1225,11 @@@ ospf_ifa_notify3(struct proto *P, uint static void ospf_reconfigure_ifaces2(struct ospf_proto *p) { - struct iface *iface; struct ifa *a; - WALK_LIST(iface, iface_list) + IFACE_WALK(iface) { - if (p->p.vrf && p->p.vrf != iface->master) - if (p->p.vrf_set && !if_in_vrf(iface, p->p.vrf)) ++ if (p->p.vrf && !if_in_vrf(iface, p->p.vrf)) continue; if (! (iface->flags & IF_UP)) @@@ -1273,11 -1271,12 +1273,11 @@@ static void ospf_reconfigure_ifaces3(struct ospf_proto *p) { - struct iface *iface; struct ifa *a; - WALK_LIST(iface, iface_list) + IFACE_WALK(iface) { - if (p->p.vrf && p->p.vrf != iface->master) - if (p->p.vrf_set && !if_in_vrf(iface, p->p.vrf)) ++ if (p->p.vrf && !if_in_vrf(iface, p->p.vrf)) continue; if (! (iface->flags & IF_UP)) diff --cc proto/radv/radv.c index f96481d87,ba31e1a84..64f3171e6 --- a/proto/radv/radv.c +++ b/proto/radv/radv.c @@@ -664,11 -658,12 +664,11 @@@ radv_reconfigure(struct proto *P, struc /* We started to accept routes so we need to refeed them */ if (!old->propagate_routes && new->propagate_routes) - channel_request_feeding(p->p.main_channel); + channel_request_feeding_dynamic(p->p.main_channel, CFRT_DIRECT); - struct iface *iface; - WALK_LIST(iface, iface_list) + IFACE_WALK(iface) { - if (p->p.vrf && p->p.vrf != iface->master) - if (p->p.vrf_set && !if_in_vrf(iface, p->p.vrf)) ++ if (p->p.vrf && !if_in_vrf(iface, p->p.vrf)) continue; if (!(iface->flags & IF_UP)) diff --cc proto/rip/rip.c index a8f9ffcd6,1c3509e40..00423802a --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@@ -852,9 -793,11 +852,9 @@@ rip_reconfigure_iface(struct rip_proto static void rip_reconfigure_ifaces(struct rip_proto *p, struct rip_config *cf) { - struct iface *iface; - - WALK_LIST(iface, iface_list) + IFACE_WALK(iface) { - if (p->p.vrf && p->p.vrf != iface->master) - if (p->p.vrf_set && !if_in_vrf(iface, p->p.vrf)) ++ if (p->p.vrf && !if_in_vrf(iface, p->p.vrf)) continue; if (!(iface->flags & IF_UP))