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

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

View File

@ -70,175 +70,30 @@ config_write_debug (struct vty *vty)
int write = 0; int write = 0;
int i; int i;
const char *type_str[] = {"update", "request", "query", "reply", "hello", "", "probe", "ack", "", const char *type_str[] = {"update", "request", "query", "reply",
"SIA query", "SIA reply", "stub", "all"}; "hello", "", "probe", "ack", "",
"SIA query", "SIA reply", "stub", "all"};
const char *detail_str[] = {"", " send", " recv", "", " detail", const char *detail_str[] = {"", " send", " recv", "", " detail",
" send detail", " recv detail", " detail"}; " send detail", " recv detail", " detail"};
/* debug eigrp event. */ /* debug eigrp event. */
// if (IS_CONF_DEBUG_EIGRP (event, EVENT) == EIGRP_DEBUG_EVENT)
// {
// vty_out (vty, "debug eigrp event%s", VTY_NEWLINE);
// write = 1;
// }
/* debug eigrp packet all detail. */
// r = EIGRP_DEBUG_SEND_RECV|EIGRP_DEBUG_DETAIL;
// for (i = 0; i < 11; i++)
// r &= conf_debug_eigrp_packet[i] & (EIGRP_DEBUG_SEND_RECV|EIGRP_DEBUG_DETAIL);
// if (r == (EIGRP_DEBUG_SEND_RECV|EIGRP_DEBUG_DETAIL))
// {
// vty_out (vty, "debug eigrp packet all detail%s", VTY_NEWLINE);
//// return 1;
// }
//
// /* debug eigrp packet all. */
// r = EIGRP_DEBUG_SEND_RECV;
// for (i = 0; i < 11; i++)
// r &= conf_debug_eigrp_packet[i] & EIGRP_DEBUG_SEND_RECV;
// if (r == EIGRP_DEBUG_SEND_RECV)
// {
// vty_out (vty, "debug eigrp packet all%s", VTY_NEWLINE);
// for (i = 0; i < 11; i++)
// if (conf_debug_eigrp_packet[i] & EIGRP_DEBUG_DETAIL)
// vty_out (vty, "debug eigrp packet %s detail%s",
// type_str[i],
// VTY_NEWLINE);
//// return 1;
// }
/* debug eigrp packet */ /* debug eigrp packet */
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
{ {
if (conf_debug_eigrp_packet[i] == 0 && term_debug_eigrp_packet[i] == 0 ) if (conf_debug_eigrp_packet[i] == 0 && term_debug_eigrp_packet[i] == 0 )
continue; continue;
vty_out (vty, "debug eigrp packet %s%s%s", vty_out (vty, "debug eigrp packet %s%s%s",
type_str[i], detail_str[conf_debug_eigrp_packet[i]], type_str[i], detail_str[conf_debug_eigrp_packet[i]],
VTY_NEWLINE); VTY_NEWLINE);
write = 1; write = 1;
} }
// int write = 0;
// int i, r;
//
// const char *type_str[] = {"hello", "dd", "ls-request", "ls-update", "ls-ack"};
// const char *detail_str[] = {"", " send", " recv", "", " detail",
// " send detail", " recv detail", " detail"};
//
// /* debug ospf ism (status|events|timers). */
// if (IS_CONF_DEBUG_OSPF (ism, ISM) == OSPF_DEBUG_ISM)
// vty_out (vty, "debug ospf ism%s", VTY_NEWLINE);
// else
// {
// if (IS_CONF_DEBUG_OSPF (ism, ISM_STATUS))
// vty_out (vty, "debug ospf ism status%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (ism, ISM_EVENTS))
// vty_out (vty, "debug ospf ism event%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (ism, ISM_TIMERS))
// vty_out (vty, "debug ospf ism timer%s", VTY_NEWLINE);
// }
//
// /* debug ospf nsm (status|events|timers). */
// if (IS_CONF_DEBUG_OSPF (nsm, NSM) == OSPF_DEBUG_NSM)
// vty_out (vty, "debug ospf nsm%s", VTY_NEWLINE);
// else
// {
// if (IS_CONF_DEBUG_OSPF (nsm, NSM_STATUS))
// vty_out (vty, "debug ospf nsm status%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (nsm, NSM_EVENTS))
// vty_out (vty, "debug ospf nsm event%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (nsm, NSM_TIMERS))
// vty_out (vty, "debug ospf nsm timer%s", VTY_NEWLINE);
// }
//
// /* debug ospf lsa (generate|flooding|install|refresh). */
// if (IS_CONF_DEBUG_OSPF (lsa, LSA) == OSPF_DEBUG_LSA)
// vty_out (vty, "debug ospf lsa%s", VTY_NEWLINE);
// else
// {
// if (IS_CONF_DEBUG_OSPF (lsa, LSA_GENERATE))
// vty_out (vty, "debug ospf lsa generate%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (lsa, LSA_FLOODING))
// vty_out (vty, "debug ospf lsa flooding%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (lsa, LSA_INSTALL))
// vty_out (vty, "debug ospf lsa install%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (lsa, LSA_REFRESH))
// vty_out (vty, "debug ospf lsa refresh%s", VTY_NEWLINE);
//
// write = 1;
// }
//
// /* debug ospf zebra (interface|redistribute). */
// if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA) == OSPF_DEBUG_ZEBRA)
// vty_out (vty, "debug ospf zebra%s", VTY_NEWLINE);
// else
// {
// if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
// vty_out (vty, "debug ospf zebra interface%s", VTY_NEWLINE);
// if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
// vty_out (vty, "debug ospf zebra redistribute%s", VTY_NEWLINE);
//
// write = 1;
// }
//
// /* debug ospf event. */
// if (IS_CONF_DEBUG_OSPF (event, EVENT) == OSPF_DEBUG_EVENT)
// {
// vty_out (vty, "debug ospf event%s", VTY_NEWLINE);
// write = 1;
// }
//
// /* debug ospf nssa. */
// if (IS_CONF_DEBUG_OSPF (nssa, NSSA) == OSPF_DEBUG_NSSA)
// {
// vty_out (vty, "debug ospf nssa%s", VTY_NEWLINE);
// write = 1;
// }
//
// /* debug ospf packet all detail. */
// r = OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL;
// for (i = 0; i < 5; i++)
// r &= conf_debug_ospf_packet[i] & (OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL);
// if (r == (OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL))
// {
// vty_out (vty, "debug ospf packet all detail%s", VTY_NEWLINE);
// return 1;
// }
//
// /* debug ospf packet all. */
// r = OSPF_DEBUG_SEND_RECV;
// for (i = 0; i < 5; i++)
// r &= conf_debug_ospf_packet[i] & OSPF_DEBUG_SEND_RECV;
// if (r == OSPF_DEBUG_SEND_RECV)
// {
// vty_out (vty, "debug ospf packet all%s", VTY_NEWLINE);
// for (i = 0; i < 5; i++)
// if (conf_debug_ospf_packet[i] & OSPF_DEBUG_DETAIL)
// vty_out (vty, "debug ospf packet %s detail%s",
// type_str[i],
// VTY_NEWLINE);
// return 1;
// }
//
// /* debug ospf packet (hello|dd|ls-request|ls-update|ls-ack)
// (send|recv) (detail). */
// for (i = 0; i < 5; i++)
// {
// if (conf_debug_ospf_packet[i] == 0)
// continue;
//
// vty_out (vty, "debug ospf packet %s%s%s",
// type_str[i], detail_str[conf_debug_ospf_packet[i]],
// VTY_NEWLINE);
// write = 1;
// }
return write; return write;
} }
static int static int
eigrp_neighbor_packet_queue_sum (struct eigrp_interface *ei) eigrp_neighbor_packet_queue_sum (struct eigrp_interface *ei)
{ {
@ -282,14 +137,14 @@ void
eigrp_header_dump (struct eigrp_header *eigrph) eigrp_header_dump (struct eigrp_header *eigrph)
{ {
/* EIGRP Header dump. */ /* EIGRP Header dump. */
zlog_debug ("eigrp_version %u", eigrph->version); zlog_debug ("eigrp_version %u", eigrph->version);
zlog_debug ("eigrp_opcode %u", eigrph->opcode); zlog_debug ("eigrp_opcode %u", eigrph->opcode);
zlog_debug ("eigrp_checksum 0x%x", ntohs(eigrph->checksum)); zlog_debug ("eigrp_checksum 0x%x", ntohs(eigrph->checksum));
zlog_debug ("eigrp_flags 0x%x", ntohl(eigrph->flags)); zlog_debug ("eigrp_flags 0x%x", ntohl(eigrph->flags));
zlog_debug ("eigrp_sequence %u", ntohl(eigrph->sequence)); zlog_debug ("eigrp_sequence %u", ntohl(eigrph->sequence));
zlog_debug ("eigrp_ack %u", ntohl(eigrph->ack)); zlog_debug ("eigrp_ack %u", ntohl(eigrph->ack));
zlog_debug ("eigrp_vrid %u" , ntohs(eigrph->vrid)); zlog_debug ("eigrp_vrid %u", ntohs(eigrph->vrid));
zlog_debug ("eigrp_AS %u", ntohs(eigrph->ASNumber)); zlog_debug ("eigrp_AS %u", ntohs(eigrph->ASNumber));
} }
const char * const char *
@ -368,28 +223,37 @@ show_ip_eigrp_interface_header (struct vty *vty, struct eigrp *eigrp)
void void
show_ip_eigrp_interface_sub (struct vty *vty, struct eigrp *eigrp, show_ip_eigrp_interface_sub (struct vty *vty, struct eigrp *eigrp,
struct eigrp_interface *ei) struct eigrp_interface *ei)
{ {
vty_out (vty, "%-11s ", eigrp_if_name_string (ei)); vty_out (vty, "%-11s ", eigrp_if_name_string (ei));
vty_out (vty, "%-11u",IF_DEF_PARAMS (ei->ifp)->bandwidth); vty_out (vty, "%-11u", IF_DEF_PARAMS (ei->ifp)->bandwidth);
vty_out (vty, "%-11u",IF_DEF_PARAMS (ei->ifp)->delay); vty_out (vty, "%-11u", IF_DEF_PARAMS (ei->ifp)->delay);
vty_out (vty, "%-7u", ei->nbrs->count); vty_out (vty, "%-7u", ei->nbrs->count);
vty_out (vty, "%u %c %-10u",0,'/',eigrp_neighbor_packet_queue_sum (ei)); vty_out (vty, "%u %c %-10u",0,'/', eigrp_neighbor_packet_queue_sum (ei));
vty_out (vty, "%-7u %-14u %-12u %-8u",0,0,0,0); vty_out (vty, "%-7u %-14u %-12u %-8u", 0, 0, 0, 0);
vty_out (vty, "%-8u %-8u %s",IF_DEF_PARAMS (ei->ifp)->v_hello,IF_DEF_PARAMS (ei->ifp)->v_wait,VTY_NEWLINE); vty_out (vty, "%-8u %-8u %s",
IF_DEF_PARAMS (ei->ifp)->v_hello,
IF_DEF_PARAMS (ei->ifp)->v_wait,VTY_NEWLINE);
} }
void void
show_ip_eigrp_interface_detail (struct vty *vty, struct eigrp *eigrp, show_ip_eigrp_interface_detail (struct vty *vty, struct eigrp *eigrp,
struct eigrp_interface *ei) struct eigrp_interface *ei)
{ {
vty_out (vty, "%-2s %s %d %-3s %s","","Hello interval is ",0," sec",VTY_NEWLINE); vty_out (vty, "%-2s %s %d %-3s %s","","Hello interval is ", 0, " sec", VTY_NEWLINE);
vty_out (vty, "%-2s %s %s %s","","Next xmit serial","<none>",VTY_NEWLINE); vty_out (vty, "%-2s %s %s %s","", "Next xmit serial","<none>", VTY_NEWLINE);
vty_out (vty, "%-2s %s %d %s %d %s %d %s %d %s","","Un/reliable mcasts: ",0,"/",0,"Un/reliable ucasts: ",0,"/",0,VTY_NEWLINE); vty_out (vty, "%-2s %s %d %s %d %s %d %s %d %s",
vty_out (vty, "%-2s %s %d %s %d %s %d %s","","Mcast exceptions: ",0," CR packets: ",0," ACKs supressed: ",0,VTY_NEWLINE); "", "Un/reliable mcasts: ", 0, "/", 0, "Un/reliable ucasts: ",
vty_out (vty, "%-2s %s %d %s %d %s","","Retransmissions sent: ",0,"Out-of-sequence rcvd: ",0,VTY_NEWLINE); 0, "/", 0, VTY_NEWLINE);
vty_out (vty, "%-2s %s %s %s %s","","Authentication mode is ","not","set",VTY_NEWLINE); vty_out (vty, "%-2s %s %d %s %d %s %d %s",
vty_out (vty, "%-2s %s %s","","Use multicast",VTY_NEWLINE); "", "Mcast exceptions: ", 0, " CR packets: ",
0, " ACKs supressed: ", 0, VTY_NEWLINE);
vty_out (vty, "%-2s %s %d %s %d %s",
"", "Retransmissions sent: ", 0, "Out-of-sequence rcvd: ",
0 ,VTY_NEWLINE);
vty_out (vty, "%-2s %s %s %s %s",
"", "Authentication mode is ", "not","set", VTY_NEWLINE);
vty_out (vty, "%-2s %s %s", "", "Use multicast", VTY_NEWLINE);
} }
void void
@ -405,23 +269,24 @@ show_ip_eigrp_neighbor_header (struct vty *vty, struct eigrp *eigrp)
void void
show_ip_eigrp_neighbor_sub (struct vty *vty, struct eigrp_neighbor *nbr, show_ip_eigrp_neighbor_sub (struct vty *vty, struct eigrp_neighbor *nbr,
int detail) int detail)
{ {
vty_out (vty, "%-3u %-17s %-21s",0,eigrp_neigh_ip_string (nbr),eigrp_if_name_string (nbr->ei)); vty_out (vty, "%-3u %-17s %-21s", 0,
vty_out (vty,"%-7lu",thread_timer_remain_second (nbr->t_holddown)); eigrp_neigh_ip_string (nbr), eigrp_if_name_string (nbr->ei));
vty_out (vty,"%-8u %-6u %-5u",0,0,EIGRP_PACKET_RETRANS_TIME); vty_out (vty,"%-7lu", thread_timer_remain_second (nbr->t_holddown));
vty_out (vty,"%-7lu",nbr->retrans_queue->count); vty_out (vty,"%-8u %-6u %-5u", 0, 0, EIGRP_PACKET_RETRANS_TIME);
vty_out (vty,"%u%s",nbr->recv_sequence_number,VTY_NEWLINE); vty_out (vty,"%-7lu", nbr->retrans_queue->count);
vty_out (vty,"%u%s", nbr->recv_sequence_number, VTY_NEWLINE);
if (detail) if (detail)
{ {
vty_out(vty," Version %u.%u/%u.%u", vty_out(vty," Version %u.%u/%u.%u",
nbr->os_rel_major, nbr->os_rel_minor, nbr->os_rel_major, nbr->os_rel_minor,
nbr->tlv_rel_major, nbr->tlv_rel_minor); nbr->tlv_rel_major, nbr->tlv_rel_minor);
vty_out(vty,", Retrans: %lu, Retries: %lu", 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); 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, "%s/%u, ",inet_ntoa (tn->destination_ipv4->prefix),tn->destination_ipv4->prefixlen);
vty_out (vty, "%u successors, ",eigrp_topology_get_successor(tn)->count); vty_out (vty, "%u successors, ",eigrp_topology_get_successor(tn)->count);
vty_out (vty, "FD is %u, serno: %lu %s",tn->fdistance, tn->serno, VTY_NEWLINE); vty_out (vty, "FD is %u, serno: %lu %s",tn->fdistance, tn->serno, VTY_NEWLINE);
} }
void void
show_ip_eigrp_neighbor_entry (struct vty *vty, struct eigrp *eigrp, struct eigrp_neighbor_entry *te) show_ip_eigrp_neighbor_entry (struct vty *vty, struct eigrp *eigrp, struct eigrp_neighbor_entry *te)
{ {
if (te->adv_router == eigrp->neighbor_self) if (te->adv_router == eigrp->neighbor_self)
vty_out (vty, "%-7s%s, %s%s"," ","via Connected",eigrp_if_name_string (te->ei), VTY_NEWLINE); vty_out (vty, "%-7s%s, %s%s", " ", "via Connected",
eigrp_if_name_string (te->ei), VTY_NEWLINE);
else else
{ {
vty_out (vty, "%-7s%s%s (%u/%u), %s%s"," ","via ",inet_ntoa (te->adv_router->src),te->distance, te->reported_distance, eigrp_if_name_string (te->ei), VTY_NEWLINE); vty_out (vty, "%-7s%s%s (%u/%u), %s%s",
" ", "via ", inet_ntoa (te->adv_router->src),
te->distance, te->reported_distance,
eigrp_if_name_string (te->ei), VTY_NEWLINE);
} }
} }
@ -481,39 +349,39 @@ DEFUN (show_debugging_eigrp,
/* Show debug status for EIGRP Packets. */ /* Show debug status for EIGRP Packets. */
for (i = 0; i < 11 ; i++) for (i = 0; i < 11 ; i++)
{ {
if (i == 8) if (i == 8)
continue; continue;
if (IS_DEBUG_EIGRP_PACKET (i, SEND) && IS_DEBUG_EIGRP_PACKET (i, RECV)) if (IS_DEBUG_EIGRP_PACKET (i, SEND) && IS_DEBUG_EIGRP_PACKET (i, RECV))
{ {
vty_out (vty, " EIGRP packet %s%s debugging is on%s", vty_out (vty, " EIGRP packet %s%s debugging is on%s",
LOOKUP (eigrp_packet_type_str, i + 1), LOOKUP (eigrp_packet_type_str, i + 1),
IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "", IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "",
VTY_NEWLINE); VTY_NEWLINE);
} }
else else
{ {
if (IS_DEBUG_EIGRP_PACKET (i, SEND)) if (IS_DEBUG_EIGRP_PACKET (i, SEND))
vty_out (vty, " EIGRP packet %s send%s debugging is on%s", vty_out (vty, " EIGRP packet %s send%s debugging is on%s",
LOOKUP (eigrp_packet_type_str, i + 1), LOOKUP (eigrp_packet_type_str, i + 1),
IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "", IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "",
VTY_NEWLINE); VTY_NEWLINE);
if (IS_DEBUG_EIGRP_PACKET (i, RECV)) if (IS_DEBUG_EIGRP_PACKET (i, RECV))
vty_out (vty, " EIGRP packet %s receive%s debugging is on%s", vty_out (vty, " EIGRP packet %s receive%s debugging is on%s",
LOOKUP (eigrp_packet_type_str, i + 1), LOOKUP (eigrp_packet_type_str, i + 1),
IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "", IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "",
VTY_NEWLINE); VTY_NEWLINE);
} }
} }
return CMD_SUCCESS; return CMD_SUCCESS;
} }
/* /*
[no] debug eigrp packet (hello|dd|ls-request|ls-update|ls-ack|all) [no] debug eigrp packet (hello|dd|ls-request|ls-update|ls-ack|all)
[send|recv [detail]] [send|recv [detail]]
*/ */
DEFUN (debug_eigrp_transmit, DEFUN (debug_eigrp_transmit,

View File

@ -79,111 +79,111 @@ eigrp_distribute_update (struct distribute *dist)
/* Check if distribute-list was set for process or interface */ /* Check if distribute-list was set for process or interface */
if (! dist->ifname) if (! dist->ifname)
{ {
/* access list IN for whole process */ /* access list IN for whole process */
if (dist->list[DISTRIBUTE_V4_IN]) if (dist->list[DISTRIBUTE_V4_IN])
{ {
alist = access_list_lookup (AFI_IP, 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); zlog_info("<DEBUG DISTRIBUTE ACL IN FOUND: %s",alist->name);
if (alist) if (alist)
e->list[EIGRP_FILTER_IN] = alist; e->list[EIGRP_FILTER_IN] = alist;
else else
e->list[EIGRP_FILTER_IN] = NULL; e->list[EIGRP_FILTER_IN] = NULL;
} }
else else
{ {
e->list[EIGRP_FILTER_IN] = NULL; e->list[EIGRP_FILTER_IN] = NULL;
} }
/* access list OUT for whole process */ /* access list OUT for whole process */
if (dist->list[DISTRIBUTE_V4_OUT]) if (dist->list[DISTRIBUTE_V4_OUT])
{ {
zlog_info("<DEBUG DISTRIBUTE ACL OUT FOUND: %s",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]); alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_V4_OUT]);
if (alist) if (alist)
e->list[EIGRP_FILTER_OUT] = alist; e->list[EIGRP_FILTER_OUT] = alist;
else else
e->list[EIGRP_FILTER_OUT] = NULL; e->list[EIGRP_FILTER_OUT] = NULL;
} }
else else
{ {
e->list[EIGRP_FILTER_OUT] = NULL; 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 IN for process */ /* PREFIX_LIST OUT for process */
if (dist->prefix[DISTRIBUTE_V4_IN]) if (dist->prefix[DISTRIBUTE_V4_OUT])
{ {
zlog_info("<DEBUG DISTRIBUTE PREFIX IN FOUND: %s",dist->prefix[DISTRIBUTE_V4_IN]); zlog_info("<DEBUG DISTRIBUTE PREFIX OUT FOUND: %s",dist->prefix[DISTRIBUTE_V4_OUT]);
plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_IN]); plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_OUT]);
if (plist) if (plist)
{ {
e->prefix[EIGRP_FILTER_IN] = plist; e->prefix[EIGRP_FILTER_OUT] = 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]) else
{ e->prefix[EIGRP_FILTER_OUT] = NULL;
zlog_info("<DEBUG DISTRIBUTE PREFIX OUT FOUND: %s",dist->prefix[DISTRIBUTE_V4_OUT]); }
plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_OUT]); else
if (plist) e->prefix[EIGRP_FILTER_OUT] = NULL;
{
e->prefix[EIGRP_FILTER_OUT] = plist;
} //This is commented out, because the distribute.[ch] code
else //changes looked poorly written from first glance
e->prefix[EIGRP_FILTER_OUT] = NULL; //commit was 133bdf2d
} //TODO: DBS
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 #if 0
/* route-map IN for whole process */ /* route-map IN for whole process */
if (dist->route[DISTRIBUTE_V4_IN]) if (dist->route[DISTRIBUTE_V4_IN])
{ {
routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_IN]); routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_IN]);
if (routemap) if (routemap)
e->routemap[EIGRP_FILTER_IN] = routemap; e->routemap[EIGRP_FILTER_IN] = routemap;
else else
e->routemap[EIGRP_FILTER_IN] = NULL; e->routemap[EIGRP_FILTER_IN] = NULL;
} }
else else
{ {
e->routemap[EIGRP_FILTER_IN] = NULL; e->routemap[EIGRP_FILTER_IN] = NULL;
} }
/* route-map OUT for whole process */ /* route-map OUT for whole process */
if (dist->route[DISTRIBUTE_V4_OUT]) if (dist->route[DISTRIBUTE_V4_OUT])
{ {
routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_OUT]); routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_OUT]);
if (routemap) if (routemap)
e->routemap[EIGRP_FILTER_OUT] = routemap; e->routemap[EIGRP_FILTER_OUT] = routemap;
else else
e->routemap[EIGRP_FILTER_OUT] = NULL; e->routemap[EIGRP_FILTER_OUT] = NULL;
} }
else else
{ {
e->routemap[EIGRP_FILTER_OUT] = NULL; e->routemap[EIGRP_FILTER_OUT] = NULL;
} }
#endif #endif
//TODO: check Graceful restart after 10sec //TODO: check Graceful restart after 10sec
/* check if there is already GR scheduled */ /* check if there is already GR scheduled */
if(e->t_distribute != NULL) if(e->t_distribute != NULL)
{ {
/* if is, cancel schedule */ /* if is, cancel schedule */
thread_cancel(e->t_distribute); thread_cancel(e->t_distribute);
} }
/* schedule Graceful restart for whole process in 10sec */ /* schedule Graceful restart for whole process in 10sec */
e->t_distribute = thread_add_timer(master, eigrp_distribute_timer_process, e,(10)); e->t_distribute = thread_add_timer(master, eigrp_distribute_timer_process, e,(10));
return; return;
} }
ifp = if_lookup_by_name (dist->ifname, VRF_DEFAULT); ifp = if_lookup_by_name (dist->ifname, VRF_DEFAULT);
@ -199,27 +199,27 @@ eigrp_distribute_update (struct distribute *dist)
/* Find proper interface */ /* Find proper interface */
for (ALL_LIST_ELEMENTS (e->eiflist, node, nnode, ei2)) for (ALL_LIST_ELEMENTS (e->eiflist, node, nnode, ei2))
{ {
if(strcmp(ei2->ifp->name,ifp->name) == 0){ if(strcmp(ei2->ifp->name,ifp->name) == 0){
ei = ei2; ei = ei2;
break; break;
} }
} }
if(ei == NULL) 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 */ /* Access-list for interface in */
if (dist->list[DISTRIBUTE_V4_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]); alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_V4_IN]);
if (alist){ if (alist){
ei->list[EIGRP_FILTER_IN] = alist; ei->list[EIGRP_FILTER_IN] = alist;
} }
else else
ei->list[EIGRP_FILTER_IN] = NULL; ei->list[EIGRP_FILTER_IN] = NULL;
} }
else else
{ {
@ -231,25 +231,25 @@ eigrp_distribute_update (struct distribute *dist)
{ {
alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_V4_OUT]); alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_V4_OUT]);
if (alist) if (alist)
ei->list[EIGRP_FILTER_OUT] = alist; ei->list[EIGRP_FILTER_OUT] = alist;
else else
ei->list[EIGRP_FILTER_OUT] = NULL; ei->list[EIGRP_FILTER_OUT] = NULL;
} }
else else
{ {
ei->list[EIGRP_FILTER_OUT] = NULL; ei->list[EIGRP_FILTER_OUT] = NULL;
zlog_info("<DEBUG ACL out else"); zlog_info("<DEBUG ACL out else");
} }
/* Prefix-list for interface in */ /* Prefix-list for interface in */
if (dist->prefix[DISTRIBUTE_V4_IN]) if (dist->prefix[DISTRIBUTE_V4_IN])
{ {
plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_IN]); plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_IN]);
if (plist) if (plist)
ei->prefix[EIGRP_FILTER_IN] = plist; ei->prefix[EIGRP_FILTER_IN] = plist;
else else
ei->prefix[EIGRP_FILTER_IN] = NULL; ei->prefix[EIGRP_FILTER_IN] = NULL;
} }
else else
ei->prefix[EIGRP_FILTER_IN] = NULL; 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]); plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_OUT]);
if (plist) if (plist)
ei->prefix[EIGRP_FILTER_OUT] = plist; ei->prefix[EIGRP_FILTER_OUT] = plist;
else else
ei->prefix[EIGRP_FILTER_OUT] = NULL; ei->prefix[EIGRP_FILTER_OUT] = NULL;
} }
else else
ei->prefix[EIGRP_FILTER_OUT] = NULL; ei->prefix[EIGRP_FILTER_OUT] = NULL;
@ -269,44 +269,43 @@ eigrp_distribute_update (struct distribute *dist)
#if 0 #if 0
/* route-map IN for whole process */ /* route-map IN for whole process */
if (dist->route[DISTRIBUTE_V4_IN]) if (dist->route[DISTRIBUTE_V4_IN])
{ {
zlog_info("<DEBUG ACL ALL in"); zlog_info("<DEBUG ACL ALL in");
routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_IN]); routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_IN]);
if (routemap) if (routemap)
ei->routemap[EIGRP_FILTER_IN] = routemap; ei->routemap[EIGRP_FILTER_IN] = routemap;
else else
ei->routemap[EIGRP_FILTER_IN] = NULL; ei->routemap[EIGRP_FILTER_IN] = NULL;
} }
else else
{ {
ei->routemap[EIGRP_FILTER_IN] = NULL; ei->routemap[EIGRP_FILTER_IN] = NULL;
} }
/* route-map OUT for whole process */ /* route-map OUT for whole process */
if (dist->route[DISTRIBUTE_V4_OUT]) if (dist->route[DISTRIBUTE_V4_OUT])
{ {
routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_OUT]); routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_OUT]);
if (routemap) if (routemap)
ei->routemap[EIGRP_FILTER_OUT] = routemap; ei->routemap[EIGRP_FILTER_OUT] = routemap;
else else
ei->routemap[EIGRP_FILTER_OUT] = NULL; ei->routemap[EIGRP_FILTER_OUT] = NULL;
} }
else else
{ {
ei->routemap[EIGRP_FILTER_OUT] = NULL; ei->routemap[EIGRP_FILTER_OUT] = NULL;
} }
#endif #endif
//TODO: check Graceful restart after 10sec //TODO: check Graceful restart after 10sec
/* check if there is already GR scheduled */ /* check if there is already GR scheduled */
if(ei->t_distribute != NULL) if(ei->t_distribute != NULL)
{ {
/* if is, cancel schedule */ /* if is, cancel schedule */
thread_cancel(ei->t_distribute); thread_cancel(ei->t_distribute);
} }
/* schedule Graceful restart for interface in 10sec */ /* schedule Graceful restart for interface in 10sec */
e->t_distribute = thread_add_timer(master, eigrp_distribute_timer_interface, ei,(10)); e->t_distribute = thread_add_timer(master, eigrp_distribute_timer_interface, ei, 10);
} }
/* /*
@ -341,15 +340,15 @@ eigrp_distribute_update_all (struct prefix_list *notused)
void void
eigrp_distribute_update_all_wrapper(struct access_list *notused) eigrp_distribute_update_all_wrapper(struct access_list *notused)
{ {
eigrp_distribute_update_all(NULL); eigrp_distribute_update_all(NULL);
} }
/* /*
* @fn eigrp_distribute_timer_process * @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 * @par
* Called when 10sec waiting time expire and * Called when 10sec waiting time expire and
@ -358,23 +357,23 @@ eigrp_distribute_update_all_wrapper(struct access_list *notused)
int int
eigrp_distribute_timer_process (struct thread *thread) eigrp_distribute_timer_process (struct thread *thread)
{ {
struct eigrp *eigrp; struct eigrp *eigrp;
eigrp = THREAD_ARG(thread); eigrp = THREAD_ARG(thread);
eigrp->t_distribute = NULL; eigrp->t_distribute = NULL;
/* execute GR for whole process */ /* execute GR for whole process */
eigrp_update_send_process_GR(eigrp, EIGRP_GR_FILTER, NULL); eigrp_update_send_process_GR(eigrp, EIGRP_GR_FILTER, NULL);
return 0; return 0;
} }
/* /*
* @fn eigrp_distribute_timer_interface * @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 * @par
* Called when 10sec waiting time expire and * Called when 10sec waiting time expire and
@ -383,13 +382,13 @@ eigrp_distribute_timer_process (struct thread *thread)
int int
eigrp_distribute_timer_interface (struct thread *thread) eigrp_distribute_timer_interface (struct thread *thread)
{ {
struct eigrp_interface *ei; struct eigrp_interface *ei;
ei = THREAD_ARG(thread); ei = THREAD_ARG(thread);
ei->t_distribute = NULL; ei->t_distribute = NULL;
/* execute GR for interface */ /* execute GR for interface */
eigrp_update_send_interface_GR(ei, EIGRP_GR_FILTER, NULL); eigrp_update_send_interface_GR(ei, EIGRP_GR_FILTER, NULL);
return 0; return 0;
} }

