]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospf6d/ospf6_interface.c
eigrpd: eigrp usage of uint32_t to struct in_addr for router_id data
[mirror_frr.git] / ospf6d / ospf6_interface.c
index 8524292215bf4fd530b6fa443221b7efd4f3feb9..2bfa4201cbce5bed54f907745c25223ba198f630 100644 (file)
@@ -101,7 +101,7 @@ static void ospf6_interface_lsdb_hook_remove(struct ospf6_lsa *lsa)
        ospf6_interface_lsdb_hook(lsa, ospf6_lsremove_to_spf_reason(lsa));
 }
 
-static u_char ospf6_default_iftype(struct interface *ifp)
+static uint8_t ospf6_default_iftype(struct interface *ifp)
 {
        if (if_is_pointopoint(ifp))
                return OSPF_IFTYPE_POINTOPOINT;
@@ -111,11 +111,11 @@ static u_char ospf6_default_iftype(struct interface *ifp)
                return OSPF_IFTYPE_BROADCAST;
 }
 
-static u_int32_t ospf6_interface_get_cost(struct ospf6_interface *oi)
+static uint32_t ospf6_interface_get_cost(struct ospf6_interface *oi)
 {
        /* If all else fails, use default OSPF cost */
-       u_int32_t cost;
-       u_int32_t bw, refbw;
+       uint32_t cost;
+       uint32_t bw, refbw;
 
        /* interface speed and bw can be 0 in some platforms,
         * use ospf default bw. If bw is configured then it would
@@ -134,7 +134,7 @@ static u_int32_t ospf6_interface_get_cost(struct ospf6_interface *oi)
        if (CHECK_FLAG(oi->flag, OSPF6_INTERFACE_NOAUTOCOST))
                cost = oi->cost;
        else {
-               cost = (u_int32_t)((double)refbw / (double)bw + (double)0.5);
+               cost = (uint32_t)((double)refbw / (double)bw + (double)0.5);
                if (cost < 1)
                        cost = 1;
                else if (cost > UINT32_MAX)
@@ -161,7 +161,7 @@ static void ospf6_interface_force_recalculate_cost(struct ospf6_interface *oi)
 
 static void ospf6_interface_recalculate_cost(struct ospf6_interface *oi)
 {
-       u_int32_t newcost;
+       uint32_t newcost;
 
        newcost = ospf6_interface_get_cost(oi);
        if (newcost == oi->cost)
@@ -180,12 +180,6 @@ struct ospf6_interface *ospf6_interface_create(struct interface *ifp)
        oi = (struct ospf6_interface *)XCALLOC(MTYPE_OSPF6_IF,
                                               sizeof(struct ospf6_interface));
 
-       if (!oi) {
-               zlog_err("Can't malloc ospf6_interface for ifindex %d",
-                        ifp->ifindex);
-               return (struct ospf6_interface *)NULL;
-       }
-
        oi->area = (struct ospf6_area *)NULL;
        oi->neighbor_list = list_new();
        oi->neighbor_list->cmp = ospf6_neighbor_cmp;
@@ -247,7 +241,7 @@ void ospf6_interface_delete(struct ospf6_interface *oi)
        for (ALL_LIST_ELEMENTS(oi->neighbor_list, node, nnode, on))
                ospf6_neighbor_delete(on);
 
-       list_delete_and_null(&oi->neighbor_list);
+       list_delete(&oi->neighbor_list);
 
        THREAD_OFF(oi->thread_send_hello);
        THREAD_OFF(oi->thread_send_lsupdate);
@@ -349,28 +343,6 @@ void ospf6_interface_if_add(struct interface *ifp)
        ospf6_interface_state_update(oi->interface);
 }
 
-void ospf6_interface_if_del(struct interface *ifp)
-{
-       struct ospf6_interface *oi;
-
-       oi = (struct ospf6_interface *)ifp->info;
-       if (oi == NULL)
-               return;
-
-       /* interface stop */
-       if (oi->area)
-               thread_execute(master, interface_down, oi, 0);
-
-       listnode_delete(oi->area->if_list, oi);
-       oi->area = (struct ospf6_area *)NULL;
-
-       /* cut link */
-       oi->interface = NULL;
-       ifp->info = NULL;
-
-       ospf6_interface_delete(oi);
-}
-
 void ospf6_interface_state_update(struct interface *ifp)
 {
        struct ospf6_interface *oi;
@@ -494,10 +466,10 @@ void ospf6_interface_connected_route_update(struct interface *ifp)
        OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(oi->area);
 }
 
