eigrpd: Cleanup tab/spacing of the *.c files

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-04-08 14:44:58 -04:00
parent 962251aeff
commit f9e5c9ca06
20 changed files with 3357 additions and 3501 deletions

View File

@ -70,43 +70,14 @@ config_write_debug (struct vty *vty)
int write = 0; int write = 0;
int i; int i;
const char *type_str[] = {"update", "request", "query", "reply", "hello", "", "probe", "ack", "", const char *type_str[] = {"update", "request", "query", "reply",
"hello", "", "probe", "ack", "",
"SIA query", "SIA reply", "stub", "all"}; "SIA query", "SIA reply", "stub", "all"};
const char *detail_str[] = {"", " send", " recv", "", " detail", const char *detail_str[] = {"", " send", " recv", "", " detail",
" send detail", " recv detail", " detail"}; " send detail", " recv detail", " detail"};
/* debug eigrp event. */ /* debug eigrp event. */
// if (IS_CONF_DEBUG_EIGRP (event, EVENT) == EIGRP_DEBUG_EVENT)
// {
// vty_out (vty, "debug eigrp event%s", VTY_NEWLINE);
// write = 1;
// }
/* debug eigrp packet all detail. */
// r = EIGRP_DEBUG_SEND_RECV|EIGRP_DEBUG_DETAIL;
// for (i = 0; i < 11; i++)
// r &= conf_debug_eigrp_packet[i] & (EIGRP_DEBUG_SEND_RECV|EIGRP_DEBUG_DETAIL);
// if (r == (EIGRP_DEBUG_SEND_RECV|EIGRP_DEBUG_DETAIL))
// {
// vty_out (vty, "debug eigrp packet all detail%s", VTY_NEWLINE);
//// return 1;
// }
//
// /* debug eigrp packet all. */
// r = EIGRP_DEBUG_SEND_RECV;
// for (i = 0; i < 11; i++)
// r &= conf_debug_eigrp_packet[i] & EIGRP_DEBUG_SEND_RECV;
// if (r == EIGRP_DEBUG_SEND_RECV)
// {
// vty_out (vty, "debug eigrp packet all%s", VTY_NEWLINE);
// for (i = 0; i < 11; i++)
// if (conf_debug_eigrp_packet[i] & EIGRP_DEBUG_DETAIL)
// vty_out (vty, "debug eigrp packet %s detail%s",
// type_str[i],
// VTY_NEWLINE);
//// return 1;
// }
/* debug eigrp packet */ /* debug eigrp packet */
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
@ -120,125 +91,9 @@ config_write_debug (struct vty *vty)
write = 1; write = 1;
} }
// int write = 0;
// int i, r;
//
// const char *type_str[] = {"hello", "dd", "ls-request", "ls-update", "ls-ack"};
// const char *detail_str[] = {"", " send", " recv", "", " detail",
// " send detail", " recv detail", " detail"};
//
// /* debug ospf ism (status|events|timers). */
// if (IS_CONF_DEBUG_OSPF (ism, ISM) == OSPF_DEBUG_ISM)
// vty_out (vty, "debug ospf ism%s", VTY_NEWLINE);
// else
// {
// if (IS_CONF_DEBUG_OSPF (ism, ISM_STATUS))
// vty_out (vty, "debug ospf ism status%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (ism, ISM_EVENTS))
// vty_out (vty, "debug ospf ism event%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (ism, ISM_TIMERS))
// vty_out (vty, "debug ospf ism timer%s", VTY_NEWLINE);
// }
//
// /* debug ospf nsm (status|events|timers). */
// if (IS_CONF_DEBUG_OSPF (nsm, NSM) == OSPF_DEBUG_NSM)
// vty_out (vty, "debug ospf nsm%s", VTY_NEWLINE);
// else
// {
// if (IS_CONF_DEBUG_OSPF (nsm, NSM_STATUS))
// vty_out (vty, "debug ospf nsm status%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (nsm, NSM_EVENTS))
// vty_out (vty, "debug ospf nsm event%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (nsm, NSM_TIMERS))
// vty_out (vty, "debug ospf nsm timer%s", VTY_NEWLINE);
// }
//
// /* debug ospf lsa (generate|flooding|install|refresh). */
// if (IS_CONF_DEBUG_OSPF (lsa, LSA) == OSPF_DEBUG_LSA)
// vty_out (vty, "debug ospf lsa%s", VTY_NEWLINE);
// else
// {
// if (IS_CONF_DEBUG_OSPF (lsa, LSA_GENERATE))
// vty_out (vty, "debug ospf lsa generate%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (lsa, LSA_FLOODING))
// vty_out (vty, "debug ospf lsa flooding%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (lsa, LSA_INSTALL))
// vty_out (vty, "debug ospf lsa install%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (lsa, LSA_REFRESH))
// vty_out (vty, "debug ospf lsa refresh%s", VTY_NEWLINE);
//
// write = 1;
// }
//
// /* debug ospf zebra (interface|redistribute). */
// if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA) == OSPF_DEBUG_ZEBRA)
// vty_out (vty, "debug ospf zebra%s", VTY_NEWLINE);
// else
// {
// if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
// vty_out (vty, "debug ospf zebra interface%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
// vty_out (vty, "debug ospf zebra redistribute%s", VTY_NEWLINE);
//
// write = 1;
// }
//
// /* debug ospf event. */
// if (IS_CONF_DEBUG_OSPF (event, EVENT) == OSPF_DEBUG_EVENT)
// {
// vty_out (vty, "debug ospf event%s", VTY_NEWLINE);
// write = 1;
// }
//
// /* debug ospf nssa. */
// if (IS_CONF_DEBUG_OSPF (nssa, NSSA) == OSPF_DEBUG_NSSA)
// {
// vty_out (vty, "debug ospf nssa%s", VTY_NEWLINE);
// write = 1;
// }
//
// /* debug ospf packet all detail. */
// r = OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL;
// for (i = 0; i < 5; i++)
// r &= conf_debug_ospf_packet[i] & (OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL);
// if (r == (OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL))
// {
// vty_out (vty, "debug ospf packet all detail%s", VTY_NEWLINE);
// return 1;
// }
//
// /* debug ospf packet all. */
// r = OSPF_DEBUG_SEND_RECV;
// for (i = 0; i < 5; i++)
// r &= conf_debug_ospf_packet[i] & OSPF_DEBUG_SEND_RECV;
// if (r == OSPF_DEBUG_SEND_RECV)
// {
// vty_out (vty, "debug ospf packet all%s", VTY_NEWLINE);
// for (i = 0; i < 5; i++)
// if (conf_debug_ospf_packet[i] & OSPF_DEBUG_DETAIL)
// vty_out (vty, "debug ospf packet %s detail%s",
// type_str[i],
// VTY_NEWLINE);
// return 1;
// }
//
// /* debug ospf packet (hello|dd|ls-request|ls-update|ls-ack)
// (send|recv) (detail). */
// for (i = 0; i < 5; i++)
// {
// if (conf_debug_ospf_packet[i] == 0)
// continue;
//
// vty_out (vty, "debug ospf packet %s%s%s",
// type_str[i], detail_str[conf_debug_ospf_packet[i]],
// VTY_NEWLINE);
// write = 1;
// }
return write; return write;
} }
static int static int
eigrp_neighbor_packet_queue_sum (struct eigrp_interface *ei) eigrp_neighbor_packet_queue_sum (struct eigrp_interface *ei)
{ {
@ -288,7 +143,7 @@ eigrp_header_dump (struct eigrp_header *eigrph)
zlog_debug ("eigrp_flags 0x%x", ntohl(eigrph->flags)); zlog_debug ("eigrp_flags 0x%x", ntohl(eigrph->flags));
zlog_debug ("eigrp_sequence %u", ntohl(eigrph->sequence)); zlog_debug ("eigrp_sequence %u", ntohl(eigrph->sequence));
zlog_debug ("eigrp_ack %u", ntohl(eigrph->ack)); zlog_debug ("eigrp_ack %u", ntohl(eigrph->ack));
zlog_debug ("eigrp_vrid %u" , ntohs(eigrph->vrid)); zlog_debug ("eigrp_vrid %u", ntohs(eigrph->vrid));
zlog_debug ("eigrp_AS %u", ntohs(eigrph->ASNumber)); zlog_debug ("eigrp_AS %u", ntohs(eigrph->ASNumber));
} }
@ -371,25 +226,34 @@ show_ip_eigrp_interface_sub (struct vty *vty, struct eigrp *eigrp,
struct eigrp_interface *ei) struct eigrp_interface *ei)
{ {
vty_out (vty, "%-11s ", eigrp_if_name_string (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)->bandwidth);
vty_out (vty, "%-11u",IF_DEF_PARAMS (ei->ifp)->delay); vty_out (vty, "%-11u", IF_DEF_PARAMS (ei->ifp)->delay);
vty_out (vty, "%-7u", ei->nbrs->count); vty_out (vty, "%-7u", ei->nbrs->count);
vty_out (vty, "%u %c %-10u",0,'/',eigrp_neighbor_packet_queue_sum (ei)); 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, "%-7u %-14u %-12u %-8u", 0, 0, 0, 0);
vty_out (vty, "%-8u %-8u %s",IF_DEF_PARAMS (ei->ifp)->v_hello,IF_DEF_PARAMS (ei->ifp)->v_wait,VTY_NEWLINE); vty_out (vty, "%-8u %-8u %s",
IF_DEF_PARAMS (ei->ifp)->v_hello,
IF_DEF_PARAMS (ei->ifp)->v_wait,VTY_NEWLINE);
} }
void void
show_ip_eigrp_interface_detail (struct vty *vty, struct eigrp *eigrp, show_ip_eigrp_interface_detail (struct vty *vty, struct eigrp *eigrp,
struct eigrp_interface *ei) struct eigrp_interface *ei)
{ {
vty_out (vty, "%-2s %s %d %-3s %s","","Hello interval is ",0," sec",VTY_NEWLINE); vty_out (vty, "%-2s %s %d %-3s %s","","Hello interval is ", 0, " sec", VTY_NEWLINE);
vty_out (vty, "%-2s %s %s %s","","Next xmit serial","<none>",VTY_NEWLINE); vty_out (vty, "%-2s %s %s %s","", "Next xmit serial","<none>", VTY_NEWLINE);
vty_out (vty, "%-2s %s %d %s %d %s %d %s %d %s","","Un/reliable mcasts: ",0,"/",0,"Un/reliable ucasts: ",0,"/",0,VTY_NEWLINE); vty_out (vty, "%-2s %s %d %s %d %s %d %s %d %s",
vty_out (vty, "%-2s %s %d %s %d %s %d %s","","Mcast exceptions: ",0," CR packets: ",0," ACKs supressed: ",0,VTY_NEWLINE); "", "Un/reliable mcasts: ", 0, "/", 0, "Un/reliable ucasts: ",
vty_out (vty, "%-2s %s %d %s %d %s","","Retransmissions sent: ",0,"Out-of-sequence rcvd: ",0,VTY_NEWLINE); 0, "/", 0, VTY_NEWLINE);
vty_out (vty, "%-2s %s %s %s %s","","Authentication mode is ","not","set",VTY_NEWLINE); vty_out (vty, "%-2s %s %d %s %d %s %d %s",
vty_out (vty, "%-2s %s %s","","Use multicast",VTY_NEWLINE); "", "Mcast exceptions: ", 0, " CR packets: ",
0, " ACKs supressed: ", 0, VTY_NEWLINE);
vty_out (vty, "%-2s %s %d %s %d %s",
"", "Retransmissions sent: ", 0, "Out-of-sequence rcvd: ",
0 ,VTY_NEWLINE);
vty_out (vty, "%-2s %s %s %s %s",
"", "Authentication mode is ", "not","set", VTY_NEWLINE);
vty_out (vty, "%-2s %s %s", "", "Use multicast", VTY_NEWLINE);
} }
void void
@ -408,11 +272,12 @@ show_ip_eigrp_neighbor_sub (struct vty *vty, struct eigrp_neighbor *nbr,
int detail) int detail)
{ {
vty_out (vty, "%-3u %-17s %-21s",0,eigrp_neigh_ip_string (nbr),eigrp_if_name_string (nbr->ei)); vty_out (vty, "%-3u %-17s %-21s", 0,
vty_out (vty,"%-7lu",thread_timer_remain_second (nbr->t_holddown)); eigrp_neigh_ip_string (nbr), eigrp_if_name_string (nbr->ei));
vty_out (vty,"%-8u %-6u %-5u",0,0,EIGRP_PACKET_RETRANS_TIME); vty_out (vty,"%-7lu", thread_timer_remain_second (nbr->t_holddown));
vty_out (vty,"%-7lu",nbr->retrans_queue->count); vty_out (vty,"%-8u %-6u %-5u", 0, 0, EIGRP_PACKET_RETRANS_TIME);
vty_out (vty,"%u%s",nbr->recv_sequence_number,VTY_NEWLINE); vty_out (vty,"%-7lu", nbr->retrans_queue->count);
vty_out (vty,"%u%s", nbr->recv_sequence_number, VTY_NEWLINE);
if (detail) if (detail)
@ -449,17 +314,20 @@ show_ip_eigrp_prefix_entry (struct vty *vty, struct eigrp_prefix_entry *tn)
vty_out (vty, "%s/%u, ",inet_ntoa (tn->destination_ipv4->prefix),tn->destination_ipv4->prefixlen); vty_out (vty, "%s/%u, ",inet_ntoa (tn->destination_ipv4->prefix),tn->destination_ipv4->prefixlen);
vty_out (vty, "%u successors, ",eigrp_topology_get_successor(tn)->count); vty_out (vty, "%u successors, ",eigrp_topology_get_successor(tn)->count);
vty_out (vty, "FD is %u, serno: %lu %s",tn->fdistance, tn->serno, VTY_NEWLINE); vty_out (vty, "FD is %u, serno: %lu %s",tn->fdistance, tn->serno, VTY_NEWLINE);
} }
void void
show_ip_eigrp_neighbor_entry (struct vty *vty, struct eigrp *eigrp, struct eigrp_neighbor_entry *te) show_ip_eigrp_neighbor_entry (struct vty *vty, struct eigrp *eigrp, struct eigrp_neighbor_entry *te)
{ {
if (te->adv_router == eigrp->neighbor_self) if (te->adv_router == eigrp->neighbor_self)
vty_out (vty, "%-7s%s, %s%s"," ","via Connected",eigrp_if_name_string (te->ei), VTY_NEWLINE); vty_out (vty, "%-7s%s, %s%s", " ", "via Connected",
eigrp_if_name_string (te->ei), VTY_NEWLINE);
else else
{ {
vty_out (vty, "%-7s%s%s (%u/%u), %s%s"," ","via ",inet_ntoa (te->adv_router->src),te->distance, te->reported_distance, eigrp_if_name_string (te->ei), VTY_NEWLINE); vty_out (vty, "%-7s%s%s (%u/%u), %s%s",
" ", "via ", inet_ntoa (te->adv_router->src),
te->distance, te->reported_distance,
eigrp_if_name_string (te->ei), VTY_NEWLINE);
} }
} }

View File