View File

@ -93,22 +93,14 @@
/* /*
* Prototypes * Prototypes
*/ */
int int eigrp_fsm_event_keep_state(struct eigrp_fsm_action_message *);
eigrp_fsm_event_keep_state(struct eigrp_fsm_action_message *); int eigrp_fsm_event_nq_fcn(struct eigrp_fsm_action_message *);
int int eigrp_fsm_event_q_fcn(struct eigrp_fsm_action_message *);
eigrp_fsm_event_nq_fcn(struct eigrp_fsm_action_message *); int eigrp_fsm_event_lr(struct eigrp_fsm_action_message *);
int int eigrp_fsm_event_dinc(struct eigrp_fsm_action_message *);
eigrp_fsm_event_q_fcn(struct eigrp_fsm_action_message *); int eigrp_fsm_event_lr_fcs(struct eigrp_fsm_action_message *);
int int eigrp_fsm_event_lr_fcn(struct eigrp_fsm_action_message *);
eigrp_fsm_event_lr(struct eigrp_fsm_action_message *); int eigrp_fsm_event_qact(struct eigrp_fsm_action_message *);
int
eigrp_fsm_event_dinc(struct eigrp_fsm_action_message *);
int
eigrp_fsm_event_lr_fcs(struct eigrp_fsm_action_message *);
int
eigrp_fsm_event_lr_fcn(struct eigrp_fsm_action_message *);
int
eigrp_fsm_event_qact(struct eigrp_fsm_action_message *);
//--------------------------------------------------------------------- //---------------------------------------------------------------------
@ -120,59 +112,58 @@ eigrp_fsm_event_qact(struct eigrp_fsm_action_message *);
* Functions are should be executed within separate thread. * Functions are should be executed within separate thread.
*/ */
struct { struct {
int int
(*func)(struct eigrp_fsm_action_message *); (*func)(struct eigrp_fsm_action_message *);
} NSM[EIGRP_FSM_STATE_MAX][EIGRP_FSM_EVENT_MAX] = { { } NSM[EIGRP_FSM_STATE_MAX][EIGRP_FSM_EVENT_MAX] = { {
//PASSIVE STATE //PASSIVE STATE
{ eigrp_fsm_event_nq_fcn }, /* Event 0 */ { eigrp_fsm_event_nq_fcn }, /* Event 0 */
{ eigrp_fsm_event_keep_state }, /* Event 1 */ { eigrp_fsm_event_keep_state }, /* Event 1 */
{ eigrp_fsm_event_q_fcn }, /* Event 2 */ { eigrp_fsm_event_q_fcn }, /* Event 2 */
{ eigrp_fsm_event_keep_state }, /* Event 3 */ { eigrp_fsm_event_keep_state }, /* Event 3 */
{ eigrp_fsm_event_keep_state }, /* Event 4 */ { eigrp_fsm_event_keep_state }, /* Event 4 */
{ eigrp_fsm_event_keep_state }, /* Event 5 */ { eigrp_fsm_event_keep_state }, /* Event 5 */
{ eigrp_fsm_event_keep_state }, /* Event 6 */ { eigrp_fsm_event_keep_state }, /* Event 6 */
{ eigrp_fsm_event_keep_state }, /* Event 7 */ { eigrp_fsm_event_keep_state }, /* Event 7 */
}, { }, {
//Active 0 state //Active 0 state
{ eigrp_fsm_event_keep_state }, /* Event 0 */ { eigrp_fsm_event_keep_state }, /* Event 0 */
{ eigrp_fsm_event_keep_state }, /* Event 1 */ { eigrp_fsm_event_keep_state }, /* Event 1 */
{ eigrp_fsm_event_keep_state }, /* Event 2 */ { eigrp_fsm_event_keep_state }, /* Event 2 */
{ eigrp_fsm_event_lr_fcs }, /* Event 3 */ { eigrp_fsm_event_lr_fcs }, /* Event 3 */
{ eigrp_fsm_event_keep_state }, /* Event 4 */ { eigrp_fsm_event_keep_state }, /* Event 4 */
{ eigrp_fsm_event_qact }, /* Event 5 */ { eigrp_fsm_event_qact }, /* Event 5 */
{ eigrp_fsm_event_lr_fcn }, /* Event 6 */ { eigrp_fsm_event_lr_fcn }, /* Event 6 */
{ eigrp_fsm_event_keep_state }, /* Event 7 */ { eigrp_fsm_event_keep_state }, /* Event 7 */
}, {
}, { //Active 1 state
//Active 1 state { eigrp_fsm_event_keep_state }, /* Event 0 */
{ eigrp_fsm_event_keep_state }, /* Event 0 */ { eigrp_fsm_event_lr }, /* Event 1 */
{ eigrp_fsm_event_lr }, /* Event 1 */ { eigrp_fsm_event_keep_state }, /* Event 2 */
{ eigrp_fsm_event_keep_state }, /* Event 2 */ { eigrp_fsm_event_keep_state }, /* Event 3 */
{ eigrp_fsm_event_keep_state }, /* Event 3 */ { eigrp_fsm_event_dinc }, /* Event 4 */
{ eigrp_fsm_event_dinc }, /* Event 4 */ { eigrp_fsm_event_qact }, /* Event 5 */
{ eigrp_fsm_event_qact }, /* Event 5 */ { eigrp_fsm_event_keep_state }, /* Event 6 */
{ eigrp_fsm_event_keep_state }, /* Event 6 */ { eigrp_fsm_event_keep_state }, /* Event 7 */
{ eigrp_fsm_event_keep_state }, /* Event 7 */ }, {
}, { //Active 2 state
//Active 2 state { eigrp_fsm_event_keep_state }, /* Event 0 */
{ eigrp_fsm_event_keep_state }, /* Event 0 */ { eigrp_fsm_event_keep_state }, /* Event 1 */
{ eigrp_fsm_event_keep_state }, /* Event 1 */ { eigrp_fsm_event_keep_state }, /* Event 2 */
{ eigrp_fsm_event_keep_state }, /* Event 2 */ { eigrp_fsm_event_lr_fcs }, /* Event 3 */
{ eigrp_fsm_event_lr_fcs }, /* Event 3 */ { eigrp_fsm_event_keep_state }, /* Event 4 */
{ eigrp_fsm_event_keep_state }, /* Event 4 */ { eigrp_fsm_event_keep_state }, /* Event 5 */
{ eigrp_fsm_event_keep_state }, /* Event 5 */ { eigrp_fsm_event_lr_fcn }, /* Event 6 */
{ eigrp_fsm_event_lr_fcn }, /* Event 6 */ { eigrp_fsm_event_keep_state }, /* Event 7 */
{ eigrp_fsm_event_keep_state }, /* Event 7 */ }, {
}, { //Active 3 state
//Active 3 state { eigrp_fsm_event_keep_state }, /* Event 0 */
{ eigrp_fsm_event_keep_state }, /* Event 0 */ { eigrp_fsm_event_lr }, /* Event 1 */
{ eigrp_fsm_event_lr }, /* Event 1 */ { eigrp_fsm_event_keep_state }, /* Event 2 */
{ eigrp_fsm_event_keep_state }, /* Event 2 */ { eigrp_fsm_event_keep_state }, /* Event 3 */
{ eigrp_fsm_event_keep_state }, /* Event 3 */ { eigrp_fsm_event_dinc }, /* Event 4 */
{ eigrp_fsm_event_dinc }, /* Event 4 */ { eigrp_fsm_event_keep_state }, /* Event 5 */
{ eigrp_fsm_event_keep_state }, /* Event 5 */ { eigrp_fsm_event_keep_state }, /* Event 6 */
{ eigrp_fsm_event_keep_state }, /* Event 6 */ { eigrp_fsm_event_keep_state }, /* Event 7 */
{ eigrp_fsm_event_keep_state }, /* Event 7 */
}, }; }, };
/* /*
@ -183,353 +174,416 @@ struct {
* Return number of occurred event (arrow in diagram). * Return number of occurred event (arrow in diagram).
* *
*/ */
int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg) { int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg)
// Loading base information from message {
//struct eigrp *eigrp = msg->eigrp; // Loading base information from message
struct eigrp_prefix_entry *prefix = msg->prefix; //struct eigrp *eigrp = msg->eigrp;
struct eigrp_neighbor_entry *entry = msg->entry; struct eigrp_prefix_entry *prefix = msg->prefix;
u_char actual_state = prefix->state; struct eigrp_neighbor_entry *entry = msg->entry;
u_char actual_state = prefix->state;
if (entry == NULL) { if (entry == NULL)
entry = eigrp_neighbor_entry_new(); {
entry->adv_router = msg->adv_router; entry = eigrp_neighbor_entry_new();
entry->ei = msg->adv_router->ei; entry->adv_router = msg->adv_router;
entry->prefix = prefix; entry->ei = msg->adv_router->ei;
msg->entry = entry; entry->prefix = prefix;
} msg->entry = entry;
}
// Dividing by actual state of prefix's FSM // Dividing by actual state of prefix's FSM
switch (actual_state) { switch (actual_state)
case EIGRP_FSM_STATE_PASSIVE: { {
//Calculate resultant metrics and insert to correct position in entries list case EIGRP_FSM_STATE_PASSIVE:
eigrp_topology_update_distance(msg); {
//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;
}
}
struct eigrp_neighbor_entry * head = break;
(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); case EIGRP_FSM_STATE_ACTIVE_0:
if (head->reported_distance < prefix->fdistance) { {
return EIGRP_FSM_KEEP_STATE; eigrp_topology_update_distance(msg);
}
/*
* 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; if (msg->packet_type == EIGRP_OPC_REPLY) {
} listnode_delete(prefix->rij, entry->adv_router);
case EIGRP_FSM_STATE_ACTIVE_0: { if (prefix->rij->count)
eigrp_topology_update_distance(msg); {
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;
}
if (msg->packet_type == EIGRP_OPC_REPLY) { return EIGRP_FSM_EVENT_LR_FCN;
listnode_delete(prefix->rij, entry->adv_router); }
if (prefix->rij->count) { }
return EIGRP_FSM_KEEP_STATE; else if (msg->packet_type == EIGRP_OPC_QUERY
} else { && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG))
zlog_info("All reply received\n"); {
if (((struct eigrp_neighbor_entry *) prefix->entries->head->data)->reported_distance return EIGRP_FSM_EVENT_QACT;
< prefix->fdistance) { }
return EIGRP_FSM_EVENT_LR_FCS;
}
return EIGRP_FSM_EVENT_LR_FCN; return EIGRP_FSM_KEEP_STATE;
}
} 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);
break; if (msg->packet_type == EIGRP_OPC_QUERY
} && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG))
case EIGRP_FSM_STATE_ACTIVE_1: { {
int change = eigrp_topology_update_distance(msg); return EIGRP_FSM_EVENT_QACT;
}
else if (msg->packet_type == EIGRP_OPC_REPLY)
{
listnode_delete(prefix->rij, entry->adv_router);
if (msg->packet_type == EIGRP_OPC_QUERY if (change == 1
&& (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) { && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG))
return EIGRP_FSM_EVENT_QACT; {
} else if (msg->packet_type == EIGRP_OPC_REPLY) { return EIGRP_FSM_EVENT_DINC;
listnode_delete(prefix->rij, entry->adv_router); }
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;
if (change == 1 break;
&& (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) { }
return EIGRP_FSM_EVENT_DINC; case EIGRP_FSM_STATE_ACTIVE_2:
} else if (prefix->rij->count) { {
return EIGRP_FSM_KEEP_STATE; eigrp_topology_update_distance(msg);
} 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; if (msg->packet_type == EIGRP_OPC_REPLY)
} {
case EIGRP_FSM_STATE_ACTIVE_2: { 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;
}
eigrp_topology_update_distance(msg); return EIGRP_FSM_EVENT_LR_FCN;
}
}
return EIGRP_FSM_KEEP_STATE;
if (msg->packet_type == EIGRP_OPC_REPLY) { break;
listnode_delete(prefix->rij, entry->adv_router); }
if (prefix->rij->count) { case EIGRP_FSM_STATE_ACTIVE_3:
return EIGRP_FSM_KEEP_STATE; {
} else { int change = eigrp_topology_update_distance(msg);
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; if (msg->packet_type == EIGRP_OPC_REPLY)
} {
} listnode_delete(prefix->rij, entry->adv_router);
return EIGRP_FSM_KEEP_STATE;
break; if (change == 1
} && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG))
case EIGRP_FSM_STATE_ACTIVE_3: { {
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;
int change = eigrp_topology_update_distance(msg); break;
}
}
if (msg->packet_type == EIGRP_OPC_REPLY) { return EIGRP_FSM_KEEP_STATE;
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. * Function made to execute in separate thread.
* Load argument from thread and execute proper NSM function * Load argument from thread and execute proper NSM function
*/ */
int eigrp_fsm_event(struct eigrp_fsm_action_message *msg, int event) { int eigrp_fsm_event(struct eigrp_fsm_action_message *msg, int event)
{
zlog_info("EIGRP AS: %d State: %d Event: %d Network: %s\n", msg->eigrp->AS,
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, return 1;
msg->prefix->state, event, eigrp_topology_ip_string(msg->prefix));
(*(NSM[msg->prefix->state][event].func))(msg);
return 1;
} }
/* /*
* Function of event 0. * Function of event 0.
* *
*/ */
int eigrp_fsm_event_nq_fcn(struct eigrp_fsm_action_message *msg) { int eigrp_fsm_event_nq_fcn(struct eigrp_fsm_action_message *msg)
struct eigrp *eigrp = msg->eigrp; {
struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp *eigrp = msg->eigrp;
struct list *successors = eigrp_topology_get_successor(prefix); 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? assert(successors); // If this is NULL we have shit the bed, fun huh?
prefix->state = EIGRP_FSM_STATE_ACTIVE_1; prefix->state = EIGRP_FSM_STATE_ACTIVE_1;
prefix->rdistance = prefix->distance = prefix->fdistance = prefix->rdistance = prefix->distance = prefix->fdistance =
((struct eigrp_neighbor_entry *) successors->head->data)->distance; ((struct eigrp_neighbor_entry *) successors->head->data)->distance;
prefix->reported_metric = prefix->reported_metric =
((struct eigrp_neighbor_entry *) successors->head->data)->total_metric; ((struct eigrp_neighbor_entry *) successors->head->data)->total_metric;
if (eigrp_nbr_count_get()) { if (eigrp_nbr_count_get())
prefix->req_action |= EIGRP_FSM_NEED_QUERY; {
listnode_add(eigrp->topology_changes_internalIPV4,prefix); prefix->req_action |= EIGRP_FSM_NEED_QUERY;
} else { listnode_add(eigrp->topology_changes_internalIPV4,prefix);
eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left }
} else
{
eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left
}
list_delete(successors); list_delete(successors);
return 1; return 1;
} }
int eigrp_fsm_event_q_fcn(struct eigrp_fsm_action_message *msg) { int eigrp_fsm_event_q_fcn(struct eigrp_fsm_action_message *msg)
struct eigrp *eigrp = msg->eigrp; {
struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp *eigrp = msg->eigrp;
struct list *successors = eigrp_topology_get_successor(prefix); 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. assert(successors); // If this is NULL somebody poked us in the eye.
prefix->state = EIGRP_FSM_STATE_ACTIVE_3; prefix->state = EIGRP_FSM_STATE_ACTIVE_3;
prefix->rdistance = prefix->distance = prefix->fdistance = prefix->rdistance = prefix->distance = prefix->fdistance =
((struct eigrp_neighbor_entry *) successors->head->data)->distance; ((struct eigrp_neighbor_entry *) successors->head->data)->distance;
prefix->reported_metric = prefix->reported_metric =
((struct eigrp_neighbor_entry *) successors->head->data)->total_metric; ((struct eigrp_neighbor_entry *) successors->head->data)->total_metric;
if (eigrp_nbr_count_get()) { if (eigrp_nbr_count_get())
prefix->req_action |= EIGRP_FSM_NEED_QUERY; {
listnode_add(eigrp->topology_changes_internalIPV4,prefix); prefix->req_action |= EIGRP_FSM_NEED_QUERY;
} else { listnode_add(eigrp->topology_changes_internalIPV4,prefix);
eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left }
} else
{
eigrp_fsm_event_lr(msg); //in the case that there are no more neighbors left
}
list_delete(successors); list_delete(successors);
return 1; return 1;
} }
int eigrp_fsm_event_keep_state(struct eigrp_fsm_action_message *msg) { int eigrp_fsm_event_keep_state(struct eigrp_fsm_action_message *msg)
{
struct eigrp_prefix_entry *prefix = msg->prefix;
struct eigrp_prefix_entry *prefix = msg->prefix; if (prefix->state == EIGRP_FSM_STATE_PASSIVE)
{
if (!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 (prefix->state == EIGRP_FSM_STATE_PASSIVE) { if (msg->packet_type == EIGRP_OPC_QUERY)
if (!eigrp_metrics_is_same(&prefix->reported_metric, eigrp_send_reply(msg->adv_router, prefix);
&((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) return 1;
eigrp_send_reply(msg->adv_router, prefix);
return 1;
} }
int eigrp_fsm_event_lr(struct eigrp_fsm_action_message *msg) { int eigrp_fsm_event_lr(struct eigrp_fsm_action_message *msg)
struct eigrp *eigrp = msg->eigrp; {
struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp *eigrp = msg->eigrp;
prefix->fdistance = struct eigrp_prefix_entry *prefix = msg->prefix;
prefix->distance = prefix->fdistance =
prefix->rdistance = prefix->distance =
((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->distance; prefix->rdistance =
prefix->reported_metric = ((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->distance;
((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->total_metric; prefix->reported_metric =
((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->total_metric;
if (prefix->state == EIGRP_FSM_STATE_ACTIVE_3) { if (prefix->state == EIGRP_FSM_STATE_ACTIVE_3)
struct list *successors = eigrp_topology_get_successor(prefix); {
struct list *successors = eigrp_topology_get_successor(prefix);
assert(successors); // It's like Napolean and Waterloo assert(successors); // It's like Napolean and Waterloo
eigrp_send_reply(((struct eigrp_neighbor_entry *)successors->head->data)->adv_router, prefix); eigrp_send_reply(((struct eigrp_neighbor_entry *)successors->head->data)->adv_router, prefix);
list_delete(successors); list_delete(successors);
} }
prefix->state = EIGRP_FSM_STATE_PASSIVE; prefix->state = EIGRP_FSM_STATE_PASSIVE;
prefix->req_action |= EIGRP_FSM_NEED_UPDATE; prefix->req_action |= EIGRP_FSM_NEED_UPDATE;
listnode_add(eigrp->topology_changes_internalIPV4,prefix); listnode_add(eigrp->topology_changes_internalIPV4,prefix);
eigrp_topology_update_node_flags(prefix); eigrp_topology_update_node_flags(prefix);
eigrp_update_routing_table(prefix); eigrp_update_routing_table(prefix);
eigrp_update_topology_table_prefix(eigrp->topology_table, prefix); eigrp_update_topology_table_prefix(eigrp->topology_table, prefix);
return 1; return 1;
} }
int eigrp_fsm_event_dinc(struct eigrp_fsm_action_message *msg) { int eigrp_fsm_event_dinc(struct eigrp_fsm_action_message *msg)
struct list *successors = eigrp_topology_get_successor(msg->prefix); {
struct list *successors = eigrp_topology_get_successor(msg->prefix);
assert(successors); // Trump and his big hands assert(successors); // Trump and his big hands
msg->prefix->state = msg->prefix->state =
msg->prefix->state == EIGRP_FSM_STATE_ACTIVE_1 ? msg->prefix->state == EIGRP_FSM_STATE_ACTIVE_1 ?
EIGRP_FSM_STATE_ACTIVE_0 : EIGRP_FSM_STATE_ACTIVE_2; EIGRP_FSM_STATE_ACTIVE_0 : EIGRP_FSM_STATE_ACTIVE_2;
msg->prefix->distance = ((struct eigrp_neighbor_entry *)successors->head->data)->distance; msg->prefix->distance =
if (!msg->prefix->rij->count) { ((struct eigrp_neighbor_entry *)successors->head->data)->distance;
(*(NSM[msg->prefix->state][eigrp_get_fsm_event(msg)].func))(msg); 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) { int eigrp_fsm_event_lr_fcs(struct eigrp_fsm_action_message *msg)
struct eigrp *eigrp = msg->eigrp; {
struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp *eigrp = msg->eigrp;
prefix->state = EIGRP_FSM_STATE_PASSIVE; struct eigrp_prefix_entry *prefix = msg->prefix;
prefix->distance = prefix->state = EIGRP_FSM_STATE_PASSIVE;
prefix->rdistance = prefix->distance =
((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->distance; prefix->rdistance =
prefix->reported_metric = ((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->distance;
((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->total_metric; prefix->reported_metric =
prefix->fdistance = ((struct eigrp_neighbor_entry *) (prefix->entries->head->data))->total_metric;
prefix->fdistance > prefix->distance ? prefix->fdistance =
prefix->distance : prefix->fdistance; prefix->fdistance > prefix->distance ?
if (prefix->state == EIGRP_FSM_STATE_ACTIVE_2) { prefix->distance : prefix->fdistance;
struct list *successors = eigrp_topology_get_successor(prefix); 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 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); eigrp_send_reply(((struct eigrp_neighbor_entry *)successors->head->data)->adv_router, prefix);
list_delete(successors); list_delete(successors);
} }
prefix->req_action |= EIGRP_FSM_NEED_UPDATE; prefix->req_action |= EIGRP_FSM_NEED_UPDATE;
listnode_add(eigrp->topology_changes_internalIPV4,prefix); listnode_add(eigrp->topology_changes_internalIPV4,prefix);
eigrp_topology_update_node_flags(prefix); eigrp_topology_update_node_flags(prefix);
eigrp_update_routing_table(prefix); eigrp_update_routing_table(prefix);
eigrp_update_topology_table_prefix(eigrp->topology_table, prefix); eigrp_update_topology_table_prefix(eigrp->topology_table, prefix);
return 1; return 1;
} }
int eigrp_fsm_event_lr_fcn(struct eigrp_fsm_action_message *msg) { int eigrp_fsm_event_lr_fcn(struct eigrp_fsm_action_message *msg)
struct eigrp *eigrp = msg->eigrp; {
struct eigrp_prefix_entry *prefix = msg->prefix; struct eigrp *eigrp = msg->eigrp;
struct list *successors = eigrp_topology_get_successor(prefix); struct eigrp_prefix_entry *prefix = msg->prefix;
struct list *successors = eigrp_topology_get_successor(prefix);
assert(successors); // Routing without a stack assert(successors); // Routing without a stack
prefix->state = prefix->state =
prefix->state == EIGRP_FSM_STATE_ACTIVE_0 ? prefix->state == EIGRP_FSM_STATE_ACTIVE_0 ?
EIGRP_FSM_STATE_ACTIVE_1 : EIGRP_FSM_STATE_ACTIVE_3; EIGRP_FSM_STATE_ACTIVE_1 : EIGRP_FSM_STATE_ACTIVE_3;
struct eigrp_neighbor_entry *best_successor = struct eigrp_neighbor_entry *best_successor =
((struct eigrp_neighbor_entry *) (successors->head->data)); ((struct eigrp_neighbor_entry *) (successors->head->data));
prefix->rdistance = prefix->distance = best_successor->distance; prefix->rdistance = prefix->distance = best_successor->distance;
prefix->reported_metric = best_successor->total_metric; prefix->reported_metric = best_successor->total_metric;
if (eigrp_nbr_count_get()) {
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); 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
}
return 1; list_delete(successors);
return 1;
} }
int eigrp_fsm_event_qact(struct eigrp_fsm_action_message *msg) { int eigrp_fsm_event_qact(struct eigrp_fsm_action_message *msg)
struct list *successors = eigrp_topology_get_successor(msg->prefix); {
struct list *successors = eigrp_topology_get_successor(msg->prefix);
assert(successors); // Cats and no Dogs assert(successors); // Cats and no Dogs
msg->prefix->state = EIGRP_FSM_STATE_ACTIVE_2; msg->prefix->state = EIGRP_FSM_STATE_ACTIVE_2;
msg->prefix->distance = msg->prefix->distance =
((struct eigrp_neighbor_entry *) (successors->head->data))->distance; ((struct eigrp_neighbor_entry *) (successors->head->data))->distance;
list_delete(successors); list_delete(successors);
return 1; return 1;
} }

View File

@ -59,14 +59,14 @@
/* Packet Type String. */ /* Packet Type String. */
static const struct message eigrp_general_tlv_type_str[] = static const struct message eigrp_general_tlv_type_str[] =
{ {
{ EIGRP_TLV_PARAMETER, "PARAMETER" }, { EIGRP_TLV_PARAMETER, "PARAMETER" },
{ EIGRP_TLV_AUTH, "AUTH" }, { EIGRP_TLV_AUTH, "AUTH" },
{ EIGRP_TLV_SEQ, "SEQ" }, { EIGRP_TLV_SEQ, "SEQ" },
{ EIGRP_TLV_SW_VERSION, "SW_VERSION" }, { EIGRP_TLV_SW_VERSION, "SW_VERSION" },
{ EIGRP_TLV_NEXT_MCAST_SEQ, "NEXT_MCAST_SEQ" }, { EIGRP_TLV_NEXT_MCAST_SEQ, "NEXT_MCAST_SEQ" },
{ EIGRP_TLV_PEER_TERMINATION, "PEER_TERMINATION" }, { EIGRP_TLV_PEER_TERMINATION, "PEER_TERMINATION" },
{ EIGRP_TLV_PEER_MTRLIST, "PEER_MTRLIST" }, { EIGRP_TLV_PEER_MTRLIST, "PEER_MTRLIST" },
{ EIGRP_TLV_PEER_TIDLIST, "PEER_TIDLIST" }, { EIGRP_TLV_PEER_TIDLIST, "PEER_TIDLIST" },
}; };
static const size_t eigrp_general_tlv_type_str_max = sizeof(eigrp_general_tlv_type_str) / 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 * @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 * @par
* Called once per "hello" time interval, default 5 seconds * Called once per "hello" time interval, default 5 seconds
@ -102,7 +102,7 @@ eigrp_hello_timer (struct thread *thread)
/* Hello timer set. */ /* Hello timer set. */
ei->t_hello = thread_add_timer(master, eigrp_hello_timer, ei, 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; return 0;
} }
@ -124,7 +124,7 @@ eigrp_hello_timer (struct thread *thread)
*/ */
static void static void
eigrp_hello_parameter_decode (struct eigrp_neighbor *nbr, 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 eigrp *eigrp = nbr->ei->eigrp;
struct TLV_Parameter_Type *param = (struct TLV_Parameter_Type *)tlv; 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) if (eigrp_nbr_state_get(nbr) == EIGRP_NEIGHBOR_DOWN)
{ {
zlog_info("Neighbor %s (%s) is pending: new adjacency", zlog_info("Neighbor %s (%s) is pending: new adjacency",
inet_ntoa(nbr->src), ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT)); inet_ntoa(nbr->src), ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
/* Expedited hello sent */ /* Expedited hello sent */
eigrp_hello_send(nbr->ei, EIGRP_HELLO_NORMAL, NULL); eigrp_hello_send(nbr->ei, EIGRP_HELLO_NORMAL, NULL);
// if(ntohl(nbr->ei->address->u.prefix4.s_addr) > ntohl(nbr->src.s_addr)) // if(ntohl(nbr->ei->address->u.prefix4.s_addr) > ntohl(nbr->src.s_addr))
eigrp_update_send_init(nbr); eigrp_update_send_init(nbr);
eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_PENDING); eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_PENDING);
} }
} }
else else
{ {
if (eigrp_nbr_state_get(nbr) != EIGRP_NEIGHBOR_DOWN) 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", zlog_info ("Neighbor %s (%s) is down: Interface PEER-TERMINATION received",
inet_ntoa (nbr->src),ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT)); inet_ntoa (nbr->src),ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT));
eigrp_nbr_delete (nbr); eigrp_nbr_delete (nbr);
} }
else else
{ {
zlog_info ("Neighbor %s (%s) going down: Kvalue mismatch", zlog_info ("Neighbor %s (%s) going down: Kvalue mismatch",
inet_ntoa (nbr->src),ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT)); inet_ntoa (nbr->src),ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT));
eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_DOWN); eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_DOWN);
} }
} }
} }
} }
static u_char static u_char
eigrp_hello_authentication_decode(struct stream *s, struct eigrp_tlv_hdr_type *tlv_header, struct eigrp_neighbor *nbr) eigrp_hello_authentication_decode(struct stream *s, struct eigrp_tlv_hdr_type *tlv_header,
struct eigrp_neighbor *nbr)
{ {
struct TLV_MD5_Authentication_Type *md5; struct TLV_MD5_Authentication_Type *md5;
md5 = (struct TLV_MD5_Authentication_Type *) tlv_header; md5 = (struct TLV_MD5_Authentication_Type *) tlv_header;
@ -194,7 +194,8 @@ eigrp_hello_authentication_decode(struct stream *s, struct eigrp_tlv_hdr_type *t
if(md5->auth_type == EIGRP_AUTH_TYPE_MD5) if(md5->auth_type == EIGRP_AUTH_TYPE_MD5)
return eigrp_check_md5_digest(s, md5, nbr, EIGRP_AUTH_BASIC_HELLO_FLAG); return eigrp_check_md5_digest(s, md5, nbr, EIGRP_AUTH_BASIC_HELLO_FLAG);
else if (md5->auth_type == EIGRP_AUTH_TYPE_SHA256) else if (md5->auth_type == EIGRP_AUTH_TYPE_SHA256)
return eigrp_check_sha256_digest(s, (struct TLV_SHA256_Authentication_Type *) tlv_header, nbr, EIGRP_AUTH_BASIC_HELLO_FLAG); return eigrp_check_sha256_digest(s, (struct TLV_SHA256_Authentication_Type *)tlv_header,
nbr, EIGRP_AUTH_BASIC_HELLO_FLAG);
return 0; return 0;
} }
@ -214,7 +215,7 @@ eigrp_hello_authentication_decode(struct stream *s, struct eigrp_tlv_hdr_type *t
*/ */
static void static void
eigrp_sw_version_decode (struct eigrp_neighbor *nbr, 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; struct TLV_Software_Type *version = (struct TLV_Software_Type *)tlv;
@ -240,22 +241,22 @@ eigrp_sw_version_decode (struct eigrp_neighbor *nbr,
*/ */
static void static void
eigrp_peer_termination_decode (struct eigrp_neighbor *nbr, 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; 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 my_ip = nbr->ei->address->u.prefix4.s_addr;
uint32_t received_ip = param->neighbor_ip; uint32_t received_ip = param->neighbor_ip;
if(my_ip == received_ip) if(my_ip == received_ip)
{ {
zlog_info ("Neighbor %s (%s) is down: Peer Termination received", zlog_info ("Neighbor %s (%s) is down: Peer Termination received",
inet_ntoa (nbr->src),ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT)); inet_ntoa (nbr->src),ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT));
/* set neighbor to DOWN */ /* set neighbor to DOWN */
nbr->state = EIGRP_NEIGHBOR_DOWN; nbr->state = EIGRP_NEIGHBOR_DOWN;
/* delete neighbor */ /* delete neighbor */
eigrp_nbr_delete (nbr); eigrp_nbr_delete (nbr);
} }
} }
/** /**
@ -272,30 +273,30 @@ eigrp_peer_termination_decode (struct eigrp_neighbor *nbr,
static u_int16_t static u_int16_t
eigrp_peer_termination_encode (struct stream *s, struct in_addr *nbr_addr) 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 */ /* fill in type and length */
stream_putw(s, EIGRP_TLV_PEER_TERMINATION); stream_putw(s, EIGRP_TLV_PEER_TERMINATION);
stream_putw(s, length); stream_putw(s, length);
/* fill in unknown field 0x04 */ /* fill in unknown field 0x04 */
stream_putc(s, 0x04); stream_putc(s, 0x04);
/* finally neighbor IP address */ /* finally neighbor IP address */
stream_put_ipv4(s, nbr_addr->s_addr); stream_put_ipv4(s, nbr_addr->s_addr);
return(length); return(length);
} }
/* /*
* @fn eigrp_hello_receive * @fn eigrp_hello_receive
* *
* @param[in] eigrp eigrp routing process * @param[in] eigrp eigrp routing process
* @param[in] iph pointer to ip header * @param[in] iph pointer to ip header
* @param[in] eigrph pointer to eigrp header * @param[in] eigrph pointer to eigrp header
* @param[in] s input ip stream * @param[in] s input ip stream
* @param[in] ei eigrp interface packet arrived on * @param[in] ei eigrp interface packet arrived on
* @param[in] size size of eigrp packet * @param[in] size size of eigrp packet
* *
* @return void * @return void
* *
@ -310,12 +311,12 @@ eigrp_peer_termination_encode (struct stream *s, struct in_addr *nbr_addr)
*/ */
void void
eigrp_hello_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *eigrph, 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_tlv_hdr_type *tlv_header;
struct eigrp_neighbor *nbr; struct eigrp_neighbor *nbr;
uint16_t type; uint16_t type;
uint16_t length; uint16_t length;
/* get neighbor struct */ /* get neighbor struct */
nbr = eigrp_nbr_get(ei, eigrph, iph); 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)) if (IS_DEBUG_EIGRP_PACKET(eigrph->opcode - 1, RECV))
zlog_debug("Processing Hello size[%u] int(%s) nbr(%s)", zlog_debug("Processing Hello size[%u] int(%s) nbr(%s)",
size, ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT), size, ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT),
inet_ntoa(nbr->src)); inet_ntoa(nbr->src));
size -= EIGRP_HEADER_LEN; size -= EIGRP_HEADER_LEN;
if (size < 0) 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 ((length > 0) && (length <= size))
{ {
if (IS_DEBUG_EIGRP_PACKET(0, RECV)) if (IS_DEBUG_EIGRP_PACKET(0, RECV))
zlog_debug(" General TLV(%s)", LOOKUP(eigrp_general_tlv_type_str, type)); zlog_debug(" General TLV(%s)", LOOKUP(eigrp_general_tlv_type_str, type));
// determine what General TLV is being processed // determine what General TLV is being processed
switch (type) switch (type)
{ {
case EIGRP_TLV_PARAMETER: case EIGRP_TLV_PARAMETER:
eigrp_hello_parameter_decode(nbr, tlv_header); eigrp_hello_parameter_decode(nbr, tlv_header);
break; break;
case EIGRP_TLV_AUTH: case EIGRP_TLV_AUTH:
{ {
if(eigrp_hello_authentication_decode(s,tlv_header,nbr) == 0) if(eigrp_hello_authentication_decode(s,tlv_header,nbr) == 0)
return; return;
else else
break; break;
break; break;
} }
case EIGRP_TLV_SEQ: case EIGRP_TLV_SEQ:
break; break;
case EIGRP_TLV_SW_VERSION: case EIGRP_TLV_SW_VERSION:
eigrp_sw_version_decode(nbr, tlv_header); eigrp_sw_version_decode(nbr, tlv_header);
break; break;
case EIGRP_TLV_NEXT_MCAST_SEQ: case EIGRP_TLV_NEXT_MCAST_SEQ:
break; break;
case EIGRP_TLV_PEER_TERMINATION: case EIGRP_TLV_PEER_TERMINATION:
eigrp_peer_termination_decode(nbr, tlv_header); eigrp_peer_termination_decode(nbr, tlv_header);
break; break;
case EIGRP_TLV_PEER_MTRLIST: case EIGRP_TLV_PEER_MTRLIST:
case EIGRP_TLV_PEER_TIDLIST: case EIGRP_TLV_PEER_TIDLIST:
break; break;
default: default:
break; break;
} }
} }
tlv_header = (struct eigrp_tlv_hdr_type *)(((char *)tlv_header) + length); tlv_header = (struct eigrp_tlv_hdr_type *)(((char *)tlv_header) + length);
size -= 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)) 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 // encode the version of quagga we're running
// DVS: need to figure out a cleaner way to do this // DVS: need to figure out a cleaner way to do this
stream_putc(s, 0); //!< major os version stream_putc(s, 0); //!< major os version
stream_putc(s, 99); //!< minor os version stream_putc(s, 99); //!< minor os version
/* and the core eigrp version */ /* and the core eigrp version */
stream_putc(s, EIGRP_MAJOR_VERSION); stream_putc(s, EIGRP_MAJOR_VERSION);
@ -532,9 +532,9 @@ eigrp_next_sequence_encode (struct stream *s)
} }
// add in the parameters TLV // add in the parameters TLV
stream_putw(s, EIGRP_TLV_NEXT_MCAST_SEQ); stream_putw(s, EIGRP_TLV_NEXT_MCAST_SEQ);
stream_putw(s, EIGRP_NEXT_SEQUENCE_TLV_SIZE); stream_putw(s, EIGRP_NEXT_SEQUENCE_TLV_SIZE);
stream_putl(s,eigrp->sequence_number+1); stream_putl(s,eigrp->sequence_number+1);
return length; return length;
} }
@ -557,7 +557,7 @@ eigrp_next_sequence_encode (struct stream *s)
static u_int16_t static u_int16_t
eigrp_hello_parameter_encode (struct eigrp_interface *ei, struct stream *s, u_char flags) 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 // add in the parameters TLV
stream_putw(s, EIGRP_TLV_PARAMETER); 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 * static struct eigrp_packet *
eigrp_hello_encode (struct eigrp_interface *ei, in_addr_t addr, u_int32_t ack, u_char flags, struct in_addr *nbr_addr) eigrp_hello_encode (struct eigrp_interface *ei, in_addr_t addr, u_int32_t ack,
u_char flags, struct in_addr *nbr_addr)
{ {
struct eigrp_packet *ep; struct eigrp_packet *ep;
u_int16_t length = EIGRP_HEADER_LEN; u_int16_t length = EIGRP_HEADER_LEN;
@ -619,11 +620,13 @@ eigrp_hello_encode (struct eigrp_interface *ei, in_addr_t addr, u_int32_t ack, u
eigrp_packet_header_init(EIGRP_OPC_HELLO, ei, ep->s, 0, 0, ack); eigrp_packet_header_init(EIGRP_OPC_HELLO, ei, ep->s, 0, 0, ack);
// encode Authentication TLV // encode Authentication TLV
if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL)) if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
{ {
length += eigrp_add_authTLV_MD5_to_stream(ep->s,ei); length += eigrp_add_authTLV_MD5_to_stream(ep->s,ei);
} }
else if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_SHA256) && (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL)) else if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_SHA256) &&
(IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
{ {
length += eigrp_add_authTLV_SHA256_to_stream(ep->s,ei); length += eigrp_add_authTLV_SHA256_to_stream(ep->s,ei);
} }
@ -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 */ /* encode Peer Termination TLV if needed */
if(flags & EIGRP_HELLO_GRACEFUL_SHUTDOWN_NBR) 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 // Set packet length
ep->length = 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 // set soruce address for the hello packet
ep->dst.s_addr = addr; ep->dst.s_addr = addr;
if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL)) if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
{ {
eigrp_make_md5_digest(ei,ep->s, EIGRP_AUTH_BASIC_HELLO_FLAG); eigrp_make_md5_digest(ei,ep->s, EIGRP_AUTH_BASIC_HELLO_FLAG);
} }
else if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_SHA256) && (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL)) else if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_SHA256) &&
(IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
{ {
eigrp_make_sha256_digest(ei,ep->s, EIGRP_AUTH_BASIC_HELLO_FLAG); eigrp_make_sha256_digest(ei,ep->s, EIGRP_AUTH_BASIC_HELLO_FLAG);
} }
@ -696,21 +701,21 @@ eigrp_hello_send_ack (struct eigrp_neighbor *nbr)
if (ep) if (ep)
{ {
if (IS_DEBUG_EIGRP_PACKET(0, SEND)) if (IS_DEBUG_EIGRP_PACKET(0, SEND))
zlog_debug("Queueing [Hello] Ack Seq [%u] nbr [%s]", zlog_debug("Queueing [Hello] Ack Seq [%u] nbr [%s]",
nbr->recv_sequence_number, inet_ntoa(nbr->src)); nbr->recv_sequence_number, inet_ntoa(nbr->src));
/* Add packet to the top of the interface output queue*/ /* Add packet to the top of the interface output queue*/
eigrp_fifo_push_head(nbr->ei->obuf, ep); eigrp_fifo_push_head(nbr->ei->obuf, ep);
/* Hook thread to write packet. */ /* Hook thread to write packet. */
if (nbr->ei->on_write_q == 0) if (nbr->ei->on_write_q == 0)
{ {
listnode_add(nbr->ei->eigrp->oi_write_q, nbr->ei); listnode_add(nbr->ei->eigrp->oi_write_q, nbr->ei);
nbr->ei->on_write_q = 1; nbr->ei->on_write_q = 1;
} }
if (nbr->ei->eigrp->t_write == NULL) if (nbr->ei->eigrp->t_write == NULL)
nbr->ei->eigrp->t_write = 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);
} }
} }
@ -734,9 +739,9 @@ eigrp_hello_send (struct eigrp_interface *ei, u_char flags, struct in_addr *nbr_
struct eigrp_packet *ep = NULL; struct eigrp_packet *ep = NULL;
/* If this is passive interface, do not send EIGRP Hello. /* If this is passive interface, do not send EIGRP Hello.
if ((EIGRP_IF_PASSIVE_STATUS (ei) == EIGRP_IF_PASSIVE) || if ((EIGRP_IF_PASSIVE_STATUS (ei) == EIGRP_IF_PASSIVE) ||
(ei->type != EIGRP_IFTYPE_NBMA)) (ei->type != EIGRP_IFTYPE_NBMA))
return; return;
*/ */
if (IS_DEBUG_EIGRP_PACKET(0, SEND)) 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) if(flags & EIGRP_HELLO_GRACEFUL_SHUTDOWN)
{ {
ei->eigrp->t_write = 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 else
{ {
ei->eigrp->t_write = ei->eigrp->t_write =
thread_add_write(master, eigrp_write, ei->eigrp, ei->eigrp->fd); thread_add_write(master, eigrp_write, ei->eigrp, ei->eigrp->fd);
} }
} }
} }
} }

