]> git.proxmox.com Git - mirror_frr.git/blobdiff - eigrpd/eigrp_interface.c
doc: add comment on PR title and description
[mirror_frr.git] / eigrpd / eigrp_interface.c
index ec29d86fd248450a09a497a5e9486d82b41bcb2a..cd62811fdfdadf34da3698590019f8974155b998 100644 (file)
@@ -125,12 +125,11 @@ struct list *eigrp_iflist;
 void eigrp_if_init()
 {
        /* Initialize Zebra interface data structure. */
-       //hook_register_prio(if_add, 0, eigrp_if_new);
+       // hook_register_prio(if_add, 0, eigrp_if_new);
        hook_register_prio(if_del, 0, eigrp_if_delete_hook);
 }
 
 
-
 void eigrp_del_if_params(struct eigrp_if_params *eip)
 {
        if (eip->auth_keychain)
@@ -160,8 +159,7 @@ int eigrp_if_up(struct eigrp_interface *ei)
        thread_add_event(master, eigrp_hello_timer, ei, (1), NULL);
 
        /*Prepare metrics*/
-       metric.bandwidth =
-               eigrp_bandwidth_to_scaled(ei->params.bandwidth);
+       metric.bandwidth = eigrp_bandwidth_to_scaled(ei->params.bandwidth);
        metric.delay = eigrp_delay_to_scaled(ei->params.delay);
        metric.load = ei->params.load;
        metric.reliability = ei->params.reliability;
@@ -310,8 +308,7 @@ void eigrp_if_set_multicast(struct eigrp_interface *ei)
                 * group. */
                if (ei->member_allrouters) {
                        /* Only actually drop if this is the last reference */
-                       eigrp_if_drop_allspfrouters(ei->eigrp,
-                                                   ei->address,
+                       eigrp_if_drop_allspfrouters(ei->eigrp, ei->address,
                                                    ei->ifp->ifindex);
                        /* Unset the flag regardless of whether the system call
                           to leave
@@ -323,7 +320,7 @@ void eigrp_if_set_multicast(struct eigrp_interface *ei)
        }
 }
 
-u_char eigrp_default_iftype(struct interface *ifp)
+uint8_t eigrp_default_iftype(struct interface *ifp)
 {
        if (if_is_pointopoint(ifp))
                return EIGRP_IFTYPE_POINTOPOINT;
@@ -333,13 +330,15 @@ u_char eigrp_default_iftype(struct interface *ifp)
                return EIGRP_IFTYPE_BROADCAST;
 }
 
-void eigrp_if_free(struct eigrp_interface *ei,
-                  int source)
+void eigrp_if_free(struct eigrp_interface *ei, int source)
 {
        struct prefix dest_addr;
        struct eigrp_prefix_entry *pe;
        struct eigrp *eigrp = eigrp_lookup();
 
+       if (!eigrp)
+               return;
+
        if (source == INTERFACE_DOWN_BY_VTY) {
                THREAD_OFF(ei->t_hello);
                eigrp_hello_send(ei, EIGRP_HELLO_GRACEFUL_SHUTDOWN, NULL);
@@ -417,32 +416,32 @@ struct eigrp_interface *eigrp_if_lookup_by_name(struct eigrp *eigrp,
        return NULL;
 }
 
-u_int32_t eigrp_bandwidth_to_scaled(u_int32_t bandwidth)
+uint32_t eigrp_bandwidth_to_scaled(uint32_t bandwidth)
 {
        uint64_t temp_bandwidth = (256ull * 10000000) / bandwidth;
 
        temp_bandwidth = temp_bandwidth < EIGRP_MAX_METRIC ? temp_bandwidth
                                                           : EIGRP_MAX_METRIC;
 
-       return (u_int32_t)temp_bandwidth;
+       return (uint32_t)temp_bandwidth;
 }
 
-u_int32_t eigrp_scaled_to_bandwidth(u_int32_t scaled)
+uint32_t eigrp_scaled_to_bandwidth(uint32_t scaled)
 {
        uint64_t temp_scaled = scaled * (256ull * 10000000);
 
        temp_scaled =
                temp_scaled < EIGRP_MAX_METRIC ? temp_scaled : EIGRP_MAX_METRIC;
 
-       return (u_int32_t)temp_scaled;
+       return (uint32_t)temp_scaled;
 }
 
-u_int32_t eigrp_delay_to_scaled(u_int32_t delay)
+uint32_t eigrp_delay_to_scaled(uint32_t delay)
 {
        return delay * 256;
 }
 
-u_int32_t eigrp_scaled_to_delay(u_int32_t scaled)
+uint32_t eigrp_scaled_to_delay(uint32_t scaled)
 {
        return scaled / 256;
 }