]> git.proxmox.com Git - mirror_frr.git/commitdiff
eigrpd: eigrp usage of uint32_t to struct in_addr for router_id data
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 31 Dec 2018 00:54:25 +0000 (19:54 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 31 Dec 2018 00:55:50 +0000 (19:55 -0500)
In eigrp we were using a uint32_t to hold the `struct in_addr` data
for the router id values.  This caused us to do unnecessary conversions
pre and post for in/out.  Let's just use the standard `struct in_addr`

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
eigrpd/eigrp_dump.c
eigrpd/eigrp_network.c
eigrpd/eigrp_structs.h
eigrpd/eigrp_vty.c
eigrpd/eigrpd.c

index 27e02630a655d91c7d05912af872031250f77f26..c975c0abc7b6cef50b2b48c03edd4560e4194445 100644 (file)
@@ -276,11 +276,8 @@ void show_ip_eigrp_neighbor_sub(struct vty *vty, struct eigrp_neighbor *nbr,
  */
 void show_ip_eigrp_topology_header(struct vty *vty, struct eigrp *eigrp)
 {
-       struct in_addr router_id;
-       router_id.s_addr = eigrp->router_id;
-
        vty_out(vty, "\nEIGRP Topology Table for AS(%d)/ID(%s)\n\n", eigrp->AS,
-               inet_ntoa(router_id));
+               inet_ntoa(eigrp->router_id));
        vty_out(vty,
                "Codes: P - Passive, A - Active, U - Update, Q - Query, "
                "R - Reply\n       r - reply Status, s - sia Status\n\n");
index 35b45288b80f2bedebcbd90cbc03e641dc2a56ee..6bb619f0e1953ad765a43c173a513d9e3fae8b50 100644 (file)
@@ -227,7 +227,7 @@ int eigrp_network_set(struct eigrp *eigrp, struct prefix *p)
        rn->info = (void *)pref;
 
        /* Schedule Router ID Update. */
-       if (eigrp->router_id == 0)
+       if (eigrp->router_id.s_addr == 0)
                eigrp_router_id_update(eigrp);
        /* Run network config now. */
        /* Get target interface. */
@@ -293,7 +293,7 @@ void eigrp_if_update(struct interface *ifp)
         */
        for (ALL_LIST_ELEMENTS(eigrp_om->eigrp, node, nnode, eigrp)) {
                /* EIGRP must be on and Router-ID must be configured. */
-               if (!eigrp || eigrp->router_id == 0)
+               if (!eigrp || eigrp->router_id.s_addr == 0)
                        continue;
 
                /* Run each network for this interface. */
index ce03a21fbaeb7a4e796c731cabf9b75df6641138..f661d9ec581bec5d57c34174dd7c7ec6bbda6833 100644 (file)
@@ -79,8 +79,8 @@ struct eigrp {
        char *name;
 
        /* EIGRP Router ID. */
-       uint32_t router_id;     /* Configured automatically. */
-       uint32_t router_id_static; /* Configured manually. */
+       struct in_addr router_id;       /* Configured automatically. */
+       struct in_addr router_id_static; /* Configured manually. */
 
        struct list *eiflist;             /* eigrp interfaces */
        uint8_t passive_interface_default; /* passive-interface default */
index 89dd0035e6f5c1cb9ae1a4b4d8e8f09ae8788f38..7baf7b9f6bc1e56b64f569ff5dcd148b6e3e79ed 100644 (file)
@@ -192,11 +192,9 @@ static int config_write_eigrp_router(struct vty *vty, struct eigrp *eigrp)
        write++;
 
        /* Router ID print. */
-       if (eigrp->router_id_static != 0) {
-               struct in_addr router_id_static;
-               router_id_static.s_addr = htonl(eigrp->router_id_static);
+       if (eigrp->router_id_static.s_addr != 0) {
                vty_out(vty, " eigrp router-id %s\n",
-                       inet_ntoa(router_id_static));
+                       inet_ntoa(eigrp->router_id_static));
        }
 
        /* Network area print. */
index 9bbecdf9e39df04e4c38d338d6d1bc607d4a6c49..2b2293f24f4c8c84f7dbf0c38445cf1fd86c0827 100644 (file)
@@ -95,21 +95,21 @@ void eigrp_router_id_update(struct eigrp *eigrp)
 {
        struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
        struct interface *ifp;
-       uint32_t router_id, router_id_old;
+       struct in_addr router_id, router_id_old;
 
        router_id_old = eigrp->router_id;
 
-       if (eigrp->router_id_static != 0)
+       if (eigrp->router_id_static.s_addr != 0)
                router_id = eigrp->router_id_static;
 
-       else if (eigrp->router_id != 0)
+       else if (eigrp->router_id.s_addr != 0)
                router_id = eigrp->router_id;
 
        else
-               router_id = router_id_zebra.s_addr;
+               router_id = router_id_zebra;
 
        eigrp->router_id = router_id;
-       if (router_id_old != router_id) {
+       if (router_id_old.s_addr != router_id.s_addr) {
                //      if (IS_DEBUG_EIGRP_EVENT)
                //        zlog_debug("Router-ID[NEW:%s]: Update",
                //        inet_ntoa(eigrp->router_id));
@@ -142,8 +142,8 @@ static struct eigrp *eigrp_new(const char *AS)
        /* init information relevant to peers */
        eigrp->vrid = 0;
        eigrp->AS = atoi(AS);
-       eigrp->router_id = 0L;
-       eigrp->router_id_static = 0L;
+       eigrp->router_id.s_addr = 0;
+       eigrp->router_id_static.s_addr = 0;
        eigrp->sequence_number = 1;
 
        /*Configure default K Values for EIGRP Process*/