From 79b3087675c7c4cc6c0693ca205c02b76c45525a Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 6 Sep 2017 20:12:46 -0400 Subject: [PATCH] eigrpd: Start fixing eigrp_interface The EIGRP interface handling code created 2 levels of interface information, the ei( created per *connected* address?????) and the ifp->info pointer. Start the combination of pushing these together and cleaning up the weirdness that is these two data structures. This commit probably breaks eigrp's handling of interfaces. Signed-off-by: Donald Sharp --- eigrpd/eigrp_interface.c | 2 +- eigrpd/eigrp_macros.h | 4 +-- eigrpd/eigrp_structs.h | 64 +++++++++++++++++++--------------------- 3 files changed, 33 insertions(+), 37 deletions(-) diff --git a/eigrpd/eigrp_interface.c b/eigrpd/eigrp_interface.c index f2512eadad..0e0af71fb9 100644 --- a/eigrpd/eigrp_interface.c +++ b/eigrpd/eigrp_interface.c @@ -159,7 +159,7 @@ int eigrp_if_new_hook(struct interface *ifp) { int rc = 0; - ifp->info = XCALLOC(MTYPE_EIGRP_IF_INFO, sizeof(struct eigrp_if_info)); + ifp->info = XCALLOC(MTYPE_EIGRP_IF_INFO, sizeof(struct eigrp_interface)); IF_OIFS(ifp) = route_table_init(); IF_OIFS_PARAMS(ifp) = route_table_init(); diff --git a/eigrpd/eigrp_macros.h b/eigrpd/eigrp_macros.h index fdb84673df..7a803fdbfc 100644 --- a/eigrpd/eigrp_macros.h +++ b/eigrpd/eigrp_macros.h @@ -29,9 +29,9 @@ #define _ZEBRA_EIGRP_MACROS_H_ #define DECLARE_IF_PARAM(T, P) T P; u_char P##__config:1 -#define IF_EIGRP_IF_INFO(I) ((struct eigrp_if_info *)((I)->info)) +#define IF_EIGRP_IF_INFO(I) ((struct eigrp_interface *)((I)->info)) #define IF_OIFS(I) (IF_EIGRP_IF_INFO (I)->eifs) -#define IF_OIFS_PARAMS(I) (IF_EIGRP_IF_INFO (I)->params) +#define IF_OIFS_PARAMS(I) (IF_EIGRP_IF_INFO (I)->eparams) #define SET_IF_PARAM(S, P) ((S)->P##__config) = 1 #define IF_DEF_PARAMS(I) (IF_EIGRP_IF_INFO (I)->def_params) diff --git a/eigrpd/eigrp_structs.h b/eigrpd/eigrp_structs.h index 5bc63a7c47..71761391ac 100644 --- a/eigrpd/eigrp_structs.h +++ b/eigrpd/eigrp_structs.h @@ -135,10 +135,39 @@ struct eigrp { QOBJ_FIELDS }; DECLARE_QOBJ_TYPE(eigrp) -//------------------------------------------------------------------------------------------------------------------------------------------ + +struct eigrp_if_params { + DECLARE_IF_PARAM(u_char, passive_interface); /* EIGRP Interface is + passive: no sending or + receiving (no need to + join multicast groups) + */ + DECLARE_IF_PARAM(u_int32_t, v_hello); /* Hello Interval */ + DECLARE_IF_PARAM(u_int16_t, v_wait); /* Router Hold Time Interval */ + DECLARE_IF_PARAM(u_char, type); /* type of interface */ + DECLARE_IF_PARAM(u_int32_t, bandwidth); + DECLARE_IF_PARAM(u_int32_t, delay); + DECLARE_IF_PARAM(u_char, reliability); + DECLARE_IF_PARAM(u_char, load); + + DECLARE_IF_PARAM(char *, + auth_keychain); /* Associated keychain with interface*/ + DECLARE_IF_PARAM(int, auth_type); /* EIGRP authentication type */ +}; + +enum { MEMBER_ALLROUTERS = 0, + MEMBER_MAX, +}; /*EIGRP interface structure*/ struct eigrp_interface { + struct eigrp_if_params *def_params; + struct route_table *eparams; + struct route_table *eifs; + + /*multicast group refcnts */ + unsigned int membership_counts[MEMBER_MAX]; + /* This interface's parent eigrp instance. */ struct eigrp *eigrp; @@ -196,39 +225,6 @@ struct eigrp_interface { struct route_map *routemap[EIGRP_FILTER_MAX]; }; -struct eigrp_if_params { - DECLARE_IF_PARAM(u_char, passive_interface); /* EIGRP Interface is - passive: no sending or - receiving (no need to - join multicast groups) - */ - DECLARE_IF_PARAM(u_int32_t, v_hello); /* Hello Interval */ - DECLARE_IF_PARAM(u_int16_t, v_wait); /* Router Hold Time Interval */ - DECLARE_IF_PARAM(u_char, type); /* type of interface */ - DECLARE_IF_PARAM(u_int32_t, bandwidth); - DECLARE_IF_PARAM(u_int32_t, delay); - DECLARE_IF_PARAM(u_char, reliability); - DECLARE_IF_PARAM(u_char, load); - - DECLARE_IF_PARAM(char *, - auth_keychain); /* Associated keychain with interface*/ - DECLARE_IF_PARAM(int, auth_type); /* EIGRP authentication type */ -}; - -enum { MEMBER_ALLROUTERS = 0, - MEMBER_MAX, -}; - -struct eigrp_if_info { - struct eigrp_if_params *def_params; - struct route_table *params; - struct route_table *eifs; - unsigned int - membership_counts[MEMBER_MAX]; /* multicast group refcnts */ -}; - -//------------------------------------------------------------------------------------------------------------------------------------------ - /* Determines if it is first or last packet * when packet consists of multiple packet * chunks because of many route TLV -- 2.39.5