*: 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 (install)
ret = install_evpn_route_entry(
bgp, vpn, evp, ri);
bgp, vpn, evp, ri);
else
ret = uninstall_evpn_route_entry(
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))
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];
@ -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",
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);
}
}
}
}
@ -2851,7 +2846,6 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
bgp->vrf_id, vni);
return -1;
}
}
/* if the VNI is live already, there is nothing more to do */

View File

@ -28,7 +28,7 @@
#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

View File

@ -38,7 +38,7 @@
#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.
@ -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_buf, json_rt);
}
}
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;
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) {
@ -624,8 +620,7 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
json_ocode);
}
} else {
if (option
== SHOW_DISPLAY_TAGS)
if (option == SHOW_DISPLAY_TAGS)
vty_out(vty,
V4_HEADER_TAG);
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");
vty_out(vty,
"Origin codes: i - IGP, e - EGP, ? - incomplete\n\n");
vty_out(vty,
V4_HEADER);
vty_out(vty, V4_HEADER);
}
}
header = 0;
@ -669,14 +663,11 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
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);
@ -692,16 +683,13 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
"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);
@ -1496,8 +1484,7 @@ static void evpn_show_import_rts(struct vty *vty, struct bgp *bgp,
* 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;
@ -2357,7 +2344,8 @@ DEFUN(show_bgp_l2vpn_evpn_summary,
/*
* 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
@ -2409,7 +2397,8 @@ DEFUN(show_bgp_l2vpn_evpn_route, show_bgp_l2vpn_evpn_route_cmd,
/*
* 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
@ -2754,7 +2743,8 @@ DEFUN(show_bgp_l2vpn_evpn_route_vni_multicast,
/*
* 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
@ -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
*/
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

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)
{
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)

View File

@ -2205,7 +2205,8 @@ static wq_item_status bgp_process_wq(struct work_queue *wq, void *data)
/* 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;
}
@ -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);
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++;
@ -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
* 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);
@ -3401,9 +3403,9 @@ static void bgp_soft_reconfig_table(struct peer *peer, afi_t afi, safi_t 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,
@ -4572,19 +4574,16 @@ void bgp_static_add(struct bgp *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);
}
}
}
@ -4612,15 +4611,13 @@ void bgp_static_delete(struct bgp *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_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;
@ -4628,8 +4625,8 @@ void bgp_static_delete(struct bgp *bgp)
}
} 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);
@ -4660,20 +4657,18 @@ void bgp_static_redo_import_check(struct bgp *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 = 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);
@ -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,
safi_t safi)
safi_t safi)
{
if (bgp->table_map[afi][safi].name) {
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. */
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
@ -5752,8 +5747,7 @@ static void bgp_aggregate_add(struct bgp *bgp, struct prefix *p, afi_t afi,
ri->attr->community);
community = community_uniq_sort(
commerge);
community_free(
commerge);
community_free(commerge);
} else
community = community_dup(
ri->attr->community);
@ -5827,8 +5821,8 @@ void bgp_aggregate_delete(struct bgp *bgp, struct prefix *p, afi_t afi,
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++;
}
}
@ -6307,21 +6301,22 @@ static void route_vty_out_route(struct prefix *p, struct vty *vty,
} 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) {
@ -8425,9 +8420,9 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
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)
@ -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) {
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;
}
@ -8618,7 +8614,7 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp,
&& (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);
@ -10015,8 +10011,7 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
if (header1) {
if (use_json) {
json_object_int_add(
json,
"bgpTableVersion",
json, "bgpTableVersion",
0);
json_object_string_add(
json,
@ -10024,12 +10019,10 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
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,
@ -10051,11 +10044,13 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
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++;
@ -10875,11 +10870,11 @@ static int bgp_clear_damp_route(struct vty *vty, const char *view_name,
|| 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;
@ -10999,8 +10994,7 @@ static void bgp_config_write_network_vpn(struct vty *vty, struct bgp *bgp,
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;
@ -11049,8 +11043,7 @@ static void bgp_config_write_network_evpn(struct vty *vty, struct bgp *bgp,
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;
@ -11074,8 +11067,8 @@ static void bgp_config_write_network_evpn(struct vty *vty, struct bgp *bgp,
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)
@ -11116,8 +11109,7 @@ void bgp_config_write_network(struct vty *vty, struct bgp *bgp, afi_t afi,
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;
@ -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,
safi_t safi)
safi_t safi)
{
struct bgp_node *rn;
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.
*/
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);

View File

@ -1498,7 +1498,7 @@ ALIAS_HIDDEN(no_bgp_maxpaths_ibgp, no_bgp_maxpaths_ibgp_hidden_cmd,
"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",
@ -6414,21 +6414,19 @@ DEFUN (show_bgp_vrfs,
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);
}
@ -6445,13 +6443,13 @@ static void bgp_show_martian_nexthops(struct vty *vty, struct bgp *bgp)
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;
@ -6671,19 +6669,16 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
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
@ -6693,16 +6688,15 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
} 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
@ -6712,8 +6706,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
"updateDelayEstablishWait",
bgp->v_establish_wait);
if (bgp_update_delay_active(
bgp)) {
if (bgp_update_delay_active(bgp)) {
json_object_string_add(
json,
"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",
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);
@ -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)
&& 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
@ -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],
BGP_CONFIG_DAMPENING))
json_object_boolean_true_add(
json,
"dampeningEnabled");
json, "dampeningEnabled");
} else {
if (bgp_maxmed_onstartup_configured(bgp)
&& 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,
"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,
@ -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],
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");
}
@ -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();
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);
@ -6972,57 +6935,45 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
}
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");
}
@ -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 (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
@ -8632,43 +8583,38 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json,
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 */
@ -9004,17 +8950,18 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json,
}
/* 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");
@ -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)) {
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");
}
@ -11146,7 +11093,7 @@ DEFUN (no_bgp_redistribute_ipv6,
}
void bgp_config_write_redistribute(struct vty *vty, struct bgp *bgp, afi_t afi,
safi_t safi)
safi_t safi)
{
int i;

View File

@ -2821,16 +2821,16 @@ static struct bgp *bgp_create(as_t *as, const char *name,
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);
@ -6930,14 +6930,12 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
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,

View File

@ -1770,11 +1770,11 @@ int cmd_domainname_set(const char *domainname)
}
/* 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];
@ -1786,12 +1786,12 @@ DEFUN (config_domainname,
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);
}

View File

@ -97,8 +97,7 @@ void vty_frame(struct vty *vty, const char *format, ...)
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);
}
@ -275,8 +274,7 @@ void vty_hello(struct vty *vty)
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());
}
}

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 *);
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;

View File

@ -306,12 +306,12 @@ DEFUN (no_router_ospf6,
}
/* 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;
@ -324,8 +324,7 @@ DEFUN (ospf6_router_id,
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;
}
@ -336,13 +335,12 @@ DEFUN (ospf6_router_id,
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;

View File

@ -404,10 +404,10 @@ int main(int argc, char **argv, char **env)
"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. */

