Merge remote-tracking branch 'origin/stable/3.0'

This commit is contained in:
Donald Sharp 2017-04-17 19:12:44 -04:00
commit 0f5ec54a69
5 changed files with 41 additions and 45 deletions

View File

@ -8171,7 +8171,7 @@ bgp_show_lcommunity (struct vty *vty, struct bgp *bgp, int argc,
buffer_putc (b, ' '); buffer_putc (b, ' ');
else else
{ {
if (strmatch (argv[i]->text, "<AA:BB:CC>")) if (strmatch (argv[i]->text, "AA:BB:CC"))
{ {
first = 1; first = 1;
buffer_putstr (b, argv[i]->arg); buffer_putstr (b, argv[i]->arg);
@ -8187,7 +8187,7 @@ bgp_show_lcommunity (struct vty *vty, struct bgp *bgp, int argc,
XFREE (MTYPE_TMP, str); XFREE (MTYPE_TMP, str);
if (! lcom) if (! lcom)
{ {
vty_out (vty, "%% Large-community malformed: %s", VTY_NEWLINE); vty_out (vty, "%% Large-community malformed%s", VTY_NEWLINE);
return CMD_WARNING; return CMD_WARNING;
} }
@ -8299,8 +8299,7 @@ DEFUN (show_ip_bgp_large_community,
return CMD_WARNING; return CMD_WARNING;
} }
argv_find (argv, argc, "large-community", &idx); if (argv_find (argv, argc, "AA:BB:CC", &idx))
if (strmatch(argv[idx+1]->text, "AA:BB:CC"))
return bgp_show_lcommunity (vty, bgp, argc, argv, afi, safi, uj); return bgp_show_lcommunity (vty, bgp, argc, argv, afi, safi, uj);
else else
return bgp_show (vty, bgp, afi, safi, bgp_show_type_lcommunity_all, NULL, uj); return bgp_show (vty, bgp, afi, safi, bgp_show_type_lcommunity_all, NULL, uj);
@ -8563,8 +8562,6 @@ static int
bgp_show_regexp (struct vty *vty, const char *regstr, afi_t afi, bgp_show_regexp (struct vty *vty, const char *regstr, afi_t afi,
safi_t safi, enum bgp_show_type type) safi_t safi, enum bgp_show_type type)
{ {
return CMD_SUCCESS;
regex_t *regex; regex_t *regex;
int rc; int rc;

View File

@ -1437,7 +1437,7 @@ route_set_aspath_prepend_compile (const char *arg)
{ {
unsigned int num; unsigned int num;
if (sscanf(arg, "last-as %u", &num) == 1 && num > 0 && num < 10) if (sscanf(arg, "last-as %u", &num) == 1 && num > 0 && num <= 10)
return (void*)(uintptr_t)num; return (void*)(uintptr_t)num;
return route_aspath_compile(arg); return route_aspath_compile(arg);
@ -3677,12 +3677,12 @@ DEFUN (set_aspath_prepend_asn,
DEFUN (set_aspath_prepend_lastas, DEFUN (set_aspath_prepend_lastas,
set_aspath_prepend_lastas_cmd, set_aspath_prepend_lastas_cmd,
"set as-path prepend last-as (1-9)", "set as-path prepend last-as (1-10)",
SET_STR SET_STR
"Transform BGP AS_PATH attribute\n" "Transform BGP AS_PATH attribute\n"
"Prepend to the as-path\n" "Prepend to the as-path\n"
"Use the peer's AS-number\n" "Use the peer's AS-number\n"
"Number of times to insert") "Number of times to insert\n")
{ {
return set_aspath_prepend_asn (self, vty, argc, argv); return set_aspath_prepend_asn (self, vty, argc, argv);
} }

View File

@ -1486,7 +1486,9 @@ lm_label_manager_connect (struct zclient *zclient)
vrf_id_t vrf_id; vrf_id_t vrf_id;
u_int16_t cmd; u_int16_t cmd;
if (zclient_debug)
zlog_debug ("Connecting to Label Manager"); zlog_debug ("Connecting to Label Manager");
if (zclient->sock < 0) if (zclient->sock < 0)
return -1; return -1;
@ -1518,6 +1520,7 @@ lm_label_manager_connect (struct zclient *zclient)
zclient->sock = -1; zclient->sock = -1;
return -1; return -1;
} }
if (zclient_debug)
zlog_debug ("%s: Label manager connect request (%d bytes) sent", __func__, ret); zlog_debug ("%s: Label manager connect request (%d bytes) sent", __func__, ret);
/* read response */ /* read response */
@ -1532,6 +1535,7 @@ lm_label_manager_connect (struct zclient *zclient)
} }
/* result */ /* result */
result = stream_getc(s); result = stream_getc(s);
if (zclient_debug)
zlog_debug ("%s: Label Manager connect response (%d bytes) received, result %u", zlog_debug ("%s: Label Manager connect response (%d bytes) received, result %u",
__func__, size, result); __func__, size, result);
@ -1564,7 +1568,9 @@ lm_get_label_chunk (struct zclient *zclient, u_char keep, uint32_t chunk_size,
u_int16_t cmd; u_int16_t cmd;
u_char response_keep; u_char response_keep;
if (zclient_debug)
zlog_debug ("Getting Label Chunk"); zlog_debug ("Getting Label Chunk");
if (zclient->sock < 0) if (zclient->sock < 0)
return -1; return -1;
@ -1594,6 +1600,7 @@ lm_get_label_chunk (struct zclient *zclient, u_char keep, uint32_t chunk_size,
zclient->sock = -1; zclient->sock = -1;
return -1; return -1;
} }
if (zclient_debug)
zlog_debug ("%s: Label chunk request (%d bytes) sent", __func__, ret); zlog_debug ("%s: Label chunk request (%d bytes) sent", __func__, ret);
/* read response */ /* read response */
@ -1606,7 +1613,9 @@ lm_get_label_chunk (struct zclient *zclient, u_char keep, uint32_t chunk_size,
zlog_err ("%s: Invalid Get Label Chunk Message Reply Header", __func__); zlog_err ("%s: Invalid Get Label Chunk Message Reply Header", __func__);
return -1; return -1;
} }
if (zclient_debug)
zlog_debug ("%s: Label chunk response (%d bytes) received", __func__, size); zlog_debug ("%s: Label chunk response (%d bytes) received", __func__, size);
/* keep */ /* keep */
response_keep = stream_getc(s); response_keep = stream_getc(s);
/* start and end labels */ /* start and end labels */
@ -1627,6 +1636,7 @@ lm_get_label_chunk (struct zclient *zclient, u_char keep, uint32_t chunk_size,
return -1; return -1;
} }
if (zclient_debug)
zlog_debug ("Label Chunk assign: %u - %u (%u) ", zlog_debug ("Label Chunk assign: %u - %u (%u) ",
*start, *end, response_keep); *start, *end, response_keep);
@ -1647,7 +1657,9 @@ lm_release_label_chunk (struct zclient *zclient, uint32_t start, uint32_t end)
int ret; int ret;
struct stream *s; struct stream *s;
if (zclient_debug)
zlog_debug ("Releasing Label Chunk"); zlog_debug ("Releasing Label Chunk");
if (zclient->sock < 0) if (zclient->sock < 0)
return -1; return -1;

View File

@ -3557,7 +3557,7 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc,
VTY_NEWLINE, VTY_NEWLINE); VTY_NEWLINE, VTY_NEWLINE);
} }
if (argc == (iface_argv + 1)) if (argc == iface_argv)
{ {
/* Show All Interfaces.*/ /* Show All Interfaces.*/
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
@ -3570,25 +3570,6 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc,
} }
} }
} }
else if (argv[iface_argv] && strcmp(argv[iface_argv]->arg, "json") == 0)
{
if (!use_json)
{
json = json_object_new_object();
json_interface_sub = json_object_new_object ();
use_json = 1;
}
/* Show All Interfaces. */
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
{
if (ospf_oi_count(ifp))
{
show_ip_ospf_interface_sub (vty, ospf, ifp, json_interface_sub, use_json);
if (use_json)
json_object_object_add(json, ifp->name, json_interface_sub);
}
}
}
else else
{ {
/* Interface name is specified. */ /* Interface name is specified. */
@ -3634,7 +3615,10 @@ DEFUN (show_ip_ospf_interface,
if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running) if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
return CMD_SUCCESS; return CMD_SUCCESS;
return show_ip_ospf_interface_common(vty, ospf, argc, argv, 0, uj); if (uj)
argc--;
return show_ip_ospf_interface_common(vty, ospf, argc, argv, 4, uj);
} }
DEFUN (show_ip_ospf_instance_interface, DEFUN (show_ip_ospf_instance_interface,
@ -3657,7 +3641,10 @@ DEFUN (show_ip_ospf_instance_interface,
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS; return CMD_SUCCESS;
return show_ip_ospf_interface_common(vty, ospf, argc, argv, 1, uj); if (uj)
argc--;
return show_ip_ospf_interface_common(vty, ospf, argc, argv, 5, uj);
} }
static void static void

View File

@ -339,7 +339,7 @@ DEFUN (rip_redistribute_type,
for(i = 0; redist_type[i].str; i++) for(i = 0; redist_type[i].str; i++)
{ {
if (strncmp (redist_type[i].str, argv[2]->arg, if (strncmp (redist_type[i].str, argv[1]->arg,
redist_type[i].str_min_len) == 0) redist_type[i].str_min_len) == 0)
{ {
zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient,
@ -348,7 +348,7 @@ DEFUN (rip_redistribute_type,
} }
} }
vty_out(vty, "Invalid type %s%s", argv[2]->arg, vty_out(vty, "Invalid type %s%s", argv[1]->arg,
VTY_NEWLINE); VTY_NEWLINE);
return CMD_WARNING; return CMD_WARNING;
@ -365,7 +365,7 @@ DEFUN (no_rip_redistribute_type,
for (i = 0; redist_type[i].str; i++) for (i = 0; redist_type[i].str; i++)
{ {
if (strncmp(redist_type[i].str, argv[3]->arg, if (strncmp(redist_type[i].str, argv[2]->arg,
redist_type[i].str_min_len) == 0) redist_type[i].str_min_len) == 0)
{ {
rip_metric_unset (redist_type[i].type, DONT_CARE_METRIC_RIP); rip_metric_unset (redist_type[i].type, DONT_CARE_METRIC_RIP);
@ -375,7 +375,7 @@ DEFUN (no_rip_redistribute_type,
} }
} }
vty_out(vty, "Invalid type %s%s", argv[3]->arg, vty_out(vty, "Invalid type %s%s", argv[2]->arg,
VTY_NEWLINE); VTY_NEWLINE);
return CMD_WARNING; return CMD_WARNING;