summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfdd/bfdd.c4
-rw-r--r--bgpd/bgp_evpn_vty.c27
-rw-r--r--bgpd/bgp_fsm.c19
-rw-r--r--bgpd/bgp_mplsvpn.c8
-rw-r--r--bgpd/bgp_nexthop.c48
-rw-r--r--bgpd/bgp_nexthop.h5
-rw-r--r--bgpd/bgp_nht.c31
-rw-r--r--bgpd/bgp_nht.h5
-rw-r--r--bgpd/bgp_packet.c1
-rw-r--r--bgpd/bgp_pbr.c13
-rw-r--r--bgpd/bgp_route.c75
-rw-r--r--bgpd/bgp_route.h2
-rw-r--r--bgpd/bgp_updgrp.c3
-rw-r--r--bgpd/bgp_updgrp.h6
-rw-r--r--bgpd/bgp_updgrp_packet.c37
-rw-r--r--bgpd/bgp_vty.c130
-rw-r--r--bgpd/bgp_vty.h9
-rw-r--r--bgpd/bgpd.c5
-rw-r--r--bgpd/rfapi/rfapi.c17
-rw-r--r--bgpd/rfapi/rfapi_private.h3
-rwxr-xr-xconfigure.ac2
-rw-r--r--doc/developer/topotests-markers.rst2
-rw-r--r--doc/user/bgp.rst27
-rw-r--r--doc/user/nhrpd.rst13
-rw-r--r--doc/user/setup.rst50
-rw-r--r--eigrpd/eigrp_filter.c63
-rw-r--r--isisd/isis_bpf.c6
-rw-r--r--isisd/isis_dlpi.c5
-rw-r--r--lib/buffer.c10
-rw-r--r--lib/if.c142
-rw-r--r--lib/link_state.c6
-rw-r--r--lib/printf/printf-pos.c4
-rw-r--r--lib/printf/vfprintf.c6
-rwxr-xr-xlib/route_types.pl2
-rw-r--r--lib/thread.c6
-rw-r--r--lib/vty.c21
-rw-r--r--lib/workqueue.c5
-rw-r--r--ospf6d/ospf6_abr.c13
-rw-r--r--ospf6d/ospf6_flood.c12
-rw-r--r--ospf6d/ospf6_top.c93
-rw-r--r--ospfd/ospf_ase.c78
-rw-r--r--ospfd/ospf_lsa.c26
-rw-r--r--ospfd/ospf_snmp.c23
-rw-r--r--ospfd/ospf_spf.c62
-rw-r--r--ospfd/ospf_vty.c103
-rw-r--r--ospfd/ospfd.c49
-rw-r--r--ospfd/ospfd.h2
-rw-r--r--pbrd/pbr_nht.c7
-rw-r--r--pimd/pim_hello.c16
-rw-r--r--pimd/test_igmpv3_join.c5
-rw-r--r--ripd/rip_interface.c33
-rw-r--r--ripd/rip_snmp.c11
-rw-r--r--ripd/ripd.c17
-rw-r--r--ripngd/ripngd.c140
-rw-r--r--ripngd/ripngd.h36
-rw-r--r--tests/topotests/all-protocol-startup/r1/ip_nht.ref12
-rw-r--r--tests/topotests/all-protocol-startup/test_all_protocol_startup.py52
-rw-r--r--tests/topotests/lib/snmptest.py5
-rw-r--r--tests/topotests/pytest.ini2
-rw-r--r--zebra/rt_netlink.c7
-rw-r--r--zebra/zebra_nhg.c4
-rw-r--r--zebra/zebra_rib.c8
62 files changed, 389 insertions, 1245 deletions
diff --git a/bfdd/bfdd.c b/bfdd/bfdd.c
index b8a059708f..0cac990108 100644
--- a/bfdd/bfdd.c
+++ b/bfdd/bfdd.c
@@ -371,10 +371,6 @@ int main(int argc, char *argv[])
snprintf(ctl_path, sizeof(ctl_path), BFDD_CONTROL_SOCKET,
"/", bfdd_di.pathspace);
-#if 0 /* TODO add support for JSON configuration files. */
- parse_config(conf);
-#endif
-
/* Initialize FRR infrastructure. */
master = frr_init();
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index 4dc670a24d..5b0b3bb6e5 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -4100,7 +4100,7 @@ DEFPY(show_bgp_l2vpn_evpn_es_vrf, show_bgp_l2vpn_evpn_es_vrf_cmd,
*/
DEFUN(show_bgp_l2vpn_evpn_summary,
show_bgp_l2vpn_evpn_summary_cmd,
- "show bgp [vrf VRFNAME] l2vpn evpn summary [established|failed] [json]",
+ "show bgp [vrf VRFNAME] l2vpn evpn summary [established|failed] [wide] [json]",
SHOW_STR
BGP_STR
"bgp vrf\n"
@@ -4110,23 +4110,30 @@ DEFUN(show_bgp_l2vpn_evpn_summary,
"Summary of BGP neighbor status\n"
"Show only sessions in Established state\n"
"Show only sessions not in Established state\n"
+ "Increase table width for longer output\n"
JSON_STR)
{
int idx_vrf = 0;
- bool uj = use_json(argc, argv);
+ int idx = 0;
char *vrf = NULL;
- bool show_failed = false;
- bool show_established = false;
+ uint8_t show_flags = 0;
if (argv_find(argv, argc, "vrf", &idx_vrf))
vrf = argv[++idx_vrf]->arg;
- if (argv_find(argv, argc, "failed", &idx_vrf))
- show_failed = true;
- if (argv_find(argv, argc, "established", &idx_vrf))
- show_established = true;
- return bgp_show_summary_vty(vty, vrf, AFI_L2VPN, SAFI_EVPN, show_failed,
- show_established, uj);
+ if (argv_find(argv, argc, "failed", &idx))
+ SET_FLAG(show_flags, BGP_SHOW_OPT_FAILED);
+
+ if (argv_find(argv, argc, "established", &idx))
+ SET_FLAG(show_flags, BGP_SHOW_OPT_ESTABLISHED);
+
+ if (argv_find(argv, argc, "wide", &idx))
+ SET_FLAG(show_flags, BGP_SHOW_OPT_WIDE);
+
+ if (use_json(argc, argv))
+ SET_FLAG(show_flags, BGP_SHOW_OPT_JSON);
+
+ return bgp_show_summary_vty(vty, vrf, AFI_L2VPN, SAFI_EVPN, show_flags);
}
int bgp_evpn_cli_parse_type(int *type, struct cmd_token **argv, int argc)
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index cec4a9339a..b69e2d71b6 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -110,9 +110,9 @@ static int bgp_peer_reg_with_nht(struct peer *peer)
&& !CHECK_FLAG(peer->bgp->flags, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
connected = 1;
- return bgp_find_or_add_nexthop(
- peer->bgp, peer->bgp, family2afi(peer->su.sa.sa_family),
- NULL, peer, connected);
+ return bgp_find_or_add_nexthop(peer->bgp, peer->bgp,
+ family2afi(peer->su.sa.sa_family),
+ SAFI_UNICAST, NULL, peer, connected);
}
static void peer_xfer_stats(struct peer *peer_dst, struct peer *peer_src)
@@ -1420,19 +1420,6 @@ int bgp_stop(struct peer *peer)
peer->update_time = 0;
-/* Until we are sure that there is no problem about prefix count
- this should be commented out.*/
-#if 0
- /* Reset prefix count */
- peer->pcount[AFI_IP][SAFI_UNICAST] = 0;
- peer->pcount[AFI_IP][SAFI_MULTICAST] = 0;
- peer->pcount[AFI_IP][SAFI_LABELED_UNICAST] = 0;
- peer->pcount[AFI_IP][SAFI_MPLS_VPN] = 0;
- peer->pcount[AFI_IP6][SAFI_UNICAST] = 0;
- peer->pcount[AFI_IP6][SAFI_MULTICAST] = 0;
- peer->pcount[AFI_IP6][SAFI_LABELED_UNICAST] = 0;
-#endif /* 0 */
-
if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)
&& !(CHECK_FLAG(peer->flags, PEER_FLAG_DELETE))) {
peer_delete(peer);
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 1d66d75288..d9acda8bd0 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -590,8 +590,8 @@ leak_update(struct bgp *bgp, /* destination bgp instance */
* TBD do we need to do anything about the
* 'connected' parameter?
*/
- nh_valid = bgp_find_or_add_nexthop(bgp, bgp_nexthop,
- afi, bpi, NULL, 0);
+ nh_valid = bgp_find_or_add_nexthop(
+ bgp, bgp_nexthop, afi, safi, bpi, NULL, 0);
if (debug)
zlog_debug("%s: nexthop is %svalid (in vrf %s)",
@@ -656,8 +656,8 @@ leak_update(struct bgp *bgp, /* destination bgp instance */
* TBD do we need to do anything about the
* 'connected' parameter?
*/
- nh_valid = bgp_find_or_add_nexthop(bgp, bgp_nexthop,
- afi, new, NULL, 0);
+ nh_valid = bgp_find_or_add_nexthop(bgp, bgp_nexthop, afi, safi,
+ new, NULL, 0);
if (debug)
zlog_debug("%s: nexthop is %svalid (in vrf %s)",
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index 1a9f59db64..b7f62ec0a1 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -33,6 +33,7 @@
#include "nexthop.h"
#include "queue.h"
#include "filter.h"
+#include "printfrr.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_route.h"
@@ -1020,3 +1021,50 @@ void bgp_scan_finish(struct bgp *bgp)
bgp->connected_table[afi] = NULL;
}
}
+
+char *bgp_nexthop_dump_bnc_flags(struct bgp_nexthop_cache *bnc, char *buf,
+ size_t len)
+{
+ if (bnc->flags == 0) {
+ snprintfrr(buf, len, "None ");
+ return buf;
+ }
+
+ snprintfrr(buf, len, "%s%s%s%s%s%s%s",
+ CHECK_FLAG(bnc->flags, BGP_NEXTHOP_VALID) ? "Valid " : "",
+ CHECK_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED) ? "Reg " : "",
+ CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED) ? "Conn " : "",
+ CHECK_FLAG(bnc->flags, BGP_NEXTHOP_PEER_NOTIFIED) ? "Notify "
+ : "",
+ CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE) ? "Static " : "",
+ CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH)
+ ? "Static Exact "
+ : "",
+ CHECK_FLAG(bnc->flags, BGP_NEXTHOP_LABELED_VALID)
+ ? "Label Valid "
+ : "");
+
+ return buf;
+}
+
+char *bgp_nexthop_dump_bnc_change_flags(struct bgp_nexthop_cache *bnc,
+ char *buf, size_t len)
+{
+ if (bnc->flags == 0) {
+ snprintfrr(buf, len, "None ");
+ return buf;
+ }
+
+ snprintfrr(buf, len, "%s%s%s",
+ CHECK_FLAG(bnc->change_flags, BGP_NEXTHOP_CHANGED)
+ ? "Changed "
+ : "",
+ CHECK_FLAG(bnc->change_flags, BGP_NEXTHOP_METRIC_CHANGED)
+ ? "Metric "
+ : "",
+ CHECK_FLAG(bnc->change_flags, BGP_NEXTHOP_CONNECTED_CHANGED)
+ ? "Connected "
+ : "");
+
+ return buf;
+}
diff --git a/bgpd/bgp_nexthop.h b/bgpd/bgp_nexthop.h
index c4b913faf4..a223ff4133 100644
--- a/bgpd/bgp_nexthop.h
+++ b/bgpd/bgp_nexthop.h
@@ -100,6 +100,11 @@ struct update_subgroup;
struct bgp_dest;
struct attr;
+#define BNC_FLAG_DUMP_SIZE 180
+extern char *bgp_nexthop_dump_bnc_flags(struct bgp_nexthop_cache *bnc,
+ char *buf, size_t len);
+extern char *bgp_nexthop_dump_bnc_change_flags(struct bgp_nexthop_cache *bnc,
+ char *buf, size_t len);
extern void bgp_connected_add(struct bgp *bgp, struct connected *c);
extern void bgp_connected_delete(struct bgp *bgp, struct connected *c);
extern bool bgp_subgrp_multiaccess_check_v4(struct in_addr nexthop,
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index 29ab3d9c6c..bc5da0ee21 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -121,7 +121,7 @@ void bgp_unlink_nexthop_by_peer(struct peer *peer)
* we need both the bgp_route and bgp_nexthop pointers.
*/
int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
- afi_t afi, struct bgp_path_info *pi,
+ afi_t afi, safi_t safi, struct bgp_path_info *pi,
struct peer *peer, int connected)
{
struct bgp_nexthop_cache_head *tree = NULL;
@@ -257,7 +257,11 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
*/
if (bgp_route->inst_type == BGP_INSTANCE_TYPE_VIEW)
return 1;
- else
+ else if (safi == SAFI_UNICAST && pi
+ && pi->sub_type == BGP_ROUTE_IMPORTED && pi->extra
+ && pi->extra->num_labels) {
+ return bgp_isvalid_labeled_nexthop(bnc);
+ } else
return (bgp_isvalid_nexthop(bnc));
}
@@ -316,12 +320,17 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc,
bnc->change_flags = 0;
/* debug print the input */
- if (BGP_DEBUG(nht, NHT))
+ if (BGP_DEBUG(nht, NHT)) {
+ char bnc_buf[BNC_FLAG_DUMP_SIZE];
+
zlog_debug(
- "%s(%u): Rcvd NH update %pFX(%u) - metric %d/%d #nhops %d/%d flags 0x%x",
+ "%s(%u): Rcvd NH update %pFX(%u) - metric %d/%d #nhops %d/%d flags %s",
bnc->bgp->name_pretty, bnc->bgp->vrf_id, &nhr->prefix,
bnc->srte_color, nhr->metric, bnc->metric,
- nhr->nexthop_num, bnc->nexthop_num, bnc->flags);
+ nhr->nexthop_num, bnc->nexthop_num,
+ bgp_nexthop_dump_bnc_flags(bnc, bnc_buf,
+ sizeof(bnc_buf)));
+ }
if (nhr->metric != bnc->metric)
bnc->change_flags |= BGP_NEXTHOP_METRIC_CHANGED;
@@ -698,11 +707,17 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc)
if (BGP_DEBUG(nht, NHT)) {
char buf[PREFIX2STR_BUFFER];
+ char bnc_buf[BNC_FLAG_DUMP_SIZE];
+ char chg_buf[BNC_FLAG_DUMP_SIZE];
+
bnc_str(bnc, buf, PREFIX2STR_BUFFER);
zlog_debug(
- "NH update for %s(%u)(%s) - flags 0x%x chgflags 0x%x - evaluate paths",
- buf, bnc->srte_color, bnc->bgp->name_pretty, bnc->flags,
- bnc->change_flags);
+ "NH update for %s(%u)(%s) - flags %s chgflags %s- evaluate paths",
+ buf, bnc->srte_color, bnc->bgp->name_pretty,
+ bgp_nexthop_dump_bnc_flags(bnc, bnc_buf,
+ sizeof(bnc_buf)),
+ bgp_nexthop_dump_bnc_change_flags(bnc, chg_buf,
+ sizeof(bnc_buf)));
}
LIST_FOREACH (path, &(bnc->paths), nh_thread) {
diff --git a/bgpd/bgp_nht.h b/bgpd/bgp_nht.h
index 8451f0689d..f374e8dfa5 100644
--- a/bgpd/bgp_nht.h
+++ b/bgpd/bgp_nht.h
@@ -34,14 +34,15 @@ extern void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id);
* bgp_route - BGP instance of route
* bgp_nexthop - BGP instance of nexthop
* a - afi: AFI_IP or AF_IP6
+ * safi - safi: to check which table nhs are being imported to
* p - path for which the nexthop object is being looked up
* peer - The BGP peer associated with this NHT
* connected - True if NH MUST be a connected route
*/
extern int bgp_find_or_add_nexthop(struct bgp *bgp_route,
struct bgp *bgp_nexthop, afi_t a,
- struct bgp_path_info *p, struct peer *peer,
- int connected);
+ safi_t safi, struct bgp_path_info *p,
+ struct peer *peer, int connected);
/**
* bgp_unlink_nexthop() - Unlink the nexthop object from the path structure.
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index b7ecd8a49b..c2e2de1c73 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1863,6 +1863,7 @@ static int bgp_notify_receive(struct peer *peer, bgp_size_t size)
bgp_notify.subcode = stream_getc(peer->curr);
bgp_notify.length = size - 2;
bgp_notify.data = NULL;
+ bgp_notify.raw_data = NULL;
/* Preserv notify code and sub code. */
peer->notify.code = bgp_notify.code;
diff --git a/bgpd/bgp_pbr.c b/bgpd/bgp_pbr.c
index 4f22f5bcfe..171522f8ae 100644
--- a/bgpd/bgp_pbr.c
+++ b/bgpd/bgp_pbr.c
@@ -2845,19 +2845,6 @@ static void bgp_pbr_handle_entry(struct bgp *bgp, struct bgp_path_info *path,
zlog_warn("PBR: Sample action Ignored");
}
}
-#if 0
- if (api->actions[i].u.za.filter
- & TRAFFIC_ACTION_DISTRIBUTE) {
- if (BGP_DEBUG(pbr, PBR)) {
- bgp_pbr_print_policy_route(api);
- zlog_warn("PBR: Distribute action Applies");
- }
- continue_loop = 0;
- /* continue forwarding entry as before
- * no action
- */
- }
-#endif /* XXX to confirm behaviour of traffic action. for now , ignore */
/* terminate action: run other filters
*/
break;
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index e6276d060e..0ac9a42dc5 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -4062,7 +4062,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
nh_afi = BGP_ATTR_NH_AFI(afi, pi->attr);
if (bgp_find_or_add_nexthop(bgp, bgp_nexthop, nh_afi,
- pi, NULL, connected)
+ safi, pi, NULL, connected)
|| CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD))
bgp_path_info_set_flag(dest, pi,
BGP_PATH_VALID);
@@ -4207,7 +4207,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
nh_afi = BGP_ATTR_NH_AFI(afi, new->attr);
- if (bgp_find_or_add_nexthop(bgp, bgp, nh_afi, new, NULL,
+ if (bgp_find_or_add_nexthop(bgp, bgp, nh_afi, safi, new, NULL,
connected)
|| CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD))
bgp_path_info_set_flag(dest, new, BGP_PATH_VALID);
@@ -5445,7 +5445,8 @@ void bgp_static_update(struct bgp *bgp, const struct prefix *p,
bgp_nexthop = pi->extra->bgp_orig;
if (bgp_find_or_add_nexthop(bgp, bgp_nexthop,
- afi, pi, NULL, 0))
+ afi, safi, pi, NULL,
+ 0))
bgp_path_info_set_flag(dest, pi,
BGP_PATH_VALID);
else {
@@ -5497,7 +5498,7 @@ void bgp_static_update(struct bgp *bgp, const struct prefix *p,
/* Nexthop reachability check. */
if (CHECK_FLAG(bgp->flags, BGP_FLAG_IMPORT_CHECK)
&& (safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST)) {
- if (bgp_find_or_add_nexthop(bgp, bgp, afi, new, NULL, 0))
+ if (bgp_find_or_add_nexthop(bgp, bgp, afi, safi, new, NULL, 0))
bgp_path_info_set_flag(dest, new, BGP_PATH_VALID);
else {
if (BGP_DEBUG(nht, NHT)) {
@@ -6702,6 +6703,9 @@ static void bgp_aggregate_install(
if (!attr) {
bgp_aggregate_delete(bgp, p, afi, safi, aggregate);
+ if (BGP_DEBUG(update_groups, UPDATE_GROUPS))
+ zlog_debug("%s: %pFX null attribute", __func__,
+ p);
return;
}
@@ -7220,6 +7224,13 @@ static void bgp_add_route_to_aggregate(struct bgp *bgp,
struct ecommunity *ecommunity = NULL;
struct lcommunity *lcommunity = NULL;
+ /* If the bgp instance is being deleted or self peer is deleted
+ * then do not create aggregate route
+ */
+ if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)
+ || (bgp->peer_self == NULL))
+ return;
+
/* ORIGIN attribute: If at least one route among routes that are
* aggregated has ORIGIN with the value INCOMPLETE, then the
* aggregated route must have the ORIGIN attribute with the value
@@ -7336,6 +7347,13 @@ static void bgp_remove_route_from_aggregate(struct bgp *bgp, afi_t afi,
struct lcommunity *lcommunity = NULL;
unsigned long match = 0;
+ /* If the bgp instance is being deleted or self peer is deleted
+ * then do not create aggregate route
+ */
+ if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)
+ || (bgp->peer_self == NULL))
+ return;
+
if (BGP_PATH_HOLDDOWN(pi))
return;
@@ -7532,6 +7550,13 @@ int bgp_aggregate_unset(struct bgp *bgp, struct prefix *prefix, afi_t afi,
struct bgp_dest *dest;
struct bgp_aggregate *aggregate;
+ /* If the bgp instance is being deleted or self peer is deleted
+ * then do not create aggregate route
+ */
+ if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)
+ || (bgp->peer_self == NULL))
+ return 0;
+
apply_mask(prefix);
/* Old configuration check. */
dest = bgp_node_lookup(bgp->aggregate[afi][safi], prefix);
@@ -12289,22 +12314,6 @@ struct bgp_table_stats {
double total_space;
};
-#if 0
-#define TALLY_SIGFIG 100000
-static unsigned long
-ravg_tally (unsigned long count, unsigned long oldavg, unsigned long newval)
-{
- unsigned long newtot = (count-1) * oldavg + (newval * TALLY_SIGFIG);
- unsigned long res = (newtot * TALLY_SIGFIG) / count;
- unsigned long ret = newtot / count;
-
- if ((res % TALLY_SIGFIG) > (TALLY_SIGFIG/2))
- return ret + 1;
- else
- return ret;
-}
-#endif
-
static void bgp_table_stats_rn(struct bgp_dest *dest, struct bgp_dest *top,
struct bgp_table_stats *ts, unsigned int space)
{
@@ -12319,13 +12328,6 @@ static void bgp_table_stats_rn(struct bgp_dest *dest, struct bgp_dest *top,
ts->counts[BGP_STATS_PREFIXES]++;
ts->counts[BGP_STATS_TOTPLEN] += rn_p->prefixlen;
-#if 0
- ts->counts[BGP_STATS_AVGPLEN]
- = ravg_tally (ts->counts[BGP_STATS_PREFIXES],
- ts->counts[BGP_STATS_AVGPLEN],
- rn_p->prefixlen);
-#endif
-
/* check if the prefix is included by any other announcements */
while (pdest && !bgp_dest_has_bgp_path_info_data(pdest))
pdest = bgp_dest_parent_nolock(pdest);
@@ -12362,16 +12364,6 @@ static void bgp_table_stats_rn(struct bgp_dest *dest, struct bgp_dest *top,
ts->counts[BGP_STATS_ASPATH_TOTHOPS] += hops;
ts->counts[BGP_STATS_ASPATH_TOTSIZE] += size;
-#if 0
- ts->counts[BGP_STATS_ASPATH_AVGHOPS]
- = ravg_tally (ts->counts[BGP_STATS_ASPATH_COUNT],
- ts->counts[BGP_STATS_ASPATH_AVGHOPS],
- hops);
- ts->counts[BGP_STATS_ASPATH_AVGSIZE]
- = ravg_tally (ts->counts[BGP_STATS_ASPATH_COUNT],
- ts->counts[BGP_STATS_ASPATH_AVGSIZE],
- size);
-#endif
if (highest > ts->counts[BGP_STATS_ASN_HIGHEST])
ts->counts[BGP_STATS_ASN_HIGHEST] = highest;
}
@@ -12481,15 +12473,6 @@ static int bgp_table_stats_single(struct vty *vty, struct bgp *bgp, afi_t afi,
continue;
switch (i) {
-#if 0
- case BGP_STATS_ASPATH_AVGHOPS:
- case BGP_STATS_ASPATH_AVGSIZE:
- case BGP_STATS_AVGPLEN:
- vty_out (vty, "%-30s: ", table_stats_strs[i]);
- vty_out (vty, "%12.2f",
- (float)ts.counts[i] / (float)TALLY_SIGFIG);
- break;
-#endif
case BGP_STATS_ASPATH_TOTHOPS:
case BGP_STATS_ASPATH_TOTSIZE:
if (!json) {
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index bdbf4743ab..1060d2e60d 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -558,6 +558,8 @@ DECLARE_HOOK(bgp_process,
#define BGP_SHOW_OPT_AFI_ALL (1 << 2)
#define BGP_SHOW_OPT_AFI_IP (1 << 3)
#define BGP_SHOW_OPT_AFI_IP6 (1 << 4)
+#define BGP_SHOW_OPT_ESTABLISHED (1 << 5)
+#define BGP_SHOW_OPT_FAILED (1 << 6)
/* Prototypes. */
extern void bgp_rib_remove(struct bgp_dest *dest, struct bgp_path_info *pi,
diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c
index 059e05ef71..621a14014f 100644
--- a/bgpd/bgp_updgrp.c
+++ b/bgpd/bgp_updgrp.c
@@ -909,7 +909,6 @@ static void update_subgroup_add_peer(struct update_subgroup *subgrp,
bpacket_add_peer(pkt, paf);
- bpacket_queue_sanity_check(SUBGRP_PKTQ(subgrp));
if (BGP_DEBUG(update_groups, UPDATE_GROUPS))
zlog_debug("peer %s added to subgroup s%" PRIu64,
paf->peer->host, subgrp->id);
@@ -1229,8 +1228,6 @@ static int update_subgroup_copy_packets(struct update_subgroup *dest,
pkt = bpacket_next(pkt);
}
- bpacket_queue_sanity_check(SUBGRP_PKTQ(dest));
-
return count;
}
diff --git a/bgpd/bgp_updgrp.h b/bgpd/bgp_updgrp.h
index 7261933dc9..694636ef3d 100644
--- a/bgpd/bgp_updgrp.h
+++ b/bgpd/bgp_updgrp.h
@@ -109,12 +109,6 @@ struct bpacket {
struct bpacket_queue {
TAILQ_HEAD(pkt_queue, bpacket) pkts;
-#if 0
- /* A dummy packet that is used to thread all peers that have
- completed their work */
- struct bpacket sentinel;
-#endif
-
unsigned int conf_max_count;
unsigned int curr_count;
unsigned int hwm_count;
diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c
index 866bf8178a..0a3ecc584e 100644
--- a/bgpd/bgp_updgrp_packet.c
+++ b/bgpd/bgp_updgrp_packet.c
@@ -88,39 +88,6 @@ void bpacket_queue_init(struct bpacket_queue *q)
}
/*
- * bpacket_queue_sanity_check
- */
-void bpacket_queue_sanity_check(struct bpacket_queue __attribute__((__unused__))
- * q)
-{
-#if 0
- struct bpacket *pkt;
-
- pkt = bpacket_queue_last (q);
- assert (pkt);
- assert (!pkt->buffer);
-
- /*
- * Make sure the count of packets is correct.
- */
- int num_pkts = 0;
-
- pkt = bpacket_queue_first (q);
- while (pkt)
- {
- num_pkts++;
-
- if (num_pkts > q->curr_count)
- assert (0);
-
- pkt = TAILQ_NEXT (pkt, pkt_train);
- }
-
- assert (num_pkts == q->curr_count);
-#endif
-}
-
-/*
* bpacket_queue_add_packet
*
* Internal function of bpacket_queue - and adds a
@@ -168,7 +135,6 @@ struct bpacket *bpacket_queue_add(struct bpacket_queue *q, struct stream *s,
else
bpacket_attr_vec_arr_reset(&pkt->arr);
bpacket_queue_add_packet(q, pkt);
- bpacket_queue_sanity_check(q);
return pkt;
}
@@ -176,7 +142,6 @@ struct bpacket *bpacket_queue_add(struct bpacket_queue *q, struct stream *s,
* Fill in the new information into the current sentinel and create a
* new sentinel.
*/
- bpacket_queue_sanity_check(q);
last_pkt = bpacket_queue_last(q);
assert(last_pkt->buffer == NULL);
last_pkt->buffer = s;
@@ -190,7 +155,6 @@ struct bpacket *bpacket_queue_add(struct bpacket_queue *q, struct stream *s,
pkt->ver++;
bpacket_queue_add_packet(q, pkt);
- bpacket_queue_sanity_check(q);
return last_pkt;
}
@@ -290,7 +254,6 @@ static int bpacket_queue_compact(struct bpacket_queue *q)
num_deleted++;
}
- bpacket_queue_sanity_check(q);
return num_deleted;
}
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index a8256d165e..a89c245e2a 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -8014,22 +8014,6 @@ DEFPY_YANG(
return nb_cli_apply_changes(vty, base_xpath);
}
-ALIAS_HIDDEN(neighbor_route_map, neighbor_route_map_hidden_cmd,
- "neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
- NEIGHBOR_STR NEIGHBOR_ADDR_STR2
- "Apply route map to neighbor\n"
- "Name of route map\n"
- "Apply map to incoming routes\n"
- "Apply map to outbound routes\n")
-
-ALIAS_HIDDEN(neighbor_route_map, no_neighbor_route_map_hidden_cmd,
- "no neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
- NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
- "Apply route map to neighbor\n"
- "Name of route map\n"
- "Apply map to incoming routes\n"
- "Apply map to outbound routes\n")
-
/* Set unsuppress-map to the peer. */
static int peer_unsuppress_map_set_vty(struct vty *vty, const char *ip_str,
afi_t afi, safi_t safi,
@@ -10612,8 +10596,7 @@ static char *bgp_peer_description_stripped(char *desc, uint32_t size)
/* Show BGP peer's summary information. */
static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
- bool show_failed, bool show_established,
- bool use_json)
+ uint8_t show_flags)
{
struct peer *peer;
struct listnode *node, *nnode;
@@ -10629,6 +10612,11 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
json_object *json_peers = NULL;
struct peer_af *paf;
struct bgp_filter *filter;
+ bool use_json = CHECK_FLAG(show_flags, BGP_SHOW_OPT_JSON);
+ bool show_failed = CHECK_FLAG(show_flags, BGP_SHOW_OPT_FAILED);
+ bool show_established =
+ CHECK_FLAG(show_flags, BGP_SHOW_OPT_ESTABLISHED);
+ bool show_wide = CHECK_FLAG(show_flags, BGP_SHOW_OPT_WIDE);
/* labeled-unicast routes are installed in the unicast table so in order
* to
@@ -10925,10 +10913,13 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
vty_out(vty, "%*s", max_neighbor_width - 8,
" ");
if (show_failed)
- vty_out(vty, "EstdCnt DropCnt ResetTime Reason\n");
+ vty_out(vty,
+ BGP_SHOW_SUMMARY_HEADER_FAILED);
else
vty_out(vty,
- "V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc\n");
+ show_wide
+ ? BGP_SHOW_SUMMARY_HEADER_ALL_WIDE
+ : BGP_SHOW_SUMMARY_HEADER_ALL);
}
}
@@ -10968,6 +10959,11 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
peer->domainname);
json_object_int_add(json_peer, "remoteAs", peer->as);
+ json_object_int_add(
+ json_peer, "localAs",
+ peer->change_local_as
+ ? peer->change_local_as
+ : peer->local_as);
json_object_int_add(json_peer, "version", 4);
json_object_int_add(json_peer, "msgRcvd",
PEER_TOTAL_RX(peer));
@@ -11124,14 +11120,33 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
&peer->ibuf->count,
memory_order_relaxed);
- vty_out(vty,
- "4 %10u %9u %9u %8" PRIu64" %4zu %4zu %8s",
- peer->as, PEER_TOTAL_RX(peer),
- PEER_TOTAL_TX(peer),
- peer->version[afi][safi], inq_count,
- outq_count,
- peer_uptime(peer->uptime, timebuf,
- BGP_UPTIME_LEN, 0, NULL));
+ if (show_wide)
+ vty_out(vty,
+ "4 %10u %10u %9u %9u %8" PRIu64
+ " %4zu %4zu %8s",
+ peer->as,
+ peer->change_local_as
+ ? peer->change_local_as
+ : peer->local_as,
+ PEER_TOTAL_RX(peer),
+ PEER_TOTAL_TX(peer),
+ peer->version[afi][safi],
+ inq_count, outq_count,
+ peer_uptime(peer->uptime,
+ timebuf,
+ BGP_UPTIME_LEN, 0,
+ NULL));
+ else
+ vty_out(vty, "4 %10u %9u %9u %8" PRIu64
+ " %4zu %4zu %8s",
+ peer->as, PEER_TOTAL_RX(peer),
+ PEER_TOTAL_TX(peer),
+ peer->version[afi][safi],
+ inq_count, outq_count,
+ peer_uptime(peer->uptime,
+ timebuf,
+ BGP_UPTIME_LEN, 0,
+ NULL));
if (peer->status == Established) {
if (peer->afc_recv[afi][safi]) {
@@ -11149,7 +11164,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
[afi]
[pfx_rcd_safi]);
} else {
- vty_out(vty, " NoNeg");
+ vty_out(vty, " NoNeg");
}
if (paf && PAF_SUBGRP(paf)) {
@@ -11166,6 +11181,8 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
(PAF_SUBGRP(
paf))
->scount);
+ } else {
+ vty_out(vty, " NoNeg");
}
} else {
if (CHECK_FLAG(peer->flags,
@@ -11187,7 +11204,8 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
if (peer->desc)
vty_out(vty, " %s",
bgp_peer_description_stripped(
- peer->desc, 20));
+ peer->desc,
+ show_wide ? 64 : 20));
else
vty_out(vty, " N/A");
vty_out(vty, "\n");
@@ -11227,14 +11245,14 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
}
static void bgp_show_summary_afi_safi(struct vty *vty, struct bgp *bgp, int afi,
- int safi, bool show_failed,
- bool show_established, bool use_json)
+ int safi, uint8_t show_flags)
{
int is_first = 1;
int afi_wildcard = (afi == AFI_MAX);
int safi_wildcard = (safi == SAFI_MAX);
int is_wildcard = (afi_wildcard || safi_wildcard);
bool nbr_output = false;
+ bool use_json = CHECK_FLAG(show_flags, BGP_SHOW_OPT_JSON);
if (use_json && is_wildcard)
vty_out(vty, "{\n");
@@ -11272,8 +11290,7 @@ static void bgp_show_summary_afi_safi(struct vty *vty, struct bgp *bgp, int afi,
}
}
bgp_show_summary(vty, bgp, afi, safi,
- show_failed, show_established,
- use_json);
+ show_flags);
}
safi++;
if (!safi_wildcard)
@@ -11295,14 +11312,13 @@ static void bgp_show_summary_afi_safi(struct vty *vty, struct bgp *bgp, int afi,
}
static void bgp_show_all_instances_summary_vty(struct vty *vty, afi_t afi,
- safi_t safi, bool show_failed,
- bool show_established,
- bool use_json)
+ safi_t safi, uint8_t show_flags)
{
struct listnode *node, *nnode;
struct bgp *bgp;
int is_first = 1;
bool nbr_output = false;
+ bool use_json = CHECK_FLAG(show_flags, BGP_SHOW_OPT_JSON);
if (use_json)
vty_out(vty, "{\n");
@@ -11325,8 +11341,7 @@ static void bgp_show_all_instances_summary_vty(struct vty *vty, afi_t afi,
? VRF_DEFAULT_NAME
: bgp->name);
}
- bgp_show_summary_afi_safi(vty, bgp, afi, safi, show_failed,
- show_established, use_json);
+ bgp_show_summary_afi_safi(vty, bgp, afi, safi, show_flags);
}
if (use_json)
@@ -11336,16 +11351,15 @@ static void bgp_show_all_instances_summary_vty(struct vty *vty, afi_t afi,
}
int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi,
- safi_t safi, bool show_failed, bool show_established,
- bool use_json)
+ safi_t safi, uint8_t show_flags)
{
struct bgp *bgp;
+ bool use_json = CHECK_FLAG(show_flags, BGP_SHOW_OPT_JSON);
if (name) {
if (strmatch(name, "all")) {
- bgp_show_all_instances_summary_vty(
- vty, afi, safi, show_failed, show_established,
- use_json);
+ bgp_show_all_instances_summary_vty(vty, afi, safi,
+ show_flags);
return CMD_SUCCESS;
} else {
bgp = bgp_lookup_by_name(name);
@@ -11360,8 +11374,7 @@ int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi,
}
bgp_show_summary_afi_safi(vty, bgp, afi, safi,
- show_failed, show_established,
- use_json);
+ show_flags);
return CMD_SUCCESS;
}
}
@@ -11369,8 +11382,7 @@ int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi,
bgp = bgp_get_default();
if (bgp)
- bgp_show_summary_afi_safi(vty, bgp, afi, safi, show_failed,
- show_established, use_json);
+ bgp_show_summary_afi_safi(vty, bgp, afi, safi, show_flags);
else {
if (use_json)
vty_out(vty, "{}\n");
@@ -11385,7 +11397,7 @@ int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi,
/* `show [ip] bgp summary' commands. */
DEFPY (show_ip_bgp_summary,
show_ip_bgp_summary_cmd,
- "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]] [all$all] summary [established|failed] [json$uj]",
+ "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]] [all$all] summary [established|failed] [wide] [json$uj]",
SHOW_STR
IP_STR
BGP_STR
@@ -11396,13 +11408,13 @@ DEFPY (show_ip_bgp_summary,
"Summary of BGP neighbor status\n"
"Show only sessions in Established state\n"
"Show only sessions not in Established state\n"
+ "Increase table width for longer output\n"
JSON_STR)
{
char *vrf = NULL;
afi_t afi = AFI_MAX;
safi_t safi = SAFI_MAX;
- bool show_failed = false;
- bool show_established = false;
+ uint8_t show_flags = 0;
int idx = 0;
@@ -11423,12 +11435,18 @@ DEFPY (show_ip_bgp_summary,
}
if (argv_find(argv, argc, "failed", &idx))
- show_failed = true;
+ SET_FLAG(show_flags, BGP_SHOW_OPT_FAILED);
+
if (argv_find(argv, argc, "established", &idx))
- show_established = true;
+ SET_FLAG(show_flags, BGP_SHOW_OPT_ESTABLISHED);
+
+ if (argv_find(argv, argc, "wide", &idx))
+ SET_FLAG(show_flags, BGP_SHOW_OPT_WIDE);
+
+ if (argv_find(argv, argc, "json", &idx))
+ SET_FLAG(show_flags, BGP_SHOW_OPT_JSON);
- return bgp_show_summary_vty(vty, vrf, afi, safi, show_failed,
- show_established, uj);
+ return bgp_show_summary_vty(vty, vrf, afi, safi, show_flags);
}
const char *get_afi_safi_str(afi_t afi, safi_t safi, bool for_json)
@@ -18627,8 +18645,6 @@ void bgp_vty_init(void)
install_element(BGP_FLOWSPECV6_NODE, &no_neighbor_filter_list_cmd);
/* "neighbor route-map" commands. */
- install_element(BGP_NODE, &neighbor_route_map_hidden_cmd);
- install_element(BGP_NODE, &no_neighbor_route_map_hidden_cmd);
install_element(BGP_IPV4_NODE, &neighbor_route_map_cmd);
install_element(BGP_IPV4M_NODE, &neighbor_route_map_cmd);
install_element(BGP_IPV4L_NODE, &neighbor_route_map_cmd);
diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h
index 07f61ab0ea..85619dd074 100644
--- a/bgpd/bgp_vty.h
+++ b/bgpd/bgp_vty.h
@@ -53,6 +53,12 @@ struct bgp;
" Helper - GR Mode-Helper,\n" \
" Disable - GR Mode-Disable.\n\n"
+#define BGP_SHOW_SUMMARY_HEADER_ALL \
+ "V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc\n"
+#define BGP_SHOW_SUMMARY_HEADER_ALL_WIDE \
+ "V AS LocalAS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc\n"
+#define BGP_SHOW_SUMMARY_HEADER_FAILED "EstdCnt DropCnt ResetTime Reason\n"
+
#define BGP_SHOW_PEER_GR_CAPABILITY( \
vty, p, use_json, json) \
do { \
@@ -178,8 +184,7 @@ extern int bgp_vty_find_and_parse_afi_safi_bgp(struct vty *vty,
int bgp_vty_find_and_parse_bgp(struct vty *vty, struct cmd_token **argv,
int argc, struct bgp **bgp, bool use_json);
extern int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi,
- safi_t safi, bool show_failed,
- bool show_established, bool use_json);
+ safi_t safi, uint8_t show_flags);
extern int bgp_clear_star_soft_in(const char *name, char *errmsg,
size_t errmsg_len);
extern int bgp_clear_star_soft_out(const char *name, char *errmsg,
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 368397d7aa..edd90d7040 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -5684,11 +5684,6 @@ int peer_allowas_in_unset(struct peer *peer, afi_t afi, safi_t safi)
PEER_FLAG_ALLOWAS_IN))
continue;
- /* Skip peers where flag is already disabled. */
- if (!CHECK_FLAG(member->af_flags[afi][safi],
- PEER_FLAG_ALLOWAS_IN))
- continue;
-
/* Remove flags and configuration on peer-group member. */
UNSET_FLAG(member->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN);
UNSET_FLAG(member->af_flags[afi][safi],
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index f7bbd44512..8c455c6ea5 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -578,9 +578,6 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
struct bgp_attr_encap_subtlv *encaptlv;
char buf[PREFIX_STRLEN];
char buf2[RD_ADDRSTRLEN];
-#if 0 /* unused? */
- struct prefix pfx_buf;
-#endif
struct rfapi_nexthop *lnh = NULL; /* local nexthop */
struct rfapi_vn_option *vo;
@@ -603,20 +600,6 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
return;
}
-#if 0 /* unused? */
- if ((safi == SAFI_MPLS_VPN) && (flags & RFAPI_AHR_SET_PFX_TO_NEXTHOP))
- {
-
- if (rfapiRaddr2Qprefix (nexthop, &pfx_buf))
- {
- vnc_zlog_debug_verbose
- ("%s: can't set pfx to vn addr, not adding SAFI_MPLS_VPN route",
- __func__);
- return;
- }
- p = &pfx_buf;
- }
-#endif
for (vo = options_vn; vo; vo = vo->next) {
if (RFAPI_VN_OPTION_TYPE_L2ADDR == vo->type) {
l2o = &vo->v.l2addr;
diff --git a/bgpd/rfapi/rfapi_private.h b/bgpd/rfapi/rfapi_private.h
index e24d62def4..af56367955 100644
--- a/bgpd/rfapi/rfapi_private.h
+++ b/bgpd/rfapi/rfapi_private.h
@@ -289,9 +289,6 @@ add_vnc_route(struct rfapi_descriptor *rfd, /* cookie + UN addr for VPN */
uint8_t type, uint8_t sub_type, int flags);
#define RFAPI_AHR_NO_TUNNEL_SUBTLV 0x00000001
#define RFAPI_AHR_RFPOPT_IS_VNCTLV 0x00000002 /* hack! */
-#if 0 /* unused? */
-# define RFAPI_AHR_SET_PFX_TO_NEXTHOP 0x00000004
-#endif
extern void del_vnc_route(struct rfapi_descriptor *rfd, struct peer *peer,
struct bgp *bgp, safi_t safi, const struct prefix *p,
diff --git a/configure.ac b/configure.ac
index 670a8f7de9..f82aa7a2a4 100755
--- a/configure.ac
+++ b/configure.ac
@@ -7,7 +7,7 @@
##
AC_PREREQ([2.60])
-AC_INIT([frr], [7.6-dev], [https://github.com/frrouting/frr/issues])
+AC_INIT([frr], [7.7-dev], [https://github.com/frrouting/frr/issues])
PACKAGE_URL="https://frrouting.org/"
AC_SUBST([PACKAGE_URL])
PACKAGE_FULLNAME="FRRouting"
diff --git a/doc/developer/topotests-markers.rst b/doc/developer/topotests-markers.rst
index 893834ad36..9f92412595 100644
--- a/doc/developer/topotests-markers.rst
+++ b/doc/developer/topotests-markers.rst
@@ -92,7 +92,7 @@ Adding multiple markers:
def test_using_bgpd_ospfd_ospf6d():
-Selecting marked modules fort testing
+Selecting marked modules for testing
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Selecting by a single marker:
diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst
index b7fda1c3a7..cb2444da54 100644
--- a/doc/user/bgp.rst
+++ b/doc/user/bgp.rst
@@ -442,6 +442,8 @@ Require policy on EBGP
This is enabled by default for the traditional configuration and
turned off by default for datacenter configuration.
+ When you enable/disable this option you MUST clear the session.
+
When the incoming or outgoing filter is missing you will see
"(Policy)" sign under ``show bgp summary``:
@@ -3327,8 +3329,8 @@ Some other commands provide additional options for filtering the output.
This command displays BGP routes using AS path regular expression
(:ref:`bgp-regular-expressions`).
-.. index:: show [ip] bgp [all] summary [json]
-.. clicmd:: show [ip] bgp [all] summary [json]
+.. index:: show [ip] bgp [all] summary [wide] [json]
+.. clicmd:: show [ip] bgp [all] summary [wide] [json]
Show a bgp peer summary for the specified address family.
@@ -3337,6 +3339,25 @@ and should no longer be used. In order to reach the other BGP routing tables
other than the IPv6 routing table given by :clicmd:`show bgp`, the new command
structure is extended with :clicmd:`show bgp [afi] [safi]`.
+``wide`` option gives more output like ``LocalAS`` and extended ``Desc`` to
+64 characters.
+
+ .. code-block:: frr
+
+ exit1# show ip bgp summary wide
+
+ IPv4 Unicast Summary:
+ BGP router identifier 192.168.100.1, local AS number 65534 vrf-id 0
+ BGP table version 3
+ RIB entries 5, using 920 bytes of memory
+ Peers 1, using 27 KiB of memory
+
+ Neighbor V AS LocalAS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
+ 192.168.0.2 4 65030 123 15 22 0 0 0 00:07:00 0 1 us-east1-rs1.frrouting.org
+
+ Total number of neighbors 1
+ exit1#
+
.. index:: show bgp [afi] [safi] [all] [wide|json]
.. clicmd:: show bgp [afi] [safi] [all] [wide|json]
@@ -3469,7 +3490,7 @@ attribute.
If ``json`` option is specified, output is displayed in JSON format.
-.. index:: show bgp labelpool <chunks|inuse|ledger|requests|summary> [json]
+.. index:: show bgp labelpool <chunks|inuse|ledger|requests|summary> [json]
.. clicmd:: show bgp labelpool <chunks|inuse|ledger|requests|summary> [json]
These commands display information about the BGP labelpool used for
diff --git a/doc/user/nhrpd.rst b/doc/user/nhrpd.rst
index 9caeb0eedb..65645c519d 100644
--- a/doc/user/nhrpd.rst
+++ b/doc/user/nhrpd.rst
@@ -180,14 +180,15 @@ Integration with IKE
nhrpd needs tight integration with IKE daemon for various reasons.
Currently only strongSwan is supported as IKE daemon.
-nhrpd connects to strongSwan using VICI protocol based on UNIX socket
-(hardcoded now as /var/run/charon.vici).
+nhrpd connects to strongSwan using VICI protocol based on UNIX socket which
+can be configured using the command below (default to /var/run/charon.vici).
strongSwan currently needs few patches applied. Please check out the
-https://git.alpinelinux.org/user/tteras/strongswan/log/?h=tteras-release
-and
-https://git.alpinelinux.org/user/tteras/strongswan/log/?h=tteras
-git repositories for the patches.
+original patches at:
+https://git-old.alpinelinux.org/user/tteras/strongswan/
+
+Actively maintained patches are also available at:
+https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/strongswan
.. _nhrp-events:
diff --git a/doc/user/setup.rst b/doc/user/setup.rst
index b2b71cf012..64a33765c2 100644
--- a/doc/user/setup.rst
+++ b/doc/user/setup.rst
@@ -240,3 +240,53 @@ because FRR's monitoring program cannot currently distinguish between a crashed
The closest that can be achieved is to remove all configuration for the daemon,
and set its line in ``/etc/frr/daemons`` to ``=no``. Once this is done, the
daemon will be stopped the next time FRR is restarted.
+
+
+Network Namespaces
+^^^^^^^^^^^^^^^^^^
+
+It is possible to run FRR in different network namespaces so it can be
+further compartmentalized (e.g. confining to a smaller subset network).
+The network namespace configuration can be used in the default FRR
+configuration pathspace or it can be used in a different pathspace
+(`-N/--pathspace`).
+
+To use FRR network namespace in the default pathspace you should add
+or uncomment the ``watchfrr_options`` line in ``/etc/frr/daemons``:
+
+.. code-block:: diff
+
+ - #watchfrr_options="--netns"
+ + watchfrr_options="--netns=<network-namespace-name>"
+
+If you want to use a different pathspace with the network namespace
+(the recommended way) you should add/uncomment the ``watchfrr_options``
+line in ``/etc/frr/<namespace>/daemons``:
+
+.. code-block:: diff
+
+ - #watchfrr_options="--netns"
+ + #watchfrr_options="--netns=<network-namespace-name>"
+ +
+ + # `--netns` argument is optional and if not provided it will
+ + # default to the pathspace name.
+ + watchfrr_options="--netns"
+
+To start FRR in the new pathspace+network namespace the initialization script
+should be called with an extra parameter:
+
+
+.. code::
+
+ /etc/init.d/frr start <pathspace-name>
+
+
+.. note::
+
+ Some Linux distributions might not use the default init script
+ shipped with FRR, in that case you might want to try running the
+ bundled script in ``/usr/lib/frr/frrinit.sh``.
+
+ On systemd you might create different units or parameterize the
+ existing one. See the man page:
+ https://www.freedesktop.org/software/systemd/man/systemd.unit.html
diff --git a/eigrpd/eigrp_filter.c b/eigrpd/eigrp_filter.c
index 009b57e05f..c77a6fc1b1 100644
--- a/eigrpd/eigrp_filter.c
+++ b/eigrpd/eigrp_filter.c
@@ -124,39 +124,6 @@ void eigrp_distribute_update(struct distribute_ctx *ctx,
} else
e->prefix[EIGRP_FILTER_OUT] = NULL;
-// This is commented out, because the distribute.[ch] code
-// changes looked poorly written from first glance
-// commit was 133bdf2d
-// TODO: DBS
-#if 0
- /* route-map IN for whole process */
- if (dist->route[DISTRIBUTE_V4_IN])
- {
- routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_IN]);
- if (routemap)
- e->routemap[EIGRP_FILTER_IN] = routemap;
- else
- e->routemap[EIGRP_FILTER_IN] = NULL;
- }
- else
- {
- e->routemap[EIGRP_FILTER_IN] = NULL;
- }
-
- /* route-map OUT for whole process */
- if (dist->route[DISTRIBUTE_V4_OUT])
- {
- routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_OUT]);
- if (routemap)
- e->routemap[EIGRP_FILTER_OUT] = routemap;
- else
- e->routemap[EIGRP_FILTER_OUT] = NULL;
- }
- else
- {
- e->routemap[EIGRP_FILTER_OUT] = NULL;
- }
-#endif
// TODO: check Graceful restart after 10sec
/* cancel GR scheduled */
@@ -232,36 +199,6 @@ void eigrp_distribute_update(struct distribute_ctx *ctx,
} else
ei->prefix[EIGRP_FILTER_OUT] = NULL;
-#if 0
- /* route-map IN for whole process */
- if (dist->route[DISTRIBUTE_V4_IN])
- {
- zlog_info("<DEBUG ACL ALL in");
- routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_IN]);
- if (routemap)
- ei->routemap[EIGRP_FILTER_IN] = routemap;
- else
- ei->routemap[EIGRP_FILTER_IN] = NULL;
- }
- else
- {
- ei->routemap[EIGRP_FILTER_IN] = NULL;
- }
-
- /* route-map OUT for whole process */
- if (dist->route[DISTRIBUTE_V4_OUT])
- {
- routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_OUT]);
- if (routemap)
- ei->routemap[EIGRP_FILTER_OUT] = routemap;
- else
- ei->routemap[EIGRP_FILTER_OUT] = NULL;
- }
- else
- {
- ei->routemap[EIGRP_FILTER_OUT] = NULL;
- }
-#endif
// TODO: check Graceful restart after 10sec
/* Cancel GR scheduled */
diff --git a/isisd/isis_bpf.c b/isisd/isis_bpf.c
index 454da99e09..88c3bfa63c 100644
--- a/isisd/isis_bpf.c
+++ b/isisd/isis_bpf.c
@@ -67,12 +67,6 @@ uint8_t *readbuff = NULL;
static const uint8_t ALL_L1_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x14};
static const uint8_t ALL_L2_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x15};
-#if 0
-/* missing support for P2P-over-LAN / ES-IS on BSD */
-static const uint8_t ALL_ISS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x05};
-static const uint8_t ALL_ESS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x04};
-#endif
-
static char sock_buff[16384];
static int open_bpf_dev(struct isis_circuit *circuit)
diff --git a/isisd/isis_dlpi.c b/isisd/isis_dlpi.c
index 06fb41430c..bb8c542597 100644
--- a/isisd/isis_dlpi.c
+++ b/isisd/isis_dlpi.c
@@ -57,11 +57,6 @@ static t_uscalar_t dlpi_ctl[1024]; /* DLPI control messages */
static const uint8_t ALL_L1_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x14};
static const uint8_t ALL_L2_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x15};
static const uint8_t ALL_ISS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x05};
-#if 0
-/* missing support for ES-IS on Solaris */
-static const uint8_t ALL_ESS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x04};
-#endif
-
static uint8_t sock_buff[16384];
static unsigned short pf_filter[] = {
diff --git a/lib/buffer.c b/lib/buffer.c
index 459d98e75d..42796faae8 100644
--- a/lib/buffer.c
+++ b/lib/buffer.c
@@ -468,16 +468,6 @@ buffer_status_t buffer_write(struct buffer *b, int fd, const void *p,
{
ssize_t nbytes;
-#if 0
- /*
- * Should we attempt to drain any previously buffered data?
- * This could help reduce latency in pushing out the data if
- * we are stuck in a long-running thread that is preventing
- * the main select loop from calling the flush thread...
- */
- if (b->head && (buffer_flush_available(b, fd) == BUFFER_ERROR))
- return BUFFER_ERROR;
-#endif
if (b->head)
/* Buffer is not empty, so do not attempt to write the new data.
*/
diff --git a/lib/if.c b/lib/if.c
index c707c4c6d9..fa0b1d0195 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -802,70 +802,6 @@ void if_dump_all(void)
if_dump(ifp);
}
-#if 0
-/* For debug purpose. */
-DEFUN (show_address,
- show_address_cmd,
- "show address [vrf NAME]",
- SHOW_STR
- "address\n"
- VRF_CMD_HELP_STR)
-{
- int idx_vrf = 3;
- struct listnode *node;
- struct interface *ifp;
- struct connected *ifc;
- struct prefix *p;
- vrf_id_t vrf_id = VRF_DEFAULT;
-
- if (argc > 2)
- VRF_GET_ID (vrf_id, argv[idx_vrf]->arg);
-
- FOR_ALL_INTERFACES (vrf, ifp) {
- for (ALL_LIST_ELEMENTS_RO (ifp->connected, node, ifc)) {
- p = ifc->address;
-
- if (p->family == AF_INET)
- vty_out (vty, "%pFX\n", p);
- }
- }
- return CMD_SUCCESS;
-}
-
-DEFUN (show_address_vrf_all,
- show_address_vrf_all_cmd,
- "show address vrf all",
- SHOW_STR
- "address\n"
- VRF_ALL_CMD_HELP_STR)
-{
- struct vrf *vrf;
- struct listnode *node;
- struct interface *ifp;
- struct connected *ifc;
- struct prefix *p;
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if (RB_EMPTY (if_name_head, &vrf->ifaces_by_name))
- continue;
-
- vty_out (vty, "\nVRF %s(%u)\n\n",
- VRF_LOGNAME(vrf), vrf->vrf_id);
-
- FOR_ALL_INTERFACES (vrf, ifp) {
- for (ALL_LIST_ELEMENTS_RO (ifp->connected, node, ifc)) {
- p = ifc->address;
-
- if (p->family == AF_INET)
- vty_out (vty, "%pFX\n", p);
- }
- }
- }
- return CMD_SUCCESS;
-}
-#endif
-
/* Allocate connected structure. */
struct connected *connected_new(void)
{
@@ -1083,84 +1019,6 @@ struct connected *connected_get_linklocal(struct interface *ifp)
return c;
}
-#if 0 /* this route_table of struct connected's is unused \
- * however, it would be good to use a route_table rather than \
- * a list.. \
- */
-/* Interface looking up by interface's address. */
-/* Interface's IPv4 address reverse lookup table. */
-struct route_table *ifaddr_ipv4_table;
-/* struct route_table *ifaddr_ipv6_table; */
-
-static void
-ifaddr_ipv4_add (struct in_addr *ifaddr, struct interface *ifp)
-{
- struct route_node *rn;
- struct prefix_ipv4 p;
-
- p.family = AF_INET;
- p.prefixlen = IPV4_MAX_PREFIXLEN;
- p.prefix = *ifaddr;
-
- rn = route_node_get (ifaddr_ipv4_table, (struct prefix *) &p);
- if (rn)
- {
- route_unlock_node (rn);
- zlog_info("ifaddr_ipv4_add(): address %pI4 is already added",
- ifaddr);
- return;
- }
- rn->info = ifp;
-}
-
-static void
-ifaddr_ipv4_delete (struct in_addr *ifaddr, struct interface *ifp)
-{
- struct route_node *rn;
- struct prefix_ipv4 p;
-
- p.family = AF_INET;
- p.prefixlen = IPV4_MAX_PREFIXLEN;
- p.prefix = *ifaddr;
-
- rn = route_node_lookup (ifaddr_ipv4_table, (struct prefix *) &p);
- if (! rn)
- {
- zlog_info("%s: can't find address %pI4", __func__, ifaddr);
- return;
- }
- rn->info = NULL;
- route_unlock_node (rn);
- route_unlock_node (rn);
-}
-
-/* Lookup interface by interface's IP address or interface index. */
-static struct interface *
-ifaddr_ipv4_lookup (struct in_addr *addr, ifindex_t ifindex)
-{
- struct prefix_ipv4 p;
- struct route_node *rn;
- struct interface *ifp;
-
- if (addr)
- {
- p.family = AF_INET;
- p.prefixlen = IPV4_MAX_PREFIXLEN;
- p.prefix = *addr;
-
- rn = route_node_lookup (ifaddr_ipv4_table, (struct prefix *) &p);
- if (! rn)
- return NULL;
-
- ifp = rn->info;
- route_unlock_node (rn);
- return ifp;
- }
- else
- return if_lookup_by_index(ifindex, VRF_DEFAULT);
-}
-#endif /* ifaddr_ipv4_table */
-
void if_terminate(struct vrf *vrf)
{
struct interface *ifp;
diff --git a/lib/link_state.c b/lib/link_state.c
index f8fdda64f0..8dc5ab8eee 100644
--- a/lib/link_state.c
+++ b/lib/link_state.c
@@ -1273,10 +1273,8 @@ void ls_dump_ted(struct ls_ted *ted)
frr_each(subnets, &ted->subnets, subnet) {
ls_subnet2msg(&msg, subnet);
zlog_debug(
- "\tTed subnet key:%s vertex:%pI4 pfx:%pFX",
- subnet->key.family == AF_INET
- ? inet_ntoa(subnet->key.u.prefix4)
- : inet6_ntoa(subnet->key.u.prefix6),
+ "\tTed subnet key:%pFX vertex:%pI4 pfx:%pFX",
+ &subnet->key,
&subnet->vertex->node->adv.id.ip.addr,
&subnet->ls_pref->pref);
}
diff --git a/lib/printf/printf-pos.c b/lib/printf/printf-pos.c
index cc03f7ef9a..ac775bea4e 100644
--- a/lib/printf/printf-pos.c
+++ b/lib/printf/printf-pos.c
@@ -384,6 +384,7 @@ reswitch: switch (ch) {
goto error;
break;
#endif /* !NO_FLOATING_POINT */
+#ifdef DANGEROUS_PERCENT_N
case 'n':
if (flags & INTMAXT)
error = addtype(&types, TP_INTMAXT);
@@ -404,6 +405,7 @@ reswitch: switch (ch) {
if (error)
goto error;
continue; /* no output */
+#endif
case 'O':
flags |= LONGINT;
/*FALLTHROUGH*/
@@ -576,6 +578,7 @@ reswitch: switch (ch) {
goto error;
break;
#endif /* !NO_FLOATING_POINT */
+#ifdef DANGEROUS_PERCENT_N
case 'n':
if (flags & INTMAXT)
error = addtype(&types, TP_INTMAXT);
@@ -596,6 +599,7 @@ reswitch: switch (ch) {
if (error)
goto error;
continue; /* no output */
+#endif
case 'O':
flags |= LONGINT;
/*FALLTHROUGH*/
diff --git a/lib/printf/vfprintf.c b/lib/printf/vfprintf.c
index 6ffccb3811..a0634cde4b 100644
--- a/lib/printf/vfprintf.c
+++ b/lib/printf/vfprintf.c
@@ -503,6 +503,11 @@ reswitch: switch (ch) {
size = (prec >= 0) ? strnlen(cp, prec) : strlen(cp);
sign = '\0';
break;
+#ifdef DANGEROUS_PERCENT_N
+ /* FRR does not use %n in printf formats. This is just left
+ * here in case someone tries to use %n and starts debugging
+ * why the f* it doesn't work
+ */
case 'n':
/*
* Assignment-like behavior is specified if the
@@ -526,6 +531,7 @@ reswitch: switch (ch) {
else
*GETARG(int *) = ret;
continue; /* no output */
+#endif
case 'O':
flags |= LONGINT;
/*FALLTHROUGH*/
diff --git a/lib/route_types.pl b/lib/route_types.pl
index 759e9b4729..8c216e13bd 100755
--- a/lib/route_types.pl
+++ b/lib/route_types.pl
@@ -130,7 +130,7 @@ sub codelist {
$str =~ s/ $//;
push @lines, $str . "\\n\" \\\n";
push @lines, " \" > - selected route, * - FIB route, q - queued, r - rejected, b - backup\\n\"";
- push @lines, " \" t - trapped, o - offload failure\\n\"";
+ push @lines, " \" t - trapped, o - offload failure\\n\\n\"";
return join("", @lines);
diff --git a/lib/thread.c b/lib/thread.c
index c886058355..285b9b501a 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -119,7 +119,7 @@ static void vty_out_cpu_thread_history(struct vty *vty,
a->total_active, a->cpu.total / 1000, a->cpu.total % 1000,
a->total_calls, (a->cpu.total / a->total_calls), a->cpu.max,
(a->real.total / a->total_calls), a->real.max);
- vty_out(vty, " %c%c%c%c%c %s\n",
+ vty_out(vty, " %c%c%c%c%c %s\n",
a->types & (1 << THREAD_READ) ? 'R' : ' ',
a->types & (1 << THREAD_WRITE) ? 'W' : ' ',
a->types & (1 << THREAD_TIMER) ? 'T' : ' ',
@@ -188,7 +188,7 @@ static void cpu_record_print(struct vty *vty, uint8_t filter)
name);
vty_out(vty, "-------------------------------%s\n",
underline);
- vty_out(vty, "%21s %18s %18s\n", "",
+ vty_out(vty, "%30s %18s %18s\n", "",
"CPU (user+system):", "Real (wall-clock):");
vty_out(vty,
"Active Runtime(ms) Invoked Avg uSec Max uSecs");
@@ -211,7 +211,7 @@ static void cpu_record_print(struct vty *vty, uint8_t filter)
vty_out(vty, "\n");
vty_out(vty, "Total thread statistics\n");
vty_out(vty, "-------------------------\n");
- vty_out(vty, "%21s %18s %18s\n", "",
+ vty_out(vty, "%30s %18s %18s\n", "",
"CPU (user+system):", "Real (wall-clock):");
vty_out(vty, "Active Runtime(ms) Invoked Avg uSec Max uSecs");
vty_out(vty, " Avg uSec Max uSecs");
diff --git a/lib/vty.c b/lib/vty.c
index 21b3d47b09..4062b183e7 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -396,16 +396,6 @@ static void vty_do_window_size(struct vty *vty)
vty_out(vty, "%s", cmd);
}
-#if 0 /* Currently not used. */
-/* Make don't use lflow vty interface. */
-static void
-vty_dont_lflow_ahead (struct vty *vty)
-{
- unsigned char cmd[] = { IAC, DONT, TELOPT_LFLOW, '\0' };
- vty_out (vty, "%s", cmd);
-}
-#endif /* 0 */
-
/* Authentication of vty */
static void vty_auth(struct vty *vty, char *buf)
{
@@ -1090,11 +1080,6 @@ static void vty_describe_command(struct vty *vty)
vector_free(varcomps);
}
-#if 0
- vty_out (vty, " %-*s %s\n", width
- desc->cmd[0] == '.' ? desc->cmd + 1 : desc->cmd,
- desc->str ? desc->str : "");
-#endif /* 0 */
}
if ((token = token_cr)) {
@@ -1396,12 +1381,6 @@ static int vty_read(struct thread *thread)
case 'Q':
vty_buffer_reset(vty);
break;
-#if 0 /* More line does not work for "show ip bgp". */
- case '\n':
- case '\r':
- vty->status = VTY_MORELINE;
- break;
-#endif
default:
break;
}
diff --git a/lib/workqueue.c b/lib/workqueue.c
index f8e4677220..8eabdf52e7 100644
--- a/lib/workqueue.c
+++ b/lib/workqueue.c
@@ -377,11 +377,6 @@ stats:
if (yielded)
wq->yields++;
-#if 0
- printf ("%s: cycles %d, new: best %d, worst %d\n",
- __func__, cycles, wq->cycles.best, wq->cycles.granularity);
-#endif
-
/* Is the queue done yet? If it is, call the completion callback. */
if (!work_queue_empty(wq)) {
if (ret == WQ_RETRY_LATER ||
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c
index eee98275ec..7bd51138b3 100644
--- a/ospf6d/ospf6_abr.c
+++ b/ospf6d/ospf6_abr.c
@@ -160,35 +160,22 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
&& route->type != OSPF6_DEST_TYPE_RANGE
&& ((route->type != OSPF6_DEST_TYPE_ROUTER)
|| !CHECK_FLAG(route->path.router_bits, OSPF6_ROUTER_BIT_E))) {
-#if 0
- zlog_debug(
- "Route type is none of network, range nor ASBR, ignore");
-#endif
return 0;
}
/* AS External routes are never considered */
if (route->path.type == OSPF6_PATH_TYPE_EXTERNAL1
|| route->path.type == OSPF6_PATH_TYPE_EXTERNAL2) {
-#if 0
- zlog_debug("Path type is external, skip");
-#endif
return 0;
}
/* do not generate if the path's area is the same as target area */
if (route->path.area_id == area->area_id) {
-#if 0
- zlog_debug("The route is in the area itself, ignore");
-#endif
return 0;
}
/* do not generate if the nexthops belongs to the target area */
if (ospf6_abr_nexthops_belong_to_area(route, area)) {
-#if 0
- zlog_debug("The route's nexthop is in the same area, ignore");
-#endif
return 0;
}
diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c
index 0662cfd683..2d896546fa 100644
--- a/ospf6d/ospf6_flood.c
+++ b/ospf6d/ospf6_flood.c
@@ -452,12 +452,6 @@ void ospf6_flood_area(struct ospf6_neighbor *from, struct ospf6_lsa *lsa,
&& oi != OSPF6_INTERFACE(lsa->lsdb->data))
continue;
-#if 0
- if (OSPF6_LSA_SCOPE (lsa->header->type) == OSPF6_SCOPE_AS &&
- ospf6_is_interface_virtual_link (oi))
- continue;
-#endif /*0*/
-
ospf6_flood_interface(from, lsa, oi);
}
}
@@ -527,12 +521,6 @@ static void ospf6_flood_clear_area(struct ospf6_lsa *lsa, struct ospf6_area *oa)
&& oi != OSPF6_INTERFACE(lsa->lsdb->data))
continue;
-#if 0
- if (OSPF6_LSA_SCOPE (lsa->header->type) == OSPF6_SCOPE_AS &&
- ospf6_is_interface_virtual_link (oi))
- continue;
-#endif /*0*/
-
ospf6_flood_clear_interface(lsa, oi);
}
}
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 212f59965d..27d81beaec 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -719,39 +719,6 @@ DEFUN (no_ospf6_distance_ospf6,
return CMD_SUCCESS;
}
-#if 0
-DEFUN (ospf6_distance_source,
- ospf6_distance_source_cmd,
- "distance (1-255) X:X::X:X/M [WORD]",
- "Administrative distance\n"
- "Distance value\n"
- "IP source prefix\n"
- "Access list name\n")
-{
- VTY_DECLVAR_CONTEXT(ospf6, o);
- char *alname = (argc == 4) ? argv[3]->arg : NULL;
- ospf6_distance_set (vty, o, argv[1]->arg, argv[2]->arg, alname);
-
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ospf6_distance_source,
- no_ospf6_distance_source_cmd,
- "no distance (1-255) X:X::X:X/M [WORD]",
- NO_STR
- "Administrative distance\n"
- "Distance value\n"
- "IP source prefix\n"
- "Access list name\n")
-{
- VTY_DECLVAR_CONTEXT(ospf6, o);
- char *alname = (argc == 5) ? argv[4]->arg : NULL;
- ospf6_distance_unset (vty, o, argv[2]->arg, argv[3]->arg, alname);
-
- return CMD_SUCCESS;
-}
-#endif
-
DEFUN (ospf6_interface_area,
ospf6_interface_area_cmd,
"interface IFNAME area <A.B.C.D|(0-4294967295)>",
@@ -912,55 +879,6 @@ DEFUN (no_ospf6_stub_router_admin,
return CMD_SUCCESS;
}
-#if 0
-DEFUN (ospf6_stub_router_startup,
- ospf6_stub_router_startup_cmd,
- "stub-router on-startup (5-86400)",
- "Make router a stub router\n"
- "Advertise inability to be a transit router\n"
- "Automatically advertise as stub-router on startup of OSPF6\n"
- "Time (seconds) to advertise self as stub-router\n")
-{
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ospf6_stub_router_startup,
- no_ospf6_stub_router_startup_cmd,
- "no stub-router on-startup",
- NO_STR
- "Make router a stub router\n"
- "Advertise inability to be a transit router\n"
- "Automatically advertise as stub-router on startup of OSPF6\n"
- "Time (seconds) to advertise self as stub-router\n")
-{
- return CMD_SUCCESS;
-}
-
-DEFUN (ospf6_stub_router_shutdown,
- ospf6_stub_router_shutdown_cmd,
- "stub-router on-shutdown (5-86400)",
- "Make router a stub router\n"
- "Advertise inability to be a transit router\n"
- "Automatically advertise as stub-router before shutdown\n"
- "Time (seconds) to advertise self as stub-router\n")
-{
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ospf6_stub_router_shutdown,
- no_ospf6_stub_router_shutdown_cmd,
- "no stub-router on-shutdown",
- NO_STR
- "Make router a stub router\n"
- "Advertise inability to be a transit router\n"
- "Automatically advertise as stub-router before shutdown\n"
- "Time (seconds) to advertise self as stub-router\n")
-{
- return CMD_SUCCESS;
-}
-#endif
-
-
static void ospf6_show(struct vty *vty, struct ospf6 *o, json_object *json,
bool use_json)
{
@@ -1396,20 +1314,9 @@ void ospf6_top_init(void)
install_element(OSPF6_NODE, &no_ospf6_interface_area_cmd);
install_element(OSPF6_NODE, &ospf6_stub_router_admin_cmd);
install_element(OSPF6_NODE, &no_ospf6_stub_router_admin_cmd);
-/* For a later time */
-#if 0
- install_element (OSPF6_NODE, &ospf6_stub_router_startup_cmd);
- install_element (OSPF6_NODE, &no_ospf6_stub_router_startup_cmd);
- install_element (OSPF6_NODE, &ospf6_stub_router_shutdown_cmd);
- install_element (OSPF6_NODE, &no_ospf6_stub_router_shutdown_cmd);
-#endif
install_element(OSPF6_NODE, &ospf6_distance_cmd);
install_element(OSPF6_NODE, &no_ospf6_distance_cmd);
install_element(OSPF6_NODE, &ospf6_distance_ospf6_cmd);
install_element(OSPF6_NODE, &no_ospf6_distance_ospf6_cmd);
-#if 0
- install_element (OSPF6_NODE, &ospf6_distance_source_cmd);
- install_element (OSPF6_NODE, &no_ospf6_distance_source_cmd);
-#endif
}
diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c
index e18d8ddb31..51da4a55a7 100644
--- a/ospfd/ospf_ase.c
+++ b/ospfd/ospf_ase.c
@@ -156,84 +156,6 @@ static int ospf_ase_forward_address_check(struct ospf *ospf,
return 1;
}
-#if 0
-/* Calculate ASBR route. */
-static struct ospf_route *
-ospf_ase_calculate_asbr_route (struct ospf *ospf,
- struct route_table *rt_network,
- struct route_table *rt_router,
- struct as_external_lsa *al)
-{
- struct prefix_ipv4 asbr;
- struct ospf_route *asbr_route;
- struct route_node *rn;
-
- /* Find ASBR route from Router routing table. */
- asbr.family = AF_INET;
- asbr.prefix = al->header.adv_router;
- asbr.prefixlen = IPV4_MAX_BITLEN;
- apply_mask_ipv4 (&asbr);
-
- asbr_route = ospf_find_asbr_route (ospf, rt_router, &asbr);
-
- if (asbr_route == NULL)
- {
- if (IS_DEBUG_OSPF (lsa, LSA))
- zlog_debug ("ospf_ase_calculate(): Route to ASBR %pI4 not found",
- &asbr.prefix);
- return NULL;
- }
-
- if (!(asbr_route->u.std.flags & ROUTER_LSA_EXTERNAL))
- {
- if (IS_DEBUG_OSPF (lsa, LSA))
- zlog_debug ("ospf_ase_calculate(): Originating router is not an ASBR");
- return NULL;
- }
-
- if (al->e[0].fwd_addr.s_addr != INADDR_ANY)
- {
- if (IS_DEBUG_OSPF (lsa, LSA))
- zlog_debug ("ospf_ase_calculate(): Forwarding address is not 0.0.0.0.");
-
- if (! ospf_ase_forward_address_check (ospf, al->e[0].fwd_addr))
- {
- if (IS_DEBUG_OSPF (lsa, LSA))
- zlog_debug ("ospf_ase_calculate(): Forwarding address is one of our addresses, Ignore.");
- return NULL;
- }
-
- if (IS_DEBUG_OSPF (lsa, LSA))
- zlog_debug ("ospf_ase_calculate(): Looking up in the Network Routing Table.");
-
- /* Looking up the path to the fwd_addr from Network route. */
- asbr.family = AF_INET;
- asbr.prefix = al->e[0].fwd_addr;
- asbr.prefixlen = IPV4_MAX_BITLEN;
-
- rn = route_node_match (rt_network, (struct prefix *) &asbr);
-
- if (rn == NULL)
- {
- if (IS_DEBUG_OSPF (lsa, LSA))
- zlog_debug ("ospf_ase_calculate(): Couldn't find a route to the forwarding address.");
- return NULL;
- }
-
- route_unlock_node (rn);
-
- if ((asbr_route = rn->info) == NULL)
- {
- if (IS_DEBUG_OSPF (lsa, LSA))
- zlog_debug ("ospf_ase_calculate(): Somehow OSPF route to ASBR is lost");
- return NULL;
- }
- }
-
- return asbr_route;
-}
-#endif
-
static struct ospf_route *
ospf_ase_calculate_new_route(struct ospf_lsa *lsa,
struct ospf_route *asbr_route, uint32_t metric)
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index 72201355e7..6ed0497562 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -2163,12 +2163,6 @@ void ospf_external_lsa_flush(struct ospf *ospf, uint8_t type,
/* Sweep LSA from Link State Retransmit List. */
ospf_ls_retransmit_delete_nbr_as(ospf, lsa);
-/* There must be no self-originated LSA in rtrs_external. */
-#if 0
- /* Remove External route from Zebra. */
- ospf_zebra_delete ((struct prefix_ipv4 *) p, &nexthop);
-#endif
-
if (!IS_LSA_MAXAGE(lsa)) {
/* Unregister LSA from Refresh queue. */
ospf_refresher_unregister_lsa(ospf, lsa);
@@ -2440,12 +2434,7 @@ ospf_summary_lsa_install(struct ospf *ospf, struct ospf_lsa *new, int rt_recalc)
necessary to re-examine all the AS-external-LSAs.
*/
-#if 0
- /* This doesn't exist yet... */
- ospf_summary_incremental_update(new); */
-#else /* #if 0 */
ospf_spf_calculate_schedule(ospf, SPF_FLAG_SUMMARY_LSA_INSTALL);
-#endif /* #if 0 */
}
if (IS_LSA_SELF(new))
@@ -2466,16 +2455,8 @@ static struct ospf_lsa *ospf_summary_asbr_lsa_install(struct ospf *ospf,
destination is an AS boundary router, it may also be
necessary to re-examine all the AS-external-LSAs.
*/
-#if 0
- /* These don't exist yet... */
- ospf_summary_incremental_update(new);
- /* Isn't this done by the above call?
- - RFC 2328 Section 16.5 implies it should be */
- /* ospf_ase_calculate_schedule(); */
-#else /* #if 0 */
ospf_spf_calculate_schedule(ospf,
SPF_FLAG_ASBR_SUMMARY_LSA_INSTALL);
-#endif /* #if 0 */
}
/* register LSA to refresh-list. */
@@ -2854,9 +2835,10 @@ static int ospf_maxage_lsa_remover(struct thread *thread)
*/
if (old != lsa) {
flog_err(EC_OSPF_LSA_MISSING,
- "%s: LSA[Type%d:%s]: LSA not in LSDB",
- __func__, lsa->data->type,
- inet_ntoa(lsa->data->id));
+ "%s: LSA[Type%d:%pI4]: LSA not in LSDB",
+ __func__, lsa->data->type,
+ &lsa->data->id);
+
continue;
}
ospf_discard_from_db(ospf, lsa->lsdb, lsa);
diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c
index 66dd9c7ca4..3f4ca44b05 100644
--- a/ospfd/ospf_snmp.c
+++ b/ospfd/ospf_snmp.c
@@ -1236,7 +1236,6 @@ static struct ospf_nbr_nbma *ospfHostLookup(struct variable *v, oid *name,
size_t *length,
struct in_addr *addr, int exact)
{
- int len;
struct ospf_nbr_nbma *nbr_nbma;
struct ospf *ospf;
@@ -1258,28 +1257,8 @@ static struct ospf_nbr_nbma *ospfHostLookup(struct variable *v, oid *name,
nbr_nbma = ospf_nbr_nbma_lookup(ospf, *addr);
return nbr_nbma;
- } else {
- len = *length - v->namelen;
- if (len > 4)
- len = 4;
-
- oid2in_addr(name + v->namelen, len, addr);
-
- nbr_nbma =
- ospf_nbr_nbma_lookup_next(ospf, addr, len == 0 ? 1 : 0);
-
- if (nbr_nbma == NULL)
- return NULL;
-
- oid_copy_addr(name + v->namelen, addr, IN_ADDR_SIZE);
-
- /* Set TOS 0. */
- name[v->namelen + IN_ADDR_SIZE] = 0;
-
- *length = v->namelen + IN_ADDR_SIZE + 1;
-
- return nbr_nbma;
}
+
return NULL;
}
diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c
index fae4f1e10c..82acd0829c 100644
--- a/ospfd/ospf_spf.c
+++ b/ospfd/ospf_spf.c
@@ -1683,68 +1683,6 @@ void ospf_spf_cleanup(struct vertex *spf, struct list *vertex_list)
list_delete(&vertex_list);
}
-#if 0
-static void
-ospf_rtrs_print (struct route_table *rtrs)
-{
- struct route_node *rn;
- struct list *or_list;
- struct listnode *ln;
- struct listnode *pnode;
- struct ospf_route *or;
- struct ospf_path *path;
- char buf1[BUFSIZ];
- char buf2[BUFSIZ];
-
- if (IS_DEBUG_OSPF_EVENT)
- zlog_debug ("ospf_rtrs_print() start");
-
- for (rn = route_top (rtrs); rn; rn = route_next (rn))
- if ((or_list = rn->info) != NULL)
- for (ALL_LIST_ELEMENTS_RO (or_list, ln, or))
- {
- switch (or->path_type)
- {
- case OSPF_PATH_INTRA_AREA:
- if (IS_DEBUG_OSPF_EVENT)
- zlog_debug ("%s [%d] area: %s",
- inet_ntop (AF_INET, &or->id, buf1, BUFSIZ),
- or->cost, inet_ntop (AF_INET, &or->u.std.area_id,
- buf2, BUFSIZ));
- break;
- case OSPF_PATH_INTER_AREA:
- if (IS_DEBUG_OSPF_EVENT)
- zlog_debug ("%s IA [%d] area: %s",
- inet_ntop (AF_INET, &or->id, buf1, BUFSIZ),
- or->cost, inet_ntop (AF_INET, &or->u.std.area_id,
- buf2, BUFSIZ));
- break;
- default:
- break;
- }
-
- for (ALL_LIST_ELEMENTS_RO (or->paths, pnode, path))
- {
- if (path->nexthop.s_addr == INADDR_ANY)
- {
- if (IS_DEBUG_OSPF_EVENT)
- zlog_debug (" directly attached to %s\r",
- ifindex2ifname (path->ifindex), VRF_DEFAULT);
- }
- else
- {
- if (IS_DEBUG_OSPF_EVENT)
- zlog_debug (" via %pI4, %s\r",
- &path->nexthop,
- ifindex2ifname (path->ifindex), VRF_DEFAULT);
- }
- }
- }
-
- zlog_debug ("ospf_rtrs_print() end");
-}
-#endif
-
/* Calculating the shortest-path tree for an area, see RFC2328 16.1. */
void ospf_spf_calculate(struct ospf_area *area, struct ospf_lsa *root_lsa,
struct route_table *new_table,
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index a4a220b1f6..949582278f 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -6406,31 +6406,7 @@ static int show_as_external_lsa_detail(struct vty *vty, struct ospf_lsa *lsa,
return 0;
}
-#if 0
-static int
-show_as_external_lsa_stdvty (struct ospf_lsa *lsa)
-{
- struct as_external_lsa *al = (struct as_external_lsa *) lsa->data;
-
- /* show_ip_ospf_database_header (vty, lsa); */
-
- zlog_debug( " Network Mask: /%d%s",
- ip_masklen (al->mask), "\n");
- zlog_debug( " Metric Type: %s%s",
- IS_EXTERNAL_METRIC (al->e[0].tos) ?
- "2 (Larger than any link state path)" : "1", "\n");
- zlog_debug( " TOS: 0%s", "\n");
- zlog_debug( " Metric: %d%s",
- GET_METRIC (al->e[0].metric), "\n");
- zlog_debug( " Forward Address: %pI4%s",
- &al->e[0].fwd_addr, "\n");
- zlog_debug( " External Route Tag: %"ROUTE_TAG_PRI"%s%s",
- (route_tag_t)ntohl (al->e[0].route_tag), "\n", "\n");
-
- return 0;
-}
-#endif
/* Show AS-NSSA-LSA detail information. */
static int show_as_nssa_lsa_detail(struct vty *vty, struct ospf_lsa *lsa,
json_object *json)
@@ -9467,78 +9443,6 @@ DEFUN (ospf_distance_ospf,
return CMD_SUCCESS;
}
-#if 0
-DEFUN (ospf_distance_source,
- ospf_distance_source_cmd,
- "distance (1-255) A.B.C.D/M",
- "Administrative distance\n"
- "Distance value\n"
- "IP source prefix\n")
-{
- VTY_DECLVAR_CONTEXT(ospf, ospf);
- int idx_number = 1;
- int idx_ipv4_prefixlen = 2;
-
- ospf_distance_set (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, NULL);
-
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ospf_distance_source,
- no_ospf_distance_source_cmd,
- "no distance (1-255) A.B.C.D/M",
- NO_STR
- "Administrative distance\n"
- "Distance value\n"
- "IP source prefix\n")
-{
- VTY_DECLVAR_CONTEXT(ospf, ospf);
- int idx_number = 2;
- int idx_ipv4_prefixlen = 3;
-
- ospf_distance_unset (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, NULL);
-
- return CMD_SUCCESS;
-}
-
-DEFUN (ospf_distance_source_access_list,
- ospf_distance_source_access_list_cmd,
- "distance (1-255) A.B.C.D/M WORD",
- "Administrative distance\n"
- "Distance value\n"
- "IP source prefix\n"
- "Access list name\n")
-{
- VTY_DECLVAR_CONTEXT(ospf, ospf);
- int idx_number = 1;
- int idx_ipv4_prefixlen = 2;
- int idx_word = 3;
-
- ospf_distance_set (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, argv[idx_word]->arg);
-
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ospf_distance_source_access_list,
- no_ospf_distance_source_access_list_cmd,
- "no distance (1-255) A.B.C.D/M WORD",
- NO_STR
- "Administrative distance\n"
- "Distance value\n"
- "IP source prefix\n"
- "Access list name\n")
-{
- VTY_DECLVAR_CONTEXT(ospf, ospf);
- int idx_number = 2;
- int idx_ipv4_prefixlen = 3;
- int idx_word = 4;
-
- ospf_distance_unset (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, argv[idx_word]->arg);
-
- return CMD_SUCCESS;
-}
-#endif
-
DEFUN (ip_ospf_mtu_ignore,
ip_ospf_mtu_ignore_addr_cmd,
"ip ospf mtu-ignore [A.B.C.D]",
@@ -12653,13 +12557,6 @@ static void ospf_vty_zebra_init(void)
&no_ospf_external_route_aggregation_no_adrvertise_cmd);
install_element(OSPF_NODE, &ospf_route_aggregation_timer_cmd);
install_element(OSPF_NODE, &no_ospf_route_aggregation_timer_cmd);
-
-#if 0
- install_element (OSPF_NODE, &ospf_distance_source_cmd);
- install_element (OSPF_NODE, &no_ospf_distance_source_cmd);
- install_element (OSPF_NODE, &ospf_distance_source_access_list_cmd);
- install_element (OSPF_NODE, &no_ospf_distance_source_access_list_cmd);
-#endif /* 0 */
}
static int ospf_config_write(struct vty *vty);
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 56424abeca..04397d50a5 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -1739,26 +1739,6 @@ int ospf_area_nssa_translator_role_set(struct ospf *ospf,
return 1;
}
-#if 0
-/* XXX: unused? Leave for symmetry? */
-static int
-ospf_area_nssa_translator_role_unset (struct ospf *ospf,
- struct in_addr area_id)
-{
- struct ospf_area *area;
-
- area = ospf_area_lookup_by_area_id (ospf, area_id);
- if (area == NULL)
- return 0;
-
- area->NSSATranslatorRole = OSPF_NSSA_ROLE_CANDIDATE;
-
- ospf_area_check_free (ospf, area_id);
-
- return 1;
-}
-#endif
-
int ospf_area_export_list_set(struct ospf *ospf, struct ospf_area *area,
const char *list_name)
{
@@ -2001,35 +1981,6 @@ struct ospf_nbr_nbma *ospf_nbr_nbma_lookup(struct ospf *ospf,
return NULL;
}
-struct ospf_nbr_nbma *ospf_nbr_nbma_lookup_next(struct ospf *ospf,
- struct in_addr *addr, int first)
-{
-#if 0
- struct ospf_nbr_nbma *nbr_nbma;
- struct listnode *node;
-#endif
-
- if (ospf == NULL)
- return NULL;
-
-#if 0
- for (ALL_LIST_ELEMENTS_RO (ospf->nbr_nbma, node, nbr_nbma))
- {
- if (first)
- {
- *addr = nbr_nbma->addr;
- return nbr_nbma;
- }
- else if (ntohl (nbr_nbma->addr.s_addr) > ntohl (addr->s_addr))
- {
- *addr = nbr_nbma->addr;
- return nbr_nbma;
- }
- }
-#endif
- return NULL;
-}
-
int ospf_nbr_nbma_set(struct ospf *ospf, struct in_addr nbr_addr)
{
struct ospf_nbr_nbma *nbr_nbma;
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index 9d5aa6a4f9..954a469b68 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -694,8 +694,6 @@ extern void ospf_terminate(void);
extern void ospf_nbr_nbma_if_update(struct ospf *, struct ospf_interface *);
extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup(struct ospf *,
struct in_addr);
-extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup_next(struct ospf *,
- struct in_addr *, int);
extern int ospf_oi_count(struct interface *);
extern struct ospf_area *ospf_area_new(struct ospf *ospf,
diff --git a/pbrd/pbr_nht.c b/pbrd/pbr_nht.c
index f99971ab7b..723374d9d6 100644
--- a/pbrd/pbr_nht.c
+++ b/pbrd/pbr_nht.c
@@ -320,13 +320,6 @@ void pbr_nhgroup_delete_cb(const char *name)
pbr_map_check_nh_group_change(name);
}
-#if 0
-static struct pbr_nexthop_cache *pbr_nht_lookup_nexthop(struct nexthop *nexthop)
-{
- return NULL;
-}
-#endif
-
static void
pbr_nht_find_nhg_from_table_update(struct pbr_nexthop_group_cache *pnhgc,
uint32_t table_id, bool installed)
diff --git a/pimd/pim_hello.c b/pimd/pim_hello.c
index e50504ec10..6f5c4174e2 100644
--- a/pimd/pim_hello.c
+++ b/pimd/pim_hello.c
@@ -95,22 +95,6 @@ static void tlv_trace_uint32_hex(const char *label, const char *tlv_name,
}
}
-#if 0
-static void tlv_trace(const char *label, const char *tlv_name,
- const char *ifname, struct in_addr src_addr,
- int isset)
-{
- if (isset) {
- char src_str[INET_ADDRSTRLEN];
- pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
- zlog_debug("%s: PIM hello option from %s on interface %s: %s",
- label,
- src_str, ifname,
- tlv_name);
- }
-}
-#endif
-
static void tlv_trace_list(const char *label, const char *tlv_name,
const char *ifname, struct in_addr src_addr,
int isset, struct list *addr_list)
diff --git a/pimd/test_igmpv3_join.c b/pimd/test_igmpv3_join.c
index bf44f3c94a..3c26517e88 100644
--- a/pimd/test_igmpv3_join.c
+++ b/pimd/test_igmpv3_join.c
@@ -54,11 +54,6 @@ static int iface_solve_index(const char *ifname)
}
for (i = 0; ini[i].if_index; ++i) {
-#if 0
- fprintf(stderr,
- "%s: interface=%s matching against local ifname=%s ifindex=%d\n",
- prog_name, ifname, ini[i].if_name, ini[i].if_index);
-#endif
if (!strcmp(ini[i].if_name, ifname)) {
ifindex = ini[i].if_index;
break;
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index c601ab4047..89e7e5dc17 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -208,39 +208,6 @@ static void rip_request_interface(struct interface *ifp)
rip_request_interface_send(ifp, RIPv2);
}
-#if 0
-/* Send RIP request to the neighbor. */
-static void
-rip_request_neighbor (struct in_addr addr)
-{
- struct sockaddr_in to;
-
- memset (&to, 0, sizeof(struct sockaddr_in));
- to.sin_port = htons (RIP_PORT_DEFAULT);
- to.sin_addr = addr;
-
- rip_request_send (&to, NULL, rip->version_send, NULL);
-}
-
-/* Request routes at all interfaces. */
-static void
-rip_request_neighbor_all (void)
-{
- struct route_node *rp;
-
- if (! rip)
- return;
-
- if (IS_RIP_DEBUG_EVENT)
- zlog_debug ("request to the all neighbor");
-
- /* Send request to all neighbor. */
- for (rp = route_top (rip->neighbor); rp; rp = route_next (rp))
- if (rp->info)
- rip_request_neighbor (rp->p.u.prefix4);
-}
-#endif
-
/* Multicast packet receive socket. */
static int rip_multicast_join(struct interface *ifp, int sock)
{
diff --git a/ripd/rip_snmp.c b/ripd/rip_snmp.c
index be222c7a5f..4e6ed1400f 100644
--- a/ripd/rip_snmp.c
+++ b/ripd/rip_snmp.c
@@ -547,18 +547,7 @@ static uint8_t *rip2PeerTable(struct variable *v, oid name[], size_t *length,
return (uint8_t *)&domain;
case RIP2PEERLASTUPDATE:
-#if 0
- /* We don't know the SNMP agent startup time. We have two choices here:
- * - assume ripd startup time equals SNMP agent startup time
- * - don't support this variable, at all
- * Currently, we do the latter...
- */
- *val_len = sizeof(time_t);
- uptime = peer->uptime; /* now - snmp_agent_startup - peer->uptime */
- return (uint8_t *) &uptime;
-#else
return (uint8_t *)NULL;
-#endif
case RIP2PEERVERSION:
*val_len = sizeof(int);
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 82dd401f96..a276dedec8 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -2858,23 +2858,6 @@ void rip_event(struct rip *rip, enum rip_event event, int sock)
}
}
-#if 0
-static void
-rip_update_default_metric (void)
-{
- struct route_node *np;
- struct rip_info *rinfo = NULL;
- struct list *list = NULL;
- struct listnode *listnode = NULL;
-
- for (np = route_top (rip->table); np; np = route_next (np))
- if ((list = np->info) != NULL)
- for (ALL_LIST_ELEMENTS_RO (list, listnode, rinfo))
- if (rinfo->type != ZEBRA_ROUTE_RIP && rinfo->type != ZEBRA_ROUTE_CONNECT)
- rinfo->metric = rip->default_metric;
-}
-#endif
-
struct rip_distance *rip_distance_new(void)
{
return XCALLOC(MTYPE_RIP_DISTANCE, sizeof(struct rip_distance));
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index 1ebdae43fb..a9f570598f 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -2217,136 +2217,6 @@ DEFUN (show_ipv6_ripng_status,
return CMD_SUCCESS;
}
-#if 0
-/* RIPng update timer setup. */
-DEFUN (ripng_update_timer,
- ripng_update_timer_cmd,
- "update-timer SECOND",
- "Set RIPng update timer in seconds\n"
- "Seconds\n")
-{
- unsigned long update;
- char *endptr = NULL;
-
- update = strtoul (argv[0], &endptr, 10);
- if (update == ULONG_MAX || *endptr != '\0')
- {
- vty_out (vty, "update timer value error\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- ripng->update_time = update;
-
- ripng_event (RIPNG_UPDATE_EVENT, 0);
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ripng_update_timer,
- no_ripng_update_timer_cmd,
- "no update-timer SECOND",
- NO_STR
- "Unset RIPng update timer in seconds\n"
- "Seconds\n")
-{
- ripng->update_time = RIPNG_UPDATE_TIMER_DEFAULT;
- ripng_event (RIPNG_UPDATE_EVENT, 0);
- return CMD_SUCCESS;
-}
-
-/* RIPng timeout timer setup. */
-DEFUN (ripng_timeout_timer,
- ripng_timeout_timer_cmd,
- "timeout-timer SECOND",
- "Set RIPng timeout timer in seconds\n"
- "Seconds\n")
-{
- unsigned long timeout;
- char *endptr = NULL;
-
- timeout = strtoul (argv[0], &endptr, 10);
- if (timeout == ULONG_MAX || *endptr != '\0')
- {
- vty_out (vty, "timeout timer value error\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- ripng->timeout_time = timeout;
-
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ripng_timeout_timer,
- no_ripng_timeout_timer_cmd,
- "no timeout-timer SECOND",
- NO_STR
- "Unset RIPng timeout timer in seconds\n"
- "Seconds\n")
-{
- ripng->timeout_time = RIPNG_TIMEOUT_TIMER_DEFAULT;
- return CMD_SUCCESS;
-}
-
-/* RIPng garbage timer setup. */
-DEFUN (ripng_garbage_timer,
- ripng_garbage_timer_cmd,
- "garbage-timer SECOND",
- "Set RIPng garbage timer in seconds\n"
- "Seconds\n")
-{
- unsigned long garbage;
- char *endptr = NULL;
-
- garbage = strtoul (argv[0], &endptr, 10);
- if (garbage == ULONG_MAX || *endptr != '\0')
- {
- vty_out (vty, "garbage timer value error\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- ripng->garbage_time = garbage;
-
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ripng_garbage_timer,
- no_ripng_garbage_timer_cmd,
- "no garbage-timer SECOND",
- NO_STR
- "Unset RIPng garbage timer in seconds\n"
- "Seconds\n")
-{
- ripng->garbage_time = RIPNG_GARBAGE_TIMER_DEFAULT;
- return CMD_SUCCESS;
-}
-#endif /* 0 */
-
-#if 0
-DEFUN (show_ipv6_protocols,
- show_ipv6_protocols_cmd,
- "show ipv6 protocols",
- SHOW_STR
- IPV6_STR
- "Routing protocol information\n")
-{
- if (! ripng)
- return CMD_SUCCESS;
-
- vty_out (vty, "Routing Protocol is \"ripng\"\n");
-
- vty_out (vty, "Sending updates every %ld seconds, next due in %d seconds\n",
- ripng->update_time, 0);
-
- vty_out (vty, "Timerout after %ld seconds, garbage correct %ld\n",
- ripng->timeout_time,
- ripng->garbage_time);
-
- vty_out (vty, "Outgoing update filter list for all interfaces is not set");
- vty_out (vty, "Incoming update filter list for all interfaces is not set");
-
- return CMD_SUCCESS;
-}
-#endif
-
/* Update ECMP routes to zebra when ECMP is disabled. */
void ripng_ecmp_disable(struct ripng *ripng)
{
@@ -2847,16 +2717,6 @@ void ripng_init(void)
install_default(RIPNG_NODE);
-#if 0
- install_element (VIEW_NODE, &show_ipv6_protocols_cmd);
- install_element (RIPNG_NODE, &ripng_update_timer_cmd);
- install_element (RIPNG_NODE, &no_ripng_update_timer_cmd);
- install_element (RIPNG_NODE, &ripng_timeout_timer_cmd);
- install_element (RIPNG_NODE, &no_ripng_timeout_timer_cmd);
- install_element (RIPNG_NODE, &ripng_garbage_timer_cmd);
- install_element (RIPNG_NODE, &no_ripng_garbage_timer_cmd);
-#endif /* 0 */
-
ripng_if_init();
ripng_debug_init();
diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h
index a42c32ebb7..14ac29b3fe 100644
--- a/ripngd/ripngd.h
+++ b/ripngd/ripngd.h
@@ -230,35 +230,6 @@ struct ripng_info {
struct agg_node *rp;
};
-#ifdef notyet
-#if 0
-/* RIPng tag structure. */
-struct ripng_tag
-{
- /* Tag value. */
- uint16_t tag;
-
- /* Port. */
- uint16_t port;
-
- /* Multicast group. */
- struct in6_addr maddr;
-
- /* Table number. */
- int table;
-
- /* Distance. */
- int distance;
-
- /* Split horizon. */
- uint8_t split_horizon;
-
- /* Poison reverse. */
- uint8_t poison_reverse;
-};
-#endif /* 0 */
-#endif /* not yet */
-
typedef enum {
RIPNG_NO_SPLIT_HORIZON = 0,
RIPNG_SPLIT_HORIZON,
@@ -294,13 +265,6 @@ struct ripng_interface {
/* Route-map. */
struct route_map *routemap[RIPNG_FILTER_MAX];
-#ifdef notyet
-#if 0
- /* RIPng tag configuration. */
- struct ripng_tag *rtag;
-#endif /* 0 */
-#endif /* notyet */
-
/* Default information originate. */
uint8_t default_originate;
diff --git a/tests/topotests/all-protocol-startup/r1/ip_nht.ref b/tests/topotests/all-protocol-startup/r1/ip_nht.ref
index 098e3bf387..1da4da4df5 100644
--- a/tests/topotests/all-protocol-startup/r1/ip_nht.ref
+++ b/tests/topotests/all-protocol-startup/r1/ip_nht.ref
@@ -39,6 +39,18 @@
4.4.4.2
unresolved
Client list: pbr(fd XX)
+6.6.6.1
+ unresolved
+ Client list: pbr(fd XX)
+6.6.6.2
+ unresolved
+ Client list: pbr(fd XX)
+6.6.6.3
+ unresolved
+ Client list: pbr(fd XX)
+6.6.6.4
+ unresolved
+ Client list: pbr(fd XX)
192.168.0.2
resolved via connected
is directly connected, r1-eth0
diff --git a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
index 24bef07ec2..5942aca71d 100644
--- a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
+++ b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
@@ -82,6 +82,7 @@ class NetworkTopo(Topo):
##
#####################################################
+
@pytest.mark.isis
@pytest.mark.ospf
@pytest.mark.rip
@@ -344,7 +345,7 @@ def test_converge_protocols():
actual = (
net["r%s" % i]
.cmd(
- 'vtysh -c "show ip route" | /usr/bin/tail -n +7 | env LC_ALL=en_US.UTF-8 sort 2> /dev/null'
+ 'vtysh -c "show ip route" | sed -e \'/^Codes: /,/^\s*$/d\' | env LC_ALL=en_US.UTF-8 sort 2> /dev/null'
)
.rstrip()
)
@@ -375,7 +376,7 @@ def test_converge_protocols():
actual = (
net["r%s" % i]
.cmd(
- 'vtysh -c "show ipv6 route" | /usr/bin/tail -n +7 | env LC_ALL=en_US.UTF-8 sort 2> /dev/null'
+ 'vtysh -c "show ipv6 route" | sed -e \'/^Codes: /,/^\s*$/d\' | env LC_ALL=en_US.UTF-8 sort 2> /dev/null'
)
.rstrip()
)
@@ -537,6 +538,51 @@ def test_nexthop_groups():
verify_route_nexthop_group("5.5.5.1/32")
+ ## 4-way ECMP Routes Pointing to Each Other
+
+ # This is to check for a bug with NH resolution where
+ # routes would infintely resolve to each other blowing
+ # up the resolved-> nexthop pointer.
+
+ net["r1"].cmd(
+ 'vtysh -c "c t" -c "nexthop-group infinite-recursive" -c "nexthop 6.6.6.1" -c "nexthop 6.6.6.2" \
+ -c "nexthop 6.6.6.3" -c "nexthop 6.6.6.4"'
+ )
+
+ # static route nexthops can recurse to
+
+ net["r1"].cmd('vtysh -c "c t" -c "ip route 6.6.6.0/24 1.1.1.1"')
+
+ # Make routes that point to themselves in ecmp
+
+ net["r1"].cmd(
+ 'vtysh -c "sharp install routes 6.6.6.4 nexthop-group infinite-recursive 1"'
+ )
+
+ net["r1"].cmd(
+ 'vtysh -c "sharp install routes 6.6.6.3 nexthop-group infinite-recursive 1"'
+ )
+
+ net["r1"].cmd(
+ 'vtysh -c "sharp install routes 6.6.6.2 nexthop-group infinite-recursive 1"'
+ )
+
+ net["r1"].cmd(
+ 'vtysh -c "sharp install routes 6.6.6.1 nexthop-group infinite-recursive 1"'
+ )
+
+ # Get routes and test if has too many (duplicate) nexthops
+ nhg_id = route_get_nhg_id("6.6.6.1/32")
+ output = net["r1"].cmd('vtysh -c "show nexthop-group rib %d"' % nhg_id)
+
+ dups = re.findall(r"(via 1\.1\.1\.1)", output)
+
+ # Should find 3, itself is inactive
+ assert len(dups) == 3, (
+ "Route 6.6.6.1/32 with Nexthop Group ID=%d has wrong number of resolved nexthops"
+ % nhg_id
+ )
+
##CLI(net)
## Remove all NHG routes
@@ -548,6 +594,8 @@ def test_nexthop_groups():
net["r1"].cmd('vtysh -c "sharp remove routes 4.4.4.1 1"')
net["r1"].cmd('vtysh -c "sharp remove routes 4.4.4.2 1"')
net["r1"].cmd('vtysh -c "sharp remove routes 5.5.5.1 1"')
+ net["r1"].cmd('vtysh -c "sharp remove routes 6.6.6.1 4"')
+ net["r1"].cmd('vtysh -c "c t" -c "no ip route 6.6.6.0/24 1.1.1.1"')
def test_rip_status():
diff --git a/tests/topotests/lib/snmptest.py b/tests/topotests/lib/snmptest.py
index 910e901ade..1bf83c2aea 100644
--- a/tests/topotests/lib/snmptest.py
+++ b/tests/topotests/lib/snmptest.py
@@ -118,7 +118,7 @@ class SnmpTester(object):
def test_oid_walk(self, oid, values, oids=None):
results_dict, results_list = self.walk(oid)
- print("res {}".format(results_dict))
+ print("test_oid_walk: {} {}".format(oid, results_dict))
if oids is not None:
index = 0
for oid in oids:
@@ -127,4 +127,5 @@ class SnmpTester(object):
index += 1
return True
- return results_list == values
+ # Return true if 'values' is a subset of 'results_list'
+ return results_list[: len(values)] == values
diff --git a/tests/topotests/pytest.ini b/tests/topotests/pytest.ini
index 0c45a09445..f400e51b92 100644
--- a/tests/topotests/pytest.ini
+++ b/tests/topotests/pytest.ini
@@ -1,6 +1,6 @@
# Skip pytests example directory
[pytest]
-norecursedirs = .git example-test example-topojson-test lib docker
+norecursedirs = .git example-test example-topojson-test lib docker isis-lsp-bits-topo1
# Markers
#
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index d96d77e77c..3af3586d31 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -2481,13 +2481,6 @@ static int netlink_nexthop_process_group(struct rtattr **tb,
return count;
}
-#if 0
- // TODO: Need type for something?
- zlog_debug("Nexthop group type: %d",
- *((uint16_t *)RTA_DATA(tb[NHA_GROUP_TYPE])));
-
-#endif
-
for (int i = 0; ((i < count) && (i < z_grp_size)); i++) {
z_grp[i].id = n_grp[i].id;
z_grp[i].weight = n_grp[i].weight + 1;
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index 604480b68b..2864b96c83 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -1760,6 +1760,10 @@ static bool nexthop_valid_resolve(const struct nexthop *nexthop,
if (!CHECK_FLAG(resolved->flags, NEXTHOP_FLAG_ACTIVE))
return false;
+ /* Must not be duplicate */
+ if (CHECK_FLAG(resolved->flags, NEXTHOP_FLAG_DUPLICATE))
+ return false;
+
switch (nexthop->type) {
case NEXTHOP_TYPE_IPV4_IFINDEX:
case NEXTHOP_TYPE_IPV6_IFINDEX:
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 8914f9c59c..69d3a577cf 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -2323,14 +2323,6 @@ static void process_subq_route(struct listnode *lnode, uint8_t qindex)
UNSET_FLAG(rib_dest_from_rnode(rnode)->flags,
RIB_ROUTE_QUEUED(qindex));
-#if 0
- else
- {
- zlog_debug ("%s: called for route_node (%p, %d) with no ribs",
- __func__, rnode, route_node_get_lock_count(rnode));
- zlog_backtrace(LOG_DEBUG);
- }
-#endif
route_unlock_node(rnode);
}