]> git.proxmox.com Git - mirror_frr.git/blobdiff - eigrpd/eigrp_siareply.c
zebra: Allow ns delete to happen after under/over flow checks
[mirror_frr.git] / eigrpd / eigrp_siareply.c
index 9a768566d3f00b7d181150e241600f45edbddedb..d3dd123f909cb4f79862e77914b1ae10c370a777 100644 (file)
@@ -61,7 +61,7 @@ void eigrp_siareply_receive(struct eigrp *eigrp, struct ip *iph,
        struct eigrp_neighbor *nbr;
        struct TLV_IPv4_Internal_type *tlv;
 
-       u_int16_t type;
+       uint16_t type;
 
        /* increment statistics. */
        ei->siaReply_in++;
@@ -77,14 +77,14 @@ void eigrp_siareply_receive(struct eigrp *eigrp, struct ip *iph,
        while (s->endp > s->getp) {
                type = stream_getw(s);
                if (type == EIGRP_TLV_IPv4_INT) {
-                       struct prefix_ipv4 dest_addr;
+                       struct prefix dest_addr;
 
-                       stream_set_getp(s, s->getp - sizeof(u_int16_t));
+                       stream_set_getp(s, s->getp - sizeof(uint16_t));
 
                        tlv = eigrp_read_ipv4_tlv(s);
 
                        dest_addr.family = AFI_IP;
-                       dest_addr.prefix = tlv->destination;
+                       dest_addr.u.prefix4 = tlv->destination;
                        dest_addr.prefixlen = tlv->prefix_length;
                        struct eigrp_prefix_entry *dest =
                                eigrp_topology_table_lookup_ipv4(
@@ -93,22 +93,18 @@ void eigrp_siareply_receive(struct eigrp *eigrp, struct ip *iph,
                        /* If the destination exists (it should, but one never
                         * know)*/
                        if (dest != NULL) {
-                               struct eigrp_fsm_action_message *msg;
-                               msg = XCALLOC(MTYPE_EIGRP_FSM_MSG,
-                                             sizeof(struct
-                                                    eigrp_fsm_action_message));
-                               struct eigrp_neighbor_entry *entry =
+                               struct eigrp_fsm_action_message msg;
+                               struct eigrp_nexthop_entry *entry =
                                        eigrp_prefix_entry_lookup(dest->entries,
                                                                  nbr);
-                               msg->packet_type = EIGRP_OPC_SIAQUERY;
-                               msg->eigrp = eigrp;
-                               msg->data_type = EIGRP_TLV_IPv4_INT;
-                               msg->adv_router = nbr;
-                               msg->data.ipv4_int_type = tlv;
-                               msg->entry = entry;
-                               msg->prefix = dest;
-                               int event = eigrp_get_fsm_event(msg);
-                               eigrp_fsm_event(msg, event);
+                               msg.packet_type = EIGRP_OPC_SIAQUERY;
+                               msg.eigrp = eigrp;
+                               msg.data_type = EIGRP_INT;
+                               msg.adv_router = nbr;
+                               msg.metrics = tlv->metric;
+                               msg.entry = entry;
+                               msg.prefix = dest;
+                               eigrp_fsm_event(&msg);
                        }
                        eigrp_IPv4_InternalTLV_free(tlv);
                }
@@ -120,24 +116,24 @@ void eigrp_send_siareply(struct eigrp_neighbor *nbr,
                         struct eigrp_prefix_entry *pe)
 {
        struct eigrp_packet *ep;
-       u_int16_t length = EIGRP_HEADER_LEN;
+       uint16_t length = EIGRP_HEADER_LEN;
 
-       ep = eigrp_packet_new(nbr->ei->ifp->mtu);
+       ep = eigrp_packet_new(EIGRP_PACKET_MTU(nbr->ei->ifp->mtu), nbr);
 
        /* 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->eigrp, ep->s, 0,
                                 nbr->ei->eigrp->sequence_number, 0);
 
        // encode Authentication TLV, if needed
-       if ((IF_DEF_PARAMS(nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
-           && (IF_DEF_PARAMS(nbr->ei->ifp)->auth_keychain != NULL)) {
+       if (nbr->ei->params.auth_type == EIGRP_AUTH_TYPE_MD5
+           && nbr->ei->params.auth_keychain != NULL) {
                length += eigrp_add_authTLV_MD5_to_stream(ep->s, nbr->ei);
        }
 
        length += eigrp_add_internalTLV_to_stream(ep->s, pe);
 
-       if ((IF_DEF_PARAMS(nbr->ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
-           && (IF_DEF_PARAMS(nbr->ei->ifp)->auth_keychain != NULL)) {
+       if ((nbr->ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+           && (nbr->ei->params.auth_keychain != NULL)) {
                eigrp_make_md5_digest(nbr->ei, ep->s, EIGRP_AUTH_UPDATE_FLAG);
        }
 
@@ -152,7 +148,7 @@ void eigrp_send_siareply(struct eigrp_neighbor *nbr,
 
        if (nbr->state == EIGRP_NEIGHBOR_UP) {
                /*Put packet to retransmission queue*/
-               eigrp_fifo_push_head(nbr->retrans_queue, ep);
+               eigrp_fifo_push(nbr->retrans_queue, ep);
 
                if (nbr->retrans_queue->count == 1) {
                        eigrp_send_packet_reliably(nbr);