-static void ospf6_interface_state_change(u_char next_state,
+static void ospf6_interface_state_change(uint8_t next_state,
                                         struct ospf6_interface *oi)
 {
-       u_char prev_state;
+       uint8_t prev_state;
 
        prev_state = oi->state;
        oi->state = next_state;
@@ -610,12 +582,12 @@ static struct ospf6_neighbor *better_drouter(struct ospf6_neighbor *a,
        return a;
 }
 
-static u_char dr_election(struct ospf6_interface *oi)
+static uint8_t dr_election(struct ospf6_interface *oi)
 {
        struct listnode *node, *nnode;
        struct ospf6_neighbor *on, *drouter, *bdrouter, myself;
        struct ospf6_neighbor *best_drouter, *best_bdrouter;
-       u_char next_state = 0;
+       uint8_t next_state = 0;
 
        drouter = bdrouter = NULL;
        best_drouter = best_bdrouter = NULL;
@@ -886,7 +858,6 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp)
        struct prefix *p;
        struct listnode *i;
        char strbuf[PREFIX2STR_BUFFER], drouter[32], bdrouter[32];
-       const char *updown[3] = {"down", "up", NULL};
        const char *type;
        struct timeval res, now;
        char duration[32];
@@ -903,7 +874,7 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp)
                type = "UNKNOWN";
 
        vty_out(vty, "%s is %s, type %s\n", ifp->name,
-               updown[if_is_operative(ifp)], type);
+               (if_is_operative(ifp) ? "up" : "down"), type);
        vty_out(vty, "  Interface ID: %d\n", ifp->ifindex);
 
        if (ifp->info == NULL) {
@@ -1102,13 +1073,18 @@ DEFUN (show_ipv6_ospf6_interface_traffic,
 
 DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
        show_ipv6_ospf6_interface_ifname_prefix_cmd,
-       "show ipv6 ospf6 interface IFNAME prefix [<X:X::X:X|X:X::X:X/M>] [<match|detail>]",
+       "show ipv6 ospf6 interface IFNAME prefix\
+          [<\
+           detail\
+           |<X:X::X:X|X:X::X:X/M> [<match|detail>]\
+         >]",
        SHOW_STR
        IP6_STR
        OSPF6_STR
        INTERFACE_STR
        IFNAME_STR
        "Display connected prefixes to advertise\n"
+       "Display details of the prefixes\n"
        OSPF6_ROUTE_ADDRESS_STR
        OSPF6_ROUTE_PREFIX_STR
        OSPF6_ROUTE_MATCH_STR
@@ -1140,12 +1116,17 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
 
 DEFUN (show_ipv6_ospf6_interface_prefix,
        show_ipv6_ospf6_interface_prefix_cmd,
-       "show ipv6 ospf6 interface prefix [<X:X::X:X|X:X::X:X/M>] [<match|detail>]",
+       "show ipv6 ospf6 interface prefix\
+          [<\
+           detail\
+           |<X:X::X:X|X:X::X:X/M> [<match|detail>]\
+         >]",
        SHOW_STR
        IP6_STR
        OSPF6_STR
        INTERFACE_STR
        "Display connected prefixes to advertise\n"
+       "Display details of the prefixes\n"
        OSPF6_ROUTE_ADDRESS_STR
        OSPF6_ROUTE_PREFIX_STR
        OSPF6_ROUTE_MATCH_STR
@@ -1346,7 +1327,7 @@ DEFUN (auto_cost_reference_bandwidth,
        struct ospf6_area *oa;
        struct ospf6_interface *oi;
        struct listnode *i, *j;
-       u_int32_t refbw;
+       uint32_t refbw;
 
        refbw = strtol(argv[idx_number]->arg, NULL, 10);
        if (refbw < 1 || refbw > 4294967) {