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

This commit is contained in:
Donald Sharp 2017-06-29 10:10:15 -04:00
commit b440fe5c82
12 changed files with 146 additions and 113 deletions

View File

@ -842,12 +842,12 @@ lsp_print_mt_reach(struct list *list, struct vty *vty,
lspid_print(neigh->neigh_id, lspid, dynhost, 0); lspid_print(neigh->neigh_id, lspid, dynhost, 0);
if (mtid == ISIS_MT_IPV4_UNICAST) if (mtid == ISIS_MT_IPV4_UNICAST)
{ {
vty_out(vty, " Metric : %-8d IS-Extended : %s%s", vty_out(vty, " Metric : %-8u IS-Extended : %s%s",
GET_TE_METRIC(neigh), lspid, VTY_NEWLINE); GET_TE_METRIC(neigh), lspid, VTY_NEWLINE);
} }
else else
{ {
vty_out(vty, " Metric : %-8d MT-Reach : %s %s%s", vty_out(vty, " Metric : %-8u MT-Reach : %s %s%s",
GET_TE_METRIC(neigh), lspid, GET_TE_METRIC(neigh), lspid,
isis_mtid2str(mtid), VTY_NEWLINE); isis_mtid2str(mtid), VTY_NEWLINE);
} }
@ -874,11 +874,11 @@ lsp_print_mt_ipv6_reach(struct list *list, struct vty *vty, uint16_t mtid)
{ {
if ((ipv6_reach->control_info & if ((ipv6_reach->control_info &
CTRL_INFO_DISTRIBUTION) == DISTRIBUTION_INTERNAL) CTRL_INFO_DISTRIBUTION) == DISTRIBUTION_INTERNAL)
vty_out (vty, " Metric : %-8d IPv6-Internal : %s/%d%s", vty_out (vty, " Metric : %-8" PRIu32 " IPv6-Internal : %s/%d%s",
ntohl (ipv6_reach->metric), ntohl (ipv6_reach->metric),
buff, ipv6_reach->prefix_len, VTY_NEWLINE); buff, ipv6_reach->prefix_len, VTY_NEWLINE);
else else
vty_out (vty, " Metric : %-8d IPv6-External : %s/%d%s", vty_out (vty, " Metric : %-8" PRIu32 " IPv6-External : %s/%d%s",
ntohl (ipv6_reach->metric), ntohl (ipv6_reach->metric),
buff, ipv6_reach->prefix_len, VTY_NEWLINE); buff, ipv6_reach->prefix_len, VTY_NEWLINE);
} }
@ -886,12 +886,12 @@ lsp_print_mt_ipv6_reach(struct list *list, struct vty *vty, uint16_t mtid)
{ {
if ((ipv6_reach->control_info & if ((ipv6_reach->control_info &
CTRL_INFO_DISTRIBUTION) == DISTRIBUTION_INTERNAL) CTRL_INFO_DISTRIBUTION) == DISTRIBUTION_INTERNAL)
vty_out (vty, " Metric : %-8d IPv6-MT-Int : %s/%d %s%s", vty_out (vty, " Metric : %-8" PRIu32 " IPv6-MT-Int : %s/%d %s%s",
ntohl (ipv6_reach->metric), ntohl (ipv6_reach->metric),
buff, ipv6_reach->prefix_len, buff, ipv6_reach->prefix_len,
isis_mtid2str(mtid), VTY_NEWLINE); isis_mtid2str(mtid), VTY_NEWLINE);
else else
vty_out (vty, " Metric : %-8d IPv6-MT-Ext : %s/%d %s%s", vty_out (vty, " Metric : %-8" PRIu32 " IPv6-MT-Ext : %s/%d %s%s",
ntohl (ipv6_reach->metric), ntohl (ipv6_reach->metric),
buff, ipv6_reach->prefix_len, buff, ipv6_reach->prefix_len,
isis_mtid2str(mtid), VTY_NEWLINE); isis_mtid2str(mtid), VTY_NEWLINE);
@ -910,7 +910,7 @@ lsp_print_mt_ipv4_reach(struct list *list, struct vty *vty, uint16_t mtid)
if (mtid == ISIS_MT_IPV4_UNICAST) if (mtid == ISIS_MT_IPV4_UNICAST)
{ {
/* FIXME: There should be better way to output this stuff. */ /* FIXME: There should be better way to output this stuff. */
vty_out (vty, " Metric : %-8d IPv4-Extended : %s/%d%s", vty_out (vty, " Metric : %-8" PRIu32 " IPv4-Extended : %s/%d%s",
ntohl (te_ipv4_reach->te_metric), ntohl (te_ipv4_reach->te_metric),
inet_ntoa (newprefix2inaddr (&te_ipv4_reach->prefix_start, inet_ntoa (newprefix2inaddr (&te_ipv4_reach->prefix_start,
te_ipv4_reach->control)), te_ipv4_reach->control)),
@ -919,7 +919,7 @@ lsp_print_mt_ipv4_reach(struct list *list, struct vty *vty, uint16_t mtid)
else else
{ {
/* FIXME: There should be better way to output this stuff. */ /* FIXME: There should be better way to output this stuff. */
vty_out (vty, " Metric : %-8d IPv4-MT : %s/%d %s%s", vty_out (vty, " Metric : %-8" PRIu32 " IPv4-MT : %s/%d %s%s",
ntohl (te_ipv4_reach->te_metric), ntohl (te_ipv4_reach->te_metric),
inet_ntoa (newprefix2inaddr (&te_ipv4_reach->prefix_start, inet_ntoa (newprefix2inaddr (&te_ipv4_reach->prefix_start,
te_ipv4_reach->control)), te_ipv4_reach->control)),
@ -1025,7 +1025,7 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost)
for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.is_neighs, lnode, is_neigh)) for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.is_neighs, lnode, is_neigh))
{ {
lspid_print (is_neigh->neigh_id, LSPid, dynhost, 0); lspid_print (is_neigh->neigh_id, LSPid, dynhost, 0);
vty_out (vty, " Metric : %-8d IS : %s%s", vty_out (vty, " Metric : %-8" PRIu8 " IS : %s%s",
is_neigh->metrics.metric_default, LSPid, VTY_NEWLINE); is_neigh->metrics.metric_default, LSPid, VTY_NEWLINE);
} }
@ -1038,7 +1038,7 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost)
sizeof (ipv4_reach_prefix)); sizeof (ipv4_reach_prefix));
memcpy (ipv4_reach_mask, inet_ntoa (ipv4_reach->mask), memcpy (ipv4_reach_mask, inet_ntoa (ipv4_reach->mask),
sizeof (ipv4_reach_mask)); sizeof (ipv4_reach_mask));
vty_out (vty, " Metric : %-8d IPv4-Internal : %s %s%s", vty_out (vty, " Metric : %-8" PRIu8 " IPv4-Internal : %s %s%s",
ipv4_reach->metrics.metric_default, ipv4_reach_prefix, ipv4_reach->metrics.metric_default, ipv4_reach_prefix,
ipv4_reach_mask, VTY_NEWLINE); ipv4_reach_mask, VTY_NEWLINE);
} }
@ -1052,7 +1052,7 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost)
sizeof (ipv4_reach_prefix)); sizeof (ipv4_reach_prefix));
memcpy (ipv4_reach_mask, inet_ntoa (ipv4_reach->mask), memcpy (ipv4_reach_mask, inet_ntoa (ipv4_reach->mask),
sizeof (ipv4_reach_mask)); sizeof (ipv4_reach_mask));
vty_out (vty, " Metric : %-8d IPv4-External : %s %s%s", vty_out (vty, " Metric : %-8" PRIu8 " IPv4-External : %s %s%s",
ipv4_reach->metrics.metric_default, ipv4_reach_prefix, ipv4_reach->metrics.metric_default, ipv4_reach_prefix,
ipv4_reach_mask, VTY_NEWLINE); ipv4_reach_mask, VTY_NEWLINE);
} }