View File

@ -106,9 +106,9 @@ eigrp_if_new (struct eigrp *eigrp, struct interface *ifp, struct prefix *p)
/* Initialize lists */ /* Initialize lists */
for (i = 0; i < EIGRP_FILTER_MAX; i++) for (i = 0; i < EIGRP_FILTER_MAX; i++)
{ {
ei->list[i] = NULL; ei->list[i] = NULL;
ei->prefix[i] = NULL; ei->prefix[i] = NULL;
ei->routemap[i] = NULL; ei->routemap[i] = NULL;
} }
return ei; return ei;
@ -138,7 +138,6 @@ eigrp_if_table_lookup (struct interface *ifp, struct prefix *prefix)
int int
eigrp_if_delete_hook (struct interface *ifp) eigrp_if_delete_hook (struct interface *ifp)
{ {
struct route_node *rn; struct route_node *rn;
route_table_finish (IF_OIFS (ifp)); route_table_finish (IF_OIFS (ifp));
@ -222,7 +221,6 @@ eigrp_new_if_params (void)
UNSET_IF_PARAM (eip, auth_keychain); UNSET_IF_PARAM (eip, auth_keychain);
UNSET_IF_PARAM (eip, auth_type); UNSET_IF_PARAM (eip, auth_type);
return eip; return eip;
} }
@ -401,7 +399,7 @@ eigrp_if_set_multicast (struct eigrp_interface *ei)
/* The interface should belong to the EIGRP-all-routers group. */ /* The interface should belong to the EIGRP-all-routers group. */
if (!EI_MEMBER_CHECK (ei, MEMBER_ALLROUTERS) if (!EI_MEMBER_CHECK (ei, MEMBER_ALLROUTERS)
&& (eigrp_if_add_allspfrouters (ei->eigrp, ei->address, && (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. */ /* Set the flag only if the system call to join succeeded. */
EI_MEMBER_JOINED (ei, MEMBER_ALLROUTERS); 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 */ /* Only actually drop if this is the last reference */
if (EI_MEMBER_COUNT (ei, MEMBER_ALLROUTERS) == 1) if (EI_MEMBER_COUNT (ei, MEMBER_ALLROUTERS) == 1)
eigrp_if_drop_allspfrouters (ei->eigrp, ei->address, 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 /* Unset the flag regardless of whether the system call to leave
the group succeeded, since it's much safer to assume that the group succeeded, since it's much safer to assume that
we are not a member. */ we are not a member. */
EI_MEMBER_LEFT (ei, MEMBER_ALLROUTERS); 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 /* Simulate down/up on the interface. This is needed, for example, when
the MTU changes. */ the MTU changes. */
void void
eigrp_if_reset (struct interface *ifp) eigrp_if_reset (struct interface *ifp)
{ {
@ -504,7 +502,7 @@ eigrp_if_reset (struct interface *ifp)
struct eigrp_interface * struct eigrp_interface *
eigrp_if_lookup_by_local_addr (struct eigrp *eigrp, struct interface *ifp, eigrp_if_lookup_by_local_addr (struct eigrp *eigrp, struct interface *ifp,
struct in_addr address) struct in_addr address)
{ {
struct listnode *node; struct listnode *node;
struct eigrp_interface *ei; struct eigrp_interface *ei;
@ -535,26 +533,26 @@ eigrp_if_lookup_by_local_addr (struct eigrp *eigrp, struct interface *ifp,
struct eigrp_interface * struct eigrp_interface *
eigrp_if_lookup_by_name (struct eigrp *eigrp, const char *if_name) eigrp_if_lookup_by_name (struct eigrp *eigrp, const char *if_name)
{ {
struct eigrp_interface *ei; struct eigrp_interface *ei;
struct listnode *node; struct listnode *node;
/* iterate over all eigrp interfaces */ /* iterate over all eigrp interfaces */
for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei)) for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
{ {
/* compare int name with eigrp interface's name */ /* compare int name with eigrp interface's name */
if(strcmp(ei->ifp->name, if_name) == 0) if(strcmp(ei->ifp->name, if_name) == 0)
{ {
return ei; return ei;
} }
} }
return NULL; return NULL;
} }
/* determine receiving interface by ifp and source address */ /* determine receiving interface by ifp and source address */
struct eigrp_interface * struct eigrp_interface *
eigrp_if_lookup_recv_if (struct eigrp *eigrp, struct in_addr src, eigrp_if_lookup_recv_if (struct eigrp *eigrp, struct in_addr src,
struct interface *ifp) struct interface *ifp)
{ {
struct route_node *rn; struct route_node *rn;
struct prefix_ipv4 addr; struct prefix_ipv4 addr;
@ -577,7 +575,7 @@ eigrp_if_lookup_recv_if (struct eigrp *eigrp, struct in_addr src,
continue; continue;
if (prefix_match (CONNECTED_PREFIX (ei->connected), if (prefix_match (CONNECTED_PREFIX (ei->connected),
(struct prefix *) &addr)) (struct prefix *) &addr))
{ {
if ((match == NULL) if ((match == NULL)
|| (match->address->prefixlen < ei->address->prefixlen)) || (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; u_int64_t temp_bandwidth = (256ull * 10000000) / bandwidth;
temp_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; return (u_int32_t) temp_bandwidth;
} }
u_int32_t u_int32_t
@ -606,7 +603,7 @@ eigrp_scaled_to_bandwidth (u_int32_t scaled)
u_int64_t temp_scaled = scaled * (256ull * 10000000); u_int64_t temp_scaled = scaled * (256ull * 10000000);
temp_scaled = 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; return (u_int32_t) temp_scaled;
} }

View File

@ -91,9 +91,9 @@ struct zebra_privs_t eigrpd_privs =
/* EIGRPd options. */ /* EIGRPd options. */
struct option longopts[] = struct option longopts[] =
{ {
{ 0 } { 0 }
}; };
/* Master of threads. */ /* Master of threads. */
struct thread_master *master; struct thread_master *master;
@ -211,11 +211,11 @@ main (int argc, char **argv, char **envp)
prefix_list_delete_hook (eigrp_distribute_update_all); prefix_list_delete_hook (eigrp_distribute_update_all);
/*eigrp_route_map_init(); /*eigrp_route_map_init();
route_map_add_hook (eigrp_rmap_update); route_map_add_hook (eigrp_rmap_update);
route_map_delete_hook (eigrp_rmap_update);*/ route_map_delete_hook (eigrp_rmap_update);*/
/*if_rmap_init (EIGRP_NODE); /*if_rmap_init (EIGRP_NODE);
if_rmap_hook_add (eigrp_if_rmap_update); if_rmap_hook_add (eigrp_if_rmap_update);
if_rmap_hook_delete (eigrp_if_rmap_update);*/ if_rmap_hook_delete (eigrp_if_rmap_update);*/
/* Distribute list install. */ /* Distribute list install. */
distribute_list_init (EIGRP_NODE); distribute_list_init (EIGRP_NODE);

View File

@ -67,7 +67,6 @@ eigrp_nbr_new (struct eigrp_interface *ei)
nbr->ei = ei; nbr->ei = ei;
/* Set default values. */ /* Set default values. */
eigrp_nbr_state_set (nbr, EIGRP_NEIGHBOR_DOWN); eigrp_nbr_state_set (nbr, EIGRP_NEIGHBOR_DOWN);
return nbr; return nbr;
@ -89,9 +88,9 @@ eigrp_nbr_add (struct eigrp_interface *ei, struct eigrp_header *eigrph,
nbr = eigrp_nbr_new (ei); nbr = eigrp_nbr_new (ei);
nbr->src = iph->ip_src; nbr->src = iph->ip_src;
// if (IS_DEBUG_EIGRP_EVENT) // if (IS_DEBUG_EIGRP_EVENT)
// zlog_debug("NSM[%s:%s]: start", IF_NAME (nbr->oi), // zlog_debug("NSM[%s:%s]: start", IF_NAME (nbr->oi),
// inet_ntoa (nbr->router_id)); // inet_ntoa (nbr->router_id));
return nbr; return nbr;
} }
@ -149,8 +148,8 @@ eigrp_nbr_lookup_by_addr (struct eigrp_interface *ei, struct in_addr *addr)
/** /**
* @fn eigrp_nbr_lookup_by_addr_process * @fn eigrp_nbr_lookup_by_addr_process
* *
* @param[in] eigrp EIGRP process * @param[in] eigrp EIGRP process
* @param[in] nbr_addr Address of neighbor * @param[in] nbr_addr Address of neighbor
* *
* @return void * @return void
* *
@ -161,25 +160,25 @@ eigrp_nbr_lookup_by_addr (struct eigrp_interface *ei, struct in_addr *addr)
struct eigrp_neighbor * struct eigrp_neighbor *
eigrp_nbr_lookup_by_addr_process (struct eigrp *eigrp, struct in_addr nbr_addr) eigrp_nbr_lookup_by_addr_process (struct eigrp *eigrp, struct in_addr nbr_addr)
{ {
struct eigrp_interface *ei; struct eigrp_interface *ei;
struct listnode *node, *node2, *nnode2; struct listnode *node, *node2, *nnode2;
struct eigrp_neighbor *nbr; struct eigrp_neighbor *nbr;
/* iterate over all eigrp interfaces */ /* iterate over all eigrp interfaces */
for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei)) for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
{ {
/* iterate over all neighbors on eigrp interface */ /* iterate over all neighbors on eigrp interface */
for (ALL_LIST_ELEMENTS (ei->nbrs, node2, nnode2, nbr)) for (ALL_LIST_ELEMENTS (ei->nbrs, node2, nnode2, nbr))
{ {
/* compare if neighbor address is same as arg address */ /* compare if neighbor address is same as arg address */
if (nbr->src.s_addr == nbr_addr.s_addr) if (nbr->src.s_addr == nbr_addr.s_addr)
{ {
return nbr; return nbr;
} }
} }
} }
return NULL; return NULL;
} }
@ -187,7 +186,6 @@ eigrp_nbr_lookup_by_addr_process (struct eigrp *eigrp, struct in_addr nbr_addr)
void void
eigrp_nbr_delete (struct eigrp_neighbor *nbr) eigrp_nbr_delete (struct eigrp_neighbor *nbr)
{ {
eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_DOWN); eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_DOWN);
eigrp_topology_neighbor_down(nbr->ei->eigrp, nbr); eigrp_topology_neighbor_down(nbr->ei->eigrp, nbr);
@ -209,7 +207,7 @@ holddown_timer_expired (struct thread *thread)
nbr = THREAD_ARG (thread); nbr = THREAD_ARG (thread);
zlog_info ("Neighbor %s (%s) is down: holding time expired", 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; nbr->state = EIGRP_NEIGHBOR_DOWN;
eigrp_nbr_delete (nbr); eigrp_nbr_delete (nbr);
@ -225,7 +223,6 @@ eigrp_nbr_state_get (struct eigrp_neighbor *nbr)
void void
eigrp_nbr_state_set (struct eigrp_neighbor *nbr, u_char state) eigrp_nbr_state_set (struct eigrp_neighbor *nbr, u_char state)
{ {
nbr->state = state; nbr->state = state;
if (eigrp_nbr_state_get(nbr) == EIGRP_NEIGHBOR_DOWN) if (eigrp_nbr_state_get(nbr) == EIGRP_NEIGHBOR_DOWN)
@ -251,7 +248,7 @@ eigrp_nbr_state_set (struct eigrp_neighbor *nbr, u_char state)
if (nbr->multicast_queue) if (nbr->multicast_queue)
eigrp_fifo_free (nbr->multicast_queue); eigrp_fifo_free (nbr->multicast_queue);
if (nbr->retrans_queue) if (nbr->retrans_queue)
eigrp_fifo_free (nbr->retrans_queue); eigrp_fifo_free (nbr->retrans_queue);
/* in with the new */ /* in with the new */
nbr->retrans_queue = eigrp_fifo_new (); nbr->retrans_queue = eigrp_fifo_new ();
@ -291,56 +288,55 @@ eigrp_nbr_state_update (struct eigrp_neighbor *nbr)
{ {
case EIGRP_NEIGHBOR_DOWN: case EIGRP_NEIGHBOR_DOWN:
{ {
/*Start Hold Down Timer for neighbor*/ /*Start Hold Down Timer for neighbor*/
// THREAD_OFF(nbr->t_holddown); // THREAD_OFF(nbr->t_holddown);
// THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired, // THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired,
// nbr, nbr->v_holddown); // nbr, nbr->v_holddown);
break; break;
} }
case EIGRP_NEIGHBOR_PENDING: case EIGRP_NEIGHBOR_PENDING:
{ {
/*Reset Hold Down Timer for neighbor*/ /*Reset Hold Down Timer for neighbor*/
THREAD_OFF(nbr->t_holddown); THREAD_OFF(nbr->t_holddown);
THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired, nbr, THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired, nbr,
nbr->v_holddown); nbr->v_holddown);
break; break;
} }
case EIGRP_NEIGHBOR_UP: case EIGRP_NEIGHBOR_UP:
{ {
/*Reset Hold Down Timer for neighbor*/ /*Reset Hold Down Timer for neighbor*/
THREAD_OFF(nbr->t_holddown); THREAD_OFF(nbr->t_holddown);
THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired, nbr, THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired, nbr,
nbr->v_holddown); nbr->v_holddown);
break; break;
} }
} }
} }
int eigrp_nbr_count_get(void){ 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; if (eigrp == NULL)
struct listnode *node, *node2, *nnode2; {
struct eigrp_neighbor *nbr; zlog_debug("EIGRP Routing Process not enabled");
struct eigrp *eigrp = eigrp_lookup(); return 0;
u_int32_t counter; }
if (eigrp == NULL) counter=0;
{ for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, iface))
zlog_debug("EIGRP Routing Process not enabled"); {
return 0; for (ALL_LIST_ELEMENTS(iface->nbrs, node2, nnode2, nbr))
} {
if (nbr->state == EIGRP_NEIGHBOR_UP){
counter=0; counter++;
for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, iface)) }
{ }
for (ALL_LIST_ELEMENTS(iface->nbrs, node2, nnode2, nbr)) }
{ return counter;
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) void eigrp_nbr_hard_restart(struct eigrp_neighbor *nbr, struct vty *vty)
{ {
if(nbr == NULL) if(nbr == NULL)
{ {
zlog_err("Nbr Hard restart: Neighbor not specified."); zlog_err("Nbr Hard restart: Neighbor not specified.");
return; return;
} }
zlog_debug ("Neighbor %s (%s) is down: manually cleared", zlog_debug ("Neighbor %s (%s) is down: manually cleared",
inet_ntoa (nbr->src), inet_ntoa (nbr->src),
ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT)); ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT));
if(vty != NULL) if(vty != NULL)
{ {
vty_time_print (vty, 0); vty_time_print (vty, 0);
vty_out (vty, "Neighbor %s (%s) is down: manually cleared%s", vty_out (vty, "Neighbor %s (%s) is down: manually cleared%s",
inet_ntoa (nbr->src), inet_ntoa (nbr->src),
ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT), ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT),
VTY_NEWLINE); VTY_NEWLINE);
} }
/* send Hello with Peer Termination TLV */ /* send Hello with Peer Termination TLV */
eigrp_hello_send(nbr->ei, EIGRP_HELLO_GRACEFUL_SHUTDOWN_NBR, &(nbr->src)); eigrp_hello_send(nbr->ei, EIGRP_HELLO_GRACEFUL_SHUTDOWN_NBR, &(nbr->src));
/* set neighbor to DOWN */ /* set neighbor to DOWN */
nbr->state = EIGRP_NEIGHBOR_DOWN; nbr->state = EIGRP_NEIGHBOR_DOWN;
/* delete neighbor */ /* delete neighbor */
eigrp_nbr_delete (nbr); eigrp_nbr_delete (nbr);
} }

