mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 02:53:55 +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)) {
|
||||
vrf_name = argv[idx_vrf + 1]->arg;
|
||||
if (vrf_name == NULL || strmatch(vrf_name, VRF_DEFAULT_NAME))
|
||||
vrf_name = NULL;
|
||||
if (enable) {
|
||||
/* Allocate VRF aware instance */
|
||||
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->router_id.s_addr = htonl(0);
|
||||
new->router_id_static.s_addr = htonl(0);
|
||||
|
||||
if (name) {
|
||||
if (name && !strmatch(name, VRF_DEFAULT_NAME)) {
|
||||
new->vrf_id = VRF_UNKNOWN;
|
||||
/* Freed in ospf_finish_final */
|
||||
new->name = XSTRDUP(MTYPE_OSPF_TOP, name);
|
||||
vrf = vrf_lookup_by_name(new->name);
|
||||
if (IS_DEBUG_OSPF_EVENT)
|
||||
zlog_debug(
|
||||
"%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 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)) {
|
||||
if ((ospf->instance == instance)
|
||||
&& ((ospf->name == NULL && name == NULL)
|
||||
@ -2078,6 +2079,10 @@ static int ospf_vrf_enable(struct vrf *vrf)
|
||||
|
||||
ospf = ospf_lookup_by_name(vrf->name);
|
||||
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;
|
||||
/* We have instance configured, link to VRF and make it "up". */
|
||||
ospf_vrf_link(ospf, vrf);
|
||||
|
Loading…
Reference in New Issue
Block a user