summaryrefslogtreecommitdiffstats
path: root/vrrpd
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@nvidia.com>2020-07-30 22:44:46 +0200
committerQuentin Young <qlyoung@nvidia.com>2020-08-11 20:26:33 +0200
commitf4893b09ab77a0b37c087eb4e89debc6a8564aab (patch)
tree3b60e359d56cb909de5a600d6b0e09400c53e9a6 /vrrpd
parentvrrpd: don't allow autocreated vr's in NB layer (diff)
downloadfrr-f4893b09ab77a0b37c087eb4e89debc6a8564aab.tar.xz
frr-f4893b09ab77a0b37c087eb4e89debc6a8564aab.zip
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>
Diffstat (limited to 'vrrpd')
-rw-r--r--vrrpd/vrrp_northbound.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/vrrpd/vrrp_northbound.c b/vrrpd/vrrp_northbound.c
index ad6775dd3..bc5acdcd1 100644
--- a/vrrpd/vrrp_northbound.c
+++ b/vrrpd/vrrp_northbound.c
@@ -40,15 +40,18 @@ static int lib_interface_vrrp_vrrp_group_create(struct nb_cb_create_args *args)
uint8_t version = 3;
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");
version = yang_dnode_get_enum(args->dnode, "./version");
- switch (event) {
+ switch (args->event) {
case NB_EV_VALIDATE:
- vr = vrrp_lookup(ifp, vrid);
- if (vr && vr->autoconf)
- return NB_ERR_VALIDATION;
+ if (ifp) {
+ vr = vrrp_lookup(ifp, vrid);
+ if (vr && vr->autoconf)
+ return NB_ERR_VALIDATION;
+ }
+ return NB_OK;
case NB_EV_PREPARE:
case NB_EV_ABORT:
return NB_OK;