mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 13:27:53 +00:00
ospfd: VRF aware Router-ID update
Ensure zebra received router-id isolated per vrf instance. Store zebra received router-id within ospf instance. Ticket:CM-18657 Reviewed By: Testing Done: Validated follwoing sequence - Create vrf1111 - Create ospf vrf1111 with no router-id - Assign ip to vrf111 - ospf is assigned zebra assigned router-id which is vrf ip. - upon remvoing vrf ip, the router-id retained as same until ospfd restarted. Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
This commit is contained in:
parent
0ce9f92d86
commit
6021c6c059
@ -244,7 +244,6 @@ DEFUN (no_router_ospf,
|
|||||||
else
|
else
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
zlog_debug("%s: no router ospf ", __PRETTY_FUNCTION__);
|
|
||||||
ospf_finish(ospf);
|
ospf_finish(ospf);
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
@ -4151,12 +4150,12 @@ static void show_ip_ospf_neighbor_sub(struct vty *vty,
|
|||||||
|
|
||||||
if (nbr->state == NSM_Attempt &&
|
if (nbr->state == NSM_Attempt &&
|
||||||
nbr->router_id.s_addr == 0)
|
nbr->router_id.s_addr == 0)
|
||||||
strncpy(neigh_str, "neighbor",
|
strlcpy(neigh_str, "neighbor",
|
||||||
INET_ADDRSTRLEN);
|
sizeof(neigh_str));
|
||||||
else
|
else
|
||||||
strncpy(neigh_str,
|
strlcpy(neigh_str,
|
||||||
inet_ntoa(nbr->router_id),
|
inet_ntoa(nbr->router_id),
|
||||||
INET_ADDRSTRLEN);
|
sizeof(neigh_str));
|
||||||
|
|
||||||
json_object_object_get_ex(json, neigh_str,
|
json_object_object_get_ex(json, neigh_str,
|
||||||
&json_neigh_array);
|
&json_neigh_array);
|
||||||
|
@ -63,7 +63,6 @@ struct zclient *zclient = NULL;
|
|||||||
|
|
||||||
/* For registering threads. */
|
/* For registering threads. */
|
||||||
extern struct thread_master *master;
|
extern struct thread_master *master;
|
||||||
struct in_addr router_id_zebra;
|
|
||||||
|
|
||||||
/* Router-id update message from zebra. */
|
/* Router-id update message from zebra. */
|
||||||
static int ospf_router_id_update_zebra(int command, struct zclient *zclient,
|
static int ospf_router_id_update_zebra(int command, struct zclient *zclient,
|
||||||
@ -80,13 +79,12 @@ static int ospf_router_id_update_zebra(int command, struct zclient *zclient,
|
|||||||
buf, ospf_vrf_id_to_name(vrf_id), vrf_id);
|
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);
|
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);
|
ospf_router_id_update(ospf);
|
||||||
else {
|
} else {
|
||||||
if (IS_DEBUG_OSPF_EVENT) {
|
if (IS_DEBUG_OSPF_EVENT) {
|
||||||
char buf[PREFIX2STR_BUFFER];
|
char buf[PREFIX2STR_BUFFER];
|
||||||
|
|
||||||
@ -1434,12 +1432,14 @@ void ospf_zebra_vrf_register(struct ospf *ospf)
|
|||||||
if (!zclient || zclient->sock < 0 || !ospf)
|
if (!zclient || zclient->sock < 0 || !ospf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ospf->vrf_id != VRF_DEFAULT && ospf->vrf_id != VRF_UNKNOWN) {
|
if (ospf->vrf_id != VRF_UNKNOWN) {
|
||||||
if (IS_DEBUG_OSPF_EVENT)
|
if (IS_DEBUG_OSPF_EVENT)
|
||||||
zlog_debug("%s: Register VRF %s id %u",
|
zlog_debug("%s: Register VRF %s id %u",
|
||||||
__PRETTY_FUNCTION__,
|
__PRETTY_FUNCTION__,
|
||||||
ospf_vrf_id_to_name(ospf->vrf_id),
|
ospf_vrf_id_to_name(ospf->vrf_id),
|
||||||
ospf->vrf_id);
|
ospf->vrf_id);
|
||||||
|
/* Deregister for router-id, interfaces,
|
||||||
|
* redistributed routes. */
|
||||||
zclient_send_reg_requests(zclient, ospf->vrf_id);
|
zclient_send_reg_requests(zclient, ospf->vrf_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1451,7 +1451,7 @@ void ospf_zebra_vrf_deregister(struct ospf *ospf)
|
|||||||
|
|
||||||
if (ospf->vrf_id != VRF_DEFAULT && ospf->vrf_id != VRF_UNKNOWN) {
|
if (ospf->vrf_id != VRF_DEFAULT && ospf->vrf_id != VRF_UNKNOWN) {
|
||||||
if (IS_DEBUG_OSPF_EVENT)
|
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__,
|
__PRETTY_FUNCTION__,
|
||||||
ospf_vrf_id_to_name(ospf->vrf_id),
|
ospf_vrf_id_to_name(ospf->vrf_id),
|
||||||
ospf->vrf_id);
|
ospf->vrf_id);
|
||||||
|
@ -66,7 +66,6 @@ static struct ospf_master ospf_master;
|
|||||||
struct ospf_master *om;
|
struct ospf_master *om;
|
||||||
|
|
||||||
extern struct zclient *zclient;
|
extern struct zclient *zclient;
|
||||||
extern struct in_addr router_id_zebra;
|
|
||||||
|
|
||||||
|
|
||||||
static void ospf_remove_vls_through_area(struct ospf *, struct ospf_area *);
|
static void ospf_remove_vls_through_area(struct ospf *, struct ospf_area *);
|
||||||
@ -117,12 +116,12 @@ void ospf_router_id_update(struct ospf *ospf)
|
|||||||
else if (ospf->router_id.s_addr != 0)
|
else if (ospf->router_id.s_addr != 0)
|
||||||
router_id = ospf->router_id;
|
router_id = ospf->router_id;
|
||||||
else
|
else
|
||||||
router_id = router_id_zebra;
|
router_id = ospf->router_id_zebra;
|
||||||
|
|
||||||
if (IS_DEBUG_OSPF_EVENT)
|
if (IS_DEBUG_OSPF_EVENT)
|
||||||
zlog_debug("Router-ID[OLD:%s]: Update to %s",
|
zlog_debug("Router-ID[OLD:%s]: Update to %s",
|
||||||
inet_ntoa(ospf->router_id),
|
inet_ntoa(ospf->router_id),
|
||||||
inet_ntoa(router_id_old));
|
inet_ntoa(router_id));
|
||||||
|
|
||||||
if (!IPV4_ADDR_SAME(&router_id_old, &router_id)) {
|
if (!IPV4_ADDR_SAME(&router_id_old, &router_id)) {
|
||||||
|
|
||||||
@ -2056,6 +2055,7 @@ static int ospf_vrf_enable(struct vrf *vrf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ospf->oi_running = 1;
|
ospf->oi_running = 1;
|
||||||
|
ospf_zebra_vrf_register(ospf);
|
||||||
ospf_router_id_update(ospf);
|
ospf_router_id_update(ospf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,6 +134,7 @@ struct ospf {
|
|||||||
/* OSPF Router ID. */
|
/* OSPF Router ID. */
|
||||||
struct in_addr router_id; /* Configured automatically. */
|
struct in_addr router_id; /* Configured automatically. */
|
||||||
struct in_addr router_id_static; /* Configured manually. */
|
struct in_addr router_id_static; /* Configured manually. */
|
||||||
|
struct in_addr router_id_zebra;
|
||||||
|
|
||||||
vrf_id_t vrf_id; /* VRF Id */
|
vrf_id_t vrf_id; /* VRF Id */
|
||||||
char *name; /* VRF name */
|
char *name; /* VRF name */
|
||||||
|
Loading…
Reference in New Issue
Block a user