diff options
-rw-r--r-- | addrtoname.c | 2 | ||||
-rw-r--r-- | extract.h | 26 | ||||
-rw-r--r-- | print-802_11.c | 4 | ||||
-rw-r--r-- | print-ah.c | 4 | ||||
-rw-r--r-- | print-ahcp.c | 8 | ||||
-rw-r--r-- | print-aodv.c | 38 | ||||
-rw-r--r-- | print-aoe.c | 10 | ||||
-rw-r--r-- | print-ap1394.c | 4 | ||||
-rw-r--r-- | print-arcnet.c | 4 | ||||
-rw-r--r-- | print-arp.c | 12 | ||||
-rw-r--r-- | print-atalk.c | 38 | ||||
-rw-r--r-- | print-atm.c | 24 | ||||
-rw-r--r-- | print-babel.c | 44 | ||||
-rw-r--r-- | print-bfd.c | 28 | ||||
-rw-r--r-- | print-bgp.c | 131 | ||||
-rw-r--r-- | print-bootp.c | 32 | ||||
-rw-r--r-- | print-bt.c | 2 | ||||
-rw-r--r-- | print-carp.c | 4 | ||||
-rw-r--r-- | print-cdp.c | 20 | ||||
-rw-r--r-- | print-cfm.c | 14 | ||||
-rw-r--r-- | print-chdlc.c | 14 | ||||
-rw-r--r-- | print-cnfp.c | 96 | ||||
-rw-r--r-- | print-dccp.c | 30 | ||||
-rw-r--r-- | print-dhcp6.c | 54 | ||||
-rw-r--r-- | print-domain.c | 64 | ||||
-rw-r--r-- | print-dtp.c | 4 | ||||
-rw-r--r-- | print-dvmrp.c | 2 | ||||
-rw-r--r-- | print-eap.c | 10 | ||||
-rw-r--r-- | print-egp.c | 14 | ||||
-rw-r--r-- | print-eigrp.c | 84 | ||||
-rw-r--r-- | print-enc.c | 2 | ||||
-rw-r--r-- | print-esp.c | 16 | ||||
-rw-r--r-- | print-ether.c | 8 | ||||
-rw-r--r-- | print-forces.c | 185 | ||||
-rw-r--r-- | print-fr.c | 8 | ||||
-rw-r--r-- | print-frag6.c | 16 | ||||
-rw-r--r-- | print-geneve.c | 8 | ||||
-rw-r--r-- | print-geonet.c | 10 | ||||
-rw-r--r-- | print-gre.c | 28 | ||||
-rw-r--r-- | print-hncp.c | 44 | ||||
-rw-r--r-- | print-icmp.c | 38 | ||||
-rw-r--r-- | print-icmp6.c | 84 | ||||
-rw-r--r-- | print-igmp.c | 24 | ||||
-rw-r--r-- | print-igrp.c | 14 | ||||
-rw-r--r-- | print-ip.c | 18 | ||||
-rw-r--r-- | print-ip6.c | 4 | ||||
-rw-r--r-- | print-ip6opts.c | 4 | ||||
-rw-r--r-- | print-ipcomp.c | 2 | ||||
-rw-r--r-- | print-ipx.c | 30 | ||||
-rw-r--r-- | print-isakmp.c | 16 | ||||
-rw-r--r-- | print-isoclns.c | 183 | ||||
-rw-r--r-- | print-juniper.c | 64 | ||||
-rw-r--r-- | print-krb.c | 2 | ||||
-rw-r--r-- | print-l2tp.c | 110 | ||||
-rw-r--r-- | print-lane.c | 6 | ||||
-rw-r--r-- | print-ldp.c | 74 | ||||
-rw-r--r-- | print-lisp.c | 19 | ||||
-rw-r--r-- | print-llc.c | 4 | ||||
-rw-r--r-- | print-lldp.c | 66 | ||||
-rw-r--r-- | print-lmp.c | 174 | ||||
-rw-r--r-- | print-lspping.c | 68 | ||||
-rw-r--r-- | print-lwapp.c | 8 | ||||
-rw-r--r-- | print-lwres.c | 99 | ||||
-rw-r--r-- | print-m3ua.c | 13 | ||||
-rw-r--r-- | print-medsa.c | 2 | ||||
-rw-r--r-- | print-mobile.c | 4 | ||||
-rw-r--r-- | print-mobility.c | 28 | ||||
-rw-r--r-- | print-mpcp.c | 20 | ||||
-rw-r--r-- | print-mpls.c | 2 | ||||
-rw-r--r-- | print-mptcp.c | 34 | ||||
-rw-r--r-- | print-msdp.c | 4 | ||||
-rw-r--r-- | print-nfs.c | 246 | ||||
-rw-r--r-- | print-nsh.c | 8 | ||||
-rw-r--r-- | print-ntp.c | 52 | ||||
-rw-r--r-- | print-olsr.c | 26 | ||||
-rw-r--r-- | print-openflow-1.0.c | 277 | ||||
-rw-r--r-- | print-openflow.c | 4 | ||||
-rw-r--r-- | print-ospf.c | 114 | ||||
-rw-r--r-- | print-ospf6.c | 80 | ||||
-rw-r--r-- | print-otv.c | 4 | ||||
-rw-r--r-- | print-pflog.c | 4 | ||||
-rw-r--r-- | print-pgm.c | 89 | ||||
-rw-r--r-- | print-pim.c | 74 | ||||
-rw-r--r-- | print-ppp.c | 78 | ||||
-rw-r--r-- | print-pppoe.c | 8 | ||||
-rw-r--r-- | print-pptp.c | 72 | ||||
-rw-r--r-- | print-radius.c | 38 | ||||
-rw-r--r-- | print-rip.c | 34 | ||||
-rw-r--r-- | print-ripng.c | 2 | ||||
-rw-r--r-- | print-rpki-rtr.c | 18 | ||||
-rw-r--r-- | print-rrcp.c | 10 | ||||
-rw-r--r-- | print-rsvp.c | 216 | ||||
-rw-r--r-- | print-rt6.c | 4 | ||||
-rw-r--r-- | print-rx.c | 144 | ||||
-rw-r--r-- | print-sctp.c | 52 | ||||
-rw-r--r-- | print-sflow.c | 222 | ||||
-rw-r--r-- | print-sl.c | 4 | ||||
-rw-r--r-- | print-sll.c | 12 | ||||
-rw-r--r-- | print-slow.c | 40 | ||||
-rw-r--r-- | print-smb.c | 18 | ||||
-rw-r--r-- | print-stp.c | 76 | ||||
-rw-r--r-- | print-sunatm.c | 2 | ||||
-rw-r--r-- | print-sunrpc.c | 14 | ||||
-rw-r--r-- | print-symantec.c | 4 | ||||
-rw-r--r-- | print-tcp.c | 44 | ||||
-rw-r--r-- | print-tftp.c | 6 | ||||
-rw-r--r-- | print-timed.c | 4 | ||||
-rw-r--r-- | print-tipc.c | 50 | ||||
-rw-r--r-- | print-token.c | 16 | ||||
-rw-r--r-- | print-udld.c | 8 | ||||
-rw-r--r-- | print-udp.c | 76 | ||||
-rw-r--r-- | print-vqp.c | 8 | ||||
-rw-r--r-- | print-vrrp.c | 4 | ||||
-rw-r--r-- | print-vtp.c | 28 | ||||
-rw-r--r-- | print-vxlan-gpe.c | 2 | ||||
-rw-r--r-- | print-vxlan.c | 2 | ||||
-rw-r--r-- | print-wb.c | 54 | ||||
-rw-r--r-- | print-zeromq.c | 4 | ||||
-rw-r--r-- | smbutil.c | 20 |
119 files changed, 2378 insertions, 2358 deletions
diff --git a/addrtoname.c b/addrtoname.c index 731439c3..b26047c4 100644 --- a/addrtoname.c +++ b/addrtoname.c @@ -539,7 +539,7 @@ etheraddr_string(netdissect_options *ndo, register const u_char *ep) } #endif cp = buf; - oui = EXTRACT_24BITS(ep); + oui = EXTRACT_BE_24BITS(ep); *cp++ = hex[*ep >> 4 ]; *cp++ = hex[*ep++ & 0xf]; for (i = 5; --i >= 0;) { @@ -83,19 +83,19 @@ * architectures in all cases? */ static inline uint16_t UNALIGNED_OK -EXTRACT_16BITS(const void *p) +EXTRACT_BE_16BITS(const void *p) { return ((uint16_t)ntohs(*(const uint16_t *)(p))); } static inline uint32_t UNALIGNED_OK -EXTRACT_32BITS(const void *p) +EXTRACT_BE_32BITS(const void *p) { return ((uint32_t)ntohl(*(const uint32_t *)(p))); } static inline uint64_t UNALIGNED_OK -EXTRACT_64BITS(const void *p) +EXTRACT_BE_64BITS(const void *p) { return ((uint64_t)(((uint64_t)ntohl(*((const uint32_t *)(p) + 0))) << 32 | ((uint64_t)ntohl(*((const uint32_t *)(p) + 1))) << 0)); @@ -164,19 +164,19 @@ typedef struct { } __attribute__((packed)) unaligned_uint32_t; UNALIGNED_OK static inline uint16_t -EXTRACT_16BITS(const void *p) +EXTRACT_BE_16BITS(const void *p) { return ((uint16_t)ntohs(((const unaligned_uint16_t *)(p))->val)); } UNALIGNED_OK static inline uint32_t -EXTRACT_32BITS(const void *p) +EXTRACT_BE_32BITS(const void *p) { return ((uint32_t)ntohl(((const unaligned_uint32_t *)(p))->val)); } UNALIGNED_OK static inline uint64_t -EXTRACT_64BITS(const void *p) +EXTRACT_BE_64BITS(const void *p) { return ((uint64_t)(((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 0)->val)) << 32 | ((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 1)->val)) << 0)); @@ -190,15 +190,15 @@ EXTRACT_64BITS(const void *p) * quantities the hard way - fetch the bytes one at a time and * assemble them. */ -#define EXTRACT_16BITS(p) \ +#define EXTRACT_BE_16BITS(p) \ ((uint16_t)(((uint16_t)(*((const uint8_t *)(p) + 0)) << 8) | \ ((uint16_t)(*((const uint8_t *)(p) + 1)) << 0))) -#define EXTRACT_32BITS(p) \ +#define EXTRACT_BE_32BITS(p) \ ((uint32_t)(((uint32_t)(*((const uint8_t *)(p) + 0)) << 24) | \ ((uint32_t)(*((const uint8_t *)(p) + 1)) << 16) | \ ((uint32_t)(*((const uint8_t *)(p) + 2)) << 8) | \ ((uint32_t)(*((const uint8_t *)(p) + 3)) << 0))) -#define EXTRACT_64BITS(p) \ +#define EXTRACT_BE_64BITS(p) \ ((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 56) | \ ((uint64_t)(*((const uint8_t *)(p) + 1)) << 48) | \ ((uint64_t)(*((const uint8_t *)(p) + 2)) << 40) | \ @@ -209,19 +209,19 @@ EXTRACT_64BITS(const void *p) ((uint64_t)(*((const uint8_t *)(p) + 7)) << 0))) #endif /* unaligned access checks */ -#define EXTRACT_24BITS(p) \ +#define EXTRACT_BE_24BITS(p) \ ((uint32_t)(((uint32_t)(*((const uint8_t *)(p) + 0)) << 16) | \ ((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \ ((uint32_t)(*((const uint8_t *)(p) + 2)) << 0))) -#define EXTRACT_40BITS(p) \ +#define EXTRACT_BE_40BITS(p) \ ((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 32) | \ ((uint64_t)(*((const uint8_t *)(p) + 1)) << 24) | \ ((uint64_t)(*((const uint8_t *)(p) + 2)) << 16) | \ ((uint64_t)(*((const uint8_t *)(p) + 3)) << 8) | \ ((uint64_t)(*((const uint8_t *)(p) + 4)) << 0))) -#define EXTRACT_48BITS(p) \ +#define EXTRACT_BE_48BITS(p) \ ((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 40) | \ ((uint64_t)(*((const uint8_t *)(p) + 1)) << 32) | \ ((uint64_t)(*((const uint8_t *)(p) + 2)) << 24) | \ @@ -229,7 +229,7 @@ EXTRACT_64BITS(const void *p) ((uint64_t)(*((const uint8_t *)(p) + 4)) << 8) | \ ((uint64_t)(*((const uint8_t *)(p) + 5)) << 0))) -#define EXTRACT_56BITS(p) \ +#define EXTRACT_BE_56BITS(p) \ ((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 48) | \ ((uint64_t)(*((const uint8_t *)(p) + 1)) << 40) | \ ((uint64_t)(*((const uint8_t *)(p) + 2)) << 32) | \ diff --git a/print-802_11.c b/print-802_11.c index d8bf039d..1f6f74f2 100644 --- a/print-802_11.c +++ b/print-802_11.c @@ -3275,7 +3275,7 @@ ieee802_11_avs_radio_print(netdissect_options *ndo, return caplen; } - caphdr_len = EXTRACT_32BITS(p + 4); + caphdr_len = EXTRACT_BE_32BITS(p + 4); if (caphdr_len < 8) { /* * Yow! The capture header length is claimed not @@ -3327,7 +3327,7 @@ prism_if_print(netdissect_options *ndo, return caplen; } - msgcode = EXTRACT_32BITS(p); + msgcode = EXTRACT_BE_32BITS(p); if (msgcode == WLANCAP_MAGIC_COOKIE_V1 || msgcode == WLANCAP_MAGIC_COOKIE_V2) return ieee802_11_avs_radio_print(ndo, p, length, caplen); @@ -46,11 +46,11 @@ ah_print(netdissect_options *ndo, register const u_char *bp) sumlen = ah->ah_len << 2; - ND_PRINT((ndo, "AH(spi=0x%08x", EXTRACT_32BITS(&ah->ah_spi))); + ND_PRINT((ndo, "AH(spi=0x%08x", EXTRACT_BE_32BITS(&ah->ah_spi))); if (ndo->ndo_vflag) ND_PRINT((ndo, ",sumlen=%d", sumlen)); ND_TCHECK_32BITS(ah + 1); - ND_PRINT((ndo, ",seq=0x%x", EXTRACT_32BITS(ah + 1))); + ND_PRINT((ndo, ",seq=0x%x", EXTRACT_BE_32BITS(ah + 1))); if (!ND_TTEST2(*bp, sizeof(struct ah) + sumlen)) { ND_PRINT((ndo, "[truncated]):")); return -1; diff --git a/print-ahcp.c b/print-ahcp.c index 067b5069..e8b9d327 100644 --- a/print-ahcp.c +++ b/print-ahcp.c @@ -107,7 +107,7 @@ ahcp_time_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) if (cp + 4 != ep) goto invalid; ND_TCHECK2(*cp, 4); - t = EXTRACT_32BITS(cp); + t = EXTRACT_BE_32BITS(cp); if (NULL == (tm = gmtime(&t))) ND_PRINT((ndo, ": gmtime() error")); else if (0 == strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm)) @@ -131,7 +131,7 @@ ahcp_seconds_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) if (cp + 4 != ep) goto invalid; ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ": %us", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ": %us", EXTRACT_BE_32BITS(cp))); return 0; invalid: @@ -317,7 +317,7 @@ ahcp1_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) cp += 1; /* Length */ ND_TCHECK2(*cp, 2); - body_len = EXTRACT_16BITS(cp); + body_len = EXTRACT_BE_16BITS(cp); cp += 2; if (ndo->ndo_vflag) { @@ -381,7 +381,7 @@ ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len) cp += 1; /* Nonce */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", Nonce 0x%08x", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ", Nonce 0x%08x", EXTRACT_BE_32BITS(cp))); cp += 4; /* Source Id */ ND_TCHECK2(*cp, 8); diff --git a/print-aodv.c b/print-aodv.c index fe75db86..4e4501b5 100644 --- a/print-aodv.c +++ b/print-aodv.c @@ -192,7 +192,7 @@ aodv_extension(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\text HELLO %ld ms", - (unsigned long)EXTRACT_32BITS(&ah->interval))); + (unsigned long) EXTRACT_BE_32BITS(&ah->interval))); break; default: @@ -222,11 +222,11 @@ aodv_rreq(netdissect_options *ndo, const u_char *dat, u_int length) ap->rreq_type & RREQ_DEST ? "[D]" : "", ap->rreq_type & RREQ_UNKNOWN ? "[U] " : " ", ap->rreq_hops, - (unsigned long)EXTRACT_32BITS(&ap->rreq_id), + (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_id), ipaddr_string(ndo, &ap->rreq_da), - (unsigned long)EXTRACT_32BITS(&ap->rreq_ds), + (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_ds), ipaddr_string(ndo, &ap->rreq_oa), - (unsigned long)EXTRACT_32BITS(&ap->rreq_os))); + (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_os))); i = length - sizeof(*ap); if (i >= sizeof(struct aodv_ext)) aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i); @@ -252,9 +252,9 @@ aodv_rrep(netdissect_options *ndo, const u_char *dat, u_int length) ap->rrep_ps & RREP_PREFIX_MASK, ap->rrep_hops, ipaddr_string(ndo, &ap->rrep_da), - (unsigned long)EXTRACT_32BITS(&ap->rrep_ds), + (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_ds), ipaddr_string(ndo, &ap->rrep_oa), - (unsigned long)EXTRACT_32BITS(&ap->rrep_life))); + (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_life))); i = length - sizeof(*ap); if (i >= sizeof(struct aodv_ext)) aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i); @@ -284,7 +284,7 @@ aodv_rerr(netdissect_options *ndo, const u_char *dat, u_int length) if (i < sizeof(*dp)) goto trunc; ND_PRINT((ndo, " {%s}(%ld)", ipaddr_string(ndo, &dp->u_da), - (unsigned long)EXTRACT_32BITS(&dp->u_ds))); + (unsigned long) EXTRACT_BE_32BITS(&dp->u_ds))); dp++; i -= sizeof(*dp); } @@ -311,11 +311,11 @@ aodv_v6_rreq(netdissect_options *ndo, const u_char *dat, u_int length) ap->rreq_type & RREQ_DEST ? "[D]" : "", ap->rreq_type & RREQ_UNKNOWN ? "[U] " : " ", ap->rreq_hops, - (unsigned long)EXTRACT_32BITS(&ap->rreq_id), + (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_id), ip6addr_string(ndo, &ap->rreq_da), - (unsigned long)EXTRACT_32BITS(&ap->rreq_ds), + (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_ds), ip6addr_string(ndo, &ap->rreq_oa), - (unsigned long)EXTRACT_32BITS(&ap->rreq_os))); + (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_os))); i = length - sizeof(*ap); if (i >= sizeof(struct aodv_ext)) aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i); @@ -341,9 +341,9 @@ aodv_v6_rrep(netdissect_options *ndo, const u_char *dat, u_int length) ap->rrep_ps & RREP_PREFIX_MASK, ap->rrep_hops, ip6addr_string(ndo, &ap->rrep_da), - (unsigned long)EXTRACT_32BITS(&ap->rrep_ds), + (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_ds), ip6addr_string(ndo, &ap->rrep_oa), - (unsigned long)EXTRACT_32BITS(&ap->rrep_life))); + (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_life))); i = length - sizeof(*ap); if (i >= sizeof(struct aodv_ext)) aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i); @@ -373,7 +373,7 @@ aodv_v6_rerr(netdissect_options *ndo, const u_char *dat, u_int length) if (i < sizeof(*dp6)) goto trunc; ND_PRINT((ndo, " {%s}(%ld)", ip6addr_string(ndo, &dp6->u_da), - (unsigned long)EXTRACT_32BITS(&dp6->u_ds))); + (unsigned long) EXTRACT_BE_32BITS(&dp6->u_ds))); dp6++; i -= sizeof(*dp6); } @@ -400,11 +400,11 @@ aodv_v6_draft_01_rreq(netdissect_options *ndo, const u_char *dat, u_int length) ap->rreq_type & RREQ_DEST ? "[D]" : "", ap->rreq_type & RREQ_UNKNOWN ? "[U] " : " ", ap->rreq_hops, - (unsigned long)EXTRACT_32BITS(&ap->rreq_id), + (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_id), ip6addr_string(ndo, &ap->rreq_da), - (unsigned long)EXTRACT_32BITS(&ap->rreq_ds), + (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_ds), ip6addr_string(ndo, &ap->rreq_oa), - (unsigned long)EXTRACT_32BITS(&ap->rreq_os))); + (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_os))); i = length - sizeof(*ap); if (i >= sizeof(struct aodv_ext)) aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i); @@ -430,9 +430,9 @@ aodv_v6_draft_01_rrep(netdissect_options *ndo, const u_char *dat, u_int length) ap->rrep_ps & RREP_PREFIX_MASK, ap->rrep_hops, ip6addr_string(ndo, &ap->rrep_da), - (unsigned long)EXTRACT_32BITS(&ap->rrep_ds), + (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_ds), ip6addr_string(ndo, &ap->rrep_oa), - (unsigned long)EXTRACT_32BITS(&ap->rrep_life))); + (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_life))); i = length - sizeof(*ap); if (i >= sizeof(struct aodv_ext)) aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i); @@ -462,7 +462,7 @@ aodv_v6_draft_01_rerr(netdissect_options *ndo, const u_char *dat, u_int length) if (i < sizeof(*dp6)) goto trunc; ND_PRINT((ndo, " {%s}(%ld)", ip6addr_string(ndo, &dp6->u_da), - (unsigned long)EXTRACT_32BITS(&dp6->u_ds))); + (unsigned long) EXTRACT_BE_32BITS(&dp6->u_ds))); dp6++; i -= sizeof(*dp6); } diff --git a/print-aoe.c b/print-aoe.c index 97e93df2..4b483bd8 100644 --- a/print-aoe.c +++ b/print-aoe.c @@ -214,11 +214,11 @@ aoev1_query_print(netdissect_options *ndo, goto invalid; /* Buffer Count */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, "\n\tBuffer Count: %u", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, "\n\tBuffer Count: %u", EXTRACT_BE_16BITS(cp))); cp += 2; /* Firmware Version */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", Firmware Version: %u", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, ", Firmware Version: %u", EXTRACT_BE_16BITS(cp))); cp += 2; /* Sector Count */ ND_TCHECK2(*cp, 1); @@ -231,7 +231,7 @@ aoev1_query_print(netdissect_options *ndo, cp += 1; /* Config String Length */ ND_TCHECK2(*cp, 2); - cslen = EXTRACT_16BITS(cp); + cslen = EXTRACT_BE_16BITS(cp); cp += 2; if (cslen > AOEV1_MAX_CONFSTR_LEN || AOEV1_QUERY_ARG_LEN + cslen > len) goto invalid; @@ -362,7 +362,7 @@ aoev1_print(netdissect_options *ndo, cp += 1; /* Major */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, "\n\tMajor: 0x%04x", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, "\n\tMajor: 0x%04x", EXTRACT_BE_16BITS(cp))); cp += 2; /* Minor */ ND_TCHECK2(*cp, 1); @@ -375,7 +375,7 @@ aoev1_print(netdissect_options *ndo, ND_PRINT((ndo, ", Command: %s", tok2str(cmdcode_str, "Unknown (0x%02x)", command))); /* Tag */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", Tag: 0x%08x", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ", Tag: 0x%08x", EXTRACT_BE_32BITS(cp))); cp += 4; /* Arg */ cmd_decoder = diff --git a/print-ap1394.c b/print-ap1394.c index 79401cba..69fe2c1c 100644 --- a/print-ap1394.c +++ b/print-ap1394.c @@ -67,7 +67,7 @@ ap1394_hdr_print(netdissect_options *ndo, register const u_char *bp, u_int lengt fwaddr_string(ndo, fp->firewire_shost), fwaddr_string(ndo, fp->firewire_dhost))); - firewire_type = EXTRACT_16BITS(&fp->firewire_type); + firewire_type = EXTRACT_BE_16BITS(&fp->firewire_type); if (!ndo->ndo_qflag) { ND_PRINT((ndo, ", ethertype %s (0x%04x)", tok2str(ethertype_values,"Unknown", firewire_type), @@ -107,7 +107,7 @@ ap1394_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch fp = (const struct firewire_header *)p; p += FIREWIRE_HDRLEN; - ether_type = EXTRACT_16BITS(&fp->firewire_type); + ether_type = EXTRACT_BE_16BITS(&fp->firewire_type); src.addr = fp->firewire_shost; src.addr_string = fwaddr_string; dst.addr = fp->firewire_dhost; diff --git a/print-arcnet.c b/print-arcnet.c index abc19b80..321bb6a6 100644 --- a/print-arcnet.c +++ b/print-arcnet.c @@ -216,11 +216,11 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch return (caplen); } flag = ap->arc_flag2; - seqid = EXTRACT_16BITS(&ap->arc_seqid2); + seqid = EXTRACT_BE_16BITS(&ap->arc_seqid2); archdrlen = ARC_HDRNEWLEN_EXC; } else { flag = ap->arc_flag; - seqid = EXTRACT_16BITS(&ap->arc_seqid); + seqid = EXTRACT_BE_16BITS(&ap->arc_seqid); archdrlen = ARC_HDRNEWLEN; } } diff --git a/print-arp.c b/print-arp.c index 96727faa..69a86ce2 100644 --- a/print-arp.c +++ b/print-arp.c @@ -86,11 +86,11 @@ struct arp_pkthdr { #define ARP_HDRLEN 8 -#define HRD(ap) EXTRACT_16BITS(&(ap)->ar_hrd) +#define HRD(ap) EXTRACT_BE_16BITS(&(ap)->ar_hrd) #define HRD_LEN(ap) ((ap)->ar_hln) #define PROTO_LEN(ap) ((ap)->ar_pln) -#define OP(ap) EXTRACT_16BITS(&(ap)->ar_op) -#define PRO(ap) EXTRACT_16BITS(&(ap)->ar_pro) +#define OP(ap) EXTRACT_BE_16BITS(&(ap)->ar_op) +#define PRO(ap) EXTRACT_BE_16BITS(&(ap)->ar_pro) #define SHA(ap) (ar_sha(ap)) #define SPA(ap) (ar_spa(ap)) #define THA(ap) (ar_tha(ap)) @@ -153,12 +153,12 @@ struct atmarp_pkthdr { u_char aar_tpa[]; /* target protocol address */ #endif -#define ATMHRD(ap) EXTRACT_16BITS(&(ap)->aar_hrd) +#define ATMHRD(ap) EXTRACT_BE_16BITS(&(ap)->aar_hrd) #define ATMSHRD_LEN(ap) ((ap)->aar_shtl & ATMARP_LEN_MASK) #define ATMSSLN(ap) ((ap)->aar_sstl & ATMARP_LEN_MASK) #define ATMSPROTO_LEN(ap) ((ap)->aar_spln) -#define ATMOP(ap) EXTRACT_16BITS(&(ap)->aar_op) -#define ATMPRO(ap) EXTRACT_16BITS(&(ap)->aar_pro) +#define ATMOP(ap) EXTRACT_BE_16BITS(&(ap)->aar_op) +#define ATMPRO(ap) EXTRACT_BE_16BITS(&(ap)->aar_pro) #define ATMTHRD_LEN(ap) ((ap)->aar_thtl & ATMARP_LEN_MASK) #define ATMTSLN(ap) ((ap)->aar_tstl & ATMARP_LEN_MASK) #define ATMTPROTO_LEN(ap) ((ap)->aar_tpln) diff --git a/print-atalk.c b/print-atalk.c index 08376b62..cf93b7e8 100644 --- a/print-atalk.c +++ b/print-atalk.c @@ -144,11 +144,11 @@ llap_print(netdissect_options *ndo, return (0); /* cut short by the snapshot length */ } dp = (const struct atDDP *)bp; - snet = EXTRACT_16BITS(&dp->srcNet); + snet = EXTRACT_BE_16BITS(&dp->srcNet); ND_PRINT((ndo, "%s.%s", ataddr_string(ndo, snet, dp->srcNode), ddpskt_string(ndo, dp->srcSkt))); ND_PRINT((ndo, " > %s.%s:", - ataddr_string(ndo, EXTRACT_16BITS(&dp->dstNet), dp->dstNode), + ataddr_string(ndo, EXTRACT_BE_16BITS(&dp->dstNet), dp->dstNode), ddpskt_string(ndo, dp->dstSkt))); bp += ddpSize; length -= ddpSize; @@ -194,11 +194,11 @@ atalk_print(netdissect_options *ndo, return; } dp = (const struct atDDP *)bp; - snet = EXTRACT_16BITS(&dp->srcNet); + snet = EXTRACT_BE_16BITS(&dp->srcNet); ND_PRINT((ndo, "%s.%s", ataddr_string(ndo, snet, dp->srcNode), ddpskt_string(ndo, dp->srcSkt))); ND_PRINT((ndo, " > %s.%s: ", - ataddr_string(ndo, EXTRACT_16BITS(&dp->dstNet), dp->dstNode), + ataddr_string(ndo, EXTRACT_BE_16BITS(&dp->dstNet), dp->dstNode), ddpskt_string(ndo, dp->dstSkt))); bp += ddpSize; length -= ddpSize; @@ -225,10 +225,10 @@ aarp_print(netdissect_options *ndo, ND_PRINT((ndo, " [|aarp %u]", length)); return; } - if (EXTRACT_16BITS(&ap->htype) == 1 && - EXTRACT_16BITS(&ap->ptype) == ETHERTYPE_ATALK && + if (EXTRACT_BE_16BITS(&ap->htype) == 1 && + EXTRACT_BE_16BITS(&ap->ptype) == ETHERTYPE_ATALK && ap->halen == 6 && ap->palen == 4 ) - switch (EXTRACT_16BITS(&ap->op)) { + switch (EXTRACT_BE_16BITS(&ap->op)) { case 1: /* request */ ND_PRINT((ndo, "who-has %s tell %s", AT(pdaddr), AT(psaddr))); @@ -243,8 +243,8 @@ aarp_print(netdissect_options *ndo, return; } ND_PRINT((ndo, "len %u op %u htype %u ptype %#x halen %u palen %u", - length, EXTRACT_16BITS(&ap->op), EXTRACT_16BITS(&ap->htype), - EXTRACT_16BITS(&ap->ptype), ap->halen, ap->palen)); + length, EXTRACT_BE_16BITS(&ap->op), EXTRACT_BE_16BITS(&ap->htype), + EXTRACT_BE_16BITS(&ap->ptype), ap->halen, ap->palen)); } /* @@ -297,7 +297,7 @@ atp_print(netdissect_options *ndo, case atpReqCode: ND_PRINT((ndo, " atp-req%s %d", ap->control & atpXO? " " : "*", - EXTRACT_16BITS(&ap->transID))); + EXTRACT_BE_16BITS(&ap->transID))); atp_bitmap_print(ndo, ap->bitmap); @@ -320,7 +320,7 @@ atp_print(netdissect_options *ndo, case atpRspCode: ND_PRINT((ndo, " atp-resp%s%d:%d (%u)", ap->control & atpEOM? "*" : " ", - EXTRACT_16BITS(&ap->transID), ap->bitmap, length)); + EXTRACT_BE_16BITS(&ap->transID), ap->bitmap, length)); switch (ap->control & (atpXO|atpSTS)) { case atpXO: ND_PRINT((ndo, " [XO]")); @@ -335,7 +335,7 @@ atp_print(netdissect_options *ndo, break; case atpRelCode: - ND_PRINT((ndo, " atp-rel %d", EXTRACT_16BITS(&ap->transID))); + ND_PRINT((ndo, " atp-rel %d", EXTRACT_BE_16BITS(&ap->transID))); atp_bitmap_print(ndo, ap->bitmap); @@ -363,10 +363,10 @@ atp_print(netdissect_options *ndo, default: ND_PRINT((ndo, " atp-0x%x %d (%u)", ap->control, - EXTRACT_16BITS(&ap->transID), length)); + EXTRACT_BE_16BITS(&ap->transID), length)); break; } - data = EXTRACT_32BITS(&ap->userData); + data = EXTRACT_BE_32BITS(&ap->userData); if (data != 0) ND_PRINT((ndo, " 0x%x", data)); } @@ -448,11 +448,11 @@ nbp_print(netdissect_options *ndo, ND_PRINT((ndo, " [ntup=%d]", np->control & 0xf)); if (tp->enumerator) ND_PRINT((ndo, " [enum=%d]", tp->enumerator)); - if (EXTRACT_16BITS(&tp->net) != snet || + if (EXTRACT_BE_16BITS(&tp->net) != snet || tp->node != snode || tp->skt != skt) ND_PRINT((ndo, " [addr=%s.%d]", - ataddr_string(ndo, EXTRACT_16BITS(&tp->net), - tp->node), tp->skt)); + ataddr_string(ndo, EXTRACT_BE_16BITS(&tp->net), + tp->node), tp->skt)); break; case nbpLkUpReply: @@ -519,9 +519,9 @@ nbp_tuple_print(netdissect_options *ndo, ND_PRINT((ndo, " %d", tp->skt)); /* if the address doesn't match the src address, it's an anomaly */ - if (EXTRACT_16BITS(&tp->net) != snet || tp->node != snode) + if (EXTRACT_BE_16BITS(&tp->net) != snet || tp->node != snode) ND_PRINT((ndo, " [addr=%s]", - ataddr_string(ndo, EXTRACT_16BITS(&tp->net), tp->node))); + ataddr_string(ndo, EXTRACT_BE_16BITS(&tp->net), tp->node))); return (tpn); } diff --git a/print-atm.c b/print-atm.c index 12ada49d..b3033182 100644 --- a/print-atm.c +++ b/print-atm.c @@ -282,7 +282,7 @@ atm_if_print(netdissect_options *ndo, * packet nor an RFC 2684 routed NLPID-formatted PDU nor * an 802.2-but-no-SNAP IP packet. */ - llchdr = EXTRACT_24BITS(p); + llchdr = EXTRACT_BE_24BITS(p); if (llchdr != LLC_UI_HDR(LLCSAP_SNAP) && llchdr != LLC_UI_HDR(LLCSAP_ISONS) && llchdr != LLC_UI_HDR(LLCSAP_IP)) { @@ -308,10 +308,10 @@ atm_if_print(netdissect_options *ndo, } if (ndo->ndo_eflag) ND_PRINT((ndo, "%08x%08x %08x%08x ", - EXTRACT_32BITS(p), - EXTRACT_32BITS(p+4), - EXTRACT_32BITS(p+8), - EXTRACT_32BITS(p+12))); + EXTRACT_BE_32BITS(p), + EXTRACT_BE_32BITS(p + 4), + EXTRACT_BE_32BITS(p + 8), + EXTRACT_BE_32BITS(p + 12))); p += 20; length -= 20; caplen -= 20; @@ -366,7 +366,7 @@ sig_print(netdissect_options *ndo, * do from the caplen test above, we also know we have * the call reference. */ - call_ref = EXTRACT_24BITS(&p[CALL_REF_POS]); + call_ref = EXTRACT_BE_24BITS(&p[CALL_REF_POS]); ND_PRINT((ndo, "CALL_REF:0x%06x", call_ref)); } else { /* SSCOP with some unknown protocol atop it */ @@ -461,7 +461,7 @@ oam_print (netdissect_options *ndo, ND_TCHECK(*(p+ATM_HDR_LEN_NOHEC+hec)); - cell_header = EXTRACT_32BITS(p+hec); + cell_header = EXTRACT_BE_32BITS(p + hec); cell_type = ((*(p+ATM_HDR_LEN_NOHEC+hec))>>4) & 0x0f; func_type = (*(p+ATM_HDR_LEN_NOHEC+hec)) & 0x0f; @@ -501,17 +501,17 @@ oam_print (netdissect_options *ndo, tok2str(oam_fm_loopback_indicator_values, "Unknown", oam_ptr.oam_fm_loopback->loopback_indicator & OAM_FM_LOOPBACK_INDICATOR_MASK), - EXTRACT_32BITS(&oam_ptr.oam_fm_loopback->correlation_tag))); + EXTRACT_BE_32BITS(&oam_ptr.oam_fm_loopback->correlation_tag))); ND_PRINT((ndo, "\n\tLocation-ID ")); for (idx = 0; idx < sizeof(oam_ptr.oam_fm_loopback->loopback_id); idx++) { if (idx % 2) { - ND_PRINT((ndo, "%04x ", EXTRACT_16BITS(&oam_ptr.oam_fm_loopback->loopback_id[idx]))); + ND_PRINT((ndo, "%04x ", EXTRACT_BE_16BITS(&oam_ptr.oam_fm_loopback->loopback_id[idx]))); } } ND_PRINT((ndo, "\n\tSource-ID ")); for (idx = 0; idx < sizeof(oam_ptr.oam_fm_loopback->source_id); idx++) { if (idx % 2) { - ND_PRINT((ndo, "%04x ", EXTRACT_16BITS(&oam_ptr.oam_fm_loopback->source_id[idx]))); + ND_PRINT((ndo, "%04x ", EXTRACT_BE_16BITS(&oam_ptr.oam_fm_loopback->source_id[idx]))); } } break; @@ -524,7 +524,7 @@ oam_print (netdissect_options *ndo, ND_PRINT((ndo, "\n\tLocation-ID ")); for (idx = 0; idx < sizeof(oam_ptr.oam_fm_ais_rdi->failure_location); idx++) { if (idx % 2) { - ND_PRINT((ndo, "%04x ", EXTRACT_16BITS(&oam_ptr.oam_fm_ais_rdi->failure_location[idx]))); + ND_PRINT((ndo, "%04x ", EXTRACT_BE_16BITS(&oam_ptr.oam_fm_ais_rdi->failure_location[idx]))); } } break; @@ -539,7 +539,7 @@ oam_print (netdissect_options *ndo, /* crc10 checksum verification */ ND_TCHECK2(*(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN), 2); - cksum = EXTRACT_16BITS(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN) + cksum = EXTRACT_BE_16BITS(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN) & OAM_CRC10_MASK; cksum_shouldbe = verify_crc10_cksum(0, p, OAM_PAYLOAD_LEN); diff --git a/print-babel.c b/print-babel.c index f8741d7b..df0c5941 100644 --- a/print-babel.c +++ b/print-babel.c @@ -310,14 +310,14 @@ subtlvs_print(netdissect_options *ndo, if(tlv_type == MESSAGE_HELLO) { if(sublen < 4) goto invalid; - t1 = EXTRACT_32BITS(cp); + t1 = EXTRACT_BE_32BITS(cp); ND_PRINT((ndo, " %s", format_timestamp(t1))); } else if(tlv_type == MESSAGE_IHU) { if(sublen < 8) goto invalid; - t1 = EXTRACT_32BITS(cp); + t1 = EXTRACT_BE_32BITS(cp); ND_PRINT((ndo, " %s", format_timestamp(t1))); - t2 = EXTRACT_32BITS(cp + 4); + t2 = EXTRACT_BE_32BITS(cp + 4); ND_PRINT((ndo, "|%s", format_timestamp(t2))); } else ND_PRINT((ndo, " (bogus)")); @@ -350,7 +350,7 @@ babel_print_v2(netdissect_options *ndo, ND_TCHECK2(*cp, 4); if (length < 4) goto invalid; - bodylen = EXTRACT_16BITS(cp + 2); + bodylen = EXTRACT_BE_16BITS(cp + 2); ND_PRINT((ndo, " (%u)", bodylen)); /* Process the TLVs in the body */ @@ -391,8 +391,8 @@ babel_print_v2(netdissect_options *ndo, else { ND_PRINT((ndo, "\n\tAcknowledgment Request ")); if(len < 6) goto invalid; - nonce = EXTRACT_16BITS(message + 4); - interval = EXTRACT_16BITS(message + 6); + nonce = EXTRACT_BE_16BITS(message + 4); + interval = EXTRACT_BE_16BITS(message + 6); ND_PRINT((ndo, "%04x %s", nonce, format_interval(interval))); } } @@ -405,7 +405,7 @@ babel_print_v2(netdissect_options *ndo, else { ND_PRINT((ndo, "\n\tAcknowledgment ")); if(len < 2) goto invalid; - nonce = EXTRACT_16BITS(message + 2); + nonce = EXTRACT_BE_16BITS(message + 2); ND_PRINT((ndo, "%04x", nonce)); } } @@ -418,8 +418,8 @@ babel_print_v2(netdissect_options *ndo, else { ND_PRINT((ndo, "\n\tHello ")); if(len < 6) goto invalid; - seqno = EXTRACT_16BITS(message + 4); - interval = EXTRACT_16BITS(message + 6); + seqno = EXTRACT_BE_16BITS(message + 4); + interval = EXTRACT_BE_16BITS(message + 6); ND_PRINT((ndo, "seqno %u interval %s", seqno, format_interval(interval))); /* Extra data. */ if(len > 6) @@ -437,8 +437,8 @@ babel_print_v2(netdissect_options *ndo, int rc; ND_PRINT((ndo, "\n\tIHU ")); if(len < 6) goto invalid; - txcost = EXTRACT_16BITS(message + 4); - interval = EXTRACT_16BITS(message + 6); + txcost = EXTRACT_BE_16BITS(message + 4); + interval = EXTRACT_BE_16BITS(message + 6); rc = network_address(message[2], message + 8, len - 6, address); if(rc < 0) { ND_PRINT((ndo, "%s", tstr)); break; } ND_PRINT((ndo, "%s txcost %u interval %s", @@ -500,9 +500,9 @@ babel_print_v2(netdissect_options *ndo, message[2] == 1 ? v4_prefix : v6_prefix, len - 10, prefix); if(rc < 0) goto invalid; - interval = EXTRACT_16BITS(message + 6); - seqno = EXTRACT_16BITS(message + 8); - metric = EXTRACT_16BITS(message + 10); + interval = EXTRACT_BE_16BITS(message + 6); + seqno = EXTRACT_BE_16BITS(message + 8); + metric = EXTRACT_BE_16BITS(message + 10); ND_PRINT((ndo, "%s%s%s %s metric %u seqno %u interval %s", (message[3] & 0x80) ? "/prefix": "", (message[3] & 0x40) ? "/id" : "", @@ -549,7 +549,7 @@ babel_print_v2(netdissect_options *ndo, u_char prefix[16], plen; ND_PRINT((ndo, "\n\tMH-Request ")); if(len < 14) goto invalid; - seqno = EXTRACT_16BITS(message + 4); + seqno = EXTRACT_BE_16BITS(message + 4); rc = network_prefix(message[2], message[3], 0, message + 16, NULL, len - 14, prefix); if(rc < 0) goto invalid; @@ -566,8 +566,8 @@ babel_print_v2(netdissect_options *ndo, else { ND_PRINT((ndo, "\n\tTS/PC ")); if(len < 6) goto invalid; - ND_PRINT((ndo, "timestamp %u packetcounter %u", EXTRACT_32BITS (message + 4), - EXTRACT_16BITS(message + 2))); + ND_PRINT((ndo, "timestamp %u packetcounter %u", EXTRACT_BE_32BITS(message + 4), + EXTRACT_BE_16BITS(message + 2))); } break; case MESSAGE_HMAC : { @@ -577,7 +577,7 @@ babel_print_v2(netdissect_options *ndo, unsigned j; ND_PRINT((ndo, "\n\tHMAC ")); if(len < 18) goto invalid; - ND_PRINT((ndo, "key-id %u digest-%u ", EXTRACT_16BITS(message + 2), len - 2)); + ND_PRINT((ndo, "key-id %u digest-%u ", EXTRACT_BE_16BITS(message + 2), len - 2)); for (j = 0; j < len - 2; j++) ND_PRINT((ndo, "%02X", message[4 + j])); } @@ -599,9 +599,9 @@ babel_print_v2(netdissect_options *ndo, src_plen = message[3]; plen = message[4]; omitted = message[5]; - interval = EXTRACT_16BITS(message + 6); - seqno = EXTRACT_16BITS(message + 8); - metric = EXTRACT_16BITS(message + 10); + interval = EXTRACT_BE_16BITS(message + 6); + seqno = EXTRACT_BE_16BITS(message + 8); + metric = EXTRACT_BE_16BITS(message + 10); rc = network_prefix(ae, plen, omitted, message + 2 + parsed_len, ae == 1 ? v4_prefix : v6_prefix, len - parsed_len, prefix); @@ -673,7 +673,7 @@ babel_print_v2(netdissect_options *ndo, if(len < 14) goto invalid; ae = message[2]; plen = message[3]; - seqno = EXTRACT_16BITS(message + 4); + seqno = EXTRACT_BE_16BITS(message + 4); hopc = message[6]; src_plen = message[7]; router_id = message + 8; diff --git a/print-bfd.c b/print-bfd.c index e7ec5ff2..83e53a89 100644 --- a/print-bfd.c +++ b/print-bfd.c @@ -243,7 +243,7 @@ auth_print(netdissect_options *ndo, register const u_char *pptr) } pptr += 2; ND_TCHECK2(*pptr, 4); - ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_32BITS(pptr))); + ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_BE_32BITS(pptr))); pptr += 4; ND_TCHECK2(*pptr, AUTH_MD5_HASH_LEN); ND_PRINT((ndo, "\n\t Digest: ")); @@ -274,7 +274,7 @@ auth_print(netdissect_options *ndo, register const u_char *pptr) } pptr += 2; ND_TCHECK2(*pptr, 4); - ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_32BITS(pptr))); + ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_BE_32BITS(pptr))); pptr += 4; ND_TCHECK2(*pptr, AUTH_SHA1_HASH_LEN); ND_PRINT((ndo, "\n\t Hash: ")); @@ -327,15 +327,15 @@ bfd_print(netdissect_options *ndo, register const u_char *pptr, ND_PRINT((ndo, "\n\tDetection Timer Multiplier: %u (%u ms Detection time), BFD Length: %u", bfd_header->detect_time_multiplier, - bfd_header->detect_time_multiplier * EXTRACT_32BITS(bfd_header->desired_min_tx_interval)/1000, + bfd_header->detect_time_multiplier * EXTRACT_BE_32BITS(bfd_header->desired_min_tx_interval)/1000, bfd_header->length)); - ND_PRINT((ndo, "\n\tMy Discriminator: 0x%08x", EXTRACT_32BITS(bfd_header->my_discriminator))); - ND_PRINT((ndo, ", Your Discriminator: 0x%08x", EXTRACT_32BITS(bfd_header->your_discriminator))); - ND_PRINT((ndo, "\n\t Desired min Tx Interval: %4u ms", EXTRACT_32BITS(bfd_header->desired_min_tx_interval)/1000)); - ND_PRINT((ndo, "\n\t Required min Rx Interval: %4u ms", EXTRACT_32BITS(bfd_header->required_min_rx_interval)/1000)); - ND_PRINT((ndo, "\n\t Required min Echo Interval: %4u ms", EXTRACT_32BITS(bfd_header->required_min_echo_interval)/1000)); + ND_PRINT((ndo, "\n\tMy Discriminator: 0x%08x", EXTRACT_BE_32BITS(bfd_header->my_discriminator))); + ND_PRINT((ndo, ", Your Discriminator: 0x%08x", EXTRACT_BE_32BITS(bfd_header->your_discriminator))); + ND_PRINT((ndo, "\n\t Desired min Tx Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->desired_min_tx_interval)/1000)); + ND_PRINT((ndo, "\n\t Required min Rx Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->required_min_rx_interval)/1000)); + ND_PRINT((ndo, "\n\t Required min Echo Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->required_min_echo_interval)/1000)); break; /* BFDv1 */ @@ -362,15 +362,15 @@ bfd_print(netdissect_options *ndo, register const u_char *pptr, ND_PRINT((ndo, "\n\tDetection Timer Multiplier: %u (%u ms Detection time), BFD Length: %u", bfd_header->detect_time_multiplier, - bfd_header->detect_time_multiplier * EXTRACT_32BITS(bfd_header->desired_min_tx_interval)/1000, + bfd_header->detect_time_multiplier * EXTRACT_BE_32BITS(bfd_header->desired_min_tx_interval)/1000, bfd_header->length)); - ND_PRINT((ndo, "\n\tMy Discriminator: 0x%08x", EXTRACT_32BITS(bfd_header->my_discriminator))); - ND_PRINT((ndo, ", Your Discriminator: 0x%08x", EXTRACT_32BITS(bfd_header->your_discriminator))); - ND_PRINT((ndo, "\n\t Desired min Tx Interval: %4u ms", EXTRACT_32BITS(bfd_header->desired_min_tx_interval)/1000)); - ND_PRINT((ndo, "\n\t Required min Rx Interval: %4u ms", EXTRACT_32BITS(bfd_header->required_min_rx_interval)/1000)); - ND_PRINT((ndo, "\n\t Required min Echo Interval: %4u ms", EXTRACT_32BITS(bfd_header->required_min_echo_interval)/1000)); + ND_PRINT((ndo, "\n\tMy Discriminator: 0x%08x", EXTRACT_BE_32BITS(bfd_header->my_discriminator))); + ND_PRINT((ndo, ", Your Discriminator: 0x%08x", EXTRACT_BE_32BITS(bfd_header->your_discriminator))); + ND_PRINT((ndo, "\n\t Desired min Tx Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->desired_min_tx_interval)/1000)); + ND_PRINT((ndo, "\n\t Required min Rx Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->required_min_rx_interval)/1000)); + ND_PRINT((ndo, "\n\t Required min Echo Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->required_min_echo_interval)/1000)); if (bfd_header->flags & BFD_FLAG_AUTH) { if (auth_print(ndo, pptr)) diff --git a/print-bgp.c b/print-bgp.c index 66bbe65b..39d3662b 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -112,7 +112,7 @@ struct bgp_route_refresh { #define bgp_attr_lenlen(flags, p) \ (((flags) & 0x10) ? 2 : 1) #define bgp_attr_len(flags, p) \ - (((flags) & 0x10) ? EXTRACT_16BITS(p) : *(p)) + (((flags) & 0x10) ? EXTRACT_BE_16BITS(p) : *(p)) #define BGPTYPE_ORIGIN 1 #define BGPTYPE_AS_PATH 2 @@ -606,7 +606,7 @@ decode_labeled_prefix4(netdissect_options *ndo, snprintf(buf, buflen, "%s/%d, label:%u %s", ipaddr_string(ndo, &addr), plen, - EXTRACT_24BITS(pptr+1)>>4, + EXTRACT_BE_24BITS(pptr + 1)>>4, ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); return 4 + plenbytes; @@ -723,28 +723,29 @@ bgp_vpn_rd_print(netdissect_options *ndo, char *pos = rd; /* ok lets load the RD format */ - switch (EXTRACT_16BITS(pptr)) { + switch (EXTRACT_BE_16BITS(pptr)) { /* 2-byte-AS:number fmt*/ case 0: snprintf(pos, sizeof(rd) - (pos - rd), "%u:%u (= %u.%u.%u.%u)", - EXTRACT_16BITS(pptr+2), - EXTRACT_32BITS(pptr+4), + EXTRACT_BE_16BITS(pptr + 2), + EXTRACT_BE_32BITS(pptr + 4), *(pptr+4), *(pptr+5), *(pptr+6), *(pptr+7)); break; /* IP-address:AS fmt*/ case 1: snprintf(pos, sizeof(rd) - (pos - rd), "%u.%u.%u.%u:%u", - *(pptr+2), *(pptr+3), *(pptr+4), *(pptr+5), EXTRACT_16BITS(pptr+6)); + *(pptr+2), *(pptr+3), *(pptr+4), *(pptr+5), + EXTRACT_BE_16BITS(pptr + 6)); break; /* 4-byte-AS:number fmt*/ case 2: snprintf(pos, sizeof(rd) - (pos - rd), "%s:%u (%u.%u.%u.%u:%u)", - as_printf(ndo, astostr, sizeof(astostr), EXTRACT_32BITS(pptr+2)), - EXTRACT_16BITS(pptr+6), *(pptr+2), *(pptr+3), *(pptr+4), - *(pptr+5), EXTRACT_16BITS(pptr+6)); + as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_32BITS(pptr + 2)), + EXTRACT_BE_16BITS(pptr + 6), *(pptr+2), *(pptr+3), *(pptr+4), + *(pptr+5), EXTRACT_BE_16BITS(pptr + 6)); break; default: snprintf(pos, sizeof(rd) - (pos - rd), "unknown RD format"); @@ -782,7 +783,7 @@ decode_rt_routing_info(netdissect_options *ndo, /* With at least "origin AS", possibly with "route target". */ ND_TCHECK_32BITS(pptr + 1); - as_printf(ndo, asbuf, sizeof(asbuf), EXTRACT_32BITS(pptr + 1)); + as_printf(ndo, asbuf, sizeof(asbuf), EXTRACT_BE_32BITS(pptr + 1)); plen-=32; /* adjust prefix length */ @@ -841,7 +842,7 @@ decode_labeled_vpn_prefix4(netdissect_options *ndo, bgp_vpn_rd_print(ndo, pptr+4), ipaddr_string(ndo, &addr), plen, - EXTRACT_24BITS(pptr+1)>>4, + EXTRACT_BE_24BITS(pptr + 1)>>4, ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); return 12 + (plen + 7) / 8; @@ -950,7 +951,7 @@ decode_multicast_vpn(netdissect_options *ndo, snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s", bgp_vpn_rd_print(ndo, pptr), as_printf(ndo, astostr, sizeof(astostr), - EXTRACT_32BITS(pptr + BGP_VPN_RD_LEN))); + EXTRACT_BE_32BITS(pptr + BGP_VPN_RD_LEN))); break; case BGP_MULTICAST_VPN_ROUTE_TYPE_S_PMSI: @@ -986,7 +987,7 @@ decode_multicast_vpn(netdissect_options *ndo, snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s", bgp_vpn_rd_print(ndo, pptr), as_printf(ndo, astostr, sizeof(astostr), - EXTRACT_32BITS(pptr + BGP_VPN_RD_LEN))); + EXTRACT_BE_32BITS(pptr + BGP_VPN_RD_LEN))); pptr += BGP_VPN_RD_LEN + 4; bgp_vpn_sg_print(ndo, pptr, buf, buflen); @@ -1033,7 +1034,7 @@ decode_labeled_vpn_l2(netdissect_options *ndo, int plen,tlen,stringlen,tlv_type,tlv_len,ttlv_len; ND_TCHECK2(pptr[0], 2); - plen=EXTRACT_16BITS(pptr); + plen=EXTRACT_BE_16BITS(pptr); tlen=plen; pptr+=2; /* Old and new L2VPN NLRI share AFI/SAFI @@ -1060,9 +1061,9 @@ decode_labeled_vpn_l2(netdissect_options *ndo, buf[0]='\0'; stringlen=snprintf(buf, buflen, "RD: %s, CE-ID: %u, Label-Block Offset: %u, Label Base %u", bgp_vpn_rd_print(ndo, pptr), - EXTRACT_16BITS(pptr+8), - EXTRACT_16BITS(pptr+10), - EXTRACT_24BITS(pptr+12)>>4); /* the label is offsetted by 4 bits so lets shift it right */ + EXTRACT_BE_16BITS(pptr + 8), + EXTRACT_BE_16BITS(pptr + 10), + EXTRACT_BE_24BITS(pptr + 12)>>4); /* the label is offsetted by 4 bits so lets shift it right */ UPDATE_BUF_BUFLEN(buf, buflen, stringlen); pptr+=15; tlen-=15; @@ -1073,7 +1074,7 @@ decode_labeled_vpn_l2(netdissect_options *ndo, return -1; ND_TCHECK2(pptr[0], 3); tlv_type=*pptr++; - tlv_len=EXTRACT_16BITS(pptr); + tlv_len=EXTRACT_BE_16BITS(pptr); ttlv_len=tlv_len; pptr+=2; @@ -1184,7 +1185,7 @@ decode_labeled_prefix6(netdissect_options *ndo, snprintf(buf, buflen, "%s/%d, label:%u %s", ip6addr_string(ndo, &addr), plen, - EXTRACT_24BITS(pptr+1)>>4, + EXTRACT_BE_24BITS(pptr + 1)>>4, ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); return 4 + plenbytes; @@ -1226,7 +1227,7 @@ decode_labeled_vpn_prefix6(netdissect_options *ndo, bgp_vpn_rd_print(ndo, pptr+4), ip6addr_string(ndo, &addr), plen, - EXTRACT_24BITS(pptr+1)>>4, + EXTRACT_BE_24BITS(pptr + 1)>>4, ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); return 12 + (plen + 7) / 8; @@ -1295,7 +1296,7 @@ decode_labeled_vpn_clnp_prefix(netdissect_options *ndo, bgp_vpn_rd_print(ndo, pptr+4), isonsap_string(ndo, addr,(plen + 7) / 8), plen, - EXTRACT_24BITS(pptr+1)>>4, + EXTRACT_BE_24BITS(pptr + 1)>>4, ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); return 12 + (plen + 7) / 8; @@ -1428,8 +1429,8 @@ bgp_attr_print(netdissect_options *ndo, ND_PRINT((ndo, "%s ", as_printf(ndo, astostr, sizeof(astostr), as_size == 2 ? - EXTRACT_16BITS(&tptr[2 + i]) : - EXTRACT_32BITS(&tptr[2 + i])))); + EXTRACT_BE_16BITS(&tptr[2 + i]) : + EXTRACT_BE_32BITS(&tptr[2 + i])))); } ND_TCHECK(tptr[0]); ND_PRINT((ndo, "%s", tok2str(bgp_as_path_segment_close_values, @@ -1452,7 +1453,7 @@ bgp_attr_print(netdissect_options *ndo, ND_PRINT((ndo, "invalid len")); else { ND_TCHECK2(tptr[0], 4); - ND_PRINT((ndo, "%u", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(tptr))); } break; case BGPTYPE_ATOMIC_AGGREGATE: @@ -1472,12 +1473,12 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK2(tptr[0], len); if (len == 6) { ND_PRINT((ndo, " AS #%s, origin %s", - as_printf(ndo, astostr, sizeof(astostr), EXTRACT_16BITS(tptr)), + as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_16BITS(tptr)), ipaddr_string(ndo, tptr + 2))); } else { ND_PRINT((ndo, " AS #%s, origin %s", as_printf(ndo, astostr, sizeof(astostr), - EXTRACT_32BITS(tptr)), ipaddr_string(ndo, tptr + 4))); + EXTRACT_BE_32BITS(tptr)), ipaddr_string(ndo, tptr + 4))); } break; case BGPTYPE_AGGREGATOR4: @@ -1487,8 +1488,8 @@ bgp_attr_print(netdissect_options *ndo, } ND_TCHECK2(tptr[0], 8); ND_PRINT((ndo, " AS #%s, origin %s", - as_printf(ndo, astostr, sizeof(astostr), EXTRACT_32BITS(tptr)), - ipaddr_string(ndo, tptr + 4))); + as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_32BITS(tptr)), + ipaddr_string(ndo, tptr + 4))); break; case BGPTYPE_COMMUNITIES: if (len % 4) { @@ -1498,7 +1499,7 @@ bgp_attr_print(netdissect_options *ndo, while (tlen>0) { uint32_t comm; ND_TCHECK2(tptr[0], 4); - comm = EXTRACT_32BITS(tptr); + comm = EXTRACT_BE_32BITS(tptr); switch (comm) { case BGP_COMMUNITY_NO_EXPORT: ND_PRINT((ndo, " NO_EXPORT")); @@ -1544,7 +1545,7 @@ bgp_attr_print(netdissect_options *ndo, break; case BGPTYPE_MP_REACH_NLRI: ND_TCHECK2(tptr[0], 3); - af = EXTRACT_16BITS(tptr); + af = EXTRACT_BE_16BITS(tptr); safi = tptr[2]; ND_PRINT((ndo, "\n\t AFI: %s (%u), %sSAFI: %s (%u)", @@ -1703,10 +1704,10 @@ bgp_attr_print(netdissect_options *ndo, bgp_vpn_rd_print(ndo, tptr), isonsap_string(ndo, tptr+BGP_VPN_RD_LEN,tlen-BGP_VPN_RD_LEN))); /* rfc986 mapped IPv4 address ? */ - if (EXTRACT_32BITS(tptr+BGP_VPN_RD_LEN) == 0x47000601) + if (EXTRACT_BE_32BITS(tptr + BGP_VPN_RD_LEN) == 0x47000601) ND_PRINT((ndo, " = %s", ipaddr_string(ndo, tptr+BGP_VPN_RD_LEN+4))); /* rfc1888 mapped IPv6 address ? */ - else if (EXTRACT_24BITS(tptr+BGP_VPN_RD_LEN) == 0x350000) + else if (EXTRACT_BE_24BITS(tptr + BGP_VPN_RD_LEN) == 0x350000) ND_PRINT((ndo, " = %s", ip6addr_string(ndo, tptr+BGP_VPN_RD_LEN+3))); tptr += tlen; tlen = 0; @@ -1895,7 +1896,7 @@ bgp_attr_print(netdissect_options *ndo, case BGPTYPE_MP_UNREACH_NLRI: ND_TCHECK2(tptr[0], BGP_MP_NLRI_MINSIZE); - af = EXTRACT_16BITS(tptr); + af = EXTRACT_BE_16BITS(tptr); safi = tptr[2]; ND_PRINT((ndo, "\n\t AFI: %s (%u), %sSAFI: %s (%u)", @@ -2058,7 +2059,7 @@ bgp_attr_print(netdissect_options *ndo, uint16_t extd_comm; ND_TCHECK2(tptr[0], 2); - extd_comm=EXTRACT_16BITS(tptr); + extd_comm=EXTRACT_BE_16BITS(tptr); ND_PRINT((ndo, "\n\t %s (0x%04x), Flags [%s]", tok2str(bgp_extd_comm_subtype_values, @@ -2073,8 +2074,8 @@ bgp_attr_print(netdissect_options *ndo, case BGP_EXT_COM_RO_0: case BGP_EXT_COM_L2VPN_RT_0: ND_PRINT((ndo, ": %u:%u (= %s)", - EXTRACT_16BITS(tptr+2), - EXTRACT_32BITS(tptr+4), + EXTRACT_BE_16BITS(tptr + 2), + EXTRACT_BE_32BITS(tptr + 4), ipaddr_string(ndo, tptr+4))); break; case BGP_EXT_COM_RT_1: @@ -2083,16 +2084,16 @@ bgp_attr_print(netdissect_options *ndo, case BGP_EXT_COM_VRF_RT_IMP: ND_PRINT((ndo, ": %s:%u", ipaddr_string(ndo, tptr+2), - EXTRACT_16BITS(tptr+6))); + EXTRACT_BE_16BITS(tptr + 6))); break; case BGP_EXT_COM_RT_2: case BGP_EXT_COM_RO_2: ND_PRINT((ndo, ": %s:%u", as_printf(ndo, astostr, sizeof(astostr), - EXTRACT_32BITS(tptr+2)), EXTRACT_16BITS(tptr+6))); + EXTRACT_BE_32BITS(tptr + 2)), EXTRACT_BE_16BITS(tptr + 6))); break; case BGP_EXT_COM_LINKBAND: - bw.i = EXTRACT_32BITS(tptr+2); + bw.i = EXTRACT_BE_32BITS(tptr + 2); ND_PRINT((ndo, ": bandwidth: %.3f Mbps", bw.f*8/1000000)); break; @@ -2120,10 +2121,10 @@ bgp_attr_print(netdissect_options *ndo, "unknown encaps", *(tptr+2)), *(tptr+3), - EXTRACT_16BITS(tptr+4))); + EXTRACT_BE_16BITS(tptr + 4))); break; case BGP_EXT_COM_SOURCE_AS: - ND_PRINT((ndo, ": AS %u", EXTRACT_16BITS(tptr+2))); + ND_PRINT((ndo, ": AS %u", EXTRACT_BE_16BITS(tptr + 2))); break; default: ND_TCHECK2(*tptr,8); @@ -2148,7 +2149,7 @@ bgp_attr_print(netdissect_options *ndo, tok2str(bgp_pmsi_tunnel_values, "Unknown", tunnel_type), tunnel_type, bittok2str(bgp_pmsi_flag_values, "none", flags), - EXTRACT_24BITS(tptr+2)>>4)); + EXTRACT_BE_24BITS(tptr + 2)>>4)); tptr +=5; tlen -= 5; @@ -2178,13 +2179,13 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK2(tptr[0], 8); ND_PRINT((ndo, "\n\t Root-Node %s, LSP-ID 0x%08x", ipaddr_string(ndo, tptr), - EXTRACT_32BITS(tptr+4))); + EXTRACT_BE_32BITS(tptr + 4))); break; case BGP_PMSI_TUNNEL_RSVP_P2MP: ND_TCHECK2(tptr[0], 8); ND_PRINT((ndo, "\n\t Extended-Tunnel-ID %s, P2MP-ID 0x%08x", ipaddr_string(ndo, tptr), - EXTRACT_32BITS(tptr+4))); + EXTRACT_BE_32BITS(tptr + 4))); break; default: if (ndo->ndo_vflag <= 1) { @@ -2205,7 +2206,7 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK2(tptr[0], 3); type = *tptr; - length = EXTRACT_16BITS(tptr+1); + length = EXTRACT_BE_16BITS(tptr + 1); tptr += 3; tlen -= 3; @@ -2228,7 +2229,7 @@ bgp_attr_print(netdissect_options *ndo, if (length < 8) goto trunc; ND_PRINT((ndo, ", metric %" PRIu64, - EXTRACT_64BITS(tptr))); + EXTRACT_BE_64BITS(tptr))); break; default: @@ -2247,7 +2248,7 @@ bgp_attr_print(netdissect_options *ndo, if (len < 4) goto trunc; ND_PRINT((ndo, "\n\t Origin AS: %s", - as_printf(ndo, astostr, sizeof(astostr), EXTRACT_32BITS(tptr)))); + as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_32BITS(tptr)))); tptr+=4; len -=4; @@ -2302,9 +2303,9 @@ bgp_attr_print(netdissect_options *ndo, while (len > 0) { ND_TCHECK2(*tptr, 12); ND_PRINT((ndo, "%u:%u:%u%s", - EXTRACT_32BITS(tptr), - EXTRACT_32BITS(tptr + 4), - EXTRACT_32BITS(tptr + 8), + EXTRACT_BE_32BITS(tptr), + EXTRACT_BE_32BITS(tptr + 4), + EXTRACT_BE_32BITS(tptr + 8), (len > 12) ? ", " : "")); tptr += 12; len -= 12; @@ -2349,8 +2350,8 @@ bgp_capabilities_print(netdissect_options *ndo, case BGP_CAPCODE_MP: ND_PRINT((ndo, "\n\t\tAFI %s (%u), SAFI %s (%u)", tok2str(af_values, "Unknown", - EXTRACT_16BITS(opt+i+2)), - EXTRACT_16BITS(opt+i+2), + EXTRACT_BE_16BITS(opt + i + 2)), + EXTRACT_BE_16BITS(opt + i + 2), tok2str(bgp_safi_values, "Unknown", opt[i+5]), opt[i+5])); @@ -2358,14 +2359,14 @@ bgp_capabilities_print(netdissect_options *ndo, case BGP_CAPCODE_RESTART: ND_PRINT((ndo, "\n\t\tRestart Flags: [%s], Restart Time %us", ((opt[i+2])&0x80) ? "R" : "none", - EXTRACT_16BITS(opt+i+2)&0xfff)); + EXTRACT_BE_16BITS(opt + i + 2)&0xfff)); tcap_len-=2; cap_offset=4; while(tcap_len>=4) { ND_PRINT((ndo, "\n\t\t AFI %s (%u), SAFI %s (%u), Forwarding state preserved: %s", tok2str(af_values,"Unknown", - EXTRACT_16BITS(opt+i+cap_offset)), - EXTRACT_16BITS(opt+i+cap_offset), + EXTRACT_BE_16BITS(opt + i + cap_offset)), + EXTRACT_BE_16BITS(opt + i + cap_offset), tok2str(bgp_safi_values,"Unknown", opt[i+cap_offset+2]), opt[i+cap_offset+2], @@ -2385,7 +2386,7 @@ bgp_capabilities_print(netdissect_options *ndo, if (cap_len == 4) { ND_PRINT((ndo, "\n\t\t 4 Byte AS %s", as_printf(ndo, astostr, sizeof(astostr), - EXTRACT_32BITS(opt + i + 2)))); + EXTRACT_BE_32BITS(opt + i + 2)))); } break; case BGP_CAPCODE_ADD_PATH: @@ -2400,8 +2401,8 @@ bgp_capabilities_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t\tAFI %s (%u), SAFI %s (%u), Send/Receive: %s", - tok2str(af_values,"Unknown",EXTRACT_16BITS(opt+i+cap_offset)), - EXTRACT_16BITS(opt+i+cap_offset), + tok2str(af_values,"Unknown",EXTRACT_BE_16BITS(opt + i + cap_offset)), + EXTRACT_BE_16BITS(opt + i + cap_offset), tok2str(bgp_safi_values,"Unknown",opt[i+cap_offset+2]), opt[i+cap_offset+2], tok2str(bgp_add_path_recvsend,"Bogus (0x%02x)",opt[i+cap_offset+3]) @@ -2512,7 +2513,7 @@ bgp_update_print(netdissect_options *ndo, ND_TCHECK2(p[0], 2); if (length < 2) goto trunc; - withdrawn_routes_len = EXTRACT_16BITS(p); + withdrawn_routes_len = EXTRACT_BE_16BITS(p); p += 2; length -= 2; if (withdrawn_routes_len) { @@ -2532,7 +2533,7 @@ bgp_update_print(netdissect_options *ndo, ND_TCHECK2(p[0], 2); if (length < 2) goto trunc; - len = EXTRACT_16BITS(p); + len = EXTRACT_BE_16BITS(p); p += 2; length -= 2; @@ -2695,11 +2696,11 @@ bgp_notification_print(netdissect_options *ndo, ND_TCHECK2(*tptr, 7); ND_PRINT((ndo, ", AFI %s (%u), SAFI %s (%u), Max Prefixes: %u", tok2str(af_values, "Unknown", - EXTRACT_16BITS(tptr)), - EXTRACT_16BITS(tptr), + EXTRACT_BE_16BITS(tptr)), + EXTRACT_BE_16BITS(tptr), tok2str(bgp_safi_values, "Unknown", *(tptr+2)), *(tptr+2), - EXTRACT_32BITS(tptr+3))); + EXTRACT_BE_32BITS(tptr + 3))); } /* * draft-ietf-idr-shutdown describes a method to send a communication @@ -2763,8 +2764,8 @@ bgp_route_refresh_print(netdissect_options *ndo, tok2str(af_values,"Unknown", /* this stinks but the compiler pads the structure * weird */ - EXTRACT_16BITS(&bgp_route_refresh_header->afi)), - EXTRACT_16BITS(&bgp_route_refresh_header->afi), + EXTRACT_BE_16BITS(&bgp_route_refresh_header->afi)), + EXTRACT_BE_16BITS(&bgp_route_refresh_header->afi), tok2str(bgp_safi_values,"Unknown", bgp_route_refresh_header->safi), bgp_route_refresh_header->safi)); diff --git a/print-bootp.c b/print-bootp.c index 51e53844..02bd57e9 100644 --- a/print-bootp.c +++ b/print-bootp.c @@ -317,35 +317,35 @@ bootp_print(netdissect_options *ndo, /* Only print interesting fields */ if (bp->bp_hops) ND_PRINT((ndo, ", hops %d", bp->bp_hops)); - if (EXTRACT_32BITS(&bp->bp_xid)) - ND_PRINT((ndo, ", xid 0x%x", EXTRACT_32BITS(&bp->bp_xid))); - if (EXTRACT_16BITS(&bp->bp_secs)) - ND_PRINT((ndo, ", secs %d", EXTRACT_16BITS(&bp->bp_secs))); + if (EXTRACT_BE_32BITS(&bp->bp_xid)) + ND_PRINT((ndo, ", xid 0x%x", EXTRACT_BE_32BITS(&bp->bp_xid))); + if (EXTRACT_BE_16BITS(&bp->bp_secs)) + ND_PRINT((ndo, ", secs %d", EXTRACT_BE_16BITS(&bp->bp_secs))); ND_TCHECK(bp->bp_flags); ND_PRINT((ndo, ", Flags [%s]", - bittok2str(bootp_flag_values, "none", EXTRACT_16BITS(&bp->bp_flags)))); + bittok2str(bootp_flag_values, "none", EXTRACT_BE_16BITS(&bp->bp_flags)))); if (ndo->ndo_vflag > 1) - ND_PRINT((ndo, " (0x%04x)", EXTRACT_16BITS(&bp->bp_flags))); + ND_PRINT((ndo, " (0x%04x)", EXTRACT_BE_16BITS(&bp->bp_flags))); /* Client's ip address */ ND_TCHECK(bp->bp_ciaddr); - if (EXTRACT_32BITS(&bp->bp_ciaddr.s_addr)) + if (EXTRACT_BE_32BITS(&bp->bp_ciaddr.s_addr)) ND_PRINT((ndo, "\n\t Client-IP %s", ipaddr_string(ndo, &bp->bp_ciaddr))); /* 'your' ip address (bootp client) */ ND_TCHECK(bp->bp_yiaddr); - if (EXTRACT_32BITS(&bp->bp_yiaddr.s_addr)) + if (EXTRACT_BE_32BITS(&bp->bp_yiaddr.s_addr)) ND_PRINT((ndo, "\n\t Your-IP %s", ipaddr_string(ndo, &bp->bp_yiaddr))); /* Server's ip address */ ND_TCHECK(bp->bp_siaddr); - if (EXTRACT_32BITS(&bp->bp_siaddr.s_addr)) + if (EXTRACT_BE_32BITS(&bp->bp_siaddr.s_addr)) ND_PRINT((ndo, "\n\t Server-IP %s", ipaddr_string(ndo, &bp->bp_siaddr))); /* Gateway's ip address */ ND_TCHECK(bp->bp_giaddr); - if (EXTRACT_32BITS(&bp->bp_giaddr.s_addr)) + if (EXTRACT_BE_32BITS(&bp->bp_giaddr.s_addr)) ND_PRINT((ndo, "\n\t Gateway-IP %s", ipaddr_string(ndo, &bp->bp_giaddr))); /* Client's Ethernet address */ @@ -388,7 +388,7 @@ bootp_print(netdissect_options *ndo, else { uint32_t ul; - ul = EXTRACT_32BITS(&bp->bp_vend); + ul = EXTRACT_BE_32BITS(&bp->bp_vend); if (ul != 0) ND_PRINT((ndo, "\n\t Vendor-#0x%x", ul)); } @@ -607,7 +607,7 @@ rfc1048_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Vendor-rfc1048 Extensions")); /* Step over magic cookie */ - ND_PRINT((ndo, "\n\t Magic Cookie 0x%08x", EXTRACT_32BITS(bp))); + ND_PRINT((ndo, "\n\t Magic Cookie 0x%08x", EXTRACT_BE_32BITS(bp))); bp += sizeof(int32_t); /* Loop while we there is a tag left in the buffer */ @@ -619,7 +619,7 @@ rfc1048_print(netdissect_options *ndo, return; if (tag == TAG_EXTENDED_OPTION) { ND_TCHECK2(*(bp + 1), 2); - tag = EXTRACT_16BITS(bp + 1); + tag = EXTRACT_BE_16BITS(bp + 1); /* XXX we don't know yet if the IANA will * preclude overlap of 1-byte and 2-byte spaces. * If not, we need to offset tag after this step. @@ -680,7 +680,7 @@ rfc1048_print(netdissect_options *ndo, first = 1; while (len > 1) { len -= 2; - us = EXTRACT_16BITS(bp); + us = EXTRACT_BE_16BITS(bp); bp += 2; cp = tok2str(xtag2str, "?xT%u", us); if (!first) @@ -723,7 +723,7 @@ rfc1048_print(netdissect_options *ndo, while (len >= sizeof(ul)) { if (!first) ND_PRINT((ndo, ",")); - ul = EXTRACT_32BITS(bp); + ul = EXTRACT_BE_32BITS(bp); if (c == 'i') { ul = htonl(ul); ND_PRINT((ndo, "%s", ipaddr_string(ndo, &ul))); @@ -758,7 +758,7 @@ rfc1048_print(netdissect_options *ndo, while (len >= sizeof(us)) { if (!first) ND_PRINT((ndo, ",")); - us = EXTRACT_16BITS(bp); + us = EXTRACT_BE_16BITS(bp); ND_PRINT((ndo, "%u", us)); bp += sizeof(us); len -= sizeof(us); @@ -53,7 +53,7 @@ bt_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char * length -= BT_HDRLEN; p += BT_HDRLEN; if (ndo->ndo_eflag) - ND_PRINT((ndo, "hci length %d, direction %s, ", length, (EXTRACT_32BITS(&hdr->direction)&0x1)?"in":"out")); + ND_PRINT((ndo, "hci length %d, direction %s, ", length, (EXTRACT_BE_32BITS(&hdr->direction)&0x1)?"in":"out")); if (!ndo->ndo_suppress_default_print) ND_DEFAULTPRINT(p, caplen); diff --git a/print-carp.c b/print-carp.c index c650d181..918617bd 100644 --- a/print-carp.c +++ b/print-carp.c @@ -73,9 +73,9 @@ carp_print(netdissect_options *ndo, register const u_char *bp, register u_int le vec[0].len = len; if (ND_TTEST2(bp[0], len) && in_cksum(vec, 1)) ND_PRINT((ndo, " (bad carp cksum %x!)", - EXTRACT_16BITS(&bp[6]))); + EXTRACT_BE_16BITS(&bp[6]))); } - ND_PRINT((ndo, "counter=%" PRIu64, EXTRACT_64BITS(&bp[8]))); + ND_PRINT((ndo, "counter=%" PRIu64, EXTRACT_BE_64BITS(&bp[8]))); return; trunc: diff --git a/print-cdp.c b/print-cdp.c index 311f2c26..9b12e413 100644 --- a/print-cdp.c +++ b/print-cdp.c @@ -108,13 +108,13 @@ cdp_print(netdissect_options *ndo, ND_PRINT((ndo, "CDPv%u, ttl: %us", *(tptr + CDP_HEADER_VERSION_OFFSET), *(tptr + CDP_HEADER_TTL_OFFSET))); if (ndo->ndo_vflag) - ND_PRINT((ndo, ", checksum: 0x%04x (unverified), length %u", EXTRACT_16BITS(tptr+CDP_HEADER_CHECKSUM_OFFSET), length)); + ND_PRINT((ndo, ", checksum: 0x%04x (unverified), length %u", EXTRACT_BE_16BITS(tptr + CDP_HEADER_CHECKSUM_OFFSET), length)); tptr += CDP_HEADER_LEN; while (tptr < (pptr+length)) { ND_TCHECK2(*tptr, CDP_TLV_HEADER_LEN); /* read out Type and Length */ - type = EXTRACT_16BITS(tptr+CDP_TLV_TYPE_OFFSET); - len = EXTRACT_16BITS(tptr+CDP_TLV_LEN_OFFSET); /* object length includes the 4 bytes header length */ + type = EXTRACT_BE_16BITS(tptr + CDP_TLV_TYPE_OFFSET); + len = EXTRACT_BE_16BITS(tptr + CDP_TLV_LEN_OFFSET); /* object length includes the 4 bytes header length */ if (len < CDP_TLV_HEADER_LEN) { if (ndo->ndo_vflag) ND_PRINT((ndo, "\n\t%s (0x%02x), TLV length: %u byte%s (too short)", @@ -164,8 +164,8 @@ cdp_print(netdissect_options *ndo, if (len < 4) goto trunc; ND_PRINT((ndo, "(0x%08x): %s", - EXTRACT_32BITS(tptr), - bittok2str(cdp_capability_values, "none", EXTRACT_32BITS(tptr)))); + EXTRACT_BE_32BITS(tptr), + bittok2str(cdp_capability_values, "none", EXTRACT_BE_32BITS(tptr)))); break; case 0x05: /* Version */ ND_PRINT((ndo, "\n\t ")); @@ -197,7 +197,7 @@ cdp_print(netdissect_options *ndo, case 0x0a: /* Native VLAN ID - CDPv2 */ if (len < 2) goto trunc; - ND_PRINT((ndo, "%d", EXTRACT_16BITS(tptr))); + ND_PRINT((ndo, "%d", EXTRACT_BE_16BITS(tptr))); break; case 0x0b: /* Duplex - CDPv2 */ if (len < 1) @@ -211,7 +211,7 @@ cdp_print(netdissect_options *ndo, case 0x0e: /* ATA-186 VoIP VLAN request - incomplete doc. */ if (len < 3) goto trunc; - ND_PRINT((ndo, "app %d, vlan %d", *(tptr), EXTRACT_16BITS(tptr + 1))); + ND_PRINT((ndo, "app %d, vlan %d", *(tptr), EXTRACT_BE_16BITS(tptr + 1))); break; case 0x10: /* ATA-186 VoIP VLAN assignment - incomplete doc. */ ND_PRINT((ndo, "%1.2fW", cdp_get_number(tptr, len) / 1000.0)); @@ -219,7 +219,7 @@ cdp_print(netdissect_options *ndo, case 0x11: /* MTU - not documented */ if (len < 4) goto trunc; - ND_PRINT((ndo, "%u bytes", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "%u bytes", EXTRACT_BE_32BITS(tptr))); break; case 0x12: /* AVVID trust bitmap - not documented */ if (len < 1) @@ -288,7 +288,7 @@ cdp_print_addr(netdissect_options *ndo, ND_TCHECK2(*p, 4); if (p + 4 > endp) goto trunc; - num = EXTRACT_32BITS(p); + num = EXTRACT_BE_32BITS(p); p += 4; while (p < endp && num >= 0) { @@ -302,7 +302,7 @@ cdp_print_addr(netdissect_options *ndo, ND_TCHECK2(p[pl], 2); if (p + pl + 2 > endp) goto trunc; - al = EXTRACT_16BITS(&p[pl]); /* address length */ + al = EXTRACT_BE_16BITS(&p[pl]); /* address length */ if (pt == PT_NLPID && pl == 1 && *p == NLPID_IP && al == 4) { /* diff --git a/print-cfm.c b/print-cfm.c index b2365918..4c26e336 100644 --- a/print-cfm.c +++ b/print-cfm.c @@ -361,8 +361,8 @@ cfm_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t Sequence Number 0x%08x, MA-End-Point-ID 0x%04x", - EXTRACT_32BITS(msg_ptr.cfm_ccm->sequence), - EXTRACT_16BITS(msg_ptr.cfm_ccm->ma_epi))); + EXTRACT_BE_32BITS(msg_ptr.cfm_ccm->sequence), + EXTRACT_BE_16BITS(msg_ptr.cfm_ccm->ma_epi))); namesp = msg_ptr.cfm_ccm->names; names_data_remaining = sizeof(msg_ptr.cfm_ccm->names); @@ -477,7 +477,7 @@ cfm_print(netdissect_options *ndo, bittok2str(cfm_ltm_flag_values, "none", cfm_common_header->flags))); ND_PRINT((ndo, "\n\t Transaction-ID 0x%08x, ttl %u", - EXTRACT_32BITS(msg_ptr.cfm_ltm->transaction_id), + EXTRACT_BE_32BITS(msg_ptr.cfm_ltm->transaction_id), msg_ptr.cfm_ltm->ttl)); ND_PRINT((ndo, "\n\t Original-MAC %s, Target-MAC %s", @@ -500,7 +500,7 @@ cfm_print(netdissect_options *ndo, bittok2str(cfm_ltr_flag_values, "none", cfm_common_header->flags))); ND_PRINT((ndo, "\n\t Transaction-ID 0x%08x, ttl %u", - EXTRACT_32BITS(msg_ptr.cfm_ltr->transaction_id), + EXTRACT_BE_32BITS(msg_ptr.cfm_ltr->transaction_id), msg_ptr.cfm_ltr->ttl)); ND_PRINT((ndo, "\n\t Replay-Action %s (%u)", @@ -545,7 +545,7 @@ cfm_print(netdissect_options *ndo, if (tlen < sizeof(struct cfm_tlv_header_t)) goto tooshort; ND_TCHECK2(*tptr, sizeof(struct cfm_tlv_header_t)); - cfm_tlv_len=EXTRACT_16BITS(&cfm_tlv_header->length); + cfm_tlv_len=EXTRACT_BE_16BITS(&cfm_tlv_header->length); ND_PRINT((ndo, ", length %u", cfm_tlv_len)); @@ -586,8 +586,8 @@ cfm_print(netdissect_options *ndo, return; } ND_PRINT((ndo, ", Vendor: %s (%u), Sub-Type %u", - tok2str(oui_values,"Unknown", EXTRACT_24BITS(tptr)), - EXTRACT_24BITS(tptr), + tok2str(oui_values,"Unknown", EXTRACT_BE_24BITS(tptr)), + EXTRACT_BE_24BITS(tptr), *(tptr + 3))); hexdump = TRUE; break; diff --git a/print-chdlc.c b/print-chdlc.c index 16df8499..b46828f9 100644 --- a/print-chdlc.c +++ b/print-chdlc.c @@ -59,7 +59,7 @@ chdlc_print(netdissect_options *ndo, register const u_char *p, u_int length) if (length < CHDLC_HDRLEN) goto trunc; ND_TCHECK2(*p, CHDLC_HDRLEN); - proto = EXTRACT_16BITS(&p[2]); + proto = EXTRACT_BE_16BITS(&p[2]); if (ndo->ndo_eflag) { ND_PRINT((ndo, "%s, ethertype %s (0x%04x), length %u: ", tok2str(chdlc_cast_values, "0x%02x", p[0]), @@ -151,7 +151,7 @@ chdlc_slarp_print(netdissect_options *ndo, const u_char *cp, u_int length) slarp = (const struct cisco_slarp *)cp; ND_TCHECK2(*slarp, SLARP_MIN_LEN); - switch (EXTRACT_32BITS(&slarp->code)) { + switch (EXTRACT_BE_32BITS(&slarp->code)) { case SLARP_REQUEST: ND_PRINT((ndo, "request")); /* @@ -171,14 +171,14 @@ chdlc_slarp_print(netdissect_options *ndo, const u_char *cp, u_int length) break; case SLARP_KEEPALIVE: ND_PRINT((ndo, "keepalive: mineseen=0x%08x, yourseen=0x%08x, reliability=0x%04x", - EXTRACT_32BITS(&slarp->un.keep.myseq), - EXTRACT_32BITS(&slarp->un.keep.yourseq), - EXTRACT_16BITS(&slarp->un.keep.rel))); + EXTRACT_BE_32BITS(&slarp->un.keep.myseq), + EXTRACT_BE_32BITS(&slarp->un.keep.yourseq), + EXTRACT_BE_16BITS(&slarp->un.keep.rel))); if (length >= SLARP_MAX_LEN) { /* uptime-stamp is optional */ cp += SLARP_MIN_LEN; ND_TCHECK2(*cp, 4); - sec = EXTRACT_32BITS(cp) / 1000; + sec = EXTRACT_BE_32BITS(cp) / 1000; min = sec / 60; sec -= min * 60; hrs = min / 60; min -= hrs * 60; days = hrs / 24; hrs -= days * 24; @@ -186,7 +186,7 @@ chdlc_slarp_print(netdissect_options *ndo, const u_char *cp, u_int length) } break; default: - ND_PRINT((ndo, "0x%02x unknown", EXTRACT_32BITS(&slarp->code))); + ND_PRINT((ndo, "0x%02x unknown", EXTRACT_BE_32BITS(&slarp->code))); if (ndo->ndo_vflag <= 1) print_unknown_data(ndo,cp+4,"\n\t",length-4); break; diff --git a/print-cnfp.c b/print-cnfp.c index 7e7d835c..f58a8c2d 100644 --- a/print-cnfp.c +++ b/print-cnfp.c @@ -168,8 +168,8 @@ cnfp_v1_print(netdissect_options *ndo, const u_char *cp) nh = (const struct nfhdr_v1 *)cp; ND_TCHECK(*nh); - ver = EXTRACT_16BITS(&nh->version); - nrecs = EXTRACT_32BITS(&nh->count); + ver = EXTRACT_BE_16BITS(&nh->version); + nrecs = EXTRACT_BE_32BITS(&nh->count); #if 0 /* * This is seconds since the UN*X epoch, and is followed by @@ -180,9 +180,9 @@ cnfp_v1_print(netdissect_options *ndo, const u_char *cp) #endif ND_PRINT((ndo, "NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver, - EXTRACT_32BITS(&nh->msys_uptime)/1000, - EXTRACT_32BITS(&nh->msys_uptime)%1000, - EXTRACT_32BITS(&nh->utc_sec), EXTRACT_32BITS(&nh->utc_nsec))); + EXTRACT_BE_32BITS(&nh->msys_uptime)/1000, + EXTRACT_BE_32BITS(&nh->msys_uptime)%1000, + EXTRACT_BE_32BITS(&nh->utc_sec), EXTRACT_BE_32BITS(&nh->utc_nsec))); nr = (const struct nfrec_v1 *)&nh[1]; @@ -197,17 +197,17 @@ cnfp_v1_print(netdissect_options *ndo, const u_char *cp) */ ND_TCHECK(*nr); ND_PRINT((ndo, "\n started %u.%03u, last %u.%03u", - EXTRACT_32BITS(&nr->start_time)/1000, - EXTRACT_32BITS(&nr->start_time)%1000, - EXTRACT_32BITS(&nr->last_time)/1000, - EXTRACT_32BITS(&nr->last_time)%1000)); + EXTRACT_BE_32BITS(&nr->start_time)/1000, + EXTRACT_BE_32BITS(&nr->start_time)%1000, + EXTRACT_BE_32BITS(&nr->last_time)/1000, + EXTRACT_BE_32BITS(&nr->last_time)%1000)); asbuf[0] = buf[0] = '\0'; ND_PRINT((ndo, "\n %s%s%s:%u ", intoa(nr->src_ina.s_addr), buf, asbuf, - EXTRACT_16BITS(&nr->srcport))); + EXTRACT_BE_16BITS(&nr->srcport))); ND_PRINT((ndo, "> %s%s%s:%u ", intoa(nr->dst_ina.s_addr), buf, asbuf, - EXTRACT_16BITS(&nr->dstport))); + EXTRACT_BE_16BITS(&nr->dstport))); ND_PRINT((ndo, ">> %s\n ", intoa(nr->nhop_ina.s_addr))); @@ -233,8 +233,8 @@ cnfp_v1_print(netdissect_options *ndo, const u_char *cp) buf[0]='\0'; ND_PRINT((ndo, "tos %u, %u (%u octets) %s", nr->tos, - EXTRACT_32BITS(&nr->packets), - EXTRACT_32BITS(&nr->octets), buf)); + EXTRACT_BE_32BITS(&nr->packets), + EXTRACT_BE_32BITS(&nr->octets), buf)); } return; @@ -257,8 +257,8 @@ cnfp_v5_print(netdissect_options *ndo, const u_char *cp) nh = (const struct nfhdr_v5 *)cp; ND_TCHECK(*nh); - ver = EXTRACT_16BITS(&nh->version); - nrecs = EXTRACT_32BITS(&nh->count); + ver = EXTRACT_BE_16BITS(&nh->version); + nrecs = EXTRACT_BE_32BITS(&nh->count); #if 0 /* * This is seconds since the UN*X epoch, and is followed by @@ -269,11 +269,11 @@ cnfp_v5_print(netdissect_options *ndo, const u_char *cp) #endif ND_PRINT((ndo, "NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver, - EXTRACT_32BITS(&nh->msys_uptime)/1000, - EXTRACT_32BITS(&nh->msys_uptime)%1000, - EXTRACT_32BITS(&nh->utc_sec), EXTRACT_32BITS(&nh->utc_nsec))); + EXTRACT_BE_32BITS(&nh->msys_uptime)/1000, + EXTRACT_BE_32BITS(&nh->msys_uptime)%1000, + EXTRACT_BE_32BITS(&nh->utc_sec), EXTRACT_BE_32BITS(&nh->utc_nsec))); - ND_PRINT((ndo, "#%u, ", EXTRACT_32BITS(&nh->sequence))); + ND_PRINT((ndo, "#%u, ", EXTRACT_BE_32BITS(&nh->sequence))); nr = (const struct nfrec_v5 *)&nh[1]; ND_PRINT((ndo, "%2u recs", nrecs)); @@ -287,23 +287,23 @@ cnfp_v5_print(netdissect_options *ndo, const u_char *cp) */ ND_TCHECK(*nr); ND_PRINT((ndo, "\n started %u.%03u, last %u.%03u", - EXTRACT_32BITS(&nr->start_time)/1000, - EXTRACT_32BITS(&nr->start_time)%1000, - EXTRACT_32BITS(&nr->last_time)/1000, - EXTRACT_32BITS(&nr->last_time)%1000)); + EXTRACT_BE_32BITS(&nr->start_time)/1000, + EXTRACT_BE_32BITS(&nr->start_time)%1000, + EXTRACT_BE_32BITS(&nr->last_time)/1000, + EXTRACT_BE_32BITS(&nr->last_time)%1000)); asbuf[0] = buf[0] = '\0'; snprintf(buf, sizeof(buf), "/%u", nr->src_mask); snprintf(asbuf, sizeof(asbuf), ":%u", - EXTRACT_16BITS(&nr->src_as)); + EXTRACT_BE_16BITS(&nr->src_as)); ND_PRINT((ndo, "\n %s%s%s:%u ", intoa(nr->src_ina.s_addr), buf, asbuf, - EXTRACT_16BITS(&nr->srcport))); + EXTRACT_BE_16BITS(&nr->srcport))); snprintf(buf, sizeof(buf), "/%d", nr->dst_mask); snprintf(asbuf, sizeof(asbuf), ":%u", - EXTRACT_16BITS(&nr->dst_as)); + EXTRACT_BE_16BITS(&nr->dst_as)); ND_PRINT((ndo, "> %s%s%s:%u ", intoa(nr->dst_ina.s_addr), buf, asbuf, - EXTRACT_16BITS(&nr->dstport))); + EXTRACT_BE_16BITS(&nr->dstport))); ND_PRINT((ndo, ">> %s\n ", intoa(nr->nhop_ina.s_addr))); @@ -329,8 +329,8 @@ cnfp_v5_print(netdissect_options *ndo, const u_char *cp) buf[0]='\0'; ND_PRINT((ndo, "tos %u, %u (%u octets) %s", nr->tos, - EXTRACT_32BITS(&nr->packets), - EXTRACT_32BITS(&nr->octets), buf)); + EXTRACT_BE_32BITS(&nr->packets), + EXTRACT_BE_32BITS(&nr->octets), buf)); } return; @@ -353,8 +353,8 @@ cnfp_v6_print(netdissect_options *ndo, const u_char *cp) nh = (const struct nfhdr_v6 *)cp; ND_TCHECK(*nh); - ver = EXTRACT_16BITS(&nh->version); - nrecs = EXTRACT_32BITS(&nh->count); + ver = EXTRACT_BE_16BITS(&nh->version); + nrecs = EXTRACT_BE_32BITS(&nh->count); #if 0 /* * This is seconds since the UN*X epoch, and is followed by @@ -365,11 +365,11 @@ cnfp_v6_print(netdissect_options *ndo, const u_char *cp) #endif ND_PRINT((ndo, "NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver, - EXTRACT_32BITS(&nh->msys_uptime)/1000, - EXTRACT_32BITS(&nh->msys_uptime)%1000, - EXTRACT_32BITS(&nh->utc_sec), EXTRACT_32BITS(&nh->utc_nsec))); + EXTRACT_BE_32BITS(&nh->msys_uptime)/1000, + EXTRACT_BE_32BITS(&nh->msys_uptime)%1000, + EXTRACT_BE_32BITS(&nh->utc_sec), EXTRACT_BE_32BITS(&nh->utc_nsec))); - ND_PRINT((ndo, "#%u, ", EXTRACT_32BITS(&nh->sequence))); + ND_PRINT((ndo, "#%u, ", EXTRACT_BE_32BITS(&nh->sequence))); nr = (const struct nfrec_v6 *)&nh[1]; ND_PRINT((ndo, "%2u recs", nrecs)); @@ -383,23 +383,23 @@ cnfp_v6_print(netdissect_options *ndo, const u_char *cp) */ ND_TCHECK(*nr); ND_PRINT((ndo, "\n started %u.%03u, last %u.%03u", - EXTRACT_32BITS(&nr->start_time)/1000, - EXTRACT_32BITS(&nr->start_time)%1000, - EXTRACT_32BITS(&nr->last_time)/1000, - EXTRACT_32BITS(&nr->last_time)%1000)); + EXTRACT_BE_32BITS(&nr->start_time)/1000, + EXTRACT_BE_32BITS(&nr->start_time)%1000, + EXTRACT_BE_32BITS(&nr->last_time)/1000, + EXTRACT_BE_32BITS(&nr->last_time)%1000)); asbuf[0] = buf[0] = '\0'; snprintf(buf, sizeof(buf), "/%u", nr->src_mask); snprintf(asbuf, sizeof(asbuf), ":%u", - EXTRACT_16BITS(&nr->src_as)); + EXTRACT_BE_16BITS(&nr->src_as)); ND_PRINT((ndo, "\n %s%s%s:%u ", intoa(nr->src_ina.s_addr), buf, asbuf, - EXTRACT_16BITS(&nr->srcport))); + EXTRACT_BE_16BITS(&nr->srcport))); snprintf(buf, sizeof(buf), "/%d", nr->dst_mask); snprintf(asbuf, sizeof(asbuf), ":%u", - EXTRACT_16BITS(&nr->dst_as)); + EXTRACT_BE_16BITS(&nr->dst_as)); ND_PRINT((ndo, "> %s%s%s:%u ", intoa(nr->dst_ina.s_addr), buf, asbuf, - EXTRACT_16BITS(&nr->dstport))); + EXTRACT_BE_16BITS(&nr->dstport))); ND_PRINT((ndo, ">> %s\n ", intoa(nr->nhop_ina.s_addr))); @@ -424,12 +424,12 @@ cnfp_v6_print(netdissect_options *ndo, const u_char *cp) buf[0]='\0'; snprintf(buf, sizeof(buf), "(%u<>%u encaps)", - (EXTRACT_16BITS(&nr->flags) >> 8) & 0xff, - (EXTRACT_16BITS(&nr->flags)) & 0xff); + (EXTRACT_BE_16BITS(&nr->flags) >> 8) & 0xff, + (EXTRACT_BE_16BITS(&nr->flags)) & 0xff); ND_PRINT((ndo, "tos %u, %u (%u octets) %s", nr->tos, - EXTRACT_32BITS(&nr->packets), - EXTRACT_32BITS(&nr->octets), buf)); + EXTRACT_BE_32BITS(&nr->packets), + EXTRACT_BE_32BITS(&nr->octets), buf)); } return; @@ -447,7 +447,7 @@ cnfp_print(netdissect_options *ndo, const u_char *cp) * First 2 bytes are the version number. */ ND_TCHECK2(*cp, 2); - ver = EXTRACT_16BITS(cp); + ver = EXTRACT_BE_16BITS(cp); switch (ver) { case 1: diff --git a/print-dccp.c b/print-dccp.c index 64a7fb76..78c7c7d8 100644 --- a/print-dccp.c +++ b/print-dccp.c @@ -225,9 +225,9 @@ static uint64_t dccp_seqno(const u_char *bp) if (DCCPH_X(dh) != 0) { const struct dccp_hdr_ext *dhx = (const struct dccp_hdr_ext *)bp; - seqno = EXTRACT_48BITS(dhx->dccph_seq); + seqno = EXTRACT_BE_48BITS(dhx->dccph_seq); } else { - seqno = EXTRACT_24BITS(dh->dccph_seq); + seqno = EXTRACT_BE_24BITS(dh->dccph_seq); } return seqno; @@ -246,10 +246,10 @@ static void dccp_print_ack_no(netdissect_options *ndo, const u_char *bp) if (DCCPH_X(dh) != 0) { ND_TCHECK2(*ackp, 8); - ackno = EXTRACT_48BITS(ackp + 2); + ackno = EXTRACT_BE_48BITS(ackp + 2); } else { ND_TCHECK2(*ackp, 4); - ackno = EXTRACT_24BITS(ackp + 1); + ackno = EXTRACT_BE_24BITS(ackp + 1); } ND_PRINT((ndo, "(ack=%" PRIu64 ") ", ackno)); @@ -307,8 +307,8 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, } ND_TCHECK2(*dh, fixed_hdrlen); - sport = EXTRACT_16BITS(&dh->dccph_sport); - dport = EXTRACT_16BITS(&dh->dccph_dport); + sport = EXTRACT_BE_16BITS(&dh->dccph_sport); + dport = EXTRACT_BE_16BITS(&dh->dccph_dport); hlen = dh->dccph_doff * 4; if (ip6) { @@ -341,7 +341,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, if (ndo->ndo_vflag && ND_TTEST2(bp[0], len)) { uint16_t sum = 0, dccp_sum; - dccp_sum = EXTRACT_16BITS(&dh->dccph_checksum); + dccp_sum = EXTRACT_BE_16BITS(&dh->dccph_checksum); ND_PRINT((ndo, "cksum 0x%04x ", dccp_sum)); if (IP_V(ip) == 4) sum = dccp_cksum(ndo, ip, dh, len); @@ -372,7 +372,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, ND_TCHECK(*dhr); ND_PRINT((ndo, "%s (service=%d) ", tok2str(dccp_pkt_type_str, "", dccph_type), - EXTRACT_32BITS(&dhr->dccph_req_service))); + EXTRACT_BE_32BITS(&dhr->dccph_req_service))); break; } case DCCP_PKT_RESPONSE: { @@ -388,7 +388,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, ND_TCHECK(*dhr); ND_PRINT((ndo, "%s (service=%d) ", tok2str(dccp_pkt_type_str, "", dccph_type), - EXTRACT_32BITS(&dhr->dccph_resp_service))); + EXTRACT_BE_32BITS(&dhr->dccph_resp_service))); break; } case DCCP_PKT_DATA: @@ -566,10 +566,10 @@ static int dccp_print_option(netdissect_options *ndo, const u_char *option, u_in ND_PRINT((ndo, "CCID option %d", *option)); switch (optlen) { case 4: - ND_PRINT((ndo, " %u", EXTRACT_16BITS(option + 2))); + ND_PRINT((ndo, " %u", EXTRACT_BE_16BITS(option + 2))); break; case 6: - ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(option + 2))); break; default: break; @@ -625,21 +625,21 @@ static int dccp_print_option(netdissect_options *ndo, const u_char *option, u_in break; case 41: if (optlen == 4) - ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(option + 2))); else ND_PRINT((ndo, " optlen != 4")); break; case 42: if (optlen == 4) - ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(option + 2))); else ND_PRINT((ndo, " optlen != 4")); break; case 43: if (optlen == 6) - ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(option + 2))); else if (optlen == 4) - ND_PRINT((ndo, " %u", EXTRACT_16BITS(option + 2))); + ND_PRINT((ndo, " %u", EXTRACT_BE_16BITS(option + 2))); else ND_PRINT((ndo, " optlen != 4 or 6")); break; diff --git a/print-dhcp6.c b/print-dhcp6.c index cbb6d84a..cc2787a9 100644 --- a/print-dhcp6.c +++ b/print-dhcp6.c @@ -299,10 +299,10 @@ dhcp6opt_print(netdissect_options *ndo, goto trunc; dh6o = (const struct dhcp6opt *)cp; ND_TCHECK(*dh6o); - optlen = EXTRACT_16BITS(&dh6o->dh6opt_len); + optlen = EXTRACT_BE_16BITS(&dh6o->dh6opt_len); if (ep < cp + sizeof(*dh6o) + optlen) goto trunc; - opttype = EXTRACT_16BITS(&dh6o->dh6opt_type); + opttype = EXTRACT_BE_16BITS(&dh6o->dh6opt_type); ND_PRINT((ndo, " (%s", tok2str(dh6opt_str, "opt_%u", opttype))); ND_TCHECK2(*(cp + sizeof(*dh6o)), optlen); switch (opttype) { @@ -314,12 +314,12 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - switch (EXTRACT_16BITS(tp)) { + switch (EXTRACT_BE_16BITS(tp)) { case 1: if (optlen >= 2 + 6) { ND_PRINT((ndo, " hwaddr/time type %u time %u ", - EXTRACT_16BITS(&tp[2]), - EXTRACT_32BITS(&tp[4]))); + EXTRACT_BE_16BITS(&tp[2]), + EXTRACT_BE_32BITS(&tp[4]))); for (i = 8; i < optlen; i++) ND_PRINT((ndo, "%02x", tp[i])); /*(*/ @@ -344,7 +344,7 @@ dhcp6opt_print(netdissect_options *ndo, case 3: if (optlen >= 2 + 2) { ND_PRINT((ndo, " hwaddr type %u ", - EXTRACT_16BITS(&tp[2]))); + EXTRACT_BE_16BITS(&tp[2]))); for (i = 4; i < optlen; i++) ND_PRINT((ndo, "%02x", tp[i])); /*(*/ @@ -355,7 +355,7 @@ dhcp6opt_print(netdissect_options *ndo, } break; default: - ND_PRINT((ndo, " type %d)", EXTRACT_16BITS(tp))); + ND_PRINT((ndo, " type %d)", EXTRACT_BE_16BITS(tp))); break; } break; @@ -368,8 +368,8 @@ dhcp6opt_print(netdissect_options *ndo, tp = (const u_char *)(dh6o + 1); ND_PRINT((ndo, " %s", ip6addr_string(ndo, &tp[0]))); ND_PRINT((ndo, " pltime:%u vltime:%u", - EXTRACT_32BITS(&tp[16]), - EXTRACT_32BITS(&tp[20]))); + EXTRACT_BE_32BITS(&tp[16]), + EXTRACT_BE_32BITS(&tp[20]))); if (optlen > 24) { /* there are sub-options */ dhcp6opt_print(ndo, tp + 24, tp + optlen); @@ -385,7 +385,7 @@ dhcp6opt_print(netdissect_options *ndo, tp = (const u_char *)(dh6o + 1); for (i = 0; i < optlen; i += 2) { ND_PRINT((ndo, " %s", - tok2str(dh6opt_str, "opt_%u", EXTRACT_16BITS(&tp[i])))); + tok2str(dh6opt_str, "opt_%u", EXTRACT_BE_16BITS(&tp[i])))); } ND_PRINT((ndo, ")")); break; @@ -403,7 +403,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT((ndo, " %d)", EXTRACT_16BITS(tp))); + ND_PRINT((ndo, " %d)", EXTRACT_BE_16BITS(tp))); break; case DH6OPT_RELAY_MSG: ND_PRINT((ndo, " (")); @@ -451,7 +451,7 @@ dhcp6opt_print(netdissect_options *ndo, tp++; ND_PRINT((ndo, ", RD:")); for (i = 0; i < 4; i++, tp += 2) - ND_PRINT((ndo, " %04x", EXTRACT_16BITS(tp))); + ND_PRINT((ndo, " %04x", EXTRACT_BE_16BITS(tp))); /* protocol dependent part */ authinfolen = optlen - 11; @@ -469,11 +469,11 @@ dhcp6opt_print(netdissect_options *ndo, } for (i = 0; i < authrealmlen; i++, tp++) ND_PRINT((ndo, "%02x", *tp)); - ND_PRINT((ndo, ", key ID: %08x", EXTRACT_32BITS(tp))); + ND_PRINT((ndo, ", key ID: %08x", EXTRACT_BE_32BITS(tp))); tp += 4; ND_PRINT((ndo, ", HMAC-MD5:")); for (i = 0; i < 4; i++, tp+= 4) - ND_PRINT((ndo, " %08x", EXTRACT_32BITS(tp))); + ND_PRINT((ndo, " %08x", EXTRACT_BE_32BITS(tp))); break; case DH6OPT_AUTHPROTO_RECONFIG: if (authinfolen != 17) { @@ -493,7 +493,7 @@ dhcp6opt_print(netdissect_options *ndo, } ND_PRINT((ndo, " value:")); for (i = 0; i < 4; i++, tp+= 4) - ND_PRINT((ndo, " %08x", EXTRACT_32BITS(tp))); + ND_PRINT((ndo, " %08x", EXTRACT_BE_32BITS(tp))); break; default: ND_PRINT((ndo, " ??")); @@ -571,7 +571,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT((ndo, " %s)", dhcp6stcode(EXTRACT_16BITS(&tp[0])))); + ND_PRINT((ndo, " %s)", dhcp6stcode(EXTRACT_BE_16BITS(&tp[0])))); break; case DH6OPT_IA_NA: case DH6OPT_IA_PD: @@ -581,9 +581,9 @@ dhcp6opt_print(netdissect_options *ndo, } tp = (const u_char *)(dh6o + 1); ND_PRINT((ndo, " IAID:%u T1:%u T2:%u", - EXTRACT_32BITS(&tp[0]), - EXTRACT_32BITS(&tp[4]), - EXTRACT_32BITS(&tp[8]))); + EXTRACT_BE_32BITS(&tp[0]), + EXTRACT_BE_32BITS(&tp[4]), + EXTRACT_BE_32BITS(&tp[8]))); if (optlen > 12) { /* there are sub-options */ dhcp6opt_print(ndo, tp + 12, tp + optlen); @@ -596,7 +596,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT((ndo, " IAID:%u", EXTRACT_32BITS(tp))); + ND_PRINT((ndo, " IAID:%u", EXTRACT_BE_32BITS(tp))); if (optlen > 4) { /* there are sub-options */ dhcp6opt_print(ndo, tp + 4, tp + optlen); @@ -611,8 +611,8 @@ dhcp6opt_print(netdissect_options *ndo, tp = (const u_char *)(dh6o + 1); ND_PRINT((ndo, " %s/%d", ip6addr_string(ndo, &tp[9]), tp[8])); ND_PRINT((ndo, " pltime:%u vltime:%u", - EXTRACT_32BITS(&tp[0]), - EXTRACT_32BITS(&tp[4]))); + EXTRACT_BE_32BITS(&tp[0]), + EXTRACT_BE_32BITS(&tp[4]))); if (optlen > 25) { /* there are sub-options */ dhcp6opt_print(ndo, tp + 25, tp + optlen); @@ -626,7 +626,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT((ndo, " %d)", EXTRACT_32BITS(tp))); + ND_PRINT((ndo, " %d)", EXTRACT_BE_32BITS(tp))); break; case DH6OPT_REMOTE_ID: if (optlen < 4) { @@ -634,7 +634,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT((ndo, " %d ", EXTRACT_32BITS(tp))); + ND_PRINT((ndo, " %d ", EXTRACT_BE_32BITS(tp))); /* * Print hex dump first 10 characters. */ @@ -695,9 +695,9 @@ dhcp6opt_print(netdissect_options *ndo, } tp = (const u_char *)(dh6o + 1); while (tp < cp + sizeof(*dh6o) + optlen - 4) { - subopt_code = EXTRACT_16BITS(tp); + subopt_code = EXTRACT_BE_16BITS(tp); tp += 2; - subopt_len = EXTRACT_16BITS(tp); + subopt_len = EXTRACT_BE_16BITS(tp); tp += 2; if (tp + subopt_len > cp + sizeof(*dh6o) + optlen) goto trunc; @@ -807,7 +807,7 @@ dhcp6_print(netdissect_options *ndo, ND_PRINT((ndo, " %s (", name)); /*)*/ if (dh6->dh6_msgtype != DH6_RELAY_FORW && dh6->dh6_msgtype != DH6_RELAY_REPLY) { - ND_PRINT((ndo, "xid=%x", EXTRACT_32BITS(&dh6->dh6_xid) & DH6_XIDMASK)); + ND_PRINT((ndo, "xid=%x", EXTRACT_BE_32BITS(&dh6->dh6_xid) & DH6_XIDMASK)); extp = (const u_char *)(dh6 + 1); dhcp6opt_print(ndo, extp, ep); } else { /* relay messages */ diff --git a/print-domain.c b/print-domain.c index 4bd2cf16..3eea6ac7 100644 --- a/print-domain.c +++ b/print-domain.c @@ -332,11 +332,11 @@ ns_qprint(netdissect_options *ndo, return(NULL); /* print the qtype */ - i = EXTRACT_16BITS(cp); + i = EXTRACT_BE_16BITS(cp); cp += 2; ND_PRINT((ndo, " %s", tok2str(ns_type2str, "Type%d", i))); /* print the qclass (if it's not IN) */ - i = EXTRACT_16BITS(cp); + i = EXTRACT_BE_16BITS(cp); cp += 2; if (is_mdns) class = (i & ~C_QU); @@ -373,10 +373,10 @@ ns_rprint(netdissect_options *ndo, return (ndo->ndo_snapend); /* print the type/qtype */ - typ = EXTRACT_16BITS(cp); + typ = EXTRACT_BE_16BITS(cp); cp += 2; /* print the class (if it's not IN and the type isn't OPT) */ - i = EXTRACT_16BITS(cp); + i = EXTRACT_BE_16BITS(cp); cp += 2; if (is_mdns) class = (i & ~C_CACHE_FLUSH); @@ -392,13 +392,13 @@ ns_rprint(netdissect_options *ndo, if (typ == T_OPT) { /* get opt flags */ cp += 2; - opt_flags = EXTRACT_16BITS(cp); + opt_flags = EXTRACT_BE_16BITS(cp); /* ignore rest of ttl field */ cp += 2; } else if (ndo->ndo_vflag > 2) { /* print ttl */ ND_PRINT((ndo, " [")); - unsigned_relts_print(ndo, EXTRACT_32BITS(cp)); + unsigned_relts_print(ndo, EXTRACT_BE_32BITS(cp)); ND_PRINT((ndo, "]")); cp += 4; } else { @@ -406,7 +406,7 @@ ns_rprint(netdissect_options *ndo, cp += 4; } - len = EXTRACT_16BITS(cp); + len = EXTRACT_BE_16BITS(cp); cp += 2; rp = cp + len; @@ -419,7 +419,7 @@ ns_rprint(netdissect_options *ndo, case T_A: if (!ND_TTEST2(*cp, sizeof(struct in_addr))) return(NULL); - ND_PRINT((ndo, " %s", intoa(htonl(EXTRACT_32BITS(cp))))); + ND_PRINT((ndo, " %s", intoa(htonl(EXTRACT_BE_32BITS(cp))))); break; case T_NS: @@ -444,15 +444,15 @@ ns_rprint(netdissect_options *ndo, return(NULL); if (!ND_TTEST2(*cp, 5 * 4)) return(NULL); - ND_PRINT((ndo, " %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp))); cp += 4; - ND_PRINT((ndo, " %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp))); cp += 4; - ND_PRINT((ndo, " %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp))); cp += 4; - ND_PRINT((ndo, " %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp))); cp += 4; - ND_PRINT((ndo, " %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp))); cp += 4; break; case T_MX: @@ -461,7 +461,7 @@ ns_rprint(netdissect_options *ndo, return(NULL); if (ns_nprint(ndo, cp + 2, bp) == NULL) return(NULL); - ND_PRINT((ndo, " %d", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, " %d", EXTRACT_BE_16BITS(cp))); break; case T_TXT: @@ -480,8 +480,8 @@ ns_rprint(netdissect_options *ndo, return(NULL); if (ns_nprint(ndo, cp + 6, bp) == NULL) return(NULL); - ND_PRINT((ndo, ":%d %d %d", EXTRACT_16BITS(cp + 4), - EXTRACT_16BITS(cp), EXTRACT_16BITS(cp + 2))); + ND_PRINT((ndo, ":%d %d %d", EXTRACT_BE_16BITS(cp + 4), + EXTRACT_BE_16BITS(cp), EXTRACT_BE_16BITS(cp + 2))); break; case T_AAAA: @@ -550,23 +550,23 @@ ns_rprint(netdissect_options *ndo, cp += 6; if (!ND_TTEST2(*cp, 2)) return(NULL); - ND_PRINT((ndo, " fudge=%u", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, " fudge=%u", EXTRACT_BE_16BITS(cp))); cp += 2; if (!ND_TTEST2(*cp, 2)) return(NULL); - ND_PRINT((ndo, " maclen=%u", EXTRACT_16BITS(cp))); - cp += 2 + EXTRACT_16BITS(cp); + ND_PRINT((ndo, " maclen=%u", EXTRACT_BE_16BITS(cp))); + cp += 2 + EXTRACT_BE_16BITS(cp); if (!ND_TTEST2(*cp, 2)) return(NULL); - ND_PRINT((ndo, " origid=%u", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, " origid=%u", EXTRACT_BE_16BITS(cp))); cp += 2; if (!ND_TTEST2(*cp, 2)) return(NULL); - ND_PRINT((ndo, " error=%u", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, " error=%u", EXTRACT_BE_16BITS(cp))); cp += 2; if (!ND_TTEST2(*cp, 2)) return(NULL); - ND_PRINT((ndo, " otherlen=%u", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, " otherlen=%u", EXTRACT_BE_16BITS(cp))); cp += 2; } } @@ -585,15 +585,15 @@ domain_print(netdissect_options *ndo, np = (const HEADER *)bp; ND_TCHECK(*np); /* get the byte-order right */ - qdcount = EXTRACT_16BITS(&np->qdcount); - ancount = EXTRACT_16BITS(&np->ancount); - nscount = EXTRACT_16BITS(&np->nscount); - arcount = EXTRACT_16BITS(&np->arcount); + qdcount = EXTRACT_BE_16BITS(&np->qdcount); + ancount = EXTRACT_BE_16BITS(&np->ancount); + nscount = EXTRACT_BE_16BITS(&np->nscount); + arcount = EXTRACT_BE_16BITS(&np->arcount); if (DNS_QR(np)) { /* this is a response */ ND_PRINT((ndo, "%d%s%s%s%s%s%s", - EXTRACT_16BITS(&np->id), + EXTRACT_BE_16BITS(&np->id), ns_ops[DNS_OPCODE(np)], ns_resp[DNS_RCODE(np)], DNS_AA(np)? "*" : "", @@ -606,7 +606,7 @@ domain_print(netdissect_options *ndo, /* Print QUESTION section on -vv */ cp = (const u_char *)(np + 1); while (qdcount--) { - if (qdcount < EXTRACT_16BITS(&np->qdcount) - 1) + if (qdcount < EXTRACT_BE_16BITS(&np->qdcount) - 1) ND_PRINT((ndo, ",")); if (ndo->ndo_vflag > 1) { ND_PRINT((ndo, " q:")); @@ -660,12 +660,12 @@ domain_print(netdissect_options *ndo, } else { /* this is a request */ - ND_PRINT((ndo, "%d%s%s%s", EXTRACT_16BITS(&np->id), ns_ops[DNS_OPCODE(np)], - DNS_RD(np) ? "+" : "", - DNS_CD(np) ? "%" : "")); + ND_PRINT((ndo, "%d%s%s%s", EXTRACT_BE_16BITS(&np->id), ns_ops[DNS_OPCODE(np)], + DNS_RD(np) ? "+" : "", + DNS_CD(np) ? "%" : "")); /* any weirdness? */ - b2 = EXTRACT_16BITS(((const u_short *)np)+1); + b2 = EXTRACT_BE_16BITS(((const u_short *)np) + 1); if (b2 & 0x6cf) ND_PRINT((ndo, " [b2&3=0x%x]", b2)); diff --git a/print-dtp.c b/print-dtp.c index 1d8c66a0..2c981fc6 100644 --- a/print-dtp.c +++ b/print-dtp.c @@ -72,8 +72,8 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length) while (tptr < (pptr+length)) { ND_TCHECK2(*tptr, 4); - type = EXTRACT_16BITS(tptr); - len = EXTRACT_16BITS(tptr+2); + type = EXTRACT_BE_16BITS(tptr); + len = EXTRACT_BE_16BITS(tptr + 2); /* XXX: should not be but sometimes it is, see the test captures */ if (type == 0) return; diff --git a/print-dvmrp.c b/print-dvmrp.c index 60f836e8..814b3598 100644 --- a/print-dvmrp.c +++ b/print-dvmrp.c @@ -338,7 +338,7 @@ print_prune(netdissect_options *ndo, ND_PRINT((ndo, " src %s grp %s", ipaddr_string(ndo, bp), ipaddr_string(ndo, bp + 4))); bp += 8; ND_PRINT((ndo, " timer ")); - unsigned_relts_print(ndo, EXTRACT_32BITS(bp)); + unsigned_relts_print(ndo, EXTRACT_BE_32BITS(bp)); return (0); trunc: return (-1); diff --git a/print-eap.c b/print-eap.c index 5126c96f..886b4f6c 100644 --- a/print-eap.c +++ b/print-eap.c @@ -167,7 +167,7 @@ eap_print(netdissect_options *ndo, tok2str(eap_frame_type_values, "unknown", eap->type), eap->type, eap->version, - EXTRACT_16BITS(eap->length))); + EXTRACT_BE_16BITS(eap->length))); return; } @@ -175,7 +175,7 @@ eap_print(netdissect_options *ndo, tok2str(eap_frame_type_values, "unknown", eap->type), eap->type, eap->version, - EXTRACT_16BITS(eap->length))); + EXTRACT_BE_16BITS(eap->length))); tptr += sizeof(struct eap_frame_t); tlen -= sizeof(struct eap_frame_t); @@ -185,7 +185,7 @@ eap_print(netdissect_options *ndo, ND_TCHECK_8BITS(tptr); type = *(tptr); ND_TCHECK_16BITS(tptr+2); - len = EXTRACT_16BITS(tptr+2); + len = EXTRACT_BE_16BITS(tptr + 2); ND_PRINT((ndo, ", %s (%u), id %u, len %u", tok2str(eap_code_values, "unknown", type), type, @@ -245,7 +245,7 @@ eap_print(netdissect_options *ndo, if (EAP_TLS_EXTRACT_BIT_L(*(tptr+5))) { ND_TCHECK_32BITS(tptr + 6); - ND_PRINT((ndo, " len %u", EXTRACT_32BITS(tptr + 6))); + ND_PRINT((ndo, " len %u", EXTRACT_BE_32BITS(tptr + 6))); } break; @@ -259,7 +259,7 @@ eap_print(netdissect_options *ndo, if (EAP_TLS_EXTRACT_BIT_L(*(tptr+5))) { ND_TCHECK_32BITS(tptr + 6); - ND_PRINT((ndo, " len %u", EXTRACT_32BITS(tptr + 6))); + ND_PRINT((ndo, " len %u", EXTRACT_BE_32BITS(tptr + 6))); } /* FIXME - TLV attributes follow */ diff --git a/print-egp.c b/print-egp.c index 8fba9ce7..29f653b3 100644 --- a/print-egp.c +++ b/print-egp.c @@ -244,8 +244,8 @@ egp_print(netdissect_options *ndo, if (!ndo->ndo_vflag) { ND_PRINT((ndo, "EGPv%u, AS %u, seq %u, length %u", egp->egp_version, - EXTRACT_16BITS(&egp->egp_as), - EXTRACT_16BITS(&egp->egp_sequence), + EXTRACT_BE_16BITS(&egp->egp_as), + EXTRACT_BE_16BITS(&egp->egp_sequence), length)); return; } else @@ -281,8 +281,8 @@ egp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, " hello:%d poll:%d", - EXTRACT_16BITS(&egp->egp_hello), - EXTRACT_16BITS(&egp->egp_poll))); + EXTRACT_BE_16BITS(&egp->egp_hello), + EXTRACT_BE_16BITS(&egp->egp_poll))); break; case EGPC_REFUSE: @@ -363,10 +363,10 @@ egp_print(netdissect_options *ndo, else ND_PRINT((ndo, " [status %d]", status)); - if (EXTRACT_16BITS(&egp->egp_reason) <= EGPR_UVERSION) - ND_PRINT((ndo, " %s", egp_reasons[EXTRACT_16BITS(&egp->egp_reason)])); + if (EXTRACT_BE_16BITS(&egp->egp_reason) <= EGPR_UVERSION) + ND_PRINT((ndo, " %s", egp_reasons[EXTRACT_BE_16BITS(&egp->egp_reason)])); else - ND_PRINT((ndo, " [reason %d]", EXTRACT_16BITS(&egp->egp_reason))); + ND_PRINT((ndo, " [reason %d]", EXTRACT_BE_16BITS(&egp->egp_reason))); break; default: diff --git a/print-eigrp.c b/print-eigrp.c index d6884c26..b37b08b1 100644 --- a/print-eigrp.c +++ b/print-eigrp.c @@ -260,13 +260,13 @@ eigrp_print(netdissect_options *ndo, register const u_char *pptr, register u_int eigrp_com_header->version, tok2str(eigrp_opcode_values, "unknown, type: %u",eigrp_com_header->opcode), eigrp_com_header->opcode, - EXTRACT_16BITS(&eigrp_com_header->checksum), + EXTRACT_BE_16BITS(&eigrp_com_header->checksum), tok2str(eigrp_common_header_flag_values, "none", - EXTRACT_32BITS(&eigrp_com_header->flags)), - EXTRACT_32BITS(&eigrp_com_header->seq), - EXTRACT_32BITS(&eigrp_com_header->ack), - EXTRACT_32BITS(&eigrp_com_header->asn), + EXTRACT_BE_32BITS(&eigrp_com_header->flags)), + EXTRACT_BE_32BITS(&eigrp_com_header->seq), + EXTRACT_BE_32BITS(&eigrp_com_header->ack), + EXTRACT_BE_32BITS(&eigrp_com_header->asn), tlen)); tptr+=sizeof(struct eigrp_common_header); @@ -276,8 +276,8 @@ eigrp_print(netdissect_options *ndo, register const u_char *pptr, register u_int ND_TCHECK2(*tptr, sizeof(struct eigrp_tlv_header)); eigrp_tlv_header = (const struct eigrp_tlv_header *)tptr; - eigrp_tlv_len=EXTRACT_16BITS(&eigrp_tlv_header->length); - eigrp_tlv_type=EXTRACT_16BITS(&eigrp_tlv_header->type); + eigrp_tlv_len=EXTRACT_BE_16BITS(&eigrp_tlv_header->length); + eigrp_tlv_type=EXTRACT_BE_16BITS(&eigrp_tlv_header->type); if (eigrp_tlv_len < sizeof(struct eigrp_tlv_header) || @@ -315,7 +315,7 @@ eigrp_print(netdissect_options *ndo, register const u_char *pptr, register u_int } ND_PRINT((ndo, "\n\t holdtime: %us, k1 %u, k2 %u, k3 %u, k4 %u, k5 %u", - EXTRACT_16BITS(tlv_ptr.eigrp_tlv_general_parm->holdtime), + EXTRACT_BE_16BITS(tlv_ptr.eigrp_tlv_general_parm->holdtime), tlv_ptr.eigrp_tlv_general_parm->k1, tlv_ptr.eigrp_tlv_general_parm->k2, tlv_ptr.eigrp_tlv_general_parm->k3, @@ -358,15 +358,15 @@ eigrp_print(netdissect_options *ndo, register const u_char *pptr, register u_int ND_PRINT((ndo, "\n\t IPv4 prefix: %15s/%u, nexthop: ", ipaddr_string(ndo, prefix), bit_length)); - if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0) + if (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0) ND_PRINT((ndo, "self")); else ND_PRINT((ndo, "%s",ipaddr_string(ndo, &tlv_ptr.eigrp_tlv_ip_int->nexthop))); ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u", - (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->delay)/100), - EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->bandwidth), - EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_ip_int->mtu), + (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_int->delay)/100), + EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_int->bandwidth), + EXTRACT_BE_24BITS(&tlv_ptr.eigrp_tlv_ip_int->mtu), tlv_ptr.eigrp_tlv_ip_int->hopcount, tlv_ptr.eigrp_tlv_ip_int->reliability, tlv_ptr.eigrp_tlv_ip_int->load)); @@ -392,23 +392,23 @@ eigrp_print(netdissect_options *ndo, register const u_char *pptr, register u_int ND_PRINT((ndo, "\n\t IPv4 prefix: %15s/%u, nexthop: ", ipaddr_string(ndo, prefix), bit_length)); - if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0) + if (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0) ND_PRINT((ndo, "self")); else ND_PRINT((ndo, "%s",ipaddr_string(ndo, &tlv_ptr.eigrp_tlv_ip_ext->nexthop))); ND_PRINT((ndo, "\n\t origin-router %s, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u", ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_ext->origin_router), - EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->origin_as), + EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_ip_ext->origin_as), tok2str(eigrp_ext_proto_id_values,"unknown",tlv_ptr.eigrp_tlv_ip_ext->proto_id), tlv_ptr.eigrp_tlv_ip_ext->flags, - EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->tag), - EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->metric))); + EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_ip_ext->tag), + EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_ip_ext->metric))); ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u", - (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->delay)/100), - EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->bandwidth), - EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_ip_ext->mtu), + (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->delay)/100), + EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->bandwidth), + EXTRACT_BE_24BITS(&tlv_ptr.eigrp_tlv_ip_ext->mtu), tlv_ptr.eigrp_tlv_ip_ext->hopcount, tlv_ptr.eigrp_tlv_ip_ext->reliability, tlv_ptr.eigrp_tlv_ip_ext->load)); @@ -423,9 +423,9 @@ eigrp_print(netdissect_options *ndo, register const u_char *pptr, register u_int } ND_PRINT((ndo, "\n\t Cable-range: %u-%u, Router-ID %u", - EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_start), - EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_end), - EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->router_id))); + EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_start), + EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_end), + EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->router_id))); break; case EIGRP_TLV_AT_INT: @@ -437,20 +437,20 @@ eigrp_print(netdissect_options *ndo, register const u_char *pptr, register u_int } ND_PRINT((ndo, "\n\t Cable-Range: %u-%u, nexthop: ", - EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_start), - EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_end))); + EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_start), + EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_end))); - if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop) == 0) + if (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop) == 0) ND_PRINT((ndo, "self")); else ND_PRINT((ndo, "%u.%u", - EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop), - EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop[2]))); + EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop), + EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop[2]))); ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u", - (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_int->delay)/100), - EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_int->bandwidth), - EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_at_int->mtu), + (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_int->delay)/100), + EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_int->bandwidth), + EXTRACT_BE_24BITS(&tlv_ptr.eigrp_tlv_at_int->mtu), tlv_ptr.eigrp_tlv_at_int->hopcount, tlv_ptr.eigrp_tlv_at_int->reliability, tlv_ptr.eigrp_tlv_at_int->load)); @@ -465,28 +465,28 @@ eigrp_print(netdissect_options *ndo, register const u_char *pptr, register u_int } ND_PRINT((ndo, "\n\t Cable-Range: %u-%u, nexthop: ", - EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_start), - EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_end))); + EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_start), + EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_end))); - if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop) == 0) + if (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop) == 0) ND_PRINT((ndo, "self")); else ND_PRINT((ndo, "%u.%u", - EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop), - EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop[2]))); + EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop), + EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop[2]))); ND_PRINT((ndo, "\n\t origin-router %u, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u", - EXTRACT_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_router), - EXTRACT_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_as), + EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_router), + EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_as), tok2str(eigrp_ext_proto_id_values,"unknown",tlv_ptr.eigrp_tlv_at_ext->proto_id), tlv_ptr.eigrp_tlv_at_ext->flags, - EXTRACT_32BITS(tlv_ptr.eigrp_tlv_at_ext->tag), - EXTRACT_16BITS(tlv_ptr.eigrp_tlv_at_ext->metric))); + EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_at_ext->tag), + EXTRACT_BE_16BITS(tlv_ptr.eigrp_tlv_at_ext->metric))); ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u", - (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_ext->delay)/100), - EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_ext->bandwidth), - EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_at_ext->mtu), + (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_ext->delay)/100), + EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_ext->bandwidth), + EXTRACT_BE_24BITS(&tlv_ptr.eigrp_tlv_at_ext->mtu), tlv_ptr.eigrp_tlv_at_ext->hopcount, tlv_ptr.eigrp_tlv_at_ext->reliability, tlv_ptr.eigrp_tlv_at_ext->load)); diff --git a/print-enc.c b/print-enc.c index d791b3f5..0406175c 100644 --- a/print-enc.c +++ b/print-enc.c @@ -108,7 +108,7 @@ enc_if_print(netdissect_options *ndo, ENC_PRINT_TYPE(flags, M_AUTH, "authentic"); ENC_PRINT_TYPE(flags, M_CONF, "confidential"); /* ENC_PRINT_TYPE(flags, M_TUNNEL, "tunnel"); */ - ND_PRINT((ndo, "SPI 0x%08x: ", EXTRACT_32BITS(&hdr->spi))); + ND_PRINT((ndo, "SPI 0x%08x: ", EXTRACT_BE_32BITS(&hdr->spi))); length -= ENC_HDRLEN; caplen -= ENC_HDRLEN; diff --git a/print-esp.c b/print-esp.c index d12b97da..59d109d4 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_32BITS(&esp->esp_spi))); - ND_PRINT((ndo, ",seq=0x%x)", EXTRACT_32BITS(&esp->esp_seq))); + 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, ", 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_16BITS(&ip6->ip6_plen)) + if (!EXTRACT_BE_16BITS(&ip6->ip6_plen)) goto fail; /* if we can't get nexthdr, we do not need to decrypt it */ - len = sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen); + len = sizeof(struct ip6_hdr) + EXTRACT_BE_16BITS(&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_32BITS(&esp->esp_spi) && + if (sa->spi == EXTRACT_BE_32BITS(&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_16BITS(&ip->ip_off) & IP_MF) + if (EXTRACT_BE_16BITS(&ip->ip_off) & IP_MF) goto fail; - len = EXTRACT_16BITS(&ip->ip_len); + len = EXTRACT_BE_16BITS(&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_32BITS(&esp->esp_spi) && + if (sa->spi == EXTRACT_BE_32BITS(&esp->esp_spi) && sa->daddr_version == 4 && UNALIGNED_MEMCMP(&sa->daddr.in4, &ip->ip_dst, sizeof(struct in_addr)) == 0) { diff --git a/print-ether.c b/print-ether.c index 33a135e0..5ffbb273 100644 --- a/print-ether.c +++ b/print-ether.c @@ -102,7 +102,7 @@ ether_hdr_print(netdissect_options *ndo, etheraddr_string(ndo, ESRC(ep)), etheraddr_string(ndo, EDST(ep)))); - length_type = EXTRACT_16BITS(&ep->ether_length_type); + length_type = EXTRACT_BE_16BITS(&ep->ether_length_type); if (!ndo->ndo_qflag) { if (length_type <= ETHERMTU) { ND_PRINT((ndo, ", 802.3")); @@ -168,7 +168,7 @@ ether_print(netdissect_options *ndo, src.addr_string = etheraddr_string; dst.addr = EDST(ep); dst.addr_string = etheraddr_string; - length_type = EXTRACT_16BITS(&ep->ether_length_type); + length_type = EXTRACT_BE_16BITS(&ep->ether_length_type); recurse: /* @@ -201,12 +201,12 @@ recurse: return (hdrlen + length); } if (ndo->ndo_eflag) { - uint16_t tag = EXTRACT_16BITS(p); + uint16_t tag = EXTRACT_BE_16BITS(p); ND_PRINT((ndo, "%s, ", ieee8021q_tci_string(tag))); } - length_type = EXTRACT_16BITS(p + 2); + length_type = EXTRACT_BE_16BITS(p + 2); if (ndo->ndo_eflag && length_type > ETHERMTU) ND_PRINT((ndo, "ethertype %s, ", tok2str(ethertype_values,"0x%04x", length_type))); p += 4; diff --git a/print-forces.c b/print-forces.c index 702b8384..b74227e6 100644 --- a/print-forces.c +++ b/print-forces.c @@ -157,20 +157,20 @@ struct forcesh { #define ForCES_V(forcesh) ((forcesh)->fm_vrsvd >> 4) nd_uint8_t fm_tom; /* type of message */ nd_uint16_t fm_len; /* total length * 4 bytes */ -#define ForCES_BLN(forcesh) ((uint32_t)(EXTRACT_16BITS(&(forcesh)->fm_len) << 2)) +#define ForCES_BLN(forcesh) ((uint32_t)(EXTRACT_BE_16BITS(&(forcesh)->fm_len) << 2)) nd_uint32_t fm_sid; /* Source ID */ -#define ForCES_SID(forcesh) EXTRACT_32BITS(&(forcesh)->fm_sid) +#define ForCES_SID(forcesh) EXTRACT_BE_32BITS(&(forcesh)->fm_sid) nd_uint32_t fm_did; /* Destination ID */ -#define ForCES_DID(forcesh) EXTRACT_32BITS(&(forcesh)->fm_did) +#define ForCES_DID(forcesh) EXTRACT_BE_32BITS(&(forcesh)->fm_did) nd_uint8_t fm_cor[8]; /* correlator */ nd_uint32_t fm_flags; /* flags */ -#define ForCES_ACK(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0xC0000000) >> 30) -#define ForCES_PRI(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x38000000) >> 27) -#define ForCES_RS1(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x07000000) >> 24) -#define ForCES_EM(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x00C00000) >> 22) -#define ForCES_AT(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x00200000) >> 21) -#define ForCES_TP(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x00180000) >> 19) -#define ForCES_RS2(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x0007FFFF) >> 0) +#define ForCES_ACK(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0xC0000000) >> 30) +#define ForCES_PRI(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x38000000) >> 27) +#define ForCES_RS1(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x07000000) >> 24) +#define ForCES_EM(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x00C00000) >> 22) +#define ForCES_AT(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x00200000) >> 21) +#define ForCES_TP(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x00180000) >> 19) +#define ForCES_RS2(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x0007FFFF) >> 0) }; #define ForCES_HLN_VALID(fhl,tlen) ((tlen) >= ForCES_HDRL && \ @@ -389,16 +389,16 @@ struct forces_tlv { #define TLV_ALN_LEN(len) F_ALN_LEN(TLV_SET_LEN(len)) #define TLV_RDAT_LEN(tlv) ((int)(EXTRACT_16BITS(&(tlv)->length) - TLV_SET_LEN(0)) #define TLV_DATA(tlvp) ((const void*)(((const char*)(tlvp)) + TLV_SET_LEN(0))) -#define GO_NXT_TLV(tlv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_16BITS(&(tlv)->length)), \ +#define GO_NXT_TLV(tlv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_BE_16BITS(&(tlv)->length)), \ (const struct forces_tlv*)(((const char*)(tlv)) \ - + F_ALN_LEN(EXTRACT_16BITS(&(tlv)->length)))) + + F_ALN_LEN(EXTRACT_BE_16BITS(&(tlv)->length)))) #define ILV_SET_LEN(len) (F_ALN_LEN(ILV_HDRL) + (len)) #define ILV_ALN_LEN(len) F_ALN_LEN(ILV_SET_LEN(len)) -#define ILV_RDAT_LEN(ilv) ((int)(EXTRACT_32BITS(&(ilv)->length)) - ILV_SET_LEN(0)) +#define ILV_RDAT_LEN(ilv) ((int)(EXTRACT_BE_32BITS(&(ilv)->length)) - ILV_SET_LEN(0)) #define ILV_DATA(ilvp) ((const void*)(((const char*)(ilvp)) + ILV_SET_LEN(0))) -#define GO_NXT_ILV(ilv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_32BITS(&(ilv)->length)), \ +#define GO_NXT_ILV(ilv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_BE_32BITS(&(ilv)->length)), \ (const struct forces_ilv *)(((const char*)(ilv)) \ - + F_ALN_LEN(EXTRACT_32BITS(&(ilv)->length)))) + + F_ALN_LEN(EXTRACT_BE_32BITS(&(ilv)->length)))) #define INVALID_RLEN 1 #define INVALID_STLN 2 #define INVALID_LTLN 3 @@ -416,11 +416,11 @@ static inline u_int tlv_valid(const struct forces_tlv *tlv, u_int rlen) { if (rlen < TLV_HDRL) return INVALID_RLEN; - if (EXTRACT_16BITS(&tlv->length) < TLV_HDRL) + if (EXTRACT_BE_16BITS(&tlv->length) < TLV_HDRL) return INVALID_STLN; - if (EXTRACT_16BITS(&tlv->length) > rlen) + if (EXTRACT_BE_16BITS(&tlv->length) > rlen) return INVALID_LTLN; - if (rlen < F_ALN_LEN(EXTRACT_16BITS(&tlv->length))) + if (rlen < F_ALN_LEN(EXTRACT_BE_16BITS(&tlv->length))) return INVALID_ALEN; return 0; @@ -430,11 +430,11 @@ static inline int ilv_valid(const struct forces_ilv *ilv, u_int rlen) { if (rlen < ILV_HDRL) return INVALID_RLEN; - if (EXTRACT_32BITS(&ilv->length) < ILV_HDRL) + if (EXTRACT_BE_32BITS(&ilv->length) < ILV_HDRL) return INVALID_STLN; - if (EXTRACT_32BITS(&ilv->length) > rlen) + if (EXTRACT_BE_32BITS(&ilv->length) > rlen) return INVALID_LTLN; - if (rlen < F_ALN_LEN(EXTRACT_32BITS(&ilv->length))) + if (rlen < F_ALN_LEN(EXTRACT_BE_32BITS(&ilv->length))) return INVALID_ALEN; return 0; @@ -693,7 +693,7 @@ fdatatlv_print(netdissect_options *ndo, */ rlen = len - TLV_HDRL; ND_TCHECK(*tlv); - type = EXTRACT_16BITS(&tlv->type); + type = EXTRACT_BE_16BITS(&tlv->type); if (type != F_TLV_FULD) { ND_PRINT((ndo, "Error: expecting FULLDATA!\n")); return -1; @@ -742,9 +742,9 @@ sdatailv_print(netdissect_options *ndo, return -1; } if (ndo->ndo_vflag >= 3) { - int ilvl = EXTRACT_32BITS(&ilv->length); + int ilvl = EXTRACT_BE_32BITS(&ilv->length); ND_PRINT((ndo, "\n%s ILV: type %x length %d\n", &ib[1], - EXTRACT_32BITS(&ilv->type), ilvl)); + EXTRACT_BE_32BITS(&ilv->type), ilvl)); hex_print_with_offset(ndo, "\t\t[", tdp, ilvl-ILV_HDRL, 0); } @@ -774,7 +774,7 @@ sdatatlv_print(netdissect_options *ndo, */ rlen = len - TLV_HDRL; ND_TCHECK(*tlv); - type = EXTRACT_16BITS(&tlv->type); + type = EXTRACT_BE_16BITS(&tlv->type); if (type != F_TLV_SPAD) { ND_PRINT((ndo, "Error: expecting SPARSEDATA!\n")); return -1; @@ -802,16 +802,16 @@ pkeyitlv_print(netdissect_options *ndo, u_int invtlv; ND_TCHECK(*tdp); - id = EXTRACT_32BITS(tdp); + id = EXTRACT_BE_32BITS(tdp); ND_PRINT((ndo, "%sKeyinfo: Key 0x%x\n", ib, id)); ND_TCHECK(*kdtlv); - type = EXTRACT_16BITS(&kdtlv->type); + type = EXTRACT_BE_16BITS(&kdtlv->type); invtlv = tlv_valid(kdtlv, len); if (invtlv) { ND_PRINT((ndo, "%s TLV type 0x%x len %d\n", tok2str(ForCES_TLV_err, NULL, invtlv), type, - EXTRACT_16BITS(&kdtlv->length))); + EXTRACT_BE_16BITS(&kdtlv->length))); return -1; } /* @@ -819,7 +819,7 @@ pkeyitlv_print(netdissect_options *ndo, * length is large enough but not too large (it doesn't * go past the end of the containing TLV). */ - tll = EXTRACT_16BITS(&kdtlv->length); + tll = EXTRACT_BE_16BITS(&kdtlv->length); dp = (const u_char *) TLV_DATA(kdtlv); return fdatatlv_print(ndo, dp, tll, op_msk, indent); @@ -846,7 +846,7 @@ pdatacnt_print(netdissect_options *ndo, ND_TCHECK2(*pptr, 4); if (len < 4) goto trunc; - id = EXTRACT_32BITS(pptr); + id = EXTRACT_BE_32BITS(pptr); if (ndo->ndo_vflag >= 3) ND_PRINT((ndo, "%sID#%02u: %d\n", ib, i + 1, id)); len -= 4; @@ -866,11 +866,11 @@ pdatacnt_print(netdissect_options *ndo, pptr += sizeof(struct forces_tlv); len -= sizeof(struct forces_tlv); - starti = EXTRACT_32BITS(pptr); + starti = EXTRACT_BE_32BITS(pptr); pptr += 4; len -= 4; - endi = EXTRACT_32BITS(pptr); + endi = EXTRACT_BE_32BITS(pptr); pptr += 4; len -= 4; @@ -896,7 +896,7 @@ pdatacnt_print(netdissect_options *ndo, pptr += sizeof(struct forces_tlv); len -= sizeof(struct forces_tlv); /* skip key content */ - tll = EXTRACT_16BITS(&keytlv->length); + tll = EXTRACT_BE_16BITS(&keytlv->length); if (tll < TLV_HDRL) { ND_PRINT((ndo, "key content length %u < %u\n", tll, TLV_HDRL)); @@ -922,12 +922,12 @@ pdatacnt_print(netdissect_options *ndo, u_int invtlv; ND_TCHECK(*pdtlv); - type = EXTRACT_16BITS(&pdtlv->type); + type = EXTRACT_BE_16BITS(&pdtlv->type); invtlv = tlv_valid(pdtlv, len); if (invtlv) { ND_PRINT((ndo, "%s Outstanding bytes %d for TLV type 0x%x TLV len %d\n", tok2str(ForCES_TLV_err, NULL, invtlv), len, type, - EXTRACT_16BITS(&pdtlv->length))); + EXTRACT_BE_16BITS(&pdtlv->length))); goto pd_err; } /* @@ -935,15 +935,15 @@ pdatacnt_print(netdissect_options *ndo, * length is large enough but not too large (it doesn't * go past the end of the containing TLV). */ - tll = EXTRACT_16BITS(&pdtlv->length) - TLV_HDRL; - aln = F_ALN_LEN(EXTRACT_16BITS(&pdtlv->length)); - if (aln > EXTRACT_16BITS(&pdtlv->length)) { + tll = EXTRACT_BE_16BITS(&pdtlv->length) - TLV_HDRL; + aln = F_ALN_LEN(EXTRACT_BE_16BITS(&pdtlv->length)); + if (aln > EXTRACT_BE_16BITS(&pdtlv->length)) { if (aln > len) { ND_PRINT((ndo, "Invalid padded pathdata TLV type 0x%x len %d missing %d pad bytes\n", - type, EXTRACT_16BITS(&pdtlv->length), aln - len)); + type, EXTRACT_BE_16BITS(&pdtlv->length), aln - len)); } else { - pad = aln - EXTRACT_16BITS(&pdtlv->length); + pad = aln - EXTRACT_BE_16BITS(&pdtlv->length); } } if (pd_valid(type)) { @@ -952,10 +952,10 @@ pdatacnt_print(netdissect_options *ndo, if (ndo->ndo_vflag >= 3 && ops->v != F_TLV_PDAT) { if (pad) ND_PRINT((ndo, "%s %s (Length %d DataLen %d pad %d Bytes)\n", - ib, ops->s, EXTRACT_16BITS(&pdtlv->length), tll, pad)); + ib, ops->s, EXTRACT_BE_16BITS(&pdtlv->length), tll, pad)); else ND_PRINT((ndo, "%s %s (Length %d DataLen %d Bytes)\n", - ib, ops->s, EXTRACT_16BITS(&pdtlv->length), tll)); + ib, ops->s, EXTRACT_BE_16BITS(&pdtlv->length), tll)); } chk_op_type(ndo, type, op_msk, ops->op_msk); @@ -967,9 +967,9 @@ pdatacnt_print(netdissect_options *ndo, len -= (TLV_HDRL + pad + tll); } else { ND_PRINT((ndo, "Invalid path data content type 0x%x len %d\n", - type, EXTRACT_16BITS(&pdtlv->length))); + type, EXTRACT_BE_16BITS(&pdtlv->length))); pd_err: - if (EXTRACT_16BITS(&pdtlv->length)) { + if (EXTRACT_BE_16BITS(&pdtlv->length)) { hex_print_with_offset(ndo, "Bad Data val\n\t [", pptr, len, 0); ND_PRINT((ndo, "]\n")); @@ -1001,25 +1001,25 @@ pdata_print(netdissect_options *ndo, goto trunc; if (ndo->ndo_vflag >= 3) { ND_PRINT((ndo, "\n%sPathdata: Flags 0x%x ID count %d\n", - ib, EXTRACT_16BITS(&pdh->pflags), EXTRACT_16BITS(&pdh->pIDcnt))); + ib, EXTRACT_BE_16BITS(&pdh->pflags), EXTRACT_BE_16BITS(&pdh->pIDcnt))); } - if (EXTRACT_16BITS(&pdh->pflags) & F_SELKEY) { + if (EXTRACT_BE_16BITS(&pdh->pflags) & F_SELKEY) { op_msk |= B_KEYIN; } /* Table GET Range operation */ - if (EXTRACT_16BITS(&pdh->pflags) & F_SELTABRANGE) { + if (EXTRACT_BE_16BITS(&pdh->pflags) & F_SELTABRANGE) { op_msk |= B_TRNG; } /* Table SET append operation */ - if (EXTRACT_16BITS(&pdh->pflags) & F_TABAPPEND) { + if (EXTRACT_BE_16BITS(&pdh->pflags) & F_TABAPPEND) { op_msk |= B_APPND; } pptr += sizeof(struct pathdata_h); len -= sizeof(struct pathdata_h); - idcnt = EXTRACT_16BITS(&pdh->pIDcnt); + idcnt = EXTRACT_BE_16BITS(&pdh->pIDcnt); minsize = idcnt * 4; if (len < minsize) { ND_PRINT((ndo, "\t\t\ttruncated IDs expected %uB got %uB\n", minsize, @@ -1061,11 +1061,11 @@ genoptlv_print(netdissect_options *ndo, char *ib = indent_pr(indent, 0); ND_TCHECK(*pdtlv); - type = EXTRACT_16BITS(&pdtlv->type); - tll = EXTRACT_16BITS(&pdtlv->length) - TLV_HDRL; + type = EXTRACT_BE_16BITS(&pdtlv->type); + tll = EXTRACT_BE_16BITS(&pdtlv->length) - TLV_HDRL; invtlv = tlv_valid(pdtlv, len); ND_PRINT((ndo, "genoptlvprint - %s TLV type 0x%x len %d\n", - tok2str(ForCES_TLV, NULL, type), type, EXTRACT_16BITS(&pdtlv->length))); + tok2str(ForCES_TLV, NULL, type), type, EXTRACT_BE_16BITS(&pdtlv->length))); if (!invtlv) { /* * At this point, tlv_valid() has ensured that the TLV @@ -1076,13 +1076,13 @@ genoptlv_print(netdissect_options *ndo, if (!ttlv_valid(type)) { ND_PRINT((ndo, "%s TLV type 0x%x len %d\n", tok2str(ForCES_TLV_err, NULL, invtlv), type, - EXTRACT_16BITS(&pdtlv->length))); + EXTRACT_BE_16BITS(&pdtlv->length))); return -1; } if (ndo->ndo_vflag >= 3) ND_PRINT((ndo, "%s%s, length %d (data length %d Bytes)", ib, tok2str(ForCES_TLV, NULL, type), - EXTRACT_16BITS(&pdtlv->length), tll)); + EXTRACT_BE_16BITS(&pdtlv->length), tll)); return pdata_print(ndo, dp, tll, op_msk, indent + 1); } else { @@ -1120,15 +1120,15 @@ recpdoptlv_print(netdissect_options *ndo, * go past the end of the containing TLV). */ ib = indent_pr(indent, 0); - type = EXTRACT_16BITS(&pdtlv->type); + type = EXTRACT_BE_16BITS(&pdtlv->type); dp = (const u_char *) TLV_DATA(pdtlv); - tll = EXTRACT_16BITS(&pdtlv->length) - TLV_HDRL; + tll = EXTRACT_BE_16BITS(&pdtlv->length) - TLV_HDRL; if (ndo->ndo_vflag >= 3) ND_PRINT((ndo, "%s%s, length %d (data encapsulated %d Bytes)", ib, tok2str(ForCES_TLV, NULL, type), - EXTRACT_16BITS(&pdtlv->length), - EXTRACT_16BITS(&pdtlv->length) - TLV_HDRL)); + EXTRACT_BE_16BITS(&pdtlv->length), + EXTRACT_BE_16BITS(&pdtlv->length) - TLV_HDRL)); if (pdata_print(ndo, dp, tll, op_msk, indent + 1) == -1) return -1; @@ -1138,7 +1138,7 @@ recpdoptlv_print(netdissect_options *ndo, if (len) { ND_PRINT((ndo, "\n\t\tMessy PATHDATA TLV header, type (0x%x)\n\t\texcess of %d Bytes ", - EXTRACT_16BITS(&pdtlv->type), len - EXTRACT_16BITS(&pdtlv->length))); + EXTRACT_BE_16BITS(&pdtlv->type), len - EXTRACT_BE_16BITS(&pdtlv->length))); return -1; } @@ -1180,17 +1180,17 @@ otlv_print(netdissect_options *ndo, * >= TLV_HDRL. */ ND_TCHECK(*otlv); - type = EXTRACT_16BITS(&otlv->type); - tll = EXTRACT_16BITS(&otlv->length) - TLV_HDRL; + type = EXTRACT_BE_16BITS(&otlv->type); + tll = EXTRACT_BE_16BITS(&otlv->length) - TLV_HDRL; ops = get_forces_optlv_h(type); if (ndo->ndo_vflag >= 3) { ND_PRINT((ndo, "%sOper TLV %s(0x%x) length %d\n", ib, ops->s, type, - EXTRACT_16BITS(&otlv->length))); + EXTRACT_BE_16BITS(&otlv->length))); } /* rest of ops must at least have 12B {pathinfo} */ if (tll < OP_MIN_SIZ) { ND_PRINT((ndo, "\t\tOper TLV %s(0x%x) length %d\n", ops->s, type, - EXTRACT_16BITS(&otlv->length))); + EXTRACT_BE_16BITS(&otlv->length))); ND_PRINT((ndo, "\t\tTruncated data size %d minimum required %d\n", tll, OP_MIN_SIZ)); return invoptlv_print(ndo, dp, tll, ops->op_msk, indent); @@ -1229,7 +1229,7 @@ asttlv_print(netdissect_options *ndo, return -1; } ND_TCHECK2(*pptr, 4); - rescode = EXTRACT_32BITS(pptr); + rescode = EXTRACT_BE_32BITS(pptr); if (rescode > ASTMCD) { ND_PRINT((ndo, "illegal ASTresult result code: %d!\n", rescode)); return -1; @@ -1287,7 +1287,7 @@ asrtlv_print(netdissect_options *ndo, return -1; } ND_TCHECK2(*pptr, 4); - rescode = EXTRACT_32BITS(pptr); + rescode = EXTRACT_BE_32BITS(pptr); if (rescode > ASRMCD) { ND_PRINT((ndo, "illegal ASRresult result code: %d!\n", rescode)); @@ -1353,10 +1353,10 @@ print_metailv(netdissect_options *ndo, * print_metatlv() has ensured that len (what remains in the * ILV) >= ILV_HDRL. */ - rlen = EXTRACT_32BITS(&ilv->length) - ILV_HDRL; + rlen = EXTRACT_BE_32BITS(&ilv->length) - ILV_HDRL; ND_TCHECK(*ilv); - ND_PRINT((ndo, "%sMetaID 0x%x length %d\n", ib, EXTRACT_32BITS(&ilv->type), - EXTRACT_32BITS(&ilv->length))); + ND_PRINT((ndo, "%sMetaID 0x%x length %d\n", ib, EXTRACT_BE_32BITS(&ilv->type), + EXTRACT_BE_32BITS(&ilv->length))); if (ndo->ndo_vflag >= 3) { hex_print_with_offset(ndo, "\t\t[", ILV_DATA(ilv), rlen, 0); ND_PRINT((ndo, " ]\n")); @@ -1468,16 +1468,18 @@ redirect_print(netdissect_options *ndo, * length is large enough but not too large (it doesn't * go past the end of the containing TLV). */ - if (EXTRACT_16BITS(&tlv->type) == F_TLV_METD) { + if (EXTRACT_BE_16BITS(&tlv->type) == F_TLV_METD) { print_metatlv(ndo, (const u_char *) TLV_DATA(tlv), - EXTRACT_16BITS(&tlv->length), 0, indent); - } else if ((EXTRACT_16BITS(&tlv->type) == F_TLV_REDD)) { + EXTRACT_BE_16BITS(&tlv->length), 0, + indent); + } else if ((EXTRACT_BE_16BITS(&tlv->type) == F_TLV_REDD)) { print_reddata(ndo, (const u_char *) TLV_DATA(tlv), - EXTRACT_16BITS(&tlv->length), 0, indent); + EXTRACT_BE_16BITS(&tlv->length), 0, + indent); } else { ND_PRINT((ndo, "Unknown REDIRECT TLV 0x%x len %d\n", - EXTRACT_16BITS(&tlv->type), - EXTRACT_16BITS(&tlv->length))); + EXTRACT_BE_16BITS(&tlv->type), + EXTRACT_BE_16BITS(&tlv->length))); } tlv = GO_NXT_TLV(tlv, rlen); @@ -1486,8 +1488,8 @@ redirect_print(netdissect_options *ndo, if (rlen) { ND_PRINT((ndo, "\n\t\tMessy Redirect TLV header, type (0x%x)\n\t\texcess of %d Bytes ", - EXTRACT_16BITS(&tlv->type), - rlen - EXTRACT_16BITS(&tlv->length))); + EXTRACT_BE_16BITS(&tlv->type), + rlen - EXTRACT_BE_16BITS(&tlv->length))); return -1; } @@ -1534,9 +1536,9 @@ lfbselect_print(netdissect_options *ndo, ND_TCHECK(*lfbs); if (ndo->ndo_vflag >= 3) { ND_PRINT((ndo, "\n%s%s(Classid %x) instance %x\n", - ib, tok2str(ForCES_LFBs, NULL, EXTRACT_32BITS(&lfbs->class)), - EXTRACT_32BITS(&lfbs->class), - EXTRACT_32BITS(&lfbs->instance))); + ib, tok2str(ForCES_LFBs, NULL, EXTRACT_BE_32BITS(&lfbs->class)), + EXTRACT_BE_32BITS(&lfbs->class), + EXTRACT_BE_32BITS(&lfbs->instance))); } otlv = (const struct forces_tlv *)(lfbs + 1); @@ -1553,14 +1555,14 @@ lfbselect_print(netdissect_options *ndo, * length is large enough but not too large (it doesn't * go past the end of the containing TLV). */ - if (op_valid(EXTRACT_16BITS(&otlv->type), op_msk)) { + if (op_valid(EXTRACT_BE_16BITS(&otlv->type), op_msk)) { otlv_print(ndo, otlv, 0, indent); } else { if (ndo->ndo_vflag < 3) ND_PRINT((ndo, "\n")); ND_PRINT((ndo, "\t\tINValid oper-TLV type 0x%x length %d for this ForCES message\n", - EXTRACT_16BITS(&otlv->type), EXTRACT_16BITS(&otlv->length))); + EXTRACT_BE_16BITS(&otlv->type), EXTRACT_BE_16BITS(&otlv->length))); invoptlv_print(ndo, (const u_char *)otlv, rlen, 0, indent); } otlv = GO_NXT_TLV(otlv, rlen); @@ -1569,7 +1571,7 @@ lfbselect_print(netdissect_options *ndo, if (rlen) { ND_PRINT((ndo, "\n\t\tMessy oper TLV header, type (0x%x)\n\t\texcess of %d Bytes ", - EXTRACT_16BITS(&otlv->type), rlen - EXTRACT_16BITS(&otlv->length))); + EXTRACT_BE_16BITS(&otlv->type), rlen - EXTRACT_BE_16BITS(&otlv->length))); return -1; } @@ -1631,20 +1633,21 @@ forces_type_print(netdissect_options *ndo, * length is large enough but not too large (it doesn't * go past the end of the packet). */ - if (!ttlv_valid(EXTRACT_16BITS(&tltlv->type))) { + if (!ttlv_valid(EXTRACT_BE_16BITS(&tltlv->type))) { ND_PRINT((ndo, "\n\tInvalid ForCES Top TLV type=0x%x", - EXTRACT_16BITS(&tltlv->type))); + EXTRACT_BE_16BITS(&tltlv->type))); return -1; } if (ndo->ndo_vflag >= 3) ND_PRINT((ndo, "\t%s, length %d (data length %d Bytes)", - tok2str(ForCES_TLV, NULL, EXTRACT_16BITS(&tltlv->type)), - EXTRACT_16BITS(&tltlv->length), - EXTRACT_16BITS(&tltlv->length) - TLV_HDRL)); + tok2str(ForCES_TLV, NULL, EXTRACT_BE_16BITS(&tltlv->type)), + EXTRACT_BE_16BITS(&tltlv->length), + EXTRACT_BE_16BITS(&tltlv->length) - TLV_HDRL)); rc = tops->print(ndo, (const u_char *) TLV_DATA(tltlv), - EXTRACT_16BITS(&tltlv->length), tops->op_msk, 9); + EXTRACT_BE_16BITS(&tltlv->length), + tops->op_msk, 9); if (rc < 0) { return -1; } @@ -1659,7 +1662,7 @@ forces_type_print(netdissect_options *ndo, */ if (rlen) { ND_PRINT((ndo, "\tMess TopTLV header: min %u, total %d advertised %d ", - TLV_HDRL, rlen, EXTRACT_16BITS(&tltlv->length))); + TLV_HDRL, rlen, EXTRACT_BE_16BITS(&tltlv->length))); return -1; } @@ -1704,7 +1707,7 @@ forces_print(netdissect_options *ndo, } ND_TCHECK2(*(pptr + 20), 4); - flg_raw = EXTRACT_32BITS(pptr + 20); + flg_raw = EXTRACT_BE_32BITS(pptr + 20); if (ndo->ndo_vflag >= 1) { ND_PRINT((ndo, "\n\tForCES Version %d len %uB flags 0x%08x ", ForCES_V(fhdr), mlen, flg_raw)); @@ -1712,7 +1715,7 @@ forces_print(netdissect_options *ndo, "\n\tSrcID 0x%x(%s) DstID 0x%x(%s) Correlator 0x%" PRIx64, ForCES_SID(fhdr), ForCES_node(ForCES_SID(fhdr)), ForCES_DID(fhdr), ForCES_node(ForCES_DID(fhdr)), - EXTRACT_64BITS(fhdr->fm_cor))); + EXTRACT_BE_64BITS(fhdr->fm_cor))); } if (ndo->ndo_vflag >= 2) { @@ -200,7 +200,7 @@ fr_hdr_print(netdissect_options *ndo, ND_PRINT((ndo, "Q.922, hdr-len %u, DLCI %u, Flags [%s], NLPID %s (0x%02x), length %u: ", addr_len, dlci, - bittok2str(fr_header_flag_values, "none", EXTRACT_32BITS(flags)), + bittok2str(fr_header_flag_values, "none", EXTRACT_BE_32BITS(flags)), tok2str(nlpid_values,"unknown", nlpid), nlpid, length)); @@ -208,7 +208,7 @@ fr_hdr_print(netdissect_options *ndo, ND_PRINT((ndo, "Q.922, hdr-len %u, DLCI %u, Flags [%s], cisco-ethertype %s (0x%04x), length %u: ", addr_len, dlci, - bittok2str(fr_header_flag_values, "none", EXTRACT_32BITS(flags)), + bittok2str(fr_header_flag_values, "none", EXTRACT_BE_32BITS(flags)), tok2str(ethertype_values, "unknown", nlpid), nlpid, length)); @@ -267,7 +267,7 @@ fr_print(netdissect_options *ndo, /* no Ethertype */ ND_PRINT((ndo, "UI %02x! ", p[addr_len])); } else { - extracted_ethertype = EXTRACT_16BITS(p+addr_len); + extracted_ethertype = EXTRACT_BE_16BITS(p + addr_len); if (ndo->ndo_eflag) fr_hdr_print(ndo, length, addr_len, dlci, @@ -493,7 +493,7 @@ mfr_print(netdissect_options *ndo, switch (ie_type) { case MFR_CTRL_IE_MAGIC_NUM: - ND_PRINT((ndo, "0x%08x", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "0x%08x", EXTRACT_BE_32BITS(tptr))); break; case MFR_CTRL_IE_BUNDLE_ID: /* same message format */ diff --git a/print-frag6.c b/print-frag6.c index fbcabc5b..59b9dfef 100644 --- a/print-frag6.c +++ b/print-frag6.c @@ -45,19 +45,19 @@ frag6_print(netdissect_options *ndo, register const u_char *bp, register const u if (ndo->ndo_vflag) { ND_PRINT((ndo, "frag (0x%08x:%d|%ld)", - EXTRACT_32BITS(&dp->ip6f_ident), - EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK, - sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen) - - (long)(bp - bp2) - sizeof(struct ip6_frag))); + EXTRACT_BE_32BITS(&dp->ip6f_ident), + EXTRACT_BE_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK, + sizeof(struct ip6_hdr) + EXTRACT_BE_16BITS(&ip6->ip6_plen) - + (long)(bp - bp2) - sizeof(struct ip6_frag))); } else { ND_PRINT((ndo, "frag (%d|%ld)", - EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK, - sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen) - - (long)(bp - bp2) - sizeof(struct ip6_frag))); + EXTRACT_BE_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK, + sizeof(struct ip6_hdr) + EXTRACT_BE_16BITS(&ip6->ip6_plen) - + (long)(bp - bp2) - sizeof(struct ip6_frag))); } /* it is meaningless to decode non-first fragment */ - if ((EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK) != 0) + if ((EXTRACT_BE_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK) != 0) return -1; else { diff --git a/print-geneve.c b/print-geneve.c index 40402ab4..7d6014a6 100644 --- a/print-geneve.c +++ b/print-geneve.c @@ -112,7 +112,7 @@ geneve_opts_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_PRINT((ndo, "%s", sep)); sep = ", "; - opt_class = EXTRACT_16BITS(bp); + opt_class = EXTRACT_BE_16BITS(bp); opt_type = *(bp + 2); opt_len = 4 + ((*(bp + 3) & OPT_LEN_MASK) * 4); @@ -132,7 +132,7 @@ geneve_opts_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_PRINT((ndo, " data")); for (i = 4; i < opt_len; i += 4) { - ND_PRINT((ndo, " %08x", EXTRACT_32BITS(data))); + ND_PRINT((ndo, " %08x", EXTRACT_BE_32BITS(data))); data++; } } @@ -171,11 +171,11 @@ geneve_print(netdissect_options *ndo, const u_char *bp, u_int len) bp += 1; len -= 1; - prot = EXTRACT_16BITS(bp); + prot = EXTRACT_BE_16BITS(bp); bp += 2; len -= 2; - vni = EXTRACT_24BITS(bp); + vni = EXTRACT_BE_24BITS(bp); bp += 3; len -= 3; diff --git a/print-geonet.c b/print-geonet.c index 9da89bfe..f30e434b 100644 --- a/print-geonet.c +++ b/print-geonet.c @@ -75,8 +75,8 @@ static void print_btp(netdissect_options *ndo, const u_char *bp) { - uint16_t dest = EXTRACT_16BITS(bp+0); - uint16_t src = EXTRACT_16BITS(bp+2); + uint16_t dest = EXTRACT_BE_16BITS(bp + 0); + uint16_t src = EXTRACT_BE_16BITS(bp + 2); ND_PRINT((ndo, "; BTP Dst:%u Src:%u", dest, src)); } @@ -92,9 +92,9 @@ print_long_pos_vector(netdissect_options *ndo, if (!ND_TTEST2(*(bp+12), 8)) return (-1); - lat = EXTRACT_32BITS(bp+12); + lat = EXTRACT_BE_32BITS(bp + 12); ND_PRINT((ndo, "lat:%d ", lat)); - lon = EXTRACT_32BITS(bp+16); + lon = EXTRACT_BE_32BITS(bp + 16); ND_PRINT((ndo, "lon:%d", lon)); return (0); } @@ -132,7 +132,7 @@ geonet_print(netdissect_options *ndo, const u_char *bp, u_int length, next_hdr = bp[0] & 0x0f; hdr_type = bp[1] >> 4; hdr_subtype = bp[1] & 0x0f; - payload_length = EXTRACT_16BITS(bp+4); + payload_length = EXTRACT_BE_16BITS(bp + 4); hop_limit = bp[7]; switch (next_hdr) { diff --git a/print-gre.c b/print-gre.c index 47a000cf..0de72886 100644 --- a/print-gre.c +++ b/print-gre.c @@ -92,7 +92,7 @@ gre_print(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK2(*bp, 2); if (len < 2) goto trunc; - vers = EXTRACT_16BITS(bp) & GRE_VERS_MASK; + vers = EXTRACT_BE_16BITS(bp) & GRE_VERS_MASK; ND_PRINT((ndo, "GREv%u",vers)); switch(vers) { @@ -120,7 +120,7 @@ gre_print_0(netdissect_options *ndo, const u_char *bp, u_int length) uint16_t flags, prot; /* 16 bits ND_TCHECKed in gre_print() */ - flags = EXTRACT_16BITS(bp); + flags = EXTRACT_BE_16BITS(bp); if (ndo->ndo_vflag) ND_PRINT((ndo, ", Flags [%s]", bittok2str(gre_flag_values,"none",flags))); @@ -131,7 +131,7 @@ gre_print_0(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK2(*bp, 2); if (len < 2) goto trunc; - prot = EXTRACT_16BITS(bp); + prot = EXTRACT_BE_16BITS(bp); len -= 2; bp += 2; @@ -140,14 +140,14 @@ gre_print_0(netdissect_options *ndo, const u_char *bp, u_int length) if (len < 2) goto trunc; if (ndo->ndo_vflag) - ND_PRINT((ndo, ", sum 0x%x", EXTRACT_16BITS(bp))); + ND_PRINT((ndo, ", sum 0x%x", EXTRACT_BE_16BITS(bp))); bp += 2; len -= 2; ND_TCHECK2(*bp, 2); if (len < 2) goto trunc; - ND_PRINT((ndo, ", off 0x%x", EXTRACT_16BITS(bp))); + ND_PRINT((ndo, ", off 0x%x", EXTRACT_BE_16BITS(bp))); bp += 2; len -= 2; } @@ -156,7 +156,7 @@ gre_print_0(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK2(*bp, 4); if (len < 4) goto trunc; - ND_PRINT((ndo, ", key=0x%x", EXTRACT_32BITS(bp))); + ND_PRINT((ndo, ", key=0x%x", EXTRACT_BE_32BITS(bp))); bp += 4; len -= 4; } @@ -165,7 +165,7 @@ gre_print_0(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK2(*bp, 4); if (len < 4) goto trunc; - ND_PRINT((ndo, ", seq %u", EXTRACT_32BITS(bp))); + ND_PRINT((ndo, ", seq %u", EXTRACT_BE_32BITS(bp))); bp += 4; len -= 4; } @@ -179,7 +179,7 @@ gre_print_0(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK2(*bp, 4); if (len < 4) goto trunc; - af = EXTRACT_16BITS(bp); + af = EXTRACT_BE_16BITS(bp); sreoff = *(bp + 2); srelen = *(bp + 3); bp += 4; @@ -248,7 +248,7 @@ gre_print_1(netdissect_options *ndo, const u_char *bp, u_int length) uint16_t flags, prot; /* 16 bits ND_TCHECKed in gre_print() */ - flags = EXTRACT_16BITS(bp); + flags = EXTRACT_BE_16BITS(bp); len -= 2; bp += 2; @@ -259,7 +259,7 @@ gre_print_1(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK2(*bp, 2); if (len < 2) goto trunc; - prot = EXTRACT_16BITS(bp); + prot = EXTRACT_BE_16BITS(bp); len -= 2; bp += 2; @@ -270,7 +270,7 @@ gre_print_1(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK2(*bp, 4); if (len < 4) goto trunc; - k = EXTRACT_32BITS(bp); + k = EXTRACT_BE_32BITS(bp); ND_PRINT((ndo, ", call %d", k & 0xffff)); len -= 4; bp += 4; @@ -280,7 +280,7 @@ gre_print_1(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK2(*bp, 4); if (len < 4) goto trunc; - ND_PRINT((ndo, ", seq %u", EXTRACT_32BITS(bp))); + ND_PRINT((ndo, ", seq %u", EXTRACT_BE_32BITS(bp))); bp += 4; len -= 4; } @@ -289,7 +289,7 @@ gre_print_1(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK2(*bp, 4); if (len < 4) goto trunc; - ND_PRINT((ndo, ", ack %u", EXTRACT_32BITS(bp))); + ND_PRINT((ndo, ", ack %u", EXTRACT_BE_32BITS(bp))); bp += 4; len -= 4; } @@ -414,7 +414,7 @@ gre_sre_asn_print(netdissect_options *ndo, uint8_t sreoff, uint8_t srelen, ND_PRINT((ndo, " %s%x", ((bp - up) == sreoff) ? "*" : "", - EXTRACT_16BITS(bp))); + EXTRACT_BE_16BITS(bp))); bp += 2; len -= 2; diff --git a/print-hncp.c b/print-hncp.c index af219c67..d606116d 100644 --- a/print-hncp.c +++ b/print-hncp.c @@ -173,10 +173,10 @@ format_256(const u_char *data) static int i = 0; i = (i + 1) % 4; snprintf(buf[i], sizeof(buf[i]), "%016" PRIx64 "%016" PRIx64 "%016" PRIx64 "%016" PRIx64, - EXTRACT_64BITS(data), - EXTRACT_64BITS(data + 8), - EXTRACT_64BITS(data + 16), - EXTRACT_64BITS(data + 24) + EXTRACT_BE_64BITS(data), + EXTRACT_BE_64BITS(data + 8), + EXTRACT_BE_64BITS(data + 16), + EXTRACT_BE_64BITS(data + 24) ); return buf[i]; } @@ -325,8 +325,8 @@ dhcpv6_print(netdissect_options *ndo, if (i + 4 > length) return -1; tlv = cp + i; - type = EXTRACT_16BITS(tlv); - optlen = EXTRACT_16BITS(tlv + 2); + type = EXTRACT_BE_16BITS(tlv); + optlen = EXTRACT_BE_16BITS(tlv + 2); value = tlv + 4; ND_PRINT((ndo, "\n")); @@ -426,8 +426,8 @@ hncp_print_rec(netdissect_options *ndo, if (i + 4 > length) goto invalid; - type = EXTRACT_16BITS(tlv); - bodylen = EXTRACT_16BITS(tlv + 2); + type = EXTRACT_BE_16BITS(tlv); + bodylen = EXTRACT_BE_16BITS(tlv + 2); value = tlv + 4; ND_TCHECK2(*value, bodylen); if (i + bodylen + 4 > length) @@ -499,7 +499,7 @@ hncp_print_rec(netdissect_options *ndo, break; } node_identifier = format_nid(value); - endpoint_identifier = EXTRACT_32BITS(value + 4); + endpoint_identifier = EXTRACT_BE_32BITS(value + 4); ND_PRINT((ndo, " NID: %s EPID: %08x", node_identifier, endpoint_identifier @@ -513,7 +513,7 @@ hncp_print_rec(netdissect_options *ndo, ND_PRINT((ndo, " %s", istr)); break; } - hash = EXTRACT_64BITS(value); + hash = EXTRACT_BE_64BITS(value); ND_PRINT((ndo, " hash: %016" PRIx64, hash)); } break; @@ -527,9 +527,9 @@ hncp_print_rec(netdissect_options *ndo, break; } node_identifier = format_nid(value); - sequence_number = EXTRACT_32BITS(value + 4); - interval = format_interval(EXTRACT_32BITS(value + 8)); - hash = EXTRACT_64BITS(value + 12); + sequence_number = EXTRACT_BE_32BITS(value + 4); + interval = format_interval(EXTRACT_BE_32BITS(value + 8)); + hash = EXTRACT_BE_64BITS(value + 12); ND_PRINT((ndo, " NID: %s seqno: %u %s hash: %016" PRIx64, node_identifier, sequence_number, @@ -548,8 +548,8 @@ hncp_print_rec(netdissect_options *ndo, break; } peer_node_identifier = format_nid(value); - peer_endpoint_identifier = EXTRACT_32BITS(value + 4); - endpoint_identifier = EXTRACT_32BITS(value + 8); + peer_endpoint_identifier = EXTRACT_BE_32BITS(value + 4); + endpoint_identifier = EXTRACT_BE_32BITS(value + 8); ND_PRINT((ndo, " Peer-NID: %s Peer-EPID: %08x Local-EPID: %08x", peer_node_identifier, peer_endpoint_identifier, @@ -565,8 +565,8 @@ hncp_print_rec(netdissect_options *ndo, ND_PRINT((ndo, " %s", istr)); break; } - endpoint_identifier = EXTRACT_32BITS(value); - interval = format_interval(EXTRACT_32BITS(value + 4)); + endpoint_identifier = EXTRACT_BE_32BITS(value); + interval = format_interval(EXTRACT_BE_32BITS(value + 4)); ND_PRINT((ndo, " EPID: %08x Interval: %s", endpoint_identifier, interval @@ -593,7 +593,7 @@ hncp_print_rec(netdissect_options *ndo, ND_PRINT((ndo, " %s", istr)); break; } - capabilities = EXTRACT_16BITS(value + 2); + capabilities = EXTRACT_BE_16BITS(value + 2); M = (uint8_t)((capabilities >> 12) & 0xf); P = (uint8_t)((capabilities >> 8) & 0xf); H = (uint8_t)((capabilities >> 4) & 0xf); @@ -618,8 +618,8 @@ hncp_print_rec(netdissect_options *ndo, break; } ND_PRINT((ndo, " VLSO: %s PLSO: %s Prefix: ", - format_interval(EXTRACT_32BITS(value)), - format_interval(EXTRACT_32BITS(value + 4)) + format_interval(EXTRACT_BE_32BITS(value)), + format_interval(EXTRACT_BE_32BITS(value + 4)) )); l = print_prefix(ndo, value + 8, bodylen - 8); if (l == -1) { @@ -730,7 +730,7 @@ hncp_print_rec(netdissect_options *ndo, } prty = value[4] & 0xf; ND_PRINT((ndo, " EPID: %08x Prty: %u", - EXTRACT_32BITS(value), + EXTRACT_BE_32BITS(value), prty )); ND_PRINT((ndo, " Prefix: ")); @@ -753,7 +753,7 @@ hncp_print_rec(netdissect_options *ndo, ND_PRINT((ndo, " %s", istr)); break; } - endpoint_identifier = EXTRACT_32BITS(value); + endpoint_identifier = EXTRACT_BE_32BITS(value); ip_address = format_ip6addr(ndo, value + 4); ND_PRINT((ndo, " EPID: %08x IP Address: %s", endpoint_identifier, diff --git a/print-icmp.c b/print-icmp.c index 0a949518..fd3c2e33 100644 --- a/print-icmp.c +++ b/print-icmp.c @@ -359,8 +359,8 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * (void)snprintf(buf, sizeof(buf), "echo %s, id %u, seq %u", dp->icmp_type == ICMP_ECHO ? "request" : "reply", - EXTRACT_16BITS(&dp->icmp_id), - EXTRACT_16BITS(&dp->icmp_seq)); + EXTRACT_BE_16BITS(&dp->icmp_id), + EXTRACT_BE_16BITS(&dp->icmp_seq)); break; case ICMP_UNREACH: @@ -381,7 +381,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * hlen = IP_HL(oip) * 4; ouh = (const struct udphdr *)(((const u_char *)oip) + hlen); ND_TCHECK(ouh->uh_dport); - dport = EXTRACT_16BITS(&ouh->uh_dport); + dport = EXTRACT_BE_16BITS(&ouh->uh_dport); switch (oip->ip_p) { case IPPROTO_TCP: @@ -411,7 +411,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * { register const struct mtu_discovery *mp; mp = (const struct mtu_discovery *)(const u_char *)&dp->icmp_void; - mtu = EXTRACT_16BITS(&mp->nexthopmtu); + mtu = EXTRACT_BE_16BITS(&mp->nexthopmtu); if (mtu) { (void)snprintf(buf, sizeof(buf), "%s unreachable - need to frag (mtu %d)", @@ -455,7 +455,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * ND_TCHECK(*ihp); (void)strncpy(cp, " lifetime ", sizeof(buf) - (cp - buf)); cp = buf + strlen(buf); - lifetime = EXTRACT_16BITS(&ihp->ird_lifetime); + lifetime = EXTRACT_BE_16BITS(&ihp->ird_lifetime); if (lifetime < 60) { (void)snprintf(cp, sizeof(buf) - (cp - buf), "%u", lifetime); @@ -486,7 +486,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * ND_TCHECK(*idp); (void)snprintf(cp, sizeof(buf) - (cp - buf), " {%s %u}", ipaddr_string(ndo, &idp->ird_addr), - EXTRACT_32BITS(&idp->ird_pref)); + EXTRACT_BE_32BITS(&idp->ird_pref)); cp = buf + strlen(buf); ++idp; } @@ -526,29 +526,29 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * case ICMP_MASKREPLY: ND_TCHECK(dp->icmp_mask); (void)snprintf(buf, sizeof(buf), "address mask is 0x%08x", - EXTRACT_32BITS(&dp->icmp_mask)); + EXTRACT_BE_32BITS(&dp->icmp_mask)); break; case ICMP_TSTAMP: ND_TCHECK(dp->icmp_seq); (void)snprintf(buf, sizeof(buf), "time stamp query id %u seq %u", - EXTRACT_16BITS(&dp->icmp_id), - EXTRACT_16BITS(&dp->icmp_seq)); + EXTRACT_BE_16BITS(&dp->icmp_id), + EXTRACT_BE_16BITS(&dp->icmp_seq)); break; case ICMP_TSTAMPREPLY: ND_TCHECK(dp->icmp_ttime); (void)snprintf(buf, sizeof(buf), "time stamp reply id %u seq %u: org %s", - EXTRACT_16BITS(&dp->icmp_id), - EXTRACT_16BITS(&dp->icmp_seq), - icmp_tstamp_print(EXTRACT_32BITS(&dp->icmp_otime))); + EXTRACT_BE_16BITS(&dp->icmp_id), + EXTRACT_BE_16BITS(&dp->icmp_seq), + icmp_tstamp_print(EXTRACT_BE_32BITS(&dp->icmp_otime))); (void)snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", recv %s", - icmp_tstamp_print(EXTRACT_32BITS(&dp->icmp_rtime))); + icmp_tstamp_print(EXTRACT_BE_32BITS(&dp->icmp_rtime))); (void)snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", xmit %s", - icmp_tstamp_print(EXTRACT_32BITS(&dp->icmp_ttime))); + icmp_tstamp_print(EXTRACT_BE_32BITS(&dp->icmp_ttime))); break; default: @@ -564,7 +564,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * vec[0].len = plen; sum = in_cksum(vec, 1); if (sum != 0) { - uint16_t icmp_sum = EXTRACT_16BITS(&dp->icmp_cksum); + uint16_t icmp_sum = EXTRACT_BE_16BITS(&dp->icmp_cksum); ND_PRINT((ndo, " (wrong icmp cksum %x (->%x)!)", icmp_sum, in_cksum_shouldbe(icmp_sum, sum))); @@ -582,7 +582,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * ip = (const struct ip *)bp; snapend_save = ndo->ndo_snapend; ND_TCHECK_16BITS(&ip->ip_len); - ip_print(ndo, bp, EXTRACT_16BITS(&ip->ip_len)); + ip_print(ndo, bp, EXTRACT_BE_16BITS(&ip->ip_len)); ndo->ndo_snapend = snapend_save; } @@ -625,7 +625,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * vec[0].ptr = (const uint8_t *)(const void *)&ext_dp->icmp_ext_version_res; vec[0].len = hlen; ND_PRINT((ndo, ", checksum 0x%04x (%scorrect), length %u", - EXTRACT_16BITS(ext_dp->icmp_ext_checksum), + EXTRACT_BE_16BITS(ext_dp->icmp_ext_checksum), in_cksum(vec, 1) ? "in" : "", hlen)); } @@ -637,7 +637,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * icmp_mpls_ext_object_header = (const struct icmp_mpls_ext_object_header_t *)obj_tptr; ND_TCHECK(*icmp_mpls_ext_object_header); - obj_tlen = EXTRACT_16BITS(icmp_mpls_ext_object_header->length); + obj_tlen = EXTRACT_BE_16BITS(icmp_mpls_ext_object_header->length); obj_class_num = icmp_mpls_ext_object_header->class_num; obj_ctype = icmp_mpls_ext_object_header->ctype; obj_tptr += sizeof(struct icmp_mpls_ext_object_header_t); @@ -662,7 +662,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * switch(obj_ctype) { case 1: ND_TCHECK2(*obj_tptr, 4); - raw_label = EXTRACT_32BITS(obj_tptr); + raw_label = EXTRACT_BE_32BITS(obj_tptr); ND_PRINT((ndo, "\n\t label %u, exp %u", MPLS_LABEL(raw_label), MPLS_EXP(raw_label))); if (MPLS_STACK(raw_label)) ND_PRINT((ndo, ", [S]")); diff --git a/print-icmp6.c b/print-icmp6.c index 42fe19f2..5157700e 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -704,7 +704,7 @@ rpl_dio_print(netdissect_options *ndo, dagid_str, dio->rpl_dtsn, dio->rpl_instanceid, - EXTRACT_16BITS(&dio->rpl_dagrank), + EXTRACT_BE_16BITS(&dio->rpl_dagrank), RPL_DIO_GROUNDED(dio->rpl_mopprf) ? "grounded,":"", tok2str(rpl_mop_values, "mop%u", RPL_DIO_MOP(dio->rpl_mopprf)), RPL_DIO_PRF(dio->rpl_mopprf))); @@ -890,7 +890,7 @@ icmp6_print(netdissect_options *ndo, uint16_t sum, udp_sum; if (ND_TTEST2(bp[0], length)) { - udp_sum = EXTRACT_16BITS(&dp->icmp6_cksum); + udp_sum = EXTRACT_BE_16BITS(&dp->icmp6_cksum); sum = icmp6_cksum(ndo, ip, dp, length); if (sum != 0) ND_PRINT((ndo,"[bad icmp6 cksum 0x%04x -> 0x%04x!] ", @@ -934,7 +934,7 @@ icmp6_print(netdissect_options *ndo, == NULL) goto trunc; - dport = EXTRACT_16BITS(&ouh->uh_dport); + dport = EXTRACT_BE_16BITS(&ouh->uh_dport); switch (prot) { case IPPROTO_TCP: ND_PRINT((ndo,", %s tcp port %s", @@ -963,7 +963,7 @@ icmp6_print(netdissect_options *ndo, break; case ICMP6_PACKET_TOO_BIG: ND_TCHECK(dp->icmp6_mtu); - ND_PRINT((ndo,", mtu %u", EXTRACT_32BITS(&dp->icmp6_mtu))); + ND_PRINT((ndo,", mtu %u", EXTRACT_BE_32BITS(&dp->icmp6_mtu))); break; case ICMP6_TIME_EXCEEDED: ND_TCHECK(oip->ip6_dst); @@ -984,13 +984,13 @@ icmp6_print(netdissect_options *ndo, ND_TCHECK(oip->ip6_dst); switch (dp->icmp6_code) { case ICMP6_PARAMPROB_HEADER: - ND_PRINT((ndo,", erroneous - octet %u", EXTRACT_32BITS(&dp->icmp6_pptr))); + ND_PRINT((ndo,", erroneous - octet %u", EXTRACT_BE_32BITS(&dp->icmp6_pptr))); break; case ICMP6_PARAMPROB_NEXTHEADER: - ND_PRINT((ndo,", next header - octet %u", EXTRACT_32BITS(&dp->icmp6_pptr))); + ND_PRINT((ndo,", next header - octet %u", EXTRACT_BE_32BITS(&dp->icmp6_pptr))); break; case ICMP6_PARAMPROB_OPTION: - ND_PRINT((ndo,", option - octet %u", EXTRACT_32BITS(&dp->icmp6_pptr))); + ND_PRINT((ndo,", option - octet %u", EXTRACT_BE_32BITS(&dp->icmp6_pptr))); break; default: ND_PRINT((ndo,", code-#%d", @@ -1001,7 +1001,7 @@ icmp6_print(netdissect_options *ndo, case ICMP6_ECHO_REQUEST: case ICMP6_ECHO_REPLY: ND_TCHECK(dp->icmp6_seq); - ND_PRINT((ndo,", seq %u", EXTRACT_16BITS(&dp->icmp6_seq))); + ND_PRINT((ndo,", seq %u", EXTRACT_BE_16BITS(&dp->icmp6_seq))); break; case ICMP6_MEMBERSHIP_QUERY: if (length == MLD_MINLEN) { @@ -1038,9 +1038,9 @@ icmp6_print(netdissect_options *ndo, (u_int)p->nd_ra_curhoplimit, bittok2str(icmp6_opt_ra_flag_values,"none",(p->nd_ra_flags_reserved)), get_rtpref(p->nd_ra_flags_reserved), - EXTRACT_16BITS(&p->nd_ra_router_lifetime), - EXTRACT_32BITS(&p->nd_ra_reachable), - EXTRACT_32BITS(&p->nd_ra_retransmit))); + EXTRACT_BE_16BITS(&p->nd_ra_router_lifetime), + EXTRACT_BE_32BITS(&p->nd_ra_reachable), + EXTRACT_BE_32BITS(&p->nd_ra_retransmit))); icmp6_opt_print(ndo, (const u_char *)dp + RTADVLEN, length - RTADVLEN); @@ -1071,7 +1071,7 @@ icmp6_print(netdissect_options *ndo, ND_PRINT((ndo,", Flags [%s]", bittok2str(icmp6_nd_na_flag_values, "none", - EXTRACT_32BITS(&p->nd_na_flags_reserved)))); + EXTRACT_BE_32BITS(&p->nd_na_flags_reserved)))); #define NDADVLEN 24 icmp6_opt_print(ndo, (const u_char *)dp + NDADVLEN, length - NDADVLEN); @@ -1110,7 +1110,7 @@ icmp6_print(netdissect_options *ndo, case ICMP6_MOBILEPREFIX_SOLICIT: /* fall through */ case ICMP6_HADISCOV_REQUEST: ND_TCHECK(dp->icmp6_data16[0]); - ND_PRINT((ndo,", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0]))); + ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_16BITS(&dp->icmp6_data16[0]))); break; case ICMP6_HADISCOV_REPLY: if (ndo->ndo_vflag) { @@ -1118,7 +1118,7 @@ icmp6_print(netdissect_options *ndo, const u_char *cp; ND_TCHECK(dp->icmp6_data16[0]); - ND_PRINT((ndo,", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0]))); + ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_16BITS(&dp->icmp6_data16[0]))); cp = (const u_char *)dp + length; in6 = (const struct in6_addr *)(dp + 1); for (; (const u_char *)in6 < cp; in6++) { @@ -1130,7 +1130,7 @@ icmp6_print(netdissect_options *ndo, case ICMP6_MOBILEPREFIX_ADVERT: if (ndo->ndo_vflag) { ND_TCHECK(dp->icmp6_data16[0]); - ND_PRINT((ndo,", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0]))); + ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_16BITS(&dp->icmp6_data16[0]))); ND_TCHECK(dp->icmp6_data16[1]); if (dp->icmp6_data16[1] & 0xc0) ND_PRINT((ndo," ")); @@ -1211,7 +1211,7 @@ get_upperlayer(netdissect_options *ndo, const u_char *bp, u_int *prot) if (!ND_TTEST(fragh->ip6f_offlg)) return(NULL); /* fragments with non-zero offset are meaningless */ - if ((EXTRACT_16BITS(&fragh->ip6f_offlg) & IP6F_OFF_MASK) != 0) + if ((EXTRACT_BE_16BITS(&fragh->ip6f_offlg) & IP6F_OFF_MASK) != 0) return(NULL); nh = fragh->ip6f_nxt; hlen = sizeof(struct ip6_frag); @@ -1291,8 +1291,8 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) opp->nd_opt_pi_prefix_len, (op->nd_opt_len != 4) ? "badlen" : "", bittok2str(icmp6_opt_pi_flag_values, "none", opp->nd_opt_pi_flags_reserved), - get_lifetime(EXTRACT_32BITS(&opp->nd_opt_pi_valid_time)))); - ND_PRINT((ndo,", pref. time %s", get_lifetime(EXTRACT_32BITS(&opp->nd_opt_pi_preferred_time)))); + get_lifetime(EXTRACT_BE_32BITS(&opp->nd_opt_pi_valid_time)))); + ND_PRINT((ndo,", pref. time %s", get_lifetime(EXTRACT_BE_32BITS(&opp->nd_opt_pi_preferred_time)))); break; case ND_OPT_REDIRECTED_HEADER: print_unknown_data(ndo, bp,"\n\t ",op->nd_opt_len<<3); @@ -1302,14 +1302,14 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) opm = (const struct nd_opt_mtu *)op; ND_TCHECK(opm->nd_opt_mtu_mtu); ND_PRINT((ndo," %u%s", - EXTRACT_32BITS(&opm->nd_opt_mtu_mtu), - (op->nd_opt_len != 1) ? "bad option length" : "" )); + EXTRACT_BE_32BITS(&opm->nd_opt_mtu_mtu), + (op->nd_opt_len != 1) ? "bad option length" : "" )); break; case ND_OPT_RDNSS: oprd = (const struct nd_opt_rdnss *)op; l = (op->nd_opt_len - 1) / 2; ND_PRINT((ndo," lifetime %us,", - EXTRACT_32BITS(&oprd->nd_opt_rdnss_lifetime))); + EXTRACT_BE_32BITS(&oprd->nd_opt_rdnss_lifetime))); for (i = 0; i < l; i++) { ND_TCHECK(oprd->nd_opt_rdnss_addr[i]); ND_PRINT((ndo," addr: %s", @@ -1319,7 +1319,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) case ND_OPT_DNSSL: opds = (const struct nd_opt_dnssl *)op; ND_PRINT((ndo," lifetime %us, domain(s):", - EXTRACT_32BITS(&opds->nd_opt_dnssl_lifetime))); + EXTRACT_BE_32BITS(&opds->nd_opt_dnssl_lifetime))); domp = cp + 8; /* domain names, variable-sized, RFC1035-encoded */ while (domp < cp + (op->nd_opt_len << 3) && *domp != '\0') { @@ -1331,14 +1331,14 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) case ND_OPT_ADVINTERVAL: opa = (const struct nd_opt_advinterval *)op; ND_TCHECK(opa->nd_opt_adv_interval); - ND_PRINT((ndo," %ums", EXTRACT_32BITS(&opa->nd_opt_adv_interval))); + ND_PRINT((ndo," %ums", EXTRACT_BE_32BITS(&opa->nd_opt_adv_interval))); break; case ND_OPT_HOMEAGENT_INFO: oph = (const struct nd_opt_homeagent_info *)op; ND_TCHECK(oph->nd_opt_hai_lifetime); ND_PRINT((ndo," preference %u, lifetime %u", - EXTRACT_16BITS(&oph->nd_opt_hai_preference), - EXTRACT_16BITS(&oph->nd_opt_hai_lifetime))); + EXTRACT_BE_16BITS(&oph->nd_opt_hai_preference), + EXTRACT_BE_16BITS(&oph->nd_opt_hai_lifetime))); break; case ND_OPT_ROUTE_INFO: opri = (const struct nd_opt_route_info *)op; @@ -1363,7 +1363,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) opri->nd_opt_rti_prefixlen)); ND_PRINT((ndo,", pref=%s", get_rtpref(opri->nd_opt_rti_flags))); ND_PRINT((ndo,", lifetime=%s", - get_lifetime(EXTRACT_32BITS(&opri->nd_opt_rti_lifetime)))); + get_lifetime(EXTRACT_BE_32BITS(&opri->nd_opt_rti_lifetime)))); break; default: if (ndo->ndo_vflag <= 1) { @@ -1399,7 +1399,7 @@ mld6_print(netdissect_options *ndo, const u_char *bp) if ((const u_char *)mp + sizeof(*mp) > ep) return; - ND_PRINT((ndo,"max resp delay: %d ", EXTRACT_16BITS(&mp->mld6_maxdelay))); + ND_PRINT((ndo,"max resp delay: %d ", EXTRACT_BE_16BITS(&mp->mld6_maxdelay))); ND_PRINT((ndo,"addr: %s", ip6addr_string(ndo, &mp->mld6_addr))); } @@ -1417,7 +1417,7 @@ mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len) } ND_TCHECK(icp->icmp6_data16[1]); - ngroups = EXTRACT_16BITS(&icp->icmp6_data16[1]); + ngroups = EXTRACT_BE_16BITS(&icp->icmp6_data16[1]); ND_PRINT((ndo,", %d group record(s)", ngroups)); if (ndo->ndo_vflag > 0) { /* Print the group records */ @@ -1476,7 +1476,7 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len) return; } ND_TCHECK(icp->icmp6_data16[0]); - mrc = EXTRACT_16BITS(&icp->icmp6_data16[0]); + mrc = EXTRACT_BE_16BITS(&icp->icmp6_data16[0]); if (mrc < 32768) { mrt = mrc; } else { @@ -1505,7 +1505,7 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len) } ND_TCHECK2(bp[26], 2); - nsrcs = EXTRACT_16BITS(&bp[26]); + nsrcs = EXTRACT_BE_16BITS(&bp[26]); if (nsrcs > 0) { if (len < 28 + nsrcs * sizeof(struct in6_addr)) ND_PRINT((ndo," [invalid number of sources]")); @@ -1590,13 +1590,13 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, ND_TCHECK2(*dp, sizeof(*ni6)); ni6 = (const struct icmp6_nodeinfo *)dp; ND_PRINT((ndo," (")); /*)*/ - switch (EXTRACT_16BITS(&ni6->ni_qtype)) { + switch (EXTRACT_BE_16BITS(&ni6->ni_qtype)) { case NI_QTYPE_NOOP: ND_PRINT((ndo,"noop")); break; case NI_QTYPE_SUPTYPES: ND_PRINT((ndo,"supported qtypes")); - i = EXTRACT_16BITS(&ni6->ni_flags); + i = EXTRACT_BE_16BITS(&ni6->ni_flags); if (i) ND_PRINT((ndo," [%s]", (i & 0x01) ? "C" : "")); break; @@ -1732,7 +1732,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, break; } - switch (EXTRACT_16BITS(&ni6->ni_qtype)) { + switch (EXTRACT_BE_16BITS(&ni6->ni_qtype)) { case NI_QTYPE_NOOP: if (needcomma) ND_PRINT((ndo,", ")); @@ -1745,7 +1745,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, if (needcomma) ND_PRINT((ndo,", ")); ND_PRINT((ndo,"supported qtypes")); - i = EXTRACT_16BITS(&ni6->ni_flags); + i = EXTRACT_BE_16BITS(&ni6->ni_flags); if (i) ND_PRINT((ndo," [%s]", (i & 0x01) ? "C" : "")); break; @@ -1768,8 +1768,8 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, ND_PRINT((ndo,"\"")); } else dnsname_print(ndo, cp, ep); - if ((EXTRACT_16BITS(&ni6->ni_flags) & 0x01) != 0) - ND_PRINT((ndo," [TTL=%u]", EXTRACT_32BITS(ni6 + 1))); + if ((EXTRACT_BE_16BITS(&ni6->ni_flags) & 0x01) != 0) + ND_PRINT((ndo," [TTL=%u]", EXTRACT_BE_32BITS(ni6 + 1))); break; case NI_QTYPE_NODEADDR: if (needcomma) @@ -1781,7 +1781,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, break; ND_PRINT((ndo," %s", ip6addr_string(ndo, bp + i))); i += sizeof(struct in6_addr); - ND_PRINT((ndo,"(%d)", (int32_t)EXTRACT_32BITS(bp + i))); + ND_PRINT((ndo,"(%d)", (int32_t) EXTRACT_BE_32BITS(bp + i))); i += sizeof(int32_t); } i = ni6->ni_flags; @@ -1844,7 +1844,7 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep) break; } - ND_PRINT((ndo,", seq=%u", EXTRACT_32BITS(&rr6->rr_seqnum))); + ND_PRINT((ndo,", seq=%u", EXTRACT_BE_32BITS(&rr6->rr_seqnum))); if (ndo->ndo_vflag) { #define F(x, y) ((rr6->rr_flags) & (x) ? (y) : "") @@ -1857,9 +1857,9 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep) F(ICMP6_RR_FLAGS_PREVDONE, "P"))); } ND_PRINT((ndo,"seg=%u,", rr6->rr_segnum)); - ND_PRINT((ndo,"maxdelay=%u", EXTRACT_16BITS(&rr6->rr_maxdelay))); + ND_PRINT((ndo,"maxdelay=%u", EXTRACT_BE_16BITS(&rr6->rr_maxdelay))); if (rr6->rr_reserved) - ND_PRINT((ndo,"rsvd=0x%x", EXTRACT_32BITS(&rr6->rr_reserved))); + ND_PRINT((ndo,"rsvd=0x%x", EXTRACT_BE_32BITS(&rr6->rr_reserved))); /*[*/ ND_PRINT((ndo,"]")); #undef F @@ -1924,12 +1924,12 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep) ND_PRINT((ndo,"vltime=infty,")); else ND_PRINT((ndo,"vltime=%u,", - EXTRACT_32BITS(&use->rpu_vltime))); + EXTRACT_BE_32BITS(&use->rpu_vltime))); if (~use->rpu_pltime == 0) ND_PRINT((ndo,"pltime=infty,")); else ND_PRINT((ndo,"pltime=%u,", - EXTRACT_32BITS(&use->rpu_pltime))); + EXTRACT_BE_32BITS(&use->rpu_pltime))); } if (addrtostr6(&use->rpu_prefix, hbuf, sizeof(hbuf))) ND_PRINT((ndo,"%s/%u/%u", hbuf, use->rpu_uselen, diff --git a/print-igmp.c b/print-igmp.c index 0bb7f976..fc0ef683 100644 --- a/print-igmp.c +++ b/print-igmp.c @@ -114,11 +114,11 @@ print_mtrace(netdissect_options *ndo, return; } ND_PRINT((ndo, "mtrace %u: %s to %s reply-to %s", - TR_GETQID(EXTRACT_32BITS(&tr->tr_rttlqid)), + TR_GETQID(EXTRACT_BE_32BITS(&tr->tr_rttlqid)), ipaddr_string(ndo, &tr->tr_src), ipaddr_string(ndo, &tr->tr_dst), ipaddr_string(ndo, &tr->tr_raddr))); - if (IN_CLASSD(EXTRACT_32BITS(&tr->tr_raddr))) - ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_32BITS(&tr->tr_rttlqid)))); + if (IN_CLASSD(EXTRACT_BE_32BITS(&tr->tr_raddr))) + ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_BE_32BITS(&tr->tr_rttlqid)))); return; trunc: ND_PRINT((ndo, "%s", tstr)); @@ -136,11 +136,11 @@ print_mresp(netdissect_options *ndo, return; } ND_PRINT((ndo, "mresp %lu: %s to %s reply-to %s", - (u_long)TR_GETQID(EXTRACT_32BITS(&tr->tr_rttlqid)), + (u_long)TR_GETQID(EXTRACT_BE_32BITS(&tr->tr_rttlqid)), ipaddr_string(ndo, &tr->tr_src), ipaddr_string(ndo, &tr->tr_dst), ipaddr_string(ndo, &tr->tr_raddr))); - if (IN_CLASSD(EXTRACT_32BITS(&tr->tr_raddr))) - ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_32BITS(&tr->tr_rttlqid)))); + if (IN_CLASSD(EXTRACT_BE_32BITS(&tr->tr_raddr))) + ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_BE_32BITS(&tr->tr_rttlqid)))); return; trunc: ND_PRINT((ndo, "%s", tstr)); @@ -159,7 +159,7 @@ print_igmpv3_report(netdissect_options *ndo, return; } ND_TCHECK2(bp[6], 2); - ngroups = EXTRACT_16BITS(&bp[6]); + ngroups = EXTRACT_BE_16BITS(&bp[6]); ND_PRINT((ndo, ", %d group record(s)", ngroups)); if (ndo->ndo_vflag > 0) { /* Print the group records */ @@ -173,7 +173,7 @@ print_igmpv3_report(netdissect_options *ndo, ND_PRINT((ndo, " [gaddr %s", ipaddr_string(ndo, &bp[group+4]))); ND_PRINT((ndo, " %s", tok2str(igmpv3report2str, " [v3-report-#%d]", bp[group]))); - nsrcs = EXTRACT_16BITS(&bp[group+2]); + nsrcs = EXTRACT_BE_16BITS(&bp[group + 2]); /* Check the number of sources and print them */ if (len < group+8+(nsrcs<<2)) { ND_PRINT((ndo, " [invalid number of sources %d]", nsrcs)); @@ -232,11 +232,11 @@ print_igmpv3_query(netdissect_options *ndo, ND_PRINT((ndo, "]")); } ND_TCHECK2(bp[4], 4); - if (EXTRACT_32BITS(&bp[4]) == 0) + if (EXTRACT_BE_32BITS(&bp[4]) == 0) return; ND_PRINT((ndo, " [gaddr %s", ipaddr_string(ndo, &bp[4]))); ND_TCHECK2(bp[10], 2); - nsrcs = EXTRACT_16BITS(&bp[10]); + nsrcs = EXTRACT_BE_16BITS(&bp[10]); if (nsrcs > 0) { if (len < 12 + (nsrcs << 2)) ND_PRINT((ndo, " [invalid number of sources]")); @@ -282,7 +282,7 @@ igmp_print(netdissect_options *ndo, } else ND_PRINT((ndo, " v1")); ND_TCHECK2(bp[4], 4); - if (EXTRACT_32BITS(&bp[4])) + if (EXTRACT_BE_32BITS(&bp[4])) ND_PRINT((ndo, " [gaddr %s]", ipaddr_string(ndo, &bp[4]))); if (len != 8) ND_PRINT((ndo, " [len %d]", len)); @@ -333,7 +333,7 @@ igmp_print(netdissect_options *ndo, vec[0].ptr = bp; vec[0].len = len; if (in_cksum(vec, 1)) - ND_PRINT((ndo, " bad igmp cksum %x!", EXTRACT_16BITS(&bp[2]))); + ND_PRINT((ndo, " bad igmp cksum %x!", EXTRACT_BE_16BITS(&bp[2]))); } return; trunc: diff --git a/print-igrp.c b/print-igrp.c index b6eaf312..f824e1e1 100644 --- a/print-igrp.c +++ b/print-igrp.c @@ -82,12 +82,12 @@ igrp_entry_print(netdissect_options *ndo, register const struct igrprte *igr, ND_PRINT((ndo, " %d.%d.%d.0", igr->igr_net[0], igr->igr_net[1], igr->igr_net[2])); - delay = EXTRACT_24BITS(igr->igr_dly); - bandwidth = EXTRACT_24BITS(igr->igr_bw); + delay = EXTRACT_BE_24BITS(igr->igr_dly); + bandwidth = EXTRACT_BE_24BITS(igr->igr_bw); metric = bandwidth + delay; if (metric > 0xffffff) metric = 0xffffff; - mtu = EXTRACT_16BITS(igr->igr_mtu); + mtu = EXTRACT_BE_16BITS(igr->igr_mtu); ND_PRINT((ndo, " d=%d b=%d r=%d l=%d M=%d mtu=%d in %d hops", 10 * delay, bandwidth == 0 ? 0 : 10000000 / bandwidth, @@ -114,15 +114,15 @@ igrp_print(netdissect_options *ndo, register const u_char *bp, u_int length) /* Header */ ND_TCHECK(*hdr); - nint = EXTRACT_16BITS(&hdr->ig_ni); - nsys = EXTRACT_16BITS(&hdr->ig_ns); - next = EXTRACT_16BITS(&hdr->ig_nx); + nint = EXTRACT_BE_16BITS(&hdr->ig_ni); + nsys = EXTRACT_BE_16BITS(&hdr->ig_ns); + next = EXTRACT_BE_16BITS(&hdr->ig_nx); ND_PRINT((ndo, " %s V%d edit=%d AS=%d (%d/%d/%d)", tok2str(op2str, "op-#%d", IGRP_OP(hdr->ig_vop)), IGRP_V(hdr->ig_vop), hdr->ig_ed, - EXTRACT_16BITS(&hdr->ig_as), + EXTRACT_BE_16BITS(&hdr->ig_as), nint, nsys, next)); @@ -220,8 +220,8 @@ ip_printts(netdissect_options *ndo, if (ptr == len) type = " ^ "; ND_TCHECK2(cp[len], hoplen); - ND_PRINT((ndo, "%s%d@%s", type, EXTRACT_32BITS(&cp[len+hoplen-4]), - hoplen!=8 ? "" : ipaddr_string(ndo, &cp[len]))); + ND_PRINT((ndo, "%s%d@%s", type, EXTRACT_BE_32BITS(&cp[len + hoplen - 4]), + hoplen!=8 ? "" : ipaddr_string(ndo, &cp[len]))); type = " "; } @@ -302,8 +302,8 @@ ip_optprint(netdissect_options *ndo, break; } ND_TCHECK(cp[3]); - if (EXTRACT_16BITS(&cp[2]) != 0) - ND_PRINT((ndo, " value %u", EXTRACT_16BITS(&cp[2]))); + if (EXTRACT_BE_16BITS(&cp[2]) != 0) + ND_PRINT((ndo, " value %u", EXTRACT_BE_16BITS(&cp[2]))); break; case IPOPT_NOP: /* nothing to print - fall through */ @@ -566,7 +566,7 @@ ip_print(netdissect_options *ndo, return; } - ipds->len = EXTRACT_16BITS(&ipds->ip->ip_len); + ipds->len = EXTRACT_BE_16BITS(&ipds->ip->ip_len); if (length < ipds->len) ND_PRINT((ndo, "truncated-ip - %u bytes missing! ", ipds->len - length)); @@ -595,7 +595,7 @@ ip_print(netdissect_options *ndo, ipds->len -= hlen; - ipds->off = EXTRACT_16BITS(&ipds->ip->ip_off); + ipds->off = EXTRACT_BE_16BITS(&ipds->ip->ip_off); if (ndo->ndo_vflag) { ND_PRINT((ndo, "(tos 0x%x", (int)ipds->ip->ip_tos)); @@ -628,13 +628,13 @@ ip_print(netdissect_options *ndo, */ ND_PRINT((ndo, ", id %u, offset %u, flags [%s], proto %s (%u)", - EXTRACT_16BITS(&ipds->ip->ip_id), + EXTRACT_BE_16BITS(&ipds->ip->ip_id), (ipds->off & 0x1fff) * 8, bittok2str(ip_frag_values, "none", ipds->off&0xe000), tok2str(ipproto_values,"unknown",ipds->ip->ip_p), ipds->ip->ip_p)); - ND_PRINT((ndo, ", length %u", EXTRACT_16BITS(&ipds->ip->ip_len))); + ND_PRINT((ndo, ", length %u", EXTRACT_BE_16BITS(&ipds->ip->ip_len))); if ((hlen - sizeof(struct ip)) > 0) { ND_PRINT((ndo, ", options (")); @@ -647,7 +647,7 @@ ip_print(netdissect_options *ndo, vec[0].len = hlen; sum = in_cksum(vec, 1); if (sum != 0) { - ip_sum = EXTRACT_16BITS(&ipds->ip->ip_sum); + ip_sum = EXTRACT_BE_16BITS(&ipds->ip->ip_sum); ND_PRINT((ndo, ", bad cksum %x (->%x)!", ip_sum, in_cksum_shouldbe(ip_sum, sum))); } diff --git a/print-ip6.c b/print-ip6.c index ed40d9e2..862dfb2c 100644 --- a/print-ip6.c +++ b/print-ip6.c @@ -239,14 +239,14 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) return; } - payload_len = EXTRACT_16BITS(&ip6->ip6_plen); + payload_len = EXTRACT_BE_16BITS(&ip6->ip6_plen); len = payload_len + sizeof(struct ip6_hdr); if (length < len) ND_PRINT((ndo, "truncated-ip6 - %u bytes missing!", len - length)); if (ndo->ndo_vflag) { - flow = EXTRACT_32BITS(&ip6->ip6_flow); + flow = EXTRACT_BE_32BITS(&ip6->ip6_flow); ND_PRINT((ndo, "(")); #if 0 /* rfc1883 */ diff --git a/print-ip6opts.c b/print-ip6opts.c index 14768deb..90c34735 100644 --- a/print-ip6opts.c +++ b/print-ip6opts.c @@ -125,7 +125,7 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len) ND_PRINT((ndo, "(rtalert: invalid len %d)", bp[i + 1])); goto trunc; } - ND_PRINT((ndo, "(rtalert: 0x%04x) ", EXTRACT_16BITS(&bp[i + 2]))); + ND_PRINT((ndo, "(rtalert: 0x%04x) ", EXTRACT_BE_16BITS(&bp[i + 2]))); break; case IP6OPT_JUMBO: if (len - i < IP6OPT_JUMBO_LEN) { @@ -136,7 +136,7 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len) ND_PRINT((ndo, "(jumbo: invalid len %d)", bp[i + 1])); goto trunc; } - ND_PRINT((ndo, "(jumbo: %u) ", EXTRACT_32BITS(&bp[i + 2]))); + ND_PRINT((ndo, "(jumbo: %u) ", EXTRACT_BE_32BITS(&bp[i + 2]))); break; case IP6OPT_HOME_ADDRESS: if (len - i < IP6OPT_HOMEADDR_MINLEN) { diff --git a/print-ipcomp.c b/print-ipcomp.c index 291caa97..d96c30f1 100644 --- a/print-ipcomp.c +++ b/print-ipcomp.c @@ -44,7 +44,7 @@ ipcomp_print(netdissect_options *ndo, register const u_char *bp) ipcomp = (const struct ipcomp *)bp; ND_TCHECK(*ipcomp); - cpi = EXTRACT_16BITS(&ipcomp->comp_cpi); + cpi = EXTRACT_BE_16BITS(&ipcomp->comp_cpi); ND_PRINT((ndo, "IPComp(cpi=0x%04x)", cpi)); diff --git a/print-ipx.c b/print-ipx.c index d807a66e..c88c03a6 100644 --- a/print-ipx.c +++ b/print-ipx.c @@ -78,16 +78,16 @@ ipx_print(netdissect_options *ndo, const u_char *p, u_int length) ND_TCHECK(ipx->srcSkt); ND_PRINT((ndo, "%s.%04x > ", - ipxaddr_string(EXTRACT_32BITS(ipx->srcNet), ipx->srcNode), - EXTRACT_16BITS(&ipx->srcSkt))); + ipxaddr_string(EXTRACT_BE_32BITS(ipx->srcNet), ipx->srcNode), + EXTRACT_BE_16BITS(&ipx->srcSkt))); ND_PRINT((ndo, "%s.%04x: ", - ipxaddr_string(EXTRACT_32BITS(ipx->dstNet), ipx->dstNode), - EXTRACT_16BITS(&ipx->dstSkt))); + ipxaddr_string(EXTRACT_BE_32BITS(ipx->dstNet), ipx->dstNode), + EXTRACT_BE_16BITS(&ipx->dstSkt))); /* take length from ipx header */ ND_TCHECK(ipx->length); - length = EXTRACT_16BITS(&ipx->length); + length = EXTRACT_BE_16BITS(&ipx->length); ipx_decode(ndo, ipx, p + ipxSize, length - ipxSize); return; @@ -111,7 +111,7 @@ ipx_decode(netdissect_options *ndo, const struct ipxHdr *ipx, const u_char *data { register u_short dstSkt; - dstSkt = EXTRACT_16BITS(&ipx->dstSkt); + dstSkt = EXTRACT_BE_16BITS(&ipx->dstSkt); switch (dstSkt) { case IPX_SKT_NCP: ND_PRINT((ndo, "ipx-ncp %d", length)); @@ -152,7 +152,7 @@ ipx_sap_print(netdissect_options *ndo, const u_short *ipx, u_int length) int command, i; ND_TCHECK(ipx[0]); - command = EXTRACT_16BITS(ipx); + command = EXTRACT_BE_16BITS(ipx); ipx++; length -= 2; @@ -165,7 +165,7 @@ ipx_sap_print(netdissect_options *ndo, const u_short *ipx, u_int length) ND_PRINT((ndo, "ipx-sap-nearest-req")); ND_TCHECK(ipx[0]); - ND_PRINT((ndo, " %s", ipxsap_string(ndo, htons(EXTRACT_16BITS(&ipx[0]))))); + ND_PRINT((ndo, " %s", ipxsap_string(ndo, htons(EXTRACT_BE_16BITS(&ipx[0]))))); break; case 2: @@ -177,14 +177,14 @@ ipx_sap_print(netdissect_options *ndo, const u_short *ipx, u_int length) for (i = 0; i < 8 && length > 0; i++) { ND_TCHECK(ipx[0]); - ND_PRINT((ndo, " %s '", ipxsap_string(ndo, htons(EXTRACT_16BITS(&ipx[0]))))); + ND_PRINT((ndo, " %s '", ipxsap_string(ndo, htons(EXTRACT_BE_16BITS(&ipx[0]))))); if (fn_printzp(ndo, (const u_char *)&ipx[1], 48, ndo->ndo_snapend)) { ND_PRINT((ndo, "'")); goto trunc; } ND_TCHECK2(ipx[25], 10); ND_PRINT((ndo, "' addr %s", - ipxaddr_string(EXTRACT_32BITS(&ipx[25]), (const u_char *)&ipx[27]))); + ipxaddr_string(EXTRACT_BE_32BITS(&ipx[25]), (const u_char *)&ipx[27]))); ipx += 32; length -= 64; } @@ -204,7 +204,7 @@ ipx_rip_print(netdissect_options *ndo, const u_short *ipx, u_int length) int command, i; ND_TCHECK(ipx[0]); - command = EXTRACT_16BITS(ipx); + command = EXTRACT_BE_16BITS(ipx); ipx++; length -= 2; @@ -213,16 +213,16 @@ ipx_rip_print(netdissect_options *ndo, const u_short *ipx, u_int length) ND_PRINT((ndo, "ipx-rip-req")); if (length > 0) { ND_TCHECK(ipx[3]); - ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_32BITS(&ipx[0]), - EXTRACT_16BITS(&ipx[2]), EXTRACT_16BITS(&ipx[3]))); + ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_32BITS(&ipx[0]), + EXTRACT_BE_16BITS(&ipx[2]), EXTRACT_BE_16BITS(&ipx[3]))); } break; case 2: ND_PRINT((ndo, "ipx-rip-resp")); for (i = 0; i < 50 && length > 0; i++) { ND_TCHECK(ipx[3]); - ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_32BITS(&ipx[0]), - EXTRACT_16BITS(&ipx[2]), EXTRACT_16BITS(&ipx[3]))); + ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_32BITS(&ipx[0]), + EXTRACT_BE_16BITS(&ipx[2]), EXTRACT_BE_16BITS(&ipx[3]))); ipx += 4; length -= 8; diff --git a/print-isakmp.c b/print-isakmp.c index 04374b0b..d38b4732 100644 --- a/print-isakmp.c +++ b/print-isakmp.c @@ -923,7 +923,7 @@ ikev1_attrmap_print(netdissect_options *ndo, totlen = 4; else { ND_TCHECK_16BITS(&p[2]); - totlen = 4 + EXTRACT_16BITS(&p[2]); + totlen = 4 + EXTRACT_BE_16BITS(&p[2]); } if (ep2 < p + totlen) { ND_PRINT((ndo,"[|attr]")); @@ -932,7 +932,7 @@ ikev1_attrmap_print(netdissect_options *ndo, ND_TCHECK_16BITS(&p[0]); ND_PRINT((ndo,"(")); - t = EXTRACT_16BITS(&p[0]) & 0x7fff; + t = EXTRACT_BE_16BITS(&p[0]) & 0x7fff; if (map && t < nmap && map[t].type) ND_PRINT((ndo,"type=%s ", map[t].type)); else @@ -940,7 +940,7 @@ ikev1_attrmap_print(netdissect_options *ndo, if (p[0] & 0x80) { ND_PRINT((ndo,"value=")); ND_TCHECK_16BITS(&p[2]); - v = EXTRACT_16BITS(&p[2]); + v = EXTRACT_BE_16BITS(&p[2]); if (map && t < nmap && v < map[t].nvalue && map[t].value[v]) ND_PRINT((ndo,"%s", map[t].value[v])); else { @@ -974,7 +974,7 @@ ikev1_attr_print(netdissect_options *ndo, const u_char *p, const u_char *ep2) totlen = 4; else { ND_TCHECK_16BITS(&p[2]); - totlen = 4 + EXTRACT_16BITS(&p[2]); + totlen = 4 + EXTRACT_BE_16BITS(&p[2]); } if (ep2 < p + totlen) { ND_PRINT((ndo,"[|attr]")); @@ -983,7 +983,7 @@ ikev1_attr_print(netdissect_options *ndo, const u_char *p, const u_char *ep2) ND_TCHECK_16BITS(&p[0]); ND_PRINT((ndo,"(")); - t = EXTRACT_16BITS(&p[0]) & 0x7fff; + t = EXTRACT_BE_16BITS(&p[0]) & 0x7fff; ND_PRINT((ndo,"type=#%d ", t)); if (p[0] & 0x80) { ND_PRINT((ndo,"value=")); @@ -1770,7 +1770,7 @@ ikev1_n_print(netdissect_options *ndo, u_char tpay _U_, case IPSECDOI_NTYPE_REPLAY_STATUS: ND_PRINT((ndo," status=(")); ND_PRINT((ndo,"replay detection %sabled", - EXTRACT_32BITS(cp) ? "en" : "dis")); + EXTRACT_BE_32BITS(cp) ? "en" : "dis")); ND_PRINT((ndo,")")); break; default: @@ -2822,7 +2822,7 @@ ikev1_print(netdissect_options *ndo, p = (const struct isakmp *)bp; ep = ndo->ndo_snapend; - phase = (EXTRACT_32BITS(base->msgid) == 0) ? 1 : 2; + phase = (EXTRACT_BE_32BITS(base->msgid) == 0) ? 1 : 2; if (phase == 1) ND_PRINT((ndo," phase %d", phase)); else @@ -2981,7 +2981,7 @@ ikev2_print(netdissect_options *ndo, p = (const struct isakmp *)bp; ep = ndo->ndo_snapend; - phase = (EXTRACT_32BITS(base->msgid) == 0) ? 1 : 2; + phase = (EXTRACT_BE_32BITS(base->msgid) == 0) ? 1 : 2; if (phase == 1) ND_PRINT((ndo, " parent_sa")); else diff --git a/print-isoclns.c b/print-isoclns.c index 8ea5d3b8..c8110292 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -861,10 +861,10 @@ clnp_print(netdissect_options *ndo, clnp_header->version, clnp_header->lifetime/2, (clnp_header->lifetime%2)*5, - EXTRACT_16BITS(clnp_header->segment_length), - EXTRACT_16BITS(clnp_header->cksum))); + EXTRACT_BE_16BITS(clnp_header->segment_length), + EXTRACT_BE_16BITS(clnp_header->cksum))); - osi_print_cksum(ndo, optr, EXTRACT_16BITS(clnp_header->cksum), 7, + osi_print_cksum(ndo, optr, EXTRACT_BE_16BITS(clnp_header->cksum), 7, clnp_header->length_indicator); ND_PRINT((ndo, "\n\tFlags [%s]", @@ -884,9 +884,9 @@ clnp_print(netdissect_options *ndo, clnp_segment_header = (const struct clnp_segment_header_t *) pptr; ND_TCHECK(*clnp_segment_header); ND_PRINT((ndo, "\n\tData Unit ID: 0x%04x, Segment Offset: %u, Total PDU Length: %u", - EXTRACT_16BITS(clnp_segment_header->data_unit_id), - EXTRACT_16BITS(clnp_segment_header->segment_offset), - EXTRACT_16BITS(clnp_segment_header->total_length))); + EXTRACT_BE_16BITS(clnp_segment_header->data_unit_id), + EXTRACT_BE_16BITS(clnp_segment_header->segment_offset), + EXTRACT_BE_16BITS(clnp_segment_header->total_length))); pptr+=sizeof(struct clnp_segment_header_t); li-=sizeof(struct clnp_segment_header_t); } @@ -1149,12 +1149,13 @@ esis_print(netdissect_options *ndo, esis_pdu_type)); ND_PRINT((ndo, ", v: %u%s", esis_header->version, esis_header->version == ESIS_VERSION ? "" : "unsupported" )); - ND_PRINT((ndo, ", checksum: 0x%04x", EXTRACT_16BITS(esis_header->cksum))); + ND_PRINT((ndo, ", checksum: 0x%04x", EXTRACT_BE_16BITS(esis_header->cksum))); - osi_print_cksum(ndo, pptr, EXTRACT_16BITS(esis_header->cksum), 7, li); + osi_print_cksum(ndo, pptr, EXTRACT_BE_16BITS(esis_header->cksum), 7, + li); ND_PRINT((ndo, ", holding time: %us, length indicator: %u", - EXTRACT_16BITS(esis_header->holdtime), li)); + EXTRACT_BE_16BITS(esis_header->holdtime), li)); if (ndo->ndo_vflag > 1) print_unknown_data(ndo, optr, "\n\t", sizeof(struct esis_header_t)); @@ -1327,7 +1328,7 @@ esis_print(netdissect_options *ndo, case ESIS_OPTION_ES_CONF_TIME: if (opli == 2) { ND_TCHECK2(*pptr, 2); - ND_PRINT((ndo, "%us", EXTRACT_16BITS(tptr))); + ND_PRINT((ndo, "%us", EXTRACT_BE_16BITS(tptr))); } else ND_PRINT((ndo, "(bad length)")); break; @@ -1382,7 +1383,7 @@ isis_print_mcid(netdissect_options *ndo, if (fn_printzp(ndo, mcid->name, 32, ndo->ndo_snapend)) goto trunc; - ND_PRINT((ndo, "\n\t Lvl: %d", EXTRACT_16BITS(mcid->revision_lvl))); + ND_PRINT((ndo, "\n\t Lvl: %d", EXTRACT_BE_16BITS(mcid->revision_lvl))); ND_PRINT((ndo, ", Digest: ")); @@ -1464,7 +1465,7 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo, for(i=1;i<=8; i++) { - ND_PRINT((ndo, "%08x ", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "%08x ", EXTRACT_BE_32BITS(tptr))); if (i%4 == 0 && i != 8) ND_PRINT((ndo, "\n\t ")); tptr = tptr + 4; @@ -1481,14 +1482,14 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo, while (stlv_len >= ISIS_SUBTLV_SPB_BVID_MIN_LEN) { ND_PRINT((ndo, "\n\t ECT: %08x", - EXTRACT_32BITS(tptr))); + EXTRACT_BE_32BITS(tptr))); tptr = tptr+4; ND_PRINT((ndo, " BVID: %d, U:%01x M:%01x ", - (EXTRACT_16BITS (tptr) >> 4) , - (EXTRACT_16BITS (tptr) >> 3) & 0x01, - (EXTRACT_16BITS (tptr) >> 2) & 0x01)); + (EXTRACT_BE_16BITS(tptr) >> 4) , + (EXTRACT_BE_16BITS(tptr) >> 3) & 0x01, + (EXTRACT_BE_16BITS(tptr) >> 2) & 0x01)); tptr = tptr + 2; len = len - ISIS_SUBTLV_SPB_BVID_MIN_LEN; @@ -1545,20 +1546,20 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, if (stlv_len < ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN) goto trunc; - ND_PRINT((ndo, "\n\t CIST Root-ID: %08x", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "\n\t CIST Root-ID: %08x", EXTRACT_BE_32BITS(tptr))); tptr = tptr+4; - ND_PRINT((ndo, " %08x", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, " %08x", EXTRACT_BE_32BITS(tptr))); tptr = tptr+4; - ND_PRINT((ndo, ", Path Cost: %08x", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, ", Path Cost: %08x", EXTRACT_BE_32BITS(tptr))); tptr = tptr+4; - ND_PRINT((ndo, ", Prio: %d", EXTRACT_16BITS(tptr))); + ND_PRINT((ndo, ", Prio: %d", EXTRACT_BE_16BITS(tptr))); tptr = tptr + 2; ND_PRINT((ndo, "\n\t RES: %d", - EXTRACT_16BITS(tptr) >> 5)); + EXTRACT_BE_16BITS(tptr) >> 5)); ND_PRINT((ndo, ", V: %d", - (EXTRACT_16BITS(tptr) >> 4) & 0x0001)); + (EXTRACT_BE_16BITS(tptr) >> 4) & 0x0001)); ND_PRINT((ndo, ", SPSource-ID: %d", - (EXTRACT_32BITS(tptr) & 0x000fffff))); + (EXTRACT_BE_32BITS(tptr) & 0x000fffff))); tptr = tptr+4; ND_PRINT((ndo, ", No of Trees: %x", *(tptr))); @@ -1578,13 +1579,13 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, tptr++; - ND_PRINT((ndo, ", ECT: %08x", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, ", ECT: %08x", EXTRACT_BE_32BITS(tptr))); tptr = tptr + 4; ND_PRINT((ndo, ", BVID: %d, SPVID: %d", - (EXTRACT_24BITS(tptr) >> 12) & 0x000fff, - EXTRACT_24BITS(tptr) & 0x000fff)); + (EXTRACT_BE_24BITS(tptr) >> 12) & 0x000fff, + EXTRACT_BE_24BITS(tptr) & 0x000fff)); tptr = tptr + 3; len = len - ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN; @@ -1598,13 +1599,13 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, if (stlv_len < 8) goto trunc; - ND_PRINT((ndo, "\n\t BMAC: %08x", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "\n\t BMAC: %08x", EXTRACT_BE_32BITS(tptr))); tptr = tptr+4; - ND_PRINT((ndo, "%04x", EXTRACT_16BITS(tptr))); + ND_PRINT((ndo, "%04x", EXTRACT_BE_16BITS(tptr))); tptr = tptr+2; - ND_PRINT((ndo, ", RES: %d, VID: %d", EXTRACT_16BITS(tptr) >> 12, - (EXTRACT_16BITS(tptr)) & 0x0fff)); + ND_PRINT((ndo, ", RES: %d, VID: %d", EXTRACT_BE_16BITS(tptr) >> 12, + (EXTRACT_BE_16BITS(tptr)) & 0x0fff)); tptr = tptr+2; len = len - 8; @@ -1613,10 +1614,10 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, while (stlv_len >= 4) { ND_TCHECK2(*tptr, 4); ND_PRINT((ndo, "\n\t T: %d, R: %d, RES: %d, ISID: %d", - (EXTRACT_32BITS(tptr) >> 31), - (EXTRACT_32BITS(tptr) >> 30) & 0x01, - (EXTRACT_32BITS(tptr) >> 24) & 0x03f, - (EXTRACT_32BITS(tptr)) & 0x0ffffff)); + (EXTRACT_BE_32BITS(tptr) >> 31), + (EXTRACT_BE_32BITS(tptr) >> 30) & 0x01, + (EXTRACT_BE_32BITS(tptr) >> 24) & 0x03f, + (EXTRACT_BE_32BITS(tptr)) & 0x0ffffff)); tptr = tptr + 4; len = len - 4; @@ -1710,7 +1711,7 @@ isis_print_tlv_ip_reach(netdissect_options *ndo, if (!ND_TTEST(*tlv_ip_reach)) return (0); - prefix_len = mask2plen(EXTRACT_32BITS(tlv_ip_reach->mask)); + prefix_len = mask2plen(EXTRACT_BE_32BITS(tlv_ip_reach->mask)); if (prefix_len == -1) ND_PRINT((ndo, "%sIPv4 prefix: %s mask %s", @@ -1774,8 +1775,8 @@ isis_print_ip_reach_subtlv(netdissect_options *ndo, case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32: while (subl >= 4) { ND_PRINT((ndo, ", 0x%08x (=%u)", - EXTRACT_32BITS(tptr), - EXTRACT_32BITS(tptr))); + EXTRACT_BE_32BITS(tptr), + EXTRACT_BE_32BITS(tptr))); tptr+=4; subl-=4; } @@ -1783,8 +1784,8 @@ isis_print_ip_reach_subtlv(netdissect_options *ndo, case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64: while (subl >= 8) { ND_PRINT((ndo, ", 0x%08x%08x", - EXTRACT_32BITS(tptr), - EXTRACT_32BITS(tptr+4))); + EXTRACT_BE_32BITS(tptr), + EXTRACT_BE_32BITS(tptr + 4))); tptr+=8; subl-=8; } @@ -1830,9 +1831,9 @@ isis_print_is_reach_subtlv(netdissect_options *ndo, case ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID: case ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID: if (subl >= 4) { - ND_PRINT((ndo, ", 0x%08x", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_32BITS(tptr))); if (subl == 8) /* rfc4205 */ - ND_PRINT((ndo, ", 0x%08x", EXTRACT_32BITS(tptr+4))); + ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_32BITS(tptr + 4))); } break; case ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR: @@ -1843,14 +1844,14 @@ isis_print_is_reach_subtlv(netdissect_options *ndo, case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW : case ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW: if (subl >= 4) { - bw.i = EXTRACT_32BITS(tptr); + bw.i = EXTRACT_BE_32BITS(tptr); ND_PRINT((ndo, ", %.3f Mbps", bw.f * 8 / 1000000)); } break; case ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW : if (subl >= 32) { for (te_class = 0; te_class < 8; te_class++) { - bw.i = EXTRACT_32BITS(tptr); + bw.i = EXTRACT_BE_32BITS(tptr); ND_PRINT((ndo, "%s TE-Class %u: %.3f Mbps", ident, te_class, @@ -1870,7 +1871,7 @@ isis_print_is_reach_subtlv(netdissect_options *ndo, tptr++; /* decode BCs until the subTLV ends */ for (te_class = 0; te_class < (subl-1)/4; te_class++) { - bw.i = EXTRACT_32BITS(tptr); + bw.i = EXTRACT_BE_32BITS(tptr); ND_PRINT((ndo, "%s Bandwidth constraint CT%u: %.3f Mbps", ident, te_class, @@ -1880,15 +1881,15 @@ isis_print_is_reach_subtlv(netdissect_options *ndo, break; case ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC: if (subl >= 3) - ND_PRINT((ndo, ", %u", EXTRACT_24BITS(tptr))); + ND_PRINT((ndo, ", %u", EXTRACT_BE_24BITS(tptr))); break; case ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE: if (subl == 2) { ND_PRINT((ndo, ", [ %s ] (0x%04x)", bittok2str(isis_subtlv_link_attribute_values, "Unknown", - EXTRACT_16BITS(tptr)), - EXTRACT_16BITS(tptr))); + EXTRACT_BE_16BITS(tptr)), + EXTRACT_BE_16BITS(tptr))); } break; case ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE: @@ -1900,11 +1901,11 @@ isis_print_is_reach_subtlv(netdissect_options *ndo, break; case ISIS_SUBTLV_SPB_METRIC: if (subl >= 6) { - ND_PRINT((ndo, ", LM: %u", EXTRACT_24BITS(tptr))); + ND_PRINT((ndo, ", LM: %u", EXTRACT_BE_24BITS(tptr))); tptr=tptr+3; ND_PRINT((ndo, ", P: %u", *(tptr))); tptr++; - ND_PRINT((ndo, ", P-ID: %u", EXTRACT_16BITS(tptr))); + ND_PRINT((ndo, ", P-ID: %u", EXTRACT_BE_16BITS(tptr))); } break; case ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR: @@ -1918,7 +1919,7 @@ isis_print_is_reach_subtlv(netdissect_options *ndo, tptr+=4; ND_PRINT((ndo, "%s Max LSP Bandwidth:", ident)); for (priority_level = 0; priority_level < 8; priority_level++) { - bw.i = EXTRACT_32BITS(tptr); + bw.i = EXTRACT_BE_32BITS(tptr); ND_PRINT((ndo, "%s priority level %d: %.3f Mbps", ident, priority_level, @@ -1933,14 +1934,14 @@ isis_print_is_reach_subtlv(netdissect_options *ndo, case GMPLS_PSC4: if (subl < 6) break; - bw.i = EXTRACT_32BITS(tptr); + bw.i = EXTRACT_BE_32BITS(tptr); ND_PRINT((ndo, "%s Min LSP Bandwidth: %.3f Mbps", ident, bw.f * 8 / 1000000)); - ND_PRINT((ndo, "%s Interface MTU: %u", ident, EXTRACT_16BITS(tptr + 4))); + ND_PRINT((ndo, "%s Interface MTU: %u", ident, EXTRACT_BE_16BITS(tptr + 4))); break; case GMPLS_TSC: if (subl < 8) break; - bw.i = EXTRACT_32BITS(tptr); + bw.i = EXTRACT_BE_32BITS(tptr); ND_PRINT((ndo, "%s Min LSP Bandwidth: %.3f Mbps", ident, bw.f * 8 / 1000000)); ND_PRINT((ndo, "%s Indication %s", ident, tok2str(gmpls_switch_cap_tsc_indication_values, "Unknown (%u)", *(tptr + 4)))); @@ -1988,7 +1989,7 @@ isis_print_ext_is_reach(netdissect_options *ndo, if (tlv_type != ISIS_TLV_IS_ALIAS_ID) { /* the Alias TLV Metric field is implicit 0 */ if (!ND_TTEST2(*tptr, 3)) /* and is therefore skipped */ return(0); - ND_PRINT((ndo, ", Metric: %d", EXTRACT_24BITS(tptr))); + ND_PRINT((ndo, ", Metric: %d", EXTRACT_BE_24BITS(tptr))); tptr+=3; } @@ -2032,11 +2033,11 @@ isis_print_mtid(netdissect_options *ndo, ident, tok2str(isis_mt_values, "Reserved for IETF Consensus", - ISIS_MASK_MTID(EXTRACT_16BITS(tptr))))); + ISIS_MASK_MTID(EXTRACT_BE_16BITS(tptr))))); ND_PRINT((ndo, " Topology (0x%03x), Flags: [%s]", - ISIS_MASK_MTID(EXTRACT_16BITS(tptr)), - bittok2str(isis_mt_flag_values, "none",ISIS_MASK_MTFLAGS(EXTRACT_16BITS(tptr))))); + ISIS_MASK_MTID(EXTRACT_BE_16BITS(tptr)), + bittok2str(isis_mt_flag_values, "none",ISIS_MASK_MTFLAGS(EXTRACT_BE_16BITS(tptr))))); return(2); } @@ -2058,7 +2059,7 @@ isis_print_extd_ip_reach(netdissect_options *ndo, if (!ND_TTEST2(*tptr, 4)) return (0); - metric = EXTRACT_32BITS(tptr); + metric = EXTRACT_BE_32BITS(tptr); processed=4; tptr+=4; @@ -2329,7 +2330,7 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, ", length %u", length)); return (1); } - pdu_len=EXTRACT_16BITS(header_iih_lan->pdu_len); + pdu_len=EXTRACT_BE_16BITS(header_iih_lan->pdu_len); if (packet_len>pdu_len) { packet_len=pdu_len; /* do TLV decoding as long as it makes sense */ length=pdu_len; @@ -2337,7 +2338,7 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t source-id: %s, holding time: %us, Flags: [%s]", isis_print_id(header_iih_lan->source_id,SYSTEM_ID_LEN), - EXTRACT_16BITS(header_iih_lan->holding_time), + EXTRACT_BE_16BITS(header_iih_lan->holding_time), tok2str(isis_iih_circuit_type_values, "unknown circuit type 0x%02x", header_iih_lan->circuit_type))); @@ -2370,7 +2371,7 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, ", length %u", length)); return (1); } - pdu_len=EXTRACT_16BITS(header_iih_ptp->pdu_len); + pdu_len=EXTRACT_BE_16BITS(header_iih_ptp->pdu_len); if (packet_len>pdu_len) { packet_len=pdu_len; /* do TLV decoding as long as it makes sense */ length=pdu_len; @@ -2378,7 +2379,7 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t source-id: %s, holding time: %us, Flags: [%s]", isis_print_id(header_iih_ptp->source_id,SYSTEM_ID_LEN), - EXTRACT_16BITS(header_iih_ptp->holding_time), + EXTRACT_BE_16BITS(header_iih_ptp->holding_time), tok2str(isis_iih_circuit_type_values, "unknown circuit type 0x%02x", header_iih_ptp->circuit_type))); @@ -2409,12 +2410,12 @@ isis_print(netdissect_options *ndo, if (ndo->ndo_vflag == 0) { ND_PRINT((ndo, ", lsp-id %s, seq 0x%08x, lifetime %5us", isis_print_id(header_lsp->lsp_id, LSP_ID_LEN), - EXTRACT_32BITS(header_lsp->sequence_number), - EXTRACT_16BITS(header_lsp->remaining_lifetime))); + EXTRACT_BE_32BITS(header_lsp->sequence_number), + EXTRACT_BE_16BITS(header_lsp->remaining_lifetime))); ND_PRINT((ndo, ", length %u", length)); return (1); } - pdu_len=EXTRACT_16BITS(header_lsp->pdu_len); + pdu_len=EXTRACT_BE_16BITS(header_lsp->pdu_len); if (packet_len>pdu_len) { packet_len=pdu_len; /* do TLV decoding as long as it makes sense */ length=pdu_len; @@ -2422,12 +2423,12 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t lsp-id: %s, seq: 0x%08x, lifetime: %5us\n\t chksum: 0x%04x", isis_print_id(header_lsp->lsp_id, LSP_ID_LEN), - EXTRACT_32BITS(header_lsp->sequence_number), - EXTRACT_16BITS(header_lsp->remaining_lifetime), - EXTRACT_16BITS(header_lsp->checksum))); + EXTRACT_BE_32BITS(header_lsp->sequence_number), + EXTRACT_BE_16BITS(header_lsp->remaining_lifetime), + EXTRACT_BE_16BITS(header_lsp->checksum))); osi_print_cksum(ndo, (const uint8_t *)header_lsp->lsp_id, - EXTRACT_16BITS(header_lsp->checksum), + EXTRACT_BE_16BITS(header_lsp->checksum), 12, length-12); ND_PRINT((ndo, ", PDU length: %u, Flags: [ %s", @@ -2469,7 +2470,7 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, ", length %u", length)); return (1); } - pdu_len=EXTRACT_16BITS(header_csnp->pdu_len); + pdu_len=EXTRACT_BE_16BITS(header_csnp->pdu_len); if (packet_len>pdu_len) { packet_len=pdu_len; /* do TLV decoding as long as it makes sense */ length=pdu_len; @@ -2507,7 +2508,7 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, ", length %u", length)); return (1); } - pdu_len=EXTRACT_16BITS(header_psnp->pdu_len); + pdu_len=EXTRACT_BE_16BITS(header_psnp->pdu_len); if (packet_len>pdu_len) { packet_len=pdu_len; /* do TLV decoding as long as it makes sense */ length=pdu_len; @@ -2776,7 +2777,7 @@ isis_print(netdissect_options *ndo, break; case ISIS_SUBTLV_AUTH_GENERIC: ND_TCHECK2(*(tptr + 1), 2); - key_id = EXTRACT_16BITS((tptr+1)); + key_id = EXTRACT_BE_16BITS((tptr + 1)); ND_PRINT((ndo, "%u, password: ", key_id)); for(i=1 + sizeof(uint16_t);i<tlv_len;i++) { ND_TCHECK2(*(tptr + i), 1); @@ -2803,7 +2804,7 @@ isis_print(netdissect_options *ndo, if(tmp>sizeof(tlv_ptp_adj->extd_local_circuit_id)) { ND_TCHECK(tlv_ptp_adj->extd_local_circuit_id); ND_PRINT((ndo, "\n\t Extended Local circuit-ID: 0x%08x", - EXTRACT_32BITS(tlv_ptp_adj->extd_local_circuit_id))); + EXTRACT_BE_32BITS(tlv_ptp_adj->extd_local_circuit_id))); tmp-=sizeof(tlv_ptp_adj->extd_local_circuit_id); } if(tmp>=SYSTEM_ID_LEN) { @@ -2815,7 +2816,7 @@ isis_print(netdissect_options *ndo, if(tmp>=sizeof(tlv_ptp_adj->neighbor_extd_local_circuit_id)) { ND_TCHECK(tlv_ptp_adj->neighbor_extd_local_circuit_id); ND_PRINT((ndo, "\n\t Neighbor Extended Local circuit-ID: 0x%08x", - EXTRACT_32BITS(tlv_ptp_adj->neighbor_extd_local_circuit_id))); + EXTRACT_BE_32BITS(tlv_ptp_adj->neighbor_extd_local_circuit_id))); } break; @@ -2840,8 +2841,8 @@ isis_print(netdissect_options *ndo, ND_TCHECK2(*(tptr), 2); ND_PRINT((ndo, "\n\t RES: %d, MTID(s): %d", - (EXTRACT_16BITS (tptr) >> 12), - (EXTRACT_16BITS (tptr) & 0x0fff))); + (EXTRACT_BE_16BITS(tptr) >> 12), + (EXTRACT_BE_16BITS(tptr) & 0x0fff))); tmp = tmp-2; tptr = tptr+2; @@ -2857,9 +2858,9 @@ isis_print(netdissect_options *ndo, ND_TCHECK2(*(tptr), 2); ND_PRINT((ndo, "\n\t O: %d, RES: %d, MTID(s): %d", - (EXTRACT_16BITS(tptr) >> 15) & 0x01, - (EXTRACT_16BITS(tptr) >> 12) & 0x07, - EXTRACT_16BITS(tptr) & 0x0fff)); + (EXTRACT_BE_16BITS(tptr) >> 15) & 0x01, + (EXTRACT_BE_16BITS(tptr) >> 12) & 0x07, + EXTRACT_BE_16BITS(tptr) & 0x0fff)); tmp = tmp-2; tptr = tptr+2; @@ -2919,7 +2920,7 @@ isis_print(netdissect_options *ndo, while (tmp>=4) { ND_TCHECK2(*tptr, 4); - ND_PRINT((ndo, "\n\t Link-ID: 0x%08x", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "\n\t Link-ID: 0x%08x", EXTRACT_BE_32BITS(tptr))); tptr+=4; tmp-=4; } @@ -2932,11 +2933,11 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t lsp-id: %s", isis_print_id(tlv_lsp->lsp_id, LSP_ID_LEN))); ND_TCHECK2(tlv_lsp->sequence_number, 4); - ND_PRINT((ndo, ", seq: 0x%08x", EXTRACT_32BITS(tlv_lsp->sequence_number))); + ND_PRINT((ndo, ", seq: 0x%08x", EXTRACT_BE_32BITS(tlv_lsp->sequence_number))); ND_TCHECK2(tlv_lsp->remaining_lifetime, 2); - ND_PRINT((ndo, ", lifetime: %5ds", EXTRACT_16BITS(tlv_lsp->remaining_lifetime))); + ND_PRINT((ndo, ", lifetime: %5ds", EXTRACT_BE_16BITS(tlv_lsp->remaining_lifetime))); ND_TCHECK2(tlv_lsp->checksum, 2); - ND_PRINT((ndo, ", chksum: 0x%04x", EXTRACT_16BITS(tlv_lsp->checksum))); + ND_PRINT((ndo, ", chksum: 0x%04x", EXTRACT_BE_16BITS(tlv_lsp->checksum))); tmp-=sizeof(struct isis_tlv_lsp); tlv_lsp++; } @@ -2946,14 +2947,14 @@ isis_print(netdissect_options *ndo, if (tmp < ISIS_TLV_CHECKSUM_MINLEN) break; ND_TCHECK2(*tptr, ISIS_TLV_CHECKSUM_MINLEN); - ND_PRINT((ndo, "\n\t checksum: 0x%04x ", EXTRACT_16BITS(tptr))); + ND_PRINT((ndo, "\n\t checksum: 0x%04x ", EXTRACT_BE_16BITS(tptr))); /* do not attempt to verify the checksum if it is zero * most likely a HMAC-MD5 TLV is also present and * to avoid conflicts the checksum TLV is zeroed. * see rfc3358 for details */ - osi_print_cksum(ndo, optr, EXTRACT_16BITS(tptr), tptr-optr, - length); + osi_print_cksum(ndo, optr, EXTRACT_BE_16BITS(tptr), tptr-optr, + length); break; case ISIS_TLV_POI: @@ -3007,7 +3008,7 @@ isis_print(netdissect_options *ndo, break; ND_TCHECK2(*tptr, ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN); - ND_PRINT((ndo, ", Remaining holding time %us", EXTRACT_16BITS(tptr))); + ND_PRINT((ndo, ", Remaining holding time %us", EXTRACT_BE_16BITS(tptr))); tptr+=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN; tmp-=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN; @@ -3029,7 +3030,7 @@ isis_print(netdissect_options *ndo, switch (*tptr++) { case ISIS_SUBTLV_IDRP_ASN: ND_TCHECK2(*tptr, 2); /* fetch AS number */ - ND_PRINT((ndo, "AS Number: %u", EXTRACT_16BITS(tptr))); + ND_PRINT((ndo, "AS Number: %u", EXTRACT_BE_16BITS(tptr))); break; case ISIS_SUBTLV_IDRP_LOCAL: case ISIS_SUBTLV_IDRP_RES: @@ -3044,7 +3045,7 @@ isis_print(netdissect_options *ndo, if (tmp < ISIS_TLV_LSP_BUFFERSIZE_MINLEN) break; ND_TCHECK2(*tptr, ISIS_TLV_LSP_BUFFERSIZE_MINLEN); - ND_PRINT((ndo, "\n\t LSP Buffersize: %u", EXTRACT_16BITS(tptr))); + ND_PRINT((ndo, "\n\t LSP Buffersize: %u", EXTRACT_BE_16BITS(tptr))); break; case ISIS_TLV_PART_DIS: @@ -3087,14 +3088,14 @@ isis_print(netdissect_options *ndo, if (tmp < ISIS_TLV_IIH_SEQNR_MINLEN) break; ND_TCHECK2(*tptr, ISIS_TLV_IIH_SEQNR_MINLEN); /* check if four bytes are on the wire */ - ND_PRINT((ndo, "\n\t Sequence number: %u", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "\n\t Sequence number: %u", EXTRACT_BE_32BITS(tptr))); break; case ISIS_TLV_VENDOR_PRIVATE: if (tmp < ISIS_TLV_VENDOR_PRIVATE_MINLEN) break; ND_TCHECK2(*tptr, ISIS_TLV_VENDOR_PRIVATE_MINLEN); /* check if enough byte for a full oui */ - vendor_id = EXTRACT_24BITS(tptr); + vendor_id = EXTRACT_BE_24BITS(tptr); ND_PRINT((ndo, "\n\t Vendor: %s (%u)", tok2str(oui_values, "Unknown", vendor_id), vendor_id)); diff --git a/print-juniper.c b/print-juniper.c index b8383032..d9c45200 100644 --- a/print-juniper.c +++ b/print-juniper.c @@ -477,7 +477,7 @@ juniper_ggsn_if_print(netdissect_options *ndo, ND_PRINT((ndo, "proto %s (%u), vlan %u: ", tok2str(juniper_protocol_values,"Unknown",gh->proto), gh->proto, - EXTRACT_16BITS(&gh->vlan_id[0]))); + EXTRACT_BE_16BITS(&gh->vlan_id[0]))); } switch (gh->proto) { @@ -550,17 +550,17 @@ juniper_es_if_print(netdissect_options *ndo, if (ndo->ndo_eflag) { if (!es_type_bundle) { ND_PRINT((ndo, "ES SA, index %u, ttl %u type %s (%u), spi %u, Tunnel %s > %s, length %u\n", - EXTRACT_16BITS(&ih->sa_index), + EXTRACT_BE_16BITS(&ih->sa_index), ih->ttl, tok2str(juniper_ipsec_type_values,"Unknown",ih->type), ih->type, - EXTRACT_32BITS(&ih->spi), + EXTRACT_BE_32BITS(&ih->spi), ipaddr_string(ndo, &ih->src_ip), ipaddr_string(ndo, &ih->dst_ip), l2info.length)); } else { ND_PRINT((ndo, "ES SA, index %u, ttl %u type %s (%u), length %u\n", - EXTRACT_16BITS(&ih->sa_index), + EXTRACT_BE_16BITS(&ih->sa_index), ih->ttl, tok2str(juniper_ipsec_type_values,"Unknown",ih->type), ih->type, @@ -601,8 +601,8 @@ juniper_monitor_if_print(netdissect_options *ndo, ND_TCHECK(*mh); if (ndo->ndo_eflag) ND_PRINT((ndo, "service-id %u, iif %u, pkt-type %u: ", - EXTRACT_32BITS(&mh->service_id), - EXTRACT_16BITS(&mh->iif), + EXTRACT_BE_32BITS(&mh->service_id), + EXTRACT_BE_16BITS(&mh->iif), mh->pkt_type)); /* no proto field - lets guess by first byte of IP header*/ @@ -642,8 +642,8 @@ juniper_services_if_print(netdissect_options *ndo, ND_PRINT((ndo, "service-id %u flags 0x%02x service-set-id 0x%04x iif %u: ", sh->svc_id, sh->flags_len, - EXTRACT_16BITS(&sh->svc_set_id), - EXTRACT_24BITS(&sh->dir_iif[1]))); + EXTRACT_BE_16BITS(&sh->svc_set_id), + EXTRACT_BE_24BITS(&sh->dir_iif[1]))); /* no proto field - lets guess by first byte of IP header*/ ip_heuristic_guess (ndo, p, l2info.length); @@ -761,7 +761,7 @@ juniper_pppoe_atm_if_print(netdissect_options *ndo, p+=l2info.header_len; ND_TCHECK2(p[0], 2); - extracted_ethertype = EXTRACT_16BITS(p); + extracted_ethertype = EXTRACT_BE_16BITS(p); /* this DLT contains nothing but raw PPPoE frames, * prepended with a type field*/ if (ethertype_print(ndo, extracted_ethertype, @@ -794,8 +794,8 @@ juniper_mlppp_if_print(netdissect_options *ndo, /* suppress Bundle-ID if frame was captured on a child-link * best indicator if the cookie looks like a proto */ if (ndo->ndo_eflag && - EXTRACT_16BITS(&l2info.cookie) != PPP_OSI && - EXTRACT_16BITS(&l2info.cookie) != (PPP_ADDRESS << 8 | PPP_CONTROL)) + EXTRACT_BE_16BITS(&l2info.cookie) != PPP_OSI && + EXTRACT_BE_16BITS(&l2info.cookie) != (PPP_ADDRESS << 8 | PPP_CONTROL)) ND_PRINT((ndo, "Bundle-ID %u: ", l2info.bundle)); p+=l2info.header_len; @@ -825,7 +825,7 @@ juniper_mlppp_if_print(netdissect_options *ndo, } /* zero length cookie ? */ - switch (EXTRACT_16BITS(&l2info.cookie)) { + switch (EXTRACT_BE_16BITS(&l2info.cookie)) { case PPP_OSI: ppp_print(ndo, p - 2, l2info.length + 2); break; @@ -882,7 +882,7 @@ juniper_mfr_if_print(netdissect_options *ndo, } /* suppress Bundle-ID if frame was captured on a child-link */ - if (ndo->ndo_eflag && EXTRACT_32BITS(l2info.cookie) != 1) + if (ndo->ndo_eflag && EXTRACT_BE_32BITS(l2info.cookie) != 1) ND_PRINT((ndo, "Bundle-ID %u, ", l2info.bundle)); switch (l2info.proto) { case (LLCSAP_ISONS<<8 | LLCSAP_ISONS): @@ -916,7 +916,7 @@ juniper_mlfr_if_print(netdissect_options *ndo, p+=l2info.header_len; /* suppress Bundle-ID if frame was captured on a child-link */ - if (ndo->ndo_eflag && EXTRACT_32BITS(l2info.cookie) != 1) + if (ndo->ndo_eflag && EXTRACT_BE_32BITS(l2info.cookie) != 1) ND_PRINT((ndo, "Bundle-ID %u, ", l2info.bundle)); switch (l2info.proto) { case (LLC_UI): @@ -966,8 +966,8 @@ juniper_atm1_if_print(netdissect_options *ndo, } ND_TCHECK2(p[0], 3); - if (EXTRACT_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */ - EXTRACT_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */ + if (EXTRACT_BE_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */ + EXTRACT_BE_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */ llc_hdrlen = llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL); if (llc_hdrlen > 0) @@ -1020,8 +1020,8 @@ juniper_atm2_if_print(netdissect_options *ndo, } ND_TCHECK2(p[0], 3); - if (EXTRACT_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */ - EXTRACT_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */ + if (EXTRACT_BE_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */ + EXTRACT_BE_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */ llc_hdrlen = llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL); if (llc_hdrlen > 0) @@ -1029,7 +1029,7 @@ juniper_atm2_if_print(netdissect_options *ndo, } if (l2info.direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */ - (EXTRACT_32BITS(l2info.cookie) & ATM2_GAP_COUNT_MASK)) { + (EXTRACT_BE_32BITS(l2info.cookie) & ATM2_GAP_COUNT_MASK)) { ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL); return l2info.header_len; } @@ -1061,7 +1061,7 @@ static int juniper_ppp_heuristic_guess(netdissect_options *ndo, register const u_char *p, u_int length) { - switch(EXTRACT_16BITS(p)) { + switch(EXTRACT_BE_16BITS(p)) { case PPP_IP : case PPP_OSI : case PPP_MPLS_UCAST : @@ -1159,13 +1159,13 @@ juniper_read_tlv_value(const u_char *p, u_int tlv_type, u_int tlv_len) tlv_value = *p; break; case 2: - tlv_value = EXTRACT_16BITS(p); + tlv_value = EXTRACT_BE_16BITS(p); break; case 3: - tlv_value = EXTRACT_24BITS(p); + tlv_value = EXTRACT_BE_24BITS(p); break; case 4: - tlv_value = EXTRACT_32BITS(p); + tlv_value = EXTRACT_BE_32BITS(p); break; default: tlv_value = -1; @@ -1198,7 +1198,7 @@ juniper_parse_header(netdissect_options *ndo, l2info->flags = p[3]; l2info->direction = p[3]&JUNIPER_BPF_PKT_IN; - if (EXTRACT_24BITS(p) != JUNIPER_MGC_NUMBER) { /* magic number found ? */ + if (EXTRACT_BE_24BITS(p) != JUNIPER_MGC_NUMBER) { /* magic number found ? */ ND_PRINT((ndo, "no magic-number found!")); return 0; } @@ -1220,7 +1220,7 @@ juniper_parse_header(netdissect_options *ndo, /* ok to read extension length ? */ ND_TCHECK2(tptr[0], 2); - jnx_ext_len = EXTRACT_16BITS(tptr); + jnx_ext_len = EXTRACT_BE_16BITS(tptr); jnx_header_len += 2; tptr +=2; @@ -1368,7 +1368,7 @@ juniper_parse_header(netdissect_options *ndo, ND_TCHECK_16BITS(p+l2info->cookie_len); - l2info->proto = EXTRACT_16BITS(p+l2info->cookie_len); + l2info->proto = EXTRACT_BE_16BITS(p + l2info->cookie_len); break; } ++lp; @@ -1384,7 +1384,7 @@ juniper_parse_header(netdissect_options *ndo, l2info->bundle = l2info->cookie[1]; break; case AS_COOKIE_ID: - l2info->bundle = (EXTRACT_16BITS(&l2info->cookie[6])>>3)&0xfff; + l2info->bundle = (EXTRACT_BE_16BITS(&l2info->cookie[6])>>3)&0xfff; l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK; break; default: @@ -1399,13 +1399,13 @@ juniper_parse_header(netdissect_options *ndo, case LS_COOKIE_ID: ND_TCHECK2(p[0], 2); l2info->bundle = l2info->cookie[1]; - l2info->proto = EXTRACT_16BITS(p); + l2info->proto = EXTRACT_BE_16BITS(p); l2info->header_len += 2; l2info->length -= 2; l2info->caplen -= 2; break; case AS_COOKIE_ID: - l2info->bundle = (EXTRACT_16BITS(&l2info->cookie[6])>>3)&0xfff; + l2info->bundle = (EXTRACT_BE_16BITS(&l2info->cookie[6])>>3)&0xfff; l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK; break; default: @@ -1423,13 +1423,13 @@ juniper_parse_header(netdissect_options *ndo, case LS_COOKIE_ID: ND_TCHECK2(p[0], 2); l2info->bundle = l2info->cookie[1]; - l2info->proto = EXTRACT_16BITS(p); + l2info->proto = EXTRACT_BE_16BITS(p); l2info->header_len += 2; l2info->length -= 2; l2info->caplen -= 2; break; case AS_COOKIE_ID: - l2info->bundle = (EXTRACT_16BITS(&l2info->cookie[6])>>3)&0xfff; + l2info->bundle = (EXTRACT_BE_16BITS(&l2info->cookie[6])>>3)&0xfff; l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK; break; default: @@ -1443,7 +1443,7 @@ juniper_parse_header(netdissect_options *ndo, ND_TCHECK2(p[0], 4); /* ATM cell relay control word present ? */ if (l2info->cookie[7] & ATM2_PKT_TYPE_MASK) { - control_word = EXTRACT_32BITS(p); + control_word = EXTRACT_BE_32BITS(p); /* some control word heuristics */ switch(control_word) { case 0: /* zero control word */ diff --git a/print-krb.c b/print-krb.c index de69054c..aac9a8ee 100644 --- a/print-krb.c +++ b/print-krb.c @@ -155,7 +155,7 @@ krb4_print(netdissect_options *ndo, #define PRINT if ((cp = c_print(ndo, cp, ndo->ndo_snapend)) == NULL) goto trunc /* True if struct krb is little endian */ #define IS_LENDIAN(kp) (((kp)->type & 0x01) != 0) -#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? EXTRACT_LE_16BITS(cp) : EXTRACT_16BITS(cp)) +#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? EXTRACT_LE_16BITS(cp) : EXTRACT_BE_16BITS(cp)) kp = (const struct krb *)cp; diff --git a/print-l2tp.c b/print-l2tp.c index d70d434f..6682d71a 100644 --- a/print-l2tp.c +++ b/print-l2tp.c @@ -284,13 +284,13 @@ print_octets(netdissect_options *ndo, const u_char *dat, u_int length) static void print_16bits_val(netdissect_options *ndo, const uint16_t *dat) { - ND_PRINT((ndo, "%u", EXTRACT_16BITS(dat))); + ND_PRINT((ndo, "%u", EXTRACT_BE_16BITS(dat))); } static void print_32bits_val(netdissect_options *ndo, const uint32_t *dat) { - ND_PRINT((ndo, "%lu", (u_long)EXTRACT_32BITS(dat))); + ND_PRINT((ndo, "%lu", (u_long) EXTRACT_BE_32BITS(dat))); } /***********************************/ @@ -306,7 +306,7 @@ l2tp_msgtype_print(netdissect_options *ndo, const u_char *dat, u_int length) return; } ND_PRINT((ndo, "%s", tok2str(l2tp_msgtype2str, "MSGTYPE-#%u", - EXTRACT_16BITS(ptr)))); + EXTRACT_BE_16BITS(ptr)))); } static void @@ -319,7 +319,7 @@ l2tp_result_code_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT((ndo, "AVP too short")); return; } - ND_PRINT((ndo, "%u", EXTRACT_16BITS(ptr))); + ND_PRINT((ndo, "%u", EXTRACT_BE_16BITS(ptr))); ptr++; length -= 2; @@ -330,7 +330,7 @@ l2tp_result_code_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT((ndo, " AVP too short")); return; } - ND_PRINT((ndo, "/%u", EXTRACT_16BITS(ptr))); + ND_PRINT((ndo, "/%u", EXTRACT_BE_16BITS(ptr))); ptr++; length -= 2; @@ -348,8 +348,8 @@ l2tp_proto_ver_print(netdissect_options *ndo, const uint16_t *dat, u_int length) ND_PRINT((ndo, "AVP too short")); return; } - ND_PRINT((ndo, "%u.%u", (EXTRACT_16BITS(dat) >> 8), - (EXTRACT_16BITS(dat) & 0xff))); + ND_PRINT((ndo, "%u.%u", (EXTRACT_BE_16BITS(dat) >> 8), + (EXTRACT_BE_16BITS(dat) & 0xff))); } static void @@ -361,10 +361,10 @@ l2tp_framing_cap_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT((ndo, "AVP too short")); return; } - if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_CAP_ASYNC_MASK) { + if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_CAP_ASYNC_MASK) { ND_PRINT((ndo, "A")); } - if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_CAP_SYNC_MASK) { + if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_CAP_SYNC_MASK) { ND_PRINT((ndo, "S")); } } @@ -378,10 +378,10 @@ l2tp_bearer_cap_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT((ndo, "AVP too short")); return; } - if (EXTRACT_32BITS(ptr) & L2TP_BEARER_CAP_ANALOG_MASK) { + if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_CAP_ANALOG_MASK) { ND_PRINT((ndo, "A")); } - if (EXTRACT_32BITS(ptr) & L2TP_BEARER_CAP_DIGITAL_MASK) { + if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_CAP_DIGITAL_MASK) { ND_PRINT((ndo, "D")); } } @@ -412,10 +412,10 @@ l2tp_bearer_type_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT((ndo, "AVP too short")); return; } - if (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) { + if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) { ND_PRINT((ndo, "A")); } - if (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) { + if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) { ND_PRINT((ndo, "D")); } } @@ -429,10 +429,10 @@ l2tp_framing_type_print(netdissect_options *ndo, const u_char *dat, u_int length ND_PRINT((ndo, "AVP too short")); return; } - if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_TYPE_ASYNC_MASK) { + if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_TYPE_ASYNC_MASK) { ND_PRINT((ndo, "A")); } - if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_TYPE_SYNC_MASK) { + if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_TYPE_SYNC_MASK) { ND_PRINT((ndo, "S")); } } @@ -453,7 +453,7 @@ l2tp_proxy_auth_type_print(netdissect_options *ndo, const u_char *dat, u_int len return; } ND_PRINT((ndo, "%s", tok2str(l2tp_authentype2str, - "AuthType-#%u", EXTRACT_16BITS(ptr)))); + "AuthType-#%u", EXTRACT_BE_16BITS(ptr)))); } static void @@ -465,7 +465,7 @@ l2tp_proxy_auth_id_print(netdissect_options *ndo, const u_char *dat, u_int lengt ND_PRINT((ndo, "AVP too short")); return; } - ND_PRINT((ndo, "%u", EXTRACT_16BITS(ptr) & L2TP_PROXY_AUTH_ID_MASK)); + ND_PRINT((ndo, "%u", EXTRACT_BE_16BITS(ptr) & L2TP_PROXY_AUTH_ID_MASK)); } static void @@ -485,48 +485,48 @@ l2tp_call_errors_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT((ndo, "AVP too short")); return; } - val_h = EXTRACT_16BITS(ptr); ptr++; length -= 2; - val_l = EXTRACT_16BITS(ptr); ptr++; length -= 2; + val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; + val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; ND_PRINT((ndo, "CRCErr=%u ", (val_h<<16) + val_l)); if (length < 4) { ND_PRINT((ndo, "AVP too short")); return; } - val_h = EXTRACT_16BITS(ptr); ptr++; length -= 2; - val_l = EXTRACT_16BITS(ptr); ptr++; length -= 2; + val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; + val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; ND_PRINT((ndo, "FrameErr=%u ", (val_h<<16) + val_l)); if (length < 4) { ND_PRINT((ndo, "AVP too short")); return; } - val_h = EXTRACT_16BITS(ptr); ptr++; length -= 2; - val_l = EXTRACT_16BITS(ptr); ptr++; length -= 2; + val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; + val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; ND_PRINT((ndo, "HardOver=%u ", (val_h<<16) + val_l)); if (length < 4) { ND_PRINT((ndo, "AVP too short")); return; } - val_h = EXTRACT_16BITS(ptr); ptr++; length -= 2; - val_l = EXTRACT_16BITS(ptr); ptr++; length -= 2; + val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; + val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; ND_PRINT((ndo, "BufOver=%u ", (val_h<<16) + val_l)); if (length < 4) { ND_PRINT((ndo, "AVP too short")); return; } - val_h = EXTRACT_16BITS(ptr); ptr++; length -= 2; - val_l = EXTRACT_16BITS(ptr); ptr++; length -= 2; + val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; + val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; ND_PRINT((ndo, "Timeout=%u ", (val_h<<16) + val_l)); if (length < 4) { ND_PRINT((ndo, "AVP too short")); return; } - val_h = EXTRACT_16BITS(ptr); ptr++; - val_l = EXTRACT_16BITS(ptr); ptr++; + val_h = EXTRACT_BE_16BITS(ptr); ptr++; + val_l = EXTRACT_BE_16BITS(ptr); ptr++; ND_PRINT((ndo, "AlignErr=%u ", (val_h<<16) + val_l)); } @@ -547,16 +547,16 @@ l2tp_accm_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT((ndo, "AVP too short")); return; } - val_h = EXTRACT_16BITS(ptr); ptr++; length -= 2; - val_l = EXTRACT_16BITS(ptr); ptr++; length -= 2; + val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; + val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; ND_PRINT((ndo, "send=%08x ", (val_h<<16) + val_l)); if (length < 4) { ND_PRINT((ndo, "AVP too short")); return; } - val_h = EXTRACT_16BITS(ptr); ptr++; - val_l = EXTRACT_16BITS(ptr); ptr++; + val_h = EXTRACT_BE_16BITS(ptr); ptr++; + val_l = EXTRACT_BE_16BITS(ptr); ptr++; ND_PRINT((ndo, "recv=%08x ", (val_h<<16) + val_l)); } @@ -570,11 +570,11 @@ l2tp_ppp_discon_cc_print(netdissect_options *ndo, const u_char *dat, u_int lengt return; } /* Disconnect Code */ - ND_PRINT((ndo, "%04x, ", EXTRACT_16BITS(dat))); + ND_PRINT((ndo, "%04x, ", EXTRACT_BE_16BITS(dat))); dat += 2; length -= 2; /* Control Protocol Number */ - ND_PRINT((ndo, "%04x ", EXTRACT_16BITS(dat))); + ND_PRINT((ndo, "%04x ", EXTRACT_BE_16BITS(dat))); dat += 2; length -= 2; /* Direction */ @@ -604,7 +604,7 @@ l2tp_avp_print(netdissect_options *ndo, const u_char *dat, int length) ND_PRINT((ndo, " ")); ND_TCHECK(*ptr); /* Flags & Length */ - len = EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_LEN_MASK; + len = EXTRACT_BE_16BITS(ptr) & L2TP_AVP_HDR_LEN_MASK; /* If it is not long enough to contain the header, we'll give up. */ if (len < 6) @@ -625,26 +625,26 @@ l2tp_avp_print(netdissect_options *ndo, const u_char *dat, int length) * check whether we go past the end of the AVP. */ - if (EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_FLAG_MANDATORY) { + if (EXTRACT_BE_16BITS(ptr) & L2TP_AVP_HDR_FLAG_MANDATORY) { ND_PRINT((ndo, "*")); } - if (EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_FLAG_HIDDEN) { + if (EXTRACT_BE_16BITS(ptr) & L2TP_AVP_HDR_FLAG_HIDDEN) { hidden = TRUE; ND_PRINT((ndo, "?")); } ptr++; - if (EXTRACT_16BITS(ptr)) { + if (EXTRACT_BE_16BITS(ptr)) { /* Vendor Specific Attribute */ - ND_PRINT((ndo, "VENDOR%04x:", EXTRACT_16BITS(ptr))); ptr++; - ND_PRINT((ndo, "ATTR%04x", EXTRACT_16BITS(ptr))); ptr++; + ND_PRINT((ndo, "VENDOR%04x:", EXTRACT_BE_16BITS(ptr))); ptr++; + ND_PRINT((ndo, "ATTR%04x", EXTRACT_BE_16BITS(ptr))); ptr++; ND_PRINT((ndo, "(")); print_octets(ndo, (const u_char *)ptr, len-6); ND_PRINT((ndo, ")")); } else { /* IETF-defined Attributes */ ptr++; - attr_type = EXTRACT_16BITS(ptr); ptr++; + attr_type = EXTRACT_BE_16BITS(ptr); ptr++; ND_PRINT((ndo, "%s", tok2str(l2tp_avp2str, "AVP-#%u", attr_type))); ND_PRINT((ndo, "(")); if (hidden) { @@ -776,9 +776,9 @@ l2tp_print(netdissect_options *ndo, const u_char *dat, u_int length) flag_t = flag_l = flag_s = flag_o = FALSE; ND_TCHECK2(*ptr, 2); /* Flags & Version */ - if ((EXTRACT_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) { + if ((EXTRACT_BE_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) { ND_PRINT((ndo, " l2tp:")); - } else if ((EXTRACT_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2F) { + } else if ((EXTRACT_BE_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2F) { ND_PRINT((ndo, " l2f:")); return; /* nothing to do */ } else { @@ -787,23 +787,23 @@ l2tp_print(netdissect_options *ndo, const u_char *dat, u_int length) } ND_PRINT((ndo, "[")); - if (EXTRACT_16BITS(ptr) & L2TP_FLAG_TYPE) { + if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_TYPE) { flag_t = TRUE; ND_PRINT((ndo, "T")); } - if (EXTRACT_16BITS(ptr) & L2TP_FLAG_LENGTH) { + if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_LENGTH) { flag_l = TRUE; ND_PRINT((ndo, "L")); } - if (EXTRACT_16BITS(ptr) & L2TP_FLAG_SEQUENCE) { + if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_SEQUENCE) { flag_s = TRUE; ND_PRINT((ndo, "S")); } - if (EXTRACT_16BITS(ptr) & L2TP_FLAG_OFFSET) { + if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_OFFSET) { flag_o = TRUE; ND_PRINT((ndo, "O")); } - if (EXTRACT_16BITS(ptr) & L2TP_FLAG_PRIORITY) + if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_PRIORITY) ND_PRINT((ndo, "P")); ND_PRINT((ndo, "]")); @@ -812,7 +812,7 @@ l2tp_print(netdissect_options *ndo, const u_char *dat, u_int length) if (flag_l) { ND_TCHECK2(*ptr, 2); /* Length */ - l2tp_len = EXTRACT_16BITS(ptr); + l2tp_len = EXTRACT_BE_16BITS(ptr); ptr += 2; cnt += 2; } else { @@ -820,28 +820,28 @@ l2tp_print(netdissect_options *ndo, const u_char *dat, u_int length) } ND_TCHECK2(*ptr, 2); /* Tunnel ID */ - ND_PRINT((ndo, "(%u/", EXTRACT_16BITS(ptr))); + ND_PRINT((ndo, "(%u/", EXTRACT_BE_16BITS(ptr))); ptr += 2; cnt += 2; ND_TCHECK2(*ptr, 2); /* Session ID */ - ND_PRINT((ndo, "%u)", EXTRACT_16BITS(ptr))); + ND_PRINT((ndo, "%u)", EXTRACT_BE_16BITS(ptr))); ptr += 2; cnt += 2; if (flag_s) { ND_TCHECK2(*ptr, 2); /* Ns */ - ND_PRINT((ndo, "Ns=%u,", EXTRACT_16BITS(ptr))); + ND_PRINT((ndo, "Ns=%u,", EXTRACT_BE_16BITS(ptr))); ptr += 2; cnt += 2; ND_TCHECK2(*ptr, 2); /* Nr */ - ND_PRINT((ndo, "Nr=%u", EXTRACT_16BITS(ptr))); + ND_PRINT((ndo, "Nr=%u", EXTRACT_BE_16BITS(ptr))); ptr += 2; cnt += 2; } if (flag_o) { ND_TCHECK2(*ptr, 2); /* Offset Size */ - pad = EXTRACT_16BITS(ptr); + pad = EXTRACT_BE_16BITS(ptr); ptr += (2 + pad); cnt += (2 + pad); } diff --git a/print-lane.c b/print-lane.c index ba520842..b506ce30 100644 --- a/print-lane.c +++ b/print-lane.c @@ -69,7 +69,7 @@ static const struct tok lecop2str[] = { static void lane_hdr_print(netdissect_options *ndo, const u_char *bp) { - ND_PRINT((ndo, "lecid:%x ", EXTRACT_16BITS(bp))); + ND_PRINT((ndo, "lecid:%x ", EXTRACT_BE_16BITS(bp))); } /* @@ -91,13 +91,13 @@ lane_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) } lec = (const struct lane_controlhdr *)p; - if (EXTRACT_16BITS(&lec->lec_header) == 0xff00) { + if (EXTRACT_BE_16BITS(&lec->lec_header) == 0xff00) { /* * LE Control. */ ND_PRINT((ndo, "lec: proto %x vers %x %s", lec->lec_proto, lec->lec_vers, - tok2str(lecop2str, "opcode-#%u", EXTRACT_16BITS(&lec->lec_opcode)))); + tok2str(lecop2str, "opcode-#%u", EXTRACT_BE_16BITS(&lec->lec_opcode)))); return; } diff --git a/print-ldp.c b/print-ldp.c index d556a683..7f991a2b 100644 --- a/print-ldp.c +++ b/print-ldp.c @@ -251,13 +251,13 @@ ldp_tlv_print(netdissect_options *ndo, ldp_tlv_header = (const struct ldp_tlv_header *)tptr; ND_TCHECK(*ldp_tlv_header); - tlv_len=EXTRACT_16BITS(ldp_tlv_header->length); + tlv_len=EXTRACT_BE_16BITS(ldp_tlv_header->length); if (tlv_len + 4 > msg_tlen) { ND_PRINT((ndo, "\n\t\t TLV contents go past end of message")); return 0; } tlv_tlen=tlv_len; - tlv_type=LDP_MASK_TLV_TYPE(EXTRACT_16BITS(ldp_tlv_header->type)); + tlv_type=LDP_MASK_TLV_TYPE(EXTRACT_BE_16BITS(ldp_tlv_header->type)); /* FIXME vendor private / experimental check */ ND_PRINT((ndo, "\n\t %s TLV (0x%04x), length: %u, Flags: [%s and %s forward if unknown]", @@ -266,8 +266,8 @@ ldp_tlv_print(netdissect_options *ndo, tlv_type), tlv_type, tlv_len, - LDP_MASK_U_BIT(EXTRACT_16BITS(&ldp_tlv_header->type)) ? "continue processing" : "ignore", - LDP_MASK_F_BIT(EXTRACT_16BITS(&ldp_tlv_header->type)) ? "do" : "don't")); + LDP_MASK_U_BIT(EXTRACT_BE_16BITS(&ldp_tlv_header->type)) ? "continue processing" : "ignore", + LDP_MASK_F_BIT(EXTRACT_BE_16BITS(&ldp_tlv_header->type)) ? "do" : "don't")); tptr+=sizeof(struct ldp_tlv_header); @@ -276,9 +276,9 @@ ldp_tlv_print(netdissect_options *ndo, case LDP_TLV_COMMON_HELLO: TLV_TCHECK(4); ND_PRINT((ndo, "\n\t Hold Time: %us, Flags: [%s Hello%s]", - EXTRACT_16BITS(tptr), - (EXTRACT_16BITS(tptr+2)&0x8000) ? "Targeted" : "Link", - (EXTRACT_16BITS(tptr+2)&0x4000) ? ", Request for targeted Hellos" : "")); + EXTRACT_BE_16BITS(tptr), + (EXTRACT_BE_16BITS(tptr + 2)&0x8000) ? "Targeted" : "Link", + (EXTRACT_BE_16BITS(tptr + 2)&0x4000) ? ", Request for targeted Hellos" : "")); break; case LDP_TLV_IPV4_TRANSPORT_ADDR: @@ -291,12 +291,12 @@ ldp_tlv_print(netdissect_options *ndo, break; case LDP_TLV_CONFIG_SEQ_NUMBER: TLV_TCHECK(4); - ND_PRINT((ndo, "\n\t Sequence Number: %u", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "\n\t Sequence Number: %u", EXTRACT_BE_32BITS(tptr))); break; case LDP_TLV_ADDRESS_LIST: TLV_TCHECK(LDP_TLV_ADDRESS_LIST_AFNUM_LEN); - af = EXTRACT_16BITS(tptr); + af = EXTRACT_BE_16BITS(tptr); tptr+=LDP_TLV_ADDRESS_LIST_AFNUM_LEN; tlv_tlen -= LDP_TLV_ADDRESS_LIST_AFNUM_LEN; ND_PRINT((ndo, "\n\t Address Family: %s, addresses", @@ -327,9 +327,9 @@ ldp_tlv_print(netdissect_options *ndo, case LDP_TLV_COMMON_SESSION: TLV_TCHECK(8); ND_PRINT((ndo, "\n\t Version: %u, Keepalive: %us, Flags: [Downstream %s, Loop Detection %s]", - EXTRACT_16BITS(tptr), EXTRACT_16BITS(tptr+2), - (EXTRACT_16BITS(tptr+6)&0x8000) ? "On Demand" : "Unsolicited", - (EXTRACT_16BITS(tptr+6)&0x4000) ? "Enabled" : "Disabled" + EXTRACT_BE_16BITS(tptr), EXTRACT_BE_16BITS(tptr + 2), + (EXTRACT_BE_16BITS(tptr + 6)&0x8000) ? "On Demand" : "Unsolicited", + (EXTRACT_BE_16BITS(tptr + 6)&0x4000) ? "Enabled" : "Disabled" )); break; @@ -348,7 +348,7 @@ ldp_tlv_print(netdissect_options *ndo, break; case LDP_FEC_PREFIX: TLV_TCHECK(2); - af = EXTRACT_16BITS(tptr); + af = EXTRACT_BE_16BITS(tptr); tptr+=LDP_TLV_ADDRESS_LIST_AFNUM_LEN; tlv_tlen-=LDP_TLV_ADDRESS_LIST_AFNUM_LEN; if (af == AFNUM_INET) { @@ -393,9 +393,9 @@ ldp_tlv_print(netdissect_options *ndo, */ if (vc_info_len == 0) { ND_PRINT((ndo, ": %s, %scontrol word, group-ID %u, VC-info-length: %u", - tok2str(mpls_pw_types_values, "Unknown", EXTRACT_16BITS(tptr)&0x7fff), - EXTRACT_16BITS(tptr)&0x8000 ? "" : "no ", - EXTRACT_32BITS(tptr+3), + tok2str(mpls_pw_types_values, "Unknown", EXTRACT_BE_16BITS(tptr)&0x7fff), + EXTRACT_BE_16BITS(tptr)&0x8000 ? "" : "no ", + EXTRACT_BE_32BITS(tptr + 3), vc_info_len)); break; } @@ -403,11 +403,11 @@ ldp_tlv_print(netdissect_options *ndo, /* Make sure we have the VC ID as well */ TLV_TCHECK(11); ND_PRINT((ndo, ": %s, %scontrol word, group-ID %u, VC-ID %u, VC-info-length: %u", - tok2str(mpls_pw_types_values, "Unknown", EXTRACT_16BITS(tptr)&0x7fff), - EXTRACT_16BITS(tptr)&0x8000 ? "" : "no ", - EXTRACT_32BITS(tptr+3), - EXTRACT_32BITS(tptr+7), - vc_info_len)); + tok2str(mpls_pw_types_values, "Unknown", EXTRACT_BE_16BITS(tptr)&0x7fff), + EXTRACT_BE_16BITS(tptr)&0x8000 ? "" : "no ", + EXTRACT_BE_32BITS(tptr + 3), + EXTRACT_BE_32BITS(tptr + 7), + vc_info_len)); if (vc_info_len < 4) { /* minimum 4, for the VC ID */ ND_PRINT((ndo, " (invalid, < 4")); @@ -435,7 +435,7 @@ ldp_tlv_print(netdissect_options *ndo, switch(vc_info_tlv_type) { case LDP_FEC_MARTINI_IFPARM_MTU: - ND_PRINT((ndo, ": %u", EXTRACT_16BITS(tptr+2))); + ND_PRINT((ndo, ": %u", EXTRACT_BE_16BITS(tptr + 2))); break; case LDP_FEC_MARTINI_IFPARM_DESC: @@ -468,18 +468,18 @@ ldp_tlv_print(netdissect_options *ndo, case LDP_TLV_GENERIC_LABEL: TLV_TCHECK(4); - ND_PRINT((ndo, "\n\t Label: %u", EXTRACT_32BITS(tptr) & 0xfffff)); + ND_PRINT((ndo, "\n\t Label: %u", EXTRACT_BE_32BITS(tptr) & 0xfffff)); break; case LDP_TLV_STATUS: TLV_TCHECK(8); - ui = EXTRACT_32BITS(tptr); + ui = EXTRACT_BE_32BITS(tptr); tptr+=4; ND_PRINT((ndo, "\n\t Status: 0x%02x, Flags: [%s and %s forward]", ui&0x3fffffff, ui&0x80000000 ? "Fatal error" : "Advisory Notification", ui&0x40000000 ? "do" : "don't")); - ui = EXTRACT_32BITS(tptr); + ui = EXTRACT_BE_32BITS(tptr); tptr+=4; if (ui) ND_PRINT((ndo, ", causing Message ID: 0x%08x", ui)); @@ -487,7 +487,7 @@ ldp_tlv_print(netdissect_options *ndo, case LDP_TLV_FT_SESSION: TLV_TCHECK(8); - ft_flags = EXTRACT_16BITS(tptr); + ft_flags = EXTRACT_BE_16BITS(tptr); ND_PRINT((ndo, "\n\t Flags: [%sReconnect, %sSave State, %sAll-Label Protection, %s Checkpoint, %sRe-Learn State]", ft_flags&0x8000 ? "" : "No ", ft_flags&0x8 ? "" : "Don't ", @@ -495,18 +495,18 @@ ldp_tlv_print(netdissect_options *ndo, ft_flags&0x2 ? "Sequence Numbered Label" : "All Labels", ft_flags&0x1 ? "" : "Don't ")); tptr+=4; - ui = EXTRACT_32BITS(tptr); + ui = EXTRACT_BE_32BITS(tptr); if (ui) ND_PRINT((ndo, ", Reconnect Timeout: %ums", ui)); tptr+=4; - ui = EXTRACT_32BITS(tptr); + ui = EXTRACT_BE_32BITS(tptr); if (ui) ND_PRINT((ndo, ", Recovery Time: %ums", ui)); break; case LDP_TLV_MTU: TLV_TCHECK(2); - ND_PRINT((ndo, "\n\t MTU: %u", EXTRACT_16BITS(tptr))); + ND_PRINT((ndo, "\n\t MTU: %u", EXTRACT_BE_16BITS(tptr))); break; @@ -573,14 +573,14 @@ ldp_pdu_print(netdissect_options *ndo, /* * Sanity checking of the header. */ - if (EXTRACT_16BITS(&ldp_com_header->version) != LDP_VERSION) { + if (EXTRACT_BE_16BITS(&ldp_com_header->version) != LDP_VERSION) { ND_PRINT((ndo, "%sLDP version %u packet not supported", (ndo->ndo_vflag < 1) ? "" : "\n\t", - EXTRACT_16BITS(&ldp_com_header->version))); + EXTRACT_BE_16BITS(&ldp_com_header->version))); return 0; } - pdu_len = EXTRACT_16BITS(&ldp_com_header->pdu_length); + pdu_len = EXTRACT_BE_16BITS(&ldp_com_header->pdu_length); if (pdu_len < sizeof(struct ldp_common_header)-4) { /* length too short */ ND_PRINT((ndo, "%sLDP, pdu-length: %u (too short, < %u)", @@ -594,7 +594,7 @@ ldp_pdu_print(netdissect_options *ndo, ND_PRINT((ndo, "%sLDP, Label-Space-ID: %s:%u, pdu-length: %u", (ndo->ndo_vflag < 1) ? "" : "\n\t", ipaddr_string(ndo, &ldp_com_header->lsr_id), - EXTRACT_16BITS(&ldp_com_header->label_space), + EXTRACT_BE_16BITS(&ldp_com_header->label_space), pdu_len)); /* bail out if non-verbose */ @@ -610,8 +610,8 @@ ldp_pdu_print(netdissect_options *ndo, ND_TCHECK2(*tptr, sizeof(struct ldp_msg_header)); ldp_msg_header = (const struct ldp_msg_header *)tptr; - msg_len=EXTRACT_16BITS(ldp_msg_header->length); - msg_type=LDP_MASK_MSG_TYPE(EXTRACT_16BITS(ldp_msg_header->type)); + msg_len=EXTRACT_BE_16BITS(ldp_msg_header->length); + msg_type=LDP_MASK_MSG_TYPE(EXTRACT_BE_16BITS(ldp_msg_header->type)); if (msg_len < sizeof(struct ldp_msg_header)-4) { /* length too short */ @@ -633,8 +633,8 @@ ldp_pdu_print(netdissect_options *ndo, msg_type), msg_type, msg_len, - EXTRACT_32BITS(&ldp_msg_header->id), - LDP_MASK_U_BIT(EXTRACT_16BITS(&ldp_msg_header->type)) ? "continue processing" : "ignore")); + EXTRACT_BE_32BITS(&ldp_msg_header->id), + LDP_MASK_U_BIT(EXTRACT_BE_16BITS(&ldp_msg_header->type)) ? "continue processing" : "ignore")); msg_tptr=tptr+sizeof(struct ldp_msg_header); msg_tlen=msg_len-(sizeof(struct ldp_msg_header)-4); /* Type & Length fields not included */ diff --git a/print-lisp.c b/print-lisp.c index e5b15077..8d064023 100644 --- a/print-lisp.c +++ b/print-lisp.c @@ -263,13 +263,13 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) xtr_present = is_xtr_data_present(type, lisp_hdr->type_and_flag); /* Extract the number of EID records present */ - auth_data_len = EXTRACT_16BITS(&lisp_hdr->auth_data_len); + auth_data_len = EXTRACT_BE_16BITS(&lisp_hdr->auth_data_len); packet_iterator = (const u_char *)(lisp_hdr); packet_offset = MAP_REGISTER_HDR_LEN; record_count = lisp_hdr->record_count; if (ndo->ndo_vflag) { - key_id = EXTRACT_16BITS(&lisp_hdr->key_id); + key_id = EXTRACT_BE_16BITS(&lisp_hdr->key_id); ND_PRINT((ndo, "\n %u record(s), ", record_count)); ND_PRINT((ndo, "Authentication %s,", tok2str(auth_type, "unknown-type", key_id))); @@ -292,11 +292,11 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) ((const u_char *)lisp_hdr + packet_offset); packet_offset += MAP_REGISTER_EID_LEN; mask_len = lisp_eid->eid_prefix_mask_length; - eid_afi = EXTRACT_16BITS(&lisp_eid->eid_prefix_afi); + eid_afi = EXTRACT_BE_16BITS(&lisp_eid->eid_prefix_afi); loc_count = lisp_eid->locator_count; if (ndo->ndo_vflag) { - ttl = EXTRACT_32BITS(&lisp_eid->ttl); + ttl = EXTRACT_BE_32BITS(&lisp_eid->ttl); ND_PRINT((ndo, " Record TTL %u,", ttl)); action_flag(ndo, lisp_eid->act_auth_inc_res); map_version = (((lisp_eid->reserved_version_hi) & 15 ) * 255) + @@ -332,7 +332,7 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) lisp_loc = (const lisp_map_register_loc *) (packet_iterator + packet_offset); loc_ip_pointer = (const u_char *) (lisp_loc + 1); packet_offset += MAP_REGISTER_LOC_LEN; - loc_afi = EXTRACT_16BITS(&lisp_loc->locator_afi); + loc_afi = EXTRACT_BE_16BITS(&lisp_loc->locator_afi); if (ndo->ndo_vflag) ND_PRINT((ndo, "\n ")); @@ -356,7 +356,8 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) " Multicast Priority/Weight %u/%u,", lisp_loc->priority, lisp_loc->weight, lisp_loc->m_priority, lisp_loc->m_weight)); - loc_hdr_flag(ndo, EXTRACT_16BITS(&lisp_loc->unused_and_flag)); + loc_hdr_flag(ndo, + EXTRACT_BE_16BITS(&lisp_loc->unused_and_flag)); } } } @@ -371,7 +372,7 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) goto invalid; hex_print_with_offset(ndo, "\n xTR-ID: ", packet_iterator + packet_offset, 16, 0); ND_PRINT((ndo, "\n SITE-ID: %" PRIu64, - EXTRACT_64BITS(packet_iterator + packet_offset + 16))); + EXTRACT_BE_64BITS(packet_iterator + packet_offset + 16))); } else { /* Check if packet isn't over yet */ if (packet_iterator + packet_offset < ndo->ndo_snapend) { @@ -418,10 +419,10 @@ static void lisp_hdr_flag(netdissect_options *ndo, const lisp_map_register_hdr * if (type == LISP_MAP_REGISTER) { ND_PRINT((ndo, " flags [%s],", bittok2str(map_register_hdr_flag, - "none", EXTRACT_32BITS(lisp_hdr)))); + "none", EXTRACT_BE_32BITS(lisp_hdr)))); } else if (type == LISP_MAP_NOTIFY) { ND_PRINT((ndo, " flags [%s],", bittok2str(map_notify_hdr_flag, - "none", EXTRACT_32BITS(lisp_hdr)))); + "none", EXTRACT_BE_32BITS(lisp_hdr)))); } return; diff --git a/print-llc.c b/print-llc.c index be8886ab..b3fbef0f 100644 --- a/print-llc.c +++ b/print-llc.c @@ -428,8 +428,8 @@ snap_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, ND_TCHECK2(*p, 5); if (caplen < 5 || length < 5) goto trunc; - orgcode = EXTRACT_24BITS(p); - et = EXTRACT_16BITS(p + 3); + orgcode = EXTRACT_BE_24BITS(p); + et = EXTRACT_BE_16BITS(p + 3); if (ndo->ndo_eflag) { /* diff --git a/print-lldp.c b/print-lldp.c index e87b16bd..f43af3b6 100644 --- a/print-lldp.c +++ b/print-lldp.c @@ -668,22 +668,22 @@ lldp_private_8021_print(netdissect_options *ndo, return hexdump; } ND_PRINT((ndo, "\n\t port vlan id (PVID): %u", - EXTRACT_16BITS(tptr + 4))); + EXTRACT_BE_16BITS(tptr + 4))); break; case LLDP_PRIVATE_8021_SUBTYPE_PROTOCOL_VLAN_ID: if (tlv_len < 7) { return hexdump; } ND_PRINT((ndo, "\n\t port and protocol vlan id (PPVID): %u, flags [%s] (0x%02x)", - EXTRACT_16BITS(tptr+5), - bittok2str(lldp_8021_port_protocol_id_values, "none", *(tptr+4)), + EXTRACT_BE_16BITS(tptr + 5), + bittok2str(lldp_8021_port_protocol_id_values, "none", *(tptr+4)), *(tptr + 4))); break; case LLDP_PRIVATE_8021_SUBTYPE_VLAN_NAME: if (tlv_len < 6) { return hexdump; } - ND_PRINT((ndo, "\n\t vlan id (VID): %u", EXTRACT_16BITS(tptr + 4))); + ND_PRINT((ndo, "\n\t vlan id (VID): %u", EXTRACT_BE_16BITS(tptr + 4))); if (tlv_len < 7) { return hexdump; } @@ -789,7 +789,7 @@ lldp_private_8021_print(netdissect_options *ndo, tval=*(tptr+i+5); ND_PRINT((ndo, "\n\t Priority: %u, RES: %u, Sel: %u, Protocol ID: %u", tval >> 5, (tval >> 3) & 0x03, (tval & 0x07), - EXTRACT_16BITS(tptr + i + 5))); + EXTRACT_BE_16BITS(tptr + i + 5))); i=i+3; } break; @@ -822,14 +822,14 @@ lldp_private_8021_print(netdissect_options *ndo, tval=*(tptr+4); ND_PRINT((ndo, "\n\t Role: %d, RES: %d, Scomp: %d ", tval >> 7, (tval >> 4) & 0x07, (tval >> 3) & 0x01)); - ND_PRINT((ndo, "ChnCap: %d", EXTRACT_16BITS(tptr + 6) & 0x0fff)); + ND_PRINT((ndo, "ChnCap: %d", EXTRACT_BE_16BITS(tptr + 6) & 0x0fff)); sublen=tlv_len-8; if(sublen%3!=0) { return hexdump; } i=0; while(i<sublen) { - tval=EXTRACT_24BITS(tptr+i+8); + tval=EXTRACT_BE_24BITS(tptr + i + 8); ND_PRINT((ndo, "\n\t SCID: %d, SVID: %d", tval >> 12, tval & 0x000fff)); i=i+3; @@ -871,11 +871,11 @@ lldp_private_8023_print(netdissect_options *ndo, bittok2str(lldp_8023_autonegotiation_values, "none", *(tptr+4)), *(tptr + 4))); ND_PRINT((ndo, "\n\t PMD autoneg capability [%s] (0x%04x)", - bittok2str(lldp_pmd_capability_values,"unknown", EXTRACT_16BITS(tptr+5)), - EXTRACT_16BITS(tptr + 5))); + bittok2str(lldp_pmd_capability_values,"unknown", EXTRACT_BE_16BITS(tptr + 5)), + EXTRACT_BE_16BITS(tptr + 5))); ND_PRINT((ndo, "\n\t MAU type %s (0x%04x)", - tok2str(lldp_mau_types_values, "unknown", EXTRACT_16BITS(tptr+7)), - EXTRACT_16BITS(tptr + 7))); + tok2str(lldp_mau_types_values, "unknown", EXTRACT_BE_16BITS(tptr + 7)), + EXTRACT_BE_16BITS(tptr + 7))); break; case LLDP_PRIVATE_8023_SUBTYPE_MDIPOWER: @@ -894,14 +894,14 @@ lldp_private_8023_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t aggregation status [%s], aggregation port ID %u", bittok2str(lldp_aggregation_values, "none", *(tptr+4)), - EXTRACT_32BITS(tptr + 5))); + EXTRACT_BE_32BITS(tptr + 5))); break; case LLDP_PRIVATE_8023_SUBTYPE_MTU: if (tlv_len < 6) { return hexdump; } - ND_PRINT((ndo, "\n\t MTU size %u", EXTRACT_16BITS(tptr + 4))); + ND_PRINT((ndo, "\n\t MTU size %u", EXTRACT_BE_16BITS(tptr + 4))); break; default: @@ -921,7 +921,7 @@ lldp_extract_latlon(const u_char *tptr) uint64_t latlon; latlon = *tptr & 0x3; - latlon = (latlon << 32) | EXTRACT_32BITS(tptr+1); + latlon = (latlon << 32) | EXTRACT_BE_32BITS(tptr + 1); return latlon; } @@ -989,7 +989,7 @@ lldp_private_tia_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t Media capabilities [%s] (0x%04x)", bittok2str(lldp_tia_capabilities_values, "none", - EXTRACT_16BITS(tptr + 4)), EXTRACT_16BITS(tptr + 4))); + EXTRACT_BE_16BITS(tptr + 4)), EXTRACT_BE_16BITS(tptr + 4))); ND_PRINT((ndo, "\n\t Device type [%s] (0x%02x)", tok2str(lldp_tia_device_type_values, "unknown", *(tptr+6)), *(tptr + 6))); @@ -1005,11 +1005,11 @@ lldp_private_tia_print(netdissect_options *ndo, ND_PRINT((ndo, ", Flags [%s]", bittok2str( lldp_tia_network_policy_bits_values, "none", *(tptr + 5)))); ND_PRINT((ndo, "\n\t Vlan id %u", - LLDP_EXTRACT_NETWORK_POLICY_VLAN(EXTRACT_16BITS(tptr + 5)))); + LLDP_EXTRACT_NETWORK_POLICY_VLAN(EXTRACT_BE_16BITS(tptr + 5)))); ND_PRINT((ndo, ", L2 priority %u", - LLDP_EXTRACT_NETWORK_POLICY_L2_PRIORITY(EXTRACT_16BITS(tptr + 6)))); + LLDP_EXTRACT_NETWORK_POLICY_L2_PRIORITY(EXTRACT_BE_16BITS(tptr + 6)))); ND_PRINT((ndo, ", DSCP value %u", - LLDP_EXTRACT_NETWORK_POLICY_DSCP(EXTRACT_16BITS(tptr + 6)))); + LLDP_EXTRACT_NETWORK_POLICY_DSCP(EXTRACT_BE_16BITS(tptr + 6)))); break; case LLDP_PRIVATE_TIA_SUBTYPE_LOCAL_ID: @@ -1034,8 +1034,8 @@ lldp_private_tia_print(netdissect_options *ndo, tok2str(lldp_tia_location_altitude_type_values, "unknown",(*(tptr+15)>>4)), (*(tptr + 15) >> 4))); ND_PRINT((ndo, "\n\t Altitude resolution %u, altitude value 0x%x", - (EXTRACT_16BITS(tptr+15)>>6)&0x3f, - ((EXTRACT_32BITS(tptr + 16) & 0x3fffffff)))); + (EXTRACT_BE_16BITS(tptr + 15)>>6)&0x3f, + ((EXTRACT_BE_32BITS(tptr + 16) & 0x3fffffff)))); ND_PRINT((ndo, "\n\t Datum %s (0x%02x)", tok2str(lldp_tia_location_datum_type_values, "unknown", *(tptr+20)), *(tptr + 20))); @@ -1114,7 +1114,7 @@ lldp_private_tia_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Power priority [%s] (0x%02x)", tok2str(lldp_tia_power_priority_values, "none", *(tptr+4)&0x0f), *(tptr + 4) & 0x0f)); - power_val = EXTRACT_16BITS(tptr+5); + power_val = EXTRACT_BE_16BITS(tptr + 5); if (power_val < LLDP_TIA_POWER_VAL_MAX) { ND_PRINT((ndo, ", Power %.1f Watts", ((float)power_val) / 10)); } else { @@ -1176,7 +1176,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, ND_TCHECK2(*tptr, sizeof(tlv)); - tlv = EXTRACT_16BITS(tptr); + tlv = EXTRACT_BE_16BITS(tptr); tlv_type = LLDP_EXTRACT_TYPE(tlv); tlv_len = LLDP_EXTRACT_LEN(tlv); @@ -1205,9 +1205,9 @@ lldp_private_dcbx_print(netdissect_options *ndo, LLDP_DCBX_CONTROL_TLV, tlv_len)); ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr)); ND_PRINT((ndo, "\n\t Max_Version: %d", *(tptr + 1))); - ND_PRINT((ndo, "\n\t Sequence Number: %d", EXTRACT_32BITS(tptr + 2))); + ND_PRINT((ndo, "\n\t Sequence Number: %d", EXTRACT_BE_32BITS(tptr + 2))); ND_PRINT((ndo, "\n\t Acknowledgement Number: %d", - EXTRACT_32BITS(tptr + 6))); + EXTRACT_BE_32BITS(tptr + 6))); break; case LLDP_DCBX_PRIORITY_GROUPS_TLV: if (tlv_len < 17) { @@ -1229,7 +1229,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, * Array of 8 4-bit priority group ID values; we fetch all * 32 bits and extract each nibble. */ - pgval = EXTRACT_32BITS(tptr+4); + pgval = EXTRACT_BE_32BITS(tptr + 4); for (i = 0; i <= 7; i++) { ND_PRINT((ndo, "\n\t PgId_%d: %d", i, (pgval >> (28 - 4 * i)) & 0xF)); @@ -1280,8 +1280,8 @@ lldp_private_dcbx_print(netdissect_options *ndo, while (tval >= 6) { ND_PRINT((ndo, "\n\t Application Value")); ND_PRINT((ndo, "\n\t Application Protocol ID: 0x%04x", - EXTRACT_16BITS(mptr))); - uval = EXTRACT_24BITS(mptr+2); + EXTRACT_BE_16BITS(mptr))); + uval = EXTRACT_BE_24BITS(mptr + 2); ND_PRINT((ndo, "\n\t SF (0x%x) Application Protocol ID is %s", (uval >> 22), (uval >> 22) ? "Socket Number" : "L2 EtherType")); @@ -1393,7 +1393,7 @@ lldp_mgmt_addr_tlv_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t %s Interface Numbering (%u): %u", tok2str(lldp_intf_numb_subtype_values, "Unknown", intf_num_subtype), intf_num_subtype, - EXTRACT_32BITS(tptr + 1))); + EXTRACT_BE_32BITS(tptr + 1))); tptr += LLDP_INTF_NUM_LEN; tlen -= LLDP_INTF_NUM_LEN; @@ -1435,7 +1435,7 @@ lldp_print(netdissect_options *ndo, ND_TCHECK2(*tptr, sizeof(tlv)); - tlv = EXTRACT_16BITS(tptr); + tlv = EXTRACT_BE_16BITS(tptr); tlv_type = LLDP_EXTRACT_TYPE(tlv); tlv_len = LLDP_EXTRACT_LEN(tlv); @@ -1549,7 +1549,7 @@ lldp_print(netdissect_options *ndo, if (tlv_len < 2) { goto trunc; } - ND_PRINT((ndo, ": TTL %us", EXTRACT_16BITS(tptr))); + ND_PRINT((ndo, ": TTL %us", EXTRACT_BE_16BITS(tptr))); } break; @@ -1587,8 +1587,8 @@ lldp_print(netdissect_options *ndo, if (tlv_len < 4) { goto trunc; } - cap = EXTRACT_16BITS(tptr); - ena_cap = EXTRACT_16BITS(tptr+2); + cap = EXTRACT_BE_16BITS(tptr); + ena_cap = EXTRACT_BE_16BITS(tptr + 2); ND_PRINT((ndo, "\n\t System Capabilities [%s] (0x%04x)", bittok2str(lldp_cap_values, "none", cap), cap)); ND_PRINT((ndo, "\n\t Enabled Capabilities [%s] (0x%04x)", @@ -1609,7 +1609,7 @@ lldp_print(netdissect_options *ndo, if (tlv_len < 3) { goto trunc; } - oui = EXTRACT_24BITS(tptr); + oui = EXTRACT_BE_24BITS(tptr); ND_PRINT((ndo, ": OUI %s (0x%06x)", tok2str(oui_values, "Unknown", oui), oui)); switch (oui) { diff --git a/print-lmp.c b/print-lmp.c index 5b7c0344..d8d9540e 100644 --- a/print-lmp.c +++ b/print-lmp.c @@ -399,16 +399,16 @@ lmp_print_data_link_subobjs(netdissect_options *ndo, const u_char *obj_tptr, "Unknown", EXTRACT_8BITS(obj_tptr + offset + 3)), EXTRACT_8BITS(obj_tptr + offset + 3))); - bw.i = EXTRACT_32BITS(obj_tptr+offset+4); + bw.i = EXTRACT_BE_32BITS(obj_tptr + offset + 4); ND_PRINT((ndo, "\n\t Min Reservable Bandwidth: %.3f Mbps", bw.f*8/1000000)); - bw.i = EXTRACT_32BITS(obj_tptr+offset+8); + bw.i = EXTRACT_BE_32BITS(obj_tptr + offset + 8); ND_PRINT((ndo, "\n\t Max Reservable Bandwidth: %.3f Mbps", bw.f*8/1000000)); break; case WAVELENGTH_SUBOBJ: ND_PRINT((ndo, "\n\t Wavelength: %u", - EXTRACT_32BITS(obj_tptr+offset+4))); + EXTRACT_BE_32BITS(obj_tptr + offset + 4))); break; default: /* Any Unknown Subobject ==> Exit loop */ @@ -462,7 +462,7 @@ lmp_print(netdissect_options *ndo, /* ok they seem to want to know everything - lets fully decode it */ - tlen=EXTRACT_16BITS(lmp_com_header->length); + tlen=EXTRACT_BE_16BITS(lmp_com_header->length); ND_PRINT((ndo, "\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u", LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]), @@ -486,7 +486,7 @@ lmp_print(netdissect_options *ndo, ND_TCHECK2(*tptr, sizeof(struct lmp_object_header)); lmp_obj_header = (const struct lmp_object_header *)tptr; - lmp_obj_len=EXTRACT_16BITS(lmp_obj_header->length); + lmp_obj_len=EXTRACT_BE_16BITS(lmp_obj_header->length); lmp_obj_ctype=(lmp_obj_header->ctype)&0x7f; ND_PRINT((ndo, "\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u", @@ -528,8 +528,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Control Channel ID: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr), - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr), + EXTRACT_BE_32BITS(obj_tptr))); break; default: @@ -548,7 +548,7 @@ lmp_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t IPv4 Link ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr), - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr))); break; case LMP_CTYPE_IPV6_LOC: case LMP_CTYPE_IPV6_RMT: @@ -558,7 +558,7 @@ lmp_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t IPv6 Link ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr), - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr))); break; case LMP_CTYPE_UNMD_LOC: case LMP_CTYPE_UNMD_RMT: @@ -567,8 +567,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Link ID: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr), - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr), + EXTRACT_BE_32BITS(obj_tptr))); break; default: hexdump=TRUE; @@ -583,8 +583,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Message ID: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr), - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr), + EXTRACT_BE_32BITS(obj_tptr))); break; case LMP_CTYPE_2: if (obj_tlen != 4) { @@ -592,8 +592,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Message ID Ack: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr), - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr), + EXTRACT_BE_32BITS(obj_tptr))); break; default: hexdump=TRUE; @@ -610,7 +610,7 @@ lmp_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t Node ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr), - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr))); break; default: @@ -626,8 +626,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Hello Interval: %u\n\t Hello Dead Interval: %u", - EXTRACT_16BITS(obj_tptr), - EXTRACT_16BITS(obj_tptr+2))); + EXTRACT_BE_16BITS(obj_tptr), + EXTRACT_BE_16BITS(obj_tptr + 2))); break; default: @@ -643,8 +643,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Tx Seq: %u, Rx Seq: %u", - EXTRACT_32BITS(obj_tptr), - EXTRACT_32BITS(obj_tptr+4))); + EXTRACT_BE_32BITS(obj_tptr), + EXTRACT_BE_32BITS(obj_tptr + 4))); break; default: @@ -667,9 +667,9 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)" "\n\t Remote Link-ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+4), - EXTRACT_32BITS(obj_tptr+4), + EXTRACT_BE_32BITS(obj_tptr + 4), ipaddr_string(ndo, obj_tptr+8), - EXTRACT_32BITS(obj_tptr+8))); + EXTRACT_BE_32BITS(obj_tptr + 8))); break; case LMP_CTYPE_IPV6: @@ -685,9 +685,9 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)" "\n\t Remote Link-ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr+4), - EXTRACT_32BITS(obj_tptr+4), + EXTRACT_BE_32BITS(obj_tptr + 4), ip6addr_string(ndo, obj_tptr+20), - EXTRACT_32BITS(obj_tptr+20))); + EXTRACT_BE_32BITS(obj_tptr + 20))); break; case LMP_CTYPE_UNMD: @@ -702,10 +702,10 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Local Link-ID: %u (0x%08x)" "\n\t Remote Link-ID: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr+4), - EXTRACT_32BITS(obj_tptr+4), - EXTRACT_32BITS(obj_tptr+8), - EXTRACT_32BITS(obj_tptr+8))); + EXTRACT_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_32BITS(obj_tptr + 8), + EXTRACT_BE_32BITS(obj_tptr + 8))); break; default: @@ -727,9 +727,9 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)" "\n\t Remote Interface ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+4), - EXTRACT_32BITS(obj_tptr+4), + EXTRACT_BE_32BITS(obj_tptr + 4), ipaddr_string(ndo, obj_tptr+8), - EXTRACT_32BITS(obj_tptr+8))); + EXTRACT_BE_32BITS(obj_tptr + 8))); if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12)) hexdump=TRUE; @@ -747,9 +747,9 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)" "\n\t Remote Interface ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr+4), - EXTRACT_32BITS(obj_tptr+4), + EXTRACT_BE_32BITS(obj_tptr + 4), ip6addr_string(ndo, obj_tptr+20), - EXTRACT_32BITS(obj_tptr+20))); + EXTRACT_BE_32BITS(obj_tptr + 20))); if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 36, 36)) hexdump=TRUE; @@ -766,10 +766,10 @@ lmp_print(netdissect_options *ndo, EXTRACT_8BITS(obj_tptr)))); ND_PRINT((ndo, "\n\t Local Interface ID: %u (0x%08x)" "\n\t Remote Interface ID: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr+4), - EXTRACT_32BITS(obj_tptr+4), - EXTRACT_32BITS(obj_tptr+8), - EXTRACT_32BITS(obj_tptr+8))); + EXTRACT_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_32BITS(obj_tptr + 8), + EXTRACT_BE_32BITS(obj_tptr + 8))); if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12)) hexdump=TRUE; @@ -790,21 +790,21 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: %s", bittok2str(lmp_obj_begin_verify_flag_values, "none", - EXTRACT_16BITS(obj_tptr)))); + EXTRACT_BE_16BITS(obj_tptr)))); ND_PRINT((ndo, "\n\t Verify Interval: %u", - EXTRACT_16BITS(obj_tptr+2))); + EXTRACT_BE_16BITS(obj_tptr + 2))); ND_PRINT((ndo, "\n\t Data links: %u", - EXTRACT_32BITS(obj_tptr+4))); + EXTRACT_BE_32BITS(obj_tptr + 4))); ND_PRINT((ndo, "\n\t Encoding type: %s", tok2str(gmpls_encoding_values, "Unknown", *(obj_tptr+8)))); ND_PRINT((ndo, "\n\t Verify Transport Mechanism: %u (0x%x)%s", - EXTRACT_16BITS(obj_tptr+10), - EXTRACT_16BITS(obj_tptr+10), - EXTRACT_16BITS(obj_tptr+10)&8000 ? " (Payload test messages capable)" : "")); - bw.i = EXTRACT_32BITS(obj_tptr+12); + EXTRACT_BE_16BITS(obj_tptr + 10), + EXTRACT_BE_16BITS(obj_tptr + 10), + EXTRACT_BE_16BITS(obj_tptr + 10)&8000 ? " (Payload test messages capable)" : "")); + bw.i = EXTRACT_BE_32BITS(obj_tptr + 12); ND_PRINT((ndo, "\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000)); ND_PRINT((ndo, "\n\t Wavelength: %u", - EXTRACT_32BITS(obj_tptr+16))); + EXTRACT_BE_32BITS(obj_tptr + 16))); break; default: @@ -821,8 +821,8 @@ lmp_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t Verify Dead Interval: %u" "\n\t Verify Transport Response: %u", - EXTRACT_16BITS(obj_tptr), - EXTRACT_16BITS(obj_tptr+2))); + EXTRACT_BE_16BITS(obj_tptr), + EXTRACT_BE_16BITS(obj_tptr + 2))); break; default: @@ -838,7 +838,7 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Verify ID: %u", - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr))); break; default: @@ -854,23 +854,23 @@ lmp_print(netdissect_options *ndo, while (offset+8 <= obj_tlen) { ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+offset), - EXTRACT_32BITS(obj_tptr+offset))); + EXTRACT_BE_32BITS(obj_tptr + offset))); ND_PRINT((ndo, "\n\t\t Active: %s (%u)", - (EXTRACT_32BITS(obj_tptr+offset+4)>>31) ? - "Allocated" : "Non-allocated", - (EXTRACT_32BITS(obj_tptr+offset+4)>>31))); + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31) ? + "Allocated" : "Non-allocated", + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31))); ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", - (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ? - "Transmit" : "Receive", - (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1)); + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1 ? + "Transmit" : "Receive", + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1)); ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)", tok2str(lmp_obj_channel_status_values, "Unknown", - EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF), - EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF)); + EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF), + EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF)); offset+=8; } break; @@ -881,23 +881,23 @@ lmp_print(netdissect_options *ndo, while (offset+20 <= obj_tlen) { ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr+offset), - EXTRACT_32BITS(obj_tptr+offset))); + EXTRACT_BE_32BITS(obj_tptr + offset))); ND_PRINT((ndo, "\n\t\t Active: %s (%u)", - (EXTRACT_32BITS(obj_tptr+offset+16)>>31) ? - "Allocated" : "Non-allocated", - (EXTRACT_32BITS(obj_tptr+offset+16)>>31))); + (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>31) ? + "Allocated" : "Non-allocated", + (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>31))); ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", - (EXTRACT_32BITS(obj_tptr+offset+16)>>30)&0x1 ? - "Transmit" : "Receive", - (EXTRACT_32BITS(obj_tptr+offset+16)>>30)&0x1)); + (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>30)&0x1 ? + "Transmit" : "Receive", + (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>30)&0x1)); ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)", tok2str(lmp_obj_channel_status_values, "Unknown", - EXTRACT_32BITS(obj_tptr+offset+16)&0x3FFFFFF), - EXTRACT_32BITS(obj_tptr+offset+16)&0x3FFFFFF)); + EXTRACT_BE_32BITS(obj_tptr + offset + 16)&0x3FFFFFF), + EXTRACT_BE_32BITS(obj_tptr + offset + 16)&0x3FFFFFF)); offset+=20; } break; @@ -907,24 +907,24 @@ lmp_print(netdissect_options *ndo, /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */ while (offset+8 <= obj_tlen) { ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr+offset), - EXTRACT_32BITS(obj_tptr+offset))); + EXTRACT_BE_32BITS(obj_tptr + offset), + EXTRACT_BE_32BITS(obj_tptr + offset))); ND_PRINT((ndo, "\n\t\t Active: %s (%u)", - (EXTRACT_32BITS(obj_tptr+offset+4)>>31) ? - "Allocated" : "Non-allocated", - (EXTRACT_32BITS(obj_tptr+offset+4)>>31))); + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31) ? + "Allocated" : "Non-allocated", + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31))); ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", - (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ? - "Transmit" : "Receive", - (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1)); + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1 ? + "Transmit" : "Receive", + (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1)); ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)", tok2str(lmp_obj_channel_status_values, "Unknown", - EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF), - EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF)); + EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF), + EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF)); offset+=8; } break; @@ -941,7 +941,7 @@ lmp_print(netdissect_options *ndo, while (offset+4 <= obj_tlen) { ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+offset), - EXTRACT_32BITS(obj_tptr+offset))); + EXTRACT_BE_32BITS(obj_tptr + offset))); offset+=4; } break; @@ -951,7 +951,7 @@ lmp_print(netdissect_options *ndo, while (offset+16 <= obj_tlen) { ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr+offset), - EXTRACT_32BITS(obj_tptr+offset))); + EXTRACT_BE_32BITS(obj_tptr + offset))); offset+=16; } break; @@ -960,8 +960,8 @@ lmp_print(netdissect_options *ndo, offset = 0; while (offset+4 <= obj_tlen) { ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)", - EXTRACT_32BITS(obj_tptr+offset), - EXTRACT_32BITS(obj_tptr+offset))); + EXTRACT_BE_32BITS(obj_tptr + offset), + EXTRACT_BE_32BITS(obj_tptr + offset))); offset+=4; } break; @@ -981,7 +981,7 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Error Code: %s", bittok2str(lmp_obj_begin_verify_error_values, "none", - EXTRACT_32BITS(obj_tptr)))); + EXTRACT_BE_32BITS(obj_tptr)))); break; case LMP_CTYPE_LINK_SUMMARY_ERROR: @@ -992,7 +992,7 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Error Code: %s", bittok2str(lmp_obj_link_summary_error_values, "none", - EXTRACT_32BITS(obj_tptr)))); + EXTRACT_BE_32BITS(obj_tptr)))); break; default: hexdump=TRUE; @@ -1058,20 +1058,20 @@ lmp_print(netdissect_options *ndo, EXTRACT_8BITS(obj_tptr + 3)))); ND_PRINT((ndo, "\n\t Minimum NCC: %u", - EXTRACT_16BITS(obj_tptr+4))); + EXTRACT_BE_16BITS(obj_tptr + 4))); ND_PRINT((ndo, "\n\t Maximum NCC: %u", - EXTRACT_16BITS(obj_tptr+6))); + EXTRACT_BE_16BITS(obj_tptr + 6))); ND_PRINT((ndo, "\n\t Minimum NVC:%u", - EXTRACT_16BITS(obj_tptr+8))); + EXTRACT_BE_16BITS(obj_tptr + 8))); ND_PRINT((ndo, "\n\t Maximum NVC:%u", - EXTRACT_16BITS(obj_tptr+10))); + EXTRACT_BE_16BITS(obj_tptr + 10))); ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+12), - EXTRACT_32BITS(obj_tptr+12))); + EXTRACT_BE_32BITS(obj_tptr + 12))); break; @@ -1085,7 +1085,7 @@ lmp_print(netdissect_options *ndo, bittok2str( lmp_obj_service_config_nsa_transparency_flag_values, "none", - EXTRACT_32BITS(obj_tptr)))); + EXTRACT_BE_32BITS(obj_tptr)))); ND_PRINT((ndo, "\n\t TCM Monitoring Flags: %s", bittok2str( diff --git a/print-lspping.c b/print-lspping.c index cd006524..d4f09124 100644 --- a/print-lspping.c +++ b/print-lspping.c @@ -530,18 +530,18 @@ lspping_print(netdissect_options *ndo, /* * Sanity checking of the header. */ - if (EXTRACT_16BITS(&lspping_com_header->version[0]) != LSPPING_VERSION) { + if (EXTRACT_BE_16BITS(&lspping_com_header->version[0]) != LSPPING_VERSION) { ND_PRINT((ndo, "LSP-PING version %u packet not supported", - EXTRACT_16BITS(&lspping_com_header->version[0]))); + EXTRACT_BE_16BITS(&lspping_com_header->version[0]))); return; } /* in non-verbose mode just lets print the basic Message Type*/ if (ndo->ndo_vflag < 1) { ND_PRINT((ndo, "LSP-PINGv%u, %s, seq %u, length: %u", - EXTRACT_16BITS(&lspping_com_header->version[0]), + EXTRACT_BE_16BITS(&lspping_com_header->version[0]), tok2str(lspping_msg_type_values, "unknown (%u)",lspping_com_header->msg_type), - EXTRACT_32BITS(lspping_com_header->seq_number), + EXTRACT_BE_32BITS(lspping_com_header->seq_number), len)); return; } @@ -551,7 +551,7 @@ lspping_print(netdissect_options *ndo, tlen=len; ND_PRINT((ndo, "\n\tLSP-PINGv%u, msg-type: %s (%u), length: %u\n\t reply-mode: %s (%u)", - EXTRACT_16BITS(&lspping_com_header->version[0]), + EXTRACT_BE_16BITS(&lspping_com_header->version[0]), tok2str(lspping_msg_type_values, "unknown",lspping_com_header->msg_type), lspping_com_header->msg_type, len, @@ -580,16 +580,16 @@ lspping_print(netdissect_options *ndo, lspping_com_header->return_subcode)); ND_PRINT((ndo, "\n\t Sender Handle: 0x%08x, Sequence: %u", - EXTRACT_32BITS(lspping_com_header->sender_handle), - EXTRACT_32BITS(lspping_com_header->seq_number))); + EXTRACT_BE_32BITS(lspping_com_header->sender_handle), + EXTRACT_BE_32BITS(lspping_com_header->seq_number))); - timestamp.tv_sec=EXTRACT_32BITS(lspping_com_header->ts_sent_sec); - timestamp.tv_usec=EXTRACT_32BITS(lspping_com_header->ts_sent_usec); + timestamp.tv_sec=EXTRACT_BE_32BITS(lspping_com_header->ts_sent_sec); + timestamp.tv_usec=EXTRACT_BE_32BITS(lspping_com_header->ts_sent_usec); ND_PRINT((ndo, "\n\t Sender Timestamp: ")); ts_print(ndo, ×tamp); - timestamp.tv_sec=EXTRACT_32BITS(lspping_com_header->ts_rcvd_sec); - timestamp.tv_usec=EXTRACT_32BITS(lspping_com_header->ts_rcvd_usec); + timestamp.tv_sec=EXTRACT_BE_32BITS(lspping_com_header->ts_rcvd_sec); + timestamp.tv_usec=EXTRACT_BE_32BITS(lspping_com_header->ts_rcvd_usec); ND_PRINT((ndo, "Receiver Timestamp: ")); if ((timestamp.tv_sec != 0) && (timestamp.tv_usec != 0)) ts_print(ndo, ×tamp); @@ -608,8 +608,8 @@ lspping_print(netdissect_options *ndo, ND_TCHECK2(*tptr, sizeof(struct lspping_tlv_header)); lspping_tlv_header = (const struct lspping_tlv_header *)tptr; - lspping_tlv_type=EXTRACT_16BITS(lspping_tlv_header->type); - lspping_tlv_len=EXTRACT_16BITS(lspping_tlv_header->length); + lspping_tlv_type=EXTRACT_BE_16BITS(lspping_tlv_header->type); + lspping_tlv_len=EXTRACT_BE_16BITS(lspping_tlv_header->length); ND_PRINT((ndo, "\n\t %s TLV (%u), length: %u", tok2str(lspping_tlv_values, @@ -649,8 +649,8 @@ lspping_print(netdissect_options *ndo, subtlv_hexdump=FALSE; lspping_subtlv_header = (const struct lspping_tlv_header *)tlv_tptr; - lspping_subtlv_type=EXTRACT_16BITS(lspping_subtlv_header->type); - lspping_subtlv_len=EXTRACT_16BITS(lspping_subtlv_header->length); + lspping_subtlv_type=EXTRACT_BE_16BITS(lspping_subtlv_header->type); + lspping_subtlv_len=EXTRACT_BE_16BITS(lspping_subtlv_header->length); subtlv_tptr=tlv_tptr+sizeof(struct lspping_tlv_header); /* Does the subTLV go past the end of the TLV? */ @@ -740,8 +740,8 @@ lspping_print(netdissect_options *ndo, "\n\t tunnel-id 0x%04x, extended tunnel-id %s", ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_endpoint), ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_sender), - EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->lsp_id), - EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_id), + EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->lsp_id), + EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_id), ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->extended_tunnel_id))); } break; @@ -758,8 +758,8 @@ lspping_print(netdissect_options *ndo, "\n\t tunnel-id 0x%04x, extended tunnel-id %s", ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_endpoint), ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_sender), - EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->lsp_id), - EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_id), + EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->lsp_id), + EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_id), ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->extended_tunnel_id))); } break; @@ -805,12 +805,12 @@ lspping_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t RD: %s, Sender VE ID: %u, Receiver VE ID: %u" \ "\n\t Encapsulation Type: %s (%u)", bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->rd), - EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->sender_ve_id), - EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->receiver_ve_id), + EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->sender_ve_id), + EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->receiver_ve_id), tok2str(mpls_pw_types_values, "unknown", - EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)), - EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation))); + EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)), + EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation))); } break; @@ -826,11 +826,11 @@ lspping_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Remote PE: %s" \ "\n\t PW ID: 0x%08x, PW Type: %s (%u)", ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->remote_pe_address), - EXTRACT_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_id), + EXTRACT_BE_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_id), tok2str(mpls_pw_types_values, "unknown", - EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type)), - EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type))); + EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type)), + EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type))); } break; @@ -846,11 +846,11 @@ lspping_print(netdissect_options *ndo, "\n\t PW ID: 0x%08x, PW Type: %s (%u)", ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->sender_pe_address), ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->remote_pe_address), - EXTRACT_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_id), + EXTRACT_BE_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_id), tok2str(mpls_pw_types_values, "unknown", - EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type)), - EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type))); + EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type)), + EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type))); } break; @@ -896,7 +896,7 @@ lspping_print(netdissect_options *ndo, * we find the address-type, we recast the tlv_tptr and move on. */ ND_PRINT((ndo, "\n\t MTU: %u, Address-Type: %s (%u)", - EXTRACT_16BITS(tlv_ptr.lspping_tlv_downstream_map->mtu), + EXTRACT_BE_16BITS(tlv_ptr.lspping_tlv_downstream_map->mtu), tok2str(lspping_tlv_downstream_addr_values, "unknown", tlv_ptr.lspping_tlv_downstream_map->address_type), @@ -938,7 +938,7 @@ lspping_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Downstream IP: %s" \ "\n\t Downstream Interface Index: 0x%08x", ipaddr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv4_unmb->downstream_ip), - EXTRACT_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4_unmb->downstream_interface))); + EXTRACT_BE_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4_unmb->downstream_interface))); tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv4_unmb_t); tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv4_unmb_t); break; @@ -976,7 +976,7 @@ lspping_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Downstream IP: %s" \ "\n\t Downstream Interface Index: 0x%08x", ip6addr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv6_unmb->downstream_ip), - EXTRACT_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv6_unmb->downstream_interface))); + EXTRACT_BE_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv6_unmb->downstream_interface))); tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv6_unmb_t); tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv6_unmb_t); break; @@ -1016,7 +1016,7 @@ lspping_print(netdissect_options *ndo, goto tlv_tooshort; } else { ND_TCHECK2(*tptr, LSPPING_TLV_BFD_DISCRIMINATOR_LEN); - ND_PRINT((ndo, "\n\t BFD Discriminator 0x%08x", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "\n\t BFD Discriminator 0x%08x", EXTRACT_BE_32BITS(tptr))); } break; @@ -1030,7 +1030,7 @@ lspping_print(netdissect_options *ndo, goto tlv_tooshort; } else { ND_TCHECK2(*tptr, LSPPING_TLV_VENDOR_ENTERPRISE_LEN); - vendor_id = EXTRACT_32BITS(tlv_tptr); + vendor_id = EXTRACT_BE_32BITS(tlv_tptr); ND_PRINT((ndo, "\n\t Vendor: %s (0x%04x)", tok2str(smi_values, "Unknown", vendor_id), vendor_id)); diff --git a/print-lwapp.c b/print-lwapp.c index c4393338..e4a01c81 100644 --- a/print-lwapp.c +++ b/print-lwapp.c @@ -202,7 +202,7 @@ lwapp_control_print(netdissect_options *ndo, } /* ok they seem to want to know everything - lets fully decode it */ - tlen=EXTRACT_16BITS(lwapp_trans_header->length); + tlen=EXTRACT_BE_16BITS(lwapp_trans_header->length); ND_PRINT((ndo, "LWAPPv%u, %s frame, Radio-id %u, Flags [%s], Frag-id %u, length %u", LWAPP_EXTRACT_VERSION(lwapp_trans_header->version), @@ -225,7 +225,7 @@ lwapp_control_print(netdissect_options *ndo, ND_TCHECK2(*tptr, sizeof(struct lwapp_control_header)); lwapp_control_header = (const struct lwapp_control_header *)tptr; - msg_tlen = EXTRACT_16BITS(lwapp_control_header->len); + msg_tlen = EXTRACT_BE_16BITS(lwapp_control_header->len); /* print message header */ ND_PRINT((ndo, "\n\t Msg type: %s (%u), Seqnum: %u, Msg len: %d, Session: 0x%08x", @@ -233,7 +233,7 @@ lwapp_control_print(netdissect_options *ndo, lwapp_control_header->msg_type, lwapp_control_header->seq_num, msg_tlen, - EXTRACT_32BITS(lwapp_control_header->session_id))); + EXTRACT_BE_32BITS(lwapp_control_header->session_id))); /* did we capture enough for fully decoding the message */ ND_TCHECK2(*tptr, msg_tlen); @@ -319,7 +319,7 @@ lwapp_data_print(netdissect_options *ndo, } /* ok they seem to want to know everything - lets fully decode it */ - tlen=EXTRACT_16BITS(lwapp_trans_header->length); + tlen=EXTRACT_BE_16BITS(lwapp_trans_header->length); ND_PRINT((ndo, "LWAPPv%u, %s frame, Radio-id %u, Flags [%s], Frag-id %u, length %u", LWAPP_EXTRACT_VERSION(lwapp_trans_header->version), diff --git a/print-lwres.c b/print-lwres.c index ae352807..2510ae81 100644 --- a/print-lwres.c +++ b/print-lwres.c @@ -216,7 +216,7 @@ lwres_printnamelen(netdissect_options *ndo, if (p + 2 > (const char *)ndo->ndo_snapend) goto trunc; - l = EXTRACT_16BITS(p); + l = EXTRACT_BE_16BITS(p); advance = lwres_printname(ndo, l, p + 2); if (advance < 0) goto trunc; @@ -237,7 +237,7 @@ lwres_printbinlen(netdissect_options *ndo, p = p0; if (p + 2 > (const char *)ndo->ndo_snapend) goto trunc; - l = EXTRACT_16BITS(p); + l = EXTRACT_BE_16BITS(p); if (p + 2 + l > (const char *)ndo->ndo_snapend) goto trunc; p += 2; @@ -258,12 +258,12 @@ lwres_printaddr(netdissect_options *ndo, int i; ND_TCHECK(ap->length); - l = EXTRACT_16BITS(&ap->length); + l = EXTRACT_BE_16BITS(&ap->length); /* XXX ap points to packed struct */ p = (const char *)&ap->length + sizeof(ap->length); ND_TCHECK2(*p, l); - switch (EXTRACT_32BITS(&ap->family)) { + switch (EXTRACT_BE_32BITS(&ap->family)) { case 1: /* IPv4 */ if (l < 4) return -1; @@ -277,7 +277,7 @@ lwres_printaddr(netdissect_options *ndo, p += sizeof(struct in6_addr); break; default: - ND_PRINT((ndo, " %u/", EXTRACT_32BITS(&ap->family))); + ND_PRINT((ndo, " %u/", EXTRACT_BE_32BITS(&ap->family))); for (i = 0; i < l; i++) ND_PRINT((ndo, "%02x", *p++)); } @@ -303,35 +303,35 @@ lwres_print(netdissect_options *ndo, ND_TCHECK(np->authlength); ND_PRINT((ndo, " lwres")); - v = EXTRACT_16BITS(&np->version); + v = EXTRACT_BE_16BITS(&np->version); if (ndo->ndo_vflag || v != LWRES_LWPACKETVERSION_0) ND_PRINT((ndo, " v%u", v)); if (v != LWRES_LWPACKETVERSION_0) { - s = (const char *)np + EXTRACT_32BITS(&np->length); + s = (const char *)np + EXTRACT_BE_32BITS(&np->length); goto tail; } - response = EXTRACT_16BITS(&np->pktflags) & LWRES_LWPACKETFLAG_RESPONSE; + response = EXTRACT_BE_16BITS(&np->pktflags) & LWRES_LWPACKETFLAG_RESPONSE; /* opcode and pktflags */ - v = EXTRACT_32BITS(&np->opcode); + v = EXTRACT_BE_32BITS(&np->opcode); s = tok2str(opcode, "#0x%x", v); ND_PRINT((ndo, " %s%s", s, response ? "" : "?")); /* pktflags */ - v = EXTRACT_16BITS(&np->pktflags); + v = EXTRACT_BE_16BITS(&np->pktflags); if (v & ~LWRES_LWPACKETFLAG_RESPONSE) ND_PRINT((ndo, "[0x%x]", v)); if (ndo->ndo_vflag > 1) { ND_PRINT((ndo, " (")); /*)*/ - ND_PRINT((ndo, "serial:0x%x", EXTRACT_32BITS(&np->serial))); - ND_PRINT((ndo, " result:0x%x", EXTRACT_32BITS(&np->result))); - ND_PRINT((ndo, " recvlen:%u", EXTRACT_32BITS(&np->recvlength))); + ND_PRINT((ndo, "serial:0x%x", EXTRACT_BE_32BITS(&np->serial))); + ND_PRINT((ndo, " result:0x%x", EXTRACT_BE_32BITS(&np->result))); + ND_PRINT((ndo, " recvlen:%u", EXTRACT_BE_32BITS(&np->recvlength))); /* BIND910: not used */ if (ndo->ndo_vflag > 2) { - ND_PRINT((ndo, " authtype:0x%x", EXTRACT_16BITS(&np->authtype))); - ND_PRINT((ndo, " authlen:%u", EXTRACT_16BITS(&np->authlength))); + ND_PRINT((ndo, " authtype:0x%x", EXTRACT_BE_16BITS(&np->authtype))); + ND_PRINT((ndo, " authlen:%u", EXTRACT_BE_16BITS(&np->authlength))); } /*(*/ ND_PRINT((ndo, ")")); @@ -351,7 +351,7 @@ lwres_print(netdissect_options *ndo, gnba = NULL; grbn = NULL; - switch (EXTRACT_32BITS(&np->opcode)) { + switch (EXTRACT_BE_32BITS(&np->opcode)) { case LWRES_OPCODE_NOOP: break; case LWRES_OPCODE_GETADDRSBYNAME: @@ -360,15 +360,15 @@ lwres_print(netdissect_options *ndo, /* XXX gabn points to packed struct */ s = (const char *)&gabn->namelen + sizeof(gabn->namelen); - l = EXTRACT_16BITS(&gabn->namelen); + l = EXTRACT_BE_16BITS(&gabn->namelen); /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT((ndo, " flags:0x%x", - EXTRACT_32BITS(&gabn->flags))); + EXTRACT_BE_32BITS(&gabn->flags))); } - v = EXTRACT_32BITS(&gabn->addrtypes); + v = EXTRACT_BE_32BITS(&gabn->addrtypes); switch (v & (LWRES_ADDRTYPE_V4 | LWRES_ADDRTYPE_V6)) { case LWRES_ADDRTYPE_V4: ND_PRINT((ndo, " IPv4")); @@ -395,7 +395,7 @@ lwres_print(netdissect_options *ndo, /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT((ndo, " flags:0x%x", - EXTRACT_32BITS(&gnba->flags))); + EXTRACT_BE_32BITS(&gnba->flags))); } s = (const char *)&gnba->addr; @@ -413,20 +413,20 @@ lwres_print(netdissect_options *ndo, /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT((ndo, " flags:0x%x", - EXTRACT_32BITS(&grbn->flags))); + EXTRACT_BE_32BITS(&grbn->flags))); } ND_PRINT((ndo, " %s", tok2str(ns_type2str, "Type%d", - EXTRACT_16BITS(&grbn->rdtype)))); - if (EXTRACT_16BITS(&grbn->rdclass) != C_IN) { + EXTRACT_BE_16BITS(&grbn->rdtype)))); + if (EXTRACT_BE_16BITS(&grbn->rdclass) != C_IN) { ND_PRINT((ndo, " %s", tok2str(ns_class2str, "Class%d", - EXTRACT_16BITS(&grbn->rdclass)))); + EXTRACT_BE_16BITS(&grbn->rdclass)))); } /* XXX grbn points to packed struct */ s = (const char *)&grbn->namelen + sizeof(grbn->namelen); - l = EXTRACT_16BITS(&grbn->namelen); + l = EXTRACT_BE_16BITS(&grbn->namelen); advance = lwres_printname(ndo, l, s); if (advance < 0) @@ -451,7 +451,7 @@ lwres_print(netdissect_options *ndo, gnba = NULL; grbn = NULL; - switch (EXTRACT_32BITS(&np->opcode)) { + switch (EXTRACT_BE_32BITS(&np->opcode)) { case LWRES_OPCODE_NOOP: break; case LWRES_OPCODE_GETADDRSBYNAME: @@ -460,16 +460,16 @@ lwres_print(netdissect_options *ndo, /* XXX gabn points to packed struct */ s = (const char *)&gabn->realnamelen + sizeof(gabn->realnamelen); - l = EXTRACT_16BITS(&gabn->realnamelen); + l = EXTRACT_BE_16BITS(&gabn->realnamelen); /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT((ndo, " flags:0x%x", - EXTRACT_32BITS(&gabn->flags))); + EXTRACT_BE_32BITS(&gabn->flags))); } - ND_PRINT((ndo, " %u/%u", EXTRACT_16BITS(&gabn->naliases), - EXTRACT_16BITS(&gabn->naddrs))); + ND_PRINT((ndo, " %u/%u", EXTRACT_BE_16BITS(&gabn->naliases), + EXTRACT_BE_16BITS(&gabn->naddrs))); advance = lwres_printname(ndo, l, s); if (advance < 0) @@ -477,7 +477,7 @@ lwres_print(netdissect_options *ndo, s += advance; /* aliases */ - na = EXTRACT_16BITS(&gabn->naliases); + na = EXTRACT_BE_16BITS(&gabn->naliases); for (i = 0; i < na; i++) { advance = lwres_printnamelen(ndo, s); if (advance < 0) @@ -486,7 +486,7 @@ lwres_print(netdissect_options *ndo, } /* addrs */ - na = EXTRACT_16BITS(&gabn->naddrs); + na = EXTRACT_BE_16BITS(&gabn->naddrs); for (i = 0; i < na; i++) { advance = lwres_printaddr(ndo, (const lwres_addr_t *)s); if (advance < 0) @@ -500,15 +500,15 @@ lwres_print(netdissect_options *ndo, /* XXX gnba points to packed struct */ s = (const char *)&gnba->realnamelen + sizeof(gnba->realnamelen); - l = EXTRACT_16BITS(&gnba->realnamelen); + l = EXTRACT_BE_16BITS(&gnba->realnamelen); /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT((ndo, " flags:0x%x", - EXTRACT_32BITS(&gnba->flags))); + EXTRACT_BE_32BITS(&gnba->flags))); } - ND_PRINT((ndo, " %u", EXTRACT_16BITS(&gnba->naliases))); + ND_PRINT((ndo, " %u", EXTRACT_BE_16BITS(&gnba->naliases))); advance = lwres_printname(ndo, l, s); if (advance < 0) @@ -516,7 +516,7 @@ lwres_print(netdissect_options *ndo, s += advance; /* aliases */ - na = EXTRACT_16BITS(&gnba->naliases); + na = EXTRACT_BE_16BITS(&gnba->naliases); for (i = 0; i < na; i++) { advance = lwres_printnamelen(ndo, s); if (advance < 0) @@ -532,19 +532,20 @@ lwres_print(netdissect_options *ndo, /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT((ndo, " flags:0x%x", - EXTRACT_32BITS(&grbn->flags))); + EXTRACT_BE_32BITS(&grbn->flags))); } ND_PRINT((ndo, " %s", tok2str(ns_type2str, "Type%d", - EXTRACT_16BITS(&grbn->rdtype)))); - if (EXTRACT_16BITS(&grbn->rdclass) != C_IN) { + EXTRACT_BE_16BITS(&grbn->rdtype)))); + if (EXTRACT_BE_16BITS(&grbn->rdclass) != C_IN) { ND_PRINT((ndo, " %s", tok2str(ns_class2str, "Class%d", - EXTRACT_16BITS(&grbn->rdclass)))); + EXTRACT_BE_16BITS(&grbn->rdclass)))); } ND_PRINT((ndo, " TTL ")); - unsigned_relts_print(ndo, EXTRACT_32BITS(&grbn->ttl)); - ND_PRINT((ndo, " %u/%u", EXTRACT_16BITS(&grbn->nrdatas), - EXTRACT_16BITS(&grbn->nsigs))); + unsigned_relts_print(ndo, + EXTRACT_BE_32BITS(&grbn->ttl)); + ND_PRINT((ndo, " %u/%u", EXTRACT_BE_16BITS(&grbn->nrdatas), + EXTRACT_BE_16BITS(&grbn->nsigs))); /* XXX grbn points to packed struct */ s = (const char *)&grbn->nsigs+ sizeof(grbn->nsigs); @@ -555,7 +556,7 @@ lwres_print(netdissect_options *ndo, s += advance; /* rdatas */ - na = EXTRACT_16BITS(&grbn->nrdatas); + na = EXTRACT_BE_16BITS(&grbn->nrdatas); for (i = 0; i < na; i++) { /* XXX should decode resource data */ advance = lwres_printbinlen(ndo, s); @@ -565,7 +566,7 @@ lwres_print(netdissect_options *ndo, } /* sigs */ - na = EXTRACT_16BITS(&grbn->nsigs); + na = EXTRACT_BE_16BITS(&grbn->nsigs); for (i = 0; i < na; i++) { /* XXX how should we print it? */ advance = lwres_printbinlen(ndo, s); @@ -582,11 +583,11 @@ lwres_print(netdissect_options *ndo, tail: /* length mismatch */ - if (EXTRACT_32BITS(&np->length) != length) { - ND_PRINT((ndo, " [len: %u != %u]", EXTRACT_32BITS(&np->length), - length)); + if (EXTRACT_BE_32BITS(&np->length) != length) { + ND_PRINT((ndo, " [len: %u != %u]", EXTRACT_BE_32BITS(&np->length), + length)); } - if (!unsupported && s < (const char *)np + EXTRACT_32BITS(&np->length)) + if (!unsupported && s < (const char *)np + EXTRACT_BE_32BITS(&np->length)) ND_PRINT((ndo, "[extra]")); return; diff --git a/print-m3ua.c b/print-m3ua.c index 71a585ff..54b218da 100644 --- a/print-m3ua.c +++ b/print-m3ua.c @@ -220,7 +220,7 @@ tag_value_print(netdissect_options *ndo, if (size < 4) goto invalid; ND_TCHECK2(*buf, size); - ND_PRINT((ndo, "0x%08x", EXTRACT_32BITS(buf))); + ND_PRINT((ndo, "0x%08x", EXTRACT_BE_32BITS(buf))); break; /* ... */ default: @@ -262,10 +262,10 @@ m3ua_tags_print(netdissect_options *ndo, goto invalid; ND_TCHECK2(*p, sizeof(struct m3ua_param_header)); /* Parameter Tag */ - hdr_tag = EXTRACT_16BITS(p); + hdr_tag = EXTRACT_BE_16BITS(p); ND_PRINT((ndo, "\n\t\t\t%s: ", tok2str(ParamName, "Unknown Parameter (0x%04x)", hdr_tag))); /* Parameter Length */ - hdr_len = EXTRACT_16BITS(p + 2); + hdr_len = EXTRACT_BE_16BITS(p + 2); if (hdr_len < sizeof(struct m3ua_param_header)) goto invalid; /* Parameter Value */ @@ -323,10 +323,11 @@ m3ua_print(netdissect_options *ndo, if (dict != NULL) ND_PRINT((ndo, " %s Message", tok2str(dict, "Unknown (0x%02x)", hdr->msg_type))); - if (size != EXTRACT_32BITS(&hdr->len)) - ND_PRINT((ndo, "\n\t\t\t@@@@@@ Corrupted length %u of message @@@@@@", EXTRACT_32BITS(&hdr->len))); + if (size != EXTRACT_BE_32BITS(&hdr->len)) + ND_PRINT((ndo, "\n\t\t\t@@@@@@ Corrupted length %u of message @@@@@@", EXTRACT_BE_32BITS(&hdr->len))); else - m3ua_tags_print(ndo, buf + sizeof(struct m3ua_common_header), EXTRACT_32BITS(&hdr->len) - sizeof(struct m3ua_common_header)); + m3ua_tags_print(ndo, buf + sizeof(struct m3ua_common_header), + EXTRACT_BE_32BITS(&hdr->len) - sizeof(struct m3ua_common_header)); return; invalid: diff --git a/print-medsa.c b/print-medsa.c index 4895fd94..c1e953b9 100644 --- a/print-medsa.c +++ b/print-medsa.c @@ -157,7 +157,7 @@ medsa_print(netdissect_options *ndo, length -= 8; caplen -= 8; - ether_type = EXTRACT_16BITS(&medsa->ether_type); + ether_type = EXTRACT_BE_16BITS(&medsa->ether_type); if (ether_type <= ETHERMTU) { /* Try to print the LLC-layer header & higher layers */ if (llc_print(ndo, bp, length, caplen, src, dst) < 0) { diff --git a/print-mobile.c b/print-mobile.c index 6d31648c..93d7b02c 100644 --- a/print-mobile.c +++ b/print-mobile.c @@ -78,8 +78,8 @@ mobile_print(netdissect_options *ndo, const u_char *bp, u_int length) } ND_PRINT((ndo, "mobile: ")); - proto = EXTRACT_16BITS(&mob->proto); - crc = EXTRACT_16BITS(&mob->hcheck); + proto = EXTRACT_BE_16BITS(&mob->proto); + crc = EXTRACT_BE_16BITS(&mob->hcheck); if (proto & OSRC_PRES) { osp=1; } diff --git a/print-mobility.c b/print-mobility.c index 44c9a77f..17564b37 100644 --- a/print-mobility.c +++ b/print-mobility.c @@ -152,7 +152,7 @@ mobility_opt_print(netdissect_options *ndo, /* units of 4 secs */ ND_TCHECK_16BITS(&bp[i+2]); ND_PRINT((ndo, "(refresh: %u)", - EXTRACT_16BITS(&bp[i+2]) << 2)); + EXTRACT_BE_16BITS(&bp[i + 2]) << 2)); break; case IP6MOPT_ALTCOA: if (len - i < IP6MOPT_ALTCOA_MINLEN) { @@ -170,8 +170,8 @@ mobility_opt_print(netdissect_options *ndo, ND_TCHECK_16BITS(&bp[i+2]); ND_TCHECK_16BITS(&bp[i+4]); ND_PRINT((ndo, "(ni: ho=0x%04x co=0x%04x)", - EXTRACT_16BITS(&bp[i+2]), - EXTRACT_16BITS(&bp[i+4]))); + EXTRACT_BE_16BITS(&bp[i + 2]), + EXTRACT_BE_16BITS(&bp[i + 4]))); break; case IP6MOPT_AUTH: if (len - i < IP6MOPT_AUTH_MINLEN) { @@ -250,36 +250,36 @@ mobility_print(netdissect_options *ndo, ND_TCHECK_32BITS(&bp[hlen + 4]); ND_PRINT((ndo, " %s Init Cookie=%08x:%08x", type == IP6M_HOME_TEST_INIT ? "Home" : "Care-of", - EXTRACT_32BITS(&bp[hlen]), - EXTRACT_32BITS(&bp[hlen + 4]))); + EXTRACT_BE_32BITS(&bp[hlen]), + EXTRACT_BE_32BITS(&bp[hlen + 4]))); } hlen += 8; break; case IP6M_HOME_TEST: case IP6M_CAREOF_TEST: ND_TCHECK(mh->ip6m_data16[0]); - ND_PRINT((ndo, " nonce id=0x%x", EXTRACT_16BITS(&mh->ip6m_data16[0]))); + ND_PRINT((ndo, " nonce id=0x%x", EXTRACT_BE_16BITS(&mh->ip6m_data16[0]))); hlen = IP6M_MINLEN; if (ndo->ndo_vflag) { ND_TCHECK_32BITS(&bp[hlen + 4]); ND_PRINT((ndo, " %s Init Cookie=%08x:%08x", type == IP6M_HOME_TEST ? "Home" : "Care-of", - EXTRACT_32BITS(&bp[hlen]), - EXTRACT_32BITS(&bp[hlen + 4]))); + EXTRACT_BE_32BITS(&bp[hlen]), + EXTRACT_BE_32BITS(&bp[hlen + 4]))); } hlen += 8; if (ndo->ndo_vflag) { ND_TCHECK_32BITS(&bp[hlen + 4]); ND_PRINT((ndo, " %s Keygen Token=%08x:%08x", type == IP6M_HOME_TEST ? "Home" : "Care-of", - EXTRACT_32BITS(&bp[hlen]), - EXTRACT_32BITS(&bp[hlen + 4]))); + EXTRACT_BE_32BITS(&bp[hlen]), + EXTRACT_BE_32BITS(&bp[hlen + 4]))); } hlen += 8; break; case IP6M_BINDING_UPDATE: ND_TCHECK(mh->ip6m_data16[0]); - ND_PRINT((ndo, " seq#=%u", EXTRACT_16BITS(&mh->ip6m_data16[0]))); + ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_16BITS(&mh->ip6m_data16[0]))); hlen = IP6M_MINLEN; ND_TCHECK_16BITS(&bp[hlen]); if (bp[hlen] & 0xf0) { @@ -299,7 +299,7 @@ mobility_print(netdissect_options *ndo, hlen += 1; ND_TCHECK_16BITS(&bp[hlen]); /* units of 4 secs */ - ND_PRINT((ndo, " lifetime=%u", EXTRACT_16BITS(&bp[hlen]) << 2)); + ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_16BITS(&bp[hlen]) << 2)); hlen += 2; break; case IP6M_BINDING_ACK: @@ -311,11 +311,11 @@ mobility_print(netdissect_options *ndo, /* Reserved (7bits) */ hlen = IP6M_MINLEN; ND_TCHECK_16BITS(&bp[hlen]); - ND_PRINT((ndo, " seq#=%u", EXTRACT_16BITS(&bp[hlen]))); + ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_16BITS(&bp[hlen]))); hlen += 2; ND_TCHECK_16BITS(&bp[hlen]); /* units of 4 secs */ - ND_PRINT((ndo, " lifetime=%u", EXTRACT_16BITS(&bp[hlen]) << 2)); + ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_16BITS(&bp[hlen]) << 2)); hlen += 2; break; case IP6M_BINDING_ERROR: diff --git a/print-mpcp.c b/print-mpcp.c index acb83cbc..18c7f77d 100644 --- a/print-mpcp.c +++ b/print-mpcp.c @@ -141,10 +141,10 @@ mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int mpcp.common_header = (const struct mpcp_common_header_t *)pptr; ND_TCHECK2(*tptr, sizeof(struct mpcp_common_header_t)); - opcode = EXTRACT_16BITS(mpcp.common_header->opcode); + opcode = EXTRACT_BE_16BITS(mpcp.common_header->opcode); ND_PRINT((ndo, "MPCP, Opcode %s", tok2str(mpcp_opcode_values, "Unknown (%u)", opcode))); if (opcode != MPCP_OPCODE_PAUSE) { - ND_PRINT((ndo, ", Timestamp %u ticks", EXTRACT_32BITS(mpcp.common_header->timestamp))); + ND_PRINT((ndo, ", Timestamp %u ticks", EXTRACT_BE_32BITS(mpcp.common_header->timestamp))); } ND_PRINT((ndo, ", length %u", length)); @@ -172,13 +172,13 @@ mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int mpcp.grant = (const struct mpcp_grant_t *)tptr; ND_PRINT((ndo, "\n\tGrant #%u, Start-Time %u ticks, duration %u ticks", grant, - EXTRACT_32BITS(mpcp.grant->starttime), - EXTRACT_16BITS(mpcp.grant->duration))); + EXTRACT_BE_32BITS(mpcp.grant->starttime), + EXTRACT_BE_16BITS(mpcp.grant->duration))); tptr += sizeof(struct mpcp_grant_t); } ND_TCHECK2(*tptr, MPCP_TIMESTAMP_DURATION_LEN); - ND_PRINT((ndo, "\n\tSync-Time %u ticks", EXTRACT_16BITS(tptr))); + ND_PRINT((ndo, "\n\tSync-Time %u ticks", EXTRACT_BE_16BITS(tptr))); break; @@ -202,7 +202,7 @@ mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int ND_TCHECK2(*tptr, MPCP_TIMESTAMP_DURATION_LEN); ND_PRINT((ndo, "\n\t Q%u Report, Duration %u ticks", report, - EXTRACT_16BITS(tptr))); + EXTRACT_BE_16BITS(tptr))); tptr+=MPCP_TIMESTAMP_DURATION_LEN; } report++; @@ -224,9 +224,9 @@ mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int mpcp.reg = (const struct mpcp_reg_t *)tptr; ND_PRINT((ndo, "\n\tAssigned-Port %u, Flags [ %s ]" \ "\n\tSync-Time %u ticks, Echoed-Pending-Grants %u", - EXTRACT_16BITS(mpcp.reg->assigned_port), + EXTRACT_BE_16BITS(mpcp.reg->assigned_port), bittok2str(mpcp_reg_flag_values, "Reserved", mpcp.reg->flags), - EXTRACT_16BITS(mpcp.reg->sync_time), + EXTRACT_BE_16BITS(mpcp.reg->sync_time), mpcp.reg->echoed_pending_grants)); break; @@ -235,9 +235,9 @@ mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int mpcp.reg_ack = (const struct mpcp_reg_ack_t *)tptr; ND_PRINT((ndo, "\n\tEchoed-Assigned-Port %u, Flags [ %s ]" \ "\n\tEchoed-Sync-Time %u ticks", - EXTRACT_16BITS(mpcp.reg_ack->echoed_assigned_port), + EXTRACT_BE_16BITS(mpcp.reg_ack->echoed_assigned_port), bittok2str(mpcp_reg_ack_flag_values, "Reserved", mpcp.reg_ack->flags), - EXTRACT_16BITS(mpcp.reg_ack->echoed_sync_time))); + EXTRACT_BE_16BITS(mpcp.reg_ack->echoed_sync_time))); break; default: diff --git a/print-mpls.c b/print-mpls.c index 5c26e4f9..c8fe9045 100644 --- a/print-mpls.c +++ b/print-mpls.c @@ -72,7 +72,7 @@ mpls_print(netdissect_options *ndo, const u_char *bp, u_int length) ND_PRINT((ndo, "[|MPLS], length %u", length)); return; } - label_entry = EXTRACT_32BITS(p); + label_entry = EXTRACT_BE_32BITS(p); ND_PRINT((ndo, "%s(label %u", (label_stack_depth && ndo->ndo_vflag) ? "\n\t" : " ", MPLS_LABEL(label_entry))); diff --git a/print-mptcp.c b/print-mptcp.c index 392791e6..6e7154e6 100644 --- a/print-mptcp.c +++ b/print-mptcp.c @@ -189,9 +189,9 @@ mp_capable_print(netdissect_options *ndo, if (mpc->flags & MP_CAPABLE_C) ND_PRINT((ndo, " csum")); - ND_PRINT((ndo, " {0x%" PRIx64, EXTRACT_64BITS(mpc->sender_key))); + ND_PRINT((ndo, " {0x%" PRIx64, EXTRACT_BE_64BITS(mpc->sender_key))); if (opt_len == 20) /* ACK */ - ND_PRINT((ndo, ",0x%" PRIx64, EXTRACT_64BITS(mpc->receiver_key))); + ND_PRINT((ndo, ",0x%" PRIx64, EXTRACT_BE_64BITS(mpc->receiver_key))); ND_PRINT((ndo, "}")); return 1; } @@ -216,13 +216,13 @@ mp_join_print(netdissect_options *ndo, switch (opt_len) { case 12: /* SYN */ ND_PRINT((ndo, " token 0x%x" " nonce 0x%x", - EXTRACT_32BITS(mpj->u.syn.token), - EXTRACT_32BITS(mpj->u.syn.nonce))); + EXTRACT_BE_32BITS(mpj->u.syn.token), + EXTRACT_BE_32BITS(mpj->u.syn.nonce))); break; case 16: /* SYN/ACK */ ND_PRINT((ndo, " hmac 0x%" PRIx64 " nonce 0x%x", - EXTRACT_64BITS(mpj->u.synack.mac), - EXTRACT_32BITS(mpj->u.synack.nonce))); + EXTRACT_BE_64BITS(mpj->u.synack.mac), + EXTRACT_BE_32BITS(mpj->u.synack.nonce))); break; case 24: {/* ACK */ size_t i; @@ -264,13 +264,13 @@ mp_dss_print(netdissect_options *ndo, if (mdss->flags & MP_DSS_a) { if (opt_len < 8) return 0; - ND_PRINT((ndo, "%" PRIu64, EXTRACT_64BITS(opt))); + ND_PRINT((ndo, "%" PRIu64, EXTRACT_BE_64BITS(opt))); opt += 8; opt_len -= 8; } else { if (opt_len < 4) return 0; - ND_PRINT((ndo, "%u", EXTRACT_32BITS(opt))); + ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(opt))); opt += 4; opt_len -= 4; } @@ -289,24 +289,24 @@ mp_dss_print(netdissect_options *ndo, if (mdss->flags & MP_DSS_m) { if (opt_len < 8) return 0; - ND_PRINT((ndo, "%" PRIu64, EXTRACT_64BITS(opt))); + ND_PRINT((ndo, "%" PRIu64, EXTRACT_BE_64BITS(opt))); opt += 8; opt_len -= 8; } else { if (opt_len < 4) return 0; - ND_PRINT((ndo, "%u", EXTRACT_32BITS(opt))); + ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(opt))); opt += 4; opt_len -= 4; } if (opt_len < 4) return 0; - ND_PRINT((ndo, " subseq %u", EXTRACT_32BITS(opt))); + ND_PRINT((ndo, " subseq %u", EXTRACT_BE_32BITS(opt))); opt += 4; opt_len -= 4; if (opt_len < 2) return 0; - ND_PRINT((ndo, " len %u", EXTRACT_16BITS(opt))); + ND_PRINT((ndo, " len %u", EXTRACT_BE_16BITS(opt))); opt += 2; opt_len -= 2; @@ -316,7 +316,7 @@ mp_dss_print(netdissect_options *ndo, * bytes as the Checksum. */ if (opt_len >= 2) { - ND_PRINT((ndo, " csum 0x%x", EXTRACT_16BITS(opt))); + ND_PRINT((ndo, " csum 0x%x", EXTRACT_BE_16BITS(opt))); opt_len -= 2; } } @@ -341,12 +341,12 @@ add_addr_print(netdissect_options *ndo, case 4: ND_PRINT((ndo, " %s", ipaddr_string(ndo, add_addr->u.v4.addr))); if (opt_len == 10) - ND_PRINT((ndo, ":%u", EXTRACT_16BITS(add_addr->u.v4.port))); + ND_PRINT((ndo, ":%u", EXTRACT_BE_16BITS(add_addr->u.v4.port))); break; case 6: ND_PRINT((ndo, " %s", ip6addr_string(ndo, add_addr->u.v6.addr))); if (opt_len == 22) - ND_PRINT((ndo, ":%u", EXTRACT_16BITS(add_addr->u.v6.port))); + ND_PRINT((ndo, ":%u", EXTRACT_BE_16BITS(add_addr->u.v6.port))); break; default: return 0; @@ -398,7 +398,7 @@ mp_fail_print(netdissect_options *ndo, if (opt_len != 12) return 0; - ND_PRINT((ndo, " seq %" PRIu64, EXTRACT_64BITS(opt + 4))); + ND_PRINT((ndo, " seq %" PRIu64, EXTRACT_BE_64BITS(opt + 4))); return 1; } @@ -409,7 +409,7 @@ mp_fast_close_print(netdissect_options *ndo, if (opt_len != 12) return 0; - ND_PRINT((ndo, " key 0x%" PRIx64, EXTRACT_64BITS(opt + 4))); + ND_PRINT((ndo, " key 0x%" PRIx64, EXTRACT_BE_64BITS(opt + 4))); return 1; } diff --git a/print-msdp.c b/print-msdp.c index 50bafb0a..19b7c5e6 100644 --- a/print-msdp.c +++ b/print-msdp.c @@ -38,14 +38,14 @@ msdp_print(netdissect_options *ndo, const u_char *sp, u_int length) ND_TCHECK2(*sp, 3); /* See if we think we're at the beginning of a compound packet */ type = *sp; - len = EXTRACT_16BITS(sp + 1); + len = EXTRACT_BE_16BITS(sp + 1); if (len > 1500 || len < 3 || type == 0 || type > MSDP_TYPE_MAX) goto trunc; /* not really truncated, but still not decodable */ ND_PRINT((ndo, " msdp:")); while (length > 0) { ND_TCHECK2(*sp, 3); type = *sp; - len = EXTRACT_16BITS(sp + 1); + len = EXTRACT_BE_16BITS(sp + 1); if (len > 1400 || ndo->ndo_vflag) ND_PRINT((ndo, " [len %u]", len)); if (len < 3) diff --git a/print-nfs.c b/print-nfs.c index b44561c3..7be695fd 100644 --- a/print-nfs.c +++ b/print-nfs.c @@ -234,60 +234,60 @@ parse_sattr3(netdissect_options *ndo, const uint32_t *dp, struct nfsv3_sattr *sa3) { ND_TCHECK(dp[0]); - sa3->sa_modeset = EXTRACT_32BITS(dp); + sa3->sa_modeset = EXTRACT_BE_32BITS(dp); dp++; if (sa3->sa_modeset) { ND_TCHECK(dp[0]); - sa3->sa_mode = EXTRACT_32BITS(dp); + sa3->sa_mode = EXTRACT_BE_32BITS(dp); dp++; } ND_TCHECK(dp[0]); - sa3->sa_uidset = EXTRACT_32BITS(dp); + sa3->sa_uidset = EXTRACT_BE_32BITS(dp); dp++; if (sa3->sa_uidset) { ND_TCHECK(dp[0]); - sa3->sa_uid = EXTRACT_32BITS(dp); + sa3->sa_uid = EXTRACT_BE_32BITS(dp); dp++; } ND_TCHECK(dp[0]); - sa3->sa_gidset = EXTRACT_32BITS(dp); + sa3->sa_gidset = EXTRACT_BE_32BITS(dp); dp++; if (sa3->sa_gidset) { ND_TCHECK(dp[0]); - sa3->sa_gid = EXTRACT_32BITS(dp); + sa3->sa_gid = EXTRACT_BE_32BITS(dp); dp++; } ND_TCHECK(dp[0]); - sa3->sa_sizeset = EXTRACT_32BITS(dp); + sa3->sa_sizeset = EXTRACT_BE_32BITS(dp); dp++; if (sa3->sa_sizeset) { ND_TCHECK(dp[0]); - sa3->sa_size = EXTRACT_32BITS(dp); + sa3->sa_size = EXTRACT_BE_32BITS(dp); dp++; } ND_TCHECK(dp[0]); - sa3->sa_atimetype = EXTRACT_32BITS(dp); + sa3->sa_atimetype = EXTRACT_BE_32BITS(dp); dp++; if (sa3->sa_atimetype == NFSV3SATTRTIME_TOCLIENT) { ND_TCHECK(dp[1]); - sa3->sa_atime.nfsv3_sec = EXTRACT_32BITS(dp); + sa3->sa_atime.nfsv3_sec = EXTRACT_BE_32BITS(dp); dp++; - sa3->sa_atime.nfsv3_nsec = EXTRACT_32BITS(dp); + sa3->sa_atime.nfsv3_nsec = EXTRACT_BE_32BITS(dp); dp++; } ND_TCHECK(dp[0]); - sa3->sa_mtimetype = EXTRACT_32BITS(dp); + sa3->sa_mtimetype = EXTRACT_BE_32BITS(dp); dp++; if (sa3->sa_mtimetype == NFSV3SATTRTIME_TOCLIENT) { ND_TCHECK(dp[1]); - sa3->sa_mtime.nfsv3_sec = EXTRACT_32BITS(dp); + sa3->sa_mtime.nfsv3_sec = EXTRACT_BE_32BITS(dp); dp++; - sa3->sa_mtime.nfsv3_nsec = EXTRACT_32BITS(dp); + sa3->sa_mtime.nfsv3_nsec = EXTRACT_BE_32BITS(dp); dp++; } @@ -333,11 +333,11 @@ nfsreply_print(netdissect_options *ndo, if (!ndo->ndo_nflag) { strlcpy(srcid, "nfs", sizeof(srcid)); snprintf(dstid, sizeof(dstid), "%u", - EXTRACT_32BITS(&rp->rm_xid)); + EXTRACT_BE_32BITS(&rp->rm_xid)); } else { snprintf(srcid, sizeof(srcid), "%u", NFS_PORT); snprintf(dstid, sizeof(dstid), "%u", - EXTRACT_32BITS(&rp->rm_xid)); + EXTRACT_BE_32BITS(&rp->rm_xid)); } print_nfsaddr(ndo, bp2, srcid, dstid); @@ -365,7 +365,7 @@ nfsreply_noaddr_print(netdissect_options *ndo, rp = (const struct sunrpc_msg *)bp; ND_TCHECK(rp->rm_reply.rp_stat); - reply_stat = EXTRACT_32BITS(&rp->rm_reply.rp_stat); + reply_stat = EXTRACT_BE_32BITS(&rp->rm_reply.rp_stat); switch (reply_stat) { case SUNRPC_MSG_ACCEPTED: @@ -377,19 +377,19 @@ nfsreply_noaddr_print(netdissect_options *ndo, case SUNRPC_MSG_DENIED: ND_PRINT((ndo, "reply ERR %u: ", length)); ND_TCHECK(rp->rm_reply.rp_reject.rj_stat); - rstat = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_stat); + rstat = EXTRACT_BE_32BITS(&rp->rm_reply.rp_reject.rj_stat); switch (rstat) { case SUNRPC_RPC_MISMATCH: ND_TCHECK(rp->rm_reply.rp_reject.rj_vers.high); - rlow = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_vers.low); - rhigh = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_vers.high); + rlow = EXTRACT_BE_32BITS(&rp->rm_reply.rp_reject.rj_vers.low); + rhigh = EXTRACT_BE_32BITS(&rp->rm_reply.rp_reject.rj_vers.high); ND_PRINT((ndo, "RPC Version mismatch (%u-%u)", rlow, rhigh)); break; case SUNRPC_AUTH_ERROR: ND_TCHECK(rp->rm_reply.rp_reject.rj_why); - rwhy = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_why); + rwhy = EXTRACT_BE_32BITS(&rp->rm_reply.rp_reject.rj_why); ND_PRINT((ndo, "Auth %s", tok2str(sunrpc_auth_str, "Invalid failure code %u", rwhy))); break; @@ -426,11 +426,11 @@ parsereq(netdissect_options *ndo, */ dp = (const uint32_t *)&rp->rm_call.cb_cred; ND_TCHECK(dp[1]); - len = EXTRACT_32BITS(&dp[1]); + len = EXTRACT_BE_32BITS(&dp[1]); if (len < length) { dp += (len + (2 * sizeof(*dp) + 3)) / sizeof(*dp); ND_TCHECK(dp[1]); - len = EXTRACT_32BITS(&dp[1]); + len = EXTRACT_BE_32BITS(&dp[1]); if (len < length) { dp += (len + (2 * sizeof(*dp) + 3)) / sizeof(*dp); ND_TCHECK2(dp[0], 0); @@ -453,7 +453,7 @@ parsefh(netdissect_options *ndo, if (v3) { ND_TCHECK(dp[0]); - len = EXTRACT_32BITS(dp) / 4; + len = EXTRACT_BE_32BITS(dp) / 4; dp++; } else len = NFSX_V2FH / 4; @@ -537,8 +537,8 @@ nfsreq_noaddr_print(netdissect_options *ndo, if (!xid_map_enter(ndo, rp, bp2)) /* record proc number for later on */ goto trunc; - v3 = (EXTRACT_32BITS(&rp->rm_call.cb_vers) == NFS_VER3); - proc = EXTRACT_32BITS(&rp->rm_call.cb_proc); + v3 = (EXTRACT_BE_32BITS(&rp->rm_call.cb_vers) == NFS_VER3); + proc = EXTRACT_BE_32BITS(&rp->rm_call.cb_proc); if (!v3 && proc < NFS_NPROCS) proc = nfsv3_procid[proc]; @@ -571,7 +571,7 @@ nfsreq_noaddr_print(netdissect_options *ndo, if ((dp = parsereq(ndo, rp, length)) != NULL && (dp = parsefh(ndo, dp, v3)) != NULL) { ND_TCHECK(dp[0]); - access_flags = EXTRACT_32BITS(&dp[0]); + access_flags = EXTRACT_BE_32BITS(&dp[0]); if (access_flags & ~NFSV3ACCESS_FULL) { /* NFSV3ACCESS definitions aren't up to date */ ND_PRINT((ndo, " %04x", access_flags)); @@ -612,13 +612,13 @@ nfsreq_noaddr_print(netdissect_options *ndo, if (v3) { ND_TCHECK(dp[2]); ND_PRINT((ndo, " %u bytes @ %" PRIu64, - EXTRACT_32BITS(&dp[2]), - EXTRACT_64BITS(&dp[0]))); + EXTRACT_BE_32BITS(&dp[2]), + EXTRACT_BE_64BITS(&dp[0]))); } else { ND_TCHECK(dp[1]); ND_PRINT((ndo, " %u bytes @ %u", - EXTRACT_32BITS(&dp[1]), - EXTRACT_32BITS(&dp[0]))); + EXTRACT_BE_32BITS(&dp[1]), + EXTRACT_BE_32BITS(&dp[0]))); } return; } @@ -630,21 +630,21 @@ nfsreq_noaddr_print(netdissect_options *ndo, if (v3) { ND_TCHECK(dp[4]); ND_PRINT((ndo, " %u (%u) bytes @ %" PRIu64, - EXTRACT_32BITS(&dp[4]), - EXTRACT_32BITS(&dp[2]), - EXTRACT_64BITS(&dp[0]))); + EXTRACT_BE_32BITS(&dp[4]), + EXTRACT_BE_32BITS(&dp[2]), + EXTRACT_BE_64BITS(&dp[0]))); if (ndo->ndo_vflag) { ND_PRINT((ndo, " <%s>", tok2str(nfsv3_writemodes, - NULL, EXTRACT_32BITS(&dp[3])))); + NULL, EXTRACT_BE_32BITS(&dp[3])))); } } else { ND_TCHECK(dp[3]); ND_PRINT((ndo, " %u (%u) bytes @ %u (%u)", - EXTRACT_32BITS(&dp[3]), - EXTRACT_32BITS(&dp[2]), - EXTRACT_32BITS(&dp[1]), - EXTRACT_32BITS(&dp[0]))); + EXTRACT_BE_32BITS(&dp[3]), + EXTRACT_BE_32BITS(&dp[2]), + EXTRACT_BE_32BITS(&dp[1]), + EXTRACT_BE_32BITS(&dp[0]))); } return; } @@ -668,7 +668,7 @@ nfsreq_noaddr_print(netdissect_options *ndo, if ((dp = parsereq(ndo, rp, length)) != NULL && (dp = parsefhn(ndo, dp, v3)) != NULL) { ND_TCHECK(*dp); - type = (nfs_type)EXTRACT_32BITS(dp); + type = (nfs_type) EXTRACT_BE_32BITS(dp); dp++; if ((dp = parse_sattr3(ndo, dp, &sa3)) == NULL) break; @@ -676,8 +676,8 @@ nfsreq_noaddr_print(netdissect_options *ndo, if (ndo->ndo_vflag && (type == NFCHR || type == NFBLK)) { ND_TCHECK(dp[1]); ND_PRINT((ndo, " %u/%u", - EXTRACT_32BITS(&dp[0]), - EXTRACT_32BITS(&dp[1]))); + EXTRACT_BE_32BITS(&dp[0]), + EXTRACT_BE_32BITS(&dp[1]))); dp += 2; } if (ndo->ndo_vflag) @@ -714,8 +714,8 @@ nfsreq_noaddr_print(netdissect_options *ndo, * offset cookie here. */ ND_PRINT((ndo, " %u bytes @ %" PRId64, - EXTRACT_32BITS(&dp[4]), - EXTRACT_64BITS(&dp[0]))); + EXTRACT_BE_32BITS(&dp[4]), + EXTRACT_BE_64BITS(&dp[0]))); if (ndo->ndo_vflag) ND_PRINT((ndo, " verf %08x%08x", dp[2], dp[3])); } else { @@ -725,8 +725,8 @@ nfsreq_noaddr_print(netdissect_options *ndo, * common, but offsets > 2^31 aren't. */ ND_PRINT((ndo, " %u bytes @ %d", - EXTRACT_32BITS(&dp[1]), - EXTRACT_32BITS(&dp[0]))); + EXTRACT_BE_32BITS(&dp[1]), + EXTRACT_BE_32BITS(&dp[0]))); } return; } @@ -741,12 +741,12 @@ nfsreq_noaddr_print(netdissect_options *ndo, * cookie here. */ ND_PRINT((ndo, " %u bytes @ %" PRId64, - EXTRACT_32BITS(&dp[4]), - EXTRACT_64BITS(&dp[0]))); + EXTRACT_BE_32BITS(&dp[4]), + EXTRACT_BE_64BITS(&dp[0]))); if (ndo->ndo_vflag) { ND_TCHECK(dp[5]); ND_PRINT((ndo, " max %u verf %08x%08x", - EXTRACT_32BITS(&dp[5]), dp[2], dp[3])); + EXTRACT_BE_32BITS(&dp[5]), dp[2], dp[3])); } return; } @@ -757,8 +757,8 @@ nfsreq_noaddr_print(netdissect_options *ndo, (dp = parsefh(ndo, dp, v3)) != NULL) { ND_TCHECK(dp[2]); ND_PRINT((ndo, " %u bytes @ %" PRIu64, - EXTRACT_32BITS(&dp[2]), - EXTRACT_64BITS(&dp[0]))); + EXTRACT_BE_32BITS(&dp[2]), + EXTRACT_BE_64BITS(&dp[0]))); return; } break; @@ -899,8 +899,8 @@ xid_map_enter(netdissect_options *ndo, UNALIGNED_MEMCPY(&xmep->client, &ip6->ip6_src, sizeof(ip6->ip6_src)); UNALIGNED_MEMCPY(&xmep->server, &ip6->ip6_dst, sizeof(ip6->ip6_dst)); } - xmep->proc = EXTRACT_32BITS(&rp->rm_call.cb_proc); - xmep->vers = EXTRACT_32BITS(&rp->rm_call.cb_vers); + xmep->proc = EXTRACT_BE_32BITS(&rp->rm_call.cb_proc); + xmep->vers = EXTRACT_BE_32BITS(&rp->rm_call.cb_vers); return (1); } @@ -997,7 +997,7 @@ parserep(netdissect_options *ndo, */ dp = ((const uint32_t *)&rp->rm_reply) + 1; ND_TCHECK(dp[1]); - len = EXTRACT_32BITS(&dp[1]); + len = EXTRACT_BE_32BITS(&dp[1]); if (len >= length) return (NULL); /* @@ -1009,7 +1009,7 @@ parserep(netdissect_options *ndo, * now we can check the ar_stat field */ ND_TCHECK(dp[0]); - astat = (enum sunrpc_accept_stat) EXTRACT_32BITS(dp); + astat = (enum sunrpc_accept_stat) EXTRACT_BE_32BITS(dp); if (astat != SUNRPC_SUCCESS) { ND_PRINT((ndo, " %s", tok2str(sunrpc_str, "ar_stat %d", astat))); nfserr = 1; /* suppress trunc string */ @@ -1030,7 +1030,7 @@ parsestatus(netdissect_options *ndo, ND_TCHECK(dp[0]); - errnum = EXTRACT_32BITS(&dp[0]); + errnum = EXTRACT_BE_32BITS(&dp[0]); if (er) *er = errnum; if (errnum != 0) { @@ -1055,17 +1055,17 @@ parsefattr(netdissect_options *ndo, if (verbose) { ND_PRINT((ndo, " %s %o ids %d/%d", tok2str(type2str, "unk-ft %d ", - EXTRACT_32BITS(&fap->fa_type)), - EXTRACT_32BITS(&fap->fa_mode), - EXTRACT_32BITS(&fap->fa_uid), - EXTRACT_32BITS(&fap->fa_gid))); + EXTRACT_BE_32BITS(&fap->fa_type)), + EXTRACT_BE_32BITS(&fap->fa_mode), + EXTRACT_BE_32BITS(&fap->fa_uid), + EXTRACT_BE_32BITS(&fap->fa_gid))); if (v3) { ND_TCHECK(fap->fa3_size); ND_PRINT((ndo, " sz %" PRIu64, - EXTRACT_64BITS((const uint32_t *)&fap->fa3_size))); + EXTRACT_BE_64BITS((const uint32_t *)&fap->fa3_size))); } else { ND_TCHECK(fap->fa2_size); - ND_PRINT((ndo, " sz %d", EXTRACT_32BITS(&fap->fa2_size))); + ND_PRINT((ndo, " sz %d", EXTRACT_BE_32BITS(&fap->fa2_size))); } } /* print lots more stuff */ @@ -1073,38 +1073,38 @@ parsefattr(netdissect_options *ndo, if (v3) { ND_TCHECK(fap->fa3_ctime); ND_PRINT((ndo, " nlink %d rdev %d/%d", - EXTRACT_32BITS(&fap->fa_nlink), - EXTRACT_32BITS(&fap->fa3_rdev.specdata1), - EXTRACT_32BITS(&fap->fa3_rdev.specdata2))); + EXTRACT_BE_32BITS(&fap->fa_nlink), + EXTRACT_BE_32BITS(&fap->fa3_rdev.specdata1), + EXTRACT_BE_32BITS(&fap->fa3_rdev.specdata2))); ND_PRINT((ndo, " fsid %" PRIx64, - EXTRACT_64BITS((const uint32_t *)&fap->fa3_fsid))); + EXTRACT_BE_64BITS((const uint32_t *)&fap->fa3_fsid))); ND_PRINT((ndo, " fileid %" PRIx64, - EXTRACT_64BITS((const uint32_t *)&fap->fa3_fileid))); + EXTRACT_BE_64BITS((const uint32_t *)&fap->fa3_fileid))); ND_PRINT((ndo, " a/m/ctime %u.%06u", - EXTRACT_32BITS(&fap->fa3_atime.nfsv3_sec), - EXTRACT_32BITS(&fap->fa3_atime.nfsv3_nsec))); + EXTRACT_BE_32BITS(&fap->fa3_atime.nfsv3_sec), + EXTRACT_BE_32BITS(&fap->fa3_atime.nfsv3_nsec))); ND_PRINT((ndo, " %u.%06u", - EXTRACT_32BITS(&fap->fa3_mtime.nfsv3_sec), - EXTRACT_32BITS(&fap->fa3_mtime.nfsv3_nsec))); + EXTRACT_BE_32BITS(&fap->fa3_mtime.nfsv3_sec), + EXTRACT_BE_32BITS(&fap->fa3_mtime.nfsv3_nsec))); ND_PRINT((ndo, " %u.%06u", - EXTRACT_32BITS(&fap->fa3_ctime.nfsv3_sec), - EXTRACT_32BITS(&fap->fa3_ctime.nfsv3_nsec))); + EXTRACT_BE_32BITS(&fap->fa3_ctime.nfsv3_sec), + EXTRACT_BE_32BITS(&fap->fa3_ctime.nfsv3_nsec))); } else { ND_TCHECK(fap->fa2_ctime); ND_PRINT((ndo, " nlink %d rdev 0x%x fsid 0x%x nodeid 0x%x a/m/ctime", - EXTRACT_32BITS(&fap->fa_nlink), - EXTRACT_32BITS(&fap->fa2_rdev), - EXTRACT_32BITS(&fap->fa2_fsid), - EXTRACT_32BITS(&fap->fa2_fileid))); + EXTRACT_BE_32BITS(&fap->fa_nlink), + EXTRACT_BE_32BITS(&fap->fa2_rdev), + EXTRACT_BE_32BITS(&fap->fa2_fsid), + EXTRACT_BE_32BITS(&fap->fa2_fileid))); ND_PRINT((ndo, " %u.%06u", - EXTRACT_32BITS(&fap->fa2_atime.nfsv2_sec), - EXTRACT_32BITS(&fap->fa2_atime.nfsv2_usec))); + EXTRACT_BE_32BITS(&fap->fa2_atime.nfsv2_sec), + EXTRACT_BE_32BITS(&fap->fa2_atime.nfsv2_usec))); ND_PRINT((ndo, " %u.%06u", - EXTRACT_32BITS(&fap->fa2_mtime.nfsv2_sec), - EXTRACT_32BITS(&fap->fa2_mtime.nfsv2_usec))); + EXTRACT_BE_32BITS(&fap->fa2_mtime.nfsv2_sec), + EXTRACT_BE_32BITS(&fap->fa2_mtime.nfsv2_usec))); ND_PRINT((ndo, " %u.%06u", - EXTRACT_32BITS(&fap->fa2_ctime.nfsv2_sec), - EXTRACT_32BITS(&fap->fa2_ctime.nfsv2_usec))); + EXTRACT_BE_32BITS(&fap->fa2_ctime.nfsv2_sec), + EXTRACT_BE_32BITS(&fap->fa2_ctime.nfsv2_usec))); } } return ((const uint32_t *)((const unsigned char *)dp + @@ -1192,23 +1192,23 @@ parsestatfs(netdissect_options *ndo, if (v3) { ND_PRINT((ndo, " tbytes %" PRIu64 " fbytes %" PRIu64 " abytes %" PRIu64, - EXTRACT_64BITS((const uint32_t *)&sfsp->sf_tbytes), - EXTRACT_64BITS((const uint32_t *)&sfsp->sf_fbytes), - EXTRACT_64BITS((const uint32_t *)&sfsp->sf_abytes))); + EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_tbytes), + EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_fbytes), + EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_abytes))); if (ndo->ndo_vflag) { ND_PRINT((ndo, " tfiles %" PRIu64 " ffiles %" PRIu64 " afiles %" PRIu64 " invar %u", - EXTRACT_64BITS((const uint32_t *)&sfsp->sf_tfiles), - EXTRACT_64BITS((const uint32_t *)&sfsp->sf_ffiles), - EXTRACT_64BITS((const uint32_t *)&sfsp->sf_afiles), - EXTRACT_32BITS(&sfsp->sf_invarsec))); + EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_tfiles), + EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_ffiles), + EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_afiles), + EXTRACT_BE_32BITS(&sfsp->sf_invarsec))); } } else { ND_PRINT((ndo, " tsize %d bsize %d blocks %d bfree %d bavail %d", - EXTRACT_32BITS(&sfsp->sf_tsize), - EXTRACT_32BITS(&sfsp->sf_bsize), - EXTRACT_32BITS(&sfsp->sf_blocks), - EXTRACT_32BITS(&sfsp->sf_bfree), - EXTRACT_32BITS(&sfsp->sf_bavail))); + EXTRACT_BE_32BITS(&sfsp->sf_tsize), + EXTRACT_BE_32BITS(&sfsp->sf_bsize), + EXTRACT_BE_32BITS(&sfsp->sf_blocks), + EXTRACT_BE_32BITS(&sfsp->sf_bfree), + EXTRACT_BE_32BITS(&sfsp->sf_bavail))); } return (1); @@ -1232,7 +1232,7 @@ parserddires(netdissect_options *ndo, ND_TCHECK(dp[2]); ND_PRINT((ndo, " offset 0x%x size %d ", - EXTRACT_32BITS(&dp[0]), EXTRACT_32BITS(&dp[1]))); + EXTRACT_BE_32BITS(&dp[0]), EXTRACT_BE_32BITS(&dp[1]))); if (dp[2] != 0) ND_PRINT((ndo, " eof")); @@ -1246,10 +1246,10 @@ parse_wcc_attr(netdissect_options *ndo, const uint32_t *dp) { /* Our caller has already checked this */ - ND_PRINT((ndo, " sz %" PRIu64, EXTRACT_64BITS(&dp[0]))); + ND_PRINT((ndo, " sz %" PRIu64, EXTRACT_BE_64BITS(&dp[0]))); ND_PRINT((ndo, " mtime %u.%06u ctime %u.%06u", - EXTRACT_32BITS(&dp[2]), EXTRACT_32BITS(&dp[3]), - EXTRACT_32BITS(&dp[4]), EXTRACT_32BITS(&dp[5]))); + EXTRACT_BE_32BITS(&dp[2]), EXTRACT_BE_32BITS(&dp[3]), + EXTRACT_BE_32BITS(&dp[4]), EXTRACT_BE_32BITS(&dp[5]))); return (dp + 6); } @@ -1261,7 +1261,7 @@ parse_pre_op_attr(netdissect_options *ndo, const uint32_t *dp, int verbose) { ND_TCHECK(dp[0]); - if (!EXTRACT_32BITS(&dp[0])) + if (!EXTRACT_BE_32BITS(&dp[0])) return (dp + 1); dp++; ND_TCHECK2(*dp, 24); @@ -1283,7 +1283,7 @@ parse_post_op_attr(netdissect_options *ndo, const uint32_t *dp, int verbose) { ND_TCHECK(dp[0]); - if (!EXTRACT_32BITS(&dp[0])) + if (!EXTRACT_BE_32BITS(&dp[0])) return (dp + 1); dp++; if (verbose) { @@ -1320,7 +1320,7 @@ parsecreateopres(netdissect_options *ndo, dp = parse_wcc_data(ndo, dp, verbose); else { ND_TCHECK(dp[0]); - if (!EXTRACT_32BITS(&dp[0])) + if (!EXTRACT_BE_32BITS(&dp[0])) return (dp + 1); dp++; if (!(dp = parsefh(ndo, dp, 1))) @@ -1393,19 +1393,19 @@ parsefsinfo(netdissect_options *ndo, sfp = (const struct nfsv3_fsinfo *)dp; ND_TCHECK(*sfp); ND_PRINT((ndo, " rtmax %u rtpref %u wtmax %u wtpref %u dtpref %u", - EXTRACT_32BITS(&sfp->fs_rtmax), - EXTRACT_32BITS(&sfp->fs_rtpref), - EXTRACT_32BITS(&sfp->fs_wtmax), - EXTRACT_32BITS(&sfp->fs_wtpref), - EXTRACT_32BITS(&sfp->fs_dtpref))); + EXTRACT_BE_32BITS(&sfp->fs_rtmax), + EXTRACT_BE_32BITS(&sfp->fs_rtpref), + EXTRACT_BE_32BITS(&sfp->fs_wtmax), + EXTRACT_BE_32BITS(&sfp->fs_wtpref), + EXTRACT_BE_32BITS(&sfp->fs_dtpref))); if (ndo->ndo_vflag) { ND_PRINT((ndo, " rtmult %u wtmult %u maxfsz %" PRIu64, - EXTRACT_32BITS(&sfp->fs_rtmult), - EXTRACT_32BITS(&sfp->fs_wtmult), - EXTRACT_64BITS((const uint32_t *)&sfp->fs_maxfilesize))); + EXTRACT_BE_32BITS(&sfp->fs_rtmult), + EXTRACT_BE_32BITS(&sfp->fs_wtmult), + EXTRACT_BE_64BITS((const uint32_t *)&sfp->fs_maxfilesize))); ND_PRINT((ndo, " delta %u.%06u ", - EXTRACT_32BITS(&sfp->fs_timedelta.nfsv3_sec), - EXTRACT_32BITS(&sfp->fs_timedelta.nfsv3_nsec))); + EXTRACT_BE_32BITS(&sfp->fs_timedelta.nfsv3_sec), + EXTRACT_BE_32BITS(&sfp->fs_timedelta.nfsv3_nsec))); } return (1); trunc: @@ -1432,12 +1432,12 @@ parsepathconf(netdissect_options *ndo, ND_TCHECK(*spp); ND_PRINT((ndo, " linkmax %u namemax %u %s %s %s %s", - EXTRACT_32BITS(&spp->pc_linkmax), - EXTRACT_32BITS(&spp->pc_namemax), - EXTRACT_32BITS(&spp->pc_notrunc) ? "notrunc" : "", - EXTRACT_32BITS(&spp->pc_chownrestricted) ? "chownres" : "", - EXTRACT_32BITS(&spp->pc_caseinsensitive) ? "igncase" : "", - EXTRACT_32BITS(&spp->pc_casepreserving) ? "keepcase" : "")); + EXTRACT_BE_32BITS(&spp->pc_linkmax), + EXTRACT_BE_32BITS(&spp->pc_namemax), + EXTRACT_BE_32BITS(&spp->pc_notrunc) ? "notrunc" : "", + EXTRACT_BE_32BITS(&spp->pc_chownrestricted) ? "chownres" : "", + EXTRACT_BE_32BITS(&spp->pc_caseinsensitive) ? "igncase" : "", + EXTRACT_BE_32BITS(&spp->pc_casepreserving) ? "keepcase" : "")); return (1); trunc: return (0); @@ -1516,7 +1516,7 @@ interp_reply(netdissect_options *ndo, break; if (!er) { ND_TCHECK(dp[0]); - ND_PRINT((ndo, " c %04x", EXTRACT_32BITS(&dp[0]))); + ND_PRINT((ndo, " c %04x", EXTRACT_BE_32BITS(&dp[0]))); } return; @@ -1538,8 +1538,8 @@ interp_reply(netdissect_options *ndo, return; if (ndo->ndo_vflag) { ND_TCHECK(dp[1]); - ND_PRINT((ndo, " %u bytes", EXTRACT_32BITS(&dp[0]))); - if (EXTRACT_32BITS(&dp[1])) + ND_PRINT((ndo, " %u bytes", EXTRACT_BE_32BITS(&dp[0]))); + if (EXTRACT_BE_32BITS(&dp[1])) ND_PRINT((ndo, " EOF")); } return; @@ -1561,12 +1561,12 @@ interp_reply(netdissect_options *ndo, return; if (ndo->ndo_vflag) { ND_TCHECK(dp[0]); - ND_PRINT((ndo, " %u bytes", EXTRACT_32BITS(&dp[0]))); + ND_PRINT((ndo, " %u bytes", EXTRACT_BE_32BITS(&dp[0]))); if (ndo->ndo_vflag > 1) { ND_TCHECK(dp[1]); ND_PRINT((ndo, " <%s>", tok2str(nfsv3_writemodes, - NULL, EXTRACT_32BITS(&dp[1])))); + NULL, EXTRACT_BE_32BITS(&dp[1])))); } return; } diff --git a/print-nsh.c b/print-nsh.c index abd722d4..42846777 100644 --- a/print-nsh.c +++ b/print-nsh.c @@ -77,7 +77,7 @@ nsh_print(netdissect_options *ndo, const u_char *bp, u_int len) bp += 1; next_protocol = *bp; bp += 1; - service_path_id = EXTRACT_24BITS(bp); + service_path_id = EXTRACT_BE_24BITS(bp); bp += 3; service_index = *bp; bp += 1; @@ -117,7 +117,7 @@ nsh_print(netdissect_options *ndo, const u_char *bp, u_int len) if (ndo->ndo_vflag > 2) { if (md_type == 0x01) { for (n = 0; n < length - 2; n++) { - ctx = EXTRACT_32BITS(bp); + ctx = EXTRACT_BE_32BITS(bp); bp += NSH_HDR_WORD_SIZE; ND_PRINT((ndo, "\n Context[%02d]: 0x%08x", n, ctx)); } @@ -125,7 +125,7 @@ nsh_print(netdissect_options *ndo, const u_char *bp, u_int len) else if (md_type == 0x02) { n = 0; while (n < length - 2) { - tlv_class = EXTRACT_16BITS(bp); + tlv_class = EXTRACT_BE_16BITS(bp); bp += 2; tlv_type = *bp; bp += 1; @@ -143,7 +143,7 @@ nsh_print(netdissect_options *ndo, const u_char *bp, u_int len) } for (vn = 0; vn < tlv_len; vn++) { - ctx = EXTRACT_32BITS(bp); + ctx = EXTRACT_BE_32BITS(bp); bp += NSH_HDR_WORD_SIZE; ND_PRINT((ndo, "\n Value[%02d]: 0x%08x", vn, ctx)); } diff --git a/print-ntp.c b/print-ntp.c index 55d26907..8da3c93f 100644 --- a/print-ntp.c +++ b/print-ntp.c @@ -306,7 +306,7 @@ ntp_time_print(netdissect_options *ndo, default: /* In NTPv4 (RFC 5905) refid is an IPv4 address or first 32 bits of MD5 sum of IPv6 address */ - ND_PRINT((ndo, "0x%08x", EXTRACT_32BITS(&bp->refid))); + ND_PRINT((ndo, "0x%08x", EXTRACT_BE_32BITS(&bp->refid))); break; } @@ -335,26 +335,26 @@ ntp_time_print(netdissect_options *ndo, /* FIXME: this code is not aware of any extension fields */ if (length == NTP_TIMEMSG_MINLEN + 4) { /* Optional: key-id (crypto-NAK) */ ND_TCHECK(bp->key_id); - ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_32BITS(&bp->key_id))); + ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_32BITS(&bp->key_id))); } else if (length == NTP_TIMEMSG_MINLEN + 4 + 16) { /* Optional: key-id + 128-bit digest */ ND_TCHECK(bp->key_id); - ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_32BITS(&bp->key_id))); + ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_32BITS(&bp->key_id))); ND_TCHECK2(bp->message_digest, 16); ND_PRINT((ndo, "\n\tAuthentication: %08x%08x%08x%08x", - EXTRACT_32BITS(bp->message_digest), - EXTRACT_32BITS(bp->message_digest + 4), - EXTRACT_32BITS(bp->message_digest + 8), - EXTRACT_32BITS(bp->message_digest + 12))); + EXTRACT_BE_32BITS(bp->message_digest), + EXTRACT_BE_32BITS(bp->message_digest + 4), + EXTRACT_BE_32BITS(bp->message_digest + 8), + EXTRACT_BE_32BITS(bp->message_digest + 12))); } else if (length == NTP_TIMEMSG_MINLEN + 4 + 20) { /* Optional: key-id + 160-bit digest */ ND_TCHECK(bp->key_id); - ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_32BITS(&bp->key_id))); + ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_32BITS(&bp->key_id))); ND_TCHECK2(bp->message_digest, 20); ND_PRINT((ndo, "\n\tAuthentication: %08x%08x%08x%08x%08x", - EXTRACT_32BITS(bp->message_digest), - EXTRACT_32BITS(bp->message_digest + 4), - EXTRACT_32BITS(bp->message_digest + 8), - EXTRACT_32BITS(bp->message_digest + 12), - EXTRACT_32BITS(bp->message_digest + 16))); + EXTRACT_BE_32BITS(bp->message_digest), + EXTRACT_BE_32BITS(bp->message_digest + 4), + EXTRACT_BE_32BITS(bp->message_digest + 8), + EXTRACT_BE_32BITS(bp->message_digest + 12), + EXTRACT_BE_32BITS(bp->message_digest + 16))); } else if (length > NTP_TIMEMSG_MINLEN) { ND_PRINT((ndo, "\n\t(%u more bytes after the header)", length - NTP_TIMEMSG_MINLEN)); } @@ -392,23 +392,23 @@ ntp_control_print(netdissect_options *ndo, M ? "More" : "Last", (unsigned)opcode)); ND_TCHECK(cd->sequence); - sequence = EXTRACT_16BITS(&cd->sequence); + sequence = EXTRACT_BE_16BITS(&cd->sequence); ND_PRINT((ndo, "\tSequence=%hu", sequence)); ND_TCHECK(cd->status); - status = EXTRACT_16BITS(&cd->status); + status = EXTRACT_BE_16BITS(&cd->status); ND_PRINT((ndo, ", Status=%#hx", status)); ND_TCHECK(cd->assoc); - assoc = EXTRACT_16BITS(&cd->assoc); + assoc = EXTRACT_BE_16BITS(&cd->assoc); ND_PRINT((ndo, ", Assoc.=%hu", assoc)); ND_TCHECK(cd->offset); - offset = EXTRACT_16BITS(&cd->offset); + offset = EXTRACT_BE_16BITS(&cd->offset); ND_PRINT((ndo, ", Offset=%hu", offset)); ND_TCHECK(cd->count); - count = EXTRACT_16BITS(&cd->count); + count = EXTRACT_BE_16BITS(&cd->count); ND_PRINT((ndo, ", Count=%hu", count)); if (NTP_CTRLMSG_MINLEN + count > length) @@ -485,8 +485,8 @@ p_sfix(netdissect_options *ndo, register int f; register double ff; - i = EXTRACT_16BITS(&sfp->int_part); - f = EXTRACT_16BITS(&sfp->fraction); + i = EXTRACT_BE_16BITS(&sfp->int_part); + f = EXTRACT_BE_16BITS(&sfp->fraction); ff = f / 65536.0; /* shift radix point by 16 bits */ f = (int)(ff * 1000000.0); /* Treat fraction as parts per million */ ND_PRINT((ndo, "%d.%06d", i, f)); @@ -503,8 +503,8 @@ p_ntp_time(netdissect_options *ndo, register uint32_t f; register double ff; - i = EXTRACT_32BITS(&lfp->int_part); - uf = EXTRACT_32BITS(&lfp->fraction); + i = EXTRACT_BE_32BITS(&lfp->int_part); + uf = EXTRACT_BE_32BITS(&lfp->fraction); ff = uf; if (ff < 0.0) /* some compilers are buggy */ ff += FMAXINT; @@ -561,10 +561,10 @@ p_ntp_delta(netdissect_options *ndo, register double ff; int signbit; - u = EXTRACT_32BITS(&lfp->int_part); - ou = EXTRACT_32BITS(&olfp->int_part); - uf = EXTRACT_32BITS(&lfp->fraction); - ouf = EXTRACT_32BITS(&olfp->fraction); + u = EXTRACT_BE_32BITS(&lfp->int_part); + ou = EXTRACT_BE_32BITS(&olfp->int_part); + uf = EXTRACT_BE_32BITS(&lfp->fraction); + ouf = EXTRACT_BE_32BITS(&olfp->fraction); if (ou == 0 && ouf == 0) { p_ntp_time(ndo, lfp); return; diff --git a/print-olsr.c b/print-olsr.c index e67988df..8f727a96 100644 --- a/print-olsr.c +++ b/print-olsr.c @@ -335,11 +335,11 @@ olsr_print(netdissect_options *ndo, ND_TCHECK2(*tptr, sizeof(struct olsr_common)); ptr.common = (const struct olsr_common *)tptr; - length = min(length, EXTRACT_16BITS(ptr.common->packet_len)); + length = min(length, EXTRACT_BE_16BITS(ptr.common->packet_len)); ND_PRINT((ndo, "OLSRv%i, seq 0x%04x, length %u", (is_ipv6 == 0) ? 4 : 6, - EXTRACT_16BITS(ptr.common->packet_seq), + EXTRACT_BE_16BITS(ptr.common->packet_seq), length)); tptr += sizeof(struct olsr_common); @@ -364,7 +364,7 @@ olsr_print(netdissect_options *ndo, ND_TCHECK2(*tptr, sizeof(struct olsr_msg6)); msgptr.v6 = (const struct olsr_msg6 *) tptr; msg_type = msgptr.v6->msg_type; - msg_len = EXTRACT_16BITS(msgptr.v6->msg_len); + msg_len = EXTRACT_BE_16BITS(msgptr.v6->msg_len); if ((msg_len >= sizeof (struct olsr_msg6)) && (msg_len <= length)) msg_len_valid = 1; @@ -381,7 +381,7 @@ olsr_print(netdissect_options *ndo, msgptr.v6->ttl, msgptr.v6->hopcount, ME_TO_DOUBLE(msgptr.v6->vtime), - EXTRACT_16BITS(msgptr.v6->msg_seq), + EXTRACT_BE_16BITS(msgptr.v6->msg_seq), msg_len, (msg_len_valid == 0) ? " (invalid)" : "")); if (!msg_len_valid) { return; @@ -395,7 +395,7 @@ olsr_print(netdissect_options *ndo, ND_TCHECK2(*tptr, sizeof(struct olsr_msg4)); msgptr.v4 = (const struct olsr_msg4 *) tptr; msg_type = msgptr.v4->msg_type; - msg_len = EXTRACT_16BITS(msgptr.v4->msg_len); + msg_len = EXTRACT_BE_16BITS(msgptr.v4->msg_len); if ((msg_len >= sizeof (struct olsr_msg4)) && (msg_len <= length)) msg_len_valid = 1; @@ -412,7 +412,7 @@ olsr_print(netdissect_options *ndo, msgptr.v4->ttl, msgptr.v4->hopcount, ME_TO_DOUBLE(msgptr.v4->vtime), - EXTRACT_16BITS(msgptr.v4->msg_seq), + EXTRACT_BE_16BITS(msgptr.v4->msg_seq), msg_len, (msg_len_valid == 0) ? " (invalid)" : "")); if (!msg_len_valid) { return; @@ -445,7 +445,7 @@ olsr_print(netdissect_options *ndo, ptr.hello_link = (const struct olsr_hello_link *)msg_data; - hello_len = EXTRACT_16BITS(ptr.hello_link->len); + hello_len = EXTRACT_BE_16BITS(ptr.hello_link->len); link_type = OLSR_EXTRACT_LINK_TYPE(ptr.hello_link->link_code); neighbor_type = OLSR_EXTRACT_NEIGHBOR_TYPE(ptr.hello_link->link_code); @@ -493,7 +493,7 @@ olsr_print(netdissect_options *ndo, ptr.tc = (const struct olsr_tc *)msg_data; ND_PRINT((ndo, "\n\t advertised neighbor seq 0x%04x", - EXTRACT_16BITS(ptr.tc->ans_seq))); + EXTRACT_BE_16BITS(ptr.tc->ans_seq))); msg_data += sizeof(struct olsr_tc); msg_tlen -= sizeof(struct olsr_tc); @@ -603,7 +603,7 @@ olsr_print(netdissect_options *ndo, ND_PRINT((ndo, "%s%s/%u", col == 0 ? "\n\t " : ", ", ipaddr_string(ndo, ptr.hna->network), - mask2plen(EXTRACT_32BITS(ptr.hna->mask)))); + mask2plen(EXTRACT_BE_32BITS(ptr.hna->mask)))); } msg_data += sizeof(struct olsr_hna4); @@ -625,7 +625,7 @@ olsr_print(netdissect_options *ndo, goto trunc; ND_TCHECK2(*msg_data, 4); - name_entries = EXTRACT_16BITS(msg_data+2); + name_entries = EXTRACT_BE_16BITS(msg_data + 2); addr_size = 4; if (is_ipv6) addr_size = 16; @@ -636,7 +636,7 @@ olsr_print(netdissect_options *ndo, name_entries_valid = 1; ND_PRINT((ndo, "\n\t Version %u, Entries %u%s", - EXTRACT_16BITS(msg_data), + EXTRACT_BE_16BITS(msg_data), name_entries, (name_entries_valid == 0) ? " (invalid)" : "")); if (name_entries_valid == 0) @@ -652,8 +652,8 @@ olsr_print(netdissect_options *ndo, break; ND_TCHECK2(*msg_data, 4); - name_entry_type = EXTRACT_16BITS(msg_data); - name_entry_len = EXTRACT_16BITS(msg_data+2); + name_entry_type = EXTRACT_BE_16BITS(msg_data); + name_entry_len = EXTRACT_BE_16BITS(msg_data + 2); msg_data += 4; msg_tlen -= 4; diff --git a/print-openflow-1.0.c b/print-openflow-1.0.c index e50c06e6..de44d5ee 100644 --- a/print-openflow-1.0.c +++ b/print-openflow-1.0.c @@ -763,7 +763,7 @@ of10_bsn_message_print(netdissect_options *ndo, goto invalid; /* subtype */ ND_TCHECK2(*cp, 4); - subtype = EXTRACT_32BITS(cp); + subtype = EXTRACT_BE_32BITS(cp); cp += 4; ND_PRINT((ndo, "\n\t subtype %s", tok2str(bsn_subtype_str, "unknown (0x%08x)", subtype))); switch (subtype) { @@ -872,7 +872,7 @@ of10_bsn_message_print(netdissect_options *ndo, goto invalid; /* vport_no */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", vport_no %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ", vport_no %u", EXTRACT_BE_32BITS(cp))); cp += 4; break; case BSN_SHELL_COMMAND: @@ -892,7 +892,7 @@ of10_bsn_message_print(netdissect_options *ndo, goto invalid; /* service */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", service %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ", service %u", EXTRACT_BE_32BITS(cp))); cp += 4; /* data */ ND_PRINT((ndo, ", data '")); @@ -939,7 +939,7 @@ of10_bsn_message_print(netdissect_options *ndo, goto invalid; /* status */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", status 0x%08x", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ", status 0x%08x", EXTRACT_BE_32BITS(cp))); cp += 4; break; default: @@ -968,7 +968,7 @@ of10_bsn_actions_print(netdissect_options *ndo, goto invalid; /* subtype */ ND_TCHECK2(*cp, 4); - subtype = EXTRACT_32BITS(cp); + subtype = EXTRACT_BE_32BITS(cp); cp += 4; ND_PRINT((ndo, "\n\t subtype %s", tok2str(bsn_action_subtype_str, "unknown (0x%08x)", subtype))); switch (subtype) { @@ -991,11 +991,11 @@ of10_bsn_actions_print(netdissect_options *ndo, goto invalid; /* dest_port */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", dest_port %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ", dest_port %u", EXTRACT_BE_32BITS(cp))); cp += 4; /* vlan_tag */ ND_TCHECK2(*cp, 4); - vlan_tag = EXTRACT_32BITS(cp); + vlan_tag = EXTRACT_BE_32BITS(cp); cp += 4; switch (vlan_tag >> 16) { case 0: @@ -1042,7 +1042,7 @@ of10_vendor_action_print(netdissect_options *ndo, goto invalid; /* vendor */ ND_TCHECK2(*cp, 4); - vendor = EXTRACT_32BITS(cp); + vendor = EXTRACT_BE_32BITS(cp); cp += 4; ND_PRINT((ndo, ", vendor 0x%08x (%s)", vendor, of_vendor_name(vendor))); /* data */ @@ -1071,7 +1071,7 @@ of10_vendor_message_print(netdissect_options *ndo, goto invalid; /* vendor */ ND_TCHECK2(*cp, 4); - vendor = EXTRACT_32BITS(cp); + vendor = EXTRACT_BE_32BITS(cp); cp += 4; ND_PRINT((ndo, ", vendor 0x%08x (%s)", vendor, of_vendor_name(vendor))); /* data */ @@ -1100,7 +1100,7 @@ of10_vendor_data_print(netdissect_options *ndo, goto invalid; /* vendor */ ND_TCHECK2(*cp, 4); - vendor = EXTRACT_32BITS(cp); + vendor = EXTRACT_BE_32BITS(cp); cp += 4; ND_PRINT((ndo, ", vendor 0x%08x (%s)", vendor, of_vendor_name(vendor))); /* data */ @@ -1150,7 +1150,7 @@ of10_phy_ports_print(netdissect_options *ndo, goto invalid; /* port_no */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); cp += 2; /* hw_addr */ ND_TCHECK2(*cp, ETHER_ADDR_LEN); @@ -1170,33 +1170,39 @@ of10_phy_ports_print(netdissect_options *ndo, } /* config */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t config 0x%08x", EXTRACT_32BITS(cp))); - of10_bitmap_print(ndo, ofppc_bm, EXTRACT_32BITS(cp), OFPPC_U); + ND_PRINT((ndo, "\n\t config 0x%08x", EXTRACT_BE_32BITS(cp))); + of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_32BITS(cp), + OFPPC_U); cp += 4; /* state */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t state 0x%08x", EXTRACT_32BITS(cp))); - of10_bitmap_print(ndo, ofpps_bm, EXTRACT_32BITS(cp), OFPPS_U); + ND_PRINT((ndo, "\n\t state 0x%08x", EXTRACT_BE_32BITS(cp))); + of10_bitmap_print(ndo, ofpps_bm, EXTRACT_BE_32BITS(cp), + OFPPS_U); cp += 4; /* curr */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t curr 0x%08x", EXTRACT_32BITS(cp))); - of10_bitmap_print(ndo, ofppf_bm, EXTRACT_32BITS(cp), OFPPF_U); + ND_PRINT((ndo, "\n\t curr 0x%08x", EXTRACT_BE_32BITS(cp))); + of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp), + OFPPF_U); cp += 4; /* advertised */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t advertised 0x%08x", EXTRACT_32BITS(cp))); - of10_bitmap_print(ndo, ofppf_bm, EXTRACT_32BITS(cp), OFPPF_U); + ND_PRINT((ndo, "\n\t advertised 0x%08x", EXTRACT_BE_32BITS(cp))); + of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp), + OFPPF_U); cp += 4; /* supported */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t supported 0x%08x", EXTRACT_32BITS(cp))); - of10_bitmap_print(ndo, ofppf_bm, EXTRACT_32BITS(cp), OFPPF_U); + ND_PRINT((ndo, "\n\t supported 0x%08x", EXTRACT_BE_32BITS(cp))); + of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp), + OFPPF_U); cp += 4; /* peer */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t peer 0x%08x", EXTRACT_32BITS(cp))); - of10_bitmap_print(ndo, ofppf_bm, EXTRACT_32BITS(cp), OFPPF_U); + ND_PRINT((ndo, "\n\t peer 0x%08x", EXTRACT_BE_32BITS(cp))); + of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp), + OFPPF_U); cp += 4; next_port: len -= OF_PHY_PORT_LEN; @@ -1228,12 +1234,12 @@ of10_queue_props_print(netdissect_options *ndo, goto invalid; /* property */ ND_TCHECK2(*cp, 2); - property = EXTRACT_16BITS(cp); + property = EXTRACT_BE_16BITS(cp); cp += 2; ND_PRINT((ndo, "\n\t property %s", tok2str(ofpqt_str, "invalid (0x%04x)", property))); /* len */ ND_TCHECK2(*cp, 2); - plen = EXTRACT_16BITS(cp); + plen = EXTRACT_BE_16BITS(cp); cp += 2; ND_PRINT((ndo, ", len %u", plen)); if (plen < OF_QUEUE_PROP_HEADER_LEN || plen > len) @@ -1264,7 +1270,7 @@ of10_queue_props_print(netdissect_options *ndo, if (property == OFPQT_MIN_RATE) { /* the only case of property decoding */ /* rate */ ND_TCHECK2(*cp, 2); - rate = EXTRACT_16BITS(cp); + rate = EXTRACT_BE_16BITS(cp); cp += 2; if (rate > 1000) ND_PRINT((ndo, ", rate disabled")); @@ -1302,11 +1308,11 @@ of10_queues_print(netdissect_options *ndo, goto invalid; /* queue_id */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t queue_id %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, "\n\t queue_id %u", EXTRACT_BE_32BITS(cp))); cp += 4; /* len */ ND_TCHECK2(*cp, 2); - desclen = EXTRACT_16BITS(cp); + desclen = EXTRACT_BE_16BITS(cp); cp += 2; ND_PRINT((ndo, ", len %u", desclen)); if (desclen < OF_PACKET_QUEUE_LEN || desclen > len) @@ -1349,14 +1355,14 @@ of10_match_print(netdissect_options *ndo, /* wildcards */ ND_TCHECK2(*cp, 4); - wildcards = EXTRACT_32BITS(cp); + wildcards = EXTRACT_BE_32BITS(cp); if (wildcards & OFPFW_U) ND_PRINT((ndo, "%swildcards 0x%08x (bogus)", pfx, wildcards)); cp += 4; /* in_port */ ND_TCHECK2(*cp, 2); if (! (wildcards & OFPFW_IN_PORT)) - ND_PRINT((ndo, "%smatch in_port %s", pfx, tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, "%smatch in_port %s", pfx, tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); cp += 2; /* dl_src */ ND_TCHECK2(*cp, ETHER_ADDR_LEN); @@ -1371,7 +1377,7 @@ of10_match_print(netdissect_options *ndo, /* dl_vlan */ ND_TCHECK2(*cp, 2); if (! (wildcards & OFPFW_DL_VLAN)) - ND_PRINT((ndo, "%smatch dl_vlan %s", pfx, vlan_str(EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, "%smatch dl_vlan %s", pfx, vlan_str(EXTRACT_BE_16BITS(cp)))); cp += 2; /* dl_vlan_pcp */ ND_TCHECK2(*cp, 1); @@ -1383,7 +1389,7 @@ of10_match_print(netdissect_options *ndo, cp += 1; /* dl_type */ ND_TCHECK2(*cp, 2); - dl_type = EXTRACT_16BITS(cp); + dl_type = EXTRACT_BE_16BITS(cp); cp += 2; if (! (wildcards & OFPFW_DL_TYPE)) ND_PRINT((ndo, "%smatch dl_type 0x%04x", pfx, dl_type)); @@ -1422,7 +1428,7 @@ of10_match_print(netdissect_options *ndo, field_name = ! (wildcards & OFPFW_DL_TYPE) && dl_type == ETHERTYPE_IP && ! (wildcards & OFPFW_NW_PROTO) && nw_proto == IPPROTO_ICMP ? "icmp_type" : "tp_src"; - ND_PRINT((ndo, "%smatch %s %u", pfx, field_name, EXTRACT_16BITS(cp))); + ND_PRINT((ndo, "%smatch %s %u", pfx, field_name, EXTRACT_BE_16BITS(cp))); } cp += 2; /* tp_dst */ @@ -1431,7 +1437,7 @@ of10_match_print(netdissect_options *ndo, field_name = ! (wildcards & OFPFW_DL_TYPE) && dl_type == ETHERTYPE_IP && ! (wildcards & OFPFW_NW_PROTO) && nw_proto == IPPROTO_ICMP ? "icmp_code" : "tp_dst"; - ND_PRINT((ndo, "%smatch %s %u", pfx, field_name, EXTRACT_16BITS(cp))); + ND_PRINT((ndo, "%smatch %s %u", pfx, field_name, EXTRACT_BE_16BITS(cp))); } return cp + 2; @@ -1457,12 +1463,12 @@ of10_actions_print(netdissect_options *ndo, goto invalid; /* type */ ND_TCHECK2(*cp, 2); - type = EXTRACT_16BITS(cp); + type = EXTRACT_BE_16BITS(cp); cp += 2; ND_PRINT((ndo, "%saction type %s", pfx, tok2str(ofpat_str, "invalid (0x%04x)", type))); /* length */ ND_TCHECK2(*cp, 2); - alen = EXTRACT_16BITS(cp); + alen = EXTRACT_BE_16BITS(cp); cp += 2; ND_PRINT((ndo, ", len %u", alen)); /* On action size underrun/overrun skip the rest of the action list. */ @@ -1507,19 +1513,19 @@ of10_actions_print(netdissect_options *ndo, case OFPAT_OUTPUT: /* port */ ND_TCHECK2(*cp, 2); - output_port = EXTRACT_16BITS(cp); + output_port = EXTRACT_BE_16BITS(cp); cp += 2; ND_PRINT((ndo, ", port %s", tok2str(ofpp_str, "%u", output_port))); /* max_len */ ND_TCHECK2(*cp, 2); if (output_port == OFPP_CONTROLLER) - ND_PRINT((ndo, ", max_len %u", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, ", max_len %u", EXTRACT_BE_16BITS(cp))); cp += 2; break; case OFPAT_SET_VLAN_VID: /* vlan_vid */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", vlan_vid %s", vlan_str(EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, ", vlan_vid %s", vlan_str(EXTRACT_BE_16BITS(cp)))); cp += 2; /* pad */ ND_TCHECK2(*cp, 2); @@ -1564,7 +1570,7 @@ of10_actions_print(netdissect_options *ndo, case OFPAT_SET_TP_DST: /* nw_tos */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", tp_port %u", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, ", tp_port %u", EXTRACT_BE_16BITS(cp))); cp += 2; /* pad */ ND_TCHECK2(*cp, 2); @@ -1573,14 +1579,14 @@ of10_actions_print(netdissect_options *ndo, case OFPAT_ENQUEUE: /* port */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", port %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, ", port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); cp += 2; /* pad */ ND_TCHECK2(*cp, 6); cp += 6; /* queue_id */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_32BITS(cp)))); + ND_PRINT((ndo, ", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_BE_32BITS(cp)))); cp += 4; break; case OFPAT_VENDOR: @@ -1614,11 +1620,11 @@ of10_features_reply_print(netdissect_options *ndo, { /* datapath_id */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, "\n\t dpid 0x%016" PRIx64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, "\n\t dpid 0x%016" PRIx64, EXTRACT_BE_64BITS(cp))); cp += 8; /* n_buffers */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", n_buffers %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ", n_buffers %u", EXTRACT_BE_32BITS(cp))); cp += 4; /* n_tables */ ND_TCHECK2(*cp, 1); @@ -1629,13 +1635,14 @@ of10_features_reply_print(netdissect_options *ndo, cp += 3; /* capabilities */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t capabilities 0x%08x", EXTRACT_32BITS(cp))); - of10_bitmap_print(ndo, ofp_capabilities_bm, EXTRACT_32BITS(cp), OFPCAP_U); + ND_PRINT((ndo, "\n\t capabilities 0x%08x", EXTRACT_BE_32BITS(cp))); + of10_bitmap_print(ndo, ofp_capabilities_bm, EXTRACT_BE_32BITS(cp), + OFPCAP_U); cp += 4; /* actions */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t actions 0x%08x", EXTRACT_32BITS(cp))); - of10_bitmap_print(ndo, ofpat_bm, EXTRACT_32BITS(cp), OFPAT_U); + ND_PRINT((ndo, "\n\t actions 0x%08x", EXTRACT_BE_32BITS(cp))); + of10_bitmap_print(ndo, ofpat_bm, EXTRACT_BE_32BITS(cp), OFPAT_U); cp += 4; /* ports */ return of10_phy_ports_print(ndo, cp, ep, len - OF_SWITCH_FEATURES_LEN); @@ -1657,43 +1664,43 @@ of10_flow_mod_print(netdissect_options *ndo, return ep; /* end of snapshot */ /* cookie */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, "\n\t cookie 0x%016" PRIx64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, "\n\t cookie 0x%016" PRIx64, EXTRACT_BE_64BITS(cp))); cp += 8; /* command */ ND_TCHECK2(*cp, 2); - command = EXTRACT_16BITS(cp); + command = EXTRACT_BE_16BITS(cp); ND_PRINT((ndo, ", command %s", tok2str(ofpfc_str, "invalid (0x%04x)", command))); cp += 2; /* idle_timeout */ ND_TCHECK2(*cp, 2); - if (EXTRACT_16BITS(cp)) - ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_16BITS(cp))); + if (EXTRACT_BE_16BITS(cp)) + ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_16BITS(cp))); cp += 2; /* hard_timeout */ ND_TCHECK2(*cp, 2); - if (EXTRACT_16BITS(cp)) - ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_16BITS(cp))); + if (EXTRACT_BE_16BITS(cp)) + ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_BE_16BITS(cp))); cp += 2; /* priority */ ND_TCHECK2(*cp, 2); - if (EXTRACT_16BITS(cp)) - ND_PRINT((ndo, ", priority %u", EXTRACT_16BITS(cp))); + if (EXTRACT_BE_16BITS(cp)) + ND_PRINT((ndo, ", priority %u", EXTRACT_BE_16BITS(cp))); cp += 2; /* buffer_id */ ND_TCHECK2(*cp, 4); if (command == OFPFC_ADD || command == OFPFC_MODIFY || command == OFPFC_MODIFY_STRICT) - ND_PRINT((ndo, ", buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_32BITS(cp)))); + ND_PRINT((ndo, ", buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_BE_32BITS(cp)))); cp += 4; /* out_port */ ND_TCHECK2(*cp, 2); if (command == OFPFC_DELETE || command == OFPFC_DELETE_STRICT) - ND_PRINT((ndo, ", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, ", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); cp += 2; /* flags */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_16BITS(cp))); - of10_bitmap_print(ndo, ofpff_bm, EXTRACT_16BITS(cp), OFPFF_U); + ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_16BITS(cp))); + of10_bitmap_print(ndo, ofpff_bm, EXTRACT_BE_16BITS(cp), OFPFF_U); cp += 2; /* actions */ return of10_actions_print(ndo, "\n\t ", cp, ep, len - OF_FLOW_MOD_LEN); @@ -1710,7 +1717,7 @@ of10_port_mod_print(netdissect_options *ndo, { /* port_no */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); cp += 2; /* hw_addr */ ND_TCHECK2(*cp, ETHER_ADDR_LEN); @@ -1718,18 +1725,18 @@ of10_port_mod_print(netdissect_options *ndo, cp += ETHER_ADDR_LEN; /* config */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t config 0x%08x", EXTRACT_32BITS(cp))); - of10_bitmap_print(ndo, ofppc_bm, EXTRACT_32BITS(cp), OFPPC_U); + ND_PRINT((ndo, "\n\t config 0x%08x", EXTRACT_BE_32BITS(cp))); + of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_32BITS(cp), OFPPC_U); cp += 4; /* mask */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t mask 0x%08x", EXTRACT_32BITS(cp))); - of10_bitmap_print(ndo, ofppc_bm, EXTRACT_32BITS(cp), OFPPC_U); + ND_PRINT((ndo, "\n\t mask 0x%08x", EXTRACT_BE_32BITS(cp))); + of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_32BITS(cp), OFPPC_U); cp += 4; /* advertise */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t advertise 0x%08x", EXTRACT_32BITS(cp))); - of10_bitmap_print(ndo, ofppf_bm, EXTRACT_32BITS(cp), OFPPF_U); + ND_PRINT((ndo, "\n\t advertise 0x%08x", EXTRACT_BE_32BITS(cp))); + of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp), OFPPF_U); cp += 4; /* pad */ ND_TCHECK2(*cp, 4); @@ -1751,13 +1758,13 @@ of10_stats_request_print(netdissect_options *ndo, /* type */ ND_TCHECK2(*cp, 2); - type = EXTRACT_16BITS(cp); + type = EXTRACT_BE_16BITS(cp); cp += 2; ND_PRINT((ndo, "\n\t type %s", tok2str(ofpst_str, "invalid (0x%04x)", type))); /* flags */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_16BITS(cp))); - if (EXTRACT_16BITS(cp)) + ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_16BITS(cp))); + if (EXTRACT_BE_16BITS(cp)) ND_PRINT((ndo, " (bogus)")); cp += 2; /* type-specific body of one of fixed lengths */ @@ -1784,14 +1791,14 @@ of10_stats_request_print(netdissect_options *ndo, cp += 1; /* out_port */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, ", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); return cp + 2; case OFPST_PORT: if (len != OF_PORT_STATS_REQUEST_LEN) goto invalid; /* port_no */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); cp += 2; /* pad */ ND_TCHECK2(*cp, 6); @@ -1801,14 +1808,14 @@ of10_stats_request_print(netdissect_options *ndo, goto invalid; /* port_no */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); cp += 2; /* pad */ ND_TCHECK2(*cp, 2); cp += 2; /* queue_id */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_32BITS(cp)))); + ND_PRINT((ndo, ", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_BE_32BITS(cp)))); return cp + 4; case OFPST_VENDOR: return of10_vendor_data_print(ndo, cp, ep, len); @@ -1885,7 +1892,7 @@ of10_flow_stats_reply_print(netdissect_options *ndo, goto invalid; /* length */ ND_TCHECK2(*cp, 2); - entry_len = EXTRACT_16BITS(cp); + entry_len = EXTRACT_BE_16BITS(cp); ND_PRINT((ndo, "\n\t length %u", entry_len)); if (entry_len < OF_FLOW_STATS_LEN || entry_len > len) goto invalid; @@ -1902,38 +1909,38 @@ of10_flow_stats_reply_print(netdissect_options *ndo, return ep; /* end of snapshot */ /* duration_sec */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t duration_sec %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, "\n\t duration_sec %u", EXTRACT_BE_32BITS(cp))); cp += 4; /* duration_nsec */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_BE_32BITS(cp))); cp += 4; /* priority */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", priority %u", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, ", priority %u", EXTRACT_BE_16BITS(cp))); cp += 2; /* idle_timeout */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_16BITS(cp))); cp += 2; /* hard_timeout */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_BE_16BITS(cp))); cp += 2; /* pad2 */ ND_TCHECK2(*cp, 6); cp += 6; /* cookie */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", cookie 0x%016" PRIx64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", cookie 0x%016" PRIx64, EXTRACT_BE_64BITS(cp))); cp += 8; /* packet_count */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* byte_count */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* actions */ if (ep == (cp = of10_actions_print(ndo, "\n\t ", cp, ep, entry_len - OF_FLOW_STATS_LEN))) @@ -1962,15 +1969,15 @@ of10_aggregate_stats_reply_print(netdissect_options *ndo, goto invalid; /* packet_count */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, "\n\t packet_count %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, "\n\t packet_count %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* byte_count */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* flow_count */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", flow_count %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ", flow_count %u", EXTRACT_BE_32BITS(cp))); cp += 4; /* pad */ ND_TCHECK2(*cp, 4); @@ -2011,24 +2018,25 @@ of10_table_stats_reply_print(netdissect_options *ndo, cp += OFP_MAX_TABLE_NAME_LEN; /* wildcards */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t wildcards 0x%08x", EXTRACT_32BITS(cp))); - of10_bitmap_print(ndo, ofpfw_bm, EXTRACT_32BITS(cp), OFPFW_U); + ND_PRINT((ndo, "\n\t wildcards 0x%08x", EXTRACT_BE_32BITS(cp))); + of10_bitmap_print(ndo, ofpfw_bm, EXTRACT_BE_32BITS(cp), + OFPFW_U); cp += 4; /* max_entries */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t max_entries %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, "\n\t max_entries %u", EXTRACT_BE_32BITS(cp))); cp += 4; /* active_count */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", active_count %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ", active_count %u", EXTRACT_BE_32BITS(cp))); cp += 4; /* lookup_count */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", lookup_count %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", lookup_count %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* matched_count */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", matched_count %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", matched_count %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; len -= OF_TABLE_STATS_LEN; @@ -2057,7 +2065,7 @@ of10_port_stats_reply_print(netdissect_options *ndo, goto invalid; /* port_no */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); cp += 2; if (ndo->ndo_vflag < 2) { ND_TCHECK2(*cp, OF_PORT_STATS_LEN - 2); @@ -2069,51 +2077,51 @@ of10_port_stats_reply_print(netdissect_options *ndo, cp += 6; /* rx_packets */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", rx_packets %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", rx_packets %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* tx_packets */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* rx_bytes */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", rx_bytes %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", rx_bytes %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* tx_bytes */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* rx_dropped */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", rx_dropped %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", rx_dropped %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* tx_dropped */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", tx_dropped %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", tx_dropped %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* rx_errors */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", rx_errors %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", rx_errors %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* tx_errors */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* rx_frame_err */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", rx_frame_err %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", rx_frame_err %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* rx_over_err */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", rx_over_err %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", rx_over_err %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* rx_crc_err */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", rx_crc_err %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", rx_crc_err %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* collisions */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", collisions %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", collisions %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; next_port: len -= OF_PORT_STATS_LEN; @@ -2142,26 +2150,26 @@ of10_queue_stats_reply_print(netdissect_options *ndo, goto invalid; /* port_no */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); cp += 2; /* pad */ ND_TCHECK2(*cp, 2); cp += 2; /* queue_id */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", queue_id %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ", queue_id %u", EXTRACT_BE_32BITS(cp))); cp += 4; /* tx_bytes */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* tx_packets */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* tx_errors */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; len -= OF_QUEUE_STATS_LEN; @@ -2187,13 +2195,14 @@ of10_stats_reply_print(netdissect_options *ndo, /* type */ ND_TCHECK2(*cp, 2); - type = EXTRACT_16BITS(cp); + type = EXTRACT_BE_16BITS(cp); ND_PRINT((ndo, "\n\t type %s", tok2str(ofpst_str, "invalid (0x%04x)", type))); cp += 2; /* flags */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_16BITS(cp))); - of10_bitmap_print(ndo, ofpsf_reply_bm, EXTRACT_16BITS(cp), OFPSF_REPLY_U); + ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_16BITS(cp))); + of10_bitmap_print(ndo, ofpsf_reply_bm, EXTRACT_BE_16BITS(cp), + OFPSF_REPLY_U); cp += 2; if (ndo->ndo_vflag > 0) { @@ -2228,15 +2237,15 @@ of10_packet_out_print(netdissect_options *ndo, /* buffer_id */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t buffer_id 0x%08x", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, "\n\t buffer_id 0x%08x", EXTRACT_BE_32BITS(cp))); cp += 4; /* in_port */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); cp += 2; /* actions_len */ ND_TCHECK2(*cp, 2); - actions_len = EXTRACT_16BITS(cp); + actions_len = EXTRACT_BE_16BITS(cp); cp += 2; if (actions_len > len - OF_PACKET_OUT_LEN) goto invalid; @@ -2262,15 +2271,15 @@ of10_packet_in_print(netdissect_options *ndo, { /* buffer_id */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_32BITS(cp)))); + ND_PRINT((ndo, "\n\t buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_BE_32BITS(cp)))); cp += 4; /* total_len */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", total_len %u", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, ", total_len %u", EXTRACT_BE_16BITS(cp))); cp += 2; /* in_port */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); cp += 2; /* reason */ ND_TCHECK2(*cp, 1); @@ -2298,12 +2307,12 @@ of10_flow_removed_print(netdissect_options *ndo, return ep; /* end of snapshot */ /* cookie */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, "\n\t cookie 0x%016" PRIx64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, "\n\t cookie 0x%016" PRIx64, EXTRACT_BE_64BITS(cp))); cp += 8; /* priority */ ND_TCHECK2(*cp, 2); - if (EXTRACT_16BITS(cp)) - ND_PRINT((ndo, ", priority %u", EXTRACT_16BITS(cp))); + if (EXTRACT_BE_16BITS(cp)) + ND_PRINT((ndo, ", priority %u", EXTRACT_BE_16BITS(cp))); cp += 2; /* reason */ ND_TCHECK2(*cp, 1); @@ -2314,27 +2323,27 @@ of10_flow_removed_print(netdissect_options *ndo, cp += 1; /* duration_sec */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", duration_sec %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ", duration_sec %u", EXTRACT_BE_32BITS(cp))); cp += 4; /* duration_nsec */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_BE_32BITS(cp))); cp += 4; /* idle_timeout */ ND_TCHECK2(*cp, 2); - if (EXTRACT_16BITS(cp)) - ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_16BITS(cp))); + if (EXTRACT_BE_16BITS(cp)) + ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_16BITS(cp))); cp += 2; /* pad2 */ ND_TCHECK2(*cp, 2); cp += 2; /* packet_count */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_BE_64BITS(cp))); cp += 8; /* byte_count */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_64BITS(cp))); + ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_64BITS(cp))); return cp + 8; trunc: @@ -2352,7 +2361,7 @@ of10_error_print(netdissect_options *ndo, /* type */ ND_TCHECK2(*cp, 2); - type = EXTRACT_16BITS(cp); + type = EXTRACT_BE_16BITS(cp); cp += 2; ND_PRINT((ndo, "\n\t type %s", tok2str(ofpet_str, "invalid (0x%04x)", type))); /* code */ @@ -2365,7 +2374,7 @@ of10_error_print(netdissect_options *ndo, type == OFPET_PORT_MOD_FAILED ? ofppmfc_str : type == OFPET_QUEUE_OP_FAILED ? ofpqofc_str : empty_str; - ND_PRINT((ndo, ", code %s", tok2str(code_str, "invalid (0x%04x)", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, ", code %s", tok2str(code_str, "invalid (0x%04x)", EXTRACT_BE_16BITS(cp)))); cp += 2; /* data */ return of10_data_print(ndo, cp, ep, len - OF_ERROR_MSG_LEN); @@ -2411,11 +2420,11 @@ of10_header_body_print(netdissect_options *ndo, goto next_message; /* flags */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, "\n\t flags %s", tok2str(ofp_config_str, "invalid (0x%04x)", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, "\n\t flags %s", tok2str(ofp_config_str, "invalid (0x%04x)", EXTRACT_BE_16BITS(cp)))); cp += 2; /* miss_send_len */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", miss_send_len %u", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, ", miss_send_len %u", EXTRACT_BE_16BITS(cp))); return cp + 2; case OFPT_PORT_MOD: if (len != OF_PORT_MOD_LEN) @@ -2430,7 +2439,7 @@ of10_header_body_print(netdissect_options *ndo, goto next_message; /* port */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); cp += 2; /* pad */ ND_TCHECK2(*cp, 2); @@ -2539,7 +2548,7 @@ of10_header_body_print(netdissect_options *ndo, goto next_message; /* port */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); cp += 2; /* pad */ ND_TCHECK2(*cp, 6); diff --git a/print-openflow.c b/print-openflow.c index 043adc2e..4918faf7 100644 --- a/print-openflow.c +++ b/print-openflow.c @@ -94,11 +94,11 @@ of_header_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep cp += 1; /* length */ ND_TCHECK2(*cp, 2); - length = EXTRACT_16BITS(cp); + length = EXTRACT_BE_16BITS(cp); cp += 2; /* xid */ ND_TCHECK2(*cp, 4); - xid = EXTRACT_32BITS(cp); + xid = EXTRACT_BE_32BITS(cp); cp += 4; /* Message length includes the header length and a message always includes * the basic header. A message length underrun fails decoding of the rest of diff --git a/print-ospf.c b/print-ospf.c index 8dad2eaa..22eb4c52 100644 --- a/print-ospf.c +++ b/print-ospf.c @@ -192,8 +192,8 @@ ospf_print_grace_lsa(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Remaining LS length %u < 4", ls_length)); return -1; } - tlv_type = EXTRACT_16BITS(tptr); - tlv_length = EXTRACT_16BITS(tptr+2); + tlv_type = EXTRACT_BE_16BITS(tptr); + tlv_length = EXTRACT_BE_16BITS(tptr + 2); tptr+=4; ls_length-=4; @@ -221,7 +221,7 @@ ospf_print_grace_lsa(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Bogus length %u != 4", tlv_length)); return -1; } - ND_PRINT((ndo, "%us", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "%us", EXTRACT_BE_32BITS(tptr))); break; case LS_OPAQUE_GRACE_TLV_REASON: @@ -279,8 +279,8 @@ ospf_print_te_lsa(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Remaining LS length %u < 4", ls_length)); return -1; } - tlv_type = EXTRACT_16BITS(tptr); - tlv_length = EXTRACT_16BITS(tptr+2); + tlv_type = EXTRACT_BE_16BITS(tptr); + tlv_length = EXTRACT_BE_16BITS(tptr + 2); tptr+=4; ls_length-=4; @@ -309,8 +309,8 @@ ospf_print_te_lsa(netdissect_options *ndo, return -1; } ND_TCHECK2(*tptr, 4); - subtlv_type = EXTRACT_16BITS(tptr); - subtlv_length = EXTRACT_16BITS(tptr+2); + subtlv_type = EXTRACT_BE_16BITS(tptr); + subtlv_length = EXTRACT_BE_16BITS(tptr + 2); tptr+=4; tlv_length-=4; @@ -330,7 +330,7 @@ ospf_print_te_lsa(netdissect_options *ndo, ND_PRINT((ndo, " != 4")); goto invalid; } - ND_PRINT((ndo, ", 0x%08x", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_32BITS(tptr))); break; case LS_OPAQUE_TE_LINK_SUBTLV_LINK_ID: case LS_OPAQUE_TE_LINK_SUBTLV_LINK_LOCAL_REMOTE_ID: @@ -340,11 +340,11 @@ ospf_print_te_lsa(netdissect_options *ndo, } ND_PRINT((ndo, ", %s (0x%08x)", ipaddr_string(ndo, tptr), - EXTRACT_32BITS(tptr))); + EXTRACT_BE_32BITS(tptr))); if (subtlv_length == 8) /* rfc4203 */ ND_PRINT((ndo, ", %s (0x%08x)", ipaddr_string(ndo, tptr+4), - EXTRACT_32BITS(tptr + 4))); + EXTRACT_BE_32BITS(tptr + 4))); break; case LS_OPAQUE_TE_LINK_SUBTLV_LOCAL_IP: case LS_OPAQUE_TE_LINK_SUBTLV_REMOTE_IP: @@ -360,7 +360,7 @@ ospf_print_te_lsa(netdissect_options *ndo, ND_PRINT((ndo, " != 4")); goto invalid; } - bw.i = EXTRACT_32BITS(tptr); + bw.i = EXTRACT_BE_32BITS(tptr); ND_PRINT((ndo, ", %.3f Mbps", bw.f * 8 / 1000000)); break; case LS_OPAQUE_TE_LINK_SUBTLV_UNRES_BW: @@ -369,7 +369,7 @@ ospf_print_te_lsa(netdissect_options *ndo, goto invalid; } for (te_class = 0; te_class < 8; te_class++) { - bw.i = EXTRACT_32BITS(tptr+te_class*4); + bw.i = EXTRACT_BE_32BITS(tptr + te_class * 4); ND_PRINT((ndo, "\n\t\tTE-Class %u: %.3f Mbps", te_class, bw.f * 8 / 1000000)); @@ -394,7 +394,7 @@ ospf_print_te_lsa(netdissect_options *ndo, } /* decode BCs until the subTLV ends */ for (te_class = 0; te_class < (subtlv_length-4)/4; te_class++) { - bw.i = EXTRACT_32BITS(tptr+4+te_class*4); + bw.i = EXTRACT_BE_32BITS(tptr + 4 + te_class * 4); ND_PRINT((ndo, "\n\t\t Bandwidth constraint CT%u: %.3f Mbps", te_class, bw.f * 8 / 1000000)); @@ -405,7 +405,7 @@ ospf_print_te_lsa(netdissect_options *ndo, ND_PRINT((ndo, " != 4")); goto invalid; } - ND_PRINT((ndo, ", Metric %u", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, ", Metric %u", EXTRACT_BE_32BITS(tptr))); break; case LS_OPAQUE_TE_LINK_SUBTLV_LINK_PROTECTION_TYPE: /* Protection Cap (1 octet) + Reserved ((3 octets) */ @@ -427,7 +427,7 @@ ospf_print_te_lsa(netdissect_options *ndo, ND_PRINT((ndo, "\n\t\tLSP Encoding: %s\n\t\tMax LSP Bandwidth:", tok2str(gmpls_encoding_values, "Unknown", *(tptr + 1)))); for (priority_level = 0; priority_level < 8; priority_level++) { - bw.i = EXTRACT_32BITS(tptr+4+(priority_level*4)); + bw.i = EXTRACT_BE_32BITS(tptr + 4 + (priority_level * 4)); ND_PRINT((ndo, "\n\t\t priority level %d: %.3f Mbps", priority_level, bw.f * 8 / 1000000)); @@ -452,7 +452,7 @@ ospf_print_te_lsa(netdissect_options *ndo, if (count_srlg != 0) ND_PRINT((ndo, "\n\t\t Shared risk group: ")); while (count_srlg > 0) { - bw.i = EXTRACT_32BITS(tptr); + bw.i = EXTRACT_BE_32BITS(tptr); ND_PRINT((ndo, "%d", bw.i)); tptr+=4; count_srlg--; @@ -515,7 +515,7 @@ ospf_print_lshdr(netdissect_options *ndo, u_int ls_length; ND_TCHECK(lshp->ls_length); - ls_length = EXTRACT_16BITS(&lshp->ls_length); + ls_length = EXTRACT_BE_16BITS(&lshp->ls_length); if (ls_length < sizeof(struct lsa_hdr)) { ND_PRINT((ndo, "\n\t Bogus length %u < header (%lu)", ls_length, (unsigned long)sizeof(struct lsa_hdr))); @@ -525,8 +525,8 @@ ospf_print_lshdr(netdissect_options *ndo, ND_TCHECK(lshp->ls_seq); /* XXX - ls_length check checked this */ ND_PRINT((ndo, "\n\t Advertising Router %s, seq 0x%08x, age %us, length %u", ipaddr_string(ndo, &lshp->ls_router), - EXTRACT_32BITS(&lshp->ls_seq), - EXTRACT_16BITS(&lshp->ls_age), + EXTRACT_BE_32BITS(&lshp->ls_seq), + EXTRACT_BE_16BITS(&lshp->ls_age), ls_length - (u_int)sizeof(struct lsa_hdr))); ND_TCHECK(lshp->ls_type); /* XXX - ls_length check checked this */ @@ -543,7 +543,7 @@ ospf_print_lshdr(netdissect_options *ndo, "unknown", *(&lshp->un_lsa_id.opaque_field.opaque_type)), *(&lshp->un_lsa_id.opaque_field.opaque_type), - EXTRACT_24BITS(&lshp->un_lsa_id.opaque_field.opaque_id) + EXTRACT_BE_24BITS(&lshp->un_lsa_id.opaque_field.opaque_id) )); break; @@ -595,7 +595,7 @@ ospf_print_tos_metrics(netdissect_options *ndo, tok2str(ospf_topology_values, "Unknown", metric_count ? tos->metrics.tos_type : 0), metric_count ? tos->metrics.tos_type : 0, - EXTRACT_16BITS(&tos->metrics.tos_metric))); + EXTRACT_BE_16BITS(&tos->metrics.tos_metric))); metric_count++; tos++; toscount--; @@ -639,7 +639,7 @@ ospf_print_lsa(netdissect_options *ndo, bittok2str(ospf_rla_flag_values, "none", lsap->lsa_un.un_rla.rla_flags))); ND_TCHECK(lsap->lsa_un.un_rla.rla_count); - j = EXTRACT_16BITS(&lsap->lsa_un.un_rla.rla_count); + j = EXTRACT_BE_16BITS(&lsap->lsa_un.un_rla.rla_count); ND_TCHECK(lsap->lsa_un.un_rla.rla_link); rlp = lsap->lsa_un.un_rla.rla_link; while (j--) { @@ -706,7 +706,7 @@ ospf_print_lsa(netdissect_options *ndo, register uint32_t ul; ND_TCHECK(*lp); - ul = EXTRACT_32BITS(lp); + ul = EXTRACT_BE_32BITS(lp); topology = (ul & SLA_MASK_TOS) >> SLA_SHIFT_TOS; ND_PRINT((ndo, "\n\t\ttopology %s (%u) metric %d", tok2str(ospf_topology_values, "Unknown", topology), @@ -723,7 +723,7 @@ ospf_print_lsa(netdissect_options *ndo, register uint32_t ul; ND_TCHECK(*lp); - ul = EXTRACT_32BITS(lp); + ul = EXTRACT_BE_32BITS(lp); topology = (ul & SLA_MASK_TOS) >> SLA_SHIFT_TOS; ND_PRINT((ndo, "\n\t\ttopology %s (%u) metric %d", tok2str(ospf_topology_values, "Unknown", topology), @@ -745,7 +745,7 @@ ospf_print_lsa(netdissect_options *ndo, register uint32_t ul; ND_TCHECK(almp->asla_tosmetric); - ul = EXTRACT_32BITS(&almp->asla_tosmetric); + ul = EXTRACT_BE_32BITS(&almp->asla_tosmetric); topology = ((ul & ASLA_MASK_TOS) >> ASLA_SHIFT_TOS); ND_PRINT((ndo, "\n\t\ttopology %s (%u), type %d, metric", tok2str(ospf_topology_values, "Unknown", topology), @@ -773,7 +773,7 @@ ospf_print_lsa(netdissect_options *ndo, mcp = lsap->lsa_un.un_mcla; while ((const u_char *)mcp < ls_end) { ND_TCHECK(mcp->mcla_vid); - switch (EXTRACT_32BITS(&mcp->mcla_vtype)) { + switch (EXTRACT_BE_32BITS(&mcp->mcla_vtype)) { case MCLA_VERTEX_ROUTER: ND_PRINT((ndo, "\n\t Router Router-ID %s", @@ -787,7 +787,7 @@ ospf_print_lsa(netdissect_options *ndo, default: ND_PRINT((ndo, "\n\t unknown VertexType (%u)", - EXTRACT_32BITS(&mcp->mcla_vtype))); + EXTRACT_BE_32BITS(&mcp->mcla_vtype))); break; } ++mcp; @@ -808,8 +808,8 @@ ospf_print_lsa(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Remaining LS length %u < 4", ls_length)); return(ls_end); } - tlv_type = EXTRACT_16BITS(tptr); - tlv_length = EXTRACT_16BITS(tptr+2); + tlv_type = EXTRACT_BE_16BITS(tptr); + tlv_length = EXTRACT_BE_16BITS(tptr + 2); tptr+=4; ls_length-=4; @@ -832,7 +832,7 @@ ospf_print_lsa(netdissect_options *ndo, return(ls_end); } ND_PRINT((ndo, "Capabilities: %s", - bittok2str(lsa_opaque_ri_tlv_cap_values, "Unknown", EXTRACT_32BITS(tptr)))); + bittok2str(lsa_opaque_ri_tlv_cap_values, "Unknown", EXTRACT_BE_32BITS(tptr)))); break; default: if (ndo->ndo_vflag <= 1) { @@ -910,11 +910,11 @@ ospf_decode_lls(netdissect_options *ndo, } /* dig deeper if LLS data is available; see RFC4813 */ - length2 = EXTRACT_16BITS(&op->ospf_len); + length2 = EXTRACT_BE_16BITS(&op->ospf_len); dptr = (const u_char *)op + length2; dataend = (const u_char *)op + length; - if (EXTRACT_16BITS(&op->ospf_authtype) == OSPF_AUTH_MD5) { + if (EXTRACT_BE_16BITS(&op->ospf_authtype) == OSPF_AUTH_MD5) { dptr = dptr + op->ospf_authdata[3]; length2 += op->ospf_authdata[3]; } @@ -923,24 +923,24 @@ ospf_decode_lls(netdissect_options *ndo, return (1); } ND_TCHECK2(*dptr, 2); - ND_PRINT((ndo, "\n\t LLS: checksum: 0x%04x", (u_int)EXTRACT_16BITS(dptr))); + ND_PRINT((ndo, "\n\t LLS: checksum: 0x%04x", (u_int) EXTRACT_BE_16BITS(dptr))); dptr += 2; ND_TCHECK2(*dptr, 2); - length2 = EXTRACT_16BITS(dptr); + length2 = EXTRACT_BE_16BITS(dptr); ND_PRINT((ndo, ", length: %u", length2)); dptr += 2; ND_TCHECK(*dptr); while (dptr < dataend) { ND_TCHECK2(*dptr, 2); - lls_type = EXTRACT_16BITS(dptr); + lls_type = EXTRACT_BE_16BITS(dptr); ND_PRINT((ndo, "\n\t %s (%u)", tok2str(ospf_lls_tlv_values,"Unknown TLV",lls_type), lls_type)); dptr += 2; ND_TCHECK2(*dptr, 2); - lls_len = EXTRACT_16BITS(dptr); + lls_len = EXTRACT_BE_16BITS(dptr); ND_PRINT((ndo, ", length: %u", lls_len)); dptr += 2; switch (lls_type) { @@ -951,7 +951,7 @@ ospf_decode_lls(netdissect_options *ndo, lls_len = 4; } ND_TCHECK2(*dptr, 4); - lls_flags = EXTRACT_32BITS(dptr); + lls_flags = EXTRACT_BE_32BITS(dptr); ND_PRINT((ndo, "\n\t Options: 0x%08x [%s]", lls_flags, bittok2str(ospf_lls_eo_options, "?", lls_flags))); @@ -963,7 +963,7 @@ ospf_decode_lls(netdissect_options *ndo, lls_len = 20; } ND_TCHECK2(*dptr, 4); - ND_PRINT((ndo, "\n\t Sequence number: 0x%08x", EXTRACT_32BITS(dptr))); + ND_PRINT((ndo, "\n\t Sequence number: 0x%08x", EXTRACT_BE_32BITS(dptr))); break; } @@ -994,8 +994,8 @@ ospf_decode_v2(netdissect_options *ndo, ND_TCHECK(op->ospf_hello.hello_deadint); ND_PRINT((ndo, "\n\t Hello Timer %us, Dead Timer %us, Mask %s, Priority %u", - EXTRACT_16BITS(&op->ospf_hello.hello_helloint), - EXTRACT_32BITS(&op->ospf_hello.hello_deadint), + EXTRACT_BE_16BITS(&op->ospf_hello.hello_helloint), + EXTRACT_BE_32BITS(&op->ospf_hello.hello_deadint), ipaddr_string(ndo, &op->ospf_hello.hello_mask), op->ospf_hello.hello_priority)); @@ -1028,10 +1028,10 @@ ospf_decode_v2(netdissect_options *ndo, bittok2str(ospf_dd_flag_values, "none", op->ospf_db.db_flags))); ND_TCHECK(op->ospf_db.db_ifmtu); if (op->ospf_db.db_ifmtu) { - ND_PRINT((ndo, ", MTU: %u", EXTRACT_16BITS(&op->ospf_db.db_ifmtu))); + ND_PRINT((ndo, ", MTU: %u", EXTRACT_BE_16BITS(&op->ospf_db.db_ifmtu))); } ND_TCHECK(op->ospf_db.db_seq); - ND_PRINT((ndo, ", Sequence: 0x%08x", EXTRACT_32BITS(&op->ospf_db.db_seq))); + ND_PRINT((ndo, ", Sequence: 0x%08x", EXTRACT_BE_32BITS(&op->ospf_db.db_seq))); /* Print all the LS adv's */ lshp = op->ospf_db.db_lshdr; @@ -1047,10 +1047,10 @@ ospf_decode_v2(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Advertising Router: %s, %s LSA (%u)", ipaddr_string(ndo, &lsrp->ls_router), - tok2str(lsa_values,"unknown",EXTRACT_32BITS(lsrp->ls_type)), - EXTRACT_32BITS(&lsrp->ls_type))); + tok2str(lsa_values,"unknown",EXTRACT_BE_32BITS(lsrp->ls_type)), + EXTRACT_BE_32BITS(&lsrp->ls_type))); - switch (EXTRACT_32BITS(lsrp->ls_type)) { + switch (EXTRACT_BE_32BITS(lsrp->ls_type)) { /* the LSA header for opaque LSAs was slightly changed */ case LS_TYPE_OPAQUE_LL: case LS_TYPE_OPAQUE_AL: @@ -1058,7 +1058,7 @@ ospf_decode_v2(netdissect_options *ndo, ND_PRINT((ndo, ", Opaque-Type: %s LSA (%u), Opaque-ID: %u", tok2str(lsa_opaque_values, "unknown",lsrp->un_ls_stateid.opaque_field.opaque_type), lsrp->un_ls_stateid.opaque_field.opaque_type, - EXTRACT_24BITS(&lsrp->un_ls_stateid.opaque_field.opaque_id))); + EXTRACT_BE_24BITS(&lsrp->un_ls_stateid.opaque_field.opaque_id))); break; default: ND_PRINT((ndo, ", LSA-ID: %s", @@ -1073,7 +1073,7 @@ ospf_decode_v2(netdissect_options *ndo, case OSPF_TYPE_LS_UPDATE: lsap = op->ospf_lsu.lsu_lsa; ND_TCHECK(op->ospf_lsu.lsu_count); - lsa_count_max = EXTRACT_32BITS(&op->ospf_lsu.lsu_count); + lsa_count_max = EXTRACT_BE_32BITS(&op->ospf_lsu.lsu_count); ND_PRINT((ndo, ", %d LSA%s", lsa_count_max, PLURAL_SUFFIX(lsa_count_max))); for (lsa_count=1;lsa_count <= lsa_count_max;lsa_count++) { ND_PRINT((ndo, "\n\t LSA #%u", lsa_count)); @@ -1111,7 +1111,7 @@ ospf_print(netdissect_options *ndo, /* XXX Before we do anything else, strip off the MD5 trailer */ ND_TCHECK(op->ospf_authtype); - if (EXTRACT_16BITS(&op->ospf_authtype) == OSPF_AUTH_MD5) { + if (EXTRACT_BE_16BITS(&op->ospf_authtype) == OSPF_AUTH_MD5) { length -= OSPF_AUTH_MD5_LEN; ndo->ndo_snapend -= OSPF_AUTH_MD5_LEN; } @@ -1129,12 +1129,12 @@ ospf_print(netdissect_options *ndo, } ND_TCHECK(op->ospf_len); - if (length != EXTRACT_16BITS(&op->ospf_len)) { - ND_PRINT((ndo, " [len %d]", EXTRACT_16BITS(&op->ospf_len))); + if (length != EXTRACT_BE_16BITS(&op->ospf_len)) { + ND_PRINT((ndo, " [len %d]", EXTRACT_BE_16BITS(&op->ospf_len))); } - if (length > EXTRACT_16BITS(&op->ospf_len)) { - dataend = bp + EXTRACT_16BITS(&op->ospf_len); + if (length > EXTRACT_BE_16BITS(&op->ospf_len)) { + dataend = bp + EXTRACT_BE_16BITS(&op->ospf_len); } else { dataend = bp + length; } @@ -1153,10 +1153,10 @@ ospf_print(netdissect_options *ndo, ND_TCHECK2(op->ospf_authdata[0], sizeof(op->ospf_authdata)); ND_PRINT((ndo, ", Authentication Type: %s (%u)", - tok2str(ospf_authtype_values, "unknown", EXTRACT_16BITS(&op->ospf_authtype)), - EXTRACT_16BITS(&op->ospf_authtype))); + tok2str(ospf_authtype_values, "unknown", EXTRACT_BE_16BITS(&op->ospf_authtype)), + EXTRACT_BE_16BITS(&op->ospf_authtype))); - switch (EXTRACT_16BITS(&op->ospf_authtype)) { + switch (EXTRACT_BE_16BITS(&op->ospf_authtype)) { case OSPF_AUTH_NONE: break; @@ -1170,7 +1170,7 @@ ospf_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\tKey-ID: %u, Auth-Length: %u, Crypto Sequence Number: 0x%08x", *((op->ospf_authdata) + 2), *((op->ospf_authdata) + 3), - EXTRACT_32BITS((op->ospf_authdata) + 4))); + EXTRACT_BE_32BITS((op->ospf_authdata) + 4))); break; default: @@ -1184,7 +1184,7 @@ ospf_print(netdissect_options *ndo, /* ospf version 2 */ if (ospf_decode_v2(ndo, op, dataend)) goto trunc; - if (length > EXTRACT_16BITS(&op->ospf_len)) { + if (length > EXTRACT_BE_16BITS(&op->ospf_len)) { if (ospf_decode_lls(ndo, op, length)) goto trunc; } diff --git a/print-ospf6.c b/print-ospf6.c index a5ac3051..3b77000f 100644 --- a/print-ospf6.c +++ b/print-ospf6.c @@ -394,11 +394,12 @@ ospf6_print_lshdr(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Advertising Router %s, seq 0x%08x, age %us, length %u", ipaddr_string(ndo, &lshp->ls_router), - EXTRACT_32BITS(&lshp->ls_seq), - EXTRACT_16BITS(&lshp->ls_age), - EXTRACT_16BITS(&lshp->ls_length)-(u_int)sizeof(struct lsa6_hdr))); + EXTRACT_BE_32BITS(&lshp->ls_seq), + EXTRACT_BE_16BITS(&lshp->ls_age), + EXTRACT_BE_16BITS(&lshp->ls_length)-(u_int)sizeof(struct lsa6_hdr))); - ospf6_print_ls_type(ndo, EXTRACT_16BITS(&lshp->ls_type), &lshp->ls_stateid); + ospf6_print_ls_type(ndo, EXTRACT_BE_16BITS(&lshp->ls_type), + &lshp->ls_stateid); return (0); trunc: @@ -435,7 +436,7 @@ ospf6_print_lsaprefix(netdissect_options *ndo, bittok2str(ospf6_lsa_prefix_option_values, "none", lsapp->lsa_p_opt))); } - ND_PRINT((ndo, ", metric %u", EXTRACT_16BITS(&lsapp->lsa_p_metric))); + ND_PRINT((ndo, ", metric %u", EXTRACT_BE_16BITS(&lsapp->lsa_p_metric))); return sizeof(*lsapp) - IPV6_ADDR_LEN_BYTES + wordlen * 4; trunc: @@ -473,7 +474,7 @@ ospf6_print_lsa(netdissect_options *ndo, if (ospf6_print_lshdr(ndo, &lsap->ls_hdr, dataend)) return (1); ND_TCHECK(lsap->ls_hdr.ls_length); - length = EXTRACT_16BITS(&lsap->ls_hdr.ls_length); + length = EXTRACT_BE_16BITS(&lsap->ls_hdr.ls_length); /* * The LSA length includes the length of the header; @@ -486,7 +487,7 @@ ospf6_print_lsa(netdissect_options *ndo, lsa_length = length - sizeof(struct lsa6_hdr); tptr = (const uint8_t *)lsap+sizeof(struct lsa6_hdr); - switch (EXTRACT_16BITS(&lsap->ls_hdr.ls_type)) { + switch (EXTRACT_BE_16BITS(&lsap->ls_hdr.ls_type)) { case LS_TYPE_ROUTER | LS_SCOPE_AREA: if (lsa_length < sizeof (lsap->lsa_un.un_rla.rla_options)) return (1); @@ -494,7 +495,7 @@ ospf6_print_lsa(netdissect_options *ndo, ND_TCHECK(lsap->lsa_un.un_rla.rla_options); ND_PRINT((ndo, "\n\t Options [%s]", bittok2str(ospf6_option_values, "none", - EXTRACT_32BITS(&lsap->lsa_un.un_rla.rla_options)))); + EXTRACT_BE_32BITS(&lsap->lsa_un.un_rla.rla_options)))); ND_PRINT((ndo, ", RLA-Flags [%s]", bittok2str(ospf6_rla_flag_values, "none", lsap->lsa_un.un_rla.rla_flags))); @@ -536,7 +537,7 @@ ospf6_print_lsa(netdissect_options *ndo, rlp->link_type)); return (0); } - ND_PRINT((ndo, ", metric %d", EXTRACT_16BITS(&rlp->link_metric))); + ND_PRINT((ndo, ", metric %d", EXTRACT_BE_16BITS(&rlp->link_metric))); rlp++; } break; @@ -548,7 +549,7 @@ ospf6_print_lsa(netdissect_options *ndo, ND_TCHECK(lsap->lsa_un.un_nla.nla_options); ND_PRINT((ndo, "\n\t Options [%s]", bittok2str(ospf6_option_values, "none", - EXTRACT_32BITS(&lsap->lsa_un.un_nla.nla_options)))); + EXTRACT_BE_32BITS(&lsap->lsa_un.un_nla.nla_options)))); ND_PRINT((ndo, "\n\t Connected Routers:")); ap = lsap->lsa_un.un_nla.nla_router; @@ -568,7 +569,7 @@ ospf6_print_lsa(netdissect_options *ndo, lsa_length -= sizeof (lsap->lsa_un.un_inter_ap.inter_ap_metric); ND_TCHECK(lsap->lsa_un.un_inter_ap.inter_ap_metric); ND_PRINT((ndo, ", metric %u", - EXTRACT_32BITS(&lsap->lsa_un.un_inter_ap.inter_ap_metric) & SLA_MASK_METRIC)); + EXTRACT_BE_32BITS(&lsap->lsa_un.un_inter_ap.inter_ap_metric) & SLA_MASK_METRIC)); tptr = (const uint8_t *)lsap->lsa_un.un_inter_ap.inter_ap_prefix; while (lsa_length != 0) { @@ -585,11 +586,11 @@ ospf6_print_lsa(netdissect_options *ndo, return (1); lsa_length -= sizeof (lsap->lsa_un.un_asla.asla_metric); ND_TCHECK(lsap->lsa_un.un_asla.asla_metric); - flags32 = EXTRACT_32BITS(&lsap->lsa_un.un_asla.asla_metric); + flags32 = EXTRACT_BE_32BITS(&lsap->lsa_un.un_asla.asla_metric); ND_PRINT((ndo, "\n\t Flags [%s]", bittok2str(ospf6_asla_flag_values, "none", flags32))); ND_PRINT((ndo, " metric %u", - EXTRACT_32BITS(&lsap->lsa_un.un_asla.asla_metric) & + EXTRACT_BE_32BITS(&lsap->lsa_un.un_asla.asla_metric) & ASLA_MASK_METRIC)); tptr = (const uint8_t *)lsap->lsa_un.un_asla.asla_prefix; @@ -643,13 +644,13 @@ ospf6_print_lsa(netdissect_options *ndo, ND_TCHECK(llsap->llsa_priandopt); ND_PRINT((ndo, "\n\t Options [%s]", bittok2str(ospf6_option_values, "none", - EXTRACT_32BITS(&llsap->llsa_options)))); + EXTRACT_BE_32BITS(&llsap->llsa_options)))); if (lsa_length < sizeof (llsap->llsa_lladdr) + sizeof (llsap->llsa_nprefix)) return (1); lsa_length -= sizeof (llsap->llsa_lladdr) + sizeof (llsap->llsa_nprefix); ND_TCHECK(llsap->llsa_nprefix); - prefixes = EXTRACT_32BITS(&llsap->llsa_nprefix); + prefixes = EXTRACT_BE_32BITS(&llsap->llsa_nprefix); ND_PRINT((ndo, "\n\t Priority %d, Link-local address %s, Prefixes %d:", llsap->llsa_priority, ip6addr_string(ndo, &llsap->llsa_lladdr), @@ -673,14 +674,14 @@ ospf6_print_lsa(netdissect_options *ndo, lsa_length -= sizeof (lsap->lsa_un.un_intra_ap.intra_ap_rtid); ND_TCHECK(lsap->lsa_un.un_intra_ap.intra_ap_rtid); ospf6_print_ls_type(ndo, - EXTRACT_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_lstype), + EXTRACT_BE_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_lstype), &lsap->lsa_un.un_intra_ap.intra_ap_lsid); if (lsa_length < sizeof (lsap->lsa_un.un_intra_ap.intra_ap_nprefix)) return (1); lsa_length -= sizeof (lsap->lsa_un.un_intra_ap.intra_ap_nprefix); ND_TCHECK(lsap->lsa_un.un_intra_ap.intra_ap_nprefix); - prefixes = EXTRACT_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_nprefix); + prefixes = EXTRACT_BE_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_nprefix); ND_PRINT((ndo, "\n\t Prefixes %d:", prefixes)); tptr = (const uint8_t *)lsap->lsa_un.un_intra_ap.intra_ap_prefix; @@ -739,21 +740,21 @@ ospf6_decode_v3(netdissect_options *ndo, ND_TCHECK_32BITS(&hellop->hello_options); ND_PRINT((ndo, "\n\tOptions [%s]", bittok2str(ospf6_option_values, "none", - EXTRACT_32BITS(&hellop->hello_options)))); + EXTRACT_BE_32BITS(&hellop->hello_options)))); ND_TCHECK(hellop->hello_deadint); ND_PRINT((ndo, "\n\t Hello Timer %us, Dead Timer %us, Interface-ID %s, Priority %u", - EXTRACT_16BITS(&hellop->hello_helloint), - EXTRACT_16BITS(&hellop->hello_deadint), + EXTRACT_BE_16BITS(&hellop->hello_helloint), + EXTRACT_BE_16BITS(&hellop->hello_deadint), ipaddr_string(ndo, &hellop->hello_ifid), hellop->hello_priority)); ND_TCHECK(hellop->hello_dr); - if (EXTRACT_32BITS(&hellop->hello_dr) != 0) + if (EXTRACT_BE_32BITS(&hellop->hello_dr) != 0) ND_PRINT((ndo, "\n\t Designated Router %s", ipaddr_string(ndo, &hellop->hello_dr))); ND_TCHECK(hellop->hello_bdr); - if (EXTRACT_32BITS(&hellop->hello_bdr) != 0) + if (EXTRACT_BE_32BITS(&hellop->hello_bdr) != 0) ND_PRINT((ndo, ", Backup Designated Router %s", ipaddr_string(ndo, &hellop->hello_bdr))); if (ndo->ndo_vflag > 1) { @@ -774,15 +775,15 @@ ospf6_decode_v3(netdissect_options *ndo, ND_TCHECK(ddp->db_options); ND_PRINT((ndo, "\n\tOptions [%s]", bittok2str(ospf6_option_values, "none", - EXTRACT_32BITS(&ddp->db_options)))); + EXTRACT_BE_32BITS(&ddp->db_options)))); ND_TCHECK(ddp->db_flags); ND_PRINT((ndo, ", DD Flags [%s]", bittok2str(ospf6_dd_flag_values,"none",ddp->db_flags))); ND_TCHECK(ddp->db_seq); ND_PRINT((ndo, ", MTU %u, DD-Sequence 0x%08x", - EXTRACT_16BITS(&ddp->db_mtu), - EXTRACT_32BITS(&ddp->db_seq))); + EXTRACT_BE_16BITS(&ddp->db_mtu), + EXTRACT_BE_32BITS(&ddp->db_seq))); if (ndo->ndo_vflag > 1) { /* Print all the LS adv's */ lshp = ddp->db_lshdr; @@ -801,7 +802,8 @@ ospf6_decode_v3(netdissect_options *ndo, ND_TCHECK(*lsrp); ND_PRINT((ndo, "\n\t Advertising Router %s", ipaddr_string(ndo, &lsrp->ls_router))); - ospf6_print_ls_type(ndo, EXTRACT_16BITS(&lsrp->ls_type), + ospf6_print_ls_type(ndo, + EXTRACT_BE_16BITS(&lsrp->ls_type), &lsrp->ls_stateid); ++lsrp; } @@ -813,13 +815,13 @@ ospf6_decode_v3(netdissect_options *ndo, register const struct lsu6 *lsup = (const struct lsu6 *)((const uint8_t *)op + OSPF6HDR_LEN); ND_TCHECK(lsup->lsu_count); - i = EXTRACT_32BITS(&lsup->lsu_count); + i = EXTRACT_BE_32BITS(&lsup->lsu_count); lsap = lsup->lsu_lsa; while ((const u_char *)lsap < dataend && i--) { if (ospf6_print_lsa(ndo, lsap, dataend)) goto trunc; lsap = (const struct lsa6 *)((const u_char *)lsap + - EXTRACT_16BITS(&lsap->ls_hdr.ls_length)); + EXTRACT_BE_16BITS(&lsap->ls_hdr.ls_length)); } } break; @@ -855,11 +857,11 @@ ospf6_print_lls(netdissect_options *ndo, goto trunc; /* Checksum */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, "\n\tLLS Checksum 0x%04x", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, "\n\tLLS Checksum 0x%04x", EXTRACT_BE_16BITS(cp))); cp += 2; /* LLS Data Length */ ND_TCHECK2(*cp, 2); - llsdatalen = EXTRACT_16BITS(cp); + llsdatalen = EXTRACT_BE_16BITS(cp); ND_PRINT((ndo, ", Data Length %u", llsdatalen)); if (llsdatalen < OSPF_LLS_HDRLEN || llsdatalen > len) goto trunc; @@ -886,11 +888,11 @@ ospf6_decode_at(netdissect_options *ndo, goto trunc; /* Authentication Type */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, "\n\tAuthentication Type %s", tok2str(ospf6_auth_type_str, "unknown (0x%04x)", EXTRACT_16BITS(cp)))); + ND_PRINT((ndo, "\n\tAuthentication Type %s", tok2str(ospf6_auth_type_str, "unknown (0x%04x)", EXTRACT_BE_16BITS(cp)))); cp += 2; /* Auth Data Len */ ND_TCHECK2(*cp, 2); - authdatalen = EXTRACT_16BITS(cp); + authdatalen = EXTRACT_BE_16BITS(cp); ND_PRINT((ndo, ", Length %u", authdatalen)); if (authdatalen < OSPF6_AT_HDRLEN || authdatalen > len) goto trunc; @@ -900,15 +902,15 @@ ospf6_decode_at(netdissect_options *ndo, cp += 2; /* Security Association ID */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", SAID %u", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, ", SAID %u", EXTRACT_BE_16BITS(cp))); cp += 2; /* Cryptographic Sequence Number (High-Order 32 Bits) */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", CSN 0x%08x", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ", CSN 0x%08x", EXTRACT_BE_32BITS(cp))); cp += 4; /* Cryptographic Sequence Number (Low-Order 32 Bits) */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ":%08x", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, ":%08x", EXTRACT_BE_32BITS(cp))); cp += 4; /* Authentication Data */ ND_TCHECK2(*cp, authdatalen - OSPF6_AT_HDRLEN); @@ -936,12 +938,12 @@ ospf6_decode_v3_trailer(netdissect_options *ndo, if (op->ospf6_type == OSPF_TYPE_HELLO) { const struct hello6 *hellop = (const struct hello6 *)((const uint8_t *)op + OSPF6HDR_LEN); ND_TCHECK(hellop->hello_options); - if (EXTRACT_32BITS(&hellop->hello_options) & OSPF6_OPTION_L) + if (EXTRACT_BE_32BITS(&hellop->hello_options) & OSPF6_OPTION_L) lls_hello = 1; } else if (op->ospf6_type == OSPF_TYPE_DD) { const struct dd6 *ddp = (const struct dd6 *)((const uint8_t *)op + OSPF6HDR_LEN); ND_TCHECK(ddp->db_options); - if (EXTRACT_32BITS(&ddp->db_options) & OSPF6_OPTION_L) + if (EXTRACT_BE_32BITS(&ddp->db_options) & OSPF6_OPTION_L) lls_dd = 1; } if ((lls_hello || lls_dd) && (llslen = ospf6_print_lls(ndo, cp, len)) < 0) @@ -978,7 +980,7 @@ ospf6_print(netdissect_options *ndo, /* OSPFv3 data always comes first and optional trailing data may follow. */ ND_TCHECK(op->ospf6_len); - datalen = EXTRACT_16BITS(&op->ospf6_len); + datalen = EXTRACT_BE_16BITS(&op->ospf6_len); if (datalen > length) { ND_PRINT((ndo, " [len %d]", datalen)); return; @@ -989,7 +991,7 @@ ospf6_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\tRouter-ID %s", ipaddr_string(ndo, &op->ospf6_routerid))); ND_TCHECK(op->ospf6_areaid); - if (EXTRACT_32BITS(&op->ospf6_areaid) != 0) + if (EXTRACT_BE_32BITS(&op->ospf6_areaid) != 0) ND_PRINT((ndo, ", Area %s", ipaddr_string(ndo, &op->ospf6_areaid))); else ND_PRINT((ndo, ", Backbone Area")); diff --git a/print-otv.c b/print-otv.c index 723f8ef5..7c3e7b11 100644 --- a/print-otv.c +++ b/print-otv.c @@ -55,11 +55,11 @@ otv_print(netdissect_options *ndo, const u_char *bp, u_int len) bp += 1; ND_TCHECK2(*bp, 3); - ND_PRINT((ndo, "overlay %u, ", EXTRACT_24BITS(bp))); + ND_PRINT((ndo, "overlay %u, ", EXTRACT_BE_24BITS(bp))); bp += 3; ND_TCHECK2(*bp, 3); - ND_PRINT((ndo, "instance %u\n", EXTRACT_24BITS(bp))); + ND_PRINT((ndo, "instance %u\n", EXTRACT_BE_24BITS(bp))); bp += 3; /* Reserved */ diff --git a/print-pflog.c b/print-pflog.c index 265efd3c..387a89b3 100644 --- a/print-pflog.c +++ b/print-pflog.c @@ -90,8 +90,8 @@ pflog_print(netdissect_options *ndo, const struct pfloghdr *hdr) { uint32_t rulenr, subrulenr; - rulenr = EXTRACT_32BITS(&hdr->rulenr); - subrulenr = EXTRACT_32BITS(&hdr->subrulenr); + rulenr = EXTRACT_BE_32BITS(&hdr->rulenr); + subrulenr = EXTRACT_BE_32BITS(&hdr->subrulenr); if (subrulenr == (uint32_t)-1) ND_PRINT((ndo, "rule %u/", rulenr)); else diff --git a/print-pgm.c b/print-pgm.c index 4f9003f6..e2d721c1 100644 --- a/print-pgm.c +++ b/print-pgm.c @@ -177,8 +177,8 @@ pgm_print(netdissect_options *ndo, return; } - sport = EXTRACT_16BITS(&pgm->pgm_sport); - dport = EXTRACT_16BITS(&pgm->pgm_dport); + sport = EXTRACT_BE_16BITS(&pgm->pgm_sport); + dport = EXTRACT_BE_16BITS(&pgm->pgm_dport); if (ip6) { if (ip6->ip6_nxt == IPPROTO_PGM) { @@ -206,7 +206,7 @@ pgm_print(netdissect_options *ndo, ND_TCHECK(*pgm); - ND_PRINT((ndo, "PGM, length %u", EXTRACT_16BITS(&pgm->pgm_length))); + ND_PRINT((ndo, "PGM, length %u", EXTRACT_BE_16BITS(&pgm->pgm_length))); if (!ndo->ndo_vflag) return; @@ -226,7 +226,7 @@ pgm_print(netdissect_options *ndo, ND_TCHECK(*spm); bp = (const u_char *) (spm + 1); - switch (EXTRACT_16BITS(&spm->pgms_nla_afi)) { + switch (EXTRACT_BE_16BITS(&spm->pgms_nla_afi)) { case AFNUM_INET: ND_TCHECK2(*bp, sizeof(struct in_addr)); addrtostr(bp, nla_buf, sizeof(nla_buf)); @@ -243,10 +243,10 @@ pgm_print(netdissect_options *ndo, } ND_PRINT((ndo, "SPM seq %u trail %u lead %u nla %s", - EXTRACT_32BITS(&spm->pgms_seq), - EXTRACT_32BITS(&spm->pgms_trailseq), - EXTRACT_32BITS(&spm->pgms_leadseq), - nla_buf)); + EXTRACT_BE_32BITS(&spm->pgms_seq), + EXTRACT_BE_32BITS(&spm->pgms_trailseq), + EXTRACT_BE_32BITS(&spm->pgms_leadseq), + nla_buf)); break; } @@ -256,8 +256,8 @@ pgm_print(netdissect_options *ndo, poll_msg = (const struct pgm_poll *)(pgm + 1); ND_TCHECK(*poll_msg); ND_PRINT((ndo, "POLL seq %u round %u", - EXTRACT_32BITS(&poll_msg->pgmp_seq), - EXTRACT_16BITS(&poll_msg->pgmp_round))); + EXTRACT_BE_32BITS(&poll_msg->pgmp_seq), + EXTRACT_BE_16BITS(&poll_msg->pgmp_round))); bp = (const u_char *) (poll_msg + 1); break; } @@ -269,7 +269,7 @@ pgm_print(netdissect_options *ndo, ND_TCHECK(*polr); bp = (const u_char *) (polr + 1); - switch (EXTRACT_16BITS(&polr->pgmp_nla_afi)) { + switch (EXTRACT_BE_16BITS(&polr->pgmp_nla_afi)) { case AFNUM_INET: ND_TCHECK2(*bp, sizeof(struct in_addr)); addrtostr(bp, nla_buf, sizeof(nla_buf)); @@ -286,20 +286,20 @@ pgm_print(netdissect_options *ndo, } ND_TCHECK2(*bp, sizeof(uint32_t)); - ivl = EXTRACT_32BITS(bp); + ivl = EXTRACT_BE_32BITS(bp); bp += sizeof(uint32_t); ND_TCHECK2(*bp, sizeof(uint32_t)); - rnd = EXTRACT_32BITS(bp); + rnd = EXTRACT_BE_32BITS(bp); bp += sizeof(uint32_t); ND_TCHECK2(*bp, sizeof(uint32_t)); - mask = EXTRACT_32BITS(bp); + mask = EXTRACT_BE_32BITS(bp); bp += sizeof(uint32_t); ND_PRINT((ndo, "POLR seq %u round %u nla %s ivl %u rnd 0x%08x " - "mask 0x%08x", EXTRACT_32BITS(&polr->pgmp_seq), - EXTRACT_16BITS(&polr->pgmp_round), nla_buf, ivl, rnd, mask)); + "mask 0x%08x", EXTRACT_BE_32BITS(&polr->pgmp_seq), + EXTRACT_BE_16BITS(&polr->pgmp_round), nla_buf, ivl, rnd, mask)); break; } case PGM_ODATA: { @@ -308,8 +308,8 @@ pgm_print(netdissect_options *ndo, odata = (const struct pgm_data *)(pgm + 1); ND_TCHECK(*odata); ND_PRINT((ndo, "ODATA trail %u seq %u", - EXTRACT_32BITS(&odata->pgmd_trailseq), - EXTRACT_32BITS(&odata->pgmd_seq))); + EXTRACT_BE_32BITS(&odata->pgmd_trailseq), + EXTRACT_BE_32BITS(&odata->pgmd_seq))); bp = (const u_char *) (odata + 1); break; } @@ -320,8 +320,8 @@ pgm_print(netdissect_options *ndo, rdata = (const struct pgm_data *)(pgm + 1); ND_TCHECK(*rdata); ND_PRINT((ndo, "RDATA trail %u seq %u", - EXTRACT_32BITS(&rdata->pgmd_trailseq), - EXTRACT_32BITS(&rdata->pgmd_seq))); + EXTRACT_BE_32BITS(&rdata->pgmd_trailseq), + EXTRACT_BE_32BITS(&rdata->pgmd_seq))); bp = (const u_char *) (rdata + 1); break; } @@ -340,7 +340,7 @@ pgm_print(netdissect_options *ndo, * Skip past the source, saving info along the way * and stopping if we don't have enough. */ - switch (EXTRACT_16BITS(&nak->pgmn_source_afi)) { + switch (EXTRACT_BE_16BITS(&nak->pgmn_source_afi)) { case AFNUM_INET: ND_TCHECK2(*bp, sizeof(struct in_addr)); addrtostr(bp, source_buf, sizeof(source_buf)); @@ -362,7 +362,7 @@ pgm_print(netdissect_options *ndo, */ bp += (2 * sizeof(uint16_t)); ND_TCHECK_16BITS(bp); - switch (EXTRACT_16BITS(bp)) { + switch (EXTRACT_BE_16BITS(bp)) { case AFNUM_INET: ND_TCHECK2(*bp, sizeof(struct in_addr)); addrtostr(bp, group_buf, sizeof(group_buf)); @@ -395,7 +395,7 @@ pgm_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "(%s -> %s), seq %u", - source_buf, group_buf, EXTRACT_32BITS(&nak->pgmn_seq))); + source_buf, group_buf, EXTRACT_BE_32BITS(&nak->pgmn_seq))); break; } @@ -405,7 +405,7 @@ pgm_print(netdissect_options *ndo, ack = (const struct pgm_ack *)(pgm + 1); ND_TCHECK(*ack); ND_PRINT((ndo, "ACK seq %u", - EXTRACT_32BITS(&ack->pgma_rx_max_seq))); + EXTRACT_BE_32BITS(&ack->pgma_rx_max_seq))); bp = (const u_char *) (ack + 1); break; } @@ -443,7 +443,7 @@ pgm_print(netdissect_options *ndo, ND_PRINT((ndo, "[Bad OPT_LENGTH option, length %u != 4]", opt_len)); return; } - opts_len = EXTRACT_16BITS(bp); + opts_len = EXTRACT_BE_16BITS(bp); if (opts_len < 4) { ND_PRINT((ndo, "[Bad total option length %u < 4]", opts_len)); return; @@ -485,7 +485,7 @@ pgm_print(netdissect_options *ndo, opt_len, PGM_OPT_LENGTH_LEN)); return; } - ND_PRINT((ndo, " OPTS LEN (extra?) %d", EXTRACT_16BITS(bp))); + ND_PRINT((ndo, " OPTS LEN (extra?) %d", EXTRACT_BE_16BITS(bp))); bp += 2; opts_len -= PGM_OPT_LENGTH_LEN; break; @@ -498,11 +498,11 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - seq = EXTRACT_32BITS(bp); + seq = EXTRACT_BE_32BITS(bp); bp += 4; - offset = EXTRACT_32BITS(bp); + offset = EXTRACT_BE_32BITS(bp); bp += 4; - len = EXTRACT_32BITS(bp); + len = EXTRACT_BE_32BITS(bp); bp += 4; ND_PRINT((ndo, " FRAG seq %u off %u len %u", seq, offset, len)); opts_len -= PGM_OPT_FRAGMENT_LEN; @@ -518,7 +518,7 @@ pgm_print(netdissect_options *ndo, return; } ND_TCHECK2(*bp, 4); - ND_PRINT((ndo, " %u", EXTRACT_32BITS(bp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(bp))); bp += 4; opt_len -= 4; opts_len -= 4; @@ -533,7 +533,7 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - seq = EXTRACT_32BITS(bp); + seq = EXTRACT_BE_32BITS(bp); bp += 4; ND_PRINT((ndo, " JOIN %u", seq)); opts_len -= PGM_OPT_JOIN_LEN; @@ -547,9 +547,9 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - offset = EXTRACT_32BITS(bp); + offset = EXTRACT_BE_32BITS(bp); bp += 4; - seq = EXTRACT_32BITS(bp); + seq = EXTRACT_BE_32BITS(bp); bp += 4; ND_PRINT((ndo, " BACKOFF ivl %u ivlseq %u", offset, seq)); opts_len -= PGM_OPT_NAK_BO_IVL_LEN; @@ -563,9 +563,9 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - offset = EXTRACT_32BITS(bp); + offset = EXTRACT_BE_32BITS(bp); bp += 4; - seq = EXTRACT_32BITS(bp); + seq = EXTRACT_BE_32BITS(bp); bp += 4; ND_PRINT((ndo, " BACKOFF max %u min %u", offset, seq)); opts_len -= PGM_OPT_NAK_BO_RNG_LEN; @@ -579,7 +579,7 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - nla_afnum = EXTRACT_16BITS(bp); + nla_afnum = EXTRACT_BE_16BITS(bp); bp += 2+2; switch (nla_afnum) { case AFNUM_INET: @@ -620,7 +620,7 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - len = EXTRACT_32BITS(bp); + len = EXTRACT_BE_32BITS(bp); bp += 4; ND_PRINT((ndo, " PARITY MAXTGS %u", len)); opts_len -= PGM_OPT_PARITY_PRM_LEN; @@ -634,7 +634,7 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - seq = EXTRACT_32BITS(bp); + seq = EXTRACT_BE_32BITS(bp); bp += 4; ND_PRINT((ndo, " PARITY GROUP %u", seq)); opts_len -= PGM_OPT_PARITY_GRP_LEN; @@ -648,7 +648,7 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - len = EXTRACT_32BITS(bp); + len = EXTRACT_BE_32BITS(bp); bp += 4; ND_PRINT((ndo, " PARITY ATGS %u", len)); opts_len -= PGM_OPT_CURR_TGSIZE_LEN; @@ -734,9 +734,9 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - offset = EXTRACT_32BITS(bp); + offset = EXTRACT_BE_32BITS(bp); bp += 4; - nla_afnum = EXTRACT_16BITS(bp); + nla_afnum = EXTRACT_BE_16BITS(bp); bp += 2+2; switch (nla_afnum) { case AFNUM_INET: @@ -777,9 +777,9 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - offset = EXTRACT_32BITS(bp); + offset = EXTRACT_BE_32BITS(bp); bp += 4; - nla_afnum = EXTRACT_16BITS(bp); + nla_afnum = EXTRACT_BE_16BITS(bp); bp += 2+2; switch (nla_afnum) { case AFNUM_INET: @@ -827,7 +827,8 @@ pgm_print(netdissect_options *ndo, ND_PRINT((ndo, " [%u]", length)); if (ndo->ndo_packettype == PT_PGM_ZMTP1 && (pgm->pgm_type == PGM_ODATA || pgm->pgm_type == PGM_RDATA)) - zmtp1_datagram_print(ndo, bp, EXTRACT_16BITS(&pgm->pgm_length)); + zmtp1_datagram_print(ndo, bp, + EXTRACT_BE_16BITS(&pgm->pgm_length)); return; diff --git a/print-pim.c b/print-pim.c index 9c8ca547..97123e3f 100644 --- a/print-pim.c +++ b/print-pim.c @@ -148,11 +148,11 @@ pimv1_join_prune_print(netdissect_options *ndo, /* If it's a single group and a single source, use 1-line output. */ if (ND_TTEST2(bp[0], 30) && bp[11] == 1 && - ((njoin = EXTRACT_16BITS(&bp[20])) + EXTRACT_16BITS(&bp[22])) == 1) { + ((njoin = EXTRACT_BE_16BITS(&bp[20])) + EXTRACT_BE_16BITS(&bp[22])) == 1) { int hold; ND_PRINT((ndo, " RPF %s ", ipaddr_string(ndo, bp))); - hold = EXTRACT_16BITS(&bp[6]); + hold = EXTRACT_BE_16BITS(&bp[6]); if (hold != 180) { ND_PRINT((ndo, "Hold ")); unsigned_relts_print(ndo, hold); @@ -160,7 +160,7 @@ pimv1_join_prune_print(netdissect_options *ndo, ND_PRINT((ndo, "%s (%s/%d, %s", njoin ? "Join" : "Prune", ipaddr_string(ndo, &bp[26]), bp[25] & 0x3f, ipaddr_string(ndo, &bp[12]))); - if (EXTRACT_32BITS(&bp[16]) != 0xffffffff) + if (EXTRACT_BE_32BITS(&bp[16]) != 0xffffffff) ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[16]))); ND_PRINT((ndo, ") %s%s %s", (bp[24] & 0x01) ? "Sparse" : "Dense", @@ -183,7 +183,7 @@ pimv1_join_prune_print(netdissect_options *ndo, if (ndo->ndo_vflag > 1) ND_PRINT((ndo, "\n")); ND_PRINT((ndo, " Hold time: ")); - unsigned_relts_print(ndo, EXTRACT_16BITS(&bp[2])); + unsigned_relts_print(ndo, EXTRACT_BE_16BITS(&bp[2])); if (ndo->ndo_vflag < 2) return; bp += 4; @@ -209,15 +209,15 @@ pimv1_join_prune_print(netdissect_options *ndo, if (len < 4) goto trunc; ND_TCHECK2(bp[0], sizeof(struct in_addr)); - if (EXTRACT_32BITS(&bp[0]) != 0xffffffff) + if (EXTRACT_BE_32BITS(&bp[0]) != 0xffffffff) ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[0]))); bp += 4; len -= 4; if (len < 4) goto trunc; ND_TCHECK2(bp[0], 4); - njoin = EXTRACT_16BITS(&bp[0]); - nprune = EXTRACT_16BITS(&bp[2]); + njoin = EXTRACT_BE_16BITS(&bp[0]); + nprune = EXTRACT_BE_16BITS(&bp[2]); ND_PRINT((ndo, " joined: %d pruned: %d", njoin, nprune)); bp += 4; len -= 4; @@ -278,7 +278,7 @@ pimv1_print(netdissect_options *ndo, if (ndo->ndo_vflag) { ND_TCHECK2(bp[10],2); ND_PRINT((ndo, " (Hold-time ")); - unsigned_relts_print(ndo, EXTRACT_16BITS(&bp[10])); + unsigned_relts_print(ndo, EXTRACT_BE_16BITS(&bp[10])); ND_PRINT((ndo, ")")); } break; @@ -297,23 +297,23 @@ pimv1_print(netdissect_options *ndo, if (ndo->ndo_vflag) { ND_TCHECK2(bp[22], 2); ND_PRINT((ndo, " group %s", ipaddr_string(ndo, &bp[8]))); - if (EXTRACT_32BITS(&bp[12]) != 0xffffffff) + if (EXTRACT_BE_32BITS(&bp[12]) != 0xffffffff) ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12]))); ND_PRINT((ndo, " RP %s hold ", ipaddr_string(ndo, &bp[16]))); - unsigned_relts_print(ndo, EXTRACT_16BITS(&bp[22])); + unsigned_relts_print(ndo, EXTRACT_BE_16BITS(&bp[22])); } break; case PIMV1_TYPE_ASSERT: ND_TCHECK2(bp[16], sizeof(struct in_addr)); ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[16]), ipaddr_string(ndo, &bp[8]))); - if (EXTRACT_32BITS(&bp[12]) != 0xffffffff) + if (EXTRACT_BE_32BITS(&bp[12]) != 0xffffffff) ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12]))); ND_TCHECK2(bp[24], 4); ND_PRINT((ndo, " %s pref %d metric %d", (bp[20] & 0x80) ? "RP-tree" : "SPT", - EXTRACT_32BITS(&bp[20]) & 0x7fffffff, - EXTRACT_32BITS(&bp[24]))); + EXTRACT_BE_32BITS(&bp[20]) & 0x7fffffff, + EXTRACT_BE_32BITS(&bp[24]))); break; case PIMV1_TYPE_JOIN_PRUNE: case PIMV1_TYPE_GRAFT: @@ -371,9 +371,9 @@ cisco_autorp_print(netdissect_options *ndo, ND_TCHECK2(bp[2], 2); ND_PRINT((ndo, " Hold ")); - hold = EXTRACT_16BITS(&bp[2]); + hold = EXTRACT_BE_16BITS(&bp[2]); if (hold) - unsigned_relts_print(ndo, EXTRACT_16BITS(&bp[2])); + unsigned_relts_print(ndo, EXTRACT_BE_16BITS(&bp[2])); else ND_PRINT((ndo, "FOREVER")); @@ -709,8 +709,8 @@ pimv2_print(netdissect_options *ndo, if (len < 4) goto trunc; ND_TCHECK(pim->pim_cksum); - ND_PRINT((ndo, ", cksum 0x%04x ", EXTRACT_16BITS(&pim->pim_cksum))); - if (EXTRACT_16BITS(&pim->pim_cksum) == 0) { + ND_PRINT((ndo, ", cksum 0x%04x ", EXTRACT_BE_16BITS(&pim->pim_cksum))); + if (EXTRACT_BE_16BITS(&pim->pim_cksum) == 0) { ND_PRINT((ndo, "(unverified)")); } else { if (PIM_TYPE(pim->pim_typever) == PIMV2_TYPE_REGISTER) { @@ -760,8 +760,8 @@ pimv2_print(netdissect_options *ndo, if (len < 4) goto trunc; ND_TCHECK2(bp[0], 4); - otype = EXTRACT_16BITS(&bp[0]); - olen = EXTRACT_16BITS(&bp[2]); + otype = EXTRACT_BE_16BITS(&bp[0]); + olen = EXTRACT_BE_16BITS(&bp[2]); ND_PRINT((ndo, "\n\t %s Option (%u), length %u, Value: ", tok2str(pimv2_hello_option_values, "Unknown", otype), otype, @@ -777,7 +777,8 @@ pimv2_print(netdissect_options *ndo, if (olen != 2) { ND_PRINT((ndo, "ERROR: Option Length != 2 Bytes (%u)", olen)); } else { - unsigned_relts_print(ndo, EXTRACT_16BITS(bp)); + unsigned_relts_print(ndo, + EXTRACT_BE_16BITS(bp)); } break; @@ -787,8 +788,8 @@ pimv2_print(netdissect_options *ndo, } else { char t_bit; uint16_t lan_delay, override_interval; - lan_delay = EXTRACT_16BITS(bp); - override_interval = EXTRACT_16BITS(bp+2); + lan_delay = EXTRACT_BE_16BITS(bp); + override_interval = EXTRACT_BE_16BITS(bp + 2); t_bit = (lan_delay & 0x8000)? 1 : 0; lan_delay &= ~0x8000; ND_PRINT((ndo, "\n\t T-bit=%d, LAN delay %dms, Override interval %dms", @@ -803,7 +804,7 @@ pimv2_print(netdissect_options *ndo, ND_PRINT((ndo, "Bi-Directional Capability (Old)")); break; case 4: - ND_PRINT((ndo, "%u", EXTRACT_32BITS(bp))); + ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(bp))); break; default: ND_PRINT((ndo, "ERROR: Option Length != 4 Bytes (%u)", olen)); @@ -815,7 +816,7 @@ pimv2_print(netdissect_options *ndo, if (olen != 4) { ND_PRINT((ndo, "ERROR: Option Length != 4 Bytes (%u)", olen)); } else { - ND_PRINT((ndo, "0x%08x", EXTRACT_32BITS(bp))); + ND_PRINT((ndo, "0x%08x", EXTRACT_BE_32BITS(bp))); } break; @@ -828,8 +829,8 @@ pimv2_print(netdissect_options *ndo, ND_PRINT((ndo, ", interval ")); unsigned_relts_print(ndo, *(bp+1)); } - if (EXTRACT_16BITS(bp+2) != 0) { - ND_PRINT((ndo, " ?0x%04x?", EXTRACT_16BITS(bp+2))); + if (EXTRACT_BE_16BITS(bp + 2) != 0) { + ND_PRINT((ndo, " ?0x%04x?", EXTRACT_BE_16BITS(bp + 2))); } } break; @@ -877,7 +878,7 @@ pimv2_print(netdissect_options *ndo, ND_PRINT((ndo, ", Flags [ %s ]\n\t", tok2str(pimv2_register_flag_values, "none", - EXTRACT_32BITS(bp)))); + EXTRACT_BE_32BITS(bp)))); bp += 4; len -= 4; /* encapsulated multicast packet */ @@ -976,7 +977,7 @@ pimv2_print(netdissect_options *ndo, goto trunc; ND_TCHECK2(*bp, 4); ngroup = bp[1]; - holdtime = EXTRACT_16BITS(&bp[2]); + holdtime = EXTRACT_BE_16BITS(&bp[2]); ND_PRINT((ndo, "\n\t %u group(s)", ngroup)); if (PIM_TYPE(pim->pim_typever) != 7) { /*not for Graft-ACK*/ ND_PRINT((ndo, ", holdtime: ")); @@ -994,8 +995,8 @@ pimv2_print(netdissect_options *ndo, if (len < 4) goto trunc; ND_TCHECK2(*bp, 4); - njoin = EXTRACT_16BITS(&bp[0]); - nprune = EXTRACT_16BITS(&bp[2]); + njoin = EXTRACT_BE_16BITS(&bp[0]); + nprune = EXTRACT_BE_16BITS(&bp[2]); ND_PRINT((ndo, ", joined sources: %u, pruned sources: %u", njoin, nprune)); bp += 4; len -= 4; for (j = 0; j < njoin; j++) { @@ -1022,7 +1023,7 @@ pimv2_print(netdissect_options *ndo, if (len < 2) goto trunc; ND_TCHECK_16BITS(bp); - ND_PRINT((ndo, " tag=%x", EXTRACT_16BITS(bp))); + ND_PRINT((ndo, " tag=%x", EXTRACT_BE_16BITS(bp))); bp += 2; len -= 2; if (len < 1) @@ -1080,7 +1081,8 @@ pimv2_print(netdissect_options *ndo, goto trunc; ND_TCHECK_16BITS(bp); ND_PRINT((ndo, ",holdtime=")); - unsigned_relts_print(ndo, EXTRACT_16BITS(bp)); + unsigned_relts_print(ndo, + EXTRACT_BE_16BITS(bp)); if (len < 3) goto trunc; ND_TCHECK(bp[2]); @@ -1108,8 +1110,8 @@ pimv2_print(netdissect_options *ndo, ND_TCHECK2(*bp, 8); if (bp[0] & 0x80) ND_PRINT((ndo, " RPT")); - ND_PRINT((ndo, " pref=%u", EXTRACT_32BITS(&bp[0]) & 0x7fffffff)); - ND_PRINT((ndo, " metric=%u", EXTRACT_32BITS(&bp[4]))); + ND_PRINT((ndo, " pref=%u", EXTRACT_BE_32BITS(&bp[0]) & 0x7fffffff)); + ND_PRINT((ndo, " metric=%u", EXTRACT_BE_32BITS(&bp[4]))); break; case PIMV2_TYPE_CANDIDATE_RP: @@ -1130,7 +1132,7 @@ pimv2_print(netdissect_options *ndo, goto trunc; ND_TCHECK_16BITS(&bp[2]); ND_PRINT((ndo, " holdtime=")); - unsigned_relts_print(ndo, EXTRACT_16BITS(&bp[2])); + unsigned_relts_print(ndo, EXTRACT_BE_16BITS(&bp[2])); bp += 4; len -= 4; @@ -1172,7 +1174,7 @@ pimv2_print(netdissect_options *ndo, goto trunc; ND_TCHECK_16BITS(bp); ND_PRINT((ndo, " TUNR ")); - unsigned_relts_print(ndo, EXTRACT_16BITS(bp)); + unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp)); break; diff --git a/print-ppp.c b/print-ppp.c index 89176172..0838fd3b 100644 --- a/print-ppp.c +++ b/print-ppp.c @@ -444,7 +444,7 @@ handle_ctrl_proto(netdissect_options *ndo, return; /* there may be a NULL confreq etc. */ ND_TCHECK2(*tptr, 2); - len = EXTRACT_16BITS(tptr); + len = EXTRACT_BE_16BITS(tptr); tptr += 2; ND_PRINT((ndo, "\n\tencoded length %u (=Option(s) length %u)", len, len - 4)); @@ -458,12 +458,12 @@ handle_ctrl_proto(netdissect_options *ndo, if (length < 11) break; ND_TCHECK2(*tptr, 4); - ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_32BITS(tptr))); tptr += 4; ND_TCHECK2(*tptr, 3); ND_PRINT((ndo, " Vendor: %s (%u)", - tok2str(oui_values,"Unknown",EXTRACT_24BITS(tptr)), - EXTRACT_24BITS(tptr))); + tok2str(oui_values,"Unknown",EXTRACT_BE_24BITS(tptr)), + EXTRACT_BE_24BITS(tptr))); /* XXX: need to decode Kind and Value(s)? */ break; case CPCODES_CONF_REQ: @@ -519,8 +519,8 @@ handle_ctrl_proto(netdissect_options *ndo, break; ND_TCHECK2(*tptr, 2); ND_PRINT((ndo, "\n\t Rejected %s Protocol (0x%04x)", - tok2str(ppptype2str,"unknown", EXTRACT_16BITS(tptr)), - EXTRACT_16BITS(tptr))); + tok2str(ppptype2str,"unknown", EXTRACT_BE_16BITS(tptr)), + EXTRACT_BE_16BITS(tptr))); /* XXX: need to decode Rejected-Information? - hexdump for now */ if (len > 6) { ND_PRINT((ndo, "\n\t Rejected Packet")); @@ -533,7 +533,7 @@ handle_ctrl_proto(netdissect_options *ndo, if (length < 8) break; ND_TCHECK2(*tptr, 4); - ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_32BITS(tptr))); /* XXX: need to decode Data? - hexdump for now */ if (len > 8) { ND_PRINT((ndo, "\n\t -----trailing data-----")); @@ -545,7 +545,7 @@ handle_ctrl_proto(netdissect_options *ndo, if (length < 8) break; ND_TCHECK2(*tptr, 4); - ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_32BITS(tptr))); /* RFC 1661 says this is intended to be human readable */ if (len > 8) { ND_PRINT((ndo, "\n\t Message\n\t ")); @@ -557,9 +557,9 @@ handle_ctrl_proto(netdissect_options *ndo, if (length < 12) break; ND_TCHECK2(*tptr, 4); - ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_32BITS(tptr))); ND_TCHECK2(*(tptr + 4), 4); - ND_PRINT((ndo, ", Seconds-Remaining %us", EXTRACT_32BITS(tptr + 4))); + ND_PRINT((ndo, ", Seconds-Remaining %us", EXTRACT_BE_32BITS(tptr + 4))); /* XXX: need to decode Message? */ break; default: @@ -613,8 +613,8 @@ print_lcp_config_options(netdissect_options *ndo, } ND_TCHECK_24BITS(p + 2); ND_PRINT((ndo, ": Vendor: %s (%u)", - tok2str(oui_values,"Unknown",EXTRACT_24BITS(p+2)), - EXTRACT_24BITS(p + 2))); + tok2str(oui_values,"Unknown",EXTRACT_BE_24BITS(p + 2)), + EXTRACT_BE_24BITS(p + 2))); #if 0 ND_TCHECK(p[5]); ND_PRINT((ndo, ", kind: 0x%02x", p[5])); @@ -631,7 +631,7 @@ print_lcp_config_options(netdissect_options *ndo, return len; } ND_TCHECK_16BITS(p + 2); - ND_PRINT((ndo, ": %u", EXTRACT_16BITS(p + 2))); + ND_PRINT((ndo, ": %u", EXTRACT_BE_16BITS(p + 2))); break; case LCPOPT_ACCM: if (len != 6) { @@ -639,7 +639,7 @@ print_lcp_config_options(netdissect_options *ndo, return len; } ND_TCHECK_32BITS(p + 2); - ND_PRINT((ndo, ": 0x%08x", EXTRACT_32BITS(p + 2))); + ND_PRINT((ndo, ": 0x%08x", EXTRACT_BE_32BITS(p + 2))); break; case LCPOPT_AP: if (len < 4) { @@ -647,9 +647,9 @@ print_lcp_config_options(netdissect_options *ndo, return len; } ND_TCHECK_16BITS(p + 2); - ND_PRINT((ndo, ": %s", tok2str(ppptype2str, "Unknown Auth Proto (0x04x)", EXTRACT_16BITS(p + 2)))); + ND_PRINT((ndo, ": %s", tok2str(ppptype2str, "Unknown Auth Proto (0x04x)", EXTRACT_BE_16BITS(p + 2)))); - switch (EXTRACT_16BITS(p+2)) { + switch (EXTRACT_BE_16BITS(p + 2)) { case PPP_CHAP: ND_TCHECK(p[4]); ND_PRINT((ndo, ", %s", tok2str(authalg_values, "Unknown Auth Alg %u", p[4]))); @@ -669,7 +669,7 @@ print_lcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_16BITS(p+2); - if (EXTRACT_16BITS(p+2) == PPP_LQM) + if (EXTRACT_BE_16BITS(p + 2) == PPP_LQM) ND_PRINT((ndo, ": LQR")); else ND_PRINT((ndo, ": unknown")); @@ -680,7 +680,7 @@ print_lcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_32BITS(p + 2); - ND_PRINT((ndo, ": 0x%08x", EXTRACT_32BITS(p + 2))); + ND_PRINT((ndo, ": 0x%08x", EXTRACT_BE_32BITS(p + 2))); break; case LCPOPT_PFC: break; @@ -692,7 +692,7 @@ print_lcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_16BITS(p + 2); - ND_PRINT((ndo, ": 0x%04x", EXTRACT_16BITS(p + 2))); + ND_PRINT((ndo, ": 0x%04x", EXTRACT_BE_16BITS(p + 2))); break; case LCPOPT_CBACK: if (len < 3) { @@ -711,7 +711,7 @@ print_lcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_16BITS(p + 2); - ND_PRINT((ndo, ": %u", EXTRACT_16BITS(p + 2))); + ND_PRINT((ndo, ": %u", EXTRACT_BE_16BITS(p + 2))); break; case LCPOPT_MLED: if (len < 3) { @@ -821,7 +821,7 @@ handle_mlppp(netdissect_options *ndo, } ND_PRINT((ndo, "seq 0x%03x, Flags [%s], length %u", - (EXTRACT_16BITS(p))&0x0fff, /* only support 12-Bit sequence space for now */ + (EXTRACT_BE_16BITS(p))&0x0fff, /* only support 12-Bit sequence space for now */ bittok2str(ppp_ml_flag_values, "none", *p & 0xc0), length)); } @@ -858,7 +858,7 @@ handle_chap(netdissect_options *ndo, p++; ND_TCHECK2(*p, 2); - len = EXTRACT_16BITS(p); + len = EXTRACT_BE_16BITS(p); p += 2; /* @@ -938,7 +938,7 @@ handle_pap(netdissect_options *ndo, p++; ND_TCHECK2(*p, 2); - len = EXTRACT_16BITS(p); + len = EXTRACT_BE_16BITS(p); p += 2; if ((int)len > length) { @@ -1065,7 +1065,7 @@ print_ipcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_16BITS(p+2); - compproto = EXTRACT_16BITS(p+2); + compproto = EXTRACT_BE_16BITS(p + 2); ND_PRINT((ndo, ": %s (0x%02x):", tok2str(ipcpopt_compproto_values, "Unknown", compproto), @@ -1085,11 +1085,11 @@ print_ipcp_config_options(netdissect_options *ndo, ND_TCHECK2(*(p + 2), IPCPOPT_IPCOMP_MINLEN); ND_PRINT((ndo, "\n\t TCP Space %u, non-TCP Space %u" \ ", maxPeriod %u, maxTime %u, maxHdr %u", - EXTRACT_16BITS(p+4), - EXTRACT_16BITS(p+6), - EXTRACT_16BITS(p+8), - EXTRACT_16BITS(p+10), - EXTRACT_16BITS(p+12))); + EXTRACT_BE_16BITS(p + 4), + EXTRACT_BE_16BITS(p + 6), + EXTRACT_BE_16BITS(p + 8), + EXTRACT_BE_16BITS(p + 10), + EXTRACT_BE_16BITS(p + 12))); /* suboptions present ? */ if (len > IPCPOPT_IPCOMP_MINLEN) { @@ -1192,10 +1192,10 @@ print_ip6cp_config_options(netdissect_options *ndo, } ND_TCHECK2(*(p + 2), 8); ND_PRINT((ndo, ": %04x:%04x:%04x:%04x", - EXTRACT_16BITS(p + 2), - EXTRACT_16BITS(p + 4), - EXTRACT_16BITS(p + 6), - EXTRACT_16BITS(p + 8))); + EXTRACT_BE_16BITS(p + 2), + EXTRACT_BE_16BITS(p + 4), + EXTRACT_BE_16BITS(p + 6), + EXTRACT_BE_16BITS(p + 8))); break; default: /* @@ -1346,7 +1346,7 @@ print_bacp_config_options(netdissect_options *ndo, return len; } ND_TCHECK_32BITS(p + 2); - ND_PRINT((ndo, ": Magic-Num 0x%08x", EXTRACT_32BITS(p + 2))); + ND_PRINT((ndo, ": Magic-Num 0x%08x", EXTRACT_BE_32BITS(p + 2))); break; default: /* @@ -1421,13 +1421,13 @@ ppp_hdlc(netdissect_options *ndo, if (length < 2) goto trunc; - proto = EXTRACT_16BITS(b); /* next guess - load two octets */ + proto = EXTRACT_BE_16BITS(b); /* next guess - load two octets */ switch (proto) { case (PPP_ADDRESS << 8 | PPP_CONTROL): /* looks like a PPP frame */ if (length < 4) goto trunc; - proto = EXTRACT_16BITS(b+2); /* load the PPP proto-id */ + proto = EXTRACT_BE_16BITS(b + 2); /* load the PPP proto-id */ handle_ppp(ndo, proto, b + 4, length - 4); break; default: /* last guess - proto must be a PPP proto-id */ @@ -1525,7 +1525,7 @@ ppp_print(netdissect_options *ndo, if (length < 2) goto trunc; ND_TCHECK2(*p, 2); - ppp_header = EXTRACT_16BITS(p); + ppp_header = EXTRACT_BE_16BITS(p); switch(ppp_header) { case (PPP_WITHDIRECTION_IN << 8 | PPP_CONTROL): @@ -1560,7 +1560,7 @@ ppp_print(netdissect_options *ndo, hdr_len++; } else { ND_TCHECK2(*p, 2); - proto = EXTRACT_16BITS(p); + proto = EXTRACT_BE_16BITS(p); p += 2; length -= 2; hdr_len += 2; @@ -1676,7 +1676,7 @@ ppp_hdlc_if_print(netdissect_options *ndo, length -= 2; hdrlen += 2; - proto = EXTRACT_16BITS(p); + proto = EXTRACT_BE_16BITS(p); p += 2; length -= 2; hdrlen += 2; diff --git a/print-pppoe.c b/print-pppoe.c index 23d9a238..7ee7c729 100644 --- a/print-pppoe.c +++ b/print-pppoe.c @@ -107,8 +107,8 @@ pppoe_print(netdissect_options *ndo, register const u_char *bp, u_int length) pppoe_ver = (pppoe_packet[0] & 0xF0) >> 4; pppoe_type = (pppoe_packet[0] & 0x0F); pppoe_code = pppoe_packet[1]; - pppoe_sessionid = EXTRACT_16BITS(pppoe_packet + 2); - pppoe_length = EXTRACT_16BITS(pppoe_packet + 4); + pppoe_sessionid = EXTRACT_BE_16BITS(pppoe_packet + 2); + pppoe_length = EXTRACT_BE_16BITS(pppoe_packet + 4); pppoe_payload = pppoe_packet + PPPOE_HDRLEN; if (pppoe_ver != 1) { @@ -142,8 +142,8 @@ pppoe_print(netdissect_options *ndo, register const u_char *bp, u_int length) */ while (tag_type && p < pppoe_payload + pppoe_length) { ND_TCHECK2(*p, 4); - tag_type = EXTRACT_16BITS(p); - tag_len = EXTRACT_16BITS(p + 2); + tag_type = EXTRACT_BE_16BITS(p); + tag_len = EXTRACT_BE_16BITS(p + 2); p += 4; /* p points to tag_value */ diff --git a/print-pptp.c b/print-pptp.c index a4d713d5..779011a2 100644 --- a/print-pptp.c +++ b/print-pptp.c @@ -274,8 +274,8 @@ pptp_bearer_cap_print(netdissect_options *ndo, const uint32_t *bearer_cap) { ND_PRINT((ndo, " BEARER_CAP(%s%s)", - EXTRACT_32BITS(bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK ? "D" : "", - EXTRACT_32BITS(bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK ? "A" : "")); + EXTRACT_BE_32BITS(bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK ? "D" : "", + EXTRACT_BE_32BITS(bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK ? "A" : "")); } static const struct tok pptp_btype_str[] = { @@ -290,35 +290,35 @@ pptp_bearer_type_print(netdissect_options *ndo, const uint32_t *bearer_type) { ND_PRINT((ndo, " BEARER_TYPE(%s)", - tok2str(pptp_btype_str, "?", EXTRACT_32BITS(bearer_type)))); + tok2str(pptp_btype_str, "?", EXTRACT_BE_32BITS(bearer_type)))); } static void pptp_call_id_print(netdissect_options *ndo, const uint16_t *call_id) { - ND_PRINT((ndo, " CALL_ID(%u)", EXTRACT_16BITS(call_id))); + ND_PRINT((ndo, " CALL_ID(%u)", EXTRACT_BE_16BITS(call_id))); } static void pptp_call_ser_print(netdissect_options *ndo, const uint16_t *call_ser) { - ND_PRINT((ndo, " CALL_SER_NUM(%u)", EXTRACT_16BITS(call_ser))); + ND_PRINT((ndo, " CALL_SER_NUM(%u)", EXTRACT_BE_16BITS(call_ser))); } static void pptp_cause_code_print(netdissect_options *ndo, const uint16_t *cause_code) { - ND_PRINT((ndo, " CAUSE_CODE(%u)", EXTRACT_16BITS(cause_code))); + ND_PRINT((ndo, " CAUSE_CODE(%u)", EXTRACT_BE_16BITS(cause_code))); } static void pptp_conn_speed_print(netdissect_options *ndo, const uint32_t *conn_speed) { - ND_PRINT((ndo, " CONN_SPEED(%u)", EXTRACT_32BITS(conn_speed))); + ND_PRINT((ndo, " CONN_SPEED(%u)", EXTRACT_BE_32BITS(conn_speed))); } static const struct tok pptp_errcode_str[] = { @@ -347,7 +347,7 @@ static void pptp_firm_rev_print(netdissect_options *ndo, const uint16_t *firm_rev) { - ND_PRINT((ndo, " FIRM_REV(%u)", EXTRACT_16BITS(firm_rev))); + ND_PRINT((ndo, " FIRM_REV(%u)", EXTRACT_BE_16BITS(firm_rev))); } static void @@ -355,10 +355,10 @@ pptp_framing_cap_print(netdissect_options *ndo, const uint32_t *framing_cap) { ND_PRINT((ndo, " FRAME_CAP(")); - if (EXTRACT_32BITS(framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) { + if (EXTRACT_BE_32BITS(framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) { ND_PRINT((ndo, "A")); /* Async */ } - if (EXTRACT_32BITS(framing_cap) & PPTP_FRAMING_CAP_SYNC_MASK) { + if (EXTRACT_BE_32BITS(framing_cap) & PPTP_FRAMING_CAP_SYNC_MASK) { ND_PRINT((ndo, "S")); /* Sync */ } ND_PRINT((ndo, ")")); @@ -376,7 +376,7 @@ pptp_framing_type_print(netdissect_options *ndo, const uint32_t *framing_type) { ND_PRINT((ndo, " FRAME_TYPE(%s)", - tok2str(pptp_ftype_str, "?", EXTRACT_32BITS(framing_type)))); + tok2str(pptp_ftype_str, "?", EXTRACT_BE_32BITS(framing_type)))); } static void @@ -390,35 +390,35 @@ static void pptp_id_print(netdissect_options *ndo, const uint32_t *id) { - ND_PRINT((ndo, " ID(%u)", EXTRACT_32BITS(id))); + ND_PRINT((ndo, " ID(%u)", EXTRACT_BE_32BITS(id))); } static void pptp_max_channel_print(netdissect_options *ndo, const uint16_t *max_channel) { - ND_PRINT((ndo, " MAX_CHAN(%u)", EXTRACT_16BITS(max_channel))); + ND_PRINT((ndo, " MAX_CHAN(%u)", EXTRACT_BE_16BITS(max_channel))); } static void pptp_peer_call_id_print(netdissect_options *ndo, const uint16_t *peer_call_id) { - ND_PRINT((ndo, " PEER_CALL_ID(%u)", EXTRACT_16BITS(peer_call_id))); + ND_PRINT((ndo, " PEER_CALL_ID(%u)", EXTRACT_BE_16BITS(peer_call_id))); } static void pptp_phy_chan_id_print(netdissect_options *ndo, const uint32_t *phy_chan_id) { - ND_PRINT((ndo, " PHY_CHAN_ID(%u)", EXTRACT_32BITS(phy_chan_id))); + ND_PRINT((ndo, " PHY_CHAN_ID(%u)", EXTRACT_BE_32BITS(phy_chan_id))); } static void pptp_pkt_proc_delay_print(netdissect_options *ndo, const uint16_t *pkt_proc_delay) { - ND_PRINT((ndo, " PROC_DELAY(%u)", EXTRACT_16BITS(pkt_proc_delay))); + ND_PRINT((ndo, " PROC_DELAY(%u)", EXTRACT_BE_16BITS(pkt_proc_delay))); } static void @@ -426,15 +426,15 @@ pptp_proto_ver_print(netdissect_options *ndo, const uint16_t *proto_ver) { ND_PRINT((ndo, " PROTO_VER(%u.%u)", /* Version.Revision */ - EXTRACT_16BITS(proto_ver) >> 8, - EXTRACT_16BITS(proto_ver) & 0xff)); + EXTRACT_BE_16BITS(proto_ver) >> 8, + EXTRACT_BE_16BITS(proto_ver) & 0xff)); } static void pptp_recv_winsiz_print(netdissect_options *ndo, const uint16_t *recv_winsiz) { - ND_PRINT((ndo, " RECV_WIN(%u)", EXTRACT_16BITS(recv_winsiz))); + ND_PRINT((ndo, " RECV_WIN(%u)", EXTRACT_BE_16BITS(recv_winsiz))); } static const struct tok pptp_scrrp_str[] = { @@ -672,9 +672,9 @@ pptp_ocrq_print(netdissect_options *ndo, ND_TCHECK(ptr->call_ser); pptp_call_ser_print(ndo, &ptr->call_ser); ND_TCHECK(ptr->min_bps); - ND_PRINT((ndo, " MIN_BPS(%u)", EXTRACT_32BITS(&ptr->min_bps))); + ND_PRINT((ndo, " MIN_BPS(%u)", EXTRACT_BE_32BITS(&ptr->min_bps))); ND_TCHECK(ptr->max_bps); - ND_PRINT((ndo, " MAX_BPS(%u)", EXTRACT_32BITS(&ptr->max_bps))); + ND_PRINT((ndo, " MAX_BPS(%u)", EXTRACT_BE_32BITS(&ptr->max_bps))); ND_TCHECK(ptr->bearer_type); pptp_bearer_type_print(ndo, &ptr->bearer_type); ND_TCHECK(ptr->framing_type); @@ -684,7 +684,7 @@ pptp_ocrq_print(netdissect_options *ndo, ND_TCHECK(ptr->pkt_proc_delay); pptp_pkt_proc_delay_print(ndo, &ptr->pkt_proc_delay); ND_TCHECK(ptr->phone_no_len); - ND_PRINT((ndo, " PHONE_NO_LEN(%u)", EXTRACT_16BITS(&ptr->phone_no_len))); + ND_PRINT((ndo, " PHONE_NO_LEN(%u)", EXTRACT_BE_16BITS(&ptr->phone_no_len))); ND_TCHECK(ptr->reserved1); ND_TCHECK(ptr->phone_no); ND_PRINT((ndo, " PHONE_NO(%.64s)", ptr->phone_no)); @@ -743,9 +743,9 @@ pptp_icrq_print(netdissect_options *ndo, ND_TCHECK(ptr->phy_chan_id); pptp_phy_chan_id_print(ndo, &ptr->phy_chan_id); ND_TCHECK(ptr->dialed_no_len); - ND_PRINT((ndo, " DIALED_NO_LEN(%u)", EXTRACT_16BITS(&ptr->dialed_no_len))); + ND_PRINT((ndo, " DIALED_NO_LEN(%u)", EXTRACT_BE_16BITS(&ptr->dialed_no_len))); ND_TCHECK(ptr->dialing_no_len); - ND_PRINT((ndo, " DIALING_NO_LEN(%u)", EXTRACT_16BITS(&ptr->dialing_no_len))); + ND_PRINT((ndo, " DIALING_NO_LEN(%u)", EXTRACT_BE_16BITS(&ptr->dialing_no_len))); ND_TCHECK(ptr->dialed_no); ND_PRINT((ndo, " DIALED_NO(%.64s)", ptr->dialed_no)); ND_TCHECK(ptr->dialing_no); @@ -859,17 +859,17 @@ pptp_wen_print(netdissect_options *ndo, pptp_peer_call_id_print(ndo, &ptr->peer_call_id); ND_TCHECK(ptr->reserved1); ND_TCHECK(ptr->crc_err); - ND_PRINT((ndo, " CRC_ERR(%u)", EXTRACT_32BITS(&ptr->crc_err))); + ND_PRINT((ndo, " CRC_ERR(%u)", EXTRACT_BE_32BITS(&ptr->crc_err))); ND_TCHECK(ptr->framing_err); - ND_PRINT((ndo, " FRAMING_ERR(%u)", EXTRACT_32BITS(&ptr->framing_err))); + ND_PRINT((ndo, " FRAMING_ERR(%u)", EXTRACT_BE_32BITS(&ptr->framing_err))); ND_TCHECK(ptr->hardware_overrun); - ND_PRINT((ndo, " HARDWARE_OVERRUN(%u)", EXTRACT_32BITS(&ptr->hardware_overrun))); + ND_PRINT((ndo, " HARDWARE_OVERRUN(%u)", EXTRACT_BE_32BITS(&ptr->hardware_overrun))); ND_TCHECK(ptr->buffer_overrun); - ND_PRINT((ndo, " BUFFER_OVERRUN(%u)", EXTRACT_32BITS(&ptr->buffer_overrun))); + ND_PRINT((ndo, " BUFFER_OVERRUN(%u)", EXTRACT_BE_32BITS(&ptr->buffer_overrun))); ND_TCHECK(ptr->timeout_err); - ND_PRINT((ndo, " TIMEOUT_ERR(%u)", EXTRACT_32BITS(&ptr->timeout_err))); + ND_PRINT((ndo, " TIMEOUT_ERR(%u)", EXTRACT_BE_32BITS(&ptr->timeout_err))); ND_TCHECK(ptr->align_err); - ND_PRINT((ndo, " ALIGN_ERR(%u)", EXTRACT_32BITS(&ptr->align_err))); + ND_PRINT((ndo, " ALIGN_ERR(%u)", EXTRACT_BE_32BITS(&ptr->align_err))); return; @@ -887,9 +887,9 @@ pptp_sli_print(netdissect_options *ndo, pptp_peer_call_id_print(ndo, &ptr->peer_call_id); ND_TCHECK(ptr->reserved1); ND_TCHECK(ptr->send_accm); - ND_PRINT((ndo, " SEND_ACCM(0x%08x)", EXTRACT_32BITS(&ptr->send_accm))); + ND_PRINT((ndo, " SEND_ACCM(0x%08x)", EXTRACT_BE_32BITS(&ptr->send_accm))); ND_TCHECK(ptr->recv_accm); - ND_PRINT((ndo, " RECV_ACCM(0x%08x)", EXTRACT_32BITS(&ptr->recv_accm))); + ND_PRINT((ndo, " RECV_ACCM(0x%08x)", EXTRACT_BE_32BITS(&ptr->recv_accm))); return; @@ -911,11 +911,11 @@ pptp_print(netdissect_options *ndo, ND_TCHECK(hdr->length); if (ndo->ndo_vflag) { - ND_PRINT((ndo, " Length=%u", EXTRACT_16BITS(&hdr->length))); + ND_PRINT((ndo, " Length=%u", EXTRACT_BE_16BITS(&hdr->length))); } ND_TCHECK(hdr->msg_type); if (ndo->ndo_vflag) { - switch(EXTRACT_16BITS(&hdr->msg_type)) { + switch(EXTRACT_BE_16BITS(&hdr->msg_type)) { case PPTP_MSG_TYPE_CTRL: ND_PRINT((ndo, " CTRL-MSG")); break; @@ -929,7 +929,7 @@ pptp_print(netdissect_options *ndo, } ND_TCHECK(hdr->magic_cookie); - mc = EXTRACT_32BITS(&hdr->magic_cookie); + mc = EXTRACT_BE_32BITS(&hdr->magic_cookie); if (mc != PPTP_MAGIC_COOKIE) { ND_PRINT((ndo, " UNEXPECTED Magic-Cookie!!(%08x)", mc)); } @@ -937,7 +937,7 @@ pptp_print(netdissect_options *ndo, ND_PRINT((ndo, " Magic-Cookie=%08x", mc)); } ND_TCHECK(hdr->ctrl_msg_type); - ctrl_msg_type = EXTRACT_16BITS(&hdr->ctrl_msg_type); + ctrl_msg_type = EXTRACT_BE_16BITS(&hdr->ctrl_msg_type); if (ctrl_msg_type < PPTP_MAX_MSGTYPE_INDEX) { ND_PRINT((ndo, " CTRL_MSGTYPE=%s", pptp_message_type_string[ctrl_msg_type])); diff --git a/print-radius.c b/print-radius.c index f212a83e..0df38221 100644 --- a/print-radius.c +++ b/print-radius.c @@ -599,7 +599,7 @@ print_attr_string(netdissect_options *ndo, ND_PRINT((ndo, "Tag[Unused] ")); data++; length--; - ND_PRINT((ndo, "Salt %u ", EXTRACT_16BITS(data))); + ND_PRINT((ndo, "Salt %u ", EXTRACT_BE_16BITS(data))); data+=2; length-=2; break; @@ -656,7 +656,7 @@ print_vendor_attr(netdissect_options *ndo, if (length < 4) goto trunc; ND_TCHECK2(*data, 4); - vendor_id = EXTRACT_32BITS(data); + vendor_id = EXTRACT_BE_32BITS(data); data+=4; length-=4; @@ -736,11 +736,11 @@ print_attr_num(netdissect_options *ndo, else ND_PRINT((ndo, "Tag[%d] ", *data)); data++; - data_value = EXTRACT_24BITS(data); + data_value = EXTRACT_BE_24BITS(data); } else { - data_value = EXTRACT_32BITS(data); + data_value = EXTRACT_BE_32BITS(data); } if ( data_value <= (uint32_t)(attr_type[attr_code].siz_subtypes - 1 + attr_type[attr_code].first_subtype) && @@ -754,10 +754,10 @@ print_attr_num(netdissect_options *ndo, switch(attr_code) /* Be aware of special cases... */ { case FRM_IPX: - if (EXTRACT_32BITS( data) == 0xFFFFFFFE ) + if (EXTRACT_BE_32BITS(data) == 0xFFFFFFFE ) ND_PRINT((ndo, "NAS Select")); else - ND_PRINT((ndo, "%d", EXTRACT_32BITS(data))); + ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data))); break; case SESSION_TIMEOUT: @@ -765,7 +765,7 @@ print_attr_num(netdissect_options *ndo, case ACCT_DELAY: case ACCT_SESSION_TIME: case ACCT_INT_INTERVAL: - timeout = EXTRACT_32BITS( data); + timeout = EXTRACT_BE_32BITS(data); if ( timeout < 60 ) ND_PRINT((ndo, "%02d secs", timeout)); else @@ -781,15 +781,15 @@ print_attr_num(netdissect_options *ndo, break; case FRM_ATALK_LINK: - if (EXTRACT_32BITS(data) ) - ND_PRINT((ndo, "%d", EXTRACT_32BITS(data))); + if (EXTRACT_BE_32BITS(data)) + ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data))); else ND_PRINT((ndo, "Unnumbered")); break; case FRM_ATALK_NETWORK: - if (EXTRACT_32BITS(data) ) - ND_PRINT((ndo, "%d", EXTRACT_32BITS(data))); + if (EXTRACT_BE_32BITS(data)) + ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data))); else ND_PRINT((ndo, "NAS assigned")); break; @@ -800,7 +800,7 @@ print_attr_num(netdissect_options *ndo, else ND_PRINT((ndo, "Tag[Unused] ")); data++; - ND_PRINT((ndo, "%d", EXTRACT_24BITS(data))); + ND_PRINT((ndo, "%d", EXTRACT_BE_24BITS(data))); break; case EGRESS_VLAN_ID: @@ -808,11 +808,11 @@ print_attr_num(netdissect_options *ndo, tok2str(rfc4675_tagged,"Unknown tag",*data), *data)); data++; - ND_PRINT((ndo, "%d", EXTRACT_24BITS(data))); + ND_PRINT((ndo, "%d", EXTRACT_BE_24BITS(data))); break; default: - ND_PRINT((ndo, "%d", EXTRACT_32BITS(data))); + ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data))); break; } /* switch */ @@ -848,10 +848,10 @@ print_attr_address(netdissect_options *ndo, { case FRM_IPADDR: case LOG_IPHOST: - if (EXTRACT_32BITS(data) == 0xFFFFFFFF ) + if (EXTRACT_BE_32BITS(data) == 0xFFFFFFFF ) ND_PRINT((ndo, "User Selected")); else - if (EXTRACT_32BITS(data) == 0xFFFFFFFE ) + if (EXTRACT_BE_32BITS(data) == 0xFFFFFFFE ) ND_PRINT((ndo, "NAS Select")); else ND_PRINT((ndo, "%s",ipaddr_string(ndo, data))); @@ -951,7 +951,7 @@ print_attr_time(netdissect_options *ndo, ND_TCHECK2(data[0],4); - attr_time = EXTRACT_32BITS(data); + attr_time = EXTRACT_BE_32BITS(data); strlcpy(string, ctime(&attr_time), sizeof(string)); /* Get rid of the newline */ string[24] = '\0'; @@ -1043,7 +1043,7 @@ print_attr_strange(netdissect_options *ndo, } ND_TCHECK2(data[0],4); - error_cause_value = EXTRACT_32BITS(data); + error_cause_value = EXTRACT_BE_32BITS(data); ND_PRINT((ndo, "Error cause %u: %s", error_cause_value, tok2str(errorcausetype, "Error-Cause %u not known", error_cause_value))); break; } @@ -1123,7 +1123,7 @@ radius_print(netdissect_options *ndo, ND_TCHECK2(*dat, MIN_RADIUS_LEN); rad = (const struct radius_hdr *)dat; - len = EXTRACT_16BITS(&rad->len); + len = EXTRACT_BE_16BITS(&rad->len); if (len < MIN_RADIUS_LEN) { diff --git a/print-rip.c b/print-rip.c index cf661d03..43f681b8 100644 --- a/print-rip.c +++ b/print-rip.c @@ -100,15 +100,15 @@ rip_entry_print_v1(netdissect_options *ndo, register u_short family; /* RFC 1058 */ - family = EXTRACT_16BITS(&ni->rip_family); + family = EXTRACT_BE_16BITS(&ni->rip_family); if (family != BSD_AFNUM_INET && family != 0) { ND_PRINT((ndo, "\n\t AFI %s, ", tok2str(bsd_af_values, "Unknown (%u)", family))); print_unknown_data(ndo, (const uint8_t *)&ni->rip_family, "\n\t ", RIP_ROUTELEN); return; } - if (EXTRACT_16BITS(&ni->rip_tag) || - EXTRACT_32BITS(&ni->rip_dest_mask) || - EXTRACT_32BITS(&ni->rip_router)) { + if (EXTRACT_BE_16BITS(&ni->rip_tag) || + EXTRACT_BE_32BITS(&ni->rip_dest_mask) || + EXTRACT_BE_32BITS(&ni->rip_router)) { /* MBZ fields not zero */ print_unknown_data(ndo, (const uint8_t *)&ni->rip_family, "\n\t ", RIP_ROUTELEN); return; @@ -116,12 +116,12 @@ rip_entry_print_v1(netdissect_options *ndo, if (family == 0) { ND_PRINT((ndo, "\n\t AFI 0, %s, metric: %u", ipaddr_string(ndo, &ni->rip_dest), - EXTRACT_32BITS(&ni->rip_metric))); + EXTRACT_BE_32BITS(&ni->rip_metric))); return; } /* BSD_AFNUM_INET */ ND_PRINT((ndo, "\n\t %s, metric: %u", ipaddr_string(ndo, &ni->rip_dest), - EXTRACT_32BITS(&ni->rip_metric))); + EXTRACT_BE_32BITS(&ni->rip_metric))); } static unsigned @@ -130,9 +130,9 @@ rip_entry_print_v2(netdissect_options *ndo, { register u_short family; - family = EXTRACT_16BITS(&ni->rip_family); + family = EXTRACT_BE_16BITS(&ni->rip_family); if (family == 0xFFFF) { /* variable-sized authentication structures */ - uint16_t auth_type = EXTRACT_16BITS(&ni->rip_tag); + uint16_t auth_type = EXTRACT_BE_16BITS(&ni->rip_tag); if (auth_type == 2) { register const u_char *p = (const u_char *)&ni->rip_dest; u_int i = 0; @@ -141,19 +141,19 @@ rip_entry_print_v2(netdissect_options *ndo, ND_PRINT((ndo, "%c", ND_ISPRINT(*p) ? *p : '.')); } else if (auth_type == 3) { ND_PRINT((ndo, "\n\t Auth header:")); - ND_PRINT((ndo, " Packet Len %u,", EXTRACT_16BITS((const uint8_t *)ni + 4))); + ND_PRINT((ndo, " Packet Len %u,", EXTRACT_BE_16BITS((const uint8_t *)ni + 4))); ND_PRINT((ndo, " Key-ID %u,", *((const uint8_t *)ni + 6))); ND_PRINT((ndo, " Auth Data Len %u,", *((const uint8_t *)ni + 7))); - ND_PRINT((ndo, " SeqNo %u,", EXTRACT_32BITS(&ni->rip_dest_mask))); - ND_PRINT((ndo, " MBZ %u,", EXTRACT_32BITS(&ni->rip_router))); - ND_PRINT((ndo, " MBZ %u", EXTRACT_32BITS(&ni->rip_metric))); + ND_PRINT((ndo, " SeqNo %u,", EXTRACT_BE_32BITS(&ni->rip_dest_mask))); + ND_PRINT((ndo, " MBZ %u,", EXTRACT_BE_32BITS(&ni->rip_router))); + ND_PRINT((ndo, " MBZ %u", EXTRACT_BE_32BITS(&ni->rip_metric))); } else if (auth_type == 1) { ND_PRINT((ndo, "\n\t Auth trailer:")); print_unknown_data(ndo, (const uint8_t *)&ni->rip_dest, "\n\t ", remaining); return remaining; /* AT spans till the packet end */ } else { ND_PRINT((ndo, "\n\t Unknown (%u) Authentication data:", - EXTRACT_16BITS(&ni->rip_tag))); + EXTRACT_BE_16BITS(&ni->rip_tag))); print_unknown_data(ndo, (const uint8_t *)&ni->rip_dest, "\n\t ", remaining); } } else if (family != BSD_AFNUM_INET && family != 0) { @@ -163,10 +163,10 @@ rip_entry_print_v2(netdissect_options *ndo, ND_PRINT((ndo, "\n\t AFI %s, %15s/%-2d, tag 0x%04x, metric: %u, next-hop: ", tok2str(bsd_af_values, "%u", family), ipaddr_string(ndo, &ni->rip_dest), - mask2plen(EXTRACT_32BITS(&ni->rip_dest_mask)), - EXTRACT_16BITS(&ni->rip_tag), - EXTRACT_32BITS(&ni->rip_metric))); - if (EXTRACT_32BITS(&ni->rip_router)) + mask2plen(EXTRACT_BE_32BITS(&ni->rip_dest_mask)), + EXTRACT_BE_16BITS(&ni->rip_tag), + EXTRACT_BE_32BITS(&ni->rip_metric))); + if (EXTRACT_BE_32BITS(&ni->rip_router)) ND_PRINT((ndo, "%s", ipaddr_string(ndo, &ni->rip_router))); else ND_PRINT((ndo, "self")); diff --git a/print-ripng.c b/print-ripng.c index 7113239a..cf090245 100644 --- a/print-ripng.c +++ b/print-ripng.c @@ -99,7 +99,7 @@ rip6_entry_print(netdissect_options *ndo, register const struct netinfo6 *ni, in int l; l = ND_PRINT((ndo, "%s/%d", ip6addr_string(ndo, &ni->rip6_dest), ni->rip6_plen)); if (ni->rip6_tag) - l += ND_PRINT((ndo, " [%d]", EXTRACT_16BITS(&ni->rip6_tag))); + l += ND_PRINT((ndo, " [%d]", EXTRACT_BE_16BITS(&ni->rip6_tag))); if (metric) l += ND_PRINT((ndo, " (%d)", ni->rip6_metric)); return l; diff --git a/print-rpki-rtr.c b/print-rpki-rtr.c index 5c52863b..67ba86b0 100644 --- a/print-rpki-rtr.c +++ b/print-rpki-rtr.c @@ -200,7 +200,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len ND_TCHECK2(*tptr, sizeof(rpki_rtr_pdu)); pdu_header = (const rpki_rtr_pdu *)tptr; pdu_type = pdu_header->pdu_type; - pdu_len = EXTRACT_32BITS(pdu_header->length); + pdu_len = EXTRACT_BE_32BITS(pdu_header->length); /* Do not check bounds with pdu_len yet, do it in the case blocks * below to make it possible to decode at least the beginning of * a truncated Error Report PDU or a truncated encapsulated PDU. @@ -229,8 +229,8 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len msg = (const u_char *)(pdu_header + 1); ND_PRINT((ndo, "%sSession ID: 0x%04x, Serial: %u", indent_string(indent+2), - EXTRACT_16BITS(pdu_header->u.session_id), - EXTRACT_32BITS(msg))); + EXTRACT_BE_16BITS(pdu_header->u.session_id), + EXTRACT_BE_32BITS(msg))); break; /* @@ -253,7 +253,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len /* no additional boundary to check */ ND_PRINT((ndo, "%sSession ID: 0x%04x", indent_string(indent+2), - EXTRACT_16BITS(pdu_header->u.session_id))); + EXTRACT_BE_16BITS(pdu_header->u.session_id))); break; case RPKI_RTR_IPV4_PREFIX_PDU: @@ -268,7 +268,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len indent_string(indent+2), ipaddr_string(ndo, pdu->prefix), pdu->prefix_length, pdu->max_length, - EXTRACT_32BITS(pdu->as), pdu->flags)); + EXTRACT_BE_32BITS(pdu->as), pdu->flags)); } break; @@ -284,7 +284,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len indent_string(indent+2), ip6addr_string(ndo, pdu->prefix), pdu->prefix_length, pdu->max_length, - EXTRACT_32BITS(pdu->as), pdu->flags)); + EXTRACT_BE_32BITS(pdu->as), pdu->flags)); } break; @@ -302,10 +302,10 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len * data element, more data elements may be present. */ pdu = (const rpki_rtr_pdu_error_report *)tptr; - encapsulated_pdu_length = EXTRACT_32BITS(pdu->encapsulated_pdu_length); + encapsulated_pdu_length = EXTRACT_BE_32BITS(pdu->encapsulated_pdu_length); tlen += 4; - error_code = EXTRACT_16BITS(pdu->pdu_header.u.error_code); + error_code = EXTRACT_BE_16BITS(pdu->pdu_header.u.error_code); ND_PRINT((ndo, "%sError code: %s (%u), Encapsulated PDU length: %u", indent_string(indent+2), tok2str(rpki_rtr_error_codes, "Unknown", error_code), @@ -347,7 +347,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len /* * Extract, trail-zero and print the Error message. */ - text_length = EXTRACT_32BITS(tptr + tlen); + text_length = EXTRACT_BE_32BITS(tptr + tlen); tlen += 4; if (text_length) { diff --git a/print-rrcp.c b/print-rrcp.c index 936b3ea7..27eeae31 100644 --- a/print-rrcp.c +++ b/print-rrcp.c @@ -105,7 +105,7 @@ rrcp_print(netdissect_options *ndo, if (rrcp_proto==1){ ND_TCHECK2(*(cp + RRCP_AUTHKEY_OFFSET), 2); ND_PRINT((ndo, ", auth=0x%04x", - EXTRACT_16BITS(cp + RRCP_AUTHKEY_OFFSET))); + EXTRACT_BE_16BITS(cp + RRCP_AUTHKEY_OFFSET))); } if (rrcp_proto==1 && rrcp_opcode==0 && ((*(cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_ISREPLY)){ @@ -114,13 +114,13 @@ rrcp_print(netdissect_options *ndo, *(cp + RRCP_DOWNLINK_PORT_OFFSET), *(cp + RRCP_UPLINK_PORT_OFFSET), etheraddr_string(ndo, cp + RRCP_UPLINK_MAC_OFFSET), - EXTRACT_32BITS(cp + RRCP_VENDOR_ID_OFFSET), - EXTRACT_16BITS(cp + RRCP_CHIP_ID_OFFSET))); + EXTRACT_BE_32BITS(cp + RRCP_VENDOR_ID_OFFSET), + EXTRACT_BE_16BITS(cp + RRCP_CHIP_ID_OFFSET))); }else if (rrcp_opcode==1 || rrcp_opcode==2 || rrcp_proto==2){ ND_TCHECK2(*(cp + RRCP_COOKIE2_OFFSET), 4); ND_PRINT((ndo, ", cookie=0x%08x%08x ", - EXTRACT_32BITS(cp + RRCP_COOKIE2_OFFSET), - EXTRACT_32BITS(cp + RRCP_COOKIE1_OFFSET))); + EXTRACT_BE_32BITS(cp + RRCP_COOKIE2_OFFSET), + EXTRACT_BE_32BITS(cp + RRCP_COOKIE1_OFFSET))); } return; diff --git a/print-rsvp.c b/print-rsvp.c index 18628d17..3689b77e 100644 --- a/print-rsvp.c +++ b/print-rsvp.c @@ -501,7 +501,7 @@ rsvp_intserv_print(netdissect_options *ndo, return 0; parameter_id = *(tptr); ND_TCHECK2(*(tptr + 2), 2); - parameter_length = EXTRACT_16BITS(tptr+2)<<2; /* convert wordcount to bytecount */ + parameter_length = EXTRACT_BE_16BITS(tptr + 2)<<2; /* convert wordcount to bytecount */ ND_PRINT((ndo, "\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]", tok2str(rsvp_intserv_parameter_id_values,"unknown",parameter_id), @@ -523,7 +523,7 @@ rsvp_intserv_print(netdissect_options *ndo, */ if (parameter_length == 4) { ND_TCHECK2(*(tptr + 4), 4); - ND_PRINT((ndo, "\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr + 4))); + ND_PRINT((ndo, "\n\t\tIS hop count: %u", EXTRACT_BE_32BITS(tptr + 4))); } break; @@ -537,7 +537,7 @@ rsvp_intserv_print(netdissect_options *ndo, */ if (parameter_length == 4) { ND_TCHECK2(*(tptr + 4), 4); - bw.i = EXTRACT_32BITS(tptr+4); + bw.i = EXTRACT_BE_32BITS(tptr + 4); ND_PRINT((ndo, "\n\t\tPath b/w estimate: %.10g Mbps", bw.f / 125000)); } break; @@ -553,10 +553,10 @@ rsvp_intserv_print(netdissect_options *ndo, if (parameter_length == 4) { ND_TCHECK2(*(tptr + 4), 4); ND_PRINT((ndo, "\n\t\tMinimum path latency: ")); - if (EXTRACT_32BITS(tptr+4) == 0xffffffff) + if (EXTRACT_BE_32BITS(tptr + 4) == 0xffffffff) ND_PRINT((ndo, "don't care")); else - ND_PRINT((ndo, "%u", EXTRACT_32BITS(tptr + 4))); + ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(tptr + 4))); } break; @@ -571,7 +571,7 @@ rsvp_intserv_print(netdissect_options *ndo, */ if (parameter_length == 4) { ND_TCHECK2(*(tptr + 4), 4); - ND_PRINT((ndo, "\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr + 4))); + ND_PRINT((ndo, "\n\t\tComposed MTU: %u bytes", EXTRACT_BE_32BITS(tptr + 4))); } break; case 127: @@ -593,14 +593,14 @@ rsvp_intserv_print(netdissect_options *ndo, if (parameter_length == 20) { ND_TCHECK2(*(tptr + 4), 20); - bw.i = EXTRACT_32BITS(tptr+4); + bw.i = EXTRACT_BE_32BITS(tptr + 4); ND_PRINT((ndo, "\n\t\tToken Bucket Rate: %.10g Mbps", bw.f / 125000)); - bw.i = EXTRACT_32BITS(tptr+8); + bw.i = EXTRACT_BE_32BITS(tptr + 8); ND_PRINT((ndo, "\n\t\tToken Bucket Size: %.10g bytes", bw.f)); - bw.i = EXTRACT_32BITS(tptr+12); + bw.i = EXTRACT_BE_32BITS(tptr + 12); ND_PRINT((ndo, "\n\t\tPeak Data Rate: %.10g Mbps", bw.f / 125000)); - ND_PRINT((ndo, "\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr + 16))); - ND_PRINT((ndo, "\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr + 20))); + ND_PRINT((ndo, "\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_BE_32BITS(tptr + 16))); + ND_PRINT((ndo, "\n\t\tMaximum Packet Size: %u bytes", EXTRACT_BE_32BITS(tptr + 20))); } break; @@ -617,9 +617,9 @@ rsvp_intserv_print(netdissect_options *ndo, if (parameter_length == 8) { ND_TCHECK2(*(tptr + 4), 8); - bw.i = EXTRACT_32BITS(tptr+4); + bw.i = EXTRACT_BE_32BITS(tptr + 4); ND_PRINT((ndo, "\n\t\tRate: %.10g Mbps", bw.f / 125000)); - ND_PRINT((ndo, "\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr + 8))); + ND_PRINT((ndo, "\n\t\tSlack Term: %u", EXTRACT_BE_32BITS(tptr + 8))); } break; @@ -629,7 +629,7 @@ rsvp_intserv_print(netdissect_options *ndo, case 136: if (parameter_length == 4) { ND_TCHECK2(*(tptr + 4), 4); - ND_PRINT((ndo, "\n\t\tValue: %u", EXTRACT_32BITS(tptr + 4))); + ND_PRINT((ndo, "\n\t\tValue: %u", EXTRACT_BE_32BITS(tptr + 4))); } break; @@ -684,7 +684,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_TCHECK2(*tptr, sizeof(struct rsvp_object_header)); rsvp_obj_header = (const struct rsvp_object_header *)tptr; - rsvp_obj_len=EXTRACT_16BITS(rsvp_obj_header->length); + rsvp_obj_len=EXTRACT_BE_16BITS(rsvp_obj_header->length); rsvp_obj_ctype=rsvp_obj_header->ctype; if(rsvp_obj_len % 4) { @@ -742,7 +742,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s Flags: [0x%02x], DestPort %u", indent, *(obj_tptr+5), - EXTRACT_16BITS(obj_tptr + 6))); + EXTRACT_BE_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; @@ -756,7 +756,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s Flags: [0x%02x], DestPort %u", indent, *(obj_tptr+sizeof(struct in6_addr)+1), - EXTRACT_16BITS(obj_tptr + sizeof(struct in6_addr) + 2))); + EXTRACT_BE_16BITS(obj_tptr + sizeof(struct in6_addr) + 2))); obj_tlen-=20; obj_tptr+=20; break; @@ -767,7 +767,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s", indent, ip6addr_string(ndo, obj_tptr), - EXTRACT_16BITS(obj_tptr+18), + EXTRACT_BE_16BITS(obj_tptr + 18), ip6addr_string(ndo, obj_tptr + 20))); obj_tlen-=36; obj_tptr+=36; @@ -778,8 +778,8 @@ rsvp_obj_print(netdissect_options *ndo, return -1; ND_PRINT((ndo, "%s IPv6 P2MP LSP ID: 0x%08x, Tunnel ID: 0x%04x, Extended Tunnel ID: %s", indent, - EXTRACT_32BITS(obj_tptr), - EXTRACT_16BITS(obj_tptr+6), + EXTRACT_BE_32BITS(obj_tptr), + EXTRACT_BE_16BITS(obj_tptr + 6), ip6addr_string(ndo, obj_tptr + 8))); obj_tlen-=26; obj_tptr+=26; @@ -790,7 +790,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s IPv4 P2MP LSP ID: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_16BITS(obj_tptr+6), + EXTRACT_BE_16BITS(obj_tptr + 6), ipaddr_string(ndo, obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; @@ -802,7 +802,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_16BITS(obj_tptr+6), + EXTRACT_BE_16BITS(obj_tptr + 6), ipaddr_string(ndo, obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; @@ -869,7 +869,7 @@ rsvp_obj_print(netdissect_options *ndo, switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: while(obj_tlen >= 4 ) { - ND_PRINT((ndo, "%s Label: %u", indent, EXTRACT_32BITS(obj_tptr))); + ND_PRINT((ndo, "%s Label: %u", indent, EXTRACT_BE_32BITS(obj_tptr))); obj_tlen-=4; obj_tptr+=4; } @@ -879,7 +879,7 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT((ndo, "%s Generalized Label: %u", indent, - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr))); obj_tlen-=4; obj_tptr+=4; break; @@ -888,10 +888,10 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT((ndo, "%s Waveband ID: %u%s Start Label: %u, Stop Label: %u", indent, - EXTRACT_32BITS(obj_tptr), + EXTRACT_BE_32BITS(obj_tptr), indent, - EXTRACT_32BITS(obj_tptr+4), - EXTRACT_32BITS(obj_tptr + 8))); + EXTRACT_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_32BITS(obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; break; @@ -909,7 +909,7 @@ rsvp_obj_print(netdissect_options *ndo, indent, tok2str(rsvp_resstyle_values, "Unknown", - EXTRACT_24BITS(obj_tptr+1)), + EXTRACT_BE_24BITS(obj_tptr + 1)), *(obj_tptr))); obj_tlen-=4; obj_tptr+=4; @@ -927,7 +927,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_16BITS(obj_tptr + 6))); + EXTRACT_BE_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; @@ -937,7 +937,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u", indent, ip6addr_string(ndo, obj_tptr), - EXTRACT_16BITS(obj_tptr + 18))); + EXTRACT_BE_16BITS(obj_tptr + 18))); obj_tlen-=20; obj_tptr+=20; break; @@ -948,10 +948,10 @@ rsvp_obj_print(netdissect_options *ndo, "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x", indent, ip6addr_string(ndo, obj_tptr), - EXTRACT_16BITS(obj_tptr+18), + EXTRACT_BE_16BITS(obj_tptr + 18), indent, ip6addr_string(ndo, obj_tptr+20), - EXTRACT_16BITS(obj_tptr + 38))); + EXTRACT_BE_16BITS(obj_tptr + 38))); obj_tlen-=40; obj_tptr+=40; break; @@ -961,7 +961,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_16BITS(obj_tptr + 6))); + EXTRACT_BE_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; @@ -972,10 +972,10 @@ rsvp_obj_print(netdissect_options *ndo, "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_16BITS(obj_tptr+6), + EXTRACT_BE_16BITS(obj_tptr + 6), indent, ipaddr_string(ndo, obj_tptr+8), - EXTRACT_16BITS(obj_tptr + 12))); + EXTRACT_BE_16BITS(obj_tptr + 12))); obj_tlen-=16; obj_tptr+=16; break; @@ -992,7 +992,7 @@ rsvp_obj_print(netdissect_options *ndo, indent, tok2str(ethertype_values, "Unknown Protocol (0x%04x)", - EXTRACT_16BITS(obj_tptr + 2)))); + EXTRACT_BE_16BITS(obj_tptr + 2)))); obj_tlen-=4; obj_tptr+=4; } @@ -1004,16 +1004,16 @@ rsvp_obj_print(netdissect_options *ndo, indent, tok2str(ethertype_values, "Unknown Protocol (0x%04x)", - EXTRACT_16BITS(obj_tptr + 2)))); + EXTRACT_BE_16BITS(obj_tptr + 2)))); ND_PRINT((ndo, ",%s merge capability",((*(obj_tptr + 4)) & 0x80) ? "no" : "" )); ND_PRINT((ndo, "%s Minimum VPI/VCI: %u/%u", indent, - (EXTRACT_16BITS(obj_tptr+4))&0xfff, - (EXTRACT_16BITS(obj_tptr + 6)) & 0xfff)); + (EXTRACT_BE_16BITS(obj_tptr + 4))&0xfff, + (EXTRACT_BE_16BITS(obj_tptr + 6)) & 0xfff)); ND_PRINT((ndo, "%s Maximum VPI/VCI: %u/%u", indent, - (EXTRACT_16BITS(obj_tptr+8))&0xfff, - (EXTRACT_16BITS(obj_tptr + 10)) & 0xfff)); + (EXTRACT_BE_16BITS(obj_tptr + 8))&0xfff, + (EXTRACT_BE_16BITS(obj_tptr + 10)) & 0xfff)); obj_tlen-=12; obj_tptr+=12; break; @@ -1024,13 +1024,13 @@ rsvp_obj_print(netdissect_options *ndo, indent, tok2str(ethertype_values, "Unknown Protocol (0x%04x)", - EXTRACT_16BITS(obj_tptr + 2)))); + EXTRACT_BE_16BITS(obj_tptr + 2)))); ND_PRINT((ndo, "%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI", indent, - (EXTRACT_32BITS(obj_tptr+4))&0x7fffff, - (EXTRACT_32BITS(obj_tptr+8))&0x7fffff, - (((EXTRACT_16BITS(obj_tptr+4)>>7)&3) == 0 ) ? "10" : "", - (((EXTRACT_16BITS(obj_tptr + 4) >> 7) & 3) == 2 ) ? "23" : "")); + (EXTRACT_BE_32BITS(obj_tptr + 4))&0x7fffff, + (EXTRACT_BE_32BITS(obj_tptr + 8))&0x7fffff, + (((EXTRACT_BE_16BITS(obj_tptr + 4)>>7)&3) == 0 ) ? "10" : "", + (((EXTRACT_BE_16BITS(obj_tptr + 4) >> 7) & 3) == 2 ) ? "23" : "")); obj_tlen-=12; obj_tptr+=12; break; @@ -1051,8 +1051,8 @@ rsvp_obj_print(netdissect_options *ndo, *(obj_tptr+1), tok2str(gmpls_payload_values, "Unknown", - EXTRACT_16BITS(obj_tptr+2)), - EXTRACT_16BITS(obj_tptr + 2))); + EXTRACT_BE_16BITS(obj_tptr + 2)), + EXTRACT_BE_16BITS(obj_tptr + 2))); obj_tlen-=4; obj_tptr+=4; break; @@ -1120,7 +1120,7 @@ rsvp_obj_print(netdissect_options *ndo, "Unknown", *(obj_tptr+3) + 256*RSVP_OBJ_RRO), *(obj_tptr+3), - EXTRACT_32BITS(obj_tptr + 4))); + EXTRACT_BE_32BITS(obj_tptr + 4))); } obj_tlen-=*(obj_tptr+1); obj_tptr+=*(obj_tptr+1); @@ -1139,8 +1139,8 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT((ndo, "%s Source Instance: 0x%08x, Destination Instance: 0x%08x", indent, - EXTRACT_32BITS(obj_tptr), - EXTRACT_32BITS(obj_tptr + 4))); + EXTRACT_BE_32BITS(obj_tptr), + EXTRACT_BE_32BITS(obj_tptr + 4))); obj_tlen-=8; obj_tptr+=8; break; @@ -1156,8 +1156,8 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT((ndo, "%s Restart Time: %ums, Recovery Time: %ums", indent, - EXTRACT_32BITS(obj_tptr), - EXTRACT_32BITS(obj_tptr + 4))); + EXTRACT_BE_32BITS(obj_tptr), + EXTRACT_BE_32BITS(obj_tptr + 4))); obj_tlen-=8; obj_tptr+=8; break; @@ -1216,9 +1216,9 @@ rsvp_obj_print(netdissect_options *ndo, */ if (total_subobj_len < 4) goto invalid; - subobj_len = EXTRACT_16BITS(obj_tptr); - subobj_type = (EXTRACT_16BITS(obj_tptr+2))>>8; - af = (EXTRACT_16BITS(obj_tptr+2))&0x00FF; + subobj_len = EXTRACT_BE_16BITS(obj_tptr); + subobj_type = (EXTRACT_BE_16BITS(obj_tptr + 2))>>8; + af = (EXTRACT_BE_16BITS(obj_tptr + 2))&0x00FF; ND_PRINT((ndo, "%s Subobject Type: %s (%u), AF: %s (%u), length: %u", indent, @@ -1276,10 +1276,10 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s U-bit: %x, Label type: %u, Logical port id: %u, Label: %u", indent, - ((EXTRACT_32BITS(obj_tptr+4))>>31), - ((EXTRACT_32BITS(obj_tptr+4))&0xFF), - EXTRACT_32BITS(obj_tptr+8), - EXTRACT_32BITS(obj_tptr + 12))); + ((EXTRACT_BE_32BITS(obj_tptr + 4))>>31), + ((EXTRACT_BE_32BITS(obj_tptr + 4))&0xFF), + EXTRACT_BE_32BITS(obj_tptr + 8), + EXTRACT_BE_32BITS(obj_tptr + 12))); break; case RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL: @@ -1288,7 +1288,7 @@ rsvp_obj_print(netdissect_options *ndo, } ND_PRINT((ndo, "%s Service level: %u", - indent, (EXTRACT_32BITS(obj_tptr + 4)) >> 24)); + indent, (EXTRACT_BE_32BITS(obj_tptr + 4)) >> 24)); break; default: @@ -1320,7 +1320,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_32BITS(obj_tptr + 4))); + EXTRACT_BE_32BITS(obj_tptr + 4))); obj_tlen-=8; obj_tptr+=8; if (obj_tlen) @@ -1333,7 +1333,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x", indent, ip6addr_string(ndo, obj_tptr), - EXTRACT_32BITS(obj_tptr + 16))); + EXTRACT_BE_32BITS(obj_tptr + 16))); obj_tlen-=20; obj_tptr+=20; hexdump=TRUE; /* unless we have a TLV parser lets just hexdump */ @@ -1350,7 +1350,7 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT((ndo, "%s Refresh Period: %ums", indent, - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr))); obj_tlen-=4; obj_tptr+=4; break; @@ -1370,12 +1370,12 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s Msg-Version: %u, length: %u", indent, (*obj_tptr & 0xf0) >> 4, - EXTRACT_16BITS(obj_tptr + 2) << 2)); + EXTRACT_BE_16BITS(obj_tptr + 2) << 2)); obj_tptr+=4; /* get to the start of the service header */ obj_tlen-=4; while (obj_tlen >= 4) { - intserv_serv_tlen=EXTRACT_16BITS(obj_tptr+2)<<2; + intserv_serv_tlen=EXTRACT_BE_16BITS(obj_tptr + 2)<<2; ND_PRINT((ndo, "%s Service Type: %s (%u), break bit %s set, Service length: %u", indent, tok2str(rsvp_intserv_service_type_values,"unknown",*(obj_tptr)), @@ -1409,7 +1409,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_16BITS(obj_tptr + 6))); + EXTRACT_BE_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; @@ -1419,7 +1419,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u", indent, ip6addr_string(ndo, obj_tptr), - EXTRACT_16BITS(obj_tptr + 18))); + EXTRACT_BE_16BITS(obj_tptr + 18))); obj_tlen-=20; obj_tptr+=20; break; @@ -1429,7 +1429,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s Source Address: %s, Flow Label: %u", indent, ip6addr_string(ndo, obj_tptr), - EXTRACT_24BITS(obj_tptr + 17))); + EXTRACT_BE_24BITS(obj_tptr + 17))); obj_tlen-=20; obj_tptr+=20; break; @@ -1439,7 +1439,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s Source Address: %s, LSP-ID: 0x%04x", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_16BITS(obj_tptr + 18))); + EXTRACT_BE_16BITS(obj_tptr + 18))); obj_tlen-=20; obj_tptr+=20; break; @@ -1450,10 +1450,10 @@ rsvp_obj_print(netdissect_options *ndo, "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x", indent, ip6addr_string(ndo, obj_tptr), - EXTRACT_16BITS(obj_tptr+18), + EXTRACT_BE_16BITS(obj_tptr + 18), indent, ip6addr_string(ndo, obj_tptr+20), - EXTRACT_16BITS(obj_tptr + 38))); + EXTRACT_BE_16BITS(obj_tptr + 38))); obj_tlen-=40; obj_tptr+=40; break; @@ -1463,7 +1463,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s Source Address: %s, LSP-ID: 0x%04x", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_16BITS(obj_tptr + 6))); + EXTRACT_BE_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; @@ -1474,10 +1474,10 @@ rsvp_obj_print(netdissect_options *ndo, "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_16BITS(obj_tptr+6), + EXTRACT_BE_16BITS(obj_tptr + 6), indent, ipaddr_string(ndo, obj_tptr+8), - EXTRACT_16BITS(obj_tptr + 12))); + EXTRACT_BE_16BITS(obj_tptr + 12))); obj_tlen-=16; obj_tptr+=16; break; @@ -1494,7 +1494,7 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_1: /* new style */ if (obj_tlen < sizeof(struct rsvp_obj_frr_t)) return-1; - bw.i = EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->bandwidth); + bw.i = EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->bandwidth); ND_PRINT((ndo, "%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps", indent, (int)obj_ptr.rsvp_obj_frr->setup_prio, @@ -1503,9 +1503,9 @@ rsvp_obj_print(netdissect_options *ndo, bw.f * 8 / 1000000)); ND_PRINT((ndo, "%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x", indent, - EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->include_any), - EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->exclude_any), - EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->include_all))); + EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->include_any), + EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->exclude_any), + EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->include_all))); obj_tlen-=sizeof(struct rsvp_obj_frr_t); obj_tptr+=sizeof(struct rsvp_obj_frr_t); break; @@ -1513,7 +1513,7 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_TUNNEL_IPV4: /* old style */ if (obj_tlen < 16) return-1; - bw.i = EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->bandwidth); + bw.i = EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->bandwidth); ND_PRINT((ndo, "%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps", indent, (int)obj_ptr.rsvp_obj_frr->setup_prio, @@ -1522,8 +1522,8 @@ rsvp_obj_print(netdissect_options *ndo, bw.f * 8 / 1000000)); ND_PRINT((ndo, "%s Include Colors: 0x%08x, Exclude Colors: 0x%08x", indent, - EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->include_any), - EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->exclude_any))); + EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->include_any), + EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->exclude_any))); obj_tlen-=16; obj_tptr+=16; break; @@ -1556,7 +1556,7 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_1: ND_PRINT((ndo, "%s CT: %u", indent, - EXTRACT_32BITS(obj_tptr) & 0x7)); + EXTRACT_BE_32BITS(obj_tptr) & 0x7)); obj_tlen-=4; obj_tptr+=4; break; @@ -1572,7 +1572,7 @@ rsvp_obj_print(netdissect_options *ndo, if (obj_tlen < 8) return-1; error_code=*(obj_tptr+5); - error_value=EXTRACT_16BITS(obj_tptr+6); + error_value=EXTRACT_BE_16BITS(obj_tptr + 6); ND_PRINT((ndo, "%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)", indent, ipaddr_string(ndo, obj_tptr), @@ -1604,7 +1604,7 @@ rsvp_obj_print(netdissect_options *ndo, if (obj_tlen < 20) return-1; error_code=*(obj_tptr+17); - error_value=EXTRACT_16BITS(obj_tptr+18); + error_value=EXTRACT_BE_16BITS(obj_tptr + 18); ND_PRINT((ndo, "%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)", indent, ip6addr_string(ndo, obj_tptr), @@ -1635,10 +1635,10 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; - padbytes = EXTRACT_16BITS(obj_tptr+2); + padbytes = EXTRACT_BE_16BITS(obj_tptr + 2); ND_PRINT((ndo, "%s TLV count: %u, padding bytes: %u", indent, - EXTRACT_16BITS(obj_tptr), + EXTRACT_BE_16BITS(obj_tptr), padbytes)); obj_tlen-=4; obj_tptr+=4; @@ -1674,15 +1674,15 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s Flags [0x%02x], epoch: %u", indent, *obj_tptr, - EXTRACT_24BITS(obj_tptr + 1))); + EXTRACT_BE_24BITS(obj_tptr + 1))); obj_tlen-=4; obj_tptr+=4; /* loop through as long there are no messages left */ while(obj_tlen >= 4) { ND_PRINT((ndo, "%s Message-ID 0x%08x (%u)", indent, - EXTRACT_32BITS(obj_tptr), - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr), + EXTRACT_BE_32BITS(obj_tptr))); obj_tlen-=4; obj_tptr+=4; } @@ -1700,19 +1700,19 @@ rsvp_obj_print(netdissect_options *ndo, obj_ptr.rsvp_obj_integrity = (const struct rsvp_obj_integrity_t *)obj_tptr; ND_PRINT((ndo, "%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]", indent, - EXTRACT_16BITS(obj_ptr.rsvp_obj_integrity->key_id), - EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->key_id+2), - EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->sequence), - EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->sequence+4), + EXTRACT_BE_16BITS(obj_ptr.rsvp_obj_integrity->key_id), + EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->key_id + 2), + EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->sequence), + EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->sequence + 4), bittok2str(rsvp_obj_integrity_flag_values, "none", obj_ptr.rsvp_obj_integrity->flags))); ND_PRINT((ndo, "%s MD5-sum 0x%08x%08x%08x%08x ", indent, - EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest), - EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest+4), - EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest+8), - EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest + 12))); + EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->digest), + EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->digest + 4), + EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->digest + 8), + EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->digest + 12))); sigcheck = signature_verify(ndo, pptr, plen, obj_ptr.rsvp_obj_integrity->digest, @@ -1735,7 +1735,7 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT((ndo, "%s Flags [%s]", indent, bittok2str(rsvp_obj_admin_status_flag_values, "none", - EXTRACT_32BITS(obj_tptr)))); + EXTRACT_BE_32BITS(obj_tptr)))); obj_tlen-=4; obj_tptr+=4; break; @@ -1749,11 +1749,11 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; - action = (EXTRACT_16BITS(obj_tptr)>>8); + action = (EXTRACT_BE_16BITS(obj_tptr)>>8); ND_PRINT((ndo, "%s Action: %s (%u), Label type: %u", indent, tok2str(rsvp_obj_label_set_action_values, "Unknown", action), - action, ((EXTRACT_32BITS(obj_tptr) & 0x7F)))); + action, ((EXTRACT_BE_32BITS(obj_tptr) & 0x7F)))); switch (action) { case LABEL_SET_INCLUSIVE_RANGE: @@ -1763,8 +1763,8 @@ rsvp_obj_print(netdissect_options *ndo, if (obj_tlen < 12) return -1; ND_PRINT((ndo, "%s Start range: %u, End range: %u", indent, - EXTRACT_32BITS(obj_tptr+4), - EXTRACT_32BITS(obj_tptr + 8))); + EXTRACT_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_32BITS(obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; break; @@ -1775,7 +1775,7 @@ rsvp_obj_print(netdissect_options *ndo, subchannel = 1; while(obj_tlen >= 4 ) { ND_PRINT((ndo, "%s Subchannel #%u: %u", indent, subchannel, - EXTRACT_32BITS(obj_tptr))); + EXTRACT_BE_32BITS(obj_tptr))); obj_tptr+=4; obj_tlen-=4; subchannel++; @@ -1878,7 +1878,7 @@ rsvp_print(netdissect_options *ndo, /* ok they seem to want to know everything - lets fully decode it */ - plen = tlen = EXTRACT_16BITS(rsvp_com_header->length); + plen = tlen = EXTRACT_BE_16BITS(rsvp_com_header->length); ND_PRINT((ndo, "\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x", RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags), @@ -1887,7 +1887,7 @@ rsvp_print(netdissect_options *ndo, bittok2str(rsvp_header_flag_values,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header->version_flags)), tlen, rsvp_com_header->ttl, - EXTRACT_16BITS(rsvp_com_header->checksum))); + EXTRACT_BE_16BITS(rsvp_com_header->checksum))); if (tlen < sizeof(struct rsvp_common_header)) { ND_PRINT((ndo, "ERROR: common header too short %u < %lu", tlen, @@ -1924,7 +1924,7 @@ rsvp_print(netdissect_options *ndo, return; } - subplen = subtlen = EXTRACT_16BITS(rsvp_com_header->length); + subplen = subtlen = EXTRACT_BE_16BITS(rsvp_com_header->length); ND_PRINT((ndo, "\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x", RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags), @@ -1933,7 +1933,7 @@ rsvp_print(netdissect_options *ndo, bittok2str(rsvp_header_flag_values,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header->version_flags)), subtlen, rsvp_com_header->ttl, - EXTRACT_16BITS(rsvp_com_header->checksum))); + EXTRACT_BE_16BITS(rsvp_com_header->checksum))); if (subtlen < sizeof(struct rsvp_common_header)) { ND_PRINT((ndo, "ERROR: common header too short %u < %lu", subtlen, diff --git a/print-rt6.c b/print-rt6.c index 78a6a57b..146a84b2 100644 --- a/print-rt6.c +++ b/print-rt6.c @@ -62,9 +62,9 @@ rt6_print(netdissect_options *ndo, register const u_char *bp, const u_char *bp2 dp0 = (const struct ip6_rthdr0 *)dp; ND_TCHECK(dp0->ip6r0_reserved); - if (EXTRACT_32BITS(dp0->ip6r0_reserved) || ndo->ndo_vflag) { + if (EXTRACT_BE_32BITS(dp0->ip6r0_reserved) || ndo->ndo_vflag) { ND_PRINT((ndo, ", rsv=0x%0x", - EXTRACT_32BITS(&dp0->ip6r0_reserved))); + EXTRACT_BE_32BITS(&dp0->ip6r0_reserved))); } if (len % 2 == 1) @@ -544,17 +544,17 @@ rx_print(netdissect_options *ndo, if (ndo->ndo_vflag > 1) ND_PRINT((ndo, " cid %08x call# %d", - (int) EXTRACT_32BITS(&rxh->cid), - (int) EXTRACT_32BITS(&rxh->callNumber))); + (int) EXTRACT_BE_32BITS(&rxh->cid), + (int) EXTRACT_BE_32BITS(&rxh->callNumber))); ND_PRINT((ndo, " seq %d ser %d", - (int) EXTRACT_32BITS(&rxh->seq), - (int) EXTRACT_32BITS(&rxh->serial))); + (int) EXTRACT_BE_32BITS(&rxh->seq), + (int) EXTRACT_BE_32BITS(&rxh->serial))); if (ndo->ndo_vflag > 2) ND_PRINT((ndo, " secindex %d serviceid %hu", (int) rxh->securityIndex, - EXTRACT_16BITS(&rxh->serviceId))); + EXTRACT_BE_16BITS(&rxh->serviceId))); if (ndo->ndo_vflag > 1) for (i = 0; i < NUM_RX_FLAGS; i++) { @@ -582,7 +582,7 @@ rx_print(netdissect_options *ndo, */ if (rxh->type == RX_PACKET_TYPE_DATA && - EXTRACT_32BITS(&rxh->seq) == 1 && + EXTRACT_BE_32BITS(&rxh->seq) == 1 && rxh->flags & RX_CLIENT_INITIATED) { /* @@ -626,7 +626,7 @@ rx_print(netdissect_options *ndo, */ } else if (((rxh->type == RX_PACKET_TYPE_DATA && - EXTRACT_32BITS(&rxh->seq) == 1) || + EXTRACT_BE_32BITS(&rxh->seq) == 1) || rxh->type == RX_PACKET_TYPE_ABORT) && (rxh->flags & RX_CLIENT_INITIATED) == 0 && rx_cache_find(rxh, (const struct ip *) bp2, @@ -690,12 +690,12 @@ rx_cache_insert(netdissect_options *ndo, if (++rx_cache_next >= RX_CACHE_SIZE) rx_cache_next = 0; - rxent->callnum = EXTRACT_32BITS(&rxh->callNumber); + rxent->callnum = EXTRACT_BE_32BITS(&rxh->callNumber); UNALIGNED_MEMCPY(&rxent->client, &ip->ip_src, sizeof(uint32_t)); UNALIGNED_MEMCPY(&rxent->server, &ip->ip_dst, sizeof(uint32_t)); rxent->dport = dport; - rxent->serviceId = EXTRACT_32BITS(&rxh->serviceId); - rxent->opcode = EXTRACT_32BITS(bp + sizeof(struct rx_header)); + rxent->serviceId = EXTRACT_BE_32BITS(&rxh->serviceId); + rxent->opcode = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); } /* @@ -722,10 +722,10 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport, i = rx_cache_hint; do { rxent = &rx_cache[i]; - if (rxent->callnum == EXTRACT_32BITS(&rxh->callNumber) && + if (rxent->callnum == EXTRACT_BE_32BITS(&rxh->callNumber) && rxent->client.s_addr == clip && rxent->server.s_addr == sip && - rxent->serviceId == EXTRACT_32BITS(&rxh->serviceId) && + rxent->serviceId == EXTRACT_BE_32BITS(&rxh->serviceId) && rxent->dport == sport) { /* We got a match! */ @@ -748,18 +748,18 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport, #define FIDOUT() { unsigned long n1, n2, n3; \ ND_TCHECK2(bp[0], sizeof(int32_t) * 3); \ - n1 = EXTRACT_32BITS(bp); \ + n1 = EXTRACT_BE_32BITS(bp); \ bp += sizeof(int32_t); \ - n2 = EXTRACT_32BITS(bp); \ + n2 = EXTRACT_BE_32BITS(bp); \ bp += sizeof(int32_t); \ - n3 = EXTRACT_32BITS(bp); \ + n3 = EXTRACT_BE_32BITS(bp); \ bp += sizeof(int32_t); \ ND_PRINT((ndo, " fid %d/%d/%d", (int) n1, (int) n2, (int) n3)); \ } #define STROUT(MAX) { unsigned int _i; \ ND_TCHECK2(bp[0], sizeof(int32_t)); \ - _i = EXTRACT_32BITS(bp); \ + _i = EXTRACT_BE_32BITS(bp); \ if (_i > (MAX)) \ goto trunc; \ bp += sizeof(int32_t); \ @@ -772,28 +772,28 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport, #define INTOUT() { int _i; \ ND_TCHECK2(bp[0], sizeof(int32_t)); \ - _i = (int) EXTRACT_32BITS(bp); \ + _i = (int) EXTRACT_BE_32BITS(bp); \ bp += sizeof(int32_t); \ ND_PRINT((ndo, " %d", _i)); \ } #define UINTOUT() { unsigned long _i; \ ND_TCHECK2(bp[0], sizeof(int32_t)); \ - _i = EXTRACT_32BITS(bp); \ + _i = EXTRACT_BE_32BITS(bp); \ bp += sizeof(int32_t); \ ND_PRINT((ndo, " %lu", _i)); \ } #define UINT64OUT() { uint64_t _i; \ ND_TCHECK2(bp[0], sizeof(uint64_t)); \ - _i = EXTRACT_64BITS(bp); \ + _i = EXTRACT_BE_64BITS(bp); \ bp += sizeof(uint64_t); \ ND_PRINT((ndo, " %" PRIu64, _i)); \ } #define DATEOUT() { time_t _t; struct tm *tm; char str[256]; \ ND_TCHECK2(bp[0], sizeof(int32_t)); \ - _t = (time_t) EXTRACT_32BITS(bp); \ + _t = (time_t) EXTRACT_BE_32BITS(bp); \ bp += sizeof(int32_t); \ tm = localtime(&_t); \ strftime(str, 256, "%Y/%m/%d %H:%M:%S", tm); \ @@ -802,17 +802,17 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport, #define STOREATTROUT() { unsigned long mask, _i; \ ND_TCHECK2(bp[0], (sizeof(int32_t)*6)); \ - mask = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \ + mask = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); \ if (mask) ND_PRINT((ndo, " StoreStatus")); \ if (mask & 1) { ND_PRINT((ndo, " date")); DATEOUT(); } \ else bp += sizeof(int32_t); \ - _i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \ + _i = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); \ if (mask & 2) ND_PRINT((ndo, " owner %lu", _i)); \ - _i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \ + _i = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); \ if (mask & 4) ND_PRINT((ndo, " group %lu", _i)); \ - _i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \ + _i = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); \ if (mask & 8) ND_PRINT((ndo, " mode %lo", _i & 07777)); \ - _i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \ + _i = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); \ if (mask & 16) ND_PRINT((ndo, " segsize %lu", _i)); \ /* undocumented in 3.3 docu */ \ if (mask & 1024) ND_PRINT((ndo, " fsync")); \ @@ -820,26 +820,26 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport, #define UBIK_VERSIONOUT() {int32_t epoch; int32_t counter; \ ND_TCHECK2(bp[0], sizeof(int32_t) * 2); \ - epoch = EXTRACT_32BITS(bp); \ + epoch = EXTRACT_BE_32BITS(bp); \ bp += sizeof(int32_t); \ - counter = EXTRACT_32BITS(bp); \ + counter = EXTRACT_BE_32BITS(bp); \ bp += sizeof(int32_t); \ ND_PRINT((ndo, " %d.%d", epoch, counter)); \ } #define AFSUUIDOUT() {uint32_t temp; int _i; \ ND_TCHECK2(bp[0], 11*sizeof(uint32_t)); \ - temp = EXTRACT_32BITS(bp); \ + temp = EXTRACT_BE_32BITS(bp); \ bp += sizeof(uint32_t); \ ND_PRINT((ndo, " %08x", temp)); \ - temp = EXTRACT_32BITS(bp); \ + temp = EXTRACT_BE_32BITS(bp); \ bp += sizeof(uint32_t); \ ND_PRINT((ndo, "%04x", temp)); \ - temp = EXTRACT_32BITS(bp); \ + temp = EXTRACT_BE_32BITS(bp); \ bp += sizeof(uint32_t); \ ND_PRINT((ndo, "%04x", temp)); \ for (_i = 0; _i < 8; _i++) { \ - temp = EXTRACT_32BITS(bp); \ + temp = EXTRACT_BE_32BITS(bp); \ bp += sizeof(uint32_t); \ ND_PRINT((ndo, "%02x", (unsigned char) temp)); \ } \ @@ -857,7 +857,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport, ND_TCHECK2(bp[0], (MAX) * sizeof(int32_t)); \ sp = s; \ for (k = 0; k < (MAX); k++) { \ - *sp++ = (u_char) EXTRACT_32BITS(bp); \ + *sp++ = (u_char) EXTRACT_BE_32BITS(bp); \ bp += sizeof(int32_t); \ } \ s[(MAX)] = '\0'; \ @@ -868,11 +868,11 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport, #define DESTSERVEROUT() { unsigned long n1, n2, n3; \ ND_TCHECK2(bp[0], sizeof(int32_t) * 3); \ - n1 = EXTRACT_32BITS(bp); \ + n1 = EXTRACT_BE_32BITS(bp); \ bp += sizeof(int32_t); \ - n2 = EXTRACT_32BITS(bp); \ + n2 = EXTRACT_BE_32BITS(bp); \ bp += sizeof(int32_t); \ - n3 = EXTRACT_32BITS(bp); \ + n3 = EXTRACT_BE_32BITS(bp); \ bp += sizeof(int32_t); \ ND_PRINT((ndo, " server %d:%d:%d", (int) n1, (int) n2, (int) n3)); \ } @@ -900,7 +900,7 @@ fs_print(netdissect_options *ndo, * gleaned from fsint/afsint.xg */ - fs_op = EXTRACT_32BITS(bp + sizeof(struct rx_header)); + fs_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " fs call %s", tok2str(fs_req, "op#%d", fs_op))); @@ -952,7 +952,7 @@ fs_print(netdissect_options *ndo, char a[AFSOPAQUEMAX+1]; FIDOUT(); ND_TCHECK2(bp[0], 4); - i = EXTRACT_32BITS(bp); + i = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); ND_TCHECK2(bp[0], i); i = min(AFSOPAQUEMAX, i); @@ -1009,7 +1009,7 @@ fs_print(netdissect_options *ndo, { unsigned long j; ND_TCHECK2(bp[0], 4); - j = EXTRACT_32BITS(bp); + j = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); for (i = 0; i < j; i++) { @@ -1085,7 +1085,7 @@ fs_reply_print(netdissect_options *ndo, { char a[AFSOPAQUEMAX+1]; ND_TCHECK2(bp[0], 4); - i = EXTRACT_32BITS(bp); + i = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); ND_TCHECK2(bp[0], i); i = min(AFSOPAQUEMAX, i); @@ -1114,7 +1114,7 @@ fs_reply_print(netdissect_options *ndo, * Otherwise, just print out the return code */ ND_TCHECK2(bp[0], sizeof(int32_t)); - i = (int) EXTRACT_32BITS(bp); + i = (int) EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); ND_PRINT((ndo, " error %s", tok2str(afs_fs_errors, "#%d", i))); @@ -1234,7 +1234,7 @@ cb_print(netdissect_options *ndo, * gleaned from fsint/afscbint.xg */ - cb_op = EXTRACT_32BITS(bp + sizeof(struct rx_header)); + cb_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " cb call %s", tok2str(cb_req, "op#%d", cb_op))); @@ -1250,7 +1250,7 @@ cb_print(netdissect_options *ndo, { unsigned long j, t; ND_TCHECK2(bp[0], 4); - j = EXTRACT_32BITS(bp); + j = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); for (i = 0; i < j; i++) { @@ -1263,7 +1263,7 @@ cb_print(netdissect_options *ndo, ND_PRINT((ndo, " <none!>")); ND_TCHECK_32BITS(bp); - j = EXTRACT_32BITS(bp); + j = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); if (j != 0) @@ -1275,7 +1275,7 @@ cb_print(netdissect_options *ndo, ND_PRINT((ndo, " expires")); DATEOUT(); ND_TCHECK2(bp[0], 4); - t = EXTRACT_32BITS(bp); + t = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); tok2str(cb_types, "type %d", t); } @@ -1368,7 +1368,7 @@ prot_print(netdissect_options *ndo, * gleaned from ptserver/ptint.xg */ - pt_op = EXTRACT_32BITS(bp + sizeof(struct rx_header)); + pt_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " pt")); @@ -1421,7 +1421,7 @@ prot_print(netdissect_options *ndo, { unsigned long j; ND_TCHECK2(bp[0], 4); - j = EXTRACT_32BITS(bp); + j = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); /* @@ -1443,7 +1443,7 @@ prot_print(netdissect_options *ndo, unsigned long j; ND_PRINT((ndo, " ids:")); ND_TCHECK2(bp[0], 4); - i = EXTRACT_32BITS(bp); + i = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); for (j = 0; j < i; j++) INTOUT(); @@ -1533,7 +1533,7 @@ prot_reply_print(netdissect_options *ndo, unsigned long j; ND_PRINT((ndo, " ids:")); ND_TCHECK2(bp[0], 4); - i = EXTRACT_32BITS(bp); + i = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); for (j = 0; j < i; j++) INTOUT(); @@ -1545,7 +1545,7 @@ prot_reply_print(netdissect_options *ndo, { unsigned long j; ND_TCHECK2(bp[0], 4); - j = EXTRACT_32BITS(bp); + j = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); /* @@ -1570,7 +1570,7 @@ prot_reply_print(netdissect_options *ndo, { unsigned long j; ND_TCHECK2(bp[0], 4); - j = EXTRACT_32BITS(bp); + j = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); for (i = 0; i < j; i++) { INTOUT(); @@ -1625,7 +1625,7 @@ vldb_print(netdissect_options *ndo, * gleaned from vlserver/vldbint.xg */ - vldb_op = EXTRACT_32BITS(bp + sizeof(struct rx_header)); + vldb_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " vldb")); @@ -1655,7 +1655,7 @@ vldb_print(netdissect_options *ndo, ND_PRINT((ndo, " volid")); INTOUT(); ND_TCHECK2(bp[0], sizeof(int32_t)); - i = EXTRACT_32BITS(bp); + i = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); if (i <= 2) ND_PRINT((ndo, " type %s", voltype[i])); @@ -1675,7 +1675,7 @@ vldb_print(netdissect_options *ndo, ND_PRINT((ndo, " volid")); INTOUT(); ND_TCHECK2(bp[0], sizeof(int32_t)); - i = EXTRACT_32BITS(bp); + i = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); if (i <= 2) ND_PRINT((ndo, " type %s", voltype[i])); @@ -1748,7 +1748,7 @@ vldb_reply_print(netdissect_options *ndo, bp += sizeof(int32_t); ND_PRINT((ndo, " numservers")); ND_TCHECK2(bp[0], sizeof(int32_t)); - nservers = EXTRACT_32BITS(bp); + nservers = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); ND_PRINT((ndo, " %lu", nservers)); ND_PRINT((ndo, " servers")); @@ -1762,7 +1762,7 @@ vldb_reply_print(netdissect_options *ndo, ND_PRINT((ndo, " partitions")); for (i = 0; i < 8; i++) { ND_TCHECK2(bp[0], sizeof(int32_t)); - j = EXTRACT_32BITS(bp); + j = EXTRACT_BE_32BITS(bp); if (i < nservers && j <= 26) ND_PRINT((ndo, " %c", 'a' + (int)j)); else if (i < nservers) @@ -1795,7 +1795,7 @@ vldb_reply_print(netdissect_options *ndo, VECOUT(VLNAMEMAX); ND_PRINT((ndo, " numservers")); ND_TCHECK2(bp[0], sizeof(int32_t)); - nservers = EXTRACT_32BITS(bp); + nservers = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); ND_PRINT((ndo, " %lu", nservers)); ND_PRINT((ndo, " servers")); @@ -1809,7 +1809,7 @@ vldb_reply_print(netdissect_options *ndo, ND_PRINT((ndo, " partitions")); for (i = 0; i < 13; i++) { ND_TCHECK2(bp[0], sizeof(int32_t)); - j = EXTRACT_32BITS(bp); + j = EXTRACT_BE_32BITS(bp); if (i < nservers && j <= 26) ND_PRINT((ndo, " %c", 'a' + (int)j)); else if (i < nservers) @@ -1832,7 +1832,7 @@ vldb_reply_print(netdissect_options *ndo, VECOUT(VLNAMEMAX); ND_PRINT((ndo, " numservers")); ND_TCHECK2(bp[0], sizeof(int32_t)); - nservers = EXTRACT_32BITS(bp); + nservers = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); ND_PRINT((ndo, " %lu", nservers)); ND_PRINT((ndo, " servers")); @@ -1850,7 +1850,7 @@ vldb_reply_print(netdissect_options *ndo, ND_PRINT((ndo, " partitions")); for (i = 0; i < 13; i++) { ND_TCHECK2(bp[0], sizeof(int32_t)); - j = EXTRACT_32BITS(bp); + j = EXTRACT_BE_32BITS(bp); if (i < nservers && j <= 26) ND_PRINT((ndo, " %c", 'a' + (int)j)); else if (i < nservers) @@ -1906,7 +1906,7 @@ kauth_print(netdissect_options *ndo, * gleaned from kauth/kauth.rg */ - kauth_op = EXTRACT_32BITS(bp + sizeof(struct rx_header)); + kauth_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " kauth")); @@ -1948,7 +1948,7 @@ kauth_print(netdissect_options *ndo, ND_PRINT((ndo, " domain")); STROUT(KANAMEMAX); ND_TCHECK2(bp[0], sizeof(int32_t)); - i = (int) EXTRACT_32BITS(bp); + i = (int) EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); ND_TCHECK2(bp[0], i); bp += i; @@ -2052,7 +2052,7 @@ vol_print(netdissect_options *ndo, * gleaned from volser/volint.xg */ - vol_op = EXTRACT_32BITS(bp + sizeof(struct rx_header)); + vol_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " vol call %s", tok2str(vol_req, "op#%d", vol_op))); @@ -2204,7 +2204,7 @@ vol_print(netdissect_options *ndo, { unsigned long i, j; ND_TCHECK2(bp[0], 4); - j = EXTRACT_32BITS(bp); + j = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); for (i = 0; i < j; i++) { DESTSERVEROUT(); @@ -2332,7 +2332,7 @@ vol_reply_print(netdissect_options *ndo, { unsigned long i, j; ND_TCHECK2(bp[0], 4); - j = EXTRACT_32BITS(bp); + j = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); for (i = 0; i < j; i++) { ND_PRINT((ndo, " name")); @@ -2389,7 +2389,7 @@ bos_print(netdissect_options *ndo, * gleaned from bozo/bosint.xg */ - bos_op = EXTRACT_32BITS(bp + sizeof(struct rx_header)); + bos_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " bos call %s", tok2str(bos_req, "op#%d", bos_op))); @@ -2538,7 +2538,7 @@ ubik_print(netdissect_options *ndo, * for (sizeof(rx_header) + 4) bytes, so long as it remains this way * the line below will not over-read. */ - ubik_op = EXTRACT_32BITS(bp + sizeof(struct rx_header)); + ubik_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " ubik call %s", tok2str(ubik_req, "op#%d", ubik_op))); @@ -2551,7 +2551,7 @@ ubik_print(netdissect_options *ndo, switch (ubik_op) { case 10000: /* Beacon */ ND_TCHECK2(bp[0], 4); - temp = EXTRACT_32BITS(bp); + temp = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); ND_PRINT((ndo, " syncsite %s", temp ? "yes" : "no")); ND_PRINT((ndo, " votestart")); @@ -2583,7 +2583,7 @@ ubik_print(netdissect_options *ndo, ND_PRINT((ndo, " length")); INTOUT(); ND_TCHECK_32BITS(bp); - temp = EXTRACT_32BITS(bp); + temp = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); tok2str(ubik_lock_types, "type %d", temp); break; @@ -2733,12 +2733,12 @@ rx_ack_print(netdissect_options *ndo, if (ndo->ndo_vflag > 2) ND_PRINT((ndo, " bufspace %d maxskew %d", - (int) EXTRACT_16BITS(&rxa->bufferSpace), - (int) EXTRACT_16BITS(&rxa->maxSkew))); + (int) EXTRACT_BE_16BITS(&rxa->bufferSpace), + (int) EXTRACT_BE_16BITS(&rxa->maxSkew))); - firstPacket = EXTRACT_32BITS(&rxa->firstPacket); + firstPacket = EXTRACT_BE_32BITS(&rxa->firstPacket); ND_PRINT((ndo, " first %d serial %d reason %s", - firstPacket, EXTRACT_32BITS(&rxa->serial), + firstPacket, EXTRACT_BE_32BITS(&rxa->serial), tok2str(rx_ack_reasons, "#%d", (int) rxa->reason))); /* diff --git a/print-sctp.c b/print-sctp.c index 91f10c1e..529faff5 100644 --- a/print-sctp.c +++ b/print-sctp.c @@ -516,8 +516,8 @@ sctp_print(netdissect_options *ndo, ND_TCHECK(*sctpPktHdr); sctpPacketLengthRemaining = sctpPacketLength; - sourcePort = EXTRACT_16BITS(&sctpPktHdr->source); - destPort = EXTRACT_16BITS(&sctpPktHdr->destination); + sourcePort = EXTRACT_BE_16BITS(&sctpPktHdr->source); + destPort = EXTRACT_BE_16BITS(&sctpPktHdr->destination); ip = (const struct ip *)bp2; if (IP_V(ip) == 6) @@ -570,7 +570,7 @@ sctp_print(netdissect_options *ndo, break; } ND_TCHECK(*chunkDescPtr); - chunkLength = EXTRACT_16BITS(&chunkDescPtr->chunkLength); + chunkLength = EXTRACT_BE_16BITS(&chunkDescPtr->chunkLength); if (chunkLength < sizeof(*chunkDescPtr)) { ND_PRINT((ndo, "%s%d) [Bad chunk length %u, < size of chunk descriptor]", sep, chunkCount+1, chunkLength)); break; @@ -631,10 +631,10 @@ sctp_print(netdissect_options *ndo, } dataHdrPtr=(const struct sctpDataPart*)bp; - ppid = EXTRACT_32BITS(&dataHdrPtr->payloadtype); - ND_PRINT((ndo, "[TSN: %u] ", EXTRACT_32BITS(&dataHdrPtr->TSN))); - ND_PRINT((ndo, "[SID: %u] ", EXTRACT_16BITS(&dataHdrPtr->streamId))); - ND_PRINT((ndo, "[SSEQ %u] ", EXTRACT_16BITS(&dataHdrPtr->sequence))); + ppid = EXTRACT_BE_32BITS(&dataHdrPtr->payloadtype); + ND_PRINT((ndo, "[TSN: %u] ", EXTRACT_BE_32BITS(&dataHdrPtr->TSN))); + ND_PRINT((ndo, "[SID: %u] ", EXTRACT_BE_16BITS(&dataHdrPtr->streamId))); + ND_PRINT((ndo, "[SSEQ %u] ", EXTRACT_BE_16BITS(&dataHdrPtr->sequence))); ND_PRINT((ndo, "[PPID %s] ", tok2str(PayloadProto_idents, "0x%x", ppid))); @@ -685,11 +685,11 @@ sctp_print(netdissect_options *ndo, return; } init=(const struct sctpInitiation*)bp; - ND_PRINT((ndo, "[init tag: %u] ", EXTRACT_32BITS(&init->initTag))); - ND_PRINT((ndo, "[rwnd: %u] ", EXTRACT_32BITS(&init->rcvWindowCredit))); - ND_PRINT((ndo, "[OS: %u] ", EXTRACT_16BITS(&init->NumPreopenStreams))); - ND_PRINT((ndo, "[MIS: %u] ", EXTRACT_16BITS(&init->MaxInboundStreams))); - ND_PRINT((ndo, "[init TSN: %u] ", EXTRACT_32BITS(&init->initialTSN))); + ND_PRINT((ndo, "[init tag: %u] ", EXTRACT_BE_32BITS(&init->initTag))); + ND_PRINT((ndo, "[rwnd: %u] ", EXTRACT_BE_32BITS(&init->rcvWindowCredit))); + ND_PRINT((ndo, "[OS: %u] ", EXTRACT_BE_16BITS(&init->NumPreopenStreams))); + ND_PRINT((ndo, "[MIS: %u] ", EXTRACT_BE_16BITS(&init->MaxInboundStreams))); + ND_PRINT((ndo, "[init TSN: %u] ", EXTRACT_BE_32BITS(&init->initialTSN))); bp += sizeof(*init); sctpPacketLengthRemaining -= sizeof(*init); chunkLengthRemaining -= sizeof(*init); @@ -713,11 +713,11 @@ sctp_print(netdissect_options *ndo, return; } init=(const struct sctpInitiation*)bp; - ND_PRINT((ndo, "[init tag: %u] ", EXTRACT_32BITS(&init->initTag))); - ND_PRINT((ndo, "[rwnd: %u] ", EXTRACT_32BITS(&init->rcvWindowCredit))); - ND_PRINT((ndo, "[OS: %u] ", EXTRACT_16BITS(&init->NumPreopenStreams))); - ND_PRINT((ndo, "[MIS: %u] ", EXTRACT_16BITS(&init->MaxInboundStreams))); - ND_PRINT((ndo, "[init TSN: %u] ", EXTRACT_32BITS(&init->initialTSN))); + ND_PRINT((ndo, "[init tag: %u] ", EXTRACT_BE_32BITS(&init->initTag))); + ND_PRINT((ndo, "[rwnd: %u] ", EXTRACT_BE_32BITS(&init->rcvWindowCredit))); + ND_PRINT((ndo, "[OS: %u] ", EXTRACT_BE_16BITS(&init->NumPreopenStreams))); + ND_PRINT((ndo, "[MIS: %u] ", EXTRACT_BE_16BITS(&init->MaxInboundStreams))); + ND_PRINT((ndo, "[init TSN: %u] ", EXTRACT_BE_32BITS(&init->initialTSN))); bp += sizeof(*init); sctpPacketLengthRemaining -= sizeof(*init); chunkLengthRemaining -= sizeof(*init); @@ -744,10 +744,10 @@ sctp_print(netdissect_options *ndo, return; } sack=(const struct sctpSelectiveAck*)bp; - ND_PRINT((ndo, "[cum ack %u] ", EXTRACT_32BITS(&sack->highestConseqTSN))); - ND_PRINT((ndo, "[a_rwnd %u] ", EXTRACT_32BITS(&sack->updatedRwnd))); - ND_PRINT((ndo, "[#gap acks %u] ", EXTRACT_16BITS(&sack->numberOfdesc))); - ND_PRINT((ndo, "[#dup tsns %u] ", EXTRACT_16BITS(&sack->numDupTsns))); + ND_PRINT((ndo, "[cum ack %u] ", EXTRACT_BE_32BITS(&sack->highestConseqTSN))); + ND_PRINT((ndo, "[a_rwnd %u] ", EXTRACT_BE_32BITS(&sack->updatedRwnd))); + ND_PRINT((ndo, "[#gap acks %u] ", EXTRACT_BE_16BITS(&sack->numberOfdesc))); + ND_PRINT((ndo, "[#dup tsns %u] ", EXTRACT_BE_16BITS(&sack->numDupTsns))); bp += sizeof(*sack); sctpPacketLengthRemaining -= sizeof(*sack); chunkLengthRemaining -= sizeof(*sack); @@ -755,7 +755,7 @@ sctp_print(netdissect_options *ndo, /* print gaps */ for (fragNo=0; - chunkLengthRemaining != 0 && fragNo < EXTRACT_16BITS(&sack->numberOfdesc); + chunkLengthRemaining != 0 && fragNo < EXTRACT_BE_16BITS(&sack->numberOfdesc); bp += sizeof(*frag), sctpPacketLengthRemaining -= sizeof(*frag), chunkLengthRemaining -= sizeof(*frag), fragNo++) { if (chunkLengthRemaining < sizeof(*frag)) { ND_PRINT((ndo, "bogus chunk length %u]", chunkLength)); @@ -764,13 +764,13 @@ sctp_print(netdissect_options *ndo, frag = (const struct sctpSelectiveFrag *)bp; ND_PRINT((ndo, "\n\t\t[gap ack block #%d: start = %u, end = %u] ", fragNo+1, - EXTRACT_32BITS(&sack->highestConseqTSN) + EXTRACT_16BITS(&frag->fragmentStart), - EXTRACT_32BITS(&sack->highestConseqTSN) + EXTRACT_16BITS(&frag->fragmentEnd))); + EXTRACT_BE_32BITS(&sack->highestConseqTSN) + EXTRACT_BE_16BITS(&frag->fragmentStart), + EXTRACT_BE_32BITS(&sack->highestConseqTSN) + EXTRACT_BE_16BITS(&frag->fragmentEnd))); } /* print duplicate TSNs */ for (tsnNo=0; - chunkLengthRemaining != 0 && tsnNo<EXTRACT_16BITS(&sack->numDupTsns); + chunkLengthRemaining != 0 && tsnNo<EXTRACT_BE_16BITS(&sack->numDupTsns); bp += 4, sctpPacketLengthRemaining -= 4, chunkLengthRemaining -= 4, tsnNo++) { if (chunkLengthRemaining < 4) { ND_PRINT((ndo, "bogus chunk length %u]", chunkLength)); @@ -778,7 +778,7 @@ sctp_print(netdissect_options *ndo, } dupTSN = (const u_char *)bp; ND_PRINT((ndo, "\n\t\t[dup TSN #%u: %u] ", tsnNo+1, - EXTRACT_32BITS(dupTSN))); + EXTRACT_BE_32BITS(dupTSN))); } break; } diff --git a/print-sflow.c b/print-sflow.c index dc64e63e..d86db5f4 100644 --- a/print-sflow.c +++ b/print-sflow.c @@ -308,36 +308,36 @@ print_sflow_counter_generic(netdissect_options *ndo, sflow_gen_counter = (const struct sflow_generic_counter_t *)pointer; ND_TCHECK(*sflow_gen_counter); ND_PRINT((ndo, "\n\t ifindex %u, iftype %u, ifspeed %" PRIu64 ", ifdirection %u (%s)", - EXTRACT_32BITS(sflow_gen_counter->ifindex), - EXTRACT_32BITS(sflow_gen_counter->iftype), - EXTRACT_64BITS(sflow_gen_counter->ifspeed), - EXTRACT_32BITS(sflow_gen_counter->ifdirection), + EXTRACT_BE_32BITS(sflow_gen_counter->ifindex), + EXTRACT_BE_32BITS(sflow_gen_counter->iftype), + EXTRACT_BE_64BITS(sflow_gen_counter->ifspeed), + EXTRACT_BE_32BITS(sflow_gen_counter->ifdirection), tok2str(sflow_iface_direction_values, "Unknown", - EXTRACT_32BITS(sflow_gen_counter->ifdirection)))); + EXTRACT_BE_32BITS(sflow_gen_counter->ifdirection)))); ND_PRINT((ndo, "\n\t ifstatus %u, adminstatus: %s, operstatus: %s", - EXTRACT_32BITS(sflow_gen_counter->ifstatus), - EXTRACT_32BITS(sflow_gen_counter->ifstatus)&1 ? "up" : "down", - (EXTRACT_32BITS(sflow_gen_counter->ifstatus)>>1)&1 ? "up" : "down")); + EXTRACT_BE_32BITS(sflow_gen_counter->ifstatus), + EXTRACT_BE_32BITS(sflow_gen_counter->ifstatus)&1 ? "up" : "down", + (EXTRACT_BE_32BITS(sflow_gen_counter->ifstatus)>>1)&1 ? "up" : "down")); ND_PRINT((ndo, "\n\t In octets %" PRIu64 ", unicast pkts %u, multicast pkts %u, broadcast pkts %u, discards %u", - EXTRACT_64BITS(sflow_gen_counter->ifinoctets), - EXTRACT_32BITS(sflow_gen_counter->ifinunicastpkts), - EXTRACT_32BITS(sflow_gen_counter->ifinmulticastpkts), - EXTRACT_32BITS(sflow_gen_counter->ifinbroadcastpkts), - EXTRACT_32BITS(sflow_gen_counter->ifindiscards))); + EXTRACT_BE_64BITS(sflow_gen_counter->ifinoctets), + EXTRACT_BE_32BITS(sflow_gen_counter->ifinunicastpkts), + EXTRACT_BE_32BITS(sflow_gen_counter->ifinmulticastpkts), + EXTRACT_BE_32BITS(sflow_gen_counter->ifinbroadcastpkts), + EXTRACT_BE_32BITS(sflow_gen_counter->ifindiscards))); ND_PRINT((ndo, "\n\t In errors %u, unknown protos %u", - EXTRACT_32BITS(sflow_gen_counter->ifinerrors), - EXTRACT_32BITS(sflow_gen_counter->ifinunkownprotos))); + EXTRACT_BE_32BITS(sflow_gen_counter->ifinerrors), + EXTRACT_BE_32BITS(sflow_gen_counter->ifinunkownprotos))); ND_PRINT((ndo, "\n\t Out octets %" PRIu64 ", unicast pkts %u, multicast pkts %u, broadcast pkts %u, discards %u", - EXTRACT_64BITS(sflow_gen_counter->ifoutoctets), - EXTRACT_32BITS(sflow_gen_counter->ifoutunicastpkts), - EXTRACT_32BITS(sflow_gen_counter->ifoutmulticastpkts), - EXTRACT_32BITS(sflow_gen_counter->ifoutbroadcastpkts), - EXTRACT_32BITS(sflow_gen_counter->ifoutdiscards))); + EXTRACT_BE_64BITS(sflow_gen_counter->ifoutoctets), + EXTRACT_BE_32BITS(sflow_gen_counter->ifoutunicastpkts), + EXTRACT_BE_32BITS(sflow_gen_counter->ifoutmulticastpkts), + EXTRACT_BE_32BITS(sflow_gen_counter->ifoutbroadcastpkts), + EXTRACT_BE_32BITS(sflow_gen_counter->ifoutdiscards))); ND_PRINT((ndo, "\n\t Out errors %u, promisc mode %u", - EXTRACT_32BITS(sflow_gen_counter->ifouterrors), - EXTRACT_32BITS(sflow_gen_counter->ifpromiscmode))); + EXTRACT_BE_32BITS(sflow_gen_counter->ifouterrors), + EXTRACT_BE_32BITS(sflow_gen_counter->ifpromiscmode))); return 0; @@ -357,21 +357,21 @@ print_sflow_counter_ethernet(netdissect_options *ndo, sflow_eth_counter = (const struct sflow_ethernet_counter_t *)pointer; ND_TCHECK(*sflow_eth_counter); ND_PRINT((ndo, "\n\t align errors %u, fcs errors %u, single collision %u, multiple collision %u, test error %u", - EXTRACT_32BITS(sflow_eth_counter->alignerrors), - EXTRACT_32BITS(sflow_eth_counter->fcserrors), - EXTRACT_32BITS(sflow_eth_counter->single_collision_frames), - EXTRACT_32BITS(sflow_eth_counter->multiple_collision_frames), - EXTRACT_32BITS(sflow_eth_counter->test_errors))); + EXTRACT_BE_32BITS(sflow_eth_counter->alignerrors), + EXTRACT_BE_32BITS(sflow_eth_counter->fcserrors), + EXTRACT_BE_32BITS(sflow_eth_counter->single_collision_frames), + EXTRACT_BE_32BITS(sflow_eth_counter->multiple_collision_frames), + EXTRACT_BE_32BITS(sflow_eth_counter->test_errors))); ND_PRINT((ndo, "\n\t deferred %u, late collision %u, excessive collision %u, mac trans error %u", - EXTRACT_32BITS(sflow_eth_counter->deferred_transmissions), - EXTRACT_32BITS(sflow_eth_counter->late_collisions), - EXTRACT_32BITS(sflow_eth_counter->excessive_collisions), - EXTRACT_32BITS(sflow_eth_counter->mac_transmit_errors))); + EXTRACT_BE_32BITS(sflow_eth_counter->deferred_transmissions), + EXTRACT_BE_32BITS(sflow_eth_counter->late_collisions), + EXTRACT_BE_32BITS(sflow_eth_counter->excessive_collisions), + EXTRACT_BE_32BITS(sflow_eth_counter->mac_transmit_errors))); ND_PRINT((ndo, "\n\t carrier error %u, frames too long %u, mac receive errors %u, symbol errors %u", - EXTRACT_32BITS(sflow_eth_counter->carrier_sense_errors), - EXTRACT_32BITS(sflow_eth_counter->frame_too_longs), - EXTRACT_32BITS(sflow_eth_counter->mac_receive_errors), - EXTRACT_32BITS(sflow_eth_counter->symbol_errors))); + EXTRACT_BE_32BITS(sflow_eth_counter->carrier_sense_errors), + EXTRACT_BE_32BITS(sflow_eth_counter->frame_too_longs), + EXTRACT_BE_32BITS(sflow_eth_counter->mac_receive_errors), + EXTRACT_BE_32BITS(sflow_eth_counter->symbol_errors))); return 0; @@ -398,27 +398,27 @@ print_sflow_counter_basevg(netdissect_options *ndo, sflow_100basevg_counter = (const struct sflow_100basevg_counter_t *)pointer; ND_TCHECK(*sflow_100basevg_counter); ND_PRINT((ndo, "\n\t in high prio frames %u, in high prio octets %" PRIu64, - EXTRACT_32BITS(sflow_100basevg_counter->in_highpriority_frames), - EXTRACT_64BITS(sflow_100basevg_counter->in_highpriority_octets))); + EXTRACT_BE_32BITS(sflow_100basevg_counter->in_highpriority_frames), + EXTRACT_BE_64BITS(sflow_100basevg_counter->in_highpriority_octets))); ND_PRINT((ndo, "\n\t in norm prio frames %u, in norm prio octets %" PRIu64, - EXTRACT_32BITS(sflow_100basevg_counter->in_normpriority_frames), - EXTRACT_64BITS(sflow_100basevg_counter->in_normpriority_octets))); + EXTRACT_BE_32BITS(sflow_100basevg_counter->in_normpriority_frames), + EXTRACT_BE_64BITS(sflow_100basevg_counter->in_normpriority_octets))); ND_PRINT((ndo, "\n\t in ipm errors %u, oversized %u, in data errors %u, null addressed frames %u", - EXTRACT_32BITS(sflow_100basevg_counter->in_ipmerrors), - EXTRACT_32BITS(sflow_100basevg_counter->in_oversized), - EXTRACT_32BITS(sflow_100basevg_counter->in_data_errors), - EXTRACT_32BITS(sflow_100basevg_counter->in_null_addressed_frames))); + EXTRACT_BE_32BITS(sflow_100basevg_counter->in_ipmerrors), + EXTRACT_BE_32BITS(sflow_100basevg_counter->in_oversized), + EXTRACT_BE_32BITS(sflow_100basevg_counter->in_data_errors), + EXTRACT_BE_32BITS(sflow_100basevg_counter->in_null_addressed_frames))); ND_PRINT((ndo, "\n\t out high prio frames %u, out high prio octets %" PRIu64 ", trans into frames %u", - EXTRACT_32BITS(sflow_100basevg_counter->out_highpriority_frames), - EXTRACT_64BITS(sflow_100basevg_counter->out_highpriority_octets), - EXTRACT_32BITS(sflow_100basevg_counter->transitioninto_frames))); + EXTRACT_BE_32BITS(sflow_100basevg_counter->out_highpriority_frames), + EXTRACT_BE_64BITS(sflow_100basevg_counter->out_highpriority_octets), + EXTRACT_BE_32BITS(sflow_100basevg_counter->transitioninto_frames))); ND_PRINT((ndo, "\n\t in hc high prio octets %" PRIu64 ", in hc norm prio octets %" PRIu64 ", out hc high prio octets %" PRIu64, - EXTRACT_64BITS(sflow_100basevg_counter->hc_in_highpriority_octets), - EXTRACT_64BITS(sflow_100basevg_counter->hc_in_normpriority_octets), - EXTRACT_64BITS(sflow_100basevg_counter->hc_out_highpriority_octets))); + EXTRACT_BE_64BITS(sflow_100basevg_counter->hc_in_highpriority_octets), + EXTRACT_BE_64BITS(sflow_100basevg_counter->hc_in_normpriority_octets), + EXTRACT_BE_64BITS(sflow_100basevg_counter->hc_out_highpriority_octets))); return 0; @@ -439,12 +439,12 @@ print_sflow_counter_vlan(netdissect_options *ndo, ND_TCHECK(*sflow_vlan_counter); ND_PRINT((ndo, "\n\t vlan_id %u, octets %" PRIu64 ", unicast_pkt %u, multicast_pkt %u, broadcast_pkt %u, discards %u", - EXTRACT_32BITS(sflow_vlan_counter->vlan_id), - EXTRACT_64BITS(sflow_vlan_counter->octets), - EXTRACT_32BITS(sflow_vlan_counter->unicast_pkt), - EXTRACT_32BITS(sflow_vlan_counter->multicast_pkt), - EXTRACT_32BITS(sflow_vlan_counter->broadcast_pkt), - EXTRACT_32BITS(sflow_vlan_counter->discards))); + EXTRACT_BE_32BITS(sflow_vlan_counter->vlan_id), + EXTRACT_BE_64BITS(sflow_vlan_counter->octets), + EXTRACT_BE_32BITS(sflow_vlan_counter->unicast_pkt), + EXTRACT_BE_32BITS(sflow_vlan_counter->multicast_pkt), + EXTRACT_BE_32BITS(sflow_vlan_counter->broadcast_pkt), + EXTRACT_BE_32BITS(sflow_vlan_counter->discards))); return 0; @@ -473,11 +473,11 @@ print_sflow_counter_processor(netdissect_options *ndo, ND_TCHECK(*sflow_processor_counter); ND_PRINT((ndo, "\n\t 5sec %u, 1min %u, 5min %u, total_mem %" PRIu64 ", total_mem %" PRIu64, - EXTRACT_32BITS(sflow_processor_counter->five_sec_util), - EXTRACT_32BITS(sflow_processor_counter->one_min_util), - EXTRACT_32BITS(sflow_processor_counter->five_min_util), - EXTRACT_64BITS(sflow_processor_counter->total_memory), - EXTRACT_64BITS(sflow_processor_counter->free_memory))); + EXTRACT_BE_32BITS(sflow_processor_counter->five_sec_util), + EXTRACT_BE_32BITS(sflow_processor_counter->one_min_util), + EXTRACT_BE_32BITS(sflow_processor_counter->five_min_util), + EXTRACT_BE_64BITS(sflow_processor_counter->total_memory), + EXTRACT_BE_64BITS(sflow_processor_counter->free_memory))); return 0; @@ -508,10 +508,10 @@ sflow_print_counter_records(netdissect_options *ndo, sflow_counter_record = (const struct sflow_counter_record_t *)tptr; ND_TCHECK(*sflow_counter_record); - enterprise = EXTRACT_32BITS(sflow_counter_record->format); + enterprise = EXTRACT_BE_32BITS(sflow_counter_record->format); counter_type = enterprise & 0x0FFF; enterprise = enterprise >> 20; - counter_len = EXTRACT_32BITS(sflow_counter_record->length); + counter_len = EXTRACT_BE_32BITS(sflow_counter_record->length); ND_PRINT((ndo, "\n\t enterprise %u, %s (%u) length %u", enterprise, (enterprise == 0) ? tok2str(sflow_counter_type_values,"Unknown",counter_type) : "Unknown", @@ -583,13 +583,13 @@ sflow_print_counter_sample(netdissect_options *ndo, sflow_counter_sample = (const struct sflow_counter_sample_t *)pointer; ND_TCHECK(*sflow_counter_sample); - typesource = EXTRACT_32BITS(sflow_counter_sample->typesource); - nrecords = EXTRACT_32BITS(sflow_counter_sample->records); + typesource = EXTRACT_BE_32BITS(sflow_counter_sample->typesource); + nrecords = EXTRACT_BE_32BITS(sflow_counter_sample->records); type = typesource >> 24; index = typesource & 0x0FFF; ND_PRINT((ndo, " seqnum %u, type %u, idx %u, records %u", - EXTRACT_32BITS(sflow_counter_sample->seqnum), + EXTRACT_BE_32BITS(sflow_counter_sample->seqnum), type, index, nrecords)); @@ -616,12 +616,12 @@ sflow_print_expanded_counter_sample(netdissect_options *ndo, sflow_expanded_counter_sample = (const struct sflow_expanded_counter_sample_t *)pointer; ND_TCHECK(*sflow_expanded_counter_sample); - nrecords = EXTRACT_32BITS(sflow_expanded_counter_sample->records); + nrecords = EXTRACT_BE_32BITS(sflow_expanded_counter_sample->records); ND_PRINT((ndo, " seqnum %u, type %u, idx %u, records %u", - EXTRACT_32BITS(sflow_expanded_counter_sample->seqnum), - EXTRACT_32BITS(sflow_expanded_counter_sample->type), - EXTRACT_32BITS(sflow_expanded_counter_sample->index), + EXTRACT_BE_32BITS(sflow_expanded_counter_sample->seqnum), + EXTRACT_BE_32BITS(sflow_expanded_counter_sample->type), + EXTRACT_BE_32BITS(sflow_expanded_counter_sample->index), nrecords)); return sflow_print_counter_records(ndo, pointer + sizeof(struct sflow_expanded_counter_sample_t), @@ -644,11 +644,11 @@ print_sflow_raw_packet(netdissect_options *ndo, sflow_flow_raw = (const struct sflow_expanded_flow_raw_t *)pointer; ND_TCHECK(*sflow_flow_raw); ND_PRINT((ndo, "\n\t protocol %s (%u), length %u, stripped bytes %u, header_size %u", - tok2str(sflow_flow_raw_protocol_values,"Unknown",EXTRACT_32BITS(sflow_flow_raw->protocol)), - EXTRACT_32BITS(sflow_flow_raw->protocol), - EXTRACT_32BITS(sflow_flow_raw->length), - EXTRACT_32BITS(sflow_flow_raw->stripped_bytes), - EXTRACT_32BITS(sflow_flow_raw->header_size))); + tok2str(sflow_flow_raw_protocol_values,"Unknown",EXTRACT_BE_32BITS(sflow_flow_raw->protocol)), + EXTRACT_BE_32BITS(sflow_flow_raw->protocol), + EXTRACT_BE_32BITS(sflow_flow_raw->length), + EXTRACT_BE_32BITS(sflow_flow_raw->stripped_bytes), + EXTRACT_BE_32BITS(sflow_flow_raw->header_size))); /* QUESTION - should we attempt to print the raw header itself? assuming of course there is wnough data present to do so... */ @@ -672,8 +672,8 @@ print_sflow_ethernet_frame(netdissect_options *ndo, ND_TCHECK(*sflow_ethernet_frame); ND_PRINT((ndo, "\n\t frame len %u, type %u", - EXTRACT_32BITS(sflow_ethernet_frame->length), - EXTRACT_32BITS(sflow_ethernet_frame->type))); + EXTRACT_BE_32BITS(sflow_ethernet_frame->length), + EXTRACT_BE_32BITS(sflow_ethernet_frame->type))); return 0; @@ -693,10 +693,10 @@ print_sflow_extended_switch_data(netdissect_options *ndo, sflow_extended_sw_data = (const struct sflow_extended_switch_data_t *)pointer; ND_TCHECK(*sflow_extended_sw_data); ND_PRINT((ndo, "\n\t src vlan %u, src pri %u, dst vlan %u, dst pri %u", - EXTRACT_32BITS(sflow_extended_sw_data->src_vlan), - EXTRACT_32BITS(sflow_extended_sw_data->src_pri), - EXTRACT_32BITS(sflow_extended_sw_data->dst_vlan), - EXTRACT_32BITS(sflow_extended_sw_data->dst_pri))); + EXTRACT_BE_32BITS(sflow_extended_sw_data->src_vlan), + EXTRACT_BE_32BITS(sflow_extended_sw_data->src_pri), + EXTRACT_BE_32BITS(sflow_extended_sw_data->dst_vlan), + EXTRACT_BE_32BITS(sflow_extended_sw_data->dst_pri))); return 0; @@ -731,10 +731,10 @@ sflow_print_flow_records(netdissect_options *ndo, /* so, the funky encoding means we cannot blythly mask-off bits, we must also check the enterprise. */ - enterprise = EXTRACT_32BITS(sflow_flow_record->format); + enterprise = EXTRACT_BE_32BITS(sflow_flow_record->format); flow_type = enterprise & 0x0FFF; enterprise = enterprise >> 12; - flow_len = EXTRACT_32BITS(sflow_flow_record->length); + flow_len = EXTRACT_BE_32BITS(sflow_flow_record->length); ND_PRINT((ndo, "\n\t enterprise %u %s (%u) length %u", enterprise, (enterprise == 0) ? tok2str(sflow_flow_type_values,"Unknown",flow_type) : "Unknown", @@ -810,20 +810,20 @@ sflow_print_flow_sample(netdissect_options *ndo, sflow_flow_sample = (const struct sflow_flow_sample_t *)pointer; ND_TCHECK(*sflow_flow_sample); - typesource = EXTRACT_32BITS(sflow_flow_sample->typesource); - nrecords = EXTRACT_32BITS(sflow_flow_sample->records); + typesource = EXTRACT_BE_32BITS(sflow_flow_sample->typesource); + nrecords = EXTRACT_BE_32BITS(sflow_flow_sample->records); type = typesource >> 24; index = typesource & 0x0FFF; ND_PRINT((ndo, " seqnum %u, type %u, idx %u, rate %u, pool %u, drops %u, input %u output %u records %u", - EXTRACT_32BITS(sflow_flow_sample->seqnum), + EXTRACT_BE_32BITS(sflow_flow_sample->seqnum), type, index, - EXTRACT_32BITS(sflow_flow_sample->rate), - EXTRACT_32BITS(sflow_flow_sample->pool), - EXTRACT_32BITS(sflow_flow_sample->drops), - EXTRACT_32BITS(sflow_flow_sample->in_interface), - EXTRACT_32BITS(sflow_flow_sample->out_interface), + EXTRACT_BE_32BITS(sflow_flow_sample->rate), + EXTRACT_BE_32BITS(sflow_flow_sample->pool), + EXTRACT_BE_32BITS(sflow_flow_sample->drops), + EXTRACT_BE_32BITS(sflow_flow_sample->in_interface), + EXTRACT_BE_32BITS(sflow_flow_sample->out_interface), nrecords)); return sflow_print_flow_records(ndo, pointer + sizeof(struct sflow_flow_sample_t), @@ -847,16 +847,16 @@ sflow_print_expanded_flow_sample(netdissect_options *ndo, sflow_expanded_flow_sample = (const struct sflow_expanded_flow_sample_t *)pointer; ND_TCHECK(*sflow_expanded_flow_sample); - nrecords = EXTRACT_32BITS(sflow_expanded_flow_sample->records); + nrecords = EXTRACT_BE_32BITS(sflow_expanded_flow_sample->records); ND_PRINT((ndo, " seqnum %u, type %u, idx %u, rate %u, pool %u, drops %u, records %u", - EXTRACT_32BITS(sflow_expanded_flow_sample->seqnum), - EXTRACT_32BITS(sflow_expanded_flow_sample->type), - EXTRACT_32BITS(sflow_expanded_flow_sample->index), - EXTRACT_32BITS(sflow_expanded_flow_sample->rate), - EXTRACT_32BITS(sflow_expanded_flow_sample->pool), - EXTRACT_32BITS(sflow_expanded_flow_sample->drops), - EXTRACT_32BITS(sflow_expanded_flow_sample->records))); + EXTRACT_BE_32BITS(sflow_expanded_flow_sample->seqnum), + EXTRACT_BE_32BITS(sflow_expanded_flow_sample->type), + EXTRACT_BE_32BITS(sflow_expanded_flow_sample->index), + EXTRACT_BE_32BITS(sflow_expanded_flow_sample->rate), + EXTRACT_BE_32BITS(sflow_expanded_flow_sample->pool), + EXTRACT_BE_32BITS(sflow_expanded_flow_sample->drops), + EXTRACT_BE_32BITS(sflow_expanded_flow_sample->records))); return sflow_print_flow_records(ndo, pointer + sizeof(struct sflow_expanded_flow_sample_t), len - sizeof(struct sflow_expanded_flow_sample_t), @@ -886,31 +886,31 @@ sflow_print(netdissect_options *ndo, /* * Sanity checking of the header. */ - if (EXTRACT_32BITS(sflow_datagram->version) != 5) { + if (EXTRACT_BE_32BITS(sflow_datagram->version) != 5) { ND_PRINT((ndo, "sFlow version %u packet not supported", - EXTRACT_32BITS(sflow_datagram->version))); + EXTRACT_BE_32BITS(sflow_datagram->version))); return; } if (ndo->ndo_vflag < 1) { ND_PRINT((ndo, "sFlowv%u, %s agent %s, agent-id %u, length %u", - EXTRACT_32BITS(sflow_datagram->version), - EXTRACT_32BITS(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6", + EXTRACT_BE_32BITS(sflow_datagram->version), + EXTRACT_BE_32BITS(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6", ipaddr_string(ndo, sflow_datagram->agent), - EXTRACT_32BITS(sflow_datagram->agent_id), + EXTRACT_BE_32BITS(sflow_datagram->agent_id), len)); return; } /* ok they seem to want to know everything - lets fully decode it */ - nsamples=EXTRACT_32BITS(sflow_datagram->samples); + nsamples=EXTRACT_BE_32BITS(sflow_datagram->samples); ND_PRINT((ndo, "sFlowv%u, %s agent %s, agent-id %u, seqnum %u, uptime %u, samples %u, length %u", - EXTRACT_32BITS(sflow_datagram->version), - EXTRACT_32BITS(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6", + EXTRACT_BE_32BITS(sflow_datagram->version), + EXTRACT_BE_32BITS(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6", ipaddr_string(ndo, sflow_datagram->agent), - EXTRACT_32BITS(sflow_datagram->agent_id), - EXTRACT_32BITS(sflow_datagram->seqnum), - EXTRACT_32BITS(sflow_datagram->uptime), + EXTRACT_BE_32BITS(sflow_datagram->agent_id), + EXTRACT_BE_32BITS(sflow_datagram->seqnum), + EXTRACT_BE_32BITS(sflow_datagram->uptime), nsamples, len)); @@ -922,8 +922,8 @@ sflow_print(netdissect_options *ndo, sflow_sample = (const struct sflow_sample_header *)tptr; ND_TCHECK(*sflow_sample); - sflow_sample_type = (EXTRACT_32BITS(sflow_sample->format)&0x0FFF); - sflow_sample_len = EXTRACT_32BITS(sflow_sample->len); + sflow_sample_type = (EXTRACT_BE_32BITS(sflow_sample->format)&0x0FFF); + sflow_sample_len = EXTRACT_BE_32BITS(sflow_sample->len); if (tlen < sizeof(struct sflow_sample_header)) goto trunc; @@ -199,7 +199,7 @@ print_sl_change(netdissect_options *ndo, register u_int i; if ((i = *cp++) == 0) { - i = EXTRACT_16BITS(cp); + i = EXTRACT_BE_16BITS(cp); cp += 2; } ND_PRINT((ndo, " %s%d", str, i)); @@ -213,7 +213,7 @@ print_sl_winchange(netdissect_options *ndo, register short i; if ((i = *cp++) == 0) { - i = EXTRACT_16BITS(cp); + i = EXTRACT_BE_16BITS(cp); cp += 2; } if (i >= 0) diff --git a/print-sll.c b/print-sll.c index 6148569e..712c2279 100644 --- a/print-sll.c +++ b/print-sll.c @@ -136,18 +136,18 @@ sll_print(netdissect_options *ndo, register const struct sll_header *sllp, u_int { u_short ether_type; - ND_PRINT((ndo, "%3s ",tok2str(sll_pkttype_values,"?",EXTRACT_16BITS(&sllp->sll_pkttype)))); + ND_PRINT((ndo, "%3s ",tok2str(sll_pkttype_values,"?",EXTRACT_BE_16BITS(&sllp->sll_pkttype)))); /* * XXX - check the link-layer address type value? * For now, we just assume 6 means Ethernet. * XXX - print others as strings of hex? */ - if (EXTRACT_16BITS(&sllp->sll_halen) == 6) + if (EXTRACT_BE_16BITS(&sllp->sll_halen) == 6) ND_PRINT((ndo, "%s ", etheraddr_string(ndo, sllp->sll_addr))); if (!ndo->ndo_qflag) { - ether_type = EXTRACT_16BITS(&sllp->sll_protocol); + ether_type = EXTRACT_BE_16BITS(&sllp->sll_protocol); if (ether_type <= ETHERMTU) { /* @@ -225,7 +225,7 @@ sll_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char p += SLL_HDR_LEN; hdrlen = SLL_HDR_LEN; - ether_type = EXTRACT_16BITS(&sllp->sll_protocol); + ether_type = EXTRACT_BE_16BITS(&sllp->sll_protocol); recurse: /* @@ -279,12 +279,12 @@ recurse: return (hdrlen + length); } if (ndo->ndo_eflag) { - uint16_t tag = EXTRACT_16BITS(p); + uint16_t tag = EXTRACT_BE_16BITS(p); ND_PRINT((ndo, "%s, ", ieee8021q_tci_string(tag))); } - ether_type = EXTRACT_16BITS(p + 2); + ether_type = EXTRACT_BE_16BITS(p + 2); if (ether_type <= ETHERMTU) ether_type = LINUX_SLL_P_802_2; if (!ndo->ndo_qflag) { diff --git a/print-slow.c b/print-slow.c index d1484790..46de14c2 100644 --- a/print-slow.c +++ b/print-slow.c @@ -418,10 +418,10 @@ slow_marker_lacp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t System %s, System Priority %u, Key %u" \ ", Port %u, Port Priority %u\n\t State Flags [%s]", etheraddr_string(ndo, tlv_ptr.lacp_tlv_actor_partner_info->sys), - EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->sys_pri), - EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->key), - EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->port), - EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->port_pri), + EXTRACT_BE_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->sys_pri), + EXTRACT_BE_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->key), + EXTRACT_BE_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->port), + EXTRACT_BE_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->port_pri), bittok2str(lacp_tlv_actor_partner_info_state_values, "none", tlv_ptr.lacp_tlv_actor_partner_info->state))); @@ -439,7 +439,7 @@ slow_marker_lacp_print(netdissect_options *ndo, tlv_ptr.lacp_tlv_collector_info = (const struct lacp_tlv_collector_info_t *)tlv_tptr; ND_PRINT((ndo, "\n\t Max Delay %u", - EXTRACT_16BITS(tlv_ptr.lacp_tlv_collector_info->max_delay))); + EXTRACT_BE_16BITS(tlv_ptr.lacp_tlv_collector_info->max_delay))); break; @@ -455,8 +455,8 @@ slow_marker_lacp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Request System %s, Request Port %u, Request Transaction ID 0x%08x", etheraddr_string(ndo, tlv_ptr.marker_tlv_marker_info->req_sys), - EXTRACT_16BITS(tlv_ptr.marker_tlv_marker_info->req_port), - EXTRACT_32BITS(tlv_ptr.marker_tlv_marker_info->req_trans_id))); + EXTRACT_BE_16BITS(tlv_ptr.marker_tlv_marker_info->req_port), + EXTRACT_BE_32BITS(tlv_ptr.marker_tlv_marker_info->req_trans_id))); break; @@ -526,7 +526,7 @@ slow_oam_print(netdissect_options *ndo, tok2str(slow_oam_code_values, "Unknown (%u)", ptr.slow_oam_common_header->code), bittok2str(slow_oam_flag_values, "none", - EXTRACT_16BITS(&ptr.slow_oam_common_header->flags)))); + EXTRACT_BE_16BITS(&ptr.slow_oam_common_header->flags)))); switch (ptr.slow_oam_common_header->code) { case SLOW_OAM_CODE_INFO: @@ -576,7 +576,7 @@ slow_oam_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t OAM-Version %u, Revision %u", tlv.slow_oam_info->oam_version, - EXTRACT_16BITS(&tlv.slow_oam_info->revision))); + EXTRACT_BE_16BITS(&tlv.slow_oam_info->revision))); ND_PRINT((ndo, "\n\t State-Parser-Action %s, State-MUX-Action %s", tok2str(slow_oam_info_type_state_parser_values, "Reserved", @@ -586,13 +586,13 @@ slow_oam_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t OAM-Config Flags [%s], OAM-PDU-Config max-PDU size %u", bittok2str(slow_oam_info_type_oam_config_values, "none", tlv.slow_oam_info->oam_config), - EXTRACT_16BITS(&tlv.slow_oam_info->oam_pdu_config) & + EXTRACT_BE_16BITS(&tlv.slow_oam_info->oam_pdu_config) & OAM_INFO_TYPE_PDU_SIZE_MASK)); ND_PRINT((ndo, "\n\t OUI %s (0x%06x), Vendor-Private 0x%08x", tok2str(oui_values, "Unknown", - EXTRACT_24BITS(&tlv.slow_oam_info->oui)), - EXTRACT_24BITS(&tlv.slow_oam_info->oui), - EXTRACT_32BITS(&tlv.slow_oam_info->vendor_private))); + EXTRACT_BE_24BITS(&tlv.slow_oam_info->oui)), + EXTRACT_BE_24BITS(&tlv.slow_oam_info->oui), + EXTRACT_BE_32BITS(&tlv.slow_oam_info->vendor_private))); break; case SLOW_OAM_INFO_TYPE_ORG_SPECIFIC: @@ -621,7 +621,7 @@ slow_oam_print(netdissect_options *ndo, if (tlen < 2) goto tooshort; ND_TCHECK2(*tptr, 2); - ND_PRINT((ndo, "\n\t Sequence Number %u", EXTRACT_16BITS(tptr))); + ND_PRINT((ndo, "\n\t Sequence Number %u", EXTRACT_BE_16BITS(tptr))); tlen -= 2; tptr += 2; @@ -677,12 +677,12 @@ slow_oam_print(netdissect_options *ndo, "\n\t Errors %" PRIu64 "\n\t Error Running Total %" PRIu64 "\n\t Event Running Total %u", - EXTRACT_16BITS(&tlv.slow_oam_link_event->time_stamp)*100, - EXTRACT_64BITS(&tlv.slow_oam_link_event->window), - EXTRACT_64BITS(&tlv.slow_oam_link_event->threshold), - EXTRACT_64BITS(&tlv.slow_oam_link_event->errors), - EXTRACT_64BITS(&tlv.slow_oam_link_event->errors_running_total), - EXTRACT_32BITS(&tlv.slow_oam_link_event->event_running_total))); + EXTRACT_BE_16BITS(&tlv.slow_oam_link_event->time_stamp)*100, + EXTRACT_BE_64BITS(&tlv.slow_oam_link_event->window), + EXTRACT_BE_64BITS(&tlv.slow_oam_link_event->threshold), + EXTRACT_BE_64BITS(&tlv.slow_oam_link_event->errors), + EXTRACT_BE_64BITS(&tlv.slow_oam_link_event->errors_running_total), + EXTRACT_BE_32BITS(&tlv.slow_oam_link_event->event_running_total))); break; case SLOW_OAM_LINK_EVENT_ORG_SPECIFIC: diff --git a/print-smb.c b/print-smb.c index 723b9a03..fb46a0e5 100644 --- a/print-smb.c +++ b/print-smb.c @@ -941,7 +941,7 @@ nbt_tcp_print(netdissect_options *ndo, goto trunc; maxbuf = data + caplen; type = data[0]; - nbt_len = EXTRACT_16BITS(data + 2); + nbt_len = EXTRACT_BE_16BITS(data + 2); length -= 4; caplen -= 4; @@ -1107,15 +1107,15 @@ nbt_udp137_print(netdissect_options *ndo, int total, i; ND_TCHECK2(data[10], 2); - name_trn_id = EXTRACT_16BITS(data); + name_trn_id = EXTRACT_BE_16BITS(data); response = (data[2] >> 7); opcode = (data[2] >> 3) & 0xF; nm_flags = ((data[2] & 0x7) << 4) + (data[3] >> 4); rcode = data[3] & 0xF; - qdcount = EXTRACT_16BITS(data + 4); - ancount = EXTRACT_16BITS(data + 6); - nscount = EXTRACT_16BITS(data + 8); - arcount = EXTRACT_16BITS(data + 10); + qdcount = EXTRACT_BE_16BITS(data + 4); + ancount = EXTRACT_BE_16BITS(data + 6); + nscount = EXTRACT_BE_16BITS(data + 8); + arcount = EXTRACT_BE_16BITS(data + 10); startbuf = data; if (maxbuf <= data) @@ -1168,12 +1168,12 @@ nbt_udp137_print(netdissect_options *ndo, if (p == NULL) goto out; ND_TCHECK_16BITS(p); - restype = EXTRACT_16BITS(p); + restype = EXTRACT_BE_16BITS(p); p = smb_fdata(ndo, p, "ResType=[rw]\nResClass=[rw]\nTTL=[rD]\n", p + 8, 0); if (p == NULL) goto out; ND_TCHECK_16BITS(p); - rdlen = EXTRACT_16BITS(p); + rdlen = EXTRACT_BE_16BITS(p); ND_PRINT((ndo, "ResourceLength=%d\nResourceData=\n", rdlen)); p += 2; if (rdlen == 6) { @@ -1250,7 +1250,7 @@ smb_tcp_print(netdissect_options *ndo, if (caplen < 4) goto trunc; maxbuf = data + caplen; - smb_len = EXTRACT_24BITS(data + 1); + smb_len = EXTRACT_BE_24BITS(data + 1); length -= 4; caplen -= 4; diff --git a/print-stp.c b/print-stp.c index ee0627ca..6eb427cc 100644 --- a/print-stp.c +++ b/print-stp.c @@ -109,7 +109,7 @@ stp_print_config_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ND_TCHECK(stp_bpdu->port_id); ND_PRINT((ndo, ", bridge-id %s.%04x, length %u", stp_print_bridge_id((const u_char *)&stp_bpdu->bridge_id), - EXTRACT_16BITS(&stp_bpdu->port_id), length)); + EXTRACT_BE_16BITS(&stp_bpdu->port_id), length)); /* in non-verbose mode just print the bridge-id */ if (!ndo->ndo_vflag) { @@ -119,14 +119,14 @@ stp_print_config_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ND_TCHECK(stp_bpdu->forward_delay); ND_PRINT((ndo, "\n\tmessage-age %.2fs, max-age %.2fs" ", hello-time %.2fs, forwarding-delay %.2fs", - (float)EXTRACT_16BITS(&stp_bpdu->message_age) / STP_TIME_BASE, - (float)EXTRACT_16BITS(&stp_bpdu->max_age) / STP_TIME_BASE, - (float)EXTRACT_16BITS(&stp_bpdu->hello_time) / STP_TIME_BASE, - (float)EXTRACT_16BITS(&stp_bpdu->forward_delay) / STP_TIME_BASE)); + (float) EXTRACT_BE_16BITS(&stp_bpdu->message_age) / STP_TIME_BASE, + (float) EXTRACT_BE_16BITS(&stp_bpdu->max_age) / STP_TIME_BASE, + (float) EXTRACT_BE_16BITS(&stp_bpdu->hello_time) / STP_TIME_BASE, + (float) EXTRACT_BE_16BITS(&stp_bpdu->forward_delay) / STP_TIME_BASE)); ND_PRINT((ndo, "\n\troot-id %s, root-pathcost %u", stp_print_bridge_id((const u_char *)&stp_bpdu->root_id), - EXTRACT_32BITS(&stp_bpdu->root_path_cost))); + EXTRACT_BE_32BITS(&stp_bpdu->root_path_cost))); /* Port role is only valid for 802.1w */ if (stp_bpdu->protocol_version == STP_PROTO_RAPID) { @@ -264,40 +264,40 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ND_TCHECK(stp_bpdu->root_path_cost); ND_PRINT((ndo, "CIST root-id %s, CIST ext-pathcost %u", stp_print_bridge_id((const u_char *)&stp_bpdu->root_id), - EXTRACT_32BITS(&stp_bpdu->root_path_cost))); + EXTRACT_BE_32BITS(&stp_bpdu->root_path_cost))); ND_TCHECK(stp_bpdu->bridge_id); ND_PRINT((ndo, "\n\tCIST regional-root-id %s, ", stp_print_bridge_id((const u_char *)&stp_bpdu->bridge_id))); ND_TCHECK(stp_bpdu->port_id); - ND_PRINT((ndo, "CIST port-id %04x,", EXTRACT_16BITS(&stp_bpdu->port_id))); + ND_PRINT((ndo, "CIST port-id %04x,", EXTRACT_BE_16BITS(&stp_bpdu->port_id))); ND_TCHECK(stp_bpdu->forward_delay); ND_PRINT((ndo, "\n\tmessage-age %.2fs, max-age %.2fs" ", hello-time %.2fs, forwarding-delay %.2fs", - (float)EXTRACT_16BITS(&stp_bpdu->message_age) / STP_TIME_BASE, - (float)EXTRACT_16BITS(&stp_bpdu->max_age) / STP_TIME_BASE, - (float)EXTRACT_16BITS(&stp_bpdu->hello_time) / STP_TIME_BASE, - (float)EXTRACT_16BITS(&stp_bpdu->forward_delay) / STP_TIME_BASE)); + (float) EXTRACT_BE_16BITS(&stp_bpdu->message_age) / STP_TIME_BASE, + (float) EXTRACT_BE_16BITS(&stp_bpdu->max_age) / STP_TIME_BASE, + (float) EXTRACT_BE_16BITS(&stp_bpdu->hello_time) / STP_TIME_BASE, + (float) EXTRACT_BE_16BITS(&stp_bpdu->forward_delay) / STP_TIME_BASE)); ND_TCHECK_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET); - ND_PRINT((ndo, "\n\tv3len %d, ", EXTRACT_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET))); + ND_PRINT((ndo, "\n\tv3len %d, ", EXTRACT_BE_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET))); ND_TCHECK_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12); ND_PRINT((ndo, "MCID Name ")); if (fn_printzp(ndo, ptr + MST_BPDU_CONFIG_NAME_OFFSET, 32, ndo->ndo_snapend)) goto trunc; ND_PRINT((ndo, ", rev %u," "\n\t\tdigest %08x%08x%08x%08x, ", - EXTRACT_16BITS(ptr + MST_BPDU_CONFIG_NAME_OFFSET + 32), - EXTRACT_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET), - EXTRACT_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 4), - EXTRACT_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 8), - EXTRACT_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12))); + EXTRACT_BE_16BITS(ptr + MST_BPDU_CONFIG_NAME_OFFSET + 32), + EXTRACT_BE_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET), + EXTRACT_BE_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 4), + EXTRACT_BE_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 8), + EXTRACT_BE_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12))); ND_TCHECK_32BITS(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET); ND_PRINT((ndo, "CIST int-root-pathcost %u,", - EXTRACT_32BITS(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET))); + EXTRACT_BE_32BITS(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET))); ND_TCHECK_BRIDGE_ID(ptr + MST_BPDU_CIST_BRIDGE_ID_OFFSET); ND_PRINT((ndo, "\n\tCIST bridge-id %s, ", @@ -308,15 +308,14 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, /* Dump all MSTI's */ ND_TCHECK_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET); - v3len = EXTRACT_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET); + v3len = EXTRACT_BE_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET); if (v3len > MST_BPDU_CONFIG_INFO_LENGTH) { len = v3len - MST_BPDU_CONFIG_INFO_LENGTH; offset = MST_BPDU_MSTI_OFFSET; while (len >= MST_BPDU_MSTI_LENGTH) { ND_TCHECK2(*(ptr + offset), MST_BPDU_MSTI_LENGTH); - msti = EXTRACT_16BITS(ptr + offset + - MST_BPDU_MSTI_ROOT_PRIO_OFFSET); + msti = EXTRACT_BE_16BITS(ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET); msti = msti & 0x0FFF; ND_PRINT((ndo, "\n\tMSTI %d, Flags [%s], port-role %s", @@ -326,8 +325,7 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ND_PRINT((ndo, "\n\t\tMSTI regional-root-id %s, pathcost %u", stp_print_bridge_id(ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET), - EXTRACT_32BITS(ptr + offset + - MST_BPDU_MSTI_ROOT_PATH_COST_OFFSET))); + EXTRACT_BE_32BITS(ptr + offset + MST_BPDU_MSTI_ROOT_PATH_COST_OFFSET))); ND_PRINT((ndo, "\n\t\tMSTI bridge-prio %d, port-prio %d, hops %d", ptr[offset + MST_BPDU_MSTI_BRIDGE_PRIO_OFFSET] >> 4, ptr[offset + MST_BPDU_MSTI_PORT_PRIO_OFFSET] >> 4, @@ -359,17 +357,17 @@ stp_print_spb_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ptr = (const u_char *)stp_bpdu; ND_TCHECK_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 16); - ND_PRINT((ndo, "\n\tv4len %d, ", EXTRACT_16BITS (ptr + offset))); + ND_PRINT((ndo, "\n\tv4len %d, ", EXTRACT_BE_16BITS(ptr + offset))); ND_PRINT((ndo, "AUXMCID Name ")); if (fn_printzp(ndo, ptr + offset + SPB_BPDU_CONFIG_NAME_OFFSET, 32, ndo->ndo_snapend)) goto trunc; ND_PRINT((ndo, ", Rev %u,\n\t\tdigest %08x%08x%08x%08x", - EXTRACT_16BITS(ptr + offset + SPB_BPDU_CONFIG_REV_OFFSET), - EXTRACT_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET), - EXTRACT_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 4), - EXTRACT_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 8), - EXTRACT_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 12))); + EXTRACT_BE_16BITS(ptr + offset + SPB_BPDU_CONFIG_REV_OFFSET), + EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET), + EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 4), + EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 8), + EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 12))); ND_PRINT((ndo, "\n\tAgreement num %d, Discarded Agreement num %d, Agreement valid-" "flag %d,\n\tRestricted role-flag: %d, Format id %d cap %d, " @@ -383,12 +381,12 @@ stp_print_spb_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ptr[offset + SPB_BPDU_AGREEMENT_FORMAT_OFFSET]&0x00ff, ptr[offset + SPB_BPDU_AGREEMENT_CON_OFFSET]>>4, ptr[offset + SPB_BPDU_AGREEMENT_CON_OFFSET]&0x00ff, - EXTRACT_16BITS(ptr + offset + SPB_BPDU_AGREEMENT_EDGE_OFFSET), - EXTRACT_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET), - EXTRACT_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET+4), - EXTRACT_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET+8), - EXTRACT_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET+12), - EXTRACT_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET+16))); + EXTRACT_BE_16BITS(ptr + offset + SPB_BPDU_AGREEMENT_EDGE_OFFSET), + EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET), + EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 4), + EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 8), + EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 12), + EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 16))); return 1; trunc: @@ -412,7 +410,7 @@ stp_print(netdissect_options *ndo, const u_char *p, u_int length) goto trunc; ND_TCHECK(stp_bpdu->protocol_id); - if (EXTRACT_16BITS(&stp_bpdu->protocol_id)) { + if (EXTRACT_BE_16BITS(&stp_bpdu->protocol_id)) { ND_PRINT((ndo, "unknown STP version, length %u", length)); return; } @@ -465,7 +463,7 @@ stp_print(netdissect_options *ndo, const u_char *p, u_int length) /* Validate v3 length */ ND_TCHECK_16BITS(p + MST_BPDU_VER3_LEN_OFFSET); - mstp_len = EXTRACT_16BITS(p + MST_BPDU_VER3_LEN_OFFSET); + mstp_len = EXTRACT_BE_16BITS(p + MST_BPDU_VER3_LEN_OFFSET); mstp_len += 2; /* length encoding itself is 2 bytes */ if (length < (sizeof(struct stp_bpdu_) + mstp_len)) { goto trunc; @@ -477,7 +475,7 @@ stp_print(netdissect_options *ndo, const u_char *p, u_int length) { /* Validate v4 length */ ND_TCHECK_16BITS(p + MST_BPDU_VER3_LEN_OFFSET + mstp_len); - spb_len = EXTRACT_16BITS (p + MST_BPDU_VER3_LEN_OFFSET + mstp_len); + spb_len = EXTRACT_BE_16BITS(p + MST_BPDU_VER3_LEN_OFFSET + mstp_len); spb_len += 2; if (length < (sizeof(struct stp_bpdu_) + mstp_len + spb_len) || spb_len < SPB_BPDU_MIN_LEN) { diff --git a/print-sunatm.c b/print-sunatm.c index a587e509..4cadcc37 100644 --- a/print-sunatm.c +++ b/print-sunatm.c @@ -96,7 +96,7 @@ sunatm_if_print(netdissect_options *ndo, break; } - vci = EXTRACT_16BITS(&p[VCI_POS]); + vci = EXTRACT_BE_16BITS(&p[VCI_POS]); vpi = p[VPI_POS]; p += PKT_BEGIN_POS; diff --git a/print-sunrpc.c b/print-sunrpc.c index aca3c969..0e7af1b7 100644 --- a/print-sunrpc.c +++ b/print-sunrpc.c @@ -178,11 +178,11 @@ sunrpc_print(netdissect_options *ndo, register const u_char *bp, if (!ndo->ndo_nflag) { snprintf(srcid, sizeof(srcid), "0x%x", - EXTRACT_32BITS(&rp->rm_xid)); + EXTRACT_BE_32BITS(&rp->rm_xid)); strlcpy(dstid, "sunrpc", sizeof(dstid)); } else { snprintf(srcid, sizeof(srcid), "0x%x", - EXTRACT_32BITS(&rp->rm_xid)); + EXTRACT_BE_32BITS(&rp->rm_xid)); snprintf(dstid, sizeof(dstid), "0x%x", SUNRPC_PMAPPORT); } @@ -205,23 +205,23 @@ sunrpc_print(netdissect_options *ndo, register const u_char *bp, } ND_PRINT((ndo, " %s", tok2str(proc2str, " proc #%u", - EXTRACT_32BITS(&rp->rm_call.cb_proc)))); - x = EXTRACT_32BITS(&rp->rm_call.cb_rpcvers); + EXTRACT_BE_32BITS(&rp->rm_call.cb_proc)))); + x = EXTRACT_BE_32BITS(&rp->rm_call.cb_rpcvers); if (x != 2) ND_PRINT((ndo, " [rpcver %u]", x)); - switch (EXTRACT_32BITS(&rp->rm_call.cb_proc)) { + switch (EXTRACT_BE_32BITS(&rp->rm_call.cb_proc)) { case SUNRPC_PMAPPROC_SET: case SUNRPC_PMAPPROC_UNSET: case SUNRPC_PMAPPROC_GETPORT: case SUNRPC_PMAPPROC_CALLIT: - x = EXTRACT_32BITS(&rp->rm_call.cb_prog); + x = EXTRACT_BE_32BITS(&rp->rm_call.cb_prog); if (!ndo->ndo_nflag) ND_PRINT((ndo, " %s", progstr(x))); else ND_PRINT((ndo, " %u", x)); - ND_PRINT((ndo, ".%u", EXTRACT_32BITS(&rp->rm_call.cb_vers))); + ND_PRINT((ndo, ".%u", EXTRACT_BE_32BITS(&rp->rm_call.cb_vers))); break; } } diff --git a/print-symantec.c b/print-symantec.c index 9e9f8f33..595994cd 100644 --- a/print-symantec.c +++ b/print-symantec.c @@ -47,7 +47,7 @@ symantec_hdr_print(netdissect_options *ndo, register const u_char *bp, u_int len sp = (const struct symantec_header *)bp; - etype = EXTRACT_16BITS(&sp->ether_type); + etype = EXTRACT_BE_16BITS(&sp->ether_type); if (!ndo->ndo_qflag) { if (etype <= ETHERMTU) ND_PRINT((ndo, "invalid ethertype %u", etype)); @@ -92,7 +92,7 @@ symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ sp = (const struct symantec_header *)p; p += sizeof (struct symantec_header); - ether_type = EXTRACT_16BITS(&sp->ether_type); + ether_type = EXTRACT_BE_16BITS(&sp->ether_type); if (ether_type <= ETHERMTU) { /* ether_type not known, print raw packet */ diff --git a/print-tcp.c b/print-tcp.c index 8d662a5f..fb7b14a4 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -187,8 +187,8 @@ tcp_print(netdissect_options *ndo, return; } - sport = EXTRACT_16BITS(&tp->th_sport); - dport = EXTRACT_16BITS(&tp->th_dport); + sport = EXTRACT_BE_16BITS(&tp->th_sport); + dport = EXTRACT_BE_16BITS(&tp->th_dport); if (ip6) { if (ip6->ip6_nxt == IPPROTO_TCP) { @@ -224,10 +224,10 @@ tcp_print(netdissect_options *ndo, return; } - seq = EXTRACT_32BITS(&tp->th_seq); - ack = EXTRACT_32BITS(&tp->th_ack); - win = EXTRACT_16BITS(&tp->th_win); - urp = EXTRACT_16BITS(&tp->th_urp); + seq = EXTRACT_BE_32BITS(&tp->th_seq); + ack = EXTRACT_BE_32BITS(&tp->th_ack); + win = EXTRACT_BE_16BITS(&tp->th_win); + urp = EXTRACT_BE_16BITS(&tp->th_urp); if (ndo->ndo_qflag) { ND_PRINT((ndo, "tcp %d", length - hlen)); @@ -372,7 +372,7 @@ tcp_print(netdissect_options *ndo, if (IP_V(ip) == 4) { if (ND_TTEST2(tp->th_sport, length)) { sum = tcp_cksum(ndo, ip, tp, length); - tcp_sum = EXTRACT_16BITS(&tp->th_sum); + tcp_sum = EXTRACT_BE_16BITS(&tp->th_sum); ND_PRINT((ndo, ", cksum 0x%04x", tcp_sum)); if (sum != 0) @@ -384,7 +384,7 @@ tcp_print(netdissect_options *ndo, } else if (IP_V(ip) == 6 && ip6->ip6_plen) { if (ND_TTEST2(tp->th_sport, length)) { sum = tcp6_cksum(ndo, ip6, tp, length); - tcp_sum = EXTRACT_16BITS(&tp->th_sum); + tcp_sum = EXTRACT_BE_16BITS(&tp->th_sum); ND_PRINT((ndo, ", cksum 0x%04x", tcp_sum)); if (sum != 0) @@ -453,7 +453,7 @@ tcp_print(netdissect_options *ndo, case TCPOPT_MAXSEG: datalen = 2; LENCHECK(datalen); - ND_PRINT((ndo, " %u", EXTRACT_16BITS(cp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_16BITS(cp))); break; case TCPOPT_WSCALE: @@ -472,9 +472,9 @@ tcp_print(netdissect_options *ndo, ND_PRINT((ndo, " %d ", datalen / 8)); for (i = 0; i < datalen; i += 8) { LENCHECK(i + 4); - s = EXTRACT_32BITS(cp + i); + s = EXTRACT_BE_32BITS(cp + i); LENCHECK(i + 8); - e = EXTRACT_32BITS(cp + i + 4); + e = EXTRACT_BE_32BITS(cp + i + 4); if (rev) { s -= thseq; e -= thseq; @@ -499,15 +499,15 @@ tcp_print(netdissect_options *ndo, */ datalen = 4; LENCHECK(datalen); - ND_PRINT((ndo, " %u", EXTRACT_32BITS(cp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp))); break; case TCPOPT_TIMESTAMP: datalen = 8; LENCHECK(datalen); ND_PRINT((ndo, " val %u ecr %u", - EXTRACT_32BITS(cp), - EXTRACT_32BITS(cp + 4))); + EXTRACT_BE_32BITS(cp), + EXTRACT_BE_32BITS(cp + 4))); break; case TCPOPT_SIGNATURE: @@ -580,7 +580,7 @@ tcp_print(netdissect_options *ndo, case TCPOPT_UTO: datalen = 2; LENCHECK(datalen); - utoval = EXTRACT_16BITS(cp); + utoval = EXTRACT_BE_16BITS(cp); ND_PRINT((ndo, " 0x%x", utoval)); if (utoval & 0x0001) utoval = (utoval >> 1) * 60; @@ -609,7 +609,7 @@ tcp_print(netdissect_options *ndo, if (datalen < 2) goto bad; /* RFC6994 */ - magic = EXTRACT_16BITS(cp); + magic = EXTRACT_BE_16BITS(cp); ND_PRINT((ndo, "-")); switch(magic) { @@ -742,19 +742,19 @@ tcp_print(netdissect_options *ndo, register const struct sunrpc_msg *rp; enum sunrpc_msg_type direction; - fraglen = EXTRACT_32BITS(bp) & 0x7FFFFFFF; + fraglen = EXTRACT_BE_32BITS(bp) & 0x7FFFFFFF; if (fraglen > (length) - 4) fraglen = (length) - 4; rp = (const struct sunrpc_msg *)(bp + 4); if (ND_TTEST(rp->rm_direction)) { - direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction); + direction = (enum sunrpc_msg_type) EXTRACT_BE_32BITS(&rp->rm_direction); if (dport == NFS_PORT && direction == SUNRPC_CALL) { - ND_PRINT((ndo, ": NFS request xid %u ", EXTRACT_32BITS(&rp->rm_xid))); + ND_PRINT((ndo, ": NFS request xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid))); nfsreq_noaddr_print(ndo, (const u_char *)rp, fraglen, (const u_char *)ip); return; } if (sport == NFS_PORT && direction == SUNRPC_REPLY) { - ND_PRINT((ndo, ": NFS reply xid %u ", EXTRACT_32BITS(&rp->rm_xid))); + ND_PRINT((ndo, ": NFS reply xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid))); nfsreply_noaddr_print(ndo, (const u_char *)rp, fraglen, (const u_char *)ip); return; } @@ -868,14 +868,14 @@ tcp_verify_signature(netdissect_options *ndo, MD5_Update(&ctx, (const char *)&ip->ip_dst, sizeof(ip->ip_dst)); MD5_Update(&ctx, (const char *)&zero_proto, sizeof(zero_proto)); MD5_Update(&ctx, (const char *)&ip->ip_p, sizeof(ip->ip_p)); - tlen = EXTRACT_16BITS(&ip->ip_len) - IP_HL(ip) * 4; + tlen = EXTRACT_BE_16BITS(&ip->ip_len) - IP_HL(ip) * 4; tlen = htons(tlen); MD5_Update(&ctx, (const char *)&tlen, sizeof(tlen)); } else if (IP_V(ip) == 6) { ip6 = (const struct ip6_hdr *)ip; MD5_Update(&ctx, (const char *)&ip6->ip6_src, sizeof(ip6->ip6_src)); MD5_Update(&ctx, (const char *)&ip6->ip6_dst, sizeof(ip6->ip6_dst)); - len32 = htonl(EXTRACT_16BITS(&ip6->ip6_plen)); + len32 = htonl(EXTRACT_BE_16BITS(&ip6->ip6_plen)); MD5_Update(&ctx, (const char *)&len32, sizeof(len32)); nxt = 0; MD5_Update(&ctx, (const char *)&nxt, sizeof(nxt)); diff --git a/print-tftp.c b/print-tftp.c index 6600c9cf..b4d82129 100644 --- a/print-tftp.c +++ b/print-tftp.c @@ -102,7 +102,7 @@ tftp_print(netdissect_options *ndo, if (length < 2) goto trunc; ND_TCHECK_16BITS(bp); - opcode = EXTRACT_16BITS(bp); + opcode = EXTRACT_BE_16BITS(bp); cp = tok2str(op2str, "tftp-#%d", opcode); ND_PRINT((ndo, " %s", cp)); /* Bail if bogus opcode */ @@ -169,7 +169,7 @@ tftp_print(netdissect_options *ndo, if (length < 2) goto trunc; /* no block number */ ND_TCHECK_16BITS(bp); - ND_PRINT((ndo, " block %d", EXTRACT_16BITS(bp))); + ND_PRINT((ndo, " block %d", EXTRACT_BE_16BITS(bp))); break; case TFTP_ERROR: @@ -178,7 +178,7 @@ tftp_print(netdissect_options *ndo, goto trunc; /* no error code */ ND_TCHECK_16BITS(bp); ND_PRINT((ndo, " %s", tok2str(err2str, "tftp-err-#%d \"", - EXTRACT_16BITS(bp)))); + EXTRACT_BE_16BITS(bp)))); bp += 2; length -= 2; /* Print error message string */ diff --git a/print-timed.c b/print-timed.c index 6aa7a821..528cfd45 100644 --- a/print-timed.c +++ b/print-timed.c @@ -123,8 +123,8 @@ timed_print(netdissect_options *ndo, case TSP_SETDATE: case TSP_SETDATEREQ: ND_TCHECK(tsp->tsp_time); - sec = EXTRACT_32BITS(&tsp->tsp_time.tv_sec); - usec = EXTRACT_32BITS(&tsp->tsp_time.tv_usec); + sec = EXTRACT_BE_32BITS(&tsp->tsp_time.tv_sec); + usec = EXTRACT_BE_32BITS(&tsp->tsp_time.tv_usec); /* XXX The comparison below is always false? */ if (usec < 0) /* invalid, skip the rest of the packet */ diff --git a/print-tipc.c b/print-tipc.c index 4d8848fc..889c06c2 100644 --- a/print-tipc.c +++ b/print-tipc.c @@ -173,15 +173,15 @@ print_payload(netdissect_options *ndo, const struct payload_tipc_pkthdr *ap) u_int dest_node; ND_TCHECK(ap->dest_port); - w0 = EXTRACT_32BITS(&ap->w0); + w0 = EXTRACT_BE_32BITS(&ap->w0); user = TIPC_USER(w0); hsize = TIPC_HSIZE(w0); msize = TIPC_MSIZE(w0); - w1 = EXTRACT_32BITS(&ap->w1); + w1 = EXTRACT_BE_32BITS(&ap->w1); mtype = TIPC_MTYPE(w1); - prev_node = EXTRACT_32BITS(&ap->prev_node); - orig_port = EXTRACT_32BITS(&ap->orig_port); - dest_port = EXTRACT_32BITS(&ap->dest_port); + prev_node = EXTRACT_BE_32BITS(&ap->prev_node); + orig_port = EXTRACT_BE_32BITS(&ap->orig_port); + dest_port = EXTRACT_BE_32BITS(&ap->dest_port); if (hsize <= 6) { ND_PRINT((ndo, "TIPC v%u.0 %u.%u.%u:%u > %u, headerlength %u bytes, MessageSize %u bytes, %s, messageType %s", TIPC_VER(w0), @@ -192,8 +192,8 @@ print_payload(netdissect_options *ndo, const struct payload_tipc_pkthdr *ap) tok2str(tipcmtype_values, "Unknown", mtype))); } else { ND_TCHECK(ap->dest_node); - orig_node = EXTRACT_32BITS(&ap->orig_node); - dest_node = EXTRACT_32BITS(&ap->dest_node); + orig_node = EXTRACT_BE_32BITS(&ap->orig_node); + dest_node = EXTRACT_BE_32BITS(&ap->dest_node); ND_PRINT((ndo, "TIPC v%u.0 %u.%u.%u:%u > %u.%u.%u:%u, headerlength %u bytes, MessageSize %u bytes, %s, messageType %s", TIPC_VER(w0), TIPC_ZONE(orig_node), TIPC_CLUSTER(orig_node), TIPC_NODE(orig_node), @@ -206,7 +206,7 @@ print_payload(netdissect_options *ndo, const struct payload_tipc_pkthdr *ap) if (ndo->ndo_vflag) { broadcast_ack = TIPC_BROADCAST_ACK(w1); - w2 = EXTRACT_32BITS(&ap->w2); + w2 = EXTRACT_BE_32BITS(&ap->w2); link_ack = TIPC_LINK_ACK(w2); link_seq = TIPC_LINK_SEQ(w2); ND_PRINT((ndo, "\n\tPrevious Node %u.%u.%u, Broadcast Ack %u, Link Ack %u, Link Sequence %u", @@ -243,14 +243,14 @@ print_internal(netdissect_options *ndo, const struct internal_tipc_pkthdr *ap) u_int link_tol; ND_TCHECK(ap->dest_node); - w0 = EXTRACT_32BITS(&ap->w0); + w0 = EXTRACT_BE_32BITS(&ap->w0); user = TIPC_USER(w0); hsize = TIPC_HSIZE(w0); msize = TIPC_MSIZE(w0); - w1 = EXTRACT_32BITS(&ap->w1); + w1 = EXTRACT_BE_32BITS(&ap->w1); mtype = TIPC_MTYPE(w1); - orig_node = EXTRACT_32BITS(&ap->orig_node); - dest_node = EXTRACT_32BITS(&ap->dest_node); + orig_node = EXTRACT_BE_32BITS(&ap->orig_node); + dest_node = EXTRACT_BE_32BITS(&ap->dest_node); ND_PRINT((ndo, "TIPC v%u.0 %u.%u.%u > %u.%u.%u, headerlength %u bytes, MessageSize %u bytes, %s, messageType %s (0x%08x)", TIPC_VER(w0), TIPC_ZONE(orig_node), TIPC_CLUSTER(orig_node), TIPC_NODE(orig_node), @@ -263,17 +263,17 @@ print_internal(netdissect_options *ndo, const struct internal_tipc_pkthdr *ap) ND_TCHECK(*ap); seq_gap = TIPC_SEQ_GAP(w1); broadcast_ack = TIPC_BROADCAST_ACK(w1); - w2 = EXTRACT_32BITS(&ap->w2); + w2 = EXTRACT_BE_32BITS(&ap->w2); bc_gap_after = TIPC_BC_GAP_AFTER(w2); bc_gap_to = TIPC_BC_GAP_TO(w2); - prev_node = EXTRACT_32BITS(&ap->prev_node); - w4 = EXTRACT_32BITS(&ap->w4); + prev_node = EXTRACT_BE_32BITS(&ap->prev_node); + w4 = EXTRACT_BE_32BITS(&ap->w4); last_sent_frag = TIPC_LAST_SENT_FRAG(w4); next_sent_frag = TIPC_NEXT_SENT_FRAG(w4); - w5 = EXTRACT_32BITS(&ap->w5); + w5 = EXTRACT_BE_32BITS(&ap->w5); sess_no = TIPC_SESS_NO(w5); - trans_seq = EXTRACT_32BITS(&ap->trans_seq); - w9 = EXTRACT_32BITS(&ap->w9); + trans_seq = EXTRACT_BE_32BITS(&ap->trans_seq); + w9 = EXTRACT_BE_32BITS(&ap->w9); msg_cnt = TIPC_MSG_CNT(w9); link_tol = TIPC_LINK_TOL(w9); ND_PRINT((ndo, "\n\tPrevious Node %u.%u.%u, Session No. %u, Broadcast Ack %u, Sequence Gap %u, Broadcast Gap After %u, Broadcast Gap To %u, Last Sent Packet No. %u, Next sent Packet No. %u, Transport Sequence %u, msg_count %u, Link Tolerance %u", @@ -303,14 +303,14 @@ print_link_conf(netdissect_options *ndo, const struct link_conf_tipc_pkthdr *ap) u_int media_id; ND_TCHECK(ap->prev_node); - w0 = EXTRACT_32BITS(&ap->w0); + w0 = EXTRACT_BE_32BITS(&ap->w0); user = TIPC_USER(w0); hsize = TIPC_HSIZE(w0); msize = TIPC_MSIZE(w0); - w1 = EXTRACT_32BITS(&ap->w1); + w1 = EXTRACT_BE_32BITS(&ap->w1); mtype = TIPC_MTYPE(w1); - dest_domain = EXTRACT_32BITS(&ap->dest_domain); - prev_node = EXTRACT_32BITS(&ap->prev_node); + dest_domain = EXTRACT_BE_32BITS(&ap->dest_domain); + prev_node = EXTRACT_BE_32BITS(&ap->prev_node); ND_PRINT((ndo, "TIPC v%u.0 %u.%u.%u > %u.%u.%u, headerlength %u bytes, MessageSize %u bytes, %s, messageType %s", TIPC_VER(w0), @@ -322,8 +322,8 @@ print_link_conf(netdissect_options *ndo, const struct link_conf_tipc_pkthdr *ap) if (ndo->ndo_vflag) { ND_TCHECK(ap->w5); node_sig = TIPC_NODE_SIG(w1); - ntwrk_id = EXTRACT_32BITS(&ap->ntwrk_id); - w5 = EXTRACT_32BITS(&ap->w5); + ntwrk_id = EXTRACT_BE_32BITS(&ap->ntwrk_id); + w5 = EXTRACT_BE_32BITS(&ap->w5); media_id = TIPC_MEDIA_ID(w5); ND_PRINT((ndo, "\n\tNodeSignature %u, network_id %u, media_id %u", node_sig, ntwrk_id, media_id)); @@ -344,7 +344,7 @@ tipc_print(netdissect_options *ndo, const u_char *bp, u_int length _U_, ap = (const struct tipc_pkthdr *)bp; ND_TCHECK(ap->w0); - w0 = EXTRACT_32BITS(&ap->w0); + w0 = EXTRACT_BE_32BITS(&ap->w0); user = TIPC_USER(w0); switch (user) diff --git a/print-token.c b/print-token.c index faffd4b1..af351bf4 100644 --- a/print-token.c +++ b/print-token.c @@ -74,12 +74,12 @@ #define FRAME_TYPE(trp) (((trp)->token_fc & 0xC0) >> 6) #define TOKEN_FC_LLC 1 -#define BROADCAST(trp) ((EXTRACT_16BITS(&(trp)->token_rcf) & 0xE000) >> 13) -#define RIF_LENGTH(trp) ((EXTRACT_16BITS(&(trp)->token_rcf) & 0x1f00) >> 8) -#define DIRECTION(trp) ((EXTRACT_16BITS(&(trp)->token_rcf) & 0x0080) >> 7) -#define LARGEST_FRAME(trp) ((EXTRACT_16BITS(&(trp)->token_rcf) & 0x0070) >> 4) -#define RING_NUMBER(trp, x) ((EXTRACT_16BITS(&(trp)->token_rseg[x]) & 0xfff0) >> 4) -#define BRIDGE_NUMBER(trp, x) ((EXTRACT_16BITS(&(trp)->token_rseg[x]) & 0x000f)) +#define BROADCAST(trp) ((EXTRACT_BE_16BITS(&(trp)->token_rcf) & 0xE000) >> 13) +#define RIF_LENGTH(trp) ((EXTRACT_BE_16BITS(&(trp)->token_rcf) & 0x1f00) >> 8) +#define DIRECTION(trp) ((EXTRACT_BE_16BITS(&(trp)->token_rcf) & 0x0080) >> 7) +#define LARGEST_FRAME(trp) ((EXTRACT_BE_16BITS(&(trp)->token_rcf) & 0x0070) >> 4) +#define RING_NUMBER(trp, x) ((EXTRACT_BE_16BITS(&(trp)->token_rseg[x]) & 0xfff0) >> 4) +#define BRIDGE_NUMBER(trp, x) ((EXTRACT_BE_16BITS(&(trp)->token_rseg[x]) & 0x000f)) #define SEGMENT_COUNT(trp) ((int)((RIF_LENGTH(trp) - 2) / 2)) struct token_header { @@ -193,10 +193,10 @@ token_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen ND_PRINT((ndo, " [%d:%d]", RING_NUMBER(trp, seg), BRIDGE_NUMBER(trp, seg))); } else { - ND_PRINT((ndo, "rt = %x", EXTRACT_16BITS(&trp->token_rcf))); + ND_PRINT((ndo, "rt = %x", EXTRACT_BE_16BITS(&trp->token_rcf))); for (seg = 0; seg < SEGMENT_COUNT(trp); seg++) - ND_PRINT((ndo, ":%x", EXTRACT_16BITS(&trp->token_rseg[seg]))); + ND_PRINT((ndo, ":%x", EXTRACT_BE_16BITS(&trp->token_rseg[seg]))); } ND_PRINT((ndo, " (%s) ", largest_frame[LARGEST_FRAME(trp)])); } else { diff --git a/print-udld.c b/print-udld.c index 02921d0e..9e77b1c7 100644 --- a/print-udld.c +++ b/print-udld.c @@ -123,15 +123,15 @@ udld_print (netdissect_options *ndo, const u_char *pptr, u_int length) return; } - ND_PRINT((ndo, "\n\tChecksum 0x%04x (unverified)", EXTRACT_16BITS(tptr+2))); + ND_PRINT((ndo, "\n\tChecksum 0x%04x (unverified)", EXTRACT_BE_16BITS(tptr + 2))); tptr += UDLD_HEADER_LEN; while (tptr < (pptr+length)) { ND_TCHECK2(*tptr, 4); - type = EXTRACT_16BITS(tptr); - len = EXTRACT_16BITS(tptr+2); + type = EXTRACT_BE_16BITS(tptr); + len = EXTRACT_BE_16BITS(tptr + 2); ND_PRINT((ndo, "\n\t%s (0x%04x) TLV, length %u", tok2str(udld_tlv_values, "Unknown", type), @@ -172,7 +172,7 @@ udld_print (netdissect_options *ndo, const u_char *pptr, u_int length) case UDLD_SEQ_NUMBER_TLV: if (len != 4) goto invalid; - ND_PRINT((ndo, ", %u", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, ", %u", EXTRACT_BE_32BITS(tptr))); break; default: diff --git a/print-udp.c b/print-udp.c index 262917fb..d3af575c 100644 --- a/print-udp.c +++ b/print-udp.c @@ -103,24 +103,24 @@ vat_print(netdissect_options *ndo, const void *hdr, register const struct udphdr u_int ts; ND_TCHECK_16BITS((const u_int *)hdr); - ts = EXTRACT_16BITS(hdr); + ts = EXTRACT_BE_16BITS(hdr); if ((ts & 0xf060) != 0) { /* probably vt */ ND_TCHECK_16BITS(&up->uh_ulen); ND_PRINT((ndo, "udp/vt %u %d / %d", - (uint32_t)(EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up)), + (uint32_t)(EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up)), ts & 0x3ff, ts >> 10)); } else { /* probably vat */ uint32_t i0, i1; ND_TCHECK_32BITS(&((const u_int *)hdr)[0]); - i0 = EXTRACT_32BITS(&((const u_int *)hdr)[0]); + i0 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[0]); ND_TCHECK_32BITS(&((const u_int *)hdr)[1]); - i1 = EXTRACT_32BITS(&((const u_int *)hdr)[1]); + i1 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[1]); ND_TCHECK_16BITS(&up->uh_ulen); ND_PRINT((ndo, "udp/vat %u c%d %u%s", - (uint32_t)(EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up) - 8), + (uint32_t)(EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up) - 8), i0 & 0xffff, i1, i0 & 0x800000? "*" : "")); /* audio format */ @@ -145,11 +145,11 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len, const char * ptype; ND_TCHECK_32BITS(&((const u_int *)hdr)[0]); - i0 = EXTRACT_32BITS(&((const u_int *)hdr)[0]); + i0 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[0]); ND_TCHECK_32BITS(&((const u_int *)hdr)[1]); - i1 = EXTRACT_32BITS(&((const u_int *)hdr)[1]); + i1 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[1]); ND_TCHECK_16BITS(&up->uh_ulen); - dlen = EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up) - 8; + dlen = EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up) - 8; ip += 2; len >>= 2; len -= 2; @@ -181,12 +181,12 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len, i1)); if (ndo->ndo_vflag) { ND_TCHECK_32BITS(&((const u_int *)hdr)[2]); - ND_PRINT((ndo, " %u", EXTRACT_32BITS(&((const u_int *)hdr)[2]))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&((const u_int *)hdr)[2]))); if (hasopt) { u_int i2, optlen; do { ND_TCHECK_32BITS(ip); - i2 = EXTRACT_32BITS(ip); + i2 = EXTRACT_BE_32BITS(ip); optlen = (i2 >> 16) & 0xff; if (optlen == 0 || optlen > len) { ND_PRINT((ndo, " !opt")); @@ -199,7 +199,7 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len, if (hasext) { u_int i2, extlen; ND_TCHECK_32BITS(ip); - i2 = EXTRACT_32BITS(ip); + i2 = EXTRACT_BE_32BITS(ip); extlen = (i2 & 0xffff) + 1; if (extlen > len) { ND_PRINT((ndo, " !ext")); @@ -209,7 +209,7 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len, } ND_TCHECK_32BITS(ip); if (contype == 0x1f) /*XXX H.261 */ - ND_PRINT((ndo, " 0x%04x", EXTRACT_32BITS(ip) >> 16)); + ND_PRINT((ndo, " 0x%04x", EXTRACT_BE_32BITS(ip) >> 16)); } trunc: @@ -230,8 +230,8 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep) if ((const u_char *)(rh + 1) > ep) goto trunc; ND_TCHECK(*rh); - len = (EXTRACT_16BITS(&rh->rh_len) + 1) * 4; - flags = EXTRACT_16BITS(&rh->rh_flags); + len = (EXTRACT_BE_16BITS(&rh->rh_len) + 1) * 4; + flags = EXTRACT_BE_16BITS(&rh->rh_flags); cnt = (flags >> 8) & 0x1f; switch (flags & 0xff) { case RTCP_PT_SR: @@ -240,15 +240,15 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep) if (len != cnt * sizeof(*rr) + sizeof(*sr) + sizeof(*rh)) ND_PRINT((ndo, " [%d]", len)); if (ndo->ndo_vflag) - ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc))); if ((const u_char *)(sr + 1) > ep) goto trunc; ND_TCHECK(*sr); - ts = (double)(EXTRACT_32BITS(&sr->sr_ntp.upper)) + - ((double)(EXTRACT_32BITS(&sr->sr_ntp.lower)) / - 4294967296.0); - ND_PRINT((ndo, " @%.2f %u %up %ub", ts, EXTRACT_32BITS(&sr->sr_ts), - EXTRACT_32BITS(&sr->sr_np), EXTRACT_32BITS(&sr->sr_nb))); + ts = (double)(EXTRACT_BE_32BITS(&sr->sr_ntp.upper)) + + ((double)(EXTRACT_BE_32BITS(&sr->sr_ntp.lower)) / + 4294967296.0); + ND_PRINT((ndo, " @%.2f %u %up %ub", ts, EXTRACT_BE_32BITS(&sr->sr_ts), + EXTRACT_BE_32BITS(&sr->sr_np), EXTRACT_BE_32BITS(&sr->sr_nb))); rr = (const struct rtcp_rr *)(sr + 1); break; case RTCP_PT_RR: @@ -257,18 +257,18 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep) ND_PRINT((ndo, " [%d]", len)); rr = (const struct rtcp_rr *)(rh + 1); if (ndo->ndo_vflag) - ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc))); break; case RTCP_PT_SDES: ND_PRINT((ndo, " sdes %d", len)); if (ndo->ndo_vflag) - ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc))); cnt = 0; break; case RTCP_PT_BYE: ND_PRINT((ndo, " bye %d", len)); if (ndo->ndo_vflag) - ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc))); + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc))); cnt = 0; break; default: @@ -283,13 +283,13 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep) goto trunc; ND_TCHECK(*rr); if (ndo->ndo_vflag) - ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rr->rr_srcid))); - ts = (double)(EXTRACT_32BITS(&rr->rr_lsr)) / 65536.; - dts = (double)(EXTRACT_32BITS(&rr->rr_dlsr)) / 65536.; + ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rr->rr_srcid))); + ts = (double)(EXTRACT_BE_32BITS(&rr->rr_lsr)) / 65536.; + dts = (double)(EXTRACT_BE_32BITS(&rr->rr_dlsr)) / 65536.; ND_PRINT((ndo, " %ul %us %uj @%.2f+%.2f", - EXTRACT_32BITS(&rr->rr_nl) & 0x00ffffff, - EXTRACT_32BITS(&rr->rr_ls), - EXTRACT_32BITS(&rr->rr_dv), ts, dts)); + EXTRACT_BE_32BITS(&rr->rr_nl) & 0x00ffffff, + EXTRACT_BE_32BITS(&rr->rr_ls), + EXTRACT_BE_32BITS(&rr->rr_dv), ts, dts)); } return (hdr + len); @@ -390,8 +390,8 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length, goto trunc; } - sport = EXTRACT_16BITS(&up->uh_sport); - dport = EXTRACT_16BITS(&up->uh_dport); + sport = EXTRACT_BE_16BITS(&up->uh_sport); + dport = EXTRACT_BE_16BITS(&up->uh_dport); if (length < sizeof(struct udphdr)) { udpipaddr_print(ndo, ip, sport, dport); @@ -402,7 +402,7 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length, udpipaddr_print(ndo, ip, sport, dport); goto trunc; } - ulen = EXTRACT_16BITS(&up->uh_ulen); + ulen = EXTRACT_BE_16BITS(&up->uh_ulen); if (ulen < sizeof(struct udphdr)) { udpipaddr_print(ndo, ip, sport, dport); ND_PRINT((ndo, "truncated-udplength %d", ulen)); @@ -437,7 +437,7 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length, case PT_RPC: rp = (const struct sunrpc_msg *)(up + 1); - direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction); + direction = (enum sunrpc_msg_type) EXTRACT_BE_32BITS(&rp->rm_direction); if (direction == SUNRPC_CALL) sunrpc_print(ndo, (const u_char *)rp, length, (const u_char *)ip); @@ -508,15 +508,15 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length, rp = (const struct sunrpc_msg *)(up + 1); if (ND_TTEST(rp->rm_direction)) { - direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction); + direction = (enum sunrpc_msg_type) EXTRACT_BE_32BITS(&rp->rm_direction); if (dport == NFS_PORT && direction == SUNRPC_CALL) { - ND_PRINT((ndo, "NFS request xid %u ", EXTRACT_32BITS(&rp->rm_xid))); + ND_PRINT((ndo, "NFS request xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid))); nfsreq_noaddr_print(ndo, (const u_char *)rp, length, (const u_char *)ip); return; } if (sport == NFS_PORT && direction == SUNRPC_REPLY) { - ND_PRINT((ndo, "NFS reply xid %u ", EXTRACT_32BITS(&rp->rm_xid))); + ND_PRINT((ndo, "NFS reply xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid))); nfsreply_noaddr_print(ndo, (const u_char *)rp, length, (const u_char *)ip); return; @@ -539,7 +539,7 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length, * TCP does, and we do so for UDP-over-IPv6. */ if (IP_V(ip) == 4 && (ndo->ndo_vflag > 1)) { - udp_sum = EXTRACT_16BITS(&up->uh_sum); + udp_sum = EXTRACT_BE_16BITS(&up->uh_sum); if (udp_sum == 0) { ND_PRINT((ndo, "[no cksum] ")); } else if (ND_TTEST2(cp[0], length)) { @@ -557,7 +557,7 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length, /* for IPv6, UDP checksum is mandatory */ if (ND_TTEST2(cp[0], length)) { sum = udp6_cksum(ndo, ip6, up, length + sizeof(struct udphdr)); - udp_sum = EXTRACT_16BITS(&up->uh_sum); + udp_sum = EXTRACT_BE_16BITS(&up->uh_sum); if (sum != 0) { ND_PRINT((ndo, "[bad udp cksum 0x%04x -> 0x%04x!] ", diff --git a/print-vqp.c b/print-vqp.c index 6e1c909f..0db04fd6 100644 --- a/print-vqp.c +++ b/print-vqp.c @@ -143,7 +143,7 @@ vqp_print(netdissect_options *ndo, register const u_char *pptr, register u_int l tok2str(vqp_msg_type_values, "unknown (%u)",vqp_common_header->msg_type), tok2str(vqp_error_code_values, "unknown (%u)",vqp_common_header->error_code), vqp_common_header->error_code, - EXTRACT_32BITS(&vqp_common_header->sequence), + EXTRACT_BE_32BITS(&vqp_common_header->sequence), nitems, len)); @@ -157,8 +157,8 @@ vqp_print(netdissect_options *ndo, register const u_char *pptr, register u_int l ND_TCHECK(*vqp_obj_tlv); if (sizeof(struct vqp_obj_tlv_t) > tlen) goto trunc; - vqp_obj_type = EXTRACT_32BITS(vqp_obj_tlv->obj_type); - vqp_obj_len = EXTRACT_16BITS(vqp_obj_tlv->obj_length); + vqp_obj_type = EXTRACT_BE_32BITS(vqp_obj_tlv->obj_type); + vqp_obj_len = EXTRACT_BE_16BITS(vqp_obj_tlv->obj_length); tptr+=sizeof(struct vqp_obj_tlv_t); tlen-=sizeof(struct vqp_obj_tlv_t); @@ -180,7 +180,7 @@ vqp_print(netdissect_options *ndo, register const u_char *pptr, register u_int l case VQP_OBJ_IP_ADDRESS: if (vqp_obj_len != 4) goto trunc; - ND_PRINT((ndo, "%s (0x%08x)", ipaddr_string(ndo, tptr), EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "%s (0x%08x)", ipaddr_string(ndo, tptr), EXTRACT_BE_32BITS(tptr))); break; /* those objects have similar semantics - fall through */ case VQP_OBJ_PORT_NAME: diff --git a/print-vrrp.c b/print-vrrp.c index d8ba4265..e2bfce14 100644 --- a/print-vrrp.c +++ b/print-vrrp.c @@ -144,7 +144,7 @@ vrrp_print(netdissect_options *ndo, vec[0].len = len; if (in_cksum(vec, 1)) ND_PRINT((ndo, ", (bad vrrp cksum %x)", - EXTRACT_16BITS(&bp[6]))); + EXTRACT_BE_16BITS(&bp[6]))); } if (version == 3 && ND_TTEST2(bp[0], len)) { @@ -152,7 +152,7 @@ vrrp_print(netdissect_options *ndo, len, len, IPPROTO_VRRP); if (cksum) ND_PRINT((ndo, ", (bad vrrp cksum %x)", - EXTRACT_16BITS(&bp[6]))); + EXTRACT_BE_16BITS(&bp[6]))); } ND_PRINT((ndo, ", addrs")); diff --git a/print-vtp.c b/print-vtp.c index d153cc19..0c07293a 100644 --- a/print-vtp.c +++ b/print-vtp.c @@ -182,21 +182,21 @@ vtp_print (netdissect_options *ndo, ND_TCHECK2(*tptr, 8); ND_PRINT((ndo, "\n\t Config Rev %x, Updater %s", - EXTRACT_32BITS(tptr), + EXTRACT_BE_32BITS(tptr), ipaddr_string(ndo, tptr+4))); tptr += 8; ND_TCHECK2(*tptr, VTP_UPDATE_TIMESTAMP_LEN); ND_PRINT((ndo, ", Timestamp 0x%08x 0x%08x 0x%08x", - EXTRACT_32BITS(tptr), - EXTRACT_32BITS(tptr + 4), - EXTRACT_32BITS(tptr + 8))); + EXTRACT_BE_32BITS(tptr), + EXTRACT_BE_32BITS(tptr + 4), + EXTRACT_BE_32BITS(tptr + 8))); tptr += VTP_UPDATE_TIMESTAMP_LEN; ND_TCHECK2(*tptr, VTP_MD5_DIGEST_LEN); ND_PRINT((ndo, ", MD5 digest: %08x%08x%08x%08x", - EXTRACT_32BITS(tptr), - EXTRACT_32BITS(tptr + 4), - EXTRACT_32BITS(tptr + 8), - EXTRACT_32BITS(tptr + 12))); + EXTRACT_BE_32BITS(tptr), + EXTRACT_BE_32BITS(tptr + 4), + EXTRACT_BE_32BITS(tptr + 8), + EXTRACT_BE_32BITS(tptr + 12))); tptr += VTP_MD5_DIGEST_LEN; break; @@ -223,7 +223,7 @@ vtp_print (netdissect_options *ndo, */ ND_TCHECK_32BITS(tptr); - ND_PRINT((ndo, ", Config Rev %x", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, ", Config Rev %x", EXTRACT_BE_32BITS(tptr))); /* * VLAN INFORMATION @@ -257,9 +257,9 @@ vtp_print (netdissect_options *ndo, ND_PRINT((ndo, "\n\tVLAN info status %s, type %s, VLAN-id %u, MTU %u, SAID 0x%08x, Name ", tok2str(vtp_vlan_status,"Unknown",vtp_vlan->status), tok2str(vtp_vlan_type_values,"Unknown",vtp_vlan->type), - EXTRACT_16BITS(&vtp_vlan->vlanid), - EXTRACT_16BITS(&vtp_vlan->mtu), - EXTRACT_32BITS(&vtp_vlan->index))); + EXTRACT_BE_16BITS(&vtp_vlan->vlanid), + EXTRACT_BE_16BITS(&vtp_vlan->mtu), + EXTRACT_BE_32BITS(&vtp_vlan->index))); len -= VTP_VLAN_INFO_FIXED_PART_LEN; tptr += VTP_VLAN_INFO_FIXED_PART_LEN; if (len < 4*((vtp_vlan->name_len + 3)/4)) @@ -308,7 +308,7 @@ vtp_print (netdissect_options *ndo, ND_PRINT((ndo, " (invalid TLV length %u != 1)", tlv_len)); return; } else { - tlv_value = EXTRACT_16BITS(tptr+2); + tlv_value = EXTRACT_BE_16BITS(tptr + 2); switch (type) { case VTP_VLAN_STE_HOP_COUNT: @@ -377,7 +377,7 @@ vtp_print (netdissect_options *ndo, */ ND_TCHECK2(*tptr, 4); - ND_PRINT((ndo, "\n\tStart value: %u", EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "\n\tStart value: %u", EXTRACT_BE_32BITS(tptr))); break; case VTP_JOIN_MESSAGE: diff --git a/print-vxlan-gpe.c b/print-vxlan-gpe.c index 336eb66d..08ef285f 100644 --- a/print-vxlan-gpe.c +++ b/print-vxlan-gpe.c @@ -75,7 +75,7 @@ vxlan_gpe_print(netdissect_options *ndo, const u_char *bp, u_int len) next_protocol = *bp; bp += 1; - vni = EXTRACT_24BITS(bp); + vni = EXTRACT_BE_24BITS(bp); bp += 4; ND_PRINT((ndo, "VXLAN-GPE, ")); diff --git a/print-vxlan.c b/print-vxlan.c index 0c2a82e2..a3de7b30 100644 --- a/print-vxlan.c +++ b/print-vxlan.c @@ -58,7 +58,7 @@ vxlan_print(netdissect_options *ndo, const u_char *bp, u_int len) flags = *bp; bp += 4; - vni = EXTRACT_24BITS(bp); + vni = EXTRACT_BE_24BITS(bp); bp += 4; ND_PRINT((ndo, "VXLAN, ")); @@ -50,7 +50,7 @@ static const char tstr[] = "[|wb]"; #define DOP_ROUNDUP(x) ((((int)(x)) + (DOP_ALIGN - 1)) & ~(DOP_ALIGN - 1)) #define DOP_NEXT(d)\ ((const struct dophdr *)((const u_char *)(d) + \ - DOP_ROUNDUP(EXTRACT_16BITS(&(d)->dh_len) + sizeof(*(d))))) + DOP_ROUNDUP(EXTRACT_BE_16BITS(&(d)->dh_len) + sizeof(*(d))))) /* * Format of the whiteboard packet header. @@ -192,14 +192,14 @@ wb_id(netdissect_options *ndo, len -= sizeof(*id); ND_PRINT((ndo, " %u/%s:%u (max %u/%s:%u) ", - EXTRACT_32BITS(&id->pi_ps.slot), + EXTRACT_BE_32BITS(&id->pi_ps.slot), ipaddr_string(ndo, &id->pi_ps.page.p_sid), - EXTRACT_32BITS(&id->pi_ps.page.p_uid), - EXTRACT_32BITS(&id->pi_mslot), + EXTRACT_BE_32BITS(&id->pi_ps.page.p_uid), + EXTRACT_BE_32BITS(&id->pi_mslot), ipaddr_string(ndo, &id->pi_mpage.p_sid), - EXTRACT_32BITS(&id->pi_mpage.p_uid))); + EXTRACT_BE_32BITS(&id->pi_mpage.p_uid))); - nid = EXTRACT_16BITS(&id->pi_ps.nid); + nid = EXTRACT_BE_16BITS(&id->pi_ps.nid); len -= sizeof(*io) * nid; io = (const struct id_off *)(id + 1); cp = (const char *)(io + nid); @@ -212,7 +212,7 @@ wb_id(netdissect_options *ndo, c = '<'; for (i = 0; i < nid && ND_TTEST(*io); ++io, ++i) { ND_PRINT((ndo, "%c%s:%u", - c, ipaddr_string(ndo, &io->id), EXTRACT_32BITS(&io->off))); + c, ipaddr_string(ndo, &io->id), EXTRACT_BE_32BITS(&io->off))); c = ','; } if (i >= nid) { @@ -233,9 +233,9 @@ wb_rreq(netdissect_options *ndo, ND_PRINT((ndo, " please repair %s %s:%u<%u:%u>", ipaddr_string(ndo, &rreq->pr_id), ipaddr_string(ndo, &rreq->pr_page.p_sid), - EXTRACT_32BITS(&rreq->pr_page.p_uid), - EXTRACT_32BITS(&rreq->pr_sseq), - EXTRACT_32BITS(&rreq->pr_eseq))); + EXTRACT_BE_32BITS(&rreq->pr_page.p_uid), + EXTRACT_BE_32BITS(&rreq->pr_sseq), + EXTRACT_BE_32BITS(&rreq->pr_eseq))); return (0); } @@ -248,9 +248,9 @@ wb_preq(netdissect_options *ndo, return (-1); ND_PRINT((ndo, " need %u/%s:%u", - EXTRACT_32BITS(&preq->pp_low), + EXTRACT_BE_32BITS(&preq->pp_low), ipaddr_string(ndo, &preq->pp_page.p_sid), - EXTRACT_32BITS(&preq->pp_page.p_uid))); + EXTRACT_BE_32BITS(&preq->pp_page.p_uid))); return (0); } @@ -265,20 +265,20 @@ wb_prep(netdissect_options *ndo, ND_PRINT((ndo, " wb-prep:")); if (len < sizeof(*prep) || !ND_TTEST(*prep)) return (-1); - n = EXTRACT_32BITS(&prep->pp_n); + n = EXTRACT_BE_32BITS(&prep->pp_n); ps = (const struct pgstate *)(prep + 1); while (--n >= 0 && ND_TTEST(*ps)) { const struct id_off *io, *ie; char c = '<'; ND_PRINT((ndo, " %u/%s:%u", - EXTRACT_32BITS(&ps->slot), + EXTRACT_BE_32BITS(&ps->slot), ipaddr_string(ndo, &ps->page.p_sid), - EXTRACT_32BITS(&ps->page.p_uid))); + EXTRACT_BE_32BITS(&ps->page.p_uid))); io = (const struct id_off *)(ps + 1); for (ie = io + ps->nid; io < ie && ND_TTEST(*io); ++io) { ND_PRINT((ndo, "%c%s:%u", c, ipaddr_string(ndo, &io->id), - EXTRACT_32BITS(&io->off))); + EXTRACT_BE_32BITS(&io->off))); c = ','; } ND_PRINT((ndo, ">")); @@ -328,7 +328,7 @@ wb_dops(netdissect_options *ndo, const struct pkt_dop *dop, else { ND_PRINT((ndo, " %s", dopstr[t])); if (t == DT_SKIP || t == DT_HOLE) { - uint32_t ts = EXTRACT_32BITS(&dh->dh_ts); + uint32_t ts = EXTRACT_BE_32BITS(&dh->dh_ts); ND_PRINT((ndo, "%d", ts - ss + 1)); if (ss > ts || ts > es) { ND_PRINT((ndo, "[|]")); @@ -358,14 +358,14 @@ wb_rrep(netdissect_options *ndo, ND_PRINT((ndo, " for %s %s:%u<%u:%u>", ipaddr_string(ndo, &rrep->pr_id), ipaddr_string(ndo, &dop->pd_page.p_sid), - EXTRACT_32BITS(&dop->pd_page.p_uid), - EXTRACT_32BITS(&dop->pd_sseq), - EXTRACT_32BITS(&dop->pd_eseq))); + EXTRACT_BE_32BITS(&dop->pd_page.p_uid), + EXTRACT_BE_32BITS(&dop->pd_sseq), + EXTRACT_BE_32BITS(&dop->pd_eseq))); if (ndo->ndo_vflag) return (wb_dops(ndo, dop, - EXTRACT_32BITS(&dop->pd_sseq), - EXTRACT_32BITS(&dop->pd_eseq))); + EXTRACT_BE_32BITS(&dop->pd_sseq), + EXTRACT_BE_32BITS(&dop->pd_eseq))); return (0); } @@ -380,14 +380,14 @@ wb_drawop(netdissect_options *ndo, ND_PRINT((ndo, " %s:%u<%u:%u>", ipaddr_string(ndo, &dop->pd_page.p_sid), - EXTRACT_32BITS(&dop->pd_page.p_uid), - EXTRACT_32BITS(&dop->pd_sseq), - EXTRACT_32BITS(&dop->pd_eseq))); + EXTRACT_BE_32BITS(&dop->pd_page.p_uid), + EXTRACT_BE_32BITS(&dop->pd_sseq), + EXTRACT_BE_32BITS(&dop->pd_eseq))); if (ndo->ndo_vflag) return (wb_dops(ndo, dop, - EXTRACT_32BITS(&dop->pd_sseq), - EXTRACT_32BITS(&dop->pd_eseq))); + EXTRACT_BE_32BITS(&dop->pd_sseq), + EXTRACT_BE_32BITS(&dop->pd_eseq))); return (0); } diff --git a/print-zeromq.c b/print-zeromq.c index 29b87fcc..96665534 100644 --- a/print-zeromq.c +++ b/print-zeromq.c @@ -90,7 +90,7 @@ zmtp1_print_frame(netdissect_options *ndo, const u_char *cp, const u_char *ep) header_len = 1 + 8; /* 0xFF, length */ ND_PRINT((ndo, " frame flags+body (64-bit) length")); ND_TCHECK2(*cp, header_len); /* 0xFF, length */ - body_len_declared = EXTRACT_64BITS(cp + 1); + body_len_declared = EXTRACT_BE_64BITS(cp + 1); ND_PRINT((ndo, " %" PRIu64, body_len_declared)); } if (body_len_declared == 0) @@ -173,7 +173,7 @@ zmtp1_print_intermediate_part(netdissect_options *ndo, const u_char *cp, const u uint64_t remaining_len; ND_TCHECK2(*cp, 2); - frame_offset = EXTRACT_16BITS(cp); + frame_offset = EXTRACT_BE_16BITS(cp); ND_PRINT((ndo, "\n\t frame offset 0x%04x", frame_offset)); cp += 2; remaining_len = ndo->ndo_snapend - cp; /* without the frame length */ @@ -185,7 +185,7 @@ name_ptr(netdissect_options *ndo, ND_TCHECK2(*p, 2); if ((p + 1) >= maxbuf) return(NULL); /* name goes past the end of the buffer */ - l = EXTRACT_16BITS(p) & 0x3FFF; + l = EXTRACT_BE_16BITS(p) & 0x3FFF; if (l == 0) { /* We have a pointer that points to itself. */ return(NULL); @@ -504,7 +504,7 @@ smb_fdata1(netdissect_options *ndo, { unsigned int x; ND_TCHECK2(buf[0], 2); - x = reverse ? EXTRACT_16BITS(buf) : + x = reverse ? EXTRACT_BE_16BITS(buf) : EXTRACT_LE_16BITS(buf); ND_PRINT((ndo, "%d (0x%x)", x, x)); buf += 2; @@ -515,7 +515,7 @@ smb_fdata1(netdissect_options *ndo, { unsigned int x; ND_TCHECK2(buf[0], 4); - x = reverse ? EXTRACT_32BITS(buf) : + x = reverse ? EXTRACT_BE_32BITS(buf) : EXTRACT_LE_32BITS(buf); ND_PRINT((ndo, "%d (0x%x)", x, x)); buf += 4; @@ -526,7 +526,7 @@ smb_fdata1(netdissect_options *ndo, { uint64_t x; ND_TCHECK2(buf[0], 8); - x = reverse ? EXTRACT_64BITS(buf) : + x = reverse ? EXTRACT_BE_64BITS(buf) : EXTRACT_LE_64BITS(buf); ND_PRINT((ndo, "%" PRIu64 " (0x%" PRIx64 ")", x, x)); buf += 8; @@ -539,9 +539,9 @@ smb_fdata1(netdissect_options *ndo, uint32_t x1, x2; uint64_t x; ND_TCHECK2(buf[0], 8); - x1 = reverse ? EXTRACT_32BITS(buf) : + x1 = reverse ? EXTRACT_BE_32BITS(buf) : EXTRACT_LE_32BITS(buf); - x2 = reverse ? EXTRACT_32BITS(buf + 4) : + x2 = reverse ? EXTRACT_BE_32BITS(buf + 4) : EXTRACT_LE_32BITS(buf + 4); x = (((uint64_t)x1) << 32) | x2; ND_PRINT((ndo, "%" PRIu64 " (0x%" PRIx64 ")", x, x)); @@ -563,7 +563,7 @@ smb_fdata1(netdissect_options *ndo, { unsigned int x; ND_TCHECK2(buf[0], 2); - x = reverse ? EXTRACT_16BITS(buf) : + x = reverse ? EXTRACT_BE_16BITS(buf) : EXTRACT_LE_16BITS(buf); ND_PRINT((ndo, "0x%X", x)); buf += 2; @@ -574,7 +574,7 @@ smb_fdata1(netdissect_options *ndo, { unsigned int x; ND_TCHECK2(buf[0], 4); - x = reverse ? EXTRACT_32BITS(buf) : + x = reverse ? EXTRACT_BE_32BITS(buf) : EXTRACT_LE_32BITS(buf); ND_PRINT((ndo, "0x%X", x)); buf += 4; @@ -595,7 +595,7 @@ smb_fdata1(netdissect_options *ndo, case 'd': ND_TCHECK2(buf[0], 2); - stringlen = reverse ? EXTRACT_16BITS(buf) : + stringlen = reverse ? EXTRACT_BE_16BITS(buf) : EXTRACT_LE_16BITS(buf); ND_PRINT((ndo, "%u", stringlen)); buf += 2; @@ -603,7 +603,7 @@ smb_fdata1(netdissect_options *ndo, case 'D': ND_TCHECK2(buf[0], 4); - stringlen = reverse ? EXTRACT_32BITS(buf) : + stringlen = reverse ? EXTRACT_BE_32BITS(buf) : EXTRACT_LE_32BITS(buf); ND_PRINT((ndo, "%u", stringlen)); buf += 4; |