]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-enc.c
Add changes in 4.2.1.
[tcpdump] / print-enc.c
index 14b08f1c083536296f75bf2b121802f786cecf89..5c01f3ef7b6142c39e59028141857ba310252851 100644 (file)
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
+#ifndef lint
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/print-enc.c,v 1.6 2008-11-18 07:35:32 guy Exp $ (LBL)";
+#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include <pcap.h>
 
 #include "interface.h"
+#include "extract.h"
 #include "addrtoname.h"
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-enc.c,v 1.2 2003-11-15 00:39:21 guy Exp $ (LBL)";
-#endif
 #include "enc.h"
 
 #define ENC_PRINT_TYPE(wh, xf, nam) \
@@ -67,12 +68,31 @@ enc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
        ENC_PRINT_TYPE(flags, M_AUTH, "authentic");
        ENC_PRINT_TYPE(flags, M_CONF, "confidential");
        /* ENC_PRINT_TYPE(flags, M_TUNNEL, "tunnel"); */
-       printf("SPI 0x%08x: ", (u_int32_t)ntohl(hdr->spi));
+       printf("SPI 0x%08x: ", EXTRACT_32BITS(&hdr->spi));
 
        length -= ENC_HDRLEN;
-       /* XXX - use the address family */
-       ip_print(p + ENC_HDRLEN, length);
+       caplen -= ENC_HDRLEN;
+       p += ENC_HDRLEN;
+       
+       switch (hdr->af) {
+       case AF_INET:
+               ip_print(gndo, p, length);
+               break;
+#ifdef INET6
+       case AF_INET6:
+               ip6_print(gndo, p, length);
+               break;
+#endif /*INET6*/
+       }
 
 out:
        return (ENC_HDRLEN);
 }
+
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */