summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2017-09-15 17:47:35 +0200
committerRenato Westphal <renato@opensourcerouting.org>2017-09-15 19:53:46 +0200
commita2addae8fe172f04f4d8ac99aa123a7d2dd64604 (patch)
treec58663b6654a9bec64ac4c26e11d158fd48b34ad /zebra
parentMerge pull request #1178 from donaldsharp/pim_obfuscation (diff)
downloadfrr-a2addae8fe172f04f4d8ac99aa123a7d2dd64604.tar.xz
frr-a2addae8fe172f04f4d8ac99aa123a7d2dd64604.zip
*: use clang's 'ForEachMacros' format style option
This fixes the broken indentation of several foreach loops throughout the code. From clang's documentation[1]: ForEachMacros: A vector of macros that should be interpreted as foreach loops instead of as function calls. [1] http://clang.llvm.org/docs/ClangFormatStyleOptions.html Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/interface.c146
-rw-r--r--zebra/irdp_main.c28
-rw-r--r--zebra/main.c3
-rw-r--r--zebra/redistribute.c26
-rw-r--r--zebra/router-id.c28
-rw-r--r--zebra/rt_netlink.c3
-rw-r--r--zebra/rtadv.c67
-rw-r--r--zebra/zebra_fpm.c3
-rw-r--r--zebra/zebra_l2.c3
-rw-r--r--zebra/zebra_mpls.c17
-rw-r--r--zebra/zebra_ptm.c57
-rw-r--r--zebra/zebra_pw.c12
-rw-r--r--zebra/zebra_rib.c84
-rw-r--r--zebra/zebra_rnh.c6
-rw-r--r--zebra/zebra_routemap.c3
-rw-r--r--zebra/zebra_snmp.c12
-rw-r--r--zebra/zebra_static.c6
-rw-r--r--zebra/zebra_vrf.c8
-rw-r--r--zebra/zebra_vty.c101
-rw-r--r--zebra/zserv.c9
20 files changed, 289 insertions, 333 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index 358f940c5..664e493d8 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -1349,9 +1349,9 @@ DEFUN (show_interface_vrf_all,
interface_update_stats();
/* All interface print. */
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, ifp))
- if_dump_vty(vty, ifp);
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, ifp))
+ if_dump_vty(vty, ifp);
return CMD_SUCCESS;
}
@@ -1404,8 +1404,7 @@ DEFUN (show_interface_name_vrf_all,
interface_update_stats();
/* All interface print. */
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
/* Specified interface print. */
ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf->vrf_id);
if (ifp) {
@@ -1486,11 +1485,11 @@ DEFUN (show_interface_desc_vrf_all,
{
struct vrf *vrf;
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- if (!list_isempty(vrf->iflist)) {
- vty_out(vty, "\n\tVRF %u\n\n", vrf->vrf_id);
- if_show_description(vty, vrf->vrf_id);
- }
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ if (!list_isempty(vrf->iflist)) {
+ vty_out(vty, "\n\tVRF %u\n\n", vrf->vrf_id);
+ if_show_description(vty, vrf->vrf_id);
+ }
return CMD_SUCCESS;
}
@@ -2836,80 +2835,89 @@ static int if_config_write(struct vty *vty)
zebra_ptm_write(vty);
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, ifp)) {
- struct zebra_if *if_data;
- struct listnode *addrnode;
- struct connected *ifc;
- struct prefix *p;
- struct vrf *vrf;
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, ifp)) {
+ struct zebra_if *if_data;
+ struct listnode *addrnode;
+ struct connected *ifc;
+ struct prefix *p;
+ struct vrf *vrf;
- if_data = ifp->info;
- vrf = vrf_lookup_by_id(ifp->vrf_id);
+ if_data = ifp->info;
+ vrf = vrf_lookup_by_id(ifp->vrf_id);
- if (ifp->vrf_id == VRF_DEFAULT)
- vty_frame(vty, "interface %s\n", ifp->name);
- else
- vty_frame(vty, "interface %s vrf %s\n", ifp->name,
- vrf->name);
+ if (ifp->vrf_id == VRF_DEFAULT)
+ vty_frame(vty, "interface %s\n", ifp->name);
+ else
+ vty_frame(vty, "interface %s vrf %s\n",
+ ifp->name, vrf->name);
- if (if_data) {
- if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON)
- vty_out(vty, " shutdown\n");
+ if (if_data) {
+ if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON)
+ vty_out(vty, " shutdown\n");
- zebra_ptm_if_write(vty, if_data);
- }
+ zebra_ptm_if_write(vty, if_data);
+ }
- if (ifp->desc)
- vty_out(vty, " description %s\n", ifp->desc);
-
- /* Assign bandwidth here to avoid unnecessary interface flap
- while processing config script */
- if (ifp->bandwidth != 0)
- vty_out(vty, " bandwidth %u\n", ifp->bandwidth);
-
- if (!CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION))
- vty_out(vty, " no link-detect\n");
-
- for (ALL_LIST_ELEMENTS_RO(ifp->connected, addrnode, ifc)) {
- if (CHECK_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED)) {
- char buf[INET6_ADDRSTRLEN];
- p = ifc->address;
- vty_out(vty, " ip%s address %s",
- p->family == AF_INET ? "" : "v6",
- inet_ntop(p->family, &p->u.prefix, buf,
- sizeof(buf)));
- if (CONNECTED_PEER(ifc)) {
- p = ifc->destination;
- vty_out(vty, " peer %s",
+ if (ifp->desc)
+ vty_out(vty, " description %s\n", ifp->desc);
+
+ /* Assign bandwidth here to avoid unnecessary interface
+ flap
+ while processing config script */
+ if (ifp->bandwidth != 0)
+ vty_out(vty, " bandwidth %u\n", ifp->bandwidth);
+
+ if (!CHECK_FLAG(ifp->status,
+ ZEBRA_INTERFACE_LINKDETECTION))
+ vty_out(vty, " no link-detect\n");
+
+ for (ALL_LIST_ELEMENTS_RO(ifp->connected, addrnode,
+ ifc)) {
+ if (CHECK_FLAG(ifc->conf,
+ ZEBRA_IFC_CONFIGURED)) {
+ char buf[INET6_ADDRSTRLEN];
+ p = ifc->address;
+ vty_out(vty, " ip%s address %s",
+ p->family == AF_INET ? ""
+ : "v6",
inet_ntop(p->family,
&p->u.prefix, buf,
sizeof(buf)));
- }
- vty_out(vty, "/%d", p->prefixlen);
+ if (CONNECTED_PEER(ifc)) {
+ p = ifc->destination;
+ vty_out(vty, " peer %s",
+ inet_ntop(p->family,
+ &p->u.prefix,
+ buf,
+ sizeof(buf)));
+ }
+ vty_out(vty, "/%d", p->prefixlen);
- if (ifc->label)
- vty_out(vty, " label %s", ifc->label);
+ if (ifc->label)
+ vty_out(vty, " label %s",
+ ifc->label);
- vty_out(vty, "\n");
+ vty_out(vty, "\n");
+ }
}
- }
- if (if_data) {
- if (if_data->multicast != IF_ZEBRA_MULTICAST_UNSPEC)
- vty_out(vty, " %smulticast\n",
- if_data->multicast
- == IF_ZEBRA_MULTICAST_ON
- ? ""
- : "no ");
- }
+ if (if_data) {
+ if (if_data->multicast
+ != IF_ZEBRA_MULTICAST_UNSPEC)
+ vty_out(vty, " %smulticast\n",
+ if_data->multicast
+ == IF_ZEBRA_MULTICAST_ON
+ ? ""
+ : "no ");
+ }
- hook_call(zebra_if_config_wr, vty, ifp);
+ hook_call(zebra_if_config_wr, vty, ifp);
- link_params_config_write(vty, ifp);
+ link_params_config_write(vty, ifp);
- vty_endframe(vty, "!\n");
- }
+ vty_endframe(vty, "!\n");
+ }
return 0;
}
diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c
index 9dfa85472..bc85e983e 100644
--- a/zebra/irdp_main.c
+++ b/zebra/irdp_main.c
@@ -322,21 +322,21 @@ static int irdp_finish(void)
zlog_info("IRDP: Received shutdown notification.");
- RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
- for (ALL_LIST_ELEMENTS(vrf->iflist, node, nnode, ifp)) {
- zi = ifp->info;
-
- if (!zi)
- continue;
- irdp = zi->irdp;
- if (!irdp)
- continue;
-
- if (irdp->flags & IF_ACTIVE) {
- irdp->flags |= IF_SHUTDOWN;
- irdp_advert_off(ifp);
+ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
+ for (ALL_LIST_ELEMENTS(vrf->iflist, node, nnode, ifp)) {
+ zi = ifp->info;
+
+ if (!zi)
+ continue;
+ irdp = zi->irdp;
+ if (!irdp)
+ continue;
+
+ if (irdp->flags & IF_ACTIVE) {
+ irdp->flags |= IF_SHUTDOWN;
+ irdp_advert_off(ifp);
+ }
}
- }
return 0;
}
diff --git a/zebra/main.c b/zebra/main.c
index bc7276817..4864b4961 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -131,8 +131,7 @@ static void sigint(void)
list_delete_all_node(zebrad.client_list);
if (retain_mode)
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
zvrf = vrf->info;
if (zvrf)
SET_FLAG(zvrf->flags, ZEBRA_VRF_RETAIN);
diff --git a/zebra/redistribute.c b/zebra/redistribute.c
index 93bfc0c03..76e0df40b 100644
--- a/zebra/redistribute.c
+++ b/zebra/redistribute.c
@@ -84,12 +84,12 @@ static void zebra_redistribute_default(struct zserv *client, vrf_id_t vrf_id)
if (!rn)
continue;
- RNODE_FOREACH_RE(rn, newre) {
+ RNODE_FOREACH_RE (rn, newre) {
if (CHECK_FLAG(newre->flags, ZEBRA_FLAG_SELECTED)
&& newre->distance != DISTANCE_INFINITY)
zsend_redistribute_route(
- ZEBRA_REDISTRIBUTE_ROUTE_ADD,
- client, &rn->p, NULL, newre);
+ ZEBRA_REDISTRIBUTE_ROUTE_ADD, client,
+ &rn->p, NULL, newre);
}
route_unlock_node(rn);
@@ -109,8 +109,7 @@ static void zebra_redistribute(struct zserv *client, int type, u_short instance,
return;
for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
- RNODE_FOREACH_RE(rn, newre)
- {
+ RNODE_FOREACH_RE (rn, newre) {
struct prefix *dst_p, *src_p;
srcdest_rnode_prefixes(rn, &dst_p, &src_p);
@@ -506,10 +505,8 @@ int zebra_add_import_table_entry(struct route_node *rn, struct route_entry *re,
prefix_copy(&p, &rn->p);
- RNODE_FOREACH_RE(rn, same)
- {
- if (CHECK_FLAG(same->status,
- ROUTE_ENTRY_REMOVED))
+ RNODE_FOREACH_RE (rn, same) {
+ if (CHECK_FLAG(same->status, ROUTE_ENTRY_REMOVED))
continue;
if (same->type == re->type
@@ -620,8 +617,7 @@ int zebra_import_table(afi_t afi, u_int32_t table_id, u_int32_t distance,
if (!rn->info)
continue;
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue;
break;
@@ -708,11 +704,9 @@ void zebra_import_table_rm_update()
if (!rn->info)
continue;
- RNODE_FOREACH_RE(rn, re)
- {
- if (CHECK_FLAG(
- re->status,
- ROUTE_ENTRY_REMOVED))
+ RNODE_FOREACH_RE (rn, re) {
+ if (CHECK_FLAG(re->status,
+ ROUTE_ENTRY_REMOVED))
continue;
break;
}
diff --git a/zebra/router-id.c b/zebra/router-id.c
index 383f21864..f6c88a216 100644
--- a/zebra/router-id.c
+++ b/zebra/router-id.c
@@ -187,19 +187,21 @@ void router_id_write(struct vty *vty)
struct vrf *vrf;
struct zebra_vrf *zvrf;
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- if ((zvrf = vrf->info) != NULL)
- if (zvrf->rid_user_assigned.u.prefix4.s_addr) {
- if (zvrf_id(zvrf) == VRF_DEFAULT)
- vty_out(vty, "router-id %s\n",
- inet_ntoa(zvrf->rid_user_assigned.u
- .prefix4));
- else
- vty_out(vty, "router-id %s vrf %s\n",
- inet_ntoa(zvrf->rid_user_assigned.u
- .prefix4),
- zvrf_name(zvrf));
- }
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ if ((zvrf = vrf->info) != NULL)
+ if (zvrf->rid_user_assigned.u.prefix4.s_addr) {
+ if (zvrf_id(zvrf) == VRF_DEFAULT)
+ vty_out(vty, "router-id %s\n",
+ inet_ntoa(
+ zvrf->rid_user_assigned
+ .u.prefix4));
+ else
+ vty_out(vty, "router-id %s vrf %s\n",
+ inet_ntoa(
+ zvrf->rid_user_assigned
+ .u.prefix4),
+ zvrf_name(zvrf));
+ }
}
DEFUN (router_id,
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index e59d5f00f..bf1042a72 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -247,8 +247,7 @@ static vrf_id_t vrf_lookup_by_table(u_int32_t table_id)
struct vrf *vrf;
struct zebra_vrf *zvrf;
- RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
- {
+ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
if ((zvrf = vrf->info) == NULL || (zvrf->table_id != table_id))
continue;
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 88836af72..6091c75e5 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -395,41 +395,48 @@ static int rtadv_timer(struct thread *thread)
rtadv_event(zns, RTADV_TIMER_MSEC, 10 /* 10 ms */);
}
- RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
- for (ALL_LIST_ELEMENTS(vrf->iflist, node, nnode, ifp)) {
- if (if_is_loopback(ifp)
- || CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK)
- || !if_is_operative(ifp))
- continue;
+ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
+ for (ALL_LIST_ELEMENTS(vrf->iflist, node, nnode, ifp)) {
+ if (if_is_loopback(ifp)
+ || CHECK_FLAG(ifp->status,
+ ZEBRA_INTERFACE_VRF_LOOPBACK)
+ || !if_is_operative(ifp))
+ continue;
+
+ zif = ifp->info;
+
+ if (zif->rtadv.AdvSendAdvertisements) {
+ if (zif->rtadv.inFastRexmit) {
+ /* We assume we fast rexmit every sec so
+ * no
+ * additional vars */
+ if (--zif->rtadv.NumFastReXmitsRemain
+ <= 0)
+ zif->rtadv.inFastRexmit = 0;
+
+ if (IS_ZEBRA_DEBUG_SEND)
+ zlog_debug(
+ "Fast RA Rexmit on interface %s",
+ ifp->name);
- zif = ifp->info;
-
- if (zif->rtadv.AdvSendAdvertisements) {
- if (zif->rtadv.inFastRexmit) {
- /* We assume we fast rexmit every sec so no
- * additional vars */
- if (--zif->rtadv.NumFastReXmitsRemain <= 0)
- zif->rtadv.inFastRexmit = 0;
-
- if (IS_ZEBRA_DEBUG_SEND)
- zlog_debug(
- "Fast RA Rexmit on interface %s",
- ifp->name);
-
- rtadv_send_packet(zns->rtadv.sock, ifp);
- } else {
- zif->rtadv.AdvIntervalTimer -= period;
- if (zif->rtadv.AdvIntervalTimer <= 0) {
- /* FIXME: using MaxRtrAdvInterval each
- time isn't what section
- 6.2.4 of RFC4861 tells to do. */
- zif->rtadv.AdvIntervalTimer =
- zif->rtadv.MaxRtrAdvInterval;
rtadv_send_packet(zns->rtadv.sock, ifp);
+ } else {
+ zif->rtadv.AdvIntervalTimer -= period;
+ if (zif->rtadv.AdvIntervalTimer <= 0) {
+ /* FIXME: using
+ MaxRtrAdvInterval each
+ time isn't what section
+ 6.2.4 of RFC4861 tells to do.
+ */
+ zif->rtadv.AdvIntervalTimer =
+ zif->rtadv
+ .MaxRtrAdvInterval;
+ rtadv_send_packet(
+ zns->rtadv.sock, ifp);
+ }
}
}
}
- }
return 0;
}
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index 8c0700ac8..6d3a8de8c 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -873,8 +873,7 @@ struct route_entry *zfpm_route_for_update(rib_dest_t *dest)
{
struct route_entry *re;
- RE_DEST_FOREACH_ROUTE(dest, re)
- {
+ RE_DEST_FOREACH_ROUTE (dest, re) {
if (!CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB))
continue;
diff --git a/zebra/zebra_l2.c b/zebra/zebra_l2.c
index 3d505857c..345637c04 100644
--- a/zebra/zebra_l2.c
+++ b/zebra/zebra_l2.c
@@ -55,8 +55,7 @@ static void map_slaves_to_bridge(struct interface *br_if, int link)
struct listnode *node;
struct interface *ifp;
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, ifp)) {
struct zebra_if *zif;
struct zebra_l2info_brslave *br_slave;
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index e3ce41412..3c7319f35 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -411,8 +411,7 @@ static int fec_change_update_lsp(struct zebra_vrf *zvrf, zebra_fec_t *fec,
if (!rn)
return 0;
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED))
break;
}
@@ -614,8 +613,7 @@ static int nhlfe_nexthop_active_ipv4(zebra_nhlfe_t *nhlfe,
route_unlock_node(rn);
/* Locate a valid connected route. */
- RNODE_FOREACH_RE(rn, match)
- {
+ RNODE_FOREACH_RE (rn, match) {
if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED)
|| !CHECK_FLAG(match->flags, ZEBRA_FLAG_SELECTED))
continue;
@@ -664,8 +662,7 @@ static int nhlfe_nexthop_active_ipv6(zebra_nhlfe_t *nhlfe,
route_unlock_node(rn);
/* Locate a valid connected route. */
- RNODE_FOREACH_RE(rn, match)
- {
+ RNODE_FOREACH_RE (rn, match) {
if ((match->type == ZEBRA_ROUTE_CONNECT)
&& !CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED)
&& CHECK_FLAG(match->flags, ZEBRA_FLAG_SELECTED))
@@ -2164,8 +2161,7 @@ int mpls_ftn_update(int add, struct zebra_vrf *zvrf, enum lsp_types_t type,
/* Lookup existing route */
rn = route_node_get(table, prefix);
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue;
if (re->distance == distance)
@@ -2392,9 +2388,8 @@ void mpls_ldp_ftn_uninstall_all(struct zebra_vrf *zvrf, int afi)
for (rn = route_top(table); rn; rn = route_next(rn)) {
update = 0;
- RNODE_FOREACH_RE(rn, re) {
- for (nexthop = re->nexthop;
- nexthop;
+ RNODE_FOREACH_RE (rn, re) {
+ for (nexthop = re->nexthop; nexthop;
nexthop = nexthop->next) {
if (nexthop->nh_label_type != ZEBRA_LSP_LDP)
continue;
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index b18b3e742..a42e6680e 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -263,17 +263,19 @@ DEFUN (zebra_ptm_enable,
ptm_cb.ptm_enable = ZEBRA_IF_PTM_ENABLE_ON;
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- for (ALL_LIST_ELEMENTS_RO(vrf->iflist, i, ifp))
- if (!ifp->ptm_enable) {
- if_data = (struct zebra_if *)ifp->info;
- if (if_data && (if_data->ptm_enable
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ for (ALL_LIST_ELEMENTS_RO(vrf->iflist, i, ifp))
+ if (!ifp->ptm_enable) {
+ if_data = (struct zebra_if *)ifp->info;
+ if (if_data
+ && (if_data->ptm_enable
== ZEBRA_IF_PTM_ENABLE_UNSPEC)) {
- ifp->ptm_enable = ZEBRA_IF_PTM_ENABLE_ON;
+ ifp->ptm_enable =
+ ZEBRA_IF_PTM_ENABLE_ON;
+ }
+ /* Assign a default unknown status */
+ ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
}
- /* Assign a default unknown status */
- ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
- }
zebra_ptm_connect(NULL);
@@ -1090,26 +1092,27 @@ void zebra_ptm_reset_status(int ptm_disable)
struct interface *ifp;
int send_linkup;
- RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
- for (ALL_LIST_ELEMENTS_RO(vrf->iflist, i, ifp)) {
- send_linkup = 0;
- if (ifp->ptm_enable) {
- if (!if_is_operative(ifp))
- send_linkup = 1;
-
- if (ptm_disable)
- ifp->ptm_enable = ZEBRA_IF_PTM_ENABLE_OFF;
- ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
-
- if (if_is_operative(ifp) && send_linkup) {
- if (IS_ZEBRA_DEBUG_EVENT)
- zlog_debug(
- "%s: Bringing up interface %s",
- __func__, ifp->name);
- if_up(ifp);
+ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
+ for (ALL_LIST_ELEMENTS_RO(vrf->iflist, i, ifp)) {
+ send_linkup = 0;
+ if (ifp->ptm_enable) {
+ if (!if_is_operative(ifp))
+ send_linkup = 1;
+
+ if (ptm_disable)
+ ifp->ptm_enable =
+ ZEBRA_IF_PTM_ENABLE_OFF;
+ ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
+
+ if (if_is_operative(ifp) && send_linkup) {
+ if (IS_ZEBRA_DEBUG_EVENT)
+ zlog_debug(
+ "%s: Bringing up interface %s",
+ __func__, ifp->name);
+ if_up(ifp);
+ }
}
}
- }
}
void zebra_ptm_if_init(struct zebra_if *zebra_ifp)
diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c
index ce9f19c3c..0ca7e34b2 100644
--- a/zebra/zebra_pw.c
+++ b/zebra/zebra_pw.c
@@ -274,11 +274,9 @@ void zebra_pw_client_close(struct zserv *client)
struct zebra_vrf *zvrf;
struct zebra_pw *pw, *tmp;
- RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
- {
+ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
zvrf = vrf->info;
- RB_FOREACH_SAFE(pw, zebra_pw_head, &zvrf->pseudowires, tmp)
- {
+ RB_FOREACH_SAFE (pw, zebra_pw_head, &zvrf->pseudowires, tmp) {
if (pw->client != client)
continue;
zebra_pw_del(zvrf, pw);
@@ -450,8 +448,7 @@ DEFUN (show_pseudowires,
vty_out(vty, "%-16s %-24s %-12s %-8s %-10s\n", "Interface", "Neighbor",
"Labels", "Protocol", "Status");
- RB_FOREACH(pw, zebra_pw_head, &zvrf->pseudowires)
- {
+ RB_FOREACH (pw, zebra_pw_head, &zvrf->pseudowires) {
char buf_nbr[INET6_ADDRSTRLEN];
char buf_labels[64];
@@ -486,8 +483,7 @@ static int zebra_pw_config(struct vty *vty)
if (!zvrf)
return 0;
- RB_FOREACH(pw, zebra_static_pw_head, &zvrf->static_pseudowires)
- {
+ RB_FOREACH (pw, zebra_static_pw_head, &zvrf->static_pseudowires) {
vty_out(vty, "pseudowire %s\n", pw->ifname);
if (pw->local_label != MPLS_NO_LABEL
&& pw->remote_label != MPLS_NO_LABEL)
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index d04b64b19..b1c2ae25c 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -447,8 +447,7 @@ static int nexthop_active(afi_t afi, struct route_entry *re,
&& !nh_resolve_via_default(p.family))
return 0;
- RNODE_FOREACH_RE(rn, match)
- {
+ RNODE_FOREACH_RE (rn, match) {
if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
continue;
@@ -563,8 +562,7 @@ struct route_entry *rib_match(afi_t afi, safi_t safi, vrf_id_t vrf_id,
route_unlock_node(rn);
/* Pick up selected route. */
- RNODE_FOREACH_RE(rn, match)
- {
+ RNODE_FOREACH_RE (rn, match) {
if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
continue;
if (CHECK_FLAG(match->status, ROUTE_ENTRY_SELECTED_FIB))
@@ -693,8 +691,7 @@ struct route_entry *rib_lookup_ipv4(struct prefix_ipv4 *p, vrf_id_t vrf_id)
/* Unlock node. */
route_unlock_node(rn);
- RNODE_FOREACH_RE(rn, match)
- {
+ RNODE_FOREACH_RE (rn, match) {
if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
continue;
if (CHECK_FLAG(match->status, ROUTE_ENTRY_SELECTED_FIB))
@@ -752,8 +749,7 @@ int rib_lookup_ipv4_route(struct prefix_ipv4 *p, union sockunion *qgate,
/* Find out if a "selected" RR for the discovered RIB entry exists ever.
*/
- RNODE_FOREACH_RE(rn, match)
- {
+ RNODE_FOREACH_RE (rn, match) {
if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED))
continue;
if (CHECK_FLAG(match->status, ROUTE_ENTRY_SELECTED_FIB))
@@ -1449,8 +1445,7 @@ static void rib_process(struct route_node *rn)
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug("%u:%s: Processing rn %p", vrf_id, buf, rn);
- RNODE_FOREACH_RE_SAFE(rn, re, next)
- {
+ RNODE_FOREACH_RE_SAFE (rn, re, next) {
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug(
"%u:%s: Examine re %p (type %d) status %x flags %x "
@@ -1619,8 +1614,7 @@ static void rib_process(struct route_node *rn)
}
/* Remove all RE entries queued for removal */
- RNODE_FOREACH_RE_SAFE(rn, re, next)
- {
+ RNODE_FOREACH_RE_SAFE (rn, re, next) {
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)) {
if (IS_ZEBRA_DEBUG_RIB) {
rnode_debug(rn, vrf_id, "rn %p, removing re %p",
@@ -1694,8 +1688,7 @@ static void meta_queue_process_complete(struct work_queue *dummy)
* should limit the evaluation to the necessary VRFs in most common
* situations.
*/
- RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
- {
+ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
zvrf = vrf->info;
if (zvrf == NULL || !(zvrf->flags & ZEBRA_VRF_RIB_SCHEDULED))
continue;
@@ -1778,8 +1771,7 @@ static void rib_meta_queue_add(struct meta_queue *mq, struct route_node *rn)
{
struct route_entry *re;
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
u_char qindex = meta_queue_map[re->type];
struct zebra_vrf *zvrf;
@@ -2139,8 +2131,7 @@ void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id)
route_unlock_node(rn);
/* let's go */
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
zlog_debug("%s: rn %p, re %p: %s, %s", __func__, (void *)rn,
(void *)re,
(CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)
@@ -2185,8 +2176,7 @@ void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id)
* revalidation
* of the rest of the RE.
*/
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
if (CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB)
&& !RIB_SYSTEM_ROUTE(re)) {
changed = 1;
@@ -2251,8 +2241,7 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p,
/* If same type of route are installed, treat it as a implicit
withdraw. */
- RNODE_FOREACH_RE(rn, same)
- {
+ RNODE_FOREACH_RE (rn, same) {
if (CHECK_FLAG(same->status, ROUTE_ENTRY_REMOVED))
continue;
@@ -2334,8 +2323,7 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
}
/* Lookup same type route. */
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue;
@@ -2471,8 +2459,7 @@ int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance,
/* If same type of route are installed, treat it as a implicit
withdraw. */
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue;
@@ -2567,8 +2554,7 @@ static void rib_update_table(struct route_table *table,
* always
* get queued for processing.
*/
- RNODE_FOREACH_RE_SAFE(rn, re, next)
- {
+ RNODE_FOREACH_RE_SAFE (rn, re, next) {
struct nexthop *nh;
if (re->type != ZEBRA_ROUTE_SYSTEM &&
@@ -2636,8 +2622,7 @@ static void rib_weed_table(struct route_table *table)
if (table)
for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
- RNODE_FOREACH_RE_SAFE(rn, re, next)
- {
+ RNODE_FOREACH_RE_SAFE (rn, re, next) {
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue;
@@ -2653,11 +2638,11 @@ void rib_weed_tables(void)
struct vrf *vrf;
struct zebra_vrf *zvrf;
- RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
- if ((zvrf = vrf->info) != NULL) {
- rib_weed_table(zvrf->table[AFI_IP][SAFI_UNICAST]);
- rib_weed_table(zvrf->table[AFI_IP6][SAFI_UNICAST]);
- }
+ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
+ if ((zvrf = vrf->info) != NULL) {
+ rib_weed_table(zvrf->table[AFI_IP][SAFI_UNICAST]);
+ rib_weed_table(zvrf->table[AFI_IP6][SAFI_UNICAST]);
+ }
}
/* Delete self installed routes after zebra is relaunched. */
@@ -2673,8 +2658,7 @@ static void rib_sweep_table(struct route_table *table)
return;
for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) {
- RNODE_FOREACH_RE_SAFE(rn, re, next)
- {
+ RNODE_FOREACH_RE_SAFE (rn, re, next) {
if (IS_ZEBRA_DEBUG_RIB)
route_entry_dump(&rn->p, NULL, re);
@@ -2718,7 +2702,7 @@ void rib_sweep_route(void)
struct vrf *vrf;
struct zebra_vrf *zvrf;
- RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id) {
+ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
if ((zvrf = vrf->info) == NULL)
continue;
@@ -2738,8 +2722,7 @@ static unsigned long rib_score_proto_table(u_char proto, u_short instance,
if (table)
for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
- RNODE_FOREACH_RE_SAFE(rn, re, next)
- {
+ RNODE_FOREACH_RE_SAFE (rn, re, next) {
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue;
if (re->type == proto
@@ -2758,13 +2741,14 @@ unsigned long rib_score_proto(u_char proto, u_short instance)
struct zebra_vrf *zvrf;
unsigned long cnt = 0;
- RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
- if ((zvrf = vrf->info) != NULL)
- cnt += rib_score_proto_table(proto, instance,
- zvrf->table[AFI_IP][SAFI_UNICAST])
- + rib_score_proto_table(
- proto, instance,
- zvrf->table[AFI_IP6][SAFI_UNICAST]);
+ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
+ if ((zvrf = vrf->info) != NULL)
+ cnt += rib_score_proto_table(
+ proto, instance,
+ zvrf->table[AFI_IP][SAFI_UNICAST])
+ + rib_score_proto_table(
+ proto, instance,
+ zvrf->table[AFI_IP6][SAFI_UNICAST]);
return cnt;
}
@@ -2782,10 +2766,8 @@ void rib_close_table(struct route_table *table)
info = table->info;
for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
- RNODE_FOREACH_RE(rn, re)
- {
- if (!CHECK_FLAG(re->status,
- ROUTE_ENTRY_SELECTED_FIB))
+ RNODE_FOREACH_RE (rn, re) {
+ if (!CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB))
continue;
if (info->safi == SAFI_UNICAST)
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index 77cfa9860..4bc9caca5 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -405,8 +405,7 @@ static struct route_entry *zebra_rnh_resolve_entry(vrf_id_t vrfid, int family,
re = NULL;
else {
/* Identify appropriate route entry. */
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue;
if (!CHECK_FLAG(re->status, ROUTE_ENTRY_SELECTED_FIB))
@@ -578,8 +577,7 @@ static void zebra_rnh_process_static_routes(vrf_id_t vrfid, int family,
/* Evaluate each static route associated with this nexthop. */
for (ALL_LIST_ELEMENTS_RO(rnh->zebra_static_route_list, node,
static_rn)) {
- RNODE_FOREACH_RE(static_rn, sre)
- {
+ RNODE_FOREACH_RE (static_rn, sre) {
if (sre->type != ZEBRA_ROUTE_STATIC)
continue;
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index 0fa616bef..dd0189666 100644
--- a/zebra/zebra_routemap.c
+++ b/zebra/zebra_routemap.c
@@ -354,8 +354,7 @@ DEFUN (set_src,
return CMD_WARNING_CONFIG_FAILED;
}
- RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
- {
+ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
if (family == AF_INET)
pif = if_lookup_exact_address((void *)&src.ipv4,
AF_INET, vrf->vrf_id);
diff --git a/zebra/zebra_snmp.c b/zebra/zebra_snmp.c
index 9ac24c53e..48218effd 100644
--- a/zebra/zebra_snmp.c
+++ b/zebra/zebra_snmp.c
@@ -155,7 +155,7 @@ static u_char *ipFwNumber(struct variable *v, oid objid[], size_t *objid_len,
/* Return number of routing entries. */
result = 0;
for (rn = route_top(table); rn; rn = route_next(rn))
- RNODE_FOREACH_RE(rn, re) {
+ RNODE_FOREACH_RE (rn, re) {
result++;
}
@@ -183,7 +183,7 @@ static u_char *ipCidrNumber(struct variable *v, oid objid[], size_t *objid_len,
/* Return number of routing entries. */
result = 0;
for (rn = route_top(table); rn; rn = route_next(rn))
- RNODE_FOREACH_RE(rn, re) {
+ RNODE_FOREACH_RE (rn, re) {
result++;
}
@@ -369,8 +369,7 @@ static void get_fwtable_route_node(struct variable *v, oid objid[],
return;
for (*np = route_top(table); *np; *np = route_next(*np)) {
if (!in_addr_cmp(&(*np)->p.u.prefix, (u_char *)&dest)) {
- RNODE_FOREACH_RE(*np, *re)
- {
+ RNODE_FOREACH_RE (*np, *re) {
if (!in_addr_cmp((u_char *)&(*re)
->nexthop->gate
.ipv4,
@@ -390,14 +389,13 @@ static void get_fwtable_route_node(struct variable *v, oid objid[],
/* Check destination first */
if (in_addr_cmp(&np2->p.u.prefix, (u_char *)&dest) > 0)
- RNODE_FOREACH_RE(np2, re2) {
+ RNODE_FOREACH_RE (np2, re2) {
check_replace(np2, re2, np, re);
}
if (in_addr_cmp(&np2->p.u.prefix, (u_char *)&dest)
== 0) { /* have to look at each re individually */
- RNODE_FOREACH_RE(np2, re2)
- {
+ RNODE_FOREACH_RE (np2, re2) {
int proto2, policy2;
proto2 = proto_trans(re2->type);
diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c
index 658f060ff..836a2aa6a 100644
--- a/zebra/zebra_static.c
+++ b/zebra/zebra_static.c
@@ -67,8 +67,7 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p,
/* Lookup existing route */
rn = srcdest_rnode_get(table, p, src_p);
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue;
@@ -281,8 +280,7 @@ void static_uninstall_route(afi_t afi, safi_t safi, struct prefix *p,
if (!rn)
return;
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
continue;
diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c
index 62c7d020b..bf8a17c3e 100644
--- a/zebra/zebra_vrf.c
+++ b/zebra/zebra_vrf.c
@@ -70,8 +70,7 @@ void zebra_vrf_update_all(struct zserv *client)
{
struct vrf *vrf;
- RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
- {
+ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
if (vrf->vrf_id)
zsend_vrf_add(client, vrf_info_lookup(vrf->vrf_id));
}
@@ -290,7 +289,7 @@ static void zebra_rtable_node_cleanup(struct route_table *table,
{
struct route_entry *re, *next;
- RNODE_FOREACH_RE_SAFE(node, re, next) {
+ RNODE_FOREACH_RE_SAFE (node, re, next) {
rib_unlink(node, re);
}
@@ -468,8 +467,7 @@ static int vrf_config_write(struct vty *vty)
struct vrf *vrf;
struct zebra_vrf *zvrf;
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
zvrf = vrf->info;
if (!zvrf)
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 1ce4f66b1..df1eef119 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -378,8 +378,7 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
char buf[SRCDEST2STR_BUFFER];
struct zebra_vrf *zvrf;
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
const char *mcast_info = "";
if (mcast) {
rib_table_info_t *info = srcdest_rnode_table_info(rn);
@@ -926,8 +925,7 @@ static int do_show_ip_route(struct vty *vty, const char *vrf_name, afi_t afi,
/* Show all routes. */
for (rn = route_top(table); rn; rn = route_next(rn)) {
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
if (use_fib
&& !CHECK_FLAG(re->status,
ROUTE_ENTRY_SELECTED_FIB))
@@ -1031,12 +1029,12 @@ DEFUN (show_ip_nht_vrf_all,
struct vrf *vrf;
struct zebra_vrf *zvrf;
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- if ((zvrf = vrf->info) != NULL) {
- vty_out(vty, "\nVRF %s:\n", zvrf_name(zvrf));
- zebra_print_rnh_table(zvrf_id(zvrf), AF_INET, vty,
- RNH_NEXTHOP_TYPE);
- }
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ if ((zvrf = vrf->info) != NULL) {
+ vty_out(vty, "\nVRF %s:\n", zvrf_name(zvrf));
+ zebra_print_rnh_table(zvrf_id(zvrf), AF_INET, vty,
+ RNH_NEXTHOP_TYPE);
+ }
return CMD_SUCCESS;
}
@@ -1071,12 +1069,12 @@ DEFUN (show_ipv6_nht_vrf_all,
struct vrf *vrf;
struct zebra_vrf *zvrf;
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- if ((zvrf = vrf->info) != NULL) {
- vty_out(vty, "\nVRF %s:\n", zvrf_name(zvrf));
- zebra_print_rnh_table(zvrf_id(zvrf), AF_INET6, vty,
- RNH_NEXTHOP_TYPE);
- }
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ if ((zvrf = vrf->info) != NULL) {
+ vty_out(vty, "\nVRF %s:\n", zvrf_name(zvrf));
+ zebra_print_rnh_table(zvrf_id(zvrf), AF_INET6, vty,
+ RNH_NEXTHOP_TYPE);
+ }
return CMD_SUCCESS;
}
@@ -1235,8 +1233,7 @@ DEFUN (show_ip_route,
}
if (vrf_all) {
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if ((zvrf = vrf->info) == NULL
|| (table = zvrf->table[AFI_IP][SAFI_UNICAST])
== NULL)
@@ -1360,8 +1357,7 @@ static void vty_show_ip_route_summary(struct vty *vty,
memset(&rib_cnt, 0, sizeof(rib_cnt));
memset(&fib_cnt, 0, sizeof(fib_cnt));
for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
is_ibgp = (re->type == ZEBRA_ROUTE_BGP
&& CHECK_FLAG(re->flags, ZEBRA_FLAG_IBGP));
@@ -1430,8 +1426,7 @@ static void vty_show_ip_route_summary_prefix(struct vty *vty,
memset(&rib_cnt, 0, sizeof(rib_cnt));
memset(&fib_cnt, 0, sizeof(fib_cnt));
for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
/*
* In case of ECMP, count only once.
@@ -1560,8 +1555,7 @@ DEFUN (show_ip_route_vrf_all_addr,
return CMD_WARNING;
}
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if ((zvrf = vrf->info) == NULL
|| (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
continue;
@@ -1601,8 +1595,7 @@ DEFUN (show_ip_route_vrf_all_prefix,
return CMD_WARNING;
}
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if ((zvrf = vrf->info) == NULL
|| (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
continue;
@@ -1635,10 +1628,10 @@ DEFUN (show_ip_route_vrf_all_summary,
struct vrf *vrf;
struct zebra_vrf *zvrf;
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- if ((zvrf = vrf->info) != NULL)
- vty_show_ip_route_summary(vty,
- zvrf->table[AFI_IP][SAFI_UNICAST]);
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ if ((zvrf = vrf->info) != NULL)
+ vty_show_ip_route_summary(
+ vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
return CMD_SUCCESS;
}
@@ -1656,10 +1649,10 @@ DEFUN (show_ip_route_vrf_all_summary_prefix,
struct vrf *vrf;
struct zebra_vrf *zvrf;
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- if ((zvrf = vrf->info) != NULL)
- vty_show_ip_route_summary_prefix(
- vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ if ((zvrf = vrf->info) != NULL)
+ vty_show_ip_route_summary_prefix(
+ vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
return CMD_SUCCESS;
}
@@ -1676,8 +1669,7 @@ static int static_config(struct vty *vty, afi_t afi, safi_t safi,
char buf[SRCDEST2STR_BUFFER];
int write = 0;
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (!(zvrf = vrf->info))
continue;
if ((stable = zvrf->stable[afi][safi]) == NULL)
@@ -1874,8 +1866,7 @@ DEFUN (show_ipv6_route,
}
if (vrf_all) {
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if ((zvrf = vrf->info) == NULL
|| (table = zvrf->table[AFI_IP6][SAFI_UNICAST])
== NULL)
@@ -2063,8 +2054,7 @@ DEFUN (show_ipv6_mroute,
/* Show all IPv6 route. */
for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
if (first) {
vty_out(vty, SHOW_ROUTE_V6_HEADER);
first = 0;
@@ -2097,8 +2087,7 @@ DEFUN (show_ipv6_route_vrf_all_addr,
return CMD_WARNING;
}
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if ((zvrf = vrf->info) == NULL
|| (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
continue;
@@ -2138,8 +2127,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix,
return CMD_WARNING;
}
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if ((zvrf = vrf->info) == NULL
|| (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
continue;
@@ -2172,10 +2160,10 @@ DEFUN (show_ipv6_route_vrf_all_summary,
struct vrf *vrf;
struct zebra_vrf *zvrf;
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- if ((zvrf = vrf->info) != NULL)
- vty_show_ip_route_summary(vty,
- zvrf->table[AFI_IP6][SAFI_UNICAST]);
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ if ((zvrf = vrf->info) != NULL)
+ vty_show_ip_route_summary(
+ vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
return CMD_SUCCESS;
}
@@ -2195,16 +2183,14 @@ DEFUN (show_ipv6_mroute_vrf_all,
struct zebra_vrf *zvrf;
int first = 1;
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if ((zvrf = vrf->info) == NULL
|| (table = zvrf->table[AFI_IP6][SAFI_MULTICAST]) == NULL)
continue;
/* Show all IPv6 route. */
for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
- RNODE_FOREACH_RE(rn, re)
- {
+ RNODE_FOREACH_RE (rn, re) {
if (first) {
vty_out(vty, SHOW_ROUTE_V6_HEADER);
first = 0;
@@ -2228,10 +2214,10 @@ DEFUN (show_ipv6_route_vrf_all_summary_prefix,
struct vrf *vrf;
struct zebra_vrf *zvrf;
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- if ((zvrf = vrf->info) != NULL)
- vty_show_ip_route_summary_prefix(
- vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ if ((zvrf = vrf->info) != NULL)
+ vty_show_ip_route_summary_prefix(
+ vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
return CMD_SUCCESS;
}
@@ -2267,8 +2253,7 @@ DEFUN (show_vrf,
struct vrf *vrf;
struct zebra_vrf *zvrf;
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if (!(zvrf = vrf->info))
continue;
if (!zvrf_id(zvrf))
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 61a75e156..55d006a03 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -1004,8 +1004,7 @@ static int zread_interface_add(struct zserv *client, u_short length,
/* Interface information is needed. */
vrf_bitmap_set(client->ifinfo, zvrf_id(zvrf));
- RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
- {
+ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
for (ALL_LIST_ELEMENTS(vrf->iflist, ifnode, ifnnode, ifp)) {
/* Skip pseudo interface. */
if (!CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE))
@@ -2084,8 +2083,7 @@ static void zebra_client_close_cleanup_rnh(struct zserv *client)
struct vrf *vrf;
struct zebra_vrf *zvrf;
- RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id)
- {
+ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
if ((zvrf = vrf->info) != NULL) {
zebra_cleanup_rnh_client(zvrf_id(zvrf), AF_INET, client,
RNH_NEXTHOP_TYPE);
@@ -2832,8 +2830,7 @@ DEFUN (show_zebra,
" Route Route Neighbor LSP LSP\n");
vty_out(vty,
"VRF Installs Removals Updates Installs Removals\n");
- RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
- {
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
struct zebra_vrf *zvrf = vrf->info;
vty_out(vty, "%-25s %10" PRIu64 " %10" PRIu64 " %10" PRIu64
" %10" PRIu64 " %10" PRIu64 "\n",