Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

This commit is contained in:
Vipin Kumar 2015-10-20 15:14:06 -07:00
commit 3607212c76
12 changed files with 433 additions and 382 deletions

View File

@ -143,7 +143,6 @@ peer_xfer_conn(struct peer *from_peer)
peer->as = from_peer->as; peer->as = from_peer->as;
peer->v_holdtime = from_peer->v_holdtime; peer->v_holdtime = from_peer->v_holdtime;
peer->v_keepalive = from_peer->v_keepalive; peer->v_keepalive = from_peer->v_keepalive;
peer->v_asorig = from_peer->v_asorig;
peer->routeadv = from_peer->routeadv; peer->routeadv = from_peer->routeadv;
peer->v_routeadv = from_peer->v_routeadv; peer->v_routeadv = from_peer->v_routeadv;
peer->v_gr_restart = from_peer->v_gr_restart; peer->v_gr_restart = from_peer->v_gr_restart;
@ -236,7 +235,6 @@ bgp_timer_set (struct peer *peer)
BGP_TIMER_OFF (peer->t_connect); BGP_TIMER_OFF (peer->t_connect);
BGP_TIMER_OFF (peer->t_holdtime); BGP_TIMER_OFF (peer->t_holdtime);
BGP_TIMER_OFF (peer->t_keepalive); BGP_TIMER_OFF (peer->t_keepalive);
BGP_TIMER_OFF (peer->t_asorig);
BGP_TIMER_OFF (peer->t_routeadv); BGP_TIMER_OFF (peer->t_routeadv);
break; break;
@ -248,7 +246,6 @@ bgp_timer_set (struct peer *peer)
BGP_TIMER_ON (peer->t_connect, bgp_connect_timer, peer->v_connect); BGP_TIMER_ON (peer->t_connect, bgp_connect_timer, peer->v_connect);
BGP_TIMER_OFF (peer->t_holdtime); BGP_TIMER_OFF (peer->t_holdtime);
BGP_TIMER_OFF (peer->t_keepalive); BGP_TIMER_OFF (peer->t_keepalive);
BGP_TIMER_OFF (peer->t_asorig);
BGP_TIMER_OFF (peer->t_routeadv); BGP_TIMER_OFF (peer->t_routeadv);
break; break;
@ -268,7 +265,6 @@ bgp_timer_set (struct peer *peer)
} }
BGP_TIMER_OFF (peer->t_holdtime); BGP_TIMER_OFF (peer->t_holdtime);
BGP_TIMER_OFF (peer->t_keepalive); BGP_TIMER_OFF (peer->t_keepalive);
BGP_TIMER_OFF (peer->t_asorig);
BGP_TIMER_OFF (peer->t_routeadv); BGP_TIMER_OFF (peer->t_routeadv);
break; break;
@ -286,7 +282,6 @@ bgp_timer_set (struct peer *peer)
BGP_TIMER_OFF (peer->t_holdtime); BGP_TIMER_OFF (peer->t_holdtime);
} }
BGP_TIMER_OFF (peer->t_keepalive); BGP_TIMER_OFF (peer->t_keepalive);
BGP_TIMER_OFF (peer->t_asorig);
BGP_TIMER_OFF (peer->t_routeadv); BGP_TIMER_OFF (peer->t_routeadv);
break; break;
@ -309,7 +304,6 @@ bgp_timer_set (struct peer *peer)
BGP_TIMER_ON (peer->t_keepalive, bgp_keepalive_timer, BGP_TIMER_ON (peer->t_keepalive, bgp_keepalive_timer,
peer->v_keepalive); peer->v_keepalive);
} }
BGP_TIMER_OFF (peer->t_asorig);
BGP_TIMER_OFF (peer->t_routeadv); BGP_TIMER_OFF (peer->t_routeadv);
break; break;
@ -333,7 +327,6 @@ bgp_timer_set (struct peer *peer)
BGP_TIMER_ON (peer->t_keepalive, bgp_keepalive_timer, BGP_TIMER_ON (peer->t_keepalive, bgp_keepalive_timer,
peer->v_keepalive); peer->v_keepalive);
} }
BGP_TIMER_OFF (peer->t_asorig);
break; break;
case Deleted: case Deleted:
BGP_TIMER_OFF (peer->t_gr_restart); BGP_TIMER_OFF (peer->t_gr_restart);
@ -344,7 +337,6 @@ bgp_timer_set (struct peer *peer)
BGP_TIMER_OFF (peer->t_connect); BGP_TIMER_OFF (peer->t_connect);
BGP_TIMER_OFF (peer->t_holdtime); BGP_TIMER_OFF (peer->t_holdtime);
BGP_TIMER_OFF (peer->t_keepalive); BGP_TIMER_OFF (peer->t_keepalive);
BGP_TIMER_OFF (peer->t_asorig);
BGP_TIMER_OFF (peer->t_routeadv); BGP_TIMER_OFF (peer->t_routeadv);
break; break;
} }
@ -1072,7 +1064,6 @@ bgp_stop (struct peer *peer)
BGP_TIMER_OFF (peer->t_connect); BGP_TIMER_OFF (peer->t_connect);
BGP_TIMER_OFF (peer->t_holdtime); BGP_TIMER_OFF (peer->t_holdtime);
BGP_TIMER_OFF (peer->t_keepalive); BGP_TIMER_OFF (peer->t_keepalive);
BGP_TIMER_OFF (peer->t_asorig);
BGP_TIMER_OFF (peer->t_routeadv); BGP_TIMER_OFF (peer->t_routeadv);
/* Stream reset. */ /* Stream reset. */

View File

@ -175,14 +175,14 @@ bgp_find_or_add_nexthop (struct bgp *bgp, afi_t afi, struct bgp_info *ri,
SET_FLAG(bnc->flags, BGP_STATIC_ROUTE); SET_FLAG(bnc->flags, BGP_STATIC_ROUTE);
/* If we're toggling the type, re-register */ /* If we're toggling the type, re-register */
if ((bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK_EXACT_MATCH)) && if ((bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) &&
!CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH)) !CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH))
{ {
SET_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH); SET_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH);
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED); UNSET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED);
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_VALID); UNSET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
} }
else if ((!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK_EXACT_MATCH)) && else if ((!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) &&
CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH)) CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH))
{ {
UNSET_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH); UNSET_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH);

View File

