]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd: introduce ospf_auth_type_str[]
authorDenis Ovsienko <infrastation@yandex.ru>
Sun, 26 Feb 2012 13:00:57 +0000 (17:00 +0400)
committerDavid Lamparter <equinox@diac24.net>
Mon, 12 Mar 2012 10:05:34 +0000 (11:05 +0100)
ospfd/ospf_dump.c
ospfd/ospf_dump.h

index 8ace09578262d7d75ba13e588a8da57c4eb7d607..7e11e2513120df8c4cc43ae2e2e202b45dcd2c19 100644 (file)
@@ -115,6 +115,16 @@ const struct message ospf_network_type_msg[] =
 };
 const int ospf_network_type_msg_max = OSPF_IFTYPE_MAX;
 
+/* AuType */
+const struct message ospf_auth_type_str[] =
+{
+  { OSPF_AUTH_NULL,          "Null"          },
+  { OSPF_AUTH_SIMPLE,        "Simple"        },
+  { OSPF_AUTH_CRYPTOGRAPHIC, "Cryptographic" },
+};
+const size_t ospf_auth_type_str_max = sizeof (ospf_auth_type_str) /
+  sizeof (ospf_auth_type_str[0]);
+
 /* Configuration debug option variables. */
 unsigned long conf_debug_ospf_packet[5] = {0, 0, 0, 0, 0};
 unsigned long conf_debug_ospf_event = 0;
@@ -657,6 +667,7 @@ static void
 ospf_header_dump (struct ospf_header *ospfh)
 {
   char buf[9];
+  u_int16_t auth_type = ntohs (ospfh->auth_type);
 
   zlog_debug ("Header");
   zlog_debug ("  Version %d", ospfh->version);
@@ -666,9 +677,9 @@ ospf_header_dump (struct ospf_header *ospfh)
   zlog_debug ("  Router ID %s", inet_ntoa (ospfh->router_id));
   zlog_debug ("  Area ID %s", inet_ntoa (ospfh->area_id));
   zlog_debug ("  Checksum 0x%x", ntohs (ospfh->checksum));
-  zlog_debug ("  AuType %d", ntohs (ospfh->auth_type));
+  zlog_debug ("  AuType %s", LOOKUP (ospf_auth_type_str, auth_type));
 
-  switch (ntohs (ospfh->auth_type))
+  switch (auth_type)
     {
     case OSPF_AUTH_NULL:
       break;
index 455214f5f37bd4178db6d244699258be55558b61..a2d5e8ba196150cf8bcd55711d6e5d1a983c88ea 100644 (file)
@@ -122,6 +122,8 @@ extern unsigned long term_debug_ospf_nssa;
 
 /* Message Strings. */
 extern char *ospf_lsa_type_str[];
+extern const struct message ospf_auth_type_str[];
+extern const size_t ospf_auth_type_str_max;
 
 /* Prototypes. */
 extern const char *ospf_area_name_string (struct ospf_area *);