0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-09-20 12:25:20 +00:00

Global interface list renamed to not clash with local lists

This commit is contained in:
Maria Matejka 2022-01-24 10:01:10 +01:00
parent b6c9263543
commit c651cef737
9 changed files with 27 additions and 27 deletions

View File

@ -36,7 +36,7 @@
static pool *if_pool; static pool *if_pool;
list iface_list; list global_iface_list;
struct iface default_vrf; struct iface default_vrf;
static void if_recalc_preferred(struct iface *i); static void if_recalc_preferred(struct iface *i);
@ -111,7 +111,7 @@ if_dump_all(void)
struct iface *i; struct iface *i;
debug("Known network interfaces:\n"); debug("Known network interfaces:\n");
WALK_LIST(i, iface_list) WALK_LIST(i, global_iface_list)
if_dump(i); if_dump(i);
debug("Router ID: %08x\n", config->router_id); debug("Router ID: %08x\n", config->router_id);
} }
@ -307,7 +307,7 @@ if_update(struct iface *new)
if (!new->master) if (!new->master)
new->master = &default_vrf; new->master = &default_vrf;
WALK_LIST(i, iface_list) WALK_LIST(i, global_iface_list)
if (!strcmp(new->name, i->name)) if (!strcmp(new->name, i->name))
{ {
new->flags = if_recalc_flags(new, new->flags); new->flags = if_recalc_flags(new, new->flags);
@ -340,7 +340,7 @@ if_update(struct iface *new)
newif: newif:
init_list(&i->neighbors); init_list(&i->neighbors);
i->flags |= IF_UPDATED | IF_TMP_DOWN; /* Tmp down as we don't have addresses yet */ 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; return i;
} }
@ -350,7 +350,7 @@ if_start_update(void)
struct iface *i; struct iface *i;
struct ifa *a; struct ifa *a;
WALK_LIST(i, iface_list) WALK_LIST(i, global_iface_list)
{ {
i->flags &= ~IF_UPDATED; i->flags &= ~IF_UPDATED;
WALK_LIST(a, i->addrs) WALK_LIST(a, i->addrs)
@ -374,7 +374,7 @@ if_end_update(void)
struct iface *i; struct iface *i;
struct ifa *a, *b; struct ifa *a, *b;
WALK_LIST(i, iface_list) WALK_LIST(i, global_iface_list)
{ {
if (!(i->flags & IF_UPDATED)) if (!(i->flags & IF_UPDATED))
if_change_flags(i, (i->flags & ~IF_ADMIN_UP) | IF_SHUTDOWN); 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 */ if (!p->if_notify && !p->ifa_notify) /* shortcut */
return; return;
DBG("Announcing interfaces to new protocol %s\n", p->name); 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_send_notify(p, IF_CHANGE_CREATE | ((i->flags & IF_UP) ? IF_CHANGE_UP : 0), i);
if (i->flags & IF_UP) if (i->flags & IF_UP)
@ -435,7 +435,7 @@ if_find_by_index(unsigned idx)
{ {
struct iface *i; struct iface *i;
WALK_LIST(i, iface_list) WALK_LIST(i, global_iface_list)
if (i->index == idx && !(i->flags & IF_SHUTDOWN)) if (i->index == idx && !(i->flags & IF_SHUTDOWN))
return i; return i;
return NULL; return NULL;
@ -454,7 +454,7 @@ if_find_by_name(const char *name)
{ {
struct iface *i; struct iface *i;
WALK_LIST(i, iface_list) WALK_LIST(i, global_iface_list)
if (!strcmp(i->name, name) && !(i->flags & IF_SHUTDOWN)) if (!strcmp(i->name, name) && !(i->flags & IF_SHUTDOWN))
return i; return i;
return NULL; return NULL;
@ -465,7 +465,7 @@ if_get_by_name(const char *name)
{ {
struct iface *i; struct iface *i;
WALK_LIST(i, iface_list) WALK_LIST(i, global_iface_list)
if (!strcmp(i->name, name)) if (!strcmp(i->name, name))
return i; return i;
@ -475,7 +475,7 @@ if_get_by_name(const char *name)
i->flags = IF_SHUTDOWN; i->flags = IF_SHUTDOWN;
init_list(&i->addrs); init_list(&i->addrs);
init_list(&i->neighbors); init_list(&i->neighbors);
add_tail(&iface_list, &i->n); add_tail(&global_iface_list, &i->n);
return i; return i;
} }
@ -561,7 +561,7 @@ if_recalc_all_preferred_addresses(void)
{ {
struct iface *i; struct iface *i;
WALK_LIST(i, iface_list) WALK_LIST(i, global_iface_list)
{ {
if_recalc_preferred(i); if_recalc_preferred(i);
@ -669,7 +669,7 @@ if_choose_router_id(struct iface_patt *mask, u32 old_id)
struct ifa *a, *b; struct ifa *a, *b;
b = NULL; b = NULL;
WALK_LIST(i, iface_list) WALK_LIST(i, global_iface_list)
{ {
if (!(i->flags & IF_ADMIN_UP) || if (!(i->flags & IF_ADMIN_UP) ||
(i->flags & IF_SHUTDOWN)) (i->flags & IF_SHUTDOWN))
@ -716,7 +716,7 @@ void
if_init(void) if_init(void)
{ {
if_pool = rp_new(&root_pool, &main_birdloop, "Interfaces"); if_pool = rp_new(&root_pool, &main_birdloop, "Interfaces");
init_list(&iface_list); init_list(&global_iface_list);
strcpy(default_vrf.name, "default"); strcpy(default_vrf.name, "default");
neigh_init(if_pool); neigh_init(if_pool);
} }
@ -844,7 +844,7 @@ if_show(void)
struct ifa *a; struct ifa *a;
char *type; char *type;
WALK_LIST(i, iface_list) WALK_LIST(i, global_iface_list)
{ {
if (i->flags & IF_SHUTDOWN) if (i->flags & IF_SHUTDOWN)
continue; continue;
@ -887,7 +887,7 @@ if_show_summary(void)
struct iface *i; struct iface *i;
cli_msg(-2005, "%-10s %-6s %-18s %s", "Interface", "State", "IPv4 address", "IPv6 address"); 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 a4[IPA_MAX_TEXT_LENGTH + 17];
byte a6[IPA_MAX_TEXT_LENGTH + 17]; byte a6[IPA_MAX_TEXT_LENGTH + 17];

View File

@ -12,7 +12,7 @@
#include "lib/lists.h" #include "lib/lists.h"
#include "lib/ip.h" #include "lib/ip.h"
extern list iface_list; extern list global_iface_list;
struct proto; struct proto;
struct pool; struct pool;

View File

@ -152,7 +152,7 @@ if_connected_any(ip_addr a, struct iface *vrf, struct iface **iface, struct ifa
*addr = NULL; *addr = NULL;
/* Prefer SCOPE_HOST or longer prefix */ /* 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 ((!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))) 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; node *x, *y;
/* Update neighbors that might be better off with the new iface */ /* 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)) if (!EMPTY_LIST(ii->neighbors) && (ii != i) && if_intersect(i, ii))
WALK_LIST2_DELSAFE(n, x, y, ii->neighbors, if_n) WALK_LIST2_DELSAFE(n, x, y, ii->neighbors, if_n)
neigh_update(n, i); neigh_update(n, i);
@ -502,7 +502,7 @@ neigh_ifa_up(struct ifa *a)
node *x, *y; node *x, *y;
/* Update neighbors that might be better off with the new ifa */ /* 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)) if (!EMPTY_LIST(ii->neighbors) && ifa_intersect(a, ii))
WALK_LIST2_DELSAFE(n, x, y, ii->neighbors, if_n) WALK_LIST2_DELSAFE(n, x, y, ii->neighbors, if_n)
neigh_update(n, i); neigh_update(n, i);

View File

@ -1907,7 +1907,7 @@ babel_reconfigure_ifaces(struct babel_proto *p, struct babel_config *cf)
{ {
struct iface *iface; struct iface *iface;
WALK_LIST(iface, iface_list) WALK_LIST(iface, global_iface_list)
{ {
if (!(iface->flags & IF_UP)) if (!(iface->flags & IF_UP))
continue; continue;

View File

@ -1225,7 +1225,7 @@ ospf_reconfigure_ifaces2(struct ospf_proto *p)
struct iface *iface; struct iface *iface;
struct ifa *a; struct ifa *a;
WALK_LIST(iface, iface_list) WALK_LIST(iface, global_iface_list)
{ {
if (! (iface->flags & IF_UP)) if (! (iface->flags & IF_UP))
continue; continue;
@ -1271,7 +1271,7 @@ ospf_reconfigure_ifaces3(struct ospf_proto *p)
struct iface *iface; struct iface *iface;
struct ifa *a; struct ifa *a;
WALK_LIST(iface, iface_list) WALK_LIST(iface, global_iface_list)
{ {
if (! (iface->flags & IF_UP)) if (! (iface->flags & IF_UP))
continue; continue;

View File

@ -664,7 +664,7 @@ radv_reconfigure(struct proto *P, struct proto_config *CF)
channel_request_feeding(p->p.main_channel); channel_request_feeding(p->p.main_channel);
struct iface *iface; struct iface *iface;
WALK_LIST(iface, iface_list) WALK_LIST(iface, global_iface_list)
{ {
if (!(iface->flags & IF_UP)) if (!(iface->flags & IF_UP))
continue; continue;

View File

@ -776,7 +776,7 @@ rip_reconfigure_ifaces(struct rip_proto *p, struct rip_config *cf)
{ {
struct iface *iface; struct iface *iface;
WALK_LIST(iface, iface_list) WALK_LIST(iface, global_iface_list)
{ {
if (!(iface->flags & IF_UP)) if (!(iface->flags & IF_UP))
continue; continue;

View File

@ -242,7 +242,7 @@ krt_send_route(struct krt_proto *p, int cmd, const rte *e)
*/ */
if (!i) if (!i)
{ {
WALK_LIST(j, iface_list) WALK_LIST(j, global_iface_list)
{ {
if (j->flags & IF_LOOPBACK) if (j->flags & IF_LOOPBACK)
{ {

View File

@ -1148,7 +1148,7 @@ kif_do_scan(struct kif_proto *p UNUSED)
/* Re-resolve master interface for slaves */ /* Re-resolve master interface for slaves */
struct iface *i; struct iface *i;
WALK_LIST(i, iface_list) WALK_LIST(i, global_iface_list)
if (i->master_index) if (i->master_index)
{ {
struct iface f = { struct iface f = {