Merge branch 'cmaster-next' into vtysh-grammar

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	bgpd/bgp_vty.c
This commit is contained in:
Quentin Young 2016-10-21 19:49:16 +00:00
commit fd8503f557
10 changed files with 185 additions and 111 deletions

View File

@ -1164,8 +1164,8 @@ aspath_firstas_check (struct aspath *aspath, as_t asno)
return 0; return 0;
} }
int unsigned int
aspath_get_firstas (struct aspath *aspath) aspath_get_first_as (struct aspath *aspath)
{ {
if (aspath == NULL || aspath->segments == NULL) if (aspath == NULL || aspath->segments == NULL)
return 0; return 0;
@ -1173,6 +1173,29 @@ aspath_get_firstas (struct aspath *aspath)
return aspath->segments->as[0]; return aspath->segments->as[0];
} }
unsigned int
aspath_get_last_as (struct aspath *aspath)
{
int i;
unsigned int last_as = 0;
const struct assegment *seg;
if (aspath == NULL || aspath->segments == NULL)
return last_as;
seg = aspath->segments;
while (seg)
{
if (seg->type == AS_SEQUENCE || seg->type == AS_CONFED_SEQUENCE)
for (i = 0; i < seg->length; i++)
last_as = seg->as[i];
seg = seg->next;
}
return last_as;
}
/* AS path loop check. If aspath contains asno then return >= 1. */ /* AS path loop check. If aspath contains asno then return >= 1. */
int int
aspath_loop_check (struct aspath *aspath, as_t asno) aspath_loop_check (struct aspath *aspath, as_t asno)

View File

@ -101,7 +101,8 @@ extern const char *aspath_print (struct aspath *);
extern void aspath_print_vty (struct vty *, const char *, struct aspath *, const char *); extern void aspath_print_vty (struct vty *, const char *, struct aspath *, const char *);
extern void aspath_print_all_vty (struct vty *); extern void aspath_print_all_vty (struct vty *);
extern unsigned int aspath_key_make (void *); extern unsigned int aspath_key_make (void *);
extern int aspath_get_firstas (struct aspath *); extern unsigned int aspath_get_first_as (struct aspath *);
extern unsigned int aspath_get_last_as (struct aspath *);
extern int aspath_loop_check (struct aspath *, as_t); extern int aspath_loop_check (struct aspath *, as_t);
extern int aspath_private_as_check (struct aspath *); extern int aspath_private_as_check (struct aspath *);
extern int aspath_single_asn_check (struct aspath *, as_t asn); extern int aspath_single_asn_check (struct aspath *, as_t asn);

View File