@ -2199,9 +2199,12 @@ bgp_process_queue_init (void)
/* Use a higher yield value of 50ms for main queue processing */ /* Use a higher yield value of 50ms for main queue processing */
bm->process_main_queue->spec.yield = 50 * 1000L; bm->process_main_queue->spec.yield = 50 * 1000L;
memcpy (bm->process_rsclient_queue, bm->process_main_queue,
sizeof (struct work_queue));
bm->process_rsclient_queue->spec.workfunc = &bgp_process_rsclient; bm->process_rsclient_queue->spec.workfunc = &bgp_process_rsclient;
bm->process_rsclient_queue->spec.del_item_data = &bgp_processq_del;
bm->process_rsclient_queue->spec.max_retries = 0;
bm->process_rsclient_queue->spec.hold = 50;
/* Use a higher yield value of 50ms for main queue processing */
bm->process_rsclient_queue->spec.yield = 50 * 1000L;
} }
void void
@ -4849,7 +4852,7 @@ bgp_config_write_table_map (struct vty *vty, struct bgp *bgp, afi_t afi,
if (bgp->table_map[afi][safi].name) if (bgp->table_map[afi][safi].name)
{ {
bgp_config_write_family_header (vty, afi, safi, write); bgp_config_write_family_header (vty, afi, safi, write);
vty_out (vty, " table-map %s%s", vty_out (vty, " table-map %s%s",
bgp->table_map[afi][safi].name, VTY_NEWLINE); bgp->table_map[afi][safi].name, VTY_NEWLINE);
} }
@ -15141,7 +15144,7 @@ bgp_config_write_network_vpnv4 (struct vty *vty, struct bgp *bgp,
prefix_rd2str (prd, rdbuf, RD_ADDRSTRLEN); prefix_rd2str (prd, rdbuf, RD_ADDRSTRLEN);
label = decode_label (bgp_static->tag); label = decode_label (bgp_static->tag);
vty_out (vty, " network %s/%d rd %s tag %d", vty_out (vty, " network %s/%d rd %s tag %d",
inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
p->prefixlen, p->prefixlen,
rdbuf, label); rdbuf, label);
@ -15182,7 +15185,7 @@ bgp_config_write_network (struct vty *vty, struct bgp *bgp,
destination = ntohl (p->u.prefix4.s_addr); destination = ntohl (p->u.prefix4.s_addr);
masklen2ip (p->prefixlen, &netmask); masklen2ip (p->prefixlen, &netmask);
vty_out (vty, " network %s", vty_out (vty, " network %s",
inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN)); inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN));
if ((IN_CLASSC (destination) && p->prefixlen == 24) if ((IN_CLASSC (destination) && p->prefixlen == 24)
@ -15197,7 +15200,7 @@ bgp_config_write_network (struct vty *vty, struct bgp *bgp,
} }
else else
{ {
vty_out (vty, " network %s/%d", vty_out (vty, " network %s/%d",
inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
p->prefixlen); p->prefixlen);
} }
@ -15227,13 +15230,13 @@ bgp_config_write_network (struct vty *vty, struct bgp *bgp,
struct in_addr netmask; struct in_addr netmask;
masklen2ip (p->prefixlen, &netmask); masklen2ip (p->prefixlen, &netmask);
vty_out (vty, " aggregate-address %s %s", vty_out (vty, " aggregate-address %s %s",
inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
inet_ntoa (netmask)); inet_ntoa (netmask));
} }
else else
{ {
vty_out (vty, " aggregate-address %s/%d", vty_out (vty, " aggregate-address %s/%d",
inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
p->prefixlen); p->prefixlen);
} }

View File

@ -74,9 +74,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#define BGPPEERKEEPALIVE 19 #define BGPPEERKEEPALIVE 19
#define BGPPEERHOLDTIMECONFIGURED 20 #define BGPPEERHOLDTIMECONFIGURED 20
#define BGPPEERKEEPALIVECONFIGURED 21 #define BGPPEERKEEPALIVECONFIGURED 21
#define BGPPEERMINASORIGINATIONINTERVAL 22 #define BGPPEERMINROUTEADVERTISEMENTINTERVAL 22
#define BGPPEERMINROUTEADVERTISEMENTINTERVAL 23 #define BGPPEERINUPDATEELAPSEDTIME 23
#define BGPPEERINUPDATEELAPSEDTIME 24
/* BGP MIB bgpIdentifier. */ /* BGP MIB bgpIdentifier. */
#define BGPIDENTIFIER 0 #define BGPIDENTIFIER 0
@ -189,8 +188,6 @@ struct variable bgp_variables[] =
3, {3, 1, 20}}, 3, {3, 1, 20}},
{BGPPEERKEEPALIVECONFIGURED, INTEGER, RWRITE, bgpPeerTable, {BGPPEERKEEPALIVECONFIGURED, INTEGER, RWRITE, bgpPeerTable,
3, {3, 1, 21}}, 3, {3, 1, 21}},
{BGPPEERMINASORIGINATIONINTERVAL, INTEGER, RWRITE, bgpPeerTable,
3, {3, 1, 22}},
{BGPPEERMINROUTEADVERTISEMENTINTERVAL, INTEGER, RWRITE, bgpPeerTable, {BGPPEERMINROUTEADVERTISEMENTINTERVAL, INTEGER, RWRITE, bgpPeerTable,
3, {3, 1, 23}}, 3, {3, 1, 23}},
{BGPPEERINUPDATEELAPSEDTIME, GAUGE32, RONLY, bgpPeerTable, {BGPPEERINUPDATEELAPSEDTIME, GAUGE32, RONLY, bgpPeerTable,
@ -438,9 +435,6 @@ write_bgpPeerTable (int action, u_char *var_val,
peer->keepalive = intval; peer->keepalive = intval;
peer->v_keepalive = intval; peer->v_keepalive = intval;
break; break;
case BGPPEERMINASORIGINATIONINTERVAL:
peer->v_asorig = intval;
break;
case BGPPEERMINROUTEADVERTISEMENTINTERVAL: case BGPPEERMINROUTEADVERTISEMENTINTERVAL:
peer->v_routeadv = intval; peer->v_routeadv = intval;
break; break;
@ -569,10 +563,6 @@ bgpPeerTable (struct variable *v, oid name[], size_t *length,
else else
return SNMP_INTEGER (peer->v_keepalive); return SNMP_INTEGER (peer->v_keepalive);
break; break;
case BGPPEERMINASORIGINATIONINTERVAL:
*write_method = write_bgpPeerTable;
return SNMP_INTEGER (peer->v_asorig);
break;
case BGPPEERMINROUTEADVERTISEMENTINTERVAL: case BGPPEERMINROUTEADVERTISEMENTINTERVAL:
*write_method = write_bgpPeerTable; *write_method = write_bgpPeerTable;
return SNMP_INTEGER (peer->v_routeadv); return SNMP_INTEGER (peer->v_routeadv);

View File

@ -1466,14 +1466,14 @@ bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS) if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
{ {
bgp_config_write_family_header (vty, afi, safi, write); bgp_config_write_family_header (vty, afi, safi, write);
vty_out (vty, " maximum-paths %d%s", vty_out (vty, " maximum-paths %d%s",
bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
} }
if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS) if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
{ {
bgp_config_write_family_header (vty, afi, safi, write); bgp_config_write_family_header (vty, afi, safi, write);
vty_out (vty, " maximum-paths ibgp %d", vty_out (vty, " maximum-paths ibgp %d",
bgp->maxpaths[afi][safi].maxpaths_ibgp); bgp->maxpaths[afi][safi].maxpaths_ibgp);
if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags, if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags,
BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)) BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN))
@ -2153,45 +2153,26 @@ DEFUN (no_bgp_default_show_hostname,
/* "bgp import-check" configuration. */ /* "bgp import-check" configuration. */
DEFUN (bgp_network_import_check, DEFUN (bgp_network_import_check,
bgp_network_import_check_cmd, bgp_network_import_check_cmd,
"bgp network import-check {exact}", "bgp network import-check",
"BGP specific commands\n" "BGP specific commands\n"
"BGP network command\n" "BGP network command\n"
"Check BGP network route exists in IGP\n" "Check BGP network route exists in IGP\n")
"Match route precisely")
{ {
struct bgp *bgp; struct bgp *bgp;
int trigger = 0;
bgp = vty->index; bgp = vty->index;
if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK))
{ {
bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
trigger = 1; bgp_static_redo_import_check(bgp);
} }
if (argv[0] != NULL)
{
if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK_EXACT_MATCH))
{
bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK_EXACT_MATCH);
trigger = 1;
}
}
else if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK_EXACT_MATCH))
{
bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK_EXACT_MATCH);
trigger = 1;
}
if (trigger)
bgp_static_redo_import_check(bgp);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (no_bgp_network_import_check, DEFUN (no_bgp_network_import_check,
no_bgp_network_import_check_cmd, no_bgp_network_import_check_cmd,
"no bgp network import-check {exact}", "no bgp network import-check",
NO_STR NO_STR
"BGP specific commands\n" "BGP specific commands\n"
"BGP network command\n" "BGP network command\n"
@ -2203,9 +2184,9 @@ DEFUN (no_bgp_network_import_check,
if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK))
{ {
bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK_EXACT_MATCH);
bgp_static_redo_import_check(bgp); bgp_static_redo_import_check(bgp);
} }
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -4836,7 +4817,7 @@ peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
DEFUN (neighbor_timers_connect, DEFUN (neighbor_timers_connect,
neighbor_timers_connect_cmd, neighbor_timers_connect_cmd,
NEIGHBOR_CMD2 "timers connect <0-65535>", NEIGHBOR_CMD2 "timers connect <1-65535>",
NEIGHBOR_STR NEIGHBOR_STR
NEIGHBOR_ADDR_STR2 NEIGHBOR_ADDR_STR2
"BGP per neighbor timers\n" "BGP per neighbor timers\n"
@ -4860,7 +4841,7 @@ DEFUN (no_neighbor_timers_connect,
ALIAS (no_neighbor_timers_connect, ALIAS (no_neighbor_timers_connect,
no_neighbor_timers_connect_val_cmd, no_neighbor_timers_connect_val_cmd,
NO_NEIGHBOR_CMD2 "timers connect <0-65535>", NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
NO_STR NO_STR
NEIGHBOR_STR NEIGHBOR_STR
NEIGHBOR_ADDR_STR2 NEIGHBOR_ADDR_STR2
@ -12459,7 +12440,7 @@ bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
bgp_config_write_family_header (vty, afi, safi, write); bgp_config_write_family_header (vty, afi, safi, write);
/* "redistribute" configuration. */ /* "redistribute" configuration. */
vty_out (vty, " redistribute %s", zebra_route_string(i)); vty_out (vty, " redistribute %s", zebra_route_string(i));
if (red->instance) if (red->instance)
vty_out (vty, " %d", red->instance); vty_out (vty, " %d", red->instance);
if (red->redist_metric_flag) if (red->redist_metric_flag)

View File

@ -822,7 +822,6 @@ peer_global_config_reset (struct peer *peer)
/* Reset some other configs back to defaults. */ /* Reset some other configs back to defaults. */
peer->v_start = BGP_INIT_START_TIMER; peer->v_start = BGP_INIT_START_TIMER;
peer->v_asorig = BGP_DEFAULT_ASORIGINATE;
peer->password = NULL; peer->password = NULL;
peer->local_id = peer->bgp->router_id; peer->local_id = peer->bgp->router_id;
peer->v_holdtime = peer->bgp->default_holdtime; peer->v_holdtime = peer->bgp->default_holdtime;
@ -1029,7 +1028,6 @@ peer_new (struct bgp *bgp)
peer->fd = -1; peer->fd = -1;
peer->v_start = BGP_INIT_START_TIMER; peer->v_start = BGP_INIT_START_TIMER;
peer->v_connect = BGP_DEFAULT_CONNECT_RETRY; peer->v_connect = BGP_DEFAULT_CONNECT_RETRY;
peer->v_asorig = BGP_DEFAULT_ASORIGINATE;
peer->status = Idle; peer->status = Idle;
peer->ostatus = Idle; peer->ostatus = Idle;
peer->cur_event = peer->last_event = peer->last_major_event = 0; peer->cur_event = peer->last_event = peer->last_major_event = 0;
@ -1119,7 +1117,6 @@ peer_xfer_config (struct peer *peer_dst, struct peer *peer_src)
peer_dst->connect = peer_src->connect; peer_dst->connect = peer_src->connect;
peer_dst->v_holdtime = peer_src->v_holdtime; peer_dst->v_holdtime = peer_src->v_holdtime;
peer_dst->v_keepalive = peer_src->v_keepalive; peer_dst->v_keepalive = peer_src->v_keepalive;
peer_dst->v_asorig = peer_src->v_asorig;
peer_dst->routeadv = peer_src->routeadv; peer_dst->routeadv = peer_src->routeadv;
peer_dst->v_routeadv = peer_src->v_routeadv; peer_dst->v_routeadv = peer_src->v_routeadv;
@ -2701,6 +2698,9 @@ bgp_create (as_t *as, const char *name)
bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
bgp->dynamic_neighbors_limit = BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT; bgp->dynamic_neighbors_limit = BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT;
bgp->dynamic_neighbors_count = 0; bgp->dynamic_neighbors_count = 0;
bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
bgp_flag_set (bgp, BGP_FLAG_SHOW_HOSTNAME);
bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
bgp->as = *as; bgp->as = *as;
@ -6062,61 +6062,61 @@ bgp_config_write_filter (struct vty *vty, struct peer *peer,
if (filter->dlist[in].name) if (filter->dlist[in].name)
if (! gfilter || ! gfilter->dlist[in].name if (! gfilter || ! gfilter->dlist[in].name
|| strcmp (filter->dlist[in].name, gfilter->dlist[in].name) != 0) || strcmp (filter->dlist[in].name, gfilter->dlist[in].name) != 0)
vty_out (vty, " neighbor %s distribute-list %s in%s", addr, vty_out (vty, " neighbor %s distribute-list %s in%s", addr,
filter->dlist[in].name, VTY_NEWLINE); filter->dlist[in].name, VTY_NEWLINE);
if (filter->dlist[out].name && ! gfilter) if (filter->dlist[out].name && ! gfilter)
vty_out (vty, " neighbor %s distribute-list %s out%s", addr, vty_out (vty, " neighbor %s distribute-list %s out%s", addr,
filter->dlist[out].name, VTY_NEWLINE); filter->dlist[out].name, VTY_NEWLINE);
/* prefix-list. */ /* prefix-list. */
if (filter->plist[in].name) if (filter->plist[in].name)
if (! gfilter || ! gfilter->plist[in].name if (! gfilter || ! gfilter->plist[in].name
|| strcmp (filter->plist[in].name, gfilter->plist[in].name) != 0) || strcmp (filter->plist[in].name, gfilter->plist[in].name) != 0)
vty_out (vty, " neighbor %s prefix-list %s in%s", addr, vty_out (vty, " neighbor %s prefix-list %s in%s", addr,
filter->plist[in].name, VTY_NEWLINE); filter->plist[in].name, VTY_NEWLINE);
if (filter->plist[out].name && ! gfilter) if (filter->plist[out].name && ! gfilter)
vty_out (vty, " neighbor %s prefix-list %s out%s", addr, vty_out (vty, " neighbor %s prefix-list %s out%s", addr,
filter->plist[out].name, VTY_NEWLINE); filter->plist[out].name, VTY_NEWLINE);
/* route-map. */ /* route-map. */
if (filter->map[RMAP_IN].name) if (filter->map[RMAP_IN].name)
if (! gfilter || ! gfilter->map[RMAP_IN].name if (! gfilter || ! gfilter->map[RMAP_IN].name
|| strcmp (filter->map[RMAP_IN].name, gfilter->map[RMAP_IN].name) != 0) || strcmp (filter->map[RMAP_IN].name, gfilter->map[RMAP_IN].name) != 0)
vty_out (vty, " neighbor %s route-map %s in%s", addr, vty_out (vty, " neighbor %s route-map %s in%s", addr,
filter->map[RMAP_IN].name, VTY_NEWLINE); filter->map[RMAP_IN].name, VTY_NEWLINE);
if (filter->map[RMAP_OUT].name && ! gfilter) if (filter->map[RMAP_OUT].name && ! gfilter)
vty_out (vty, " neighbor %s route-map %s out%s", addr, vty_out (vty, " neighbor %s route-map %s out%s", addr,
filter->map[RMAP_OUT].name, VTY_NEWLINE); filter->map[RMAP_OUT].name, VTY_NEWLINE);
if (filter->map[RMAP_IMPORT].name && ! gfilter) if (filter->map[RMAP_IMPORT].name && ! gfilter)
vty_out (vty, " neighbor %s route-map %s import%s", addr, vty_out (vty, " neighbor %s route-map %s import%s", addr,
filter->map[RMAP_IMPORT].name, VTY_NEWLINE); filter->map[RMAP_IMPORT].name, VTY_NEWLINE);
if (filter->map[RMAP_EXPORT].name) if (filter->map[RMAP_EXPORT].name)
if (! gfilter || ! gfilter->map[RMAP_EXPORT].name if (! gfilter || ! gfilter->map[RMAP_EXPORT].name
|| strcmp (filter->map[RMAP_EXPORT].name, || strcmp (filter->map[RMAP_EXPORT].name,
gfilter->map[RMAP_EXPORT].name) != 0) gfilter->map[RMAP_EXPORT].name) != 0)
vty_out (vty, " neighbor %s route-map %s export%s", addr, vty_out (vty, " neighbor %s route-map %s export%s", addr,
filter->map[RMAP_EXPORT].name, VTY_NEWLINE); filter->map[RMAP_EXPORT].name, VTY_NEWLINE);
/* unsuppress-map */ /* unsuppress-map */
if (filter->usmap.name && ! gfilter) if (filter->usmap.name && ! gfilter)
vty_out (vty, " neighbor %s unsuppress-map %s%s", addr, vty_out (vty, " neighbor %s unsuppress-map %s%s", addr,
filter->usmap.name, VTY_NEWLINE); filter->usmap.name, VTY_NEWLINE);
/* filter-list. */ /* filter-list. */
if (filter->aslist[in].name) if (filter->aslist[in].name)
if (! gfilter || ! gfilter->aslist[in].name if (! gfilter || ! gfilter->aslist[in].name
|| strcmp (filter->aslist[in].name, gfilter->aslist[in].name) != 0) || strcmp (filter->aslist[in].name, gfilter->aslist[in].name) != 0)
vty_out (vty, " neighbor %s filter-list %s in%s", addr, vty_out (vty, " neighbor %s filter-list %s in%s", addr,
filter->aslist[in].name, VTY_NEWLINE); filter->aslist[in].name, VTY_NEWLINE);
if (filter->aslist[out].name && ! gfilter) if (filter->aslist[out].name && ! gfilter)
vty_out (vty, " neighbor %s filter-list %s out%s", addr, vty_out (vty, " neighbor %s filter-list %s out%s", addr,
filter->aslist[out].name, VTY_NEWLINE); filter->aslist[out].name, VTY_NEWLINE);
} }
/* BGP peer configuration display function. */ /* BGP peer configuration display function. */
static void static void
bgp_config_write_peer (struct vty *vty, struct bgp *bgp, bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
struct peer *peer, afi_t afi, safi_t safi) struct peer *peer)
{ {
struct peer *g_peer = NULL; struct peer *g_peer = NULL;
char buf[SU_ADDRSTRLEN]; char buf[SU_ADDRSTRLEN];
@ -6137,244 +6137,325 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
/************************************ /************************************
****** Global to the neighbor ****** ****** Global to the neighbor ******
************************************/ ************************************/
if (afi == AFI_IP && safi == SAFI_UNICAST) if (peer->conf_if)
{ {
if (peer->conf_if) if (CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))
{ vty_out (vty, " neighbor %s interface v6only %s", addr, VTY_NEWLINE);
if (CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))
vty_out (vty, " neighbor %s interface v6only %s", addr, VTY_NEWLINE);
else
vty_out (vty, " neighbor %s interface%s", addr, VTY_NEWLINE);
}
/* remote-as. */
if (! peer_group_active (peer))
{
if (CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
vty_out (vty, " neighbor %s peer-group%s", addr,
VTY_NEWLINE);
if (peer->as_type == AS_SPECIFIED)
{
vty_out (vty, " neighbor %s remote-as %u%s", addr, peer->as,
VTY_NEWLINE);
}
else if (peer->as_type == AS_INTERNAL)
{
vty_out (vty, " neighbor %s remote-as internal%s", addr, VTY_NEWLINE);
}
else if (peer->as_type == AS_EXTERNAL)
{
vty_out (vty, " neighbor %s remote-as external%s", addr, VTY_NEWLINE);
}
}
else else
{ vty_out (vty, " neighbor %s interface%s", addr, VTY_NEWLINE);
if (! g_peer->as)
{
if (peer->as_type == AS_SPECIFIED)
{
vty_out (vty, " neighbor %s remote-as %u%s", addr, peer->as,
VTY_NEWLINE);
}
else if (peer->as_type == AS_INTERNAL)
{
vty_out (vty, " neighbor %s remote-as internal%s", addr, VTY_NEWLINE);
}
else if (peer->as_type == AS_EXTERNAL)
{
vty_out (vty, " neighbor %s remote-as external%s", addr, VTY_NEWLINE);
}
}
if (peer->af_group[AFI_IP][SAFI_UNICAST])
vty_out (vty, " neighbor %s peer-group %s%s", addr,
peer->group->name, VTY_NEWLINE);
}
/* local-as. */
if (peer->change_local_as)
if (! peer_group_active (peer))
vty_out (vty, " neighbor %s local-as %u%s%s%s", addr,
peer->change_local_as,
CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
" no-prepend" : "",
CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
" replace-as" : "", VTY_NEWLINE);
/* Description. */
if (peer->desc)
vty_out (vty, " neighbor %s description %s%s", addr, peer->desc,
VTY_NEWLINE);
/* Shutdown. */
if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_SHUTDOWN))
vty_out (vty, " neighbor %s shutdown%s", addr, VTY_NEWLINE);
/* bfd. */
if (peer->bfd_info)
if (! peer_group_active (peer) || ! g_peer->bfd_info)
{
bgp_bfd_peer_config_write(vty, peer, addr);
}
/* Password. */
if (peer->password)
if (!peer_group_active (peer)
|| ! g_peer->password
|| strcmp (peer->password, g_peer->password) != 0)
vty_out (vty, " neighbor %s password %s%s", addr, peer->password,
VTY_NEWLINE);
/* neighbor solo */
if (CHECK_FLAG(peer->flags, PEER_FLAG_LONESOUL))
if (!peer_group_active (peer))
vty_out (vty, " neighbor %s solo%s", addr, VTY_NEWLINE);
/* BGP port. */
if (peer->port != BGP_PORT_DEFAULT)
vty_out (vty, " neighbor %s port %d%s", addr, peer->port,
VTY_NEWLINE);
/* Local interface name. */
if (peer->ifname)
vty_out (vty, " neighbor %s interface %s%s", addr, peer->ifname,
VTY_NEWLINE);
/* Passive. */
if (CHECK_FLAG (peer->flags, PEER_FLAG_PASSIVE))
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_PASSIVE))
vty_out (vty, " neighbor %s passive%s", addr, VTY_NEWLINE);
/* EBGP multihop. */
if (peer->sort != BGP_PEER_IBGP && peer->ttl != 1 &&
!(peer->gtsm_hops != 0 && peer->ttl == MAXTTL))
if (! peer_group_active (peer) ||
g_peer->ttl != peer->ttl)
vty_out (vty, " neighbor %s ebgp-multihop %d%s", addr, peer->ttl,
VTY_NEWLINE);
/* ttl-security hops */
if (peer->gtsm_hops != 0)
if (! peer_group_active (peer) || g_peer->gtsm_hops != peer->gtsm_hops)
vty_out (vty, " neighbor %s ttl-security hops %d%s", addr,
peer->gtsm_hops, VTY_NEWLINE);
/* disable-connected-check. */
if (CHECK_FLAG (peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))
vty_out (vty, " neighbor %s disable-connected-check%s", addr, VTY_NEWLINE);
/* Update-source. */
if (peer->update_if)
if (! peer_group_active (peer) || ! g_peer->update_if
|| strcmp (g_peer->update_if, peer->update_if) != 0)
vty_out (vty, " neighbor %s update-source %s%s", addr,
peer->update_if, VTY_NEWLINE);
if (peer->update_source)
if (! peer_group_active (peer) || ! g_peer->update_source
|| sockunion_cmp (g_peer->update_source,
peer->update_source) != 0)
vty_out (vty, " neighbor %s update-source %s%s", addr,
sockunion2str (peer->update_source, buf, SU_ADDRSTRLEN),
VTY_NEWLINE);
/* advertisement-interval */
if (CHECK_FLAG (peer->config, PEER_CONFIG_ROUTEADV) &&
! peer_group_active (peer))
vty_out (vty, " neighbor %s advertisement-interval %d%s",
addr, peer->v_routeadv, VTY_NEWLINE);
/* timers. */
if (CHECK_FLAG (peer->config, PEER_CONFIG_TIMER)
&& ! peer_group_active (peer))
vty_out (vty, " neighbor %s timers %d %d%s", addr,
peer->keepalive, peer->holdtime, VTY_NEWLINE);
if (CHECK_FLAG (peer->config, PEER_CONFIG_CONNECT) &&
! peer_group_active (peer))
vty_out (vty, " neighbor %s timers connect %d%s", addr,
peer->connect, VTY_NEWLINE);
/* Default weight. */
if (CHECK_FLAG (peer->config, PEER_CONFIG_WEIGHT))
if (! peer_group_active (peer) ||
g_peer->weight != peer->weight)
vty_out (vty, " neighbor %s weight %d%s", addr, peer->weight,
VTY_NEWLINE);
/* Dynamic capability. */
if (CHECK_FLAG (peer->flags, PEER_FLAG_DYNAMIC_CAPABILITY))
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_DYNAMIC_CAPABILITY))
vty_out (vty, " neighbor %s capability dynamic%s", addr,
VTY_NEWLINE);
/* Extended next-hop capability. */
if (CHECK_FLAG (peer->flags, PEER_FLAG_CAPABILITY_ENHE))
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_CAPABILITY_ENHE))
vty_out (vty, " neighbor %s capability extended-nexthop%s", addr,
VTY_NEWLINE);
/* dont capability negotiation. */
if (CHECK_FLAG (peer->flags, PEER_FLAG_DONT_CAPABILITY))
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_DONT_CAPABILITY))
vty_out (vty, " neighbor %s dont-capability-negotiate%s", addr,
VTY_NEWLINE);
/* override capability negotiation. */
if (CHECK_FLAG (peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY))
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY))
vty_out (vty, " neighbor %s override-capability%s", addr,
VTY_NEWLINE);
/* strict capability negotiation. */
if (CHECK_FLAG (peer->flags, PEER_FLAG_STRICT_CAP_MATCH))
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_STRICT_CAP_MATCH))
vty_out (vty, " neighbor %s strict-capability-match%s", addr,
VTY_NEWLINE);
if (! peer->af_group[AFI_IP][SAFI_UNICAST])
{
if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4))
{
if (peer->afc[AFI_IP][SAFI_UNICAST])
vty_out (vty, " neighbor %s activate%s", addr, VTY_NEWLINE);
}
else
{
if (! peer->afc[AFI_IP][SAFI_UNICAST])
vty_out (vty, " no neighbor %s activate%s", addr, VTY_NEWLINE);
}
}
} }
/* remote-as */
if (! peer_group_active (peer))
{
if (CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
{
vty_out (vty, " neighbor %s peer-group%s", addr,
VTY_NEWLINE);
}
if (peer->as_type == AS_SPECIFIED)
{
vty_out (vty, " neighbor %s remote-as %u%s", addr, peer->as,
VTY_NEWLINE);
}
else if (peer->as_type == AS_INTERNAL)
{
vty_out (vty, " neighbor %s remote-as internal%s", addr, VTY_NEWLINE);
}
else if (peer->as_type == AS_EXTERNAL)
{
vty_out (vty, " neighbor %s remote-as external%s", addr, VTY_NEWLINE);
}
}
else
{
if (! g_peer->as)
{
if (peer->as_type == AS_SPECIFIED)
{
vty_out (vty, " neighbor %s remote-as %u%s", addr, peer->as,
VTY_NEWLINE);
}
else if (peer->as_type == AS_INTERNAL)
{
vty_out (vty, " neighbor %s remote-as internal%s", addr, VTY_NEWLINE);
}
else if (peer->as_type == AS_EXTERNAL)
{
vty_out (vty, " neighbor %s remote-as external%s", addr, VTY_NEWLINE);
}
}
if (peer->af_group[AFI_IP][SAFI_UNICAST])
{
vty_out (vty, " neighbor %s peer-group %s%s", addr,
peer->group->name, VTY_NEWLINE);
}
}
/* local-as */
if (peer->change_local_as)
{
if (! peer_group_active (peer))
{
vty_out (vty, " neighbor %s local-as %u%s%s%s", addr,
peer->change_local_as,
CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
" no-prepend" : "",
CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
" replace-as" : "", VTY_NEWLINE);
}
}
/* description */
if (peer->desc)
{
vty_out (vty, " neighbor %s description %s%s", addr, peer->desc,
VTY_NEWLINE);
}
/* shutdown */
if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
{
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_SHUTDOWN))
{
vty_out (vty, " neighbor %s shutdown%s", addr, VTY_NEWLINE);
}
}
/* bfd */
if (peer->bfd_info)
{
if (! peer_group_active (peer) || ! g_peer->bfd_info)
{
bgp_bfd_peer_config_write(vty, peer, addr);
}
}
/* password */
if (peer->password)
{
if (!peer_group_active (peer)
|| ! g_peer->password
|| strcmp (peer->password, g_peer->password) != 0)
{
vty_out (vty, " neighbor %s password %s%s", addr, peer->password,
VTY_NEWLINE);
}
}
/* neighbor solo */
if (CHECK_FLAG(peer->flags, PEER_FLAG_LONESOUL))
{
if (!peer_group_active (peer))
{
vty_out (vty, " neighbor %s solo%s", addr, VTY_NEWLINE);
}
}
/* BGP port */
if (peer->port != BGP_PORT_DEFAULT)
{
vty_out (vty, " neighbor %s port %d%s", addr, peer->port,
VTY_NEWLINE);
}
/* Local interface name */
if (peer->ifname)
{
vty_out (vty, " neighbor %s interface %s%s", addr, peer->ifname,
VTY_NEWLINE);
}
/* passive */
if (CHECK_FLAG (peer->flags, PEER_FLAG_PASSIVE))
{
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_PASSIVE))
{
vty_out (vty, " neighbor %s passive%s", addr, VTY_NEWLINE);
}
}
/* ebgp-multihop */
if (peer->sort != BGP_PEER_IBGP && peer->ttl != 1 &&
!(peer->gtsm_hops != 0 && peer->ttl == MAXTTL))
{
if (! peer_group_active (peer) || g_peer->ttl != peer->ttl)
{
vty_out (vty, " neighbor %s ebgp-multihop %d%s", addr, peer->ttl,
VTY_NEWLINE);
}
}
/* ttl-security hops */
if (peer->gtsm_hops != 0)
{
if (! peer_group_active (peer) || g_peer->gtsm_hops != peer->gtsm_hops)
{
vty_out (vty, " neighbor %s ttl-security hops %d%s", addr,
peer->gtsm_hops, VTY_NEWLINE);
}
}
/* disable-connected-check */
if (CHECK_FLAG (peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))
{
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))
{
vty_out (vty, " neighbor %s disable-connected-check%s", addr, VTY_NEWLINE);
}
}
/* update-source */
if (peer->update_if)
{
if (! peer_group_active (peer) || ! g_peer->update_if
|| strcmp (g_peer->update_if, peer->update_if) != 0)
{
vty_out (vty, " neighbor %s update-source %s%s", addr,
peer->update_if, VTY_NEWLINE);
}
}
if (peer->update_source)
{
if (! peer_group_active (peer) || ! g_peer->update_source
|| sockunion_cmp (g_peer->update_source,
peer->update_source) != 0)
{
vty_out (vty, " neighbor %s update-source %s%s", addr,
sockunion2str (peer->update_source, buf, SU_ADDRSTRLEN),
VTY_NEWLINE);
}
}
/* advertisement-interval */
if (CHECK_FLAG (peer->config, PEER_CONFIG_ROUTEADV) &&
! peer_group_active (peer))
{
vty_out (vty, " neighbor %s advertisement-interval %d%s",
addr, peer->v_routeadv, VTY_NEWLINE);
}
/* timers */
if (CHECK_FLAG (peer->config, PEER_CONFIG_TIMER)
&& ! peer_group_active (peer))
{
vty_out (vty, " neighbor %s timers %d %d%s", addr,
peer->keepalive, peer->holdtime, VTY_NEWLINE);
}
if (CHECK_FLAG (peer->config, PEER_CONFIG_CONNECT) &&
! peer_group_active (peer))
{
vty_out (vty, " neighbor %s timers connect %d%s", addr,
peer->connect, VTY_NEWLINE);
}
/* weight */
if (CHECK_FLAG (peer->config, PEER_CONFIG_WEIGHT))
{
if (! peer_group_active (peer) || g_peer->weight != peer->weight)
{
vty_out (vty, " neighbor %s weight %d%s", addr, peer->weight,
VTY_NEWLINE);
}
}
/* capability dynamic */
if (CHECK_FLAG (peer->flags, PEER_FLAG_DYNAMIC_CAPABILITY))
{
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_DYNAMIC_CAPABILITY))
{
vty_out (vty, " neighbor %s capability dynamic%s", addr,
VTY_NEWLINE);
}
}
/* capability extended-nexthop */
if (CHECK_FLAG (peer->flags, PEER_FLAG_CAPABILITY_ENHE))
{
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_CAPABILITY_ENHE))
{
vty_out (vty, " neighbor %s capability extended-nexthop%s", addr,
VTY_NEWLINE);
}
}
/* dont-capability-negotiation */
if (CHECK_FLAG (peer->flags, PEER_FLAG_DONT_CAPABILITY))
{
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_DONT_CAPABILITY))
{
vty_out (vty, " neighbor %s dont-capability-negotiate%s", addr,
VTY_NEWLINE);
}
}
/* override-capability */
if (CHECK_FLAG (peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY))
{
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY))
{
vty_out (vty, " neighbor %s override-capability%s", addr,
VTY_NEWLINE);
}
}
/* strict-capability-match */
if (CHECK_FLAG (peer->flags, PEER_FLAG_STRICT_CAP_MATCH))
{
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_STRICT_CAP_MATCH))
{
vty_out (vty, " neighbor %s strict-capability-match%s", addr,
VTY_NEWLINE);
}
}
}
/* BGP peer configuration display function. */
static void
bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
struct peer *peer, afi_t afi, safi_t safi)
{
struct peer *g_peer = NULL;
char *addr;
/* Skip dynamic neighbors. */
if (peer_dynamic_neighbor (peer))
return;
if (peer->conf_if)
addr = peer->conf_if;
else
addr = peer->host;
if (peer_group_active (peer))
g_peer = peer->group->conf;
/************************************ /************************************
****** Per AF to the neighbor ****** ****** Per AF to the neighbor ******
************************************/ ************************************/
if (peer->af_group[afi][safi])
if (! (afi == AFI_IP && safi == SAFI_UNICAST)) vty_out (vty, " neighbor %s peer-group %s%s", addr,
{ peer->group->name, VTY_NEWLINE);
if (peer->af_group[afi][safi]) else
vty_out (vty, " neighbor %s peer-group %s%s", addr, vty_out (vty, " neighbor %s activate%s", addr, VTY_NEWLINE);
peer->group->name, VTY_NEWLINE);
else
vty_out (vty, " neighbor %s activate%s", addr, VTY_NEWLINE);
}
/* ORF capability. */ /* ORF capability. */
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_SM) if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_SM)
|| CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_RM)) || CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_RM))
if (! peer->af_group[afi][safi]) if (! peer->af_group[afi][safi])
{ {
vty_out (vty, " neighbor %s capability orf prefix-list", addr); vty_out (vty, " neighbor %s capability orf prefix-list", addr);
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_SM) if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_SM)
&& CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_RM)) && CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_RM))
@ -6389,39 +6470,39 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
/* Route reflector client. */ /* Route reflector client. */
if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REFLECTOR_CLIENT) if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REFLECTOR_CLIENT)
&& ! peer->af_group[afi][safi]) && ! peer->af_group[afi][safi])
vty_out (vty, " neighbor %s route-reflector-client%s", addr, vty_out (vty, " neighbor %s route-reflector-client%s", addr,
VTY_NEWLINE); VTY_NEWLINE);
/* Nexthop self. */ /* Nexthop self. */
if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_FORCE_NEXTHOP_SELF) if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_FORCE_NEXTHOP_SELF)
&& ! peer->af_group[afi][safi]) && ! peer->af_group[afi][safi])
vty_out (vty, " neighbor %s next-hop-self force%s", vty_out (vty, " neighbor %s next-hop-self force%s",
addr, VTY_NEWLINE); addr, VTY_NEWLINE);
else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_NEXTHOP_SELF) else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_NEXTHOP_SELF)
&& ! peer->af_group[afi][safi]) && ! peer->af_group[afi][safi])
vty_out (vty, " neighbor %s next-hop-self%s", addr, VTY_NEWLINE); vty_out (vty, " neighbor %s next-hop-self%s", addr, VTY_NEWLINE);
/* remove-private-AS */ /* remove-private-AS */
if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS) && !peer->af_group[afi][safi]) if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS) && !peer->af_group[afi][safi])
{ {
if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_ALL) && if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_ALL) &&
peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE))
vty_out (vty, " neighbor %s remove-private-AS all replace-AS%s", addr, VTY_NEWLINE); vty_out (vty, " neighbor %s remove-private-AS all replace-AS%s", addr, VTY_NEWLINE);
else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE))
vty_out (vty, " neighbor %s remove-private-AS replace-AS%s", addr, VTY_NEWLINE); vty_out (vty, " neighbor %s remove-private-AS replace-AS%s", addr, VTY_NEWLINE);
else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_ALL))
vty_out (vty, " neighbor %s remove-private-AS all%s", addr, VTY_NEWLINE); vty_out (vty, " neighbor %s remove-private-AS all%s", addr, VTY_NEWLINE);
else else
vty_out (vty, " neighbor %s remove-private-AS%s", addr, VTY_NEWLINE); vty_out (vty, " neighbor %s remove-private-AS%s", addr, VTY_NEWLINE);
} }
/* as-override */ /* as-override */
if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_AS_OVERRIDE) && if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_AS_OVERRIDE) &&
!peer->af_group[afi][safi]) !peer->af_group[afi][safi])
vty_out (vty, " neighbor %s as-override%s", addr, VTY_NEWLINE); vty_out (vty, " neighbor %s as-override%s", addr, VTY_NEWLINE);
/* send-community print. */ /* send-community print. */
if (! peer->af_group[afi][safi]) if (! peer->af_group[afi][safi])
@ -6430,24 +6511,24 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
{ {
if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY) if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY)
&& peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY)) && peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY))
vty_out (vty, " neighbor %s send-community both%s", addr, VTY_NEWLINE); vty_out (vty, " neighbor %s send-community both%s", addr, VTY_NEWLINE);
else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY)) else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY))
vty_out (vty, " neighbor %s send-community extended%s", vty_out (vty, " neighbor %s send-community extended%s",
addr, VTY_NEWLINE); addr, VTY_NEWLINE);
else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY)) else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY))
vty_out (vty, " neighbor %s send-community%s", addr, VTY_NEWLINE); vty_out (vty, " neighbor %s send-community%s", addr, VTY_NEWLINE);
} }
else else
{ {
if (! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY) if (! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY)
&& ! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY)) && ! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY))
vty_out (vty, " no neighbor %s send-community both%s", vty_out (vty, " no neighbor %s send-community both%s",
addr, VTY_NEWLINE); addr, VTY_NEWLINE);
else if (! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY)) else if (! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY))
vty_out (vty, " no neighbor %s send-community extended%s", vty_out (vty, " no neighbor %s send-community extended%s",
addr, VTY_NEWLINE); addr, VTY_NEWLINE);
else if (! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY)) else if (! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY))
vty_out (vty, " no neighbor %s send-community%s", vty_out (vty, " no neighbor %s send-community%s",
addr, VTY_NEWLINE); addr, VTY_NEWLINE);
} }
} }
@ -6456,9 +6537,9 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_DEFAULT_ORIGINATE) if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_DEFAULT_ORIGINATE)
&& ! peer->af_group[afi][safi]) && ! peer->af_group[afi][safi])
{ {
vty_out (vty, " neighbor %s default-originate", addr); vty_out (vty, " neighbor %s default-originate", addr);
if (peer->default_rmap[afi][safi].name) if (peer->default_rmap[afi][safi].name)
vty_out (vty, " route-map %s", peer->default_rmap[afi][safi].name); vty_out (vty, " route-map %s", peer->default_rmap[afi][safi].name);
vty_out (vty, "%s", VTY_NEWLINE); vty_out (vty, "%s", VTY_NEWLINE);
} }
@ -6466,7 +6547,7 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
if (! peer->af_group[afi][safi] || if (! peer->af_group[afi][safi] ||
! CHECK_FLAG (g_peer->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) ! CHECK_FLAG (g_peer->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
vty_out (vty, " neighbor %s soft-reconfiguration inbound%s", addr, vty_out (vty, " neighbor %s soft-reconfiguration inbound%s", addr,
VTY_NEWLINE); VTY_NEWLINE);
/* maximum-prefix. */ /* maximum-prefix. */
@ -6477,7 +6558,7 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
|| CHECK_FLAG (g_peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) || CHECK_FLAG (g_peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
!= CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)) != CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING))
{ {
vty_out (vty, " neighbor %s maximum-prefix %ld", addr, peer->pmax[afi][safi]); vty_out (vty, " neighbor %s maximum-prefix %ld", addr, peer->pmax[afi][safi]);
if (peer->pmax_threshold[afi][safi] != MAXIMUM_PREFIX_THRESHOLD_DEFAULT) if (peer->pmax_threshold[afi][safi] != MAXIMUM_PREFIX_THRESHOLD_DEFAULT)
vty_out (vty, " %d", peer->pmax_threshold[afi][safi]); vty_out (vty, " %d", peer->pmax_threshold[afi][safi]);
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)) if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING))
@ -6490,12 +6571,12 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
/* Route server client. */ /* Route server client. */
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)
&& ! peer->af_group[afi][safi]) && ! peer->af_group[afi][safi])
vty_out (vty, " neighbor %s route-server-client%s", addr, VTY_NEWLINE); vty_out (vty, " neighbor %s route-server-client%s", addr, VTY_NEWLINE);
/* Nexthop-local unchanged. */ /* Nexthop-local unchanged. */
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED) if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED)
&& ! peer->af_group[afi][safi]) && ! peer->af_group[afi][safi])
vty_out (vty, " neighbor %s nexthop-local unchanged%s", addr, VTY_NEWLINE); vty_out (vty, " neighbor %s nexthop-local unchanged%s", addr, VTY_NEWLINE);
/* Allow AS in. */ /* Allow AS in. */
if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_ALLOWAS_IN)) if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_ALLOWAS_IN))
@ -6504,9 +6585,9 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
|| peer->allowas_in[afi][safi] != g_peer->allowas_in[afi][safi]) || peer->allowas_in[afi][safi] != g_peer->allowas_in[afi][safi])
{ {
if (peer->allowas_in[afi][safi] == 3) if (peer->allowas_in[afi][safi] == 3)
vty_out (vty, " neighbor %s allowas-in%s", addr, VTY_NEWLINE); vty_out (vty, " neighbor %s allowas-in%s", addr, VTY_NEWLINE);
else else
vty_out (vty, " neighbor %s allowas-in %d%s", addr, vty_out (vty, " neighbor %s allowas-in %d%s", addr,
peer->allowas_in[afi][safi], VTY_NEWLINE); peer->allowas_in[afi][safi], VTY_NEWLINE);
} }
@ -6522,9 +6603,9 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED) if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)
&& CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED) && CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)
&& CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) && CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
vty_out (vty, " neighbor %s attribute-unchanged%s", addr, VTY_NEWLINE); vty_out (vty, " neighbor %s attribute-unchanged%s", addr, VTY_NEWLINE);
else else
vty_out (vty, " neighbor %s attribute-unchanged%s%s%s%s", addr, vty_out (vty, " neighbor %s attribute-unchanged%s%s%s%s", addr,
(CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) ? (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) ?
" as-path" : "", " as-path" : "",
(CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) ? (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) ?
@ -6542,24 +6623,23 @@ bgp_config_write_family_header (struct vty *vty, afi_t afi, safi_t safi,
if (*write) if (*write)
return; return;
if (afi == AFI_IP && safi == SAFI_UNICAST) vty_out (vty, " address-family ");
return;
vty_out (vty, "!%s address-family ", VTY_NEWLINE);
if (afi == AFI_IP) if (afi == AFI_IP)
{ {
if (safi == SAFI_MULTICAST) if (safi == SAFI_UNICAST)
vty_out (vty, "ipv4 unicast");
else if (safi == SAFI_MULTICAST)
vty_out (vty, "ipv4 multicast"); vty_out (vty, "ipv4 multicast");
else if (safi == SAFI_MPLS_VPN) else if (safi == SAFI_MPLS_VPN)
vty_out (vty, "vpnv4 unicast"); vty_out (vty, "vpnv4 unicast");
} }
else if (afi == AFI_IP6) else if (afi == AFI_IP6)
{ {
vty_out (vty, "ipv6"); if (safi == SAFI_UNICAST)
vty_out (vty, "ipv6 unicast");
if (safi == SAFI_MULTICAST) else if (safi == SAFI_MULTICAST)
vty_out (vty, " multicast"); vty_out (vty, "ipv6 multicast");
} }
vty_out (vty, "%s", VTY_NEWLINE); vty_out (vty, "%s", VTY_NEWLINE);
@ -6586,7 +6666,7 @@ bgp_config_write_family (struct vty *vty, struct bgp *bgp, afi_t afi,
if (group->conf->afc[afi][safi]) if (group->conf->afc[afi][safi])
{ {
bgp_config_write_family_header (vty, afi, safi, &write); bgp_config_write_family_header (vty, afi, safi, &write);
bgp_config_write_peer (vty, bgp, group->conf, afi, safi); bgp_config_write_peer_af (vty, bgp, group->conf, afi, safi);
} }
} }
for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
@ -6600,7 +6680,7 @@ bgp_config_write_family (struct vty *vty, struct bgp *bgp, afi_t afi,
if (CHECK_FLAG (peer->flags, PEER_FLAG_CONFIG_NODE)) if (CHECK_FLAG (peer->flags, PEER_FLAG_CONFIG_NODE))
{ {
bgp_config_write_family_header (vty, afi, safi, &write); bgp_config_write_family_header (vty, afi, safi, &write);
bgp_config_write_peer (vty, bgp, peer, afi, safi); bgp_config_write_peer_af (vty, bgp, peer, afi, safi);
} }
} }
} }
@ -6668,8 +6748,8 @@ bgp_config_write (struct vty *vty)
VTY_NEWLINE); VTY_NEWLINE);
/* BGP log-neighbor-changes. */ /* BGP log-neighbor-changes. */
if (bgp_flag_check (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) if (!bgp_flag_check (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES))
vty_out (vty, " bgp log-neighbor-changes%s", VTY_NEWLINE); vty_out (vty, " no bgp log-neighbor-changes%s", VTY_NEWLINE);
/* BGP configuration. */ /* BGP configuration. */
if (bgp_flag_check (bgp, BGP_FLAG_ALWAYS_COMPARE_MED)) if (bgp_flag_check (bgp, BGP_FLAG_ALWAYS_COMPARE_MED))
@ -6685,8 +6765,8 @@ bgp_config_write (struct vty *vty)
bgp->default_local_pref, VTY_NEWLINE); bgp->default_local_pref, VTY_NEWLINE);
/* BGP default show-hostname */ /* BGP default show-hostname */
if (bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME)) if (!bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME))
vty_out (vty, " bgp default show-hostname%s", VTY_NEWLINE); vty_out (vty, " no bgp default show-hostname%s", VTY_NEWLINE);
/* BGP default subgroup-pkt-queue-max. */ /* BGP default subgroup-pkt-queue-max. */
if (bgp->default_subgroup_pkt_queue_max != BGP_DEFAULT_SUBGROUP_PKT_QUEUE_MAX) if (bgp->default_subgroup_pkt_queue_max != BGP_DEFAULT_SUBGROUP_PKT_QUEUE_MAX)
@ -6795,22 +6875,14 @@ bgp_config_write (struct vty *vty)
} }
/* BGP network import check. */ /* BGP network import check. */
if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK_EXACT_MATCH)) if (!bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK))
vty_out (vty, " bgp network import-check exact%s", VTY_NEWLINE); vty_out (vty, " no bgp network import-check%s", VTY_NEWLINE);
else if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK))
vty_out (vty, " bgp network import-check%s", VTY_NEWLINE);
/* BGP flag dampening. */ /* BGP flag dampening. */
if (CHECK_FLAG (bgp->af_flags[AFI_IP][SAFI_UNICAST], if (CHECK_FLAG (bgp->af_flags[AFI_IP][SAFI_UNICAST],
BGP_CONFIG_DAMPENING)) BGP_CONFIG_DAMPENING))
bgp_config_write_damp (vty); bgp_config_write_damp (vty);
/* BGP static route configuration. */
bgp_config_write_network (vty, bgp, AFI_IP, SAFI_UNICAST, &write);
/* BGP redistribute configuration. */
bgp_config_write_redistribute (vty, bgp, AFI_IP, SAFI_UNICAST, &write);
/* BGP timers configuration. */ /* BGP timers configuration. */
if (bgp->default_keepalive != BGP_DEFAULT_KEEPALIVE if (bgp->default_keepalive != BGP_DEFAULT_KEEPALIVE
&& bgp->default_holdtime != BGP_DEFAULT_HOLDTIME) && bgp->default_holdtime != BGP_DEFAULT_HOLDTIME)
@ -6824,20 +6896,16 @@ bgp_config_write (struct vty *vty)
/* peer-group */ /* peer-group */
for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group))
{ {
bgp_config_write_peer (vty, bgp, group->conf, AFI_IP, SAFI_UNICAST); bgp_config_write_peer_global (vty, bgp, group->conf);
} }
/* Normal neighbor configuration. */ /* Normal neighbor configuration. */
for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
{ {
if (CHECK_FLAG (peer->flags, PEER_FLAG_CONFIG_NODE)) if (CHECK_FLAG (peer->flags, PEER_FLAG_CONFIG_NODE))
bgp_config_write_peer (vty, bgp, peer, AFI_IP, SAFI_UNICAST); bgp_config_write_peer_global (vty, bgp, peer);
} }
/* maximum-paths */
bgp_config_write_maxpaths (vty, bgp, AFI_IP, SAFI_UNICAST, &write);
bgp_config_write_table_map (vty, bgp, AFI_IP, SAFI_UNICAST, &write);
/* Distance configuration. */ /* Distance configuration. */
bgp_config_write_distance (vty, bgp); bgp_config_write_distance (vty, bgp);
@ -6848,6 +6916,9 @@ bgp_config_write (struct vty *vty)
if (bgp_option_check (BGP_OPT_CONFIG_CISCO)) if (bgp_option_check (BGP_OPT_CONFIG_CISCO))
vty_out (vty, " no auto-summary%s", VTY_NEWLINE); vty_out (vty, " no auto-summary%s", VTY_NEWLINE);
/* IPv4 unicast configuration. */
write += bgp_config_write_family (vty, bgp, AFI_IP, SAFI_UNICAST);
/* IPv4 multicast configuration. */ /* IPv4 multicast configuration. */
write += bgp_config_write_family (vty, bgp, AFI_IP, SAFI_MULTICAST); write += bgp_config_write_family (vty, bgp, AFI_IP, SAFI_MULTICAST);

