diff options
| author | Jafar Al-Gharaibeh <Jafaral@users.noreply.github.com> | 2021-02-24 17:50:57 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-24 17:50:57 -0600 |
| commit | cb4756fa7466e1b36b889c9294cba65a608c359e (patch) | |
| tree | 027fd515901355c2e4a344bd265f69e99e555fe4 | |
| parent | eb3e4dc35ca25f954d24c442df7c81e3e0d84fc4 (diff) | |
| parent | e348e10e21594f7bda0e58143a525d3fca9be577 (diff) | |
Merge pull request #8148 from qlyoung/fix-pim-nb-static-mroute-loop-check
pimd: do static mroute loop check in NB VALIDATE
| -rw-r--r-- | pimd/pim_nb_config.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/pimd/pim_nb_config.c b/pimd/pim_nb_config.c index 4bc78529a8..11cfe09964 100644 --- a/pimd/pim_nb_config.c +++ b/pimd/pim_nb_config.c @@ -2394,6 +2394,13 @@ int lib_interface_pim_address_family_mroute_oif_modify( struct ipaddr group_addr; const struct lyd_node *if_dnode; + iif = nb_running_get_entry(args->dnode, NULL, true); + pim_iifp = iif->info; + pim = pim_iifp->pim; + + oifname = yang_dnode_get_string(args->dnode, NULL); + oif = if_lookup_by_name(oifname, pim->vrf_id); + switch (args->event) { case NB_EV_VALIDATE: if_dnode = yang_dnode_get_parent(args->dnode, "interface"); @@ -2402,18 +2409,20 @@ int lib_interface_pim_address_family_mroute_oif_modify( "%% Enable PIM and/or IGMP on this interface first"); return NB_ERR_VALIDATION; } + +#ifdef PIM_ENFORCE_LOOPFREE_MFC + if (iif->ifindex == oif->ifindex) { + strlcpy(args->errmsg, + "% IIF same as OIF and loopfree enforcement is enabled; rejecting", + args->errmsg_len); + return NB_ERR_VALIDATION; + } +#endif break; case NB_EV_PREPARE: case NB_EV_ABORT: break; case NB_EV_APPLY: - iif = nb_running_get_entry(args->dnode, NULL, true); - pim_iifp = iif->info; - pim = pim_iifp->pim; - - oifname = yang_dnode_get_string(args->dnode, NULL); - oif = if_lookup_by_name(oifname, pim->vrf_id); - if (!oif) { snprintf(args->errmsg, args->errmsg_len, "No such interface name %s", |
