X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/1cde6435df23876fb88998e38739def0dc7dca47..1a84a1e1142f2c60dc045c2557ed4d484b576d8b:/print-ip.c diff --git a/print-ip.c b/print-ip.c index f18c7e57..3476ed7a 100644 --- a/print-ip.c +++ b/print-ip.c @@ -84,14 +84,14 @@ ip_printroute(netdissect_options *ndo, * This is used for UDP and TCP pseudo-header in the checksum * calculation. */ -static u_int32_t +static uint32_t ip_finddst(netdissect_options *ndo, const struct ip *ip) { int length; int len; const u_char *cp; - u_int32_t retval; + uint32_t retval; cp = (const u_char *)(ip + 1); length = (IP_HL(ip) << 2) - sizeof(struct ip); @@ -123,7 +123,7 @@ ip_finddst(netdissect_options *ndo, } } trunc: - UNALIGNED_MEMCPY(&retval, &ip->ip_dst.s_addr, sizeof(u_int32_t)); + UNALIGNED_MEMCPY(&retval, &ip->ip_dst.s_addr, sizeof(uint32_t)); return retval; } @@ -132,29 +132,29 @@ trunc: */ int nextproto4_cksum(netdissect_options *ndo, - const struct ip *ip, const u_int8_t *data, + const struct ip *ip, const uint8_t *data, u_int len, u_int covlen, u_int next_proto) { struct phdr { - u_int32_t src; - u_int32_t dst; + uint32_t src; + uint32_t dst; u_char mbz; u_char proto; - u_int16_t len; + uint16_t len; } ph; struct cksum_vec vec[2]; /* pseudo-header.. */ - ph.len = htons((u_int16_t)len); + ph.len = htons((uint16_t)len); ph.mbz = 0; ph.proto = next_proto; - UNALIGNED_MEMCPY(&ph.src, &ip->ip_src.s_addr, sizeof(u_int32_t)); + UNALIGNED_MEMCPY(&ph.src, &ip->ip_src.s_addr, sizeof(uint32_t)); if (IP_HL(ip) == 5) - UNALIGNED_MEMCPY(&ph.dst, &ip->ip_dst.s_addr, sizeof(u_int32_t)); + UNALIGNED_MEMCPY(&ph.dst, &ip->ip_dst.s_addr, sizeof(uint32_t)); else ph.dst = ip_finddst(ndo, ip); - vec[0].ptr = (const u_int8_t *)(void *)&ph; + vec[0].ptr = (const uint8_t *)(void *)&ph; vec[0].len = sizeof(ph); vec[1].ptr = data; vec[1].len = covlen; @@ -436,12 +436,10 @@ again: } break; -#ifdef INET6 case IPPROTO_IPV6: /* ip6-in-ip encapsulation */ ip6_print(ndo, ipds->cp, ipds->len); break; -#endif /*INET6*/ case IPPROTO_RSVP: rsvp_print(ndo, ipds->cp, ipds->len); @@ -525,7 +523,7 @@ ip_print(netdissect_options *ndo, const u_char *ipend; u_int hlen; struct cksum_vec vec[1]; - u_int16_t sum, ip_sum; + uint16_t sum, ip_sum; struct protoent *proto; ipds->ip = (const struct ip *)bp; @@ -623,7 +621,7 @@ ip_print(netdissect_options *ndo, } if (!ndo->ndo_Kflag && (u_char *)ipds->ip + hlen <= ndo->ndo_snapend) { - vec[0].ptr = (const u_int8_t *)(void *)ipds->ip; + vec[0].ptr = (const uint8_t *)(void *)ipds->ip; vec[0].len = hlen; sum = in_cksum(vec, 1); if (sum != 0) { @@ -685,11 +683,9 @@ ipN_print(netdissect_options *ndo, register const u_char *bp, register u_int len case 4: ip_print (ndo, bp, length); return; -#ifdef INET6 case 6: ip6_print (ndo, bp, length); return; -#endif default: ND_PRINT((ndo, "unknown ip %d", IP_V(&hdr))); return;