@ -305,8 +305,7 @@ eigrp_distribute_update (struct distribute *dist)
thread_cancel(ei->t_distribute); thread_cancel(ei->t_distribute);
} }
/* schedule Graceful restart for interface in 10sec */ /* schedule Graceful restart for interface in 10sec */
e->t_distribute = thread_add_timer(master, eigrp_distribute_timer_interface, ei,(10)); e->t_distribute = thread_add_timer(master, eigrp_distribute_timer_interface, ei, 10);
} }
/* /*

View File

@ -93,22 +93,14 @@
/* /*
* Prototypes * Prototypes
*/ */
int int eigrp_fsm_event_keep_state(struct eigrp_fsm_action_message *);
eigrp_fsm_event_keep_state(struct eigrp_fsm_action_message *); int eigrp_fsm_event_nq_fcn(struct eigrp_fsm_action_message *);
int int eigrp_fsm_event_q_fcn(struct eigrp_fsm_action_message *);
eigrp_fsm_event_nq_fcn(struct eigrp_fsm_action_message *); int eigrp_fsm_event_lr(struct eigrp_fsm_action_message *);
int int eigrp_fsm_event_dinc(struct eigrp_fsm_action_message *);
eigrp_fsm_event_q_fcn(struct eigrp_fsm_action_message *); int eigrp_fsm_event_lr_fcs(struct eigrp_fsm_action_message *);
int int eigrp_fsm_event_lr_fcn(struct eigrp_fsm_action_message *);
eigrp_fsm_event_lr(struct eigrp_fsm_action_message *); int eigrp_fsm_event_qact(struct eigrp_fsm_action_message *);
int
eigrp_fsm_event_dinc(struct eigrp_fsm_action_message *);
int
eigrp_fsm_event_lr_fcs(struct eigrp_fsm_action_message *);
int
eigrp_fsm_event_lr_fcn(struct eigrp_fsm_action_message *);
int
eigrp_fsm_event_qact(struct eigrp_fsm_action_message *);
//--------------------------------------------------------------------- //---------------------------------------------------------------------
@ -123,7 +115,7 @@ struct {
int int
(*func)(struct eigrp_fsm_action_message *); (*func)(struct eigrp_fsm_action_message *);
} NSM[EIGRP_FSM_STATE_MAX][EIGRP_FSM_EVENT_MAX] = { { } NSM[EIGRP_FSM_STATE_MAX][EIGRP_FSM_EVENT_MAX] = { {
//PASSIVE STATE //PASSIVE STATE
{ eigrp_fsm_event_nq_fcn }, /* Event 0 */ { eigrp_fsm_event_nq_fcn }, /* Event 0 */
{ eigrp_fsm_event_keep_state }, /* Event 1 */ { eigrp_fsm_event_keep_state }, /* Event 1 */
{ eigrp_fsm_event_q_fcn }, /* Event 2 */ { eigrp_fsm_event_q_fcn }, /* Event 2 */
@ -132,8 +124,8 @@ struct {
{ eigrp_fsm_event_keep_state }, /* Event 5 */ { eigrp_fsm_event_keep_state }, /* Event 5 */
{ eigrp_fsm_event_keep_state }, /* Event 6 */ { eigrp_fsm_event_keep_state }, /* Event 6 */
{ eigrp_fsm_event_keep_state }, /* Event 7 */ { eigrp_fsm_event_keep_state }, /* Event 7 */
}, { }, {
//Active 0 state //Active 0 state
{ eigrp_fsm_event_keep_state }, /* Event 0 */ { eigrp_fsm_event_keep_state }, /* Event 0 */
{ eigrp_fsm_event_keep_state }, /* Event 1 */ { eigrp_fsm_event_keep_state }, /* Event 1 */
{ eigrp_fsm_event_keep_state }, /* Event 2 */ { eigrp_fsm_event_keep_state }, /* Event 2 */
@ -142,9 +134,8 @@ struct {
{ eigrp_fsm_event_qact }, /* Event 5 */ { eigrp_fsm_event_qact }, /* Event 5 */
{ eigrp_fsm_event_lr_fcn }, /* Event 6 */ { eigrp_fsm_event_lr_fcn }, /* Event 6 */
{ eigrp_fsm_event_keep_state }, /* Event 7 */ { eigrp_fsm_event_keep_state }, /* Event 7 */
}, {
}, { //Active 1 state
//Active 1 state
{ eigrp_fsm_event_keep_state }, /* Event 0 */ { eigrp_fsm_event_keep_state }, /* Event 0 */
{ eigrp_fsm_event_lr }, /* Event 1 */ { eigrp_fsm_event_lr }, /* Event 1 */
{ eigrp_fsm_event_keep_state }, /* Event 2 */ { eigrp_fsm_event_keep_state }, /* Event 2 */
@ -153,8 +144,8 @@ struct {
{ eigrp_fsm_event_qact }, /* Event 5 */ { eigrp_fsm_event_qact }, /* Event 5 */
{ eigrp_fsm_event_keep_state }, /* Event 6 */ { eigrp_fsm_event_keep_state }, /* Event 6 */
{ eigrp_fsm_event_keep_state }, /* Event 7 */ { eigrp_fsm_event_keep_state }, /* Event 7 */
}, { }, {
//Active 2 state //Active 2 state
{ eigrp_fsm_event_keep_state }, /* Event 0 */ { eigrp_fsm_event_keep_state }, /* Event 0 */
{ eigrp_fsm_event_keep_state }, /* Event 1 */ { eigrp_fsm_event_keep_state }, /* Event 1 */
{ eigrp_fsm_event_keep_state }, /* Event 2 */ { eigrp_fsm_event_keep_state }, /* Event 2 */
@ -163,8 +154,8 @@ struct {
{ eigrp_fsm_event_keep_state }, /* Event 5 */ { eigrp_fsm_event_keep_state }, /* Event 5 */
{ eigrp_fsm_event_lr_fcn }, /* Event 6 */ { eigrp_fsm_event_lr_fcn }, /* Event 6 */
{ eigrp_fsm_event_keep_state }, /* Event 7 */ { eigrp_fsm_event_keep_state }, /* Event 7 */
}, { }, {
//Active 3 state //Active 3 state
{ eigrp_fsm_event_keep_state }, /* Event 0 */ { eigrp_fsm_event_keep_state }, /* Event 0 */
{ eigrp_fsm_event_lr }, /* Event 1 */ { eigrp_fsm_event_lr }, /* Event 1 */
{ eigrp_fsm_event_keep_state }, /* Event 2 */ { eigrp_fsm_event_keep_state }, /* Event 2 */
@ -183,14 +174,16 @@ struct {
* Return number of occurred event (arrow in diagram). * Return number of occurred event (arrow in diagram).
* *
*/ */
int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg) { int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg)
{
// Loading base information from message // Loading base information from message
//struct eigrp *eigrp = msg->eigrp; //struct eigrp *eigrp = msg->eigrp;
struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp_prefix_entry *prefix = msg->prefix;
struct eigrp_neighbor_entry *entry = msg->entry; struct eigrp_neighbor_entry *entry = msg->entry;
u_char actual_state = prefix->state; u_char actual_state = prefix->state;
if (entry == NULL) { if (entry == NULL)
{
entry = eigrp_neighbor_entry_new(); entry = eigrp_neighbor_entry_new();
entry->adv_router = msg->adv_router; entry->adv_router = msg->adv_router;
entry->ei = msg->adv_router->ei; entry->ei = msg->adv_router->ei;
@ -199,49 +192,63 @@ int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg) {
} }
// Dividing by actual state of prefix's FSM // Dividing by actual state of prefix's FSM
switch (actual_state) { switch (actual_state)
case EIGRP_FSM_STATE_PASSIVE: { {
case EIGRP_FSM_STATE_PASSIVE:
{
//Calculate resultant metrics and insert to correct position in entries list //Calculate resultant metrics and insert to correct position in entries list
eigrp_topology_update_distance(msg); eigrp_topology_update_distance(msg);
struct eigrp_neighbor_entry * head = struct eigrp_neighbor_entry * head =
(struct eigrp_neighbor_entry *) entry->prefix->entries->head->data; (struct eigrp_neighbor_entry *) entry->prefix->entries->head->data;
//zlog_info ("flag: %d rdist: %u dist: %u pfdist: %u pdist: %u", head->flags, head->reported_distance, head->distance, prefix->fdistance, prefix->distance); //zlog_info ("flag: %d rdist: %u dist: %u pfdist: %u pdist: %u", head->flags, head->reported_distance, head->distance, prefix->fdistance, prefix->distance);
if (head->reported_distance < prefix->fdistance) { if (head->reported_distance < prefix->fdistance)
{
return EIGRP_FSM_KEEP_STATE; return EIGRP_FSM_KEEP_STATE;
} }
/* /*
* if best entry doesn't satisfy feasibility condition it means move to active state * if best entry doesn't satisfy feasibility condition it means move to active state
* dependently if it was query from successor * dependently if it was query from successor
*/ */
else { else
if (msg->packet_type == EIGRP_OPC_QUERY) { {
if (msg->packet_type == EIGRP_OPC_QUERY)
{
return EIGRP_FSM_EVENT_Q_FCN; return EIGRP_FSM_EVENT_Q_FCN;
} else { }
else
{
return EIGRP_FSM_EVENT_NQ_FCN; return EIGRP_FSM_EVENT_NQ_FCN;
} }
} }
break; break;
} }
case EIGRP_FSM_STATE_ACTIVE_0: { case EIGRP_FSM_STATE_ACTIVE_0:
{
eigrp_topology_update_distance(msg); eigrp_topology_update_distance(msg);
if (msg->packet_type == EIGRP_OPC_REPLY) { if (msg->packet_type == EIGRP_OPC_REPLY) {
listnode_delete(prefix->rij, entry->adv_router); listnode_delete(prefix->rij, entry->adv_router);
if (prefix->rij->count) { if (prefix->rij->count)
{
return EIGRP_FSM_KEEP_STATE; return EIGRP_FSM_KEEP_STATE;
} else { }
else
{
zlog_info("All reply received\n"); zlog_info("All reply received\n");
if (((struct eigrp_neighbor_entry *) prefix->entries->head->data)->reported_distance if (((struct eigrp_neighbor_entry *) prefix->entries->head->data)->reported_distance
< prefix->fdistance) { < prefix->fdistance)
{
return EIGRP_FSM_EVENT_LR_FCS; return EIGRP_FSM_EVENT_LR_FCS;
} }
return EIGRP_FSM_EVENT_LR_FCN; return EIGRP_FSM_EVENT_LR_FCN;
} }
} else if (msg->packet_type == EIGRP_OPC_QUERY }
&& (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) { else if (msg->packet_type == EIGRP_OPC_QUERY
&& (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG))
{
return EIGRP_FSM_EVENT_QACT; return EIGRP_FSM_EVENT_QACT;
} }
@ -249,44 +256,60 @@ int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg) {
break; break;
} }
case EIGRP_FSM_STATE_ACTIVE_1: { case EIGRP_FSM_STATE_ACTIVE_1:
{
int change = eigrp_topology_update_distance(msg); int change = eigrp_topology_update_distance(msg);
if (msg->packet_type == EIGRP_OPC_QUERY if (msg->packet_type == EIGRP_OPC_QUERY
&& (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) { && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG))
{
return EIGRP_FSM_EVENT_QACT; return EIGRP_FSM_EVENT_QACT;
} else if (msg->packet_type == EIGRP_OPC_REPLY) { }
else if (msg->packet_type == EIGRP_OPC_REPLY)
{
listnode_delete(prefix->rij, entry->adv_router); listnode_delete(prefix->rij, entry->adv_router);
if (change == 1 if (change == 1
&& (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) { && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG))
{
return EIGRP_FSM_EVENT_DINC; return EIGRP_FSM_EVENT_DINC;
} else if (prefix->rij->count) { }
else if (prefix->rij->count)
{
return EIGRP_FSM_KEEP_STATE; return EIGRP_FSM_KEEP_STATE;
} else { }
else
{
zlog_info("All reply received\n"); zlog_info("All reply received\n");
return EIGRP_FSM_EVENT_LR; return EIGRP_FSM_EVENT_LR;
} }
} else if (msg->packet_type == EIGRP_OPC_UPDATE && change == 1 }
&& (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) { else if (msg->packet_type == EIGRP_OPC_UPDATE && change == 1
&& (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG))
{
return EIGRP_FSM_EVENT_DINC; return EIGRP_FSM_EVENT_DINC;
} }
return EIGRP_FSM_KEEP_STATE; return EIGRP_FSM_KEEP_STATE;
break; break;
} }
case EIGRP_FSM_STATE_ACTIVE_2: { case EIGRP_FSM_STATE_ACTIVE_2:
{
eigrp_topology_update_distance(msg); eigrp_topology_update_distance(msg);
if (msg->packet_type == EIGRP_OPC_REPLY) { if (msg->packet_type == EIGRP_OPC_REPLY)
{
listnode_delete(prefix->rij, entry->adv_router); listnode_delete(prefix->rij, entry->adv_router);
if (prefix->rij->count) { if (prefix->rij->count)
{
return EIGRP_FSM_KEEP_STATE; return EIGRP_FSM_KEEP_STATE;
} else { }
else
{
zlog_info("All reply received\n"); zlog_info("All reply received\n");
if (((struct eigrp_neighbor_entry *) prefix->entries->head->data)->reported_distance if (((struct eigrp_neighbor_entry *) prefix->entries->head->data)->reported_distance
< prefix->fdistance) { < prefix->fdistance)
{
return EIGRP_FSM_EVENT_LR_FCS; return EIGRP_FSM_EVENT_LR_FCS;
} }
@ -297,24 +320,32 @@ int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg) {
break; break;
} }
case EIGRP_FSM_STATE_ACTIVE_3: { case EIGRP_FSM_STATE_ACTIVE_3:
{
int change = eigrp_topology_update_distance(msg); int change = eigrp_topology_update_distance(msg);
if (msg->packet_type == EIGRP_OPC_REPLY) { if (msg->packet_type == EIGRP_OPC_REPLY)
{
listnode_delete(prefix->rij, entry->adv_router); listnode_delete(prefix->rij, entry->adv_router);
if (change == 1 if (change == 1
&& (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) { && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG))
{
return EIGRP_FSM_EVENT_DINC; return EIGRP_FSM_EVENT_DINC;
} else if (prefix->rij->count) { }
else if (prefix->rij->count)
{
return EIGRP_FSM_KEEP_STATE; return EIGRP_FSM_KEEP_STATE;
} else { }
else
{
zlog_info("All reply received\n"); zlog_info("All reply received\n");
return EIGRP_FSM_EVENT_LR; return EIGRP_FSM_EVENT_LR;
} }
} else if (msg->packet_type == EIGRP_OPC_UPDATE && change == 1 }
&& (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) { else if (msg->packet_type == EIGRP_OPC_UPDATE && change == 1
&& (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG))
{
return EIGRP_FSM_EVENT_DINC; return EIGRP_FSM_EVENT_DINC;
} }
return EIGRP_FSM_KEEP_STATE; return EIGRP_FSM_KEEP_STATE;
@ -330,19 +361,21 @@ int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg) {
* Function made to execute in separate thread. * Function made to execute in separate thread.
* Load argument from thread and execute proper NSM function * Load argument from thread and execute proper NSM function
*/ */
int eigrp_fsm_event(struct eigrp_fsm_action_message *msg, int event) { int eigrp_fsm_event(struct eigrp_fsm_action_message *msg, int event)
{
zlog_info("EIGRP AS: %d State: %d Event: %d Network: %s\n", msg->eigrp->AS, zlog_info("EIGRP AS: %d State: %d Event: %d Network: %s\n", msg->eigrp->AS,
msg->prefix->state, event, eigrp_topology_ip_string(msg->prefix)); msg->prefix->state, event, eigrp_topology_ip_string(msg->prefix));
(*(NSM[msg->prefix->state][event].func))(msg); (*(NSM[msg->prefix->state][event].func))(msg);
return 1; return 1;
} }
/* /*
* Function of event 0. * Function of event 0.
* *
*/ */
int eigrp_fsm_event_nq_fcn(struct eigrp_fsm_action_message *msg) { int eigrp_fsm_event_nq_fcn(struct eigrp_fsm_action_message *msg)
{
struct eigrp *eigrp = msg->eigrp; struct eigrp *eigrp = msg->eigrp;
struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp_prefix_entry *prefix = msg->prefix;
struct list *successors = eigrp_topology_get_successor(prefix); struct list *successors = eigrp_topology_get_successor(prefix);
@ -355,10 +388,13 @@ int eigrp_fsm_event_nq_fcn(struct eigrp_fsm_action_message *msg) {
prefix->reported_metric = prefix->reported_metric =
((struct eigrp_neighbor_entry *) successors->head->data)->total_metric; ((struct eigrp_neighbor_entry *) successors->head->data)->total_metric;
if (eigrp_nbr_count_get()) { if (eigrp_nbr_count_get())
{
prefix->req_action |= EIGRP_FSM_NEED_QUERY; prefix->req_action |= EIGRP_FSM_NEED_QUERY;
listnode_add(eigrp->topology_changes_internalIPV4,prefix); listnode_add(eigrp->topology_changes_internalIPV4,prefix);
} else { }
else
{
eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left
} }
@ -367,7 +403,8 @@ int eigrp_fsm_event_nq_fcn(struct eigrp_fsm_action_message *msg) {
return 1; return 1;
} }
int eigrp_fsm_event_q_fcn(struct eigrp_fsm_action_message *msg) { int eigrp_fsm_event_q_fcn(struct eigrp_fsm_action_message *msg)
{
struct eigrp *eigrp = msg->eigrp; struct eigrp *eigrp = msg->eigrp;
struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp_prefix_entry *prefix = msg->prefix;
struct list *successors = eigrp_topology_get_successor(prefix); struct list *successors = eigrp_topology_get_successor(prefix);
@ -379,10 +416,13 @@ int eigrp_fsm_event_q_fcn(struct eigrp_fsm_action_message *msg) {
((struct eigrp_neighbor_entry *) successors->head->data)->distance; ((struct eigrp_neighbor_entry *) successors->head->data)->distance;
prefix->reported_metric = prefix->reported_metric =
((struct eigrp_neighbor_entry *) successors->head->data)->total_metric; ((struct eigrp_neighbor_entry *) successors->head->data)->total_metric;
if (eigrp_nbr_count_get()) { if (eigrp_nbr_count_get())
{
prefix->req_action |= EIGRP_FSM_NEED_QUERY; prefix->req_action |= EIGRP_FSM_NEED_QUERY;
listnode_add(eigrp->topology_changes_internalIPV4,prefix); listnode_add(eigrp->topology_changes_internalIPV4,prefix);
} else { }
else
{
eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left
} }
@ -391,13 +431,15 @@ int eigrp_fsm_event_q_fcn(struct eigrp_fsm_action_message *msg) {
return 1; return 1;
} }
int eigrp_fsm_event_keep_state(struct eigrp_fsm_action_message *msg) { int eigrp_fsm_event_keep_state(struct eigrp_fsm_action_message *msg)
{
struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp_prefix_entry *prefix = msg->prefix;
if (prefix->state == EIGRP_FSM_STATE_PASSIVE) { if (prefix->state == EIGRP_FSM_STATE_PASSIVE)
{
if (!eigrp_metrics_is_same(&prefix->reported_metric, if (!eigrp_metrics_is_same(&prefix->reported_metric,
&((struct eigrp_neighbor_entry *) prefix->entries->head->data)->total_metric)) { &((struct eigrp_neighbor_entry *) prefix->entries->head->data)->total_metric))
{
prefix->rdistance = prefix->rdistance =
prefix->fdistance = prefix->fdistance =
prefix->distance = prefix->distance =
@ -419,7 +461,8 @@ int eigrp_fsm_event_keep_state(struct eigrp_fsm_action_message *msg) {
return 1; return 1;
} }
int eigrp_fsm_event_lr(struct eigrp_fsm_action_message *msg) { int eigrp_fsm_event_lr(struct eigrp_fsm_action_message *msg)
{
struct eigrp *eigrp = msg->eigrp; struct eigrp *eigrp = msg->eigrp;
struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp_prefix_entry *prefix = msg->prefix;
prefix->fdistance = prefix->fdistance =
@ -429,7 +472,8 @@ int eigrp_fsm_event_lr(struct eigrp_fsm_action_message *msg) {
prefix->reported_metric = prefix->reported_metric =
((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->total_metric; ((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->total_metric;
if (prefix->state == EIGRP_FSM_STATE_ACTIVE_3) { if (prefix->state == EIGRP_FSM_STATE_ACTIVE_3)
{
struct list *successors = eigrp_topology_get_successor(prefix); struct list *successors = eigrp_topology_get_successor(prefix);
assert(successors); // It's like Napolean and Waterloo assert(successors); // It's like Napolean and Waterloo
@ -448,7 +492,8 @@ int eigrp_fsm_event_lr(struct eigrp_fsm_action_message *msg) {
return 1; return 1;
} }
int eigrp_fsm_event_dinc(struct eigrp_fsm_action_message *msg) { int eigrp_fsm_event_dinc(struct eigrp_fsm_action_message *msg)
{
struct list *successors = eigrp_topology_get_successor(msg->prefix); struct list *successors = eigrp_topology_get_successor(msg->prefix);
assert(successors); // Trump and his big hands assert(successors); // Trump and his big hands
@ -456,16 +501,18 @@ int eigrp_fsm_event_dinc(struct eigrp_fsm_action_message *msg) {
msg->prefix->state = msg->prefix->state =
msg->prefix->state == EIGRP_FSM_STATE_ACTIVE_1 ? msg->prefix->state == EIGRP_FSM_STATE_ACTIVE_1 ?
EIGRP_FSM_STATE_ACTIVE_0 : EIGRP_FSM_STATE_ACTIVE_2; EIGRP_FSM_STATE_ACTIVE_0 : EIGRP_FSM_STATE_ACTIVE_2;
msg->prefix->distance = ((struct eigrp_neighbor_entry *)successors->head->data)->distance; msg->prefix->distance =
if (!msg->prefix->rij->count) { ((struct eigrp_neighbor_entry *)successors->head->data)->distance;
if (!msg->prefix->rij->count)
(*(NSM[msg->prefix->state][eigrp_get_fsm_event(msg)].func))(msg); (*(NSM[msg->prefix->state][eigrp_get_fsm_event(msg)].func))(msg);
}
list_delete(successors); list_delete(successors);
return 1; return 1;
} }
int eigrp_fsm_event_lr_fcs(struct eigrp_fsm_action_message *msg) { int eigrp_fsm_event_lr_fcs(struct eigrp_fsm_action_message *msg)
{
struct eigrp *eigrp = msg->eigrp; struct eigrp *eigrp = msg->eigrp;
struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp_prefix_entry *prefix = msg->prefix;
prefix->state = EIGRP_FSM_STATE_PASSIVE; prefix->state = EIGRP_FSM_STATE_PASSIVE;
@ -477,7 +524,8 @@ int eigrp_fsm_event_lr_fcs(struct eigrp_fsm_action_message *msg) {
prefix->fdistance = prefix->fdistance =
prefix->fdistance > prefix->distance ? prefix->fdistance > prefix->distance ?
prefix->distance : prefix->fdistance; prefix->distance : prefix->fdistance;
if (prefix->state == EIGRP_FSM_STATE_ACTIVE_2) { if (prefix->state == EIGRP_FSM_STATE_ACTIVE_2)
{
struct list *successors = eigrp_topology_get_successor(prefix); struct list *successors = eigrp_topology_get_successor(prefix);
assert(successors); // Having a spoon and all you need is a knife assert(successors); // Having a spoon and all you need is a knife
@ -495,7 +543,8 @@ int eigrp_fsm_event_lr_fcs(struct eigrp_fsm_action_message *msg) {
return 1; return 1;
} }
int eigrp_fsm_event_lr_fcn(struct eigrp_fsm_action_message *msg) { int eigrp_fsm_event_lr_fcn(struct eigrp_fsm_action_message *msg)
{
struct eigrp *eigrp = msg->eigrp; struct eigrp *eigrp = msg->eigrp;
struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp_prefix_entry *prefix = msg->prefix;
struct list *successors = eigrp_topology_get_successor(prefix); struct list *successors = eigrp_topology_get_successor(prefix);
@ -509,10 +558,14 @@ int eigrp_fsm_event_lr_fcn(struct eigrp_fsm_action_message *msg) {
((struct eigrp_neighbor_entry *) (successors->head->data)); ((struct eigrp_neighbor_entry *) (successors->head->data));
prefix->rdistance = prefix->distance = best_successor->distance; prefix->rdistance = prefix->distance = best_successor->distance;
prefix->reported_metric = best_successor->total_metric; prefix->reported_metric = best_successor->total_metric;
if (eigrp_nbr_count_get()) {
if (eigrp_nbr_count_get())
{
prefix->req_action |= EIGRP_FSM_NEED_QUERY; prefix->req_action |= EIGRP_FSM_NEED_QUERY;
listnode_add(eigrp->topology_changes_internalIPV4,prefix); listnode_add(eigrp->topology_changes_internalIPV4,prefix);
} else { }
else
{
eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left
} }
@ -521,7 +574,8 @@ int eigrp_fsm_event_lr_fcn(struct eigrp_fsm_action_message *msg) {
return 1; return 1;
} }
int eigrp_fsm_event_qact(struct eigrp_fsm_action_message *msg) { int eigrp_fsm_event_qact(struct eigrp_fsm_action_message *msg)
{
struct list *successors = eigrp_topology_get_successor(msg->prefix); struct list *successors = eigrp_topology_get_successor(msg->prefix);
assert(successors); // Cats and no Dogs assert(successors); // Cats and no Dogs

View File

@ -157,7 +157,7 @@ eigrp_hello_parameter_decode (struct eigrp_neighbor *nbr,
/* Expedited hello sent */ /* Expedited hello sent */
eigrp_hello_send(nbr->ei, EIGRP_HELLO_NORMAL, NULL); eigrp_hello_send(nbr->ei, EIGRP_HELLO_NORMAL, NULL);
// if(ntohl(nbr->ei->address->u.prefix4.s_addr) > ntohl(nbr->src.s_addr)) // if(ntohl(nbr->ei->address->u.prefix4.s_addr) > ntohl(nbr->src.s_addr))
eigrp_update_send_init(nbr); eigrp_update_send_init(nbr);
eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_PENDING); eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_PENDING);
@ -184,9 +184,9 @@ eigrp_hello_parameter_decode (struct eigrp_neighbor *nbr,
} }
static u_char static u_char
eigrp_hello_authentication_decode(struct stream *s, struct eigrp_tlv_hdr_type *tlv_header, struct eigrp_neighbor *nbr) eigrp_hello_authentication_decode(struct stream *s, struct eigrp_tlv_hdr_type *tlv_header,
struct eigrp_neighbor *nbr)
{ {
struct TLV_MD5_Authentication_Type *md5; struct TLV_MD5_Authentication_Type *md5;
md5 = (struct TLV_MD5_Authentication_Type *) tlv_header; md5 = (struct TLV_MD5_Authentication_Type *) tlv_header;
@ -194,7 +194,8 @@ eigrp_hello_authentication_decode(struct stream *s, struct eigrp_tlv_hdr_type *t
if(md5->auth_type == EIGRP_AUTH_TYPE_MD5) if(md5->auth_type == EIGRP_AUTH_TYPE_MD5)
return eigrp_check_md5_digest(s, md5, nbr, EIGRP_AUTH_BASIC_HELLO_FLAG); return eigrp_check_md5_digest(s, md5, nbr, EIGRP_AUTH_BASIC_HELLO_FLAG);
else if (md5->auth_type == EIGRP_AUTH_TYPE_SHA256) else if (md5->auth_type == EIGRP_AUTH_TYPE_SHA256)
return eigrp_check_sha256_digest(s, (struct TLV_SHA256_Authentication_Type *) tlv_header, nbr, EIGRP_AUTH_BASIC_HELLO_FLAG); return eigrp_check_sha256_digest(s, (struct TLV_SHA256_Authentication_Type *)tlv_header,
nbr, EIGRP_AUTH_BASIC_HELLO_FLAG);
return 0; return 0;
} }
@ -392,7 +393,6 @@ eigrp_hello_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e
if (IS_DEBUG_EIGRP_PACKET(0, RECV)) if (IS_DEBUG_EIGRP_PACKET(0, RECV))
zlog_debug("Hello Packet received from %s", inet_ntoa(nbr->src)); zlog_debug("Hello Packet received from %s", inet_ntoa(nbr->src));
} }
/** /**
@ -605,7 +605,8 @@ eigrp_hello_parameter_encode (struct eigrp_interface *ei, struct stream *s, u_ch
* *
*/ */
static struct eigrp_packet * static struct eigrp_packet *
eigrp_hello_encode (struct eigrp_interface *ei, in_addr_t addr, u_int32_t ack, u_char flags, struct in_addr *nbr_addr) eigrp_hello_encode (struct eigrp_interface *ei, in_addr_t addr, u_int32_t ack,
u_char flags, struct in_addr *nbr_addr)
{ {
struct eigrp_packet *ep; struct eigrp_packet *ep;
u_int16_t length = EIGRP_HEADER_LEN; u_int16_t length = EIGRP_HEADER_LEN;
@ -619,11 +620,13 @@ eigrp_hello_encode (struct eigrp_interface *ei, in_addr_t addr, u_int32_t ack, u
eigrp_packet_header_init(EIGRP_OPC_HELLO, ei, ep->s, 0, 0, ack); eigrp_packet_header_init(EIGRP_OPC_HELLO, ei, ep->s, 0, 0, ack);
// encode Authentication TLV // encode Authentication TLV
if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL)) if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
{ {
length += eigrp_add_authTLV_MD5_to_stream(ep->s,ei); length += eigrp_add_authTLV_MD5_to_stream(ep->s,ei);
} }
else if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_SHA256) && (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL)) else if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_SHA256) &&
(IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
{ {
length += eigrp_add_authTLV_SHA256_to_stream(ep->s,ei); length += eigrp_add_authTLV_SHA256_to_stream(ep->s,ei);
} }
@ -656,11 +659,13 @@ eigrp_hello_encode (struct eigrp_interface *ei, in_addr_t addr, u_int32_t ack, u
// set soruce address for the hello packet // set soruce address for the hello packet
ep->dst.s_addr = addr; 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((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
{ {
eigrp_make_md5_digest(ei,ep->s, EIGRP_AUTH_BASIC_HELLO_FLAG); eigrp_make_md5_digest(ei,ep->s, EIGRP_AUTH_BASIC_HELLO_FLAG);
} }
else if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_SHA256) && (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL)) else if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_SHA256) &&
(IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
{ {
eigrp_make_sha256_digest(ei,ep->s, EIGRP_AUTH_BASIC_HELLO_FLAG); eigrp_make_sha256_digest(ei,ep->s, EIGRP_AUTH_BASIC_HELLO_FLAG);
} }

View File

@ -138,7 +138,6 @@ eigrp_if_table_lookup (struct interface *ifp, struct prefix *prefix)
int int
eigrp_if_delete_hook (struct interface *ifp) eigrp_if_delete_hook (struct interface *ifp)
{ {
struct route_node *rn; struct route_node *rn;
route_table_finish (IF_OIFS (ifp)); route_table_finish (IF_OIFS (ifp));
@ -222,7 +221,6 @@ eigrp_new_if_params (void)
UNSET_IF_PARAM (eip, auth_keychain); UNSET_IF_PARAM (eip, auth_keychain);
UNSET_IF_PARAM (eip, auth_type); UNSET_IF_PARAM (eip, auth_type);
return eip; return eip;
} }
@ -597,7 +595,6 @@ eigrp_bandwidth_to_scaled (u_int32_t bandwidth)
temp_bandwidth < EIGRP_MAX_METRIC ? temp_bandwidth : EIGRP_MAX_METRIC; temp_bandwidth < EIGRP_MAX_METRIC ? temp_bandwidth : EIGRP_MAX_METRIC;
return (u_int32_t) temp_bandwidth; return (u_int32_t) temp_bandwidth;
} }
u_int32_t u_int32_t

View File

@ -91,9 +91,9 @@ struct zebra_privs_t eigrpd_privs =
/* EIGRPd options. */ /* EIGRPd options. */
struct option longopts[] = struct option longopts[] =
{ {
{ 0 } { 0 }
}; };
/* Master of threads. */ /* Master of threads. */
struct thread_master *master; struct thread_master *master;

View File

@ -67,7 +67,6 @@ eigrp_nbr_new (struct eigrp_interface *ei)
nbr->ei = ei; nbr->ei = ei;
/* Set default values. */ /* Set default values. */
eigrp_nbr_state_set (nbr, EIGRP_NEIGHBOR_DOWN); eigrp_nbr_state_set (nbr, EIGRP_NEIGHBOR_DOWN);
return nbr; return nbr;
@ -89,9 +88,9 @@ eigrp_nbr_add (struct eigrp_interface *ei, struct eigrp_header *eigrph,
nbr = eigrp_nbr_new (ei); nbr = eigrp_nbr_new (ei);
nbr->src = iph->ip_src; nbr->src = iph->ip_src;
// if (IS_DEBUG_EIGRP_EVENT) // if (IS_DEBUG_EIGRP_EVENT)
// zlog_debug("NSM[%s:%s]: start", IF_NAME (nbr->oi), // zlog_debug("NSM[%s:%s]: start", IF_NAME (nbr->oi),
// inet_ntoa (nbr->router_id)); // inet_ntoa (nbr->router_id));
return nbr; return nbr;
} }
@ -187,7 +186,6 @@ eigrp_nbr_lookup_by_addr_process (struct eigrp *eigrp, struct in_addr nbr_addr)
void void
eigrp_nbr_delete (struct eigrp_neighbor *nbr) eigrp_nbr_delete (struct eigrp_neighbor *nbr)
{ {
eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_DOWN); eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_DOWN);
eigrp_topology_neighbor_down(nbr->ei->eigrp, nbr); eigrp_topology_neighbor_down(nbr->ei->eigrp, nbr);
@ -225,7 +223,6 @@ eigrp_nbr_state_get (struct eigrp_neighbor *nbr)
void void
eigrp_nbr_state_set (struct eigrp_neighbor *nbr, u_char state) eigrp_nbr_state_set (struct eigrp_neighbor *nbr, u_char state)
{ {
nbr->state = state; nbr->state = state;
if (eigrp_nbr_state_get(nbr) == EIGRP_NEIGHBOR_DOWN) if (eigrp_nbr_state_get(nbr) == EIGRP_NEIGHBOR_DOWN)
@ -292,9 +289,9 @@ eigrp_nbr_state_update (struct eigrp_neighbor *nbr)
case EIGRP_NEIGHBOR_DOWN: case EIGRP_NEIGHBOR_DOWN:
{ {
/*Start Hold Down Timer for neighbor*/ /*Start Hold Down Timer for neighbor*/
// THREAD_OFF(nbr->t_holddown); // THREAD_OFF(nbr->t_holddown);
// THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired, // THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired,
// nbr, nbr->v_holddown); // nbr, nbr->v_holddown);
break; break;
} }
case EIGRP_NEIGHBOR_PENDING: case EIGRP_NEIGHBOR_PENDING:
@ -317,7 +314,6 @@ eigrp_nbr_state_update (struct eigrp_neighbor *nbr)
} }
int eigrp_nbr_count_get(void){ int eigrp_nbr_count_get(void){
struct eigrp_interface *iface; struct eigrp_interface *iface;
struct listnode *node, *node2, *nnode2; struct listnode *node, *node2, *nnode2;
struct eigrp_neighbor *nbr; struct eigrp_neighbor *nbr;

View File

@ -132,6 +132,7 @@ eigrp_adjust_sndbuflen(struct eigrp * eigrp, unsigned int buflen)
return; return;
if (eigrpd_privs.change(ZPRIVS_RAISE)) if (eigrpd_privs.change(ZPRIVS_RAISE))
zlog_err("%s: could not raise privs, %s", __func__, safe_strerror(errno)); zlog_err("%s: could not raise privs, %s", __func__, safe_strerror(errno));
/* Now we try to set SO_SNDBUF to what our caller has requested /* Now we try to set SO_SNDBUF to what our caller has requested
* (the MTU of a newly added interface). However, if the OS has * (the MTU of a newly added interface). However, if the OS has
* truncated the actual buffer size to somewhat less size, try * truncated the actual buffer size to somewhat less size, try
@ -230,7 +231,6 @@ eigrp_network_set(struct eigrp *eigrp, struct prefix_ipv4 *p)
struct interface *ifp; struct interface *ifp;
struct listnode *node; struct listnode *node;
zlog_debug ("A");
rn = route_node_get(eigrp->networks, (struct prefix *) p); rn = route_node_get(eigrp->networks, (struct prefix *) p);
if (rn->info) if (rn->info)
{ {
@ -243,10 +243,9 @@ eigrp_network_set(struct eigrp *eigrp, struct prefix_ipv4 *p)
PREFIX_COPY_IPV4(pref,p); PREFIX_COPY_IPV4(pref,p);
rn->info = (void *) pref; rn->info = (void *) pref;
zlog_debug ("B");
/* Schedule Router ID Update. */ /* Schedule Router ID Update. */
// if (eigrp->router_id == 0) // if (eigrp->router_id == 0)
// eigrp_router_id_update(eigrp); // eigrp_router_id_update(eigrp);
/* Run network config now. */ /* Run network config now. */
/* Get target interface. */ /* Get target interface. */
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp)) for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
@ -373,7 +372,6 @@ eigrp_network_unset(struct eigrp *eigrp, struct prefix_ipv4 *p)
if (eigrp_network_match_iface(co, &rn->p)) if (eigrp_network_match_iface(co, &rn->p))
{ {
zlog_debug("eigrp_network_unset()2");
found = 1; found = 1;
route_unlock_node(rn); route_unlock_node(rn);
break; break;
@ -454,10 +452,10 @@ eigrp_metrics_is_same(struct eigrp_metrics *metric1,
return 0; // if different return 0; // if different
} }
void void
eigrp_external_routes_refresh (struct eigrp *eigrp, int type) eigrp_external_routes_refresh (struct eigrp *eigrp, int type)
{ {
} }

View File

@ -59,18 +59,19 @@
/* Packet Type String. */ /* Packet Type String. */
const struct message eigrp_packet_type_str[] = const struct message eigrp_packet_type_str[] =
{ {
{ EIGRP_OPC_UPDATE, "Update" }, { EIGRP_OPC_UPDATE, "Update"},
{ EIGRP_OPC_REQUEST, "Request" }, { EIGRP_OPC_REQUEST, "Request"},
{ EIGRP_OPC_QUERY, "Query" }, { EIGRP_OPC_QUERY, "Query"},
{ EIGRP_OPC_REPLY, "Reply" }, { EIGRP_OPC_REPLY, "Reply"},
{ EIGRP_OPC_HELLO, "Hello" }, { EIGRP_OPC_HELLO, "Hello"},
{ EIGRP_OPC_IPXSAP, "IPX-SAP" }, { EIGRP_OPC_IPXSAP, "IPX-SAP"},
{ EIGRP_OPC_PROBE, "Probe" }, { EIGRP_OPC_PROBE, "Probe"},
{ EIGRP_OPC_ACK, "Ack" }, { EIGRP_OPC_ACK, "Ack"},
{ EIGRP_OPC_SIAQUERY, "SIAQuery" }, { EIGRP_OPC_SIAQUERY, "SIAQuery"},
{ EIGRP_OPC_SIAREPLY, "SIAReply" }, { EIGRP_OPC_SIAREPLY, "SIAReply"},
}; };
const size_t eigrp_packet_type_str_max = sizeof(eigrp_packet_type_str) / const size_t eigrp_packet_type_str_max = sizeof(eigrp_packet_type_str) /
sizeof(eigrp_packet_type_str[0]); sizeof(eigrp_packet_type_str[0]);
@ -82,7 +83,6 @@ static int eigrp_verify_header (struct stream *, struct eigrp_interface *, struc
struct eigrp_header *); struct eigrp_header *);
static int eigrp_check_network_mask (struct eigrp_interface *, struct in_addr); static int eigrp_check_network_mask (struct eigrp_interface *, struct in_addr);
static int eigrp_retrans_count_exceeded(struct eigrp_packet *ep, struct eigrp_neighbor *nbr) static int eigrp_retrans_count_exceeded(struct eigrp_packet *ep, struct eigrp_neighbor *nbr)
{ {
return 1; return 1;
@ -146,7 +146,6 @@ eigrp_make_md5_digest (struct eigrp_interface *ei, struct stream *s, u_char flag
MD5Final(digest, &ctx); MD5Final(digest, &ctx);
/* Append md5 digest to the end of the stream. */ /* Append md5 digest to the end of the stream. */
memcpy(auth_TLV->digest,digest,EIGRP_AUTH_TYPE_MD5_LEN); memcpy(auth_TLV->digest,digest,EIGRP_AUTH_TYPE_MD5_LEN);
@ -159,7 +158,8 @@ eigrp_make_md5_digest (struct eigrp_interface *ei, struct stream *s, u_char flag
} }
int int
eigrp_check_md5_digest (struct stream *s, struct TLV_MD5_Authentication_Type *authTLV,struct eigrp_neighbor *nbr, u_char flags) eigrp_check_md5_digest (struct stream *s,
struct TLV_MD5_Authentication_Type *authTLV,struct eigrp_neighbor *nbr, u_char flags)
{ {
MD5_CTX ctx; MD5_CTX ctx;
unsigned char digest[EIGRP_AUTH_TYPE_MD5_LEN]; unsigned char digest[EIGRP_AUTH_TYPE_MD5_LEN];
@ -170,7 +170,6 @@ eigrp_check_md5_digest (struct stream *s, struct TLV_MD5_Authentication_Type *au
struct TLV_MD5_Authentication_Type *auth_TLV; struct TLV_MD5_Authentication_Type *auth_TLV;
struct eigrp_header *eigrph; struct eigrp_header *eigrph;
if (nbr && ntohl(nbr->crypt_seqnum) > ntohl(authTLV->key_sequence)) if (nbr && ntohl(nbr->crypt_seqnum) > ntohl(authTLV->key_sequence))
{ {
zlog_warn ("interface %s: eigrp_check_md5 bad sequence %d (expect %d)", zlog_warn ("interface %s: eigrp_check_md5 bad sequence %d (expect %d)",
@ -270,8 +269,8 @@ eigrp_make_sha256_digest (struct eigrp_interface *ei, struct stream *s, u_char f
if(keychain) if(keychain)
key = key_lookup_for_send(keychain); key = key_lookup_for_send(keychain);
// saved_len[index] = strnzcpyn(saved_key[index], key, // saved_len[index] = strnzcpyn(saved_key[index], key,
// PLAINTEXT_LENGTH + 1); // PLAINTEXT_LENGTH + 1);
source_ip = calloc(16, sizeof(char)); source_ip = calloc(16, sizeof(char));
inet_ntop(AF_INET, &ei->address->u.prefix4, source_ip, 16); inet_ntop(AF_INET, &ei->address->u.prefix4, source_ip, 16);
@ -299,11 +298,13 @@ eigrp_make_sha256_digest (struct eigrp_interface *ei, struct stream *s, u_char f
} }
int int
eigrp_check_sha256_digest (struct stream *s, struct TLV_SHA256_Authentication_Type *authTLV,struct eigrp_neighbor *nbr, u_char flags) eigrp_check_sha256_digest (struct stream *s,
struct TLV_SHA256_Authentication_Type *authTLV,
struct eigrp_neighbor *nbr, u_char flags)
{ {
return 1; return 1;
} }
/* /*
* eigrp_packet_dump * eigrp_packet_dump
* *
@ -317,27 +318,6 @@ eigrp_packet_dump (struct stream *s)
return; return;
} }
/*
* Converts a 24-bit integer represented as an unsigned char[3] *value
* in network byte order into uint32_t in host byte order
*/
//static uint32_t u24_32 (const unsigned char *value)
//{
// return (value[0] << 16) + (value[1] << 8) + value[2];
//}
//
///*
// * Converts an uint32_t value in host byte order into a 24-bit integer
// * in network byte order represented by unsigned char[3] *result
// */
//static unsigned char * u32_24 (uint32_t value, unsigned char *result)
//{
// value = htonl(value & 0x00FFFFFF);
// memcpy (result, (unsigned char *) &value + 1, 3);
//
// return result;
//}
int int
eigrp_write (struct thread *thread) eigrp_write (struct thread *thread)
{ {
@ -561,8 +541,8 @@ eigrp_read (struct thread *thread)
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV) && IS_DEBUG_EIGRP_TRANSMIT(0, PACKET_DETAIL)) if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV) && IS_DEBUG_EIGRP_TRANSMIT(0, PACKET_DETAIL))
eigrp_header_dump(eigrph); eigrp_header_dump(eigrph);
// if (MSG_OK != eigrp_packet_examin(eigrph, stream_get_endp(ibuf) - stream_get_getp(ibuf))) // if (MSG_OK != eigrp_packet_examin(eigrph, stream_get_endp(ibuf) - stream_get_getp(ibuf)))
// return -1; // return -1;
/* Now it is safe to access all fields of EIGRP packet header. */ /* Now it is safe to access all fields of EIGRP packet header. */
/* associate packet with eigrp interface */ /* associate packet with eigrp interface */
@ -634,7 +614,6 @@ eigrp_read (struct thread *thread)
/* Read rest of the packet and call each sort of packet routine. */ /* Read rest of the packet and call each sort of packet routine. */
stream_forward_getp(ibuf, EIGRP_HEADER_LEN); stream_forward_getp(ibuf, EIGRP_HEADER_LEN);
/* New testing block of code for handling Acks */ /* New testing block of code for handling Acks */
if (ntohl(eigrph->ack) != 0) if (ntohl(eigrph->ack) != 0)
{ {
@ -650,7 +629,8 @@ eigrp_read (struct thread *thread)
{ {
if (ntohl(eigrph->ack) == ep->sequence_number) if (ntohl(eigrph->ack) == ep->sequence_number)
{ {
if((nbr->state == EIGRP_NEIGHBOR_PENDING) && (ntohl(eigrph->ack) == nbr->init_sequence_number)) if((nbr->state == EIGRP_NEIGHBOR_PENDING) &&
(ntohl(eigrph->ack) == nbr->init_sequence_number))
{ {
eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_UP); eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_UP);
zlog_info("Neighbor adjacency became full"); zlog_info("Neighbor adjacency became full");
@ -914,8 +894,8 @@ eigrp_packet_header_init (int type, struct eigrp_interface *ei, struct stream *s
eigrph->ASNumber = htons(ei->eigrp->AS); eigrph->ASNumber = htons(ei->eigrp->AS);
eigrph->ack = htonl(ack); eigrph->ack = htonl(ack);
eigrph->sequence = htonl(sequence); eigrph->sequence = htonl(sequence);
// if(flags == EIGRP_INIT_FLAG) // if(flags == EIGRP_INIT_FLAG)
// eigrph->sequence = htonl(3); // eigrph->sequence = htonl(3);
eigrph->flags = htonl(flags); eigrph->flags = htonl(flags);
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)) if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
@ -1009,7 +989,6 @@ static int
eigrp_verify_header (struct stream *ibuf, struct eigrp_interface *ei, eigrp_verify_header (struct stream *ibuf, struct eigrp_interface *ei,
struct ip *iph, struct eigrp_header *eigrph) struct ip *iph, struct eigrp_header *eigrph)
{ {
/* Check network mask, Silently discarded. */ /* Check network mask, Silently discarded. */
if (!eigrp_check_network_mask(ei, iph->ip_src)) if (!eigrp_check_network_mask(ei, iph->ip_src))
{ {
@ -1017,10 +996,10 @@ eigrp_verify_header (struct stream *ibuf, struct eigrp_interface *ei,
IF_NAME(ei), inet_ntoa(iph->ip_src)); IF_NAME(ei), inet_ntoa(iph->ip_src));
return -1; return -1;
} }
// //
// /* Check authentication. The function handles logging actions, where required. */ // /* Check authentication. The function handles logging actions, where required. */
// if (! eigrp_check_auth(ei, eigrph)) // if (! eigrp_check_auth(ei, eigrph))
// return -1; // return -1;
return 0; return 0;
} }
@ -1189,7 +1168,6 @@ eigrp_read_ipv4_tlv (struct stream *s)
{ {
tlv->destination_part[0] = stream_getc(s); tlv->destination_part[0] = stream_getc(s);
tlv->destination.s_addr = (tlv->destination_part[0]); tlv->destination.s_addr = (tlv->destination_part[0]);
} }
else if (tlv->prefix_length > 8 && tlv->prefix_length <= 16) else if (tlv->prefix_length > 8 && tlv->prefix_length <= 16)
{ {
@ -1203,8 +1181,9 @@ eigrp_read_ipv4_tlv (struct stream *s)
tlv->destination_part[0] = stream_getc(s); tlv->destination_part[0] = stream_getc(s);
tlv->destination_part[1] = stream_getc(s); tlv->destination_part[1] = stream_getc(s);
tlv->destination_part[2] = stream_getc(s); tlv->destination_part[2] = stream_getc(s);
tlv->destination.s_addr = ((tlv->destination_part[2] << 16) tlv->destination.s_addr = ((tlv->destination_part[2] << 16) +
+ (tlv->destination_part[1] << 8) + tlv->destination_part[0]); (tlv->destination_part[1] << 8) +
tlv->destination_part[0]);
} }
else if (tlv->prefix_length > 24 && tlv->prefix_length <= 32) else if (tlv->prefix_length > 24 && tlv->prefix_length <= 32)
{ {
@ -1212,9 +1191,10 @@ eigrp_read_ipv4_tlv (struct stream *s)
tlv->destination_part[1] = stream_getc(s); tlv->destination_part[1] = stream_getc(s);
tlv->destination_part[2] = stream_getc(s); tlv->destination_part[2] = stream_getc(s);
tlv->destination_part[3] = stream_getc(s); tlv->destination_part[3] = stream_getc(s);
tlv->destination.s_addr = ((tlv->destination_part[3] << 24) tlv->destination.s_addr = ((tlv->destination_part[3] << 24) +
+ (tlv->destination_part[2] << 16) + (tlv->destination_part[1] << 8) (tlv->destination_part[2] << 16) +
+ tlv->destination_part[0]); (tlv->destination_part[1] << 8) +
tlv->destination_part[0]);
} }
return tlv; return tlv;
} }
@ -1310,7 +1290,6 @@ eigrp_add_authTLV_MD5_to_stream (struct stream *s,
authTLV->key_sequence = 0; authTLV->key_sequence = 0;
memset(authTLV->Nullpad,0,sizeof(authTLV->Nullpad)); memset(authTLV->Nullpad,0,sizeof(authTLV->Nullpad));
keychain = keychain_lookup(IF_DEF_PARAMS (ei->ifp)->auth_keychain); keychain = keychain_lookup(IF_DEF_PARAMS (ei->ifp)->auth_keychain);
if(keychain) if(keychain)
key = key_lookup_for_send(keychain); key = key_lookup_for_send(keychain);
@ -1353,7 +1332,6 @@ eigrp_add_authTLV_SHA256_to_stream (struct stream *s,
authTLV->key_sequence = 0; authTLV->key_sequence = 0;
memset(authTLV->Nullpad,0,sizeof(authTLV->Nullpad)); memset(authTLV->Nullpad,0,sizeof(authTLV->Nullpad));
keychain = keychain_lookup(IF_DEF_PARAMS (ei->ifp)->auth_keychain); keychain = keychain_lookup(IF_DEF_PARAMS (ei->ifp)->auth_keychain);
if(keychain) if(keychain)
key = key_lookup_for_send(keychain); key = key_lookup_for_send(keychain);
@ -1377,7 +1355,6 @@ eigrp_add_authTLV_SHA256_to_stream (struct stream *s,
eigrp_authTLV_SHA256_free(authTLV); eigrp_authTLV_SHA256_free(authTLV);
return 0; return 0;
} }
struct TLV_MD5_Authentication_Type * struct TLV_MD5_Authentication_Type *
@ -1393,7 +1370,6 @@ eigrp_authTLV_MD5_new ()
void void
eigrp_authTLV_MD5_free (struct TLV_MD5_Authentication_Type *authTLV) eigrp_authTLV_MD5_free (struct TLV_MD5_Authentication_Type *authTLV)
{ {
XFREE(MTYPE_EIGRP_AUTH_TLV, authTLV); XFREE(MTYPE_EIGRP_AUTH_TLV, authTLV);
} }
@ -1410,11 +1386,9 @@ eigrp_authTLV_SHA256_new ()
void void
eigrp_authTLV_SHA256_free (struct TLV_SHA256_Authentication_Type *authTLV) eigrp_authTLV_SHA256_free (struct TLV_SHA256_Authentication_Type *authTLV)
{ {
XFREE(MTYPE_EIGRP_AUTH_SHA256_TLV, authTLV); XFREE(MTYPE_EIGRP_AUTH_SHA256_TLV, authTLV);
} }
struct TLV_IPv4_Internal_type * struct TLV_IPv4_Internal_type *
eigrp_IPv4_InternalTLV_new () eigrp_IPv4_InternalTLV_new ()
{ {
@ -1428,7 +1402,6 @@ eigrp_IPv4_InternalTLV_new ()
void void
eigrp_IPv4_InternalTLV_free (struct TLV_IPv4_Internal_type *IPv4_InternalTLV) eigrp_IPv4_InternalTLV_free (struct TLV_IPv4_Internal_type *IPv4_InternalTLV)
{ {
XFREE(MTYPE_EIGRP_IPV4_INT_TLV, IPv4_InternalTLV); XFREE(MTYPE_EIGRP_IPV4_INT_TLV, IPv4_InternalTLV);
} }

View File

@ -122,8 +122,8 @@ eigrp_query_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e
dest_addr = prefix_ipv4_new(); dest_addr = prefix_ipv4_new();
dest_addr->prefix = tlv->destination; dest_addr->prefix = tlv->destination;
dest_addr->prefixlen = tlv->prefix_length; dest_addr->prefixlen = tlv->prefix_length;
struct eigrp_prefix_entry *dest = eigrp_topology_table_lookup_ipv4( struct eigrp_prefix_entry *dest =
eigrp->topology_table, dest_addr); eigrp_topology_table_lookup_ipv4(eigrp->topology_table, dest_addr);
/* If the destination exists (it should, but one never know)*/ /* If the destination exists (it should, but one never know)*/
if (dest != NULL) if (dest != NULL)
@ -131,8 +131,8 @@ eigrp_query_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e
struct eigrp_fsm_action_message *msg; struct eigrp_fsm_action_message *msg;
msg = XCALLOC(MTYPE_EIGRP_FSM_MSG, msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
sizeof(struct eigrp_fsm_action_message)); sizeof(struct eigrp_fsm_action_message));
struct eigrp_neighbor_entry *entry = eigrp_prefix_entry_lookup( struct eigrp_neighbor_entry *entry =
dest->entries, nbr); eigrp_prefix_entry_lookup(dest->entries, nbr);
msg->packet_type = EIGRP_OPC_QUERY; msg->packet_type = EIGRP_OPC_QUERY;
msg->eigrp = eigrp; msg->eigrp = eigrp;
msg->data_type = EIGRP_TLV_IPv4_INT; msg->data_type = EIGRP_TLV_IPv4_INT;
@ -168,7 +168,8 @@ eigrp_send_query (struct eigrp_interface *ei)
ei->eigrp->sequence_number, 0); ei->eigrp->sequence_number, 0);
// encode Authentication TLV, if needed // 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((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
{ {
length += eigrp_add_authTLV_MD5_to_stream(ep->s,ei); length += eigrp_add_authTLV_MD5_to_stream(ep->s,ei);
} }
@ -196,7 +197,8 @@ eigrp_send_query (struct eigrp_interface *ei)
return; return;
} }
if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL)) if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
{ {
eigrp_make_md5_digest(ei,ep->s, EIGRP_AUTH_UPDATE_FLAG); eigrp_make_md5_digest(ei,ep->s, EIGRP_AUTH_UPDATE_FLAG);
} }

View File

@ -89,7 +89,8 @@ eigrp_send_reply (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
zlog_info("REPLY SEND Prefix: %s", inet_ntoa(nbr->src)); zlog_info("REPLY SEND Prefix: %s", inet_ntoa(nbr->src));
/* Check if any list fits */ /* Check if any list fits */
if ((alist && access_list_apply (alist, (struct prefix *) pe2->destination_ipv4) == FILTER_DENY)|| if ((alist &&
access_list_apply (alist, (struct prefix *) pe2->destination_ipv4) == FILTER_DENY) ||
(plist && prefix_list_apply (plist, (struct prefix *) pe2->destination_ipv4) == PREFIX_DENY)|| (plist && prefix_list_apply (plist, (struct prefix *) pe2->destination_ipv4) == PREFIX_DENY)||
(alist_i && access_list_apply (alist_i, (struct prefix *) pe2->destination_ipv4) == FILTER_DENY)|| (alist_i && access_list_apply (alist_i, (struct prefix *) pe2->destination_ipv4) == FILTER_DENY)||
(plist_i && prefix_list_apply (plist_i, (struct prefix *) pe2->destination_ipv4) == PREFIX_DENY)) (plist_i && prefix_list_apply (plist_i, (struct prefix *) pe2->destination_ipv4) == PREFIX_DENY))
@ -97,11 +98,12 @@ eigrp_send_reply (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
zlog_info("REPLY SEND: Setting Metric to max"); zlog_info("REPLY SEND: Setting Metric to max");
pe2->reported_metric.delay = EIGRP_MAX_METRIC; pe2->reported_metric.delay = EIGRP_MAX_METRIC;
} else { }
else
{
zlog_info("REPLY SEND: Not setting metric"); zlog_info("REPLY SEND: Not setting metric");
} }
/* /*
* End of filtering * End of filtering
*/ */
@ -113,7 +115,8 @@ eigrp_send_reply (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
nbr->ei->eigrp->sequence_number, 0); nbr->ei->eigrp->sequence_number, 0);
// encode Authentication TLV, if needed // 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((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
{ {
length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei); length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei);
} }
@ -121,7 +124,8 @@ eigrp_send_reply (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
length += eigrp_add_internalTLV_to_stream(ep->s, pe2); length += eigrp_add_internalTLV_to_stream(ep->s, pe2);
if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL)) if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
{ {
eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG); eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG);
} }
@ -184,8 +188,8 @@ eigrp_reply_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e
dest_addr = prefix_ipv4_new(); dest_addr = prefix_ipv4_new();
dest_addr->prefix = tlv->destination; dest_addr->prefix = tlv->destination;
dest_addr->prefixlen = tlv->prefix_length; dest_addr->prefixlen = tlv->prefix_length;
struct eigrp_prefix_entry *dest = eigrp_topology_table_lookup_ipv4( struct eigrp_prefix_entry *dest =
eigrp->topology_table, dest_addr); eigrp_topology_table_lookup_ipv4 (eigrp->topology_table, dest_addr);
/* /*
* Destination must exists * Destination must exists
*/ */
@ -194,8 +198,8 @@ eigrp_reply_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e
struct eigrp_fsm_action_message *msg; struct eigrp_fsm_action_message *msg;
msg = XCALLOC(MTYPE_EIGRP_FSM_MSG, msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
sizeof(struct eigrp_fsm_action_message)); sizeof(struct eigrp_fsm_action_message));
struct eigrp_neighbor_entry *entry = eigrp_prefix_entry_lookup( struct eigrp_neighbor_entry *entry =
dest->entries, nbr); eigrp_prefix_entry_lookup(dest->entries, nbr);
/* /*
* Filtering * Filtering

View File

@ -68,7 +68,7 @@ eigrp_if_rmap_update (struct if_rmap *if_rmap)
if (ifp == NULL) if (ifp == NULL)
return; return;
ei=NULL; ei = NULL;
e = eigrp_lookup(); e = eigrp_lookup();
for (ALL_LIST_ELEMENTS (e->eiflist, node, nnode, ei2)) for (ALL_LIST_ELEMENTS (e->eiflist, node, nnode, ei2))
{ {
@ -267,31 +267,31 @@ static route_map_result_t
route_match_metric (void *rule, struct prefix *prefix, route_match_metric (void *rule, struct prefix *prefix,
route_map_object_t type, void *object) route_map_object_t type, void *object)
{ {
// u_int32_t *metric; // u_int32_t *metric;
// u_int32_t check; // u_int32_t check;
// struct rip_info *rinfo; // struct rip_info *rinfo;
// struct eigrp_neighbor_entry *te; // struct eigrp_neighbor_entry *te;
// struct eigrp_prefix_entry *pe; // struct eigrp_prefix_entry *pe;
// struct listnode *node, *node2, *nnode, *nnode2; // struct listnode *node, *node2, *nnode, *nnode2;
// struct eigrp *e; // struct eigrp *e;
// //
// e = eigrp_lookup(); // e = eigrp_lookup();
// //
// if (type == RMAP_EIGRP) // if (type == RMAP_EIGRP)
// { // {
// metric = rule; // metric = rule;
// rinfo = object; // rinfo = object;
// //
// /* If external metric is available, the route-map should // /* If external metric is available, the route-map should
// work on this one (for redistribute purpose) */ // work on this one (for redistribute purpose) */
// /*check = (rinfo->external_metric) ? rinfo->external_metric : // /*check = (rinfo->external_metric) ? rinfo->external_metric :
// rinfo->metric;*/ // rinfo->metric;*/
// //
// if (check == *metric) // if (check == *metric)
// return RMAP_MATCH; // return RMAP_MATCH;
// else // else
// return RMAP_NOMATCH; // return RMAP_NOMATCH;
// } // }
return RMAP_NOMATCH; return RMAP_NOMATCH;
} }
@ -299,15 +299,15 @@ route_match_metric (void *rule, struct prefix *prefix,
static void * static void *
route_match_metric_compile (const char *arg) route_match_metric_compile (const char *arg)
{ {
// u_int32_t *metric; // u_int32_t *metric;
// //
// metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t)); // metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
// *metric = atoi (arg); // *metric = atoi (arg);
// //
// if(*metric > 0) // if(*metric > 0)
// return metric; // return metric;
// //
// XFREE (MTYPE_ROUTE_MAP_COMPILED, metric); // XFREE (MTYPE_ROUTE_MAP_COMPILED, metric);
return NULL; return NULL;
} }
@ -333,25 +333,25 @@ static route_map_result_t
route_match_interface (void *rule, struct prefix *prefix, route_match_interface (void *rule, struct prefix *prefix,
route_map_object_t type, void *object) route_map_object_t type, void *object)
{ {
// struct rip_info *rinfo; // struct rip_info *rinfo;
// struct interface *ifp; // struct interface *ifp;
// char *ifname; // char *ifname;
// //
// if (type == RMAP_EIGRP) // if (type == RMAP_EIGRP)
// { // {
// ifname = rule; // ifname = rule;
// ifp = if_lookup_by_name(ifname); // ifp = if_lookup_by_name(ifname);
// //
// if (!ifp) // if (!ifp)
// return RMAP_NOMATCH; // return RMAP_NOMATCH;
// //
// rinfo = object; // rinfo = object;
// //
// /*if (rinfo->ifindex_out == ifp->ifindex || rinfo->ifindex == ifp->ifindex) // /*if (rinfo->ifindex_out == ifp->ifindex || rinfo->ifindex == ifp->ifindex)
// return RMAP_MATCH; // return RMAP_MATCH;
// else // else
// return RMAP_NOMATCH;*/ // return RMAP_NOMATCH;*/
// } // }
return RMAP_NOMATCH; return RMAP_NOMATCH;
} }
@ -386,24 +386,24 @@ static route_map_result_t
route_match_ip_next_hop (void *rule, struct prefix *prefix, route_match_ip_next_hop (void *rule, struct prefix *prefix,
route_map_object_t type, void *object) route_map_object_t type, void *object)
{ {
// struct access_list *alist; // struct access_list *alist;
// struct rip_info *rinfo; // struct rip_info *rinfo;
// struct prefix_ipv4 p; // struct prefix_ipv4 p;
// //
// if (type == RMAP_EIGRP) // if (type == RMAP_EIGRP)
// { // {
// rinfo = object; // rinfo = object;
// p.family = AF_INET; // p.family = AF_INET;
// /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop : rinfo->from;*/ // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop : rinfo->from;*/
// p.prefixlen = IPV4_MAX_BITLEN; // p.prefixlen = IPV4_MAX_BITLEN;
// //
// alist = access_list_lookup (AFI_IP, (char *) rule); // alist = access_list_lookup (AFI_IP, (char *) rule);
// if (alist == NULL) // if (alist == NULL)
// return RMAP_NOMATCH; // return RMAP_NOMATCH;
// //
// return (access_list_apply (alist, &p) == FILTER_DENY ? // return (access_list_apply (alist, &p) == FILTER_DENY ?
// RMAP_NOMATCH : RMAP_MATCH); // RMAP_NOMATCH : RMAP_MATCH);
// } // }
return RMAP_NOMATCH; return RMAP_NOMATCH;
} }
@ -424,12 +424,12 @@ route_match_ip_next_hop_free (void *rule)
/* Route map commands for ip next-hop matching. */ /* Route map commands for ip next-hop matching. */
static struct route_map_rule_cmd route_match_ip_next_hop_cmd = static struct route_map_rule_cmd route_match_ip_next_hop_cmd =
{ {
"ip next-hop", "ip next-hop",
route_match_ip_next_hop, route_match_ip_next_hop,
route_match_ip_next_hop_compile, route_match_ip_next_hop_compile,
route_match_ip_next_hop_free route_match_ip_next_hop_free
}; };
/* `match ip next-hop prefix-list PREFIX_LIST' */ /* `match ip next-hop prefix-list PREFIX_LIST' */
@ -437,24 +437,24 @@ static route_map_result_t
route_match_ip_next_hop_prefix_list (void *rule, struct prefix *prefix, route_match_ip_next_hop_prefix_list (void *rule, struct prefix *prefix,
route_map_object_t type, void *object) route_map_object_t type, void *object)
{ {
// struct prefix_list *plist; // struct prefix_list *plist;
// struct rip_info *rinfo; // struct rip_info *rinfo;
// struct prefix_ipv4 p; // struct prefix_ipv4 p;
// //
// if (type == RMAP_EIGRP) // if (type == RMAP_EIGRP)
// { // {
// rinfo = object; // rinfo = object;
// p.family = AF_INET; // p.family = AF_INET;
// /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop : rinfo->from;*/ // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop : rinfo->from;*/
// p.prefixlen = IPV4_MAX_BITLEN; // p.prefixlen = IPV4_MAX_BITLEN;
// //
// plist = prefix_list_lookup (AFI_IP, (char *) rule); // plist = prefix_list_lookup (AFI_IP, (char *) rule);
// if (plist == NULL) // if (plist == NULL)
// return RMAP_NOMATCH; // return RMAP_NOMATCH;
// //
// return (prefix_list_apply (plist, &p) == PREFIX_DENY ? // return (prefix_list_apply (plist, &p) == PREFIX_DENY ?
// RMAP_NOMATCH : RMAP_MATCH); // RMAP_NOMATCH : RMAP_MATCH);
// } // }
return RMAP_NOMATCH; return RMAP_NOMATCH;
} }
@ -517,12 +517,12 @@ route_match_ip_address_free (void *rule)
/* Route map commands for ip address matching. */ /* Route map commands for ip address matching. */
static struct route_map_rule_cmd route_match_ip_address_cmd = static struct route_map_rule_cmd route_match_ip_address_cmd =
{ {
"ip address", "ip address",
route_match_ip_address, route_match_ip_address,
route_match_ip_address_compile, route_match_ip_address_compile,
route_match_ip_address_free route_match_ip_address_free
}; };
/* `match ip address prefix-list PREFIX_LIST' */ /* `match ip address prefix-list PREFIX_LIST' */
@ -557,12 +557,12 @@ route_match_ip_address_prefix_list_free (void *rule)
} }
static struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd = static struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd =
{ {
"ip address prefix-list", "ip address prefix-list",
route_match_ip_address_prefix_list, route_match_ip_address_prefix_list,
route_match_ip_address_prefix_list_compile, route_match_ip_address_prefix_list_compile,
route_match_ip_address_prefix_list_free route_match_ip_address_prefix_list_free
}; };
/* `match tag TAG' */ /* `match tag TAG' */
/* Match function return 1 if match is success else return zero. */ /* Match function return 1 if match is success else return zero. */
@ -570,20 +570,20 @@ static route_map_result_t
route_match_tag (void *rule, struct prefix *prefix, route_match_tag (void *rule, struct prefix *prefix,
route_map_object_t type, void *object) route_map_object_t type, void *object)
{ {
// u_short *tag; // u_short *tag;
// struct rip_info *rinfo; // struct rip_info *rinfo;
// //
// if (type == RMAP_EIGRP) // if (type == RMAP_EIGRP)
// { // {
// tag = rule; // tag = rule;
// rinfo = object; // rinfo = object;
// //
// /* The information stored by rinfo is host ordered. */ // /* The information stored by rinfo is host ordered. */
// /*if (rinfo->tag == *tag) // /*if (rinfo->tag == *tag)
// return RMAP_MATCH; // return RMAP_MATCH;
// else // else
// return RMAP_NOMATCH;*/ // return RMAP_NOMATCH;*/
// } // }
return RMAP_NOMATCH; return RMAP_NOMATCH;
} }
@ -591,12 +591,12 @@ route_match_tag (void *rule, struct prefix *prefix,
static void * static void *
route_match_tag_compile (const char *arg) route_match_tag_compile (const char *arg)
{ {
// u_short *tag; // u_short *tag;
// //
// tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short)); // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
// *tag = atoi (arg); // *tag = atoi (arg);
// //
// return tag; // return tag;
} }
/* Free route map's compiled `match tag' value. */ /* Free route map's compiled `match tag' value. */
@ -608,40 +608,40 @@ route_match_tag_free (void *rule)
/* Route map commands for tag matching. */ /* Route map commands for tag matching. */
struct route_map_rule_cmd route_match_tag_cmd = struct route_map_rule_cmd route_match_tag_cmd =
{ {
"tag", "tag",
route_match_tag, route_match_tag,
route_match_tag_compile, route_match_tag_compile,
route_match_tag_free route_match_tag_free
}; };
/* Set metric to attribute. */ /* Set metric to attribute. */
static route_map_result_t static route_map_result_t
route_set_metric (void *rule, struct prefix *prefix, route_set_metric (void *rule, struct prefix *prefix,
route_map_object_t type, void *object) route_map_object_t type, void *object)
{ {
// if (type == RMAP_RIP) // if (type == RMAP_RIP)
// { // {
// struct rip_metric_modifier *mod; // struct rip_metric_modifier *mod;
// struct rip_info *rinfo; // struct rip_info *rinfo;
// //
// mod = rule; // mod = rule;
// rinfo = object; // rinfo = object;
// //
// /*if (mod->type == metric_increment) // /*if (mod->type == metric_increment)
// rinfo->metric_out += mod->metric; // rinfo->metric_out += mod->metric;
// else if (mod->type == metric_decrement) // else if (mod->type == metric_decrement)
// rinfo->metric_out -= mod->metric; // rinfo->metric_out -= mod->metric;
// else if (mod->type == metric_absolute) // else if (mod->type == metric_absolute)
// rinfo->metric_out = mod->metric; // rinfo->metric_out = mod->metric;
// //
// if ((signed int)rinfo->metric_out < 1) // if ((signed int)rinfo->metric_out < 1)
// rinfo->metric_out = 1; // rinfo->metric_out = 1;
// if (rinfo->metric_out > RIP_METRIC_INFINITY) // if (rinfo->metric_out > RIP_METRIC_INFINITY)
// rinfo->metric_out = RIP_METRIC_INFINITY;*/ // rinfo->metric_out = RIP_METRIC_INFINITY;*/
// //
// rinfo->metric_set = 1; // rinfo->metric_set = 1;
// } // }
return RMAP_OKAY; return RMAP_OKAY;
} }
@ -649,51 +649,51 @@ route_set_metric (void *rule, struct prefix *prefix,
static void * static void *
route_set_metric_compile (const char *arg) route_set_metric_compile (const char *arg)
{ {
// int len; // int len;
// const char *pnt; // const char *pnt;
// int type; // int type;
// long metric; // long metric;
// char *endptr = NULL; // char *endptr = NULL;
// struct rip_metric_modifier *mod; // struct rip_metric_modifier *mod;
// //
// len = strlen (arg); // len = strlen (arg);
// pnt = arg; // pnt = arg;
// //
// if (len == 0) // if (len == 0)
// return NULL; // return NULL;
// //
// /* Examine first character. */ // /* Examine first character. */
// if (arg[0] == '+') // if (arg[0] == '+')
// { // {
// //type = metric_increment; // //type = metric_increment;
// pnt++; // pnt++;
// } // }
// else if (arg[0] == '-') // else if (arg[0] == '-')
// { // {
// //type = metric_decrement; // //type = metric_decrement;
// pnt++; // pnt++;
// } // }
// /*else // /*else
// type = metric_absolute;*/ // type = metric_absolute;*/
// //
// /* Check beginning with digit string. */ // /* Check beginning with digit string. */
// if (*pnt < '0' || *pnt > '9') // if (*pnt < '0' || *pnt > '9')
// return NULL; // return NULL;
// //
// /* Convert string to integer. */ // /* Convert string to integer. */
// metric = strtol (pnt, &endptr, 10); // metric = strtol (pnt, &endptr, 10);
// //
// if (metric == LONG_MAX || *endptr != '\0') // if (metric == LONG_MAX || *endptr != '\0')
// return NULL; // return NULL;
// /*if (metric < 0 || metric > RIP_METRIC_INFINITY) // /*if (metric < 0 || metric > RIP_METRIC_INFINITY)
// return NULL;*/ // return NULL;*/
// //
// mod = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, // mod = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
// sizeof (struct rip_metric_modifier)); // sizeof (struct rip_metric_modifier));
// mod->type = type; // mod->type = type;
// mod->metric = metric; // mod->metric = metric;
// return mod; // return mod;
} }
/* Free route map's compiled `set metric' value. */ /* Free route map's compiled `set metric' value. */
@ -705,12 +705,12 @@ route_set_metric_free (void *rule)
/* Set metric rule structure. */ /* Set metric rule structure. */
static struct route_map_rule_cmd route_set_metric_cmd = static struct route_map_rule_cmd route_set_metric_cmd =
{ {
"metric", "metric",
route_set_metric, route_set_metric,
route_set_metric_compile, route_set_metric_compile,
route_set_metric_free, route_set_metric_free,
}; };
/* `set ip next-hop IP_ADDRESS' */ /* `set ip next-hop IP_ADDRESS' */
@ -719,18 +719,18 @@ static route_map_result_t
route_set_ip_nexthop (void *rule, struct prefix *prefix, route_set_ip_nexthop (void *rule, struct prefix *prefix,
route_map_object_t type, void *object) route_map_object_t type, void *object)
{ {
// struct in_addr *address; // struct in_addr *address;
// struct rip_info *rinfo; // struct rip_info *rinfo;
// //
// if(type == RMAP_RIP) // if(type == RMAP_RIP)
// { // {
// /* Fetch routemap's rule information. */ // /* Fetch routemap's rule information. */
// address = rule; // address = rule;
// rinfo = object; // rinfo = object;
// //
// /* Set next hop value. */ // /* Set next hop value. */
// rinfo->nexthop_out = *address; // rinfo->nexthop_out = *address;
// } // }
return RMAP_OKAY; return RMAP_OKAY;
} }
@ -740,20 +740,20 @@ route_set_ip_nexthop (void *rule, struct prefix *prefix,
static void * static void *
route_set_ip_nexthop_compile (const char *arg) route_set_ip_nexthop_compile (const char *arg)
{ {
// int ret; // int ret;
// struct in_addr *address; // struct in_addr *address;
// //
// address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct in_addr)); // address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct in_addr));
// //
// ret = inet_aton (arg, address); // ret = inet_aton (arg, address);
// //
// if (ret == 0) // if (ret == 0)
// { // {
// XFREE (MTYPE_ROUTE_MAP_COMPILED, address); // XFREE (MTYPE_ROUTE_MAP_COMPILED, address);
// return NULL; // return NULL;
// } // }
// //
// return address; // return address;
} }
/* Free route map's compiled `ip nexthop' value. */ /* Free route map's compiled `ip nexthop' value. */
@ -765,12 +765,12 @@ route_set_ip_nexthop_free (void *rule)
/* Route map commands for ip nexthop set. */ /* Route map commands for ip nexthop set. */
static struct route_map_rule_cmd route_set_ip_nexthop_cmd = static struct route_map_rule_cmd route_set_ip_nexthop_cmd =
{ {
"ip next-hop", "ip next-hop",
route_set_ip_nexthop, route_set_ip_nexthop,
route_set_ip_nexthop_compile, route_set_ip_nexthop_compile,
route_set_ip_nexthop_free route_set_ip_nexthop_free
}; };
/* `set tag TAG' */ /* `set tag TAG' */
@ -779,18 +779,18 @@ static route_map_result_t
route_set_tag (void *rule, struct prefix *prefix, route_set_tag (void *rule, struct prefix *prefix,
route_map_object_t type, void *object) route_map_object_t type, void *object)
{ {
// u_short *tag; // u_short *tag;
// struct rip_info *rinfo; // struct rip_info *rinfo;
// //
// if(type == RMAP_RIP) // if(type == RMAP_RIP)
// { // {
// /* Fetch routemap's rule information. */ // /* Fetch routemap's rule information. */
// tag = rule; // tag = rule;
// rinfo = object; // rinfo = object;
// //
// /* Set next hop value. */ // /* Set next hop value. */
// rinfo->tag_out = *tag; // rinfo->tag_out = *tag;
// } // }
return RMAP_OKAY; return RMAP_OKAY;
} }
@ -800,12 +800,12 @@ route_set_tag (void *rule, struct prefix *prefix,
static void * static void *
route_set_tag_compile (const char *arg) route_set_tag_compile (const char *arg)
{ {
// u_short *tag; // u_short *tag;
// //
// tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short)); // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
// *tag = atoi (arg); // *tag = atoi (arg);
// //
// return tag; // return tag;
} }
/* Free route map's compiled `ip nexthop' value. */ /* Free route map's compiled `ip nexthop' value. */
@ -817,12 +817,12 @@ route_set_tag_free (void *rule)
/* Route map commands for tag set. */ /* Route map commands for tag set. */
static struct route_map_rule_cmd route_set_tag_cmd = static struct route_map_rule_cmd route_set_tag_cmd =
{ {
"tag", "tag",
route_set_tag, route_set_tag,
route_set_tag_compile, route_set_tag_compile,
route_set_tag_free route_set_tag_free
}; };
#define MATCH_STR "Match values from routing table\n" #define MATCH_STR "Match values from routing table\n"
#define SET_STR "Set values in destination routing protocol\n" #define SET_STR "Set values in destination routing protocol\n"
@ -973,7 +973,6 @@ DEFUN (match_ip_address,
"IP access-list number\n" "IP access-list number\n"
"IP access-list number (expanded range)\n" "IP access-list number (expanded range)\n"
"IP Access-list name\n") "IP Access-list name\n")
{ {
return eigrp_route_match_add (vty, vty->index, "ip address", argv[0]); return eigrp_route_match_add (vty, vty->index, "ip address", argv[0]);
} }

View File

@ -89,8 +89,8 @@ eigrp_siaquery_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header
dest_addr = prefix_ipv4_new(); dest_addr = prefix_ipv4_new();
dest_addr->prefix = tlv->destination; dest_addr->prefix = tlv->destination;
dest_addr->prefixlen = tlv->prefix_length; dest_addr->prefixlen = tlv->prefix_length;
struct eigrp_prefix_entry *dest = eigrp_topology_table_lookup_ipv4( struct eigrp_prefix_entry *dest =
eigrp->topology_table, dest_addr); eigrp_topology_table_lookup_ipv4(eigrp->topology_table, dest_addr);
/* If the destination exists (it should, but one never know)*/ /* If the destination exists (it should, but one never know)*/
if (dest != NULL) if (dest != NULL)
@ -98,8 +98,8 @@ eigrp_siaquery_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header
struct eigrp_fsm_action_message *msg; struct eigrp_fsm_action_message *msg;
msg = XCALLOC(MTYPE_EIGRP_FSM_MSG, msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
sizeof(struct eigrp_fsm_action_message)); sizeof(struct eigrp_fsm_action_message));
struct eigrp_neighbor_entry *entry = eigrp_prefix_entry_lookup( struct eigrp_neighbor_entry *entry =
dest->entries, nbr); eigrp_prefix_entry_lookup(dest->entries, nbr);
msg->packet_type = EIGRP_OPC_SIAQUERY; msg->packet_type = EIGRP_OPC_SIAQUERY;
msg->eigrp = eigrp; msg->eigrp = eigrp;
msg->data_type = EIGRP_TLV_IPv4_INT; msg->data_type = EIGRP_TLV_IPv4_INT;
@ -116,7 +116,6 @@ eigrp_siaquery_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header
eigrp_hello_send_ack(nbr); eigrp_hello_send_ack(nbr);
} }
void void
eigrp_send_siaquery (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe) eigrp_send_siaquery (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
{ {
@ -130,14 +129,16 @@ eigrp_send_siaquery (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
nbr->ei->eigrp->sequence_number, 0); nbr->ei->eigrp->sequence_number, 0);
// encode Authentication TLV, if needed // 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((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
{ {
length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei); length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei);
} }
length += eigrp_add_internalTLV_to_stream(ep->s, pe); 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((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
{ {
eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG); eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG);
} }

View File

@ -25,7 +25,6 @@
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#include <zebra.h> #include <zebra.h>
#include "thread.h" #include "thread.h"
@ -89,8 +88,8 @@ eigrp_siareply_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header
dest_addr = prefix_ipv4_new(); dest_addr = prefix_ipv4_new();
dest_addr->prefix = tlv->destination; dest_addr->prefix = tlv->destination;
dest_addr->prefixlen = tlv->prefix_length; dest_addr->prefixlen = tlv->prefix_length;
struct eigrp_prefix_entry *dest = eigrp_topology_table_lookup_ipv4( struct eigrp_prefix_entry *dest =
eigrp->topology_table, dest_addr); eigrp_topology_table_lookup_ipv4(eigrp->topology_table, dest_addr);
/* If the destination exists (it should, but one never know)*/ /* If the destination exists (it should, but one never know)*/
if (dest != NULL) if (dest != NULL)
@ -98,8 +97,8 @@ eigrp_siareply_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header
struct eigrp_fsm_action_message *msg; struct eigrp_fsm_action_message *msg;
msg = XCALLOC(MTYPE_EIGRP_FSM_MSG, msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
sizeof(struct eigrp_fsm_action_message)); sizeof(struct eigrp_fsm_action_message));
struct eigrp_neighbor_entry *entry = eigrp_prefix_entry_lookup( struct eigrp_neighbor_entry *entry =
dest->entries, nbr); eigrp_prefix_entry_lookup(dest->entries, nbr);
msg->packet_type = EIGRP_OPC_SIAQUERY; msg->packet_type = EIGRP_OPC_SIAQUERY;
msg->eigrp = eigrp; msg->eigrp = eigrp;
msg->data_type = EIGRP_TLV_IPv4_INT; msg->data_type = EIGRP_TLV_IPv4_INT;
@ -129,14 +128,16 @@ eigrp_send_siareply (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
nbr->ei->eigrp->sequence_number, 0); nbr->ei->eigrp->sequence_number, 0);
// encode Authentication TLV, if needed // 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((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
{ {
length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei); length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei);
} }
length += eigrp_add_internalTLV_to_stream(ep->s, pe); 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((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
{ {
eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG); eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG);
} }

View File

@ -60,7 +60,6 @@
#include "eigrpd/eigrp_fsm.h" #include "eigrpd/eigrp_fsm.h"
#include "eigrpd/eigrp_snmp.h" #include "eigrpd/eigrp_snmp.h"
struct list *eigrp_snmp_iflist; struct list *eigrp_snmp_iflist;
/* Declare static local variables for convenience. */ /* Declare static local variables for convenience. */
@ -185,7 +184,7 @@ static u_char *eigrpInterfaceEntry (struct variable *, oid *, size_t *, int,
struct variable eigrp_variables[] = struct variable eigrp_variables[] =
{ {
/* EIGRP vpn variables */ /* EIGRP vpn variables */
{EIGRPVPNID, INTEGER, NOACCESS, eigrpVpnEntry, {EIGRPVPNID, INTEGER, NOACCESS, eigrpVpnEntry,
4, {1, 1, 1, 1}}, 4, {1, 1, 1, 1}},
@ -463,13 +462,12 @@ eigrpNbrLookup (struct variable *v, oid *name, size_t *length,
} }
static u_char * static u_char *
eigrpVpnEntry (struct variable *v, oid *name, size_t *length, eigrpVpnEntry (struct variable *v, oid *name, size_t *length,
int exact, size_t *var_len, WriteMethod **write_method) int exact, size_t *var_len, WriteMethod **write_method)
{ {
struct eigrp *eigrp; struct eigrp *eigrp;
eigrp = eigrp_lookup (); eigrp = eigrp_lookup ();
/* Check whether the instance identifier is valid */ /* Check whether the instance identifier is valid */
@ -502,11 +500,11 @@ eigrpNbrLookup (struct variable *v, oid *name, size_t *length,
return NULL; return NULL;
} }
return NULL; return NULL;
} }
static uint32_t static uint32_t
eigrp_neighbor_count(struct eigrp *eigrp) eigrp_neighbor_count(struct eigrp *eigrp)
{ {
uint32_t count; uint32_t count;
struct eigrp_interface *ei; struct eigrp_interface *ei;
struct listnode *node, *node2, *nnode2; struct listnode *node, *node2, *nnode2;
@ -528,19 +526,18 @@ eigrpNbrLookup (struct variable *v, oid *name, size_t *length,
} }
return count; return count;
} }
static u_char * static u_char *
eigrpTraffStatsEntry (struct variable *v, oid *name, size_t *length, eigrpTraffStatsEntry (struct variable *v, oid *name, size_t *length,
int exact, size_t *var_len, WriteMethod **write_method) int exact, size_t *var_len, WriteMethod **write_method)
{ {
struct eigrp *eigrp; struct eigrp *eigrp;
struct eigrp_interface *ei; struct eigrp_interface *ei;
struct listnode *node, *nnode; struct listnode *node, *nnode;
int counter; int counter;
eigrp = eigrp_lookup (); eigrp = eigrp_lookup ();
/* Check whether the instance identifier is valid */ /* Check whether the instance identifier is valid */
@ -824,16 +821,16 @@ eigrpNbrLookup (struct variable *v, oid *name, size_t *length,
return NULL; return NULL;
} }
return NULL; return NULL;
} }
static u_char *
eigrpTopologyEntry (struct variable *v, oid *name, size_t *length, static u_char *
eigrpTopologyEntry (struct variable *v, oid *name, size_t *length,
int exact, size_t *var_len, WriteMethod **write_method) int exact, size_t *var_len, WriteMethod **write_method)
{ {
struct eigrp *eigrp; struct eigrp *eigrp;
struct eigrp_interface *ei; struct eigrp_interface *ei;
struct listnode *node, *nnode; struct listnode *node, *nnode;
eigrp = eigrp_lookup (); eigrp = eigrp_lookup ();
/* Check whether the instance identifier is valid */ /* Check whether the instance identifier is valid */
@ -990,12 +987,12 @@ eigrpNbrLookup (struct variable *v, oid *name, size_t *length,
return NULL; return NULL;
} }
return NULL; return NULL;
} }
static u_char * static u_char *
eigrpPeerEntry (struct variable *v, oid *name, size_t *length, eigrpPeerEntry (struct variable *v, oid *name, size_t *length,
int exact, size_t *var_len, WriteMethod **write_method) int exact, size_t *var_len, WriteMethod **write_method)
{ {
struct eigrp *eigrp; struct eigrp *eigrp;
struct eigrp_interface *ei; struct eigrp_interface *ei;
struct listnode *node, *nnode; struct listnode *node, *nnode;
@ -1145,11 +1142,12 @@ eigrpNbrLookup (struct variable *v, oid *name, size_t *length,
return NULL; return NULL;
} }
return NULL; return NULL;
} }
static u_char *
eigrpInterfaceEntry (struct variable *v, oid *name, size_t *length, static u_char *
eigrpInterfaceEntry (struct variable *v, oid *name, size_t *length,
int exact, size_t *var_len, WriteMethod **write_method) int exact, size_t *var_len, WriteMethod **write_method)
{ {
struct eigrp *eigrp; struct eigrp *eigrp;
struct eigrp_interface *ei; struct eigrp_interface *ei;
struct listnode *node, *nnode; struct listnode *node, *nnode;
@ -1157,7 +1155,6 @@ eigrpNbrLookup (struct variable *v, oid *name, size_t *length,
struct list *keylist; struct list *keylist;
int counter; int counter;
eigrp = eigrp_lookup (); eigrp = eigrp_lookup ();
/* Check whether the instance identifier is valid */ /* Check whether the instance identifier is valid */
@ -1379,17 +1376,14 @@ eigrpNbrLookup (struct variable *v, oid *name, size_t *length,
return NULL; return NULL;
} }
return NULL; return NULL;
} }
/* Register EIGRP-MIB. */
/* Register EIGRP-MIB. */ void
void eigrp_snmp_init ()
eigrp_snmp_init () {
{
eigrp_snmp_iflist = list_new (); eigrp_snmp_iflist = list_new ();
smux_init (eigrp_om->master); smux_init (eigrp_om->master);
REGISTER_MIB("ciscoEigrpMIB", eigrp_variables, variable, eigrp_oid); REGISTER_MIB("ciscoEigrpMIB", eigrp_variables, variable, eigrp_oid);
} }
#endif #endif

View File

@ -52,17 +52,12 @@
#include "eigrpd/eigrp_fsm.h" #include "eigrpd/eigrp_fsm.h"
#include "eigrpd/eigrp_memory.h" #include "eigrpd/eigrp_memory.h"
static int static int eigrp_prefix_entry_cmp(struct eigrp_prefix_entry *, struct eigrp_prefix_entry *);
eigrp_prefix_entry_cmp(struct eigrp_prefix_entry *, struct eigrp_prefix_entry *); static void eigrp_prefix_entry_del(struct eigrp_prefix_entry *);
static void static int eigrp_neighbor_entry_cmp(struct eigrp_neighbor_entry *,
eigrp_prefix_entry_del(struct eigrp_prefix_entry *);
static int
eigrp_neighbor_entry_cmp(struct eigrp_neighbor_entry *,
struct eigrp_neighbor_entry *); struct eigrp_neighbor_entry *);
/* /*
* asdf;laksdjf;lajsdf;kasdjf;asdjf;
* asdfaskdjfa;sdkjf;adlskj
* Returns linkedlist used as topology table * Returns linkedlist used as topology table
* cmp - assigned function for comparing topology nodes * cmp - assigned function for comparing topology nodes
* del - assigned function executed before deleting topology node by list function * del - assigned function executed before deleting topology node by list function
@ -135,7 +130,6 @@ eigrp_prefix_entry_del(struct eigrp_prefix_entry *node)
* Returns new created toplogy node * Returns new created toplogy node
* cmp - assigned function for comparing topology entry * cmp - assigned function for comparing topology entry
*/ */
struct eigrp_prefix_entry * struct eigrp_prefix_entry *
eigrp_prefix_entry_new() eigrp_prefix_entry_new()
{ {
@ -154,7 +148,6 @@ eigrp_prefix_entry_new()
/* /*
* Topology entry comparison * Topology entry comparison
*/ */
static int static int
eigrp_neighbor_entry_cmp(struct eigrp_neighbor_entry *entry1, eigrp_neighbor_entry_cmp(struct eigrp_neighbor_entry *entry1,
struct eigrp_neighbor_entry *entry2) struct eigrp_neighbor_entry *entry2)
@ -187,7 +180,6 @@ eigrp_neighbor_entry_new()
/* /*
* Freeing topology table list * Freeing topology table list
*/ */
void void
eigrp_topology_free(struct list *list) eigrp_topology_free(struct list *list)
{ {
@ -197,7 +189,6 @@ eigrp_topology_free(struct list *list)
/* /*
* Deleting all topology nodes in table * Deleting all topology nodes in table
*/ */
void void
eigrp_topology_cleanup(struct list *topology) eigrp_topology_cleanup(struct list *topology)
{ {
@ -209,7 +200,6 @@ eigrp_topology_cleanup(struct list *topology)
/* /*
* Adding topology node to topology table * Adding topology node to topology table
*/ */
void void
eigrp_prefix_entry_add(struct list *topology, struct eigrp_prefix_entry *node) eigrp_prefix_entry_add(struct list *topology, struct eigrp_prefix_entry *node)
{ {
@ -222,7 +212,6 @@ eigrp_prefix_entry_add(struct list *topology, struct eigrp_prefix_entry *node)
/* /*
* Adding topology entry to topology node * Adding topology entry to topology node
*/ */
void void
eigrp_neighbor_entry_add(struct eigrp_prefix_entry *node, eigrp_neighbor_entry_add(struct eigrp_prefix_entry *node,
struct eigrp_neighbor_entry *entry) struct eigrp_neighbor_entry *entry)
@ -237,7 +226,6 @@ eigrp_neighbor_entry_add(struct eigrp_prefix_entry *node,
/* /*
* Deleting topology node from topology table * Deleting topology node from topology table
*/ */
void void
eigrp_prefix_entry_delete(struct list *topology, eigrp_prefix_entry_delete(struct list *topology,
struct eigrp_prefix_entry *node) struct eigrp_prefix_entry *node)
@ -263,7 +251,6 @@ eigrp_prefix_entry_delete(struct list *topology,
/* /*
* Deleting topology entry from topology node * Deleting topology entry from topology node
*/ */
void void
eigrp_neighbor_entry_delete(struct eigrp_prefix_entry *node, eigrp_neighbor_entry_delete(struct eigrp_prefix_entry *node,
struct eigrp_neighbor_entry *entry) struct eigrp_neighbor_entry *entry)
@ -278,7 +265,6 @@ eigrp_neighbor_entry_delete(struct eigrp_prefix_entry *node,
/* /*
* Deleting all nodes from topology table * Deleting all nodes from topology table
*/ */
void void
eigrp_topology_delete_all(struct list *topology) eigrp_topology_delete_all(struct list *topology)
{ {
@ -289,7 +275,6 @@ eigrp_topology_delete_all(struct list *topology)
* Return 0 if topology is not empty * Return 0 if topology is not empty
* otherwise return 1 * otherwise return 1
*/ */
unsigned int unsigned int
eigrp_topology_table_isempty(struct list *topology) eigrp_topology_table_isempty(struct list *topology)
{ {
@ -307,7 +292,6 @@ eigrp_topology_table_lookup_ipv4(struct list *topology_table,
struct listnode *node; struct listnode *node;
for (ALL_LIST_ELEMENTS_RO(topology_table, node, data)) for (ALL_LIST_ELEMENTS_RO(topology_table, node, data))
{ {
if ((data->af == AF_INET) if ((data->af == AF_INET)
&& (data->destination_ipv4->prefix.s_addr == address->prefix.s_addr) && (data->destination_ipv4->prefix.s_addr == address->prefix.s_addr)
&& (data->destination_ipv4->prefixlen == address->prefixlen)) && (data->destination_ipv4->prefixlen == address->prefixlen))
@ -440,8 +424,8 @@ eigrp_topology_update_distance(struct eigrp_fsm_action_message *msg)
entry->reported_distance entry->reported_distance
> eigrp_calculate_metrics(eigrp, &int_data->metric) ? 2 : 3; // Increase : Decrease : No change > eigrp_calculate_metrics(eigrp, &int_data->metric) ? 2 : 3; // Increase : Decrease : No change
entry->reported_metric = int_data->metric; entry->reported_metric = int_data->metric;
entry->reported_distance = eigrp_calculate_metrics(eigrp, entry->reported_distance =
&int_data->metric); eigrp_calculate_metrics(eigrp, &int_data->metric);
entry->distance = eigrp_calculate_total_metrics(eigrp, entry); entry->distance = eigrp_calculate_total_metrics(eigrp, entry);
} }
else else

View File

@ -300,8 +300,8 @@ eigrp_update_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *
dest_addr = prefix_ipv4_new(); dest_addr = prefix_ipv4_new();
dest_addr->prefix = tlv->destination; dest_addr->prefix = tlv->destination;
dest_addr->prefixlen = tlv->prefix_length; dest_addr->prefixlen = tlv->prefix_length;
struct eigrp_prefix_entry *dest = eigrp_topology_table_lookup_ipv4( struct eigrp_prefix_entry *dest =
eigrp->topology_table, dest_addr); eigrp_topology_table_lookup_ipv4(eigrp->topology_table, dest_addr);
/*if exists it comes to DUAL*/ /*if exists it comes to DUAL*/
if (dest != NULL) if (dest != NULL)
@ -518,7 +518,8 @@ eigrp_update_send_init (struct eigrp_neighbor *nbr)
nbr->recv_sequence_number); nbr->recv_sequence_number);
// encode Authentication TLV, if needed // 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((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
{ {
length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei); length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei);
eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_INIT_FLAG); eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_INIT_FLAG);
@ -550,7 +551,7 @@ void
eigrp_update_send_EOT (struct eigrp_neighbor *nbr) eigrp_update_send_EOT (struct eigrp_neighbor *nbr)
{ {
struct eigrp_packet *ep; struct eigrp_packet *ep;
// struct eigrp_packet *ep_multicast; // struct eigrp_packet *ep_multicast;
u_int16_t length = EIGRP_HEADER_LEN; u_int16_t length = EIGRP_HEADER_LEN;
struct eigrp_neighbor_entry *te; struct eigrp_neighbor_entry *te;
struct eigrp_prefix_entry *pe; struct eigrp_prefix_entry *pe;
@ -626,7 +627,8 @@ eigrp_update_send_EOT (struct eigrp_neighbor *nbr)
} }
} }
if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL)) if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
{ {
eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG); eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG);
} }
@ -651,7 +653,6 @@ eigrp_update_send_EOT (struct eigrp_neighbor *nbr)
{ {
eigrp_send_packet_reliably(nbr); eigrp_send_packet_reliably(nbr);
} }
} }
void void
@ -678,7 +679,8 @@ eigrp_update_send (struct eigrp_interface *ei)
ei->eigrp->sequence_number, 0); ei->eigrp->sequence_number, 0);
// encode Authentication TLV, if needed // 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((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
{ {
length += eigrp_add_authTLV_MD5_to_stream(ep->s,ei); length += eigrp_add_authTLV_MD5_to_stream(ep->s,ei);
} }
@ -774,7 +776,6 @@ eigrp_update_send (struct eigrp_interface *ei)
void void
eigrp_update_send_all (struct eigrp *eigrp, struct eigrp_interface *exception) eigrp_update_send_all (struct eigrp *eigrp, struct eigrp_interface *exception)
{ {
struct eigrp_interface *iface; struct eigrp_interface *iface;
struct listnode *node, *node2, *nnode2; struct listnode *node, *node2, *nnode2;
struct eigrp_prefix_entry *pe; struct eigrp_prefix_entry *pe;
@ -882,14 +883,14 @@ eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
nbr->recv_sequence_number); nbr->recv_sequence_number);
// encode Authentication TLV, if needed // 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((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
{ {
length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei); length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei);
} }
for (ALL_LIST_ELEMENTS(nbr->ei->eigrp->topology_table, node, nnode, pe)) for (ALL_LIST_ELEMENTS(nbr->ei->eigrp->topology_table, node, nnode, pe))
{ {
/* /*
* Filtering * Filtering
*/ */
@ -902,7 +903,6 @@ eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
alist_i = nbr->ei->list[EIGRP_FILTER_OUT]; alist_i = nbr->ei->list[EIGRP_FILTER_OUT];
plist_i = nbr->ei->prefix[EIGRP_FILTER_OUT]; plist_i = nbr->ei->prefix[EIGRP_FILTER_OUT];
/* Check if any list fits */ /* Check if any list fits */
if ((alist && access_list_apply (alist, if ((alist && access_list_apply (alist,
(struct prefix *) dest_addr) == FILTER_DENY)|| (struct prefix *) dest_addr) == FILTER_DENY)||
@ -924,14 +924,11 @@ eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
send_prefixes++; send_prefixes++;
} }
alist = e->list[EIGRP_FILTER_IN]; alist = e->list[EIGRP_FILTER_IN];
plist = e->prefix[EIGRP_FILTER_IN]; plist = e->prefix[EIGRP_FILTER_IN];
alist_i = nbr->ei->list[EIGRP_FILTER_IN]; alist_i = nbr->ei->list[EIGRP_FILTER_IN];
plist_i = nbr->ei->prefix[EIGRP_FILTER_IN]; plist_i = nbr->ei->prefix[EIGRP_FILTER_IN];
/* Check if any list fits */ /* Check if any list fits */
if ((alist && access_list_apply (alist, if ((alist && access_list_apply (alist,
(struct prefix *) dest_addr) == FILTER_DENY)|| (struct prefix *) dest_addr) == FILTER_DENY)||
@ -955,7 +952,6 @@ eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
tlv_max->destination = pe->destination_ipv4->prefix; tlv_max->destination = pe->destination_ipv4->prefix;
tlv_max->prefix_length = pe->destination_ipv4->prefixlen; tlv_max->prefix_length = pe->destination_ipv4->prefixlen;
/* prepare message for FSM */ /* prepare message for FSM */
struct eigrp_fsm_action_message *fsm_msg; struct eigrp_fsm_action_message *fsm_msg;
fsm_msg = XCALLOC(MTYPE_EIGRP_FSM_MSG, fsm_msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
@ -995,7 +991,8 @@ eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
} }
/* compute Auth digest */ /* compute Auth digest */
if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL)) if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
{ {
eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG); eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG);
} }
@ -1013,7 +1010,6 @@ eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
zlog_debug("Enqueuing Update Init Len [%u] Seq [%u] Dest [%s]", zlog_debug("Enqueuing Update Init Len [%u] Seq [%u] Dest [%s]",
ep->length, ep->sequence_number, inet_ntoa(ep->dst)); ep->length, ep->sequence_number, inet_ntoa(ep->dst));
/*Put packet to retransmission queue*/ /*Put packet to retransmission queue*/
eigrp_fifo_push_head(nbr->retrans_queue, ep); eigrp_fifo_push_head(nbr->retrans_queue, ep);
@ -1175,5 +1171,3 @@ eigrp_update_send_process_GR (struct eigrp *eigrp, enum GR_type gr_type, struct
eigrp_update_send_interface_GR(ei, gr_type, vty); eigrp_update_send_interface_GR(ei, gr_type, vty);
} }
} }

View File

@ -56,7 +56,6 @@
#include "eigrpd/eigrp_dump.h" #include "eigrpd/eigrp_dump.h"
#include "eigrpd/eigrp_const.h" #include "eigrpd/eigrp_const.h"
static int static int
config_write_network (struct vty *vty, struct eigrp *eigrp) config_write_network (struct vty *vty, struct eigrp *eigrp)
{ {
@ -197,7 +196,6 @@ DEFUN_NOSH (router_eigrp,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (no_router_eigrp, DEFUN (no_router_eigrp,
no_router_eigrp_cmd, no_router_eigrp_cmd,
"no router eigrp (1-65535)", "no router eigrp (1-65535)",
@ -337,7 +335,7 @@ DEFUN (eigrp_network,
"Enable routing on an IP network\n" "Enable routing on an IP network\n"
"EIGRP network prefix\n") "EIGRP network prefix\n")
{ {
VTY_DECLVAR_CONTEXT(eigrp, eigrp) VTY_DECLVAR_CONTEXT(eigrp, eigrp);
struct prefix_ipv4 p; struct prefix_ipv4 p;
int ret; int ret;
@ -750,8 +748,6 @@ DEFUN (no_eigrp_if_ip_hellointerval,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (eigrp_if_ip_holdinterval, DEFUN (eigrp_if_ip_holdinterval,
eigrp_if_ip_holdinterval_cmd, eigrp_if_ip_holdinterval_cmd,
"ip hold-time eigrp (1-65535)", "ip hold-time eigrp (1-65535)",
@ -878,7 +874,6 @@ str2auth_type (const char *str, struct interface *ifp)
} }
return CMD_WARNING; return CMD_WARNING;
} }
DEFUN (eigrp_authentication_mode, DEFUN (eigrp_authentication_mode,
@ -902,10 +897,10 @@ DEFUN (eigrp_authentication_mode,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
// if(strncmp(argv[2], "md5",3)) // if(strncmp(argv[2], "md5",3))
// IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_MD5; // IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_MD5;
// else if(strncmp(argv[2], "hmac-sha-256",12)) // else if(strncmp(argv[2], "hmac-sha-256",12))
// IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_SHA256; // IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_SHA256;
return str2auth_type(argv[5]->arg, ifp); return str2auth_type(argv[5]->arg, ifp);
} }
@ -996,7 +991,8 @@ DEFUN (no_eigrp_authentication_keychain,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
if((IF_DEF_PARAMS (ifp)->auth_keychain != NULL) && (strcmp(IF_DEF_PARAMS (ifp)->auth_keychain,argv[5]->arg)==0)) 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); free (IF_DEF_PARAMS (ifp)->auth_keychain);
IF_DEF_PARAMS (ifp)->auth_keychain = NULL; IF_DEF_PARAMS (ifp)->auth_keychain = NULL;
@ -1007,7 +1003,6 @@ DEFUN (no_eigrp_authentication_keychain,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (eigrp_redistribute_source_metric, DEFUN (eigrp_redistribute_source_metric,
eigrp_redistribute_source_metric_cmd, eigrp_redistribute_source_metric_cmd,
"redistribute " FRR_REDIST_STR_EIGRPD "redistribute " FRR_REDIST_STR_EIGRPD
@ -1037,7 +1032,6 @@ DEFUN (eigrp_redistribute_source_metric,
return eigrp_redistribute_set (eigrp, source, metrics_from_command); return eigrp_redistribute_set (eigrp, source, metrics_from_command);
} }
DEFUN (no_eigrp_redistribute_source_metric, DEFUN (no_eigrp_redistribute_source_metric,
no_eigrp_redistribute_source_metric_cmd, no_eigrp_redistribute_source_metric_cmd,
"no redistribute " FRR_REDIST_STR_EIGRPD "no redistribute " FRR_REDIST_STR_EIGRPD
@ -1091,7 +1085,6 @@ DEFUN (eigrp_variance,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (no_eigrp_variance, DEFUN (no_eigrp_variance,
no_eigrp_variance_cmd, no_eigrp_variance_cmd,
"no variance (1-128)", "no variance (1-128)",
@ -1139,7 +1132,6 @@ DEFUN (eigrp_maximum_paths,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (no_eigrp_maximum_paths, DEFUN (no_eigrp_maximum_paths,
no_eigrp_maximum_paths_cmd, no_eigrp_maximum_paths_cmd,
"no maximum-paths <1-32>", "no maximum-paths <1-32>",
@ -1527,8 +1519,6 @@ eigrp_vty_if_init (void)
/*EIGRP Summarization commands*/ /*EIGRP Summarization commands*/
install_element (INTERFACE_NODE, &eigrp_ip_summary_address_cmd); install_element (INTERFACE_NODE, &eigrp_ip_summary_address_cmd);
install_element (INTERFACE_NODE, &no_eigrp_ip_summary_address_cmd); install_element (INTERFACE_NODE, &no_eigrp_ip_summary_address_cmd);
} }
static void static void
@ -1536,7 +1526,6 @@ eigrp_vty_zebra_init (void)
{ {
install_element (EIGRP_NODE, &eigrp_redistribute_source_metric_cmd); install_element (EIGRP_NODE, &eigrp_redistribute_source_metric_cmd);
install_element (EIGRP_NODE, &no_eigrp_redistribute_source_metric_cmd); install_element (EIGRP_NODE, &no_eigrp_redistribute_source_metric_cmd);
} }
/* Install EIGRP related vty commands. */ /* Install EIGRP related vty commands. */

View File

@ -332,7 +332,7 @@ eigrp_interface_state_up (int command, struct zclient *zclient,
zlog_debug ("Zebra: Interface[%s] bandwidth change %d -> %d.", zlog_debug ("Zebra: Interface[%s] bandwidth change %d -> %d.",
ifp->name, if_tmp.bandwidth, ifp->bandwidth); ifp->name, if_tmp.bandwidth, ifp->bandwidth);
// eigrp_if_recalculate_output_cost (ifp); // eigrp_if_recalculate_output_cost (ifp);
} }
if (if_tmp.mtu != ifp->mtu) if (if_tmp.mtu != ifp->mtu)
@ -512,10 +512,10 @@ eigrp_redistribute_set (struct eigrp *eigrp, int type, struct eigrp_metrics metr
eigrp_external_routes_refresh (eigrp, type); eigrp_external_routes_refresh (eigrp, type);
// if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) // if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE))
// zlog_debug ("Redistribute[%s]: Refresh Type[%d], Metric[%d]", // zlog_debug ("Redistribute[%s]: Refresh Type[%d], Metric[%d]",
// eigrp_redist_string(type), // eigrp_redist_string(type),
// metric_type (eigrp, type), metric_value (eigrp, type)); // metric_type (eigrp, type), metric_value (eigrp, type));
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -524,10 +524,10 @@ eigrp_redistribute_set (struct eigrp *eigrp, int type, struct eigrp_metrics metr
zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient,
AFI_IP, type, 0, VRF_DEFAULT); AFI_IP, type, 0, VRF_DEFAULT);
// if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE)) // if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE))
// zlog_debug ("Redistribute[%s]: Start Type[%d], Metric[%d]", // zlog_debug ("Redistribute[%s]: Start Type[%d], Metric[%d]",
// ospf_redist_string(type), // ospf_redist_string(type),
// metric_type (ospf, type), metric_value (ospf, type)); // metric_type (ospf, type), metric_value (ospf, type));
++eigrp->redistribute; ++eigrp->redistribute;
@ -546,10 +546,10 @@ eigrp_redistribute_unset (struct eigrp *eigrp, int type)
--eigrp->redistribute; --eigrp->redistribute;
} }
// if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE)) // if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE))
// zlog_debug ("Redistribute[%s]: Start Type[%d], Metric[%d]", // zlog_debug ("Redistribute[%s]: Start Type[%d], Metric[%d]",
// ospf_redist_string(type), // ospf_redist_string(type),
// metric_type (ospf, type), metric_value (ospf, type)); // metric_type (ospf, type), metric_value (ospf, type));
return CMD_SUCCESS; return CMD_SUCCESS;
} }

View File

@ -114,8 +114,8 @@ eigrp_router_id_update (struct eigrp *eigrp)
eigrp->router_id = router_id; eigrp->router_id = router_id;
if (router_id_old != router_id) if (router_id_old != router_id)
{ {
// if (IS_DEBUG_EIGRP_EVENT) // if (IS_DEBUG_EIGRP_EVENT)
// zlog_debug("Router-ID[NEW:%s]: Update", inet_ntoa(eigrp->router_id)); // zlog_debug("Router-ID[NEW:%s]: Update", inet_ntoa(eigrp->router_id));
/* update eigrp_interface's */ /* update eigrp_interface's */
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp)) for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
@ -137,7 +137,6 @@ eigrp_master_init ()
eigrp_om->start_time = tv.tv_sec; eigrp_om->start_time = tv.tv_sec;
} }
/* Allocate new eigrp structure. */ /* Allocate new eigrp structure. */
static struct eigrp * static struct eigrp *
eigrp_new (const char *AS) eigrp_new (const char *AS)
@ -296,7 +295,6 @@ eigrp_finish_final (struct eigrp *eigrp)
eigrp_delete(eigrp); eigrp_delete(eigrp);
XFREE(MTYPE_EIGRP_TOP,eigrp); XFREE(MTYPE_EIGRP_TOP,eigrp);
} }
/*Look for existing eigrp process*/ /*Look for existing eigrp process*/