mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 15:33:56 +00:00
commit
aceb2285da
@ -566,6 +566,7 @@ DEFUN (no_vpnv6_network,
|
|||||||
return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg);
|
return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(KEEP_OLD_VPN_COMMANDS)
|
||||||
static int
|
static int
|
||||||
show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u_char use_json, afi_t afi)
|
show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u_char use_json, afi_t afi)
|
||||||
{
|
{
|
||||||
@ -732,6 +733,7 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u
|
|||||||
}
|
}
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
enum bgp_show_type
|
enum bgp_show_type
|
||||||
{
|
{
|
||||||
|
@ -492,7 +492,7 @@ bgp_show_all_instances_nexthops_vty (struct vty *vty)
|
|||||||
|
|
||||||
DEFUN (show_ip_bgp_nexthop,
|
DEFUN (show_ip_bgp_nexthop,
|
||||||
show_ip_bgp_nexthop_cmd,
|
show_ip_bgp_nexthop_cmd,
|
||||||
"show [ip] bgp [<view|vrf> VRFNAME] nexthop [detail]",
|
"show [ip] bgp [<view|vrf> WORD] nexthop [detail]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
@ -501,7 +501,7 @@ DEFUN (show_ip_bgp_nexthop,
|
|||||||
"Show detailed information\n")
|
"Show detailed information\n")
|
||||||
{
|
{
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
char *vrf = argv_find (argv, argc, "VRFNAME", &idx) ? argv[idx]->arg : NULL;
|
char *vrf = argv_find (argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL;
|
||||||
int detail = argv_find (argv, argc, "detail", &idx) ? 1 : 0;
|
int detail = argv_find (argv, argc, "detail", &idx) ? 1 : 0;
|
||||||
return show_ip_bgp_nexthop_table (vty, vrf, detail);
|
return show_ip_bgp_nexthop_table (vty, vrf, detail);
|
||||||
}
|
}
|
||||||
|
718
bgpd/bgp_route.c
718
bgpd/bgp_route.c
File diff suppressed because it is too large
Load Diff
@ -4399,7 +4399,7 @@ DEFUN (no_set_vpn_nexthop,
|
|||||||
|
|
||||||
DEFUN (set_ipx_vpn_nexthop,
|
DEFUN (set_ipx_vpn_nexthop,
|
||||||
set_ipx_vpn_nexthop_cmd,
|
set_ipx_vpn_nexthop_cmd,
|
||||||
"set <ipv4|ipv6> vpn next-hop [A.B.C.D|X:X::X:X]",
|
"set <ipv4|ipv6> vpn next-hop [<A.B.C.D|X:X::X:X>]",
|
||||||
SET_STR
|
SET_STR
|
||||||
"IPv4 information\n"
|
"IPv4 information\n"
|
||||||
"IPv6 information\n"
|
"IPv6 information\n"
|
||||||
@ -4426,7 +4426,7 @@ DEFUN (set_ipx_vpn_nexthop,
|
|||||||
|
|
||||||
DEFUN (no_set_ipx_vpn_nexthop,
|
DEFUN (no_set_ipx_vpn_nexthop,
|
||||||
no_set_ipx_vpn_nexthop_cmd,
|
no_set_ipx_vpn_nexthop_cmd,
|
||||||
"no set <ipv4|ipv6> vpn next-hop [A.B.C.D|X:X::X:X]",
|
"no set <ipv4|ipv6> vpn next-hop [<A.B.C.D|X:X::X:X>]",
|
||||||
NO_STR
|
NO_STR
|
||||||
SET_STR
|
SET_STR
|
||||||
"IPv4 information\n"
|
"IPv4 information\n"
|
||||||
|
@ -168,17 +168,7 @@ bgp_vty_safi_from_arg(const char *safi_str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_parse_safi(const char *str, safi_t *safi)
|
argv_find_and_parse_safi (struct cmd_token **argv, int argc, int *index, safi_t *safi)
|
||||||
{
|
|
||||||
*safi = bgp_vty_safi_from_arg(str);
|
|
||||||
if (*safi != SAFI_MAX)
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
argv_find_and_parse_safi(struct cmd_token **argv, int argc, int *index, safi_t *safi)
|
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (argv_find (argv, argc, "unicast", index))
|
if (argv_find (argv, argc, "unicast", index))
|
||||||
@ -208,6 +198,80 @@ argv_find_and_parse_safi(struct cmd_token **argv, int argc, int *index, safi_t *
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bgp_vty_find_and_parse_afi_safi_vrf
|
||||||
|
*
|
||||||
|
* For a given 'show ...' command, correctly parse the afi/safi/vrf out from it
|
||||||
|
* This function *assumes* that the calling function pre-sets the afi/safi/vrf
|
||||||
|
* to appropriate values for the calling function. This is to allow the
|
||||||
|
* calling function to make decisions appropriate for the show command
|
||||||
|
* that is being parsed.
|
||||||
|
*
|
||||||
|
* The show commands are generally of the form:
|
||||||
|
* "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]] ..."
|
||||||
|
*
|
||||||
|
* Since we use argv_find if the show command in particular doesn't have:
|
||||||
|
* [ip]
|
||||||
|
* [<view|vrf> WORD]
|
||||||
|
* [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]]
|
||||||
|
* The command parsing should still be ok.
|
||||||
|
*
|
||||||
|
* vty -> The vty for the command so we can output some useful data in
|
||||||
|
* the event of a parse error in the vrf.
|
||||||
|
* argv -> The command tokens
|
||||||
|
* argc -> How many command tokens we have
|
||||||
|
* idx -> The current place in the command, generally should be 0 for this function
|
||||||
|
* afi -> The parsed afi if it was included in the show command, returned here
|
||||||
|
* safi -> The parsed safi if it was included in the show command, returned here
|
||||||
|
* vrf -> The parsed vrf id if it was included in the show command, returned here
|
||||||
|
*
|
||||||
|
* The function returns the correct location in the parse tree for the
|
||||||
|
* last token found.
|
||||||
|
*
|
||||||
|
* Returns 0 for failure to parse correctly, else the idx position of where
|
||||||
|
* it found the last token.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
bgp_vty_find_and_parse_afi_safi_vrf (struct vty *vty, struct cmd_token **argv, int argc, int *idx,
|
||||||
|
afi_t *afi, safi_t *safi, vrf_id_t *vrf)
|
||||||
|
{
|
||||||
|
char *vrf_name = NULL;
|
||||||
|
|
||||||
|
assert (afi);
|
||||||
|
assert (safi);
|
||||||
|
assert (vrf && *vrf != VRF_UNKNOWN);
|
||||||
|
|
||||||
|
if (argv_find (argv, argc, "ip", idx))
|
||||||
|
*afi = AFI_IP;
|
||||||
|
|
||||||
|
if (argv_find (argv, argc, "view", idx) || argv_find (argv, argc, "vrf", idx))
|
||||||
|
{
|
||||||
|
vrf_name = argv[*idx + 1]->arg;
|
||||||
|
*idx += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argv_find_and_parse_afi (argv, argc, idx, afi))
|
||||||
|
argv_find_and_parse_safi (argv, argc, idx, safi);
|
||||||
|
|
||||||
|
if (vrf_name)
|
||||||
|
{
|
||||||
|
if (strmatch(vrf_name, "all"))
|
||||||
|
*vrf = VRF_ALL;
|
||||||
|
else
|
||||||
|
*vrf = vrf_name_to_id (vrf_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*vrf == VRF_UNKNOWN)
|
||||||
|
{
|
||||||
|
vty_out (vty, "View/Vrf specified is unknown: %s", vrf_name);
|
||||||
|
*idx = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
*idx += 1;
|
||||||
|
return *idx;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
peer_address_self_check (struct bgp *bgp, union sockunion *su)
|
peer_address_self_check (struct bgp *bgp, union sockunion *su)
|
||||||
{
|
{
|
||||||
@ -8614,7 +8678,7 @@ DEFUN (show_ip_bgp_neighbors,
|
|||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
BGP_INSTANCE_ALL_HELP_STR
|
BGP_INSTANCE_HELP_STR
|
||||||
"Address Family\n"
|
"Address Family\n"
|
||||||
"Address Family\n"
|
"Address Family\n"
|
||||||
"Address Family\n"
|
"Address Family\n"
|
||||||
@ -9280,7 +9344,7 @@ bgp_show_peer_group_vty (struct vty *vty, const char *name,
|
|||||||
|
|
||||||
DEFUN (show_ip_bgp_peer_groups,
|
DEFUN (show_ip_bgp_peer_groups,
|
||||||
show_ip_bgp_peer_groups_cmd,
|
show_ip_bgp_peer_groups_cmd,
|
||||||
"show [ip] bgp [<view|vrf> VRFNAME] peer-group [PGNAME]",
|
"show [ip] bgp [<view|vrf> WORD] peer-group [PGNAME]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
@ -9292,7 +9356,7 @@ DEFUN (show_ip_bgp_peer_groups,
|
|||||||
vrf = pg = NULL;
|
vrf = pg = NULL;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
vrf = argv_find (argv, argc, "VRFNAME", &idx) ? argv[idx]->arg : NULL;
|
vrf = argv_find (argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL;
|
||||||
pg = argv_find (argv, argc, "PGNAME", &idx) ? argv[idx]->arg : NULL;
|
pg = argv_find (argv, argc, "PGNAME", &idx) ? argv[idx]->arg : NULL;
|
||||||
|
|
||||||
return bgp_show_peer_group_vty (vty, vrf, show_all_groups, pg);
|
return bgp_show_peer_group_vty (vty, vrf, show_all_groups, pg);
|
||||||
|
@ -51,9 +51,6 @@ peer_and_group_lookup_vty (struct vty *vty, const char *peer_str);
|
|||||||
extern int
|
extern int
|
||||||
bgp_parse_afi(const char *str, afi_t *afi);
|
bgp_parse_afi(const char *str, afi_t *afi);
|
||||||
|
|
||||||
extern int
|
|
||||||
bgp_parse_safi(const char *str, safi_t *safi);
|
|
||||||
|
|
||||||
extern afi_t
|
extern afi_t
|
||||||
bgp_vty_afi_from_arg(const char *afi_str);
|
bgp_vty_afi_from_arg(const char *afi_str);
|
||||||
|
|
||||||
@ -66,4 +63,7 @@ argv_find_and_parse_afi(struct cmd_token **argv, int argc, int *index, afi_t *af
|
|||||||
extern int
|
extern int
|
||||||
argv_find_and_parse_safi(struct cmd_token **argv, int argc, int *index, safi_t *safi);
|
argv_find_and_parse_safi(struct cmd_token **argv, int argc, int *index, safi_t *safi);
|
||||||
|
|
||||||
|
extern int
|
||||||
|
bgp_vty_find_and_parse_afi_safi_vrf (struct vty *vty, struct cmd_token **argv, int argc, int *idx,
|
||||||
|
afi_t *afi, safi_t *safi, vrf_id_t *vrf);
|
||||||
#endif /* _QUAGGA_BGP_VTY_H */
|
#endif /* _QUAGGA_BGP_VTY_H */
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
/* The default VRF ID */
|
/* The default VRF ID */
|
||||||
#define VRF_DEFAULT 0
|
#define VRF_DEFAULT 0
|
||||||
#define VRF_UNKNOWN UINT16_MAX
|
#define VRF_UNKNOWN UINT16_MAX
|
||||||
|
#define VRF_ALL UINT16_MAX - 1
|
||||||
|
|
||||||
/* Pending: May need to refine this. */
|
/* Pending: May need to refine this. */
|
||||||
#ifndef IFLA_VRF_MAX
|
#ifndef IFLA_VRF_MAX
|
||||||
|
Loading…
Reference in New Issue
Block a user