X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/202051bb55f5e99fb304c4b68cfb2a729fe2d55e..e7cfa5e63a27e6fbb75e0bbd151af2c7d0d222e9:/print-ip.c?ds=inline diff --git a/print-ip.c b/print-ip.c index a701fede..a77bfce8 100644 --- a/print-ip.c +++ b/print-ip.c @@ -141,13 +141,13 @@ trunc: uint16_t nextproto4_cksum(netdissect_options *ndo, const struct ip *ip, const uint8_t *data, - u_int len, u_int covlen, u_int next_proto) + u_int len, u_int covlen, uint8_t next_proto) { struct phdr { uint32_t src; uint32_t dst; - u_char mbz; - u_char proto; + uint8_t mbz; + uint8_t proto; uint16_t len; } ph; struct cksum_vec vec[2]; @@ -340,7 +340,6 @@ ip_print(netdissect_options *ndo, u_int length) { const struct ip *ip; - const u_char *ipend; u_int off; u_int hlen; u_int len; @@ -397,9 +396,7 @@ ip_print(netdissect_options *ndo, /* * Cut off the snapshot length to the end of the IP payload. */ - ipend = bp + len; - if (ipend < ndo->ndo_snapend) - ndo->ndo_snapend = ipend; + nd_push_snapend(ndo, bp + len); len -= hlen; @@ -483,7 +480,7 @@ ip_print(netdissect_options *ndo, * fragments. */ if ((off & IP_OFFMASK) == 0) { - u_int nh = GET_U_1(ip->ip_p); + uint8_t nh = GET_U_1(ip->ip_p); if (nh != IPPROTO_TCP && nh != IPPROTO_UDP && nh != IPPROTO_SCTP && nh != IPPROTO_DCCP) { @@ -498,8 +495,10 @@ ip_print(netdissect_options *ndo, * Ultra quiet now means that all this stuff should be * suppressed. */ - if (ndo->ndo_qflag > 1) + if (ndo->ndo_qflag > 1) { + nd_pop_packet_info(ndo); return; + } /* * This isn't the first frag, so we're missing the @@ -513,10 +512,12 @@ ip_print(netdissect_options *ndo, else ND_PRINT(" ip-proto-%u", ip_proto); } + nd_pop_packet_info(ndo); return; trunc: nd_print_trunc(ndo); + nd_pop_packet_info(ndo); return; }