#include "ospfd/ospf_dump.h"
#include "ospfd/ospf_bfd.h"
-static const char *ospf_network_type_str[] = {
+static const char *const ospf_network_type_str[] = {
"Null", "POINTOPOINT", "BROADCAST", "NBMA", "POINTOMULTIPOINT",
"VIRTUALLINK", "LOOPBACK"};
"Write multiplier\n"
"Maximum number of interface serviced per write\n")
-const char *ospf_abr_type_descr_str[] = {"Unknown", "Standard (RFC2328)",
- "Alternative IBM", "Alternative Cisco",
- "Alternative Shortcut"};
+static const char *const ospf_abr_type_descr_str[] = {
+ "Unknown", "Standard (RFC2328)", "Alternative IBM",
+ "Alternative Cisco", "Alternative Shortcut"
+};
-const char *ospf_shortcut_mode_descr_str[] = {"Default", "Enabled", "Disabled"};
+static const char *const ospf_shortcut_mode_descr_str[] = {
+ "Default", "Enabled", "Disabled"
+};
static void show_ip_ospf_area(struct vty *vty, struct ospf_area *area,
json_object *json_areas, bool use_json)
else
vty_out(vty, " This interface is UNNUMBERED,");
} else {
+ struct in_addr dest;
+ const char *dstr;
+
/* Show OSPF interface information. */
if (use_json) {
json_object_string_add(
inet_ntoa(oi->address->u.prefix4),
oi->address->prefixlen);
- if (oi->connected->destination
- || oi->type == OSPF_IFTYPE_VIRTUALLINK) {
- struct in_addr *dest;
- const char *dstr;
-
- if (CONNECTED_PEER(oi->connected)
- || oi->type == OSPF_IFTYPE_VIRTUALLINK)
- dstr = "Peer";
- else
- dstr = "Broadcast";
+ /* For Vlinks, showing the peer address is
+ * probably more informative than the local
+ * interface that is being used */
+ if (oi->type == OSPF_IFTYPE_VIRTUALLINK) {
+ dstr = "Peer";
+ dest = oi->vl_data->peer_addr;
+ } else if (CONNECTED_PEER(oi->connected)
+ && oi->connected->destination) {
+ dstr = "Peer";
+ dest = oi->connected->destination->u.prefix4;
+ } else {
+ dstr = "Broadcast";
+ dest.s_addr = ipv4_broadcast_addr(
+ oi->connected->address->u.prefix4.s_addr,
+ oi->connected->address->prefixlen);
+ }
- /* For Vlinks, showing the peer address is
- * probably more
- * * * * * informative than the local
- * interface that is being used
- * * * * */
+ if (use_json) {
+ json_object_string_add(
+ json_interface_sub,
+ "ospfIfType", dstr);
if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
- dest = &oi->vl_data->peer_addr;
+ json_object_string_add(
+ json_interface_sub,
+ "vlinkPeer",
+ inet_ntoa(dest));
else
- dest = &oi->connected->destination->u
- .prefix4;
-
- if (use_json) {
json_object_string_add(
json_interface_sub,
- "ospfIfType", dstr);
- if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
- json_object_string_add(
- json_interface_sub,
- "vlinkPeer",
- inet_ntoa(*dest));
- else
- json_object_string_add(
- json_interface_sub,
- "localIfUsed",
- inet_ntoa(*dest));
- } else
- vty_out(vty, " %s %s,", dstr,
- inet_ntoa(*dest));
- }
+ "localIfUsed",
+ inet_ntoa(dest));
+ } else
+ vty_out(vty, " %s %s,", dstr,
+ inet_ntoa(dest));
}
if (use_json) {
json_object_string_add(json_interface_sub, "area",
return 0;
}
-static const char *show_database_desc[] = {
+static const char *const show_database_desc[] = {
"unknown",
"Router Link States",
"Net Link States",
"AS-external Opaque-LSA",
};
-static const char *show_database_header[] = {
+static const char *const show_database_header[] = {
"",
"Link ID ADV Router Age Seq# CkSum Link count",
"Link ID ADV Router Age Seq# CkSum",
vty_out(vty, " Length: %d\n\n", ntohs(lsa->data->length));
}
-const char *link_type_desc[] = {
+static const char *const link_type_desc[] = {
"(null)",
"another Router (point-to-point)",
"a Transit Network",
"a Virtual Link",
};
-const char *link_id_desc[] = {
+static const char *const link_id_desc[] = {
"(null)", "Neighboring Router ID", "Designated Router address",
"Net", "Neighboring Router ID",
};
-const char *link_data_desc[] = {
+static const char *const link_data_desc[] = {
"(null)", "Router Interface address", "Router Interface address",
"Network Mask", "Router Interface address",
};
return 0;
}
-int (*show_function[])(struct vty *, struct ospf_lsa *) = {
+int (*const show_function[])(struct vty *, struct ospf_lsa *) = {
NULL,
show_router_lsa_detail,
show_network_lsa_detail,
struct ospf *ospf = NULL;
struct listnode *node = NULL;
int count = 0;
- static char header[] = "Name Id RouterId ";
+ static const char header[] = "Name Id RouterId ";
if (uj) {
json = json_object_new_object();
return CMD_SUCCESS;
}
-const char *ospf_abr_type_str[] = {"unknown", "standard", "ibm", "cisco",
- "shortcut"};
+static const char *const ospf_abr_type_str[] = {
+ "unknown", "standard", "ibm", "cisco", "shortcut"
+};
-const char *ospf_shortcut_mode_str[] = {"default", "enable", "disable"};
+static const char *const ospf_shortcut_mode_str[] = {
+ "default", "enable", "disable"
+};
-const char *ospf_int_type_str[] = {"unknown", /* should never be used. */
- "point-to-point", "broadcast",
- "non-broadcast", "point-to-multipoint",
- "virtual-link", /* should never be used. */
- "loopback"};
+static const char *const ospf_int_type_str[] = {
+ "unknown", /* should never be used. */
+ "point-to-point",
+ "broadcast",
+ "non-broadcast",
+ "point-to-multipoint",
+ "virtual-link", /* should never be used. */
+ "loopback"
+};
static int config_write_interface_one(struct vty *vty, struct vrf *vrf)
{
DEFUN (clear_ip_ospf_interface,
clear_ip_ospf_interface_cmd,
- "clear ip ospf [vrf <NAME>] interface [IFNAME]",
+ "clear ip ospf [vrf NAME] interface [IFNAME]",
CLEAR_STR
IP_STR
"OSPF information\n"