Fixes style nits introduced by recent pull requests.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
if (is_route_matching_for_vni(bgp, vpn, ri)) {
if (install)
ret = install_evpn_route_entry(
- bgp, vpn, evp, ri);
+ bgp, vpn, evp, ri);
else
ret = uninstall_evpn_route_entry(
bgp, vpn, evp, ri);
&& ri->sub_type == BGP_ROUTE_NORMAL))
continue;
- if (bgp_nexthop_self(bgp,
- ri->attr->nexthop)) {
+ if (bgp_nexthop_self(bgp, ri->attr->nexthop)) {
char attr_str[BUFSIZ];
char pbuf[PREFIX_STRLEN];
"%u: prefix %s with attr %s - DENIED due to martian or self nexthop",
bgp->vrf_id,
prefix2str(
- &rn->p,
- pbuf,
+ &rn->p, pbuf,
sizeof(pbuf)),
attr_str);
bgp_evpn_unimport_route(bgp, afi, safi,
&rn->p, ri);
- bgp_rib_remove(rn, ri, ri->peer,
- afi, safi);
-
-
+ bgp_rib_remove(rn, ri, ri->peer, afi,
+ safi);
}
-
}
}
}
bgp->vrf_id, vni);
return -1;
}
-
}
/* if the VNI is live already, there is nothing more to do */
#include "bgpd/bgpd.h"
#include "bgpd/bgp_ecommunity.h"
-#define RT_ADDRSTRLEN 28
+#define RT_ADDRSTRLEN 28
/* EVPN prefix lengths. */
#define EVPN_TYPE_2_ROUTE_PREFIXLEN 224
#define SHOW_DISPLAY_STANDARD 0
#define SHOW_DISPLAY_TAGS 1
#define SHOW_DISPLAY_OVERLAY 2
-#define VNI_STR_LEN 32
+#define VNI_STR_LEN 32
/*
* Context for VNI hash walk - used by callbacks.
json_object_object_add(json_rt, "vnis", json_vnis);
json_object_object_add(json, rt_buf, json_rt);
}
-
}
static void show_import_rt_entry(struct hash_backet *backet, void *args[])
rd_header = 1;
- for (rm = bgp_table_top(table); rm;
- rm = bgp_route_next(rm))
+ for (rm = bgp_table_top(table); rm; rm = bgp_route_next(rm))
for (ri = rm->info; ri; ri = ri->next) {
total_count++;
if (type == bgp_show_type_neighbor) {
- union sockunion *su =
- output_arg;
+ union sockunion *su = output_arg;
if (ri->peer->su_remote == NULL
|| !sockunion_same(
- ri->peer->su_remote,
- su))
+ ri->peer->su_remote, su))
continue;
}
if (header == 0) {
json_ocode);
}
} else {
- if (option
- == SHOW_DISPLAY_TAGS)
+ if (option == SHOW_DISPLAY_TAGS)
vty_out(vty,
V4_HEADER_TAG);
else if (
"Status codes: s suppressed, d damped, h history, * valid, > best, i - internal\n");
vty_out(vty,
"Origin codes: i - IGP, e - EGP, ? - incomplete\n\n");
- vty_out(vty,
- V4_HEADER);
+ vty_out(vty, V4_HEADER);
}
}
header = 0;
char buffer[BUFSIZ];
if (type == RD_TYPE_AS
|| type == RD_TYPE_AS4)
- sprintf(buffer,
- "%u:%d",
+ sprintf(buffer, "%u:%d",
rd_as.as,
rd_as.val);
- else if (type
- == RD_TYPE_IP)
- sprintf(buffer,
- "%s:%d",
+ else if (type == RD_TYPE_IP)
+ sprintf(buffer, "%s:%d",
inet_ntoa(
rd_ip.ip),
rd_ip.val);
"as2 %u:%d",
rd_as.as,
rd_as.val);
- else if (type
- == RD_TYPE_AS4)
+ else if (type == RD_TYPE_AS4)
vty_out(vty,
"as4 %u:%d",
rd_as.as,
rd_as.val);
- else if (type
- == RD_TYPE_IP)
- vty_out(vty,
- "ip %s:%d",
+ else if (type == RD_TYPE_IP)
+ vty_out(vty, "ip %s:%d",
inet_ntoa(
rd_ip.ip),
rd_ip.val);
* Display EVPN routes for all VNIs - vty handler.
*/
static void evpn_show_routes_vni_all(struct vty *vty, struct bgp *bgp,
- struct in_addr vtep_ip,
- json_object *json)
+ struct in_addr vtep_ip, json_object *json)
{
u_int32_t num_vnis;
struct vni_walk_ctx wctx;
/*
* Display global EVPN routing table.
*/
-DEFUN(show_bgp_l2vpn_evpn_route, show_bgp_l2vpn_evpn_route_cmd,
+DEFUN(show_bgp_l2vpn_evpn_route,
+ show_bgp_l2vpn_evpn_route_cmd,
"show bgp l2vpn evpn route [type <macip|multicast>] [json]",
SHOW_STR
BGP_STR
/*
* Display global EVPN routing table for specific RD.
*/
-DEFUN(show_bgp_l2vpn_evpn_route_rd, show_bgp_l2vpn_evpn_route_rd_cmd,
+DEFUN(show_bgp_l2vpn_evpn_route_rd,
+ show_bgp_l2vpn_evpn_route_rd_cmd,
"show bgp l2vpn evpn route rd ASN:nn_or_IP-address:nn [type <macip|multicast>] [json]",
SHOW_STR
BGP_STR
/*
* Display per-VNI EVPN routing table - for all VNIs.
*/
-DEFUN(show_bgp_l2vpn_evpn_route_vni_all, show_bgp_l2vpn_evpn_route_vni_all_cmd,
+DEFUN(show_bgp_l2vpn_evpn_route_vni_all,
+ show_bgp_l2vpn_evpn_route_vni_all_cmd,
"show bgp l2vpn evpn route vni all [vtep A.B.C.D] [json]",
SHOW_STR
BGP_STR
/*
* Display EVPN import route-target hash table
*/
-DEFUN(show_bgp_l2vpn_evpn_import_rt, show_bgp_l2vpn_evpn_import_rt_cmd,
+DEFUN(show_bgp_l2vpn_evpn_import_rt,
+ show_bgp_l2vpn_evpn_import_rt_cmd,
"show bgp l2vpn evpn import-rt [json]",
SHOW_STR
BGP_STR
void bgp_tip_hash_init(struct bgp *bgp)
{
- bgp->tip_hash = hash_create(bgp_tip_hash_key_make,
- bgp_tip_hash_cmp, NULL);
+ bgp->tip_hash =
+ hash_create(bgp_tip_hash_key_make, bgp_tip_hash_cmp, NULL);
}
void bgp_tip_hash_destroy(struct bgp *bgp)
/* eoiu marker */
if (CHECK_FLAG(pqnode->flags, BGP_PROCESS_QUEUE_EOIU_MARKER)) {
bgp_process_main_one(bgp, NULL, 0, 0);
- assert(STAILQ_FIRST(&pqnode->pqueue) == NULL); /* should always have dedicated wq call */
+ /* should always have dedicated wq call */
+ assert(STAILQ_FIRST(&pqnode->pqueue) == NULL);
return WQ_SUCCESS;
}
SET_FLAG(rn->flags, BGP_NODE_PROCESS_SCHEDULED);
bgp_lock_node(rn);
- assert(STAILQ_NEXT(rn, pq) == NULL); /* can't be enqueued twice */
+ /* can't be enqueued twice */
+ assert(STAILQ_NEXT(rn, pq) == NULL);
STAILQ_INSERT_TAIL(&pqnode->pqueue, rn, pq);
pqnode->queued++;
/* Unconditionally remove the route from the RIB, without taking
* damping into consideration (eg, because the session went down)
*/
-void bgp_rib_remove(struct bgp_node *rn, struct bgp_info *ri,
- struct peer *peer, afi_t afi, safi_t safi)
+void bgp_rib_remove(struct bgp_node *rn, struct bgp_info *ri, struct peer *peer,
+ afi_t afi, safi_t safi)
{
bgp_aggregate_decrement(peer->bgp, &rn->p, ri, afi, safi);
continue;
struct bgp_info *ri = rn->info;
- mpls_label_t label =
- (ri && ri->extra) ? ri->extra->label
- : MPLS_INVALID_LABEL;
+ mpls_label_t label = (ri && ri->extra)
+ ? ri->extra->label
+ : MPLS_INVALID_LABEL;
ret = bgp_update(peer, &rn->p, ain->addpath_rx_id,
ain->attr, afi, safi, ZEBRA_ROUTE_BGP,
|| (safi == SAFI_EVPN)) {
table = rn->info;
- for (rm = bgp_table_top(table);
- rm;
+ for (rm = bgp_table_top(table); rm;
rm = bgp_route_next(rm)) {
bgp_static = rm->info;
bgp_static_update_safi(
- bgp, &rm->p,
- bgp_static, afi,
- safi);
+ bgp, &rm->p, bgp_static,
+ afi, safi);
}
} else {
- bgp_static_update(bgp, &rn->p,
- rn->info, afi,
- safi);
+ bgp_static_update(bgp, &rn->p, rn->info,
+ afi, safi);
}
}
}
|| (safi == SAFI_EVPN)) {
table = rn->info;
- for (rm = bgp_table_top(table);
- rm;
+ for (rm = bgp_table_top(table); rm;
rm = bgp_route_next(rm)) {
bgp_static = rm->info;
bgp_static_withdraw_safi(
- bgp, &rm->p,
- AFI_IP, safi,
- (struct
- prefix_rd *)&rn
+ bgp, &rm->p, AFI_IP,
+ safi,
+ (struct prefix_rd *)&rn
->p);
bgp_static_free(bgp_static);
rn->info = NULL;
}
} else {
bgp_static = rn->info;
- bgp_static_withdraw(bgp, &rn->p,
- afi, safi);
+ bgp_static_withdraw(bgp, &rn->p, afi,
+ safi);
bgp_static_free(bgp_static);
rn->info = NULL;
bgp_unlock_node(rn);
|| (safi == SAFI_EVPN)) {
table = rn->info;
- for (rm = bgp_table_top(table);
- rm;
+ for (rm = bgp_table_top(table); rm;
rm = bgp_route_next(rm)) {
bgp_static = rm->info;
bgp_static_update_safi(
- bgp, &rm->p,
- bgp_static, afi,
- safi);
+ bgp, &rm->p, bgp_static,
+ afi, safi);
}
} else {
bgp_static = rn->info;
bgp_static_update(bgp, &rn->p,
- bgp_static,
- afi, safi);
+ bgp_static, afi,
+ safi);
}
}
bgp_flag_unset(bgp, BGP_FLAG_FORCE_STATIC_PROCESS);
}
void bgp_config_write_table_map(struct vty *vty, struct bgp *bgp, afi_t afi,
- safi_t safi)
+ safi_t safi)
{
if (bgp->table_map[afi][safi].name) {
vty_out(vty, " table-map %s\n",
* community aggregation. */
if (aggregate->as_set) {
if (aspath) {
- asmerge = aspath_aggregate(aspath,
- ri->attr->aspath);
+ asmerge = aspath_aggregate(
+ aspath, ri->attr->aspath);
aspath_free(aspath);
aspath = asmerge;
} else
ri->attr->community);
community = community_uniq_sort(
commerge);
- community_free(
- commerge);
+ community_free(commerge);
} else
community = community_dup(
ri->attr->community);
ri->extra->suppress--;
if (ri->extra->suppress == 0) {
- bgp_info_set_flag(rn, ri,
- BGP_INFO_ATTR_CHANGED);
+ bgp_info_set_flag(
+ rn, ri, BGP_INFO_ATTR_CHANGED);
match++;
}
}
} 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));
+ len = vty_out(
+ vty, "%s",
+ bgp_evpn_route2str((struct prefix_evpn *)p, buf,
+ BUFSIZ));
else
- bgp_evpn_route2json((struct prefix_evpn *) p, json);
+ bgp_evpn_route2json((struct prefix_evpn *)p, json);
#else
prefix2str(p, buf, PREFIX_STRLEN);
len = vty_out(vty, "%s", buf);
#endif
} else {
if (!json)
- len = vty_out(vty, "%s/%d",
- inet_ntop(p->family, &p->u.prefix, buf,
- BUFSIZ),
- p->prefixlen);
+ len = vty_out(
+ vty, "%s/%d",
+ inet_ntop(p->family, &p->u.prefix, buf, BUFSIZ),
+ p->prefixlen);
}
if (!json) {
if (has_valid_label)
json_object_int_add(json, "localLabel", label);
- json_object_string_add(json, "prefix",
- prefix2str(p, prefix_str,
- sizeof(prefix_str)));
+ json_object_string_add(
+ json, "prefix",
+ prefix2str(p, prefix_str, sizeof(prefix_str)));
} else {
#if defined(HAVE_CUMULUS)
if (safi == SAFI_EVPN)
for (ri = rm->info; ri; ri = ri->next) {
if (header) {
- route_vty_out_detail_header(vty, bgp,
- rm, (struct prefix_rd *)&rn->p,
+ route_vty_out_detail_header(
+ vty, bgp, rm,
+ (struct prefix_rd *)&rn->p,
AFI_IP, safi, json);
header = 0;
}
&& (CHECK_FLAG(ri->flags,
BGP_INFO_MULTIPATH)
|| CHECK_FLAG(ri->flags,
- BGP_INFO_SELECTED))))
+ BGP_INFO_SELECTED))))
route_vty_out_detail(vty, bgp, &rm->p,
ri, AFI_IP, safi,
json_paths);
if (header1) {
if (use_json) {
json_object_int_add(
- json,
- "bgpTableVersion",
+ json, "bgpTableVersion",
0);
json_object_string_add(
json,
inet_ntoa(
bgp->router_id));
json_object_object_add(
- json,
- "bgpStatusCodes",
+ json, "bgpStatusCodes",
json_scode);
json_object_object_add(
- json,
- "bgpOriginCodes",
+ json, "bgpOriginCodes",
json_ocode);
} else {
vty_out(vty,
if (ain->attr) {
bgp_attr_dup(&attr, ain->attr);
if (bgp_input_modifier(peer, &rn->p,
- &attr, afi, safi, rmap_name)
+ &attr, afi, safi,
+ rmap_name)
!= RMAP_DENY) {
route_vty_out_tmp(vty, &rn->p,
- &attr, safi, use_json,
- json_ar);
+ &attr, safi,
+ use_json,
+ json_ar);
output_count++;
} else
filtered_count++;
|| rm->p.prefixlen == match.prefixlen) {
ri = rm->info;
while (ri) {
- if (ri->extra
- && ri->extra->damp_info) {
+ if (ri->extra && ri->extra->damp_info) {
ri_temp = ri->next;
bgp_damp_info_free(
- ri->extra->damp_info, 1);
+ ri->extra->damp_info,
+ 1);
ri = ri_temp;
} else
ri = ri->next;
if ((table = prn->info) == NULL)
continue;
- for (rn = bgp_table_top(table); rn;
- rn = bgp_route_next(rn)) {
+ for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
if ((bgp_static = rn->info) == NULL)
continue;
if ((table = prn->info) == NULL)
continue;
- for (rn = bgp_table_top(table); rn;
- rn = bgp_route_next(rn)) {
+ for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
if ((bgp_static = rn->info) == NULL)
continue;
prefix2str(p, buf, sizeof(buf));
vty_out(vty,
" network %s rd %s ethtag %u tag %u esi %s gwip %s routermac %s\n",
- buf, rdbuf, p->u.prefix_evpn .eth_tag,
- decode_label(&bgp_static ->label), esi, buf2,
+ buf, rdbuf, p->u.prefix_evpn.eth_tag,
+ decode_label(&bgp_static->label), esi, buf2,
macrouter);
if (macrouter)
p = &rn->p;
/* "network" configuration display. */
- if (bgp_option_check(BGP_OPT_CONFIG_CISCO)
- && afi == AFI_IP) {
+ if (bgp_option_check(BGP_OPT_CONFIG_CISCO) && afi == AFI_IP) {
u_int32_t destination;
struct in_addr netmask;
}
void bgp_config_write_distance(struct vty *vty, struct bgp *bgp, afi_t afi,
- safi_t safi)
+ safi_t safi)
{
struct bgp_node *rn;
struct bgp_distance *bdistance;
* queue element with NULL bgp node.
*/
extern void bgp_add_eoiu_mark(struct bgp *);
-extern void bgp_config_write_table_map(struct vty *, struct bgp *, afi_t, safi_t);
+extern void bgp_config_write_table_map(struct vty *, struct bgp *, afi_t,
+ safi_t);
extern void bgp_config_write_network(struct vty *, struct bgp *, afi_t, safi_t);
-extern void bgp_config_write_distance(struct vty *, struct bgp *, afi_t, safi_t);
+extern void bgp_config_write_distance(struct vty *, struct bgp *, afi_t,
+ safi_t);
extern void bgp_aggregate_increment(struct bgp *, struct prefix *,
struct bgp_info *, afi_t, safi_t);
"Match the cluster length\n")
void bgp_config_write_maxpaths(struct vty *vty, struct bgp *bgp, afi_t afi,
- safi_t safi)
+ safi_t safi)
{
if (bgp->maxpaths[afi][safi].maxpaths_ebgp != MULTIPATH_NUM) {
vty_out(vty, " maximum-paths %d\n",
static void show_address_entry(struct hash_backet *backet, void *args)
{
- struct vty *vty = (struct vty *) args;
- struct bgp_addr *addr = (struct bgp_addr *) backet->data;
+ struct vty *vty = (struct vty *)args;
+ struct bgp_addr *addr = (struct bgp_addr *)backet->data;
- vty_out(vty, "addr: %s, count: %d\n",
- inet_ntoa(addr->addr),
+ vty_out(vty, "addr: %s, count: %d\n", inet_ntoa(addr->addr),
addr->refcnt);
}
static void show_tip_entry(struct hash_backet *backet, void *args)
{
struct vty *vty = (struct vty *)args;
- struct tip_addr *tip = (struct tip_addr *) backet->data;
+ struct tip_addr *tip = (struct tip_addr *)backet->data;
- vty_out(vty, "addr: %s, count: %d\n",
- inet_ntoa(tip->addr),
+ vty_out(vty, "addr: %s, count: %d\n", inet_ntoa(tip->addr),
tip->refcnt);
}
vty);
}
-DEFUN (show_bgp_martian_nexthop_db,
- show_bgp_martian_nexthop_db_cmd,
- "show bgp martian next-hop",
- SHOW_STR
- BGP_STR
- "martian next-hops\n"
- "martian next-hop database\n")
+DEFUN(show_bgp_martian_nexthop_db,
+ show_bgp_martian_nexthop_db_cmd,
+ "show bgp martian next-hop",
+ SHOW_STR
+ BGP_STR
+ "martian next-hops\n"
+ "martian next-hop database\n")
{
struct bgp *bgp = NULL;
char memstrbuf[MTYPE_MEMSTR_LEN];
int vrf_id_ui;
- vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN)
- ? -1
- : bgp->vrf_id;
+ vrf_id_ui =
+ (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id;
/* Usage summary and header */
if (use_json) {
json_object_string_add(
json, "routerId",
inet_ntoa(bgp->router_id));
- json_object_int_add(json, "as",
- bgp->as);
- json_object_int_add(json, "vrfId",
- vrf_id_ui);
+ json_object_int_add(json, "as", bgp->as);
+ json_object_int_add(json, "vrfId", vrf_id_ui);
json_object_string_add(
json, "vrfName",
(bgp->inst_type
} else {
vty_out(vty,
"BGP router identifier %s, local AS number %u vrf-id %d",
- inet_ntoa(bgp->router_id),
- bgp->as, vrf_id_ui);
+ inet_ntoa(bgp->router_id), bgp->as,
+ vrf_id_ui);
vty_out(vty, "\n");
}
if (bgp_update_delay_configured(bgp)) {
if (use_json) {
json_object_int_add(
- json,
- "updateDelayLimit",
+ json, "updateDelayLimit",
bgp->v_update_delay);
if (bgp->v_update_delay
"updateDelayEstablishWait",
bgp->v_establish_wait);
- if (bgp_update_delay_active(
- bgp)) {
+ if (bgp_update_delay_active(bgp)) {
json_object_string_add(
json,
"updateDelayFirstNeighbor",
" Establish wait: %d seconds\n",
bgp->v_establish_wait);
- if (bgp_update_delay_active(
- bgp)) {
+ if (bgp_update_delay_active(bgp)) {
vty_out(vty,
" First neighbor established: %s\n",
bgp->update_delay_begin_time);
if (bgp_maxmed_onstartup_configured(bgp)
&& bgp->maxmed_active)
json_object_boolean_true_add(
- json,
- "maxMedOnStartup");
+ json, "maxMedOnStartup");
if (bgp->v_maxmed_admin)
json_object_boolean_true_add(
- json,
- "maxMedAdministrative");
+ json, "maxMedAdministrative");
json_object_int_add(
json, "tableVersion",
- bgp_table_version(
- bgp->rib[afi][safi]));
+ bgp_table_version(bgp->rib[afi][safi]));
- ents = bgp_table_count(
- bgp->rib[afi][safi]);
- json_object_int_add(json, "ribCount",
- ents);
+ ents = bgp_table_count(bgp->rib[afi][safi]);
+ json_object_int_add(json, "ribCount", ents);
json_object_int_add(
json, "ribMemory",
ents * sizeof(struct bgp_node));
ents = listcount(bgp->peer);
- json_object_int_add(json, "peerCount",
- ents);
- json_object_int_add(
- json, "peerMemory",
- ents * sizeof(struct peer));
+ json_object_int_add(json, "peerCount", ents);
+ json_object_int_add(json, "peerMemory",
+ ents * sizeof(struct peer));
if ((ents = listcount(bgp->group))) {
json_object_int_add(
- json, "peerGroupCount",
- ents);
+ json, "peerGroupCount", ents);
json_object_int_add(
json, "peerGroupMemory",
ents * sizeof(struct
if (CHECK_FLAG(bgp->af_flags[afi][safi],
BGP_CONFIG_DAMPENING))
json_object_boolean_true_add(
- json,
- "dampeningEnabled");
+ json, "dampeningEnabled");
} else {
if (bgp_maxmed_onstartup_configured(bgp)
&& bgp->maxmed_active)
vty_out(vty,
"Max-med administrative active\n");
- vty_out(vty,
- "BGP table version %" PRIu64
- "\n",
- bgp_table_version(
- bgp->rib[afi][safi]));
+ vty_out(vty, "BGP table version %" PRIu64 "\n",
+ bgp_table_version(bgp->rib[afi][safi]));
- ents = bgp_table_count(
- bgp->rib[afi][safi]);
+ ents = bgp_table_count(bgp->rib[afi][safi]);
vty_out(vty,
"RIB entries %ld, using %s of memory\n",
ents,
- mtype_memstr(
- memstrbuf,
- sizeof(memstrbuf),
- ents * sizeof(struct
- bgp_node)));
+ mtype_memstr(memstrbuf,
+ sizeof(memstrbuf),
+ ents * sizeof(struct
+ bgp_node)));
/* Peer related usage */
ents = listcount(bgp->peer);
- vty_out(vty,
- "Peers %ld, using %s of memory\n",
+ vty_out(vty, "Peers %ld, using %s of memory\n",
ents,
mtype_memstr(
- memstrbuf,
- sizeof(memstrbuf),
- ents * sizeof(struct
- peer)));
+ memstrbuf, sizeof(memstrbuf),
+ ents * sizeof(struct peer)));
if ((ents = listcount(bgp->group)))
vty_out(vty,
if (CHECK_FLAG(bgp->af_flags[afi][safi],
BGP_CONFIG_DAMPENING))
- vty_out(vty,
- "Dampening enabled.\n");
+ vty_out(vty, "Dampening enabled.\n");
vty_out(vty, "\n");
/* Subtract 8 here because 'Neighbor' is
* 8 characters */
vty_out(vty, "Neighbor");
- vty_out(vty, "%*s",
- max_neighbor_width - 8, " ");
+ vty_out(vty, "%*s", max_neighbor_width - 8,
+ " ");
vty_out(vty,
"V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd\n");
}
json_peer = json_object_new_object();
if (peer_dynamic_neighbor(peer))
- json_object_boolean_true_add(
- json_peer, "dynamicPeer");
+ json_object_boolean_true_add(json_peer,
+ "dynamicPeer");
if (peer->hostname)
- json_object_string_add(json_peer,
- "hostname",
+ json_object_string_add(json_peer, "hostname",
peer->hostname);
if (peer->domainname)
- json_object_string_add(
- json_peer, "domainname",
- peer->domainname);
+ json_object_string_add(json_peer, "domainname",
+ peer->domainname);
- json_object_int_add(json_peer, "remoteAs",
- peer->as);
+ json_object_int_add(json_peer, "remoteAs", peer->as);
json_object_int_add(json_peer, "version", 4);
- json_object_int_add(
- json_peer, "msgRcvd",
- peer->open_in + peer->update_in
- + peer->keepalive_in
- + peer->notify_in
- + peer->refresh_in
- + peer->dynamic_cap_in);
- json_object_int_add(
- json_peer, "msgSent",
- peer->open_out + peer->update_out
- + peer->keepalive_out
- + peer->notify_out
- + peer->refresh_out
- + peer->dynamic_cap_out);
+ json_object_int_add(json_peer, "msgRcvd",
+ peer->open_in + peer->update_in
+ + peer->keepalive_in
+ + peer->notify_in
+ + peer->refresh_in
+ + peer->dynamic_cap_in);
+ json_object_int_add(json_peer, "msgSent",
+ peer->open_out + peer->update_out
+ + peer->keepalive_out
+ + peer->notify_out
+ + peer->refresh_out
+ + peer->dynamic_cap_out);
json_object_int_add(json_peer, "tableVersion",
peer->version[afi][safi]);
json_object_int_add(json_peer, "outq",
peer->obuf->count);
json_object_int_add(json_peer, "inq", 0);
- peer_uptime(peer->uptime, timebuf,
- BGP_UPTIME_LEN, use_json,
- json_peer);
- json_object_int_add(
- json_peer, "prefixReceivedCount",
- peer->pcount[afi][pfx_rcd_safi]);
+ peer_uptime(peer->uptime, timebuf, BGP_UPTIME_LEN,
+ use_json, json_peer);
+ json_object_int_add(json_peer, "prefixReceivedCount",
+ peer->pcount[afi][pfx_rcd_safi]);
if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN))
- json_object_string_add(json_peer,
- "state",
+ json_object_string_add(json_peer, "state",
"Idle (Admin)");
- else if (CHECK_FLAG(
- peer->sflags,
- PEER_STATUS_PREFIX_OVERFLOW))
- json_object_string_add(json_peer,
- "state",
+ else if (CHECK_FLAG(peer->sflags,
+ PEER_STATUS_PREFIX_OVERFLOW))
+ json_object_string_add(json_peer, "state",
"Idle (PfxCt)");
else
json_object_string_add(
json_peer, "state",
- lookup_msg(bgp_status_msg,
- peer->status, NULL));
+ lookup_msg(bgp_status_msg, peer->status,
+ NULL));
if (peer->conf_if)
- json_object_string_add(json_peer,
- "idType",
+ json_object_string_add(json_peer, "idType",
"interface");
else if (peer->su.sa.sa_family == AF_INET)
- json_object_string_add(
- json_peer, "idType", "ipv4");
+ json_object_string_add(json_peer, "idType",
+ "ipv4");
else if (peer->su.sa.sa_family == AF_INET6)
- json_object_string_add(
- json_peer, "idType", "ipv6");
+ json_object_string_add(json_peer, "idType",
+ "ipv6");
json_object_object_add(json_peers, peer->host,
json_peer);
}
if (peer->hostname
- && bgp_flag_check(bgp,
- BGP_FLAG_SHOW_HOSTNAME))
+ && bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME))
len = vty_out(vty, "%s%s(%s)", dn_flag,
- peer->hostname,
- peer->host);
+ peer->hostname, peer->host);
else
- len = vty_out(vty, "%s%s", dn_flag,
- peer->host);
+ len = vty_out(vty, "%s%s", dn_flag, peer->host);
/* pad the neighbor column with spaces */
if (len < max_neighbor_width)
- vty_out(vty, "%*s",
- max_neighbor_width - len, " ");
+ vty_out(vty, "%*s", max_neighbor_width - len,
+ " ");
- vty_out(vty, "4 %10u %7d %7d %8" PRIu64
- " %4d %4zd %8s",
+ vty_out(vty, "4 %10u %7d %7d %8" PRIu64 " %4d %4zd %8s",
peer->as,
peer->open_in + peer->update_in
- + peer->keepalive_in
- + peer->notify_in
+ + peer->keepalive_in + peer->notify_in
+ peer->refresh_in
+ peer->dynamic_cap_in,
peer->open_out + peer->update_out
- + peer->keepalive_out
- + peer->notify_out
+ + peer->keepalive_out + peer->notify_out
+ peer->refresh_out
+ peer->dynamic_cap_out,
- peer->version[afi][safi], 0,
- peer->obuf->count,
+ peer->version[afi][safi], 0, peer->obuf->count,
peer_uptime(peer->uptime, timebuf,
BGP_UPTIME_LEN, 0, NULL));
if (peer->status == Established)
vty_out(vty, " %12ld",
- peer->pcount[afi]
- [pfx_rcd_safi]);
+ peer->pcount[afi][pfx_rcd_safi]);
else {
- if (CHECK_FLAG(peer->flags,
- PEER_FLAG_SHUTDOWN))
+ if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN))
vty_out(vty, " Idle (Admin)");
- else if (
- CHECK_FLAG(
- peer->sflags,
- PEER_STATUS_PREFIX_OVERFLOW))
+ else if (CHECK_FLAG(
+ peer->sflags,
+ PEER_STATUS_PREFIX_OVERFLOW))
vty_out(vty, " Idle (PfxCt)");
else
vty_out(vty, " %12s",
- lookup_msg(
- bgp_status_msg,
- peer->status,
- NULL));
+ lookup_msg(bgp_status_msg,
+ peer->status, NULL));
}
vty_out(vty, "\n");
}
if (afi == AFI_L2VPN && safi == SAFI_EVPN) {
if (p->bgp->advertise_all_vni)
- json_object_boolean_true_add(json_addr,
- "advertiseAllVnis");
+ json_object_boolean_true_add(
+ json_addr, "advertiseAllVnis");
}
if (filter->plist[FILTER_IN].name
json_multi);
/* Hostname capabilities */
- json_object *json_hname = NULL;
+ json_object *json_hname = NULL;
json_hname = json_object_new_object();
if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV)) {
json_object_string_add(
- json_hname,
- "advHostName",
- bgp->peer_self->hostname ?
- bgp->peer_self->hostname
+ json_hname, "advHostName",
+ bgp->peer_self->hostname
+ ? bgp->peer_self
+ ->hostname
: "n/a");
json_object_string_add(
- json_hname,
- "advDomainName",
- bgp->peer_self->domainname ?
- bgp->peer_self->domainname
+ json_hname, "advDomainName",
+ bgp->peer_self->domainname
+ ? bgp->peer_self
+ ->domainname
: "n/a");
}
if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV)) {
json_object_string_add(
- json_hname,
- "rcvHostName",
- p->hostname ?
- p->hostname :
- "n/a");
+ json_hname, "rcvHostName",
+ p->hostname ? p->hostname
+ : "n/a");
json_object_string_add(
- json_hname,
- "rcvDomainName",
- p->domainname ?
- p->domainname :
- "n/a");
+ json_hname, "rcvDomainName",
+ p->domainname ? p->domainname
+ : "n/a");
}
- json_object_object_add(json_cap,
- "hostName",
+ json_object_object_add(json_cap, "hostName",
json_hname);
/* Gracefull Restart */
}
/* Hostname capability */
- vty_out(vty,
- " Hostname Capability:");
+ vty_out(vty, " Hostname Capability:");
if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV)) {
vty_out(vty,
" advertised (name: %s,domain name: %s)",
- bgp->peer_self->hostname ?
- bgp->peer_self->hostname
+ bgp->peer_self->hostname
+ ? bgp->peer_self
+ ->hostname
: "n/a",
- bgp->peer_self->domainname ?
- bgp->peer_self->domainname
+ bgp->peer_self->domainname
+ ? bgp->peer_self
+ ->domainname
: "n/a");
} else {
vty_out(vty, " not advertised");
if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV)) {
vty_out(vty,
" received (name: %s,domain name: %s)",
- p->hostname ?
- p->hostname : "n/a",
- p->domainname ?
- p->domainname : "n/a");
+ p->hostname ? p->hostname
+ : "n/a",
+ p->domainname ? p->domainname
+ : "n/a");
} else {
vty_out(vty, " not received");
}
}
void bgp_config_write_redistribute(struct vty *vty, struct bgp *bgp, afi_t afi,
- safi_t safi)
+ safi_t safi)
{
int i;
bgp->peer_self->hostname = NULL;
}
if (cmd_hostname_get())
- bgp->peer_self->hostname = XSTRDUP(MTYPE_BGP_PEER_HOST,
- cmd_hostname_get());
+ bgp->peer_self->hostname =
+ XSTRDUP(MTYPE_BGP_PEER_HOST, cmd_hostname_get());
if (bgp->peer_self->domainname != NULL) {
XFREE(MTYPE_BGP_PEER_HOST, bgp->peer_self->domainname);
bgp->peer_self->domainname = NULL;
}
if (cmd_domainname_get())
- bgp->peer_self->domainname = XSTRDUP(MTYPE_BGP_PEER_HOST,
- cmd_domainname_get());
+ bgp->peer_self->domainname =
+ XSTRDUP(MTYPE_BGP_PEER_HOST, cmd_domainname_get());
bgp->peer = list_new();
bgp->peer->cmp = (int (*)(void *, void *))peer_cmp;
bgp->peerhash = hash_create(peer_hash_key_make, peer_hash_same, NULL);
vty_out(vty,
" neighbor %s attribute-unchanged%s%s%s\n",
addr,
- peer_af_flag_check(
- peer, afi, safi,
- PEER_FLAG_AS_PATH_UNCHANGED)
+ peer_af_flag_check(peer, afi, safi,
+ PEER_FLAG_AS_PATH_UNCHANGED)
? " as-path"
: "",
- peer_af_flag_check(
- peer, afi, safi,
- PEER_FLAG_NEXTHOP_UNCHANGED)
+ peer_af_flag_check(peer, afi, safi,
+ PEER_FLAG_NEXTHOP_UNCHANGED)
? " next-hop"
: "",
peer_af_flag_check(peer, afi, safi,
}
/* Hostname configuration */
-DEFUN (config_domainname,
- domainname_cmd,
- "domainname WORD",
- "Set system's domain name\n"
- "This system's domain name\n")
+DEFUN(config_domainname,
+ domainname_cmd,
+ "domainname WORD",
+ "Set system's domain name\n"
+ "This system's domain name\n")
{
struct cmd_token *word = argv[1];
return cmd_domainname_set(word->arg);
}
-DEFUN (config_no_domainname,
- no_domainname_cmd,
- "no domainname [DOMAINNAME]",
- NO_STR
- "Reset system's domain name\n"
- "domain name of this router\n")
+DEFUN(config_no_domainname,
+ no_domainname_cmd,
+ "no domainname [DOMAINNAME]",
+ NO_STR
+ "Reset system's domain name\n"
+ "domain name of this router\n")
{
return cmd_domainname_set(NULL);
}
va_start(args, format);
vsnprintf(vty->frame + vty->frame_pos,
- sizeof(vty->frame) - vty->frame_pos,
- format, args);
+ sizeof(vty->frame) - vty->frame_pos, format, args);
vty->frame_pos = strlen(vty->frame);
va_end(args);
}
static void vty_prompt(struct vty *vty)
{
if (vty->type == VTY_TERM) {
- vty_out(vty, cmd_prompt(vty->node),
- cmd_hostname_get());
+ vty_out(vty, cmd_prompt(vty->node), cmd_hostname_get());
}
}
extern int zapi_route_decode(struct stream *, struct zapi_route *);
static inline void zapi_route_set_blackhole(struct zapi_route *api,
- enum blackhole_type bh_type)
+ enum blackhole_type bh_type)
{
api->nexthop_num = 1;
api->nexthops[0].type = NEXTHOP_TYPE_BLACKHOLE;
}
/* change Router_ID commands. */
-DEFUN (ospf6_router_id,
- ospf6_router_id_cmd,
- "ospf6 router-id A.B.C.D",
- OSPF6_STR
- "Configure OSPF6 Router-ID\n"
- V4NOTATION_STR)
+DEFUN(ospf6_router_id,
+ ospf6_router_id_cmd,
+ "ospf6 router-id A.B.C.D",
+ OSPF6_STR
+ "Configure OSPF6 Router-ID\n"
+ V4NOTATION_STR)
{
VTY_DECLVAR_CONTEXT(ospf6, o);
int idx = 0;
ret = inet_pton(AF_INET, router_id_str, &router_id);
if (ret == 0) {
- vty_out(vty, "malformed OSPF Router-ID: %s\n",
- router_id_str);
+ vty_out(vty, "malformed OSPF Router-ID: %s\n", router_id_str);
return CMD_SUCCESS;
}
return CMD_SUCCESS;
}
-DEFUN (no_ospf6_router_id,
- no_ospf6_router_id_cmd,
- "no ospf6 router-id [A.B.C.D]",
- NO_STR
- OSPF6_STR
- "Configure OSPF6 Router-ID\n"
- V4NOTATION_STR)
+DEFUN(no_ospf6_router_id,
+ no_ospf6_router_id_cmd,
+ "no ospf6 router-id [A.B.C.D]",
+ NO_STR OSPF6_STR
+ "Configure OSPF6 Router-ID\n"
+ V4NOTATION_STR)
{
VTY_DECLVAR_CONTEXT(ospf6, o);
o->router_id_static = 0;
"NOT SUPPORTED since its\nresults are inconsistent!\n");
}
- snprintf(vtysh_config, sizeof(vtysh_config), "%s%s/%s",
- sysconfdir, pathspace, VTYSH_CONFIG_NAME);
- snprintf(frr_config, sizeof(frr_config), "%s%s/%s",
- sysconfdir, pathspace, FRR_CONFIG_NAME);
+ snprintf(vtysh_config, sizeof(vtysh_config), "%s%s/%s", sysconfdir,
+ pathspace, VTYSH_CONFIG_NAME);
+ snprintf(frr_config, sizeof(frr_config), "%s%s/%s", sysconfdir,
+ pathspace, FRR_CONFIG_NAME);
strlcat(vtydir, pathspace, sizeof(vtydir));
/* Initialize user input buffer. */
{
struct prefix p;
struct nexthop nh = {
- .type = NEXTHOP_TYPE_IFINDEX,
- .ifindex = ifp->ifindex,
+ .type = NEXTHOP_TYPE_IFINDEX, .ifindex = ifp->ifindex,
};
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
{
struct prefix p;
struct nexthop nh = {
- .type = NEXTHOP_TYPE_IFINDEX,
- .ifindex = ifp->ifindex,
+ .type = NEXTHOP_TYPE_IFINDEX, .ifindex = ifp->ifindex,
};
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
{
struct prefix p;
struct nexthop nh = {
- .type = NEXTHOP_TYPE_IFINDEX,
- .ifindex = ifp->ifindex,
+ .type = NEXTHOP_TYPE_IFINDEX, .ifindex = ifp->ifindex,
};
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
{
struct prefix p;
struct nexthop nh = {
- .type = NEXTHOP_TYPE_IFINDEX,
- .ifindex = ifp->ifindex,
+ .type = NEXTHOP_TYPE_IFINDEX, .ifindex = ifp->ifindex,
};
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
if (family == AF_INET) {
if (CONNECTED_PEER(ifc)) {
p = ifc->destination;
- addattr_l(&req.n, sizeof req, IFA_ADDRESS,
- &p->u.prefix, bytelen);
+ addattr_l(&req.n, sizeof req, IFA_ADDRESS, &p->u.prefix,
+ bytelen);
} else if (cmd == RTM_NEWADDR && ifc->destination) {
p = ifc->destination;
addattr_l(&req.n, sizeof req, IFA_BROADCAST,
*/
if (!(ifa->ifa_flags
& (IFA_F_DADFAILED | IFA_F_TENTATIVE)))
- connected_add_ipv6(
- ifp, flags, (struct in6_addr *)addr,
- ifa->ifa_prefixlen, label);
+ connected_add_ipv6(ifp, flags,
+ (struct in6_addr *)addr,
+ ifa->ifa_prefixlen, label);
} else
connected_delete_ipv6(ifp, (struct in6_addr *)addr,
ifa->ifa_prefixlen);
NULL, NULL);
}
-DEFUN (ip_address_peer,
- ip_address_peer_cmd,
- "ip address A.B.C.D peer A.B.C.D/M",
- "Interface Internet Protocol config commands\n"
- "Set the IP address of an interface\n"
- "Local IP (e.g. 10.0.0.1) for P-t-P address\n"
- "Specify P-t-P address\n"
- "Peer IP address (e.g. 10.0.0.1/8)\n")
+DEFUN(ip_address_peer,
+ ip_address_peer_cmd,
+ "ip address A.B.C.D peer A.B.C.D/M",
+ "Interface Internet Protocol config commands\n"
+ "Set the IP address of an interface\n"
+ "Local IP (e.g. 10.0.0.1) for P-t-P address\n"
+ "Specify P-t-P address\n"
+ "Peer IP address (e.g. 10.0.0.1/8)\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
return ip_address_install(vty, ifp, argv[2]->arg, argv[4]->arg, NULL);
}
-DEFUN (no_ip_address_peer,
- no_ip_address_peer_cmd,
- "no ip address A.B.C.D peer A.B.C.D/M",
- NO_STR
- "Interface Internet Protocol config commands\n"
- "Set the IP address of an interface\n"
- "Local IP (e.g. 10.0.0.1) for P-t-P address\n"
- "Specify P-t-P address\n"
- "Peer IP address (e.g. 10.0.0.1/8)\n")
+DEFUN(no_ip_address_peer,
+ no_ip_address_peer_cmd,
+ "no ip address A.B.C.D peer A.B.C.D/M",
+ NO_STR
+ "Interface Internet Protocol config commands\n"
+ "Set the IP address of an interface\n"
+ "Local IP (e.g. 10.0.0.1) for P-t-P address\n"
+ "Specify P-t-P address\n"
+ "Peer IP address (e.g. 10.0.0.1/8)\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
return ip_address_uninstall(vty, ifp, argv[3]->arg, argv[5]->arg, NULL);
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)) {
+ inet_ntop(p->family, &p->u.prefix, buf,
+ sizeof(buf)));
+ if (CONNECTED_PEER(ifc)) {
p = ifc->destination;
vty_out(vty, " peer %s",
inet_ntop(p->family,
- &p->u.prefix,
- buf, sizeof(buf)));
+ &p->u.prefix, buf,
+ sizeof(buf)));
}
- vty_out (vty, "/%d", p->prefixlen);
+ vty_out(vty, "/%d", p->prefixlen);
if (ifc->label)
vty_out(vty, " label %s", ifc->label);
*/
if (rtm->rtm_type == RTM_CHANGE)
rib_delete(AFI_IP, SAFI_UNICAST, VRF_DEFAULT,
- ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p,
- NULL, NULL, 0, 0);
+ ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p, NULL,
+ NULL, 0, 0);
if (!nh.type) {
nh.type = NEXTHOP_TYPE_IPV4;
*/
if (rtm->rtm_type == RTM_CHANGE)
rib_delete(AFI_IP6, SAFI_UNICAST, VRF_DEFAULT,
- ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p,
- NULL, NULL, 0, 0);
+ ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p, NULL,
+ NULL, 0, 0);
if (!nh.type) {
nh.type = ifindex ? NEXTHOP_TYPE_IPV6_IFINDEX
rib_add(AFI_IP, SAFI_UNICAST, re->vrf_id,
ZEBRA_ROUTE_TABLE, re->table, 0, &p,
NULL, re->nexthop,
- zebrad.rtm_table_default,
- re->metric, re->mtu,
+ zebrad.rtm_table_default, re->metric,
+ re->mtu,
zebra_import_table_distance[AFI_IP]
[re->table]);
} else if (re->nexthop_num > 1) {
nh.type = NEXTHOP_TYPE_IFINDEX;
else if (index && gate)
nh.type = (afi == AFI_IP)
- ? NEXTHOP_TYPE_IPV4_IFINDEX
- : NEXTHOP_TYPE_IPV6_IFINDEX;
+ ? NEXTHOP_TYPE_IPV4_IFINDEX
+ : NEXTHOP_TYPE_IPV6_IFINDEX;
else if (!index && gate)
- nh.type = (afi == AFI_IP)
- ? NEXTHOP_TYPE_IPV4
- : NEXTHOP_TYPE_IPV6;
+ nh.type = (afi == AFI_IP) ? NEXTHOP_TYPE_IPV4
+ : NEXTHOP_TYPE_IPV6;
else {
nh.type = NEXTHOP_TYPE_BLACKHOLE;
nh.bh_type = bh_type;
nh.type = NEXTHOP_TYPE_IFINDEX;
else if (index && gate)
nh.type = (afi == AFI_IP)
- ? NEXTHOP_TYPE_IPV4_IFINDEX
- : NEXTHOP_TYPE_IPV6_IFINDEX;
+ ? NEXTHOP_TYPE_IPV4_IFINDEX
+ : NEXTHOP_TYPE_IPV6_IFINDEX;
else if (!index && gate)
- nh.type = (afi == AFI_IP)
- ? NEXTHOP_TYPE_IPV4
- : NEXTHOP_TYPE_IPV6;
+ nh.type = (afi == AFI_IP) ? NEXTHOP_TYPE_IPV4
+ : NEXTHOP_TYPE_IPV6;
else
nh.type = NEXTHOP_TYPE_BLACKHOLE;
nh.ifindex = index;
/* XXX: need to compare the entire list of nexthops
* here for NLM_F_APPEND stupidity */
rib_delete(afi, SAFI_UNICAST, vrf_id,
- ZEBRA_ROUTE_KERNEL, 0, flags, &p, NULL,
- NULL, table, metric);
+ ZEBRA_ROUTE_KERNEL, 0, flags, &p, NULL, NULL,
+ table, metric);
}
}
smplsp = (union sockunion *)&smpls;
#endif
- error = rtm_write(
- cmd, (union sockunion *)&sin_dest,
- (union sockunion *)mask,
- gate ? (union sockunion *)&sin_gate : NULL,
- smplsp, ifindex, bh_type, re->metric);
+ error = rtm_write(cmd, (union sockunion *)&sin_dest,
+ (union sockunion *)mask,
+ gate ? (union sockunion *)&sin_gate
+ : NULL,
+ smplsp, ifindex, bh_type, re->metric);
if (IS_ZEBRA_DEBUG_RIB) {
if (!gate) {
}
struct nexthop *route_entry_nexthop_blackhole_add(struct route_entry *re,
- enum blackhole_type bh_type)
+ enum blackhole_type bh_type)
{
struct nexthop *nexthop;
"via %s ifindex %d type %d "
"doesn't exist in rib",
inet_ntop(
- family2afi(afi), &nh->gate,
- buf2,
+ family2afi(afi),
+ &nh->gate, buf2,
INET_ADDRSTRLEN), /* FIXME
*/
nh->ifindex, type);
si->ifindex);
break;
case STATIC_BLACKHOLE:
- nexthop = route_entry_nexthop_blackhole_add(re,
- si->bh_type);
+ nexthop = route_entry_nexthop_blackhole_add(
+ re, si->bh_type);
break;
case STATIC_IPV6_GATEWAY:
nexthop = route_entry_nexthop_ipv6_add(re,
si->ifindex);
break;
case STATIC_BLACKHOLE:
- nexthop = route_entry_nexthop_blackhole_add(re,
- si->bh_type);
+ nexthop = route_entry_nexthop_blackhole_add(
+ re, si->bh_type);
break;
case STATIC_IPV6_GATEWAY:
nexthop = route_entry_nexthop_ipv6_add(re,
if (!negate)
static_add_route(afi, safi, type, &p, src_p, gatep, ifname,
- bh_type, tag, distance, zvrf, &snh_label);
+ bh_type, tag, distance, zvrf, &snh_label);
else
static_delete_route(afi, safi, type, &p, src_p, gatep, ifname,
tag, distance, zvrf, &snh_label);
}
/* Static route configuration. */
-DEFPY (ip_route,
- ip_route_cmd,
- "[no] ip route\
+DEFPY(ip_route, ip_route_cmd,
+ "[no] ip route\
<A.B.C.D/M$prefix|A.B.C.D$prefix A.B.C.D$mask>\
<\
{A.B.C.D$gate|INTERFACE$ifname}\
|vrf NAME\
|label WORD\
}]",
- NO_STR
- IP_STR
- "Establish static routes\n"
- "IP destination prefix (e.g. 10.0.0.0/8)\n"
- "IP destination prefix\n"
- "IP destination prefix mask\n"
- "IP gateway address\n"
- "IP gateway interface name\n"
- "Null interface\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this route\n"
- VRF_CMD_HELP_STR
- MPLS_LABEL_HELPSTR)
+ NO_STR IP_STR
+ "Establish static routes\n"
+ "IP destination prefix (e.g. 10.0.0.0/8)\n"
+ "IP destination prefix\n"
+ "IP destination prefix mask\n"
+ "IP gateway address\n"
+ "IP gateway interface name\n"
+ "Null interface\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n"
+ "Set tag for this route\n"
+ "Tag value\n"
+ "Distance value for this route\n"
+ VRF_CMD_HELP_STR
+ MPLS_LABEL_HELPSTR)
{
return zebra_static_route(vty, AFI_IP, SAFI_UNICAST, no, prefix,
mask_str, NULL, gate_str, ifname, flag,
vty_out(vty, " (ICMP unreachable)");
break;
case BLACKHOLE_ADMINPROHIB:
- vty_out(vty, " (ICMP admin-prohibited)");
+ vty_out(vty,
+ " (ICMP admin-prohibited)");
break;
case BLACKHOLE_NULL:
vty_out(vty, " (blackhole)");
switch (nexthop->bh_type) {
case BLACKHOLE_REJECT:
json_object_boolean_true_add(
- json_nexthop,
- "reject");
+ json_nexthop, "reject");
break;
case BLACKHOLE_ADMINPROHIB:
json_object_boolean_true_add(
- json_nexthop,
- "admin-prohibited");
+ json_nexthop,
+ "admin-prohibited");
break;
case BLACKHOLE_NULL:
json_object_boolean_true_add(
- json_nexthop,
- "blackhole");
+ json_nexthop, "blackhole");
break;
case BLACKHOLE_UNSPEC:
break;
return write;
}
-DEFPY (ipv6_route,
- ipv6_route_cmd,
- "[no] ipv6 route X:X::X:X/M$prefix [from X:X::X:X/M]\
+DEFPY(ipv6_route,
+ ipv6_route_cmd,
+ "[no] ipv6 route X:X::X:X/M$prefix [from X:X::X:X/M]\
<\
{X:X::X:X$gate|INTERFACE$ifname}\
|<null0|reject|blackhole>$flag\
|vrf NAME\
|label WORD\
}]",
- NO_STR
- IPV6_STR
- "Establish static routes\n"
- "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
- "IPv6 source-dest route\n"
- "IPv6 source prefix\n"
- "IPv6 gateway address\n"
- "IPv6 gateway interface name\n"
- "Null interface\n"
- "Emit an ICMP unreachable when matched\n"
- "Silently discard pkts when matched\n"
- "Set tag for this route\n"
- "Tag value\n"
- "Distance value for this prefix\n"
- VRF_CMD_HELP_STR
- MPLS_LABEL_HELPSTR)
+ NO_STR
+ IPV6_STR
+ "Establish static routes\n"
+ "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+ "IPv6 source-dest route\n"
+ "IPv6 source prefix\n"
+ "IPv6 gateway address\n"
+ "IPv6 gateway interface name\n"
+ "Null interface\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n"
+ "Set tag for this route\n"
+ "Tag value\n"
+ "Distance value for this prefix\n"
+ VRF_CMD_HELP_STR
+ MPLS_LABEL_HELPSTR)
{
return zebra_static_route(vty, AFI_IP6, SAFI_UNICAST, no, prefix_str,
NULL, from_str, gate_str, ifname, flag,
static void zvni_deref_ip2mac(zebra_vni_t *zvni, zebra_mac_t *mac,
int uninstall)
{
- if (!CHECK_FLAG(mac->flags, ZEBRA_MAC_AUTO) ||
- !list_isempty(mac->neigh_list))
+ if (!CHECK_FLAG(mac->flags, ZEBRA_MAC_AUTO)
+ || !list_isempty(mac->neigh_list))
return;
if (uninstall)
* 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);
+ 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);
+ listnode_delete(old_zmac->neigh_list, n);
zvni_deref_ip2mac(zvni, old_zmac, 0);
}
/* Inform BGP. */
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug(
- "%u: neigh %s (MAC %s) is now ACTIVE on VNI %u",
- ifp->vrf_id, ipaddr2str(ip, buf2, sizeof(buf2)),
- prefix_mac2str(macaddr, buf, sizeof(buf)),
- zvni->vni);
+ zlog_debug("%u: neigh %s (MAC %s) is now ACTIVE on VNI %u",
+ ifp->vrf_id, ipaddr2str(ip, buf2, sizeof(buf2)),
+ prefix_mac2str(macaddr, buf, sizeof(buf)),
+ zvni->vni);
ZEBRA_NEIGH_SET_ACTIVE(n);
- return zvni_neigh_send_add_to_client(zvrf, zvni->vni, ip,
- macaddr, 0);
+ return zvni_neigh_send_add_to_client(zvrf, zvni->vni, ip, macaddr, 0);
}
ifp = zvni->vxlan_if;
if (!ifp) {
- zlog_err("VNI %u hash %p doesn't have intf upon remote VTEP DEL",
- zvni->vni, zvni);
+ zlog_err(
+ "VNI %u hash %p doesn't have intf upon remote VTEP DEL",
+ zvni->vni, zvni);
continue;
}
zif = ifp->info;
svi_if_zif = svi_if->info;
if (svi_if_zif) {
svi_if_link = if_lookup_by_index_per_ns(
- zebra_ns_lookup(
- NS_DEFAULT),
- svi_if_zif->link_ifindex);
+ zebra_ns_lookup(NS_DEFAULT),
+ svi_if_zif->link_ifindex);
zvni = zvni_map_svi(svi_if, svi_if_link);
}
} else if (IS_ZEBRA_IF_BRIDGE(svi_if)) {
NULL; /* link info for the SVI = bridge info */
svi_if_zif = ifp->info;
- svi_if_link =
- if_lookup_by_index_per_ns(zebra_ns_lookup(NS_DEFAULT),
- svi_if_zif->link_ifindex);
+ svi_if_link = if_lookup_by_index_per_ns(
+ zebra_ns_lookup(NS_DEFAULT), svi_if_zif->link_ifindex);
if (svi_if_zif && svi_if_link)
zvni = zvni_map_svi(ifp, svi_if_link);
} else if (IS_ZEBRA_IF_BRIDGE(ifp)) {
api_nh->ifindex);
break;
case NEXTHOP_TYPE_BLACKHOLE:
- route_entry_nexthop_blackhole_add(re,
- api_nh->bh_type);
+ route_entry_nexthop_blackhole_add(
+ re, api_nh->bh_type);
break;
}