mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 22:29:23 +00:00
ripd: fix minor issues from the northbound conversion
* Always apply the mask of IPv4 prefixes (user data) in the
northbound callbacks, we shouldn't assume the northbound plugins
will do that for us.
* Fix a bug in the "distance" command introduced by commit a6233bfcb3
.
* Remove unnecessary check in the
ripd_instance_redistribute_route_map_delete() function and
reset the route-map's map pointer for safety as well.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
parent
a3d29c6a49
commit
d682d365a5
@ -210,7 +210,8 @@ DEFPY (rip_distance_source,
|
|||||||
{
|
{
|
||||||
if (!no) {
|
if (!no) {
|
||||||
nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
|
nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
|
||||||
nb_cli_enqueue_change(vty, "./distance", NB_OP_MODIFY, NULL);
|
nb_cli_enqueue_change(vty, "./distance", NB_OP_MODIFY,
|
||||||
|
distance_str);
|
||||||
nb_cli_enqueue_change(vty, "./access-list",
|
nb_cli_enqueue_change(vty, "./access-list",
|
||||||
acl ? NB_OP_MODIFY : NB_OP_DELETE, acl);
|
acl ? NB_OP_MODIFY : NB_OP_DELETE, acl);
|
||||||
} else
|
} else
|
||||||
|
@ -170,6 +170,7 @@ static int ripd_instance_distance_source_create(enum nb_event event,
|
|||||||
return NB_OK;
|
return NB_OK;
|
||||||
|
|
||||||
yang_dnode_get_ipv4p(&prefix, dnode, "./prefix");
|
yang_dnode_get_ipv4p(&prefix, dnode, "./prefix");
|
||||||
|
apply_mask_ipv4(&prefix);
|
||||||
|
|
||||||
/* Get RIP distance node. */
|
/* Get RIP distance node. */
|
||||||
rn = route_node_get(rip_distance_table, (struct prefix *)&prefix);
|
rn = route_node_get(rip_distance_table, (struct prefix *)&prefix);
|
||||||
@ -317,6 +318,7 @@ static int ripd_instance_network_create(enum nb_event event,
|
|||||||
return NB_OK;
|
return NB_OK;
|
||||||
|
|
||||||
yang_dnode_get_ipv4p(&p, dnode, NULL);
|
yang_dnode_get_ipv4p(&p, dnode, NULL);
|
||||||
|
apply_mask_ipv4((struct prefix_ipv4 *)&p);
|
||||||
|
|
||||||
return rip_enable_network_add(&p);
|
return rip_enable_network_add(&p);
|
||||||
}
|
}
|
||||||
@ -330,6 +332,7 @@ static int ripd_instance_network_delete(enum nb_event event,
|
|||||||
return NB_OK;
|
return NB_OK;
|
||||||
|
|
||||||
yang_dnode_get_ipv4p(&p, dnode, NULL);
|
yang_dnode_get_ipv4p(&p, dnode, NULL);
|
||||||
|
apply_mask_ipv4((struct prefix_ipv4 *)&p);
|
||||||
|
|
||||||
return rip_enable_network_delete(&p);
|
return rip_enable_network_delete(&p);
|
||||||
}
|
}
|
||||||
@ -605,10 +608,9 @@ ripd_instance_redistribute_route_map_delete(enum nb_event event,
|
|||||||
|
|
||||||
type = yang_dnode_get_enum(dnode, "../protocol");
|
type = yang_dnode_get_enum(dnode, "../protocol");
|
||||||
|
|
||||||
if (rip->route_map[type].name) {
|
|
||||||
free(rip->route_map[type].name);
|
free(rip->route_map[type].name);
|
||||||
rip->route_map[type].name = NULL;
|
rip->route_map[type].name = NULL;
|
||||||
}
|
rip->route_map[type].map = NULL;
|
||||||
|
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
@ -667,6 +669,7 @@ static int ripd_instance_static_route_create(enum nb_event event,
|
|||||||
return NB_OK;
|
return NB_OK;
|
||||||
|
|
||||||
yang_dnode_get_ipv4p(&p, dnode, NULL);
|
yang_dnode_get_ipv4p(&p, dnode, NULL);
|
||||||
|
apply_mask_ipv4(&p);
|
||||||
|
|
||||||
memset(&nh, 0, sizeof(nh));
|
memset(&nh, 0, sizeof(nh));
|
||||||
nh.type = NEXTHOP_TYPE_IPV4;
|
nh.type = NEXTHOP_TYPE_IPV4;
|
||||||
@ -685,6 +688,7 @@ static int ripd_instance_static_route_delete(enum nb_event event,
|
|||||||
return NB_OK;
|
return NB_OK;
|
||||||
|
|
||||||
yang_dnode_get_ipv4p(&p, dnode, NULL);
|
yang_dnode_get_ipv4p(&p, dnode, NULL);
|
||||||
|
apply_mask_ipv4(&p);
|
||||||
|
|
||||||
rip_redistribute_delete(ZEBRA_ROUTE_RIP, RIP_ROUTE_STATIC, &p, 0);
|
rip_redistribute_delete(ZEBRA_ROUTE_RIP, RIP_ROUTE_STATIC, &p, 0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user