]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_vty.c
Merge pull request #7655 from ckishimo/area
[mirror_frr.git] / ospfd / ospf_vty.c
index 19bfd76001e1c73d42bdde09abb2b965e95f4f74..4c67d33cb9bbe54f682cf049e631a2c3ea3eedfc 100644 (file)
@@ -280,7 +280,7 @@ DEFPY (ospf_router_id,
        for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area))
                if (area->full_nbrs) {
                        vty_out(vty,
-                               "For this router-id change to take effect, save config and restart ospfd\n");
+                               "For this router-id change to take effect, use “clear ip ospf process” command\n");
                        return CMD_SUCCESS;
                }
 
@@ -313,7 +313,7 @@ DEFUN_HIDDEN (ospf_router_id_old,
        for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area))
                if (area->full_nbrs) {
                        vty_out(vty,
-                               "For this router-id change to take effect, save config and restart ospfd\n");
+                               "For this router-id change to take effect, use “clear ip ospf process” command\n");
                        return CMD_SUCCESS;
                }
 
@@ -346,7 +346,7 @@ DEFPY (no_ospf_router_id,
        for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area))
                if (area->full_nbrs) {
                        vty_out(vty,
-                               "For this router-id change to take effect, save config and restart ospfd\n");
+                               "For this router-id change to take effect, use “clear ip ospf process” command\n");
                        return CMD_SUCCESS;
                }
 
@@ -2702,6 +2702,10 @@ static void show_ip_ospf_area(struct vty *vty, struct ospf_area *area,
                                        json_object_boolean_true_add(
                                                json_area,
                                                "nssaTranslatorAlways");
+                               else
+                                       json_object_boolean_true_add(
+                                               json_area,
+                                               "nssaTranslatorNever");
                        } else {
                                json_object_boolean_true_add(json_area, "abr");
                                if (area->NSSATranslatorRole
@@ -2716,29 +2720,32 @@ static void show_ip_ospf_area(struct vty *vty, struct ospf_area *area,
                        }
                } else {
                        vty_out(vty,
-                               "   It is an NSSA configuration. \n   Elected NSSA/ABR performs type-7/type-5 LSA translation. \n");
+                               "   It is an NSSA configuration.\n   Elected NSSA/ABR performs type-7/type-5 LSA translation.\n");
                        if (!IS_OSPF_ABR(area->ospf))
                                vty_out(vty,
-                                       "   It is not ABR, therefore not Translator. \n");
+                                       "   It is not ABR, therefore not Translator.\n");
                        else if (area->NSSATranslatorState) {
                                vty_out(vty, "   We are an ABR and ");
                                if (area->NSSATranslatorRole
                                    == OSPF_NSSA_ROLE_CANDIDATE)
                                        vty_out(vty,
-                                               "the NSSA Elected Translator. \n");
+                                               "the NSSA Elected Translator.\n");
                                else if (area->NSSATranslatorRole
                                         == OSPF_NSSA_ROLE_ALWAYS)
                                        vty_out(vty,
-                                               "always an NSSA Translator. \n");
+                                               "always an NSSA Translator.\n");
+                               else
+                                       vty_out(vty,
+                                               "never an NSSA Translator.\n");
                        } else {
                                vty_out(vty, "   We are an ABR, but ");
                                if (area->NSSATranslatorRole
                                    == OSPF_NSSA_ROLE_CANDIDATE)
                                        vty_out(vty,
-                                               "not the NSSA Elected Translator. \n");
+                                               "not the NSSA Elected Translator.\n");
                                else
                                        vty_out(vty,
-                                               "never an NSSA Translator. \n");
+                                               "never an NSSA Translator.\n");
                        }
                }
        }
@@ -3358,6 +3365,54 @@ DEFUN (show_ip_ospf_instance,
        return ret;
 }
 
