diff options
author | Guy Harris <guy@alum.mit.edu> | 2019-03-28 11:45:43 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-03-28 11:45:43 -0700 |
commit | 48644533f2fba9a9b4d6e72d3f21f3b5cbcfe438 (patch) | |
tree | c5886b1845c760a1c6b84fe2675ad3305110bfa9 /print-ip-demux.c | |
parent | 400643120a48eca33973f6a47b34f0dcfde4d20a (diff) | |
download | tcpdump-48644533f2fba9a9b4d6e72d3f21f3b5cbcfe438.tar.gz |
Have esp_print() handle printing its payload.
That cleans things up a bit, including removing some duplicate code.
Clean up some other things, and add a length check, while we're at it.
Diffstat (limited to 'print-ip-demux.c')
-rw-r--r-- | print-ip-demux.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/print-ip-demux.c b/print-ip-demux.c index 265658e7..2dae30d2 100644 --- a/print-ip-demux.c +++ b/print-ip-demux.c @@ -66,15 +66,14 @@ again: case IPPROTO_ESP: { - u_int enh, padlen; - advance = esp_print(ndo, bp, length, - iph, &enh, &padlen); - if (advance <= 0) - break; - bp += advance; - length -= advance + padlen; - nh = enh & 0xff; - goto again; + esp_print(ndo, bp, length, iph, ver, fragmented, ttl_hl); + /* + * 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. + */ + break; } case IPPROTO_IPCOMP: @@ -111,7 +110,7 @@ again: case IPPROTO_ICMPV6: icmp6_print(ndo, bp, length, iph, fragmented); - return; + break; case IPPROTO_PIGP: /* @@ -156,10 +155,8 @@ again: case IPPROTO_IPV4: /* ipv4-in-ip encapsulation */ ip_print(ndo, bp, length); - if (! ndo->ndo_vflag) { + if (! ndo->ndo_vflag) ND_PRINT(" (ipip-proto-4)"); - return; - } break; case IPPROTO_IPV6: |