Merge pull request #657 from donaldsharp/rompapotamus

Rompapotamus
This commit is contained in:
Renato Westphal 2017-06-03 18:52:59 -03:00 committed by GitHub
commit 247e6469da
9 changed files with 70 additions and 42 deletions

View File

@ -56,6 +56,20 @@ enum {
#define VRF_CMD_HELP_STR "Specify the VRF\nThe VRF name\n"
#define VRF_ALL_CMD_HELP_STR "Specify the VRF\nAll VRFs\n"
/*
* Pass some OS specific data up through
* to the daemons
*/
struct vrf_data
{
union
{
struct {
uint32_t table_id;
} l;
};
};
struct vrf
{
RB_ENTRY(vrf) id_entry, name_entry;
@ -76,6 +90,9 @@ struct vrf
/* User data */
void *info;
/* The table_id from the kernel */
struct vrf_data data;
QOBJ_FIELDS
};
RB_HEAD (vrf_id_head, vrf);

View File

@ -1077,12 +1077,15 @@ zclient_vrf_add (struct zclient *zclient, vrf_id_t vrf_id)
{
struct vrf *vrf;
char vrfname_tmp[VRF_NAMSIZ];
struct vrf_data data;
stream_get (&data, zclient->ibuf, sizeof (struct vrf_data));
/* Read interface name. */
stream_get (vrfname_tmp, zclient->ibuf, VRF_NAMSIZ);
/* Lookup/create vrf by vrf_id. */
vrf = vrf_get (vrf_id, vrfname_tmp);
vrf->data = data;
vrf_enable (vrf);
}

View File

@ -838,8 +838,9 @@ initialize_linkparams (struct mpls_te_link *lp)
if ((oi = lookup_oi_by_ifp (ifp, NULL, OI_ANY)) == NULL)
{
zlog_warn("MPLS-TE(initialize_linkparams) Could not find corresponding OSPF Interface for %s",
ifp->name);
if (IS_DEBUG_OSPF_TE)
zlog_warn("MPLS-TE(initialize_linkparams) Could not find corresponding OSPF Interface for %s",
ifp->name);
return;
}
@ -991,7 +992,8 @@ ospf_mpls_te_update_if (struct interface *ifp)
/* Get Link context from interface */
if ((lp = lookup_linkparams_by_ifp(ifp)) == NULL)
{
zlog_warn ("OSPF MPLS-TE Update: Did not find Link Parameters context for interface %s", ifp->name);
if (IS_DEBUG_OSPF_TE)
zlog_warn ("OSPF MPLS-TE Update: Did not find Link Parameters context for interface %s", ifp->name);
return;
}

View File

@ -297,7 +297,7 @@ static int detect_primary_address_change(struct interface *ifp,
int changed;
if (force_prim_as_any)
new_prim_addr = qpim_inaddr_any;
new_prim_addr.s_addr = INADDR_ANY;
else
new_prim_addr = pim_find_primary_addr(ifp);

View File

@ -387,12 +387,14 @@ const char *pim_ifchannel_ifassert_name(enum pim_ifassert_state ifassert_state)
*/
void reset_ifassert_state(struct pim_ifchannel *ch)
{
struct in_addr any = { .s_addr = INADDR_ANY };
THREAD_OFF(ch->t_ifassert_timer);
pim_ifassert_winner_set(ch,
PIM_IFASSERT_NOINFO,
qpim_inaddr_any,
qpim_infinite_assert_metric);
PIM_IFASSERT_NOINFO,
any,
qpim_infinite_assert_metric);
}
struct pim_ifchannel *pim_ifchannel_find(struct interface *ifp,

View File

@ -61,7 +61,6 @@ struct thread *qpim_rpf_cache_refresher = NULL;
int64_t qpim_rpf_cache_refresh_requests = 0;
int64_t qpim_rpf_cache_refresh_events = 0;
int64_t qpim_rpf_cache_refresh_last = 0;
struct in_addr qpim_inaddr_any;
struct list *qpim_ssmpingd_list = NULL;
struct in_addr qpim_ssmpingd_group_addr;
int64_t qpim_scan_oil_events = 0;
@ -293,7 +292,6 @@ void pim_init()
pim_mroute_socket_enable();
qpim_inaddr_any.s_addr = PIM_NET_INADDR_ANY;
/*
RFC 4601: 4.6.3. Assert Metrics
@ -306,7 +304,7 @@ void pim_init()
qpim_infinite_assert_metric.rpt_bit_flag = 1;
qpim_infinite_assert_metric.metric_preference = PIM_ASSERT_METRIC_PREFERENCE_MAX;
qpim_infinite_assert_metric.route_metric = PIM_ASSERT_ROUTE_METRIC_MAX;
qpim_infinite_assert_metric.ip_address = qpim_inaddr_any;
qpim_infinite_assert_metric.ip_address.s_addr = INADDR_ANY;
pim_if_init();
pim_cmd_init();

View File

@ -140,7 +140,6 @@ struct thread *qpim_rpf_cache_refresher;
int64_t qpim_rpf_cache_refresh_requests;
int64_t qpim_rpf_cache_refresh_events;
int64_t qpim_rpf_cache_refresh_last;
struct in_addr qpim_inaddr_any;
struct list *qpim_ssmpingd_list; /* list of struct ssmpingd_sock */
struct in_addr qpim_ssmpingd_group_addr;
int64_t qpim_scan_oil_events;

View File

@ -183,9 +183,10 @@ vtysh_config_parse_line (void *arg, const char *line)
config->index = INTERFACE_NODE;
}
else if (config->index == RMAP_NODE ||
config->index == INTERFACE_NODE ||
config->index == NS_NODE ||
config->index == VTY_NODE)
config->index == INTERFACE_NODE ||
config->index == NS_NODE ||
config->index == VTY_NODE ||
config->index == VRF_NODE)
config_add_line_uniq (config->line, line);
else
config_add_line (config->line, line);
@ -278,6 +279,7 @@ vtysh_config_parse_line (void *arg, const char *line)
|| strncmp (line, "hostname", strlen ("hostname")) == 0
|| strncmp (line, "frr", strlen ("frr")) == 0
|| strncmp (line, "agentx", strlen ("agentx")) == 0
|| strncmp (line, "no log", strlen ("no log")) == 0
)
config_add_line_uniq (config_top, line);
else
@ -319,41 +321,41 @@ vtysh_config_dump (FILE *fp)
for (i = 0; i < vector_active (configvec); i++)
if ((master = vector_slot (configvec, i)) != NULL)
{
for (ALL_LIST_ELEMENTS (master, node, nnode, config))
{
/* Don't print empty sections for interface/vrf. Route maps on the
* other hand could have a legitimate empty section at the end.
*/
if ((config->index == INTERFACE_NODE || (config->index == VRF_NODE))
&& list_isempty (config->line))
continue;
for (ALL_LIST_ELEMENTS (master, node, nnode, config))
{
/* Don't print empty sections for interface/vrf. Route maps on the
* other hand could have a legitimate empty section at the end.
*/
if ((config->index == INTERFACE_NODE || config->index == VRF_NODE)
&& list_isempty (config->line))
continue;
fprintf (fp, "%s\n", config->name);
fflush (fp);
fprintf (fp, "%s\n", config->name);
fflush (fp);
for (ALL_LIST_ELEMENTS (config->line, mnode, mnnode, line))
{
fprintf (fp, "%s\n", line);
fflush (fp);
}
if (! NO_DELIMITER (i))
{
fprintf (fp, "!\n");
fflush (fp);
}
}
if (NO_DELIMITER (i))
{
fprintf (fp, "!\n");
fflush (fp);
}
for (ALL_LIST_ELEMENTS (config->line, mnode, mnnode, line))
{
fprintf (fp, "%s\n", line);
fflush (fp);
}
if (! NO_DELIMITER (i))
{
fprintf (fp, "!\n");
fflush (fp);
}
}
if (NO_DELIMITER (i))
{
fprintf (fp, "!\n");
fflush (fp);
}
}
for (i = 0; i < vector_active (configvec); i++)
if ((master = vector_slot (configvec, i)) != NULL)
{
list_delete (master);
vector_slot (configvec, i) = NULL;
list_delete (master);
vector_slot (configvec, i) = NULL;
}
list_delete_all_node (config_top);
}

View File

@ -192,6 +192,11 @@ zserv_encode_interface (struct stream *s, struct interface *ifp)
static void
zserv_encode_vrf (struct stream *s, struct zebra_vrf *zvrf)
{
struct vrf_data data;
data.l.table_id = zvrf->table_id;
/* Pass the tableid */
stream_put (s, &data, sizeof (struct vrf_data));
/* Interface information. */
stream_put (s, zvrf_name (zvrf), VRF_NAMSIZ);