]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bfdd: permit to configure both iface and vrf
authorPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 25 Mar 2019 16:20:35 +0000 (17:20 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 7 May 2019 13:49:39 +0000 (15:49 +0200)
it is possible to configure both iface and vrfname. also, the
appropriate vrf is used, in case an iface is given.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bfdd/bfd.c
bfdd/bfdd_vty.c

index 477bc492ce3785564910f0bfbf3225e8b4fa9ed7..517fed1a418e5e1ac10dce13b449a016addca89c 100644 (file)
@@ -128,15 +128,8 @@ int bfd_session_enable(struct bfd_session *bs)
         * If the interface or VRF doesn't exist, then we must register
         * the session but delay its start.
         */
-       if (bs->key.ifname[0]) {
-               ifp = if_lookup_by_name_all_vrf(bs->key.ifname);
-               if (ifp == NULL) {
-                       log_error(
-                               "session-enable: specified interface doesn't exists.");
-                       return 0;
-               }
-
-               vrf = vrf_lookup_by_id(ifp->vrf_id);
+       if (bs->key.vrfname[0]) {
+               vrf = vrf_lookup_by_name(bs->key.vrfname);
                if (vrf == NULL) {
                        log_error(
                                "session-enable: specified VRF doesn't exists.");
@@ -144,13 +137,24 @@ int bfd_session_enable(struct bfd_session *bs)
                }
        }
 
-       if (bs->key.vrfname[0]) {
-               vrf = vrf_lookup_by_name(bs->key.vrfname);
-               if (vrf == NULL) {
+       if (bs->key.ifname[0]) {
+               if (vrf)
+                       ifp = if_lookup_by_name(bs->key.ifname, vrf->vrf_id);
+               else
+                       ifp = if_lookup_by_name_all_vrf(bs->key.ifname);
+               if (ifp == NULL) {
                        log_error(
-                               "session-enable: specified VRF doesn't exists.");
+                                 "session-enable: specified interface doesn't exists.");
                        return 0;
                }
+               if (bs->key.ifname[0] && !vrf) {
+                       vrf = vrf_lookup_by_id(ifp->vrf_id);
+                       if (vrf == NULL) {
+                               log_error(
+                                         "session-enable: specified VRF doesn't exists.");
+                               return 0;
+                       }
+               }
        }
 
        /* Assign interface/VRF pointers. */
index 95b2dc25483183920fd291cc4e192bcc5972e22c..129894b6915225532634a1d7d1ab6e67d4adc665 100644 (file)
@@ -126,11 +126,6 @@ DEFUN_NOSH(
        if (argv_find(argv, argc, "vrf", &idx))
                vrfname = argv[idx + 1]->arg;
 
-       if (vrfname && ifname) {
-               vty_out(vty, "%% VRF is not mixable with interface\n");
-               return CMD_WARNING_CONFIG_FAILED;
-       }
-
        strtosa(peer, &psa);
        if (local) {
                strtosa(local, &lsa);