@ -1656,7 +1656,7 @@ bgp_best_selection (struct bgp *bgp, struct bgp_node *rn,
{ {
bgp_info_path_with_addpath_rx_str (new_select, path_buf); bgp_info_path_with_addpath_rx_str (new_select, path_buf);
zlog_debug("%s: %s is the bestpath from AS %d", zlog_debug("%s: %s is the bestpath from AS %d",
pfx_buf, path_buf, aspath_get_firstas(new_select->attr->aspath)); pfx_buf, path_buf, aspath_get_first_as(new_select->attr->aspath));
} }
} }
} }
@ -2354,6 +2354,7 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id,
char buf[SU_ADDRSTRLEN]; char buf[SU_ADDRSTRLEN];
char buf2[30]; char buf2[30];
int connected = 0; int connected = 0;
int do_loop_check = 1;
#if ENABLE_BGP_VNC #if ENABLE_BGP_VNC
int vnc_implicit_withdraw = 0; int vnc_implicit_withdraw = 0;
#endif #endif
@ -2389,15 +2390,24 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id,
} }
} }
/* If the peer is configured for "allowas-in origin" and the last ASN in the
* as-path is our ASN then we do not need to call aspath_loop_check
*/
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN_ORIGIN))
if (aspath_get_last_as(attr->aspath) == bgp->as)
do_loop_check = 0;
/* AS path loop check. */ /* AS path loop check. */
if (do_loop_check)
{
if (aspath_loop_check (attr->aspath, bgp->as) > peer->allowas_in[afi][safi] if (aspath_loop_check (attr->aspath, bgp->as) > peer->allowas_in[afi][safi]
|| (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION) || (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)
&& aspath_loop_check(attr->aspath, bgp->confed_id) && aspath_loop_check(attr->aspath, bgp->confed_id) > peer->allowas_in[afi][safi]))
> peer->allowas_in[afi][safi]))
{ {
reason = "as-path contains our own AS;"; reason = "as-path contains our own AS;";
goto filtered; goto filtered;
} }
}
/* Route reflector originator ID check. */ /* Route reflector originator ID check. */
if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID) if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID)
@ -6718,7 +6728,7 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
struct peer *peer; struct peer *peer;
int addpath_capable; int addpath_capable;
int has_adj; int has_adj;
int first_as; unsigned int first_as;
if (json_paths) if (json_paths)
{ {
@ -7147,7 +7157,7 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
// Mark the bestpath(s) // Mark the bestpath(s)
if (CHECK_FLAG (binfo->flags, BGP_INFO_DMED_SELECTED)) if (CHECK_FLAG (binfo->flags, BGP_INFO_DMED_SELECTED))
{ {
first_as = aspath_get_firstas(attr->aspath); first_as = aspath_get_first_as(attr->aspath);
if (json_paths) if (json_paths)
{ {

View File

@ -5500,41 +5500,49 @@ DEFUN (no_neighbor_maximum_prefix,
/* "neighbor allowas-in" */ /* "neighbor allowas-in" */
DEFUN (neighbor_allowas_in, DEFUN (neighbor_allowas_in,
neighbor_allowas_in_cmd, neighbor_allowas_in_cmd,
"neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [(1-10)]", "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
NEIGHBOR_STR NEIGHBOR_STR
NEIGHBOR_ADDR_STR2 NEIGHBOR_ADDR_STR2
"Accept as-path with my AS present in it\n" "Accept as-path with my AS present in it\n"
"Number of occurances of AS number\n") "Number of occurances of AS number\n"
"Only accept my AS in the as-path if the route was originated in my AS\n")
{ {
int idx_peer = 1; int idx_peer = 1;
int idx_number = 3; int idx_number_origin = 3;
int ret; int ret;
int origin = 0;
struct peer *peer; struct peer *peer;
unsigned int allow_num; int allow_num = 0;
peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg); peer = peer_and_group_lookup_vty (vty, argv[idx_peer]->arg);
if (! peer) if (! peer)
return CMD_WARNING; return CMD_WARNING;
if (argc <= idx_number) if (argc <= idx_number_origin)
allow_num = 3; allow_num = 3;
else else
VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[idx_number]->arg, 1, 10); {
if (argv[idx_number_origin]->type == WORD_TKN)
origin = 1;
else
allow_num = atoi (argv[idx_number_origin]->arg);
}
ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
allow_num); allow_num, origin);
return bgp_vty_return (vty, ret); return bgp_vty_return (vty, ret);
} }
DEFUN (no_neighbor_allowas_in, DEFUN (no_neighbor_allowas_in,
no_neighbor_allowas_in_cmd, no_neighbor_allowas_in_cmd,
"no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [(1-10)]", "no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
NO_STR NO_STR
NEIGHBOR_STR NEIGHBOR_STR
NEIGHBOR_ADDR_STR2 NEIGHBOR_ADDR_STR2
"allow local ASN appears in aspath attribute\n" "allow local ASN appears in aspath attribute\n"
"Number of occurances of AS number\n") "Number of occurances of AS number\n"
"Only accept my AS in the as-path if the route was originated in my AS\n")
{ {
int idx_peer = 2; int idx_peer = 2;
int ret; int ret;
@ -5549,7 +5557,6 @@ DEFUN (no_neighbor_allowas_in,
return bgp_vty_return (vty, ret); return bgp_vty_return (vty, ret);
} }
DEFUN (neighbor_ttl_security, DEFUN (neighbor_ttl_security,
neighbor_ttl_security_cmd, neighbor_ttl_security_cmd,
"neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)", "neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",

View File

@ -3668,6 +3668,7 @@ static const struct peer_flag_action peer_af_flag_action_list[] =
// PEER_FLAG_DEFAULT_ORIGINATE // PEER_FLAG_DEFAULT_ORIGINATE
{ PEER_FLAG_REMOVE_PRIVATE_AS, 1, peer_change_reset_out }, { PEER_FLAG_REMOVE_PRIVATE_AS, 1, peer_change_reset_out },
{ PEER_FLAG_ALLOWAS_IN, 0, peer_change_reset_in }, { PEER_FLAG_ALLOWAS_IN, 0, peer_change_reset_in },
{ PEER_FLAG_ALLOWAS_IN_ORIGIN, 0, peer_change_reset_in },
{ PEER_FLAG_ORF_PREFIX_SM, 1, peer_change_reset }, { PEER_FLAG_ORF_PREFIX_SM, 1, peer_change_reset },
{ PEER_FLAG_ORF_PREFIX_RM, 1, peer_change_reset }, { PEER_FLAG_ORF_PREFIX_RM, 1, peer_change_reset },
// PEER_FLAG_MAX_PREFIX // PEER_FLAG_MAX_PREFIX
@ -4847,18 +4848,21 @@ peer_interface_unset (struct peer *peer)
/* Allow-as in. */ /* Allow-as in. */
int int
peer_allowas_in_set (struct peer *peer, afi_t afi, safi_t safi, int allow_num) peer_allowas_in_set (struct peer *peer, afi_t afi, safi_t safi, int allow_num,
int origin)
{ {
struct peer_group *group; struct peer_group *group;
struct listnode *node, *nnode; struct listnode *node, *nnode;
if (allow_num < 1 || allow_num > 10) if (origin)
return BGP_ERR_INVALID_VALUE;
if (peer->allowas_in[afi][safi] != allow_num)
{ {
peer->allowas_in[afi][safi] = allow_num; if (peer->allowas_in[afi][safi] ||
SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN); CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN) ||
!CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN_ORIGIN))
{
peer->allowas_in[afi][safi] = 0;
peer_af_flag_unset (peer, afi, safi, PEER_FLAG_ALLOWAS_IN);
peer_af_flag_set (peer, afi, safi, PEER_FLAG_ALLOWAS_IN_ORIGIN);
peer_on_policy_change (peer, afi, safi, 0); peer_on_policy_change (peer, afi, safi, 0);
} }
@ -4868,14 +4872,48 @@ peer_allowas_in_set (struct peer *peer, afi_t afi, safi_t safi, int allow_num)
group = peer->group; group = peer->group;
for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
{ {
if (peer->allowas_in[afi][safi] != allow_num) if (peer->allowas_in[afi][safi] ||
CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN) ||
!CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN_ORIGIN))
{
peer->allowas_in[afi][safi] = 0;
peer_af_flag_unset (peer, afi, safi, PEER_FLAG_ALLOWAS_IN);
peer_af_flag_set (peer, afi, safi, PEER_FLAG_ALLOWAS_IN_ORIGIN);
peer_on_policy_change (peer, afi, safi, 0);
}
}
}
else
{
if (allow_num < 1 || allow_num > 10)
return BGP_ERR_INVALID_VALUE;
if (peer->allowas_in[afi][safi] != allow_num ||
CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN_ORIGIN))
{ {
peer->allowas_in[afi][safi] = allow_num; peer->allowas_in[afi][safi] = allow_num;
SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN); peer_af_flag_set (peer, afi, safi, PEER_FLAG_ALLOWAS_IN);
peer_af_flag_unset (peer, afi, safi, PEER_FLAG_ALLOWAS_IN_ORIGIN);
peer_on_policy_change (peer, afi, safi, 0); peer_on_policy_change (peer, afi, safi, 0);
} }
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
return 0;
group = peer->group;
for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
{
if (peer->allowas_in[afi][safi] != allow_num ||
CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN_ORIGIN))
{
peer->allowas_in[afi][safi] = allow_num;
peer_af_flag_set (peer, afi, safi, PEER_FLAG_ALLOWAS_IN);
peer_af_flag_unset (peer, afi, safi, PEER_FLAG_ALLOWAS_IN_ORIGIN);
peer_on_policy_change (peer, afi, safi, 0);
} }
}
}
return 0; return 0;
} }
@ -4885,10 +4923,12 @@ peer_allowas_in_unset (struct peer *peer, afi_t afi, safi_t safi)
struct peer_group *group; struct peer_group *group;
struct listnode *node, *nnode; struct listnode *node, *nnode;
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN)) if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN) ||
CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN_ORIGIN))
{ {
peer->allowas_in[afi][safi] = 0; peer->allowas_in[afi][safi] = 0;
peer_af_flag_unset (peer, afi, safi, PEER_FLAG_ALLOWAS_IN); peer_af_flag_unset (peer, afi, safi, PEER_FLAG_ALLOWAS_IN);
peer_af_flag_unset (peer, afi, safi, PEER_FLAG_ALLOWAS_IN_ORIGIN);
peer_on_policy_change (peer, afi, safi, 0); peer_on_policy_change (peer, afi, safi, 0);
} }
@ -4898,10 +4938,12 @@ peer_allowas_in_unset (struct peer *peer, afi_t afi, safi_t safi)
group = peer->group; group = peer->group;
for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
{ {
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN)) if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN) ||
CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN_ORIGIN))
{ {
peer->allowas_in[afi][safi] = 0; peer->allowas_in[afi][safi] = 0;
peer_af_flag_unset (peer, afi, safi, PEER_FLAG_ALLOWAS_IN); peer_af_flag_unset (peer, afi, safi, PEER_FLAG_ALLOWAS_IN);
peer_af_flag_unset (peer, afi, safi, PEER_FLAG_ALLOWAS_IN_ORIGIN);
peer_on_policy_change (peer, afi, safi, 0); peer_on_policy_change (peer, afi, safi, 0);
} }
} }
@ -7001,8 +7043,9 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
addr, VTY_NEWLINE); addr, VTY_NEWLINE);
} }
/* Allow AS in. */ /* allowas-in <1-10> */
if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_ALLOWAS_IN)) if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_ALLOWAS_IN))
{
if (! peer_group_active (peer) if (! peer_group_active (peer)
|| ! peer_af_flag_check (g_peer, afi, safi, PEER_FLAG_ALLOWAS_IN) || ! peer_af_flag_check (g_peer, afi, safi, PEER_FLAG_ALLOWAS_IN)
|| peer->allowas_in[afi][safi] != g_peer->allowas_in[afi][safi]) || peer->allowas_in[afi][safi] != g_peer->allowas_in[afi][safi])
@ -7020,6 +7063,19 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
addr, peer->allowas_in[afi][safi], VTY_NEWLINE); addr, peer->allowas_in[afi][safi], VTY_NEWLINE);
} }
} }
}
/* allowas-in origin */
else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_ALLOWAS_IN_ORIGIN))
{
if (! peer_group_active (peer)
|| ! peer_af_flag_check (g_peer, afi, safi, PEER_FLAG_ALLOWAS_IN_ORIGIN))
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s allowas-in origin%s",
addr, VTY_NEWLINE);
}
}
/* weight */ /* weight */
if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_WEIGHT)) if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_WEIGHT))