View File

@ -208,8 +208,7 @@ void connected_up_ipv4(struct interface *ifp, struct connected *ifc)
{
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))
@ -340,8 +339,7 @@ void connected_down_ipv4(struct interface *ifp, struct connected *ifc)
{
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))
@ -432,8 +430,7 @@ void connected_up_ipv6(struct interface *ifp, struct connected *ifc)
{
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))
@ -516,8 +513,7 @@ void connected_down_ipv6(struct interface *ifp, struct connected *ifc)
{
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))

View File

@ -836,8 +836,8 @@ static int netlink_address(int cmd, int family, struct interface *ifp,
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,
@ -999,9 +999,9 @@ int netlink_interface_addr(struct sockaddr_nl *snl, struct nlmsghdr *h,
*/
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);

View File

@ -2559,28 +2559,28 @@ DEFUN (no_ip_address,
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);
@ -2888,16 +2888,16 @@ static int if_config_write(struct vty *vty)
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);

View File

@ -1041,8 +1041,8 @@ void rtm_read(struct rt_msghdr *rtm)
*/
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;
@ -1087,8 +1087,8 @@ void rtm_read(struct rt_msghdr *rtm)
*/
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

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,
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) {

View File

@ -388,12 +388,11 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl,
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;
@ -489,12 +488,11 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl,
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;
@ -507,8 +505,8 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl,
/* 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);
}
}

View File

@ -175,11 +175,11 @@ static int kernel_rtm_ipv4(int cmd, struct prefix *p, struct route_entry *re)
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) {

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,
enum blackhole_type bh_type)
enum blackhole_type bh_type)
{
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 "
"doesn't exist in rib",
inet_ntop(
family2afi(afi), &nh->gate,
buf2,
family2afi(afi),
&nh->gate, buf2,
INET_ADDRSTRLEN), /* FIXME
*/
nh->ifindex, type);

View File

@ -91,8 +91,8 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p,
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,
@ -167,8 +167,8 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p,
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,

View File

@ -211,7 +211,7 @@ static int zebra_static_route(struct vty *vty, afi_t afi, safi_t safi,
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);
@ -330,9 +330,8 @@ DEFUN (show_ip_rpf_addr,
}
/* 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}\
@ -344,22 +343,21 @@ DEFPY (ip_route,
|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,
@ -476,7 +474,8 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
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)");
@ -667,18 +666,16 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
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;
@ -1767,9 +1764,9 @@ static int static_config(struct vty *vty, afi_t afi, safi_t safi,
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\
@ -1780,22 +1777,22 @@ DEFPY (ipv6_route,
|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,

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,
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)
@ -2965,13 +2965,11 @@ int zebra_vxlan_local_neigh_add_update(struct interface *ifp,
* 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);
}
@ -3026,15 +3024,13 @@ int zebra_vxlan_local_neigh_add_update(struct interface *ifp,
/* 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);
}
@ -3751,8 +3747,9 @@ int zebra_vxlan_remote_vtep_del(struct zserv *client, int sock, u_short length,
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;
@ -3910,9 +3907,8 @@ int zebra_vxlan_add_del_gw_macip(struct interface *ifp, struct prefix *p,
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)) {
@ -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 */
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)) {

View File

@ -1094,8 +1094,8 @@ static int zread_route_add(struct zserv *client, u_short length,
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;
}