]> git.proxmox.com Git - mirror_frr.git/blobdiff - eigrpd/eigrp_query.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / eigrpd / eigrp_query.c
index 00234bb35c6fb3954628d435ea0515d74c88ddc8..56498ed674793ffe65f9a20efb6270decfb9ef9a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * EIGRP Sending and Receiving EIGRP Query Packets.
  * Copyright (C) 2013-2014
@@ -7,22 +8,6 @@
  *   Matej Perina
  *   Peter Orsag
  *   Peter Paluch
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <zebra.h>
 #include "eigrpd/eigrp_macros.h"
 #include "eigrpd/eigrp_topology.h"
 #include "eigrpd/eigrp_fsm.h"
-#include "eigrpd/eigrp_memory.h"
 
 uint32_t eigrp_query_send_all(struct eigrp *eigrp)
 {
        struct eigrp_interface *iface;
        struct listnode *node, *node2, *nnode2;
-       struct eigrp_prefix_entry *pe;
+       struct eigrp_prefix_descriptor *pe;
        uint32_t counter;
 
        if (eigrp == NULL) {
@@ -118,7 +102,7 @@ void eigrp_query_receive(struct eigrp *eigrp, struct ip *iph,
                        dest_addr.family = AF_INET;
                        dest_addr.u.prefix4 = tlv->destination;
                        dest_addr.prefixlen = tlv->prefix_length;
-                       struct eigrp_prefix_entry *dest =
+                       struct eigrp_prefix_descriptor *dest =
                                eigrp_topology_table_lookup_ipv4(
                                        eigrp->topology_table, &dest_addr);
 
@@ -126,9 +110,9 @@ void eigrp_query_receive(struct eigrp *eigrp, struct ip *iph,
                         * know)*/
                        if (dest != NULL) {
                                struct eigrp_fsm_action_message msg;
-                               struct eigrp_nexthop_entry *entry =
-                                       eigrp_prefix_entry_lookup(dest->entries,
-                                                                 nbr);
+                               struct eigrp_route_descriptor *entry =
+                                       eigrp_route_descriptor_lookup(
+                                               dest->entries, nbr);
                                msg.packet_type = EIGRP_OPC_QUERY;
                                msg.eigrp = eigrp;
                                msg.data_type = EIGRP_INT;
@@ -164,9 +148,10 @@ void eigrp_send_query(struct eigrp_interface *ei)
        uint16_t length = EIGRP_HEADER_LEN;
        struct listnode *node, *nnode, *node2, *nnode2;
        struct eigrp_neighbor *nbr;
-       struct eigrp_prefix_entry *pe;
+       struct eigrp_prefix_descriptor *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 +159,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 +182,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 +219,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)