View File

@ -698,6 +698,7 @@ struct peer
#define PEER_FLAG_ADDPATH_TX_ALL_PATHS (1 << 22) /* addpath-tx-all-paths */ #define PEER_FLAG_ADDPATH_TX_ALL_PATHS (1 << 22) /* addpath-tx-all-paths */
#define PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS (1 << 23) /* addpath-tx-bestpath-per-AS */ #define PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS (1 << 23) /* addpath-tx-bestpath-per-AS */
#define PEER_FLAG_WEIGHT (1 << 24) /* weight */ #define PEER_FLAG_WEIGHT (1 << 24) /* weight */
#define PEER_FLAG_ALLOWAS_IN_ORIGIN (1 << 25) /* allowas-in origin */
/* MD5 password */ /* MD5 password */
char *password; char *password;
@ -1312,7 +1313,7 @@ extern void peer_interface_unset (struct peer *);
extern int peer_distribute_set (struct peer *, afi_t, safi_t, int, const char *); extern int peer_distribute_set (struct peer *, afi_t, safi_t, int, const char *);
extern int peer_distribute_unset (struct peer *, afi_t, safi_t, int); extern int peer_distribute_unset (struct peer *, afi_t, safi_t, int);
extern int peer_allowas_in_set (struct peer *, afi_t, safi_t, int); extern int peer_allowas_in_set (struct peer *, afi_t, safi_t, int, int);
extern int peer_allowas_in_unset (struct peer *, afi_t, safi_t); extern int peer_allowas_in_unset (struct peer *, afi_t, safi_t);
extern int peer_local_as_set (struct peer *, as_t, int, int); extern int peer_local_as_set (struct peer *, as_t, int, int);

