]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Merge commit 'e3c0eca9' into thread-next
authorMaria Matejka <mq@ucw.cz>
Fri, 13 Oct 2023 09:04:39 +0000 (11:04 +0200)
committerMaria Matejka <mq@ucw.cz>
Fri, 13 Oct 2023 09:04:39 +0000 (11:04 +0200)
1  2 
nest/iface.c
nest/iface.h
nest/neighbor.c
proto/babel/babel.c
proto/bgp/packets.c
proto/ospf/iface.c
proto/radv/radv.c
proto/rip/rip.c
sysdep/linux/netlink.c

diff --cc nest/iface.c
index 31eb9de15d10fe206fb2c16caa6ca9f5f6f4f960,6c84cbcf0977b509f5e2e68db9e9a6f7244811b3..5f42bac88f9e0c334d33cdaf99c8be61c7ca8b3e
@@@ -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 1411ac2a6ef3f49e2c979c66aec31cfdb9404b6d,f8e9285053c11afe013666747920edbcc65168ea..9a35ee14259e4a181f044ea0e502eecaf427d46a
@@@ -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 934cd35c3da70507f440781a1cea2ff7083bb827,2c2d3adfdee4e5f14895462e5967da450feeb296..991ed0ead51e0f4fcf0d6f9b538c657534f6b370
@@@ -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);
index 3dfb22d73b713fab5f6e630dc193309bb3499782,4187d258aa3b596f710217d2c8500909c8d1b2dc..e215977dee3359ebd4b481e53b36a6139705750d
@@@ -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))
index 84e0cb7301df1db30e849ea692b59c58fe5fa7de,dc52e8051de656a712a757b94e331a08d712efa6..c7b3ac0e7ac8910877c8c236cd47ec108ab37e3c
@@@ -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 */
index c3ec4a4c5d6fc17ad3b83978d6afb23b81e349cf,dd922b00af3e316d9348e2efa299bb8334c6f205..edfbcda433a99ef5648687b68898ea854fbf651e
@@@ -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))
  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))
index f96481d8783871bb760157246d204ccd04ba8512,ba31e1a845f2aed5af6bc73b1d4768f44a2fddde..64f3171e6e0aa9cd9f083a3a11c9c9bd4369895e
@@@ -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 a8f9ffcd69a823163b1a4188a662e04c87e94ac7,1c3509e408611ad806076c3438aa0b4149170d94..00423802a30e421ed8dd7a197e511ed40b63818c
@@@ -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))
Simple merge