diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-10-16 18:00:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-16 18:00:38 +0200 |
commit | 5b8d8894f8ecb401acc9b3986bbb6ce95b3263e9 (patch) | |
tree | 077628692cdbae750e26d1b8f237c422bae6519d /ospf6d | |
parent | Merge pull request #1305 from donaldsharp/workqueue (diff) | |
parent | *: use the FOR_ALL_INTERFACES abstraction from babeld (diff) | |
download | frr-5b8d8894f8ecb401acc9b3986bbb6ce95b3263e9.tar.xz frr-5b8d8894f8ecb401acc9b3986bbb6ce95b3263e9.zip |
Merge pull request #1298 from opensourcerouting/iface-rb-tree
Use rb-trees to store interfaces instead of linked-lists
Diffstat (limited to 'ospf6d')
-rw-r--r-- | ospf6d/ospf6_bfd.c | 7 | ||||
-rw-r--r-- | ospf6d/ospf6_interface.c | 16 | ||||
-rw-r--r-- | ospf6d/ospf6_main.c | 4 | ||||
-rw-r--r-- | ospf6d/ospf6_snmp.c | 10 | ||||
-rw-r--r-- | ospf6d/ospf6_top.c | 2 | ||||
-rw-r--r-- | ospf6d/ospf6_zebra.c | 2 |
6 files changed, 22 insertions, 19 deletions
diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c index fa0030b6d..e28af9d06 100644 --- a/ospf6d/ospf6_bfd.c +++ b/ospf6d/ospf6_bfd.c @@ -141,7 +141,8 @@ static void ospf6_bfd_reg_dereg_all_nbr(struct ospf6_interface *oi, int command) static int ospf6_bfd_nbr_replay(int command, struct zclient *zclient, zebra_size_t length, vrf_id_t vrf_id) { - struct listnode *inode, *nnode; + struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); + struct listnode *node; struct interface *ifp; struct ospf6_interface *oi; struct ospf6_neighbor *on; @@ -154,13 +155,13 @@ static int ospf6_bfd_nbr_replay(int command, struct zclient *zclient, bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER); /* Replay the neighbor, if BFD is enabled on the interface*/ - for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), inode, ifp)) { + FOR_ALL_INTERFACES (vrf, ifp) { oi = (struct ospf6_interface *)ifp->info; if (!oi || !oi->bfd_info) continue; - for (ALL_LIST_ELEMENTS_RO(oi->neighbor_list, nnode, on)) { + for (ALL_LIST_ELEMENTS_RO(oi->neighbor_list, node, on)) { if (on->state < OSPF6_NEIGHBOR_TWOWAY) continue; diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 7286b3242..f237e4bef 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -983,9 +983,9 @@ DEFUN (show_ipv6_ospf6_interface, INTERFACE_STR IFNAME_STR) { + struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); int idx_ifname = 4; struct interface *ifp; - struct listnode *i; if (argc == 5) { ifp = if_lookup_by_name(argv[idx_ifname]->arg, VRF_DEFAULT); @@ -996,7 +996,7 @@ DEFUN (show_ipv6_ospf6_interface, } ospf6_interface_show(vty, ifp); } else { - for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), i, ifp)) + FOR_ALL_INTERFACES (vrf, ifp) ospf6_interface_show(vty, ifp); } @@ -1054,12 +1054,12 @@ DEFUN (show_ipv6_ospf6_interface_prefix, OSPF6_ROUTE_MATCH_STR "Display details of the prefixes\n") { + struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); int idx_prefix = 5; - struct listnode *i; struct ospf6_interface *oi; struct interface *ifp; - for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), i, ifp)) { + FOR_ALL_INTERFACES (vrf, ifp) { oi = (struct ospf6_interface *)ifp->info; if (oi == NULL) continue; @@ -1755,11 +1755,11 @@ DEFUN (no_ipv6_ospf6_network, static int config_write_ospf6_interface(struct vty *vty) { - struct listnode *i; + struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); struct ospf6_interface *oi; struct interface *ifp; - for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), i, ifp)) { + FOR_ALL_INTERFACES (vrf, ifp) { oi = (struct ospf6_interface *)ifp->info; if (oi == NULL) continue; @@ -1905,13 +1905,13 @@ DEFUN (clear_ipv6_ospf6_interface, IFNAME_STR ) { + struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); int idx_ifname = 4; struct interface *ifp; - struct listnode *node; if (argc == 4) /* Clear all the ospfv3 interfaces. */ { - for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp)) + FOR_ALL_INTERFACES (vrf, ifp) ospf6_interface_clear(vty, ifp); } else /* Interface name is specified. */ { diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index e582737f9..4641f41c3 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -79,7 +79,7 @@ struct thread_master *master; static void __attribute__((noreturn)) ospf6_exit(int status) { - struct listnode *node; + struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); struct interface *ifp; frr_early_fini(); @@ -89,7 +89,7 @@ static void __attribute__((noreturn)) ospf6_exit(int status) bfd_gbl_exit(); - for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp)) + FOR_ALL_INTERFACES (vrf, ifp) if (ifp->info != NULL) ospf6_interface_delete(ifp->info); diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c index 0b399bad1..c14810744 100644 --- a/ospf6d/ospf6_snmp.c +++ b/ospf6d/ospf6_snmp.c @@ -837,6 +837,7 @@ static u_char *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method) { + struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); struct ospf6_lsa *lsa = NULL; ifindex_t ifindex; uint32_t area_id, id, instid, adv_router; @@ -955,8 +956,7 @@ static u_char *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, if (!ifslist) return NULL; ifslist->cmp = (int (*)(void *, void *))if_icmp_func; - for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, - iif)) + FOR_ALL_INTERFACES (vrf, iif) listnode_add_sort(ifslist, iif); for (ALL_LIST_ELEMENTS_RO(ifslist, node, iif)) { @@ -1042,6 +1042,7 @@ static u_char *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method) { + struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); ifindex_t ifindex = 0; unsigned int instid = 0; struct ospf6_interface *oi = NULL; @@ -1092,7 +1093,7 @@ static u_char *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, if (!ifslist) return NULL; ifslist->cmp = (int (*)(void *, void *))if_icmp_func; - for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), i, iif)) + FOR_ALL_INTERFACES (vrf, iif) listnode_add_sort(ifslist, iif); for (ALL_LIST_ELEMENTS_RO(ifslist, i, iif)) { @@ -1194,6 +1195,7 @@ static u_char *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method) { + struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); ifindex_t ifindex = 0; unsigned int instid, rtrid; struct ospf6_interface *oi = NULL; @@ -1253,7 +1255,7 @@ static u_char *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length, if (!ifslist) return NULL; ifslist->cmp = (int (*)(void *, void *))if_icmp_func; - for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), i, iif)) + FOR_ALL_INTERFACES (vrf, iif) listnode_add_sort(ifslist, iif); for (ALL_LIST_ELEMENTS_RO(ifslist, i, iif)) { diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index b0281b9e0..e0844765d 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -595,7 +595,7 @@ DEFUN (ospf6_interface_area, u_int32_t area_id; /* find/create ospf6 interface */ - ifp = if_get_by_name(argv[idx_ifname]->arg, VRF_DEFAULT); + ifp = if_get_by_name(argv[idx_ifname]->arg, VRF_DEFAULT, 0); oi = (struct ospf6_interface *)ifp->info; if (oi == NULL) oi = ospf6_interface_create(ifp); diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 30bb4393c..b032bd7a7 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -126,7 +126,7 @@ static int ospf6_zebra_if_del(int command, struct zclient *zclient, ospf6_interface_if_del (ifp); #endif /*0*/ - ifp->ifindex = IFINDEX_DELETED; + if_set_index(ifp, IFINDEX_INTERNAL); return 0; } |