]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospf6d/ospf6_area.c
Merge pull request #4731 from mjstapp/fix_redist_update
[mirror_frr.git] / ospf6d / ospf6_area.c
index 0a728060309a854cec468463e426bc2fb89ae475..484e5adae674a3ab044629e0b346d0dad7640fa5 100644 (file)
@@ -138,11 +138,11 @@ static void ospf6_area_stub_update(struct ospf6_area *area)
 
        if (IS_AREA_STUB(area)) {
                if (IS_OSPF6_DEBUG_ORIGINATE(ROUTER))
-                       zlog_debug("Stubbing out area for if %s\n", area->name);
+                       zlog_debug("Stubbing out area for if %s", area->name);
                OSPF6_OPT_CLEAR(area->options, OSPF6_OPT_E);
        } else if (IS_AREA_ENABLED(area)) {
                if (IS_OSPF6_DEBUG_ORIGINATE(ROUTER))
-                       zlog_debug("Normal area for if %s\n", area->name);
+                       zlog_debug("Normal area for if %s", area->name);
                OSPF6_OPT_SET(area->options, OSPF6_OPT_E);
                ospf6_asbr_send_externals_to_area(area);
        }
@@ -199,7 +199,7 @@ static void ospf6_area_no_summary_unset(struct ospf6 *ospf6,
  * @param o - ospf6 instance
  * @param df - display format for area ID
  */
-struct ospf6_area *ospf6_area_create(u_int32_t area_id, struct ospf6 *o, int df)
+struct ospf6_area *ospf6_area_create(uint32_t area_id, struct ospf6 *o, int df)
 {
        struct ospf6_area *oa;
 
@@ -277,7 +277,7 @@ void ospf6_area_delete(struct ospf6_area *oa)
        for (ALL_LIST_ELEMENTS_RO(oa->if_list, n, oi))
                oi->area = NULL;
 
-       list_delete_and_null(&oa->if_list);
+       list_delete(&oa->if_list);
 
        ospf6_lsdb_delete(oa->lsdb);
        ospf6_lsdb_delete(oa->lsdb_self);
@@ -298,7 +298,7 @@ void ospf6_area_delete(struct ospf6_area *oa)
        XFREE(MTYPE_OSPF6_AREA, oa);
 }
 
-struct ospf6_area *ospf6_area_lookup(u_int32_t area_id, struct ospf6 *ospf6)
+struct ospf6_area *ospf6_area_lookup(uint32_t area_id, struct ospf6 *ospf6)
 {
        struct ospf6_area *oa;
        struct listnode *n;
@@ -384,7 +384,7 @@ void ospf6_area_show(struct vty *vty, struct ospf6_area *oa)
 #define OSPF6_CMD_AREA_GET(str, oa)                                            \
        {                                                                      \
                char *ep;                                                      \
-               u_int32_t area_id = htonl(strtoul(str, &ep, 10));              \
+               uint32_t area_id = htonl(strtoul(str, &ep, 10));               \
                if (*ep && inet_pton(AF_INET, str, &area_id) != 1) {           \
                        vty_out(vty, "Malformed Area-ID: %s\n", str);          \
                        return CMD_SUCCESS;                                    \
@@ -416,7 +416,7 @@ DEFUN (area_range,
        struct ospf6_area *oa;
        struct prefix prefix;
        struct ospf6_route *range;
-       u_int32_t cost = OSPF_AREA_RANGE_COST_UNSPEC;
+       uint32_t cost = OSPF_AREA_RANGE_COST_UNSPEC;
 
        OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, oa);
 
@@ -441,6 +441,7 @@ DEFUN (area_range,
                        SET_FLAG(range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE);
                } else if (strmatch(argv[idx_type]->text, "advertise")) {
                        UNSET_FLAG(range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE);
+                       cost = range->path.u.cost_config;
                } else {
                        cost = strtoul(argv[5]->arg, NULL, 10);
                        UNSET_FLAG(range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE);
@@ -449,7 +450,7 @@ DEFUN (area_range,
 
        range->path.u.cost_config = cost;
 
-       zlog_debug("%s: for prefix %s, flag = %x\n", __func__,
+       zlog_debug("%s: for prefix %s, flag = %x", __func__,
                   argv[idx_ipv6_prefixlen]->arg, range->flag);
        if (range->rnode == NULL) {
                ospf6_route_add(range, oa->range_table);
@@ -566,9 +567,10 @@ void ospf6_area_config_write(struct vty *vty)
 
 DEFUN (area_filter_list,
        area_filter_list_cmd,
-       "area A.B.C.D filter-list prefix WORD <in|out>",
+       "area <A.B.C.D|(0-4294967295)> filter-list prefix WORD <in|out>",
        "OSPF6 area parameters\n"
        "OSPF6 area ID in IP address format\n"
+       "OSPF6 area ID as a decimal value\n"
        "Filter networks between OSPF6 areas\n"
        "Filter prefixes between OSPF6 areas\n"
        "Name of an IPv6 prefix-list\n"
@@ -604,10 +606,11 @@ DEFUN (area_filter_list,
 
 DEFUN (no_area_filter_list,
        no_area_filter_list_cmd,
-       "no area A.B.C.D filter-list prefix WORD <in|out>",
+       "no area <A.B.C.D|(0-4294967295)> filter-list prefix WORD <in|out>",
        NO_STR
        "OSPF6 area parameters\n"
        "OSPF6 area ID in IP address format\n"
+       "OSPF6 area ID as a decimal value\n"
        "Filter networks between OSPF6 areas\n"
        "Filter prefixes between OSPF6 areas\n"
        "Name of an IPv6 prefix-list\n"
@@ -661,9 +664,10 @@ void ospf6_area_plist_update(struct prefix_list *plist, int add)
 
 DEFUN (area_import_list,
        area_import_list_cmd,
-       "area A.B.C.D import-list NAME",
+       "area <A.B.C.D|(0-4294967295)> import-list NAME",
        "OSPF6 area parameters\n"
        "OSPF6 area ID in IP address format\n"
+       "OSPF6 area ID as a decimal value\n"
        "Set the filter for networks from other areas announced to the specified one\n"
        "Name of the acess-list\n")
 {
@@ -689,10 +693,11 @@ DEFUN (area_import_list,
 
 DEFUN (no_area_import_list,
        no_area_import_list_cmd,
-       "no area A.B.C.D import-list NAME",
+       "no area <A.B.C.D|(0-4294967295)> import-list NAME",
        NO_STR
        "OSPF6 area parameters\n"
        "OSPF6 area ID in IP address format\n"
+       "OSPF6 area ID as a decimal value\n"
        "Unset the filter for networks announced to other areas\n"
        "Name of the access-list\n")
 {
@@ -714,9 +719,10 @@ DEFUN (no_area_import_list,
 
 DEFUN (area_export_list,
        area_export_list_cmd,
-       "area A.B.C.D export-list NAME",
+       "area <A.B.C.D|(0-4294967295)> export-list NAME",
        "OSPF6 area parameters\n"
        "OSPF6 area ID in IP address format\n"
+       "OSPF6 area ID as a decimal value\n"
        "Set the filter for networks announced to other areas\n"
        "Name of the acess-list\n")
 {
@@ -742,10 +748,11 @@ DEFUN (area_export_list,
 
 DEFUN (no_area_export_list,
        no_area_export_list_cmd,
-       "no area A.B.C.D export-list NAME",
+       "no area <A.B.C.D|(0-4294967295)> export-list NAME",
        NO_STR
        "OSPF6 area parameters\n"
        "OSPF6 area ID in IP address format\n"
+       "OSPF6 area ID as a decimal value\n"
        "Unset the filter for networks announced to other areas\n"
        "Name of the access-list\n")
 {
@@ -771,7 +778,7 @@ DEFUN (show_ipv6_ospf6_spf_tree,
        SHOW_STR
        IP6_STR
        OSPF6_STR
-       "Shortest Path First caculation\n"
+       "Shortest Path First calculation\n"
        "Show SPF tree\n")
 {
        struct listnode *node;
@@ -806,11 +813,11 @@ DEFUN (show_ipv6_ospf6_area_spf_tree,
        OSPF6_STR
        OSPF6_AREA_STR
        OSPF6_AREA_ID_STR
-       "Shortest Path First caculation\n"
+       "Shortest Path First calculation\n"
        "Show SPF tree\n")
 {
        int idx_ipv4 = 4;
-       u_int32_t area_id;
+       uint32_t area_id;
        struct ospf6_area *oa;
        struct ospf6_vertex *root;
        struct ospf6_route *route;
@@ -856,12 +863,12 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root,
 {
        int idx_ipv4 = 5;
        int idx_ipv4_2 = 7;
-       u_int32_t area_id;
+       uint32_t area_id;
        struct ospf6_area *oa;
        struct ospf6_vertex *root;
        struct ospf6_route *route;
        struct prefix prefix;
-       u_int32_t router_id;
+       uint32_t router_id;
        struct ospf6_route_table *spf_table;
        unsigned char tmp_debug_ospf6_spf = 0;
 
@@ -1015,3 +1022,16 @@ void ospf6_area_init(void)
        install_element(OSPF6_NODE, &area_filter_list_cmd);
        install_element(OSPF6_NODE, &no_area_filter_list_cmd);
 }
+
+void ospf6_area_interface_delete(struct ospf6_interface *oi)
+{
+       struct ospf6_area *oa;
+       struct listnode *node, *nnode;
+
+       if (!ospf6)
+               return;
+       for (ALL_LIST_ELEMENTS(ospf6->area_list, node, nnode, oa))
+               if(listnode_lookup(oa->if_list, oi))
+                       listnode_delete(oa->if_list, oi);
+
+}