View File

@ -623,7 +623,12 @@ rfapi_group_lookup_byname (struct bgp *bgp, const char *name)
static struct rfapi_nve_group_cfg * static struct rfapi_nve_group_cfg *
rfapi_group_new () rfapi_group_new ()
{ {
return XCALLOC (MTYPE_RFAPI_GROUP_CFG, sizeof (struct rfapi_nve_group_cfg)); struct rfapi_nve_group_cfg *rfg;
rfg = XCALLOC (MTYPE_RFAPI_GROUP_CFG, sizeof (struct rfapi_nve_group_cfg));
QOBJ_REG (rfg, rfapi_nve_group_cfg);
return rfg;
} }
static struct rfapi_l2_group_cfg * static struct rfapi_l2_group_cfg *
@ -646,12 +651,18 @@ rfapi_l2_group_lookup_byname (struct bgp *bgp, const char *name)
static struct rfapi_l2_group_cfg * static struct rfapi_l2_group_cfg *
rfapi_l2_group_new () rfapi_l2_group_new ()
{ {
return XCALLOC (MTYPE_RFAPI_L2_CFG, sizeof (struct rfapi_l2_group_cfg)); struct rfapi_l2_group_cfg *rfg;
rfg = XCALLOC (MTYPE_RFAPI_L2_CFG, sizeof (struct rfapi_l2_group_cfg));
QOBJ_REG (rfg, rfapi_l2_group_cfg);
return rfg;
} }
static void static void
rfapi_l2_group_del (struct rfapi_l2_group_cfg *rfg) rfapi_l2_group_del (struct rfapi_l2_group_cfg *rfg)
{ {
QOBJ_UNREG (rfg);
XFREE (MTYPE_RFAPI_L2_CFG, rfg); XFREE (MTYPE_RFAPI_L2_CFG, rfg);
} }
@ -2752,6 +2763,7 @@ bgp_rfapi_delete_nve_group (
XFREE (MTYPE_RFAPI_RFP_GROUP_CFG, rfg->rfp_cfg); XFREE (MTYPE_RFAPI_RFP_GROUP_CFG, rfg->rfp_cfg);
listnode_delete (bgp->rfapi_cfg->nve_groups_sequential, rfg); listnode_delete (bgp->rfapi_cfg->nve_groups_sequential, rfg);
QOBJ_UNREG (rfg);
XFREE (MTYPE_RFAPI_GROUP_CFG, rfg); XFREE (MTYPE_RFAPI_GROUP_CFG, rfg);
/* /*

View File

@ -4983,34 +4983,21 @@ void rfapi_vty_init ()
install_element (ENABLE_NODE, &vnc_clear_counters_cmd); install_element (ENABLE_NODE, &vnc_clear_counters_cmd);
install_element (VIEW_NODE, &vnc_show_summary_cmd); install_element (VIEW_NODE, &vnc_show_summary_cmd);
install_element (ENABLE_NODE, &vnc_show_summary_cmd);
install_element (VIEW_NODE, &vnc_show_nves_cmd); install_element (VIEW_NODE, &vnc_show_nves_cmd);
install_element (ENABLE_NODE, &vnc_show_nves_cmd);
install_element (VIEW_NODE, &vnc_show_nves_ptct_cmd); install_element (VIEW_NODE, &vnc_show_nves_ptct_cmd);
install_element (ENABLE_NODE, &vnc_show_nves_ptct_cmd);
install_element (VIEW_NODE, &vnc_show_registrations_cmd); install_element (VIEW_NODE, &vnc_show_registrations_cmd);
install_element (ENABLE_NODE, &vnc_show_registrations_cmd);
install_element (VIEW_NODE, &vnc_show_registrations_pfx_cmd); install_element (VIEW_NODE, &vnc_show_registrations_pfx_cmd);
install_element (ENABLE_NODE, &vnc_show_registrations_pfx_cmd);
install_element (VIEW_NODE, &vnc_show_registrations_some_cmd); install_element (VIEW_NODE, &vnc_show_registrations_some_cmd);
install_element (ENABLE_NODE, &vnc_show_registrations_some_cmd);
install_element (VIEW_NODE, &vnc_show_registrations_some_pfx_cmd); install_element (VIEW_NODE, &vnc_show_registrations_some_pfx_cmd);
install_element (ENABLE_NODE, &vnc_show_registrations_some_pfx_cmd);
install_element (VIEW_NODE, &vnc_show_responses_cmd); install_element (VIEW_NODE, &vnc_show_responses_cmd);
install_element (ENABLE_NODE, &vnc_show_responses_cmd);
install_element (VIEW_NODE, &vnc_show_responses_pfx_cmd); install_element (VIEW_NODE, &vnc_show_responses_pfx_cmd);
install_element (ENABLE_NODE, &vnc_show_responses_pfx_cmd);
install_element (VIEW_NODE, &vnc_show_responses_some_cmd); install_element (VIEW_NODE, &vnc_show_responses_some_cmd);
install_element (ENABLE_NODE, &vnc_show_responses_some_cmd);
install_element (VIEW_NODE, &vnc_show_responses_some_pfx_cmd); install_element (VIEW_NODE, &vnc_show_responses_some_pfx_cmd);
install_element (ENABLE_NODE, &vnc_show_responses_some_pfx_cmd);
install_element (ENABLE_NODE, &show_vnc_queries_cmd);
install_element (VIEW_NODE, &show_vnc_queries_cmd); install_element (VIEW_NODE, &show_vnc_queries_cmd);
install_element (ENABLE_NODE, &show_vnc_queries_pfx_cmd);
install_element (VIEW_NODE, &show_vnc_queries_pfx_cmd); install_element (VIEW_NODE, &show_vnc_queries_pfx_cmd);
} }

View File

@ -57,7 +57,11 @@ json_object_int_add(struct json_object* obj, const char *key, int32_t i)
void void
json_object_long_add(struct json_object* obj, const char *key, int64_t i) json_object_long_add(struct json_object* obj, const char *key, int64_t i)
{ {
#if defined(HAVE_JSON_C_JSON_H)
json_object_object_add(obj, key, json_object_new_int64(i)); json_object_object_add(obj, key, json_object_new_int64(i));
#else
json_object_object_add(obj, key, json_object_new_int((int)i));
#endif
} }
void void

View File

@ -171,34 +171,7 @@ vtysh_config_parse_line (const char *line)
/* Store line to current configuration. */ /* Store line to current configuration. */
if (config) if (config)
{ {
if (strncmp (line, " address-family vpnv4", if (config->index == RMAP_NODE ||
strlen (" address-family vpnv4")) == 0)
config = config_get (BGP_VPNV4_NODE, line);
else if (strncmp (line, " address-family vpn6",
strlen (" address-family vpn6")) == 0)
config = config_get (BGP_VPNV6_NODE, line);
else if (strncmp (line, " address-family encapv6",
strlen (" address-family encapv6")) == 0)
config = config_get (BGP_ENCAPV6_NODE, line);
else if (strncmp (line, " address-family encap",
strlen (" address-family encap")) == 0)
config = config_get (BGP_ENCAP_NODE, line);
else if (strncmp (line, " address-family ipv4 multicast",
strlen (" address-family ipv4 multicast")) == 0)
config = config_get (BGP_IPV4M_NODE, line);
else if (strncmp (line, " address-family ipv6",
strlen (" address-family ipv6")) == 0)
config = config_get (BGP_IPV6_NODE, line);
else if (strncmp (line, " vnc defaults",
strlen (" vnc defaults")) == 0)
config = config_get (BGP_VNC_DEFAULTS_NODE, line);
else if (strncmp (line, " vnc nve-group",
strlen (" vnc nve-group")) == 0)
config = config_get (BGP_VNC_NVE_GROUP_NODE, line);
else if (strncmp (line, " vnc l2-group",
strlen (" vnc l2-group")) == 0)
config = config_get (BGP_VNC_L2_GROUP_NODE, line);
else if (config->index == RMAP_NODE ||
config->index == INTERFACE_NODE || config->index == INTERFACE_NODE ||
config->index == NS_NODE || config->index == NS_NODE ||
config->index == VTY_NODE) config->index == VTY_NODE)