+static void ospf_interface_auth_show(struct vty *vty, struct ospf_interface *oi,
+                                    json_object *json, bool use_json)
+{
+       int auth_type;
+
+       auth_type = OSPF_IF_PARAM(oi, auth_type);
+
+       switch (auth_type) {
+       case OSPF_AUTH_NULL:
+               if (use_json)
+                       json_object_string_add(json, "authentication",
+                                              "authenticationNone");
+               else
+                       vty_out(vty, "  Authentication NULL is enabled\n");
+               break;
+       case OSPF_AUTH_SIMPLE: {
+               if (use_json)
+                       json_object_string_add(json, "authentication",
+                                              "authenticationSimplePassword");
+               else
+                       vty_out(vty,
+                               "  Simple password authentication enabled\n");
+               break;
+       }
+       case OSPF_AUTH_CRYPTOGRAPHIC: {
+               struct crypt_key *ckey;
+
+               if (list_isempty(OSPF_IF_PARAM(oi, auth_crypt)))
+                       return;
+
+               ckey = listgetdata(listtail(OSPF_IF_PARAM(oi, auth_crypt)));
+               if (ckey) {
+                       if (use_json) {
+                               json_object_string_add(json, "authentication",
+                                                      "authenticationMessageDigest");
+                       } else {
+                               vty_out(vty,
+                                       "  Cryptographic authentication enabled\n");
+                               vty_out(vty, "  Algorithm:MD5\n");
+                       }
+               }
+               break;
+       }
+       default:
+               break;
+       }
+}
+
 static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
                                       struct interface *ifp,
                                       json_object *json_interface_sub,
@@ -3679,6 +3734,9 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
                                ospf_nbr_count(oi, 0),
                                ospf_nbr_count(oi, NSM_Full));
                ospf_bfd_interface_show(vty, ifp, json_interface_sub, use_json);
+
+               /* OSPF Authentication information */
+               ospf_interface_auth_show(vty, oi, json_interface_sub, use_json);
        }
 }
 
