*: fix style

Fixes style nits introduced by recent pull requests.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
Quentin Young 2017-08-30 11:23:01 -04:00
parent cc1edd3929
commit 60466a63f2
No known key found for this signature in database
GPG Key ID: DAF48E0F57E0834F
25 changed files with 382 additions and 476 deletions

View File

@ -1440,7 +1440,7 @@ static int install_uninstall_routes_for_vni(struct bgp *bgp,
if (is_route_matching_for_vni(bgp, vpn, ri)) { if (is_route_matching_for_vni(bgp, vpn, ri)) {
if (install) if (install)
ret = install_evpn_route_entry( ret = install_evpn_route_entry(
bgp, vpn, evp, ri); bgp, vpn, evp, ri);
else else
ret = uninstall_evpn_route_entry( ret = uninstall_evpn_route_entry(
bgp, vpn, evp, ri); bgp, vpn, evp, ri);
@ -2670,8 +2670,7 @@ int bgp_filter_evpn_routes_upon_martian_nh_change(struct bgp *bgp)
&& ri->sub_type == BGP_ROUTE_NORMAL)) && ri->sub_type == BGP_ROUTE_NORMAL))
continue; continue;
if (bgp_nexthop_self(bgp, if (bgp_nexthop_self(bgp, ri->attr->nexthop)) {
ri->attr->nexthop)) {
char attr_str[BUFSIZ]; char attr_str[BUFSIZ];
char pbuf[PREFIX_STRLEN]; char pbuf[PREFIX_STRLEN];
@ -2685,20 +2684,16 @@ int bgp_filter_evpn_routes_upon_martian_nh_change(struct bgp *bgp)
"%u: prefix %s with attr %s - DENIED due to martian or self nexthop", "%u: prefix %s with attr %s - DENIED due to martian or self nexthop",
bgp->vrf_id, bgp->vrf_id,
prefix2str( prefix2str(
&rn->p, &rn->p, pbuf,
pbuf,
sizeof(pbuf)), sizeof(pbuf)),
attr_str); attr_str);
bgp_evpn_unimport_route(bgp, afi, safi, bgp_evpn_unimport_route(bgp, afi, safi,
&rn->p, ri); &rn->p, ri);
bgp_rib_remove(rn, ri, ri->peer, bgp_rib_remove(rn, ri, ri->peer, afi,
afi, safi); safi);
} }
} }
} }
} }
@ -2851,7 +2846,6 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
bgp->vrf_id, vni); bgp->vrf_id, vni);
return -1; return -1;
} }
} }
/* if the VNI is live already, there is nothing more to do */ /* if the VNI is live already, there is nothing more to do */

View File

@ -28,7 +28,7 @@
#include "bgpd/bgpd.h" #include "bgpd/bgpd.h"
#include "bgpd/bgp_ecommunity.h" #include "bgpd/bgp_ecommunity.h"
#define RT_ADDRSTRLEN 28 #define RT_ADDRSTRLEN 28
/* EVPN prefix lengths. */ /* EVPN prefix lengths. */
#define EVPN_TYPE_2_ROUTE_PREFIXLEN 224 #define EVPN_TYPE_2_ROUTE_PREFIXLEN 224

View File

