diff options
Diffstat (limited to 'ospf6d/ospf6_area.c')
| -rw-r--r-- | ospf6d/ospf6_area.c | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index d65e40279d..92934d3764 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -45,10 +45,25 @@ #include "ospf6_asbr.h" #include "ospf6d.h" #include "lib/json.h" +#include "ospf6_nssa.h" DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_AREA, "OSPF6 area"); DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_PLISTNAME, "Prefix list name"); +/* Utility functions. */ +int str2area_id(const char *str, struct in_addr *area_id, int *area_id_fmt) +{ + char *ep; + + area_id->s_addr = htonl(strtoul(str, &ep, 10)); + if (*ep && !inet_aton(str, area_id)) + return -1; + + *area_id_fmt = *ep ? OSPF6_AREA_FMT_DECIMAL : OSPF6_AREA_FMT_DOTTEDQUAD; + + return 0; +} + int ospf6_area_cmp(void *va, void *vb) { struct ospf6_area *oa = (struct ospf6_area *)va; @@ -60,6 +75,7 @@ int ospf6_area_cmp(void *va, void *vb) static void ospf6_area_lsdb_hook_add(struct ospf6_lsa *lsa) { switch (ntohs(lsa->header->type)) { + case OSPF6_LSTYPE_ROUTER: case OSPF6_LSTYPE_NETWORK: if (IS_OSPF6_DEBUG_EXAMIN_TYPE(lsa->header->type)) { @@ -82,6 +98,10 @@ static void ospf6_area_lsdb_hook_add(struct ospf6_lsa *lsa) (struct ospf6_area *)lsa->lsdb->data); break; + case OSPF6_LSTYPE_TYPE_7: + ospf6_asbr_lsa_add(lsa); + break; + default: break; } @@ -111,7 +131,9 @@ static void ospf6_area_lsdb_hook_remove(struct ospf6_lsa *lsa) ospf6_abr_examin_summary(lsa, (struct ospf6_area *)lsa->lsdb->data); break; - + case OSPF6_LSTYPE_TYPE_7: + ospf6_asbr_lsa_remove(lsa, NULL); + break; default: break; } @@ -611,6 +633,8 @@ void ospf6_area_config_write(struct vty *vty, struct ospf6 *ospf6) else vty_out(vty, " area %s stub\n", oa->name); } + if (IS_AREA_NSSA(oa)) + vty_out(vty, " area %s nssa\n", oa->name); if (PREFIX_NAME_IN(oa)) vty_out(vty, " area %s filter-list prefix %s in\n", oa->name, PREFIX_NAME_IN(oa)); @@ -1216,6 +1240,48 @@ DEFUN (no_ospf6_area_stub_no_summary, return CMD_SUCCESS; } +DEFUN(ospf6_area_nssa, ospf6_area_nssa_cmd, + "area <A.B.C.D|(0-4294967295)> nssa", + "OSPF6 area parameters\n" + "OSPF6 area ID in IP address format\n" + "OSPF6 area ID as a decimal value\n" + "Configure OSPF6 area as nssa\n") +{ + int idx_ipv4_number = 1; + struct ospf6_area *area; + + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area, ospf6); + + if (!ospf6_area_nssa_set(ospf6, area)) { + vty_out(vty, + "First deconfigure all virtual link through this area\n"); + return CMD_WARNING_CONFIG_FAILED; + } + + return CMD_SUCCESS; +} + +DEFUN(no_ospf6_area_nssa, no_ospf6_area_nssa_cmd, + "no area <A.B.C.D|(0-4294967295)> nssa", + NO_STR + "OSPF6 area parameters\n" + "OSPF6 area ID in IP address format\n" + "OSPF6 area ID as a decimal value\n" + "Configure OSPF6 area as nssa\n") +{ + int idx_ipv4_number = 2; + struct ospf6_area *area; + + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area, ospf6); + + ospf6_area_nssa_unset(ospf6, area); + + return CMD_SUCCESS; +} + + void ospf6_area_init(void) { install_element(VIEW_NODE, &show_ipv6_ospf6_spf_tree_cmd); @@ -1237,6 +1303,10 @@ void ospf6_area_init(void) install_element(OSPF6_NODE, &area_filter_list_cmd); install_element(OSPF6_NODE, &no_area_filter_list_cmd); + + /* "area nssa" commands. */ + install_element(OSPF6_NODE, &ospf6_area_nssa_cmd); + install_element(OSPF6_NODE, &no_ospf6_area_nssa_cmd); } void ospf6_area_interface_delete(struct ospf6_interface *oi) |
