mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 06:10:37 +00:00
Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Conflicts: ospfd/ospf_ri.c zebra/zebra_vty.c
This commit is contained in:
commit
d64ff607e8
@ -1259,6 +1259,18 @@ DEFUN (no_router_info,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
static int
|
||||
ospf_ri_enabled (struct vty *vty)
|
||||
{
|
||||
if (OspfRI.status == enabled)
|
||||
return 1;
|
||||
|
||||
if (vty)
|
||||
vty_out (vty, "%% OSPF RI is not turned on%s", VTY_NEWLINE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFUN (pce_address,
|
||||
pce_address_cmd,
|
||||
"pce address A.B.C.D",
|
||||
@ -1270,6 +1282,9 @@ DEFUN (pce_address,
|
||||
struct in_addr value;
|
||||
struct ospf_pce_info *pi = &OspfRI.pce_info;
|
||||
|
||||
if (!ospf_ri_enabled (vty))
|
||||
return CMD_WARNING;
|
||||
|
||||
if (!inet_aton (argv[idx_ipv4]->arg, &value))
|
||||
{
|
||||
vty_out (vty, "Please specify PCE Address by A.B.C.D%s", VTY_NEWLINE);
|
||||
@ -1283,7 +1298,7 @@ DEFUN (pce_address,
|
||||
set_pce_address (value, pi);
|
||||
|
||||
/* Refresh RI LSA if already engaged */
|
||||
if ((OspfRI.status == enabled) && (OspfRI.flags & RIFLG_LSA_ENGAGED))
|
||||
if (OspfRI.flags & RIFLG_LSA_ENGAGED)
|
||||
ospf_router_info_lsa_schedule (REFRESH_THIS_LSA);
|
||||
}
|
||||
|
||||
@ -1318,6 +1333,9 @@ DEFUN (pce_path_scope,
|
||||
uint32_t scope;
|
||||
struct ospf_pce_info *pi = &OspfRI.pce_info;
|
||||
|
||||
if (!ospf_ri_enabled (vty))
|
||||
return CMD_WARNING;
|
||||
|
||||
if (sscanf (argv[idx_bitpattern]->arg, "0x%x", &scope) != 1)
|
||||
{
|
||||
vty_out (vty, "pce_path_scope: fscanf: %s%s", safe_strerror (errno),
|
||||
@ -1330,7 +1348,7 @@ DEFUN (pce_path_scope,
|
||||
set_pce_path_scope (scope, pi);
|
||||
|
||||
/* Refresh RI LSA if already engaged */
|
||||
if ((OspfRI.status == enabled) && (OspfRI.flags & RIFLG_LSA_ENGAGED))
|
||||
if (OspfRI.flags & RIFLG_LSA_ENGAGED)
|
||||
ospf_router_info_lsa_schedule (REFRESH_THIS_LSA);
|
||||
}
|
||||
|
||||
@ -1369,6 +1387,9 @@ DEFUN (pce_domain,
|
||||
struct listnode *node;
|
||||
struct ri_pce_subtlv_domain *domain;
|
||||
|
||||
if (!ospf_ri_enabled (vty))
|
||||
return CMD_WARNING;
|
||||
|
||||
if (sscanf (argv[idx_number]->arg, "%d", &as) != 1)
|
||||
{
|
||||
vty_out (vty, "pce_domain: fscanf: %s%s", safe_strerror (errno),
|
||||
@ -1380,17 +1401,17 @@ DEFUN (pce_domain,
|
||||
for (ALL_LIST_ELEMENTS_RO (pce->pce_domain, node, domain))
|
||||
{
|
||||
if (ntohl (domain->header.type) == 0 && as == domain->value)
|
||||
goto out;
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
/* Create new domain if not found */
|
||||
set_pce_domain (PCE_DOMAIN_TYPE_AS, as, pce);
|
||||
|
||||
/* Refresh RI LSA if already engaged */
|
||||
if ((OspfRI.status == enabled) && (OspfRI.flags & RIFLG_LSA_ENGAGED))
|
||||
if (OspfRI.flags & RIFLG_LSA_ENGAGED)
|
||||
ospf_router_info_lsa_schedule (REFRESH_THIS_LSA);
|
||||
|
||||
out:return CMD_SUCCESS;
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (no_pce_domain,
|
||||
@ -1439,6 +1460,9 @@ DEFUN (pce_neigbhor,
|
||||
struct listnode *node;
|
||||
struct ri_pce_subtlv_neighbor *neighbor;
|
||||
|
||||
if (!ospf_ri_enabled (vty))
|
||||
return CMD_WARNING;
|
||||
|
||||
if (sscanf (argv[idx_number]->arg, "%d", &as) != 1)
|
||||
{
|
||||
vty_out (vty, "pce_neighbor: fscanf: %s%s", safe_strerror (errno),
|
||||
@ -1450,17 +1474,17 @@ DEFUN (pce_neigbhor,
|
||||
for (ALL_LIST_ELEMENTS_RO (pce->pce_neighbor, node, neighbor))
|
||||
{
|
||||
if (ntohl (neighbor->header.type) == 0 && as == neighbor->value)
|
||||
goto out;
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
/* Create new domain if not found */
|
||||
set_pce_neighbor (PCE_DOMAIN_TYPE_AS, as, pce);
|
||||
|
||||
/* Refresh RI LSA if already engaged */
|
||||
if ((OspfRI.status == enabled) && (OspfRI.flags & RIFLG_LSA_ENGAGED))
|
||||
if (OspfRI.flags & RIFLG_LSA_ENGAGED)
|
||||
ospf_router_info_lsa_schedule (REFRESH_THIS_LSA);
|
||||
|
||||
out:return CMD_SUCCESS;
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (no_pce_neighbor,
|
||||
@ -1506,6 +1530,9 @@ DEFUN (pce_cap_flag,
|
||||
uint32_t cap;
|
||||
struct ospf_pce_info *pce = &OspfRI.pce_info;
|
||||
|
||||
if (!ospf_ri_enabled (vty))
|
||||
return CMD_WARNING;
|
||||
|
||||
if (sscanf (argv[idx_bitpattern]->arg, "0x%x", &cap) != 1)
|
||||
{
|
||||
vty_out (vty, "pce_cap_flag: fscanf: %s%s", safe_strerror (errno),
|
||||
@ -1519,7 +1546,7 @@ DEFUN (pce_cap_flag,
|
||||
set_pce_cap_flag (cap, pce);
|
||||
|
||||
/* Refresh RI LSA if already engaged */
|
||||
if ((OspfRI.status == enabled) && (OspfRI.flags & RIFLG_LSA_ENGAGED))
|
||||
if (OspfRI.flags & RIFLG_LSA_ENGAGED)
|
||||
ospf_router_info_lsa_schedule (REFRESH_THIS_LSA);
|
||||
}
|
||||
|
||||
|
@ -2452,6 +2452,11 @@ set_inter_as_mode (struct vty *vty, const char *mode_name,
|
||||
return CMD_WARNING;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vty_out (vty, "mpls-te has not been turned on%s", VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,13 @@ zebra_mpls_transit_lsp (struct vty *vty, int add_cmd, const char *inlabel_str,
|
||||
mpls_label_t label;
|
||||
mpls_label_t in_label, out_label;
|
||||
|
||||
if (!mpls_enabled)
|
||||
{
|
||||
vty_out (vty, "%% MPLS not turned on in kernel, ignoring command%s",
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
zvrf = vrf_info_lookup(VRF_DEFAULT);
|
||||
if (!zvrf)
|
||||
{
|
||||
@ -829,9 +836,6 @@ zebra_mpls_vty_init (void)
|
||||
{
|
||||
install_element (VIEW_NODE, &show_mpls_status_cmd);
|
||||
|
||||
if (! mpls_enabled)
|
||||
return;
|
||||
|
||||
install_node (&mpls_node, zebra_mpls_config);
|
||||
|
||||
install_element (CONFIG_NODE, &ip_route_label_cmd);
|
||||
|
@ -118,6 +118,12 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
|
||||
/* Labels */
|
||||
if (label_str)
|
||||
{
|
||||
if (!mpls_enabled)
|
||||
{
|
||||
vty_out (vty, "%% MPLS not turned on in kernel, ignoring command%s",
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
if (mpls_str2label (label_str, &snh_label.num_labels,
|
||||
snh_label.label))
|
||||
{
|
||||
@ -2373,7 +2379,7 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
|
||||
struct static_route *si;
|
||||
struct route_table *stable;
|
||||
struct zebra_vrf *zvrf;
|
||||
char buf[PREFIX_STRLEN];
|
||||
char buf[BUFSIZ];
|
||||
int write =0;
|
||||
struct listnode *node;
|
||||
|
||||
@ -2411,7 +2417,7 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
|
||||
}
|
||||
|
||||
if (si->tag)
|
||||
vty_out (vty, " tag %d", si->tag);
|
||||
vty_out (vty, " tag %"ROUTE_TAG_PRI, si->tag);
|
||||
|
||||
if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
|
||||
vty_out (vty, " %d", si->distance);
|
||||
@ -2419,6 +2425,12 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
|
||||
if (si->vrf_id != VRF_DEFAULT)
|
||||
vty_out (vty, " vrf %s", zvrf ? zvrf->name : "");
|
||||
|
||||
/* Label information */
|
||||
if (si->snh_label.num_labels)
|
||||
vty_out (vty, " label %s",
|
||||
mpls_label2str (si->snh_label.num_labels,
|
||||
si->snh_label.label, buf, sizeof buf));
|
||||
|
||||
vty_out (vty, "%s", VTY_NEWLINE);
|
||||
|
||||
write = 1;
|
||||
@ -2458,16 +2470,16 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
|
||||
/* Apply mask for given prefix. */
|
||||
apply_mask (&p);
|
||||
|
||||
/* tag */
|
||||
if (tag_str)
|
||||
tag = atol(tag_str);
|
||||
|
||||
/* Administrative distance. */
|
||||
if (distance_str)
|
||||
distance = atoi (distance_str);
|
||||
else
|
||||
distance = ZEBRA_STATIC_DISTANCE_DEFAULT;
|
||||
|
||||
/* tag */
|
||||
if (tag_str)
|
||||
tag = atol(tag_str);
|
||||
|
||||
/* When gateway is valid IPv6 addrees, then gate is treated as
|
||||
nexthop address other case gate is treated as interface name. */
|
||||
ret = inet_pton (AF_INET6, gate_str, &gate_addr);
|
||||
@ -2485,6 +2497,12 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
|
||||
memset (&snh_label, 0, sizeof (struct static_nh_label));
|
||||
if (label_str)
|
||||
{
|
||||
if (!mpls_enabled)
|
||||
{
|
||||
vty_out (vty, "%% MPLS not turned on in kernel, ignoring command%s",
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
if (mpls_str2label (label_str, &snh_label.num_labels,
|
||||
snh_label.label))
|
||||
{
|
||||
@ -2527,7 +2545,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
|
||||
}
|
||||
}
|
||||
|
||||
if (ifname)
|
||||
if (ifname)
|
||||
{
|
||||
/* When ifname is specified. It must be come with gateway
|
||||
address. */
|
||||
|
Loading…
Reference in New Issue
Block a user