struct eigrp_interface *ei)
{
vty_out(vty, "%-11s ", eigrp_if_name_string(ei));
- vty_out(vty, "%-11u", IF_DEF_PARAMS(ei->ifp)->bandwidth);
- vty_out(vty, "%-11u", IF_DEF_PARAMS(ei->ifp)->delay);
+ vty_out(vty, "%-11u", ei->params.bandwidth);
+ vty_out(vty, "%-11u", ei->params.delay);
vty_out(vty, "%-7u", ei->nbrs->count);
vty_out(vty, "%u %c %-10u", 0, '/',
eigrp_neighbor_packet_queue_sum(ei));
vty_out(vty, "%-7u %-14u %-12u %-8u", 0, 0, 0, 0);
- vty_out(vty, "%-8u %-8u \n", IF_DEF_PARAMS(ei->ifp)->v_hello,
- IF_DEF_PARAMS(ei->ifp)->v_wait);
+ vty_out(vty, "%-8u %-8u \n", ei->params.v_hello,
+ ei->params.v_wait);
}
void show_ip_eigrp_interface_detail(struct vty *vty, struct eigrp *eigrp,
if (IS_DEBUG_EIGRP(0, TIMERS))
zlog_debug("Start Hello Timer (%s) Expire [%u]", IF_NAME(ei),
- EIGRP_IF_PARAM(ei, v_hello));
+ ei->params.v_hello);
/* Sending hello packet. */
eigrp_hello_send(ei, EIGRP_HELLO_NORMAL, NULL);
/* Hello timer set. */
ei->t_hello = NULL;
thread_add_timer(master, eigrp_hello_timer, ei,
- EIGRP_IF_PARAM(ei, v_hello), &ei->t_hello);
+ ei->params.v_hello, &ei->t_hello);
return 0;
}
}
// and set hold time value..
- stream_putw(s, IF_DEF_PARAMS(ei->ifp)->v_wait);
+ stream_putw(s, ei->params.v_wait);
return length;
}
eigrp_packet_header_init(EIGRP_OPC_HELLO, ei->eigrp, ep->s, 0, 0, ack);
// encode Authentication TLV
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (ei->params.auth_keychain != NULL)) {
length += eigrp_add_authTLV_MD5_to_stream(ep->s, ei);
- } else if ((IF_DEF_PARAMS(ei->ifp)->auth_type
+ } else if ((ei->params.auth_type
== EIGRP_AUTH_TYPE_SHA256)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ && (ei->params.auth_keychain != NULL)) {
length += eigrp_add_authTLV_SHA256_to_stream(ep->s, ei);
}
// set soruce address for the hello packet
ep->dst.s_addr = addr;
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (ei->params.auth_keychain != NULL)) {
eigrp_make_md5_digest(ei, ep->s,
EIGRP_AUTH_BASIC_HELLO_FLAG);
- } else if ((IF_DEF_PARAMS(ei->ifp)->auth_type
+ } else if ((ei->params.auth_type
== EIGRP_AUTH_TYPE_SHA256)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ && (ei->params.auth_keychain != NULL)) {
eigrp_make_sha256_digest(ei, ep->s,
EIGRP_AUTH_BASIC_HELLO_FLAG);
}
#include "eigrpd/eigrp_memory.h"
#include "eigrpd/eigrp_fsm.h"
-static void eigrp_delete_from_if(struct interface *, struct eigrp_interface *);
-
-static void eigrp_add_to_if(struct interface *ifp, struct eigrp_interface *ei)
-{
- struct route_node *rn;
- struct prefix p;
-
- p = *ei->address;
- p.prefixlen = IPV4_MAX_PREFIXLEN;
-
- rn = route_node_get(IF_OIFS(ifp), &p);
- /* rn->info should either be NULL or equal to this ei
- * as route_node_get may return an existing node
- */
- assert(!rn->info || rn->info == ei);
- rn->info = ei;
-}
-
struct eigrp_interface *eigrp_if_new(struct eigrp *eigrp, struct interface *ifp,
struct prefix *p)
{
- struct eigrp_interface *ei;
+ struct eigrp_interface *ei = ifp->info;
int i;
- if ((ei = eigrp_if_table_lookup(ifp, p)) == NULL) {
- ei = XCALLOC(MTYPE_EIGRP_IF, sizeof(struct eigrp_interface));
- memset(ei, 0, sizeof(struct eigrp_interface));
- } else
+ if (ei)
return ei;
+ ei = XCALLOC(MTYPE_EIGRP_IF, sizeof(struct eigrp_interface));
+
/* Set zebra interface pointer. */
ei->ifp = ifp;
ei->address = p;
- eigrp_add_to_if(ifp, ei);
+ ifp->info = ei;
listnode_add(eigrp->eiflist, ei);
ei->type = EIGRP_IFTYPE_BROADCAST;
ei->routemap[i] = NULL;
}
- return ei;
-}
-
-/* lookup ei for specified prefix/ifp */
-struct eigrp_interface *eigrp_if_table_lookup(struct interface *ifp,
- struct prefix *prefix)
-{
- struct prefix p;
- struct route_node *rn;
- struct eigrp_interface *rninfo = NULL;
-
- p = *prefix;
- p.prefixlen = IPV4_MAX_PREFIXLEN;
+ ei->eigrp = eigrp;
- /* route_node_get implicitly locks */
- if ((rn = route_node_lookup(IF_OIFS(ifp), &p))) {
- rninfo = (struct eigrp_interface *)rn->info;
- route_unlock_node(rn);
- }
+ ei->params.v_hello = EIGRP_HELLO_INTERVAL_DEFAULT;
+ ei->params.v_wait = EIGRP_HOLD_INTERVAL_DEFAULT;
+ ei->params.bandwidth = EIGRP_BANDWIDTH_DEFAULT;
+ ei->params.delay = EIGRP_DELAY_DEFAULT;
+ ei->params.reliability = EIGRP_RELIABILITY_DEFAULT;
+ ei->params.load = EIGRP_LOAD_DEFAULT;
+ ei->params.auth_type = EIGRP_AUTH_TYPE_NONE;
+ ei->params.auth_keychain = NULL;
- return rninfo;
+ return ei;
}
int eigrp_if_delete_hook(struct interface *ifp)
{
- struct route_node *rn;
+ struct eigrp_interface *ei = ifp->info;
+ struct eigrp *eigrp;
- route_table_finish(IF_OIFS(ifp));
+ if (!ei)
+ return 0;
+
+ list_delete(ei->nbrs);
- for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn))
- if (rn->info)
- eigrp_del_if_params(rn->info);
- route_table_finish(IF_OIFS_PARAMS(ifp));
+ eigrp = ei->eigrp;
+ listnode_delete(eigrp->eiflist, ei);
XFREE(MTYPE_EIGRP_IF_INFO, ifp->info);
ifp->info = NULL;
void eigrp_if_init()
{
/* Initialize Zebra interface data structure. */
- hook_register_prio(if_add, 0, eigrp_if_new_hook);
+ //hook_register_prio(if_add, 0, eigrp_if_new);
hook_register_prio(if_del, 0, eigrp_if_delete_hook);
}
-int eigrp_if_new_hook(struct interface *ifp)
-{
- int rc = 0;
-
- ifp->info = XCALLOC(MTYPE_EIGRP_IF_INFO, sizeof(struct eigrp_interface));
-
- IF_OIFS(ifp) = route_table_init();
- IF_OIFS_PARAMS(ifp) = route_table_init();
-
- IF_DEF_PARAMS(ifp) = eigrp_new_if_params();
-
- SET_IF_PARAM(IF_DEF_PARAMS(ifp), v_hello);
- IF_DEF_PARAMS(ifp)->v_hello = (u_int32_t)EIGRP_HELLO_INTERVAL_DEFAULT;
-
- SET_IF_PARAM(IF_DEF_PARAMS(ifp), v_wait);
- IF_DEF_PARAMS(ifp)->v_wait = (u_int16_t)EIGRP_HOLD_INTERVAL_DEFAULT;
-
- SET_IF_PARAM(IF_DEF_PARAMS(ifp), bandwidth);
- IF_DEF_PARAMS(ifp)->bandwidth = (u_int32_t)EIGRP_BANDWIDTH_DEFAULT;
-
- SET_IF_PARAM(IF_DEF_PARAMS(ifp), delay);
- IF_DEF_PARAMS(ifp)->delay = (u_int32_t)EIGRP_DELAY_DEFAULT;
-
- SET_IF_PARAM(IF_DEF_PARAMS(ifp), reliability);
- IF_DEF_PARAMS(ifp)->reliability = (u_char)EIGRP_RELIABILITY_DEFAULT;
- SET_IF_PARAM(IF_DEF_PARAMS(ifp), load);
- IF_DEF_PARAMS(ifp)->load = (u_char)EIGRP_LOAD_DEFAULT;
-
- SET_IF_PARAM(IF_DEF_PARAMS(ifp), auth_type);
- IF_DEF_PARAMS(ifp)->auth_type = EIGRP_AUTH_TYPE_NONE;
-
- SET_IF_PARAM(IF_DEF_PARAMS(ifp), auth_keychain);
- IF_DEF_PARAMS(ifp)->auth_keychain = NULL;
-
- return rc;
-}
-
-struct eigrp_if_params *eigrp_new_if_params(void)
-{
- struct eigrp_if_params *eip;
-
- eip = XCALLOC(MTYPE_EIGRP_IF_PARAMS, sizeof(struct eigrp_if_params));
- if (!eip)
- return NULL;
-
- UNSET_IF_PARAM(eip, passive_interface);
- UNSET_IF_PARAM(eip, v_hello);
- UNSET_IF_PARAM(eip, v_wait);
- UNSET_IF_PARAM(eip, bandwidth);
- UNSET_IF_PARAM(eip, delay);
- UNSET_IF_PARAM(eip, reliability);
- UNSET_IF_PARAM(eip, load);
- UNSET_IF_PARAM(eip, auth_keychain);
- UNSET_IF_PARAM(eip, auth_type);
-
- return eip;
-}
void eigrp_del_if_params(struct eigrp_if_params *eip)
{
if (eip->auth_keychain)
free(eip->auth_keychain);
-
- XFREE(MTYPE_EIGRP_IF_PARAMS, eip);
-}
-
-struct eigrp_if_params *eigrp_lookup_if_params(struct interface *ifp,
- struct in_addr addr)
-{
- struct prefix p;
- struct route_node *rn;
-
- p.family = AF_INET;
- p.prefixlen = IPV4_MAX_PREFIXLEN;
- p.u.prefix4 = addr;
-
- rn = route_node_lookup(IF_OIFS_PARAMS(ifp), &p);
-
- if (rn) {
- route_unlock_node(rn);
- return rn->info;
- }
-
- return NULL;
}
int eigrp_if_up(struct eigrp_interface *ei)
/*Prepare metrics*/
metric.bandwidth =
- eigrp_bandwidth_to_scaled(EIGRP_IF_PARAM(ei, bandwidth));
- metric.delay = eigrp_delay_to_scaled(EIGRP_IF_PARAM(ei, delay));
- metric.load = EIGRP_IF_PARAM(ei, load);
- metric.reliability = EIGRP_IF_PARAM(ei, reliability);
+ eigrp_bandwidth_to_scaled(ei->params.bandwidth);
+ metric.delay = eigrp_delay_to_scaled(ei->params.delay);
+ metric.load = ei->params.load;
+ metric.reliability = ei->params.reliability;
metric.mtu[0] = 0xDC;
metric.mtu[1] = 0x05;
metric.mtu[2] = 0x00;
}
}
+bool eigrp_if_is_passive(struct eigrp_interface *ei)
+{
+ if (ei->params.passive_interface == EIGRP_IF_ACTIVE)
+ return false;
+
+ if (ei->eigrp->passive_interface_default == EIGRP_IF_ACTIVE)
+ return false;
+
+ return true;
+}
+
void eigrp_if_set_multicast(struct eigrp_interface *ei)
{
- if ((EIGRP_IF_PASSIVE_STATUS(ei) == EIGRP_IF_ACTIVE)) {
+ if (!eigrp_if_is_passive(ei)) {
/* The interface should belong to the EIGRP-all-routers group.
*/
- if (!EI_MEMBER_CHECK(ei, MEMBER_ALLROUTERS)
+ if (!ei->member_allrouters
&& (eigrp_if_add_allspfrouters(ei->eigrp, ei->address,
ei->ifp->ifindex)
>= 0))
/* Set the flag only if the system call to join
* succeeded. */
- EI_MEMBER_JOINED(ei, MEMBER_ALLROUTERS);
+ ei->member_allrouters = true;
} else {
/* The interface should NOT belong to the EIGRP-all-routers
* group. */
- if (EI_MEMBER_CHECK(ei, MEMBER_ALLROUTERS)) {
+ if (ei->member_allrouters) {
/* Only actually drop if this is the last reference */
- if (EI_MEMBER_COUNT(ei, MEMBER_ALLROUTERS) == 1)
- eigrp_if_drop_allspfrouters(ei->eigrp,
- ei->address,
- ei->ifp->ifindex);
+ eigrp_if_drop_allspfrouters(ei->eigrp,
+ ei->address,
+ ei->ifp->ifindex);
/* Unset the flag regardless of whether the system call
to leave
the group succeeded, since it's much safer to assume
that
we are not a member. */
- EI_MEMBER_LEFT(ei, MEMBER_ALLROUTERS);
+ ei->member_allrouters = false;
}
}
}
return EIGRP_IFTYPE_BROADCAST;
}
-void eigrp_if_free(struct eigrp_interface *ei, int source)
+void eigrp_if_free(struct eigrp_interface *ei,
+ int source)
{
struct prefix dest_addr;
struct eigrp_prefix_entry *pe;
eigrp_if_down(ei);
list_delete(ei->nbrs);
- eigrp_delete_from_if(ei->ifp, ei);
listnode_delete(ei->eigrp->eiflist, ei);
-
- thread_cancel_event(master, ei);
-
- memset(ei, 0, sizeof(*ei));
- XFREE(MTYPE_EIGRP_IF, ei);
-}
-
-static void eigrp_delete_from_if(struct interface *ifp,
- struct eigrp_interface *ei)
-{
- struct route_node *rn;
- struct prefix p;
-
- p = *ei->address;
- p.prefixlen = IPV4_MAX_PREFIXLEN;
-
- rn = route_node_lookup(IF_OIFS(ei->ifp), &p);
- assert(rn);
- assert(rn->info);
- rn->info = NULL;
- route_unlock_node(rn);
- route_unlock_node(rn);
}
/* Simulate down/up on the interface. This is needed, for example, when
the MTU changes. */
void eigrp_if_reset(struct interface *ifp)
{
- struct route_node *rn;
+ struct eigrp_interface *ei = ifp->info;
- for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
- struct eigrp_interface *ei;
+ if (!ei)
+ return;
- if ((ei = rn->info) == NULL)
- continue;
-
- eigrp_if_down(ei);
- eigrp_if_up(ei);
- }
+ eigrp_if_down(ei);
+ eigrp_if_up(ei);
}
struct eigrp_interface *eigrp_if_lookup_by_local_addr(struct eigrp *eigrp,
return NULL;
}
-/* determine receiving interface by ifp and source address */
-struct eigrp_interface *eigrp_if_lookup_recv_if(struct eigrp *eigrp,
- struct in_addr src,
- struct interface *ifp)
-{
- struct route_node *rn;
- struct prefix addr;
- struct eigrp_interface *ei, *match;
-
- addr.family = AF_INET;
- addr.u.prefix4 = src;
- addr.prefixlen = IPV4_MAX_BITLEN;
-
- match = NULL;
-
- for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
- ei = rn->info;
-
- if (!ei) /* oi can be NULL for PtP aliases */
- continue;
-
- if (if_is_loopback(ei->ifp))
- continue;
-
- if (prefix_match(CONNECTED_PREFIX(ei->connected),
- &addr)) {
- if ((match == NULL) || (match->address->prefixlen
- < ei->address->prefixlen))
- match = ei;
- }
- }
-
- return match;
-}
-
u_int32_t eigrp_bandwidth_to_scaled(u_int32_t bandwidth)
{
uint64_t temp_bandwidth = (256ull * 10000000) / bandwidth;
extern int eigrp_if_new_hook(struct interface *);
extern int eigrp_if_delete_hook(struct interface *);
+extern bool eigrp_if_is_passive(struct eigrp_interface *ei);
extern void eigrp_del_if_params(struct eigrp_if_params *);
-extern struct eigrp_if_params *eigrp_new_if_params(void);
extern struct eigrp_interface *eigrp_if_new(struct eigrp *, struct interface *,
struct prefix *);
-extern struct eigrp_interface *eigrp_if_table_lookup(struct interface *,
- struct prefix *);
-extern struct eigrp_if_params *eigrp_lookup_if_params(struct interface *,
- struct in_addr);
extern int eigrp_if_up(struct eigrp_interface *);
extern void eigrp_if_stream_set(struct eigrp_interface *);
extern void eigrp_if_set_multicast(struct eigrp_interface *);
struct in_addr);
extern struct eigrp_interface *eigrp_if_lookup_by_name(struct eigrp *,
const char *);
-struct eigrp_interface *eigrp_if_lookup_recv_if(struct eigrp *, struct in_addr,
- struct interface *);
/* Simulate down/up on the interface. */
extern void eigrp_if_reset(struct interface *);
? (O)->params->P \
: IF_DEF_PARAMS((O)->ifp)->P)
-#define EIGRP_IF_PASSIVE_STATUS(O) \
- (EIGRP_IF_PARAM_CONFIGURED((O)->params, passive_interface) \
- ? (O)->params->passive_interface \
- : (EIGRP_IF_PARAM_CONFIGURED(IF_DEF_PARAMS((O)->ifp), \
- passive_interface) \
- ? IF_DEF_PARAMS((O)->ifp)->passive_interface \
- : (O)->eigrp->passive_interface_default))
//------------------------------------------------------------------------------------------------------------------------------------
#define EIGRP_IF_STRING_MAXLEN 40
#define IF_NAME(I) eigrp_if_name_string ((I))
-//------------------------------------------------------------------------------------------------------------------------------------
-
-/*Macros for EIGRP interface multicast membership*/
-#define EI_MEMBER_FLAG(M) (1 << (M))
-#define EI_MEMBER_COUNT(O,M) (IF_EIGRP_IF_INFO(ei->ifp)->membership_counts[(M)])
-#define EI_MEMBER_CHECK(O, M) \
- (CHECK_FLAG((O)->multicast_memberships, EI_MEMBER_FLAG(M)))
-#define EI_MEMBER_JOINED(O, M) \
- do { \
- SET_FLAG((O)->multicast_memberships, EI_MEMBER_FLAG(M)); \
- IF_EIGRP_IF_INFO((O)->ifp)->membership_counts[(M)]++; \
- } while (0)
-#define EI_MEMBER_LEFT(O, M) \
- do { \
- UNSET_FLAG((O)->multicast_memberships, EI_MEMBER_FLAG(M)); \
- IF_EIGRP_IF_INFO((O)->ifp)->membership_counts[(M)]--; \
- } while (0)
+//--------------------------------------------------------------------------
-//-----------------------------------------------------------------------------------------------------------------------------------
/* Topology Macros */
static void eigrp_network_run_interface(struct eigrp *eigrp, struct prefix *p,
struct interface *ifp)
{
+ struct eigrp_interface *ei;
struct listnode *cnode;
struct connected *co;
continue;
if (p->family == co->address->family
- && !eigrp_if_table_lookup(ifp, co->address)
+ && !ifp->info
&& eigrp_network_match_iface(co, p)) {
- struct eigrp_interface *ei;
ei = eigrp_if_new(eigrp, ifp, co->address);
ei->connected = co;
- ei->params = eigrp_lookup_if_params(
- ifp, ei->address->u.prefix4);
-
/* Relate eigrp interface to eigrp instance. */
ei->eigrp = eigrp;
- /* update network type as interface flag */
- /* If network type is specified previously,
- skip network type setting. */
- ei->type = IF_DEF_PARAMS(ifp)->type;
-
/* if router_id is not configured, dont bring up
* interfaces.
* eigrp_router_id_update() will call eigrp_if_update
u_int32_t eigrp_calculate_total_metrics(struct eigrp *eigrp,
struct eigrp_nexthop_entry *entry)
{
+ struct eigrp_interface *ei = entry->ei;
+
entry->total_metric = entry->reported_metric;
uint64_t temp_delay = (uint64_t)entry->total_metric.delay
- + (uint64_t)eigrp_delay_to_scaled(
- EIGRP_IF_PARAM(entry->ei, delay));
+ + (uint64_t)eigrp_delay_to_scaled(ei->params.delay);
entry->total_metric.delay = temp_delay > EIGRP_MAX_METRIC
? EIGRP_MAX_METRIC
: (u_int32_t)temp_delay;
u_int32_t bw =
- eigrp_bandwidth_to_scaled(EIGRP_IF_PARAM(entry->ei, bandwidth));
+ eigrp_bandwidth_to_scaled(ei->params.bandwidth);
entry->total_metric.bandwidth = entry->total_metric.bandwidth > bw
? bw
: entry->total_metric.bandwidth;
stream_get(auth_TLV, s, EIGRP_AUTH_MD5_TLV_SIZE);
stream_set_getp(s, backup_get);
- keychain = keychain_lookup(IF_DEF_PARAMS(ei->ifp)->auth_keychain);
+ keychain = keychain_lookup(ei->params.auth_keychain);
if (keychain)
key = key_lookup_for_send(keychain);
else {
ibuf = s->data;
backup_end = s->endp;
- keychain = keychain_lookup(IF_DEF_PARAMS(nbr->ei->ifp)->auth_keychain);
+ keychain = keychain_lookup(nbr->ei->params.auth_keychain);
if (keychain)
key = key_lookup_for_send(keychain);
stream_get(auth_TLV, s, EIGRP_AUTH_SHA256_TLV_SIZE);
stream_set_getp(s, backup_get);
- keychain = keychain_lookup(IF_DEF_PARAMS(ei->ifp)->auth_keychain);
+ keychain = keychain_lookup(ei->params.auth_keychain);
if (keychain)
key = key_lookup_for_send(keychain);
}
/* associate packet with eigrp interface */
- ei = eigrp_if_lookup_recv_if(eigrp, iph->ip_src, ifp);
+ ei = ifp->info;
/* eigrp_verify_header() relies on a valid "ei" and thus can be called
only
// stream_get_getp(ibuf)))
// return -1;
- /* Now it is safe to access all fields of EIGRP packet header. */
- /* associate packet with eigrp interface */
- ei = eigrp_if_lookup_recv_if(eigrp, iph->ip_src, ifp);
-
- /* eigrp_verify_header() relies on a valid "ei" and thus can be called
- only
- after the checks below are passed. These checks in turn access the
- fields of unverified "eigrph" structure for their own purposes and
- must remain very accurate in doing this.
- */
- if (!ei)
- return 0;
-
/* If incoming interface is passive one, ignore it. */
- if (ei && EIGRP_IF_PASSIVE_STATUS(ei) == EIGRP_IF_PASSIVE) {
+ if (ei && eigrp_if_is_passive(ei)) {
char buf[3][INET_ADDRSTRLEN];
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
buf[2], sizeof(buf[2])));
if (iph->ip_dst.s_addr == htonl(EIGRP_MULTICAST_ADDRESS)) {
- /* Try to fix multicast membership.
- * Some OS:es may have problems in this area,
- * make sure it is removed.
- */
- EI_MEMBER_JOINED(ei, MEMBER_ALLROUTERS);
eigrp_if_set_multicast(ei);
}
return 0;
authTLV->key_sequence = 0;
memset(authTLV->Nullpad, 0, sizeof(authTLV->Nullpad));
- keychain = keychain_lookup(IF_DEF_PARAMS(ei->ifp)->auth_keychain);
+ keychain = keychain_lookup(ei->params.auth_keychain);
if (keychain)
key = key_lookup_for_send(keychain);
else {
- free(IF_DEF_PARAMS(ei->ifp)->auth_keychain);
- IF_DEF_PARAMS(ei->ifp)->auth_keychain = NULL;
+ free(ei->params.auth_keychain);
+ ei->params.auth_keychain = NULL;
eigrp_authTLV_MD5_free(authTLV);
return 0;
}
authTLV->key_sequence = 0;
memset(authTLV->Nullpad, 0, sizeof(authTLV->Nullpad));
- keychain = keychain_lookup(IF_DEF_PARAMS(ei->ifp)->auth_keychain);
+ keychain = keychain_lookup(ei->params.auth_keychain);
if (keychain)
key = key_lookup_for_send(keychain);
else {
- free(IF_DEF_PARAMS(ei->ifp)->auth_keychain);
- IF_DEF_PARAMS(ei->ifp)->auth_keychain = NULL;
+ free(ei->params.auth_keychain);
+ ei->params.auth_keychain = NULL;
eigrp_authTLV_SHA256_free(authTLV);
return 0;
}
ei->eigrp->sequence_number, 0);
// encode Authentication TLV, if needed
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (ei->params.auth_keychain != NULL)) {
length += eigrp_add_authTLV_MD5_to_stream(ep->s, ei);
}
return;
}
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && ei->params.auth_keychain != NULL) {
eigrp_make_md5_digest(ei, ep->s, EIGRP_AUTH_UPDATE_FLAG);
}
/*
- * EIGRP Sending and Receiving EIGRP Reply Packets.
+ * Eigrp Sending and Receiving EIGRP Reply Packets.
* Copyright (C) 2013-2016
* Authors:
* Donnie Savage
eigrp->sequence_number, 0);
// encode Authentication TLV, if needed
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ if (ei->params.auth_type == EIGRP_AUTH_TYPE_MD5
+ && (ei->params.auth_keychain != NULL)) {
length += eigrp_add_authTLV_MD5_to_stream(ep->s, ei);
}
length += eigrp_add_internalTLV_to_stream(ep->s, pe2);
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (ei->params.auth_keychain != NULL)) {
eigrp_make_md5_digest(ei, ep->s, EIGRP_AUTH_UPDATE_FLAG);
}
nbr->ei->eigrp->sequence_number, 0);
// encode Authentication TLV, if needed
- if ((IF_DEF_PARAMS(nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(nbr->ei->ifp)->auth_keychain != NULL)) {
+ if ((nbr->ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (nbr->ei->params.auth_keychain != NULL)) {
length += eigrp_add_authTLV_MD5_to_stream(ep->s, nbr->ei);
}
length += eigrp_add_internalTLV_to_stream(ep->s, pe);
- if ((IF_DEF_PARAMS(nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(nbr->ei->ifp)->auth_keychain != NULL)) {
+ if ((nbr->ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (nbr->ei->params.auth_keychain != NULL)) {
eigrp_make_md5_digest(nbr->ei, ep->s, EIGRP_AUTH_UPDATE_FLAG);
}
nbr->ei->eigrp->sequence_number, 0);
// encode Authentication TLV, if needed
- if ((IF_DEF_PARAMS(nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(nbr->ei->ifp)->auth_keychain != NULL)) {
+ if (nbr->ei->params.auth_type == EIGRP_AUTH_TYPE_MD5
+ && nbr->ei->params.auth_keychain != NULL) {
length += eigrp_add_authTLV_MD5_to_stream(ep->s, nbr->ei);
}
length += eigrp_add_internalTLV_to_stream(ep->s, pe);
- if ((IF_DEF_PARAMS(nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(nbr->ei->ifp)->auth_keychain != NULL)) {
+ if ((nbr->ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (nbr->ei->params.auth_keychain != NULL)) {
eigrp_make_md5_digest(nbr->ei, ep->s, EIGRP_AUTH_UPDATE_FLAG);
}
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 */
+ u_char passive_interface;
+ u_int32_t v_hello;
+ u_int16_t v_wait;
+ u_char type; /* type of interface */
+ u_int32_t bandwidth;
+ u_int32_t delay;
+ u_char reliability;
+ u_char load;
+
+ char *auth_keychain; /* Associated keychain with interface*/
+ int auth_type; /* EIGRP authentication type */
};
enum { MEMBER_ALLROUTERS = 0,
/*EIGRP interface structure*/
struct eigrp_interface {
- struct eigrp_if_params *def_params;
- struct route_table *eparams;
- struct route_table *eifs;
+ struct eigrp_if_params params;
/*multicast group refcnts */
- unsigned int membership_counts[MEMBER_MAX];
+ bool member_allrouters;
/* This interface's parent eigrp instance. */
struct eigrp *eigrp;
/* To which multicast groups do we currently belong? */
- /* Configured varables. */
- struct eigrp_if_params *params;
u_char multicast_memberships;
nbr->recv_sequence_number);
// encode Authentication TLV, if needed
- if ((IF_DEF_PARAMS(nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(nbr->ei->ifp)->auth_keychain != NULL)) {
+ if ((nbr->ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (nbr->ei->params.auth_keychain != NULL)) {
length += eigrp_add_authTLV_MD5_to_stream(ep->s, nbr->ei);
eigrp_make_md5_digest(nbr->ei, ep->s,
EIGRP_AUTH_UPDATE_INIT_FLAG);
u_int32_t seq_no,
int length)
{
- if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
- (IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL)) {
+ if((nbr->ei->params.auth_type == EIGRP_AUTH_TYPE_MD5) &&
+ (nbr->ei->params.auth_keychain != NULL)) {
eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG);
}
seq_no, nbr->recv_sequence_number);
// encode Authentication TLV, if needed
- if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
- (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL)) {
+ if((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5) &&
+ (ei->params.auth_keychain != NULL)) {
length += eigrp_add_authTLV_MD5_to_stream(ep->s,ei);
}
ep->s, EIGRP_EOT_FLAG,
seq_no, nbr->recv_sequence_number);
- if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
- (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
+ if((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5) &&
+ (ei->params.auth_keychain != NULL))
{
length += eigrp_add_authTLV_MD5_to_stream(ep->s,ei);
}
ep->s, 0, seq_no, 0);
// encode Authentication TLV, if needed
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (ei->params.auth_keychain != NULL)) {
length += eigrp_add_authTLV_MD5_to_stream(ep->s, ei);
}
continue;
if ((length + 0x001D) > (u_int16_t)ei->ifp->mtu) {
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (ei->params.auth_keychain != NULL)) {
eigrp_make_md5_digest(ei, ep->s, EIGRP_AUTH_UPDATE_FLAG);
}
ep = eigrp_packet_new(ei->ifp->mtu, NULL);
eigrp_packet_header_init(EIGRP_OPC_UPDATE, eigrp,
ep->s, 0, seq_no, 0);
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (ei->params.auth_keychain != NULL)) {
length += eigrp_add_authTLV_MD5_to_stream(ep->s, ei);
}
has_tlv = 0;
return;
}
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (ei->params.auth_keychain != NULL)) {
eigrp_make_md5_digest(ei, ep->s, EIGRP_AUTH_UPDATE_FLAG);
}
nbr->recv_sequence_number);
// encode Authentication TLV, if needed
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (ei->params.auth_keychain != NULL)) {
length += eigrp_add_authTLV_MD5_to_stream(ep->s, ei);
}
}
/* compute Auth digest */
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (ei->params.auth_keychain != NULL)) {
eigrp_make_md5_digest(ei, ep->s, EIGRP_AUTH_UPDATE_FLAG);
}
for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, ei)) {
vty_frame(vty, "interface %s\n", ei->ifp->name);
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type)
- == EIGRP_AUTH_TYPE_MD5) {
+ if (ei->params.auth_type == EIGRP_AUTH_TYPE_MD5) {
vty_out(vty, " ip authentication mode eigrp %d md5\n",
eigrp->AS);
}
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type)
- == EIGRP_AUTH_TYPE_SHA256) {
+ if (ei->params.auth_type == EIGRP_AUTH_TYPE_SHA256) {
vty_out(vty,
" ip authentication mode eigrp %d hmac-sha-256\n",
eigrp->AS);
}
- if (IF_DEF_PARAMS(ei->ifp)->auth_keychain) {
+ if (ei->params.auth_keychain) {
vty_out(vty,
" ip authentication key-chain eigrp %d %s\n",
eigrp->AS,
- IF_DEF_PARAMS(ei->ifp)->auth_keychain);
+ ei->params.auth_keychain);
}
- if ((IF_DEF_PARAMS(ei->ifp)->v_hello)
- != EIGRP_HELLO_INTERVAL_DEFAULT) {
+ if (ei->params.v_hello != EIGRP_HELLO_INTERVAL_DEFAULT) {
vty_out(vty, " ip hello-interval eigrp %d\n",
- IF_DEF_PARAMS(ei->ifp)->v_hello);
+ ei->params.v_hello);
}
- if ((IF_DEF_PARAMS(ei->ifp)->v_wait)
- != EIGRP_HOLD_INTERVAL_DEFAULT) {
+ if (ei->params.v_wait != EIGRP_HOLD_INTERVAL_DEFAULT) {
vty_out(vty, " ip hold-time eigrp %d\n",
- IF_DEF_PARAMS(ei->ifp)->v_wait);
+ ei->params.v_wait);
}
/*Separate this EIGRP interface configuration from the others*/
{
struct listnode *node;
struct interface *ifp;
+ struct eigrp_interface *ei;
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp)) {
+ ei = ifp->info;
+ if (!ei)
+ continue;
+
vty_frame(vty, "interface %s\n", ifp->name);
if (ifp->desc)
vty_out(vty, " description %s\n", ifp->desc);
- if (IF_DEF_PARAMS(ifp)->bandwidth != EIGRP_BANDWIDTH_DEFAULT)
+ if (ei->params.bandwidth != EIGRP_BANDWIDTH_DEFAULT)
vty_out(vty, " bandwidth %u\n",
- IF_DEF_PARAMS(ifp)->bandwidth);
- if (IF_DEF_PARAMS(ifp)->delay != EIGRP_DELAY_DEFAULT)
- vty_out(vty, " delay %u\n", IF_DEF_PARAMS(ifp)->delay);
- if (IF_DEF_PARAMS(ifp)->v_hello != EIGRP_HELLO_INTERVAL_DEFAULT)
+ ei->params.bandwidth);
+ if (ei->params.delay != EIGRP_DELAY_DEFAULT)
+ vty_out(vty, " delay %u\n", ei->params.delay);
+ if (ei->params.v_hello != EIGRP_HELLO_INTERVAL_DEFAULT)
vty_out(vty, " ip hello-interval eigrp %u\n",
- IF_DEF_PARAMS(ifp)->v_hello);
- if (IF_DEF_PARAMS(ifp)->v_wait != EIGRP_HOLD_INTERVAL_DEFAULT)
+ ei->params.v_hello);
+ if (ei->params.v_wait != EIGRP_HOLD_INTERVAL_DEFAULT)
vty_out(vty, " ip hold-time eigrp %u\n",
- IF_DEF_PARAMS(ifp)->v_wait);
+ ei->params.v_wait);
vty_endframe(vty, "!\n");
}
char *ifname = argv[1]->arg;
for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, ei)) {
- if (strcmp(ifname, ei->ifp->name) == 0)
- SET_IF_PARAM(IF_DEF_PARAMS(ei->ifp), passive_interface);
+ if (strcmp(ifname, ei->ifp->name) == 0) {
+ ei->params.passive_interface = EIGRP_IF_PASSIVE;
+ return CMD_SUCCESS;
+ }
}
return CMD_SUCCESS;
}
char *ifname = argv[2]->arg;
for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, ei)) {
- if (strcmp(ifname, ei->ifp->name) == 0)
- UNSET_IF_PARAM(IF_DEF_PARAMS(ei->ifp),
- passive_interface);
+ if (strcmp(ifname, ei->ifp->name) == 0) {
+ ei->params.passive_interface = EIGRP_IF_ACTIVE;
+ return CMD_SUCCESS;
+ }
}
return CMD_SUCCESS;
"Throughput delay (tens of microseconds)\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
u_int32_t delay;
return CMD_SUCCESS;
}
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
delay = atoi(argv[1]->arg);
- IF_DEF_PARAMS(ifp)->delay = delay;
+ ei->params.delay = delay;
eigrp_if_reset(ifp);
return CMD_SUCCESS;
"Throughput delay (tens of microseconds)\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
return CMD_SUCCESS;
}
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
- IF_DEF_PARAMS(ifp)->delay = EIGRP_DELAY_DEFAULT;
+ ei->params.delay = EIGRP_DELAY_DEFAULT;
eigrp_if_reset(ifp);
return CMD_SUCCESS;
"Bandwidth in kilobits\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
u_int32_t bandwidth;
struct eigrp *eigrp;
return CMD_SUCCESS;
}
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
+
bandwidth = atoi(argv[1]->arg);
- IF_DEF_PARAMS(ifp)->bandwidth = bandwidth;
+ ei->params.bandwidth = bandwidth;
eigrp_if_reset(ifp);
return CMD_SUCCESS;
"Bandwidth in kilobits\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
return CMD_SUCCESS;
}
- IF_DEF_PARAMS(ifp)->bandwidth = EIGRP_BANDWIDTH_DEFAULT;
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
+
+ ei->params.bandwidth = EIGRP_BANDWIDTH_DEFAULT;
eigrp_if_reset(ifp);
return CMD_SUCCESS;
"Seconds between hello transmissions\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
u_int32_t hello;
struct eigrp *eigrp;
return CMD_SUCCESS;
}
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
+
hello = atoi(argv[3]->arg);
- IF_DEF_PARAMS(ifp)->v_hello = hello;
+ ei->params.v_hello = hello;
return CMD_SUCCESS;
}
"Seconds between hello transmissions\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
- struct eigrp_interface *ei;
- struct listnode *node, *nnode;
eigrp = eigrp_lookup();
if (eigrp == NULL) {
return CMD_SUCCESS;
}
- IF_DEF_PARAMS(ifp)->v_hello = EIGRP_HELLO_INTERVAL_DEFAULT;
-
- for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode, ei)) {
- if (ei->ifp == ifp) {
- THREAD_TIMER_OFF(ei->t_hello);
- thread_add_timer(master, eigrp_hello_timer, ei, 1,
- &ei->t_hello);
- break;
- }
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
}
+ ei->params.v_hello = EIGRP_HELLO_INTERVAL_DEFAULT;
+
+ THREAD_TIMER_OFF(ei->t_hello);
+ thread_add_timer(master, eigrp_hello_timer, ei, 1,
+ &ei->t_hello);
+
return CMD_SUCCESS;
}
"Seconds before neighbor is considered down\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
u_int32_t hold;
struct eigrp *eigrp;
return CMD_SUCCESS;
}
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
+
hold = atoi(argv[3]->arg);
- IF_DEF_PARAMS(ifp)->v_wait = hold;
+ ei->params.v_wait = hold;
return CMD_SUCCESS;
}
"Seconds before neighbor is considered down\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
return CMD_SUCCESS;
}
- IF_DEF_PARAMS(ifp)->v_wait = EIGRP_HOLD_INTERVAL_DEFAULT;
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
+
+ ei->params.v_wait = EIGRP_HOLD_INTERVAL_DEFAULT;
return CMD_SUCCESS;
}
-static int str2auth_type(const char *str, struct interface *ifp)
+static int str2auth_type(const char *str, struct eigrp_interface *ei)
{
/* Sanity check. */
if (str == NULL)
return CMD_WARNING_CONFIG_FAILED;
if (strncmp(str, "md5", 3) == 0) {
- IF_DEF_PARAMS(ifp)->auth_type = EIGRP_AUTH_TYPE_MD5;
+ ei->params.auth_type = EIGRP_AUTH_TYPE_MD5;
return CMD_SUCCESS;
} else if (strncmp(str, "hmac-sha-256", 12) == 0) {
- IF_DEF_PARAMS(ifp)->auth_type = EIGRP_AUTH_TYPE_SHA256;
+ ei->params.auth_type = EIGRP_AUTH_TYPE_SHA256;
return CMD_SUCCESS;
}
"HMAC SHA256 algorithm \n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
return CMD_SUCCESS;
}
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
+
// if(strncmp(argv[2], "md5",3))
// IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_MD5;
// else if(strncmp(argv[2], "hmac-sha-256",12))
// IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_SHA256;
- return str2auth_type(argv[5]->arg, ifp);
+ return str2auth_type(argv[5]->arg, ei);
}
DEFUN (no_eigrp_authentication_mode,
"HMAC SHA256 algorithm \n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
return CMD_SUCCESS;
}
- IF_DEF_PARAMS(ifp)->auth_type = EIGRP_AUTH_TYPE_NONE;
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
+
+ ei->params.auth_type = EIGRP_AUTH_TYPE_NONE;
return CMD_SUCCESS;
}
"Name of key-chain\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
struct keychain *keychain;
return CMD_SUCCESS;
}
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
+
keychain = keychain_lookup(argv[4]->arg);
if (keychain != NULL) {
- if (IF_DEF_PARAMS(ifp)->auth_keychain) {
- free(IF_DEF_PARAMS(ifp)->auth_keychain);
- IF_DEF_PARAMS(ifp)->auth_keychain =
+ if (ei->params.auth_keychain) {
+ free(ei->params.auth_keychain);
+ ei->params.auth_keychain =
strdup(keychain->name);
} else
- IF_DEF_PARAMS(ifp)->auth_keychain =
+ ei->params.auth_keychain =
strdup(keychain->name);
} else
vty_out(vty, "Key chain with specified name not found\n");
"Name of key-chain\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
return CMD_SUCCESS;
}
- if ((IF_DEF_PARAMS(ifp)->auth_keychain != NULL)
- && (strcmp(IF_DEF_PARAMS(ifp)->auth_keychain, argv[5]->arg) == 0)) {
- free(IF_DEF_PARAMS(ifp)->auth_keychain);
- IF_DEF_PARAMS(ifp)->auth_keychain = NULL;
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
+
+ if ((ei->params.auth_keychain != NULL)
+ && (strcmp(ei->params.auth_keychain, argv[5]->arg) == 0)) {
+ free(ei->params.auth_keychain);
+ ei->params.auth_keychain = NULL;
} else
vty_out(vty,
"Key chain with specified name not configured on interface\n");
zebra_size_t length, vrf_id_t vrf_id)
{
struct interface *ifp;
+ struct eigrp_interface *ei;
ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
- assert(ifp->info);
+ if (!ifp->info)
+ return 0;
- if (!EIGRP_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp), type)) {
- SET_IF_PARAM(IF_DEF_PARAMS(ifp), type);
- IF_DEF_PARAMS(ifp)->type = eigrp_default_iftype(ifp);
- }
+ ei = ifp->info;
+
+ ei->params.type = eigrp_default_iftype(ifp);
eigrp_if_update(ifp);
{
struct interface *ifp;
struct stream *s;
- struct route_node *rn;
s = zclient->ibuf;
/* zebra_interface_state_read () updates interface structure in iflist
ifp->name, ifp->ifindex, (unsigned long long)ifp->flags,
ifp->metric, ifp->mtu);
- for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn))
- if (rn->info)
- eigrp_if_free((struct eigrp_interface *)rn->info,
- INTERFACE_DOWN_BY_ZEBRA);
+ if (ifp->info)
+ eigrp_if_free(ifp->info,
+ INTERFACE_DOWN_BY_ZEBRA);
- ifp->ifindex = IFINDEX_INTERNAL;
return 0;
}
struct connected *c;
struct interface *ifp;
struct eigrp_interface *ei;
- struct route_node *rn;
- struct prefix p;
c = zebra_interface_address_read(command, zclient->ibuf, vrf_id);
}
ifp = c->ifp;
- p = *c->address;
- p.prefixlen = IPV4_MAX_PREFIXLEN;
-
- rn = route_node_lookup(IF_OIFS(ifp), &p);
- if (!rn) {
- connected_free(c);
+ ei = ifp->info;
+ if (!ei)
return 0;
- }
-
- assert(rn->info);
- ei = rn->info;
/* Call interface hook functions to clean up */
eigrp_if_free(ei, INTERFACE_DOWN_BY_ZEBRA);
zebra_size_t length, vrf_id_t vrf_id)
{
struct interface *ifp;
- struct eigrp_interface *ei;
- struct route_node *rn;
ifp = zebra_interface_if_lookup(zclient->ibuf);
zlog_debug("Zebra: Interface[%s] state change to up.",
ifp->name);
- for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
- if ((ei = rn->info) == NULL)
- continue;
-
- eigrp_if_up(ei);
- }
+ if (ifp->info)
+ eigrp_if_up(ifp->info);
return 0;
}
zebra_size_t length, vrf_id_t vrf_id)
{
struct interface *ifp;
- struct eigrp_interface *ei;
- struct route_node *node;
ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
zlog_debug("Zebra: Interface[%s] state change to down.",
ifp->name);
- for (node = route_top(IF_OIFS(ifp)); node; node = route_next(node)) {
- if ((ei = node->info) == NULL)
- continue;
- eigrp_if_down(ei);
- }
+ if (ifp->info)
+ eigrp_if_down(ifp->info);
return 0;
}