@ -38,7 +38,7 @@
#define SHOW_DISPLAY_STANDARD 0 #define SHOW_DISPLAY_STANDARD 0
#define SHOW_DISPLAY_TAGS 1 #define SHOW_DISPLAY_TAGS 1
#define SHOW_DISPLAY_OVERLAY 2 #define SHOW_DISPLAY_OVERLAY 2
#define VNI_STR_LEN 32 #define VNI_STR_LEN 32
/* /*
* Context for VNI hash walk - used by callbacks. * Context for VNI hash walk - used by callbacks.
@ -157,7 +157,6 @@ static void display_import_rt(struct vty *vty, struct irt_node *irt,
json_object_object_add(json_rt, "vnis", json_vnis); json_object_object_add(json_rt, "vnis", json_vnis);
json_object_object_add(json, rt_buf, json_rt); json_object_object_add(json, rt_buf, json_rt);
} }
} }
static void show_import_rt_entry(struct hash_backet *backet, void *args[]) static void show_import_rt_entry(struct hash_backet *backet, void *args[])
@ -587,18 +586,15 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
rd_header = 1; rd_header = 1;
for (rm = bgp_table_top(table); rm; for (rm = bgp_table_top(table); rm; rm = bgp_route_next(rm))
rm = bgp_route_next(rm))
for (ri = rm->info; ri; ri = ri->next) { for (ri = rm->info; ri; ri = ri->next) {
total_count++; total_count++;
if (type == bgp_show_type_neighbor) { if (type == bgp_show_type_neighbor) {
union sockunion *su = union sockunion *su = output_arg;
output_arg;
if (ri->peer->su_remote == NULL if (ri->peer->su_remote == NULL
|| !sockunion_same( || !sockunion_same(
ri->peer->su_remote, ri->peer->su_remote, su))
su))
continue; continue;
} }
if (header == 0) { if (header == 0) {
@ -624,8 +620,7 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
json_ocode); json_ocode);
} }
} else { } else {
if (option if (option == SHOW_DISPLAY_TAGS)
== SHOW_DISPLAY_TAGS)
vty_out(vty, vty_out(vty,
V4_HEADER_TAG); V4_HEADER_TAG);
else if ( else if (
@ -642,8 +637,7 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
"Status codes: s suppressed, d damped, h history, * valid, > best, i - internal\n"); "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal\n");
vty_out(vty, vty_out(vty,
"Origin codes: i - IGP, e - EGP, ? - incomplete\n\n"); "Origin codes: i - IGP, e - EGP, ? - incomplete\n\n");
vty_out(vty, vty_out(vty, V4_HEADER);
V4_HEADER);
} }
} }
header = 0; header = 0;
@ -669,14 +663,11 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
char buffer[BUFSIZ]; char buffer[BUFSIZ];
if (type == RD_TYPE_AS if (type == RD_TYPE_AS
|| type == RD_TYPE_AS4) || type == RD_TYPE_AS4)
sprintf(buffer, sprintf(buffer, "%u:%d",
"%u:%d",
rd_as.as, rd_as.as,
rd_as.val); rd_as.val);
else if (type else if (type == RD_TYPE_IP)
== RD_TYPE_IP) sprintf(buffer, "%s:%d",
sprintf(buffer,
"%s:%d",
inet_ntoa( inet_ntoa(
rd_ip.ip), rd_ip.ip),
rd_ip.val); rd_ip.val);
@ -692,16 +683,13 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
"as2 %u:%d", "as2 %u:%d",
rd_as.as, rd_as.as,
rd_as.val); rd_as.val);
else if (type else if (type == RD_TYPE_AS4)
== RD_TYPE_AS4)
vty_out(vty, vty_out(vty,
"as4 %u:%d", "as4 %u:%d",
rd_as.as, rd_as.as,
rd_as.val); rd_as.val);
else if (type else if (type == RD_TYPE_IP)
== RD_TYPE_IP) vty_out(vty, "ip %s:%d",
vty_out(vty,
"ip %s:%d",
inet_ntoa( inet_ntoa(
rd_ip.ip), rd_ip.ip),
rd_ip.val); rd_ip.val);
@ -1496,8 +1484,7 @@ static void evpn_show_import_rts(struct vty *vty, struct bgp *bgp,
* Display EVPN routes for all VNIs - vty handler. * Display EVPN routes for all VNIs - vty handler.
*/ */
static void evpn_show_routes_vni_all(struct vty *vty, struct bgp *bgp, static void evpn_show_routes_vni_all(struct vty *vty, struct bgp *bgp,
struct in_addr vtep_ip, struct in_addr vtep_ip, json_object *json)
json_object *json)
{ {
u_int32_t num_vnis; u_int32_t num_vnis;
struct vni_walk_ctx wctx; struct vni_walk_ctx wctx;
@ -2357,7 +2344,8 @@ DEFUN(show_bgp_l2vpn_evpn_summary,
/* /*
* Display global EVPN routing table. * 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 bgp l2vpn evpn route [type <macip|multicast>] [json]",
SHOW_STR SHOW_STR
BGP_STR BGP_STR
@ -2409,7 +2397,8 @@ DEFUN(show_bgp_l2vpn_evpn_route, show_bgp_l2vpn_evpn_route_cmd,
/* /*
* Display global EVPN routing table for specific RD. * 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 bgp l2vpn evpn route rd ASN:nn_or_IP-address:nn [type <macip|multicast>] [json]",
SHOW_STR SHOW_STR
BGP_STR BGP_STR
@ -2754,7 +2743,8 @@ DEFUN(show_bgp_l2vpn_evpn_route_vni_multicast,
/* /*
* Display per-VNI EVPN routing table - for all VNIs. * 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 bgp l2vpn evpn route vni all [vtep A.B.C.D] [json]",
SHOW_STR SHOW_STR
BGP_STR BGP_STR
@ -2808,7 +2798,8 @@ DEFUN(show_bgp_l2vpn_evpn_route_vni_all, show_bgp_l2vpn_evpn_route_vni_all_cmd,
/* /*
* Display EVPN import route-target hash table * 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 bgp l2vpn evpn import-rt [json]",
SHOW_STR SHOW_STR
BGP_STR BGP_STR

View File

@ -122,8 +122,8 @@ static int bgp_tip_hash_cmp(const void *p1, const void *p2)
void bgp_tip_hash_init(struct bgp *bgp) void bgp_tip_hash_init(struct bgp *bgp)
{ {
bgp->tip_hash = hash_create(bgp_tip_hash_key_make, bgp->tip_hash =
bgp_tip_hash_cmp, NULL); hash_create(bgp_tip_hash_key_make, bgp_tip_hash_cmp, NULL);
} }
void bgp_tip_hash_destroy(struct bgp *bgp) void bgp_tip_hash_destroy(struct bgp *bgp)

View File

@ -2205,7 +2205,8 @@ static wq_item_status bgp_process_wq(struct work_queue *wq, void *data)
/* eoiu marker */ /* eoiu marker */
if (CHECK_FLAG(pqnode->flags, BGP_PROCESS_QUEUE_EOIU_MARKER)) { if (CHECK_FLAG(pqnode->flags, BGP_PROCESS_QUEUE_EOIU_MARKER)) {
bgp_process_main_one(bgp, NULL, 0, 0); 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; return WQ_SUCCESS;
} }
@ -2299,7 +2300,8 @@ void bgp_process(struct bgp *bgp, struct bgp_node *rn, afi_t afi, safi_t safi)
SET_FLAG(rn->flags, BGP_NODE_PROCESS_SCHEDULED); SET_FLAG(rn->flags, BGP_NODE_PROCESS_SCHEDULED);
bgp_lock_node(rn); 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); STAILQ_INSERT_TAIL(&pqnode->pqueue, rn, pq);
pqnode->queued++; pqnode->queued++;
@ -2431,8 +2433,8 @@ int bgp_maximum_prefix_overflow(struct peer *peer, afi_t afi, safi_t safi,
/* Unconditionally remove the route from the RIB, without taking /* Unconditionally remove the route from the RIB, without taking
* damping into consideration (eg, because the session went down) * damping into consideration (eg, because the session went down)
*/ */
void bgp_rib_remove(struct bgp_node *rn, struct bgp_info *ri, void bgp_rib_remove(struct bgp_node *rn, struct bgp_info *ri, struct peer *peer,
struct peer *peer, afi_t afi, safi_t safi) afi_t afi, safi_t safi)
{ {
bgp_aggregate_decrement(peer->bgp, &rn->p, ri, afi, safi); bgp_aggregate_decrement(peer->bgp, &rn->p, ri, afi, safi);
@ -3401,9 +3403,9 @@ static void bgp_soft_reconfig_table(struct peer *peer, afi_t afi, safi_t safi,
continue; continue;
struct bgp_info *ri = rn->info; struct bgp_info *ri = rn->info;
mpls_label_t label = mpls_label_t label = (ri && ri->extra)
(ri && ri->extra) ? ri->extra->label ? ri->extra->label
: MPLS_INVALID_LABEL; : MPLS_INVALID_LABEL;
ret = bgp_update(peer, &rn->p, ain->addpath_rx_id, ret = bgp_update(peer, &rn->p, ain->addpath_rx_id,
ain->attr, afi, safi, ZEBRA_ROUTE_BGP, ain->attr, afi, safi, ZEBRA_ROUTE_BGP,
@ -4572,19 +4574,16 @@ void bgp_static_add(struct bgp *bgp)
|| (safi == SAFI_EVPN)) { || (safi == SAFI_EVPN)) {
table = rn->info; table = rn->info;
for (rm = bgp_table_top(table); for (rm = bgp_table_top(table); rm;
rm;
rm = bgp_route_next(rm)) { rm = bgp_route_next(rm)) {
bgp_static = rm->info; bgp_static = rm->info;
bgp_static_update_safi( bgp_static_update_safi(
bgp, &rm->p, bgp, &rm->p, bgp_static,
bgp_static, afi, afi, safi);
safi);
} }
} else { } else {
bgp_static_update(bgp, &rn->p, bgp_static_update(bgp, &rn->p, rn->info,
rn->info, afi, afi, safi);
safi);
} }
} }
} }
@ -4612,15 +4611,13 @@ void bgp_static_delete(struct bgp *bgp)
|| (safi == SAFI_EVPN)) { || (safi == SAFI_EVPN)) {
table = rn->info; table = rn->info;
for (rm = bgp_table_top(table); for (rm = bgp_table_top(table); rm;
rm;
rm = bgp_route_next(rm)) { rm = bgp_route_next(rm)) {
bgp_static = rm->info; bgp_static = rm->info;
bgp_static_withdraw_safi( bgp_static_withdraw_safi(
bgp, &rm->p, bgp, &rm->p, AFI_IP,
AFI_IP, safi, safi,
(struct (struct prefix_rd *)&rn
prefix_rd *)&rn
->p); ->p);
bgp_static_free(bgp_static); bgp_static_free(bgp_static);
rn->info = NULL; rn->info = NULL;
@ -4628,8 +4625,8 @@ void bgp_static_delete(struct bgp *bgp)
} }
} else { } else {
bgp_static = rn->info; bgp_static = rn->info;
bgp_static_withdraw(bgp, &rn->p, bgp_static_withdraw(bgp, &rn->p, afi,
afi, safi); safi);
bgp_static_free(bgp_static); bgp_static_free(bgp_static);
rn->info = NULL; rn->info = NULL;
bgp_unlock_node(rn); bgp_unlock_node(rn);
@ -4660,20 +4657,18 @@ void bgp_static_redo_import_check(struct bgp *bgp)
|| (safi == SAFI_EVPN)) { || (safi == SAFI_EVPN)) {
table = rn->info; table = rn->info;
for (rm = bgp_table_top(table); for (rm = bgp_table_top(table); rm;
rm;
rm = bgp_route_next(rm)) { rm = bgp_route_next(rm)) {
bgp_static = rm->info; bgp_static = rm->info;
bgp_static_update_safi( bgp_static_update_safi(
bgp, &rm->p, bgp, &rm->p, bgp_static,
bgp_static, afi, afi, safi);
safi);
} }
} else { } else {
bgp_static = rn->info; bgp_static = rn->info;
bgp_static_update(bgp, &rn->p, bgp_static_update(bgp, &rn->p,
bgp_static, bgp_static, afi,
afi, safi); safi);
} }
} }
bgp_flag_unset(bgp, BGP_FLAG_FORCE_STATIC_PROCESS); bgp_flag_unset(bgp, BGP_FLAG_FORCE_STATIC_PROCESS);
@ -4960,7 +4955,7 @@ static int bgp_table_map_unset(struct vty *vty, afi_t afi, safi_t safi,
} }
void bgp_config_write_table_map(struct vty *vty, struct bgp *bgp, afi_t afi, 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) { if (bgp->table_map[afi][safi].name) {
vty_out(vty, " table-map %s\n", vty_out(vty, " table-map %s\n",
@ -5738,8 +5733,8 @@ static void bgp_aggregate_add(struct bgp *bgp, struct prefix *p, afi_t afi,
* community aggregation. */ * community aggregation. */
if (aggregate->as_set) { if (aggregate->as_set) {
if (aspath) { if (aspath) {
asmerge = aspath_aggregate(aspath, asmerge = aspath_aggregate(
ri->attr->aspath); aspath, ri->attr->aspath);
aspath_free(aspath); aspath_free(aspath);
aspath = asmerge; aspath = asmerge;
} else } else
@ -5752,8 +5747,7 @@ static void bgp_aggregate_add(struct bgp *bgp, struct prefix *p, afi_t afi,
ri->attr->community); ri->attr->community);
community = community_uniq_sort( community = community_uniq_sort(
commerge); commerge);
community_free( community_free(commerge);
commerge);
} else } else
community = community_dup( community = community_dup(
ri->attr->community); ri->attr->community);
@ -5827,8 +5821,8 @@ void bgp_aggregate_delete(struct bgp *bgp, struct prefix *p, afi_t afi,
ri->extra->suppress--; ri->extra->suppress--;
if (ri->extra->suppress == 0) { if (ri->extra->suppress == 0) {
bgp_info_set_flag(rn, ri, bgp_info_set_flag(
BGP_INFO_ATTR_CHANGED); rn, ri, BGP_INFO_ATTR_CHANGED);
match++; match++;
} }
} }
@ -6307,21 +6301,22 @@ static void route_vty_out_route(struct prefix *p, struct vty *vty,
} else if (p->family == AF_EVPN) { } else if (p->family == AF_EVPN) {
#if defined(HAVE_CUMULUS) #if defined(HAVE_CUMULUS)
if (!json) if (!json)
len = vty_out(vty, "%s", len = vty_out(
bgp_evpn_route2str((struct prefix_evpn *)p, vty, "%s",
buf, BUFSIZ)); bgp_evpn_route2str((struct prefix_evpn *)p, buf,
BUFSIZ));
else else
bgp_evpn_route2json((struct prefix_evpn *) p, json); bgp_evpn_route2json((struct prefix_evpn *)p, json);
#else #else
prefix2str(p, buf, PREFIX_STRLEN); prefix2str(p, buf, PREFIX_STRLEN);
len = vty_out(vty, "%s", buf); len = vty_out(vty, "%s", buf);
#endif #endif
} else { } else {
if (!json) if (!json)
len = vty_out(vty, "%s/%d", len = vty_out(
inet_ntop(p->family, &p->u.prefix, buf, vty, "%s/%d",
BUFSIZ), inet_ntop(p->family, &p->u.prefix, buf, BUFSIZ),
p->prefixlen); p->prefixlen);
} }
if (!json) { if (!json) {
@ -8425,9 +8420,9 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
if (has_valid_label) if (has_valid_label)
json_object_int_add(json, "localLabel", label); json_object_int_add(json, "localLabel", label);
json_object_string_add(json, "prefix", json_object_string_add(
prefix2str(p, prefix_str, json, "prefix",
sizeof(prefix_str))); prefix2str(p, prefix_str, sizeof(prefix_str)));
} else { } else {
#if defined(HAVE_CUMULUS) #if defined(HAVE_CUMULUS)
if (safi == SAFI_EVPN) if (safi == SAFI_EVPN)
@ -8603,8 +8598,9 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp,
for (ri = rm->info; ri; ri = ri->next) { for (ri = rm->info; ri; ri = ri->next) {
if (header) { if (header) {
route_vty_out_detail_header(vty, bgp, route_vty_out_detail_header(
rm, (struct prefix_rd *)&rn->p, vty, bgp, rm,
(struct prefix_rd *)&rn->p,
AFI_IP, safi, json); AFI_IP, safi, json);
header = 0; header = 0;
} }
@ -8618,7 +8614,7 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp,
&& (CHECK_FLAG(ri->flags, && (CHECK_FLAG(ri->flags,
BGP_INFO_MULTIPATH) BGP_INFO_MULTIPATH)
|| CHECK_FLAG(ri->flags, || CHECK_FLAG(ri->flags,
BGP_INFO_SELECTED)))) BGP_INFO_SELECTED))))
route_vty_out_detail(vty, bgp, &rm->p, route_vty_out_detail(vty, bgp, &rm->p,
ri, AFI_IP, safi, ri, AFI_IP, safi,
json_paths); json_paths);
@ -10015,8 +10011,7 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
if (header1) { if (header1) {
if (use_json) { if (use_json) {
json_object_int_add( json_object_int_add(
json, json, "bgpTableVersion",
"bgpTableVersion",
0); 0);
json_object_string_add( json_object_string_add(
json, json,
@ -10024,12 +10019,10 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
inet_ntoa( inet_ntoa(
bgp->router_id)); bgp->router_id));
json_object_object_add( json_object_object_add(
json, json, "bgpStatusCodes",
"bgpStatusCodes",
json_scode); json_scode);
json_object_object_add( json_object_object_add(
json, json, "bgpOriginCodes",
"bgpOriginCodes",
json_ocode); json_ocode);
} else { } else {
vty_out(vty, vty_out(vty,
@ -10051,11 +10044,13 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
if (ain->attr) { if (ain->attr) {
bgp_attr_dup(&attr, ain->attr); bgp_attr_dup(&attr, ain->attr);
if (bgp_input_modifier(peer, &rn->p, if (bgp_input_modifier(peer, &rn->p,
&attr, afi, safi, rmap_name) &attr, afi, safi,
rmap_name)
!= RMAP_DENY) { != RMAP_DENY) {
route_vty_out_tmp(vty, &rn->p, route_vty_out_tmp(vty, &rn->p,
&attr, safi, use_json, &attr, safi,
json_ar); use_json,
json_ar);
output_count++; output_count++;
} else } else
filtered_count++; filtered_count++;
@ -10875,11 +10870,11 @@ static int bgp_clear_damp_route(struct vty *vty, const char *view_name,
|| rm->p.prefixlen == match.prefixlen) { || rm->p.prefixlen == match.prefixlen) {
ri = rm->info; ri = rm->info;
while (ri) { while (ri) {
if (ri->extra if (ri->extra && ri->extra->damp_info) {
&& ri->extra->damp_info) {
ri_temp = ri->next; ri_temp = ri->next;
bgp_damp_info_free( bgp_damp_info_free(
ri->extra->damp_info, 1); ri->extra->damp_info,
1);
ri = ri_temp; ri = ri_temp;
} else } else
ri = ri->next; ri = ri->next;
@ -10999,8 +10994,7 @@ static void bgp_config_write_network_vpn(struct vty *vty, struct bgp *bgp,
if ((table = prn->info) == NULL) if ((table = prn->info) == NULL)
continue; continue;
for (rn = bgp_table_top(table); rn; for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
rn = bgp_route_next(rn)) {
if ((bgp_static = rn->info) == NULL) if ((bgp_static = rn->info) == NULL)
continue; continue;
@ -11049,8 +11043,7 @@ static void bgp_config_write_network_evpn(struct vty *vty, struct bgp *bgp,
if ((table = prn->info) == NULL) if ((table = prn->info) == NULL)
continue; continue;
for (rn = bgp_table_top(table); rn; for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
rn = bgp_route_next(rn)) {
if ((bgp_static = rn->info) == NULL) if ((bgp_static = rn->info) == NULL)
continue; continue;
@ -11074,8 +11067,8 @@ static void bgp_config_write_network_evpn(struct vty *vty, struct bgp *bgp,
prefix2str(p, buf, sizeof(buf)); prefix2str(p, buf, sizeof(buf));
vty_out(vty, vty_out(vty,
" network %s rd %s ethtag %u tag %u esi %s gwip %s routermac %s\n", " network %s rd %s ethtag %u tag %u esi %s gwip %s routermac %s\n",
buf, rdbuf, p->u.prefix_evpn .eth_tag, buf, rdbuf, p->u.prefix_evpn.eth_tag,
decode_label(&bgp_static ->label), esi, buf2, decode_label(&bgp_static->label), esi, buf2,
macrouter); macrouter);
if (macrouter) if (macrouter)
@ -11116,8 +11109,7 @@ void bgp_config_write_network(struct vty *vty, struct bgp *bgp, afi_t afi,
p = &rn->p; p = &rn->p;
/* "network" configuration display. */ /* "network" configuration display. */
if (bgp_option_check(BGP_OPT_CONFIG_CISCO) if (bgp_option_check(BGP_OPT_CONFIG_CISCO) && afi == AFI_IP) {
&& afi == AFI_IP) {
u_int32_t destination; u_int32_t destination;
struct in_addr netmask; struct in_addr netmask;
@ -11189,7 +11181,7 @@ void bgp_config_write_network(struct vty *vty, struct bgp *bgp, afi_t afi,
} }
void bgp_config_write_distance(struct vty *vty, struct bgp *bgp, afi_t afi, 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_node *rn;
struct bgp_distance *bdistance; struct bgp_distance *bdistance;

View File

@ -369,9 +369,11 @@ extern void bgp_process(struct bgp *, struct bgp_node *, afi_t, safi_t);
* queue element with NULL bgp node. * queue element with NULL bgp node.
*/ */
extern void bgp_add_eoiu_mark(struct bgp *); 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_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 *, extern void bgp_aggregate_increment(struct bgp *, struct prefix *,
struct bgp_info *, afi_t, safi_t); struct bgp_info *, afi_t, safi_t);

View File

@ -1498,7 +1498,7 @@ ALIAS_HIDDEN(no_bgp_maxpaths_ibgp, no_bgp_maxpaths_ibgp_hidden_cmd,
"Match the cluster length\n") "Match the cluster length\n")
void bgp_config_write_maxpaths(struct vty *vty, struct bgp *bgp, afi_t afi, 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) { if (bgp->maxpaths[afi][safi].maxpaths_ebgp != MULTIPATH_NUM) {
vty_out(vty, " maximum-paths %d\n", vty_out(vty, " maximum-paths %d\n",
@ -6414,21 +6414,19 @@ DEFUN (show_bgp_vrfs,
static void show_address_entry(struct hash_backet *backet, void *args) static void show_address_entry(struct hash_backet *backet, void *args)
{ {
struct vty *vty = (struct vty *) args; struct vty *vty = (struct vty *)args;
struct bgp_addr *addr = (struct bgp_addr *) backet->data; struct bgp_addr *addr = (struct bgp_addr *)backet->data;
vty_out(vty, "addr: %s, count: %d\n", vty_out(vty, "addr: %s, count: %d\n", inet_ntoa(addr->addr),
inet_ntoa(addr->addr),
addr->refcnt); addr->refcnt);
} }
static void show_tip_entry(struct hash_backet *backet, void *args) static void show_tip_entry(struct hash_backet *backet, void *args)
{ {
struct vty *vty = (struct vty *)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", vty_out(vty, "addr: %s, count: %d\n", inet_ntoa(tip->addr),
inet_ntoa(tip->addr),
tip->refcnt); tip->refcnt);
} }
@ -6445,13 +6443,13 @@ static void bgp_show_martian_nexthops(struct vty *vty, struct bgp *bgp)
vty); vty);
} }
DEFUN (show_bgp_martian_nexthop_db, DEFUN(show_bgp_martian_nexthop_db,
show_bgp_martian_nexthop_db_cmd, show_bgp_martian_nexthop_db_cmd,
"show bgp martian next-hop", "show bgp martian next-hop",
SHOW_STR SHOW_STR
BGP_STR BGP_STR
"martian next-hops\n" "martian next-hops\n"
"martian next-hop database\n") "martian next-hop database\n")
{ {
struct bgp *bgp = NULL; struct bgp *bgp = NULL;
@ -6671,19 +6669,16 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
char memstrbuf[MTYPE_MEMSTR_LEN]; char memstrbuf[MTYPE_MEMSTR_LEN];
int vrf_id_ui; int vrf_id_ui;
vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) vrf_id_ui =
? -1 (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id;
: bgp->vrf_id;
/* Usage summary and header */ /* Usage summary and header */
if (use_json) { if (use_json) {
json_object_string_add( json_object_string_add(
json, "routerId", json, "routerId",
inet_ntoa(bgp->router_id)); inet_ntoa(bgp->router_id));
json_object_int_add(json, "as", json_object_int_add(json, "as", bgp->as);
bgp->as); json_object_int_add(json, "vrfId", vrf_id_ui);
json_object_int_add(json, "vrfId",
vrf_id_ui);
json_object_string_add( json_object_string_add(
json, "vrfName", json, "vrfName",
(bgp->inst_type (bgp->inst_type
@ -6693,16 +6688,15 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
} else { } else {
vty_out(vty, vty_out(vty,
"BGP router identifier %s, local AS number %u vrf-id %d", "BGP router identifier %s, local AS number %u vrf-id %d",
inet_ntoa(bgp->router_id), inet_ntoa(bgp->router_id), bgp->as,
bgp->as, vrf_id_ui); vrf_id_ui);
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
if (bgp_update_delay_configured(bgp)) { if (bgp_update_delay_configured(bgp)) {
if (use_json) { if (use_json) {
json_object_int_add( json_object_int_add(
json, json, "updateDelayLimit",
"updateDelayLimit",
bgp->v_update_delay); bgp->v_update_delay);
if (bgp->v_update_delay if (bgp->v_update_delay
@ -6712,8 +6706,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
"updateDelayEstablishWait", "updateDelayEstablishWait",
bgp->v_establish_wait); bgp->v_establish_wait);
if (bgp_update_delay_active( if (bgp_update_delay_active(bgp)) {
bgp)) {
json_object_string_add( json_object_string_add(
json, json,
"updateDelayFirstNeighbor", "updateDelayFirstNeighbor",
@ -6751,8 +6744,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
" Establish wait: %d seconds\n", " Establish wait: %d seconds\n",
bgp->v_establish_wait); bgp->v_establish_wait);
if (bgp_update_delay_active( if (bgp_update_delay_active(bgp)) {
bgp)) {
vty_out(vty, vty_out(vty,
" First neighbor established: %s\n", " First neighbor established: %s\n",
bgp->update_delay_begin_time); bgp->update_delay_begin_time);
@ -6781,37 +6773,29 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
if (bgp_maxmed_onstartup_configured(bgp) if (bgp_maxmed_onstartup_configured(bgp)
&& bgp->maxmed_active) && bgp->maxmed_active)
json_object_boolean_true_add( json_object_boolean_true_add(
json, json, "maxMedOnStartup");
"maxMedOnStartup");
if (bgp->v_maxmed_admin) if (bgp->v_maxmed_admin)
json_object_boolean_true_add( json_object_boolean_true_add(
json, json, "maxMedAdministrative");
"maxMedAdministrative");
json_object_int_add( json_object_int_add(
json, "tableVersion", json, "tableVersion",
bgp_table_version( bgp_table_version(bgp->rib[afi][safi]));
bgp->rib[afi][safi]));
ents = bgp_table_count( ents = bgp_table_count(bgp->rib[afi][safi]);
bgp->rib[afi][safi]); json_object_int_add(json, "ribCount", ents);
json_object_int_add(json, "ribCount",
ents);
json_object_int_add( json_object_int_add(
json, "ribMemory", json, "ribMemory",
ents * sizeof(struct bgp_node)); ents * sizeof(struct bgp_node));
ents = listcount(bgp->peer); ents = listcount(bgp->peer);
json_object_int_add(json, "peerCount", json_object_int_add(json, "peerCount", ents);
ents); json_object_int_add(json, "peerMemory",
json_object_int_add( ents * sizeof(struct peer));
json, "peerMemory",
ents * sizeof(struct peer));
if ((ents = listcount(bgp->group))) { if ((ents = listcount(bgp->group))) {
json_object_int_add( json_object_int_add(
json, "peerGroupCount", json, "peerGroupCount", ents);
ents);
json_object_int_add( json_object_int_add(
json, "peerGroupMemory", json, "peerGroupMemory",
ents * sizeof(struct ents * sizeof(struct
@ -6821,8 +6805,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
if (CHECK_FLAG(bgp->af_flags[afi][safi], if (CHECK_FLAG(bgp->af_flags[afi][safi],
BGP_CONFIG_DAMPENING)) BGP_CONFIG_DAMPENING))
json_object_boolean_true_add( json_object_boolean_true_add(
json, json, "dampeningEnabled");
"dampeningEnabled");
} else { } else {
if (bgp_maxmed_onstartup_configured(bgp) if (bgp_maxmed_onstartup_configured(bgp)
&& bgp->maxmed_active) && bgp->maxmed_active)
@ -6832,33 +6815,25 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
vty_out(vty, vty_out(vty,
"Max-med administrative active\n"); "Max-med administrative active\n");
vty_out(vty, vty_out(vty, "BGP table version %" PRIu64 "\n",
"BGP table version %" PRIu64 bgp_table_version(bgp->rib[afi][safi]));
"\n",
bgp_table_version(
bgp->rib[afi][safi]));
ents = bgp_table_count( ents = bgp_table_count(bgp->rib[afi][safi]);
bgp->rib[afi][safi]);
vty_out(vty, vty_out(vty,
"RIB entries %ld, using %s of memory\n", "RIB entries %ld, using %s of memory\n",
ents, ents,
mtype_memstr( mtype_memstr(memstrbuf,
memstrbuf, sizeof(memstrbuf),
sizeof(memstrbuf), ents * sizeof(struct
ents * sizeof(struct bgp_node)));
bgp_node)));
/* Peer related usage */ /* Peer related usage */
ents = listcount(bgp->peer); ents = listcount(bgp->peer);
vty_out(vty, vty_out(vty, "Peers %ld, using %s of memory\n",
"Peers %ld, using %s of memory\n",
ents, ents,
mtype_memstr( mtype_memstr(
memstrbuf, memstrbuf, sizeof(memstrbuf),
sizeof(memstrbuf), ents * sizeof(struct peer)));
ents * sizeof(struct
peer)));
if ((ents = listcount(bgp->group))) if ((ents = listcount(bgp->group)))
vty_out(vty, vty_out(vty,
@ -6872,15 +6847,14 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
if (CHECK_FLAG(bgp->af_flags[afi][safi], if (CHECK_FLAG(bgp->af_flags[afi][safi],
BGP_CONFIG_DAMPENING)) BGP_CONFIG_DAMPENING))
vty_out(vty, vty_out(vty, "Dampening enabled.\n");
"Dampening enabled.\n");
vty_out(vty, "\n"); vty_out(vty, "\n");
/* Subtract 8 here because 'Neighbor' is /* Subtract 8 here because 'Neighbor' is
* 8 characters */ * 8 characters */
vty_out(vty, "Neighbor"); vty_out(vty, "Neighbor");
vty_out(vty, "%*s", vty_out(vty, "%*s", max_neighbor_width - 8,
max_neighbor_width - 8, " "); " ");
vty_out(vty, vty_out(vty,
"V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd\n"); "V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd\n");
} }
@ -6892,75 +6866,64 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
json_peer = json_object_new_object(); json_peer = json_object_new_object();
if (peer_dynamic_neighbor(peer)) if (peer_dynamic_neighbor(peer))
json_object_boolean_true_add( json_object_boolean_true_add(json_peer,
json_peer, "dynamicPeer"); "dynamicPeer");
if (peer->hostname) if (peer->hostname)
json_object_string_add(json_peer, json_object_string_add(json_peer, "hostname",
"hostname",
peer->hostname); peer->hostname);
if (peer->domainname) if (peer->domainname)
json_object_string_add( json_object_string_add(json_peer, "domainname",
json_peer, "domainname", peer->domainname);
peer->domainname);
json_object_int_add(json_peer, "remoteAs", json_object_int_add(json_peer, "remoteAs", peer->as);
peer->as);
json_object_int_add(json_peer, "version", 4); json_object_int_add(json_peer, "version", 4);
json_object_int_add( json_object_int_add(json_peer, "msgRcvd",
json_peer, "msgRcvd", peer->open_in + peer->update_in
peer->open_in + peer->update_in + peer->keepalive_in
+ peer->keepalive_in + peer->notify_in
+ peer->notify_in + peer->refresh_in
+ peer->refresh_in + peer->dynamic_cap_in);
+ peer->dynamic_cap_in); json_object_int_add(json_peer, "msgSent",
json_object_int_add( peer->open_out + peer->update_out
json_peer, "msgSent", + peer->keepalive_out
peer->open_out + peer->update_out + peer->notify_out
+ peer->keepalive_out + peer->refresh_out
+ peer->notify_out + peer->dynamic_cap_out);
+ peer->refresh_out
+ peer->dynamic_cap_out);
json_object_int_add(json_peer, "tableVersion", json_object_int_add(json_peer, "tableVersion",
peer->version[afi][safi]); peer->version[afi][safi]);
json_object_int_add(json_peer, "outq", json_object_int_add(json_peer, "outq",
peer->obuf->count); peer->obuf->count);
json_object_int_add(json_peer, "inq", 0); json_object_int_add(json_peer, "inq", 0);
peer_uptime(peer->uptime, timebuf, peer_uptime(peer->uptime, timebuf, BGP_UPTIME_LEN,
BGP_UPTIME_LEN, use_json, use_json, json_peer);
json_peer); json_object_int_add(json_peer, "prefixReceivedCount",
json_object_int_add( peer->pcount[afi][pfx_rcd_safi]);
json_peer, "prefixReceivedCount",
peer->pcount[afi][pfx_rcd_safi]);
if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN)) if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN))
json_object_string_add(json_peer, json_object_string_add(json_peer, "state",
"state",
"Idle (Admin)"); "Idle (Admin)");
else if (CHECK_FLAG( else if (CHECK_FLAG(peer->sflags,
peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
PEER_STATUS_PREFIX_OVERFLOW)) json_object_string_add(json_peer, "state",
json_object_string_add(json_peer,
"state",
"Idle (PfxCt)"); "Idle (PfxCt)");
else else
json_object_string_add( json_object_string_add(
json_peer, "state", json_peer, "state",
lookup_msg(bgp_status_msg, lookup_msg(bgp_status_msg, peer->status,
peer->status, NULL)); NULL));
if (peer->conf_if) if (peer->conf_if)
json_object_string_add(json_peer, json_object_string_add(json_peer, "idType",
"idType",
"interface"); "interface");
else if (peer->su.sa.sa_family == AF_INET) else if (peer->su.sa.sa_family == AF_INET)
json_object_string_add( json_object_string_add(json_peer, "idType",
json_peer, "idType", "ipv4"); "ipv4");
else if (peer->su.sa.sa_family == AF_INET6) else if (peer->su.sa.sa_family == AF_INET6)
json_object_string_add( json_object_string_add(json_peer, "idType",
json_peer, "idType", "ipv6"); "ipv6");
json_object_object_add(json_peers, peer->host, json_object_object_add(json_peers, peer->host,
json_peer); json_peer);
@ -6972,57 +6935,45 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
} }
if (peer->hostname if (peer->hostname
&& bgp_flag_check(bgp, && bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME))
BGP_FLAG_SHOW_HOSTNAME))
len = vty_out(vty, "%s%s(%s)", dn_flag, len = vty_out(vty, "%s%s(%s)", dn_flag,
peer->hostname, peer->hostname, peer->host);
peer->host);
else else
len = vty_out(vty, "%s%s", dn_flag, len = vty_out(vty, "%s%s", dn_flag, peer->host);
peer->host);
/* pad the neighbor column with spaces */ /* pad the neighbor column with spaces */
if (len < max_neighbor_width) if (len < max_neighbor_width)
vty_out(vty, "%*s", vty_out(vty, "%*s", max_neighbor_width - len,
max_neighbor_width - len, " "); " ");
vty_out(vty, "4 %10u %7d %7d %8" PRIu64 vty_out(vty, "4 %10u %7d %7d %8" PRIu64 " %4d %4zd %8s",
" %4d %4zd %8s",
peer->as, peer->as,
peer->open_in + peer->update_in peer->open_in + peer->update_in
+ peer->keepalive_in + peer->keepalive_in + peer->notify_in
+ peer->notify_in
+ peer->refresh_in + peer->refresh_in
+ peer->dynamic_cap_in, + peer->dynamic_cap_in,
peer->open_out + peer->update_out peer->open_out + peer->update_out
+ peer->keepalive_out + peer->keepalive_out + peer->notify_out
+ peer->notify_out
+ peer->refresh_out + peer->refresh_out
+ peer->dynamic_cap_out, + peer->dynamic_cap_out,
peer->version[afi][safi], 0, peer->version[afi][safi], 0, peer->obuf->count,
peer->obuf->count,
peer_uptime(peer->uptime, timebuf, peer_uptime(peer->uptime, timebuf,
BGP_UPTIME_LEN, 0, NULL)); BGP_UPTIME_LEN, 0, NULL));
if (peer->status == Established) if (peer->status == Established)
vty_out(vty, " %12ld", vty_out(vty, " %12ld",
peer->pcount[afi] peer->pcount[afi][pfx_rcd_safi]);
[pfx_rcd_safi]);
else { else {
if (CHECK_FLAG(peer->flags, if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN))
PEER_FLAG_SHUTDOWN))
vty_out(vty, " Idle (Admin)"); vty_out(vty, " Idle (Admin)");
else if ( else if (CHECK_FLAG(
CHECK_FLAG( peer->sflags,
peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
PEER_STATUS_PREFIX_OVERFLOW))
vty_out(vty, " Idle (PfxCt)"); vty_out(vty, " Idle (PfxCt)");
else else
vty_out(vty, " %12s", vty_out(vty, " %12s",
lookup_msg( lookup_msg(bgp_status_msg,
bgp_status_msg, peer->status, NULL));
peer->status,
NULL));
} }
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
@ -7572,8 +7523,8 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
if (afi == AFI_L2VPN && safi == SAFI_EVPN) { if (afi == AFI_L2VPN && safi == SAFI_EVPN) {
if (p->bgp->advertise_all_vni) if (p->bgp->advertise_all_vni)
json_object_boolean_true_add(json_addr, json_object_boolean_true_add(
"advertiseAllVnis"); json_addr, "advertiseAllVnis");
} }
if (filter->plist[FILTER_IN].name if (filter->plist[FILTER_IN].name
@ -8632,43 +8583,38 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json,
json_multi); json_multi);
/* Hostname capabilities */ /* Hostname capabilities */
json_object *json_hname = NULL; json_object *json_hname = NULL;
json_hname = json_object_new_object(); json_hname = json_object_new_object();
if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV)) { if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV)) {
json_object_string_add( json_object_string_add(
json_hname, json_hname, "advHostName",
"advHostName", bgp->peer_self->hostname
bgp->peer_self->hostname ? ? bgp->peer_self
bgp->peer_self->hostname ->hostname
: "n/a"); : "n/a");
json_object_string_add( json_object_string_add(
json_hname, json_hname, "advDomainName",
"advDomainName", bgp->peer_self->domainname
bgp->peer_self->domainname ? ? bgp->peer_self
bgp->peer_self->domainname ->domainname
: "n/a"); : "n/a");
} }
if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV)) { if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV)) {
json_object_string_add( json_object_string_add(
json_hname, json_hname, "rcvHostName",
"rcvHostName", p->hostname ? p->hostname
p->hostname ? : "n/a");
p->hostname :
"n/a");
json_object_string_add( json_object_string_add(
json_hname, json_hname, "rcvDomainName",
"rcvDomainName", p->domainname ? p->domainname
p->domainname ? : "n/a");
p->domainname :
"n/a");
} }
json_object_object_add(json_cap, json_object_object_add(json_cap, "hostName",
"hostName",
json_hname); json_hname);
/* Gracefull Restart */ /* Gracefull Restart */
@ -9004,17 +8950,18 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json,
} }
/* Hostname capability */ /* Hostname capability */
vty_out(vty, vty_out(vty, " Hostname Capability:");
" Hostname Capability:");
if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV)) { if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV)) {
vty_out(vty, vty_out(vty,
" advertised (name: %s,domain name: %s)", " advertised (name: %s,domain name: %s)",
bgp->peer_self->hostname ? bgp->peer_self->hostname
bgp->peer_self->hostname ? bgp->peer_self
->hostname
: "n/a", : "n/a",
bgp->peer_self->domainname ? bgp->peer_self->domainname
bgp->peer_self->domainname ? bgp->peer_self
->domainname
: "n/a"); : "n/a");
} else { } else {
vty_out(vty, " not advertised"); vty_out(vty, " not advertised");
@ -9023,10 +8970,10 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json,
if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV)) { if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV)) {
vty_out(vty, vty_out(vty,
" received (name: %s,domain name: %s)", " received (name: %s,domain name: %s)",
p->hostname ? p->hostname ? p->hostname
p->hostname : "n/a", : "n/a",
p->domainname ? p->domainname ? p->domainname
p->domainname : "n/a"); : "n/a");
} else { } else {
vty_out(vty, " not received"); vty_out(vty, " not received");
} }
@ -11146,7 +11093,7 @@ DEFUN (no_bgp_redistribute_ipv6,
} }
void bgp_config_write_redistribute(struct vty *vty, struct bgp *bgp, afi_t afi, void bgp_config_write_redistribute(struct vty *vty, struct bgp *bgp, afi_t afi,
safi_t safi) safi_t safi)
{ {
int i; int i;

View File

@ -2821,16 +2821,16 @@ static struct bgp *bgp_create(as_t *as, const char *name,
bgp->peer_self->hostname = NULL; bgp->peer_self->hostname = NULL;
} }
if (cmd_hostname_get()) if (cmd_hostname_get())
bgp->peer_self->hostname = XSTRDUP(MTYPE_BGP_PEER_HOST, bgp->peer_self->hostname =
cmd_hostname_get()); XSTRDUP(MTYPE_BGP_PEER_HOST, cmd_hostname_get());
if (bgp->peer_self->domainname != NULL) { if (bgp->peer_self->domainname != NULL) {
XFREE(MTYPE_BGP_PEER_HOST, bgp->peer_self->domainname); XFREE(MTYPE_BGP_PEER_HOST, bgp->peer_self->domainname);
bgp->peer_self->domainname = NULL; bgp->peer_self->domainname = NULL;
} }
if (cmd_domainname_get()) if (cmd_domainname_get())
bgp->peer_self->domainname = XSTRDUP(MTYPE_BGP_PEER_HOST, bgp->peer_self->domainname =
cmd_domainname_get()); XSTRDUP(MTYPE_BGP_PEER_HOST, cmd_domainname_get());
bgp->peer = list_new(); bgp->peer = list_new();
bgp->peer->cmp = (int (*)(void *, void *))peer_cmp; bgp->peer->cmp = (int (*)(void *, void *))peer_cmp;
bgp->peerhash = hash_create(peer_hash_key_make, peer_hash_same, NULL); bgp->peerhash = hash_create(peer_hash_key_make, peer_hash_same, NULL);
@ -6930,14 +6930,12 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
vty_out(vty, vty_out(vty,
" neighbor %s attribute-unchanged%s%s%s\n", " neighbor %s attribute-unchanged%s%s%s\n",
addr, addr,
peer_af_flag_check( peer_af_flag_check(peer, afi, safi,
peer, afi, safi, PEER_FLAG_AS_PATH_UNCHANGED)
PEER_FLAG_AS_PATH_UNCHANGED)
? " as-path" ? " as-path"
: "", : "",
peer_af_flag_check( peer_af_flag_check(peer, afi, safi,
peer, afi, safi, PEER_FLAG_NEXTHOP_UNCHANGED)
PEER_FLAG_NEXTHOP_UNCHANGED)
? " next-hop" ? " next-hop"
: "", : "",
peer_af_flag_check(peer, afi, safi, peer_af_flag_check(peer, afi, safi,

View File

@ -1770,11 +1770,11 @@ int cmd_domainname_set(const char *domainname)
} }
/* Hostname configuration */ /* Hostname configuration */
DEFUN (config_domainname, DEFUN(config_domainname,
domainname_cmd, domainname_cmd,
"domainname WORD", "domainname WORD",
"Set system's domain name\n" "Set system's domain name\n"
"This system's domain name\n") "This system's domain name\n")
{ {
struct cmd_token *word = argv[1]; struct cmd_token *word = argv[1];
@ -1786,12 +1786,12 @@ DEFUN (config_domainname,
return cmd_domainname_set(word->arg); return cmd_domainname_set(word->arg);
} }
DEFUN (config_no_domainname, DEFUN(config_no_domainname,
no_domainname_cmd, no_domainname_cmd,
"no domainname [DOMAINNAME]", "no domainname [DOMAINNAME]",
NO_STR NO_STR
"Reset system's domain name\n" "Reset system's domain name\n"
"domain name of this router\n") "domain name of this router\n")
{ {
return cmd_domainname_set(NULL); return cmd_domainname_set(NULL);
} }

View File

@ -97,8 +97,7 @@ void vty_frame(struct vty *vty, const char *format, ...)
va_start(args, format); va_start(args, format);
vsnprintf(vty->frame + vty->frame_pos, vsnprintf(vty->frame + vty->frame_pos,
sizeof(vty->frame) - vty->frame_pos, sizeof(vty->frame) - vty->frame_pos, format, args);
format, args);
vty->frame_pos = strlen(vty->frame); vty->frame_pos = strlen(vty->frame);
va_end(args); va_end(args);
} }
@ -275,8 +274,7 @@ void vty_hello(struct vty *vty)
static void vty_prompt(struct vty *vty) static void vty_prompt(struct vty *vty)
{ {
if (vty->type == VTY_TERM) { if (vty->type == VTY_TERM) {
vty_out(vty, cmd_prompt(vty->node), vty_out(vty, cmd_prompt(vty->node), cmd_hostname_get());
cmd_hostname_get());
} }
} }

View File

@ -433,7 +433,7 @@ extern int zapi_route_encode(u_char, struct stream *, struct zapi_route *);
extern int zapi_route_decode(struct stream *, struct zapi_route *); extern int zapi_route_decode(struct stream *, struct zapi_route *);
static inline void zapi_route_set_blackhole(struct zapi_route *api, 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->nexthop_num = 1;
api->nexthops[0].type = NEXTHOP_TYPE_BLACKHOLE; api->nexthops[0].type = NEXTHOP_TYPE_BLACKHOLE;

View File

@ -306,12 +306,12 @@ DEFUN (no_router_ospf6,
} }
/* change Router_ID commands. */ /* change Router_ID commands. */
DEFUN (ospf6_router_id, DEFUN(ospf6_router_id,
ospf6_router_id_cmd, ospf6_router_id_cmd,
"ospf6 router-id A.B.C.D", "ospf6 router-id A.B.C.D",
OSPF6_STR OSPF6_STR
"Configure OSPF6 Router-ID\n" "Configure OSPF6 Router-ID\n"
V4NOTATION_STR) V4NOTATION_STR)
{ {
VTY_DECLVAR_CONTEXT(ospf6, o); VTY_DECLVAR_CONTEXT(ospf6, o);
int idx = 0; int idx = 0;
@ -324,8 +324,7 @@ DEFUN (ospf6_router_id,
ret = inet_pton(AF_INET, router_id_str, &router_id); ret = inet_pton(AF_INET, router_id_str, &router_id);
if (ret == 0) { if (ret == 0) {
vty_out(vty, "malformed OSPF Router-ID: %s\n", vty_out(vty, "malformed OSPF Router-ID: %s\n", router_id_str);
router_id_str);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -336,13 +335,12 @@ DEFUN (ospf6_router_id,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (no_ospf6_router_id, DEFUN(no_ospf6_router_id,
no_ospf6_router_id_cmd, no_ospf6_router_id_cmd,
"no ospf6 router-id [A.B.C.D]", "no ospf6 router-id [A.B.C.D]",
NO_STR NO_STR OSPF6_STR
OSPF6_STR "Configure OSPF6 Router-ID\n"
"Configure OSPF6 Router-ID\n" V4NOTATION_STR)
V4NOTATION_STR)
{ {
VTY_DECLVAR_CONTEXT(ospf6, o); VTY_DECLVAR_CONTEXT(ospf6, o);
o->router_id_static = 0; o->router_id_static = 0;

View File

@ -404,10 +404,10 @@ int main(int argc, char **argv, char **env)
"NOT SUPPORTED since its\nresults are inconsistent!\n"); "NOT SUPPORTED since its\nresults are inconsistent!\n");
} }
snprintf(vtysh_config, sizeof(vtysh_config), "%s%s/%s", snprintf(vtysh_config, sizeof(vtysh_config), "%s%s/%s", sysconfdir,
sysconfdir, pathspace, VTYSH_CONFIG_NAME); pathspace, VTYSH_CONFIG_NAME);
snprintf(frr_config, sizeof(frr_config), "%s%s/%s", snprintf(frr_config, sizeof(frr_config), "%s%s/%s", sysconfdir,
sysconfdir, pathspace, FRR_CONFIG_NAME); pathspace, FRR_CONFIG_NAME);
strlcat(vtydir, pathspace, sizeof(vtydir)); strlcat(vtydir, pathspace, sizeof(vtydir));
/* Initialize user input buffer. */ /* Initialize user input buffer. */

View File

@ -208,8 +208,7 @@ void connected_up_ipv4(struct interface *ifp, struct connected *ifc)
{ {
struct prefix p; struct prefix p;
struct nexthop nh = { struct nexthop nh = {
.type = NEXTHOP_TYPE_IFINDEX, .type = NEXTHOP_TYPE_IFINDEX, .ifindex = ifp->ifindex,
.ifindex = ifp->ifindex,
}; };
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL)) if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
@ -340,8 +339,7 @@ void connected_down_ipv4(struct interface *ifp, struct connected *ifc)
{ {
struct prefix p; struct prefix p;
struct nexthop nh = { struct nexthop nh = {
.type = NEXTHOP_TYPE_IFINDEX, .type = NEXTHOP_TYPE_IFINDEX, .ifindex = ifp->ifindex,
.ifindex = ifp->ifindex,
}; };
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL)) if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
@ -432,8 +430,7 @@ void connected_up_ipv6(struct interface *ifp, struct connected *ifc)
{ {
struct prefix p; struct prefix p;
struct nexthop nh = { struct nexthop nh = {
.type = NEXTHOP_TYPE_IFINDEX, .type = NEXTHOP_TYPE_IFINDEX, .ifindex = ifp->ifindex,
.ifindex = ifp->ifindex,
}; };
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL)) if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
@ -516,8 +513,7 @@ void connected_down_ipv6(struct interface *ifp, struct connected *ifc)
{ {
struct prefix p; struct prefix p;
struct nexthop nh = { struct nexthop nh = {
.type = NEXTHOP_TYPE_IFINDEX, .type = NEXTHOP_TYPE_IFINDEX, .ifindex = ifp->ifindex,
.ifindex = ifp->ifindex,
}; };
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL)) if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))

View File

@ -836,8 +836,8 @@ static int netlink_address(int cmd, int family, struct interface *ifp,
if (family == AF_INET) { if (family == AF_INET) {
if (CONNECTED_PEER(ifc)) { if (CONNECTED_PEER(ifc)) {
p = ifc->destination; p = ifc->destination;
addattr_l(&req.n, sizeof req, IFA_ADDRESS, addattr_l(&req.n, sizeof req, IFA_ADDRESS, &p->u.prefix,
&p->u.prefix, bytelen); bytelen);
} else if (cmd == RTM_NEWADDR && ifc->destination) { } else if (cmd == RTM_NEWADDR && ifc->destination) {
p = ifc->destination; p = ifc->destination;
addattr_l(&req.n, sizeof req, IFA_BROADCAST, addattr_l(&req.n, sizeof req, IFA_BROADCAST,
@ -999,9 +999,9 @@ int netlink_interface_addr(struct sockaddr_nl *snl, struct nlmsghdr *h,
*/ */
if (!(ifa->ifa_flags if (!(ifa->ifa_flags
& (IFA_F_DADFAILED | IFA_F_TENTATIVE))) & (IFA_F_DADFAILED | IFA_F_TENTATIVE)))
connected_add_ipv6( connected_add_ipv6(ifp, flags,
ifp, flags, (struct in6_addr *)addr, (struct in6_addr *)addr,
ifa->ifa_prefixlen, label); ifa->ifa_prefixlen, label);
} else } else
connected_delete_ipv6(ifp, (struct in6_addr *)addr, connected_delete_ipv6(ifp, (struct in6_addr *)addr,
ifa->ifa_prefixlen); ifa->ifa_prefixlen);

View File

@ -2559,28 +2559,28 @@ DEFUN (no_ip_address,
NULL, NULL); NULL, NULL);
} }
DEFUN (ip_address_peer, DEFUN(ip_address_peer,
ip_address_peer_cmd, ip_address_peer_cmd,
"ip address A.B.C.D peer A.B.C.D/M", "ip address A.B.C.D peer A.B.C.D/M",
"Interface Internet Protocol config commands\n" "Interface Internet Protocol config commands\n"
"Set the IP address of an interface\n" "Set the IP address of an interface\n"
"Local IP (e.g. 10.0.0.1) for P-t-P address\n" "Local IP (e.g. 10.0.0.1) for P-t-P address\n"
"Specify P-t-P address\n" "Specify P-t-P address\n"
"Peer IP address (e.g. 10.0.0.1/8)\n") "Peer IP address (e.g. 10.0.0.1/8)\n")
{ {
VTY_DECLVAR_CONTEXT(interface, ifp); VTY_DECLVAR_CONTEXT(interface, ifp);
return ip_address_install(vty, ifp, argv[2]->arg, argv[4]->arg, NULL); return ip_address_install(vty, ifp, argv[2]->arg, argv[4]->arg, NULL);
} }
DEFUN (no_ip_address_peer, DEFUN(no_ip_address_peer,
no_ip_address_peer_cmd, no_ip_address_peer_cmd,
"no ip address A.B.C.D peer A.B.C.D/M", "no ip address A.B.C.D peer A.B.C.D/M",
NO_STR NO_STR
"Interface Internet Protocol config commands\n" "Interface Internet Protocol config commands\n"
"Set the IP address of an interface\n" "Set the IP address of an interface\n"
"Local IP (e.g. 10.0.0.1) for P-t-P address\n" "Local IP (e.g. 10.0.0.1) for P-t-P address\n"
"Specify P-t-P address\n" "Specify P-t-P address\n"
"Peer IP address (e.g. 10.0.0.1/8)\n") "Peer IP address (e.g. 10.0.0.1/8)\n")
{ {
VTY_DECLVAR_CONTEXT(interface, ifp); VTY_DECLVAR_CONTEXT(interface, ifp);
return ip_address_uninstall(vty, ifp, argv[3]->arg, argv[5]->arg, NULL); return ip_address_uninstall(vty, ifp, argv[3]->arg, argv[5]->arg, NULL);
@ -2888,16 +2888,16 @@ static int if_config_write(struct vty *vty)
p = ifc->address; p = ifc->address;
vty_out(vty, " ip%s address %s", vty_out(vty, " ip%s address %s",
p->family == AF_INET ? "" : "v6", p->family == AF_INET ? "" : "v6",
inet_ntop(p->family, &p->u.prefix, inet_ntop(p->family, &p->u.prefix, buf,
buf, sizeof(buf))); sizeof(buf)));
if (CONNECTED_PEER (ifc)) { if (CONNECTED_PEER(ifc)) {
p = ifc->destination; p = ifc->destination;
vty_out(vty, " peer %s", vty_out(vty, " peer %s",
inet_ntop(p->family, inet_ntop(p->family,
&p->u.prefix, &p->u.prefix, buf,
buf, sizeof(buf))); sizeof(buf)));
} }
vty_out (vty, "/%d", p->prefixlen); vty_out(vty, "/%d", p->prefixlen);
if (ifc->label) if (ifc->label)
vty_out(vty, " label %s", ifc->label); vty_out(vty, " label %s", ifc->label);

View File

@ -1041,8 +1041,8 @@ void rtm_read(struct rt_msghdr *rtm)
*/ */
if (rtm->rtm_type == RTM_CHANGE) if (rtm->rtm_type == RTM_CHANGE)
rib_delete(AFI_IP, SAFI_UNICAST, VRF_DEFAULT, rib_delete(AFI_IP, SAFI_UNICAST, VRF_DEFAULT,
ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p, ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p, NULL,
NULL, NULL, 0, 0); NULL, 0, 0);
if (!nh.type) { if (!nh.type) {
nh.type = NEXTHOP_TYPE_IPV4; nh.type = NEXTHOP_TYPE_IPV4;
@ -1087,8 +1087,8 @@ void rtm_read(struct rt_msghdr *rtm)
*/ */
if (rtm->rtm_type == RTM_CHANGE) if (rtm->rtm_type == RTM_CHANGE)
rib_delete(AFI_IP6, SAFI_UNICAST, VRF_DEFAULT, rib_delete(AFI_IP6, SAFI_UNICAST, VRF_DEFAULT,
ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p, ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p, NULL,
NULL, NULL, 0, 0); NULL, 0, 0);
if (!nh.type) { if (!nh.type) {
nh.type = ifindex ? NEXTHOP_TYPE_IPV6_IFINDEX nh.type = ifindex ? NEXTHOP_TYPE_IPV6_IFINDEX

View File

@ -530,8 +530,8 @@ int zebra_add_import_table_entry(struct route_node *rn, struct route_entry *re,
rib_add(AFI_IP, SAFI_UNICAST, re->vrf_id, rib_add(AFI_IP, SAFI_UNICAST, re->vrf_id,
ZEBRA_ROUTE_TABLE, re->table, 0, &p, ZEBRA_ROUTE_TABLE, re->table, 0, &p,
NULL, re->nexthop, NULL, re->nexthop,
zebrad.rtm_table_default, zebrad.rtm_table_default, re->metric,
re->metric, re->mtu, re->mtu,
zebra_import_table_distance[AFI_IP] zebra_import_table_distance[AFI_IP]
[re->table]); [re->table]);
} else if (re->nexthop_num > 1) { } else if (re->nexthop_num > 1) {

View File

@ -388,12 +388,11 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl,
nh.type = NEXTHOP_TYPE_IFINDEX; nh.type = NEXTHOP_TYPE_IFINDEX;
else if (index && gate) else if (index && gate)
nh.type = (afi == AFI_IP) nh.type = (afi == AFI_IP)
? NEXTHOP_TYPE_IPV4_IFINDEX ? NEXTHOP_TYPE_IPV4_IFINDEX
: NEXTHOP_TYPE_IPV6_IFINDEX; : NEXTHOP_TYPE_IPV6_IFINDEX;
else if (!index && gate) else if (!index && gate)
nh.type = (afi == AFI_IP) nh.type = (afi == AFI_IP) ? NEXTHOP_TYPE_IPV4
? NEXTHOP_TYPE_IPV4 : NEXTHOP_TYPE_IPV6;
: NEXTHOP_TYPE_IPV6;
else { else {
nh.type = NEXTHOP_TYPE_BLACKHOLE; nh.type = NEXTHOP_TYPE_BLACKHOLE;
nh.bh_type = bh_type; nh.bh_type = bh_type;
@ -489,12 +488,11 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl,
nh.type = NEXTHOP_TYPE_IFINDEX; nh.type = NEXTHOP_TYPE_IFINDEX;
else if (index && gate) else if (index && gate)
nh.type = (afi == AFI_IP) nh.type = (afi == AFI_IP)
? NEXTHOP_TYPE_IPV4_IFINDEX ? NEXTHOP_TYPE_IPV4_IFINDEX
: NEXTHOP_TYPE_IPV6_IFINDEX; : NEXTHOP_TYPE_IPV6_IFINDEX;
else if (!index && gate) else if (!index && gate)
nh.type = (afi == AFI_IP) nh.type = (afi == AFI_IP) ? NEXTHOP_TYPE_IPV4
? NEXTHOP_TYPE_IPV4 : NEXTHOP_TYPE_IPV6;
: NEXTHOP_TYPE_IPV6;
else else
nh.type = NEXTHOP_TYPE_BLACKHOLE; nh.type = NEXTHOP_TYPE_BLACKHOLE;
nh.ifindex = index; nh.ifindex = index;
@ -507,8 +505,8 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl,
/* XXX: need to compare the entire list of nexthops /* XXX: need to compare the entire list of nexthops
* here for NLM_F_APPEND stupidity */ * here for NLM_F_APPEND stupidity */
rib_delete(afi, SAFI_UNICAST, vrf_id, rib_delete(afi, SAFI_UNICAST, vrf_id,
ZEBRA_ROUTE_KERNEL, 0, flags, &p, NULL, ZEBRA_ROUTE_KERNEL, 0, flags, &p, NULL, NULL,
NULL, table, metric); table, metric);
} }
} }

View File

@ -175,11 +175,11 @@ static int kernel_rtm_ipv4(int cmd, struct prefix *p, struct route_entry *re)
smplsp = (union sockunion *)&smpls; smplsp = (union sockunion *)&smpls;
#endif #endif
error = rtm_write( error = rtm_write(cmd, (union sockunion *)&sin_dest,
cmd, (union sockunion *)&sin_dest, (union sockunion *)mask,
(union sockunion *)mask, gate ? (union sockunion *)&sin_gate
gate ? (union sockunion *)&sin_gate : NULL, : NULL,
smplsp, ifindex, bh_type, re->metric); smplsp, ifindex, bh_type, re->metric);
if (IS_ZEBRA_DEBUG_RIB) { if (IS_ZEBRA_DEBUG_RIB) {
if (!gate) { if (!gate) {

View File

@ -292,7 +292,7 @@ struct nexthop *route_entry_nexthop_ipv6_ifindex_add(struct route_entry *re,
} }
struct nexthop *route_entry_nexthop_blackhole_add(struct route_entry *re, struct nexthop *route_entry_nexthop_blackhole_add(struct route_entry *re,
enum blackhole_type bh_type) enum blackhole_type bh_type)
{ {
struct nexthop *nexthop; struct nexthop *nexthop;
@ -2394,8 +2394,8 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
"via %s ifindex %d type %d " "via %s ifindex %d type %d "
"doesn't exist in rib", "doesn't exist in rib",
inet_ntop( inet_ntop(
family2afi(afi), &nh->gate, family2afi(afi),
buf2, &nh->gate, buf2,
INET_ADDRSTRLEN), /* FIXME INET_ADDRSTRLEN), /* FIXME
*/ */
nh->ifindex, type); nh->ifindex, type);

View File

@ -91,8 +91,8 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p,
si->ifindex); si->ifindex);
break; break;
case STATIC_BLACKHOLE: case STATIC_BLACKHOLE:
nexthop = route_entry_nexthop_blackhole_add(re, nexthop = route_entry_nexthop_blackhole_add(
si->bh_type); re, si->bh_type);
break; break;
case STATIC_IPV6_GATEWAY: case STATIC_IPV6_GATEWAY:
nexthop = route_entry_nexthop_ipv6_add(re, nexthop = route_entry_nexthop_ipv6_add(re,
@ -167,8 +167,8 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p,
si->ifindex); si->ifindex);
break; break;
case STATIC_BLACKHOLE: case STATIC_BLACKHOLE:
nexthop = route_entry_nexthop_blackhole_add(re, nexthop = route_entry_nexthop_blackhole_add(
si->bh_type); re, si->bh_type);
break; break;
case STATIC_IPV6_GATEWAY: case STATIC_IPV6_GATEWAY:
nexthop = route_entry_nexthop_ipv6_add(re, nexthop = route_entry_nexthop_ipv6_add(re,

View File

@ -211,7 +211,7 @@ static int zebra_static_route(struct vty *vty, afi_t afi, safi_t safi,
if (!negate) if (!negate)
static_add_route(afi, safi, type, &p, src_p, gatep, ifname, 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 else
static_delete_route(afi, safi, type, &p, src_p, gatep, ifname, static_delete_route(afi, safi, type, &p, src_p, gatep, ifname,
tag, distance, zvrf, &snh_label); tag, distance, zvrf, &snh_label);
@ -330,9 +330,8 @@ DEFUN (show_ip_rpf_addr,
} }
/* Static route configuration. */ /* Static route configuration. */
DEFPY (ip_route, DEFPY(ip_route, ip_route_cmd,
ip_route_cmd, "[no] ip route\
"[no] ip route\
<A.B.C.D/M$prefix|A.B.C.D$prefix A.B.C.D$mask>\ <A.B.C.D/M$prefix|A.B.C.D$prefix A.B.C.D$mask>\
<\ <\
{A.B.C.D$gate|INTERFACE$ifname}\ {A.B.C.D$gate|INTERFACE$ifname}\
@ -344,22 +343,21 @@ DEFPY (ip_route,
|vrf NAME\ |vrf NAME\
|label WORD\ |label WORD\
}]", }]",
NO_STR NO_STR IP_STR
IP_STR "Establish static routes\n"
"Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n" "IP destination prefix\n"
"IP destination prefix\n" "IP destination prefix mask\n"
"IP destination prefix mask\n" "IP gateway address\n"
"IP gateway address\n" "IP gateway interface name\n"
"IP gateway interface name\n" "Null interface\n"
"Null interface\n" "Emit an ICMP unreachable when matched\n"
"Emit an ICMP unreachable when matched\n" "Silently discard pkts when matched\n"
"Silently discard pkts when matched\n" "Set tag for this route\n"
"Set tag for this route\n" "Tag value\n"
"Tag value\n" "Distance value for this route\n"
"Distance value for this route\n" VRF_CMD_HELP_STR
VRF_CMD_HELP_STR MPLS_LABEL_HELPSTR)
MPLS_LABEL_HELPSTR)
{ {
return zebra_static_route(vty, AFI_IP, SAFI_UNICAST, no, prefix, return zebra_static_route(vty, AFI_IP, SAFI_UNICAST, no, prefix,
mask_str, NULL, gate_str, ifname, flag, mask_str, NULL, gate_str, ifname, flag,
@ -476,7 +474,8 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
vty_out(vty, " (ICMP unreachable)"); vty_out(vty, " (ICMP unreachable)");
break; break;
case BLACKHOLE_ADMINPROHIB: case BLACKHOLE_ADMINPROHIB:
vty_out(vty, " (ICMP admin-prohibited)"); vty_out(vty,
" (ICMP admin-prohibited)");
break; break;
case BLACKHOLE_NULL: case BLACKHOLE_NULL:
vty_out(vty, " (blackhole)"); vty_out(vty, " (blackhole)");
@ -667,18 +666,16 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
switch (nexthop->bh_type) { switch (nexthop->bh_type) {
case BLACKHOLE_REJECT: case BLACKHOLE_REJECT:
json_object_boolean_true_add( json_object_boolean_true_add(
json_nexthop, json_nexthop, "reject");
"reject");
break; break;
case BLACKHOLE_ADMINPROHIB: case BLACKHOLE_ADMINPROHIB:
json_object_boolean_true_add( json_object_boolean_true_add(
json_nexthop, json_nexthop,
"admin-prohibited"); "admin-prohibited");
break; break;
case BLACKHOLE_NULL: case BLACKHOLE_NULL:
json_object_boolean_true_add( json_object_boolean_true_add(
json_nexthop, json_nexthop, "blackhole");
"blackhole");
break; break;
case BLACKHOLE_UNSPEC: case BLACKHOLE_UNSPEC:
break; break;
@ -1767,9 +1764,9 @@ static int static_config(struct vty *vty, afi_t afi, safi_t safi,
return write; return write;
} }
DEFPY (ipv6_route, DEFPY(ipv6_route,
ipv6_route_cmd, ipv6_route_cmd,
"[no] ipv6 route X:X::X:X/M$prefix [from X:X::X:X/M]\ "[no] ipv6 route X:X::X:X/M$prefix [from X:X::X:X/M]\
<\ <\
{X:X::X:X$gate|INTERFACE$ifname}\ {X:X::X:X$gate|INTERFACE$ifname}\
|<null0|reject|blackhole>$flag\ |<null0|reject|blackhole>$flag\
@ -1780,22 +1777,22 @@ DEFPY (ipv6_route,
|vrf NAME\ |vrf NAME\
|label WORD\ |label WORD\
}]", }]",
NO_STR NO_STR
IPV6_STR IPV6_STR
"Establish static routes\n" "Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 source-dest route\n" "IPv6 source-dest route\n"
"IPv6 source prefix\n" "IPv6 source prefix\n"
"IPv6 gateway address\n" "IPv6 gateway address\n"
"IPv6 gateway interface name\n" "IPv6 gateway interface name\n"
"Null interface\n" "Null interface\n"
"Emit an ICMP unreachable when matched\n" "Emit an ICMP unreachable when matched\n"
"Silently discard pkts when matched\n" "Silently discard pkts when matched\n"
"Set tag for this route\n" "Set tag for this route\n"
"Tag value\n" "Tag value\n"
"Distance value for this prefix\n" "Distance value for this prefix\n"
VRF_CMD_HELP_STR VRF_CMD_HELP_STR
MPLS_LABEL_HELPSTR) MPLS_LABEL_HELPSTR)
{ {
return zebra_static_route(vty, AFI_IP6, SAFI_UNICAST, no, prefix_str, return zebra_static_route(vty, AFI_IP6, SAFI_UNICAST, no, prefix_str,
NULL, from_str, gate_str, ifname, flag, NULL, from_str, gate_str, ifname, flag,

View File

@ -1969,8 +1969,8 @@ static void zvni_install_mac_hash(struct hash_backet *backet, void *ctxt)
static void zvni_deref_ip2mac(zebra_vni_t *zvni, zebra_mac_t *mac, static void zvni_deref_ip2mac(zebra_vni_t *zvni, zebra_mac_t *mac,
int uninstall) int uninstall)
{ {
if (!CHECK_FLAG(mac->flags, ZEBRA_MAC_AUTO) || if (!CHECK_FLAG(mac->flags, ZEBRA_MAC_AUTO)
!list_isempty(mac->neigh_list)) || !list_isempty(mac->neigh_list))
return; return;
if (uninstall) if (uninstall)
@ -2965,13 +2965,11 @@ int zebra_vxlan_local_neigh_add_update(struct interface *ifp,
* as this means a different MACIP route. * as this means a different MACIP route.
* Also, need to do some unlinking/relinking. * Also, need to do some unlinking/relinking.
*/ */
zvni_neigh_send_del_to_client(zvrf, zvni->vni, zvni_neigh_send_del_to_client(zvrf, zvni->vni, &n->ip,
&n->ip, &n->emac, &n->emac, 0);
0);
old_zmac = zvni_mac_lookup(zvni, &n->emac); old_zmac = zvni_mac_lookup(zvni, &n->emac);
if (old_zmac) { if (old_zmac) {
listnode_delete(old_zmac->neigh_list, listnode_delete(old_zmac->neigh_list, n);
n);
zvni_deref_ip2mac(zvni, old_zmac, 0); zvni_deref_ip2mac(zvni, old_zmac, 0);
} }
@ -3026,15 +3024,13 @@ int zebra_vxlan_local_neigh_add_update(struct interface *ifp,
/* Inform BGP. */ /* Inform BGP. */
if (IS_ZEBRA_DEBUG_VXLAN) if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug( zlog_debug("%u: neigh %s (MAC %s) is now ACTIVE on VNI %u",
"%u: neigh %s (MAC %s) is now ACTIVE on VNI %u", ifp->vrf_id, ipaddr2str(ip, buf2, sizeof(buf2)),
ifp->vrf_id, ipaddr2str(ip, buf2, sizeof(buf2)), prefix_mac2str(macaddr, buf, sizeof(buf)),
prefix_mac2str(macaddr, buf, sizeof(buf)), zvni->vni);
zvni->vni);
ZEBRA_NEIGH_SET_ACTIVE(n); ZEBRA_NEIGH_SET_ACTIVE(n);
return zvni_neigh_send_add_to_client(zvrf, zvni->vni, ip, return zvni_neigh_send_add_to_client(zvrf, zvni->vni, ip, macaddr, 0);
macaddr, 0);
} }
@ -3751,8 +3747,9 @@ int zebra_vxlan_remote_vtep_del(struct zserv *client, int sock, u_short length,
ifp = zvni->vxlan_if; ifp = zvni->vxlan_if;
if (!ifp) { if (!ifp) {
zlog_err("VNI %u hash %p doesn't have intf upon remote VTEP DEL", zlog_err(
zvni->vni, zvni); "VNI %u hash %p doesn't have intf upon remote VTEP DEL",
zvni->vni, zvni);
continue; continue;
} }
zif = ifp->info; zif = ifp->info;
@ -3910,9 +3907,8 @@ int zebra_vxlan_add_del_gw_macip(struct interface *ifp, struct prefix *p,
svi_if_zif = svi_if->info; svi_if_zif = svi_if->info;
if (svi_if_zif) { if (svi_if_zif) {
svi_if_link = if_lookup_by_index_per_ns( svi_if_link = if_lookup_by_index_per_ns(
zebra_ns_lookup( zebra_ns_lookup(NS_DEFAULT),
NS_DEFAULT), svi_if_zif->link_ifindex);
svi_if_zif->link_ifindex);
zvni = zvni_map_svi(svi_if, svi_if_link); zvni = zvni_map_svi(svi_if, svi_if_link);
} }
} else if (IS_ZEBRA_IF_BRIDGE(svi_if)) { } else if (IS_ZEBRA_IF_BRIDGE(svi_if)) {
@ -3929,9 +3925,8 @@ int zebra_vxlan_add_del_gw_macip(struct interface *ifp, struct prefix *p,
NULL; /* link info for the SVI = bridge info */ NULL; /* link info for the SVI = bridge info */
svi_if_zif = ifp->info; svi_if_zif = ifp->info;
svi_if_link = svi_if_link = if_lookup_by_index_per_ns(
if_lookup_by_index_per_ns(zebra_ns_lookup(NS_DEFAULT), zebra_ns_lookup(NS_DEFAULT), svi_if_zif->link_ifindex);
svi_if_zif->link_ifindex);
if (svi_if_zif && svi_if_link) if (svi_if_zif && svi_if_link)
zvni = zvni_map_svi(ifp, svi_if_link); zvni = zvni_map_svi(ifp, svi_if_link);
} else if (IS_ZEBRA_IF_BRIDGE(ifp)) { } else if (IS_ZEBRA_IF_BRIDGE(ifp)) {

View File

@ -1094,8 +1094,8 @@ static int zread_route_add(struct zserv *client, u_short length,
api_nh->ifindex); api_nh->ifindex);
break; break;
case NEXTHOP_TYPE_BLACKHOLE: case NEXTHOP_TYPE_BLACKHOLE:
route_entry_nexthop_blackhole_add(re, route_entry_nexthop_blackhole_add(
api_nh->bh_type); re, api_nh->bh_type);
break; break;
} }