summaryrefslogtreecommitdiff
path: root/lib/if.h
diff options
context:
space:
mode:
authorStephen Worley <sworley@cumulusnetworks.com>2019-10-09 19:50:13 -0400
committerStephen Worley <sworley@cumulusnetworks.com>2019-10-09 20:24:31 -0400
commitd5c65bf1a2b43d97e19e169223d8a33269bc6625 (patch)
tree543831bbc4aa6e90c786cffe7c5639732002590b /lib/if.h
parent9685b1e414118391825ad56faa8879d279eebeb6 (diff)
*: Cleanup interface creation apis
Cleanup the interface creation apis to make it more clear what they are doing. Make it explicit that the creation via name/ifindex will only add it to the appropriate list. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'lib/if.h')
-rw-r--r--lib/if.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/if.h b/lib/if.h
index 51db7bb8ed..1ee6561e8d 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -479,7 +479,11 @@ extern int if_cmp_name_func(const char *p1, const char *p2);
* else think before you use VRF_UNKNOWN
*/
extern void if_update_to_new_vrf(struct interface *, vrf_id_t vrf_id);
-extern struct interface *if_create(const char *name, vrf_id_t vrf_id);
+
+/* Create new interface, adds to name list only */
+extern struct interface *if_create_name(const char *name, vrf_id_t vrf_id);
+
+/* Create new interface, adds to index list only */
extern struct interface *if_create_ifindex(ifindex_t ifindex, vrf_id_t vrf_id);
extern struct interface *if_lookup_by_index(ifindex_t, vrf_id_t vrf_id);
extern struct interface *if_lookup_by_index_all_vrf(ifindex_t);
@@ -492,13 +496,15 @@ extern struct interface *if_lookup_prefix(struct prefix *prefix,
size_t if_lookup_by_hwaddr(const uint8_t *hw_addr, size_t addrsz,
struct interface ***result, vrf_id_t vrf_id);
-/* These 3 functions are to be used when the ifname argument is terminated
- by a '\0' character: */
extern struct interface *if_lookup_by_name_all_vrf(const char *ifname);
extern struct interface *if_lookup_by_name(const char *ifname, vrf_id_t vrf_id);
extern struct interface *if_get_by_name(const char *ifname, vrf_id_t vrf_id);
extern struct interface *if_get_by_ifindex(ifindex_t ifindex, vrf_id_t vrf_id);
+
+/* Sets the index and adds to index list */
extern void if_set_index(struct interface *ifp, ifindex_t ifindex);
+/* Sets the name and adds to name list */
+extern void if_set_name(struct interface *ifp, const char *name);
/* Delete the interface, but do not free the structure, and leave it in the
interface list. It is often advisable to leave the pseudo interface