mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-11 05:04:19 +00:00
commit
ac3da8fa5b
@ -395,11 +395,11 @@ DEFUN (debug_eigrp_transmit,
|
||||
flag = EIGRP_DEBUG_SEND;
|
||||
else if (argv_find(argv, argc, "recv", &idx))
|
||||
flag = EIGRP_DEBUG_RECV;
|
||||
else if (argv_find(argv, argc, "all", &idx) == 0)
|
||||
else if (argv_find(argv, argc, "all", &idx))
|
||||
flag = EIGRP_DEBUG_SEND_RECV;
|
||||
|
||||
/* detail option */
|
||||
if (argv_find(argv, argc, "detail", &idx) == 0)
|
||||
if (argv_find(argv, argc, "detail", &idx))
|
||||
flag = EIGRP_DEBUG_PACKET_DETAIL;
|
||||
|
||||
if (vty->node == CONFIG_NODE)
|
||||
@ -426,15 +426,15 @@ DEFUN (no_debug_eigrp_transmit,
|
||||
int idx = 3;
|
||||
|
||||
/* send or recv. */
|
||||
if (argv_find(argv, argc, "send", &idx) == 0)
|
||||
if (argv_find(argv, argc, "send", &idx))
|
||||
flag = EIGRP_DEBUG_SEND;
|
||||
else if (argv_find(argv, argc, "recv", &idx) == 0)
|
||||
else if (argv_find(argv, argc, "recv", &idx))
|
||||
flag = EIGRP_DEBUG_RECV;
|
||||
else if (argv_find(argv, argc, "all", &idx) == 0)
|
||||
else if (argv_find(argv, argc, "all", &idx))
|
||||
flag = EIGRP_DEBUG_SEND_RECV;
|
||||
|
||||
/* detail option */
|
||||
if (argv_find(argv, argc, "detail", &idx) == 0)
|
||||
if (argv_find(argv, argc, "detail", &idx))
|
||||
flag = EIGRP_DEBUG_PACKET_DETAIL;
|
||||
|
||||
if (vty->node == CONFIG_NODE)
|
||||
@ -474,27 +474,27 @@ DEFUN (debug_eigrp_packets,
|
||||
int idx = 0;
|
||||
|
||||
/* Check packet type. */
|
||||
if (argv_find(argv, argc, "hello", &idx) == 0)
|
||||
if (argv_find(argv, argc, "hello", &idx))
|
||||
type = EIGRP_DEBUG_HELLO;
|
||||
if (argv_find(argv, argc, "update", &idx) == 0)
|
||||
if (argv_find(argv, argc, "update", &idx))
|
||||
type = EIGRP_DEBUG_UPDATE;
|
||||
if (argv_find(argv, argc, "query", &idx) == 0)
|
||||
if (argv_find(argv, argc, "query", &idx))
|
||||
type = EIGRP_DEBUG_QUERY;
|
||||
if (argv_find(argv, argc, "ack", &idx) == 0)
|
||||
if (argv_find(argv, argc, "ack", &idx))
|
||||
type = EIGRP_DEBUG_ACK;
|
||||
if (argv_find(argv, argc, "probe", &idx) == 0)
|
||||
if (argv_find(argv, argc, "probe", &idx))
|
||||
type = EIGRP_DEBUG_PROBE;
|
||||
if (argv_find(argv, argc, "stub", &idx) == 0)
|
||||
if (argv_find(argv, argc, "stub", &idx))
|
||||
type = EIGRP_DEBUG_STUB;
|
||||
if (argv_find(argv, argc, "reply", &idx) == 0)
|
||||
if (argv_find(argv, argc, "reply", &idx))
|
||||
type = EIGRP_DEBUG_REPLY;
|
||||
if (argv_find(argv, argc, "request", &idx) == 0)
|
||||
if (argv_find(argv, argc, "request", &idx))
|
||||
type = EIGRP_DEBUG_REQUEST;
|
||||
if (argv_find(argv, argc, "siaquery", &idx) == 0)
|
||||
if (argv_find(argv, argc, "siaquery", &idx))
|
||||
type = EIGRP_DEBUG_SIAQUERY;
|
||||
if (argv_find(argv, argc, "siareply", &idx) == 0)
|
||||
if (argv_find(argv, argc, "siareply", &idx))
|
||||
type = EIGRP_DEBUG_SIAREPLY;
|
||||
if (argv_find(argv, argc, "all", &idx) == 0)
|
||||
if (argv_find(argv, argc, "all", &idx))
|
||||
type = EIGRP_DEBUG_PACKETS_ALL;
|
||||
|
||||
|
||||
@ -502,13 +502,13 @@ DEFUN (debug_eigrp_packets,
|
||||
flag = EIGRP_DEBUG_SEND_RECV;
|
||||
|
||||
/* send or recv. */
|
||||
if (argv_find(argv, argc, "s", &idx) == 0)
|
||||
if (argv_find(argv, argc, "s", &idx))
|
||||
flag = EIGRP_DEBUG_SEND;
|
||||
else if (argv_find(argv, argc, "r", &idx) == 0)
|
||||
else if (argv_find(argv, argc, "r", &idx))
|
||||
flag = EIGRP_DEBUG_RECV;
|
||||
|
||||
/* detail. */
|
||||
if (argv_find(argv, argc, "detail", &idx) == 0)
|
||||
if (argv_find(argv, argc, "detail", &idx))
|
||||
flag |= EIGRP_DEBUG_PACKET_DETAIL;
|
||||
|
||||
for (i = 0; i < 11; i++)
|
||||
@ -552,38 +552,38 @@ DEFUN (no_debug_eigrp_packets,
|
||||
int idx = 0;
|
||||
|
||||
/* Check packet type. */
|
||||
if (argv_find(argv, argc, "hello", &idx) == 0)
|
||||
if (argv_find(argv, argc, "hello", &idx))
|
||||
type = EIGRP_DEBUG_HELLO;
|
||||
if (argv_find(argv, argc, "update", &idx) == 0)
|
||||
if (argv_find(argv, argc, "update", &idx))
|
||||
type = EIGRP_DEBUG_UPDATE;
|
||||
if (argv_find(argv, argc, "query", &idx) == 0)
|
||||
if (argv_find(argv, argc, "query", &idx))
|
||||
type = EIGRP_DEBUG_QUERY;
|
||||
if (argv_find(argv, argc, "ack", &idx) == 0)
|
||||
if (argv_find(argv, argc, "ack", &idx))
|
||||
type = EIGRP_DEBUG_ACK;
|
||||
if (argv_find(argv, argc, "probe", &idx) == 0)
|
||||
if (argv_find(argv, argc, "probe", &idx))
|
||||
type = EIGRP_DEBUG_PROBE;
|
||||
if (argv_find(argv, argc, "stub", &idx) == 0)
|
||||
if (argv_find(argv, argc, "stub", &idx))
|
||||
type = EIGRP_DEBUG_STUB;
|
||||
if (argv_find(argv, argc, "reply", &idx) == 0)
|
||||
if (argv_find(argv, argc, "reply", &idx))
|
||||
type = EIGRP_DEBUG_REPLY;
|
||||
if (argv_find(argv, argc, "request", &idx) == 0)
|
||||
if (argv_find(argv, argc, "request", &idx))
|
||||
type = EIGRP_DEBUG_REQUEST;
|
||||
if (argv_find(argv, argc, "siaquery", &idx) == 0)
|
||||
if (argv_find(argv, argc, "siaquery", &idx))
|
||||
type = EIGRP_DEBUG_SIAQUERY;
|
||||
if (argv_find(argv, argc, "siareply", &idx) == 0)
|
||||
if (argv_find(argv, argc, "siareply", &idx))
|
||||
type = EIGRP_DEBUG_SIAREPLY;
|
||||
|
||||
/* Default, both send and recv. */
|
||||
flag = EIGRP_DEBUG_SEND_RECV;
|
||||
|
||||
/* send or recv. */
|
||||
if (argv_find(argv, argc, "send", &idx) == 0)
|
||||
if (argv_find(argv, argc, "send", &idx))
|
||||
flag = EIGRP_DEBUG_SEND;
|
||||
else if (argv_find(argv, argc, "reply", &idx) == 0)
|
||||
else if (argv_find(argv, argc, "reply", &idx))
|
||||
flag = EIGRP_DEBUG_RECV;
|
||||
|
||||
/* detail. */
|
||||
if (argv_find(argv, argc, "detail", &idx) == 0)
|
||||
if (argv_find(argv, argc, "detail", &idx))
|
||||
flag |= EIGRP_DEBUG_PACKET_DETAIL;
|
||||
|
||||
for (i = 0; i < 11; i++)
|
||||
|
@ -161,6 +161,7 @@ int eigrp_check_md5_digest(struct stream *s,
|
||||
{
|
||||
MD5_CTX ctx;
|
||||
unsigned char digest[EIGRP_AUTH_TYPE_MD5_LEN];
|
||||
unsigned char orig[EIGRP_AUTH_TYPE_MD5_LEN];
|
||||
struct key *key = NULL;
|
||||
struct keychain *keychain;
|
||||
u_char *ibuf;
|
||||
@ -181,7 +182,9 @@ int eigrp_check_md5_digest(struct stream *s,
|
||||
|
||||
auth_TLV = (struct TLV_MD5_Authentication_Type *)(s->data
|
||||
+ EIGRP_HEADER_LEN);
|
||||
memset(auth_TLV->digest, 0, sizeof(auth_TLV->digest));
|
||||
memcpy(orig, auth_TLV->digest, EIGRP_AUTH_TYPE_MD5_LEN);
|
||||
memset(digest, 0, EIGRP_AUTH_TYPE_MD5_LEN);
|
||||
memset(auth_TLV->digest, 0, EIGRP_AUTH_TYPE_MD5_LEN);
|
||||
|
||||
ibuf = s->data;
|
||||
backup_end = s->endp;
|
||||
@ -219,16 +222,15 @@ int eigrp_check_md5_digest(struct stream *s,
|
||||
MD5Final(digest, &ctx);
|
||||
|
||||
/* compare the two */
|
||||
if (memcmp(authTLV->digest, digest, EIGRP_AUTH_TYPE_MD5_LEN) == 0) {
|
||||
zlog_debug("VSETKO OK");
|
||||
} else {
|
||||
if (memcmp(orig, digest, EIGRP_AUTH_TYPE_MD5_LEN) != 0) {
|
||||
zlog_warn("interface %s: eigrp_check_md5 checksum mismatch",
|
||||
IF_NAME(nbr->ei));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* save neighbor's crypt_seqnum */
|
||||
nbr->crypt_seqnum = authTLV->key_sequence;
|
||||
if (nbr)
|
||||
nbr->crypt_seqnum = authTLV->key_sequence;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -884,6 +886,7 @@ void eigrp_packet_header_init(int type, struct eigrp_interface *ei,
|
||||
{
|
||||
struct eigrp_header *eigrph;
|
||||
|
||||
stream_reset(s);
|
||||
eigrph = (struct eigrp_header *)STREAM_DATA(s);
|
||||
|
||||
eigrph->version = (u_char)EIGRP_HEADER_VERSION;
|
||||
|
@ -504,10 +504,36 @@ void eigrp_update_send_init(struct eigrp_neighbor *nbr)
|
||||
}
|
||||
}
|
||||
|
||||
static void eigrp_update_place_on_nbr_queue(struct eigrp_neighbor *nbr,
|
||||
struct eigrp_packet *ep,
|
||||
u_int32_t seq_no,
|
||||
int length)
|
||||
{
|
||||
if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
|
||||
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL)) {
|
||||
eigrp_make_md5_digest(nbr->ei,ep->s, EIGRP_AUTH_UPDATE_FLAG);
|
||||
}
|
||||
|
||||
/* EIGRP Checksum */
|
||||
eigrp_packet_checksum(nbr->ei, ep->s, length);
|
||||
|
||||
ep->length = length;
|
||||
ep->dst.s_addr = nbr->src.s_addr;
|
||||
|
||||
/*This ack number we await from neighbor*/
|
||||
ep->sequence_number = seq_no;
|
||||
|
||||
if (IS_DEBUG_EIGRP_PACKET(0, RECV))
|
||||
zlog_debug("Enqueuing Update Init Len [%u] Seq [%u] Dest [%s]",
|
||||
ep->length, ep->sequence_number, inet_ntoa(ep->dst));
|
||||
|
||||
/*Put packet to retransmission queue*/
|
||||
eigrp_fifo_push_head(nbr->retrans_queue, ep);
|
||||
}
|
||||
|
||||
void eigrp_update_send_EOT(struct eigrp_neighbor *nbr)
|
||||
{
|
||||
struct eigrp_packet *ep;
|
||||
// struct eigrp_packet *ep_multicast;
|
||||
u_int16_t length = EIGRP_HEADER_LEN;
|
||||
struct eigrp_neighbor_entry *te;
|
||||
struct eigrp_prefix_entry *pe;
|
||||
@ -518,38 +544,53 @@ void eigrp_update_send_EOT(struct eigrp_neighbor *nbr)
|
||||
struct prefix_list *plist_i;
|
||||
struct eigrp *e;
|
||||
struct prefix_ipv4 *dest_addr;
|
||||
u_int32_t seq_no = nbr->ei->eigrp->sequence_number;
|
||||
|
||||
ep = eigrp_packet_new(nbr->ei->ifp->mtu);
|
||||
|
||||
/* Prepare EIGRP EOT UPDATE header */
|
||||
eigrp_packet_header_init(
|
||||
EIGRP_OPC_UPDATE, nbr->ei, ep->s, EIGRP_EOT_FLAG,
|
||||
nbr->ei->eigrp->sequence_number, nbr->recv_sequence_number);
|
||||
eigrp_packet_header_init(EIGRP_OPC_UPDATE, nbr->ei, ep->s, EIGRP_EOT_FLAG,
|
||||
seq_no,
|
||||
nbr->recv_sequence_number);
|
||||
|
||||
// encode Authentication TLV, if needed
|
||||
if ((IF_DEF_PARAMS(nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
|
||||
&& (IF_DEF_PARAMS(nbr->ei->ifp)->auth_keychain != NULL)) {
|
||||
length += eigrp_add_authTLV_MD5_to_stream(ep->s, nbr->ei);
|
||||
if((IF_DEF_PARAMS (nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) &&
|
||||
(IF_DEF_PARAMS (nbr->ei->ifp)->auth_keychain != NULL)) {
|
||||
length += eigrp_add_authTLV_MD5_to_stream(ep->s,nbr->ei);
|
||||
}
|
||||
|
||||
for (ALL_LIST_ELEMENTS(nbr->ei->eigrp->topology_table, node, nnode,
|
||||
pe)) {
|
||||
for (ALL_LIST_ELEMENTS(nbr->ei->eigrp->topology_table, node, nnode, pe)) {
|
||||
for (ALL_LIST_ELEMENTS(pe->entries, node2, nnode2, te)) {
|
||||
if ((te->ei == nbr->ei)
|
||||
&& (te->prefix->nt == EIGRP_TOPOLOGY_TYPE_REMOTE))
|
||||
continue;
|
||||
|
||||
if ((length + 0x001D) > (u_int16_t)nbr->ei->ifp->mtu) {
|
||||
eigrp_update_place_on_nbr_queue (nbr, ep, seq_no, length);
|
||||
eigrp_send_packet_reliably(nbr);
|
||||
seq_no++;
|
||||
|
||||
length = EIGRP_HEADER_LEN;
|
||||
ep = eigrp_packet_new(nbr->ei->ifp->mtu);
|
||||
eigrp_packet_header_init(EIGRP_OPC_UPDATE, nbr->ei, ep->s, EIGRP_EOT_FLAG,
|
||||
seq_no, nbr->recv_sequence_number);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
/* Get destination address from prefix */
|
||||
dest_addr = pe->destination_ipv4;
|
||||
|
||||
/*
|
||||
* Filtering
|
||||
*/
|
||||
// TODO: Work in progress
|
||||
//TODO: Work in progress
|
||||
/* get list from eigrp process */
|
||||
e = eigrp_lookup();
|
||||
/* Get access-lists and prefix-lists from process and
|
||||
* interface */
|
||||
/* Get access-lists and prefix-lists from process and interface */
|
||||
alist = e->list[EIGRP_FILTER_OUT];
|
||||
plist = e->prefix[EIGRP_FILTER_OUT];
|
||||
alist_i = nbr->ei->list[EIGRP_FILTER_OUT];
|
||||
@ -557,65 +598,24 @@ void eigrp_update_send_EOT(struct eigrp_neighbor *nbr)
|
||||
|
||||
/* Check if any list fits */
|
||||
if ((alist
|
||||
&& access_list_apply(alist,
|
||||
(struct prefix *)dest_addr)
|
||||
== FILTER_DENY)
|
||||
|| (plist
|
||||
&& prefix_list_apply(plist,
|
||||
(struct prefix *)dest_addr)
|
||||
== PREFIX_DENY)
|
||||
|| (alist_i
|
||||
&& access_list_apply(alist_i,
|
||||
(struct prefix *)dest_addr)
|
||||
== FILTER_DENY)
|
||||
|| (plist_i
|
||||
&& prefix_list_apply(plist_i,
|
||||
(struct prefix *)dest_addr)
|
||||
== PREFIX_DENY)) {
|
||||
zlog_info("PROC OUT EOT: Skipping");
|
||||
// pe->reported_metric.delay = EIGRP_MAX_METRIC;
|
||||
zlog_info("PROC OUT EOT Prefix: %s",
|
||||
inet_ntoa(dest_addr->prefix));
|
||||
&& access_list_apply (alist,
|
||||
(struct prefix *) dest_addr) == FILTER_DENY)||
|
||||
(plist && prefix_list_apply (plist,
|
||||
(struct prefix *) dest_addr) == PREFIX_DENY)||
|
||||
(alist_i && access_list_apply (alist_i,
|
||||
(struct prefix *) dest_addr) == FILTER_DENY)||
|
||||
(plist_i && prefix_list_apply (plist_i,
|
||||
(struct prefix *) dest_addr) == PREFIX_DENY)) {
|
||||
//pe->reported_metric.delay = EIGRP_MAX_METRIC;
|
||||
continue;
|
||||
} else {
|
||||
zlog_info(
|
||||
"PROC OUT EOT: NENastavujem metriku ");
|
||||
length += eigrp_add_internalTLV_to_stream(ep->s,
|
||||
pe);
|
||||
length += eigrp_add_internalTLV_to_stream(ep->s, pe);
|
||||
}
|
||||
/*
|
||||
* End of filtering
|
||||
*/
|
||||
|
||||
/* NULL the pointer */
|
||||
dest_addr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ((IF_DEF_PARAMS(nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
|
||||
&& (IF_DEF_PARAMS(nbr->ei->ifp)->auth_keychain != NULL)) {
|
||||
eigrp_make_md5_digest(nbr->ei, ep->s, EIGRP_AUTH_UPDATE_FLAG);
|
||||
}
|
||||
|
||||
/* EIGRP Checksum */
|
||||
eigrp_packet_checksum(nbr->ei, ep->s, length);
|
||||
|
||||
ep->length = length;
|
||||
ep->dst.s_addr = nbr->src.s_addr;
|
||||
|
||||
/*This ack number we await from neighbor*/
|
||||
ep->sequence_number = nbr->ei->eigrp->sequence_number;
|
||||
|
||||
if (IS_DEBUG_EIGRP_PACKET(0, RECV))
|
||||
zlog_debug("Enqueuing Update Init Len [%u] Seq [%u] Dest [%s]",
|
||||
ep->length, ep->sequence_number, inet_ntoa(ep->dst));
|
||||
|
||||
/*Put packet to retransmission queue*/
|
||||
eigrp_fifo_push_head(nbr->retrans_queue, ep);
|
||||
|
||||
if (nbr->retrans_queue->count == 1) {
|
||||
eigrp_send_packet_reliably(nbr);
|
||||
}
|
||||
eigrp_update_place_on_nbr_queue (nbr, ep, seq_no, length);
|
||||
eigrp_send_packet_reliably(nbr);
|
||||
}
|
||||
|
||||
void eigrp_update_send(struct eigrp_interface *ei)
|
||||
|
Loading…
Reference in New Issue
Block a user