View File

@ -63,7 +63,7 @@ eigrp_sock_init(void)
if (eigrpd_privs.change(ZPRIVS_RAISE)) if (eigrpd_privs.change(ZPRIVS_RAISE))
zlog_err("eigrp_sock_init: could not raise privs, %s", 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); eigrp_sock = socket(AF_INET, SOCK_RAW, IPPROTO_EIGRPIGP);
if (eigrp_sock < 0) if (eigrp_sock < 0)
@ -71,7 +71,7 @@ eigrp_sock_init(void)
int save_errno = errno; int save_errno = errno;
if (eigrpd_privs.change(ZPRIVS_LOWER)) if (eigrpd_privs.change(ZPRIVS_LOWER))
zlog_err("eigrp_sock_init: could not lower privs, %s", 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)); zlog_err("eigrp_read_sock_init: socket: %s", safe_strerror(save_errno));
exit(1); exit(1);
} }
@ -84,9 +84,9 @@ eigrp_sock_init(void)
int save_errno = errno; int save_errno = errno;
if (eigrpd_privs.change(ZPRIVS_LOWER)) if (eigrpd_privs.change(ZPRIVS_LOWER))
zlog_err("eigrp_sock_init: could not lower privs, %s", 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, 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) #elif defined (IPTOS_PREC_INTERNETCONTROL)
@ -97,10 +97,10 @@ eigrp_sock_init(void)
{ {
int save_errno = errno; int save_errno = errno;
if ( eigrpd_privs.change (ZPRIVS_LOWER) ) if ( eigrpd_privs.change (ZPRIVS_LOWER) )
zlog_err ("eigrpd_sock_init: could not lower privs, %s", zlog_err ("eigrpd_sock_init: could not lower privs, %s",
safe_strerror (errno) ); safe_strerror (errno) );
zlog_warn ("can't set sockopt IP_TOS %d to socket %d: %s", 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. */ close (eigrp_sock); /* Prevent sd leak. */
return ret; return ret;
} }
@ -117,7 +117,7 @@ eigrp_sock_init(void)
if (eigrpd_privs.change(ZPRIVS_LOWER)) if (eigrpd_privs.change(ZPRIVS_LOWER))
{ {
zlog_err("eigrp_sock_init: could not lower privs, %s", zlog_err("eigrp_sock_init: could not lower privs, %s",
safe_strerror(errno)); safe_strerror(errno));
} }
return eigrp_sock; return eigrp_sock;
@ -132,6 +132,7 @@ eigrp_adjust_sndbuflen(struct eigrp * eigrp, unsigned int buflen)
return; return;
if (eigrpd_privs.change(ZPRIVS_RAISE)) if (eigrpd_privs.change(ZPRIVS_RAISE))
zlog_err("%s: could not raise privs, %s", __func__, safe_strerror(errno)); zlog_err("%s: could not raise privs, %s", __func__, safe_strerror(errno));
/* Now we try to set SO_SNDBUF to what our caller has requested /* Now we try to set SO_SNDBUF to what our caller has requested
* (the MTU of a newly added interface). However, if the OS has * (the MTU of a newly added interface). However, if the OS has
* truncated the actual buffer size to somewhat less size, try * truncated the actual buffer size to somewhat less size, try
@ -143,7 +144,7 @@ eigrp_adjust_sndbuflen(struct eigrp * eigrp, unsigned int buflen)
newbuflen = getsockopt_so_sendbuf(eigrp->fd); newbuflen = getsockopt_so_sendbuf(eigrp->fd);
if (newbuflen < 0 || newbuflen < (int) buflen) if (newbuflen < 0 || newbuflen < (int) buflen)
zlog_warn("%s: tried to set SO_SNDBUF to %u, but got %d", __func__, buflen, zlog_warn("%s: tried to set SO_SNDBUF to %u, but got %d", __func__, buflen,
newbuflen); newbuflen);
if (newbuflen >= 0) if (newbuflen >= 0)
eigrp->maxsndbuflen = (unsigned int) newbuflen; eigrp->maxsndbuflen = (unsigned int) newbuflen;
else 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); ret = setsockopt(top->fd, IPPROTO_IP, IP_MULTICAST_TTL, (void *) &val, len);
if (ret < 0) if (ret < 0)
zlog_warn("can't setsockopt IP_MULTICAST_TTL (1) for fd %d: %s", top->fd, 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); ret = setsockopt_ipv4_multicast_if(top->fd, p->u.prefix4, ifindex);
if (ret < 0) if (ret < 0)
zlog_warn("can't setsockopt IP_MULTICAST_IF (fd %d, addr %s, " zlog_warn("can't setsockopt IP_MULTICAST_IF (fd %d, addr %s, "
"ifindex %u): %s", top->fd, inet_ntoa(p->u.prefix4), ifindex, "ifindex %u): %s", top->fd, inet_ntoa(p->u.prefix4), ifindex,
safe_strerror(errno)); safe_strerror(errno));
return ret; return ret;
} }
@ -186,7 +187,7 @@ eigrp_if_ipmulticast(struct eigrp *top, struct prefix *p, unsigned int ifindex)
/* Join to the EIGRP multicast group. */ /* Join to the EIGRP multicast group. */
int int
eigrp_if_add_allspfrouters(struct eigrp *top, struct prefix *p, eigrp_if_add_allspfrouters(struct eigrp *top, struct prefix *p,
unsigned int ifindex) unsigned int ifindex)
{ {
int ret; int ret;
@ -194,19 +195,19 @@ eigrp_if_add_allspfrouters(struct eigrp *top, struct prefix *p,
htonl(EIGRP_MULTICAST_ADDRESS), ifindex); htonl(EIGRP_MULTICAST_ADDRESS), ifindex);
if (ret < 0) if (ret < 0)
zlog_warn("can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, " zlog_warn("can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, "
"ifindex %u, AllSPFRouters): %s; perhaps a kernel limit " "ifindex %u, AllSPFRouters): %s; perhaps a kernel limit "
"on # of multicast group memberships has been exceeded?", top->fd, "on # of multicast group memberships has been exceeded?", top->fd,
inet_ntoa(p->u.prefix4), ifindex, safe_strerror(errno)); inet_ntoa(p->u.prefix4), ifindex, safe_strerror(errno));
else else
zlog_debug("interface %s [%u] join EIGRP Multicast group.", zlog_debug("interface %s [%u] join EIGRP Multicast group.",
inet_ntoa(p->u.prefix4), ifindex); inet_ntoa(p->u.prefix4), ifindex);
return ret; return ret;
} }
int int
eigrp_if_drop_allspfrouters(struct eigrp *top, struct prefix *p, eigrp_if_drop_allspfrouters(struct eigrp *top, struct prefix *p,
unsigned int ifindex) unsigned int ifindex)
{ {
int ret; int ret;
@ -214,11 +215,11 @@ eigrp_if_drop_allspfrouters(struct eigrp *top, struct prefix *p,
htonl(EIGRP_MULTICAST_ADDRESS), ifindex); htonl(EIGRP_MULTICAST_ADDRESS), ifindex);
if (ret < 0) if (ret < 0)
zlog_warn("can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %s, " zlog_warn("can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %s, "
"ifindex %u, AllSPFRouters): %s", top->fd, inet_ntoa(p->u.prefix4), "ifindex %u, AllSPFRouters): %s", top->fd, inet_ntoa(p->u.prefix4),
ifindex, safe_strerror(errno)); ifindex, safe_strerror(errno));
else else
zlog_debug("interface %s [%u] leave EIGRP Multicast group.", zlog_debug("interface %s [%u] leave EIGRP Multicast group.",
inet_ntoa(p->u.prefix4), ifindex); inet_ntoa(p->u.prefix4), ifindex);
return ret; return ret;
} }
@ -230,7 +231,6 @@ eigrp_network_set(struct eigrp *eigrp, struct prefix_ipv4 *p)
struct interface *ifp; struct interface *ifp;
struct listnode *node; struct listnode *node;
zlog_debug ("A");
rn = route_node_get(eigrp->networks, (struct prefix *) p); rn = route_node_get(eigrp->networks, (struct prefix *) p);
if (rn->info) if (rn->info)
{ {
@ -243,10 +243,9 @@ eigrp_network_set(struct eigrp *eigrp, struct prefix_ipv4 *p)
PREFIX_COPY_IPV4(pref,p); PREFIX_COPY_IPV4(pref,p);
rn->info = (void *) pref; rn->info = (void *) pref;
zlog_debug ("B");
/* Schedule Router ID Update. */ /* Schedule Router ID Update. */
// if (eigrp->router_id == 0) // if (eigrp->router_id == 0)
// eigrp_router_id_update(eigrp); // eigrp_router_id_update(eigrp);
/* Run network config now. */ /* Run network config now. */
/* Get target interface. */ /* Get target interface. */
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp)) for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
@ -269,13 +268,13 @@ eigrp_network_match_iface(const struct connected *co, const struct prefix *net)
static void static void
eigrp_network_run_interface(struct eigrp *eigrp, struct prefix *p, eigrp_network_run_interface(struct eigrp *eigrp, struct prefix *p,
struct interface *ifp) struct interface *ifp)
{ {
struct listnode *cnode; struct listnode *cnode;
struct connected *co; struct connected *co;
/* if interface prefix is match specified prefix, /* 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)) 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 */ /* update network type as interface flag */
/* If network type is specified previously, /* If network type is specified previously,
skip network type setting. */ skip network type setting. */
ei->type = IF_DEF_PARAMS (ifp)->type; ei->type = IF_DEF_PARAMS (ifp)->type;
/* if router_id is not configured, dont bring up /* 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); route_unlock_node (rn);
if (!IPV4_ADDR_SAME (&pref->u.prefix4, &p->prefix)) if (!IPV4_ADDR_SAME (&pref->u.prefix4, &p->prefix))
return 0; return 0;
prefix_ipv4_free(rn->info); prefix_ipv4_free(rn->info);
rn->info = NULL; 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)) if (eigrp_network_match_iface(co, &rn->p))
{ {
zlog_debug("eigrp_network_unset()2");
found = 1; found = 1;
route_unlock_node(rn); route_unlock_node(rn);
break; break;
@ -404,7 +402,7 @@ eigrp_calculate_metrics(struct eigrp *eigrp, struct eigrp_metrics *metric)
temp_metric += (eigrp->k_values[0] * metric->bandwith); temp_metric += (eigrp->k_values[0] * metric->bandwith);
if (eigrp->k_values[1]) if (eigrp->k_values[1])
temp_metric += ((eigrp->k_values[1] * metric->bandwith) temp_metric += ((eigrp->k_values[1] * metric->bandwith)
/ (256 - metric->load)); / (256 - metric->load));
if (eigrp->k_values[2]) if (eigrp->k_values[2])
temp_metric += (eigrp->k_values[2] * metric->delay); temp_metric += (eigrp->k_values[2] * metric->delay);
if (eigrp->k_values[3] && !eigrp->k_values[4]) 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); temp_metric *= (eigrp->k_values[4] / metric->reliability);
if (eigrp->k_values[3] && eigrp->k_values[4]) if (eigrp->k_values[3] && eigrp->k_values[4])
temp_metric *= ((eigrp->k_values[4] / metric->reliability) temp_metric *= ((eigrp->k_values[4] / metric->reliability)
+ eigrp->k_values[3]); + eigrp->k_values[3]);
if (temp_metric <= EIGRP_MAX_METRIC) if (temp_metric <= EIGRP_MAX_METRIC)
return (u_int32_t) temp_metric; return (u_int32_t) temp_metric;
@ -423,24 +421,24 @@ eigrp_calculate_metrics(struct eigrp *eigrp, struct eigrp_metrics *metric)
u_int32_t u_int32_t
eigrp_calculate_total_metrics(struct eigrp *eigrp, eigrp_calculate_total_metrics(struct eigrp *eigrp,
struct eigrp_neighbor_entry *entry) struct eigrp_neighbor_entry *entry)
{ {
entry->total_metric = entry->reported_metric; entry->total_metric = entry->reported_metric;
u_int64_t temp_delay = (u_int64_t) entry->total_metric.delay 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 = 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); u_int32_t bw = EIGRP_IF_PARAM (entry->ei,bandwidth);
entry->total_metric.bandwith = 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); return eigrp_calculate_metrics(eigrp, &entry->total_metric);
} }
u_char u_char
eigrp_metrics_is_same(struct eigrp_metrics *metric1, eigrp_metrics_is_same(struct eigrp_metrics *metric1,
struct eigrp_metrics *metric2) struct eigrp_metrics *metric2)
{ {
if ((metric1->bandwith == metric2->bandwith) if ((metric1->bandwith == metric2->bandwith)
&& (metric1->delay == metric2->delay) && (metric1->delay == metric2->delay)
@ -452,12 +450,12 @@ eigrp_metrics_is_same(struct eigrp_metrics *metric1,
&& (metric1->mtu[2] == metric2->mtu[2])) && (metric1->mtu[2] == metric2->mtu[2]))
return 1; return 1;
return 0; // if different return 0; // if different
} }
void void
eigrp_external_routes_refresh (struct eigrp *eigrp, int type) eigrp_external_routes_refresh (struct eigrp *eigrp, int type)
{ {
} }

View File

@ -59,18 +59,19 @@
/* Packet Type String. */ /* Packet Type String. */
const struct message eigrp_packet_type_str[] = const struct message eigrp_packet_type_str[] =
{ {
{ EIGRP_OPC_UPDATE, "Update" }, { EIGRP_OPC_UPDATE, "Update"},
{ EIGRP_OPC_REQUEST, "Request" }, { EIGRP_OPC_REQUEST, "Request"},
{ EIGRP_OPC_QUERY, "Query" }, { EIGRP_OPC_QUERY, "Query"},
{ EIGRP_OPC_REPLY, "Reply" }, { EIGRP_OPC_REPLY, "Reply"},
{ EIGRP_OPC_HELLO, "Hello" }, { EIGRP_OPC_HELLO, "Hello"},
{ EIGRP_OPC_IPXSAP, "IPX-SAP" }, { EIGRP_OPC_IPXSAP, "IPX-SAP"},
{ EIGRP_OPC_PROBE, "Probe" }, { EIGRP_OPC_PROBE, "Probe"},
{ EIGRP_OPC_ACK, "Ack" }, { EIGRP_OPC_ACK, "Ack"},
{ EIGRP_OPC_SIAQUERY, "SIAQuery" }, { EIGRP_OPC_SIAQUERY, "SIAQuery"},
{ EIGRP_OPC_SIAREPLY, "SIAReply" }, { EIGRP_OPC_SIAREPLY, "SIAReply"},
}; };
const size_t eigrp_packet_type_str_max = sizeof(eigrp_packet_type_str) / const size_t eigrp_packet_type_str_max = sizeof(eigrp_packet_type_str) /
sizeof(eigrp_packet_type_str[0]); sizeof(eigrp_packet_type_str[0]);
@ -79,10 +80,9 @@ static unsigned char zeropad[16] = {0};
/* Forward function reference*/ /* Forward function reference*/
static struct stream * eigrp_recv_packet (int, struct interface **, struct stream *); static struct stream * eigrp_recv_packet (int, struct interface **, struct stream *);
static int eigrp_verify_header (struct stream *, struct eigrp_interface *, struct ip *, 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_check_network_mask (struct eigrp_interface *, struct in_addr);
static int eigrp_retrans_count_exceeded(struct eigrp_packet *ep, struct eigrp_neighbor *nbr) static int eigrp_retrans_count_exceeded(struct eigrp_packet *ep, struct eigrp_neighbor *nbr)
{ {
return 1; return 1;
@ -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, ibuf, EIGRP_MD5_BASIC_COMPUTE);
MD5Update(&ctx, key->string, strlen(key->string)); MD5Update(&ctx, key->string, strlen(key->string));
if(strlen(key->string) < 16) 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) 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, ibuf, EIGRP_MD5_BASIC_COMPUTE);
MD5Update(&ctx, key->string, strlen(key->string)); MD5Update(&ctx, key->string, strlen(key->string));
if(strlen(key->string) < 16) 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)) if(backup_end > (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE))
{ {
MD5Update(&ctx, ibuf + (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));
} }
} }
MD5Final(digest, &ctx); MD5Final(digest, &ctx);
/* Append md5 digest to the end of the stream. */ /* Append md5 digest to the end of the stream. */
memcpy(auth_TLV->digest,digest,EIGRP_AUTH_TYPE_MD5_LEN); memcpy(auth_TLV->digest,digest,EIGRP_AUTH_TYPE_MD5_LEN);
@ -159,7 +158,8 @@ eigrp_make_md5_digest (struct eigrp_interface *ei, struct stream *s, u_char flag
} }
int int
eigrp_check_md5_digest (struct stream *s, struct TLV_MD5_Authentication_Type *authTLV,struct eigrp_neighbor *nbr, u_char flags) eigrp_check_md5_digest (struct stream *s,
struct TLV_MD5_Authentication_Type *authTLV,struct eigrp_neighbor *nbr, u_char flags)
{ {
MD5_CTX ctx; MD5_CTX ctx;
unsigned char digest[EIGRP_AUTH_TYPE_MD5_LEN]; unsigned char digest[EIGRP_AUTH_TYPE_MD5_LEN];
@ -170,7 +170,6 @@ eigrp_check_md5_digest (struct stream *s, struct TLV_MD5_Authentication_Type *au
struct TLV_MD5_Authentication_Type *auth_TLV; struct TLV_MD5_Authentication_Type *auth_TLV;
struct eigrp_header *eigrph; struct eigrp_header *eigrph;
if (nbr && ntohl(nbr->crypt_seqnum) > ntohl(authTLV->key_sequence)) if (nbr && ntohl(nbr->crypt_seqnum) > ntohl(authTLV->key_sequence))
{ {
zlog_warn ("interface %s: eigrp_check_md5 bad sequence %d (expect %d)", zlog_warn ("interface %s: eigrp_check_md5 bad sequence %d (expect %d)",
@ -190,8 +189,8 @@ eigrp_check_md5_digest (struct stream *s, struct TLV_MD5_Authentication_Type *au
backup_end = s->endp; backup_end = s->endp;
keychain = keychain_lookup(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain); keychain = keychain_lookup(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain);
if(keychain) if(keychain)
key = key_lookup_for_send(keychain); key = key_lookup_for_send(keychain);
memset(&ctx, 0, sizeof(ctx)); memset(&ctx, 0, sizeof(ctx));
MD5Init(&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)) if(backup_end > (EIGRP_HEADER_LEN + EIGRP_AUTH_MD5_TLV_SIZE))
{ {
MD5Update(&ctx, ibuf + (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 else
{ {
zlog_warn ("interface %s: eigrp_check_md5 checksum mismatch", zlog_warn ("interface %s: eigrp_check_md5 checksum mismatch",
IF_NAME (nbr->ei)); IF_NAME (nbr->ei));
return 0; return 0;
} }
@ -245,65 +244,67 @@ eigrp_check_md5_digest (struct stream *s, struct TLV_MD5_Authentication_Type *au
int int
eigrp_make_sha256_digest (struct eigrp_interface *ei, struct stream *s, u_char flags) eigrp_make_sha256_digest (struct eigrp_interface *ei, struct stream *s, u_char flags)
{ {
struct key *key = NULL; struct key *key = NULL;
struct keychain *keychain; struct keychain *keychain;
char *source_ip; char *source_ip;
unsigned char digest[EIGRP_AUTH_TYPE_SHA256_LEN]; unsigned char digest[EIGRP_AUTH_TYPE_SHA256_LEN];
unsigned char buffer[1 + PLAINTEXT_LENGTH + 45 + 1] = { 0 }; unsigned char buffer[1 + PLAINTEXT_LENGTH + 45 + 1] = { 0 };
HMAC_SHA256_CTX ctx; HMAC_SHA256_CTX ctx;
void *ibuf; void *ibuf;
size_t backup_get, backup_end; size_t backup_get, backup_end;
struct TLV_SHA256_Authentication_Type *auth_TLV; struct TLV_SHA256_Authentication_Type *auth_TLV;
ibuf = s->data; ibuf = s->data;
backup_end = s->endp; backup_end = s->endp;
backup_get = s->getp; backup_get = s->getp;
auth_TLV = eigrp_authTLV_SHA256_new (); auth_TLV = eigrp_authTLV_SHA256_new ();
stream_set_getp(s,EIGRP_HEADER_LEN); stream_set_getp(s,EIGRP_HEADER_LEN);
stream_get(auth_TLV,s,EIGRP_AUTH_SHA256_TLV_SIZE); stream_get(auth_TLV,s,EIGRP_AUTH_SHA256_TLV_SIZE);
stream_set_getp(s, backup_get); stream_set_getp(s, backup_get);
keychain = keychain_lookup(IF_DEF_PARAMS (ei->ifp)->auth_keychain); keychain = keychain_lookup(IF_DEF_PARAMS (ei->ifp)->auth_keychain);
if(keychain) if(keychain)
key = key_lookup_for_send(keychain); key = key_lookup_for_send(keychain);
// saved_len[index] = strnzcpyn(saved_key[index], key, // saved_len[index] = strnzcpyn(saved_key[index], key,
// PLAINTEXT_LENGTH + 1); // PLAINTEXT_LENGTH + 1);
source_ip = calloc(16, sizeof(char)); source_ip = calloc(16, sizeof(char));
inet_ntop(AF_INET, &ei->address->u.prefix4, source_ip, 16); inet_ntop(AF_INET, &ei->address->u.prefix4, source_ip, 16);
memset(&ctx, 0, sizeof(ctx)); memset(&ctx, 0, sizeof(ctx));
buffer[0] = '\n'; buffer[0] = '\n';
memcpy(buffer + 1, key, strlen (key->string)); memcpy(buffer + 1, key, strlen (key->string));
memcpy(buffer + 1 + strlen(key->string), source_ip, strlen(source_ip)); 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_Init(&ctx, buffer, 1 + strlen (key->string) + strlen(source_ip));
HMAC__SHA256_Update(&ctx, ibuf, strlen(ibuf)); HMAC__SHA256_Update(&ctx, ibuf, strlen(ibuf));
HMAC__SHA256_Final(digest, &ctx); HMAC__SHA256_Final(digest, &ctx);
/* Put hmac-sha256 digest to it's place */ /* Put hmac-sha256 digest to it's place */
memcpy(auth_TLV->digest,digest,EIGRP_AUTH_TYPE_SHA256_LEN); memcpy(auth_TLV->digest,digest,EIGRP_AUTH_TYPE_SHA256_LEN);
stream_set_endp(s,EIGRP_HEADER_LEN); stream_set_endp(s,EIGRP_HEADER_LEN);
stream_put(s,auth_TLV,EIGRP_AUTH_SHA256_TLV_SIZE); stream_put(s,auth_TLV,EIGRP_AUTH_SHA256_TLV_SIZE);
stream_set_endp(s, backup_end); stream_set_endp(s, backup_end);
eigrp_authTLV_SHA256_free(auth_TLV); eigrp_authTLV_SHA256_free(auth_TLV);
free(source_ip); free(source_ip);
return EIGRP_AUTH_TYPE_SHA256_LEN; return EIGRP_AUTH_TYPE_SHA256_LEN;
} }
int int
eigrp_check_sha256_digest (struct stream *s, struct TLV_SHA256_Authentication_Type *authTLV,struct eigrp_neighbor *nbr, u_char flags) eigrp_check_sha256_digest (struct stream *s,
struct TLV_SHA256_Authentication_Type *authTLV,
struct eigrp_neighbor *nbr, u_char flags)
{ {
return 1; return 1;
} }
/* /*
* eigrp_packet_dump * eigrp_packet_dump
* *
@ -313,31 +314,10 @@ eigrp_check_sha256_digest (struct stream *s, struct TLV_SHA256_Authentication_Ty
static void static void
eigrp_packet_dump (struct stream *s) eigrp_packet_dump (struct stream *s)
{ {
// not yet... // not yet...
return; return;
} }
/*
* Converts a 24-bit integer represented as an unsigned char[3] *value
* in network byte order into uint32_t in host byte order
*/
//static uint32_t u24_32 (const unsigned char *value)
//{
// return (value[0] << 16) + (value[1] << 8) + value[2];
//}
//
///*
// * Converts an uint32_t value in host byte order into a 24-bit integer
// * in network byte order represented by unsigned char[3] *result
// */
//static unsigned char * u32_24 (uint32_t value, unsigned char *result)
//{
// value = htonl(value & 0x00FFFFFF);
// memcpy (result, (unsigned char *) &value + 1, 3);
//
// return result;
//}
int int
eigrp_write (struct thread *thread) eigrp_write (struct thread *thread)
{ {
@ -369,7 +349,7 @@ eigrp_write (struct thread *thread)
#ifdef WANT_EIGRP_WRITE_FRAGMENT #ifdef WANT_EIGRP_WRITE_FRAGMENT
/* seed ipid static with low order bits of time */ /* seed ipid static with low order bits of time */
if (ipid == 0) if (ipid == 0)
ipid = (time(NULL) & 0xffff); ipid = (time(NULL) & 0xffff);
#endif /* WANT_EIGRP_WRITE_FRAGMENT */ #endif /* WANT_EIGRP_WRITE_FRAGMENT */
/* Get one packet from queue. */ /* Get one packet from queue. */
@ -438,15 +418,15 @@ eigrp_write (struct thread *thread)
eigrph = (struct eigrp_header *) STREAM_DATA(ep->s); eigrph = (struct eigrp_header *) STREAM_DATA(ep->s);
opcode = eigrph->opcode; opcode = eigrph->opcode;
zlog_debug("Sending [%s] to [%s] via [%s] ret [%d].", zlog_debug("Sending [%s] to [%s] via [%s] ret [%d].",
LOOKUP(eigrp_packet_type_str, opcode), inet_ntoa(ep->dst), LOOKUP(eigrp_packet_type_str, opcode), inet_ntoa(ep->dst),
IF_NAME(ei), ret); IF_NAME(ei), ret);
} }
if (ret < 0) if (ret < 0)
zlog_warn("*** sendmsg in eigrp_write failed to %s, " zlog_warn("*** sendmsg in eigrp_write failed to %s, "
"id %d, off %d, len %d, interface %s, mtu %u: %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, inet_ntoa(iph.ip_dst), iph.ip_id, iph.ip_off, iph.ip_len, ei->ifp->name,
ei->ifp->mtu, safe_strerror(errno)); ei->ifp->mtu, safe_strerror(errno));
/* Show debug sending packet. */ /* Show debug sending packet. */
if (IS_DEBUG_EIGRP_TRANSMIT(0, SEND) && (IS_DEBUG_EIGRP_TRANSMIT(0, PACKET_DETAIL))) 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 /* 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); iph = (struct ip *)STREAM_DATA(ibuf);
//Substract IPv4 header size from EIGRP Packet itself //Substract IPv4 header size from EIGRP Packet itself
if(iph->ip_v == 4) if(iph->ip_v == 4)
length = (iph->ip_len) - 20U; length = (iph->ip_len) - 20U;
/* IP Header dump. */ /* IP Header dump. */
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV) && IS_DEBUG_EIGRP_TRANSMIT(0, PACKET_DETAIL)) if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV) && IS_DEBUG_EIGRP_TRANSMIT(0, PACKET_DETAIL))
eigrp_ip_header_dump(iph); eigrp_ip_header_dump(iph);
/* Note that sockopt_iphdrincl_swab_systoh was called in eigrp_recv_packet. */ /* Note that sockopt_iphdrincl_swab_systoh was called in eigrp_recv_packet. */
if (ifp == NULL) if (ifp == NULL)
{ {
struct connected *c; struct connected *c;
/* Handle cases where the platform does not support retrieving the ifindex, /* Handle cases where the platform does not support retrieving the ifindex,
and also platforms (such as Solaris 8) that claim to support ifindex and also platforms (such as Solaris 8) that claim to support ifindex
retrieval but do not. */ retrieval but do not. */
c = if_lookup_address((void *)&iph->ip_src, AF_INET, VRF_DEFAULT); c = if_lookup_address((void *)&iph->ip_src, AF_INET, VRF_DEFAULT);
if (c == NULL) if (c == NULL)
return 0; return 0;
ifp = c->ifp; ifp = c->ifp;
} }
@ -547,13 +527,13 @@ eigrp_read (struct thread *thread)
(IPV4_ADDR_SAME(&iph->ip_src.s_addr, &ei->address->u.prefix4))) (IPV4_ADDR_SAME(&iph->ip_src.s_addr, &ei->address->u.prefix4)))
{ {
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)) if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
zlog_debug("eigrp_read[%s]: Dropping self-originated packet", zlog_debug("eigrp_read[%s]: Dropping self-originated packet",
inet_ntoa(iph->ip_src)); inet_ntoa(iph->ip_src));
return 0; return 0;
} }
/* Advance from IP header to EIGRP header (iph->ip_hl has been verified /* 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)); stream_forward_getp(ibuf, (iph->ip_hl * 4));
eigrph = (struct eigrp_header *) STREAM_PNT(ibuf); 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)) if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV) && IS_DEBUG_EIGRP_TRANSMIT(0, PACKET_DETAIL))
eigrp_header_dump(eigrph); eigrp_header_dump(eigrph);
// if (MSG_OK != eigrp_packet_examin(eigrph, stream_get_endp(ibuf) - stream_get_getp(ibuf))) // if (MSG_OK != eigrp_packet_examin(eigrph, stream_get_endp(ibuf) - stream_get_getp(ibuf)))
// return -1; // return -1;
/* Now it is safe to access all fields of EIGRP packet header. */ /* Now it is safe to access all fields of EIGRP packet header. */
/* associate packet with eigrp interface */ /* associate packet with eigrp interface */
ei = eigrp_if_lookup_recv_if(eigrp, iph->ip_src, ifp); 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 /* 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 after the checks below are passed. These checks in turn access the
fields of unverified "eigrph" structure for their own purposes and fields of unverified "eigrph" structure for their own purposes and
must remain very accurate in doing this. must remain very accurate in doing this.
*/ */
if (!ei) if (!ei)
return 0; return 0;
@ -582,22 +562,22 @@ eigrp_read (struct thread *thread)
char buf[3][INET_ADDRSTRLEN]; char buf[3][INET_ADDRSTRLEN];
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)) if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
zlog_debug("ignoring packet from router %s sent to %s, " zlog_debug("ignoring packet from router %s sent to %s, "
"received on a passive interface, %s", "received on a passive interface, %s",
inet_ntop(AF_INET, &eigrph->vrid, buf[0], sizeof(buf[0])), 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, &iph->ip_dst, buf[1], sizeof(buf[1])),
inet_ntop(AF_INET, &ei->address->u.prefix4, inet_ntop(AF_INET, &ei->address->u.prefix4,
buf[2], sizeof(buf[2]))); buf[2], sizeof(buf[2])));
if (iph->ip_dst.s_addr == htonl(EIGRP_MULTICAST_ADDRESS)) if (iph->ip_dst.s_addr == htonl(EIGRP_MULTICAST_ADDRESS))
{ {
/* Try to fix multicast membership. /* Try to fix multicast membership.
* Some OS:es may have problems in this area, * Some OS:es may have problems in this area,
* make sure it is removed. * make sure it is removed.
*/ */
EI_MEMBER_JOINED(ei, MEMBER_ALLROUTERS); EI_MEMBER_JOINED(ei, MEMBER_ALLROUTERS);
eigrp_if_set_multicast(ei); eigrp_if_set_multicast(ei);
} }
return 0; return 0;
} }
@ -608,7 +588,7 @@ eigrp_read (struct thread *thread)
{ {
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)) if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
zlog_warn("Packet from [%s] received on wrong link %s", 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; return 0;
} }
@ -628,13 +608,12 @@ eigrp_read (struct thread *thread)
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)) if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
zlog_debug("Received [%s] length [%u] via [%s] src [%s] dst [%s]", zlog_debug("Received [%s] length [%u] via [%s] src [%s] dst [%s]",
LOOKUP(eigrp_packet_type_str, opcode), length, LOOKUP(eigrp_packet_type_str, opcode), length,
IF_NAME(ei), inet_ntoa(iph->ip_src), inet_ntoa(iph->ip_dst)); 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. */ /* Read rest of the packet and call each sort of packet routine. */
stream_forward_getp(ibuf, EIGRP_HEADER_LEN); stream_forward_getp(ibuf, EIGRP_HEADER_LEN);
/* New testing block of code for handling Acks */ /* New testing block of code for handling Acks */
if (ntohl(eigrph->ack) != 0) if (ntohl(eigrph->ack) != 0)
{ {
@ -643,42 +622,43 @@ eigrp_read (struct thread *thread)
/* neighbor must be valid, eigrp_nbr_get creates if none existed */ /* neighbor must be valid, eigrp_nbr_get creates if none existed */
assert(nbr); assert(nbr);
struct eigrp_packet *ep; struct eigrp_packet *ep;
ep = eigrp_fifo_tail(nbr->retrans_queue); ep = eigrp_fifo_tail(nbr->retrans_queue);
if (ep != NULL) if (ep != NULL)
{ {
if (ntohl(eigrph->ack) == ep->sequence_number) if (ntohl(eigrph->ack) == ep->sequence_number)
{ {
if((nbr->state == EIGRP_NEIGHBOR_PENDING) && (ntohl(eigrph->ack) == nbr->init_sequence_number)) if((nbr->state == EIGRP_NEIGHBOR_PENDING) &&
{ (ntohl(eigrph->ack) == nbr->init_sequence_number))
eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_UP); {
zlog_info("Neighbor adjacency became full"); eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_UP);
nbr->init_sequence_number = 0; zlog_info("Neighbor adjacency became full");
nbr->recv_sequence_number = ntohl(eigrph->sequence); nbr->init_sequence_number = 0;
eigrp_update_send_EOT(nbr); nbr->recv_sequence_number = ntohl(eigrph->sequence);
} eigrp_update_send_EOT(nbr);
ep = eigrp_fifo_pop_tail(nbr->retrans_queue); }
/*eigrp_packet_free(ep);*/ ep = eigrp_fifo_pop_tail(nbr->retrans_queue);
if (nbr->retrans_queue->count > 0) /*eigrp_packet_free(ep);*/
if (nbr->retrans_queue->count > 0)
{ {
eigrp_send_packet_reliably(nbr); eigrp_send_packet_reliably(nbr);
} }
} }
} }
ep = eigrp_fifo_tail(nbr->multicast_queue); ep = eigrp_fifo_tail(nbr->multicast_queue);
if (ep != NULL) if (ep != NULL)
{ {
if (ntohl(eigrph->ack) == ep->sequence_number) if (ntohl(eigrph->ack) == ep->sequence_number)
{ {
ep = eigrp_fifo_pop_tail(nbr->multicast_queue); ep = eigrp_fifo_pop_tail(nbr->multicast_queue);
eigrp_packet_free(ep); eigrp_packet_free(ep);
if (nbr->multicast_queue->count > 0) if (nbr->multicast_queue->count > 0)
{ {
eigrp_send_packet_reliably(nbr); eigrp_send_packet_reliably(nbr);
} }
} }
} }
} }
@ -710,7 +690,7 @@ eigrp_read (struct thread *thread)
break; break;
default: default:
zlog_warn("interface %s: EIGRP packet header type %d unsupported", zlog_warn("interface %s: EIGRP packet header type %d unsupported",
IF_NAME(ei), opcode); IF_NAME(ei), opcode);
break; 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 */ if ((unsigned int) ret < sizeof(iph)) /* ret must be > 0 now */
{ {
zlog_warn("eigrp_recv_packet: discarding runt packet of length %d " 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; return NULL;
} }
/* Note that there should not be alignment problems with this assignment /* 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); iph = (struct ip *) STREAM_DATA(ibuf);
sockopt_iphdrincl_swab_systoh(iph); sockopt_iphdrincl_swab_systoh(iph);
@ -789,7 +769,7 @@ eigrp_recv_packet (int fd, struct interface **ifp, struct stream *ibuf)
if (ret != ip_len) if (ret != ip_len)
{ {
zlog_warn("eigrp_recv_packet read length mismatch: ip_len is %d, " 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; return NULL;
} }
@ -867,7 +847,7 @@ eigrp_send_packet_reliably (struct eigrp_neighbor *nbr)
/*Start retransmission timer*/ /*Start retransmission timer*/
THREAD_TIMER_ON(master, ep->t_retrans_timer, eigrp_unack_packet_retrans, 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*/ /*Increment sequence number counter*/
nbr->ei->eigrp->sequence_number++; nbr->ei->eigrp->sequence_number++;
@ -880,14 +860,14 @@ eigrp_send_packet_reliably (struct eigrp_neighbor *nbr)
} }
if (nbr->ei->eigrp->t_write == NULL) if (nbr->ei->eigrp->t_write == NULL)
nbr->ei->eigrp->t_write = 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 */ /* Calculate EIGRP checksum */
void void
eigrp_packet_checksum (struct eigrp_interface *ei, struct stream *s, eigrp_packet_checksum (struct eigrp_interface *ei, struct stream *s,
u_int16_t length) u_int16_t length)
{ {
struct eigrp_header *eigrph; struct eigrp_header *eigrph;
@ -900,7 +880,7 @@ eigrp_packet_checksum (struct eigrp_interface *ei, struct stream *s,
/* Make EIGRP header. */ /* Make EIGRP header. */
void void
eigrp_packet_header_init (int type, struct eigrp_interface *ei, struct stream *s, 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; 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->ASNumber = htons(ei->eigrp->AS);
eigrph->ack = htonl(ack); eigrph->ack = htonl(ack);
eigrph->sequence = htonl(sequence); eigrph->sequence = htonl(sequence);
// if(flags == EIGRP_INIT_FLAG) // if(flags == EIGRP_INIT_FLAG)
// eigrph->sequence = htonl(3); // eigrph->sequence = htonl(3);
eigrph->flags = htonl(flags); eigrph->flags = htonl(flags);
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)) if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
zlog_debug("Packet Header Init Seq [%u] Ack [%u]", 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); stream_forward_endp(s, EIGRP_HEADER_LEN);
} }
@ -1007,27 +987,26 @@ eigrp_packet_free (struct eigrp_packet *ep)
/* EIGRP Header verification. */ /* EIGRP Header verification. */
static int static int
eigrp_verify_header (struct stream *ibuf, struct eigrp_interface *ei, eigrp_verify_header (struct stream *ibuf, struct eigrp_interface *ei,
struct ip *iph, struct eigrp_header *eigrph) struct ip *iph, struct eigrp_header *eigrph)
{ {
/* Check network mask, Silently discarded. */ /* Check network mask, Silently discarded. */
if (!eigrp_check_network_mask(ei, iph->ip_src)) if (!eigrp_check_network_mask(ei, iph->ip_src))
{ {
zlog_warn("interface %s: eigrp_read network address is not same [%s]", 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; return -1;
} }
// //
// /* Check authentication. The function handles logging actions, where required. */ // /* Check authentication. The function handles logging actions, where required. */
// if (! eigrp_check_auth(ei, eigrph)) // if (! eigrp_check_auth(ei, eigrph))
// return -1; // return -1;
return 0; return 0;
} }
/* Unbound socket will accept any Raw IP packets if proto is matched. /* 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 To prevent it, compare src IP address and i/f address with masking
i/f network mask. */ i/f network mask. */
static int static int
eigrp_check_network_mask (struct eigrp_interface *ei, struct in_addr ip_src) 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) if (nbr->ei->eigrp->t_write == NULL)
nbr->ei->eigrp->t_write = 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; return 0;
@ -1108,7 +1087,7 @@ eigrp_unack_multicast_packet_retrans (struct thread *thread)
/*Start retransmission timer*/ /*Start retransmission timer*/
ep->t_retrans_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. */ /* Hook thread to write packet. */
if (nbr->ei->on_write_q == 0) 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) if (nbr->ei->eigrp->t_write == NULL)
nbr->ei->eigrp->t_write = 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; return 0;
@ -1189,22 +1168,22 @@ eigrp_read_ipv4_tlv (struct stream *s)
{ {
tlv->destination_part[0] = stream_getc(s); tlv->destination_part[0] = stream_getc(s);
tlv->destination.s_addr = (tlv->destination_part[0]); tlv->destination.s_addr = (tlv->destination_part[0]);
} }
else if (tlv->prefix_length > 8 && tlv->prefix_length <= 16) else if (tlv->prefix_length > 8 && tlv->prefix_length <= 16)
{ {
tlv->destination_part[0] = stream_getc(s); tlv->destination_part[0] = stream_getc(s);
tlv->destination_part[1] = stream_getc(s); tlv->destination_part[1] = stream_getc(s);
tlv->destination.s_addr = ((tlv->destination_part[1] << 8) 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) else if (tlv->prefix_length > 16 && tlv->prefix_length <= 24)
{ {
tlv->destination_part[0] = stream_getc(s); tlv->destination_part[0] = stream_getc(s);
tlv->destination_part[1] = stream_getc(s); tlv->destination_part[1] = stream_getc(s);
tlv->destination_part[2] = stream_getc(s); tlv->destination_part[2] = stream_getc(s);
tlv->destination.s_addr = ((tlv->destination_part[2] << 16) tlv->destination.s_addr = ((tlv->destination_part[2] << 16) +
+ (tlv->destination_part[1] << 8) + tlv->destination_part[0]); (tlv->destination_part[1] << 8) +
tlv->destination_part[0]);
} }
else if (tlv->prefix_length > 24 && tlv->prefix_length <= 32) else if (tlv->prefix_length > 24 && tlv->prefix_length <= 32)
{ {
@ -1212,16 +1191,17 @@ eigrp_read_ipv4_tlv (struct stream *s)
tlv->destination_part[1] = stream_getc(s); tlv->destination_part[1] = stream_getc(s);
tlv->destination_part[2] = stream_getc(s); tlv->destination_part[2] = stream_getc(s);
tlv->destination_part[3] = stream_getc(s); tlv->destination_part[3] = stream_getc(s);
tlv->destination.s_addr = ((tlv->destination_part[3] << 24) tlv->destination.s_addr = ((tlv->destination_part[3] << 24) +
+ (tlv->destination_part[2] << 16) + (tlv->destination_part[1] << 8) (tlv->destination_part[2] << 16) +
+ tlv->destination_part[0]); (tlv->destination_part[1] << 8) +
tlv->destination_part[0]);
} }
return tlv; return tlv;
} }
u_int16_t u_int16_t
eigrp_add_internalTLV_to_stream (struct stream *s, eigrp_add_internalTLV_to_stream (struct stream *s,
struct eigrp_prefix_entry *pe) struct eigrp_prefix_entry *pe)
{ {
u_int16_t length; u_int16_t length;
@ -1295,7 +1275,7 @@ eigrp_add_internalTLV_to_stream (struct stream *s,
u_int16_t u_int16_t
eigrp_add_authTLV_MD5_to_stream (struct stream *s, eigrp_add_authTLV_MD5_to_stream (struct stream *s,
struct eigrp_interface *ei) struct eigrp_interface *ei)
{ {
struct key *key; struct key *key;
struct keychain *keychain; struct keychain *keychain;
@ -1310,7 +1290,6 @@ eigrp_add_authTLV_MD5_to_stream (struct stream *s,
authTLV->key_sequence = 0; authTLV->key_sequence = 0;
memset(authTLV->Nullpad,0,sizeof(authTLV->Nullpad)); memset(authTLV->Nullpad,0,sizeof(authTLV->Nullpad));
keychain = keychain_lookup(IF_DEF_PARAMS (ei->ifp)->auth_keychain); keychain = keychain_lookup(IF_DEF_PARAMS (ei->ifp)->auth_keychain);
if(keychain) if(keychain)
key = key_lookup_for_send(keychain); key = key_lookup_for_send(keychain);
@ -1338,7 +1317,7 @@ eigrp_add_authTLV_MD5_to_stream (struct stream *s,
u_int16_t u_int16_t
eigrp_add_authTLV_SHA256_to_stream (struct stream *s, eigrp_add_authTLV_SHA256_to_stream (struct stream *s,
struct eigrp_interface *ei) struct eigrp_interface *ei)
{ {
struct key *key; struct key *key;
struct keychain *keychain; struct keychain *keychain;
@ -1353,7 +1332,6 @@ eigrp_add_authTLV_SHA256_to_stream (struct stream *s,
authTLV->key_sequence = 0; authTLV->key_sequence = 0;
memset(authTLV->Nullpad,0,sizeof(authTLV->Nullpad)); memset(authTLV->Nullpad,0,sizeof(authTLV->Nullpad));
keychain = keychain_lookup(IF_DEF_PARAMS (ei->ifp)->auth_keychain); keychain = keychain_lookup(IF_DEF_PARAMS (ei->ifp)->auth_keychain);
if(keychain) if(keychain)
key = key_lookup_for_send(keychain); key = key_lookup_for_send(keychain);
@ -1377,7 +1355,6 @@ eigrp_add_authTLV_SHA256_to_stream (struct stream *s,
eigrp_authTLV_SHA256_free(authTLV); eigrp_authTLV_SHA256_free(authTLV);
return 0; return 0;
} }
struct TLV_MD5_Authentication_Type * struct TLV_MD5_Authentication_Type *
@ -1393,7 +1370,6 @@ eigrp_authTLV_MD5_new ()
void void
eigrp_authTLV_MD5_free (struct TLV_MD5_Authentication_Type *authTLV) eigrp_authTLV_MD5_free (struct TLV_MD5_Authentication_Type *authTLV)
{ {
XFREE(MTYPE_EIGRP_AUTH_TLV, authTLV); XFREE(MTYPE_EIGRP_AUTH_TLV, authTLV);
} }
@ -1410,11 +1386,9 @@ eigrp_authTLV_SHA256_new ()
void void
eigrp_authTLV_SHA256_free (struct TLV_SHA256_Authentication_Type *authTLV) eigrp_authTLV_SHA256_free (struct TLV_SHA256_Authentication_Type *authTLV)
{ {
XFREE(MTYPE_EIGRP_AUTH_SHA256_TLV, authTLV); XFREE(MTYPE_EIGRP_AUTH_SHA256_TLV, authTLV);
} }
struct TLV_IPv4_Internal_type * struct TLV_IPv4_Internal_type *
eigrp_IPv4_InternalTLV_new () eigrp_IPv4_InternalTLV_new ()
{ {
@ -1428,7 +1402,6 @@ eigrp_IPv4_InternalTLV_new ()
void void
eigrp_IPv4_InternalTLV_free (struct TLV_IPv4_Internal_type *IPv4_InternalTLV) eigrp_IPv4_InternalTLV_free (struct TLV_IPv4_Internal_type *IPv4_InternalTLV)
{ {
XFREE(MTYPE_EIGRP_IPV4_INT_TLV, IPv4_InternalTLV); XFREE(MTYPE_EIGRP_IPV4_INT_TLV, IPv4_InternalTLV);
} }

View File

@ -122,17 +122,17 @@ eigrp_query_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e
dest_addr = prefix_ipv4_new(); dest_addr = prefix_ipv4_new();
dest_addr->prefix = tlv->destination; dest_addr->prefix = tlv->destination;
dest_addr->prefixlen = tlv->prefix_length; dest_addr->prefixlen = tlv->prefix_length;
struct eigrp_prefix_entry *dest = eigrp_topology_table_lookup_ipv4( struct eigrp_prefix_entry *dest =
eigrp->topology_table, dest_addr); eigrp_topology_table_lookup_ipv4(eigrp->topology_table, dest_addr);
/* If the destination exists (it should, but one never know)*/ /* If the destination exists (it should, but one never know)*/
if (dest != NULL) if (dest != NULL)
{ {
struct eigrp_fsm_action_message *msg; struct eigrp_fsm_action_message *msg;
msg = XCALLOC(MTYPE_EIGRP_FSM_MSG, msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
sizeof(struct eigrp_fsm_action_message)); sizeof(struct eigrp_fsm_action_message));
struct eigrp_neighbor_entry *entry = eigrp_prefix_entry_lookup( struct eigrp_neighbor_entry *entry =
dest->entries, nbr); eigrp_prefix_entry_lookup(dest->entries, nbr);
msg->packet_type = EIGRP_OPC_QUERY; msg->packet_type = EIGRP_OPC_QUERY;
msg->eigrp = eigrp; msg->eigrp = eigrp;
msg->data_type = EIGRP_TLV_IPv4_INT; msg->data_type = EIGRP_TLV_IPv4_INT;
@ -168,7 +168,8 @@ eigrp_send_query (struct eigrp_interface *ei)
ei->eigrp->sequence_number, 0); ei->eigrp->sequence_number, 0);
// encode Authentication TLV, if needed // encode Authentication TLV, if needed
if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL)) if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
{ {
length += eigrp_add_authTLV_MD5_to_stream(ep->s,ei); length += eigrp_add_authTLV_MD5_to_stream(ep->s,ei);
} }
@ -181,11 +182,11 @@ eigrp_send_query (struct eigrp_interface *ei)
length += eigrp_add_internalTLV_to_stream(ep->s, pe); length += eigrp_add_internalTLV_to_stream(ep->s, pe);
for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr))
{ {
if(nbr->state == EIGRP_NEIGHBOR_UP) if(nbr->state == EIGRP_NEIGHBOR_UP)
{ {
listnode_add(pe->rij, nbr); listnode_add(pe->rij, nbr);
has_tlv = 1; has_tlv = 1;
} }
} }
} }
} }
@ -196,31 +197,32 @@ eigrp_send_query (struct eigrp_interface *ei)
return; return;
} }
if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL)) if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL))
{ {
eigrp_make_md5_digest(ei,ep->s, EIGRP_AUTH_UPDATE_FLAG); eigrp_make_md5_digest(ei,ep->s, EIGRP_AUTH_UPDATE_FLAG);
} }
/* EIGRP Checksum */ /* EIGRP Checksum */
eigrp_packet_checksum(ei, ep->s, length); eigrp_packet_checksum(ei, ep->s, length);
ep->length = length; ep->length = length;
ep->dst.s_addr = htonl(EIGRP_MULTICAST_ADDRESS); ep->dst.s_addr = htonl(EIGRP_MULTICAST_ADDRESS);
/*This ack number we await from neighbor*/ /*This ack number we await from neighbor*/
ep->sequence_number = ei->eigrp->sequence_number; ep->sequence_number = ei->eigrp->sequence_number;
for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr))
{ {
if (nbr->state == EIGRP_NEIGHBOR_UP) if (nbr->state == EIGRP_NEIGHBOR_UP)
{ {
/*Put packet to retransmission queue*/ /*Put packet to retransmission queue*/
eigrp_fifo_push_head(nbr->retrans_queue, ep); eigrp_fifo_push_head(nbr->retrans_queue, ep);
if (nbr->retrans_queue->count == 1) if (nbr->retrans_queue->count == 1)
{ {
eigrp_send_packet_reliably(nbr); eigrp_send_packet_reliably(nbr);
} }
} }
} }
} }

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -58,7 +58,7 @@
/*EIGRP SIA-QUERY read function*/ /*EIGRP SIA-QUERY read function*/
void void
eigrp_siaquery_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *eigrph, 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 eigrp_neighbor *nbr;
struct TLV_IPv4_Internal_type *tlv; 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_ipv4_new();
dest_addr->prefix = tlv->destination; dest_addr->prefix = tlv->destination;
dest_addr->prefixlen = tlv->prefix_length; dest_addr->prefixlen = tlv->prefix_length;
struct eigrp_prefix_entry *dest = eigrp_topology_table_lookup_ipv4( struct eigrp_prefix_entry *dest =
eigrp->topology_table, dest_addr); eigrp_topology_table_lookup_ipv4(eigrp->topology_table, dest_addr);
/* If the destination exists (it should, but one never know)*/ /* If the destination exists (it should, but one never know)*/
if (dest != NULL) if (dest != NULL)
{ {
struct eigrp_fsm_action_message *msg; struct eigrp_fsm_action_message *msg;
msg = XCALLOC(MTYPE_EIGRP_FSM_MSG, msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
sizeof(struct eigrp_fsm_action_message)); sizeof(struct eigrp_fsm_action_message));
struct eigrp_neighbor_entry *entry = eigrp_prefix_entry_lookup( struct eigrp_neighbor_entry *entry =
dest->entries, nbr); eigrp_prefix_entry_lookup(dest->entries, nbr);
msg->packet_type = EIGRP_OPC_SIAQUERY; msg->packet_type = EIGRP_OPC_SIAQUERY;
msg->eigrp = eigrp; msg->eigrp = eigrp;
msg->data_type = EIGRP_TLV_IPv4_INT; msg->data_type = EIGRP_TLV_IPv4_INT;
@ -116,7 +116,6 @@ eigrp_siaquery_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header
eigrp_hello_send_ack(nbr); eigrp_hello_send_ack(nbr);
} }
void void
eigrp_send_siaquery (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe) eigrp_send_siaquery (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
{ {
@ -127,38 +126,40 @@ eigrp_send_siaquery (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
/* Prepare EIGRP INIT UPDATE header */ /* Prepare EIGRP INIT UPDATE header */
eigrp_packet_header_init(EIGRP_OPC_SIAQUERY, nbr->ei, ep->s, 0, 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 // encode Authentication TLV, if needed
if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL)) if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
{ {
length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei); length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei);
} }
length += eigrp_add_internalTLV_to_stream(ep->s, pe); length += eigrp_add_internalTLV_to_stream(ep->s, pe);
if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL)) if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
{ {
eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG); eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG);
} }
/* EIGRP Checksum */ /* EIGRP Checksum */
eigrp_packet_checksum(nbr->ei, ep->s, length); eigrp_packet_checksum(nbr->ei, ep->s, length);
ep->length = length; ep->length = length;
ep->dst.s_addr = nbr->src.s_addr; ep->dst.s_addr = nbr->src.s_addr;
/*This ack number we await from neighbor*/ /*This ack number we await from neighbor*/
ep->sequence_number = nbr->ei->eigrp->sequence_number; ep->sequence_number = nbr->ei->eigrp->sequence_number;
if (nbr->state == EIGRP_NEIGHBOR_UP) if (nbr->state == EIGRP_NEIGHBOR_UP)
{ {
/*Put packet to retransmission queue*/ /*Put packet to retransmission queue*/
eigrp_fifo_push_head(nbr->retrans_queue, ep); eigrp_fifo_push_head(nbr->retrans_queue, ep);
if (nbr->retrans_queue->count == 1) if (nbr->retrans_queue->count == 1)
{ {
eigrp_send_packet_reliably(nbr); eigrp_send_packet_reliably(nbr);
} }
} }
} }