View File

@ -255,8 +255,7 @@ struct bgp
#define BGP_FLAG_DISABLE_NH_CONNECTED_CHK (1 << 16) #define BGP_FLAG_DISABLE_NH_CONNECTED_CHK (1 << 16)
#define BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET (1 << 17) #define BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET (1 << 17)
#define BGP_FLAG_FORCE_STATIC_PROCESS (1 << 18) #define BGP_FLAG_FORCE_STATIC_PROCESS (1 << 18)
#define BGP_FLAG_IMPORT_CHECK_EXACT_MATCH (1 << 19) #define BGP_FLAG_SHOW_HOSTNAME (1 << 19)
#define BGP_FLAG_SHOW_HOSTNAME (1 << 20)
/* BGP Per AF flags */ /* BGP Per AF flags */
u_int16_t af_flags[AFI_MAX][SAFI_MAX]; u_int16_t af_flags[AFI_MAX][SAFI_MAX];
@ -695,7 +694,6 @@ struct peer
u_int32_t v_connect; u_int32_t v_connect;
u_int32_t v_holdtime; u_int32_t v_holdtime;
u_int32_t v_keepalive; u_int32_t v_keepalive;
u_int32_t v_asorig;
u_int32_t v_routeadv; u_int32_t v_routeadv;
u_int32_t v_pmax_restart; u_int32_t v_pmax_restart;
u_int32_t v_gr_restart; u_int32_t v_gr_restart;
@ -707,7 +705,6 @@ struct peer
struct thread *t_connect; struct thread *t_connect;
struct thread *t_holdtime; struct thread *t_holdtime;
struct thread *t_keepalive; struct thread *t_keepalive;
struct thread *t_asorig;
struct thread *t_routeadv; struct thread *t_routeadv;
struct thread *t_pmax_restart; struct thread *t_pmax_restart;
struct thread *t_gr_restart; struct thread *t_gr_restart;
@ -996,13 +993,11 @@ struct bgp_nlri
/* BGP timers default value. */ /* BGP timers default value. */
#define BGP_INIT_START_TIMER 1 #define BGP_INIT_START_TIMER 1
#define BGP_ERROR_START_TIMER 30 #define BGP_DEFAULT_HOLDTIME 9
#define BGP_DEFAULT_HOLDTIME 180 #define BGP_DEFAULT_KEEPALIVE 3
#define BGP_DEFAULT_KEEPALIVE 60 #define BGP_DEFAULT_EBGP_ROUTEADV 0
#define BGP_DEFAULT_ASORIGINATE 15 #define BGP_DEFAULT_IBGP_ROUTEADV 0
#define BGP_DEFAULT_EBGP_ROUTEADV 30 #define BGP_DEFAULT_CONNECT_RETRY 10
#define BGP_DEFAULT_IBGP_ROUTEADV 5
#define BGP_DEFAULT_CONNECT_RETRY 120
/* BGP default local preference. */ /* BGP default local preference. */
#define BGP_DEFAULT_LOCAL_PREF 100 #define BGP_DEFAULT_LOCAL_PREF 100

