mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-05 11:53:25 +00:00
vrrpd: fix improper NB query during validation
We were querying the NB for an interface and expecting it to exist, but we were doing this during a validation run when the interface hasn't yet been created, resulting in an abort. Adjust validation checks to handle this scenario. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
This commit is contained in:
parent
ee723e1382
commit
f4893b09ab
@ -40,15 +40,18 @@ static int lib_interface_vrrp_vrrp_group_create(struct nb_cb_create_args *args)
|
|||||||
uint8_t version = 3;
|
uint8_t version = 3;
|
||||||
struct vrrp_vrouter *vr;
|
struct vrrp_vrouter *vr;
|
||||||
|
|
||||||
ifp = nb_running_get_entry(args->dnode, NULL, true);
|
ifp = nb_running_get_entry(args->dnode, NULL, false);
|
||||||
vrid = yang_dnode_get_uint8(args->dnode, "./virtual-router-id");
|
vrid = yang_dnode_get_uint8(args->dnode, "./virtual-router-id");
|
||||||
version = yang_dnode_get_enum(args->dnode, "./version");
|
version = yang_dnode_get_enum(args->dnode, "./version");
|
||||||
|
|
||||||
switch (event) {
|
switch (args->event) {
|
||||||
case NB_EV_VALIDATE:
|
case NB_EV_VALIDATE:
|
||||||
|
if (ifp) {
|
||||||
vr = vrrp_lookup(ifp, vrid);
|
vr = vrrp_lookup(ifp, vrid);
|
||||||
if (vr && vr->autoconf)
|
if (vr && vr->autoconf)
|
||||||
return NB_ERR_VALIDATION;
|
return NB_ERR_VALIDATION;
|
||||||
|
}
|
||||||
|
return NB_OK;
|
||||||
case NB_EV_PREPARE:
|
case NB_EV_PREPARE:
|
||||||
case NB_EV_ABORT:
|
case NB_EV_ABORT:
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user