@@ -5793,9 +5851,8 @@ static int show_lsa_summary(struct vty *vty, struct ospf_lsa *lsa, int self,
                                /* LSA common part show. */
                                vty_out(vty, "%-15pI4",
                                        &lsa->data->id);
-                               vty_out(vty, "%-15s %4d 0x%08lx 0x%04x",
-                                       inet_ntoa(lsa->data->adv_router),
-                                       LS_AGE(lsa),
+                               vty_out(vty, "%-15pI4 %4d 0x%08lx 0x%04x",
+                                       &lsa->data->adv_router, LS_AGE(lsa),
                                        (unsigned long)ntohl(
                                                lsa->data->ls_seqnum),
                                        ntohs(lsa->data->checksum));
@@ -5809,10 +5866,13 @@ static int show_lsa_summary(struct vty *vty, struct ospf_lsa *lsa, int self,
                                         ntohs(lsa->data->checksum));
                                json_object_string_add(
                                        json_lsa, "lsId",
-                                       inet_ntoa(lsa->data->id));
+                                       inet_ntop(AF_INET, &lsa->data->id,
+                                                 buf, sizeof(buf)));
                                json_object_string_add(
                                        json_lsa, "advertisedRouter",
-                                       inet_ntoa(lsa->data->adv_router));
+                                       inet_ntop(AF_INET,
+                                                 &lsa->data->adv_router,
+                                                 buf, sizeof(buf)));
                                json_object_int_add(json_lsa, "lsaAge",
                                                    LS_AGE(lsa));
                                json_object_string_add(
@@ -5948,6 +6008,7 @@ static const char *const show_database_header[] = {
 static void show_ip_ospf_database_header(struct vty *vty, struct ospf_lsa *lsa,
                                         json_object *json)
 {
+       char buf[PREFIX_STRLEN];
        struct router_lsa *rlsa = (struct router_lsa *)lsa->data;
 
        if (!json) {
@@ -6029,9 +6090,12 @@ static void show_ip_ospf_database_header(struct vty *vty, struct ospf_lsa *lsa,
                        json, "lsaType",
                        lookup_msg(ospf_lsa_type_msg, lsa->data->type, NULL));
                json_object_string_add(json, "linkStateId",
-                                      inet_ntoa(lsa->data->id));
+                                      inet_ntop(AF_INET, &lsa->data->id,
+                                                buf, sizeof(buf)));
                json_object_string_add(json, "advertisingRouter",
-                                      inet_ntoa(lsa->data->adv_router));
+                                      inet_ntop(AF_INET,
+                                                &lsa->data->adv_router,
+                                                buf, sizeof(buf)));
                json_object_string_add(json, "lsaSeqNumber", seqnum);
                json_object_string_add(json, "checksum", checksum);
                json_object_int_add(json, "length", ntohs(lsa->data->length));
@@ -6076,6 +6140,7 @@ static void show_ip_ospf_database_router_links(struct vty *vty,
        json_object *json_links = NULL;
        json_object *json_link = NULL;
        int metric = 0;
+       char buf[PREFIX_STRLEN];
 
        if (json)
                json_links = json_object_new_object();
@@ -6093,10 +6158,13 @@ static void show_ip_ospf_database_router_links(struct vty *vty,
                                               link_type_desc[type]);
                        json_object_string_add(json_link,
                                               link_id_desc_json[type],
-                                              inet_ntoa(rl->link[i].link_id));
+                                              inet_ntop(AF_INET,
+                                                        &rl->link[i].link_id,
+                                                        buf, sizeof(buf)));
                        json_object_string_add(
                                json_link, link_data_desc_json[type],
-                               inet_ntoa(rl->link[i].link_data));
+                               inet_ntop(AF_INET, &rl->link[i].link_data,
+                                         buf, sizeof(buf)));
                        json_object_int_add(json_link, "numOfTosMetrics",
                                            metric);
                        json_object_int_add(json_link, "tos0Metric",
@@ -6151,6 +6219,7 @@ static int show_network_lsa_detail(struct vty *vty, struct ospf_lsa *lsa,
                                   json_object *json)
 {
        int length, i;
+       char buf[PREFIX_STRLEN];
        json_object *json_attached_rt = NULL;
        json_object *json_router = NULL;
 
@@ -6180,10 +6249,13 @@ static int show_network_lsa_detail(struct vty *vty, struct ospf_lsa *lsa,
                                json_router = json_object_new_object();
                                json_object_string_add(
                                        json_router, "attachedRouterId",
-                                       inet_ntoa(nl->routers[i]));
+                                       inet_ntop(AF_INET, &nl->routers[i],
+                                                 buf, sizeof(buf)));
                                json_object_object_add(
                                        json_attached_rt,
-                                       inet_ntoa(nl->routers[i]), json_router);
+                                       inet_ntop(AF_INET, &(nl->routers[i]),
+                                                 buf, sizeof(buf)),
+                                       json_router);
                        }
        }
 