View File

@ -88,9 +88,9 @@
#define OSPF_AREA_TYPE_MAX 3 #define OSPF_AREA_TYPE_MAX 3
/* SPF Throttling timer values. */ /* SPF Throttling timer values. */
#define OSPF_SPF_DELAY_DEFAULT 200 #define OSPF_SPF_DELAY_DEFAULT 0
#define OSPF_SPF_HOLDTIME_DEFAULT 1000 #define OSPF_SPF_HOLDTIME_DEFAULT 50
#define OSPF_SPF_MAX_HOLDTIME_DEFAULT 10000 #define OSPF_SPF_MAX_HOLDTIME_DEFAULT 5000
#define OSPF_LSA_MAXAGE_CHECK_INTERVAL 30 #define OSPF_LSA_MAXAGE_CHECK_INTERVAL 30
#define OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT 60 #define OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT 60

View File

@ -292,17 +292,18 @@ end
elif "address-family " in line: elif "address-family " in line:
main_ctx_key = [] main_ctx_key = []
if line != "address-family ipv4 unicast": # Save old context first
# Save old context first self.save_contexts(ctx_keys, current_context_lines)
self.save_contexts(ctx_keys, current_context_lines) current_context_lines = []
current_context_lines = [] main_ctx_key = copy.deepcopy(ctx_keys)
main_ctx_key = copy.deepcopy(ctx_keys) logger.debug('LINE %-50s: entering sub-context, append to ctx_keys', line)
logger.debug('LINE %-50s: entering sub-context, append to ctx_keys', line)
if line == "address-family ipv6": if line == "address-family ipv6":
ctx_keys.append("address-family ipv6 unicast") ctx_keys.append("address-family ipv6 unicast")
else: elif line == "address-family ipv4":
ctx_keys.append(line) ctx_keys.append("address-family ipv4 unicast")
else:
ctx_keys.append(line)
else: else:
# Continuing in an existing context, add non-commented lines to it # Continuing in an existing context, add non-commented lines to it