View File

@ -25,7 +25,6 @@
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#include <zebra.h> #include <zebra.h>
#include "thread.h" #include "thread.h"
@ -58,7 +57,7 @@
/*EIGRP SIA-REPLY read function*/ /*EIGRP SIA-REPLY read function*/
void void
eigrp_siareply_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *eigrph, 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 eigrp_neighbor *nbr;
struct TLV_IPv4_Internal_type *tlv; 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_ipv4_new();
dest_addr->prefix = tlv->destination; dest_addr->prefix = tlv->destination;
dest_addr->prefixlen = tlv->prefix_length; dest_addr->prefixlen = tlv->prefix_length;
struct eigrp_prefix_entry *dest = eigrp_topology_table_lookup_ipv4( struct eigrp_prefix_entry *dest =
eigrp->topology_table, dest_addr); eigrp_topology_table_lookup_ipv4(eigrp->topology_table, dest_addr);
/* If the destination exists (it should, but one never know)*/ /* If the destination exists (it should, but one never know)*/
if (dest != NULL) if (dest != NULL)
{ {
struct eigrp_fsm_action_message *msg; struct eigrp_fsm_action_message *msg;
msg = XCALLOC(MTYPE_EIGRP_FSM_MSG, msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
sizeof(struct eigrp_fsm_action_message)); sizeof(struct eigrp_fsm_action_message));
struct eigrp_neighbor_entry *entry = eigrp_prefix_entry_lookup( struct eigrp_neighbor_entry *entry =
dest->entries, nbr); eigrp_prefix_entry_lookup(dest->entries, nbr);
msg->packet_type = EIGRP_OPC_SIAQUERY; msg->packet_type = EIGRP_OPC_SIAQUERY;
msg->eigrp = eigrp; msg->eigrp = eigrp;
msg->data_type = EIGRP_TLV_IPv4_INT; msg->data_type = EIGRP_TLV_IPv4_INT;
@ -126,40 +125,42 @@ eigrp_send_siareply (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
/* Prepare EIGRP INIT UPDATE header */ /* Prepare EIGRP INIT UPDATE header */
eigrp_packet_header_init(EIGRP_OPC_SIAREPLY, nbr->ei, ep->s, 0, 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 // encode Authentication TLV, if needed
if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL)) if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
{ {
length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei); length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei);
} }
length += eigrp_add_internalTLV_to_stream(ep->s, pe); length += eigrp_add_internalTLV_to_stream(ep->s, pe);
if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL)) if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL))
{ {
eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG); eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG);
} }
/* EIGRP Checksum */ /* EIGRP Checksum */
eigrp_packet_checksum(nbr->ei, ep->s, length); eigrp_packet_checksum(nbr->ei, ep->s, length);
ep->length = length; ep->length = length;
ep->dst.s_addr = nbr->src.s_addr; ep->dst.s_addr = nbr->src.s_addr;
/*This ack number we await from neighbor*/ /*This ack number we await from neighbor*/
ep->sequence_number = nbr->ei->eigrp->sequence_number; ep->sequence_number = nbr->ei->eigrp->sequence_number;
if (nbr->state == EIGRP_NEIGHBOR_UP) if (nbr->state == EIGRP_NEIGHBOR_UP)
{ {
/*Put packet to retransmission queue*/ /*Put packet to retransmission queue*/
eigrp_fifo_push_head(nbr->retrans_queue, ep); eigrp_fifo_push_head(nbr->retrans_queue, ep);
if (nbr->retrans_queue->count == 1) if (nbr->retrans_queue->count == 1)
{ {
eigrp_send_packet_reliably(nbr); eigrp_send_packet_reliably(nbr);
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -52,17 +52,12 @@
#include "eigrpd/eigrp_fsm.h" #include "eigrpd/eigrp_fsm.h"
#include "eigrpd/eigrp_memory.h" #include "eigrpd/eigrp_memory.h"
static int static int eigrp_prefix_entry_cmp(struct eigrp_prefix_entry *, struct eigrp_prefix_entry *);
eigrp_prefix_entry_cmp(struct eigrp_prefix_entry *, struct eigrp_prefix_entry *); static void eigrp_prefix_entry_del(struct eigrp_prefix_entry *);
static void static int eigrp_neighbor_entry_cmp(struct eigrp_neighbor_entry *,
eigrp_prefix_entry_del(struct eigrp_prefix_entry *); struct eigrp_neighbor_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 * Returns linkedlist used as topology table
* cmp - assigned function for comparing topology nodes * cmp - assigned function for comparing topology nodes
* del - assigned function executed before deleting topology node by list function * del - assigned function executed before deleting topology node by list function
@ -72,9 +67,9 @@ eigrp_topology_new()
{ {
struct list* new = list_new(); struct list* new = list_new();
new->cmp = (int new->cmp = (int
(*)(void *, void *)) eigrp_prefix_entry_cmp; (*)(void *, void *)) eigrp_prefix_entry_cmp;
new->del = (void new->del = (void
(*)(void *)) eigrp_prefix_entry_del; (*)(void *)) eigrp_prefix_entry_del;
return new; return new;
} }
@ -85,7 +80,7 @@ eigrp_topology_new()
static int static int
eigrp_prefix_entry_cmp(struct eigrp_prefix_entry *node1, eigrp_prefix_entry_cmp(struct eigrp_prefix_entry *node1,
struct eigrp_prefix_entry *node2) struct eigrp_prefix_entry *node2)
{ {
if (node1->af == AF_INET) if (node1->af == AF_INET)
{ {
@ -135,7 +130,6 @@ eigrp_prefix_entry_del(struct eigrp_prefix_entry *node)
* Returns new created toplogy node * Returns new created toplogy node
* cmp - assigned function for comparing topology entry * cmp - assigned function for comparing topology entry
*/ */
struct eigrp_prefix_entry * struct eigrp_prefix_entry *
eigrp_prefix_entry_new() eigrp_prefix_entry_new()
{ {
@ -154,10 +148,9 @@ eigrp_prefix_entry_new()
/* /*
* Topology entry comparison * Topology entry comparison
*/ */
static int static int
eigrp_neighbor_entry_cmp(struct eigrp_neighbor_entry *entry1, eigrp_neighbor_entry_cmp(struct eigrp_neighbor_entry *entry1,
struct eigrp_neighbor_entry *entry2) struct eigrp_neighbor_entry *entry2)
{ {
if (entry1->distance < entry2->distance) // parameter used in list_add_sort () if (entry1->distance < entry2->distance) // parameter used in list_add_sort ()
return -1; // actually set to sort by distance return -1; // actually set to sort by distance
@ -177,7 +170,7 @@ eigrp_neighbor_entry_new()
struct eigrp_neighbor_entry *new; struct eigrp_neighbor_entry *new;
new = XCALLOC(MTYPE_EIGRP_NEIGHBOR_ENTRY, new = XCALLOC(MTYPE_EIGRP_NEIGHBOR_ENTRY,
sizeof(struct eigrp_neighbor_entry)); sizeof(struct eigrp_neighbor_entry));
new->reported_distance = EIGRP_MAX_METRIC; new->reported_distance = EIGRP_MAX_METRIC;
new->distance = EIGRP_MAX_METRIC; new->distance = EIGRP_MAX_METRIC;
@ -187,7 +180,6 @@ eigrp_neighbor_entry_new()
/* /*
* Freeing topology table list * Freeing topology table list
*/ */
void void
eigrp_topology_free(struct list *list) eigrp_topology_free(struct list *list)
{ {
@ -197,7 +189,6 @@ eigrp_topology_free(struct list *list)
/* /*
* Deleting all topology nodes in table * Deleting all topology nodes in table
*/ */
void void
eigrp_topology_cleanup(struct list *topology) eigrp_topology_cleanup(struct list *topology)
{ {
@ -209,7 +200,6 @@ eigrp_topology_cleanup(struct list *topology)
/* /*
* Adding topology node to topology table * Adding topology node to topology table
*/ */
void void
eigrp_prefix_entry_add(struct list *topology, struct eigrp_prefix_entry *node) eigrp_prefix_entry_add(struct list *topology, struct eigrp_prefix_entry *node)
{ {
@ -222,10 +212,9 @@ eigrp_prefix_entry_add(struct list *topology, struct eigrp_prefix_entry *node)
/* /*
* Adding topology entry to topology node * Adding topology entry to topology node
*/ */
void void
eigrp_neighbor_entry_add(struct eigrp_prefix_entry *node, eigrp_neighbor_entry_add(struct eigrp_prefix_entry *node,
struct eigrp_neighbor_entry *entry) struct eigrp_neighbor_entry *entry)
{ {
if (listnode_lookup(node->entries, entry) == NULL) 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 * Deleting topology node from topology table
*/ */
void void
eigrp_prefix_entry_delete(struct list *topology, eigrp_prefix_entry_delete(struct list *topology,
struct eigrp_prefix_entry *node) struct eigrp_prefix_entry *node)
{ {
struct eigrp *eigrp = eigrp_lookup (); struct eigrp *eigrp = eigrp_lookup ();
@ -263,10 +251,9 @@ eigrp_prefix_entry_delete(struct list *topology,
/* /*
* Deleting topology entry from topology node * Deleting topology entry from topology node
*/ */
void void
eigrp_neighbor_entry_delete(struct eigrp_prefix_entry *node, eigrp_neighbor_entry_delete(struct eigrp_prefix_entry *node,
struct eigrp_neighbor_entry *entry) struct eigrp_neighbor_entry *entry)
{ {
if (listnode_lookup(node->entries, entry) != NULL) 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 * Deleting all nodes from topology table
*/ */
void void
eigrp_topology_delete_all(struct list *topology) eigrp_topology_delete_all(struct list *topology)
{ {
@ -289,7 +275,6 @@ eigrp_topology_delete_all(struct list *topology)
* Return 0 if topology is not empty * Return 0 if topology is not empty
* otherwise return 1 * otherwise return 1
*/ */
unsigned int unsigned int
eigrp_topology_table_isempty(struct list *topology) eigrp_topology_table_isempty(struct list *topology)
{ {
@ -301,13 +286,12 @@ eigrp_topology_table_isempty(struct list *topology)
struct eigrp_prefix_entry * struct eigrp_prefix_entry *
eigrp_topology_table_lookup_ipv4(struct list *topology_table, eigrp_topology_table_lookup_ipv4(struct list *topology_table,
struct prefix_ipv4 * address) struct prefix_ipv4 * address)
{ {
struct eigrp_prefix_entry *data; struct eigrp_prefix_entry *data;
struct listnode *node; struct listnode *node;
for (ALL_LIST_ELEMENTS_RO(topology_table, node, data)) for (ALL_LIST_ELEMENTS_RO(topology_table, node, data))
{ {
if ((data->af == AF_INET) if ((data->af == AF_INET)
&& (data->destination_ipv4->prefix.s_addr == address->prefix.s_addr) && (data->destination_ipv4->prefix.s_addr == address->prefix.s_addr)
&& (data->destination_ipv4->prefixlen == address->prefixlen)) && (data->destination_ipv4->prefixlen == address->prefixlen))
@ -353,19 +337,19 @@ eigrp_topology_get_successor(struct eigrp_prefix_entry *table_node)
struct list * struct list *
eigrp_topology_get_successor_max(struct eigrp_prefix_entry *table_node, 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); struct list *successors = eigrp_topology_get_successor(table_node);
if (successors && successors->count > maxpaths) if (successors && successors->count > maxpaths)
{ {
do 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; return successors;
@ -401,13 +385,13 @@ eigrp_neighbor_prefixes_lookup(struct eigrp *eigrp, struct eigrp_neighbor *nbr)
/* iterate over all prefixes in topology table */ /* iterate over all prefixes in topology table */
for (ALL_LIST_ELEMENTS(eigrp->topology_table, node1, node11, prefix)) 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)) 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) 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 return 0; // No change
} }
change = change =
entry->reported_distance
< eigrp_calculate_metrics(eigrp, &int_data->metric) ? 1 :
entry->reported_distance entry->reported_distance
< eigrp_calculate_metrics(eigrp, &int_data->metric) ? 1 : > eigrp_calculate_metrics(eigrp, &int_data->metric) ? 2 : 3; // Increase : Decrease : No change
entry->reported_distance
> eigrp_calculate_metrics(eigrp, &int_data->metric) ? 2 : 3; // Increase : Decrease : No change
entry->reported_metric = int_data->metric; entry->reported_metric = int_data->metric;
entry->reported_distance = eigrp_calculate_metrics(eigrp, entry->reported_distance =
&int_data->metric); eigrp_calculate_metrics(eigrp, &int_data->metric);
entry->distance = eigrp_calculate_total_metrics(eigrp, entry); entry->distance = eigrp_calculate_total_metrics(eigrp, entry);
} }
else else
{ {
ext_data = msg->data.ipv4_ext_data; ext_data = msg->data.ipv4_ext_data;
if (eigrp_metrics_is_same (&ext_data->metric, &entry->reported_metric)) 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 * 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)) for (ALL_LIST_ELEMENTS_RO(dest->entries, node, entry))
{ {
if ((entry->distance <= (u_int64_t)(dest->distance*eigrp->variance)) && 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_SUCCESSOR_FLAG;
entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG; entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG;
@ -494,8 +478,8 @@ eigrp_topology_update_node_flags(struct eigrp_prefix_entry *dest)
else else
{ {
entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG; 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); eigrp_zebra_route_add(prefix->destination_ipv4, successors);
for (ALL_LIST_ELEMENTS_RO (successors, node, entry)) 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); list_delete(successors);
} }
@ -519,7 +503,7 @@ eigrp_update_routing_table(struct eigrp_prefix_entry * prefix)
{ {
eigrp_zebra_route_delete(prefix->destination_ipv4); eigrp_zebra_route_delete(prefix->destination_ipv4);
for (ALL_LIST_ELEMENTS_RO (prefix->entries, node, entry)) 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; struct eigrp_fsm_action_message *msg;
msg = XCALLOC(MTYPE_EIGRP_FSM_MSG, msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
sizeof(struct eigrp_fsm_action_message)); sizeof(struct eigrp_fsm_action_message));
struct TLV_IPv4_Internal_type * tlv = eigrp_IPv4_InternalTLV_new(); struct TLV_IPv4_Internal_type * tlv = eigrp_IPv4_InternalTLV_new();
tlv->metric.delay = EIGRP_MAX_METRIC; tlv->metric.delay = EIGRP_MAX_METRIC;
msg->packet_type = EIGRP_OPC_UPDATE; msg->packet_type = EIGRP_OPC_UPDATE;

File diff suppressed because it is too large Load Diff

View File

@ -56,7 +56,6 @@
#include "eigrpd/eigrp_dump.h" #include "eigrpd/eigrp_dump.h"
#include "eigrpd/eigrp_const.h" #include "eigrpd/eigrp_const.h"
static int static int
config_write_network (struct vty *vty, struct eigrp *eigrp) config_write_network (struct vty *vty, struct eigrp *eigrp)
{ {
@ -119,7 +118,7 @@ config_write_interfaces (struct vty *vty, struct eigrp *eigrp)
} }
/*Separate this EIGRP interface configuration from the others*/ /*Separate this EIGRP interface configuration from the others*/
vty_out (vty, "!%s", VTY_NEWLINE); vty_out (vty, "!%s", VTY_NEWLINE);
} }
return 0; return 0;
@ -168,8 +167,8 @@ config_write_eigrp_router (struct vty *vty, struct eigrp *eigrp)
{ {
struct in_addr router_id_static; struct in_addr router_id_static;
router_id_static.s_addr = htonl(eigrp->router_id_static); router_id_static.s_addr = htonl(eigrp->router_id_static);
vty_out (vty, " eigrp router-id %s%s", vty_out (vty, " eigrp router-id %s%s",
inet_ntoa (router_id_static), VTY_NEWLINE); inet_ntoa (router_id_static), VTY_NEWLINE);
} }
/* Network area print. */ /* Network area print. */
@ -185,11 +184,11 @@ config_write_eigrp_router (struct vty *vty, struct eigrp *eigrp)
} }
DEFUN_NOSH (router_eigrp, DEFUN_NOSH (router_eigrp,
router_eigrp_cmd, router_eigrp_cmd,
"router eigrp (1-65535)", "router eigrp (1-65535)",
"Enable a routing process\n" "Enable a routing process\n"
"Start EIGRP configuration\n" "Start EIGRP configuration\n"
"AS Number to use\n") "AS Number to use\n")
{ {
struct eigrp *eigrp = eigrp_get (argv[2]->arg); struct eigrp *eigrp = eigrp_get (argv[2]->arg);
VTY_PUSH_CONTEXT(EIGRP_NODE, eigrp); VTY_PUSH_CONTEXT(EIGRP_NODE, eigrp);
@ -197,7 +196,6 @@ DEFUN_NOSH (router_eigrp,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (no_router_eigrp, DEFUN (no_router_eigrp,
no_router_eigrp_cmd, no_router_eigrp_cmd,
"no router eigrp (1-65535)", "no router eigrp (1-65535)",
@ -337,7 +335,7 @@ DEFUN (eigrp_network,
"Enable routing on an IP network\n" "Enable routing on an IP network\n"
"EIGRP network prefix\n") "EIGRP network prefix\n")
{ {
VTY_DECLVAR_CONTEXT(eigrp, eigrp) VTY_DECLVAR_CONTEXT(eigrp, eigrp);
struct prefix_ipv4 p; struct prefix_ipv4 p;
int ret; int ret;
@ -418,22 +416,22 @@ DEFUN (show_ip_eigrp_topology,
eigrp = eigrp_lookup (); eigrp = eigrp_lookup ();
if (eigrp == NULL) if (eigrp == NULL)
{ {
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE); vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
show_ip_eigrp_topology_header (vty, eigrp); show_ip_eigrp_topology_header (vty, eigrp);
for (ALL_LIST_ELEMENTS (eigrp->topology_table, node, nnode, tn)) for (ALL_LIST_ELEMENTS (eigrp->topology_table, node, nnode, tn))
{ {
show_ip_eigrp_prefix_entry (vty,tn); show_ip_eigrp_prefix_entry (vty,tn);
for (ALL_LIST_ELEMENTS (tn->entries, node2, nnode2, te)) for (ALL_LIST_ELEMENTS (tn->entries, node2, nnode2, te))
{ {
if (((te->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG) == EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)|| 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)) ((te->flags & EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG) == EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG))
show_ip_eigrp_neighbor_entry (vty, eigrp, te); show_ip_eigrp_neighbor_entry (vty, eigrp, te);
} }
} }
return CMD_SUCCESS; return CMD_SUCCESS;
@ -507,36 +505,36 @@ DEFUN (show_ip_eigrp_interfaces,
if (argc !=3) if (argc !=3)
{ {
show_ip_eigrp_interface_header (vty, eigrp); show_ip_eigrp_interface_header (vty, eigrp);
} }
int idx = 0; int idx = 0;
for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei)) for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
{ {
if (argv_find (argv, argc, "detail", &idx)) if (argv_find (argv, argc, "detail", &idx))
{ {
show_ip_eigrp_interface_header (vty, eigrp); show_ip_eigrp_interface_header (vty, eigrp);
} }
show_ip_eigrp_interface_sub (vty, eigrp, ei); show_ip_eigrp_interface_sub (vty, eigrp, ei);
idx = 0; idx = 0;
if (argv_find (argv, argc, "detail", &idx)) if (argv_find (argv, argc, "detail", &idx))
{ {
show_ip_eigrp_interface_detail (vty, eigrp, ei); show_ip_eigrp_interface_detail (vty, eigrp, ei);
} }
} }
return CMD_SUCCESS; return CMD_SUCCESS;
} }
ALIAS (show_ip_eigrp_interfaces, ALIAS (show_ip_eigrp_interfaces,
show_ip_eigrp_interfaces_detail_cmd, show_ip_eigrp_interfaces_detail_cmd,
"show ip eigrp interfaces <" INT_TYPES_CMD_STR ">", "show ip eigrp interfaces <" INT_TYPES_CMD_STR ">",
SHOW_STR SHOW_STR
IP_STR IP_STR
"IP-EIGRP show commands\n" "IP-EIGRP show commands\n"
"IP-EIGRP interfaces\n" "IP-EIGRP interfaces\n"
INT_TYPES_DESC) INT_TYPES_DESC)
DEFUN (show_ip_eigrp_neighbors, DEFUN (show_ip_eigrp_neighbors,
show_ip_eigrp_neighbors_cmd, show_ip_eigrp_neighbors_cmd,
@ -567,8 +565,8 @@ DEFUN (show_ip_eigrp_neighbors,
{ {
for (ALL_LIST_ELEMENTS (ei->nbrs, node2, nnode2, nbr)) for (ALL_LIST_ELEMENTS (ei->nbrs, node2, nnode2, nbr))
{ {
if (detail || (nbr->state == EIGRP_NEIGHBOR_UP)) if (detail || (nbr->state == EIGRP_NEIGHBOR_UP))
show_ip_eigrp_neighbor_sub (vty, nbr, detail); show_ip_eigrp_neighbor_sub (vty, nbr, detail);
} }
} }
@ -576,13 +574,13 @@ DEFUN (show_ip_eigrp_neighbors,
} }
ALIAS (show_ip_eigrp_neighbors, ALIAS (show_ip_eigrp_neighbors,
show_ip_eigrp_neighbors_detail_cmd, show_ip_eigrp_neighbors_detail_cmd,
"show ip eigrp neighbors <" INT_TYPES_CMD_STR ">", "show ip eigrp neighbors <" INT_TYPES_CMD_STR ">",
SHOW_STR SHOW_STR
IP_STR IP_STR
"IP-EIGRP show commands\n" "IP-EIGRP show commands\n"
"IP-EIGRP neighbors\n" "IP-EIGRP neighbors\n"
INT_TYPES_DESC) INT_TYPES_DESC)
DEFUN (eigrp_if_delay, DEFUN (eigrp_if_delay,
eigrp_if_delay_cmd, eigrp_if_delay_cmd,
@ -691,8 +689,8 @@ DEFUN (no_eigrp_if_bandwidth,
{ {
for (ALL_LIST_ELEMENTS (pe->entries, node2, nnode2, ne)) for (ALL_LIST_ELEMENTS (pe->entries, node2, nnode2, ne))
{ {
if (ne->ei == ei) if (ne->ei == ei)
break; break;
/*TODO: */ /*TODO: */
} }
} }
@ -750,8 +748,6 @@ DEFUN (no_eigrp_if_ip_hellointerval,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (eigrp_if_ip_holdinterval, DEFUN (eigrp_if_ip_holdinterval,
eigrp_if_ip_holdinterval_cmd, eigrp_if_ip_holdinterval_cmd,
"ip hold-time eigrp (1-65535)", "ip hold-time eigrp (1-65535)",
@ -863,7 +859,7 @@ static int
str2auth_type (const char *str, struct interface *ifp) str2auth_type (const char *str, struct interface *ifp)
{ {
/* Sanity check. */ /* Sanity check. */
if (str == NULL) if (str == NULL)
return CMD_WARNING; return CMD_WARNING;
if(strncmp(str, "md5",3) == 0) if(strncmp(str, "md5",3) == 0)
@ -878,7 +874,6 @@ str2auth_type (const char *str, struct interface *ifp)
} }
return CMD_WARNING; return CMD_WARNING;
} }
DEFUN (eigrp_authentication_mode, DEFUN (eigrp_authentication_mode,
@ -902,10 +897,10 @@ DEFUN (eigrp_authentication_mode,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
// if(strncmp(argv[2], "md5",3)) // if(strncmp(argv[2], "md5",3))
// IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_MD5; // IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_MD5;
// else if(strncmp(argv[2], "hmac-sha-256",12)) // else if(strncmp(argv[2], "hmac-sha-256",12))
// IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_SHA256; // IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_SHA256;
return str2auth_type(argv[5]->arg, ifp); return str2auth_type(argv[5]->arg, ifp);
} }
@ -996,7 +991,8 @@ DEFUN (no_eigrp_authentication_keychain,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
if((IF_DEF_PARAMS (ifp)->auth_keychain != NULL) && (strcmp(IF_DEF_PARAMS (ifp)->auth_keychain,argv[5]->arg)==0)) if((IF_DEF_PARAMS (ifp)->auth_keychain != NULL) &&
(strcmp(IF_DEF_PARAMS (ifp)->auth_keychain,argv[5]->arg)==0))
{ {
free (IF_DEF_PARAMS (ifp)->auth_keychain); free (IF_DEF_PARAMS (ifp)->auth_keychain);
IF_DEF_PARAMS (ifp)->auth_keychain = NULL; IF_DEF_PARAMS (ifp)->auth_keychain = NULL;
@ -1007,7 +1003,6 @@ DEFUN (no_eigrp_authentication_keychain,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (eigrp_redistribute_source_metric, DEFUN (eigrp_redistribute_source_metric,
eigrp_redistribute_source_metric_cmd, eigrp_redistribute_source_metric_cmd,
"redistribute " FRR_REDIST_STR_EIGRPD "redistribute " FRR_REDIST_STR_EIGRPD
@ -1037,12 +1032,11 @@ DEFUN (eigrp_redistribute_source_metric,
return eigrp_redistribute_set (eigrp, source, metrics_from_command); return eigrp_redistribute_set (eigrp, source, metrics_from_command);
} }
DEFUN (no_eigrp_redistribute_source_metric, DEFUN (no_eigrp_redistribute_source_metric,
no_eigrp_redistribute_source_metric_cmd, no_eigrp_redistribute_source_metric_cmd,
"no redistribute " FRR_REDIST_STR_EIGRPD "no redistribute " FRR_REDIST_STR_EIGRPD
" metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)", " metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)",
"Disable\n" "Disable\n"
REDIST_STR REDIST_STR
FRR_REDIST_HELP_STR_EIGRPD FRR_REDIST_HELP_STR_EIGRPD
"Metric for redistributed routes\n" "Metric for redistributed routes\n"
@ -1091,7 +1085,6 @@ DEFUN (eigrp_variance,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (no_eigrp_variance, DEFUN (no_eigrp_variance,
no_eigrp_variance_cmd, no_eigrp_variance_cmd,
"no variance (1-128)", "no variance (1-128)",
@ -1139,7 +1132,6 @@ DEFUN (eigrp_maximum_paths,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (no_eigrp_maximum_paths, DEFUN (no_eigrp_maximum_paths,
no_eigrp_maximum_paths_cmd, no_eigrp_maximum_paths_cmd,
"no maximum-paths <1-32>", "no maximum-paths <1-32>",
@ -1527,8 +1519,6 @@ eigrp_vty_if_init (void)
/*EIGRP Summarization commands*/ /*EIGRP Summarization commands*/
install_element (INTERFACE_NODE, &eigrp_ip_summary_address_cmd); install_element (INTERFACE_NODE, &eigrp_ip_summary_address_cmd);
install_element (INTERFACE_NODE, &no_eigrp_ip_summary_address_cmd); install_element (INTERFACE_NODE, &no_eigrp_ip_summary_address_cmd);
} }
static void static void
@ -1536,7 +1526,6 @@ eigrp_vty_zebra_init (void)
{ {
install_element (EIGRP_NODE, &eigrp_redistribute_source_metric_cmd); install_element (EIGRP_NODE, &eigrp_redistribute_source_metric_cmd);
install_element (EIGRP_NODE, &no_eigrp_redistribute_source_metric_cmd); install_element (EIGRP_NODE, &no_eigrp_redistribute_source_metric_cmd);
} }
/* Install EIGRP related vty commands. */ /* Install EIGRP related vty commands. */

View File

@ -68,7 +68,7 @@ static int eigrp_interface_state_down (int, struct zclient *,
static struct interface * zebra_interface_if_lookup (struct stream *); static struct interface * zebra_interface_if_lookup (struct stream *);
static int eigrp_zebra_read_ipv4 (int , struct zclient *, 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. */ /* Zebra structure to hold current status. */
struct zclient *zclient = NULL; struct zclient *zclient = NULL;
@ -80,7 +80,7 @@ struct in_addr router_id_zebra;
/* Router-id update message from zebra. */ /* Router-id update message from zebra. */
static int static int
eigrp_router_id_update_zebra (int command, struct zclient *zclient, 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 eigrp *eigrp;
struct prefix router_id; struct prefix router_id;
@ -124,7 +124,7 @@ eigrp_zebra_init (void)
/* Zebra route add and delete treatment. */ /* Zebra route add and delete treatment. */
static int static int
eigrp_zebra_read_ipv4 (int command, struct zclient *zclient, 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 stream *s;
struct zapi_ipv4 api; struct zapi_ipv4 api;
@ -184,7 +184,7 @@ eigrp_zebra_read_ipv4 (int command, struct zclient *zclient,
/* Inteface addition message from zebra. */ /* Inteface addition message from zebra. */
static int static int
eigrp_interface_add (int command, struct zclient *zclient, zebra_size_t length, 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; struct interface *ifp;
@ -205,7 +205,7 @@ eigrp_interface_add (int command, struct zclient *zclient, zebra_size_t length,
static int static int
eigrp_interface_delete (int command, struct zclient *zclient, 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 interface *ifp;
struct stream *s; struct stream *s;
@ -224,7 +224,7 @@ eigrp_interface_delete (int command, struct zclient *zclient,
if (IS_DEBUG_EIGRP (zebra, ZEBRA_INTERFACE)) if (IS_DEBUG_EIGRP (zebra, ZEBRA_INTERFACE))
zlog_debug("Zebra: interface delete %s index %d flags %llx metric %d mtu %d", 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)) for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
if (rn->info) if (rn->info)
@ -236,7 +236,7 @@ eigrp_interface_delete (int command, struct zclient *zclient,
static int static int
eigrp_interface_address_add (int command, struct zclient *zclient, 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; struct connected *c;
@ -259,7 +259,7 @@ eigrp_interface_address_add (int command, struct zclient *zclient,
static int static int
eigrp_interface_address_delete (int command, struct zclient *zclient, 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 connected *c;
struct interface *ifp; struct interface *ifp;
@ -303,7 +303,7 @@ eigrp_interface_address_delete (int command, struct zclient *zclient,
static int static int
eigrp_interface_state_up (int command, struct zclient *zclient, 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 interface *ifp;
struct eigrp_interface *ei; struct eigrp_interface *ei;
@ -330,16 +330,16 @@ eigrp_interface_state_up (int command, struct zclient *zclient,
{ {
if (IS_DEBUG_EIGRP (zebra, ZEBRA_INTERFACE)) if (IS_DEBUG_EIGRP (zebra, ZEBRA_INTERFACE))
zlog_debug ("Zebra: Interface[%s] bandwidth change %d -> %d.", zlog_debug ("Zebra: Interface[%s] bandwidth change %d -> %d.",
ifp->name, if_tmp.bandwidth, ifp->bandwidth); ifp->name, if_tmp.bandwidth, ifp->bandwidth);
// eigrp_if_recalculate_output_cost (ifp); // eigrp_if_recalculate_output_cost (ifp);
} }
if (if_tmp.mtu != ifp->mtu) if (if_tmp.mtu != ifp->mtu)
{ {
if (IS_DEBUG_EIGRP (zebra, ZEBRA_INTERFACE)) if (IS_DEBUG_EIGRP (zebra, ZEBRA_INTERFACE))
zlog_debug ("Zebra: Interface[%s] MTU change %u -> %u.", 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. */ /* Must reset the interface (simulate down/up) when MTU changes. */
eigrp_if_reset (ifp); eigrp_if_reset (ifp);
@ -365,7 +365,7 @@ eigrp_interface_state_up (int command, struct zclient *zclient,
static int static int
eigrp_interface_state_down (int command, struct zclient *zclient, 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 interface *ifp;
struct eigrp_interface *ei; struct eigrp_interface *ei;
@ -399,8 +399,8 @@ zebra_interface_if_lookup (struct stream *s)
/* And look it up. */ /* And look it up. */
return if_lookup_by_name_len (ifname_tmp, return if_lookup_by_name_len (ifname_tmp,
strnlen (ifname_tmp, INTERFACE_NAMSIZ), strnlen (ifname_tmp, INTERFACE_NAMSIZ),
VRF_DEFAULT); VRF_DEFAULT);
} }
void void
@ -443,19 +443,19 @@ eigrp_zebra_route_add (struct prefix_ipv4 *p, struct list *successors)
/* Nexthop, ifindex, distance and metric information. */ /* Nexthop, ifindex, distance and metric information. */
for (ALL_LIST_ELEMENTS_RO (successors, node, te)) for (ALL_LIST_ELEMENTS_RO (successors, node, te))
{ {
stream_putc (s, NEXTHOP_TYPE_IPV4_IFINDEX); stream_putc (s, NEXTHOP_TYPE_IPV4_IFINDEX);
stream_put_in_addr (s, &te->adv_router->src); stream_put_in_addr (s, &te->adv_router->src);
stream_putl (s, te->ei->ifp->ifindex); stream_putl (s, te->ei->ifp->ifindex);
} }
if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE)) if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE))
{ {
char buf[2][INET_ADDRSTRLEN]; char buf[2][INET_ADDRSTRLEN];
zlog_debug ("Zebra: Route add %s/%d nexthop %s", zlog_debug ("Zebra: Route add %s/%d nexthop %s",
inet_ntop(AF_INET, &p->prefix, buf[0], sizeof (buf[0])), inet_ntop(AF_INET, &p->prefix, buf[0], sizeof (buf[0])),
p->prefixlen, p->prefixlen,
inet_ntop(AF_INET, 0 /*&p->nexthop*/, buf[1], sizeof (buf[1]))); inet_ntop(AF_INET, 0 /*&p->nexthop*/, buf[1], sizeof (buf[1])));
} }
stream_putw_at (s, 0, stream_get_endp (s)); 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); zapi_ipv4_route (ZEBRA_IPV4_ROUTE_DELETE, zclient, p, &api);
if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE)) if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE))
{ {
char buf[2][INET_ADDRSTRLEN]; char buf[2][INET_ADDRSTRLEN];
zlog_debug ("Zebra: Route del %s/%d nexthop %s", zlog_debug ("Zebra: Route del %s/%d nexthop %s",
inet_ntop (AF_INET, &p->prefix, buf[0], sizeof (buf[0])), inet_ntop (AF_INET, &p->prefix, buf[0], sizeof (buf[0])),
p->prefixlen, p->prefixlen,
inet_ntop (AF_INET, 0 /*&p->nexthop*/, buf[1], sizeof (buf[1]))); 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); eigrp_external_routes_refresh (eigrp, type);
// if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) // if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE))
// zlog_debug ("Redistribute[%s]: Refresh Type[%d], Metric[%d]", // zlog_debug ("Redistribute[%s]: Refresh Type[%d], Metric[%d]",
// eigrp_redist_string(type), // eigrp_redist_string(type),
// metric_type (eigrp, type), metric_value (eigrp, type)); // metric_type (eigrp, type), metric_value (eigrp, type));
return CMD_SUCCESS; return CMD_SUCCESS;
} }
eigrp->dmetric[type] = metric; eigrp->dmetric[type] = metric;
zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient,
AFI_IP, type, 0, VRF_DEFAULT); AFI_IP, type, 0, VRF_DEFAULT);
// if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE)) // if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE))
// zlog_debug ("Redistribute[%s]: Start Type[%d], Metric[%d]", // zlog_debug ("Redistribute[%s]: Start Type[%d], Metric[%d]",
// ospf_redist_string(type), // ospf_redist_string(type),
// metric_type (ospf, type), metric_value (ospf, type)); // metric_type (ospf, type), metric_value (ospf, type));
++eigrp->redistribute; ++eigrp->redistribute;
@ -542,14 +542,14 @@ eigrp_redistribute_unset (struct eigrp *eigrp, int type)
{ {
memset(&eigrp->dmetric[type], 0, sizeof(struct eigrp_metrics)); memset(&eigrp->dmetric[type], 0, sizeof(struct eigrp_metrics));
zclient_redistribute (ZEBRA_REDISTRIBUTE_DELETE, zclient, zclient_redistribute (ZEBRA_REDISTRIBUTE_DELETE, zclient,
AFI_IP, type, 0, VRF_DEFAULT); AFI_IP, type, 0, VRF_DEFAULT);
--eigrp->redistribute; --eigrp->redistribute;
} }
// if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE)) // if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE))
// zlog_debug ("Redistribute[%s]: Start Type[%d], Metric[%d]", // zlog_debug ("Redistribute[%s]: Start Type[%d], Metric[%d]",
// ospf_redist_string(type), // ospf_redist_string(type),
// metric_type (ospf, type), metric_value (ospf, type)); // metric_type (ospf, type), metric_value (ospf, type));
return CMD_SUCCESS; return CMD_SUCCESS;
} }

View File

@ -114,8 +114,8 @@ eigrp_router_id_update (struct eigrp *eigrp)
eigrp->router_id = router_id; eigrp->router_id = router_id;
if (router_id_old != router_id) if (router_id_old != router_id)
{ {
// if (IS_DEBUG_EIGRP_EVENT) // if (IS_DEBUG_EIGRP_EVENT)
// zlog_debug("Router-ID[NEW:%s]: Update", inet_ntoa(eigrp->router_id)); // zlog_debug("Router-ID[NEW:%s]: Update", inet_ntoa(eigrp->router_id));
/* update eigrp_interface's */ /* update eigrp_interface's */
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp)) for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
@ -137,7 +137,6 @@ eigrp_master_init ()
eigrp_om->start_time = tv.tv_sec; eigrp_om->start_time = tv.tv_sec;
} }
/* Allocate new eigrp structure. */ /* Allocate new eigrp structure. */
static struct eigrp * static struct eigrp *
eigrp_new (const char *AS) eigrp_new (const char *AS)
@ -246,10 +245,10 @@ eigrp_terminate (void)
struct listnode *node, *nnode; struct listnode *node, *nnode;
/* shutdown already in progress */ /* shutdown already in progress */
if (CHECK_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN)) if (CHECK_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN))
return; return;
SET_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN); SET_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN);
/* exit immediately if EIGRP not actually running */ /* exit immediately if EIGRP not actually running */
if (listcount(eigrp_om->eigrp) == 0) if (listcount(eigrp_om->eigrp) == 0)
@ -266,9 +265,9 @@ eigrp_finish (struct eigrp *eigrp)
eigrp_finish_final(eigrp); eigrp_finish_final(eigrp);
/* eigrp being shut-down? If so, was this the last eigrp instance? */ /* eigrp being shut-down? If so, was this the last eigrp instance? */
if (CHECK_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN) if (CHECK_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN)
&& (listcount(eigrp_om->eigrp) == 0)) && (listcount(eigrp_om->eigrp) == 0))
exit(0); exit(0);
return; return;
} }
@ -296,7 +295,6 @@ eigrp_finish_final (struct eigrp *eigrp)
eigrp_delete(eigrp); eigrp_delete(eigrp);
XFREE(MTYPE_EIGRP_TOP,eigrp); XFREE(MTYPE_EIGRP_TOP,eigrp);
} }
/*Look for existing eigrp process*/ /*Look for existing eigrp process*/