summaryrefslogtreecommitdiff
path: root/print-esp.c
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2017-11-22 23:54:09 +0100
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2017-11-22 23:54:09 +0100
commitda20bc56d6100b5275d6f85c4a25bac1dab4e57e (patch)
tree643c746e737c54d5a13d0b0083049d847d2cff24 /print-esp.c
parent3c8f3e13b03380742c24070f8a7b56fe12c6b8ee (diff)
downloadtcpdump-da20bc56d6100b5275d6f85c4a25bac1dab4e57e.tar.gz
Rename EXTRACT_ macros
Now all the macros have a name meaning a count in bytes. With _S_: signed, _U_: unsigned e.g.: EXTRACT_BE_32BITS -> EXTRACT_BE_U_4 EXTRACT_LE_32BITS -> EXTRACT_LE_U_4 ... EXTRACT_BE_INT32 -> EXTRACT_BE_S_4 and have: EXTRACT_8BITS -> EXTRACT_U_1 EXTRACT_INT8 -> EXTRACT_S_1
Diffstat (limited to 'print-esp.c')
-rw-r--r--print-esp.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/print-esp.c b/print-esp.c
index d19b36da..d71bd23e 100644
--- a/print-esp.c
+++ b/print-esp.c
@@ -683,8 +683,8 @@ esp_print(netdissect_options *ndo,
ND_PRINT((ndo, "[|ESP]"));
goto fail;
}
- ND_PRINT((ndo, "ESP(spi=0x%08x", EXTRACT_BE_32BITS(&esp->esp_spi)));
- ND_PRINT((ndo, ",seq=0x%x)", EXTRACT_BE_32BITS(&esp->esp_seq)));
+ ND_PRINT((ndo, "ESP(spi=0x%08x", EXTRACT_BE_U_4(&esp->esp_spi)));
+ ND_PRINT((ndo, ",seq=0x%x)", EXTRACT_BE_U_4(&esp->esp_seq)));
ND_PRINT((ndo, ", length %u", length));
#ifndef HAVE_LIBCRYPTO
@@ -706,14 +706,14 @@ esp_print(netdissect_options *ndo,
case 6:
ip6 = (const struct ip6_hdr *)bp2;
/* we do not attempt to decrypt jumbograms */
- if (!EXTRACT_BE_16BITS(&ip6->ip6_plen))
+ if (!EXTRACT_BE_U_2(&ip6->ip6_plen))
goto fail;
/* if we can't get nexthdr, we do not need to decrypt it */
- len = sizeof(struct ip6_hdr) + EXTRACT_BE_16BITS(&ip6->ip6_plen);
+ len = sizeof(struct ip6_hdr) + EXTRACT_BE_U_2(&ip6->ip6_plen);
/* see if we can find the SA, and if so, decode it */
for (sa = ndo->ndo_sa_list_head; sa != NULL; sa = sa->next) {
- if (sa->spi == EXTRACT_BE_32BITS(&esp->esp_spi) &&
+ if (sa->spi == EXTRACT_BE_U_4(&esp->esp_spi) &&
sa->daddr_version == 6 &&
UNALIGNED_MEMCMP(&sa->daddr.in6, &ip6->ip6_dst,
sizeof(struct in6_addr)) == 0) {
@@ -723,13 +723,13 @@ esp_print(netdissect_options *ndo,
break;
case 4:
/* nexthdr & padding are in the last fragment */
- if (EXTRACT_BE_16BITS(&ip->ip_off) & IP_MF)
+ if (EXTRACT_BE_U_2(&ip->ip_off) & IP_MF)
goto fail;
- len = EXTRACT_BE_16BITS(&ip->ip_len);
+ len = EXTRACT_BE_U_2(&ip->ip_len);
/* see if we can find the SA, and if so, decode it */
for (sa = ndo->ndo_sa_list_head; sa != NULL; sa = sa->next) {
- if (sa->spi == EXTRACT_BE_32BITS(&esp->esp_spi) &&
+ if (sa->spi == EXTRACT_BE_U_4(&esp->esp_spi) &&
sa->daddr_version == 4 &&
UNALIGNED_MEMCMP(&sa->daddr.in4, &ip->ip_dst,
sizeof(struct in_addr)) == 0) {
@@ -807,14 +807,14 @@ esp_print(netdissect_options *ndo,
advance = sizeof(struct newesp);
/* sanity check for pad length */
- if (ep - bp < EXTRACT_8BITS(ep - 2))
+ if (ep - bp < EXTRACT_U_1(ep - 2))
goto fail;
if (padlen)
- *padlen = EXTRACT_8BITS(ep - 2) + 2;
+ *padlen = EXTRACT_U_1(ep - 2) + 2;
if (nhdr)
- *nhdr = EXTRACT_8BITS(ep - 1);
+ *nhdr = EXTRACT_U_1(ep - 1);
ND_PRINT((ndo, ": "));
return advance;