]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-isakmp.c
Handle IPX socket 0x553, which is some kind of NetBIOS-over-IPX socket.
[tcpdump] / print-isakmp.c
index 513bfcc6c1f3af5ca0e9d6cafe7a46d64967662c..d6fa40d7e5ca12e98341d209ca25de6463f0e32f 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.23 2000-10-03 05:16:38 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.26 2000-12-12 09:20:26 itojun Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -48,10 +48,6 @@ struct rtentry;
 
 #include <netinet/in.h>
 
-#ifdef INET6
-#include <netinet/ip6.h>
-#endif
-
 #include <stdio.h>
 #include <netdb.h>
 
@@ -63,6 +59,9 @@ struct rtentry;
 #include "extract.h"                    /* must come after interface.h */
 
 #include "ip.h"
+#ifdef INET6
+#include "ip6.h"
+#endif
 
 #ifndef HAVE_SOCKADDR_STORAGE
 #define sockaddr_storage sockaddr
@@ -423,9 +422,8 @@ isakmp_sa_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
 {
        struct isakmp_pl_sa *p, sa;
        u_int32_t *q;
-       u_int32_t doi;
-       u_int32_t sit;
-       u_char *cp;
+       u_int32_t doi, sit, ident;
+       u_char *cp, *np;
        int t;
 
        printf("%s:", NPSTR(ISAKMP_NPTYPE_SA));
@@ -433,6 +431,7 @@ isakmp_sa_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
        p = (struct isakmp_pl_sa *)ext;
        safememcpy(&sa, ext, sizeof(sa));
        doi = ntohl(sa.doi);
+       sit = ntohl(sa.sit);
        if (doi != 1) {
                printf(" doi=%d", doi);
                printf(" situation=%u", (u_int32_t)ntohl(sa.sit));
@@ -443,22 +442,25 @@ isakmp_sa_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
        q = (u_int32_t *)&sa.sit;
        printf(" situation=");
        t = 0;
-       if (ntohl(*q) & 0x01) {
+       if (sit & 0x01) {
                printf("identity");
                t++;
        }
-       if (ntohl(*q) & 0x02) {
+       if (sit & 0x02) {
                printf("%ssecrecy", t ? "+" : "");
                t++;
        }
-       if (ntohl(*q) & 0x04)
+       if (sit & 0x04)
                printf("%sintegrity", t ? "+" : "");
-       sit = htonl(*q++);
 
-       if (sit != 0x01)
-               printf(" ident=%u", (u_int32_t)ntohl(*q++));
+       np = (u_char *)ext + sizeof(sa);
+       if (sit != 0x01) {
+               safememcpy(&ident, ext + 1, sizeof(ident));
+               printf(" ident=%u", (u_int32_t)ntohl(ident));
+               np += sizeof(ident);
+       }
 
-       ext = (struct isakmp_gen *)q;
+       ext = (struct isakmp_gen *)np;
 
        cp = isakmp_sub_print(ISAKMP_NPTYPE_P, ext, ep, phase, doi, proto0);
 
@@ -497,11 +499,12 @@ static char *isakmp_p_map[] = {
 
 static char *ah_p_map[] = {
        NULL, "(reserved)", "md5", "sha", "1des",
+       "sha2-256", "sha2-384", "sha2-512",
 };
 
 static char *esp_p_map[] = {
        NULL, "1des-iv64", "1des", "3des", "rc5", "idea", "cast",
-       "blowfish", "3idea", "1des-iv32", "rc4", "null"
+       "blowfish", "3idea", "1des-iv32", "rc4", "null", "aes"
 };
 
 static char *ipcomp_p_map[] = {
@@ -524,9 +527,10 @@ struct attrmap ipsec_t_map[] = {
 
 struct attrmap oakley_t_map[] = {
        { NULL, 0 },
-       { "enc", 7,     { NULL, "1des", "idea", "blowfish", "rc5",
-                         "3des", "cast"}, },
-       { "hash", 4,    { NULL, "md5", "sha1", "tiger", }, },
+       { "enc", 8,     { NULL, "1des", "idea", "blowfish", "rc5",
+                         "3des", "cast", "aes", }, },
+       { "hash", 7,    { NULL, "md5", "sha1", "tiger",
+                         "sha2-256", "sha2-384", "sha2-512", }, },
        { "auth", 6,    { NULL, "preshared", "dss", "rsa sig", "rsa enc",
                          "rsa enc revised", }, },
        { "group desc", 5,      { NULL, "modp768", "modp1024", "EC2N 2^155",