]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib, ospfd, pimd: Convert to using VRF based interface creation
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 10 Mar 2017 20:48:43 +0000 (15:48 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 15 Mar 2017 14:29:09 +0000 (10:29 -0400)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/if.c
lib/if.h
ospfd/ospf_interface.c
pimd/pim_iface.c
zebra/kernel_socket.c

index 84489f9e425e96094e7dc972766d50687f070428..8b10c91b94c901f803240d233947088d2d4f441e 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -123,7 +123,7 @@ if_cmp_func (struct interface *ifp1, struct interface *ifp2)
 
 /* Create new interface structure. */
 struct interface *
-if_create_vrf (const char *name, int namelen, vrf_id_t vrf_id)
+if_create (const char *name, int namelen, vrf_id_t vrf_id)
 {
   struct interface *ifp;
   struct list *intf_list = vrf_iflist_get (vrf_id);
@@ -158,12 +158,6 @@ if_create_vrf (const char *name, int namelen, vrf_id_t vrf_id)
   return ifp;
 }
 
-struct interface *
-if_create (const char *name, int namelen)
-{
-  return if_create_vrf (name, namelen, VRF_DEFAULT);
-}
-
 /* Create new interface structure. */
 void
 if_update_vrf (struct interface *ifp, const char *name, int namelen, vrf_id_t vrf_id)
@@ -468,7 +462,7 @@ if_get_by_name_vrf (const char *name, vrf_id_t vrf_id)
   struct interface *ifp;
 
   return ((ifp = if_lookup_by_name_vrf (name, vrf_id)) != NULL) ? ifp :
-         if_create_vrf (name, strlen(name), vrf_id);
+         if_create (name, strlen(name), vrf_id);
 }
 
 struct interface *
@@ -515,7 +509,7 @@ if_get_by_name_len_vrf (const char *name, size_t namelen, vrf_id_t vrf_id, int v
            }
        }
     }
-  return (if_create_vrf (name, namelen, vrf_id));
+  return (if_create (name, namelen, vrf_id));
 }
 
 struct interface *
index 6afce9dda6172bae9a2b31876b0d03d54c402eb6..10740957b5a2bb0108ad9d8c13965afa39e34e87 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -389,15 +389,14 @@ struct nbr_connected
 
 /* Prototypes. */
 extern int if_cmp_name_func (char *, char *);
-extern struct interface *if_create (const char *name, int namelen);
 extern struct interface *if_lookup_exact_address (void *matchaddr, int family);
 extern struct connected *if_lookup_address (void *matchaddr, int family);
 extern struct interface *if_lookup_prefix (struct prefix *prefix);
 
 extern void if_update_vrf (struct interface *, const char *name, int namelen,
                                 vrf_id_t vrf_id);
-extern struct interface *if_create_vrf (const char *name, int namelen,
-                                vrf_id_t vrf_id);
+extern struct interface *if_create (const char *name, int namelen,
+                                    vrf_id_t vrf_id);
 extern struct interface *if_lookup_by_index (ifindex_t, vrf_id_t vrf_id);
 extern struct interface *if_lookup_exact_address_vrf (void *matchaddr, int family,
                                 vrf_id_t vrf_id);
index 936ec69666b80e8d4653780b6755510d73a277b4..4fb206589a27f08768cb16d2d7c102416b6694cd 100644 (file)
@@ -874,7 +874,7 @@ ospf_vl_new (struct ospf *ospf, struct ospf_vl_data *vl_data)
     zlog_debug ("ospf_vl_new(): creating pseudo zebra interface");
 
   snprintf (ifname, sizeof(ifname), "VLINK%d", vlink_count);
-  vi = if_create (ifname, strnlen(ifname, sizeof(ifname)));
+  vi = if_create (ifname, strnlen(ifname, sizeof(ifname)), VRF_DEFAULT);
   /*
    * if_create sets ZEBRA_INTERFACE_LINKDETECTION
    * virtual links don't need this.
index def72c29f8963d65e24848eb8c0c7252ede9a293..76687cea302dd4be2069031553c8c03e2919d99b 100644 (file)
@@ -1471,7 +1471,7 @@ void pim_if_update_assert_tracking_desired(struct interface *ifp)
 void pim_if_create_pimreg (void)
 {
   if (!pim_regiface) {
-    pim_regiface = if_create("pimreg", strlen("pimreg"));
+    pim_regiface = if_create("pimreg", strlen("pimreg"), VRF_DEFAULT);
     pim_regiface->ifindex = PIM_OIF_PIM_REGISTER_VIF;
 
     pim_if_new(pim_regiface, 0, 0);
index 20de52c11ab00edccc3922f7dd446c19546cc249..ad04e1a8a4f960ccdaf66e3bb4944a87d471d470 100644 (file)
@@ -517,7 +517,7 @@ ifm_read (struct if_msghdr *ifm)
       if (ifp == NULL)
         {
          /* Interface that zebra was not previously aware of, so create. */ 
-         ifp = if_create (ifname, ifnlen);
+         ifp = if_create (ifname, ifnlen, VRF_DEFAULT);
          if (IS_ZEBRA_DEBUG_KERNEL)
            zlog_debug ("%s: creating ifp for ifindex %d", 
                        __func__, ifm->ifm_index);