From c651cef737c7c7578c26bd787c0abd3c364bf4b8 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Mon, 24 Jan 2022 10:01:10 +0100 Subject: [PATCH] Global interface list renamed to not clash with local lists --- nest/iface.c | 32 ++++++++++++++++---------------- nest/iface.h | 2 +- nest/neighbor.c | 6 +++--- proto/babel/babel.c | 2 +- proto/ospf/iface.c | 4 ++-- proto/radv/radv.c | 2 +- proto/rip/rip.c | 2 +- sysdep/bsd/krt-sock.c | 2 +- sysdep/linux/netlink.c | 2 +- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/nest/iface.c b/nest/iface.c index bd2bb39a..61b99a91 100644 --- a/nest/iface.c +++ b/nest/iface.c @@ -36,7 +36,7 @@ static pool *if_pool; -list iface_list; +list global_iface_list; struct iface default_vrf; static void if_recalc_preferred(struct iface *i); @@ -111,7 +111,7 @@ if_dump_all(void) struct iface *i; debug("Known network interfaces:\n"); - WALK_LIST(i, iface_list) + WALK_LIST(i, global_iface_list) if_dump(i); debug("Router ID: %08x\n", config->router_id); } @@ -307,7 +307,7 @@ if_update(struct iface *new) if (!new->master) new->master = &default_vrf; - WALK_LIST(i, iface_list) + WALK_LIST(i, global_iface_list) if (!strcmp(new->name, i->name)) { new->flags = if_recalc_flags(new, new->flags); @@ -340,7 +340,7 @@ if_update(struct iface *new) newif: init_list(&i->neighbors); i->flags |= IF_UPDATED | IF_TMP_DOWN; /* Tmp down as we don't have addresses yet */ - add_tail(&iface_list, &i->n); + add_tail(&global_iface_list, &i->n); return i; } @@ -350,7 +350,7 @@ if_start_update(void) struct iface *i; struct ifa *a; - WALK_LIST(i, iface_list) + WALK_LIST(i, global_iface_list) { i->flags &= ~IF_UPDATED; WALK_LIST(a, i->addrs) @@ -374,7 +374,7 @@ if_end_update(void) struct iface *i; struct ifa *a, *b; - WALK_LIST(i, iface_list) + WALK_LIST(i, global_iface_list) { if (!(i->flags & IF_UPDATED)) if_change_flags(i, (i->flags & ~IF_ADMIN_UP) | IF_SHUTDOWN); @@ -413,7 +413,7 @@ if_feed_baby(struct proto *p) if (!p->if_notify && !p->ifa_notify) /* shortcut */ return; DBG("Announcing interfaces to new protocol %s\n", p->name); - WALK_LIST(i, iface_list) + WALK_LIST(i, global_iface_list) { if_send_notify(p, IF_CHANGE_CREATE | ((i->flags & IF_UP) ? IF_CHANGE_UP : 0), i); if (i->flags & IF_UP) @@ -435,7 +435,7 @@ if_find_by_index(unsigned idx) { struct iface *i; - WALK_LIST(i, iface_list) + WALK_LIST(i, global_iface_list) if (i->index == idx && !(i->flags & IF_SHUTDOWN)) return i; return NULL; @@ -454,7 +454,7 @@ if_find_by_name(const char *name) { struct iface *i; - WALK_LIST(i, iface_list) + WALK_LIST(i, global_iface_list) if (!strcmp(i->name, name) && !(i->flags & IF_SHUTDOWN)) return i; return NULL; @@ -465,7 +465,7 @@ if_get_by_name(const char *name) { struct iface *i; - WALK_LIST(i, iface_list) + WALK_LIST(i, global_iface_list) if (!strcmp(i->name, name)) return i; @@ -475,7 +475,7 @@ if_get_by_name(const char *name) i->flags = IF_SHUTDOWN; init_list(&i->addrs); init_list(&i->neighbors); - add_tail(&iface_list, &i->n); + add_tail(&global_iface_list, &i->n); return i; } @@ -561,7 +561,7 @@ if_recalc_all_preferred_addresses(void) { struct iface *i; - WALK_LIST(i, iface_list) + WALK_LIST(i, global_iface_list) { if_recalc_preferred(i); @@ -669,7 +669,7 @@ if_choose_router_id(struct iface_patt *mask, u32 old_id) struct ifa *a, *b; b = NULL; - WALK_LIST(i, iface_list) + WALK_LIST(i, global_iface_list) { if (!(i->flags & IF_ADMIN_UP) || (i->flags & IF_SHUTDOWN)) @@ -716,7 +716,7 @@ void if_init(void) { if_pool = rp_new(&root_pool, &main_birdloop, "Interfaces"); - init_list(&iface_list); + init_list(&global_iface_list); strcpy(default_vrf.name, "default"); neigh_init(if_pool); } @@ -844,7 +844,7 @@ if_show(void) struct ifa *a; char *type; - WALK_LIST(i, iface_list) + WALK_LIST(i, global_iface_list) { if (i->flags & IF_SHUTDOWN) continue; @@ -887,7 +887,7 @@ if_show_summary(void) struct iface *i; cli_msg(-2005, "%-10s %-6s %-18s %s", "Interface", "State", "IPv4 address", "IPv6 address"); - WALK_LIST(i, iface_list) + WALK_LIST(i, global_iface_list) { byte a4[IPA_MAX_TEXT_LENGTH + 17]; byte a6[IPA_MAX_TEXT_LENGTH + 17]; diff --git a/nest/iface.h b/nest/iface.h index 13f3bd12..b3dcc408 100644 --- a/nest/iface.h +++ b/nest/iface.h @@ -12,7 +12,7 @@ #include "lib/lists.h" #include "lib/ip.h" -extern list iface_list; +extern list global_iface_list; struct proto; struct pool; diff --git a/nest/neighbor.c b/nest/neighbor.c index e10413bd..50defb96 100644 --- a/nest/neighbor.c +++ b/nest/neighbor.c @@ -152,7 +152,7 @@ if_connected_any(ip_addr a, struct iface *vrf, struct iface **iface, struct ifa *addr = NULL; /* Prefer SCOPE_HOST or longer prefix */ - WALK_LIST(i, iface_list) + WALK_LIST(i, global_iface_list) if ((!vrf || vrf == i->master) && ((s = if_connected(a, i, &b, flags)) >= 0)) if (scope_better(s, scope) || (scope_remote(s, scope) && ifa_better(b, *addr))) { @@ -440,7 +440,7 @@ neigh_if_up(struct iface *i) node *x, *y; /* Update neighbors that might be better off with the new iface */ - WALK_LIST(ii, iface_list) + WALK_LIST(ii, global_iface_list) if (!EMPTY_LIST(ii->neighbors) && (ii != i) && if_intersect(i, ii)) WALK_LIST2_DELSAFE(n, x, y, ii->neighbors, if_n) neigh_update(n, i); @@ -502,7 +502,7 @@ neigh_ifa_up(struct ifa *a) node *x, *y; /* Update neighbors that might be better off with the new ifa */ - WALK_LIST(ii, iface_list) + WALK_LIST(ii, global_iface_list) if (!EMPTY_LIST(ii->neighbors) && ifa_intersect(a, ii)) WALK_LIST2_DELSAFE(n, x, y, ii->neighbors, if_n) neigh_update(n, i); diff --git a/proto/babel/babel.c b/proto/babel/babel.c index e56a6328..8d80d7cd 100644 --- a/proto/babel/babel.c +++ b/proto/babel/babel.c @@ -1907,7 +1907,7 @@ babel_reconfigure_ifaces(struct babel_proto *p, struct babel_config *cf) { struct iface *iface; - WALK_LIST(iface, iface_list) + WALK_LIST(iface, global_iface_list) { if (!(iface->flags & IF_UP)) continue; diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c index 2aae341a..b8c40c9b 100644 --- a/proto/ospf/iface.c +++ b/proto/ospf/iface.c @@ -1225,7 +1225,7 @@ ospf_reconfigure_ifaces2(struct ospf_proto *p) struct iface *iface; struct ifa *a; - WALK_LIST(iface, iface_list) + WALK_LIST(iface, global_iface_list) { if (! (iface->flags & IF_UP)) continue; @@ -1271,7 +1271,7 @@ ospf_reconfigure_ifaces3(struct ospf_proto *p) struct iface *iface; struct ifa *a; - WALK_LIST(iface, iface_list) + WALK_LIST(iface, global_iface_list) { if (! (iface->flags & IF_UP)) continue; diff --git a/proto/radv/radv.c b/proto/radv/radv.c index b0f15514..63549c77 100644 --- a/proto/radv/radv.c +++ b/proto/radv/radv.c @@ -664,7 +664,7 @@ radv_reconfigure(struct proto *P, struct proto_config *CF) channel_request_feeding(p->p.main_channel); struct iface *iface; - WALK_LIST(iface, iface_list) + WALK_LIST(iface, global_iface_list) { if (!(iface->flags & IF_UP)) continue; diff --git a/proto/rip/rip.c b/proto/rip/rip.c index ee05f058..b4c702ae 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -776,7 +776,7 @@ rip_reconfigure_ifaces(struct rip_proto *p, struct rip_config *cf) { struct iface *iface; - WALK_LIST(iface, iface_list) + WALK_LIST(iface, global_iface_list) { if (!(iface->flags & IF_UP)) continue; diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c index 1d0a8e1b..a0f6a7cb 100644 --- a/sysdep/bsd/krt-sock.c +++ b/sysdep/bsd/krt-sock.c @@ -242,7 +242,7 @@ krt_send_route(struct krt_proto *p, int cmd, const rte *e) */ if (!i) { - WALK_LIST(j, iface_list) + WALK_LIST(j, global_iface_list) { if (j->flags & IF_LOOPBACK) { diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c index bff2d579..9b7b502d 100644 --- a/sysdep/linux/netlink.c +++ b/sysdep/linux/netlink.c @@ -1148,7 +1148,7 @@ kif_do_scan(struct kif_proto *p UNUSED) /* Re-resolve master interface for slaves */ struct iface *i; - WALK_LIST(i, iface_list) + WALK_LIST(i, global_iface_list) if (i->master_index) { struct iface f = {