]> git.proxmox.com Git - mirror_frr.git/blobdiff - eigrpd/eigrp_query.c
zebra: Allow ns delete to happen after under/over flow checks
[mirror_frr.git] / eigrpd / eigrp_query.c
index 72780f7a038ee7c20e4af519f8db335e18d215d9..84dcf5e2d55a081b6dae3685aea58e12b2cf092f 100644 (file)
 #include "eigrpd/eigrp_fsm.h"
 #include "eigrpd/eigrp_memory.h"
 
-u_int32_t eigrp_query_send_all(struct eigrp *eigrp)
+uint32_t eigrp_query_send_all(struct eigrp *eigrp)
 {
        struct eigrp_interface *iface;
        struct listnode *node, *node2, *nnode2;
        struct eigrp_prefix_entry *pe;
-       u_int32_t counter;
+       uint32_t counter;
 
        if (eigrp == NULL) {
                zlog_debug("EIGRP Routing Process not enabled");
@@ -93,8 +93,8 @@ void eigrp_query_receive(struct eigrp *eigrp, struct ip *iph,
        struct TLV_IPv4_Internal_type *tlv;
        struct prefix dest_addr;
 
-       u_int16_t type;
-       u_int16_t length;
+       uint16_t type;
+       uint16_t length;
 
        /* increment statistics. */
        ei->query_in++;
@@ -111,7 +111,7 @@ void eigrp_query_receive(struct eigrp *eigrp, struct ip *iph,
                type = stream_getw(s);
                switch (type) {
                case EIGRP_TLV_IPv4_INT:
-                       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);
 
@@ -161,12 +161,13 @@ void eigrp_query_receive(struct eigrp *eigrp, struct ip *iph,
 void eigrp_send_query(struct eigrp_interface *ei)
 {
        struct eigrp_packet *ep = NULL;
-       u_int16_t length = EIGRP_HEADER_LEN;
+       uint16_t length = EIGRP_HEADER_LEN;
        struct listnode *node, *nnode, *node2, *nnode2;
        struct eigrp_neighbor *nbr;
        struct eigrp_prefix_entry *pe;
        bool has_tlv = false;
        bool new_packet = true;
+       uint16_t eigrp_mtu = EIGRP_PACKET_MTU(ei->ifp->mtu);
 
        for (ALL_LIST_ELEMENTS(ei->eigrp->topology_changes_internalIPV4, node,
                               nnode, pe)) {
@@ -174,7 +175,7 @@ void eigrp_send_query(struct eigrp_interface *ei)
                        continue;
 
                if (new_packet) {
-                       ep = eigrp_packet_new(ei->ifp->mtu, NULL);
+                       ep = eigrp_packet_new(eigrp_mtu, NULL);
 
                        /* Prepare EIGRP INIT UPDATE header */
                        eigrp_packet_header_init(EIGRP_OPC_QUERY, ei->eigrp,
@@ -197,7 +198,7 @@ void eigrp_send_query(struct eigrp_interface *ei)
                                listnode_add(pe->rij, nbr);
                }
 
-               if (length + EIGRP_TLV_MAX_IPV4_BYTE > (uint16_t)ei->ifp->mtu) {
+               if (length + EIGRP_TLV_MAX_IPV4_BYTE > eigrp_mtu) {
                        if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
                            && ei->params.auth_keychain != NULL) {
                                eigrp_make_md5_digest(ei, ep->s,
@@ -234,11 +235,8 @@ void eigrp_send_query(struct eigrp_interface *ei)
                }
        }
 
-       if (!has_tlv) {
-               if (ep)
-                       eigrp_packet_free(ep);
+       if (!has_tlv)
                return;
-       }
 
        if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
            && ei->params.auth_keychain != NULL)