View File

@ -175,6 +175,8 @@ vtysh_config_parse_line (const char *line)
switch (c) switch (c)
{ {
/* Suppress exclamation points ! and commented lines. The !s are generated
* dynamically in vtysh_config_dump() */
case '!': case '!':
case '#': case '#':
break; break;
@ -188,8 +190,11 @@ vtysh_config_parse_line (const char *line)
else if (strncmp (line, " address-family ipv4 multicast", else if (strncmp (line, " address-family ipv4 multicast",
strlen (" address-family ipv4 multicast")) == 0) strlen (" address-family ipv4 multicast")) == 0)
config = config_get (BGP_IPV4M_NODE, line); config = config_get (BGP_IPV4M_NODE, line);
else if (strncmp (line, " address-family ipv6", else if (strncmp (line, " address-family ipv4", strlen (" address-family ipv4")) == 0 ||
strlen (" address-family ipv6")) == 0) strncmp (line, " address-family ipv4 unicast", strlen (" address-family ipv4 unicast")) == 0)
config = config_get (BGP_IPV4_NODE, line);
else if (strncmp (line, " address-family ipv6", strlen (" address-family ipv6")) == 0 ||
strncmp (line, " address-family ipv6 unicast", strlen (" address-family ipv6 unicast")) == 0)
config = config_get (BGP_IPV6_NODE, line); config = config_get (BGP_IPV6_NODE, line);
else if (config->index == RMAP_NODE || else if (config->index == RMAP_NODE ||
config->index == INTERFACE_NODE || config->index == INTERFACE_NODE ||

View File

@ -1500,6 +1500,13 @@ _netlink_route_build_singlepath(
addattr_l (nlmsg, req_size, RTA_GATEWAY, &ipv4_ll, 4); addattr_l (nlmsg, req_size, RTA_GATEWAY, &ipv4_ll, 4);
addattr32 (nlmsg, req_size, RTA_OIF, nexthop->ifindex); addattr32 (nlmsg, req_size, RTA_OIF, nexthop->ifindex);
if (nexthop->rmap_src.ipv4.s_addr && (cmd == RTM_NEWROUTE))
addattr_l (nlmsg, req_size, RTA_PREFSRC,
&nexthop->rmap_src.ipv4, bytelen);
else if (nexthop->src.ipv4.s_addr && (cmd == RTM_NEWROUTE))
addattr_l (nlmsg, req_size, RTA_PREFSRC,
&nexthop->src.ipv4, bytelen);
if (IS_ZEBRA_DEBUG_KERNEL) if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(" 5549: _netlink_route_build_singlepath() (%s): " zlog_debug(" 5549: _netlink_route_build_singlepath() (%s): "
"nexthop via %s if %u", "nexthop via %s if %u",
@ -1648,6 +1655,11 @@ _netlink_route_build_multipath(
rtnh->rtnh_len += sizeof (struct rtattr) + bytelen; rtnh->rtnh_len += sizeof (struct rtattr) + bytelen;
rtnh->rtnh_ifindex = nexthop->ifindex; rtnh->rtnh_ifindex = nexthop->ifindex;
if (nexthop->rmap_src.ipv4.s_addr)
*src = &nexthop->rmap_src;
else if (nexthop->src.ipv4.s_addr)
*src = &nexthop->src;
if (IS_ZEBRA_DEBUG_KERNEL) if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(" 5549: netlink_route_build_multipath() (%s): " zlog_debug(" 5549: netlink_route_build_multipath() (%s): "
"nexthop via %s if %u", "nexthop via %s if %u",

View File

@ -1268,7 +1268,9 @@ nexthop_active_check (struct route_node *rn, struct rib *rib,
UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE); UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
break; break;
case NEXTHOP_TYPE_IPV6_IFINDEX: case NEXTHOP_TYPE_IPV6_IFINDEX:
family = AFI_IP6; /* RFC 5549, v4 prefix with v6 NH */
if (rn->p.family != AF_INET)
family = AFI_IP6;
if (IN6_IS_ADDR_LINKLOCAL (&nexthop->gate.ipv6)) if (IN6_IS_ADDR_LINKLOCAL (&nexthop->gate.ipv6))
{ {
ifp = if_lookup_by_index (nexthop->ifindex); ifp = if_lookup_by_index (nexthop->ifindex);