summaryrefslogtreecommitdiffstats
path: root/lib/if.h
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-06-24 01:46:39 +0200
committerGitHub <noreply@github.com>2019-06-24 01:46:39 +0200
commita36898e7555036c786f7aa944b848966b45d5897 (patch)
treefb34f0ca1836e09a8e89e73ebd6696a08b89b631 /lib/if.h
parentMerge pull request #3775 from pguibert6WIND/ospf_missing_interface_handling_2 (diff)
downloadfrr-a36898e7555036c786f7aa944b848966b45d5897.tar.xz
frr-a36898e7555036c786f7aa944b848966b45d5897.zip
Revert "Ospf missing interface handling 2"
Diffstat (limited to 'lib/if.h')
-rw-r--r--lib/if.h40
1 files changed, 17 insertions, 23 deletions
diff --git a/lib/if.h b/lib/if.h
index 3237cab1d..603c9c378 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -33,8 +33,6 @@ extern "C" {
DECLARE_MTYPE(CONNECTED_LABEL)
-struct vrf;
-
/* Interface link-layer type, if known. Derived from:
*
* net/if_arp.h on various platforms - Linux especially.
@@ -293,7 +291,7 @@ struct interface {
#endif /* HAVE_NET_RT_IFLIST */
struct route_node *node;
- struct vrf *vrf;
+ vrf_id_t vrf_id;
QOBJ_FIELDS
};
@@ -304,37 +302,33 @@ RB_HEAD(if_index_head, interface);
RB_PROTOTYPE(if_index_head, interface, index_entry, if_cmp_func)
DECLARE_QOBJ_TYPE(interface)
-#define IFNAME_RB_INSERT(_vrf, _ifp) \
- if (RB_INSERT(if_name_head, &(_vrf)->ifaces_by_name, (_ifp))) \
+#define IFNAME_RB_INSERT(vrf, ifp) \
+ if (RB_INSERT(if_name_head, &vrf->ifaces_by_name, (ifp))) \
flog_err(EC_LIB_INTERFACE, \
"%s(%s): corruption detected -- interface with this " \
"name exists already in VRF %u!", \
- __func__, (_ifp)->name, (_ifp)->vrf ? \
- (_ifp)->vrf->vrf_id : VRF_UNKNOWN);
+ __func__, (ifp)->name, (ifp)->vrf_id);
-#define IFNAME_RB_REMOVE(_vrf, _ifp) \
- if (RB_REMOVE(if_name_head, &(_vrf)->ifaces_by_name, (_ifp)) == NULL) \
+#define IFNAME_RB_REMOVE(vrf, ifp) \
+ if (RB_REMOVE(if_name_head, &vrf->ifaces_by_name, (ifp)) == NULL) \
flog_err(EC_LIB_INTERFACE, \
"%s(%s): corruption detected -- interface with this " \
"name doesn't exist in VRF %u!", \
- __func__, (_ifp)->name, (_ifp)->vrf ? \
- (_ifp)->vrf->vrf_id : VRF_UNKNOWN);
+ __func__, (ifp)->name, (ifp)->vrf_id);
-#define IFINDEX_RB_INSERT(_vrf, _ifp) \
- if (RB_INSERT(if_index_head, &(_vrf)->ifaces_by_index, (_ifp))) \
+#define IFINDEX_RB_INSERT(vrf, ifp) \
+ if (RB_INSERT(if_index_head, &vrf->ifaces_by_index, (ifp))) \
flog_err(EC_LIB_INTERFACE, \
"%s(%u): corruption detected -- interface with this " \
"ifindex exists already in VRF %u!", \
- __func__, (_ifp)->ifindex, (_ifp)->vrf ? \
- (_ifp)->vrf->vrf_id : VRF_UNKNOWN);
+ __func__, (ifp)->ifindex, (ifp)->vrf_id);
-#define IFINDEX_RB_REMOVE(_vrf, _ifp) \
- if (RB_REMOVE(if_index_head, &(_vrf)->ifaces_by_index, (_ifp)) == NULL)\
+#define IFINDEX_RB_REMOVE(vrf, ifp) \
+ if (RB_REMOVE(if_index_head, &vrf->ifaces_by_index, (ifp)) == NULL) \
flog_err(EC_LIB_INTERFACE, \
"%s(%u): corruption detected -- interface with this " \
"ifindex doesn't exist in VRF %u!", \
- __func__, (_ifp)->ifindex, (_ifp)->vrf ? \
- (_ifp)->vrf->vrf_id : VRF_UNKNOWN);
+ __func__, (ifp)->ifindex, (ifp)->vrf_id);
#define FOR_ALL_INTERFACES(vrf, ifp) \
if (vrf) \
@@ -482,8 +476,8 @@ extern int if_cmp_name_func(const char *p1, const char *p2);
* This is useful for vrf route-leaking. So more than anything
* else think before you use VRF_UNKNOWN
*/
-extern void if_update_to_new_vrf(struct interface *, struct vrf *vrf);
-extern struct interface *if_create(const char *name, struct vrf *vrf);
+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);
extern struct interface *if_lookup_by_index(ifindex_t, vrf_id_t vrf_id);
extern struct interface *if_lookup_exact_address(void *matchaddr, int family,
vrf_id_t vrf_id);
@@ -497,8 +491,8 @@ size_t if_lookup_by_hwaddr(const uint8_t *hw_addr, size_t addrsz,
/* 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, struct vrf *vrf);
-extern struct interface *if_get_by_name(const char *ifname, struct vrf *vrf);
+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 void if_set_index(struct interface *ifp, ifindex_t ifindex);
/* Delete the interface, but do not free the structure, and leave it in the