else
return CMD_WARNING;
}
- zlog_debug("%s: no router ospf ", __PRETTY_FUNCTION__);
ospf_finish(ospf);
return CMD_SUCCESS;
if (nbr->state == NSM_Attempt &&
nbr->router_id.s_addr == 0)
- strncpy(neigh_str, "neighbor",
- INET_ADDRSTRLEN);
+ strlcpy(neigh_str, "neighbor",
+ sizeof(neigh_str));
else
- strncpy(neigh_str,
+ strlcpy(neigh_str,
inet_ntoa(nbr->router_id),
- INET_ADDRSTRLEN);
+ sizeof(neigh_str));
json_object_object_get_ex(json, neigh_str,
&json_neigh_array);
/* For registering threads. */
extern struct thread_master *master;
-struct in_addr router_id_zebra;
/* Router-id update message from zebra. */
static int ospf_router_id_update_zebra(int command, struct zclient *zclient,
buf, ospf_vrf_id_to_name(vrf_id), vrf_id);
}
- router_id_zebra = router_id.u.prefix4;
-
ospf = ospf_lookup_by_vrf_id(vrf_id);
- if (ospf != NULL)
+ if (ospf != NULL) {
+ ospf->router_id_zebra = router_id.u.prefix4;
ospf_router_id_update(ospf);
- else {
+ } else {
if (IS_DEBUG_OSPF_EVENT) {
char buf[PREFIX2STR_BUFFER];
if (!zclient || zclient->sock < 0 || !ospf)
return;
- if (ospf->vrf_id != VRF_DEFAULT && ospf->vrf_id != VRF_UNKNOWN) {
+ if (ospf->vrf_id != VRF_UNKNOWN) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug("%s: Register VRF %s id %u",
__PRETTY_FUNCTION__,
ospf_vrf_id_to_name(ospf->vrf_id),
ospf->vrf_id);
+ /* Deregister for router-id, interfaces,
+ * redistributed routes. */
zclient_send_reg_requests(zclient, ospf->vrf_id);
}
}
if (ospf->vrf_id != VRF_DEFAULT && ospf->vrf_id != VRF_UNKNOWN) {
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("%s: De-Register VRF %s id %u",
+ zlog_debug("%s: De-Register VRF %s id %u to Zebra.",
__PRETTY_FUNCTION__,
ospf_vrf_id_to_name(ospf->vrf_id),
ospf->vrf_id);
struct ospf_master *om;
extern struct zclient *zclient;
-extern struct in_addr router_id_zebra;
static void ospf_remove_vls_through_area(struct ospf *, struct ospf_area *);
else if (ospf->router_id.s_addr != 0)
router_id = ospf->router_id;
else
- router_id = router_id_zebra;
+ router_id = ospf->router_id_zebra;
if (IS_DEBUG_OSPF_EVENT)
zlog_debug("Router-ID[OLD:%s]: Update to %s",
inet_ntoa(ospf->router_id),
- inet_ntoa(router_id_old));
+ inet_ntoa(router_id));
if (!IPV4_ADDR_SAME(&router_id_old, &router_id)) {
}
ospf->oi_running = 1;
+ ospf_zebra_vrf_register(ospf);
ospf_router_id_update(ospf);
}
}
/* OSPF Router ID. */
struct in_addr router_id; /* Configured automatically. */
struct in_addr router_id_static; /* Configured manually. */
+ struct in_addr router_id_zebra;
vrf_id_t vrf_id; /* VRF Id */
char *name; /* VRF name */