]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-isakmp.c
IPoIB: Add the output with -e for a capture test
[tcpdump] / print-isakmp.c
index fd0cb6c500b66c55a181cfad2163376ed61c3307..18102ebce9fea081b1740c68e9c62d80d1e13416 100644 (file)
@@ -2686,7 +2686,7 @@ ikev2_e_print(netdissect_options *ndo,
 #ifdef HAVE_LIBCRYPTO
        np = GET_U_1(ext->np);
 
-       /* try to decypt it! */
+       /* try to decrypt it! */
        if(esp_print_decrypt_buffer_by_ikev2(ndo,
                                             GET_U_1(base->flags) & ISAKMP_FLAG_I,
                                             base->i_ck, base->r_ck,
@@ -2697,6 +2697,13 @@ ikev2_e_print(netdissect_options *ndo,
                /* got it decrypted, print stuff inside. */
                ikev2_sub_print(ndo, base, np, ext,
                                ndo->ndo_snapend, phase, doi, proto, depth+1);
+
+               /*
+                * esp_print_decrypt_buffer_by_ikev2 pushed information
+                * on the buffer stack; we're done with the buffer, so
+                * pop it (which frees the buffer)
+                */
+               nd_pop_packet_info(ndo);
        }
 #endif
 
@@ -3099,7 +3106,7 @@ isakmp_print(netdissect_options *ndo,
 void
 isakmp_rfc3948_print(netdissect_options *ndo,
                     const u_char *bp, u_int length,
-                    const u_char *bp2)
+                    const u_char *bp2, int ver, int fragmented, u_int ttl_hl)
 {
        ndo->ndo_protocol = "isakmp_rfc3948";
        ND_TCHECK_1(bp);
@@ -3124,20 +3131,16 @@ isakmp_rfc3948_print(netdissect_options *ndo,
 
        /* must be an ESP packet */
        {
-               u_int nh, enh, padlen;
-               int advance;
-
                ND_PRINT("UDP-encap: ");
 
-               advance = esp_print(ndo, bp, length, bp2, &enh, &padlen);
-               if(advance <= 0)
-                       return;
+               esp_print(ndo, bp, length, bp2, ver, fragmented, ttl_hl);
 
-               bp += advance;
-               length -= advance + padlen;
-               nh = enh & 0xff;
-
-               ip_inner_print(ndo, bp, length, nh, bp2);
+               /*
+                * Either this has decrypted the payload and
+                * printed it, in which case there's nothing more
+                * to do, or it hasn't, in which case there's
+                * nothing more to do.
+                */
                return;
        }