mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 08:32:45 +00:00
ospfd: adaptations to handle vrf alias
Some adaptations are done to handle alias when creationg ospf instance. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
6a8ca00fa0
commit
6895b354ef
@ -145,6 +145,8 @@ static struct ospf *ospf_cmd_lookup_ospf(struct vty *vty,
|
|||||||
|
|
||||||
if (argv_find(argv, argc, "vrf", &idx_vrf)) {
|
if (argv_find(argv, argc, "vrf", &idx_vrf)) {
|
||||||
vrf_name = argv[idx_vrf + 1]->arg;
|
vrf_name = argv[idx_vrf + 1]->arg;
|
||||||
|
if (vrf_name == NULL || strmatch(vrf_name, VRF_DEFAULT_NAME))
|
||||||
|
vrf_name = NULL;
|
||||||
if (enable) {
|
if (enable) {
|
||||||
/* Allocate VRF aware instance */
|
/* Allocate VRF aware instance */
|
||||||
ospf = ospf_get(*instance, vrf_name);
|
ospf = ospf_get(*instance, vrf_name);
|
||||||
|
@ -234,12 +234,10 @@ static struct ospf *ospf_new(unsigned short instance, const char *name)
|
|||||||
new->instance = instance;
|
new->instance = instance;
|
||||||
new->router_id.s_addr = htonl(0);
|
new->router_id.s_addr = htonl(0);
|
||||||
new->router_id_static.s_addr = htonl(0);
|
new->router_id_static.s_addr = htonl(0);
|
||||||
|
if (name && !strmatch(name, VRF_DEFAULT_NAME)) {
|
||||||
if (name) {
|
|
||||||
new->vrf_id = VRF_UNKNOWN;
|
new->vrf_id = VRF_UNKNOWN;
|
||||||
/* Freed in ospf_finish_final */
|
/* Freed in ospf_finish_final */
|
||||||
new->name = XSTRDUP(MTYPE_OSPF_TOP, name);
|
new->name = XSTRDUP(MTYPE_OSPF_TOP, name);
|
||||||
vrf = vrf_lookup_by_name(new->name);
|
|
||||||
if (IS_DEBUG_OSPF_EVENT)
|
if (IS_DEBUG_OSPF_EVENT)
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: Create new ospf instance with vrf_name %s vrf_id %u",
|
"%s: Create new ospf instance with vrf_name %s vrf_id %u",
|
||||||
@ -381,6 +379,9 @@ struct ospf *ospf_lookup_by_inst_name(unsigned short instance, const char *name)
|
|||||||
struct ospf *ospf = NULL;
|
struct ospf *ospf = NULL;
|
||||||
struct listnode *node, *nnode;
|
struct listnode *node, *nnode;
|
||||||
|
|
||||||
|
if (name == NULL || strmatch(name, VRF_DEFAULT_NAME))
|
||||||
|
return ospf_lookup_by_vrf_id(VRF_DEFAULT);
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS(om->ospf, node, nnode, ospf)) {
|
for (ALL_LIST_ELEMENTS(om->ospf, node, nnode, ospf)) {
|
||||||
if ((ospf->instance == instance)
|
if ((ospf->instance == instance)
|
||||||
&& ((ospf->name == NULL && name == NULL)
|
&& ((ospf->name == NULL && name == NULL)
|
||||||
@ -2078,6 +2079,10 @@ static int ospf_vrf_enable(struct vrf *vrf)
|
|||||||
|
|
||||||
ospf = ospf_lookup_by_name(vrf->name);
|
ospf = ospf_lookup_by_name(vrf->name);
|
||||||
if (ospf) {
|
if (ospf) {
|
||||||
|
if (ospf->name && strmatch(vrf->name, VRF_DEFAULT_NAME)) {
|
||||||
|
XFREE(MTYPE_OSPF_TOP, ospf->name);
|
||||||
|
ospf->name = NULL;
|
||||||
|
}
|
||||||
old_vrf_id = ospf->vrf_id;
|
old_vrf_id = ospf->vrf_id;
|
||||||
/* We have instance configured, link to VRF and make it "up". */
|
/* We have instance configured, link to VRF and make it "up". */
|
||||||
ospf_vrf_link(ospf, vrf);
|
ospf_vrf_link(ospf, vrf);
|
||||||
|
Loading…
Reference in New Issue
Block a user