@@ -6250,6 +6322,7 @@ static int show_summary_asbr_lsa_detail(struct vty *vty, struct ospf_lsa *lsa,
 static int show_as_external_lsa_detail(struct vty *vty, struct ospf_lsa *lsa,
                                       json_object *json)
 {
+       char buf[PREFIX_STRLEN];
        int tos = 0;
 
        if (lsa != NULL) {
@@ -6285,7 +6358,9 @@ static int show_as_external_lsa_detail(struct vty *vty, struct ospf_lsa *lsa,
                        json_object_int_add(json, "metric",
                                            GET_METRIC(al->e[0].metric));
                        json_object_string_add(json, "forwardAddress",
-                                              inet_ntoa(al->e[0].fwd_addr));
+                                              inet_ntop(AF_INET,
+                                                        &(al->e[0].fwd_addr),
+                                                        buf, sizeof(buf)));
                        json_object_int_add(
                                json, "externalRouteTag",
                                (route_tag_t)ntohl(al->e[0].route_tag));
@@ -6323,6 +6398,7 @@ show_as_external_lsa_stdvty (struct ospf_lsa *lsa)
 static int show_as_nssa_lsa_detail(struct vty *vty, struct ospf_lsa *lsa,
                                   json_object *json)
 {
+       char buf[PREFIX_STRLEN];
        int tos = 0;
 
        if (lsa != NULL) {
@@ -6359,7 +6435,9 @@ static int show_as_nssa_lsa_detail(struct vty *vty, struct ospf_lsa *lsa,
                        json_object_int_add(json, "metric",
                                            GET_METRIC(al->e[0].metric));
                        json_object_string_add(json, "nssaForwardAddress",
-                                              inet_ntoa(al->e[0].fwd_addr));
+                                              inet_ntop(AF_INET,
+                                                        &al->e[0].fwd_addr,
+                                                        buf, sizeof(buf)));
                        json_object_int_add(
                                json, "externalRouteTag",
                                (route_tag_t)ntohl(al->e[0].route_tag));
@@ -6455,6 +6533,7 @@ static void show_lsa_detail(struct vty *vty, struct ospf *ospf, int type,
 {
        struct listnode *node;
        struct ospf_area *area;
+       char buf[PREFIX_STRLEN];
        json_object *json_lsa_type = NULL;
        json_object *json_areas = NULL;
        json_object *json_lsa_array = NULL;
@@ -6492,7 +6571,10 @@ static void show_lsa_detail(struct vty *vty, struct ospf *ospf, int type,
                        } else {
                                json_lsa_array = json_object_new_array();
                                json_object_object_add(json_areas,
-                                                      inet_ntoa(area->area_id),
+                                                      inet_ntop(AF_INET,
+                                                                &area->area_id,
+                                                                buf,
+                                                                sizeof(buf)),
                                                       json_lsa_array);
                        }
 
@@ -6516,6 +6598,7 @@ static void show_lsa_detail_adv_router_proc(struct vty *vty,
                                            struct in_addr *adv_router,
                                            json_object *json)
 {
+       char buf[PREFIX_STRLEN];
        struct route_node *rn;
        struct ospf_lsa *lsa;
 
@@ -6535,7 +6618,10 @@ static void show_lsa_detail_adv_router_proc(struct vty *vty,
                                                vty, lsa, json_lsa);
                                if (json)
                                        json_object_object_add(
-                                               json, inet_ntoa(lsa->data->id),
+                                               json,
+                                               inet_ntop(AF_INET,
+                                                         &lsa->data->id,
+                                                         buf, sizeof(buf)),
                                                json_lsa);
                        }
                }
@@ -6548,6 +6634,7 @@ static void show_lsa_detail_adv_router(struct vty *vty, struct ospf *ospf,
 {
        struct listnode *node;
        struct ospf_area *area;
+       char buf[PREFIX_STRLEN];
        json_object *json_lstype = NULL;
        json_object *json_area = NULL;
 
@@ -6580,7 +6667,10 @@ static void show_lsa_detail_adv_router(struct vty *vty, struct ospf *ospf,
 
                        if (json)
                                json_object_object_add(json_lstype,
-                                                      inet_ntoa(area->area_id),
+                                                      inet_ntop(AF_INET,
+                                                                &area->area_id,
+                                                                buf,
+                                                                sizeof(buf)),
                                                       json_area);
                }
                break;
@@ -6598,6 +6688,7 @@ static void show_ip_ospf_database_summary(struct vty *vty, struct ospf *ospf,
        struct route_node *rn;
        struct ospf_area *area;
        struct listnode *node;
+       char buf[PREFIX_STRLEN];
        json_object *json_areas = NULL;
        json_object *json_area = NULL;
        json_object *json_lsa = NULL;
@@ -6658,7 +6749,9 @@ static void show_ip_ospf_database_summary(struct vty *vty, struct ospf *ospf,
                }
                if (json)
                        json_object_object_add(json_areas,
-                                              inet_ntoa(area->area_id),
+                                              inet_ntop(AF_INET,
+                                                        &area->area_id,
+                                                        buf, sizeof(buf)),
                                               json_area);
        }
 
@@ -6710,6 +6803,7 @@ static void show_ip_ospf_database_maxage(struct vty *vty, struct ospf *ospf,
                                         json_object *json)
 {
        struct route_node *rn;
+       char buf[PREFIX_STRLEN];
        json_object *json_maxage = NULL;
 
        if (!json)
@@ -6725,8 +6819,8 @@ static void show_ip_ospf_database_maxage(struct vty *vty, struct ospf *ospf,
                        if (!json) {
                                vty_out(vty, "Link type: %d\n",
                                        lsa->data->type);
-                               vty_out(vty, "Link State ID: %s\n",
-                                       inet_ntoa(lsa->data->id));
+                               vty_out(vty, "Link State ID: %pI4\n",
+                                       &lsa->data->id);
                                vty_out(vty, "Advertising Router: %pI4\n",
                                        &lsa->data->adv_router);
                                vty_out(vty, "LSA lock count: %d\n", lsa->lock);
@@ -6737,15 +6831,21 @@ static void show_ip_ospf_database_maxage(struct vty *vty, struct ospf *ospf,
                                                    lsa->data->type);
                                json_object_string_add(
                                        json_lsa, "linkStateId",
-                                       inet_ntoa(lsa->data->id));
+                                       inet_ntop(AF_INET, &lsa->data->id,
+                                                 buf, sizeof(buf)));
                                json_object_string_add(
                                        json_lsa, "advertisingRouter",
-                                       inet_ntoa(lsa->data->adv_router));
+                                       inet_ntop(AF_INET,
+                                                 &lsa->data->adv_router,
+                                                 buf, sizeof(buf)));
                                json_object_int_add(json_lsa, "lsaLockCount",
                                                    lsa->lock);
-                               json_object_object_add(json_maxage,
-                                                      inet_ntoa(lsa->data->id),
-                                                      json_lsa);
+                               json_object_object_add(
+                                       json_maxage,
+                                       inet_ntop(AF_INET,
+                                                 &lsa->data->id,
+                                                 buf, sizeof(buf)),
+                                       json_lsa);
                        }
                }
        }
@@ -6779,6 +6879,7 @@ static int show_ip_ospf_database_common(struct vty *vty, struct ospf *ospf,
        int idx_type = 4;
        int type, ret;
        struct in_addr id, adv_router;
+       char buf[PREFIX_STRLEN];
        json_object *json_vrf = NULL;
 
        if (uj) {
@@ -6801,7 +6902,8 @@ static int show_ip_ospf_database_common(struct vty *vty, struct ospf *ospf,
        /* Show Router ID. */
        if (uj) {
                json_object_string_add(json_vrf, "routerId",
-                                      inet_ntoa(ospf->router_id));
+                                      inet_ntop(AF_INET, &ospf->router_id,
+                                                buf, sizeof(buf)));
        } else {
                vty_out(vty, "\n       OSPF Router with ID (%pI4)\n\n",
                        &ospf->router_id);
@@ -7131,6 +7233,7 @@ static int show_ip_ospf_database_type_adv_router_common(struct vty *vty,
        int idx_type = 4;
        int type, ret;
        struct in_addr adv_router;
+       char buf[PREFIX_STRLEN];
        json_object *json_vrf = NULL;
 
        if (uj) {
@@ -7153,7 +7256,8 @@ static int show_ip_ospf_database_type_adv_router_common(struct vty *vty,
        /* Show Router ID. */
        if (uj) {
                json_object_string_add(json_vrf, "routerId",
-                                      inet_ntoa(ospf->router_id));
+                                      inet_ntop(AF_INET, &ospf->router_id,
+                                                buf, sizeof(buf)));
        } else {
                vty_out(vty, "\n       OSPF Router with ID (%pI4)\n\n",
                        &ospf->router_id);
@@ -7263,8 +7367,8 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router,
                                        continue;
                                ospf_output = true;
                                ret = show_ip_ospf_database_type_adv_router_common(
-                                       vty, ospf, idx ? 1 : 0, argc, argv,
-                                       use_vrf, json, uj);
+                                       vty, ospf, 2, argc, argv, use_vrf, json,
+                                       uj);
                        }
                        if (!ospf_output)
                                vty_out(vty, "%% OSPF instance not found\n");
@@ -7276,8 +7380,7 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router,
                        }
 
                        ret = show_ip_ospf_database_type_adv_router_common(
-                               vty, ospf, idx ? 1 : 0, argc, argv, use_vrf,
-                               json, uj);
+                               vty, ospf, 2, argc, argv, use_vrf, json, uj);
                }
        } else {
                /* Display default ospf (instance 0) info */
@@ -10446,7 +10549,8 @@ static void show_ip_ospf_route_network(struct vty *vty, struct ospf *ospf,
                                if (if_lookup_by_index(path->ifindex,
                                                       ospf->vrf_id)) {
 
-                                       if (path->nexthop.s_addr == 0) {
+                                       if (path->nexthop.s_addr
+                                           == INADDR_ANY) {
                                                if (json) {
                                                        json_object_string_add(
                                                                json_nexthop,
@@ -10591,7 +10695,8 @@ static void show_ip_ospf_route_router(struct vty *vty, struct ospf *ospf,
                                }
                                if (if_lookup_by_index(path->ifindex,
                                                       ospf->vrf_id)) {
-                                       if (path->nexthop.s_addr == 0) {
+                                       if (path->nexthop.s_addr
+                                           == INADDR_ANY) {
                                                if (json) {
                                                        json_object_string_add(
                                                                json_nexthop,
@@ -10719,7 +10824,7 @@ static void show_ip_ospf_route_external(struct vty *vty, struct ospf *ospf,
                        }
 
                        if (if_lookup_by_index(path->ifindex, ospf->vrf_id)) {
-                               if (path->nexthop.s_addr == 0) {
+                               if (path->nexthop.s_addr == INADDR_ANY) {
                                        if (json) {
                                                json_object_string_add(
                                                        json_nexthop, "ip",
@@ -11125,6 +11230,70 @@ DEFUN (show_ip_ospf_vrfs,
 
        return CMD_SUCCESS;
 }
+DEFPY (clear_ip_ospf_neighbor,
+       clear_ip_ospf_neighbor_cmd,
+       "clear ip ospf [(1-65535)]$instance neighbor [A.B.C.D$nbr_id]",
+       CLEAR_STR
+       IP_STR
+       "OSPF information\n"
+       "Instance ID\n"
+       "Reset OSPF Neighbor\n"
+       "Neighbor ID\n")
+{
+       struct listnode *node;
+       struct ospf *ospf = NULL;
+
+       /* If user does not specify the arguments,
+        * instance = 0 and nbr_id = 0.0.0.0
+        */
+       if (instance != 0) {
+               /* This means clear only the particular ospf process */
+               ospf = ospf_lookup_instance(instance);
+               if (ospf == NULL)
+                       return CMD_NOT_MY_INSTANCE;
+       }
+
+       /* Clear all the ospf processes */
+       for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) {
+               if (!ospf->oi_running)
+                       continue;
+
+               ospf_neighbor_reset(ospf, nbr_id, nbr_id_str);
+       }
+
+       return CMD_SUCCESS;
+}
+
+DEFPY (clear_ip_ospf_process,
+       clear_ip_ospf_process_cmd,
+       "clear ip ospf [(1-65535)]$instance process",
+       CLEAR_STR
+       IP_STR
+       "OSPF information\n"
+       "Instance ID\n"
+       "Reset OSPF Process\n")
+{
+       struct listnode *node;
+       struct ospf *ospf = NULL;
+
+       /* Check if instance is not passed as an argument */
+       if (instance != 0) {
+               /* This means clear only the particular ospf process */
+               ospf = ospf_lookup_instance(instance);
+               if (ospf == NULL)
+                       return CMD_NOT_MY_INSTANCE;
+       }
+
+       /* Clear all the ospf processes */
+       for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) {
+               if (!ospf->oi_running)
+                       continue;
+
+               ospf_process_reset(ospf);
+       }
+
+       return CMD_SUCCESS;
+}
 
 static const char *const ospf_abr_type_str[] = {
        "unknown", "standard", "ibm", "cisco", "shortcut"
@@ -11402,6 +11571,30 @@ static const char *const ospf_int_type_str[] = {
        "loopback"
 };
 
+static const char *interface_config_auth_str(struct ospf_if_params *params)
+{
+       if (!OSPF_IF_PARAM_CONFIGURED(params, auth_type)
+           || params->auth_type == OSPF_AUTH_NOTSET)
+               return NULL;
+
+       /* Translation tables are not that much help
+        * here due to syntax
+        * of the simple option */
+       switch (params->auth_type) {
+
+       case OSPF_AUTH_NULL:
+               return " null";
+
+       case OSPF_AUTH_SIMPLE:
+               return "";
+
+       case OSPF_AUTH_CRYPTOGRAPHIC:
+               return " message-digest";
+       }
+
+       return "";
+}
+
 static int config_write_interface_one(struct vty *vty, struct vrf *vrf)
 {
        struct listnode *node;
@@ -11409,6 +11602,7 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf)
        struct crypt_key *ck;
        struct route_node *rn = NULL;
        struct ospf_if_params *params;
+       const char *auth_str;
        int write = 0;
        struct ospf *ospf = vrf->info;
 
@@ -11446,32 +11640,8 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf)
                        }
 
                        /* OSPF interface authentication print */
-                       if (OSPF_IF_PARAM_CONFIGURED(params, auth_type)
-                           && params->auth_type != OSPF_AUTH_NOTSET) {
-                               const char *auth_str;
-
-                               /* Translation tables are not that much help
-                               * here due to syntax
-                               * of the simple option */
-                               switch (params->auth_type) {
-
-                               case OSPF_AUTH_NULL:
-                                       auth_str = " null";
-                                       break;
-
-                               case OSPF_AUTH_SIMPLE:
-                                       auth_str = "";
-                                       break;
-
-                               case OSPF_AUTH_CRYPTOGRAPHIC:
-                                       auth_str = " message-digest";
-                                       break;
-
-                               default:
-                                       auth_str = "";
-                                       break;
-                               }
-
+                       auth_str = interface_config_auth_str(params);
+                       if (auth_str) {
                                vty_out(vty, " ip ospf authentication%s",
                                        auth_str);
                                if (params != IF_DEF_PARAMS(ifp) && rn)
@@ -11822,6 +11992,7 @@ static int config_write_virtual_link(struct vty *vty, struct ospf *ospf)
 {
        struct listnode *node;
        struct ospf_vl_data *vl_data;
+       const char *auth_str;
        char buf[INET_ADDRSTRLEN];
 
        /* Virtual-Link print */
@@ -11854,6 +12025,13 @@ static int config_write_virtual_link(struct vty *vty, struct ospf *ospf)
                        else
                                vty_out(vty, " area %s virtual-link %pI4\n", buf,
                                        &vl_data->vl_peer);
+                       /* Auth type */
+                       auth_str = interface_config_auth_str(
+                               IF_DEF_PARAMS(oi->ifp));
+                       if (auth_str)
+                               vty_out(vty,
+                                       " area %s virtual-link %pI4 authentication%s\n",
+                                       buf, &vl_data->vl_peer, auth_str);
                        /* Auth key */
                        if (IF_DEF_PARAMS(vl_data->vl_oi->ifp)->auth_simple[0]
                            != '\0')
@@ -12079,7 +12257,7 @@ static int ospf_config_write_one(struct vty *vty, struct ospf *ospf)
        }
 
        /* Router ID print. */
-       if (ospf->router_id_static.s_addr != 0)
+       if (ospf->router_id_static.s_addr != INADDR_ANY)
                vty_out(vty, " ospf router-id %pI4\n",
                        &ospf->router_id_static);
 
@@ -12512,6 +12690,8 @@ DEFUN (clear_ip_ospf_interface,
 void ospf_vty_clear_init(void)
 {
        install_element(ENABLE_NODE, &clear_ip_ospf_interface_cmd);
+       install_element(ENABLE_NODE, &clear_ip_ospf_process_cmd);
+       install_element(ENABLE_NODE, &clear_ip_ospf_neighbor_cmd);
 }