summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eigrpd/eigrp_dump.c294
-rw-r--r--eigrpd/eigrp_filter.c331
-rw-r--r--eigrpd/eigrp_fsm.c824
-rw-r--r--eigrpd/eigrp_hello.c253
-rw-r--r--eigrpd/eigrp_interface.c57
-rw-r--r--eigrpd/eigrp_main.c14
-rw-r--r--eigrpd/eigrp_neighbor.c178
-rw-r--r--eigrpd/eigrp_network.c76
-rw-r--r--eigrpd/eigrp_packet.c371
-rw-r--r--eigrpd/eigrp_query.c66
-rw-r--r--eigrpd/eigrp_reply.c98
-rw-r--r--eigrpd/eigrp_routemap.c765
-rw-r--r--eigrpd/eigrp_siaquery.c51
-rw-r--r--eigrpd/eigrp_siareply.c51
-rw-r--r--eigrpd/eigrp_snmp.c2282
-rw-r--r--eigrpd/eigrp_topology.c84
-rw-r--r--eigrpd/eigrp_update.c1138
-rw-r--r--eigrpd/eigrp_vty.c135
-rw-r--r--eigrpd/eigrp_zebra.c82
-rw-r--r--eigrpd/eigrpd.c18
20 files changed, 3512 insertions, 3656 deletions
diff --git a/eigrpd/eigrp_dump.c b/eigrpd/eigrp_dump.c
index fa6839394..21bef48ec 100644
--- a/eigrpd/eigrp_dump.c
+++ b/eigrpd/eigrp_dump.c
@@ -70,175 +70,30 @@ config_write_debug (struct vty *vty)
int write = 0;
int i;
- const char *type_str[] = {"update", "request", "query", "reply", "hello", "", "probe", "ack", "",
- "SIA query", "SIA reply", "stub", "all"};
+ const char *type_str[] = {"update", "request", "query", "reply",
+ "hello", "", "probe", "ack", "",
+ "SIA query", "SIA reply", "stub", "all"};
const char *detail_str[] = {"", " send", " recv", "", " detail",
- " send detail", " recv detail", " detail"};
+ " send detail", " recv detail", " detail"};
/* 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 */
for (i = 0; i < 10; i++)
{
- if (conf_debug_eigrp_packet[i] == 0 && term_debug_eigrp_packet[i] == 0 )
- continue;
+ if (conf_debug_eigrp_packet[i] == 0 && term_debug_eigrp_packet[i] == 0 )
+ continue;
- vty_out (vty, "debug eigrp packet %s%s%s",
- type_str[i], detail_str[conf_debug_eigrp_packet[i]],
- VTY_NEWLINE);
- write = 1;
+ vty_out (vty, "debug eigrp packet %s%s%s",
+ type_str[i], detail_str[conf_debug_eigrp_packet[i]],
+ VTY_NEWLINE);
+ 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;
}
-
static int
eigrp_neighbor_packet_queue_sum (struct eigrp_interface *ei)
{
@@ -282,14 +137,14 @@ void
eigrp_header_dump (struct eigrp_header *eigrph)
{
/* EIGRP Header dump. */
- zlog_debug ("eigrp_version %u", eigrph->version);
- zlog_debug ("eigrp_opcode %u", eigrph->opcode);
- zlog_debug ("eigrp_checksum 0x%x", ntohs(eigrph->checksum));
- zlog_debug ("eigrp_flags 0x%x", ntohl(eigrph->flags));
- zlog_debug ("eigrp_sequence %u", ntohl(eigrph->sequence));
- zlog_debug ("eigrp_ack %u", ntohl(eigrph->ack));
- zlog_debug ("eigrp_vrid %u" , ntohs(eigrph->vrid));
- zlog_debug ("eigrp_AS %u", ntohs(eigrph->ASNumber));
+ zlog_debug ("eigrp_version %u", eigrph->version);
+ zlog_debug ("eigrp_opcode %u", eigrph->opcode);
+ zlog_debug ("eigrp_checksum 0x%x", ntohs(eigrph->checksum));
+ zlog_debug ("eigrp_flags 0x%x", ntohl(eigrph->flags));
+ zlog_debug ("eigrp_sequence %u", ntohl(eigrph->sequence));
+ zlog_debug ("eigrp_ack %u", ntohl(eigrph->ack));
+ zlog_debug ("eigrp_vrid %u", ntohs(eigrph->vrid));
+ zlog_debug ("eigrp_AS %u", ntohs(eigrph->ASNumber));
}
const char *
@@ -368,28 +223,37 @@ show_ip_eigrp_interface_header (struct vty *vty, struct eigrp *eigrp)
void
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, "%-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)->bandwidth);
+ vty_out (vty, "%-11u", IF_DEF_PARAMS (ei->ifp)->delay);
vty_out (vty, "%-7u", ei->nbrs->count);
- vty_out (vty, "%u %c %-10u",0,'/',eigrp_neighbor_packet_queue_sum (ei));
- vty_out (vty, "%-7u %-14u %-12u %-8u",0,0,0,0);
- vty_out (vty, "%-8u %-8u %s",IF_DEF_PARAMS (ei->ifp)->v_hello,IF_DEF_PARAMS (ei->ifp)->v_wait,VTY_NEWLINE);
+ vty_out (vty, "%u %c %-10u",0,'/', eigrp_neighbor_packet_queue_sum (ei));
+ vty_out (vty, "%-7u %-14u %-12u %-8u", 0, 0, 0, 0);
+ vty_out (vty, "%-8u %-8u %s",
+ IF_DEF_PARAMS (ei->ifp)->v_hello,
+ IF_DEF_PARAMS (ei->ifp)->v_wait,VTY_NEWLINE);
}
void
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 %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","","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);
+ 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 %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",
+ "", "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
@@ -405,23 +269,24 @@ show_ip_eigrp_neighbor_header (struct vty *vty, struct eigrp *eigrp)
void
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,"%-7lu",thread_timer_remain_second (nbr->t_holddown));
- vty_out (vty,"%-8u %-6u %-5u",0,0,EIGRP_PACKET_RETRANS_TIME);
- vty_out (vty,"%-7lu",nbr->retrans_queue->count);
- vty_out (vty,"%u%s",nbr->recv_sequence_number,VTY_NEWLINE);
+ vty_out (vty, "%-3u %-17s %-21s", 0,
+ eigrp_neigh_ip_string (nbr), eigrp_if_name_string (nbr->ei));
+ vty_out (vty,"%-7lu", thread_timer_remain_second (nbr->t_holddown));
+ vty_out (vty,"%-8u %-6u %-5u", 0, 0, EIGRP_PACKET_RETRANS_TIME);
+ vty_out (vty,"%-7lu", nbr->retrans_queue->count);
+ vty_out (vty,"%u%s", nbr->recv_sequence_number, VTY_NEWLINE);
if (detail)
{
vty_out(vty," Version %u.%u/%u.%u",
- nbr->os_rel_major, nbr->os_rel_minor,
- nbr->tlv_rel_major, nbr->tlv_rel_minor);
+ nbr->os_rel_major, nbr->os_rel_minor,
+ nbr->tlv_rel_major, nbr->tlv_rel_minor);
vty_out(vty,", Retrans: %lu, Retries: %lu",
- nbr->retrans_queue->count, 0UL);
+ nbr->retrans_queue->count, 0UL);
vty_out(vty,", %s%s", eigrp_nbr_state_str(nbr), VTY_NEWLINE);
}
}
@@ -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, "%u successors, ",eigrp_topology_get_successor(tn)->count);
vty_out (vty, "FD is %u, serno: %lu %s",tn->fdistance, tn->serno, VTY_NEWLINE);
-
}
void
show_ip_eigrp_neighbor_entry (struct vty *vty, struct eigrp *eigrp, struct eigrp_neighbor_entry *te)
{
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
{
- 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);
}
}
@@ -481,39 +349,39 @@ DEFUN (show_debugging_eigrp,
/* Show debug status for EIGRP Packets. */
for (i = 0; i < 11 ; i++)
- {
+ {
if (i == 8)
continue;
- if (IS_DEBUG_EIGRP_PACKET (i, SEND) && IS_DEBUG_EIGRP_PACKET (i, RECV))
- {
- vty_out (vty, " EIGRP packet %s%s debugging is on%s",
- LOOKUP (eigrp_packet_type_str, i + 1),
- IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "",
- VTY_NEWLINE);
- }
- else
- {
- if (IS_DEBUG_EIGRP_PACKET (i, SEND))
- vty_out (vty, " EIGRP packet %s send%s debugging is on%s",
- LOOKUP (eigrp_packet_type_str, i + 1),
- IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "",
- VTY_NEWLINE);
- if (IS_DEBUG_EIGRP_PACKET (i, RECV))
- vty_out (vty, " EIGRP packet %s receive%s debugging is on%s",
- LOOKUP (eigrp_packet_type_str, i + 1),
- IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "",
- VTY_NEWLINE);
- }
- }
+ if (IS_DEBUG_EIGRP_PACKET (i, SEND) && IS_DEBUG_EIGRP_PACKET (i, RECV))
+ {
+ vty_out (vty, " EIGRP packet %s%s debugging is on%s",
+ LOOKUP (eigrp_packet_type_str, i + 1),
+ IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "",
+ VTY_NEWLINE);
+ }
+ else
+ {
+ if (IS_DEBUG_EIGRP_PACKET (i, SEND))
+ vty_out (vty, " EIGRP packet %s send%s debugging is on%s",
+ LOOKUP (eigrp_packet_type_str, i + 1),
+ IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "",
+ VTY_NEWLINE);
+ if (IS_DEBUG_EIGRP_PACKET (i, RECV))
+ vty_out (vty, " EIGRP packet %s receive%s debugging is on%s",
+ LOOKUP (eigrp_packet_type_str, i + 1),
+ IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "",
+ VTY_NEWLINE);
+ }
+ }
return CMD_SUCCESS;
}
/*
- [no] debug eigrp packet (hello|dd|ls-request|ls-update|ls-ack|all)
- [send|recv [detail]]
+ [no] debug eigrp packet (hello|dd|ls-request|ls-update|ls-ack|all)
+ [send|recv [detail]]
*/
DEFUN (debug_eigrp_transmit,
diff --git a/eigrpd/eigrp_filter.c b/eigrpd/eigrp_filter.c
index b36d0fbc9..236c53acf 100644
--- a/eigrpd/eigrp_filter.c
+++ b/eigrpd/eigrp_filter.c
@@ -79,111 +79,111 @@ eigrp_distribute_update (struct distribute *dist)
/* Check if distribute-list was set for process or interface */
if (! dist->ifname)
{
- /* access list IN for whole process */
- if (dist->list[DISTRIBUTE_V4_IN])
- {
- alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_V4_IN]);
- zlog_info("<DEBUG DISTRIBUTE ACL IN FOUND: %s",alist->name);
- if (alist)
- e->list[EIGRP_FILTER_IN] = alist;
- else
- e->list[EIGRP_FILTER_IN] = NULL;
- }
- else
- {
- e->list[EIGRP_FILTER_IN] = NULL;
- }
-
- /* access list OUT for whole process */
- if (dist->list[DISTRIBUTE_V4_OUT])
- {
- zlog_info("<DEBUG DISTRIBUTE ACL OUT FOUND: %s",dist->list[DISTRIBUTE_V4_OUT]);
- alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_V4_OUT]);
- if (alist)
- e->list[EIGRP_FILTER_OUT] = alist;
- else
- e->list[EIGRP_FILTER_OUT] = NULL;
- }
- else
- {
- e->list[EIGRP_FILTER_OUT] = NULL;
- }
-
- /* PREFIX_LIST IN for process */
- if (dist->prefix[DISTRIBUTE_V4_IN])
- {
- zlog_info("<DEBUG DISTRIBUTE PREFIX IN FOUND: %s",dist->prefix[DISTRIBUTE_V4_IN]);
- plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_IN]);
- if (plist)
- {
- e->prefix[EIGRP_FILTER_IN] = plist;
- }
- else
- e->prefix[EIGRP_FILTER_IN] = NULL;
- } else
- e->prefix[EIGRP_FILTER_IN] = NULL;
-
- /* PREFIX_LIST OUT for process */
- if (dist->prefix[DISTRIBUTE_V4_OUT])
- {
- zlog_info("<DEBUG DISTRIBUTE PREFIX OUT FOUND: %s",dist->prefix[DISTRIBUTE_V4_OUT]);
- plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_OUT]);
- if (plist)
- {
- e->prefix[EIGRP_FILTER_OUT] = plist;
-
- }
- else
- e->prefix[EIGRP_FILTER_OUT] = NULL;
- }
- else
- e->prefix[EIGRP_FILTER_OUT] = NULL;
-
- //This is commented out, because the distribute.[ch] code
- //changes looked poorly written from first glance
- //commit was 133bdf2d
- //TODO: DBS
+ /* access list IN for whole process */
+ if (dist->list[DISTRIBUTE_V4_IN])
+ {
+ alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_V4_IN]);
+ zlog_info("<DEBUG DISTRIBUTE ACL IN FOUND: %s",alist->name);
+ if (alist)
+ e->list[EIGRP_FILTER_IN] = alist;
+ else
+ e->list[EIGRP_FILTER_IN] = NULL;
+ }
+ else
+ {
+ e->list[EIGRP_FILTER_IN] = NULL;
+ }
+
+ /* access list OUT for whole process */
+ if (dist->list[DISTRIBUTE_V4_OUT])
+ {
+ zlog_info("<DEBUG DISTRIBUTE ACL OUT FOUND: %s",dist->list[DISTRIBUTE_V4_OUT]);
+ alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_V4_OUT]);
+ if (alist)
+ e->list[EIGRP_FILTER_OUT] = alist;
+ else
+ e->list[EIGRP_FILTER_OUT] = NULL;
+ }
+ else
+ {
+ e->list[EIGRP_FILTER_OUT] = NULL;
+ }
+
+ /* PREFIX_LIST IN for process */
+ if (dist->prefix[DISTRIBUTE_V4_IN])
+ {
+ zlog_info("<DEBUG DISTRIBUTE PREFIX IN FOUND: %s",dist->prefix[DISTRIBUTE_V4_IN]);
+ plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_IN]);
+ if (plist)
+ {
+ e->prefix[EIGRP_FILTER_IN] = plist;
+ }
+ else
+ e->prefix[EIGRP_FILTER_IN] = NULL;
+ } else
+ e->prefix[EIGRP_FILTER_IN] = NULL;
+
+ /* PREFIX_LIST OUT for process */
+ if (dist->prefix[DISTRIBUTE_V4_OUT])
+ {
+ zlog_info("<DEBUG DISTRIBUTE PREFIX OUT FOUND: %s",dist->prefix[DISTRIBUTE_V4_OUT]);
+ plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_OUT]);
+ if (plist)
+ {
+ e->prefix[EIGRP_FILTER_OUT] = plist;
+
+ }
+ else
+ e->prefix[EIGRP_FILTER_OUT] = NULL;
+ }
+ else
+ e->prefix[EIGRP_FILTER_OUT] = NULL;
+
+ //This is commented out, because the distribute.[ch] code
+ //changes looked poorly written from first glance
+ //commit was 133bdf2d
+ //TODO: DBS
#if 0
- /* route-map IN for whole process */
- if (dist->route[DISTRIBUTE_V4_IN])
- {
- routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_IN]);
- if (routemap)
- e->routemap[EIGRP_FILTER_IN] = routemap;
- else
- e->routemap[EIGRP_FILTER_IN] = NULL;
- }
- else
- {
- e->routemap[EIGRP_FILTER_IN] = NULL;
- }
-
- /* route-map OUT for whole process */
- if (dist->route[DISTRIBUTE_V4_OUT])
- {
- routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_OUT]);
- if (routemap)
- e->routemap[EIGRP_FILTER_OUT] = routemap;
- else
- e->routemap[EIGRP_FILTER_OUT] = NULL;
- }
- else
- {
- e->routemap[EIGRP_FILTER_OUT] = NULL;
- }
+ /* route-map IN for whole process */
+ if (dist->route[DISTRIBUTE_V4_IN])
+ {
+ routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_IN]);
+ if (routemap)
+ e->routemap[EIGRP_FILTER_IN] = routemap;
+ else
+ e->routemap[EIGRP_FILTER_IN] = NULL;
+ }
+ else
+ {
+ e->routemap[EIGRP_FILTER_IN] = NULL;
+ }
+
+ /* route-map OUT for whole process */
+ if (dist->route[DISTRIBUTE_V4_OUT])
+ {
+ routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_OUT]);
+ if (routemap)
+ e->routemap[EIGRP_FILTER_OUT] = routemap;
+ else
+ e->routemap[EIGRP_FILTER_OUT] = NULL;
+ }
+ else
+ {
+ e->routemap[EIGRP_FILTER_OUT] = NULL;
+ }
#endif
- //TODO: check Graceful restart after 10sec
-
- /* check if there is already GR scheduled */
- if(e->t_distribute != NULL)
- {
- /* if is, cancel schedule */
- thread_cancel(e->t_distribute);
- }
- /* schedule Graceful restart for whole process in 10sec */
- e->t_distribute = thread_add_timer(master, eigrp_distribute_timer_process, e,(10));
-
- return;
+ //TODO: check Graceful restart after 10sec
+
+ /* check if there is already GR scheduled */
+ if(e->t_distribute != NULL)
+ {
+ /* if is, cancel schedule */
+ thread_cancel(e->t_distribute);
+ }
+ /* schedule Graceful restart for whole process in 10sec */
+ e->t_distribute = thread_add_timer(master, eigrp_distribute_timer_process, e,(10));
+
+ return;
}
ifp = if_lookup_by_name (dist->ifname, VRF_DEFAULT);
@@ -199,27 +199,27 @@ eigrp_distribute_update (struct distribute *dist)
/* Find proper interface */
for (ALL_LIST_ELEMENTS (e->eiflist, node, nnode, ei2))
{
- if(strcmp(ei2->ifp->name,ifp->name) == 0){
- ei = ei2;
- break;
- }
+ if(strcmp(ei2->ifp->name,ifp->name) == 0){
+ ei = ei2;
+ break;
+ }
}
if(ei == NULL)
- {
- zlog_info("Not Found eigrp interface %s",ifp->name);
- }
+ {
+ zlog_info("Not Found eigrp interface %s",ifp->name);
+ }
/* Access-list for interface in */
if (dist->list[DISTRIBUTE_V4_IN])
{
- zlog_info("<DEBUG ACL in");
+ zlog_info("<DEBUG ACL in");
alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_V4_IN]);
if (alist){
ei->list[EIGRP_FILTER_IN] = alist;
}
else
- ei->list[EIGRP_FILTER_IN] = NULL;
+ ei->list[EIGRP_FILTER_IN] = NULL;
}
else
{
@@ -231,25 +231,25 @@ eigrp_distribute_update (struct distribute *dist)
{
alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_V4_OUT]);
if (alist)
- ei->list[EIGRP_FILTER_OUT] = alist;
+ ei->list[EIGRP_FILTER_OUT] = alist;
else
- ei->list[EIGRP_FILTER_OUT] = NULL;
+ ei->list[EIGRP_FILTER_OUT] = NULL;
}
else
- {
- ei->list[EIGRP_FILTER_OUT] = NULL;
- zlog_info("<DEBUG ACL out else");
- }
+ {
+ ei->list[EIGRP_FILTER_OUT] = NULL;
+ zlog_info("<DEBUG ACL out else");
+ }
/* Prefix-list for interface in */
if (dist->prefix[DISTRIBUTE_V4_IN])
{
plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_IN]);
if (plist)
- ei->prefix[EIGRP_FILTER_IN] = plist;
+ ei->prefix[EIGRP_FILTER_IN] = plist;
else
- ei->prefix[EIGRP_FILTER_IN] = NULL;
+ ei->prefix[EIGRP_FILTER_IN] = NULL;
}
else
ei->prefix[EIGRP_FILTER_IN] = NULL;
@@ -259,9 +259,9 @@ eigrp_distribute_update (struct distribute *dist)
{
plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_OUT]);
if (plist)
- ei->prefix[EIGRP_FILTER_OUT] = plist;
+ ei->prefix[EIGRP_FILTER_OUT] = plist;
else
- ei->prefix[EIGRP_FILTER_OUT] = NULL;
+ ei->prefix[EIGRP_FILTER_OUT] = NULL;
}
else
ei->prefix[EIGRP_FILTER_OUT] = NULL;
@@ -269,44 +269,43 @@ eigrp_distribute_update (struct distribute *dist)
#if 0
/* route-map IN for whole process */
if (dist->route[DISTRIBUTE_V4_IN])
- {
- zlog_info("<DEBUG ACL ALL in");
- routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_IN]);
- if (routemap)
- ei->routemap[EIGRP_FILTER_IN] = routemap;
- else
- ei->routemap[EIGRP_FILTER_IN] = NULL;
- }
+ {
+ zlog_info("<DEBUG ACL ALL in");
+ routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_IN]);
+ if (routemap)
+ ei->routemap[EIGRP_FILTER_IN] = routemap;
+ else
+ ei->routemap[EIGRP_FILTER_IN] = NULL;
+ }
else
- {
- ei->routemap[EIGRP_FILTER_IN] = NULL;
- }
+ {
+ ei->routemap[EIGRP_FILTER_IN] = NULL;
+ }
/* route-map OUT for whole process */
if (dist->route[DISTRIBUTE_V4_OUT])
- {
- routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_OUT]);
- if (routemap)
- ei->routemap[EIGRP_FILTER_OUT] = routemap;
- else
- ei->routemap[EIGRP_FILTER_OUT] = NULL;
- }
+ {
+ routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_OUT]);
+ if (routemap)
+ ei->routemap[EIGRP_FILTER_OUT] = routemap;
+ else
+ ei->routemap[EIGRP_FILTER_OUT] = NULL;
+ }
else
- {
- ei->routemap[EIGRP_FILTER_OUT] = NULL;
- }
+ {
+ ei->routemap[EIGRP_FILTER_OUT] = NULL;
+ }
#endif
//TODO: check Graceful restart after 10sec
/* check if there is already GR scheduled */
if(ei->t_distribute != NULL)
- {
- /* if is, cancel schedule */
- thread_cancel(ei->t_distribute);
- }
+ {
+ /* if is, cancel schedule */
+ thread_cancel(ei->t_distribute);
+ }
/* 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);
}
/*
@@ -341,15 +340,15 @@ eigrp_distribute_update_all (struct prefix_list *notused)
void
eigrp_distribute_update_all_wrapper(struct access_list *notused)
{
- eigrp_distribute_update_all(NULL);
+ eigrp_distribute_update_all(NULL);
}
/*
* @fn eigrp_distribute_timer_process
*
- * @param[in] thread current execution thread timer is associated with
+ * @param[in] thread current execution thread timer is associated with
*
- * @return int always returns 0
+ * @return int always returns 0
*
* @par
* Called when 10sec waiting time expire and
@@ -358,23 +357,23 @@ eigrp_distribute_update_all_wrapper(struct access_list *notused)
int
eigrp_distribute_timer_process (struct thread *thread)
{
- struct eigrp *eigrp;
+ struct eigrp *eigrp;
- eigrp = THREAD_ARG(thread);
- eigrp->t_distribute = NULL;
+ eigrp = THREAD_ARG(thread);
+ eigrp->t_distribute = NULL;
- /* execute GR for whole process */
- eigrp_update_send_process_GR(eigrp, EIGRP_GR_FILTER, NULL);
+ /* execute GR for whole process */
+ eigrp_update_send_process_GR(eigrp, EIGRP_GR_FILTER, NULL);
- return 0;
+ return 0;
}
/*
* @fn eigrp_distribute_timer_interface
*
- * @param[in] thread current execution thread timer is associated with
+ * @param[in] thread current execution thread timer is associated with
*
- * @return int always returns 0
+ * @return int always returns 0
*
* @par
* Called when 10sec waiting time expire and
@@ -383,13 +382,13 @@ eigrp_distribute_timer_process (struct thread *thread)
int
eigrp_distribute_timer_interface (struct thread *thread)
{
- struct eigrp_interface *ei;
+ struct eigrp_interface *ei;
- ei = THREAD_ARG(thread);
- ei->t_distribute = NULL;
+ ei = THREAD_ARG(thread);
+ ei->t_distribute = NULL;
- /* execute GR for interface */
- eigrp_update_send_interface_GR(ei, EIGRP_GR_FILTER, NULL);
+ /* execute GR for interface */
+ eigrp_update_send_interface_GR(ei, EIGRP_GR_FILTER, NULL);
- return 0;
+ return 0;
}
diff --git a/eigrpd/eigrp_fsm.c b/eigrpd/eigrp_fsm.c
index 06ff09aa1..dc62edb68 100644
--- a/eigrpd/eigrp_fsm.c
+++ b/eigrpd/eigrp_fsm.c
@@ -93,22 +93,14 @@
/*
* Prototypes
*/
-int
-eigrp_fsm_event_keep_state(struct eigrp_fsm_action_message *);
-int
-eigrp_fsm_event_nq_fcn(struct eigrp_fsm_action_message *);
-int
-eigrp_fsm_event_q_fcn(struct eigrp_fsm_action_message *);
-int
-eigrp_fsm_event_lr(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 *);
+int eigrp_fsm_event_keep_state(struct eigrp_fsm_action_message *);
+int eigrp_fsm_event_nq_fcn(struct eigrp_fsm_action_message *);
+int eigrp_fsm_event_q_fcn(struct eigrp_fsm_action_message *);
+int eigrp_fsm_event_lr(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 *);
//---------------------------------------------------------------------
@@ -120,59 +112,58 @@ eigrp_fsm_event_qact(struct eigrp_fsm_action_message *);
* Functions are should be executed within separate thread.
*/
struct {
- int
- (*func)(struct eigrp_fsm_action_message *);
+ int
+ (*func)(struct eigrp_fsm_action_message *);
} NSM[EIGRP_FSM_STATE_MAX][EIGRP_FSM_EVENT_MAX] = { {
-//PASSIVE STATE
- { eigrp_fsm_event_nq_fcn }, /* Event 0 */
- { eigrp_fsm_event_keep_state }, /* Event 1 */
- { eigrp_fsm_event_q_fcn }, /* Event 2 */
- { eigrp_fsm_event_keep_state }, /* Event 3 */
- { eigrp_fsm_event_keep_state }, /* Event 4 */
- { eigrp_fsm_event_keep_state }, /* Event 5 */
- { eigrp_fsm_event_keep_state }, /* Event 6 */
- { eigrp_fsm_event_keep_state }, /* Event 7 */
-}, {
-//Active 0 state
- { eigrp_fsm_event_keep_state }, /* Event 0 */
- { eigrp_fsm_event_keep_state }, /* Event 1 */
- { eigrp_fsm_event_keep_state }, /* Event 2 */
- { eigrp_fsm_event_lr_fcs }, /* Event 3 */
- { eigrp_fsm_event_keep_state }, /* Event 4 */
- { eigrp_fsm_event_qact }, /* Event 5 */
- { eigrp_fsm_event_lr_fcn }, /* Event 6 */
- { eigrp_fsm_event_keep_state }, /* Event 7 */
-
-}, {
-//Active 1 state
- { eigrp_fsm_event_keep_state }, /* Event 0 */
- { eigrp_fsm_event_lr }, /* Event 1 */
- { eigrp_fsm_event_keep_state }, /* Event 2 */
- { eigrp_fsm_event_keep_state }, /* Event 3 */
- { eigrp_fsm_event_dinc }, /* Event 4 */
- { eigrp_fsm_event_qact }, /* Event 5 */
- { eigrp_fsm_event_keep_state }, /* Event 6 */
- { eigrp_fsm_event_keep_state }, /* Event 7 */
-}, {
-//Active 2 state
- { eigrp_fsm_event_keep_state }, /* Event 0 */
- { eigrp_fsm_event_keep_state }, /* Event 1 */
- { eigrp_fsm_event_keep_state }, /* Event 2 */
- { eigrp_fsm_event_lr_fcs }, /* Event 3 */
- { eigrp_fsm_event_keep_state }, /* Event 4 */
- { eigrp_fsm_event_keep_state }, /* Event 5 */
- { eigrp_fsm_event_lr_fcn }, /* Event 6 */
- { eigrp_fsm_event_keep_state }, /* Event 7 */
-}, {
-//Active 3 state
- { eigrp_fsm_event_keep_state }, /* Event 0 */
- { eigrp_fsm_event_lr }, /* Event 1 */
- { eigrp_fsm_event_keep_state }, /* Event 2 */
- { eigrp_fsm_event_keep_state }, /* Event 3 */
- { eigrp_fsm_event_dinc }, /* Event 4 */
- { eigrp_fsm_event_keep_state }, /* Event 5 */
- { eigrp_fsm_event_keep_state }, /* Event 6 */
- { eigrp_fsm_event_keep_state }, /* Event 7 */
+ //PASSIVE STATE
+ { eigrp_fsm_event_nq_fcn }, /* Event 0 */
+ { eigrp_fsm_event_keep_state }, /* Event 1 */
+ { eigrp_fsm_event_q_fcn }, /* Event 2 */
+ { eigrp_fsm_event_keep_state }, /* Event 3 */
+ { eigrp_fsm_event_keep_state }, /* Event 4 */
+ { eigrp_fsm_event_keep_state }, /* Event 5 */
+ { eigrp_fsm_event_keep_state }, /* Event 6 */
+ { eigrp_fsm_event_keep_state }, /* Event 7 */
+ }, {
+ //Active 0 state
+ { eigrp_fsm_event_keep_state }, /* Event 0 */
+ { eigrp_fsm_event_keep_state }, /* Event 1 */
+ { eigrp_fsm_event_keep_state }, /* Event 2 */
+ { eigrp_fsm_event_lr_fcs }, /* Event 3 */
+ { eigrp_fsm_event_keep_state }, /* Event 4 */
+ { eigrp_fsm_event_qact }, /* Event 5 */
+ { eigrp_fsm_event_lr_fcn }, /* Event 6 */
+ { eigrp_fsm_event_keep_state }, /* Event 7 */
+ }, {
+ //Active 1 state
+ { eigrp_fsm_event_keep_state }, /* Event 0 */
+ { eigrp_fsm_event_lr }, /* Event 1 */
+ { eigrp_fsm_event_keep_state }, /* Event 2 */
+ { eigrp_fsm_event_keep_state }, /* Event 3 */
+ { eigrp_fsm_event_dinc }, /* Event 4 */
+ { eigrp_fsm_event_qact }, /* Event 5 */
+ { eigrp_fsm_event_keep_state }, /* Event 6 */
+ { eigrp_fsm_event_keep_state }, /* Event 7 */
+ }, {
+ //Active 2 state
+ { eigrp_fsm_event_keep_state }, /* Event 0 */
+ { eigrp_fsm_event_keep_state }, /* Event 1 */
+ { eigrp_fsm_event_keep_state }, /* Event 2 */
+ { eigrp_fsm_event_lr_fcs }, /* Event 3 */
+ { eigrp_fsm_event_keep_state }, /* Event 4 */
+ { eigrp_fsm_event_keep_state }, /* Event 5 */
+ { eigrp_fsm_event_lr_fcn }, /* Event 6 */
+ { eigrp_fsm_event_keep_state }, /* Event 7 */
+ }, {
+ //Active 3 state
+ { eigrp_fsm_event_keep_state }, /* Event 0 */
+ { eigrp_fsm_event_lr }, /* Event 1 */
+ { eigrp_fsm_event_keep_state }, /* Event 2 */
+ { eigrp_fsm_event_keep_state }, /* Event 3 */
+ { eigrp_fsm_event_dinc }, /* Event 4 */
+ { eigrp_fsm_event_keep_state }, /* Event 5 */
+ { eigrp_fsm_event_keep_state }, /* Event 6 */
+ { eigrp_fsm_event_keep_state }, /* Event 7 */
}, };
/*
@@ -183,353 +174,416 @@ struct {
* Return number of occurred event (arrow in diagram).
*
*/
-int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg) {
- // Loading base information from message
- //struct eigrp *eigrp = msg->eigrp;
- struct eigrp_prefix_entry *prefix = msg->prefix;
- struct eigrp_neighbor_entry *entry = msg->entry;
- u_char actual_state = prefix->state;
-
- if (entry == NULL) {
- entry = eigrp_neighbor_entry_new();
- entry->adv_router = msg->adv_router;
- entry->ei = msg->adv_router->ei;
- entry->prefix = prefix;
- msg->entry = entry;
- }
-
- // Dividing by actual state of prefix's FSM
- switch (actual_state) {
- case EIGRP_FSM_STATE_PASSIVE: {
- //Calculate resultant metrics and insert to correct position in entries list
- eigrp_topology_update_distance(msg);
-
- struct eigrp_neighbor_entry * head =
- (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);
- if (head->reported_distance < prefix->fdistance) {
- return EIGRP_FSM_KEEP_STATE;
- }
- /*
- * if best entry doesn't satisfy feasibility condition it means move to active state
- * dependently if it was query from successor
- */
- else {
- if (msg->packet_type == EIGRP_OPC_QUERY) {
- return EIGRP_FSM_EVENT_Q_FCN;
- } else {
- return EIGRP_FSM_EVENT_NQ_FCN;
- }
- }
-
- break;
- }
- case EIGRP_FSM_STATE_ACTIVE_0: {
- eigrp_topology_update_distance(msg);
-
- if (msg->packet_type == EIGRP_OPC_REPLY) {
- listnode_delete(prefix->rij, entry->adv_router);
- if (prefix->rij->count) {
- return EIGRP_FSM_KEEP_STATE;
- } else {
- zlog_info("All reply received\n");
- if (((struct eigrp_neighbor_entry *) prefix->entries->head->data)->reported_distance
- < prefix->fdistance) {
- return EIGRP_FSM_EVENT_LR_FCS;
- }
-
- return EIGRP_FSM_EVENT_LR_FCN;
- }
- } else if (msg->packet_type == EIGRP_OPC_QUERY
- && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) {
- return EIGRP_FSM_EVENT_QACT;
- }
-
- return EIGRP_FSM_KEEP_STATE;
-
- break;
- }
- case EIGRP_FSM_STATE_ACTIVE_1: {
- int change = eigrp_topology_update_distance(msg);
-
- if (msg->packet_type == EIGRP_OPC_QUERY
- && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) {
- return EIGRP_FSM_EVENT_QACT;
- } else if (msg->packet_type == EIGRP_OPC_REPLY) {
- listnode_delete(prefix->rij, entry->adv_router);
-
- if (change == 1
- && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) {
- return EIGRP_FSM_EVENT_DINC;
- } else if (prefix->rij->count) {
- return EIGRP_FSM_KEEP_STATE;
- } else {
- zlog_info("All reply received\n");
- return EIGRP_FSM_EVENT_LR;
- }
- } 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_KEEP_STATE;
-
- break;
- }
- case EIGRP_FSM_STATE_ACTIVE_2: {
-
- eigrp_topology_update_distance(msg);
-
- if (msg->packet_type == EIGRP_OPC_REPLY) {
- listnode_delete(prefix->rij, entry->adv_router);
- if (prefix->rij->count) {
- return EIGRP_FSM_KEEP_STATE;
- } else {
- zlog_info("All reply received\n");
- if (((struct eigrp_neighbor_entry *) prefix->entries->head->data)->reported_distance
- < prefix->fdistance) {
- return EIGRP_FSM_EVENT_LR_FCS;
- }
-
- return EIGRP_FSM_EVENT_LR_FCN;
- }
- }
- return EIGRP_FSM_KEEP_STATE;
-
- break;
- }
- case EIGRP_FSM_STATE_ACTIVE_3: {
-
- int change = eigrp_topology_update_distance(msg);
-
- if (msg->packet_type == EIGRP_OPC_REPLY) {
- listnode_delete(prefix->rij, entry->adv_router);
-
- if (change == 1
- && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) {
- return EIGRP_FSM_EVENT_DINC;
- } else if (prefix->rij->count) {
- return EIGRP_FSM_KEEP_STATE;
- } else {
- zlog_info("All reply received\n");
- return EIGRP_FSM_EVENT_LR;
- }
- } 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_KEEP_STATE;
-
- break;
- }
- }
-
- return EIGRP_FSM_KEEP_STATE;
+int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg)
+{
+ // Loading base information from message
+ //struct eigrp *eigrp = msg->eigrp;
+ struct eigrp_prefix_entry *prefix = msg->prefix;
+ struct eigrp_neighbor_entry *entry = msg->entry;
+ u_char actual_state = prefix->state;
+
+ if (entry == NULL)
+ {
+ entry = eigrp_neighbor_entry_new();
+ entry->adv_router = msg->adv_router;
+ entry->ei = msg->adv_router->ei;
+ entry->prefix = prefix;
+ msg->entry = entry;
+ }
+
+ // Dividing by actual state of prefix's FSM
+ switch (actual_state)
+ {
+ case EIGRP_FSM_STATE_PASSIVE:
+ {
+ //Calculate resultant metrics and insert to correct position in entries list
+ eigrp_topology_update_distance(msg);
+
+ struct eigrp_neighbor_entry * head =
+ (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);
+ if (head->reported_distance < prefix->fdistance)
+ {
+ return EIGRP_FSM_KEEP_STATE;
+ }
+ /*
+ * if best entry doesn't satisfy feasibility condition it means move to active state
+ * dependently if it was query from successor
+ */
+ else
+ {
+ if (msg->packet_type == EIGRP_OPC_QUERY)
+ {
+ return EIGRP_FSM_EVENT_Q_FCN;
+ }
+ else
+ {
+ return EIGRP_FSM_EVENT_NQ_FCN;
+ }
+ }
+
+ break;
+ }
+ case EIGRP_FSM_STATE_ACTIVE_0:
+ {
+ eigrp_topology_update_distance(msg);
+
+ if (msg->packet_type == EIGRP_OPC_REPLY) {
+ listnode_delete(prefix->rij, entry->adv_router);
+ if (prefix->rij->count)
+ {
+ return EIGRP_FSM_KEEP_STATE;
+ }
+ else
+ {
+ zlog_info("All reply received\n");
+ if (((struct eigrp_neighbor_entry *) prefix->entries->head->data)->reported_distance
+ < prefix->fdistance)
+ {
+ return EIGRP_FSM_EVENT_LR_FCS;
+ }
+
+ return EIGRP_FSM_EVENT_LR_FCN;
+ }
+ }
+ else if (msg->packet_type == EIGRP_OPC_QUERY
+ && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG))
+ {
+ return EIGRP_FSM_EVENT_QACT;
+ }
+
+ return EIGRP_FSM_KEEP_STATE;
+
+ break;
+ }
+ case EIGRP_FSM_STATE_ACTIVE_1:
+ {
+ int change = eigrp_topology_update_distance(msg);
+
+ if (msg->packet_type == EIGRP_OPC_QUERY
+ && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG))
+ {
+ return EIGRP_FSM_EVENT_QACT;
+ }
+ else if (msg->packet_type == EIGRP_OPC_REPLY)
+ {
+ listnode_delete(prefix->rij, entry->adv_router);
+
+ if (change == 1
+ && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG))
+ {
+ return EIGRP_FSM_EVENT_DINC;
+ }
+ else if (prefix->rij->count)
+ {
+ return EIGRP_FSM_KEEP_STATE;
+ }
+ else
+ {
+ zlog_info("All reply received\n");
+ return EIGRP_FSM_EVENT_LR;
+ }
+ }
+ 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_KEEP_STATE;
+
+ break;
+ }
+ case EIGRP_FSM_STATE_ACTIVE_2:
+ {
+ eigrp_topology_update_distance(msg);
+
+ if (msg->packet_type == EIGRP_OPC_REPLY)
+ {
+ listnode_delete(prefix->rij, entry->adv_router);
+ if (prefix->rij->count)
+ {
+ return EIGRP_FSM_KEEP_STATE;
+ }
+ else
+ {
+ zlog_info("All reply received\n");
+ if (((struct eigrp_neighbor_entry *) prefix->entries->head->data)->reported_distance
+ < prefix->fdistance)
+ {
+ return EIGRP_FSM_EVENT_LR_FCS;
+ }
+
+ return EIGRP_FSM_EVENT_LR_FCN;
+ }
+ }
+ return EIGRP_FSM_KEEP_STATE;
+
+ break;
+ }
+ case EIGRP_FSM_STATE_ACTIVE_3:
+ {
+ int change = eigrp_topology_update_distance(msg);
+
+ if (msg->packet_type == EIGRP_OPC_REPLY)
+ {
+ listnode_delete(prefix->rij, entry->adv_router);
+
+ if (change == 1
+ && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG))
+ {
+ return EIGRP_FSM_EVENT_DINC;
+ }
+ else if (prefix->rij->count)
+ {
+ return EIGRP_FSM_KEEP_STATE;
+ }
+ else
+ {
+ zlog_info("All reply received\n");
+ return EIGRP_FSM_EVENT_LR;
+ }
+ }
+ 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_KEEP_STATE;
+
+ break;
+ }
+ }
+
+ return EIGRP_FSM_KEEP_STATE;
}
/*
* Function made to execute in separate thread.
* 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,
+ msg->prefix->state, event, eigrp_topology_ip_string(msg->prefix));
+ (*(NSM[msg->prefix->state][event].func))(msg);
- 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));
- (*(NSM[msg->prefix->state][event].func))(msg);
-
- return 1;
+ return 1;
}
+
/*
* Function of event 0.
*
*/
-int eigrp_fsm_event_nq_fcn(struct eigrp_fsm_action_message *msg) {
- struct eigrp *eigrp = msg->eigrp;
- struct eigrp_prefix_entry *prefix = msg->prefix;
- struct list *successors = eigrp_topology_get_successor(prefix);
-
- assert(successors); // If this is NULL we have shit the bed, fun huh?
-
- prefix->state = EIGRP_FSM_STATE_ACTIVE_1;
- prefix->rdistance = prefix->distance = prefix->fdistance =
- ((struct eigrp_neighbor_entry *) successors->head->data)->distance;
- prefix->reported_metric =
- ((struct eigrp_neighbor_entry *) successors->head->data)->total_metric;
-
- if (eigrp_nbr_count_get()) {
- prefix->req_action |= EIGRP_FSM_NEED_QUERY;
- listnode_add(eigrp->topology_changes_internalIPV4,prefix);
- } else {
- eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left
- }
-
- list_delete(successors);
-
- return 1;
+int eigrp_fsm_event_nq_fcn(struct eigrp_fsm_action_message *msg)
+{
+ struct eigrp *eigrp = msg->eigrp;
+ struct eigrp_prefix_entry *prefix = msg->prefix;
+ struct list *successors = eigrp_topology_get_successor(prefix);
+
+ assert(successors); // If this is NULL we have shit the bed, fun huh?
+
+ prefix->state = EIGRP_FSM_STATE_ACTIVE_1;
+ prefix->rdistance = prefix->distance = prefix->fdistance =
+ ((struct eigrp_neighbor_entry *) successors->head->data)->distance;
+ prefix->reported_metric =
+ ((struct eigrp_neighbor_entry *) successors->head->data)->total_metric;
+
+ if (eigrp_nbr_count_get())
+ {
+ prefix->req_action |= EIGRP_FSM_NEED_QUERY;
+ listnode_add(eigrp->topology_changes_internalIPV4,prefix);
+ }
+ else
+ {
+ eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left
+ }
+
+ list_delete(successors);
+
+ return 1;
}
-int eigrp_fsm_event_q_fcn(struct eigrp_fsm_action_message *msg) {
- struct eigrp *eigrp = msg->eigrp;
- struct eigrp_prefix_entry *prefix = msg->prefix;
- struct list *successors = eigrp_topology_get_successor(prefix);
-
- assert(successors); // If this is NULL somebody poked us in the eye.
-
- prefix->state = EIGRP_FSM_STATE_ACTIVE_3;
- prefix->rdistance = prefix->distance = prefix->fdistance =
- ((struct eigrp_neighbor_entry *) successors->head->data)->distance;
- prefix->reported_metric =
- ((struct eigrp_neighbor_entry *) successors->head->data)->total_metric;
- if (eigrp_nbr_count_get()) {
- prefix->req_action |= EIGRP_FSM_NEED_QUERY;
- listnode_add(eigrp->topology_changes_internalIPV4,prefix);
- } else {
- eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left
- }
-
- list_delete(successors);
-
- return 1;
+int eigrp_fsm_event_q_fcn(struct eigrp_fsm_action_message *msg)
+{
+ struct eigrp *eigrp = msg->eigrp;
+ struct eigrp_prefix_entry *prefix = msg->prefix;
+ struct list *successors = eigrp_topology_get_successor(prefix);
+
+ assert(successors); // If this is NULL somebody poked us in the eye.
+
+ prefix->state = EIGRP_FSM_STATE_ACTIVE_3;
+ prefix->rdistance = prefix->distance = prefix->fdistance =
+ ((struct eigrp_neighbor_entry *) successors->head->data)->distance;
+ prefix->reported_metric =
+ ((struct eigrp_neighbor_entry *) successors->head->data)->total_metric;
+ if (eigrp_nbr_count_get())
+ {
+ prefix->req_action |= EIGRP_FSM_NEED_QUERY;
+ listnode_add(eigrp->topology_changes_internalIPV4,prefix);
+ }
+ else
+ {
+ eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left
+ }
+
+ list_delete(successors);
+
+ return 1;
}
-int eigrp_fsm_event_keep_state(struct eigrp_fsm_action_message *msg) {
-
- struct eigrp_prefix_entry *prefix = msg->prefix;
-
- if (prefix->state == EIGRP_FSM_STATE_PASSIVE) {
- if (!eigrp_metrics_is_same(&prefix->reported_metric,
- &((struct eigrp_neighbor_entry *) prefix->entries->head->data)->total_metric)) {
- prefix->rdistance =
- prefix->fdistance =
- prefix->distance =
- ((struct eigrp_neighbor_entry *) prefix->entries->head->data)->distance;
- prefix->reported_metric =
- ((struct eigrp_neighbor_entry *) prefix->entries->head->data)->total_metric;
- if (msg->packet_type == EIGRP_OPC_QUERY)
- eigrp_send_reply(msg->adv_router, prefix);
- prefix->req_action |= EIGRP_FSM_NEED_UPDATE;
- listnode_add((eigrp_lookup())->topology_changes_internalIPV4,prefix);
- }
- eigrp_topology_update_node_flags(prefix);
- eigrp_update_routing_table(prefix);
- }
-
- if (msg->packet_type == EIGRP_OPC_QUERY)
- eigrp_send_reply(msg->adv_router, prefix);
-
- return 1;
+int eigrp_fsm_event_keep_state(struct eigrp_fsm_action_message *msg)
+{
+ struct eigrp_prefix_entry *prefix = msg->prefix;
+
+ if (prefix->state == EIGRP_FSM_STATE_PASSIVE)
+ {
+ if (!eigrp_metrics_is_same(&prefix->reported_metric,
+ &((struct eigrp_neighbor_entry *) prefix->entries->head->data)->total_metric))
+ {
+ prefix->rdistance =
+ prefix->fdistance =
+ prefix->distance =
+ ((struct eigrp_neighbor_entry *) prefix->entries->head->data)->distance;
+ prefix->reported_metric =
+ ((struct eigrp_neighbor_entry *) prefix->entries->head->data)->total_metric;
+ if (msg->packet_type == EIGRP_OPC_QUERY)
+ eigrp_send_reply(msg->adv_router, prefix);
+ prefix->req_action |= EIGRP_FSM_NEED_UPDATE;
+ listnode_add((eigrp_lookup())->topology_changes_internalIPV4,prefix);
+ }
+ eigrp_topology_update_node_flags(prefix);
+ eigrp_update_routing_table(prefix);
+ }
+
+ if (msg->packet_type == EIGRP_OPC_QUERY)
+ eigrp_send_reply(msg->adv_router, prefix);
+
+ return 1;
}
-int eigrp_fsm_event_lr(struct eigrp_fsm_action_message *msg) {
- struct eigrp *eigrp = msg->eigrp;
- struct eigrp_prefix_entry *prefix = msg->prefix;
- prefix->fdistance =
- prefix->distance =
- prefix->rdistance =
- ((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->distance;
- prefix->reported_metric =
- ((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->total_metric;
-
- if (prefix->state == EIGRP_FSM_STATE_ACTIVE_3) {
- struct list *successors = eigrp_topology_get_successor(prefix);
-
- assert(successors); // It's like Napolean and Waterloo
-
- eigrp_send_reply(((struct eigrp_neighbor_entry *)successors->head->data)->adv_router, prefix);
- list_delete(successors);
- }
-
- prefix->state = EIGRP_FSM_STATE_PASSIVE;
- prefix->req_action |= EIGRP_FSM_NEED_UPDATE;
- listnode_add(eigrp->topology_changes_internalIPV4,prefix);
- eigrp_topology_update_node_flags(prefix);
- eigrp_update_routing_table(prefix);
- eigrp_update_topology_table_prefix(eigrp->topology_table, prefix);
-
- return 1;
+int eigrp_fsm_event_lr(struct eigrp_fsm_action_message *msg)
+{
+ struct eigrp *eigrp = msg->eigrp;
+ struct eigrp_prefix_entry *prefix = msg->prefix;
+ prefix->fdistance =
+ prefix->distance =
+ prefix->rdistance =
+ ((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->distance;
+ prefix->reported_metric =
+ ((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->total_metric;
+
+ if (prefix->state == EIGRP_FSM_STATE_ACTIVE_3)
+ {
+ struct list *successors = eigrp_topology_get_successor(prefix);
+
+ assert(successors); // It's like Napolean and Waterloo
+
+ eigrp_send_reply(((struct eigrp_neighbor_entry *)successors->head->data)->adv_router, prefix);
+ list_delete(successors);
+ }
+
+ prefix->state = EIGRP_FSM_STATE_PASSIVE;
+ prefix->req_action |= EIGRP_FSM_NEED_UPDATE;
+ listnode_add(eigrp->topology_changes_internalIPV4,prefix);
+ eigrp_topology_update_node_flags(prefix);
+ eigrp_update_routing_table(prefix);
+ eigrp_update_topology_table_prefix(eigrp->topology_table, prefix);
+
+ return 1;
}
-int eigrp_fsm_event_dinc(struct eigrp_fsm_action_message *msg) {
- struct list *successors = eigrp_topology_get_successor(msg->prefix);
+int eigrp_fsm_event_dinc(struct eigrp_fsm_action_message *msg)
+{
+ struct list *successors = eigrp_topology_get_successor(msg->prefix);
+
+ assert(successors); // Trump and his big hands
- assert(successors); // Trump and his big hands
+ msg->prefix->state =
+ msg->prefix->state == EIGRP_FSM_STATE_ACTIVE_1 ?
+ EIGRP_FSM_STATE_ACTIVE_0 : EIGRP_FSM_STATE_ACTIVE_2;
+ msg->prefix->distance =
+ ((struct eigrp_neighbor_entry *)successors->head->data)->distance;
+ if (!msg->prefix->rij->count)
+ (*(NSM[msg->prefix->state][eigrp_get_fsm_event(msg)].func))(msg);
- msg->prefix->state =
- msg->prefix->state == EIGRP_FSM_STATE_ACTIVE_1 ?
- EIGRP_FSM_STATE_ACTIVE_0 : EIGRP_FSM_STATE_ACTIVE_2;
- msg->prefix->distance = ((struct eigrp_neighbor_entry *)successors->head->data)->distance;
- if (!msg->prefix->rij->count) {
- (*(NSM[msg->prefix->state][eigrp_get_fsm_event(msg)].func))(msg);
- }
- list_delete(successors);
- return 1;
+ list_delete(successors);
+ return 1;
}
-int eigrp_fsm_event_lr_fcs(struct eigrp_fsm_action_message *msg) {
- struct eigrp *eigrp = msg->eigrp;
- struct eigrp_prefix_entry *prefix = msg->prefix;
- prefix->state = EIGRP_FSM_STATE_PASSIVE;
- prefix->distance =
- prefix->rdistance =
- ((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->distance;
- prefix->reported_metric =
- ((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->total_metric;
- prefix->fdistance =
- prefix->fdistance > prefix->distance ?
- prefix->distance : prefix->fdistance;
- if (prefix->state == EIGRP_FSM_STATE_ACTIVE_2) {
- struct list *successors = eigrp_topology_get_successor(prefix);
-
- assert(successors); // Having a spoon and all you need is a knife
-
- eigrp_send_reply(((struct eigrp_neighbor_entry *)successors->head->data)->adv_router, prefix);
-
- list_delete(successors);
- }
- prefix->req_action |= EIGRP_FSM_NEED_UPDATE;
- listnode_add(eigrp->topology_changes_internalIPV4,prefix);
- eigrp_topology_update_node_flags(prefix);
- eigrp_update_routing_table(prefix);
- eigrp_update_topology_table_prefix(eigrp->topology_table, prefix);
-
- return 1;
+int eigrp_fsm_event_lr_fcs(struct eigrp_fsm_action_message *msg)
+{
+ struct eigrp *eigrp = msg->eigrp;
+ struct eigrp_prefix_entry *prefix = msg->prefix;
+ prefix->state = EIGRP_FSM_STATE_PASSIVE;
+ prefix->distance =
+ prefix->rdistance =
+ ((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->distance;
+ prefix->reported_metric =
+ ((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->total_metric;
+ prefix->fdistance =
+ prefix->fdistance > prefix->distance ?
+ prefix->distance : prefix->fdistance;
+ if (prefix->state == EIGRP_FSM_STATE_ACTIVE_2)
+ {
+ struct list *successors = eigrp_topology_get_successor(prefix);
+
+ assert(successors); // Having a spoon and all you need is a knife
+
+ eigrp_send_reply(((struct eigrp_neighbor_entry *)successors->head->data)->adv_router, prefix);
+
+ list_delete(successors);
+ }
+ prefix->req_action |= EIGRP_FSM_NEED_UPDATE;
+ listnode_add(eigrp->topology_changes_internalIPV4,prefix);
+ eigrp_topology_update_node_flags(prefix);
+ eigrp_update_routing_table(prefix);
+ eigrp_update_topology_table_prefix(eigrp->topology_table, prefix);
+
+ return 1;
}
-int eigrp_fsm_event_lr_fcn(struct eigrp_fsm_action_message *msg) {
- struct eigrp *eigrp = msg->eigrp;
- struct eigrp_prefix_entry *prefix = msg->prefix;
- struct list *successors = eigrp_topology_get_successor(prefix);
-
- assert(successors); // Routing without a stack
-
- prefix->state =
- prefix->state == EIGRP_FSM_STATE_ACTIVE_0 ?
- EIGRP_FSM_STATE_ACTIVE_1 : EIGRP_FSM_STATE_ACTIVE_3;
- struct eigrp_neighbor_entry *best_successor =
- ((struct eigrp_neighbor_entry *) (successors->head->data));
- prefix->rdistance = prefix->distance = best_successor->distance;
- prefix->reported_metric = best_successor->total_metric;
- if (eigrp_nbr_count_get()) {
- prefix->req_action |= EIGRP_FSM_NEED_QUERY;
- listnode_add(eigrp->topology_changes_internalIPV4,prefix);
- } else {
- eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left
- }
-
- list_delete(successors);
-
- return 1;
+int eigrp_fsm_event_lr_fcn(struct eigrp_fsm_action_message *msg)
+{
+ struct eigrp *eigrp = msg->eigrp;
+ struct eigrp_prefix_entry *prefix = msg->prefix;
+ struct list *successors = eigrp_topology_get_successor(prefix);
+
+ assert(successors); // Routing without a stack
+
+ prefix->state =
+ prefix->state == EIGRP_FSM_STATE_ACTIVE_0 ?
+ EIGRP_FSM_STATE_ACTIVE_1 : EIGRP_FSM_STATE_ACTIVE_3;
+ struct eigrp_neighbor_entry *best_successor =
+ ((struct eigrp_neighbor_entry *) (successors->head->data));
+ prefix->rdistance = prefix->distance = best_successor->distance;
+ prefix->reported_metric = best_successor->total_metric;
+
+ if (eigrp_nbr_count_get())
+ {
+ prefix->req_action |= EIGRP_FSM_NEED_QUERY;
+ listnode_add(eigrp->topology_changes_internalIPV4,prefix);
+ }
+ else
+ {
+ eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left
+ }
+
+ list_delete(successors);
+
+ return 1;
}
-int eigrp_fsm_event_qact(struct eigrp_fsm_action_message *msg) {
- struct list *successors = eigrp_topology_get_successor(msg->prefix);
+int eigrp_fsm_event_qact(struct eigrp_fsm_action_message *msg)
+{
+ struct list *successors = eigrp_topology_get_successor(msg->prefix);
- assert(successors); // Cats and no Dogs
+ assert(successors); // Cats and no Dogs
- msg->prefix->state = EIGRP_FSM_STATE_ACTIVE_2;
- msg->prefix->distance =
- ((struct eigrp_neighbor_entry *) (successors->head->data))->distance;
+ msg->prefix->state = EIGRP_FSM_STATE_ACTIVE_2;
+ msg->prefix->distance =
+ ((struct eigrp_neighbor_entry *) (successors->head->data))->distance;
- list_delete(successors);
- return 1;
+ list_delete(successors);
+ return 1;
}
diff --git a/eigrpd/eigrp_hello.c b/eigrpd/eigrp_hello.c
index 81bc408b6..240aa3678 100644
--- a/eigrpd/eigrp_hello.c
+++ b/eigrpd/eigrp_hello.c
@@ -59,14 +59,14 @@
/* Packet Type String. */
static const struct message eigrp_general_tlv_type_str[] =
{
- { EIGRP_TLV_PARAMETER, "PARAMETER" },
- { EIGRP_TLV_AUTH, "AUTH" },
- { EIGRP_TLV_SEQ, "SEQ" },
- { EIGRP_TLV_SW_VERSION, "SW_VERSION" },
- { EIGRP_TLV_NEXT_MCAST_SEQ, "NEXT_MCAST_SEQ" },
- { EIGRP_TLV_PEER_TERMINATION, "PEER_TERMINATION" },
- { EIGRP_TLV_PEER_MTRLIST, "PEER_MTRLIST" },
- { EIGRP_TLV_PEER_TIDLIST, "PEER_TIDLIST" },
+ { EIGRP_TLV_PARAMETER, "PARAMETER" },
+ { EIGRP_TLV_AUTH, "AUTH" },
+ { EIGRP_TLV_SEQ, "SEQ" },
+ { EIGRP_TLV_SW_VERSION, "SW_VERSION" },
+ { EIGRP_TLV_NEXT_MCAST_SEQ, "NEXT_MCAST_SEQ" },
+ { EIGRP_TLV_PEER_TERMINATION, "PEER_TERMINATION" },
+ { EIGRP_TLV_PEER_MTRLIST, "PEER_MTRLIST" },
+ { EIGRP_TLV_PEER_TIDLIST, "PEER_TIDLIST" },
};
static const size_t eigrp_general_tlv_type_str_max = sizeof(eigrp_general_tlv_type_str) /
@@ -76,9 +76,9 @@ static const size_t eigrp_general_tlv_type_str_max = sizeof(eigrp_general_tlv_ty
/*
* @fn eigrp_hello_timer
*
- * @param[in] thread current execution thread timer is associated with
+ * @param[in] thread current execution thread timer is associated with
*
- * @return int always returns 0
+ * @return int always returns 0
*
* @par
* Called once per "hello" time interval, default 5 seconds
@@ -102,7 +102,7 @@ eigrp_hello_timer (struct thread *thread)
/* Hello timer set. */
ei->t_hello = thread_add_timer(master, eigrp_hello_timer, ei,
- EIGRP_IF_PARAM(ei, v_hello));
+ EIGRP_IF_PARAM(ei, v_hello));
return 0;
}
@@ -124,7 +124,7 @@ eigrp_hello_timer (struct thread *thread)
*/
static void
eigrp_hello_parameter_decode (struct eigrp_neighbor *nbr,
- struct eigrp_tlv_hdr_type *tlv)
+ struct eigrp_tlv_hdr_type *tlv)
{
struct eigrp *eigrp = nbr->ei->eigrp;
struct TLV_Parameter_Type *param = (struct TLV_Parameter_Type *)tlv;
@@ -150,43 +150,43 @@ eigrp_hello_parameter_decode (struct eigrp_neighbor *nbr,
{
if (eigrp_nbr_state_get(nbr) == EIGRP_NEIGHBOR_DOWN)
- {
- zlog_info("Neighbor %s (%s) is pending: new adjacency",
- inet_ntoa(nbr->src), ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
+ {
+ zlog_info("Neighbor %s (%s) is pending: new adjacency",
+ inet_ntoa(nbr->src), ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
- /* Expedited hello sent */
- eigrp_hello_send(nbr->ei, EIGRP_HELLO_NORMAL, NULL);
+ /* Expedited hello sent */
+ eigrp_hello_send(nbr->ei, EIGRP_HELLO_NORMAL, NULL);
-// if(ntohl(nbr->ei->address->u.prefix4.s_addr) > ntohl(nbr->src.s_addr))
- eigrp_update_send_init(nbr);
+ // if(ntohl(nbr->ei->address->u.prefix4.s_addr) > ntohl(nbr->src.s_addr))
+ eigrp_update_send_init(nbr);
- eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_PENDING);
- }
+ eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_PENDING);
+ }
}
else
{
if (eigrp_nbr_state_get(nbr) != EIGRP_NEIGHBOR_DOWN)
- {
- if ((param->K1 & param->K2 & param->K3 & param->K4 & param->K5) == 255)
- {
+ {
+ if ((param->K1 & param->K2 & param->K3 & param->K4 & param->K5) == 255)
+ {
zlog_info ("Neighbor %s (%s) is down: Interface PEER-TERMINATION received",
inet_ntoa (nbr->src),ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT));
eigrp_nbr_delete (nbr);
- }
- else
- {
+ }
+ else
+ {
zlog_info ("Neighbor %s (%s) going down: Kvalue mismatch",
inet_ntoa (nbr->src),ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT));
eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_DOWN);
- }
- }
+ }
+ }
}
}
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;
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)
return eigrp_check_md5_digest(s, md5, nbr, EIGRP_AUTH_BASIC_HELLO_FLAG);
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;
}
@@ -214,7 +215,7 @@ eigrp_hello_authentication_decode(struct stream *s, struct eigrp_tlv_hdr_type *t
*/
static void
eigrp_sw_version_decode (struct eigrp_neighbor *nbr,
- struct eigrp_tlv_hdr_type *tlv)
+ struct eigrp_tlv_hdr_type *tlv)
{
struct TLV_Software_Type *version = (struct TLV_Software_Type *)tlv;
@@ -240,22 +241,22 @@ eigrp_sw_version_decode (struct eigrp_neighbor *nbr,
*/
static void
eigrp_peer_termination_decode (struct eigrp_neighbor *nbr,
- struct eigrp_tlv_hdr_type *tlv)
+ struct eigrp_tlv_hdr_type *tlv)
{
- struct TLV_Peer_Termination_type *param = (struct TLV_Peer_Termination_type *)tlv;
-
- uint32_t my_ip = nbr->ei->address->u.prefix4.s_addr;
- uint32_t received_ip = param->neighbor_ip;
-
- if(my_ip == received_ip)
- {
- zlog_info ("Neighbor %s (%s) is down: Peer Termination received",
- inet_ntoa (nbr->src),ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT));
- /* set neighbor to DOWN */
- nbr->state = EIGRP_NEIGHBOR_DOWN;
- /* delete neighbor */
- eigrp_nbr_delete (nbr);
- }
+ struct TLV_Peer_Termination_type *param = (struct TLV_Peer_Termination_type *)tlv;
+
+ uint32_t my_ip = nbr->ei->address->u.prefix4.s_addr;
+ uint32_t received_ip = param->neighbor_ip;
+
+ if(my_ip == received_ip)
+ {
+ zlog_info ("Neighbor %s (%s) is down: Peer Termination received",
+ inet_ntoa (nbr->src),ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT));
+ /* set neighbor to DOWN */
+ nbr->state = EIGRP_NEIGHBOR_DOWN;
+ /* delete neighbor */
+ eigrp_nbr_delete (nbr);
+ }
}
/**
@@ -272,30 +273,30 @@ eigrp_peer_termination_decode (struct eigrp_neighbor *nbr,
static u_int16_t
eigrp_peer_termination_encode (struct stream *s, struct in_addr *nbr_addr)
{
- u_int16_t length = EIGRP_TLV_PEER_TERMINATION_LEN;
+ u_int16_t length = EIGRP_TLV_PEER_TERMINATION_LEN;
- /* fill in type and length */
- stream_putw(s, EIGRP_TLV_PEER_TERMINATION);
- stream_putw(s, length);
+ /* fill in type and length */
+ stream_putw(s, EIGRP_TLV_PEER_TERMINATION);
+ stream_putw(s, length);
- /* fill in unknown field 0x04 */
- stream_putc(s, 0x04);
+ /* fill in unknown field 0x04 */
+ stream_putc(s, 0x04);
- /* finally neighbor IP address */
- stream_put_ipv4(s, nbr_addr->s_addr);
+ /* finally neighbor IP address */
+ stream_put_ipv4(s, nbr_addr->s_addr);
- return(length);
+ return(length);
}
/*
* @fn eigrp_hello_receive
*
- * @param[in] eigrp eigrp routing process
- * @param[in] iph pointer to ip header
- * @param[in] eigrph pointer to eigrp header
- * @param[in] s input ip stream
- * @param[in] ei eigrp interface packet arrived on
- * @param[in] size size of eigrp packet
+ * @param[in] eigrp eigrp routing process
+ * @param[in] iph pointer to ip header
+ * @param[in] eigrph pointer to eigrp header
+ * @param[in] s input ip stream
+ * @param[in] ei eigrp interface packet arrived on
+ * @param[in] size size of eigrp packet
*
* @return void
*
@@ -310,12 +311,12 @@ eigrp_peer_termination_encode (struct stream *s, struct in_addr *nbr_addr)
*/
void
eigrp_hello_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *eigrph,
- struct stream *s, struct eigrp_interface *ei, int size)
+ struct stream *s, struct eigrp_interface *ei, int size)
{
struct eigrp_tlv_hdr_type *tlv_header;
struct eigrp_neighbor *nbr;
- uint16_t type;
- uint16_t length;
+ uint16_t type;
+ uint16_t length;
/* get neighbor struct */
nbr = eigrp_nbr_get(ei, eigrph, iph);
@@ -325,8 +326,8 @@ eigrp_hello_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e
if (IS_DEBUG_EIGRP_PACKET(eigrph->opcode - 1, RECV))
zlog_debug("Processing Hello size[%u] int(%s) nbr(%s)",
- size, ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT),
- inet_ntoa(nbr->src));
+ size, ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT),
+ inet_ntoa(nbr->src));
size -= EIGRP_HEADER_LEN;
if (size < 0)
@@ -340,40 +341,40 @@ eigrp_hello_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e
if ((length > 0) && (length <= size))
{
- if (IS_DEBUG_EIGRP_PACKET(0, RECV))
- zlog_debug(" General TLV(%s)", LOOKUP(eigrp_general_tlv_type_str, type));
-
- // determine what General TLV is being processed
- switch (type)
- {
- case EIGRP_TLV_PARAMETER:
- eigrp_hello_parameter_decode(nbr, tlv_header);
- break;
- case EIGRP_TLV_AUTH:
- {
+ if (IS_DEBUG_EIGRP_PACKET(0, RECV))
+ zlog_debug(" General TLV(%s)", LOOKUP(eigrp_general_tlv_type_str, type));
+
+ // determine what General TLV is being processed
+ switch (type)
+ {
+ case EIGRP_TLV_PARAMETER:
+ eigrp_hello_parameter_decode(nbr, tlv_header);
+ break;
+ case EIGRP_TLV_AUTH:
+ {
if(eigrp_hello_authentication_decode(s,tlv_header,nbr) == 0)
return;
else
break;
break;
- }
- case EIGRP_TLV_SEQ:
- break;
- case EIGRP_TLV_SW_VERSION:
- eigrp_sw_version_decode(nbr, tlv_header);
- break;
- case EIGRP_TLV_NEXT_MCAST_SEQ:
- break;
- case EIGRP_TLV_PEER_TERMINATION:
- eigrp_peer_termination_decode(nbr, tlv_header);
- break;
- case EIGRP_TLV_PEER_MTRLIST:
- case EIGRP_TLV_PEER_TIDLIST:
- break;
- default:
- break;
- }
- }
+ }
+ case EIGRP_TLV_SEQ:
+ break;
+ case EIGRP_TLV_SW_VERSION:
+ eigrp_sw_version_decode(nbr, tlv_header);
+ break;
+ case EIGRP_TLV_NEXT_MCAST_SEQ:
+ break;
+ case EIGRP_TLV_PEER_TERMINATION:
+ eigrp_peer_termination_decode(nbr, tlv_header);
+ break;
+ case EIGRP_TLV_PEER_MTRLIST:
+ case EIGRP_TLV_PEER_TIDLIST:
+ break;
+ default:
+ break;
+ }
+ }
tlv_header = (struct eigrp_tlv_hdr_type *)(((char *)tlv_header) + length);
size -= length;
@@ -391,8 +392,7 @@ eigrp_hello_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e
}
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));
}
/**
@@ -418,8 +418,8 @@ eigrp_sw_version_encode (struct stream *s)
// encode the version of quagga we're running
// DVS: need to figure out a cleaner way to do this
- stream_putc(s, 0); //!< major os version
- stream_putc(s, 99); //!< minor os version
+ stream_putc(s, 0); //!< major os version
+ stream_putc(s, 99); //!< minor os version
/* and the core eigrp version */
stream_putc(s, EIGRP_MAJOR_VERSION);
@@ -532,9 +532,9 @@ eigrp_next_sequence_encode (struct stream *s)
}
// add in the parameters TLV
- stream_putw(s, EIGRP_TLV_NEXT_MCAST_SEQ);
- stream_putw(s, EIGRP_NEXT_SEQUENCE_TLV_SIZE);
- stream_putl(s,eigrp->sequence_number+1);
+ stream_putw(s, EIGRP_TLV_NEXT_MCAST_SEQ);
+ stream_putw(s, EIGRP_NEXT_SEQUENCE_TLV_SIZE);
+ stream_putl(s,eigrp->sequence_number+1);
return length;
}
@@ -557,7 +557,7 @@ eigrp_next_sequence_encode (struct stream *s)
static u_int16_t
eigrp_hello_parameter_encode (struct eigrp_interface *ei, struct stream *s, u_char flags)
{
- u_int16_t length = EIGRP_TLV_PARAMETER_LEN;
+ u_int16_t length = EIGRP_TLV_PARAMETER_LEN;
// add in the parameters TLV
stream_putw(s, EIGRP_TLV_PARAMETER);
@@ -605,7 +605,8 @@ eigrp_hello_parameter_encode (struct eigrp_interface *ei, struct stream *s, u_ch
*
*/
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;
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);
// 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);
}
- 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);
}
@@ -648,7 +651,7 @@ eigrp_hello_encode (struct eigrp_interface *ei, in_addr_t addr, u_int32_t ack, u
/* encode Peer Termination TLV if needed */
if(flags & EIGRP_HELLO_GRACEFUL_SHUTDOWN_NBR)
- length += eigrp_peer_termination_encode(ep->s, nbr_addr);
+ length += eigrp_peer_termination_encode(ep->s, nbr_addr);
// Set packet length
ep->length = length;
@@ -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
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);
}
- 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);
}
@@ -696,21 +701,21 @@ eigrp_hello_send_ack (struct eigrp_neighbor *nbr)
if (ep)
{
if (IS_DEBUG_EIGRP_PACKET(0, SEND))
- zlog_debug("Queueing [Hello] Ack Seq [%u] nbr [%s]",
- nbr->recv_sequence_number, inet_ntoa(nbr->src));
+ zlog_debug("Queueing [Hello] Ack Seq [%u] nbr [%s]",
+ nbr->recv_sequence_number, inet_ntoa(nbr->src));
/* Add packet to the top of the interface output queue*/
eigrp_fifo_push_head(nbr->ei->obuf, ep);
/* Hook thread to write packet. */
if (nbr->ei->on_write_q == 0)
- {
- listnode_add(nbr->ei->eigrp->oi_write_q, nbr->ei);
- nbr->ei->on_write_q = 1;
- }
+ {
+ listnode_add(nbr->ei->eigrp->oi_write_q, nbr->ei);
+ nbr->ei->on_write_q = 1;
+ }
if (nbr->ei->eigrp->t_write == NULL)
- nbr->ei->eigrp->t_write =
- thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd);
+ nbr->ei->eigrp->t_write =
+ thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd);
}
}
@@ -734,9 +739,9 @@ eigrp_hello_send (struct eigrp_interface *ei, u_char flags, struct in_addr *nbr_
struct eigrp_packet *ep = NULL;
/* If this is passive interface, do not send EIGRP Hello.
- if ((EIGRP_IF_PASSIVE_STATUS (ei) == EIGRP_IF_PASSIVE) ||
- (ei->type != EIGRP_IFTYPE_NBMA))
- return;
+ if ((EIGRP_IF_PASSIVE_STATUS (ei) == EIGRP_IF_PASSIVE) ||
+ (ei->type != EIGRP_IFTYPE_NBMA))
+ return;
*/
if (IS_DEBUG_EIGRP_PACKET(0, SEND))
@@ -762,13 +767,13 @@ eigrp_hello_send (struct eigrp_interface *ei, u_char flags, struct in_addr *nbr_
if(flags & EIGRP_HELLO_GRACEFUL_SHUTDOWN)
{
ei->eigrp->t_write =
- thread_execute(master, eigrp_write, ei->eigrp, ei->eigrp->fd);
+ thread_execute(master, eigrp_write, ei->eigrp, ei->eigrp->fd);
}
else
{
ei->eigrp->t_write =
thread_add_write(master, eigrp_write, ei->eigrp, ei->eigrp->fd);
}
- }
+ }
}
}
diff --git a/eigrpd/eigrp_interface.c b/eigrpd/eigrp_interface.c
index b3f80c57d..645b70d23 100644
--- a/eigrpd/eigrp_interface.c
+++ b/eigrpd/eigrp_interface.c
@@ -106,9 +106,9 @@ eigrp_if_new (struct eigrp *eigrp, struct interface *ifp, struct prefix *p)
/* Initialize lists */
for (i = 0; i < EIGRP_FILTER_MAX; i++)
{
- ei->list[i] = NULL;
- ei->prefix[i] = NULL;
- ei->routemap[i] = NULL;
+ ei->list[i] = NULL;
+ ei->prefix[i] = NULL;
+ ei->routemap[i] = NULL;
}
return ei;
@@ -138,7 +138,6 @@ eigrp_if_table_lookup (struct interface *ifp, struct prefix *prefix)
int
eigrp_if_delete_hook (struct interface *ifp)
{
-
struct route_node *rn;
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_type);
-
return eip;
}
@@ -401,7 +399,7 @@ eigrp_if_set_multicast (struct eigrp_interface *ei)
/* The interface should belong to the EIGRP-all-routers group. */
if (!EI_MEMBER_CHECK (ei, MEMBER_ALLROUTERS)
&& (eigrp_if_add_allspfrouters (ei->eigrp, ei->address,
- ei->ifp->ifindex) >= 0))
+ ei->ifp->ifindex) >= 0))
/* Set the flag only if the system call to join succeeded. */
EI_MEMBER_JOINED (ei, MEMBER_ALLROUTERS);
}
@@ -413,10 +411,10 @@ eigrp_if_set_multicast (struct eigrp_interface *ei)
/* Only actually drop if this is the last reference */
if (EI_MEMBER_COUNT (ei, MEMBER_ALLROUTERS) == 1)
eigrp_if_drop_allspfrouters (ei->eigrp, ei->address,
- ei->ifp->ifindex);
+ ei->ifp->ifindex);
/* Unset the flag regardless of whether the system call to leave
- the group succeeded, since it's much safer to assume that
- we are not a member. */
+ the group succeeded, since it's much safer to assume that
+ we are not a member. */
EI_MEMBER_LEFT (ei, MEMBER_ALLROUTERS);
}
}
@@ -484,7 +482,7 @@ eigrp_delete_from_if (struct interface *ifp, struct eigrp_interface *ei)
}
/* Simulate down/up on the interface. This is needed, for example, when
- the MTU changes. */
+ the MTU changes. */
void
eigrp_if_reset (struct interface *ifp)
{
@@ -504,7 +502,7 @@ eigrp_if_reset (struct interface *ifp)
struct eigrp_interface *
eigrp_if_lookup_by_local_addr (struct eigrp *eigrp, struct interface *ifp,
- struct in_addr address)
+ struct in_addr address)
{
struct listnode *node;
struct eigrp_interface *ei;
@@ -535,26 +533,26 @@ eigrp_if_lookup_by_local_addr (struct eigrp *eigrp, struct interface *ifp,
struct eigrp_interface *
eigrp_if_lookup_by_name (struct eigrp *eigrp, const char *if_name)
{
- struct eigrp_interface *ei;
- struct listnode *node;
-
- /* iterate over all eigrp interfaces */
- for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
- {
- /* compare int name with eigrp interface's name */
- if(strcmp(ei->ifp->name, if_name) == 0)
- {
- return ei;
- }
- }
-
- return NULL;
+ struct eigrp_interface *ei;
+ struct listnode *node;
+
+ /* iterate over all eigrp interfaces */
+ for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
+ {
+ /* compare int name with eigrp interface's name */
+ if(strcmp(ei->ifp->name, if_name) == 0)
+ {
+ return ei;
+ }
+ }
+
+ return NULL;
}
/* determine receiving interface by ifp and source address */
struct eigrp_interface *
eigrp_if_lookup_recv_if (struct eigrp *eigrp, struct in_addr src,
- struct interface *ifp)
+ struct interface *ifp)
{
struct route_node *rn;
struct prefix_ipv4 addr;
@@ -577,7 +575,7 @@ eigrp_if_lookup_recv_if (struct eigrp *eigrp, struct in_addr src,
continue;
if (prefix_match (CONNECTED_PREFIX (ei->connected),
- (struct prefix *) &addr))
+ (struct prefix *) &addr))
{
if ((match == NULL)
|| (match->address->prefixlen < ei->address->prefixlen))
@@ -594,10 +592,9 @@ eigrp_bandwidth_to_scaled (u_int32_t bandwidth)
u_int64_t temp_bandwidth = (256ull * 10000000) / bandwidth;
temp_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;
-
}
u_int32_t
@@ -606,7 +603,7 @@ eigrp_scaled_to_bandwidth (u_int32_t scaled)
u_int64_t temp_scaled = scaled * (256ull * 10000000);
temp_scaled =
- temp_scaled < EIGRP_MAX_METRIC ? temp_scaled : EIGRP_MAX_METRIC;
+ temp_scaled < EIGRP_MAX_METRIC ? temp_scaled : EIGRP_MAX_METRIC;
return (u_int32_t) temp_scaled;
}
diff --git a/eigrpd/eigrp_main.c b/eigrpd/eigrp_main.c
index 85a97e79a..6a5e3b1a0 100644
--- a/eigrpd/eigrp_main.c
+++ b/eigrpd/eigrp_main.c
@@ -91,9 +91,9 @@ struct zebra_privs_t eigrpd_privs =
/* EIGRPd options. */
struct option longopts[] =
-{
- { 0 }
-};
+ {
+ { 0 }
+ };
/* Master of threads. */
struct thread_master *master;
@@ -211,11 +211,11 @@ main (int argc, char **argv, char **envp)
prefix_list_delete_hook (eigrp_distribute_update_all);
/*eigrp_route_map_init();
- route_map_add_hook (eigrp_rmap_update);
- route_map_delete_hook (eigrp_rmap_update);*/
+ route_map_add_hook (eigrp_rmap_update);
+ route_map_delete_hook (eigrp_rmap_update);*/
/*if_rmap_init (EIGRP_NODE);
- if_rmap_hook_add (eigrp_if_rmap_update);
- if_rmap_hook_delete (eigrp_if_rmap_update);*/
+ if_rmap_hook_add (eigrp_if_rmap_update);
+ if_rmap_hook_delete (eigrp_if_rmap_update);*/
/* Distribute list install. */
distribute_list_init (EIGRP_NODE);
diff --git a/eigrpd/eigrp_neighbor.c b/eigrpd/eigrp_neighbor.c
index f03b9ff4d..01b2e68a0 100644
--- a/eigrpd/eigrp_neighbor.c
+++ b/eigrpd/eigrp_neighbor.c
@@ -67,7 +67,6 @@ eigrp_nbr_new (struct eigrp_interface *ei)
nbr->ei = ei;
/* Set default values. */
-
eigrp_nbr_state_set (nbr, EIGRP_NEIGHBOR_DOWN);
return nbr;
@@ -89,9 +88,9 @@ eigrp_nbr_add (struct eigrp_interface *ei, struct eigrp_header *eigrph,
nbr = eigrp_nbr_new (ei);
nbr->src = iph->ip_src;
-// if (IS_DEBUG_EIGRP_EVENT)
-// zlog_debug("NSM[%s:%s]: start", IF_NAME (nbr->oi),
-// inet_ntoa (nbr->router_id));
+ // if (IS_DEBUG_EIGRP_EVENT)
+ // zlog_debug("NSM[%s:%s]: start", IF_NAME (nbr->oi),
+ // inet_ntoa (nbr->router_id));
return nbr;
}
@@ -149,8 +148,8 @@ eigrp_nbr_lookup_by_addr (struct eigrp_interface *ei, struct in_addr *addr)
/**
* @fn eigrp_nbr_lookup_by_addr_process
*
- * @param[in] eigrp EIGRP process
- * @param[in] nbr_addr Address of neighbor
+ * @param[in] eigrp EIGRP process
+ * @param[in] nbr_addr Address of neighbor
*
* @return void
*
@@ -161,25 +160,25 @@ eigrp_nbr_lookup_by_addr (struct eigrp_interface *ei, struct in_addr *addr)
struct eigrp_neighbor *
eigrp_nbr_lookup_by_addr_process (struct eigrp *eigrp, struct in_addr nbr_addr)
{
- struct eigrp_interface *ei;
- struct listnode *node, *node2, *nnode2;
- struct eigrp_neighbor *nbr;
-
- /* iterate over all eigrp interfaces */
- for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
- {
- /* iterate over all neighbors on eigrp interface */
- for (ALL_LIST_ELEMENTS (ei->nbrs, node2, nnode2, nbr))
- {
- /* compare if neighbor address is same as arg address */
- if (nbr->src.s_addr == nbr_addr.s_addr)
- {
- return nbr;
- }
- }
- }
-
- return NULL;
+ struct eigrp_interface *ei;
+ struct listnode *node, *node2, *nnode2;
+ struct eigrp_neighbor *nbr;
+
+ /* iterate over all eigrp interfaces */
+ for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
+ {
+ /* iterate over all neighbors on eigrp interface */
+ for (ALL_LIST_ELEMENTS (ei->nbrs, node2, nnode2, nbr))
+ {
+ /* compare if neighbor address is same as arg address */
+ if (nbr->src.s_addr == nbr_addr.s_addr)
+ {
+ return nbr;
+ }
+ }
+ }
+
+ return NULL;
}
@@ -187,7 +186,6 @@ eigrp_nbr_lookup_by_addr_process (struct eigrp *eigrp, struct in_addr nbr_addr)
void
eigrp_nbr_delete (struct eigrp_neighbor *nbr)
{
-
eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_DOWN);
eigrp_topology_neighbor_down(nbr->ei->eigrp, nbr);
@@ -209,7 +207,7 @@ holddown_timer_expired (struct thread *thread)
nbr = THREAD_ARG (thread);
zlog_info ("Neighbor %s (%s) is down: holding time expired",
- inet_ntoa(nbr->src), ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
+ inet_ntoa(nbr->src), ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
nbr->state = EIGRP_NEIGHBOR_DOWN;
eigrp_nbr_delete (nbr);
@@ -225,7 +223,6 @@ eigrp_nbr_state_get (struct eigrp_neighbor *nbr)
void
eigrp_nbr_state_set (struct eigrp_neighbor *nbr, u_char state)
{
-
nbr->state = state;
if (eigrp_nbr_state_get(nbr) == EIGRP_NEIGHBOR_DOWN)
@@ -251,7 +248,7 @@ eigrp_nbr_state_set (struct eigrp_neighbor *nbr, u_char state)
if (nbr->multicast_queue)
eigrp_fifo_free (nbr->multicast_queue);
if (nbr->retrans_queue)
- eigrp_fifo_free (nbr->retrans_queue);
+ eigrp_fifo_free (nbr->retrans_queue);
/* in with the new */
nbr->retrans_queue = eigrp_fifo_new ();
@@ -291,56 +288,55 @@ eigrp_nbr_state_update (struct eigrp_neighbor *nbr)
{
case EIGRP_NEIGHBOR_DOWN:
{
- /*Start Hold Down Timer for neighbor*/
-// THREAD_OFF(nbr->t_holddown);
-// THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired,
-// nbr, nbr->v_holddown);
- break;
+ /*Start Hold Down Timer for neighbor*/
+ // THREAD_OFF(nbr->t_holddown);
+ // THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired,
+ // nbr, nbr->v_holddown);
+ break;
}
case EIGRP_NEIGHBOR_PENDING:
{
- /*Reset Hold Down Timer for neighbor*/
- THREAD_OFF(nbr->t_holddown);
- THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired, nbr,
- nbr->v_holddown);
- break;
+ /*Reset Hold Down Timer for neighbor*/
+ THREAD_OFF(nbr->t_holddown);
+ THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired, nbr,
+ nbr->v_holddown);
+ break;
}
case EIGRP_NEIGHBOR_UP:
{
- /*Reset Hold Down Timer for neighbor*/
- THREAD_OFF(nbr->t_holddown);
- THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired, nbr,
- nbr->v_holddown);
- break;
+ /*Reset Hold Down Timer for neighbor*/
+ THREAD_OFF(nbr->t_holddown);
+ THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired, nbr,
+ nbr->v_holddown);
+ break;
}
}
}
int eigrp_nbr_count_get(void){
+ struct eigrp_interface *iface;
+ struct listnode *node, *node2, *nnode2;
+ struct eigrp_neighbor *nbr;
+ struct eigrp *eigrp = eigrp_lookup();
+ u_int32_t counter;
- struct eigrp_interface *iface;
- struct listnode *node, *node2, *nnode2;
- struct eigrp_neighbor *nbr;
- struct eigrp *eigrp = eigrp_lookup();
- u_int32_t counter;
-
- if (eigrp == NULL)
- {
- zlog_debug("EIGRP Routing Process not enabled");
- return 0;
- }
-
- counter=0;
- for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, iface))
- {
- for (ALL_LIST_ELEMENTS(iface->nbrs, node2, nnode2, nbr))
- {
- if (nbr->state == EIGRP_NEIGHBOR_UP){
- counter++;
- }
- }
- }
- return counter;
+ if (eigrp == NULL)
+ {
+ zlog_debug("EIGRP Routing Process not enabled");
+ return 0;
+ }
+
+ counter=0;
+ for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, iface))
+ {
+ for (ALL_LIST_ELEMENTS(iface->nbrs, node2, nnode2, nbr))
+ {
+ if (nbr->state == EIGRP_NEIGHBOR_UP){
+ counter++;
+ }
+ }
+ }
+ return counter;
}
/**
@@ -357,28 +353,28 @@ int eigrp_nbr_count_get(void){
*/
void eigrp_nbr_hard_restart(struct eigrp_neighbor *nbr, struct vty *vty)
{
- if(nbr == NULL)
- {
- zlog_err("Nbr Hard restart: Neighbor not specified.");
- return;
- }
-
- zlog_debug ("Neighbor %s (%s) is down: manually cleared",
- inet_ntoa (nbr->src),
- ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT));
- if(vty != NULL)
- {
- vty_time_print (vty, 0);
- vty_out (vty, "Neighbor %s (%s) is down: manually cleared%s",
- inet_ntoa (nbr->src),
- ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT),
- VTY_NEWLINE);
- }
-
- /* send Hello with Peer Termination TLV */
- eigrp_hello_send(nbr->ei, EIGRP_HELLO_GRACEFUL_SHUTDOWN_NBR, &(nbr->src));
- /* set neighbor to DOWN */
- nbr->state = EIGRP_NEIGHBOR_DOWN;
- /* delete neighbor */
- eigrp_nbr_delete (nbr);
+ if(nbr == NULL)
+ {
+ zlog_err("Nbr Hard restart: Neighbor not specified.");
+ return;
+ }
+
+ zlog_debug ("Neighbor %s (%s) is down: manually cleared",
+ inet_ntoa (nbr->src),
+ ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT));
+ if(vty != NULL)
+ {
+ vty_time_print (vty, 0);
+ vty_out (vty, "Neighbor %s (%s) is down: manually cleared%s",
+ inet_ntoa (nbr->src),
+ ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT),
+ VTY_NEWLINE);
+ }
+
+ /* send Hello with Peer Termination TLV */
+ eigrp_hello_send(nbr->ei, EIGRP_HELLO_GRACEFUL_SHUTDOWN_NBR, &(nbr->src));
+ /* set neighbor to DOWN */
+ nbr->state = EIGRP_NEIGHBOR_DOWN;
+ /* delete neighbor */
+ eigrp_nbr_delete (nbr);
}
diff --git a/eigrpd/eigrp_network.c b/eigrpd/eigrp_network.c
index fba7717b9..9898d1692 100644
--- a/eigrpd/eigrp_network.c
+++ b/eigrpd/eigrp_network.c
@@ -63,7 +63,7 @@ eigrp_sock_init(void)
if (eigrpd_privs.change(ZPRIVS_RAISE))
zlog_err("eigrp_sock_init: could not raise privs, %s",
- safe_strerror(errno));
+ safe_strerror(errno));
eigrp_sock = socket(AF_INET, SOCK_RAW, IPPROTO_EIGRPIGP);
if (eigrp_sock < 0)
@@ -71,7 +71,7 @@ eigrp_sock_init(void)
int save_errno = errno;
if (eigrpd_privs.change(ZPRIVS_LOWER))
zlog_err("eigrp_sock_init: could not lower privs, %s",
- safe_strerror(errno));
+ safe_strerror(errno));
zlog_err("eigrp_read_sock_init: socket: %s", safe_strerror(save_errno));
exit(1);
}
@@ -84,9 +84,9 @@ eigrp_sock_init(void)
int save_errno = errno;
if (eigrpd_privs.change(ZPRIVS_LOWER))
zlog_err("eigrp_sock_init: could not lower privs, %s",
- safe_strerror(errno));
+ safe_strerror(errno));
zlog_warn("Can't set IP_HDRINCL option for fd %d: %s", eigrp_sock,
- safe_strerror(save_errno));
+ safe_strerror(save_errno));
}
#elif defined (IPTOS_PREC_INTERNETCONTROL)
@@ -97,10 +97,10 @@ eigrp_sock_init(void)
{
int save_errno = errno;
if ( eigrpd_privs.change (ZPRIVS_LOWER) )
- zlog_err ("eigrpd_sock_init: could not lower privs, %s",
- safe_strerror (errno) );
+ zlog_err ("eigrpd_sock_init: could not lower privs, %s",
+ safe_strerror (errno) );
zlog_warn ("can't set sockopt IP_TOS %d to socket %d: %s",
- tos, eigrp_sock, safe_strerror (save_errno));
+ tos, eigrp_sock, safe_strerror (save_errno));
close (eigrp_sock); /* Prevent sd leak. */
return ret;
}
@@ -117,7 +117,7 @@ eigrp_sock_init(void)
if (eigrpd_privs.change(ZPRIVS_LOWER))
{
zlog_err("eigrp_sock_init: could not lower privs, %s",
- safe_strerror(errno));
+ safe_strerror(errno));
}
return eigrp_sock;
@@ -132,6 +132,7 @@ eigrp_adjust_sndbuflen(struct eigrp * eigrp, unsigned int buflen)
return;
if (eigrpd_privs.change(ZPRIVS_RAISE))
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
* (the MTU of a newly added interface). However, if the OS has
* truncated the actual buffer size to somewhat less size, try
@@ -143,7 +144,7 @@ eigrp_adjust_sndbuflen(struct eigrp * eigrp, unsigned int buflen)
newbuflen = getsockopt_so_sendbuf(eigrp->fd);
if (newbuflen < 0 || newbuflen < (int) buflen)
zlog_warn("%s: tried to set SO_SNDBUF to %u, but got %d", __func__, buflen,
- newbuflen);
+ newbuflen);
if (newbuflen >= 0)
eigrp->maxsndbuflen = (unsigned int) newbuflen;
else
@@ -172,13 +173,13 @@ eigrp_if_ipmulticast(struct eigrp *top, struct prefix *p, unsigned int ifindex)
ret = setsockopt(top->fd, IPPROTO_IP, IP_MULTICAST_TTL, (void *) &val, len);
if (ret < 0)
zlog_warn("can't setsockopt IP_MULTICAST_TTL (1) for fd %d: %s", top->fd,
- safe_strerror(errno));
+ safe_strerror(errno));
ret = setsockopt_ipv4_multicast_if(top->fd, p->u.prefix4, ifindex);
if (ret < 0)
zlog_warn("can't setsockopt IP_MULTICAST_IF (fd %d, addr %s, "
- "ifindex %u): %s", top->fd, inet_ntoa(p->u.prefix4), ifindex,
- safe_strerror(errno));
+ "ifindex %u): %s", top->fd, inet_ntoa(p->u.prefix4), ifindex,
+ safe_strerror(errno));
return ret;
}
@@ -186,7 +187,7 @@ eigrp_if_ipmulticast(struct eigrp *top, struct prefix *p, unsigned int ifindex)
/* Join to the EIGRP multicast group. */
int
eigrp_if_add_allspfrouters(struct eigrp *top, struct prefix *p,
- unsigned int ifindex)
+ unsigned int ifindex)
{
int ret;
@@ -194,19 +195,19 @@ eigrp_if_add_allspfrouters(struct eigrp *top, struct prefix *p,
htonl(EIGRP_MULTICAST_ADDRESS), ifindex);
if (ret < 0)
zlog_warn("can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, "
- "ifindex %u, AllSPFRouters): %s; perhaps a kernel limit "
- "on # of multicast group memberships has been exceeded?", top->fd,
- inet_ntoa(p->u.prefix4), ifindex, safe_strerror(errno));
+ "ifindex %u, AllSPFRouters): %s; perhaps a kernel limit "
+ "on # of multicast group memberships has been exceeded?", top->fd,
+ inet_ntoa(p->u.prefix4), ifindex, safe_strerror(errno));
else
zlog_debug("interface %s [%u] join EIGRP Multicast group.",
- inet_ntoa(p->u.prefix4), ifindex);
+ inet_ntoa(p->u.prefix4), ifindex);
return ret;
}
int
eigrp_if_drop_allspfrouters(struct eigrp *top, struct prefix *p,
- unsigned int ifindex)
+ unsigned int ifindex)
{
int ret;
@@ -214,11 +215,11 @@ eigrp_if_drop_allspfrouters(struct eigrp *top, struct prefix *p,
htonl(EIGRP_MULTICAST_ADDRESS), ifindex);
if (ret < 0)
zlog_warn("can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %s, "
- "ifindex %u, AllSPFRouters): %s", top->fd, inet_ntoa(p->u.prefix4),
- ifindex, safe_strerror(errno));
+ "ifindex %u, AllSPFRouters): %s", top->fd, inet_ntoa(p->u.prefix4),
+ ifindex, safe_strerror(errno));
else
zlog_debug("interface %s [%u] leave EIGRP Multicast group.",
- inet_ntoa(p->u.prefix4), ifindex);
+ inet_ntoa(p->u.prefix4), ifindex);
return ret;
}
@@ -230,7 +231,6 @@ eigrp_network_set(struct eigrp *eigrp, struct prefix_ipv4 *p)
struct interface *ifp;
struct listnode *node;
- zlog_debug ("A");
rn = route_node_get(eigrp->networks, (struct prefix *) p);
if (rn->info)
{
@@ -243,10 +243,9 @@ eigrp_network_set(struct eigrp *eigrp, struct prefix_ipv4 *p)
PREFIX_COPY_IPV4(pref,p);
rn->info = (void *) pref;
- zlog_debug ("B");
/* Schedule Router ID Update. */
-// if (eigrp->router_id == 0)
-// eigrp_router_id_update(eigrp);
+ // if (eigrp->router_id == 0)
+ // eigrp_router_id_update(eigrp);
/* Run network config now. */
/* Get target interface. */
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
@@ -269,13 +268,13 @@ eigrp_network_match_iface(const struct connected *co, const struct prefix *net)
static void
eigrp_network_run_interface(struct eigrp *eigrp, struct prefix *p,
- struct interface *ifp)
+ struct interface *ifp)
{
struct listnode *cnode;
struct connected *co;
/* if interface prefix is match specified prefix,
- then create socket and join multicast group. */
+ then create socket and join multicast group. */
for (ALL_LIST_ELEMENTS_RO(ifp->connected, cnode, co))
{
@@ -298,7 +297,7 @@ eigrp_network_run_interface(struct eigrp *eigrp, struct prefix *p,
/* update network type as interface flag */
/* If network type is specified previously,
- skip network type setting. */
+ skip network type setting. */
ei->type = IF_DEF_PARAMS (ifp)->type;
/* if router_id is not configured, dont bring up
@@ -354,7 +353,7 @@ eigrp_network_unset(struct eigrp *eigrp, struct prefix_ipv4 *p)
route_unlock_node (rn);
if (!IPV4_ADDR_SAME (&pref->u.prefix4, &p->prefix))
- return 0;
+ return 0;
prefix_ipv4_free(rn->info);
rn->info = NULL;
@@ -373,7 +372,6 @@ eigrp_network_unset(struct eigrp *eigrp, struct prefix_ipv4 *p)
if (eigrp_network_match_iface(co, &rn->p))
{
- zlog_debug("eigrp_network_unset()2");
found = 1;
route_unlock_node(rn);
break;
@@ -404,7 +402,7 @@ eigrp_calculate_metrics(struct eigrp *eigrp, struct eigrp_metrics *metric)
temp_metric += (eigrp->k_values[0] * metric->bandwith);
if (eigrp->k_values[1])
temp_metric += ((eigrp->k_values[1] * metric->bandwith)
- / (256 - metric->load));
+ / (256 - metric->load));
if (eigrp->k_values[2])
temp_metric += (eigrp->k_values[2] * metric->delay);
if (eigrp->k_values[3] && !eigrp->k_values[4])
@@ -413,7 +411,7 @@ eigrp_calculate_metrics(struct eigrp *eigrp, struct eigrp_metrics *metric)
temp_metric *= (eigrp->k_values[4] / metric->reliability);
if (eigrp->k_values[3] && eigrp->k_values[4])
temp_metric *= ((eigrp->k_values[4] / metric->reliability)
- + eigrp->k_values[3]);
+ + eigrp->k_values[3]);
if (temp_metric <= EIGRP_MAX_METRIC)
return (u_int32_t) temp_metric;
@@ -423,24 +421,24 @@ eigrp_calculate_metrics(struct eigrp *eigrp, struct eigrp_metrics *metric)
u_int32_t
eigrp_calculate_total_metrics(struct eigrp *eigrp,
- struct eigrp_neighbor_entry *entry)
+ struct eigrp_neighbor_entry *entry)
{
entry->total_metric = entry->reported_metric;
u_int64_t temp_delay = (u_int64_t) entry->total_metric.delay
- + (u_int64_t) EIGRP_IF_PARAM (entry->ei, delay);
+ + (u_int64_t) EIGRP_IF_PARAM (entry->ei, delay);
entry->total_metric.delay =
- temp_delay > EIGRP_MAX_METRIC ? EIGRP_MAX_METRIC : (u_int32_t) temp_delay;
+ temp_delay > EIGRP_MAX_METRIC ? EIGRP_MAX_METRIC : (u_int32_t) temp_delay;
u_int32_t bw = EIGRP_IF_PARAM (entry->ei,bandwidth);
entry->total_metric.bandwith =
- entry->total_metric.bandwith > bw ? bw : entry->total_metric.bandwith;
+ entry->total_metric.bandwith > bw ? bw : entry->total_metric.bandwith;
return eigrp_calculate_metrics(eigrp, &entry->total_metric);
}
u_char
eigrp_metrics_is_same(struct eigrp_metrics *metric1,
- struct eigrp_metrics *metric2)
+ struct eigrp_metrics *metric2)
{
if ((metric1->bandwith == metric2->bandwith)
&& (metric1->delay == metric2->delay)
@@ -452,12 +450,12 @@ eigrp_metrics_is_same(struct eigrp_metrics *metric1,
&& (metric1->mtu[2] == metric2->mtu[2]))
return 1;
- return 0; // if different
+ return 0; // if different
}
+
void
eigrp_external_routes_refresh (struct eigrp *eigrp, int type)
{
-
}
diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c
index ef6993325..5b62e98ab 100644
--- a/eigrpd/eigrp_packet.c
+++ b/eigrpd/eigrp_packet.c
@@ -59,18 +59,19 @@
/* Packet Type String. */
const struct message eigrp_packet_type_str[] =
-{
- { EIGRP_OPC_UPDATE, "Update" },
- { EIGRP_OPC_REQUEST, "Request" },
- { EIGRP_OPC_QUERY, "Query" },
- { EIGRP_OPC_REPLY, "Reply" },
- { EIGRP_OPC_HELLO, "Hello" },
- { EIGRP_OPC_IPXSAP, "IPX-SAP" },
- { EIGRP_OPC_PROBE, "Probe" },
- { EIGRP_OPC_ACK, "Ack" },
- { EIGRP_OPC_SIAQUERY, "SIAQuery" },
- { EIGRP_OPC_SIAREPLY, "SIAReply" },
+ {
+ { EIGRP_OPC_UPDATE, "Update"},
+ { EIGRP_OPC_REQUEST, "Request"},
+ { EIGRP_OPC_QUERY, "Query"},
+ { EIGRP_OPC_REPLY, "Reply"},
+ { EIGRP_OPC_HELLO, "Hello"},
+ { EIGRP_OPC_IPXSAP, "IPX-SAP"},
+ { EIGRP_OPC_PROBE, "Probe"},
+ { EIGRP_OPC_ACK, "Ack"},
+ { EIGRP_OPC_SIAQUERY, "SIAQuery"},
+ { EIGRP_OPC_SIAREPLY, "SIAReply"},
};
+
const size_t eigrp_packet_type_str_max = sizeof(eigrp_packet_type_str) /
sizeof(eigrp_packet_type_str[0]);
@@ -79,10 +80,9 @@ static unsigned char zeropad[16] = {0};
/* Forward function reference*/
static struct stream * eigrp_recv_packet (int, struct interface **, struct stream *);
static int eigrp_verify_header (struct stream *, struct eigrp_interface *, struct ip *,
- struct eigrp_header *);
+ struct eigrp_header *);
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)
{
return 1;
@@ -125,7 +125,7 @@ eigrp_make_md5_digest (struct eigrp_interface *ei, struct stream *s, u_char flag
MD5Update(&ctx, ibuf, EIGRP_MD5_BASIC_COMPUTE);
MD5Update(&ctx, key->string, strlen(key->string));
if(strlen(key->string) < 16)
- MD5Update(&ctx, zeropad, 16 - strlen(key->string));
+ MD5Update(&ctx, zeropad, 16 - strlen(key->string));
}
else if(flags & EIGRP_AUTH_UPDATE_INIT_FLAG)
{
@@ -136,17 +136,16 @@ eigrp_make_md5_digest (struct eigrp_interface *ei, struct stream *s, u_char flag
MD5Update(&ctx, ibuf, EIGRP_MD5_BASIC_COMPUTE);
MD5Update(&ctx, key->string, strlen(key->string));
if(strlen(key->string) < 16)
- MD5Update(&ctx, zeropad, 16 - strlen(key->string));
+ MD5Update(&ctx, zeropad, 16 - strlen(key->string));
if(backup_end > (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE))
- {
- MD5Update(&ctx, ibuf + (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE),
- backup_end - 20 - (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE));
- }
+ {
+ MD5Update(&ctx, ibuf + (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE),
+ backup_end - 20 - (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE));
+ }
}
MD5Final(digest, &ctx);
-
/* Append md5 digest to the end of the stream. */
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
-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;
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 eigrp_header *eigrph;
-
if (nbr && ntohl(nbr->crypt_seqnum) > ntohl(authTLV->key_sequence))
{
zlog_warn ("interface %s: eigrp_check_md5 bad sequence %d (expect %d)",
@@ -190,8 +189,8 @@ eigrp_check_md5_digest (struct stream *s, struct TLV_MD5_Authentication_Type *au
backup_end = s->endp;
keychain = keychain_lookup(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain);
- if(keychain)
- key = key_lookup_for_send(keychain);
+ if(keychain)
+ key = key_lookup_for_send(keychain);
memset(&ctx, 0, sizeof(ctx));
MD5Init(&ctx);
@@ -217,7 +216,7 @@ eigrp_check_md5_digest (struct stream *s, struct TLV_MD5_Authentication_Type *au
if(backup_end > (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE))
{
MD5Update(&ctx, ibuf + (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE),
- backup_end - 20 - (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE));
+ backup_end - 20 - (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE));
}
}
@@ -231,7 +230,7 @@ eigrp_check_md5_digest (struct stream *s, struct TLV_MD5_Authentication_Type *au
else
{
zlog_warn ("interface %s: eigrp_check_md5 checksum mismatch",
- IF_NAME (nbr->ei));
+ IF_NAME (nbr->ei));
return 0;
}
@@ -245,65 +244,67 @@ eigrp_check_md5_digest (struct stream *s, struct TLV_MD5_Authentication_Type *au
int
eigrp_make_sha256_digest (struct eigrp_interface *ei, struct stream *s, u_char flags)
{
- struct key *key = NULL;
- struct keychain *keychain;
- char *source_ip;
+ struct key *key = NULL;
+ struct keychain *keychain;
+ char *source_ip;
- unsigned char digest[EIGRP_AUTH_TYPE_SHA256_LEN];
- unsigned char buffer[1 + PLAINTEXT_LENGTH + 45 + 1] = { 0 };
- HMAC_SHA256_CTX ctx;
- void *ibuf;
- size_t backup_get, backup_end;
- struct TLV_SHA256_Authentication_Type *auth_TLV;
+ unsigned char digest[EIGRP_AUTH_TYPE_SHA256_LEN];
+ unsigned char buffer[1 + PLAINTEXT_LENGTH + 45 + 1] = { 0 };
+ HMAC_SHA256_CTX ctx;
+ void *ibuf;
+ size_t backup_get, backup_end;
+ struct TLV_SHA256_Authentication_Type *auth_TLV;
- ibuf = s->data;
- backup_end = s->endp;
- backup_get = s->getp;
+ ibuf = s->data;
+ backup_end = s->endp;
+ backup_get = s->getp;
- auth_TLV = eigrp_authTLV_SHA256_new ();
+ auth_TLV = eigrp_authTLV_SHA256_new ();
- stream_set_getp(s,EIGRP_HEADER_LEN);
- stream_get(auth_TLV,s,EIGRP_AUTH_SHA256_TLV_SIZE);
- stream_set_getp(s, backup_get);
+ stream_set_getp(s,EIGRP_HEADER_LEN);
+ stream_get(auth_TLV,s,EIGRP_AUTH_SHA256_TLV_SIZE);
+ stream_set_getp(s, backup_get);
- keychain = keychain_lookup(IF_DEF_PARAMS (ei->ifp)->auth_keychain);
- if(keychain)
- key = key_lookup_for_send(keychain);
+ keychain = keychain_lookup(IF_DEF_PARAMS (ei->ifp)->auth_keychain);
+ if(keychain)
+ key = key_lookup_for_send(keychain);
-// saved_len[index] = strnzcpyn(saved_key[index], key,
-// PLAINTEXT_LENGTH + 1);
+ // saved_len[index] = strnzcpyn(saved_key[index], key,
+ // PLAINTEXT_LENGTH + 1);
- source_ip = calloc(16, sizeof(char));
- inet_ntop(AF_INET, &ei->address->u.prefix4, source_ip, 16);
+ source_ip = calloc(16, sizeof(char));
+ inet_ntop(AF_INET, &ei->address->u.prefix4, source_ip, 16);
- memset(&ctx, 0, sizeof(ctx));
- buffer[0] = '\n';
- memcpy(buffer + 1, key, strlen (key->string));
- memcpy(buffer + 1 + strlen(key->string), source_ip, strlen(source_ip));
- HMAC__SHA256_Init(&ctx, buffer, 1 + strlen (key->string) + strlen(source_ip));
- HMAC__SHA256_Update(&ctx, ibuf, strlen(ibuf));
- HMAC__SHA256_Final(digest, &ctx);
+ memset(&ctx, 0, sizeof(ctx));
+ buffer[0] = '\n';
+ memcpy(buffer + 1, key, strlen (key->string));
+ memcpy(buffer + 1 + strlen(key->string), source_ip, strlen(source_ip));
+ HMAC__SHA256_Init(&ctx, buffer, 1 + strlen (key->string) + strlen(source_ip));
+ HMAC__SHA256_Update(&ctx, ibuf, strlen(ibuf));
+ HMAC__SHA256_Final(digest, &ctx);
- /* Put hmac-sha256 digest to it's place */
- memcpy(auth_TLV->digest,digest,EIGRP_AUTH_TYPE_SHA256_LEN);
+ /* Put hmac-sha256 digest to it's place */
+ memcpy(auth_TLV->digest,digest,EIGRP_AUTH_TYPE_SHA256_LEN);
- stream_set_endp(s,EIGRP_HEADER_LEN);
- stream_put(s,auth_TLV,EIGRP_AUTH_SHA256_TLV_SIZE);
- stream_set_endp(s, backup_end);
+ stream_set_endp(s,EIGRP_HEADER_LEN);
+ stream_put(s,auth_TLV,EIGRP_AUTH_SHA256_TLV_SIZE);
+ stream_set_endp(s, backup_end);
- eigrp_authTLV_SHA256_free(auth_TLV);
- free(source_ip);
+ eigrp_authTLV_SHA256_free(auth_TLV);
+ free(source_ip);
- return EIGRP_AUTH_TYPE_SHA256_LEN;
+ return EIGRP_AUTH_TYPE_SHA256_LEN;
}
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;
}
+
/*
* eigrp_packet_dump
*
@@ -313,31 +314,10 @@ eigrp_check_sha256_digest (struct stream *s, struct TLV_SHA256_Authentication_Ty
static void
eigrp_packet_dump (struct stream *s)
{
- // not yet...
- return;
+ // not yet...
+ 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
eigrp_write (struct thread *thread)
{
@@ -369,7 +349,7 @@ eigrp_write (struct thread *thread)
#ifdef WANT_EIGRP_WRITE_FRAGMENT
/* seed ipid static with low order bits of time */
if (ipid == 0)
- ipid = (time(NULL) & 0xffff);
+ ipid = (time(NULL) & 0xffff);
#endif /* WANT_EIGRP_WRITE_FRAGMENT */
/* Get one packet from queue. */
@@ -438,15 +418,15 @@ eigrp_write (struct thread *thread)
eigrph = (struct eigrp_header *) STREAM_DATA(ep->s);
opcode = eigrph->opcode;
zlog_debug("Sending [%s] to [%s] via [%s] ret [%d].",
- LOOKUP(eigrp_packet_type_str, opcode), inet_ntoa(ep->dst),
- IF_NAME(ei), ret);
+ LOOKUP(eigrp_packet_type_str, opcode), inet_ntoa(ep->dst),
+ IF_NAME(ei), ret);
}
if (ret < 0)
zlog_warn("*** sendmsg in eigrp_write failed to %s, "
- "id %d, off %d, len %d, interface %s, mtu %u: %s",
- inet_ntoa(iph.ip_dst), iph.ip_id, iph.ip_off, iph.ip_len, ei->ifp->name,
- ei->ifp->mtu, safe_strerror(errno));
+ "id %d, off %d, len %d, interface %s, mtu %u: %s",
+ inet_ntoa(iph.ip_dst), iph.ip_id, iph.ip_off, iph.ip_len, ei->ifp->name,
+ ei->ifp->mtu, safe_strerror(errno));
/* Show debug sending packet. */
if (IS_DEBUG_EIGRP_TRANSMIT(0, SEND) && (IS_DEBUG_EIGRP_TRANSMIT(0, PACKET_DETAIL)))
@@ -504,29 +484,29 @@ eigrp_read (struct thread *thread)
}
/* Note that there should not be alignment problems with this assignment
- because this is at the beginning of the stream data buffer. */
+ because this is at the beginning of the stream data buffer. */
iph = (struct ip *)STREAM_DATA(ibuf);
//Substract IPv4 header size from EIGRP Packet itself
if(iph->ip_v == 4)
- length = (iph->ip_len) - 20U;
+ length = (iph->ip_len) - 20U;
/* IP Header dump. */
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV) && IS_DEBUG_EIGRP_TRANSMIT(0, PACKET_DETAIL))
- eigrp_ip_header_dump(iph);
+ eigrp_ip_header_dump(iph);
/* Note that sockopt_iphdrincl_swab_systoh was called in eigrp_recv_packet. */
if (ifp == NULL)
{
struct connected *c;
/* Handle cases where the platform does not support retrieving the ifindex,
- and also platforms (such as Solaris 8) that claim to support ifindex
- retrieval but do not. */
+ and also platforms (such as Solaris 8) that claim to support ifindex
+ retrieval but do not. */
c = if_lookup_address((void *)&iph->ip_src, AF_INET, VRF_DEFAULT);
if (c == NULL)
- return 0;
+ return 0;
ifp = c->ifp;
}
@@ -547,13 +527,13 @@ eigrp_read (struct thread *thread)
(IPV4_ADDR_SAME(&iph->ip_src.s_addr, &ei->address->u.prefix4)))
{
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
- zlog_debug("eigrp_read[%s]: Dropping self-originated packet",
- inet_ntoa(iph->ip_src));
+ zlog_debug("eigrp_read[%s]: Dropping self-originated packet",
+ inet_ntoa(iph->ip_src));
return 0;
}
/* Advance from IP header to EIGRP header (iph->ip_hl has been verified
- by eigrp_recv_packet() to be correct). */
+ by eigrp_recv_packet() to be correct). */
stream_forward_getp(ibuf, (iph->ip_hl * 4));
eigrph = (struct eigrp_header *) STREAM_PNT(ibuf);
@@ -561,18 +541,18 @@ eigrp_read (struct thread *thread)
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV) && IS_DEBUG_EIGRP_TRANSMIT(0, PACKET_DETAIL))
eigrp_header_dump(eigrph);
-// if (MSG_OK != eigrp_packet_examin(eigrph, stream_get_endp(ibuf) - stream_get_getp(ibuf)))
-// return -1;
+ // if (MSG_OK != eigrp_packet_examin(eigrph, stream_get_endp(ibuf) - stream_get_getp(ibuf)))
+ // return -1;
/* Now it is safe to access all fields of EIGRP packet header. */
/* associate packet with eigrp interface */
ei = eigrp_if_lookup_recv_if(eigrp, iph->ip_src, ifp);
/* eigrp_verify_header() relies on a valid "ei" and thus can be called only
- after the checks below are passed. These checks in turn access the
- fields of unverified "eigrph" structure for their own purposes and
- must remain very accurate in doing this.
- */
+ after the checks below are passed. These checks in turn access the
+ fields of unverified "eigrph" structure for their own purposes and
+ must remain very accurate in doing this.
+ */
if (!ei)
return 0;
@@ -582,22 +562,22 @@ eigrp_read (struct thread *thread)
char buf[3][INET_ADDRSTRLEN];
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
- zlog_debug("ignoring packet from router %s sent to %s, "
- "received on a passive interface, %s",
- inet_ntop(AF_INET, &eigrph->vrid, buf[0], sizeof(buf[0])),
- inet_ntop(AF_INET, &iph->ip_dst, buf[1], sizeof(buf[1])),
- inet_ntop(AF_INET, &ei->address->u.prefix4,
- buf[2], sizeof(buf[2])));
+ zlog_debug("ignoring packet from router %s sent to %s, "
+ "received on a passive interface, %s",
+ inet_ntop(AF_INET, &eigrph->vrid, buf[0], sizeof(buf[0])),
+ inet_ntop(AF_INET, &iph->ip_dst, buf[1], sizeof(buf[1])),
+ inet_ntop(AF_INET, &ei->address->u.prefix4,
+ buf[2], sizeof(buf[2])));
if (iph->ip_dst.s_addr == htonl(EIGRP_MULTICAST_ADDRESS))
{
- /* Try to fix multicast membership.
- * Some OS:es may have problems in this area,
- * make sure it is removed.
- */
- EI_MEMBER_JOINED(ei, MEMBER_ALLROUTERS);
- eigrp_if_set_multicast(ei);
- }
+ /* Try to fix multicast membership.
+ * Some OS:es may have problems in this area,
+ * make sure it is removed.
+ */
+ EI_MEMBER_JOINED(ei, MEMBER_ALLROUTERS);
+ eigrp_if_set_multicast(ei);
+ }
return 0;
}
@@ -608,7 +588,7 @@ eigrp_read (struct thread *thread)
{
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
zlog_warn("Packet from [%s] received on wrong link %s",
- inet_ntoa(iph->ip_src), ifp->name);
+ inet_ntoa(iph->ip_src), ifp->name);
return 0;
}
@@ -628,13 +608,12 @@ eigrp_read (struct thread *thread)
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
zlog_debug("Received [%s] length [%u] via [%s] src [%s] dst [%s]",
- LOOKUP(eigrp_packet_type_str, opcode), length,
- IF_NAME(ei), inet_ntoa(iph->ip_src), inet_ntoa(iph->ip_dst));
+ LOOKUP(eigrp_packet_type_str, opcode), length,
+ IF_NAME(ei), inet_ntoa(iph->ip_src), inet_ntoa(iph->ip_dst));
/* Read rest of the packet and call each sort of packet routine. */
stream_forward_getp(ibuf, EIGRP_HEADER_LEN);
-
/* New testing block of code for handling Acks */
if (ntohl(eigrph->ack) != 0)
{
@@ -643,42 +622,43 @@ eigrp_read (struct thread *thread)
/* neighbor must be valid, eigrp_nbr_get creates if none existed */
assert(nbr);
- struct eigrp_packet *ep;
+ struct eigrp_packet *ep;
- ep = eigrp_fifo_tail(nbr->retrans_queue);
- if (ep != NULL)
- {
- if (ntohl(eigrph->ack) == ep->sequence_number)
- {
- if((nbr->state == EIGRP_NEIGHBOR_PENDING) && (ntohl(eigrph->ack) == nbr->init_sequence_number))
- {
- eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_UP);
- zlog_info("Neighbor adjacency became full");
- nbr->init_sequence_number = 0;
- nbr->recv_sequence_number = ntohl(eigrph->sequence);
- eigrp_update_send_EOT(nbr);
- }
- ep = eigrp_fifo_pop_tail(nbr->retrans_queue);
- /*eigrp_packet_free(ep);*/
- if (nbr->retrans_queue->count > 0)
- {
- eigrp_send_packet_reliably(nbr);
- }
- }
- }
- ep = eigrp_fifo_tail(nbr->multicast_queue);
- if (ep != NULL)
- {
- if (ntohl(eigrph->ack) == ep->sequence_number)
- {
- ep = eigrp_fifo_pop_tail(nbr->multicast_queue);
- eigrp_packet_free(ep);
- if (nbr->multicast_queue->count > 0)
+ ep = eigrp_fifo_tail(nbr->retrans_queue);
+ if (ep != NULL)
+ {
+ if (ntohl(eigrph->ack) == ep->sequence_number)
+ {
+ if((nbr->state == EIGRP_NEIGHBOR_PENDING) &&
+ (ntohl(eigrph->ack) == nbr->init_sequence_number))
+ {
+ eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_UP);
+ zlog_info("Neighbor adjacency became full");
+ nbr->init_sequence_number = 0;
+ nbr->recv_sequence_number = ntohl(eigrph->sequence);
+ eigrp_update_send_EOT(nbr);
+ }
+ ep = eigrp_fifo_pop_tail(nbr->retrans_queue);
+ /*eigrp_packet_free(ep);*/
+ if (nbr->retrans_queue->count > 0)
{
eigrp_send_packet_reliably(nbr);
}
- }
- }
+ }
+ }
+ ep = eigrp_fifo_tail(nbr->multicast_queue);
+ if (ep != NULL)
+ {
+ if (ntohl(eigrph->ack) == ep->sequence_number)
+ {
+ ep = eigrp_fifo_pop_tail(nbr->multicast_queue);
+ eigrp_packet_free(ep);
+ if (nbr->multicast_queue->count > 0)
+ {
+ eigrp_send_packet_reliably(nbr);
+ }
+ }
+ }
}
@@ -710,7 +690,7 @@ eigrp_read (struct thread *thread)
break;
default:
zlog_warn("interface %s: EIGRP packet header type %d unsupported",
- IF_NAME(ei), opcode);
+ IF_NAME(ei), opcode);
break;
}
@@ -744,12 +724,12 @@ eigrp_recv_packet (int fd, struct interface **ifp, struct stream *ibuf)
if ((unsigned int) ret < sizeof(iph)) /* ret must be > 0 now */
{
zlog_warn("eigrp_recv_packet: discarding runt packet of length %d "
- "(ip header size is %u)", ret, (u_int) sizeof(iph));
+ "(ip header size is %u)", ret, (u_int) sizeof(iph));
return NULL;
}
/* Note that there should not be alignment problems with this assignment
- because this is at the beginning of the stream data buffer. */
+ because this is at the beginning of the stream data buffer. */
iph = (struct ip *) STREAM_DATA(ibuf);
sockopt_iphdrincl_swab_systoh(iph);
@@ -789,7 +769,7 @@ eigrp_recv_packet (int fd, struct interface **ifp, struct stream *ibuf)
if (ret != ip_len)
{
zlog_warn("eigrp_recv_packet read length mismatch: ip_len is %d, "
- "but recvmsg returned %d", ip_len, ret);
+ "but recvmsg returned %d", ip_len, ret);
return NULL;
}
@@ -867,7 +847,7 @@ eigrp_send_packet_reliably (struct eigrp_neighbor *nbr)
/*Start retransmission timer*/
THREAD_TIMER_ON(master, ep->t_retrans_timer, eigrp_unack_packet_retrans,
- nbr, EIGRP_PACKET_RETRANS_TIME);
+ nbr, EIGRP_PACKET_RETRANS_TIME);
/*Increment sequence number counter*/
nbr->ei->eigrp->sequence_number++;
@@ -880,14 +860,14 @@ eigrp_send_packet_reliably (struct eigrp_neighbor *nbr)
}
if (nbr->ei->eigrp->t_write == NULL)
nbr->ei->eigrp->t_write =
- thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd);
+ thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd);
}
}
/* Calculate EIGRP checksum */
void
eigrp_packet_checksum (struct eigrp_interface *ei, struct stream *s,
- u_int16_t length)
+ u_int16_t length)
{
struct eigrp_header *eigrph;
@@ -900,7 +880,7 @@ eigrp_packet_checksum (struct eigrp_interface *ei, struct stream *s,
/* Make EIGRP header. */
void
eigrp_packet_header_init (int type, struct eigrp_interface *ei, struct stream *s,
- u_int32_t flags, u_int32_t sequence, u_int32_t ack)
+ u_int32_t flags, u_int32_t sequence, u_int32_t ack)
{
struct eigrp_header *eigrph;
@@ -914,13 +894,13 @@ eigrp_packet_header_init (int type, struct eigrp_interface *ei, struct stream *s
eigrph->ASNumber = htons(ei->eigrp->AS);
eigrph->ack = htonl(ack);
eigrph->sequence = htonl(sequence);
-// if(flags == EIGRP_INIT_FLAG)
-// eigrph->sequence = htonl(3);
+ // if(flags == EIGRP_INIT_FLAG)
+ // eigrph->sequence = htonl(3);
eigrph->flags = htonl(flags);
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
zlog_debug("Packet Header Init Seq [%u] Ack [%u]",
- htonl(eigrph->sequence), htonl(eigrph->ack));
+ htonl(eigrph->sequence), htonl(eigrph->ack));
stream_forward_endp(s, EIGRP_HEADER_LEN);
}
@@ -1007,27 +987,26 @@ eigrp_packet_free (struct eigrp_packet *ep)
/* EIGRP Header verification. */
static int
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. */
if (!eigrp_check_network_mask(ei, iph->ip_src))
{
zlog_warn("interface %s: eigrp_read network address is not same [%s]",
- IF_NAME(ei), inet_ntoa(iph->ip_src));
+ IF_NAME(ei), inet_ntoa(iph->ip_src));
return -1;
}
-//
-// /* Check authentication. The function handles logging actions, where required. */
-// if (! eigrp_check_auth(ei, eigrph))
-// return -1;
+ //
+ // /* Check authentication. The function handles logging actions, where required. */
+ // if (! eigrp_check_auth(ei, eigrph))
+ // return -1;
return 0;
}
/* Unbound socket will accept any Raw IP packets if proto is matched.
- To prevent it, compare src IP address and i/f address with masking
- i/f network mask. */
+ To prevent it, compare src IP address and i/f address with masking
+ i/f network mask. */
static int
eigrp_check_network_mask (struct eigrp_interface *ei, struct in_addr ip_src)
{
@@ -1080,7 +1059,7 @@ eigrp_unack_packet_retrans (struct thread *thread)
}
if (nbr->ei->eigrp->t_write == NULL)
nbr->ei->eigrp->t_write =
- thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd);
+ thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd);
}
return 0;
@@ -1108,7 +1087,7 @@ eigrp_unack_multicast_packet_retrans (struct thread *thread)
/*Start retransmission timer*/
ep->t_retrans_timer =
- thread_add_timer(master, eigrp_unack_multicast_packet_retrans, nbr,EIGRP_PACKET_RETRANS_TIME);
+ thread_add_timer(master, eigrp_unack_multicast_packet_retrans, nbr,EIGRP_PACKET_RETRANS_TIME);
/* Hook thread to write packet. */
if (nbr->ei->on_write_q == 0)
@@ -1118,7 +1097,7 @@ eigrp_unack_multicast_packet_retrans (struct thread *thread)
}
if (nbr->ei->eigrp->t_write == NULL)
nbr->ei->eigrp->t_write =
- thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd);
+ thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd);
}
return 0;
@@ -1189,22 +1168,22 @@ eigrp_read_ipv4_tlv (struct stream *s)
{
tlv->destination_part[0] = stream_getc(s);
tlv->destination.s_addr = (tlv->destination_part[0]);
-
}
else if (tlv->prefix_length > 8 && tlv->prefix_length <= 16)
{
tlv->destination_part[0] = stream_getc(s);
tlv->destination_part[1] = stream_getc(s);
tlv->destination.s_addr = ((tlv->destination_part[1] << 8)
- + tlv->destination_part[0]);
+ + tlv->destination_part[0]);
}
else if (tlv->prefix_length > 16 && tlv->prefix_length <= 24)
{
tlv->destination_part[0] = stream_getc(s);
tlv->destination_part[1] = stream_getc(s);
tlv->destination_part[2] = stream_getc(s);
- tlv->destination.s_addr = ((tlv->destination_part[2] << 16)
- + (tlv->destination_part[1] << 8) + tlv->destination_part[0]);
+ tlv->destination.s_addr = ((tlv->destination_part[2] << 16) +
+ (tlv->destination_part[1] << 8) +
+ tlv->destination_part[0]);
}
else if (tlv->prefix_length > 24 && tlv->prefix_length <= 32)
{
@@ -1212,16 +1191,17 @@ eigrp_read_ipv4_tlv (struct stream *s)
tlv->destination_part[1] = stream_getc(s);
tlv->destination_part[2] = stream_getc(s);
tlv->destination_part[3] = stream_getc(s);
- tlv->destination.s_addr = ((tlv->destination_part[3] << 24)
- + (tlv->destination_part[2] << 16) + (tlv->destination_part[1] << 8)
- + tlv->destination_part[0]);
+ tlv->destination.s_addr = ((tlv->destination_part[3] << 24) +
+ (tlv->destination_part[2] << 16) +
+ (tlv->destination_part[1] << 8) +
+ tlv->destination_part[0]);
}
return tlv;
}
u_int16_t
eigrp_add_internalTLV_to_stream (struct stream *s,
- struct eigrp_prefix_entry *pe)
+ struct eigrp_prefix_entry *pe)
{
u_int16_t length;
@@ -1295,7 +1275,7 @@ eigrp_add_internalTLV_to_stream (struct stream *s,
u_int16_t
eigrp_add_authTLV_MD5_to_stream (struct stream *s,
- struct eigrp_interface *ei)
+ struct eigrp_interface *ei)
{
struct key *key;
struct keychain *keychain;
@@ -1310,7 +1290,6 @@ eigrp_add_authTLV_MD5_to_stream (struct stream *s,
authTLV->key_sequence = 0;
memset(authTLV->Nullpad,0,sizeof(authTLV->Nullpad));
-
keychain = keychain_lookup(IF_DEF_PARAMS (ei->ifp)->auth_keychain);
if(keychain)
key = key_lookup_for_send(keychain);
@@ -1338,7 +1317,7 @@ eigrp_add_authTLV_MD5_to_stream (struct stream *s,
u_int16_t
eigrp_add_authTLV_SHA256_to_stream (struct stream *s,
- struct eigrp_interface *ei)
+ struct eigrp_interface *ei)
{
struct key *key;
struct keychain *keychain;
@@ -1353,7 +1332,6 @@ eigrp_add_authTLV_SHA256_to_stream (struct stream *s,
authTLV->key_sequence = 0;
memset(authTLV->Nullpad,0,sizeof(authTLV->Nullpad));
-
keychain = keychain_lookup(IF_DEF_PARAMS (ei->ifp)->auth_keychain);
if(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);
return 0;
-
}
struct TLV_MD5_Authentication_Type *
@@ -1393,7 +1370,6 @@ eigrp_authTLV_MD5_new ()
void
eigrp_authTLV_MD5_free (struct TLV_MD5_Authentication_Type *authTLV)
{
-
XFREE(MTYPE_EIGRP_AUTH_TLV, authTLV);
}
@@ -1410,11 +1386,9 @@ eigrp_authTLV_SHA256_new ()
void
eigrp_authTLV_SHA256_free (struct TLV_SHA256_Authentication_Type *authTLV)
{
-
XFREE(MTYPE_EIGRP_AUTH_SHA256_TLV, authTLV);
}
-
struct TLV_IPv4_Internal_type *
eigrp_IPv4_InternalTLV_new ()
{
@@ -1428,7 +1402,6 @@ eigrp_IPv4_InternalTLV_new ()
void
eigrp_IPv4_InternalTLV_free (struct TLV_IPv4_Internal_type *IPv4_InternalTLV)
{
-
XFREE(MTYPE_EIGRP_IPV4_INT_TLV, IPv4_InternalTLV);
}
diff --git a/eigrpd/eigrp_query.c b/eigrpd/eigrp_query.c
index d4bd37985..4488054e0 100644
--- a/eigrpd/eigrp_query.c
+++ b/eigrpd/eigrp_query.c
@@ -122,17 +122,17 @@ eigrp_query_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e
dest_addr = prefix_ipv4_new();
dest_addr->prefix = tlv->destination;
dest_addr->prefixlen = tlv->prefix_length;
- struct eigrp_prefix_entry *dest = eigrp_topology_table_lookup_ipv4(
- eigrp->topology_table, dest_addr);
+ struct eigrp_prefix_entry *dest =
+ eigrp_topology_table_lookup_ipv4(eigrp->topology_table, dest_addr);
/* If the destination exists (it should, but one never know)*/
if (dest != NULL)
{
struct eigrp_fsm_action_message *msg;
msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
- sizeof(struct eigrp_fsm_action_message));
- struct eigrp_neighbor_entry *entry = eigrp_prefix_entry_lookup(
- dest->entries, nbr);
+ sizeof(struct eigrp_fsm_action_message));
+ struct eigrp_neighbor_entry *entry =
+ eigrp_prefix_entry_lookup(dest->entries, nbr);
msg->packet_type = EIGRP_OPC_QUERY;
msg->eigrp = eigrp;
msg->data_type = EIGRP_TLV_IPv4_INT;
@@ -168,7 +168,8 @@ eigrp_send_query (struct eigrp_interface *ei)
ei->eigrp->sequence_number, 0);
// encode Authentication TLV, if needed
- if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
+ if((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);
}
@@ -181,11 +182,11 @@ eigrp_send_query (struct eigrp_interface *ei)
length += eigrp_add_internalTLV_to_stream(ep->s, pe);
for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr))
{
- if(nbr->state == EIGRP_NEIGHBOR_UP)
- {
- listnode_add(pe->rij, nbr);
+ if(nbr->state == EIGRP_NEIGHBOR_UP)
+ {
+ listnode_add(pe->rij, nbr);
has_tlv = 1;
- }
+ }
}
}
}
@@ -196,31 +197,32 @@ eigrp_send_query (struct eigrp_interface *ei)
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 Checksum */
- eigrp_packet_checksum(ei, ep->s, length);
-
- ep->length = length;
- ep->dst.s_addr = htonl(EIGRP_MULTICAST_ADDRESS);
-
- /*This ack number we await from neighbor*/
- ep->sequence_number = ei->eigrp->sequence_number;
-
- for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr))
- {
- if (nbr->state == EIGRP_NEIGHBOR_UP)
- {
- /*Put packet to retransmission queue*/
- eigrp_fifo_push_head(nbr->retrans_queue, ep);
-
- if (nbr->retrans_queue->count == 1)
- {
- eigrp_send_packet_reliably(nbr);
- }
- }
- }
+ eigrp_packet_checksum(ei, ep->s, length);
+
+ ep->length = length;
+ ep->dst.s_addr = htonl(EIGRP_MULTICAST_ADDRESS);
+
+ /*This ack number we await from neighbor*/
+ ep->sequence_number = ei->eigrp->sequence_number;
+
+ for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr))
+ {
+ if (nbr->state == EIGRP_NEIGHBOR_UP)
+ {
+ /*Put packet to retransmission queue*/
+ eigrp_fifo_push_head(nbr->retrans_queue, ep);
+
+ if (nbr->retrans_queue->count == 1)
+ {
+ eigrp_send_packet_reliably(nbr);
+ }
+ }
+ }
}
diff --git a/eigrpd/eigrp_reply.c b/eigrpd/eigrp_reply.c
index e90d2aa9f..0c5d9dd92 100644
--- a/eigrpd/eigrp_reply.c
+++ b/eigrpd/eigrp_reply.c
@@ -89,18 +89,20 @@ eigrp_send_reply (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
zlog_info("REPLY SEND Prefix: %s", inet_ntoa(nbr->src));
/* Check if any list fits */
- 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)||
- (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))
- {
- zlog_info("REPLY SEND: Setting Metric to max");
- pe2->reported_metric.delay = EIGRP_MAX_METRIC;
-
- } else {
- zlog_info("REPLY SEND: Not setting metric");
- }
+ 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)||
+ (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))
+ {
+ zlog_info("REPLY SEND: Setting Metric to max");
+ pe2->reported_metric.delay = EIGRP_MAX_METRIC;
+ }
+ else
+ {
+ zlog_info("REPLY SEND: Not setting metric");
+ }
/*
* 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);
// 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);
}
@@ -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);
- 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);
}
@@ -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 = tlv->destination;
dest_addr->prefixlen = tlv->prefix_length;
- struct eigrp_prefix_entry *dest = eigrp_topology_table_lookup_ipv4(
- eigrp->topology_table, dest_addr);
+ struct eigrp_prefix_entry *dest =
+ eigrp_topology_table_lookup_ipv4 (eigrp->topology_table, dest_addr);
/*
* Destination must exists
*/
@@ -193,9 +197,9 @@ eigrp_reply_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e
struct eigrp_fsm_action_message *msg;
msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
- sizeof(struct eigrp_fsm_action_message));
- struct eigrp_neighbor_entry *entry = eigrp_prefix_entry_lookup(
- dest->entries, nbr);
+ sizeof(struct eigrp_fsm_action_message));
+ struct eigrp_neighbor_entry *entry =
+ eigrp_prefix_entry_lookup(dest->entries, nbr);
/*
* Filtering
@@ -210,35 +214,35 @@ eigrp_reply_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e
plist_i = ei->prefix[EIGRP_FILTER_IN];
zlog_info("REPLY Receive: Filtering");
zlog_info("REPLY RECEIVE Prefix: %s", inet_ntoa(dest_addr->prefix));
- /* Check if any list fits */
- if ((alist && access_list_apply (alist,
- (struct prefix *) dest_addr) == FILTER_DENY)||
- (plist && prefix_list_apply (plist,
- (struct prefix *) dest_addr) == PREFIX_DENY)||
- (alist_i && access_list_apply (alist_i,
- (struct prefix *) dest_addr) == FILTER_DENY)||
- (plist_i && prefix_list_apply (plist_i,
- (struct prefix *) dest_addr) == PREFIX_DENY))
- {
- zlog_info("REPLY RECEIVE: Setting metric to max");
- tlv->metric.delay = EIGRP_MAX_METRIC;
- zlog_info("REPLY RECEIVE Prefix: %s", inet_ntoa(dest_addr->prefix));
- } else {
- zlog_info("REPLY RECEIVE: Not setting metric");
- }
- /*
- * End of filtering
- */
-
- msg->packet_type = EIGRP_OPC_REPLY;
- msg->eigrp = eigrp;
- msg->data_type = EIGRP_TLV_IPv4_INT;
- msg->adv_router = nbr;
- msg->data.ipv4_int_type = tlv;
- msg->entry = entry;
- msg->prefix = dest;
- int event = eigrp_get_fsm_event(msg);
- eigrp_fsm_event(msg, event);
+ /* Check if any list fits */
+ if ((alist && access_list_apply (alist,
+ (struct prefix *) dest_addr) == FILTER_DENY)||
+ (plist && prefix_list_apply (plist,
+ (struct prefix *) dest_addr) == PREFIX_DENY)||
+ (alist_i && access_list_apply (alist_i,
+ (struct prefix *) dest_addr) == FILTER_DENY)||
+ (plist_i && prefix_list_apply (plist_i,
+ (struct prefix *) dest_addr) == PREFIX_DENY))
+ {
+ zlog_info("REPLY RECEIVE: Setting metric to max");
+ tlv->metric.delay = EIGRP_MAX_METRIC;
+ zlog_info("REPLY RECEIVE Prefix: %s", inet_ntoa(dest_addr->prefix));
+ } else {
+ zlog_info("REPLY RECEIVE: Not setting metric");
+ }
+ /*
+ * End of filtering
+ */
+
+ msg->packet_type = EIGRP_OPC_REPLY;
+ msg->eigrp = eigrp;
+ msg->data_type = EIGRP_TLV_IPv4_INT;
+ msg->adv_router = nbr;
+ msg->data.ipv4_int_type = tlv;
+ msg->entry = entry;
+ msg->prefix = dest;
+ int event = eigrp_get_fsm_event(msg);
+ eigrp_fsm_event(msg, event);
eigrp_IPv4_InternalTLV_free (tlv);
diff --git a/eigrpd/eigrp_routemap.c b/eigrpd/eigrp_routemap.c
index 9dd5b15af..c4a33d5b0 100644
--- a/eigrpd/eigrp_routemap.c
+++ b/eigrpd/eigrp_routemap.c
@@ -46,7 +46,7 @@
#include "command.h"
#include "filter.h"
#include "log.h"
-#include "sockunion.h" /* for inet_aton () */
+#include "sockunion.h" /* for inet_aton () */
#include "plist.h"
#include "eigrpd/eigrpd.h"
@@ -68,23 +68,23 @@ eigrp_if_rmap_update (struct if_rmap *if_rmap)
if (ifp == NULL)
return;
- ei=NULL;
+ ei = NULL;
e = eigrp_lookup();
for (ALL_LIST_ELEMENTS (e->eiflist, node, nnode, ei2))
{
- if(strcmp(ei2->ifp->name,ifp->name) == 0){
- ei = ei2;
- break;
- }
+ if(strcmp(ei2->ifp->name,ifp->name) == 0){
+ ei = ei2;
+ break;
+ }
}
if (if_rmap->routemap[IF_RMAP_IN])
{
rmap = route_map_lookup_by_name (if_rmap->routemap[IF_RMAP_IN]);
if (rmap)
- ei->routemap[IF_RMAP_IN] = rmap;
+ ei->routemap[IF_RMAP_IN] = rmap;
else
- ei->routemap[IF_RMAP_IN] = NULL;
+ ei->routemap[IF_RMAP_IN] = NULL;
}
else
ei->routemap[EIGRP_FILTER_IN] = NULL;
@@ -93,9 +93,9 @@ eigrp_if_rmap_update (struct if_rmap *if_rmap)
{
rmap = route_map_lookup_by_name (if_rmap->routemap[IF_RMAP_OUT]);
if (rmap)
- ei->routemap[IF_RMAP_OUT] = rmap;
+ ei->routemap[IF_RMAP_OUT] = rmap;
else
- ei->routemap[IF_RMAP_OUT] = NULL;
+ ei->routemap[IF_RMAP_OUT] = NULL;
}
else
ei->routemap[EIGRP_FILTER_OUT] = NULL;
@@ -122,11 +122,11 @@ eigrp_routemap_update_redistribute (void)
if (e)
{
for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
- {
- if (e->route_map[i].name)
- e->route_map[i].map =
- route_map_lookup_by_name (e->route_map[i].name);
- }
+ {
+ if (e->route_map[i].name)
+ e->route_map[i].map =
+ route_map_lookup_by_name (e->route_map[i].name);
+ }
}
}
@@ -146,21 +146,21 @@ eigrp_rmap_update (const char *notused)
/* Add eigrp route map rule. */
static int
eigrp_route_match_add (struct vty *vty, struct route_map_index *index,
- const char *command, const char *arg)
+ const char *command, const char *arg)
{
int ret;
ret = route_map_add_match (index, command, arg);
if (ret)
{
switch (ret)
- {
- case RMAP_RULE_MISSING:
- vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
- return CMD_WARNING;
- case RMAP_COMPILE_ERROR:
- vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
+ {
+ case RMAP_RULE_MISSING:
+ vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ case RMAP_COMPILE_ERROR:
+ vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
}
return CMD_SUCCESS;
}
@@ -168,21 +168,21 @@ eigrp_route_match_add (struct vty *vty, struct route_map_index *index,
/* Delete rip route map rule. */
static int
eigrp_route_match_delete (struct vty *vty, struct route_map_index *index,
- const char *command, const char *arg)
+ const char *command, const char *arg)
{
int ret;
ret = route_map_delete_match (index, command, arg);
if (ret)
{
switch (ret)
- {
- case RMAP_RULE_MISSING:
- vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
- return CMD_WARNING;
- case RMAP_COMPILE_ERROR:
- vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
+ {
+ case RMAP_RULE_MISSING:
+ vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ case RMAP_COMPILE_ERROR:
+ vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
}
return CMD_SUCCESS;
}
@@ -190,7 +190,7 @@ eigrp_route_match_delete (struct vty *vty, struct route_map_index *index,
/* Add eigrp route map rule. */
static int
eigrp_route_set_add (struct vty *vty, struct route_map_index *index,
- const char *command, const char *arg)
+ const char *command, const char *arg)
{
int ret;
@@ -198,20 +198,20 @@ eigrp_route_set_add (struct vty *vty, struct route_map_index *index,
if (ret)
{
switch (ret)
- {
- case RMAP_RULE_MISSING:
- vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
- return CMD_WARNING;
- case RMAP_COMPILE_ERROR:
- /* rip, ripng and other protocols share the set metric command
- but only values from 0 to 16 are valid for rip and ripng
- if metric is out of range for rip and ripng, it is not for
- other protocols. Do not return an error */
- if (strcmp(command, "metric")) {
- vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
+ {
+ case RMAP_RULE_MISSING:
+ vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ case RMAP_COMPILE_ERROR:
+ /* rip, ripng and other protocols share the set metric command
+ but only values from 0 to 16 are valid for rip and ripng
+ if metric is out of range for rip and ripng, it is not for
+ other protocols. Do not return an error */
+ if (strcmp(command, "metric")) {
+ vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ }
}
return CMD_SUCCESS;
}
@@ -219,7 +219,7 @@ eigrp_route_set_add (struct vty *vty, struct route_map_index *index,
/* Delete eigrp route map rule. */
static int
eigrp_route_set_delete (struct vty *vty, struct route_map_index *index,
- const char *command, const char *arg)
+ const char *command, const char *arg)
{
int ret;
@@ -227,14 +227,14 @@ eigrp_route_set_delete (struct vty *vty, struct route_map_index *index,
if (ret)
{
switch (ret)
- {
- case RMAP_RULE_MISSING:
- vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
- return CMD_WARNING;
- case RMAP_COMPILE_ERROR:
- vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
+ {
+ case RMAP_RULE_MISSING:
+ vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ case RMAP_COMPILE_ERROR:
+ vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
}
return CMD_SUCCESS;
}
@@ -251,11 +251,11 @@ eigrp_route_map_update (const char *notused)
if (e)
{
for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
- {
- if (e->route_map[i].name)
- e->route_map[i].map =
- route_map_lookup_by_name (e->route_map[i].name);
- }
+ {
+ if (e->route_map[i].name)
+ e->route_map[i].map =
+ route_map_lookup_by_name (e->route_map[i].name);
+ }
}
}
@@ -265,33 +265,33 @@ eigrp_route_map_update (const char *notused)
/* Match function return 1 if match is success else return zero. */
static route_map_result_t
route_match_metric (void *rule, struct prefix *prefix,
- route_map_object_t type, void *object)
-{
-// u_int32_t *metric;
-// u_int32_t check;
-// struct rip_info *rinfo;
-// struct eigrp_neighbor_entry *te;
-// struct eigrp_prefix_entry *pe;
-// struct listnode *node, *node2, *nnode, *nnode2;
-// struct eigrp *e;
-//
-// e = eigrp_lookup();
-//
-// if (type == RMAP_EIGRP)
-// {
-// metric = rule;
-// rinfo = object;
-//
-// /* If external metric is available, the route-map should
-// work on this one (for redistribute purpose) */
-// /*check = (rinfo->external_metric) ? rinfo->external_metric :
-// rinfo->metric;*/
-//
-// if (check == *metric)
-// return RMAP_MATCH;
-// else
-// return RMAP_NOMATCH;
-// }
+ route_map_object_t type, void *object)
+{
+ // u_int32_t *metric;
+ // u_int32_t check;
+ // struct rip_info *rinfo;
+ // struct eigrp_neighbor_entry *te;
+ // struct eigrp_prefix_entry *pe;
+ // struct listnode *node, *node2, *nnode, *nnode2;
+ // struct eigrp *e;
+ //
+ // e = eigrp_lookup();
+ //
+ // if (type == RMAP_EIGRP)
+ // {
+ // metric = rule;
+ // rinfo = object;
+ //
+ // /* If external metric is available, the route-map should
+ // work on this one (for redistribute purpose) */
+ // /*check = (rinfo->external_metric) ? rinfo->external_metric :
+ // rinfo->metric;*/
+ //
+ // if (check == *metric)
+ // return RMAP_MATCH;
+ // else
+ // return RMAP_NOMATCH;
+ // }
return RMAP_NOMATCH;
}
@@ -299,15 +299,15 @@ route_match_metric (void *rule, struct prefix *prefix,
static void *
route_match_metric_compile (const char *arg)
{
-// u_int32_t *metric;
-//
-// metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
-// *metric = atoi (arg);
-//
-// if(*metric > 0)
-// return metric;
-//
-// XFREE (MTYPE_ROUTE_MAP_COMPILED, metric);
+ // u_int32_t *metric;
+ //
+ // metric = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
+ // *metric = atoi (arg);
+ //
+ // if(*metric > 0)
+ // return metric;
+ //
+ // XFREE (MTYPE_ROUTE_MAP_COMPILED, metric);
return NULL;
}
@@ -331,27 +331,27 @@ struct route_map_rule_cmd route_match_metric_cmd =
/* Match function return 1 if match is success else return zero. */
static route_map_result_t
route_match_interface (void *rule, struct prefix *prefix,
- route_map_object_t type, void *object)
-{
-// struct rip_info *rinfo;
-// struct interface *ifp;
-// char *ifname;
-//
-// if (type == RMAP_EIGRP)
-// {
-// ifname = rule;
-// ifp = if_lookup_by_name(ifname);
-//
-// if (!ifp)
-// return RMAP_NOMATCH;
-//
-// rinfo = object;
-//
-// /*if (rinfo->ifindex_out == ifp->ifindex || rinfo->ifindex == ifp->ifindex)
-// return RMAP_MATCH;
-// else
-// return RMAP_NOMATCH;*/
-// }
+ route_map_object_t type, void *object)
+{
+ // struct rip_info *rinfo;
+ // struct interface *ifp;
+ // char *ifname;
+ //
+ // if (type == RMAP_EIGRP)
+ // {
+ // ifname = rule;
+ // ifp = if_lookup_by_name(ifname);
+ //
+ // if (!ifp)
+ // return RMAP_NOMATCH;
+ //
+ // rinfo = object;
+ //
+ // /*if (rinfo->ifindex_out == ifp->ifindex || rinfo->ifindex == ifp->ifindex)
+ // return RMAP_MATCH;
+ // else
+ // return RMAP_NOMATCH;*/
+ // }
return RMAP_NOMATCH;
}
@@ -384,26 +384,26 @@ struct route_map_rule_cmd route_match_interface_cmd =
/* Match function return 1 if match is success else return zero. */
static route_map_result_t
route_match_ip_next_hop (void *rule, struct prefix *prefix,
- route_map_object_t type, void *object)
-{
-// struct access_list *alist;
-// struct rip_info *rinfo;
-// struct prefix_ipv4 p;
-//
-// if (type == RMAP_EIGRP)
-// {
-// rinfo = object;
-// p.family = AF_INET;
-// /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop : rinfo->from;*/
-// p.prefixlen = IPV4_MAX_BITLEN;
-//
-// alist = access_list_lookup (AFI_IP, (char *) rule);
-// if (alist == NULL)
-// return RMAP_NOMATCH;
-//
-// return (access_list_apply (alist, &p) == FILTER_DENY ?
-// RMAP_NOMATCH : RMAP_MATCH);
-// }
+ route_map_object_t type, void *object)
+{
+ // struct access_list *alist;
+ // struct rip_info *rinfo;
+ // struct prefix_ipv4 p;
+ //
+ // if (type == RMAP_EIGRP)
+ // {
+ // rinfo = object;
+ // p.family = AF_INET;
+ // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop : rinfo->from;*/
+ // p.prefixlen = IPV4_MAX_BITLEN;
+ //
+ // alist = access_list_lookup (AFI_IP, (char *) rule);
+ // if (alist == NULL)
+ // return RMAP_NOMATCH;
+ //
+ // return (access_list_apply (alist, &p) == FILTER_DENY ?
+ // RMAP_NOMATCH : RMAP_MATCH);
+ // }
return RMAP_NOMATCH;
}
@@ -424,37 +424,37 @@ route_match_ip_next_hop_free (void *rule)
/* Route map commands for ip next-hop matching. */
static struct route_map_rule_cmd route_match_ip_next_hop_cmd =
-{
- "ip next-hop",
- route_match_ip_next_hop,
- route_match_ip_next_hop_compile,
- route_match_ip_next_hop_free
-};
+ {
+ "ip next-hop",
+ route_match_ip_next_hop,
+ route_match_ip_next_hop_compile,
+ route_match_ip_next_hop_free
+ };
/* `match ip next-hop prefix-list PREFIX_LIST' */
static route_map_result_t
route_match_ip_next_hop_prefix_list (void *rule, struct prefix *prefix,
- route_map_object_t type, void *object)
-{
-// struct prefix_list *plist;
-// struct rip_info *rinfo;
-// struct prefix_ipv4 p;
-//
-// if (type == RMAP_EIGRP)
-// {
-// rinfo = object;
-// p.family = AF_INET;
-// /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop : rinfo->from;*/
-// p.prefixlen = IPV4_MAX_BITLEN;
-//
-// plist = prefix_list_lookup (AFI_IP, (char *) rule);
-// if (plist == NULL)
-// return RMAP_NOMATCH;
-//
-// return (prefix_list_apply (plist, &p) == PREFIX_DENY ?
-// RMAP_NOMATCH : RMAP_MATCH);
-// }
+ route_map_object_t type, void *object)
+{
+ // struct prefix_list *plist;
+ // struct rip_info *rinfo;
+ // struct prefix_ipv4 p;
+ //
+ // if (type == RMAP_EIGRP)
+ // {
+ // rinfo = object;
+ // p.family = AF_INET;
+ // /*p.prefix = (rinfo->nexthop.s_addr) ? rinfo->nexthop : rinfo->from;*/
+ // p.prefixlen = IPV4_MAX_BITLEN;
+ //
+ // plist = prefix_list_lookup (AFI_IP, (char *) rule);
+ // if (plist == NULL)
+ // return RMAP_NOMATCH;
+ //
+ // return (prefix_list_apply (plist, &p) == PREFIX_DENY ?
+ // RMAP_NOMATCH : RMAP_MATCH);
+ // }
return RMAP_NOMATCH;
}
@@ -484,7 +484,7 @@ static struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd =
zero. */
static route_map_result_t
route_match_ip_address (void *rule, struct prefix *prefix,
- route_map_object_t type, void *object)
+ route_map_object_t type, void *object)
{
struct access_list *alist;
@@ -492,10 +492,10 @@ route_match_ip_address (void *rule, struct prefix *prefix,
{
alist = access_list_lookup (AFI_IP, (char *) rule);
if (alist == NULL)
- return RMAP_NOMATCH;
+ return RMAP_NOMATCH;
return (access_list_apply (alist, prefix) == FILTER_DENY ?
- RMAP_NOMATCH : RMAP_MATCH);
+ RMAP_NOMATCH : RMAP_MATCH);
}
return RMAP_NOMATCH;
}
@@ -517,18 +517,18 @@ route_match_ip_address_free (void *rule)
/* Route map commands for ip address matching. */
static struct route_map_rule_cmd route_match_ip_address_cmd =
-{
- "ip address",
- route_match_ip_address,
- route_match_ip_address_compile,
- route_match_ip_address_free
-};
+ {
+ "ip address",
+ route_match_ip_address,
+ route_match_ip_address_compile,
+ route_match_ip_address_free
+ };
/* `match ip address prefix-list PREFIX_LIST' */
static route_map_result_t
route_match_ip_address_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;
@@ -536,10 +536,10 @@ route_match_ip_address_prefix_list (void *rule, struct prefix *prefix,
{
plist = prefix_list_lookup (AFI_IP, (char *) rule);
if (plist == NULL)
- return RMAP_NOMATCH;
+ return RMAP_NOMATCH;
return (prefix_list_apply (plist, prefix) == PREFIX_DENY ?
- RMAP_NOMATCH : RMAP_MATCH);
+ RMAP_NOMATCH : RMAP_MATCH);
}
return RMAP_NOMATCH;
}
@@ -557,33 +557,33 @@ route_match_ip_address_prefix_list_free (void *rule)
}
static struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd =
-{
- "ip address prefix-list",
- route_match_ip_address_prefix_list,
- route_match_ip_address_prefix_list_compile,
- route_match_ip_address_prefix_list_free
-};
+ {
+ "ip address prefix-list",
+ route_match_ip_address_prefix_list,
+ route_match_ip_address_prefix_list_compile,
+ route_match_ip_address_prefix_list_free
+ };
/* `match tag TAG' */
/* Match function return 1 if match is success else return zero. */
static route_map_result_t
route_match_tag (void *rule, struct prefix *prefix,
- route_map_object_t type, void *object)
-{
-// u_short *tag;
-// struct rip_info *rinfo;
-//
-// if (type == RMAP_EIGRP)
-// {
-// tag = rule;
-// rinfo = object;
-//
-// /* The information stored by rinfo is host ordered. */
-// /*if (rinfo->tag == *tag)
-// return RMAP_MATCH;
-// else
-// return RMAP_NOMATCH;*/
-// }
+ route_map_object_t type, void *object)
+{
+ // u_short *tag;
+ // struct rip_info *rinfo;
+ //
+ // if (type == RMAP_EIGRP)
+ // {
+ // tag = rule;
+ // rinfo = object;
+ //
+ // /* The information stored by rinfo is host ordered. */
+ // /*if (rinfo->tag == *tag)
+ // return RMAP_MATCH;
+ // else
+ // return RMAP_NOMATCH;*/
+ // }
return RMAP_NOMATCH;
}
@@ -591,12 +591,12 @@ route_match_tag (void *rule, struct prefix *prefix,
static void *
route_match_tag_compile (const char *arg)
{
-// u_short *tag;
-//
-// tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
-// *tag = atoi (arg);
-//
-// return tag;
+ // u_short *tag;
+ //
+ // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
+ // *tag = atoi (arg);
+ //
+ // return tag;
}
/* Free route map's compiled `match tag' value. */
@@ -608,40 +608,40 @@ route_match_tag_free (void *rule)
/* Route map commands for tag matching. */
struct route_map_rule_cmd route_match_tag_cmd =
-{
- "tag",
- route_match_tag,
- route_match_tag_compile,
- route_match_tag_free
-};
+ {
+ "tag",
+ route_match_tag,
+ route_match_tag_compile,
+ route_match_tag_free
+ };
/* Set metric to attribute. */
static route_map_result_t
route_set_metric (void *rule, struct prefix *prefix,
- route_map_object_t type, void *object)
-{
-// if (type == RMAP_RIP)
-// {
-// struct rip_metric_modifier *mod;
-// struct rip_info *rinfo;
-//
-// mod = rule;
-// rinfo = object;
-//
-// /*if (mod->type == metric_increment)
-// rinfo->metric_out += mod->metric;
-// else if (mod->type == metric_decrement)
-// rinfo->metric_out -= mod->metric;
-// else if (mod->type == metric_absolute)
-// rinfo->metric_out = mod->metric;
-//
-// if ((signed int)rinfo->metric_out < 1)
-// rinfo->metric_out = 1;
-// if (rinfo->metric_out > RIP_METRIC_INFINITY)
-// rinfo->metric_out = RIP_METRIC_INFINITY;*/
-//
-// rinfo->metric_set = 1;
-// }
+ route_map_object_t type, void *object)
+{
+ // if (type == RMAP_RIP)
+ // {
+ // struct rip_metric_modifier *mod;
+ // struct rip_info *rinfo;
+ //
+ // mod = rule;
+ // rinfo = object;
+ //
+ // /*if (mod->type == metric_increment)
+ // rinfo->metric_out += mod->metric;
+ // else if (mod->type == metric_decrement)
+ // rinfo->metric_out -= mod->metric;
+ // else if (mod->type == metric_absolute)
+ // rinfo->metric_out = mod->metric;
+ //
+ // if ((signed int)rinfo->metric_out < 1)
+ // rinfo->metric_out = 1;
+ // if (rinfo->metric_out > RIP_METRIC_INFINITY)
+ // rinfo->metric_out = RIP_METRIC_INFINITY;*/
+ //
+ // rinfo->metric_set = 1;
+ // }
return RMAP_OKAY;
}
@@ -649,51 +649,51 @@ route_set_metric (void *rule, struct prefix *prefix,
static void *
route_set_metric_compile (const char *arg)
{
-// int len;
-// const char *pnt;
-// int type;
-// long metric;
-// char *endptr = NULL;
-// struct rip_metric_modifier *mod;
-//
-// len = strlen (arg);
-// pnt = arg;
-//
-// if (len == 0)
-// return NULL;
-//
-// /* Examine first character. */
-// if (arg[0] == '+')
-// {
-// //type = metric_increment;
-// pnt++;
-// }
-// else if (arg[0] == '-')
-// {
-// //type = metric_decrement;
-// pnt++;
-// }
-// /*else
-// type = metric_absolute;*/
-//
-// /* Check beginning with digit string. */
-// if (*pnt < '0' || *pnt > '9')
-// return NULL;
-//
-// /* Convert string to integer. */
-// metric = strtol (pnt, &endptr, 10);
-//
-// if (metric == LONG_MAX || *endptr != '\0')
-// return NULL;
-// /*if (metric < 0 || metric > RIP_METRIC_INFINITY)
-// return NULL;*/
-//
-// mod = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
-// sizeof (struct rip_metric_modifier));
-// mod->type = type;
-// mod->metric = metric;
-
-// return mod;
+ // int len;
+ // const char *pnt;
+ // int type;
+ // long metric;
+ // char *endptr = NULL;
+ // struct rip_metric_modifier *mod;
+ //
+ // len = strlen (arg);
+ // pnt = arg;
+ //
+ // if (len == 0)
+ // return NULL;
+ //
+ // /* Examine first character. */
+ // if (arg[0] == '+')
+ // {
+ // //type = metric_increment;
+ // pnt++;
+ // }
+ // else if (arg[0] == '-')
+ // {
+ // //type = metric_decrement;
+ // pnt++;
+ // }
+ // /*else
+ // type = metric_absolute;*/
+ //
+ // /* Check beginning with digit string. */
+ // if (*pnt < '0' || *pnt > '9')
+ // return NULL;
+ //
+ // /* Convert string to integer. */
+ // metric = strtol (pnt, &endptr, 10);
+ //
+ // if (metric == LONG_MAX || *endptr != '\0')
+ // return NULL;
+ // /*if (metric < 0 || metric > RIP_METRIC_INFINITY)
+ // return NULL;*/
+ //
+ // mod = XMALLOC (MTYPE_ROUTE_MAP_COMPILED,
+ // sizeof (struct rip_metric_modifier));
+ // mod->type = type;
+ // mod->metric = metric;
+
+ // return mod;
}
/* Free route map's compiled `set metric' value. */
@@ -705,32 +705,32 @@ route_set_metric_free (void *rule)
/* Set metric rule structure. */
static struct route_map_rule_cmd route_set_metric_cmd =
-{
- "metric",
- route_set_metric,
- route_set_metric_compile,
- route_set_metric_free,
-};
+ {
+ "metric",
+ route_set_metric,
+ route_set_metric_compile,
+ route_set_metric_free,
+ };
/* `set ip next-hop IP_ADDRESS' */
/* Set nexthop to object. ojbect must be pointer to struct attr. */
static route_map_result_t
route_set_ip_nexthop (void *rule, struct prefix *prefix,
- route_map_object_t type, void *object)
-{
-// struct in_addr *address;
-// struct rip_info *rinfo;
-//
-// if(type == RMAP_RIP)
-// {
-// /* Fetch routemap's rule information. */
-// address = rule;
-// rinfo = object;
-//
-// /* Set next hop value. */
-// rinfo->nexthop_out = *address;
-// }
+ route_map_object_t type, void *object)
+{
+ // struct in_addr *address;
+ // struct rip_info *rinfo;
+ //
+ // if(type == RMAP_RIP)
+ // {
+ // /* Fetch routemap's rule information. */
+ // address = rule;
+ // rinfo = object;
+ //
+ // /* Set next hop value. */
+ // rinfo->nexthop_out = *address;
+ // }
return RMAP_OKAY;
}
@@ -740,20 +740,20 @@ route_set_ip_nexthop (void *rule, struct prefix *prefix,
static void *
route_set_ip_nexthop_compile (const char *arg)
{
-// int ret;
-// struct in_addr *address;
-//
-// address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct in_addr));
-//
-// ret = inet_aton (arg, address);
-//
-// if (ret == 0)
-// {
-// XFREE (MTYPE_ROUTE_MAP_COMPILED, address);
-// return NULL;
-// }
-//
-// return address;
+ // int ret;
+ // struct in_addr *address;
+ //
+ // address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct in_addr));
+ //
+ // ret = inet_aton (arg, address);
+ //
+ // if (ret == 0)
+ // {
+ // XFREE (MTYPE_ROUTE_MAP_COMPILED, address);
+ // return NULL;
+ // }
+ //
+ // return address;
}
/* Free route map's compiled `ip nexthop' value. */
@@ -765,32 +765,32 @@ route_set_ip_nexthop_free (void *rule)
/* Route map commands for ip nexthop set. */
static struct route_map_rule_cmd route_set_ip_nexthop_cmd =
-{
- "ip next-hop",
- route_set_ip_nexthop,
- route_set_ip_nexthop_compile,
- route_set_ip_nexthop_free
-};
+ {
+ "ip next-hop",
+ route_set_ip_nexthop,
+ route_set_ip_nexthop_compile,
+ route_set_ip_nexthop_free
+ };
/* `set tag TAG' */
/* Set tag to object. ojbect must be pointer to struct attr. */
static route_map_result_t
route_set_tag (void *rule, struct prefix *prefix,
- route_map_object_t type, void *object)
-{
-// u_short *tag;
-// struct rip_info *rinfo;
-//
-// if(type == RMAP_RIP)
-// {
-// /* Fetch routemap's rule information. */
-// tag = rule;
-// rinfo = object;
-//
-// /* Set next hop value. */
-// rinfo->tag_out = *tag;
-// }
+ route_map_object_t type, void *object)
+{
+ // u_short *tag;
+ // struct rip_info *rinfo;
+ //
+ // if(type == RMAP_RIP)
+ // {
+ // /* Fetch routemap's rule information. */
+ // tag = rule;
+ // rinfo = object;
+ //
+ // /* Set next hop value. */
+ // rinfo->tag_out = *tag;
+ // }
return RMAP_OKAY;
}
@@ -800,12 +800,12 @@ route_set_tag (void *rule, struct prefix *prefix,
static void *
route_set_tag_compile (const char *arg)
{
-// u_short *tag;
-//
-// tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
-// *tag = atoi (arg);
-//
-// return tag;
+ // u_short *tag;
+ //
+ // tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
+ // *tag = atoi (arg);
+ //
+ // return tag;
}
/* Free route map's compiled `ip nexthop' value. */
@@ -817,12 +817,12 @@ route_set_tag_free (void *rule)
/* Route map commands for tag set. */
static struct route_map_rule_cmd route_set_tag_cmd =
-{
- "tag",
- route_set_tag,
- route_set_tag_compile,
- route_set_tag_free
-};
+ {
+ "tag",
+ route_set_tag,
+ route_set_tag_compile,
+ route_set_tag_free
+ };
#define MATCH_STR "Match values from routing table\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 (expanded range)\n"
"IP Access-list name\n")
-
{
return eigrp_route_match_add (vty, vty->index, "ip address", argv[0]);
}
@@ -1196,49 +1195,49 @@ eigrp_route_map_init ()
route_map_init_vty ();
route_map_add_hook (eigrp_route_map_update);
route_map_delete_hook (eigrp_route_map_update);
-
+
/*route_map_install_match (&route_match_metric_cmd);
- route_map_install_match (&route_match_interface_cmd);*/
+ route_map_install_match (&route_match_interface_cmd);*/
/*route_map_install_match (&route_match_ip_next_hop_cmd);
- route_map_install_match (&route_match_ip_next_hop_prefix_list_cmd);
- route_map_install_match (&route_match_ip_address_cmd);
- route_map_install_match (&route_match_ip_address_prefix_list_cmd);*/
+ route_map_install_match (&route_match_ip_next_hop_prefix_list_cmd);
+ route_map_install_match (&route_match_ip_address_cmd);
+ route_map_install_match (&route_match_ip_address_prefix_list_cmd);*/
/*route_map_install_match (&route_match_tag_cmd);*/
-
+
/*route_map_install_set (&route_set_metric_cmd);
- route_map_install_set (&route_set_ip_nexthop_cmd);
- route_map_install_set (&route_set_tag_cmd);*/
-
+ route_map_install_set (&route_set_ip_nexthop_cmd);
+ route_map_install_set (&route_set_tag_cmd);*/
+
/*install_element (RMAP_NODE, &route_match_metric_cmd);
- install_element (RMAP_NODE, &no_match_metric_cmd);
- install_element (RMAP_NODE, &no_match_metric_val_cmd);
- install_element (RMAP_NODE, &route_match_interface_cmd);
- install_element (RMAP_NODE, &no_match_interface_cmd);
- install_element (RMAP_NODE, &no_match_interface_val_cmd);
- install_element (RMAP_NODE, &route_match_ip_next_hop_cmd);
- install_element (RMAP_NODE, &no_match_ip_next_hop_cmd);
- install_element (RMAP_NODE, &no_match_ip_next_hop_val_cmd);
- install_element (RMAP_NODE, &route_match_ip_next_hop_prefix_list_cmd);
- install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd);
- install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_val_cmd);*/
+ install_element (RMAP_NODE, &no_match_metric_cmd);
+ install_element (RMAP_NODE, &no_match_metric_val_cmd);
+ install_element (RMAP_NODE, &route_match_interface_cmd);
+ install_element (RMAP_NODE, &no_match_interface_cmd);
+ install_element (RMAP_NODE, &no_match_interface_val_cmd);
+ install_element (RMAP_NODE, &route_match_ip_next_hop_cmd);
+ install_element (RMAP_NODE, &no_match_ip_next_hop_cmd);
+ install_element (RMAP_NODE, &no_match_ip_next_hop_val_cmd);
+ install_element (RMAP_NODE, &route_match_ip_next_hop_prefix_list_cmd);
+ install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd);
+ install_element (RMAP_NODE, &no_match_ip_next_hop_prefix_list_val_cmd);*/
/*install_element (RMAP_NODE, &route_match_ip_address_cmd);
- install_element (RMAP_NODE, &no_match_ip_address_cmd);
- install_element (RMAP_NODE, &no_match_ip_address_val_cmd);
- install_element (RMAP_NODE, &route_match_ip_address_prefix_list_cmd);
- install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd);
- install_element (RMAP_NODE, &no_match_ip_address_prefix_list_val_cmd);*/
+ install_element (RMAP_NODE, &no_match_ip_address_cmd);
+ install_element (RMAP_NODE, &no_match_ip_address_val_cmd);
+ install_element (RMAP_NODE, &route_match_ip_address_prefix_list_cmd);
+ install_element (RMAP_NODE, &no_match_ip_address_prefix_list_cmd);
+ install_element (RMAP_NODE, &no_match_ip_address_prefix_list_val_cmd);*/
/*install_element (RMAP_NODE, &route_match_tag_cmd);
- install_element (RMAP_NODE, &no_match_tag_cmd);
- install_element (RMAP_NODE, &no_match_tag_val_cmd);*/
+ install_element (RMAP_NODE, &no_match_tag_cmd);
+ install_element (RMAP_NODE, &no_match_tag_val_cmd);*/
/*install_element (RMAP_NODE, &set_metric_cmd);
- install_element (RMAP_NODE, &set_metric_addsub_cmd);
- install_element (RMAP_NODE, &no_set_metric_cmd);
- install_element (RMAP_NODE, &no_set_metric_val_cmd);
- install_element (RMAP_NODE, &set_ip_nexthop_cmd);
- install_element (RMAP_NODE, &no_set_ip_nexthop_cmd);
- install_element (RMAP_NODE, &no_set_ip_nexthop_val_cmd);
- install_element (RMAP_NODE, &set_tag_cmd);
- install_element (RMAP_NODE, &no_set_tag_cmd);
- install_element (RMAP_NODE, &no_set_tag_val_cmd);*/
+ install_element (RMAP_NODE, &set_metric_addsub_cmd);
+ install_element (RMAP_NODE, &no_set_metric_cmd);
+ install_element (RMAP_NODE, &no_set_metric_val_cmd);
+ install_element (RMAP_NODE, &set_ip_nexthop_cmd);
+ install_element (RMAP_NODE, &no_set_ip_nexthop_cmd);
+ install_element (RMAP_NODE, &no_set_ip_nexthop_val_cmd);
+ install_element (RMAP_NODE, &set_tag_cmd);
+ install_element (RMAP_NODE, &no_set_tag_cmd);
+ install_element (RMAP_NODE, &no_set_tag_val_cmd);*/
}
diff --git a/eigrpd/eigrp_siaquery.c b/eigrpd/eigrp_siaquery.c
index 030a86c1c..b04130076 100644
--- a/eigrpd/eigrp_siaquery.c
+++ b/eigrpd/eigrp_siaquery.c
@@ -58,7 +58,7 @@
/*EIGRP SIA-QUERY read function*/
void
eigrp_siaquery_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *eigrph,
- struct stream * s, struct eigrp_interface *ei, int size)
+ struct stream * s, struct eigrp_interface *ei, int size)
{
struct eigrp_neighbor *nbr;
struct TLV_IPv4_Internal_type *tlv;
@@ -89,17 +89,17 @@ eigrp_siaquery_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header
dest_addr = prefix_ipv4_new();
dest_addr->prefix = tlv->destination;
dest_addr->prefixlen = tlv->prefix_length;
- struct eigrp_prefix_entry *dest = eigrp_topology_table_lookup_ipv4(
- eigrp->topology_table, dest_addr);
+ struct eigrp_prefix_entry *dest =
+ eigrp_topology_table_lookup_ipv4(eigrp->topology_table, dest_addr);
/* If the destination exists (it should, but one never know)*/
if (dest != NULL)
{
struct eigrp_fsm_action_message *msg;
msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
- sizeof(struct eigrp_fsm_action_message));
- struct eigrp_neighbor_entry *entry = eigrp_prefix_entry_lookup(
- dest->entries, nbr);
+ sizeof(struct eigrp_fsm_action_message));
+ struct eigrp_neighbor_entry *entry =
+ eigrp_prefix_entry_lookup(dest->entries, nbr);
msg->packet_type = EIGRP_OPC_SIAQUERY;
msg->eigrp = eigrp;
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);
}
-
void
eigrp_send_siaquery (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
{
@@ -127,38 +126,40 @@ eigrp_send_siaquery (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
/* Prepare EIGRP INIT UPDATE header */
eigrp_packet_header_init(EIGRP_OPC_SIAQUERY, nbr->ei, ep->s, 0,
- nbr->ei->eigrp->sequence_number, 0);
+ nbr->ei->eigrp->sequence_number, 0);
// encode Authentication TLV, if needed
- if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
+ if((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_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 Checksum */
- eigrp_packet_checksum(nbr->ei, ep->s, length);
+ eigrp_packet_checksum(nbr->ei, ep->s, length);
- ep->length = length;
- ep->dst.s_addr = nbr->src.s_addr;
+ ep->length = length;
+ ep->dst.s_addr = nbr->src.s_addr;
- /*This ack number we await from neighbor*/
- ep->sequence_number = nbr->ei->eigrp->sequence_number;
+ /*This ack number we await from neighbor*/
+ ep->sequence_number = nbr->ei->eigrp->sequence_number;
- if (nbr->state == EIGRP_NEIGHBOR_UP)
- {
- /*Put packet to retransmission queue*/
- eigrp_fifo_push_head(nbr->retrans_queue, ep);
+ if (nbr->state == EIGRP_NEIGHBOR_UP)
+ {
+ /*Put packet to retransmission queue*/
+ eigrp_fifo_push_head(nbr->retrans_queue, ep);
- if (nbr->retrans_queue->count == 1)
- {
- eigrp_send_packet_reliably(nbr);
- }
- }
+ if (nbr->retrans_queue->count == 1)
+ {
+ eigrp_send_packet_reliably(nbr);
+ }
+ }
}
diff --git a/eigrpd/eigrp_siareply.c b/eigrpd/eigrp_siareply.c
index b49409061..4c4793f86 100644
--- a/eigrpd/eigrp_siareply.c
+++ b/eigrpd/eigrp_siareply.c
@@ -25,7 +25,6 @@
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
-
#include <zebra.h>
#include "thread.h"
@@ -58,7 +57,7 @@
/*EIGRP SIA-REPLY read function*/
void
eigrp_siareply_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *eigrph,
- struct stream * s, struct eigrp_interface *ei, int size)
+ struct stream * s, struct eigrp_interface *ei, int size)
{
struct eigrp_neighbor *nbr;
struct TLV_IPv4_Internal_type *tlv;
@@ -89,17 +88,17 @@ eigrp_siareply_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header
dest_addr = prefix_ipv4_new();
dest_addr->prefix = tlv->destination;
dest_addr->prefixlen = tlv->prefix_length;
- struct eigrp_prefix_entry *dest = eigrp_topology_table_lookup_ipv4(
- eigrp->topology_table, dest_addr);
+ struct eigrp_prefix_entry *dest =
+ eigrp_topology_table_lookup_ipv4(eigrp->topology_table, dest_addr);
/* If the destination exists (it should, but one never know)*/
if (dest != NULL)
{
struct eigrp_fsm_action_message *msg;
msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
- sizeof(struct eigrp_fsm_action_message));
- struct eigrp_neighbor_entry *entry = eigrp_prefix_entry_lookup(
- dest->entries, nbr);
+ sizeof(struct eigrp_fsm_action_message));
+ struct eigrp_neighbor_entry *entry =
+ eigrp_prefix_entry_lookup(dest->entries, nbr);
msg->packet_type = EIGRP_OPC_SIAQUERY;
msg->eigrp = eigrp;
msg->data_type = EIGRP_TLV_IPv4_INT;
@@ -126,40 +125,42 @@ eigrp_send_siareply (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
/* Prepare EIGRP INIT UPDATE header */
eigrp_packet_header_init(EIGRP_OPC_SIAREPLY, nbr->ei, ep->s, 0,
- nbr->ei->eigrp->sequence_number, 0);
+ nbr->ei->eigrp->sequence_number, 0);
// encode Authentication TLV, if needed
- if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
+ if((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_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 Checksum */
- eigrp_packet_checksum(nbr->ei, ep->s, length);
+ eigrp_packet_checksum(nbr->ei, ep->s, length);
- ep->length = length;
- ep->dst.s_addr = nbr->src.s_addr;
+ ep->length = length;
+ ep->dst.s_addr = nbr->src.s_addr;
- /*This ack number we await from neighbor*/
- ep->sequence_number = nbr->ei->eigrp->sequence_number;
+ /*This ack number we await from neighbor*/
+ ep->sequence_number = nbr->ei->eigrp->sequence_number;
- if (nbr->state == EIGRP_NEIGHBOR_UP)
- {
- /*Put packet to retransmission queue*/
- eigrp_fifo_push_head(nbr->retrans_queue, ep);
+ if (nbr->state == EIGRP_NEIGHBOR_UP)
+ {
+ /*Put packet to retransmission queue*/
+ eigrp_fifo_push_head(nbr->retrans_queue, ep);
- if (nbr->retrans_queue->count == 1)
- {
- eigrp_send_packet_reliably(nbr);
- }
- }
+ if (nbr->retrans_queue->count == 1)
+ {
+ eigrp_send_packet_reliably(nbr);
+ }
+ }
}
diff --git a/eigrpd/eigrp_snmp.c b/eigrpd/eigrp_snmp.c
index f5dd69f1b..f18894bb8 100644
--- a/eigrpd/eigrp_snmp.c
+++ b/eigrpd/eigrp_snmp.c
@@ -60,7 +60,6 @@
#include "eigrpd/eigrp_fsm.h"
#include "eigrpd/eigrp_snmp.h"
-
struct list *eigrp_snmp_iflist;
/* Declare static local variables for convenience. */
@@ -73,50 +72,50 @@ SNMP_LOCAL_VARIABLES
oid eigrp_oid [] = { EIGRPMIB };
/* EIGRP VPN entry */
-#define EIGRPVPNID 1
+#define EIGRPVPNID 1
#define EIGRPVPNNAME 2
/* EIGRP Traffic statistics entry */
-#define EIGRPASNUMBER 1
-#define EIGRPNBRCOUNT 2
-#define EIGRPHELLOSSENT 3
-#define EIGRPHELLOSRCVD 4
-#define EIGRPUPDATESSENT 5
-#define EIGRPUPDATESRCVD 6
-#define EIGRPQUERIESSENT 7
-#define EIGRPQUERIESRCVD 8
-#define EIGRPREPLIESSENT 9
-#define EIGRPREPLIESRCVD 10
-#define EIGRPACKSSENT 11
-#define EIGRPACKSRCVD 12
-#define EIGRPINPUTQHIGHMARK 13
-#define EIGRPINPUTQDROPS 14
-#define EIGRPSIAQUERIESSENT 15
-#define EIGRPSIAQUERIESRCVD 16
-#define EIGRPASROUTERIDTYPE 17
-#define EIGRPASROUTERID 18
-#define EIGRPTOPOROUTES 19
-#define EIGRPHEADSERIAL 20
-#define EIGRPNEXTSERIAL 21
+#define EIGRPASNUMBER 1
+#define EIGRPNBRCOUNT 2
+#define EIGRPHELLOSSENT 3
+#define EIGRPHELLOSRCVD 4
+#define EIGRPUPDATESSENT 5
+#define EIGRPUPDATESRCVD 6
+#define EIGRPQUERIESSENT 7
+#define EIGRPQUERIESRCVD 8
+#define EIGRPREPLIESSENT 9
+#define EIGRPREPLIESRCVD 10
+#define EIGRPACKSSENT 11
+#define EIGRPACKSRCVD 12
+#define EIGRPINPUTQHIGHMARK 13
+#define EIGRPINPUTQDROPS 14
+#define EIGRPSIAQUERIESSENT 15
+#define EIGRPSIAQUERIESRCVD 16
+#define EIGRPASROUTERIDTYPE 17
+#define EIGRPASROUTERID 18
+#define EIGRPTOPOROUTES 19
+#define EIGRPHEADSERIAL 20
+#define EIGRPNEXTSERIAL 21
#define EIGRPXMITPENDREPLIES 22
-#define EIGRPXMITDUMMIES 23
+#define EIGRPXMITDUMMIES 23
/* EIGRP topology entry */
-#define EIGRPDESTNETTYPE 1
-#define EIGRPDESTNET 2
+#define EIGRPDESTNETTYPE 1
+#define EIGRPDESTNET 2
#define EIGRPDESTNETPREFIXLEN 4
-#define EIGRPACTIVE 5
-#define EIGRPSTUCKINACTIVE 6
-#define EIGRPDESTSUCCESSORS 7
-#define EIGRPFDISTANCE 8
+#define EIGRPACTIVE 5
+#define EIGRPSTUCKINACTIVE 6
+#define EIGRPDESTSUCCESSORS 7
+#define EIGRPFDISTANCE 8
#define EIGRPROUTEORIGINTYPE 9
#define EIGRPROUTEORIGINADDRTYPE 10
#define EIGRPROUTEORIGINADDR 11
#define EIGRPNEXTHOPADDRESSTYPE 12
-#define EIGRPNEXTHOPADDRESS 13
+#define EIGRPNEXTHOPADDRESS 13
#define EIGRPNEXTHOPINTERFACE 14
-#define EIGRPDISTANCE 15
-#define EIGRPREPORTDISTANCE 16
+#define EIGRPDISTANCE 15
+#define EIGRPREPORTDISTANCE 16
/* EIGRP peer entry */
#define EIGRPHANDLE 1
@@ -173,181 +172,181 @@ oid eigrp_oid [] = { EIGRPMIB };
/* Hook functions. */
static u_char *eigrpVpnEntry (struct variable *, oid *, size_t *,
- int, size_t *, WriteMethod **);
+ int, size_t *, WriteMethod **);
static u_char *eigrpTraffStatsEntry (struct variable *, oid *, size_t *, int,
- size_t *, WriteMethod **);
+ size_t *, WriteMethod **);
static u_char *eigrpTopologyEntry (struct variable *, oid *, size_t *,
- int, size_t *, WriteMethod **);
+ int, size_t *, WriteMethod **);
static u_char *eigrpPeerEntry (struct variable *, oid *, size_t *, int,
- size_t *, WriteMethod **);
+ size_t *, WriteMethod **);
static u_char *eigrpInterfaceEntry (struct variable *, oid *, size_t *, int,
- size_t *, WriteMethod **);
+ size_t *, WriteMethod **);
struct variable eigrp_variables[] =
-{
- /* EIGRP vpn variables */
- {EIGRPVPNID, INTEGER, NOACCESS, eigrpVpnEntry,
- 4, {1, 1, 1, 1}},
- {EIGRPVPNNAME, STRING, RONLY, eigrpVpnEntry,
- 4, {1, 1, 1, 2}},
-
- /* EIGRP traffic stats variables */
- {EIGRPASNUMBER, UINTEGER, NOACCESS, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 1}},
- {EIGRPNBRCOUNT, UINTEGER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 2}},
- {EIGRPHELLOSSENT, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 3}},
- {EIGRPHELLOSRCVD, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 4}},
- {EIGRPUPDATESSENT, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 5}},
- {EIGRPUPDATESRCVD, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 6}},
- {EIGRPQUERIESSENT, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 7}},
- {EIGRPQUERIESRCVD, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 8}},
- {EIGRPREPLIESSENT, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 9}},
- {EIGRPREPLIESRCVD, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 10}},
- {EIGRPACKSSENT, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 11}},
- {EIGRPACKSRCVD, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 12}},
- {EIGRPINPUTQHIGHMARK, INTEGER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 13}},
- {EIGRPINPUTQDROPS, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 14}},
- {EIGRPSIAQUERIESSENT, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 15}},
- {EIGRPSIAQUERIESRCVD, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 16}},
- {EIGRPASROUTERIDTYPE, IPADDRESSTYPE, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 17}},
- {EIGRPASROUTERID, IPADDRESS, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 18}},
- {EIGRPTOPOROUTES, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 19}},
- {EIGRPHEADSERIAL, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 20}},
- {EIGRPNEXTSERIAL, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 21}},
- {EIGRPXMITPENDREPLIES, INTEGER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 22}},
- {EIGRPXMITDUMMIES, COUNTER, RONLY, eigrpTraffStatsEntry,
- 4, {2, 1, 1, 23}},
-
- /* EIGRP topology variables */
- {EIGRPDESTNETTYPE, IPADDRESSTYPE, NOACCESS, eigrpTopologyEntry,
- 4, {3, 1, 1, 1}},
- {EIGRPDESTNET, IPADDRESSPREFIXLEN, NOACCESS, eigrpTopologyEntry,
- 4, {3, 1, 1, 2}},
- {EIGRPDESTNETPREFIXLEN, IPADDRESSTYPE, NOACCESS, eigrpTopologyEntry,
- 4, {3, 1, 1, 4}},
- {EIGRPACTIVE, INTEGER, RONLY, eigrpTopologyEntry,
- 4, {3, 1, 1, 5}},
- {EIGRPSTUCKINACTIVE, INTEGER, RONLY, eigrpTopologyEntry,
- 4, {3, 1, 1, 6}},
- {EIGRPDESTSUCCESSORS, INTEGER, RONLY, eigrpTopologyEntry,
- 4, {3, 1, 1, 7}},
- {EIGRPFDISTANCE, INTEGER, RONLY, eigrpTopologyEntry,
- 4, {3, 1, 1, 8}},
- {EIGRPROUTEORIGINTYPE, STRING, RONLY, eigrpTopologyEntry,
- 4, {3, 1, 1, 9}},
- {EIGRPROUTEORIGINADDRTYPE, IPADDRESSTYPE, RONLY, eigrpTopologyEntry,
- 4, {3, 1, 1, 10}},
- {EIGRPROUTEORIGINADDR, IPADDRESS, RONLY, eigrpTopologyEntry,
- 4, {3, 1, 1, 11}},
- {EIGRPNEXTHOPADDRESSTYPE, IPADDRESSTYPE, RONLY, eigrpTopologyEntry,
- 4, {3, 1, 1, 12}},
- {EIGRPNEXTHOPADDRESS, IPADDRESS, RONLY, eigrpTopologyEntry,
- 4, {3, 1, 1, 13}},
- {EIGRPNEXTHOPINTERFACE, STRING, RONLY, eigrpTopologyEntry,
- 4, {3, 1, 1, 14}},
- {EIGRPDISTANCE, INTEGER, RONLY, eigrpTopologyEntry,
- 4, {3, 1, 1, 15}},
- {EIGRPREPORTDISTANCE, INTEGER, RONLY, eigrpTopologyEntry,
- 4, {3, 1, 1, 16}},
-
- /* EIGRP peer variables */
- {EIGRPHANDLE, INTEGER, NOACCESS, eigrpPeerEntry,
- 4, {4, 1, 1, 1}},
- {EIGRPPEERADDRTYPE, IPADDRESSTYPE, RONLY, eigrpPeerEntry,
- 4, {4, 1, 1, 2}},
- {EIGRPPEERADDR, IPADDRESS, RONLY, eigrpPeerEntry,
- 4, {4, 1, 1, 3}},
- {EIGRPPEERIFINDEX, INTERFACEINDEXORZERO, RONLY, eigrpPeerEntry,
- 4, {4, 1, 1, 4}},
- {EIGRPHOLDTIME, INTEGER, RONLY, eigrpPeerEntry,
- 4, {4, 1, 1, 5}},
- {EIGRPUPTIME, STRING, RONLY, eigrpPeerEntry,
- 4, {4, 1, 1, 6}},
- {EIGRPSRTT, INTEGER, RONLY, eigrpPeerEntry,
- 4, {4, 1, 1, 7}},
- {EIGRPRTO, INTEGER, RONLY, eigrpPeerEntry,
- 4, {4, 1, 1, 8}},
- {EIGRPPKTSENQUEUED, INTEGER, RONLY, eigrpPeerEntry,
- 4, {4, 1, 1, 9}},
- {EIGRPLASTSEQ, INTEGER, RONLY, eigrpPeerEntry,
- 4, {4, 1, 1, 10}},
- {EIGRPVERSION, STRING, RONLY, eigrpPeerEntry,
- 4, {4, 1, 1, 11}},
- {EIGRPRETRANS, COUNTER, RONLY, eigrpPeerEntry,
- 4, {4, 1, 1, 12}},
- {EIGRPRETRIES, INTEGER, RONLY, eigrpPeerEntry,
- 4, {4, 1, 1, 13}},
-
- /* EIGRP interface variables */
- {EIGRPPEERCOUNT, GAUGE, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 3}},
- {EIGRPXMITRELIABLEQ, GAUGE, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 4}},
- {EIGRPXMITUNRELIABLEQ, GAUGE, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 5}},
- {EIGRPMEANSRTT, INTEGER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 6}},
- {EIGRPPACINGRELIABLE, INTEGER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 7}},
- {EIGRPPACINGUNRELIABLE, INTEGER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 8}},
- {EIGRPMFLOWTIMER, INTEGER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 9}},
- {EIGRPPENDINGROUTES, GAUGE, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 10}},
- {EIGRPHELLOINTERVAL, INTEGER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 11}},
- {EIGRPXMITNEXTSERIAL, COUNTER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 12}},
- {EIGRPUMCASTS, COUNTER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 13}},
- {EIGRPRMCASTS, COUNTER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 14}},
- {EIGRPUUCASTS, COUNTER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 15}},
- {EIGRPRUCASTS, COUNTER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 16}},
- {EIGRPMCASTEXCEPTS, COUNTER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 17}},
- {EIGRPCRPKTS, COUNTER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 18}},
- {EIGRPACKSSUPPRESSED, COUNTER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 19}},
- {EIGRPRETRANSSENT, COUNTER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 20}},
- {EIGRPOOSRCVD, COUNTER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 21}},
- {EIGRPAUTHMODE, INTEGER, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 22}},
- {EIGRPAUTHKEYCHAIN, STRING, RONLY, eigrpInterfaceEntry,
- 4, {5, 1, 1, 23}}
+ {
+ /* EIGRP vpn variables */
+ {EIGRPVPNID, INTEGER, NOACCESS, eigrpVpnEntry,
+ 4, {1, 1, 1, 1}},
+ {EIGRPVPNNAME, STRING, RONLY, eigrpVpnEntry,
+ 4, {1, 1, 1, 2}},
+
+ /* EIGRP traffic stats variables */
+ {EIGRPASNUMBER, UINTEGER, NOACCESS, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 1}},
+ {EIGRPNBRCOUNT, UINTEGER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 2}},
+ {EIGRPHELLOSSENT, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 3}},
+ {EIGRPHELLOSRCVD, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 4}},
+ {EIGRPUPDATESSENT, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 5}},
+ {EIGRPUPDATESRCVD, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 6}},
+ {EIGRPQUERIESSENT, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 7}},
+ {EIGRPQUERIESRCVD, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 8}},
+ {EIGRPREPLIESSENT, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 9}},
+ {EIGRPREPLIESRCVD, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 10}},
+ {EIGRPACKSSENT, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 11}},
+ {EIGRPACKSRCVD, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 12}},
+ {EIGRPINPUTQHIGHMARK, INTEGER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 13}},
+ {EIGRPINPUTQDROPS, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 14}},
+ {EIGRPSIAQUERIESSENT, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 15}},
+ {EIGRPSIAQUERIESRCVD, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 16}},
+ {EIGRPASROUTERIDTYPE, IPADDRESSTYPE, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 17}},
+ {EIGRPASROUTERID, IPADDRESS, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 18}},
+ {EIGRPTOPOROUTES, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 19}},
+ {EIGRPHEADSERIAL, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 20}},
+ {EIGRPNEXTSERIAL, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 21}},
+ {EIGRPXMITPENDREPLIES, INTEGER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 22}},
+ {EIGRPXMITDUMMIES, COUNTER, RONLY, eigrpTraffStatsEntry,
+ 4, {2, 1, 1, 23}},
+
+ /* EIGRP topology variables */
+ {EIGRPDESTNETTYPE, IPADDRESSTYPE, NOACCESS, eigrpTopologyEntry,
+ 4, {3, 1, 1, 1}},
+ {EIGRPDESTNET, IPADDRESSPREFIXLEN, NOACCESS, eigrpTopologyEntry,
+ 4, {3, 1, 1, 2}},
+ {EIGRPDESTNETPREFIXLEN, IPADDRESSTYPE, NOACCESS, eigrpTopologyEntry,
+ 4, {3, 1, 1, 4}},
+ {EIGRPACTIVE, INTEGER, RONLY, eigrpTopologyEntry,
+ 4, {3, 1, 1, 5}},
+ {EIGRPSTUCKINACTIVE, INTEGER, RONLY, eigrpTopologyEntry,
+ 4, {3, 1, 1, 6}},
+ {EIGRPDESTSUCCESSORS, INTEGER, RONLY, eigrpTopologyEntry,
+ 4, {3, 1, 1, 7}},
+ {EIGRPFDISTANCE, INTEGER, RONLY, eigrpTopologyEntry,
+ 4, {3, 1, 1, 8}},
+ {EIGRPROUTEORIGINTYPE, STRING, RONLY, eigrpTopologyEntry,
+ 4, {3, 1, 1, 9}},
+ {EIGRPROUTEORIGINADDRTYPE, IPADDRESSTYPE, RONLY, eigrpTopologyEntry,
+ 4, {3, 1, 1, 10}},
+ {EIGRPROUTEORIGINADDR, IPADDRESS, RONLY, eigrpTopologyEntry,
+ 4, {3, 1, 1, 11}},
+ {EIGRPNEXTHOPADDRESSTYPE, IPADDRESSTYPE, RONLY, eigrpTopologyEntry,
+ 4, {3, 1, 1, 12}},
+ {EIGRPNEXTHOPADDRESS, IPADDRESS, RONLY, eigrpTopologyEntry,
+ 4, {3, 1, 1, 13}},
+ {EIGRPNEXTHOPINTERFACE, STRING, RONLY, eigrpTopologyEntry,
+ 4, {3, 1, 1, 14}},
+ {EIGRPDISTANCE, INTEGER, RONLY, eigrpTopologyEntry,
+ 4, {3, 1, 1, 15}},
+ {EIGRPREPORTDISTANCE, INTEGER, RONLY, eigrpTopologyEntry,
+ 4, {3, 1, 1, 16}},
+
+ /* EIGRP peer variables */
+ {EIGRPHANDLE, INTEGER, NOACCESS, eigrpPeerEntry,
+ 4, {4, 1, 1, 1}},
+ {EIGRPPEERADDRTYPE, IPADDRESSTYPE, RONLY, eigrpPeerEntry,
+ 4, {4, 1, 1, 2}},
+ {EIGRPPEERADDR, IPADDRESS, RONLY, eigrpPeerEntry,
+ 4, {4, 1, 1, 3}},
+ {EIGRPPEERIFINDEX, INTERFACEINDEXORZERO, RONLY, eigrpPeerEntry,
+ 4, {4, 1, 1, 4}},
+ {EIGRPHOLDTIME, INTEGER, RONLY, eigrpPeerEntry,
+ 4, {4, 1, 1, 5}},
+ {EIGRPUPTIME, STRING, RONLY, eigrpPeerEntry,
+ 4, {4, 1, 1, 6}},
+ {EIGRPSRTT, INTEGER, RONLY, eigrpPeerEntry,
+ 4, {4, 1, 1, 7}},
+ {EIGRPRTO, INTEGER, RONLY, eigrpPeerEntry,
+ 4, {4, 1, 1, 8}},
+ {EIGRPPKTSENQUEUED, INTEGER, RONLY, eigrpPeerEntry,
+ 4, {4, 1, 1, 9}},
+ {EIGRPLASTSEQ, INTEGER, RONLY, eigrpPeerEntry,
+ 4, {4, 1, 1, 10}},
+ {EIGRPVERSION, STRING, RONLY, eigrpPeerEntry,
+ 4, {4, 1, 1, 11}},
+ {EIGRPRETRANS, COUNTER, RONLY, eigrpPeerEntry,
+ 4, {4, 1, 1, 12}},
+ {EIGRPRETRIES, INTEGER, RONLY, eigrpPeerEntry,
+ 4, {4, 1, 1, 13}},
+
+ /* EIGRP interface variables */
+ {EIGRPPEERCOUNT, GAUGE, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 3}},
+ {EIGRPXMITRELIABLEQ, GAUGE, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 4}},
+ {EIGRPXMITUNRELIABLEQ, GAUGE, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 5}},
+ {EIGRPMEANSRTT, INTEGER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 6}},
+ {EIGRPPACINGRELIABLE, INTEGER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 7}},
+ {EIGRPPACINGUNRELIABLE, INTEGER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 8}},
+ {EIGRPMFLOWTIMER, INTEGER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 9}},
+ {EIGRPPENDINGROUTES, GAUGE, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 10}},
+ {EIGRPHELLOINTERVAL, INTEGER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 11}},
+ {EIGRPXMITNEXTSERIAL, COUNTER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 12}},
+ {EIGRPUMCASTS, COUNTER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 13}},
+ {EIGRPRMCASTS, COUNTER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 14}},
+ {EIGRPUUCASTS, COUNTER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 15}},
+ {EIGRPRUCASTS, COUNTER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 16}},
+ {EIGRPMCASTEXCEPTS, COUNTER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 17}},
+ {EIGRPCRPKTS, COUNTER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 18}},
+ {EIGRPACKSSUPPRESSED, COUNTER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 19}},
+ {EIGRPRETRANSSENT, COUNTER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 20}},
+ {EIGRPOOSRCVD, COUNTER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 21}},
+ {EIGRPAUTHMODE, INTEGER, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 22}},
+ {EIGRPAUTHKEYCHAIN, STRING, RONLY, eigrpInterfaceEntry,
+ 4, {5, 1, 1, 23}}
};
static struct eigrp_neighbor *
eigrp_snmp_nbr_lookup (struct eigrp *eigrp, struct in_addr *nbr_addr,
- unsigned int *ifindex)
+ unsigned int *ifindex)
{
struct listnode *node, *nnode, *node2, *nnode2;
struct eigrp_interface *ei;
@@ -356,19 +355,19 @@ eigrp_snmp_nbr_lookup (struct eigrp *eigrp, struct in_addr *nbr_addr,
for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
{
for (ALL_LIST_ELEMENTS (ei->nbrs, node2, nnode2, nbr))
- {
- if (IPV4_ADDR_SAME (&nbr->src, nbr_addr))
- {
- return nbr;
- }
- }
+ {
+ if (IPV4_ADDR_SAME (&nbr->src, nbr_addr))
+ {
+ return nbr;
+ }
+ }
}
return NULL;
}
static struct eigrp_neighbor *
eigrp_snmp_nbr_lookup_next (struct in_addr *nbr_addr, unsigned int *ifindex,
- int first)
+ int first)
{
struct listnode *node, *nnode, *node2, *nnode2;
struct eigrp_interface *ei;
@@ -382,22 +381,22 @@ eigrp_snmp_nbr_lookup_next (struct in_addr *nbr_addr, unsigned int *ifindex,
for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
{
for (ALL_LIST_ELEMENTS (ei->nbrs, node2, nnode2, nbr))
- {
- if (first)
- {
- if (! min)
- min = nbr;
- else if (ntohl (nbr->src.s_addr) < ntohl (min->src.s_addr))
- min = nbr;
- }
- else if (ntohl (nbr->src.s_addr) > ntohl (nbr_addr->s_addr))
- {
- if (! min)
- min = nbr;
- else if (ntohl (nbr->src.s_addr) < ntohl (min->src.s_addr))
- min = nbr;
- }
- }
+ {
+ if (first)
+ {
+ if (! min)
+ min = nbr;
+ else if (ntohl (nbr->src.s_addr) < ntohl (min->src.s_addr))
+ min = nbr;
+ }
+ else if (ntohl (nbr->src.s_addr) > ntohl (nbr_addr->s_addr))
+ {
+ if (! min)
+ min = nbr;
+ else if (ntohl (nbr->src.s_addr) < ntohl (min->src.s_addr))
+ min = nbr;
+ }
+ }
}
if (min)
{
@@ -410,7 +409,7 @@ eigrp_snmp_nbr_lookup_next (struct in_addr *nbr_addr, unsigned int *ifindex,
static struct eigrp_neighbor *
eigrpNbrLookup (struct variable *v, oid *name, size_t *length,
- struct in_addr *nbr_addr, unsigned int *ifindex, int exact)
+ struct in_addr *nbr_addr, unsigned int *ifindex, int exact)
{
unsigned int len;
int first;
@@ -425,7 +424,7 @@ eigrpNbrLookup (struct variable *v, oid *name, size_t *length,
if (exact)
{
if (*length != v->namelen + IN_ADDR_SIZE + 1)
- return NULL;
+ return NULL;
oid2in_addr (name + v->namelen, IN_ADDR_SIZE, nbr_addr);
*ifindex = name[v->namelen + IN_ADDR_SIZE];
@@ -438,958 +437,953 @@ eigrpNbrLookup (struct variable *v, oid *name, size_t *length,
len = *length - v->namelen;
if (len <= 0)
- first = 1;
+ first = 1;
if (len > IN_ADDR_SIZE)
- len = IN_ADDR_SIZE;
+ len = IN_ADDR_SIZE;
oid2in_addr (name + v->namelen, len, nbr_addr);
len = *length - v->namelen - IN_ADDR_SIZE;
if (len >= 1)
- *ifindex = name[v->namelen + IN_ADDR_SIZE];
+ *ifindex = name[v->namelen + IN_ADDR_SIZE];
nbr = eigrp_snmp_nbr_lookup_next (nbr_addr, ifindex, first);
if (nbr)
- {
- *length = v->namelen + IN_ADDR_SIZE + 1;
- oid_copy_addr (name + v->namelen, nbr_addr, IN_ADDR_SIZE);
- name[v->namelen + IN_ADDR_SIZE] = *ifindex;
- return nbr;
- }
+ {
+ *length = v->namelen + IN_ADDR_SIZE + 1;
+ oid_copy_addr (name + v->namelen, nbr_addr, IN_ADDR_SIZE);
+ name[v->namelen + IN_ADDR_SIZE] = *ifindex;
+ return nbr;
+ }
}
return NULL;
}
- static u_char *
- eigrpVpnEntry (struct variable *v, oid *name, size_t *length,
- int exact, size_t *var_len, WriteMethod **write_method)
- {
- struct eigrp *eigrp;
-
-
- eigrp = eigrp_lookup ();
-
- /* Check whether the instance identifier is valid */
- if (smux_header_generic (v, name, length, exact, var_len, write_method)
- == MATCH_FAILED)
- return NULL;
-
- /* Return the current value of the variable */
- switch (v->magic)
- {
- case EIGRPVPNID: /* 1 */
- /* The unique VPN identifier */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPVPNNAME: /* 2 */
- /* The name given to the VPN */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- default:
- return NULL;
- }
- return NULL;
- }
-
- static uint32_t
- eigrp_neighbor_count(struct eigrp *eigrp)
- {
- uint32_t count;
- struct eigrp_interface *ei;
- struct listnode *node, *node2, *nnode2;
- struct eigrp_neighbor *nbr;
+static u_char *
+eigrpVpnEntry (struct variable *v, oid *name, size_t *length,
+ int exact, size_t *var_len, WriteMethod **write_method)
+{
+ struct eigrp *eigrp;
+
+ eigrp = eigrp_lookup ();
+
+ /* Check whether the instance identifier is valid */
+ if (smux_header_generic (v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
+ /* Return the current value of the variable */
+ switch (v->magic)
+ {
+ case EIGRPVPNID: /* 1 */
+ /* The unique VPN identifier */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPVPNNAME: /* 2 */
+ /* The name given to the VPN */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ default:
+ return NULL;
+ }
+ return NULL;
+}
+
+static uint32_t
+eigrp_neighbor_count(struct eigrp *eigrp)
+{
+ uint32_t count;
+ struct eigrp_interface *ei;
+ struct listnode *node, *node2, *nnode2;
+ struct eigrp_neighbor *nbr;
- if (eigrp == NULL)
+ if (eigrp == NULL)
{
- return 0;
+ return 0;
}
- count = 0;
- for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
+ count = 0;
+ for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
{
- for (ALL_LIST_ELEMENTS (ei->nbrs, node2, nnode2, nbr))
+ for (ALL_LIST_ELEMENTS (ei->nbrs, node2, nnode2, nbr))
{
- if (nbr->state == EIGRP_NEIGHBOR_UP)
- count++;
+ if (nbr->state == EIGRP_NEIGHBOR_UP)
+ count++;
}
}
- return count;
- }
+ return count;
+}
- static u_char *
- eigrpTraffStatsEntry (struct variable *v, oid *name, size_t *length,
- int exact, size_t *var_len, WriteMethod **write_method)
- {
- struct eigrp *eigrp;
- struct eigrp_interface *ei;
- struct listnode *node, *nnode;
- int counter;
-
-
- eigrp = eigrp_lookup ();
-
- /* Check whether the instance identifier is valid */
- if (smux_header_generic (v, name, length, exact, var_len, write_method)
- == MATCH_FAILED)
- return NULL;
-
- /* Return the current value of the variable */
- switch (v->magic)
- {
- case EIGRPASNUMBER: /* 1 */
- /* AS-number of this EIGRP instance. */
- if (eigrp)
- return SNMP_INTEGER (eigrp->AS);
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPNBRCOUNT: /* 2 */
- /* Neighbor count of this EIGRP instance */
- if (eigrp)
- return SNMP_INTEGER (eigrp_neighbor_count (eigrp));
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPHELLOSSENT: /* 3 */
- /* Hello packets output count */
- if (eigrp)
- {
- counter = 0;
- for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
- {
- counter += ei->hello_out;
- }
- return SNMP_INTEGER (counter);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPHELLOSRCVD: /* 4 */
- /* Hello packets input count */
- if (eigrp)
- {
- counter = 0;
- for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
- {
- counter += ei->hello_in;
- }
- return SNMP_INTEGER (counter);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPUPDATESSENT: /* 5 */
- /* Update packets output count */
- if (eigrp)
- {
- counter = 0;
- for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
- {
- counter += ei->update_out;
- }
- return SNMP_INTEGER (counter);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPUPDATESRCVD: /* 6 */
- /* Update packets input count */
- if (eigrp)
- {
- counter = 0;
- for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
- {
- counter += ei->update_in;
- }
- return SNMP_INTEGER (counter);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPQUERIESSENT: /* 7 */
- /* Querry packets output count */
- if (eigrp)
- {
- counter = 0;
- for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
- {
- counter += ei->query_out;
- }
- return SNMP_INTEGER (counter);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPQUERIESRCVD: /* 8 */
- /* Querry packets input count */
- if (eigrp)
- {
- counter = 0;
- for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
- {
- counter += ei->query_in;
- }
- return SNMP_INTEGER (counter);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPREPLIESSENT: /* 9 */
- /* Reply packets output count */
- if (eigrp)
- {
- counter = 0;
- for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
- {
- counter += ei->reply_out;
- }
- return SNMP_INTEGER (counter);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPREPLIESRCVD: /* 10 */
- /* Reply packets input count */
- if (eigrp)
- {
- counter = 0;
- for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
- {
- counter += ei->reply_in;
- }
- return SNMP_INTEGER (counter);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPACKSSENT: /* 11 */
- /* Acknowledgement packets output count */
- if (eigrp)
- {
- counter = 0;
- for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
- {
- counter += ei->ack_out;
- }
- return SNMP_INTEGER (counter);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPACKSRCVD: /* 12 */
- /* Acknowledgement packets input count */
- if (eigrp)
- {
- counter = 0;
- for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
- {
- counter += ei->ack_in;
- }
- return SNMP_INTEGER (counter);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPINPUTQHIGHMARK: /* 13 */
- /* The highest number of EIGRP packets in the input queue */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPINPUTQDROPS: /* 14 */
- /* The number of EIGRP packets dropped from the input queue */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPSIAQUERIESSENT: /* 15 */
- /* SIA querry packets output count */
- if (eigrp)
- {
- counter = 0;
- for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
- {
- counter += ei->siaQuery_out;
- }
- return SNMP_INTEGER (counter);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPSIAQUERIESRCVD: /* 16 */
- /* SIA querry packets input count */
- if (eigrp)
- {
- counter = 0;
- for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
- {
- counter += ei->siaQuery_in;
- }
- return SNMP_INTEGER (counter);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPASROUTERIDTYPE: /* 17 */
- /* Whether the router ID is set manually or automatically */
- if (eigrp)
- if(eigrp->router_id_static!=0)
- return SNMP_INTEGER(1);
- else
- return SNMP_INTEGER(1);
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPASROUTERID: /* 18 */
- /* Router ID for this EIGRP AS */
- if (eigrp)
- if(eigrp->router_id_static!=0)
- return SNMP_INTEGER (eigrp->router_id_static);
- else
- return SNMP_INTEGER (eigrp->router_id);
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPTOPOROUTES: /* 19 */
- /* The total number of EIGRP derived routes currently existing
- in the topology table for the AS */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPHEADSERIAL: /* 20 */
- /* The serial number of the first route in the internal
- sequence for an AS*/
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPNEXTSERIAL: /* 21 */
- /* The serial number that would be assigned to the next new
+static u_char *
+eigrpTraffStatsEntry (struct variable *v, oid *name, size_t *length,
+ int exact, size_t *var_len, WriteMethod **write_method)
+{
+ struct eigrp *eigrp;
+ struct eigrp_interface *ei;
+ struct listnode *node, *nnode;
+ int counter;
+
+ eigrp = eigrp_lookup ();
+
+ /* Check whether the instance identifier is valid */
+ if (smux_header_generic (v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
+ /* Return the current value of the variable */
+ switch (v->magic)
+ {
+ case EIGRPASNUMBER: /* 1 */
+ /* AS-number of this EIGRP instance. */
+ if (eigrp)
+ return SNMP_INTEGER (eigrp->AS);
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPNBRCOUNT: /* 2 */
+ /* Neighbor count of this EIGRP instance */
+ if (eigrp)
+ return SNMP_INTEGER (eigrp_neighbor_count (eigrp));
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPHELLOSSENT: /* 3 */
+ /* Hello packets output count */
+ if (eigrp)
+ {
+ counter = 0;
+ for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
+ {
+ counter += ei->hello_out;
+ }
+ return SNMP_INTEGER (counter);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPHELLOSRCVD: /* 4 */
+ /* Hello packets input count */
+ if (eigrp)
+ {
+ counter = 0;
+ for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
+ {
+ counter += ei->hello_in;
+ }
+ return SNMP_INTEGER (counter);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPUPDATESSENT: /* 5 */
+ /* Update packets output count */
+ if (eigrp)
+ {
+ counter = 0;
+ for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
+ {
+ counter += ei->update_out;
+ }
+ return SNMP_INTEGER (counter);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPUPDATESRCVD: /* 6 */
+ /* Update packets input count */
+ if (eigrp)
+ {
+ counter = 0;
+ for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
+ {
+ counter += ei->update_in;
+ }
+ return SNMP_INTEGER (counter);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPQUERIESSENT: /* 7 */
+ /* Querry packets output count */
+ if (eigrp)
+ {
+ counter = 0;
+ for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
+ {
+ counter += ei->query_out;
+ }
+ return SNMP_INTEGER (counter);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPQUERIESRCVD: /* 8 */
+ /* Querry packets input count */
+ if (eigrp)
+ {
+ counter = 0;
+ for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
+ {
+ counter += ei->query_in;
+ }
+ return SNMP_INTEGER (counter);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPREPLIESSENT: /* 9 */
+ /* Reply packets output count */
+ if (eigrp)
+ {
+ counter = 0;
+ for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
+ {
+ counter += ei->reply_out;
+ }
+ return SNMP_INTEGER (counter);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPREPLIESRCVD: /* 10 */
+ /* Reply packets input count */
+ if (eigrp)
+ {
+ counter = 0;
+ for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
+ {
+ counter += ei->reply_in;
+ }
+ return SNMP_INTEGER (counter);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPACKSSENT: /* 11 */
+ /* Acknowledgement packets output count */
+ if (eigrp)
+ {
+ counter = 0;
+ for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
+ {
+ counter += ei->ack_out;
+ }
+ return SNMP_INTEGER (counter);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPACKSRCVD: /* 12 */
+ /* Acknowledgement packets input count */
+ if (eigrp)
+ {
+ counter = 0;
+ for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
+ {
+ counter += ei->ack_in;
+ }
+ return SNMP_INTEGER (counter);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPINPUTQHIGHMARK: /* 13 */
+ /* The highest number of EIGRP packets in the input queue */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPINPUTQDROPS: /* 14 */
+ /* The number of EIGRP packets dropped from the input queue */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPSIAQUERIESSENT: /* 15 */
+ /* SIA querry packets output count */
+ if (eigrp)
+ {
+ counter = 0;
+ for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
+ {
+ counter += ei->siaQuery_out;
+ }
+ return SNMP_INTEGER (counter);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPSIAQUERIESRCVD: /* 16 */
+ /* SIA querry packets input count */
+ if (eigrp)
+ {
+ counter = 0;
+ for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei))
+ {
+ counter += ei->siaQuery_in;
+ }
+ return SNMP_INTEGER (counter);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPASROUTERIDTYPE: /* 17 */
+ /* Whether the router ID is set manually or automatically */
+ if (eigrp)
+ if(eigrp->router_id_static!=0)
+ return SNMP_INTEGER(1);
+ else
+ return SNMP_INTEGER(1);
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPASROUTERID: /* 18 */
+ /* Router ID for this EIGRP AS */
+ if (eigrp)
+ if(eigrp->router_id_static!=0)
+ return SNMP_INTEGER (eigrp->router_id_static);
+ else
+ return SNMP_INTEGER (eigrp->router_id);
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPTOPOROUTES: /* 19 */
+ /* The total number of EIGRP derived routes currently existing
+ in the topology table for the AS */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPHEADSERIAL: /* 20 */
+ /* The serial number of the first route in the internal
+ sequence for an AS*/
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPNEXTSERIAL: /* 21 */
+ /* The serial number that would be assigned to the next new
or changed route in the topology table for the AS*/
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPXMITPENDREPLIES: /* 22 */
- /* Total number of outstanding replies expected to queries
- that have been sent to peers in the current AS*/
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPXMITDUMMIES: /* 23 */
- /* Total number of currently existing dummies associated with the AS*/
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- default:
- return NULL;
- }
- return NULL;
- }
- static u_char *
- eigrpTopologyEntry (struct variable *v, oid *name, size_t *length,
- int exact, size_t *var_len, WriteMethod **write_method)
- {
- struct eigrp *eigrp;
- struct eigrp_interface *ei;
- struct listnode *node, *nnode;
-
-
- eigrp = eigrp_lookup ();
-
- /* Check whether the instance identifier is valid */
- if (smux_header_generic (v, name, length, exact, var_len, write_method)
- == MATCH_FAILED)
- return NULL;
-
- /* Return the current value of the variable */
- switch (v->magic)
- {
- case EIGRPDESTNETTYPE: /* 1 */
- /* The format of the destination IP network number for a single
- route in the topology table*/
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPDESTNET: /* 2 */
- /* The destination IP network number for a single route in the topology table*/
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPDESTNETPREFIXLEN: /* 4 */
- /* The prefix length associated with the destination IP network address
- for a single route in the topology table in the AS*/
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPACTIVE: /* 5 */
- /* A value of true(1) indicates the route to the destination network has failed
- A value of false(2) indicates the route is stable (passive).*/
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPSTUCKINACTIVE: /* 6 */
- /* A value of true(1) indicates that that this route which is in active state
- has not received any replies to queries for alternate paths */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPDESTSUCCESSORS: /* 7 */
- /* Next routing hop for a path to the destination IP network */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPFDISTANCE: /* 8 */
- /* Minimum distance from this router to the destination IP network */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPROUTEORIGINTYPE: /* 9 */
- /* Text string describing the internal origin of the EIGRP route */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPROUTEORIGINADDRTYPE: /* 10 */
- /* The format of the IP address defined as the origin of this
- topology route entry */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPROUTEORIGINADDR: /* 11 */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPXMITPENDREPLIES: /* 22 */
+ /* Total number of outstanding replies expected to queries
+ that have been sent to peers in the current AS*/
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPXMITDUMMIES: /* 23 */
+ /* Total number of currently existing dummies associated with the AS*/
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ default:
+ return NULL;
+ }
+ return NULL;
+}
+
+static u_char *
+eigrpTopologyEntry (struct variable *v, oid *name, size_t *length,
+ int exact, size_t *var_len, WriteMethod **write_method)
+{
+ struct eigrp *eigrp;
+ struct eigrp_interface *ei;
+ struct listnode *node, *nnode;
+
+ eigrp = eigrp_lookup ();
+
+ /* Check whether the instance identifier is valid */
+ if (smux_header_generic (v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
+ /* Return the current value of the variable */
+ switch (v->magic)
+ {
+ case EIGRPDESTNETTYPE: /* 1 */
+ /* The format of the destination IP network number for a single
+ route in the topology table*/
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPDESTNET: /* 2 */
+ /* The destination IP network number for a single route in the topology table*/
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPDESTNETPREFIXLEN: /* 4 */
+ /* The prefix length associated with the destination IP network address
+ for a single route in the topology table in the AS*/
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPACTIVE: /* 5 */
+ /* A value of true(1) indicates the route to the destination network has failed
+ A value of false(2) indicates the route is stable (passive).*/
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPSTUCKINACTIVE: /* 6 */
+ /* A value of true(1) indicates that that this route which is in active state
+ has not received any replies to queries for alternate paths */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPDESTSUCCESSORS: /* 7 */
+ /* Next routing hop for a path to the destination IP network */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPFDISTANCE: /* 8 */
+ /* Minimum distance from this router to the destination IP network */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPROUTEORIGINTYPE: /* 9 */
+ /* Text string describing the internal origin of the EIGRP route */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPROUTEORIGINADDRTYPE: /* 10 */
+ /* The format of the IP address defined as the origin of this
+ topology route entry */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPROUTEORIGINADDR: /* 11 */
/* If the origin of the topology route entry is external to this router,
then this object is the IP address of the router from which it originated */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPNEXTHOPADDRESSTYPE: /* 12 */
- /* The format of the next hop IP address */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPNEXTHOPADDRESS: /* 13 */
- /* Next hop IP address for the route */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPNEXTHOPINTERFACE: /* 14 */
- /* The interface through which the next hop IP address is reached */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPDISTANCE: /* 15 */
- /* The computed distance to the destination network entry from this router */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPREPORTDISTANCE: /* 16 */
- /* The computed distance to the destination network in the topology entry
- reported to this router by the originator of this route */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- default:
- return NULL;
- }
- return NULL;
- }
-
- static u_char *
- eigrpPeerEntry (struct variable *v, oid *name, size_t *length,
- int exact, size_t *var_len, WriteMethod **write_method)
- {
- struct eigrp *eigrp;
- struct eigrp_interface *ei;
- struct listnode *node, *nnode;
- struct eigrp_neighbor *nbr;
- struct in_addr nbr_addr;
- unsigned int ifindex;
-
- eigrp = eigrp_lookup ();
-
- /* Check whether the instance identifier is valid */
- if (smux_header_generic (v, name, length, exact, var_len, write_method)
- == MATCH_FAILED)
- return NULL;
-
- memset (&nbr_addr, 0, sizeof (struct in_addr));
- ifindex = 0;
-
- nbr = eigrpNbrLookup (v, name, length, &nbr_addr, &ifindex, exact);
- if (! nbr)
- return NULL;
- ei = nbr->ei;
- if (! ei)
- return NULL;
-
- /* Return the current value of the variable */
- switch (v->magic)
- {
- case EIGRPHANDLE: /* 1 */
- /* The unique internal identifier for the peer in the AS */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPPEERADDRTYPE: /* 2 */
- /* The format of the remote source IP address used by the peer */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPPEERADDR: /* 3 */
- /* The source IP address used by the peer */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPPEERIFINDEX: /* 4 */
- /* The ifIndex of the interface on this router */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPHOLDTIME: /* 5 */
- /* How much time must pass without receiving a hello packet from this
- EIGRP peer before this router declares the peer down */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPUPTIME: /* 6 */
- /* The elapsed time since the EIGRP adjacency was first established */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPSRTT: /* 7 */
- /* The computed smooth round trip time for packets to and from the peer */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPRTO: /* 8 */
- /* The computed retransmission timeout for the peer */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPPKTSENQUEUED: /* 9 */
- /* The number of any EIGRP packets currently enqueued */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPLASTSEQ: /* 10 */
- /* sequence number of the last EIGRP packet sent to this peer */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPVERSION: /* 11 */
- /* The EIGRP version information reported by the remote peer */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPRETRANS: /* 12 */
- /* The cumulative number of retransmissions to this peer */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPRETRIES: /* 13 */
- /* The number of times the current unacknowledged packet has been retried */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- default:
- return NULL;
- }
- return NULL;
- }
- static u_char *
- eigrpInterfaceEntry (struct variable *v, oid *name, size_t *length,
- int exact, size_t *var_len, WriteMethod **write_method)
- {
- struct eigrp *eigrp;
- struct eigrp_interface *ei;
- struct listnode *node, *nnode;
- struct keychain *keychain;
- struct list *keylist;
- int counter;
-
-
- eigrp = eigrp_lookup ();
-
- /* Check whether the instance identifier is valid */
- if (smux_header_generic (v, name, length, exact, var_len, write_method)
- == MATCH_FAILED)
- return NULL;
-
- /* Return the current value of the variable */
- switch (v->magic)
- {
- case EIGRPPEERCOUNT: /* 3 */
- /* The number of EIGRP adjacencies currently formed with
- peers reached through this interface */
- if (eigrp)
- {
- return SNMP_INTEGER (eigrp_neighbor_count (eigrp));
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPXMITRELIABLEQ: /* 4 */
- /* The number of EIGRP packets currently waiting in the reliable
- transport transmission queue */
- if (eigrp)
- {
- return SNMP_INTEGER (1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPXMITUNRELIABLEQ: /* 5 */
- /* The number of EIGRP packets currently waiting in the unreliable
- transport transmission queue */
- if (eigrp)
- {
- return SNMP_INTEGER (1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPMEANSRTT: /* 6 */
- /* The average of all the computed smooth round trip time values
- for a packet to and from all peers established on this interface */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPPACINGRELIABLE: /* 7 */
- /* The configured time interval between EIGRP packet transmissions */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPPACINGUNRELIABLE: /* 8 */
- /* The configured time interval between EIGRP packet transmissions
- on the interface when the unreliable transport method is used */
- if (eigrp)
- {
- return SNMP_INTEGER (1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPMFLOWTIMER: /* 9 */
- /* The configured multicast flow control timer value */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPPENDINGROUTES: /* 10 */
- /* The number of queued EIGRP routing updates awaiting transmission */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPHELLOINTERVAL: /* 11 */
- /* The configured time interval between Hello packet transmissions */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPXMITNEXTSERIAL: /* 12 */
- /* The serial number of the next EIGRP packet that is to be queued
- for transmission */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPUMCASTS: /* 13 */
- /* The total number of unreliable EIGRP multicast packets sent
- on this interface */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPRMCASTS: /* 14 */
- /* The total number of reliable EIGRP multicast packets sent
- on this interface */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPUUCASTS: /* 15 */
- /* The total number of unreliable EIGRP unicast packets sent
- on this interface */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPRUCASTS: /* 16 */
- /* The total number of reliable EIGRP unicast packets sent
- on this interface */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPMCASTEXCEPTS: /* 17 */
- /* The total number of EIGRP multicast exception transmissions */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPCRPKTS: /* 18 */
- /* The total number EIGRP Conditional-Receive packets sent on this interface */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPACKSSUPPRESSED: /* 19 */
- /* The total number of individual EIGRP acknowledgement packets that have been
- suppressed and combined in an already enqueued outbound reliable packet on this interface */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPRETRANSSENT: /* 20 */
- /* The total number EIGRP packet retransmissions sent on the interface */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPOOSRCVD: /* 21 */
- /* The total number of out-of-sequence EIGRP packets received */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPAUTHMODE: /* 22 */
- /* The EIGRP authentication mode of the interface */
- if (eigrp)
- {
- return SNMP_INTEGER(1);
- }
- else
- return SNMP_INTEGER (0);
- break;
- case EIGRPAUTHKEYCHAIN: /* 23 */
- /* The name of the authentication key-chain configured
- on this interface. */
- keylist = keychain_list_get();
- for (ALL_LIST_ELEMENTS (keylist, node, nnode, keychain))
- {
- return (u_char *) keychain->name;
- }
- if (eigrp && keychain)
- {
- *var_len = str_len (keychain->name);
- return (u_char *) keychain->name;
- }
- else
- return (u_char *) "TEST";
- break;
- default:
- return NULL;
- }
- return NULL;
- }
-
-
- /* Register EIGRP-MIB. */
- void
- eigrp_snmp_init ()
- {
- eigrp_snmp_iflist = list_new ();
- smux_init (eigrp_om->master);
- REGISTER_MIB("ciscoEigrpMIB", eigrp_variables, variable, eigrp_oid);
- }
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPNEXTHOPADDRESSTYPE: /* 12 */
+ /* The format of the next hop IP address */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPNEXTHOPADDRESS: /* 13 */
+ /* Next hop IP address for the route */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPNEXTHOPINTERFACE: /* 14 */
+ /* The interface through which the next hop IP address is reached */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPDISTANCE: /* 15 */
+ /* The computed distance to the destination network entry from this router */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPREPORTDISTANCE: /* 16 */
+ /* The computed distance to the destination network in the topology entry
+ reported to this router by the originator of this route */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ default:
+ return NULL;
+ }
+ return NULL;
+}
+
+static u_char *
+eigrpPeerEntry (struct variable *v, oid *name, size_t *length,
+ int exact, size_t *var_len, WriteMethod **write_method)
+{
+ struct eigrp *eigrp;
+ struct eigrp_interface *ei;
+ struct listnode *node, *nnode;
+ struct eigrp_neighbor *nbr;
+ struct in_addr nbr_addr;
+ unsigned int ifindex;
+
+ eigrp = eigrp_lookup ();
+
+ /* Check whether the instance identifier is valid */
+ if (smux_header_generic (v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
+ memset (&nbr_addr, 0, sizeof (struct in_addr));
+ ifindex = 0;
+
+ nbr = eigrpNbrLookup (v, name, length, &nbr_addr, &ifindex, exact);
+ if (! nbr)
+ return NULL;
+ ei = nbr->ei;
+ if (! ei)
+ return NULL;
+
+ /* Return the current value of the variable */
+ switch (v->magic)
+ {
+ case EIGRPHANDLE: /* 1 */
+ /* The unique internal identifier for the peer in the AS */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPPEERADDRTYPE: /* 2 */
+ /* The format of the remote source IP address used by the peer */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPPEERADDR: /* 3 */
+ /* The source IP address used by the peer */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPPEERIFINDEX: /* 4 */
+ /* The ifIndex of the interface on this router */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPHOLDTIME: /* 5 */
+ /* How much time must pass without receiving a hello packet from this
+ EIGRP peer before this router declares the peer down */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPUPTIME: /* 6 */
+ /* The elapsed time since the EIGRP adjacency was first established */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPSRTT: /* 7 */
+ /* The computed smooth round trip time for packets to and from the peer */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPRTO: /* 8 */
+ /* The computed retransmission timeout for the peer */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPPKTSENQUEUED: /* 9 */
+ /* The number of any EIGRP packets currently enqueued */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPLASTSEQ: /* 10 */
+ /* sequence number of the last EIGRP packet sent to this peer */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPVERSION: /* 11 */
+ /* The EIGRP version information reported by the remote peer */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPRETRANS: /* 12 */
+ /* The cumulative number of retransmissions to this peer */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPRETRIES: /* 13 */
+ /* The number of times the current unacknowledged packet has been retried */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ default:
+ return NULL;
+ }
+ return NULL;
+}
+static u_char *
+eigrpInterfaceEntry (struct variable *v, oid *name, size_t *length,
+ int exact, size_t *var_len, WriteMethod **write_method)
+{
+ struct eigrp *eigrp;
+ struct eigrp_interface *ei;
+ struct listnode *node, *nnode;
+ struct keychain *keychain;
+ struct list *keylist;
+ int counter;
+
+ eigrp = eigrp_lookup ();
+
+ /* Check whether the instance identifier is valid */
+ if (smux_header_generic (v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
+ /* Return the current value of the variable */
+ switch (v->magic)
+ {
+ case EIGRPPEERCOUNT: /* 3 */
+ /* The number of EIGRP adjacencies currently formed with
+ peers reached through this interface */
+ if (eigrp)
+ {
+ return SNMP_INTEGER (eigrp_neighbor_count (eigrp));
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPXMITRELIABLEQ: /* 4 */
+ /* The number of EIGRP packets currently waiting in the reliable
+ transport transmission queue */
+ if (eigrp)
+ {
+ return SNMP_INTEGER (1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPXMITUNRELIABLEQ: /* 5 */
+ /* The number of EIGRP packets currently waiting in the unreliable
+ transport transmission queue */
+ if (eigrp)
+ {
+ return SNMP_INTEGER (1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPMEANSRTT: /* 6 */
+ /* The average of all the computed smooth round trip time values
+ for a packet to and from all peers established on this interface */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPPACINGRELIABLE: /* 7 */
+ /* The configured time interval between EIGRP packet transmissions */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPPACINGUNRELIABLE: /* 8 */
+ /* The configured time interval between EIGRP packet transmissions
+ on the interface when the unreliable transport method is used */
+ if (eigrp)
+ {
+ return SNMP_INTEGER (1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPMFLOWTIMER: /* 9 */
+ /* The configured multicast flow control timer value */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPPENDINGROUTES: /* 10 */
+ /* The number of queued EIGRP routing updates awaiting transmission */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPHELLOINTERVAL: /* 11 */
+ /* The configured time interval between Hello packet transmissions */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPXMITNEXTSERIAL: /* 12 */
+ /* The serial number of the next EIGRP packet that is to be queued
+ for transmission */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPUMCASTS: /* 13 */
+ /* The total number of unreliable EIGRP multicast packets sent
+ on this interface */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPRMCASTS: /* 14 */
+ /* The total number of reliable EIGRP multicast packets sent
+ on this interface */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPUUCASTS: /* 15 */
+ /* The total number of unreliable EIGRP unicast packets sent
+ on this interface */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPRUCASTS: /* 16 */
+ /* The total number of reliable EIGRP unicast packets sent
+ on this interface */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPMCASTEXCEPTS: /* 17 */
+ /* The total number of EIGRP multicast exception transmissions */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPCRPKTS: /* 18 */
+ /* The total number EIGRP Conditional-Receive packets sent on this interface */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPACKSSUPPRESSED: /* 19 */
+ /* The total number of individual EIGRP acknowledgement packets that have been
+ suppressed and combined in an already enqueued outbound reliable packet on this interface */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPRETRANSSENT: /* 20 */
+ /* The total number EIGRP packet retransmissions sent on the interface */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPOOSRCVD: /* 21 */
+ /* The total number of out-of-sequence EIGRP packets received */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPAUTHMODE: /* 22 */
+ /* The EIGRP authentication mode of the interface */
+ if (eigrp)
+ {
+ return SNMP_INTEGER(1);
+ }
+ else
+ return SNMP_INTEGER (0);
+ break;
+ case EIGRPAUTHKEYCHAIN: /* 23 */
+ /* The name of the authentication key-chain configured
+ on this interface. */
+ keylist = keychain_list_get();
+ for (ALL_LIST_ELEMENTS (keylist, node, nnode, keychain))
+ {
+ return (u_char *) keychain->name;
+ }
+ if (eigrp && keychain)
+ {
+ *var_len = str_len (keychain->name);
+ return (u_char *) keychain->name;
+ }
+ else
+ return (u_char *) "TEST";
+ break;
+ default:
+ return NULL;
+ }
+ return NULL;
+}
+/* Register EIGRP-MIB. */
+void
+eigrp_snmp_init ()
+{
+ eigrp_snmp_iflist = list_new ();
+ smux_init (eigrp_om->master);
+ REGISTER_MIB("ciscoEigrpMIB", eigrp_variables, variable, eigrp_oid);
+}
#endif
diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c
index 8895a61f3..c2f420090 100644
--- a/eigrpd/eigrp_topology.c
+++ b/eigrpd/eigrp_topology.c
@@ -52,17 +52,12 @@
#include "eigrpd/eigrp_fsm.h"
#include "eigrpd/eigrp_memory.h"
-static int
-eigrp_prefix_entry_cmp(struct eigrp_prefix_entry *, struct eigrp_prefix_entry *);
-static void
-eigrp_prefix_entry_del(struct eigrp_prefix_entry *);
-static int
-eigrp_neighbor_entry_cmp(struct eigrp_neighbor_entry *,
- struct eigrp_neighbor_entry *);
+static int eigrp_prefix_entry_cmp(struct eigrp_prefix_entry *, struct eigrp_prefix_entry *);
+static void eigrp_prefix_entry_del(struct eigrp_prefix_entry *);
+static int eigrp_neighbor_entry_cmp(struct eigrp_neighbor_entry *,
+ struct eigrp_neighbor_entry *);
/*
- * asdf;laksdjf;lajsdf;kasdjf;asdjf;
- * asdfaskdjfa;sdkjf;adlskj
* Returns linkedlist used as topology table
* cmp - assigned function for comparing topology nodes
* del - assigned function executed before deleting topology node by list function
@@ -72,9 +67,9 @@ eigrp_topology_new()
{
struct list* new = list_new();
new->cmp = (int
- (*)(void *, void *)) eigrp_prefix_entry_cmp;
+ (*)(void *, void *)) eigrp_prefix_entry_cmp;
new->del = (void
- (*)(void *)) eigrp_prefix_entry_del;
+ (*)(void *)) eigrp_prefix_entry_del;
return new;
}
@@ -85,7 +80,7 @@ eigrp_topology_new()
static int
eigrp_prefix_entry_cmp(struct eigrp_prefix_entry *node1,
- struct eigrp_prefix_entry *node2)
+ struct eigrp_prefix_entry *node2)
{
if (node1->af == AF_INET)
{
@@ -135,7 +130,6 @@ eigrp_prefix_entry_del(struct eigrp_prefix_entry *node)
* Returns new created toplogy node
* cmp - assigned function for comparing topology entry
*/
-
struct eigrp_prefix_entry *
eigrp_prefix_entry_new()
{
@@ -154,10 +148,9 @@ eigrp_prefix_entry_new()
/*
* Topology entry comparison
*/
-
static int
eigrp_neighbor_entry_cmp(struct eigrp_neighbor_entry *entry1,
- struct eigrp_neighbor_entry *entry2)
+ struct eigrp_neighbor_entry *entry2)
{
if (entry1->distance < entry2->distance) // parameter used in list_add_sort ()
return -1; // actually set to sort by distance
@@ -177,7 +170,7 @@ eigrp_neighbor_entry_new()
struct eigrp_neighbor_entry *new;
new = XCALLOC(MTYPE_EIGRP_NEIGHBOR_ENTRY,
- sizeof(struct eigrp_neighbor_entry));
+ sizeof(struct eigrp_neighbor_entry));
new->reported_distance = EIGRP_MAX_METRIC;
new->distance = EIGRP_MAX_METRIC;
@@ -187,7 +180,6 @@ eigrp_neighbor_entry_new()
/*
* Freeing topology table list
*/
-
void
eigrp_topology_free(struct list *list)
{
@@ -197,7 +189,6 @@ eigrp_topology_free(struct list *list)
/*
* Deleting all topology nodes in table
*/
-
void
eigrp_topology_cleanup(struct list *topology)
{
@@ -209,7 +200,6 @@ eigrp_topology_cleanup(struct list *topology)
/*
* Adding topology node to topology table
*/
-
void
eigrp_prefix_entry_add(struct list *topology, struct eigrp_prefix_entry *node)
{
@@ -222,10 +212,9 @@ eigrp_prefix_entry_add(struct list *topology, struct eigrp_prefix_entry *node)
/*
* Adding topology entry to topology node
*/
-
void
eigrp_neighbor_entry_add(struct eigrp_prefix_entry *node,
- struct eigrp_neighbor_entry *entry)
+ struct eigrp_neighbor_entry *entry)
{
if (listnode_lookup(node->entries, entry) == NULL)
{
@@ -237,10 +226,9 @@ eigrp_neighbor_entry_add(struct eigrp_prefix_entry *node,
/*
* Deleting topology node from topology table
*/
-
void
eigrp_prefix_entry_delete(struct list *topology,
- struct eigrp_prefix_entry *node)
+ struct eigrp_prefix_entry *node)
{
struct eigrp *eigrp = eigrp_lookup ();
@@ -263,10 +251,9 @@ eigrp_prefix_entry_delete(struct list *topology,
/*
* Deleting topology entry from topology node
*/
-
void
eigrp_neighbor_entry_delete(struct eigrp_prefix_entry *node,
- struct eigrp_neighbor_entry *entry)
+ struct eigrp_neighbor_entry *entry)
{
if (listnode_lookup(node->entries, entry) != NULL)
{
@@ -278,7 +265,6 @@ eigrp_neighbor_entry_delete(struct eigrp_prefix_entry *node,
/*
* Deleting all nodes from topology table
*/
-
void
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
* otherwise return 1
*/
-
unsigned int
eigrp_topology_table_isempty(struct list *topology)
{
@@ -301,13 +286,12 @@ eigrp_topology_table_isempty(struct list *topology)
struct eigrp_prefix_entry *
eigrp_topology_table_lookup_ipv4(struct list *topology_table,
- struct prefix_ipv4 * address)
+ struct prefix_ipv4 * address)
{
struct eigrp_prefix_entry *data;
struct listnode *node;
for (ALL_LIST_ELEMENTS_RO(topology_table, node, data))
{
-
if ((data->af == AF_INET)
&& (data->destination_ipv4->prefix.s_addr == address->prefix.s_addr)
&& (data->destination_ipv4->prefixlen == address->prefixlen))
@@ -353,19 +337,19 @@ eigrp_topology_get_successor(struct eigrp_prefix_entry *table_node)
struct list *
eigrp_topology_get_successor_max(struct eigrp_prefix_entry *table_node,
- unsigned int maxpaths)
+ unsigned int maxpaths)
{
struct list *successors = eigrp_topology_get_successor(table_node);
-
+
if (successors && successors->count > maxpaths)
{
do
- {
- struct listnode *node = listtail(successors);
+ {
+ struct listnode *node = listtail(successors);
- list_delete_node(successors, node);
+ list_delete_node(successors, node);
- } while (successors->count > maxpaths);
+ } while (successors->count > maxpaths);
}
return successors;
@@ -401,13 +385,13 @@ eigrp_neighbor_prefixes_lookup(struct eigrp *eigrp, struct eigrp_neighbor *nbr)
/* iterate over all prefixes in topology table */
for (ALL_LIST_ELEMENTS(eigrp->topology_table, node1, node11, prefix))
{
- /* iterate over all neighbor entry in prefix */
+ /* iterate over all neighbor entry in prefix */
for (ALL_LIST_ELEMENTS(prefix->entries, node2, node22, entry))
{
- /* if entry is from specified neighbor, add to list */
+ /* if entry is from specified neighbor, add to list */
if (entry->adv_router == nbr)
{
- listnode_add(prefixes, prefix);
+ listnode_add(prefixes, prefix);
}
}
}
@@ -435,20 +419,20 @@ eigrp_topology_update_distance(struct eigrp_fsm_action_message *msg)
return 0; // No change
}
change =
+ entry->reported_distance
+ < eigrp_calculate_metrics(eigrp, &int_data->metric) ? 1 :
entry->reported_distance
- < eigrp_calculate_metrics(eigrp, &int_data->metric) ? 1 :
- 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_distance = eigrp_calculate_metrics(eigrp,
- &int_data->metric);
+ entry->reported_distance =
+ eigrp_calculate_metrics(eigrp, &int_data->metric);
entry->distance = eigrp_calculate_total_metrics(eigrp, entry);
}
else
{
ext_data = msg->data.ipv4_ext_data;
if (eigrp_metrics_is_same (&ext_data->metric, &entry->reported_metric))
- return 0;
+ return 0;
}
/*
* Move to correct position in list according to new distance
@@ -481,7 +465,7 @@ eigrp_topology_update_node_flags(struct eigrp_prefix_entry *dest)
for (ALL_LIST_ELEMENTS_RO(dest->entries, node, entry))
{
if ((entry->distance <= (u_int64_t)(dest->distance*eigrp->variance)) &&
- entry->distance != EIGRP_MAX_METRIC) // is successor
+ entry->distance != EIGRP_MAX_METRIC) // is successor
{
entry->flags |= EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG;
entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG;
@@ -494,8 +478,8 @@ eigrp_topology_update_node_flags(struct eigrp_prefix_entry *dest)
else
{
entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG;
- entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG;
- }
+ entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG;
+ }
}
}
@@ -511,7 +495,7 @@ eigrp_update_routing_table(struct eigrp_prefix_entry * prefix)
{
eigrp_zebra_route_add(prefix->destination_ipv4, successors);
for (ALL_LIST_ELEMENTS_RO (successors, node, entry))
- entry->flags |= EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG;
+ entry->flags |= EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG;
list_delete(successors);
}
@@ -519,7 +503,7 @@ eigrp_update_routing_table(struct eigrp_prefix_entry * prefix)
{
eigrp_zebra_route_delete(prefix->destination_ipv4);
for (ALL_LIST_ELEMENTS_RO (prefix->entries, node, entry))
- entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG;
+ entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG;
}
}
@@ -538,7 +522,7 @@ eigrp_topology_neighbor_down(struct eigrp *eigrp, struct eigrp_neighbor * nbr)
{
struct eigrp_fsm_action_message *msg;
msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
- sizeof(struct eigrp_fsm_action_message));
+ sizeof(struct eigrp_fsm_action_message));
struct TLV_IPv4_Internal_type * tlv = eigrp_IPv4_InternalTLV_new();
tlv->metric.delay = EIGRP_MAX_METRIC;
msg->packet_type = EIGRP_OPC_UPDATE;
diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c
index 85fa43230..ee873bb07 100644
--- a/eigrpd/eigrp_update.c
+++ b/eigrpd/eigrp_update.c
@@ -79,18 +79,18 @@
static void
remove_received_prefix_gr (struct list *nbr_prefixes, struct eigrp_prefix_entry *recv_prefix)
{
- struct listnode *node1, *node11;
- struct eigrp_prefix_entry *prefix = NULL;
-
- /* iterate over all prefixes in list */
- for (ALL_LIST_ELEMENTS(nbr_prefixes, node1, node11, prefix))
- {
- /* remove prefix from list if found */
- if (prefix == recv_prefix)
- {
- listnode_delete(nbr_prefixes, prefix);
- }
- }
+ struct listnode *node1, *node11;
+ struct eigrp_prefix_entry *prefix = NULL;
+
+ /* iterate over all prefixes in list */
+ for (ALL_LIST_ELEMENTS(nbr_prefixes, node1, node11, prefix))
+ {
+ /* remove prefix from list if found */
+ if (prefix == recv_prefix)
+ {
+ listnode_delete(nbr_prefixes, prefix);
+ }
+ }
}
/**
@@ -110,51 +110,51 @@ remove_received_prefix_gr (struct list *nbr_prefixes, struct eigrp_prefix_entry
static void
eigrp_update_receive_GR_ask (struct eigrp *eigrp, struct eigrp_neighbor *nbr, struct list *nbr_prefixes)
{
- struct listnode *node1;
- struct eigrp_prefix_entry *prefix;
- struct TLV_IPv4_Internal_type *tlv_max;
-
- /* iterate over all prefixes which weren't advertised by neighbor */
- for (ALL_LIST_ELEMENTS_RO(nbr_prefixes, node1, prefix))
- {
- zlog_debug("GR receive: Neighbor not advertised %s/%d",
- inet_ntoa(prefix->destination_ipv4->prefix),
- prefix->destination_ipv4->prefixlen);
-
- /* create internal IPv4 TLV with infinite delay */
- tlv_max = eigrp_IPv4_InternalTLV_new();
- tlv_max->type = EIGRP_TLV_IPv4_INT;
- tlv_max->length = 28U;
- tlv_max->metric = prefix->reported_metric;
- /* set delay to MAX */
- tlv_max->metric.delay = EIGRP_MAX_METRIC;
- tlv_max->destination = prefix->destination_ipv4->prefix;
- tlv_max->prefix_length = prefix->destination_ipv4->prefixlen;
-
-
- /* prepare message for FSM */
- struct eigrp_fsm_action_message *fsm_msg;
- fsm_msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
- sizeof(struct eigrp_fsm_action_message));
-
- struct eigrp_neighbor_entry *entry =
- eigrp_prefix_entry_lookup(prefix->entries, nbr);
-
- fsm_msg->packet_type = EIGRP_OPC_UPDATE;
- fsm_msg->eigrp = eigrp;
- fsm_msg->data_type = EIGRP_TLV_IPv4_INT;
- fsm_msg->adv_router = nbr;
- fsm_msg->data.ipv4_int_type = tlv_max;
- fsm_msg->entry = entry;
- fsm_msg->prefix = prefix;
-
- /* send message to FSM */
- int event = eigrp_get_fsm_event(fsm_msg);
- eigrp_fsm_event(fsm_msg, event);
-
- /* free memory used by TLV */
- eigrp_IPv4_InternalTLV_free (tlv_max);
- }
+ struct listnode *node1;
+ struct eigrp_prefix_entry *prefix;
+ struct TLV_IPv4_Internal_type *tlv_max;
+
+ /* iterate over all prefixes which weren't advertised by neighbor */
+ for (ALL_LIST_ELEMENTS_RO(nbr_prefixes, node1, prefix))
+ {
+ zlog_debug("GR receive: Neighbor not advertised %s/%d",
+ inet_ntoa(prefix->destination_ipv4->prefix),
+ prefix->destination_ipv4->prefixlen);
+
+ /* create internal IPv4 TLV with infinite delay */
+ tlv_max = eigrp_IPv4_InternalTLV_new();
+ tlv_max->type = EIGRP_TLV_IPv4_INT;
+ tlv_max->length = 28U;
+ tlv_max->metric = prefix->reported_metric;
+ /* set delay to MAX */
+ tlv_max->metric.delay = EIGRP_MAX_METRIC;
+ tlv_max->destination = prefix->destination_ipv4->prefix;
+ tlv_max->prefix_length = prefix->destination_ipv4->prefixlen;
+
+
+ /* prepare message for FSM */
+ struct eigrp_fsm_action_message *fsm_msg;
+ fsm_msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
+ sizeof(struct eigrp_fsm_action_message));
+
+ struct eigrp_neighbor_entry *entry =
+ eigrp_prefix_entry_lookup(prefix->entries, nbr);
+
+ fsm_msg->packet_type = EIGRP_OPC_UPDATE;
+ fsm_msg->eigrp = eigrp;
+ fsm_msg->data_type = EIGRP_TLV_IPv4_INT;
+ fsm_msg->adv_router = nbr;
+ fsm_msg->data.ipv4_int_type = tlv_max;
+ fsm_msg->entry = entry;
+ fsm_msg->prefix = prefix;
+
+ /* send message to FSM */
+ int event = eigrp_get_fsm_event(fsm_msg);
+ eigrp_fsm_event(fsm_msg, event);
+
+ /* free memory used by TLV */
+ eigrp_IPv4_InternalTLV_free (tlv_max);
+ }
}
/*
@@ -198,7 +198,7 @@ eigrp_update_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *
graceful_restart = 0;
graceful_restart_final = 0;
if((nbr->recv_sequence_number) == (ntohl(eigrph->sequence)))
- same = 1;
+ same = 1;
nbr->recv_sequence_number = ntohl(eigrph->sequence);
if (IS_DEBUG_EIGRP_PACKET(0, RECV))
@@ -208,66 +208,66 @@ eigrp_update_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *
nbr->recv_sequence_number, flags);
- if((flags == (EIGRP_INIT_FLAG+EIGRP_RS_FLAG+EIGRP_EOT_FLAG)) && (!same))
+ if((flags == (EIGRP_INIT_FLAG+EIGRP_RS_FLAG+EIGRP_EOT_FLAG)) && (!same))
+ {
+ /* Graceful restart Update received with all routes */
+
+ zlog_info("Neighbor %s (%s) is resync: peer graceful-restart",
+ inet_ntoa(nbr->src), ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
+
+ /* get all prefixes from neighbor from topology table */
+ nbr_prefixes = eigrp_neighbor_prefixes_lookup(eigrp, nbr);
+ graceful_restart = 1;
+ graceful_restart_final = 1;
+ }
+ else if((flags == (EIGRP_INIT_FLAG+EIGRP_RS_FLAG)) && (!same))
{
- /* Graceful restart Update received with all routes */
+ /* Graceful restart Update received, routes also in next packet */
- zlog_info("Neighbor %s (%s) is resync: peer graceful-restart",
- inet_ntoa(nbr->src), ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
+ zlog_info("Neighbor %s (%s) is resync: peer graceful-restart",
+ inet_ntoa(nbr->src), ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
- /* get all prefixes from neighbor from topology table */
- nbr_prefixes = eigrp_neighbor_prefixes_lookup(eigrp, nbr);
- graceful_restart = 1;
- graceful_restart_final = 1;
+ /* get all prefixes from neighbor from topology table */
+ nbr_prefixes = eigrp_neighbor_prefixes_lookup(eigrp, nbr);
+ /* save prefixes to neighbor for later use */
+ nbr->nbr_gr_prefixes = nbr_prefixes;
+ graceful_restart = 1;
+ graceful_restart_final = 0;
}
- else if((flags == (EIGRP_INIT_FLAG+EIGRP_RS_FLAG)) && (!same))
+ else if((flags == (EIGRP_EOT_FLAG)) && (!same))
{
- /* Graceful restart Update received, routes also in next packet */
+ /* If there was INIT+RS Update packet before,
+ * consider this as GR EOT */
- zlog_info("Neighbor %s (%s) is resync: peer graceful-restart",
- inet_ntoa(nbr->src), ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
+ if(nbr->nbr_gr_prefixes != NULL)
+ {
+ /* this is final packet of GR */
+ nbr_prefixes = nbr->nbr_gr_prefixes;
+ nbr->nbr_gr_prefixes = NULL;
+
+ graceful_restart = 1;
+ graceful_restart_final = 1;
+ }
- /* get all prefixes from neighbor from topology table */
- nbr_prefixes = eigrp_neighbor_prefixes_lookup(eigrp, nbr);
- /* save prefixes to neighbor for later use */
- nbr->nbr_gr_prefixes = nbr_prefixes;
- graceful_restart = 1;
- graceful_restart_final = 0;
}
- else if((flags == (EIGRP_EOT_FLAG)) && (!same))
- {
- /* If there was INIT+RS Update packet before,
- * consider this as GR EOT */
-
- if(nbr->nbr_gr_prefixes != NULL)
- {
- /* this is final packet of GR */
- nbr_prefixes = nbr->nbr_gr_prefixes;
- nbr->nbr_gr_prefixes = NULL;
-
- graceful_restart = 1;
- graceful_restart_final = 1;
- }
-
- }
else if((flags == (0)) && (!same))
- {
- /* If there was INIT+RS Update packet before,
- * consider this as GR not final packet */
+ {
+ /* If there was INIT+RS Update packet before,
+ * consider this as GR not final packet */
- if(nbr->nbr_gr_prefixes != NULL)
- {
- /* this is GR not final route packet */
- nbr_prefixes = nbr->nbr_gr_prefixes;
+ if(nbr->nbr_gr_prefixes != NULL)
+ {
+ /* this is GR not final route packet */
+ nbr_prefixes = nbr->nbr_gr_prefixes;
- graceful_restart = 1;
- graceful_restart_final = 0;
- }
+ graceful_restart = 1;
+ graceful_restart_final = 0;
+ }
- }
+ }
else if((flags & EIGRP_INIT_FLAG) && (!same))
- { /* When in pending state, send INIT update only if it wasn't
- already sent before (only if init_sequence is 0) */
+ { /* When in pending state, send INIT update only if it wasn't
+ already sent before (only if init_sequence is 0) */
if((nbr->state == EIGRP_NEIGHBOR_PENDING) && (nbr->init_sequence_number == 0))
eigrp_update_send_init(nbr);
@@ -283,7 +283,7 @@ eigrp_update_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *
inet_ntoa(nbr->src), ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
eigrp_update_send_init(nbr);
}
- }
+ }
/*If there is topology information*/
while (s->endp > s->getp)
@@ -300,21 +300,21 @@ eigrp_update_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *
dest_addr = prefix_ipv4_new();
dest_addr->prefix = tlv->destination;
dest_addr->prefixlen = tlv->prefix_length;
- struct eigrp_prefix_entry *dest = eigrp_topology_table_lookup_ipv4(
- eigrp->topology_table, dest_addr);
+ struct eigrp_prefix_entry *dest =
+ eigrp_topology_table_lookup_ipv4(eigrp->topology_table, dest_addr);
/*if exists it comes to DUAL*/
if (dest != NULL)
{
- /* remove received prefix from neighbor prefix list if in GR */
- if(graceful_restart)
- remove_received_prefix_gr(nbr_prefixes, dest);
+ /* remove received prefix from neighbor prefix list if in GR */
+ if(graceful_restart)
+ remove_received_prefix_gr(nbr_prefixes, dest);
struct eigrp_fsm_action_message *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(dest->entries, nbr);
+ eigrp_prefix_entry_lookup(dest->entries, nbr);
msg->packet_type = EIGRP_OPC_UPDATE;
msg->eigrp = eigrp;
@@ -341,107 +341,107 @@ eigrp_update_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *
ne->adv_router = nbr;
ne->reported_metric = tlv->metric;
ne->reported_distance =
- eigrp_calculate_metrics(eigrp,
- &tlv->metric);
+ eigrp_calculate_metrics(eigrp,
+ &tlv->metric);
/*
* Filtering
*/
e = eigrp_lookup();
/*
- * Check if there is any access-list on interface (IN direction)
- * and set distance to max
- */
- alist = ei->list[EIGRP_FILTER_IN];
+ * Check if there is any access-list on interface (IN direction)
+ * and set distance to max
+ */
+ alist = ei->list[EIGRP_FILTER_IN];
- if (alist) {
+ if (alist) {
zlog_info ("ALIST PROC IN: %s", alist->name);
- } else {
- zlog_info("ALIST je prazdny");
- }
+ } else {
+ zlog_info("ALIST je prazdny");
+ }
/* Check if access-list fits */
- if (alist && access_list_apply (alist,
- (struct prefix *) dest_addr) == FILTER_DENY)
- {
+ if (alist && access_list_apply (alist,
+ (struct prefix *) dest_addr) == FILTER_DENY)
+ {
/* If yes, set reported metric to Max */
- zlog_info("PROC IN: Nastavujem metriku na MAX");
+ zlog_info("PROC IN: Nastavujem metriku na MAX");
ne->reported_metric.delay = EIGRP_MAX_METRIC;
zlog_info("PROC IN Prefix: %s", inet_ntoa(dest_addr->prefix));
- } else {
- zlog_info("PROC IN: NENastavujem metriku ");
- ne->distance = eigrp_calculate_total_metrics(eigrp, ne);
- }
-
- plist = e->prefix[EIGRP_FILTER_IN];
-
- if (plist) {
- zlog_info ("PLIST PROC IN: %s", plist->name);
- } else {
- zlog_info("PLIST PROC IN je prazdny");
- }
-
- /* Check if prefix-list fits */
- if (plist && prefix_list_apply (plist,
- (struct prefix *) dest_addr) == PREFIX_DENY)
- {
- /* If yes, set reported metric to Max */
- zlog_info("PLIST PROC IN: Nastavujem metriku na MAX");
- ne->reported_metric.delay = EIGRP_MAX_METRIC;
- zlog_info("PLIST PROC IN Prefix: %s", inet_ntoa(dest_addr->prefix));
- } else {
- zlog_info("PLIST PROC IN: NENastavujem metriku ");
- }
-
- /*Get access-list from current interface */
- zlog_info("Checking access_list on interface: %s",ei->ifp->name);
- alist = ei->list[EIGRP_FILTER_IN];
- if (alist) {
- zlog_info ("ALIST INT IN: %s", alist->name);
- } else {
- zlog_info("ALIST INT IN je prazdny");
- }
-
- /* Check if access-list fits */
- if (alist && access_list_apply (alist, (struct prefix *) dest_addr) == FILTER_DENY)
- {
- /* If yes, set reported metric to Max */
- zlog_info("INT IN: Nastavujem metriku na MAX");
- ne->reported_metric.delay = EIGRP_MAX_METRIC;
- zlog_info("INT IN Prefix: %s", inet_ntoa(dest_addr->prefix));
- } else {
- zlog_info("INT IN: NENastavujem metriku ");
- }
-
- plist = ei->prefix[EIGRP_FILTER_IN];
-
- if (plist) {
- zlog_info ("PLIST INT IN: %s", plist->name);
- } else {
- zlog_info("PLIST INT IN je prazdny");
- }
-
- /* Check if prefix-list fits */
- if (plist && prefix_list_apply (plist,
- (struct prefix *) dest_addr) == PREFIX_DENY)
- {
- /* If yes, set reported metric to Max */
- zlog_info("PLIST INT IN: Nastavujem metriku na MAX");
- ne->reported_metric.delay = EIGRP_MAX_METRIC;
- zlog_info("PLIST INT IN Prefix: %s", inet_ntoa(dest_addr->prefix));
- } else {
- zlog_info("PLIST INT IN: NENastavujem metriku ");
- }
- /*
- * End of filtering
- */
-
- ne->distance = eigrp_calculate_total_metrics(eigrp, ne);
-
- zlog_info("<DEBUG PROC IN Distance: %x", ne->distance);
- zlog_info("<DEBUG PROC IN Delay: %x", ne->total_metric.delay);
+ } else {
+ zlog_info("PROC IN: NENastavujem metriku ");
+ ne->distance = eigrp_calculate_total_metrics(eigrp, ne);
+ }
+
+ plist = e->prefix[EIGRP_FILTER_IN];
+
+ if (plist) {
+ zlog_info ("PLIST PROC IN: %s", plist->name);
+ } else {
+ zlog_info("PLIST PROC IN je prazdny");
+ }
+
+ /* Check if prefix-list fits */
+ if (plist && prefix_list_apply (plist,
+ (struct prefix *) dest_addr) == PREFIX_DENY)
+ {
+ /* If yes, set reported metric to Max */
+ zlog_info("PLIST PROC IN: Nastavujem metriku na MAX");
+ ne->reported_metric.delay = EIGRP_MAX_METRIC;
+ zlog_info("PLIST PROC IN Prefix: %s", inet_ntoa(dest_addr->prefix));
+ } else {
+ zlog_info("PLIST PROC IN: NENastavujem metriku ");
+ }
+
+ /*Get access-list from current interface */
+ zlog_info("Checking access_list on interface: %s",ei->ifp->name);
+ alist = ei->list[EIGRP_FILTER_IN];
+ if (alist) {
+ zlog_info ("ALIST INT IN: %s", alist->name);
+ } else {
+ zlog_info("ALIST INT IN je prazdny");
+ }
+
+ /* Check if access-list fits */
+ if (alist && access_list_apply (alist, (struct prefix *) dest_addr) == FILTER_DENY)
+ {
+ /* If yes, set reported metric to Max */
+ zlog_info("INT IN: Nastavujem metriku na MAX");
+ ne->reported_metric.delay = EIGRP_MAX_METRIC;
+ zlog_info("INT IN Prefix: %s", inet_ntoa(dest_addr->prefix));
+ } else {
+ zlog_info("INT IN: NENastavujem metriku ");
+ }
+
+ plist = ei->prefix[EIGRP_FILTER_IN];
+
+ if (plist) {
+ zlog_info ("PLIST INT IN: %s", plist->name);
+ } else {
+ zlog_info("PLIST INT IN je prazdny");
+ }
+
+ /* Check if prefix-list fits */
+ if (plist && prefix_list_apply (plist,
+ (struct prefix *) dest_addr) == PREFIX_DENY)
+ {
+ /* If yes, set reported metric to Max */
+ zlog_info("PLIST INT IN: Nastavujem metriku na MAX");
+ ne->reported_metric.delay = EIGRP_MAX_METRIC;
+ zlog_info("PLIST INT IN Prefix: %s", inet_ntoa(dest_addr->prefix));
+ } else {
+ zlog_info("PLIST INT IN: NENastavujem metriku ");
+ }
+ /*
+ * End of filtering
+ */
+
+ ne->distance = eigrp_calculate_total_metrics(eigrp, ne);
+
+ zlog_info("<DEBUG PROC IN Distance: %x", ne->distance);
+ zlog_info("<DEBUG PROC IN Delay: %x", ne->total_metric.delay);
pe->fdistance = pe->distance = pe->rdistance =
- ne->distance;
+ ne->distance;
ne->prefix = pe;
ne->flags = EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG;
@@ -479,11 +479,11 @@ eigrp_update_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *
}
}
- /* ask about prefixes not present in GR update,
- * if this is final GR packet */
- if(graceful_restart_final)
+ /* ask about prefixes not present in GR update,
+ * if this is final GR packet */
+ if(graceful_restart_final)
{
- eigrp_update_receive_GR_ask(eigrp, nbr, nbr_prefixes);
+ eigrp_update_receive_GR_ask(eigrp, nbr, nbr_prefixes);
}
/*
@@ -518,7 +518,8 @@ eigrp_update_send_init (struct eigrp_neighbor *nbr)
nbr->recv_sequence_number);
// encode Authentication TLV, if needed
- if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
+ if((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);
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)
{
struct eigrp_packet *ep;
-// struct eigrp_packet *ep_multicast;
+ // struct eigrp_packet *ep_multicast;
u_int16_t length = EIGRP_HEADER_LEN;
struct eigrp_neighbor_entry *te;
struct eigrp_prefix_entry *pe;
@@ -584,49 +585,50 @@ eigrp_update_send_EOT (struct eigrp_neighbor *nbr)
continue;
/* Get destination address from prefix */
- dest_addr = pe->destination_ipv4;
-
- /*
- * Filtering
- */
- //TODO: Work in progress
- /* get list from eigrp process */
- e = eigrp_lookup();
- /* Get access-lists and prefix-lists from process and interface */
- alist = e->list[EIGRP_FILTER_OUT];
- plist = e->prefix[EIGRP_FILTER_OUT];
- alist_i = nbr->ei->list[EIGRP_FILTER_OUT];
- plist_i = nbr->ei->prefix[EIGRP_FILTER_OUT];
-
- /* Check if any list fits */
- if ((alist && access_list_apply (alist,
- (struct prefix *) dest_addr) == FILTER_DENY)||
- (plist && prefix_list_apply (plist,
- (struct prefix *) dest_addr) == PREFIX_DENY)||
- (alist_i && access_list_apply (alist_i,
- (struct prefix *) dest_addr) == FILTER_DENY)||
- (plist_i && prefix_list_apply (plist_i,
- (struct prefix *) dest_addr) == PREFIX_DENY))
- {
- zlog_info("PROC OUT EOT: Skipping");
- //pe->reported_metric.delay = EIGRP_MAX_METRIC;
- zlog_info("PROC OUT EOT Prefix: %s", inet_ntoa(dest_addr->prefix));
- continue;
- } else {
- zlog_info("PROC OUT EOT: NENastavujem metriku ");
- length += eigrp_add_internalTLV_to_stream(ep->s, pe);
- }
- /*
- * End of filtering
- */
-
- /* NULL the pointer */
- dest_addr = NULL;
+ dest_addr = pe->destination_ipv4;
+
+ /*
+ * Filtering
+ */
+ //TODO: Work in progress
+ /* get list from eigrp process */
+ e = eigrp_lookup();
+ /* Get access-lists and prefix-lists from process and interface */
+ alist = e->list[EIGRP_FILTER_OUT];
+ plist = e->prefix[EIGRP_FILTER_OUT];
+ alist_i = nbr->ei->list[EIGRP_FILTER_OUT];
+ plist_i = nbr->ei->prefix[EIGRP_FILTER_OUT];
+
+ /* Check if any list fits */
+ if ((alist && access_list_apply (alist,
+ (struct prefix *) dest_addr) == FILTER_DENY)||
+ (plist && prefix_list_apply (plist,
+ (struct prefix *) dest_addr) == PREFIX_DENY)||
+ (alist_i && access_list_apply (alist_i,
+ (struct prefix *) dest_addr) == FILTER_DENY)||
+ (plist_i && prefix_list_apply (plist_i,
+ (struct prefix *) dest_addr) == PREFIX_DENY))
+ {
+ zlog_info("PROC OUT EOT: Skipping");
+ //pe->reported_metric.delay = EIGRP_MAX_METRIC;
+ zlog_info("PROC OUT EOT Prefix: %s", inet_ntoa(dest_addr->prefix));
+ continue;
+ } else {
+ zlog_info("PROC OUT EOT: NENastavujem metriku ");
+ length += eigrp_add_internalTLV_to_stream(ep->s, pe);
+ }
+ /*
+ * End of filtering
+ */
+
+ /* NULL the pointer */
+ dest_addr = NULL;
}
}
- 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);
}
@@ -651,7 +653,6 @@ eigrp_update_send_EOT (struct eigrp_neighbor *nbr)
{
eigrp_send_packet_reliably(nbr);
}
-
}
void
@@ -668,7 +669,7 @@ eigrp_update_send (struct eigrp_interface *ei)
struct prefix_list *plist_i;
struct eigrp *e;
struct prefix_ipv4 *dest_addr;
-
+
u_int16_t length = EIGRP_HEADER_LEN;
ep = eigrp_packet_new(ei->ifp->mtu);
@@ -678,7 +679,8 @@ eigrp_update_send (struct eigrp_interface *ei)
ei->eigrp->sequence_number, 0);
// encode Authentication TLV, if needed
- if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
+ if((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);
}
@@ -688,46 +690,46 @@ eigrp_update_send (struct eigrp_interface *ei)
{
if(pe->req_action & EIGRP_FSM_NEED_UPDATE)
{
- /* Get destination address from prefix */
- dest_addr = pe->destination_ipv4;
-
- /*
- * Filtering
- */
- //TODO: Work in progress
- /* get list from eigrp process */
- e = eigrp_lookup();
- /* Get access-lists and prefix-lists from process and interface */
- alist = e->list[EIGRP_FILTER_OUT];
- plist = e->prefix[EIGRP_FILTER_OUT];
- alist_i = ei->list[EIGRP_FILTER_OUT];
- plist_i = ei->prefix[EIGRP_FILTER_OUT];
-
- /* Check if any list fits */
- if ((alist && access_list_apply (alist,
- (struct prefix *) dest_addr) == FILTER_DENY)||
- (plist && prefix_list_apply (plist,
- (struct prefix *) dest_addr) == PREFIX_DENY)||
- (alist_i && access_list_apply (alist_i,
- (struct prefix *) dest_addr) == FILTER_DENY)||
- (plist_i && prefix_list_apply (plist_i,
- (struct prefix *) dest_addr) == PREFIX_DENY))
- {
- zlog_info("PROC OUT: Skipping");
- //pe->reported_metric.delay = EIGRP_MAX_METRIC;
- zlog_info("PROC OUT Prefix: %s", inet_ntoa(dest_addr->prefix));
- continue;
- } else {
- zlog_info("PROC OUT: NENastavujem metriku ");
- length += eigrp_add_internalTLV_to_stream(ep->s, pe);
- has_tlv = 1;
- }
- /*
- * End of filtering
- */
-
- /* NULL the pointer */
- dest_addr = NULL;
+ /* Get destination address from prefix */
+ dest_addr = pe->destination_ipv4;
+
+ /*
+ * Filtering
+ */
+ //TODO: Work in progress
+ /* get list from eigrp process */
+ e = eigrp_lookup();
+ /* Get access-lists and prefix-lists from process and interface */
+ alist = e->list[EIGRP_FILTER_OUT];
+ plist = e->prefix[EIGRP_FILTER_OUT];
+ alist_i = ei->list[EIGRP_FILTER_OUT];
+ plist_i = ei->prefix[EIGRP_FILTER_OUT];
+
+ /* Check if any list fits */
+ if ((alist && access_list_apply (alist,
+ (struct prefix *) dest_addr) == FILTER_DENY)||
+ (plist && prefix_list_apply (plist,
+ (struct prefix *) dest_addr) == PREFIX_DENY)||
+ (alist_i && access_list_apply (alist_i,
+ (struct prefix *) dest_addr) == FILTER_DENY)||
+ (plist_i && prefix_list_apply (plist_i,
+ (struct prefix *) dest_addr) == PREFIX_DENY))
+ {
+ zlog_info("PROC OUT: Skipping");
+ //pe->reported_metric.delay = EIGRP_MAX_METRIC;
+ zlog_info("PROC OUT Prefix: %s", inet_ntoa(dest_addr->prefix));
+ continue;
+ } else {
+ zlog_info("PROC OUT: NENastavujem metriku ");
+ length += eigrp_add_internalTLV_to_stream(ep->s, pe);
+ has_tlv = 1;
+ }
+ /*
+ * End of filtering
+ */
+
+ /* NULL the pointer */
+ dest_addr = NULL;
}
}
@@ -774,7 +776,6 @@ eigrp_update_send (struct eigrp_interface *ei)
void
eigrp_update_send_all (struct eigrp *eigrp, struct eigrp_interface *exception)
{
-
struct eigrp_interface *iface;
struct listnode *node, *node2, *nnode2;
struct eigrp_prefix_entry *pe;
@@ -815,212 +816,207 @@ eigrp_update_send_all (struct eigrp *eigrp, struct eigrp_interface *exception)
static void
eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
{
- struct eigrp_packet *ep;
- u_int16_t length = EIGRP_HEADER_LEN;
- struct listnode *node, *nnode;
- struct eigrp_prefix_entry *pe;
- struct prefix_ipv4 *dest_addr;
- struct eigrp *e;
- struct access_list *alist, *alist_i;
- struct prefix_list *plist, *plist_i;
- struct list *prefixes;
- u_int32_t flags;
- unsigned int send_prefixes;
- struct TLV_IPv4_Internal_type *tlv_max;
-
- /* get prefixes to send to neighbor */
- prefixes = nbr->nbr_gr_prefixes_send;
-
- send_prefixes = 0;
- length = EIGRP_HEADER_LEN;
-
- /* if there already were last packet chunk, we won't continue */
- if(nbr->nbr_gr_packet_type == EIGRP_PACKET_PART_LAST)
- return;
-
- /* if this is first packet chunk, we need to decide,
- * if there will be one or more chunks */
- if(nbr->nbr_gr_packet_type == EIGRP_PACKET_PART_FIRST)
- {
- if(prefixes->count <= EIGRP_TLV_MAX_IPv4)
- {
- /* there will be only one chunk */
- flags = EIGRP_INIT_FLAG + EIGRP_RS_FLAG + EIGRP_EOT_FLAG;
- nbr->nbr_gr_packet_type = EIGRP_PACKET_PART_LAST;
- }
- else
- {
- /* there will be more chunks */
- flags = EIGRP_INIT_FLAG + EIGRP_RS_FLAG;
- nbr->nbr_gr_packet_type = EIGRP_PACKET_PART_NA;
- }
- }
- else
- {
- /* this is not first chunk, and we need to decide,
- * if there will be more chunks */
- if(prefixes->count <= EIGRP_TLV_MAX_IPv4)
- {
- /* this is last chunk */
- flags = EIGRP_EOT_FLAG;
- nbr->nbr_gr_packet_type = EIGRP_PACKET_PART_LAST;
- }
- else
- {
- /* there will be more chunks */
- flags = 0;
- nbr->nbr_gr_packet_type = EIGRP_PACKET_PART_NA;
- }
- }
-
- ep = eigrp_packet_new(nbr->ei->ifp->mtu);
-
- /* Prepare EIGRP Graceful restart UPDATE header */
- eigrp_packet_header_init(EIGRP_OPC_UPDATE, nbr->ei, ep->s,
- flags,
- nbr->ei->eigrp->sequence_number,
- nbr->recv_sequence_number);
-
- // encode Authentication TLV, if needed
- if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
- {
- length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei);
- }
-
- for (ALL_LIST_ELEMENTS(nbr->ei->eigrp->topology_table, node, nnode, pe))
- {
-
- /*
- * Filtering
- */
- dest_addr = pe->destination_ipv4;
- /* get list from eigrp process */
- e = eigrp_lookup();
- /* Get access-lists and prefix-lists from process and interface */
- alist = e->list[EIGRP_FILTER_OUT];
- plist = e->prefix[EIGRP_FILTER_OUT];
- alist_i = nbr->ei->list[EIGRP_FILTER_OUT];
- plist_i = nbr->ei->prefix[EIGRP_FILTER_OUT];
-
-
- /* Check if any list fits */
- if ((alist && access_list_apply (alist,
- (struct prefix *) dest_addr) == FILTER_DENY)||
- (plist && prefix_list_apply (plist,
- (struct prefix *) dest_addr) == PREFIX_DENY)||
- (alist_i && access_list_apply (alist_i,
- (struct prefix *) dest_addr) == FILTER_DENY)||
- (plist_i && prefix_list_apply (plist_i,
- (struct prefix *) dest_addr) == PREFIX_DENY))
- {
- /* do not send filtered route */
- zlog_info("Filtered prefix %s won't be sent out.",
- inet_ntoa(dest_addr->prefix));
- }
- else
- {
- /* sending route which wasn't filtered */
- length += eigrp_add_internalTLV_to_stream(ep->s, pe);
- send_prefixes++;
- }
-
-
-
- alist = e->list[EIGRP_FILTER_IN];
- plist = e->prefix[EIGRP_FILTER_IN];
- alist_i = nbr->ei->list[EIGRP_FILTER_IN];
- plist_i = nbr->ei->prefix[EIGRP_FILTER_IN];
-
-
- /* Check if any list fits */
- if ((alist && access_list_apply (alist,
- (struct prefix *) dest_addr) == FILTER_DENY)||
- (plist && prefix_list_apply (plist,
- (struct prefix *) dest_addr) == PREFIX_DENY)||
- (alist_i && access_list_apply (alist_i,
- (struct prefix *) dest_addr) == FILTER_DENY)||
- (plist_i && prefix_list_apply (plist_i,
- (struct prefix *) dest_addr) == PREFIX_DENY))
- {
- /* do not send filtered route */
- zlog_info("Filtered prefix %s will be removed.",
- inet_ntoa(dest_addr->prefix));
-
- tlv_max = eigrp_IPv4_InternalTLV_new();
- tlv_max->type = EIGRP_TLV_IPv4_INT;
- tlv_max->length = 28U;
- tlv_max->metric = pe->reported_metric;
- /* set delay to MAX */
- tlv_max->metric.delay = EIGRP_MAX_METRIC;
- tlv_max->destination = pe->destination_ipv4->prefix;
- tlv_max->prefix_length = pe->destination_ipv4->prefixlen;
-
-
- /* prepare message for FSM */
- struct eigrp_fsm_action_message *fsm_msg;
- fsm_msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
- sizeof(struct eigrp_fsm_action_message));
-
- struct eigrp_neighbor_entry *entry =
- eigrp_prefix_entry_lookup(pe->entries, nbr);
-
- fsm_msg->packet_type = EIGRP_OPC_UPDATE;
- fsm_msg->eigrp = e;
- fsm_msg->data_type = EIGRP_TLV_IPv4_INT;
- fsm_msg->adv_router = nbr;
- fsm_msg->data.ipv4_int_type = tlv_max;
- fsm_msg->entry = entry;
- fsm_msg->prefix = pe;
-
- /* send message to FSM */
- int event = eigrp_get_fsm_event(fsm_msg);
- eigrp_fsm_event(fsm_msg, event);
-
- /* free memory used by TLV */
- eigrp_IPv4_InternalTLV_free (tlv_max);
- }
- /*
- * End of filtering
- */
-
- /* NULL the pointer */
- dest_addr = NULL;
-
- /* delete processed prefix from list */
- listnode_delete(prefixes, pe);
-
- /* if there are enough prefixes, send packet */
- if(send_prefixes >= EIGRP_TLV_MAX_IPv4)
- break;
- }
-
- /* 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))
- {
- eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG);
- }
-
- /* EIGRP Checksum */
- eigrp_packet_checksum(nbr->ei, ep->s, length);
-
- ep->length = length;
- ep->dst.s_addr = nbr->src.s_addr;
-
- /*This ack number we await from neighbor*/
- ep->sequence_number = nbr->ei->eigrp->sequence_number;
-
- if (IS_DEBUG_EIGRP_PACKET(0, RECV))
- zlog_debug("Enqueuing Update Init Len [%u] Seq [%u] Dest [%s]",
- ep->length, ep->sequence_number, inet_ntoa(ep->dst));
-
-
- /*Put packet to retransmission queue*/
- eigrp_fifo_push_head(nbr->retrans_queue, ep);
-
- if (nbr->retrans_queue->count == 1)
- {
- eigrp_send_packet_reliably(nbr);
- }
+ struct eigrp_packet *ep;
+ u_int16_t length = EIGRP_HEADER_LEN;
+ struct listnode *node, *nnode;
+ struct eigrp_prefix_entry *pe;
+ struct prefix_ipv4 *dest_addr;
+ struct eigrp *e;
+ struct access_list *alist, *alist_i;
+ struct prefix_list *plist, *plist_i;
+ struct list *prefixes;
+ u_int32_t flags;
+ unsigned int send_prefixes;
+ struct TLV_IPv4_Internal_type *tlv_max;
+
+ /* get prefixes to send to neighbor */
+ prefixes = nbr->nbr_gr_prefixes_send;
+
+ send_prefixes = 0;
+ length = EIGRP_HEADER_LEN;
+
+ /* if there already were last packet chunk, we won't continue */
+ if(nbr->nbr_gr_packet_type == EIGRP_PACKET_PART_LAST)
+ return;
+
+ /* if this is first packet chunk, we need to decide,
+ * if there will be one or more chunks */
+ if(nbr->nbr_gr_packet_type == EIGRP_PACKET_PART_FIRST)
+ {
+ if(prefixes->count <= EIGRP_TLV_MAX_IPv4)
+ {
+ /* there will be only one chunk */
+ flags = EIGRP_INIT_FLAG + EIGRP_RS_FLAG + EIGRP_EOT_FLAG;
+ nbr->nbr_gr_packet_type = EIGRP_PACKET_PART_LAST;
+ }
+ else
+ {
+ /* there will be more chunks */
+ flags = EIGRP_INIT_FLAG + EIGRP_RS_FLAG;
+ nbr->nbr_gr_packet_type = EIGRP_PACKET_PART_NA;
+ }
+ }
+ else
+ {
+ /* this is not first chunk, and we need to decide,
+ * if there will be more chunks */
+ if(prefixes->count <= EIGRP_TLV_MAX_IPv4)
+ {
+ /* this is last chunk */
+ flags = EIGRP_EOT_FLAG;
+ nbr->nbr_gr_packet_type = EIGRP_PACKET_PART_LAST;
+ }
+ else
+ {
+ /* there will be more chunks */
+ flags = 0;
+ nbr->nbr_gr_packet_type = EIGRP_PACKET_PART_NA;
+ }
+ }
+
+ ep = eigrp_packet_new(nbr->ei->ifp->mtu);
+
+ /* Prepare EIGRP Graceful restart UPDATE header */
+ eigrp_packet_header_init(EIGRP_OPC_UPDATE, nbr->ei, ep->s,
+ flags,
+ nbr->ei->eigrp->sequence_number,
+ nbr->recv_sequence_number);
+
+ // encode Authentication TLV, if needed
+ if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
+ (IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
+ {
+ length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei);
+ }
+
+ for (ALL_LIST_ELEMENTS(nbr->ei->eigrp->topology_table, node, nnode, pe))
+ {
+ /*
+ * Filtering
+ */
+ dest_addr = pe->destination_ipv4;
+ /* get list from eigrp process */
+ e = eigrp_lookup();
+ /* Get access-lists and prefix-lists from process and interface */
+ alist = e->list[EIGRP_FILTER_OUT];
+ plist = e->prefix[EIGRP_FILTER_OUT];
+ alist_i = nbr->ei->list[EIGRP_FILTER_OUT];
+ plist_i = nbr->ei->prefix[EIGRP_FILTER_OUT];
+
+ /* Check if any list fits */
+ if ((alist && access_list_apply (alist,
+ (struct prefix *) dest_addr) == FILTER_DENY)||
+ (plist && prefix_list_apply (plist,
+ (struct prefix *) dest_addr) == PREFIX_DENY)||
+ (alist_i && access_list_apply (alist_i,
+ (struct prefix *) dest_addr) == FILTER_DENY)||
+ (plist_i && prefix_list_apply (plist_i,
+ (struct prefix *) dest_addr) == PREFIX_DENY))
+ {
+ /* do not send filtered route */
+ zlog_info("Filtered prefix %s won't be sent out.",
+ inet_ntoa(dest_addr->prefix));
+ }
+ else
+ {
+ /* sending route which wasn't filtered */
+ length += eigrp_add_internalTLV_to_stream(ep->s, pe);
+ send_prefixes++;
+ }
+
+ alist = e->list[EIGRP_FILTER_IN];
+ plist = e->prefix[EIGRP_FILTER_IN];
+ alist_i = nbr->ei->list[EIGRP_FILTER_IN];
+ plist_i = nbr->ei->prefix[EIGRP_FILTER_IN];
+
+ /* Check if any list fits */
+ if ((alist && access_list_apply (alist,
+ (struct prefix *) dest_addr) == FILTER_DENY)||
+ (plist && prefix_list_apply (plist,
+ (struct prefix *) dest_addr) == PREFIX_DENY)||
+ (alist_i && access_list_apply (alist_i,
+ (struct prefix *) dest_addr) == FILTER_DENY)||
+ (plist_i && prefix_list_apply (plist_i,
+ (struct prefix *) dest_addr) == PREFIX_DENY))
+ {
+ /* do not send filtered route */
+ zlog_info("Filtered prefix %s will be removed.",
+ inet_ntoa(dest_addr->prefix));
+
+ tlv_max = eigrp_IPv4_InternalTLV_new();
+ tlv_max->type = EIGRP_TLV_IPv4_INT;
+ tlv_max->length = 28U;
+ tlv_max->metric = pe->reported_metric;
+ /* set delay to MAX */
+ tlv_max->metric.delay = EIGRP_MAX_METRIC;
+ tlv_max->destination = pe->destination_ipv4->prefix;
+ tlv_max->prefix_length = pe->destination_ipv4->prefixlen;
+
+ /* prepare message for FSM */
+ struct eigrp_fsm_action_message *fsm_msg;
+ fsm_msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
+ sizeof(struct eigrp_fsm_action_message));
+
+ struct eigrp_neighbor_entry *entry =
+ eigrp_prefix_entry_lookup(pe->entries, nbr);
+
+ fsm_msg->packet_type = EIGRP_OPC_UPDATE;
+ fsm_msg->eigrp = e;
+ fsm_msg->data_type = EIGRP_TLV_IPv4_INT;
+ fsm_msg->adv_router = nbr;
+ fsm_msg->data.ipv4_int_type = tlv_max;
+ fsm_msg->entry = entry;
+ fsm_msg->prefix = pe;
+
+ /* send message to FSM */
+ int event = eigrp_get_fsm_event(fsm_msg);
+ eigrp_fsm_event(fsm_msg, event);
+
+ /* free memory used by TLV */
+ eigrp_IPv4_InternalTLV_free (tlv_max);
+ }
+ /*
+ * End of filtering
+ */
+
+ /* NULL the pointer */
+ dest_addr = NULL;
+
+ /* delete processed prefix from list */
+ listnode_delete(prefixes, pe);
+
+ /* if there are enough prefixes, send packet */
+ if(send_prefixes >= EIGRP_TLV_MAX_IPv4)
+ break;
+ }
+
+ /* 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))
+ {
+ eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG);
+ }
+
+ /* EIGRP Checksum */
+ eigrp_packet_checksum(nbr->ei, ep->s, length);
+
+ ep->length = length;
+ ep->dst.s_addr = nbr->src.s_addr;
+
+ /*This ack number we await from neighbor*/
+ ep->sequence_number = nbr->ei->eigrp->sequence_number;
+
+ if (IS_DEBUG_EIGRP_PACKET(0, RECV))
+ zlog_debug("Enqueuing Update Init Len [%u] Seq [%u] Dest [%s]",
+ ep->length, ep->sequence_number, inet_ntoa(ep->dst));
+
+ /*Put packet to retransmission queue*/
+ eigrp_fifo_push_head(nbr->retrans_queue, ep);
+
+ if (nbr->retrans_queue->count == 1)
+ {
+ eigrp_send_packet_reliably(nbr);
+ }
}
/**
@@ -1039,29 +1035,29 @@ eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
int
eigrp_update_send_GR_thread(struct thread *thread)
{
- struct eigrp_neighbor *nbr;
+ struct eigrp_neighbor *nbr;
- /* get argument from thread */
- nbr = THREAD_ARG(thread);
- /* remove this thread pointer */
- nbr->t_nbr_send_gr = NULL;
+ /* get argument from thread */
+ nbr = THREAD_ARG(thread);
+ /* remove this thread pointer */
+ nbr->t_nbr_send_gr = NULL;
- /* if there is packet waiting in queue,
- * schedule this thread again with small delay */
- if(nbr->retrans_queue->count > 0)
- {
- nbr->t_nbr_send_gr = thread_add_timer_msec(master, eigrp_update_send_GR_thread, nbr, 10);
- return 0;
- }
+ /* if there is packet waiting in queue,
+ * schedule this thread again with small delay */
+ if(nbr->retrans_queue->count > 0)
+ {
+ nbr->t_nbr_send_gr = thread_add_timer_msec(master, eigrp_update_send_GR_thread, nbr, 10);
+ return 0;
+ }
- /* send GR EIGRP packet chunk */
- eigrp_update_send_GR_part(nbr);
+ /* send GR EIGRP packet chunk */
+ eigrp_update_send_GR_part(nbr);
- /* if it wasn't last chunk, schedule this thread again */
- if(nbr->nbr_gr_packet_type != EIGRP_PACKET_PART_LAST)
- nbr->t_nbr_send_gr = thread_execute(master, eigrp_update_send_GR_thread, nbr, 0);
+ /* if it wasn't last chunk, schedule this thread again */
+ if(nbr->nbr_gr_packet_type != EIGRP_PACKET_PART_LAST)
+ nbr->t_nbr_send_gr = thread_execute(master, eigrp_update_send_GR_thread, nbr, 0);
- return 0;
+ return 0;
}
/**
@@ -1081,45 +1077,45 @@ eigrp_update_send_GR_thread(struct thread *thread)
void
eigrp_update_send_GR (struct eigrp_neighbor *nbr, enum GR_type gr_type, struct vty *vty)
{
- struct eigrp_prefix_entry *pe2;
- struct listnode *node2, *nnode2;
- struct list *prefixes;
-
- if(gr_type == EIGRP_GR_FILTER)
- {
- /* function was called after applying filtration */
- zlog_info("Neighbor %s (%s) is resync: route configuration changed",
- inet_ntoa(nbr->src), ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
- }
- else if(gr_type == EIGRP_GR_MANUAL)
- {
- /* Graceful restart was called manually */
- zlog_info("Neighbor %s (%s) is resync: manually cleared",
- inet_ntoa(nbr->src), ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
-
- if(vty != NULL)
- {
- vty_time_print (vty, 0);
- vty_out (vty, "Neighbor %s (%s) is resync: manually cleared%s",
- inet_ntoa (nbr->src),
- ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT),
- VTY_NEWLINE);
- }
- }
-
- prefixes = list_new();
- /* add all prefixes from topology table to list */
- for (ALL_LIST_ELEMENTS(nbr->ei->eigrp->topology_table, node2, nnode2, pe2))
- {
- listnode_add(prefixes, pe2);
- }
-
- /* save prefixes to neighbor */
- nbr->nbr_gr_prefixes_send = prefixes;
- /* indicate, that this is first GR Update packet chunk */
- nbr->nbr_gr_packet_type = EIGRP_PACKET_PART_FIRST;
- /* execute packet sending in thread */
- nbr->t_nbr_send_gr = thread_execute(master, eigrp_update_send_GR_thread, nbr, 0);
+ struct eigrp_prefix_entry *pe2;
+ struct listnode *node2, *nnode2;
+ struct list *prefixes;
+
+ if(gr_type == EIGRP_GR_FILTER)
+ {
+ /* function was called after applying filtration */
+ zlog_info("Neighbor %s (%s) is resync: route configuration changed",
+ inet_ntoa(nbr->src), ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
+ }
+ else if(gr_type == EIGRP_GR_MANUAL)
+ {
+ /* Graceful restart was called manually */
+ zlog_info("Neighbor %s (%s) is resync: manually cleared",
+ inet_ntoa(nbr->src), ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
+
+ if(vty != NULL)
+ {
+ vty_time_print (vty, 0);
+ vty_out (vty, "Neighbor %s (%s) is resync: manually cleared%s",
+ inet_ntoa (nbr->src),
+ ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT),
+ VTY_NEWLINE);
+ }
+ }
+
+ prefixes = list_new();
+ /* add all prefixes from topology table to list */
+ for (ALL_LIST_ELEMENTS(nbr->ei->eigrp->topology_table, node2, nnode2, pe2))
+ {
+ listnode_add(prefixes, pe2);
+ }
+
+ /* save prefixes to neighbor */
+ nbr->nbr_gr_prefixes_send = prefixes;
+ /* indicate, that this is first GR Update packet chunk */
+ nbr->nbr_gr_packet_type = EIGRP_PACKET_PART_FIRST;
+ /* execute packet sending in thread */
+ nbr->t_nbr_send_gr = thread_execute(master, eigrp_update_send_GR_thread, nbr, 0);
}
/**
@@ -1138,15 +1134,15 @@ eigrp_update_send_GR (struct eigrp_neighbor *nbr, enum GR_type gr_type, struct v
void
eigrp_update_send_interface_GR (struct eigrp_interface *ei, enum GR_type gr_type, struct vty *vty)
{
- struct listnode *node;
- struct eigrp_neighbor *nbr;
-
- /* iterate over all neighbors on eigrp interface */
- for (ALL_LIST_ELEMENTS_RO(ei->nbrs, node, nbr))
- {
- /* send GR to neighbor */
- eigrp_update_send_GR(nbr, gr_type, vty);
- }
+ struct listnode *node;
+ struct eigrp_neighbor *nbr;
+
+ /* iterate over all neighbors on eigrp interface */
+ for (ALL_LIST_ELEMENTS_RO(ei->nbrs, node, nbr))
+ {
+ /* send GR to neighbor */
+ eigrp_update_send_GR(nbr, gr_type, vty);
+ }
}
/**
@@ -1165,15 +1161,13 @@ eigrp_update_send_interface_GR (struct eigrp_interface *ei, enum GR_type gr_type
void
eigrp_update_send_process_GR (struct eigrp *eigrp, enum GR_type gr_type, struct vty *vty)
{
- struct listnode *node;
- struct eigrp_interface *ei;
-
- /* iterate over all eigrp interfaces */
- for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
- {
- /* send GR to all neighbors on interface */
- eigrp_update_send_interface_GR(ei, gr_type, vty);
- }
-}
-
+ struct listnode *node;
+ struct eigrp_interface *ei;
+ /* iterate over all eigrp interfaces */
+ for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
+ {
+ /* send GR to all neighbors on interface */
+ eigrp_update_send_interface_GR(ei, gr_type, vty);
+ }
+}
diff --git a/eigrpd/eigrp_vty.c b/eigrpd/eigrp_vty.c
index 328387af4..8237d0c6a 100644
--- a/eigrpd/eigrp_vty.c
+++ b/eigrpd/eigrp_vty.c
@@ -56,7 +56,6 @@
#include "eigrpd/eigrp_dump.h"
#include "eigrpd/eigrp_const.h"
-
static int
config_write_network (struct vty *vty, struct eigrp *eigrp)
{
@@ -119,7 +118,7 @@ config_write_interfaces (struct vty *vty, struct eigrp *eigrp)
}
/*Separate this EIGRP interface configuration from the others*/
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_out (vty, "!%s", VTY_NEWLINE);
}
return 0;
@@ -168,8 +167,8 @@ config_write_eigrp_router (struct vty *vty, struct eigrp *eigrp)
{
struct in_addr router_id_static;
router_id_static.s_addr = htonl(eigrp->router_id_static);
- vty_out (vty, " eigrp router-id %s%s",
- inet_ntoa (router_id_static), VTY_NEWLINE);
+ vty_out (vty, " eigrp router-id %s%s",
+ inet_ntoa (router_id_static), VTY_NEWLINE);
}
/* Network area print. */
@@ -185,11 +184,11 @@ config_write_eigrp_router (struct vty *vty, struct eigrp *eigrp)
}
DEFUN_NOSH (router_eigrp,
- router_eigrp_cmd,
- "router eigrp (1-65535)",
- "Enable a routing process\n"
- "Start EIGRP configuration\n"
- "AS Number to use\n")
+ router_eigrp_cmd,
+ "router eigrp (1-65535)",
+ "Enable a routing process\n"
+ "Start EIGRP configuration\n"
+ "AS Number to use\n")
{
struct eigrp *eigrp = eigrp_get (argv[2]->arg);
VTY_PUSH_CONTEXT(EIGRP_NODE, eigrp);
@@ -197,7 +196,6 @@ DEFUN_NOSH (router_eigrp,
return CMD_SUCCESS;
}
-
DEFUN (no_router_eigrp,
no_router_eigrp_cmd,
"no router eigrp (1-65535)",
@@ -337,7 +335,7 @@ DEFUN (eigrp_network,
"Enable routing on an IP network\n"
"EIGRP network prefix\n")
{
- VTY_DECLVAR_CONTEXT(eigrp, eigrp)
+ VTY_DECLVAR_CONTEXT(eigrp, eigrp);
struct prefix_ipv4 p;
int ret;
@@ -418,22 +416,22 @@ DEFUN (show_ip_eigrp_topology,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
- {
- vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
- return CMD_SUCCESS;
- }
+ {
+ vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
+ return CMD_SUCCESS;
+ }
show_ip_eigrp_topology_header (vty, eigrp);
for (ALL_LIST_ELEMENTS (eigrp->topology_table, node, nnode, tn))
- {
- show_ip_eigrp_prefix_entry (vty,tn);
- for (ALL_LIST_ELEMENTS (tn->entries, node2, nnode2, te))
- {
- if (((te->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG) == EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)||
- ((te->flags & EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG) == EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG))
- show_ip_eigrp_neighbor_entry (vty, eigrp, te);
- }
+ {
+ show_ip_eigrp_prefix_entry (vty,tn);
+ for (ALL_LIST_ELEMENTS (tn->entries, node2, nnode2, te))
+ {
+ if (((te->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG) == EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)||
+ ((te->flags & EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG) == EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG))
+ show_ip_eigrp_neighbor_entry (vty, eigrp, te);
+ }
}
return CMD_SUCCESS;
@@ -507,36 +505,36 @@ DEFUN (show_ip_eigrp_interfaces,
if (argc !=3)
{
- show_ip_eigrp_interface_header (vty, eigrp);
+ show_ip_eigrp_interface_header (vty, eigrp);
}
int idx = 0;
for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
- {
- if (argv_find (argv, argc, "detail", &idx))
- {
- show_ip_eigrp_interface_header (vty, eigrp);
- }
+ {
+ if (argv_find (argv, argc, "detail", &idx))
+ {
+ show_ip_eigrp_interface_header (vty, eigrp);
+ }
- show_ip_eigrp_interface_sub (vty, eigrp, ei);
- idx = 0;
- if (argv_find (argv, argc, "detail", &idx))
- {
- show_ip_eigrp_interface_detail (vty, eigrp, ei);
- }
- }
+ show_ip_eigrp_interface_sub (vty, eigrp, ei);
+ idx = 0;
+ if (argv_find (argv, argc, "detail", &idx))
+ {
+ show_ip_eigrp_interface_detail (vty, eigrp, ei);
+ }
+ }
return CMD_SUCCESS;
}
ALIAS (show_ip_eigrp_interfaces,
- show_ip_eigrp_interfaces_detail_cmd,
- "show ip eigrp interfaces <" INT_TYPES_CMD_STR ">",
- SHOW_STR
- IP_STR
- "IP-EIGRP show commands\n"
- "IP-EIGRP interfaces\n"
- INT_TYPES_DESC)
+ show_ip_eigrp_interfaces_detail_cmd,
+ "show ip eigrp interfaces <" INT_TYPES_CMD_STR ">",
+ SHOW_STR
+ IP_STR
+ "IP-EIGRP show commands\n"
+ "IP-EIGRP interfaces\n"
+ INT_TYPES_DESC)
DEFUN (show_ip_eigrp_neighbors,
show_ip_eigrp_neighbors_cmd,
@@ -567,8 +565,8 @@ DEFUN (show_ip_eigrp_neighbors,
{
for (ALL_LIST_ELEMENTS (ei->nbrs, node2, nnode2, nbr))
{
- if (detail || (nbr->state == EIGRP_NEIGHBOR_UP))
- show_ip_eigrp_neighbor_sub (vty, nbr, detail);
+ if (detail || (nbr->state == EIGRP_NEIGHBOR_UP))
+ show_ip_eigrp_neighbor_sub (vty, nbr, detail);
}
}
@@ -576,13 +574,13 @@ DEFUN (show_ip_eigrp_neighbors,
}
ALIAS (show_ip_eigrp_neighbors,
- show_ip_eigrp_neighbors_detail_cmd,
- "show ip eigrp neighbors <" INT_TYPES_CMD_STR ">",
- SHOW_STR
- IP_STR
- "IP-EIGRP show commands\n"
- "IP-EIGRP neighbors\n"
- INT_TYPES_DESC)
+ show_ip_eigrp_neighbors_detail_cmd,
+ "show ip eigrp neighbors <" INT_TYPES_CMD_STR ">",
+ SHOW_STR
+ IP_STR
+ "IP-EIGRP show commands\n"
+ "IP-EIGRP neighbors\n"
+ INT_TYPES_DESC)
DEFUN (eigrp_if_delay,
eigrp_if_delay_cmd,
@@ -691,8 +689,8 @@ DEFUN (no_eigrp_if_bandwidth,
{
for (ALL_LIST_ELEMENTS (pe->entries, node2, nnode2, ne))
{
- if (ne->ei == ei)
- break;
+ if (ne->ei == ei)
+ break;
/*TODO: */
}
}
@@ -750,8 +748,6 @@ DEFUN (no_eigrp_if_ip_hellointerval,
return CMD_SUCCESS;
}
-
-
DEFUN (eigrp_if_ip_holdinterval,
eigrp_if_ip_holdinterval_cmd,
"ip hold-time eigrp (1-65535)",
@@ -863,7 +859,7 @@ static int
str2auth_type (const char *str, struct interface *ifp)
{
/* Sanity check. */
- if (str == NULL)
+ if (str == NULL)
return CMD_WARNING;
if(strncmp(str, "md5",3) == 0)
@@ -878,7 +874,6 @@ str2auth_type (const char *str, struct interface *ifp)
}
return CMD_WARNING;
-
}
DEFUN (eigrp_authentication_mode,
@@ -902,10 +897,10 @@ DEFUN (eigrp_authentication_mode,
return CMD_SUCCESS;
}
-// if(strncmp(argv[2], "md5",3))
-// IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_MD5;
-// else if(strncmp(argv[2], "hmac-sha-256",12))
-// IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_SHA256;
+ // if(strncmp(argv[2], "md5",3))
+ // IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_MD5;
+ // else if(strncmp(argv[2], "hmac-sha-256",12))
+ // IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_SHA256;
return str2auth_type(argv[5]->arg, ifp);
}
@@ -996,7 +991,8 @@ DEFUN (no_eigrp_authentication_keychain,
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);
IF_DEF_PARAMS (ifp)->auth_keychain = NULL;
@@ -1007,7 +1003,6 @@ DEFUN (no_eigrp_authentication_keychain,
return CMD_SUCCESS;
}
-
DEFUN (eigrp_redistribute_source_metric,
eigrp_redistribute_source_metric_cmd,
"redistribute " FRR_REDIST_STR_EIGRPD
@@ -1037,12 +1032,11 @@ DEFUN (eigrp_redistribute_source_metric,
return eigrp_redistribute_set (eigrp, source, metrics_from_command);
}
-
DEFUN (no_eigrp_redistribute_source_metric,
- no_eigrp_redistribute_source_metric_cmd,
+ no_eigrp_redistribute_source_metric_cmd,
"no redistribute " FRR_REDIST_STR_EIGRPD
- " metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)",
- "Disable\n"
+ " metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)",
+ "Disable\n"
REDIST_STR
FRR_REDIST_HELP_STR_EIGRPD
"Metric for redistributed routes\n"
@@ -1091,7 +1085,6 @@ DEFUN (eigrp_variance,
return CMD_SUCCESS;
}
-
DEFUN (no_eigrp_variance,
no_eigrp_variance_cmd,
"no variance (1-128)",
@@ -1139,7 +1132,6 @@ DEFUN (eigrp_maximum_paths,
return CMD_SUCCESS;
}
-
DEFUN (no_eigrp_maximum_paths,
no_eigrp_maximum_paths_cmd,
"no maximum-paths <1-32>",
@@ -1527,8 +1519,6 @@ eigrp_vty_if_init (void)
/*EIGRP Summarization commands*/
install_element (INTERFACE_NODE, &eigrp_ip_summary_address_cmd);
install_element (INTERFACE_NODE, &no_eigrp_ip_summary_address_cmd);
-
-
}
static void
@@ -1536,7 +1526,6 @@ eigrp_vty_zebra_init (void)
{
install_element (EIGRP_NODE, &eigrp_redistribute_source_metric_cmd);
install_element (EIGRP_NODE, &no_eigrp_redistribute_source_metric_cmd);
-
}
/* Install EIGRP related vty commands. */
diff --git a/eigrpd/eigrp_zebra.c b/eigrpd/eigrp_zebra.c
index 0c99fd5a5..627d564a7 100644
--- a/eigrpd/eigrp_zebra.c
+++ b/eigrpd/eigrp_zebra.c
@@ -68,7 +68,7 @@ static int eigrp_interface_state_down (int, struct zclient *,
static struct interface * zebra_interface_if_lookup (struct stream *);
static int eigrp_zebra_read_ipv4 (int , struct zclient *,
- zebra_size_t, vrf_id_t vrf_id);
+ zebra_size_t, vrf_id_t vrf_id);
/* Zebra structure to hold current status. */
struct zclient *zclient = NULL;
@@ -80,7 +80,7 @@ struct in_addr router_id_zebra;
/* Router-id update message from zebra. */
static int
eigrp_router_id_update_zebra (int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+ zebra_size_t length, vrf_id_t vrf_id)
{
struct eigrp *eigrp;
struct prefix router_id;
@@ -124,7 +124,7 @@ eigrp_zebra_init (void)
/* Zebra route add and delete treatment. */
static int
eigrp_zebra_read_ipv4 (int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+ zebra_size_t length, vrf_id_t vrf_id)
{
struct stream *s;
struct zapi_ipv4 api;
@@ -184,7 +184,7 @@ eigrp_zebra_read_ipv4 (int command, struct zclient *zclient,
/* Inteface addition message from zebra. */
static int
eigrp_interface_add (int command, struct zclient *zclient, zebra_size_t length,
- vrf_id_t vrf_id)
+ vrf_id_t vrf_id)
{
struct interface *ifp;
@@ -205,7 +205,7 @@ eigrp_interface_add (int command, struct zclient *zclient, zebra_size_t length,
static int
eigrp_interface_delete (int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+ zebra_size_t length, vrf_id_t vrf_id)
{
struct interface *ifp;
struct stream *s;
@@ -224,7 +224,7 @@ eigrp_interface_delete (int command, struct zclient *zclient,
if (IS_DEBUG_EIGRP (zebra, ZEBRA_INTERFACE))
zlog_debug("Zebra: interface delete %s index %d flags %llx metric %d mtu %d",
- ifp->name, ifp->ifindex, (unsigned long long)ifp->flags, ifp->metric, ifp->mtu);
+ ifp->name, ifp->ifindex, (unsigned long long)ifp->flags, ifp->metric, ifp->mtu);
for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
if (rn->info)
@@ -236,7 +236,7 @@ eigrp_interface_delete (int command, struct zclient *zclient,
static int
eigrp_interface_address_add (int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+ zebra_size_t length, vrf_id_t vrf_id)
{
struct connected *c;
@@ -259,7 +259,7 @@ eigrp_interface_address_add (int command, struct zclient *zclient,
static int
eigrp_interface_address_delete (int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+ zebra_size_t length, vrf_id_t vrf_id)
{
struct connected *c;
struct interface *ifp;
@@ -303,7 +303,7 @@ eigrp_interface_address_delete (int command, struct zclient *zclient,
static int
eigrp_interface_state_up (int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+ zebra_size_t length, vrf_id_t vrf_id)
{
struct interface *ifp;
struct eigrp_interface *ei;
@@ -330,16 +330,16 @@ eigrp_interface_state_up (int command, struct zclient *zclient,
{
if (IS_DEBUG_EIGRP (zebra, ZEBRA_INTERFACE))
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 (IS_DEBUG_EIGRP (zebra, ZEBRA_INTERFACE))
zlog_debug ("Zebra: Interface[%s] MTU change %u -> %u.",
- ifp->name, if_tmp.mtu, ifp->mtu);
+ ifp->name, if_tmp.mtu, ifp->mtu);
/* Must reset the interface (simulate down/up) when MTU changes. */
eigrp_if_reset (ifp);
@@ -365,7 +365,7 @@ eigrp_interface_state_up (int command, struct zclient *zclient,
static int
eigrp_interface_state_down (int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+ zebra_size_t length, vrf_id_t vrf_id)
{
struct interface *ifp;
struct eigrp_interface *ei;
@@ -399,8 +399,8 @@ zebra_interface_if_lookup (struct stream *s)
/* And look it up. */
return if_lookup_by_name_len (ifname_tmp,
- strnlen (ifname_tmp, INTERFACE_NAMSIZ),
- VRF_DEFAULT);
+ strnlen (ifname_tmp, INTERFACE_NAMSIZ),
+ VRF_DEFAULT);
}
void
@@ -443,19 +443,19 @@ eigrp_zebra_route_add (struct prefix_ipv4 *p, struct list *successors)
/* Nexthop, ifindex, distance and metric information. */
for (ALL_LIST_ELEMENTS_RO (successors, node, te))
- {
- stream_putc (s, NEXTHOP_TYPE_IPV4_IFINDEX);
- stream_put_in_addr (s, &te->adv_router->src);
- stream_putl (s, te->ei->ifp->ifindex);
- }
+ {
+ stream_putc (s, NEXTHOP_TYPE_IPV4_IFINDEX);
+ stream_put_in_addr (s, &te->adv_router->src);
+ stream_putl (s, te->ei->ifp->ifindex);
+ }
if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE))
{
char buf[2][INET_ADDRSTRLEN];
zlog_debug ("Zebra: Route add %s/%d nexthop %s",
- inet_ntop(AF_INET, &p->prefix, buf[0], sizeof (buf[0])),
- p->prefixlen,
- inet_ntop(AF_INET, 0 /*&p->nexthop*/, buf[1], sizeof (buf[1])));
+ inet_ntop(AF_INET, &p->prefix, buf[0], sizeof (buf[0])),
+ p->prefixlen,
+ inet_ntop(AF_INET, 0 /*&p->nexthop*/, buf[1], sizeof (buf[1])));
}
stream_putw_at (s, 0, stream_get_endp (s));
@@ -480,12 +480,12 @@ eigrp_zebra_route_delete (struct prefix_ipv4 *p)
zapi_ipv4_route (ZEBRA_IPV4_ROUTE_DELETE, zclient, p, &api);
if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE))
- {
+ {
char buf[2][INET_ADDRSTRLEN];
zlog_debug ("Zebra: Route del %s/%d nexthop %s",
- inet_ntop (AF_INET, &p->prefix, buf[0], sizeof (buf[0])),
- p->prefixlen,
- inet_ntop (AF_INET, 0 /*&p->nexthop*/, buf[1], sizeof (buf[1])));
+ inet_ntop (AF_INET, &p->prefix, buf[0], sizeof (buf[0])),
+ p->prefixlen,
+ inet_ntop (AF_INET, 0 /*&p->nexthop*/, buf[1], sizeof (buf[1])));
}
}
@@ -512,22 +512,22 @@ eigrp_redistribute_set (struct eigrp *eigrp, int type, struct eigrp_metrics metr
eigrp_external_routes_refresh (eigrp, type);
-// if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE))
-// zlog_debug ("Redistribute[%s]: Refresh Type[%d], Metric[%d]",
-// eigrp_redist_string(type),
-// metric_type (eigrp, type), metric_value (eigrp, type));
+ // if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE))
+ // zlog_debug ("Redistribute[%s]: Refresh Type[%d], Metric[%d]",
+ // eigrp_redist_string(type),
+ // metric_type (eigrp, type), metric_value (eigrp, type));
return CMD_SUCCESS;
}
eigrp->dmetric[type] = metric;
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))
-// zlog_debug ("Redistribute[%s]: Start Type[%d], Metric[%d]",
-// ospf_redist_string(type),
-// metric_type (ospf, type), metric_value (ospf, type));
+ // if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE))
+ // zlog_debug ("Redistribute[%s]: Start Type[%d], Metric[%d]",
+ // ospf_redist_string(type),
+ // metric_type (ospf, type), metric_value (ospf, type));
++eigrp->redistribute;
@@ -542,14 +542,14 @@ eigrp_redistribute_unset (struct eigrp *eigrp, int type)
{
memset(&eigrp->dmetric[type], 0, sizeof(struct eigrp_metrics));
zclient_redistribute (ZEBRA_REDISTRIBUTE_DELETE, zclient,
- AFI_IP, type, 0, VRF_DEFAULT);
+ AFI_IP, type, 0, VRF_DEFAULT);
--eigrp->redistribute;
}
-// if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE))
-// zlog_debug ("Redistribute[%s]: Start Type[%d], Metric[%d]",
-// ospf_redist_string(type),
-// metric_type (ospf, type), metric_value (ospf, type));
+ // if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE))
+ // zlog_debug ("Redistribute[%s]: Start Type[%d], Metric[%d]",
+ // ospf_redist_string(type),
+ // metric_type (ospf, type), metric_value (ospf, type));
return CMD_SUCCESS;
}
diff --git a/eigrpd/eigrpd.c b/eigrpd/eigrpd.c
index cb60db16c..8d7aa028a 100644
--- a/eigrpd/eigrpd.c
+++ b/eigrpd/eigrpd.c
@@ -114,8 +114,8 @@ eigrp_router_id_update (struct eigrp *eigrp)
eigrp->router_id = router_id;
if (router_id_old != router_id)
{
-// if (IS_DEBUG_EIGRP_EVENT)
-// zlog_debug("Router-ID[NEW:%s]: Update", inet_ntoa(eigrp->router_id));
+ // if (IS_DEBUG_EIGRP_EVENT)
+ // zlog_debug("Router-ID[NEW:%s]: Update", inet_ntoa(eigrp->router_id));
/* update eigrp_interface's */
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;
}
-
/* Allocate new eigrp structure. */
static struct eigrp *
eigrp_new (const char *AS)
@@ -246,10 +245,10 @@ eigrp_terminate (void)
struct listnode *node, *nnode;
/* shutdown already in progress */
- if (CHECK_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN))
- return;
+ if (CHECK_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN))
+ return;
- SET_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN);
+ SET_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN);
/* exit immediately if EIGRP not actually running */
if (listcount(eigrp_om->eigrp) == 0)
@@ -266,9 +265,9 @@ eigrp_finish (struct eigrp *eigrp)
eigrp_finish_final(eigrp);
/* eigrp being shut-down? If so, was this the last eigrp instance? */
- if (CHECK_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN)
- && (listcount(eigrp_om->eigrp) == 0))
- exit(0);
+ if (CHECK_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN)
+ && (listcount(eigrp_om->eigrp) == 0))
+ exit(0);
return;
}
@@ -296,7 +295,6 @@ eigrp_finish_final (struct eigrp *eigrp)
eigrp_delete(eigrp);
XFREE(MTYPE_EIGRP_TOP,eigrp);
-
}
/*Look for existing eigrp process*/