View File

@ -55,6 +55,18 @@ redist_protocol(int family)
return 0; return 0;
} }
static afi_t
afi_for_redist_protocol(int protocol)
{
if (protocol == 0)
return AFI_IP;
if (protocol == 1)
return AFI_IP6;
assert(!"Unknown redist protocol!");
return AFI_IP;
}
static int static int
is_default(struct prefix *p) is_default(struct prefix *p)
{ {
@ -177,7 +189,7 @@ isis_redist_uninstall(struct isis_area *area, int level, struct prefix *p)
if (!er_node->info) if (!er_node->info)
return; return;
XFREE(MTYPE_ISIS, er_node->info); XFREE(MTYPE_ISIS_EXT_INFO, er_node->info);
route_unlock_node(er_node); route_unlock_node(er_node);
lsp_regenerate_schedule(area, level, 0); lsp_regenerate_schedule(area, level, 0);
} }
@ -360,7 +372,7 @@ isis_redist_delete(int type, struct prefix *p)
isis_redist_uninstall(area, level, p); isis_redist_uninstall(area, level, p);
} }
XFREE(MTYPE_ISIS, ei_node->info); XFREE(MTYPE_ISIS_EXT_INFO, ei_node->info);
route_unlock_node(ei_node); route_unlock_node(ei_node);
} }
@ -387,7 +399,7 @@ isis_redist_update_zebra_subscriptions(struct isis *isis)
int level; int level;
int protocol; int protocol;
char do_subscribe[ZEBRA_ROUTE_MAX + 1]; char do_subscribe[REDIST_PROTOCOL_COUNT][ZEBRA_ROUTE_MAX + 1];
memset(do_subscribe, 0, sizeof(do_subscribe)); memset(do_subscribe, 0, sizeof(do_subscribe));
@ -396,20 +408,23 @@ isis_redist_update_zebra_subscriptions(struct isis *isis)
for (type = 0; type < ZEBRA_ROUTE_MAX + 1; type++) for (type = 0; type < ZEBRA_ROUTE_MAX + 1; type++)
for (level = 0; level < ISIS_LEVELS; level++) for (level = 0; level < ISIS_LEVELS; level++)
if (area->redist_settings[protocol][type][level].redist) if (area->redist_settings[protocol][type][level].redist)
do_subscribe[type] = 1; do_subscribe[protocol][type] = 1;
for (type = 0; type < ZEBRA_ROUTE_MAX + 1; type++) for (protocol = 0; protocol < REDIST_PROTOCOL_COUNT; protocol++)
{ for (type = 0; type < ZEBRA_ROUTE_MAX + 1; type++)
/* This field is actually controlling transmission of the IS-IS {
* routes to Zebra and has nothing to do with redistribution, /* This field is actually controlling transmission of the IS-IS
* so skip it. */ * routes to Zebra and has nothing to do with redistribution,
if (type == ZEBRA_ROUTE_ISIS) * so skip it. */
continue; if (type == ZEBRA_ROUTE_ISIS)
continue;
if (do_subscribe[type]) afi_t afi = afi_for_redist_protocol(protocol);
isis_zebra_redistribute_set(type);
else if (do_subscribe[protocol][type])
isis_zebra_redistribute_unset(type); isis_zebra_redistribute_set(afi, type);
else
isis_zebra_redistribute_unset(afi, type);
} }
} }
@ -505,7 +520,7 @@ isis_redist_unset(struct isis_area *area, int level,
continue; continue;
} }
XFREE(MTYPE_ISIS, rn->info); XFREE(MTYPE_ISIS_EXT_INFO, rn->info);
route_unlock_node(rn); route_unlock_node(rn);
} }
@ -540,7 +555,7 @@ isis_redist_area_finish(struct isis_area *area)
DEFUN (isis_redistribute, DEFUN (isis_redistribute,
isis_redistribute_cmd, isis_redistribute_cmd,
"redistribute " FRR_REDIST_STR_ISISD " <level-1|level-2> [<metric (0-16777215)|route-map WORD>]", "redistribute <ipv4|ipv6> " FRR_REDIST_STR_ISISD " <level-1|level-2> [<metric (0-16777215)|route-map WORD>]",
REDIST_STR REDIST_STR
"Redistribute IPv4 routes\n" "Redistribute IPv4 routes\n"
"Redistribute IPv6 routes\n" "Redistribute IPv6 routes\n"
@ -589,19 +604,26 @@ DEFUN (isis_redistribute,
return CMD_WARNING; return CMD_WARNING;
} }
if (strmatch(argv[idx_metric_rmap]->text, "metric")) metric = 0xffffffff;
{ routemap = NULL;
char *endp;
metric = strtoul(argv[idx_metric_rmap + 1]->arg, &endp, 10);
routemap = NULL;
if (argv[idx_metric_rmap]->arg[0] == '\0' || *endp != '\0') if (argc > idx_metric_rmap + 1)
return CMD_WARNING;
}
else
{ {
routemap = argv[idx_metric_rmap + 1]->arg; if (argv[idx_metric_rmap + 1]->arg[0] == '\0')
metric = 0xffffffff; return CMD_WARNING;
if (strmatch(argv[idx_metric_rmap]->text, "metric"))
{
char *endp;
metric = strtoul(argv[idx_metric_rmap + 1]->arg, &endp, 10);
if (*endp != '\0')
return CMD_WARNING;
}
else
{
routemap = argv[idx_metric_rmap + 1]->arg;
}
} }
isis_redist_set(area, level, family, type, metric, routemap, 0); isis_redist_set(area, level, family, type, metric, routemap, 0);
@ -610,7 +632,7 @@ DEFUN (isis_redistribute,
DEFUN (no_isis_redistribute, DEFUN (no_isis_redistribute,
no_isis_redistribute_cmd, no_isis_redistribute_cmd,
"no redistribute " FRR_REDIST_STR_ISISD " <level-1|level-2>", "no redistribute <ipv4|ipv6> " FRR_REDIST_STR_ISISD " <level-1|level-2>",
NO_STR NO_STR
REDIST_STR REDIST_STR
"Redistribute IPv4 routes\n" "Redistribute IPv4 routes\n"
@ -648,7 +670,7 @@ DEFUN (no_isis_redistribute,
DEFUN (isis_default_originate, DEFUN (isis_default_originate,
isis_default_originate_cmd, isis_default_originate_cmd,
"default-information originate <ipv4|ipv6> <level-1|level-2> [<always|metric (0-16777215)|route-map WORD>]", "default-information originate <ipv4|ipv6> <level-1|level-2> [always] [<metric (0-16777215)|route-map WORD>]",
"Control distribution of default information\n" "Control distribution of default information\n"
"Distribute a default route\n" "Distribute a default route\n"
"Distribute default route for IPv4\n" "Distribute default route for IPv4\n"
@ -663,6 +685,7 @@ DEFUN (isis_default_originate,
{ {
int idx_afi = 2; int idx_afi = 2;
int idx_level = 3; int idx_level = 3;
int idx_always = 4;
int idx_metric_rmap = 4; int idx_metric_rmap = 4;
VTY_DECLVAR_CONTEXT (isis_area, area); VTY_DECLVAR_CONTEXT (isis_area, area);
int family; int family;
@ -683,15 +706,19 @@ DEFUN (isis_default_originate,
return CMD_WARNING; return CMD_WARNING;
} }
if (argc > 4) if (argc > idx_always && strmatch (argv[idx_always]->text, "always"))
{ {
if (strmatch (argv[idx_metric_rmap]->text, "always"))
originate_type = DEFAULT_ORIGINATE_ALWAYS; originate_type = DEFAULT_ORIGINATE_ALWAYS;
else if (strmatch(argv[idx_metric_rmap]->text, "metric")) idx_metric_rmap++;
metric = strtoul(argv[idx_metric_rmap + 1]->arg, NULL, 10); }
else
routemap = argv[idx_metric_rmap + 1]->arg; if (argc > idx_metric_rmap)
} {
if (strmatch(argv[idx_metric_rmap]->text, "metric"))
metric = strtoul(argv[idx_metric_rmap + 1]->arg, NULL, 10);
else
routemap = argv[idx_metric_rmap + 1]->arg;
}
if (family == AF_INET6 && originate_type != DEFAULT_ORIGINATE_ALWAYS) if (family == AF_INET6 && originate_type != DEFAULT_ORIGINATE_ALWAYS)
{ {

View File

@ -603,6 +603,7 @@ isis_zebra_read_ipv6 (int command, struct zclient *zclient,
struct stream *stream; struct stream *stream;
struct zapi_ipv6 api; struct zapi_ipv6 api;
struct prefix_ipv6 p; struct prefix_ipv6 p;
struct prefix src_p;
struct prefix *p_generic = (struct prefix*)&p; struct prefix *p_generic = (struct prefix*)&p;
struct in6_addr nexthop; struct in6_addr nexthop;
unsigned long ifindex __attribute__((unused)); unsigned long ifindex __attribute__((unused));
@ -614,6 +615,7 @@ isis_zebra_read_ipv6 (int command, struct zclient *zclient,
ifindex = 0; ifindex = 0;
api.type = stream_getc(stream); api.type = stream_getc(stream);
api.instance = stream_getw(stream);
api.flags = stream_getl(stream); api.flags = stream_getl(stream);
api.message = stream_getc(stream); api.message = stream_getc(stream);
@ -621,6 +623,18 @@ isis_zebra_read_ipv6 (int command, struct zclient *zclient,
p.prefixlen = stream_getc(stream); p.prefixlen = stream_getc(stream);
stream_get(&p.prefix, stream, PSIZE(p.prefixlen)); stream_get(&p.prefix, stream, PSIZE(p.prefixlen));
memset(&src_p, 0, sizeof (struct prefix));
src_p.family = AF_INET6;
if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX))
{
src_p.prefixlen = stream_getc(stream);
stream_get(&src_p.u.prefix6, stream, PSIZE (src_p.prefixlen));
}
if (src_p.prefixlen)
/* we completely ignore srcdest routes for now. */
return 0;
if (CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP)) if (CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP))
{ {
api.nexthop_num = stream_getc(stream); /* this is always 1 */ api.nexthop_num = stream_getc(stream); /* this is always 1 */
@ -635,6 +649,8 @@ isis_zebra_read_ipv6 (int command, struct zclient *zclient,
api.distance = stream_getc(stream); api.distance = stream_getc(stream);
if (CHECK_FLAG(api.message, ZAPI_MESSAGE_METRIC)) if (CHECK_FLAG(api.message, ZAPI_MESSAGE_METRIC))
api.metric = stream_getl(stream); api.metric = stream_getl(stream);
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
api.tag = stream_getl(stream);
/* /*
* Avoid advertising a false default reachability. (A default * Avoid advertising a false default reachability. (A default
@ -645,7 +661,7 @@ isis_zebra_read_ipv6 (int command, struct zclient *zclient,
if (p.prefixlen == 0 && api.type == ZEBRA_ROUTE_ISIS) if (p.prefixlen == 0 && api.type == ZEBRA_ROUTE_ISIS)
command = ZEBRA_IPV6_ROUTE_DELETE; command = ZEBRA_IPV6_ROUTE_DELETE;
if (command == ZEBRA_IPV6_ROUTE_ADD) if (command == ZEBRA_REDISTRIBUTE_IPV6_ADD)
isis_redist_add(api.type, p_generic, api.distance, api.metric); isis_redist_add(api.type, p_generic, api.distance, api.metric);
else else
isis_redist_delete(api.type, p_generic); isis_redist_delete(api.type, p_generic);
@ -660,21 +676,21 @@ isis_distribute_list_update (int routetype)
} }
void void
isis_zebra_redistribute_set(int type) isis_zebra_redistribute_set(afi_t afi, int type)
{ {
if (type == DEFAULT_ROUTE) if (type == DEFAULT_ROUTE)
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD, zclient, VRF_DEFAULT); zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD, zclient, VRF_DEFAULT);
else else
zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, type, 0, VRF_DEFAULT); zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, afi, type, 0, VRF_DEFAULT);
} }
void void
isis_zebra_redistribute_unset(int type) isis_zebra_redistribute_unset(afi_t afi, int type)
{ {
if (type == DEFAULT_ROUTE) if (type == DEFAULT_ROUTE)
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE, zclient, VRF_DEFAULT); zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE, zclient, VRF_DEFAULT);
else else
zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, zclient, AFI_IP, type, 0, VRF_DEFAULT); zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, zclient, afi, type, 0, VRF_DEFAULT);
} }
static void static void

View File

@ -28,7 +28,7 @@ void isis_zebra_init(struct thread_master *);
void isis_zebra_route_update (struct prefix *prefix, void isis_zebra_route_update (struct prefix *prefix,
struct isis_route_info *route_info); struct isis_route_info *route_info);
int isis_distribute_list_update (int routetype); int isis_distribute_list_update (int routetype);
void isis_zebra_redistribute_set(int type); void isis_zebra_redistribute_set(afi_t afi, int type);
void isis_zebra_redistribute_unset(int type); void isis_zebra_redistribute_unset(afi_t afi, int type);
#endif /* _ZEBRA_ISIS_ZEBRA_H */ #endif /* _ZEBRA_ISIS_ZEBRA_H */

View File

@ -109,17 +109,19 @@ adj_new(struct in_addr lsr_id, struct hello_source *source,
return (adj); return (adj);
} }
static void void
adj_del_single(struct adj *adj) adj_del(struct adj *adj, uint32_t notif_status)
{ {
struct nbr *nbr = adj->nbr;
log_debug("%s: lsr-id %s, %s (%s)", __func__, inet_ntoa(adj->lsr_id), log_debug("%s: lsr-id %s, %s (%s)", __func__, inet_ntoa(adj->lsr_id),
log_hello_src(&adj->source), af_name(adj_get_af(adj))); log_hello_src(&adj->source), af_name(adj_get_af(adj)));
adj_stop_itimer(adj); adj_stop_itimer(adj);
RB_REMOVE(global_adj_head, &global.adj_tree, adj); RB_REMOVE(global_adj_head, &global.adj_tree, adj);
if (adj->nbr) if (nbr)
RB_REMOVE(nbr_adj_head, &adj->nbr->adj_tree, adj); RB_REMOVE(nbr_adj_head, &nbr->adj_tree, adj);
switch (adj->source.type) { switch (adj->source.type) {
case HELLO_LINK: case HELLO_LINK:
RB_REMOVE(ia_adj_head, &adj->source.link.ia->adj_tree, adj); RB_REMOVE(ia_adj_head, &adj->source.link.ia->adj_tree, adj);
@ -130,15 +132,6 @@ adj_del_single(struct adj *adj)
} }
free(adj); free(adj);
}
void
adj_del(struct adj *adj, uint32_t notif_status)
{
struct nbr *nbr = adj->nbr;
struct adj *atmp;
adj_del_single(adj);
/* /*
* If the neighbor still exists but none of its remaining * If the neighbor still exists but none of its remaining
@ -146,8 +139,6 @@ adj_del(struct adj *adj, uint32_t notif_status)
* then delete it. * then delete it.
*/ */
if (nbr && nbr_adj_count(nbr, nbr->af) == 0) { if (nbr && nbr_adj_count(nbr, nbr->af) == 0) {
RB_FOREACH_SAFE(adj, nbr_adj_head, &nbr->adj_tree, atmp)
adj_del_single(adj);
session_shutdown(nbr, notif_status, 0, 0); session_shutdown(nbr, notif_status, 0, 0);
nbr_del(nbr); nbr_del(nbr);
} }
@ -194,7 +185,6 @@ adj_itimer(struct thread *thread)
tnbr_del(leconf, adj->source.target); tnbr_del(leconf, adj->source.target);
return (0); return (0);
} }
adj->source.target->adj = NULL;
} }
adj_del(adj, S_HOLDTIME_EXP); adj_del(adj, S_HOLDTIME_EXP);

View File

@ -214,6 +214,7 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
__func__, inet_ntoa(lsr_id)); __func__, inet_ntoa(lsr_id));
return; return;
} }
ds_tlv = (tlvs_rcvd & F_HELLO_TLV_RCVD_DS) ? 1 : 0;
/* implicit transport address */ /* implicit transport address */
if (!(tlvs_rcvd & F_HELLO_TLV_RCVD_ADDR)) if (!(tlvs_rcvd & F_HELLO_TLV_RCVD_ADDR))
@ -291,11 +292,21 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
source.link.src_addr = *src; source.link.src_addr = *src;
} }
debug_hello_recv("%s lsr-id %s transport-address %s holdtime %u%s",
log_hello_src(&source), inet_ntoa(lsr_id), log_addr(af, &trans_addr),
holdtime, (ds_tlv) ? " (dual stack TLV present)" : "");
adj = adj_find(lsr_id, &source); adj = adj_find(lsr_id, &source);
if (adj && adj->ds_tlv != ds_tlv) {
/*
* Transient condition, ignore packet and wait until adjacency
* times out.
*/
return;
}
nbr = nbr_find_ldpid(lsr_id.s_addr); nbr = nbr_find_ldpid(lsr_id.s_addr);
/* check dual-stack tlv */ /* check dual-stack tlv */
ds_tlv = (tlvs_rcvd & F_HELLO_TLV_RCVD_DS) ? 1 : 0;
if (ds_tlv && trans_pref != leconf->trans_pref) { if (ds_tlv && trans_pref != leconf->trans_pref) {
/* /*
* RFC 7552 - Section 6.1.1: * RFC 7552 - Section 6.1.1:
@ -420,10 +431,6 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
else else
adj_stop_itimer(adj); adj_stop_itimer(adj);
debug_hello_recv("%s lsr-id %s transport-address %s holdtime %u%s",
log_hello_src(&source), inet_ntoa(lsr_id), log_addr(af, &trans_addr),
holdtime, (ds_tlv) ? " (dual stack TLV present)" : "");
if (nbr && nbr->state == NBR_STA_PRESENT && !nbr_pending_idtimer(nbr) && if (nbr && nbr->state == NBR_STA_PRESENT && !nbr_pending_idtimer(nbr) &&
nbr_session_active_role(nbr) && !nbr_pending_connect(nbr)) nbr_session_active_role(nbr) && !nbr_pending_connect(nbr))
nbr_establish_connection(nbr); nbr_establish_connection(nbr);

View File

@ -58,7 +58,13 @@ ospf_if_get_output_cost (struct ospf_interface *oi)
u_int32_t cost; u_int32_t cost;
u_int32_t bw, refbw; u_int32_t bw, refbw;
bw = oi->ifp->bandwidth ? oi->ifp->bandwidth : OSPF_DEFAULT_BANDWIDTH; /* ifp speed and bw can be 0 in some platforms, use ospf default bw
if bw is configured under interface it would be used.
*/
if (!oi->ifp->bandwidth && oi->ifp->speed)
bw = oi->ifp->speed;
else
bw = oi->ifp->bandwidth ? oi->ifp->bandwidth : OSPF_DEFAULT_BANDWIDTH;
refbw = oi->ospf->ref_bandwidth; refbw = oi->ospf->ref_bandwidth;
/* A specifed ip ospf cost overrides a calculated one. */ /* A specifed ip ospf cost overrides a calculated one. */

View File

@ -3251,6 +3251,7 @@ show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, struct interface
int is_up; int is_up;
struct ospf_neighbor *nbr; struct ospf_neighbor *nbr;
struct route_node *rn; struct route_node *rn;
uint32_t bandwidth = ifp->bandwidth ? ifp->bandwidth : ifp->speed;
/* Is interface up? */ /* Is interface up? */
if (use_json) if (use_json)
@ -3263,7 +3264,7 @@ show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, struct interface
json_object_int_add(json_interface_sub, "ifIndex", ifp->ifindex); json_object_int_add(json_interface_sub, "ifIndex", ifp->ifindex);
json_object_int_add(json_interface_sub, "mtuBytes", ifp->mtu); json_object_int_add(json_interface_sub, "mtuBytes", ifp->mtu);
json_object_int_add(json_interface_sub, "bandwidthMbit", ifp->bandwidth); json_object_int_add(json_interface_sub, "bandwidthMbit", bandwidth);
json_object_string_add(json_interface_sub, "ifFlags", if_flag_dump(ifp->flags)); json_object_string_add(json_interface_sub, "ifFlags", if_flag_dump(ifp->flags));
} }
else else
@ -3271,7 +3272,7 @@ show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, struct interface
vty_out (vty, "%s is %s%s", ifp->name, vty_out (vty, "%s is %s%s", ifp->name,
((is_up = if_is_operative(ifp)) ? "up" : "down"), VTY_NEWLINE); ((is_up = if_is_operative(ifp)) ? "up" : "down"), VTY_NEWLINE);
vty_out (vty, " ifindex %u, MTU %u bytes, BW %u Mbit %s%s", vty_out (vty, " ifindex %u, MTU %u bytes, BW %u Mbit %s%s",
ifp->ifindex, ifp->mtu, ifp->bandwidth, if_flag_dump(ifp->flags), ifp->ifindex, ifp->mtu, bandwidth, if_flag_dump(ifp->flags),
VTY_NEWLINE); VTY_NEWLINE);
} }

View File

@ -187,16 +187,10 @@ ospf_interface_state_up (int command, struct zclient *zclient,
zebra_interface_if_set_value (zclient->ibuf, ifp); zebra_interface_if_set_value (zclient->ibuf, ifp);
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE)) if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
zlog_debug ("Zebra: Interface[%s] state update.", ifp->name); zlog_debug ("Zebra: Interface[%s] state update speed %u -> %u, bw %d -> %d",
ifp->name, if_tmp.speed, ifp->speed, if_tmp.bandwidth, ifp->bandwidth);
if (if_tmp.bandwidth != ifp->bandwidth) ospf_if_recalculate_output_cost (ifp);
{
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
zlog_debug ("Zebra: Interface[%s] bandwidth change %d -> %d.",
ifp->name, if_tmp.bandwidth, ifp->bandwidth);
ospf_if_recalculate_output_cost (ifp);
}
if (if_tmp.mtu != ifp->mtu) if (if_tmp.mtu != ifp->mtu)
{ {

View File

@ -474,18 +474,15 @@ DEFUN (ip_irdp_minadvertinterval,
zi=ifp->info; zi=ifp->info;
irdp=&zi->irdp; irdp=&zi->irdp;
if( (unsigned) atoi(argv[idx_number]->arg) <= irdp->MaxAdvertInterval) { if((unsigned) atoi(argv[idx_number]->arg) <= irdp->MaxAdvertInterval) {
irdp->MinAdvertInterval = atoi(argv[idx_number]->arg); irdp->MinAdvertInterval = atoi(argv[idx_number]->arg);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
else {
vty_out (vty, "ICMP warning maxadvertinterval is greater or equal than minadvertinterval%s", vty_out (vty, "%% MinAdvertInterval must be less than or equal to "
VTY_NEWLINE); "MaxAdvertInterval%s", VTY_NEWLINE);
return CMD_WARNING;
vty_out (vty, "Please correct!%s", }
VTY_NEWLINE);
return CMD_WARNING;
} }
DEFUN (ip_irdp_maxadvertinterval, DEFUN (ip_irdp_maxadvertinterval,
@ -504,19 +501,15 @@ DEFUN (ip_irdp_maxadvertinterval,
zi=ifp->info; zi=ifp->info;
irdp=&zi->irdp; irdp=&zi->irdp;
if(irdp->MinAdvertInterval <= (unsigned) atoi(argv[idx_number]->arg)) {
if( irdp->MinAdvertInterval <= (unsigned) atoi(argv[idx_number]->arg) ) { irdp->MaxAdvertInterval = atoi(argv[idx_number]->arg);
irdp->MaxAdvertInterval = atoi(argv[idx_number]->arg);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
else {
vty_out (vty, "ICMP warning maxadvertinterval is greater or equal than minadvertinterval%s", vty_out (vty, "%% MaxAdvertInterval must be greater than or equal to "
VTY_NEWLINE); "MinAdvertInterval%s", VTY_NEWLINE);
return CMD_WARNING;
vty_out (vty, "Please correct!%s", }
VTY_NEWLINE);
return CMD_WARNING;
} }
/* DEFUN needs to be fixed for negative ranages... /* DEFUN needs to be fixed for negative ranages...

View File

@ -234,7 +234,7 @@ int irdp_send_thread(struct thread *t_advert)
} }
tmp = irdp->MaxAdvertInterval-irdp->MinAdvertInterval; tmp = irdp->MaxAdvertInterval-irdp->MinAdvertInterval;
timer = (random () % tmp ) + 1; timer = random () % (tmp + 1);
timer = irdp->MinAdvertInterval + timer; timer = irdp->MinAdvertInterval + timer;
if(irdp->irdp_sent < MAX_INITIAL_ADVERTISEMENTS && if(irdp->irdp_sent < MAX_INITIAL_ADVERTISEMENTS &&

View File

@ -2087,10 +2087,10 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
return CMD_WARNING; return CMD_WARNING;
} }
if (add_cmd) if (add_cmd)
static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, NULL, NULL, ifindex, ifname, static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, NULL, ifindex, ifname,
ZEBRA_FLAG_BLACKHOLE, tag, distance, zvrf, &snh_label); ZEBRA_FLAG_BLACKHOLE, tag, distance, zvrf, &snh_label);
else else
static_delete_route (AFI_IP6, SAFI_UNICAST, type, &p, NULL, NULL, ifindex, tag, static_delete_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, NULL, ifindex, tag,
distance, zvrf, &snh_label); distance, zvrf, &snh_label);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -2221,7 +2221,6 @@ DEFUN (ipv6_route_flags,
"IPv6 gateway interface name\n" "IPv6 gateway interface name\n"
"Emit an ICMP unreachable when matched\n" "Emit an ICMP unreachable when matched\n"
"Silently discard pkts when matched\n" "Silently discard pkts when matched\n"
"Silently discard pkts when matched\n"
"Set tag for this route\n" "Set tag for this route\n"
"Tag value\n" "Tag value\n"
"Distance value for this prefix\n" "Distance value for this prefix\n"