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 <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-09-06 20:12:46 -04:00
parent 98e6d77f93
commit 79b3087675
3 changed files with 33 additions and 37 deletions

View File

@ -159,7 +159,7 @@ int eigrp_if_new_hook(struct interface *ifp)
{ {
int rc = 0; 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(ifp) = route_table_init();
IF_OIFS_PARAMS(ifp) = route_table_init(); IF_OIFS_PARAMS(ifp) = route_table_init();

View File

@ -29,9 +29,9 @@
#define _ZEBRA_EIGRP_MACROS_H_ #define _ZEBRA_EIGRP_MACROS_H_
#define DECLARE_IF_PARAM(T, P) T P; u_char P##__config:1 #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(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 SET_IF_PARAM(S, P) ((S)->P##__config) = 1
#define IF_DEF_PARAMS(I) (IF_EIGRP_IF_INFO (I)->def_params) #define IF_DEF_PARAMS(I) (IF_EIGRP_IF_INFO (I)->def_params)

View File

@ -135,10 +135,39 @@ struct eigrp {
QOBJ_FIELDS QOBJ_FIELDS
}; };
DECLARE_QOBJ_TYPE(eigrp) 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*/ /*EIGRP interface structure*/
struct eigrp_interface { 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. */ /* This interface's parent eigrp instance. */
struct eigrp *eigrp; struct eigrp *eigrp;
@ -196,39 +225,6 @@ struct eigrp_interface {
struct route_map *routemap[EIGRP_FILTER_MAX]; 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 /* Determines if it is first or last packet
* when packet consists of multiple packet * when packet consists of multiple packet
* chunks because of many route TLV * chunks because of many route TLV