diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-10-25 22:29:52 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-10-25 22:29:52 +0200 |
commit | d64ff607e8a5b84cb3226bd38a5af09668a05fd3 (patch) | |
tree | 5986c22d3fb8aaf17d64226a7cdd4fcd913fef2f /zebra | |
parent | Merge branch 'cmaster-next' into vtysh-grammar (diff) | |
parent | ospfd: Only allow ospf RI commands if RI is turned on (diff) | |
download | frr-d64ff607e8a5b84cb3226bd38a5af09668a05fd3.tar.xz frr-d64ff607e8a5b84cb3226bd38a5af09668a05fd3.zip |
Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Conflicts:
ospfd/ospf_ri.c
zebra/zebra_vty.c
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/zebra_mpls_vty.c | 10 | ||||
-rw-r--r-- | zebra/zebra_vty.c | 32 |
2 files changed, 32 insertions, 10 deletions
diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c index 061bb244b..ff84c5943 100644 --- a/zebra/zebra_mpls_vty.c +++ b/zebra/zebra_mpls_vty.c @@ -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); diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index bc56e2585..667dfd031 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -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. */ |