summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>2017-08-18 17:23:30 -0700
committerMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>2017-08-18 17:33:56 -0700
commit57f7feb64ff6eebbb2e21bd769950b9ac11525ec (patch)
tree31fc523818508a5da395e9e4c80d32d379593601
parent36127a7f9c950ebc04242ad7a0b527b5966e914d (diff)
Fix coding style.
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
-rw-r--r--bgpd/bgp_evpn.c71
-rw-r--r--bgpd/bgp_nht.c3
-rw-r--r--bgpd/bgp_route.c12
-rw-r--r--bgpd/bgp_vty.c6
-rw-r--r--zebra/zebra_l2.c7
-rw-r--r--zebra/zebra_vxlan.c44
6 files changed, 73 insertions, 70 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index ad000e3f12..f509d869a3 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -2191,8 +2191,7 @@ char *bgp_evpn_label2str(mpls_label_t *label, char *buf, int len)
* Function to convert evpn route to json format.
* NOTE: We don't use prefix2str as the output here is a bit different.
*/
-void
-bgp_evpn_route2json(struct prefix_evpn *p, json_object *json)
+void bgp_evpn_route2json(struct prefix_evpn *p, json_object *json)
{
char buf1[ETHER_ADDR_STRLEN];
char buf2[PREFIX2STR_BUFFER];
@@ -2203,56 +2202,56 @@ bgp_evpn_route2json(struct prefix_evpn *p, json_object *json)
if (p->prefix.route_type == BGP_EVPN_IMET_ROUTE) {
json_object_int_add(json, "routeType", p->prefix.route_type);
json_object_int_add(json, "ethTag", 0);
- json_object_int_add(json,
- "ipLen",
- IS_EVPN_PREFIX_IPADDR_V4 (p) ?
- IPV4_MAX_BITLEN : IPV6_MAX_BITLEN);
+ json_object_int_add(json, "ipLen",
+ IS_EVPN_PREFIX_IPADDR_V4(p)
+ ? IPV4_MAX_BITLEN
+ : IPV6_MAX_BITLEN);
json_object_string_add(json, "ip",
- inet_ntoa (p->prefix.ip.ipaddr_v4));
- }
- else if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE) {
+ inet_ntoa(p->prefix.ip.ipaddr_v4));
+ } else if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE) {
if (IS_EVPN_PREFIX_IPADDR_NONE(p)) {
- json_object_int_add(json, "routeType", p->prefix.route_type);
- json_object_int_add(json, "esi", 0); /* TODO: we don't support esi yet */
- json_object_int_add(json, "ethTag", 0);
- json_object_int_add(json, "macLen", 8 * ETH_ALEN);
- json_object_string_add(json, "mac",
- prefix_mac2str (&p->prefix.mac,
- buf1, sizeof (buf1)));
+ json_object_int_add(json, "routeType",
+ p->prefix.route_type);
+ json_object_int_add(
+ json, "esi",
+ 0); /* TODO: we don't support esi yet */
+ json_object_int_add(json, "ethTag", 0);
+ json_object_int_add(json, "macLen", 8 * ETH_ALEN);
+ json_object_string_add(json, "mac",
+ prefix_mac2str(&p->prefix.mac,
+ buf1,
+ sizeof(buf1)));
} else {
u_char family;
- family = IS_EVPN_PREFIX_IPADDR_V4(p) ? \
- AF_INET : AF_INET6;
+ family = IS_EVPN_PREFIX_IPADDR_V4(p) ? AF_INET
+ : AF_INET6;
json_object_int_add(json, "routeType",
- p->prefix.route_type);
- json_object_int_add(json, "esi", 0); /* TODO: we don't support esi yet */
+ p->prefix.route_type);
+ json_object_int_add(
+ json, "esi",
+ 0); /* TODO: we don't support esi yet */
json_object_int_add(json, "ethTag", 0);
- json_object_int_add(json, "macLen",
- 8 * ETH_ALEN);
+ json_object_int_add(json, "macLen", 8 * ETH_ALEN);
json_object_string_add(json, "mac",
- prefix_mac2str (&p->prefix.mac,
- buf1,
- sizeof (buf1)));
+ prefix_mac2str(&p->prefix.mac,
+ buf1,
+ sizeof(buf1)));
json_object_int_add(json, "ipLen",
- IS_EVPN_PREFIX_IPADDR_V4 (p) ?
- IPV4_MAX_BITLEN :
- IPV6_MAX_BITLEN);
- json_object_string_add(json, "ip",
- inet_ntop (family,
- &p->prefix.ip.ip.addr,
- buf2,
- PREFIX2STR_BUFFER));
+ IS_EVPN_PREFIX_IPADDR_V4(p)
+ ? IPV4_MAX_BITLEN
+ : IPV6_MAX_BITLEN);
+ json_object_string_add(
+ json, "ip",
+ inet_ntop(family, &p->prefix.ip.ip.addr, buf2,
+ PREFIX2STR_BUFFER));
}
} else {
/* Currently, this is to cater to other AF_ETHERNET code. */
}
-
- return;
}
-
/*
* Function to convert evpn route to string.
* NOTE: We don't use prefix2str as the output here is a bit different.
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index 55a2f10132..a0fc10c745 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -498,7 +498,8 @@ void bgp_cleanup_nexthops(struct bgp *bgp)
for (rn = bgp_table_top(bgp->nexthop_cache_table[afi]); rn;
rn = bgp_route_next(rn)) {
- if ((bnc = rn->info) == NULL)
+ bnc = rn->info;
+ if (!bnc)
continue;
/* Clear relevant flags. */
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index a2a7d2ae1d..428b4f3626 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -6262,12 +6262,12 @@ static void route_vty_out_route(struct prefix *p, struct vty *vty,
len = vty_out(vty, "%s", buf);
} else if (p->family == AF_EVPN) {
#if defined(HAVE_CUMULUS)
- if (!json)
- len = vty_out(vty, "%s",
- bgp_evpn_route2str((struct prefix_evpn *)p,
- buf, BUFSIZ));
- else
- bgp_evpn_route2json((struct prefix_evpn *) p, json);
+ if (!json)
+ len = vty_out(vty, "%s",
+ bgp_evpn_route2str((struct prefix_evpn *)p,
+ buf, BUFSIZ));
+ else
+ bgp_evpn_route2json((struct prefix_evpn *) p, json);
#else
prefix2str(p, buf, PREFIX_STRLEN);
len = vty_out(vty, "%s", buf);
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 5d44c0a142..60361adbb6 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -9040,7 +9040,8 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json,
" Hostname Capability:");
if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV)) {
- vty_out(vty, " advertised (name: %s,domain name: %s)",
+ vty_out(vty,
+ " advertised (name: %s,domain name: %s)",
bgp->peer_self->hostname ?
bgp->peer_self->hostname
: "n/a",
@@ -9052,7 +9053,8 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json,
}
if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV)) {
- vty_out(vty, " received (name: %s,domain name: %s)",
+ vty_out(vty,
+ " received (name: %s,domain name: %s)",
p->hostname ?
p->hostname : "n/a",
p->domainname ?
diff --git a/zebra/zebra_l2.c b/zebra/zebra_l2.c
index 7281622e33..3d505857c2 100644
--- a/zebra/zebra_l2.c
+++ b/zebra/zebra_l2.c
@@ -230,9 +230,10 @@ void zebra_l2if_update_bridge_slave(struct interface *ifp,
if (zif->zif_type == ZEBRA_IF_VXLAN)
zebra_vxlan_if_update(ifp, ZEBRA_VXLIF_MASTER_CHANGE);
} else if (old_bridge_ifindex != IFINDEX_INTERNAL) {
- /* In the case of VxLAN, invoke the handler for EVPN.
- * Note that this should be done *prior* to unmapping the interface
- * from the bridge.
+ /*
+ * In the case of VxLAN, invoke the handler for EVPN.
+ * Note that this should be done *prior*
+ * to unmapping the interface from the bridge.
*/
if (zif->zif_type == ZEBRA_IF_VXLAN)
zebra_vxlan_if_update(ifp, ZEBRA_VXLIF_MASTER_CHANGE);
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index 6bf33806b8..c2ea8ab58c 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -2950,30 +2950,30 @@ int zebra_vxlan_local_neigh_add_update(struct interface *ifp,
*/
n->ifindex = ifp->ifindex;
return 0;
- } else {
- /* If the MAC has changed,
- * need to issue a delete first
- * as this means a different MACIP route.
- * Also, need to do some unlinking/relinking.
- */
- zvni_neigh_send_del_to_client(zvrf, zvni->vni,
- &n->ip, &n->emac,
- 0);
- old_zmac = zvni_mac_lookup(zvni, &n->emac);
- if (old_zmac) {
- listnode_delete(old_zmac->neigh_list,
- n);
- zvni_deref_ip2mac(zvni, old_zmac, 0);
- }
-
- /* Set "local" forwarding info. */
- SET_FLAG(n->flags, ZEBRA_NEIGH_LOCAL);
- n->ifindex = ifp->ifindex;
- memcpy(&n->emac, macaddr, ETH_ALEN);
+ }
- /* Link to new MAC */
- listnode_add_sort(zmac->neigh_list, n);
+ /* If the MAC has changed,
+ * need to issue a delete first
+ * as this means a different MACIP route.
+ * Also, need to do some unlinking/relinking.
+ */
+ zvni_neigh_send_del_to_client(zvrf, zvni->vni,
+ &n->ip, &n->emac,
+ 0);
+ old_zmac = zvni_mac_lookup(zvni, &n->emac);
+ if (old_zmac) {
+ listnode_delete(old_zmac->neigh_list,
+ n);
+ zvni_deref_ip2mac(zvni, old_zmac, 0);
}
+
+ /* Set "local" forwarding info. */
+ SET_FLAG(n->flags, ZEBRA_NEIGH_LOCAL);
+ n->ifindex = ifp->ifindex;
+ memcpy(&n->emac, macaddr, ETH_ALEN);
+
+ /* Link to new MAC */
+ listnode_add_sort(zmac->neigh_list, n);
} else if (ext_learned)
/* The neighbor is remote and that is the notification we got.
*/