diff options
-rw-r--r-- | addrtoname.c | 2 | ||||
-rw-r--r-- | cpack.c | 6 | ||||
-rw-r--r-- | extract.h | 64 | ||||
-rw-r--r-- | netdissect.h | 6 | ||||
-rw-r--r-- | print-802_11.c | 65 | ||||
-rw-r--r-- | print-802_15_4.c | 16 | ||||
-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 | 30 | ||||
-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 | 36 | ||||
-rw-r--r-- | print-atm.c | 28 | ||||
-rw-r--r-- | print-babel.c | 50 | ||||
-rw-r--r-- | print-bfd.c | 28 | ||||
-rw-r--r-- | print-bgp.c | 173 | ||||
-rw-r--r-- | print-bootp.c | 76 | ||||
-rw-r--r-- | print-bt.c | 2 | ||||
-rw-r--r-- | print-carp.c | 4 | ||||
-rw-r--r-- | print-cdp.c | 32 | ||||
-rw-r--r-- | print-cfm.c | 32 | ||||
-rw-r--r-- | print-chdlc.c | 14 | ||||
-rw-r--r-- | print-cnfp.c | 102 | ||||
-rw-r--r-- | print-dccp.c | 38 | ||||
-rw-r--r-- | print-decnet.c | 148 | ||||
-rw-r--r-- | print-dhcp6.c | 76 | ||||
-rw-r--r-- | print-domain.c | 88 | ||||
-rw-r--r-- | print-dtp.c | 6 | ||||
-rw-r--r-- | print-dvmrp.c | 26 | ||||
-rw-r--r-- | print-eap.c | 26 | ||||
-rw-r--r-- | print-egp.c | 34 | ||||
-rw-r--r-- | print-eigrp.c | 84 | ||||
-rw-r--r-- | print-enc.c | 2 | ||||
-rw-r--r-- | print-esp.c | 22 | ||||
-rw-r--r-- | print-ether.c | 8 | ||||
-rw-r--r-- | print-forces.c | 186 | ||||
-rw-r--r-- | print-fr.c | 102 | ||||
-rw-r--r-- | print-frag6.c | 12 | ||||
-rw-r--r-- | print-geneve.c | 16 | ||||
-rw-r--r-- | print-geonet.c | 10 | ||||
-rw-r--r-- | print-gre.c | 32 | ||||
-rw-r--r-- | print-hncp.c | 46 | ||||
-rw-r--r-- | print-icmp.c | 38 | ||||
-rw-r--r-- | print-icmp6.c | 88 | ||||
-rw-r--r-- | print-igmp.c | 36 | ||||
-rw-r--r-- | print-igrp.c | 14 | ||||
-rw-r--r-- | print-ip.c | 16 | ||||
-rw-r--r-- | print-ip6.c | 18 | ||||
-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 | 336 | ||||
-rw-r--r-- | print-juniper.c | 74 | ||||
-rw-r--r-- | print-krb.c | 8 | ||||
-rw-r--r-- | print-l2tp.c | 116 | ||||
-rw-r--r-- | print-lane.c | 6 | ||||
-rw-r--r-- | print-ldp.c | 84 | ||||
-rw-r--r-- | print-lisp.c | 18 | ||||
-rw-r--r-- | print-llc.c | 10 | ||||
-rw-r--r-- | print-lldp.c | 148 | ||||
-rw-r--r-- | print-lmp.c | 210 | ||||
-rw-r--r-- | print-loopback.c | 6 | ||||
-rw-r--r-- | print-lspping.c | 68 | ||||
-rw-r--r-- | print-lwapp.c | 8 | ||||
-rw-r--r-- | print-lwres.c | 96 | ||||
-rw-r--r-- | print-m3ua.c | 12 | ||||
-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 | 24 | ||||
-rw-r--r-- | print-mpls.c | 2 | ||||
-rw-r--r-- | print-mptcp.c | 36 | ||||
-rw-r--r-- | print-msdp.c | 4 | ||||
-rw-r--r-- | print-msnlb.c | 2 | ||||
-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 | 288 | ||||
-rw-r--r-- | print-openflow.c | 4 | ||||
-rw-r--r-- | print-ospf.c | 126 | ||||
-rw-r--r-- | print-ospf6.c | 78 | ||||
-rw-r--r-- | print-otv.c | 4 | ||||
-rw-r--r-- | print-pflog.c | 4 | ||||
-rw-r--r-- | print-pgm.c | 94 | ||||
-rw-r--r-- | print-pim.c | 72 | ||||
-rw-r--r-- | print-pktap.c | 10 | ||||
-rw-r--r-- | print-ppi.c | 8 | ||||
-rw-r--r-- | print-ppp.c | 106 | ||||
-rw-r--r-- | print-pppoe.c | 8 | ||||
-rw-r--r-- | print-pptp.c | 76 | ||||
-rw-r--r-- | print-radius.c | 46 | ||||
-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 | 18 | ||||
-rw-r--r-- | print-rsvp.c | 313 | ||||
-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 | 8 | ||||
-rw-r--r-- | print-sll.c | 12 | ||||
-rw-r--r-- | print-slow.c | 42 | ||||
-rw-r--r-- | print-smb.c | 99 | ||||
-rw-r--r-- | print-snmp.c | 14 | ||||
-rw-r--r-- | print-stp.c | 74 | ||||
-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 | 50 | ||||
-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 | 12 | ||||
-rw-r--r-- | print-udp.c | 74 | ||||
-rw-r--r-- | print-vjc.c | 2 | ||||
-rw-r--r-- | print-vqp.c | 8 | ||||
-rw-r--r-- | print-vrrp.c | 4 | ||||
-rw-r--r-- | print-vtp.c | 34 | ||||
-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 | 54 |
129 files changed, 3037 insertions, 3033 deletions
diff --git a/addrtoname.c b/addrtoname.c index 9ea438d3..c481b807 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_BE_24BITS(ep); + oui = EXTRACT_BE_U_3(ep); *cp++ = hex[*ep >> 4 ]; *cp++ = hex[*ep++ & 0xf]; for (i = 5; --i >= 0;) { @@ -100,7 +100,7 @@ cpack_uint64(struct cpack_state *cs, uint64_t *u) if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) return -1; - *u = EXTRACT_LE_64BITS(next); + *u = EXTRACT_LE_U_8(next); /* Move pointer past the uint64_t. */ cs->c_next = next + sizeof(*u); @@ -116,7 +116,7 @@ cpack_uint32(struct cpack_state *cs, uint32_t *u) if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) return -1; - *u = EXTRACT_LE_32BITS(next); + *u = EXTRACT_LE_U_4(next); /* Move pointer past the uint32_t. */ cs->c_next = next + sizeof(*u); @@ -132,7 +132,7 @@ cpack_uint16(struct cpack_state *cs, uint16_t *u) if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) return -1; - *u = EXTRACT_LE_16BITS(next); + *u = EXTRACT_LE_U_2(next); /* Move pointer past the uint16_t. */ cs->c_next = next + sizeof(*u); @@ -23,8 +23,8 @@ * For 8-bit values; needed to fetch a one-byte value. Byte order * isn't relevant, and alignment isn't an issue. */ -#define EXTRACT_8BITS(p) (*(p)) -#define EXTRACT_INT8(p) ((int8_t)(*(p))) +#define EXTRACT_U_1(p) (*(p)) +#define EXTRACT_S_1(p) ((int8_t)(*(p))) /* * Inline functions or macros to extract possibly-unaligned big-endian @@ -83,31 +83,31 @@ * architectures in all cases? */ static inline uint16_t UNALIGNED_OK -EXTRACT_BE_16BITS(const void *p) +EXTRACT_BE_U_2(const void *p) { return ((uint16_t)ntohs(*(const uint16_t *)(p))); } static inline int16_t UNALIGNED_OK -EXTRACT_BE_INT16(const void *p) +EXTRACT_BE_S_2(const void *p) { return ((int16_t)ntohs(*(const int16_t *)(p))); } static inline uint32_t UNALIGNED_OK -EXTRACT_BE_32BITS(const void *p) +EXTRACT_BE_U_4(const void *p) { return ((uint32_t)ntohl(*(const uint32_t *)(p))); } static inline int32_t UNALIGNED_OK -EXTRACT_BE_INT32(const void *p) +EXTRACT_BE_S_4(const void *p) { return ((int32_t)ntohl(*(const int32_t *)(p))); } static inline uint64_t UNALIGNED_OK -EXTRACT_BE_64BITS(const void *p) +EXTRACT_BE_U_8(const void *p) { return ((uint64_t)(((uint64_t)ntohl(*((const uint32_t *)(p) + 0))) << 32 | ((uint64_t)ntohl(*((const uint32_t *)(p) + 1))) << 0)); @@ -115,7 +115,7 @@ EXTRACT_BE_64BITS(const void *p) } static inline int64_t UNALIGNED_OK -EXTRACT_BE_INT64(const void *p) +EXTRACT_BE_S_8(const void *p) { return ((int64_t)(((int64_t)ntohl(*((const uint32_t *)(p) + 0))) << 32 | ((uint64_t)ntohl(*((const uint32_t *)(p) + 1))) << 0)); @@ -192,38 +192,38 @@ typedef struct { } __attribute__((packed)) unaligned_int32_t; UNALIGNED_OK static inline uint16_t -EXTRACT_BE_16BITS(const void *p) +EXTRACT_BE_U_2(const void *p) { return ((uint16_t)ntohs(((const unaligned_uint16_t *)(p))->val)); } UNALIGNED_OK static inline int16_t -EXTRACT_BE_INT16(const void *p) +EXTRACT_BE_S_2(const void *p) { return ((int16_t)ntohs(((const unaligned_int16_t *)(p))->val)); } UNALIGNED_OK static inline uint32_t -EXTRACT_BE_32BITS(const void *p) +EXTRACT_BE_U_4(const void *p) { return ((uint32_t)ntohl(((const unaligned_uint32_t *)(p))->val)); } UNALIGNED_OK static inline int32_t -EXTRACT_BE_INT32(const void *p) +EXTRACT_BE_S_4(const void *p) { return ((int32_t)ntohl(((const unaligned_int32_t *)(p))->val)); } UNALIGNED_OK static inline uint64_t -EXTRACT_BE_64BITS(const void *p) +EXTRACT_BE_U_8(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)); } UNALIGNED_OK static inline int64_t -EXTRACT_BE_INT64(const void *p) +EXTRACT_BE_S_8(const void *p) { return ((int64_t)(((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 0)->val)) << 32 | ((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 1)->val)) << 0)); @@ -237,23 +237,23 @@ EXTRACT_BE_INT64(const void *p) * quantities the hard way - fetch the bytes one at a time and * assemble them. */ -#define EXTRACT_BE_16BITS(p) \ +#define EXTRACT_BE_U_2(p) \ ((uint16_t)(((uint16_t)(*((const uint8_t *)(p) + 0)) << 8) | \ ((uint16_t)(*((const uint8_t *)(p) + 1)) << 0))) -#define EXTRACT_BE_INT16(p) \ +#define EXTRACT_BE_S_2(p) \ ((int16_t)(((uint16_t)(*((const uint8_t *)(p) + 0)) << 8) | \ ((uint16_t)(*((const uint8_t *)(p) + 1)) << 0))) -#define EXTRACT_BE_32BITS(p) \ +#define EXTRACT_BE_U_4(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_BE_INT32(p) \ +#define EXTRACT_BE_S_4(p) \ ((int32_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_BE_64BITS(p) \ +#define EXTRACT_BE_U_8(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) | \ @@ -262,7 +262,7 @@ EXTRACT_BE_INT64(const void *p) ((uint64_t)(*((const uint8_t *)(p) + 5)) << 16) | \ ((uint64_t)(*((const uint8_t *)(p) + 6)) << 8) | \ ((uint64_t)(*((const uint8_t *)(p) + 7)) << 0))) -#define EXTRACT_BE_INT64(p) \ +#define EXTRACT_BE_S_8(p) \ ((int64_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) | \ @@ -273,12 +273,12 @@ EXTRACT_BE_INT64(const void *p) ((uint64_t)(*((const uint8_t *)(p) + 7)) << 0))) #endif /* unaligned access checks */ -#define EXTRACT_BE_24BITS(p) \ +#define EXTRACT_BE_U_3(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_BE_INT24(p) \ +#define EXTRACT_BE_S_3(p) \ (((*((const uint8_t *)(p) + 0)) & 0x80) ? \ ((int32_t)(((uint32_t)(*((const uint8_t *)(p) + 0)) << 16) | \ ((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \ @@ -288,14 +288,14 @@ EXTRACT_BE_INT64(const void *p) ((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \ ((uint32_t)(*((const uint8_t *)(p) + 2)) << 0)))) -#define EXTRACT_BE_40BITS(p) \ +#define EXTRACT_BE_U_5(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_BE_INT40(p) \ +#define EXTRACT_BE_S_5(p) \ (((*((const uint8_t *)(p) + 0)) & 0x80) ? \ ((int64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 32) | \ ((uint64_t)(*((const uint8_t *)(p) + 1)) << 24) | \ @@ -309,7 +309,7 @@ EXTRACT_BE_INT64(const void *p) ((uint64_t)(*((const uint8_t *)(p) + 3)) << 8) | \ ((uint64_t)(*((const uint8_t *)(p) + 4)) << 0)))) -#define EXTRACT_BE_48BITS(p) \ +#define EXTRACT_BE_U_6(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) | \ @@ -317,7 +317,7 @@ EXTRACT_BE_INT64(const void *p) ((uint64_t)(*((const uint8_t *)(p) + 4)) << 8) | \ ((uint64_t)(*((const uint8_t *)(p) + 5)) << 0))) -#define EXTRACT_BE_INT48(p) \ +#define EXTRACT_BE_S_6(p) \ (((*((const uint8_t *)(p) + 0)) & 0x80) ? \ ((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 40) | \ ((uint64_t)(*((const uint8_t *)(p) + 1)) << 32) | \ @@ -333,7 +333,7 @@ EXTRACT_BE_INT64(const void *p) ((uint64_t)(*((const uint8_t *)(p) + 4)) << 8) | \ ((uint64_t)(*((const uint8_t *)(p) + 5)) << 0)))) -#define EXTRACT_BE_56BITS(p) \ +#define EXTRACT_BE_U_7(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) | \ @@ -342,7 +342,7 @@ EXTRACT_BE_INT64(const void *p) ((uint64_t)(*((const uint8_t *)(p) + 5)) << 8) | \ ((uint64_t)(*((const uint8_t *)(p) + 6)) << 0))) -#define EXTRACT_BE_INT56(p) \ +#define EXTRACT_BE_S_7(p) \ (((*((const uint8_t *)(p) + 0)) & 0x80) ? \ ((int64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 48) | \ ((uint64_t)(*((const uint8_t *)(p) + 1)) << 40) | \ @@ -364,19 +364,19 @@ EXTRACT_BE_INT64(const void *p) * Macros to extract possibly-unaligned little-endian integral values. * XXX - do loads on little-endian machines that support unaligned loads? */ -#define EXTRACT_LE_16BITS(p) \ +#define EXTRACT_LE_U_2(p) \ ((uint16_t)(((uint16_t)(*((const uint8_t *)(p) + 1)) << 8) | \ ((uint16_t)(*((const uint8_t *)(p) + 0)) << 0))) -#define EXTRACT_LE_32BITS(p) \ +#define EXTRACT_LE_U_4(p) \ ((uint32_t)(((uint32_t)(*((const uint8_t *)(p) + 3)) << 24) | \ ((uint32_t)(*((const uint8_t *)(p) + 2)) << 16) | \ ((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \ ((uint32_t)(*((const uint8_t *)(p) + 0)) << 0))) -#define EXTRACT_LE_24BITS(p) \ +#define EXTRACT_LE_U_3(p) \ ((uint32_t)(((uint32_t)(*((const uint8_t *)(p) + 2)) << 16) | \ ((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \ ((uint32_t)(*((const uint8_t *)(p) + 0)) << 0))) -#define EXTRACT_LE_64BITS(p) \ +#define EXTRACT_LE_U_8(p) \ ((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 7)) << 56) | \ ((uint64_t)(*((const uint8_t *)(p) + 6)) << 48) | \ ((uint64_t)(*((const uint8_t *)(p) + 5)) << 40) | \ diff --git a/netdissect.h b/netdissect.h index ec64cfe4..2782796e 100644 --- a/netdissect.h +++ b/netdissect.h @@ -54,16 +54,16 @@ typedef unsigned char nd_uint64_t[8]; * Use this for IPv4 addresses. It's defined as an array of octets, so * that it's not aligned on its "natural" boundary, and it's defined as * a structure in the hopes that this makes it harder to naively use - * EXTRACT_BE_32BITS() to extract the value - in many cases you just want + * EXTRACT_BE_U_4() to extract the value - in many cases you just want * to use UNALIGNED_MEMCPY() to copy its value, so that it remains in * network byte order. * * (Among other things, we don't want somebody thinking "IPv4 addresses, - * they're in network byte order, so we want EXTRACT_BE_32BITS(), right?" + * they're in network byte order, so we want EXTRACT_BE_U_4(), right?" * and then handing the result to system APIs that expect network-order * IPv4 addresses, such as inet_ntop(), on their little-endian PCs, getting * the wrong behavior, and concluding "oh, it must be in *little*-endian - * order" and "fixing" it to use EXTRACT_LE_32BITS(). Yes, people do this; + * order" and "fixing" it to use EXTRACT_LE_U_4(). Yes, people do this; * that's why Wireshark has tvb_get_ipv4(), to extract an IPv4 address from * a packet data buffer; it was introduced in reaction to somebody who * *had* done that.) diff --git a/print-802_11.c b/print-802_11.c index 8918d3d7..35889815 100644 --- a/print-802_11.c +++ b/print-802_11.c @@ -986,7 +986,7 @@ wep_print(netdissect_options *ndo, if (!ND_TTEST2(*p, IEEE802_11_IV_LEN + IEEE802_11_KID_LEN)) return 0; - iv = EXTRACT_LE_32BITS(p); + iv = EXTRACT_LE_U_4(p); ND_PRINT((ndo, " IV:%3x Pad %x KeyID %x", IV_IV(iv), IV_PAD(iv), IV_KEYID(iv))); @@ -1023,7 +1023,7 @@ parse_elements(netdissect_options *ndo, return 0; if (length < 2) return 0; - elementlen = EXTRACT_8BITS(p + offset + 1); + elementlen = EXTRACT_U_1(p + offset + 1); /* Make sure we have the entire element. */ if (!ND_TTEST2(*(p + offset + 2), elementlen)) @@ -1123,7 +1123,7 @@ parse_elements(netdissect_options *ndo, length -= ds.length; break; } - ds.channel = EXTRACT_8BITS(p + offset); + ds.channel = EXTRACT_U_1(p + offset); offset += 1; length -= 1; /* @@ -1230,10 +1230,10 @@ handle_beacon(netdissect_options *ndo, memcpy(&pbody.timestamp, p, IEEE802_11_TSTAMP_LEN); offset += IEEE802_11_TSTAMP_LEN; length -= IEEE802_11_TSTAMP_LEN; - pbody.beacon_interval = EXTRACT_LE_16BITS(p+offset); + pbody.beacon_interval = EXTRACT_LE_U_2(p + offset); offset += IEEE802_11_BCNINT_LEN; length -= IEEE802_11_BCNINT_LEN; - pbody.capability_info = EXTRACT_LE_16BITS(p+offset); + pbody.capability_info = EXTRACT_LE_U_2(p + offset); offset += IEEE802_11_CAPINFO_LEN; length -= IEEE802_11_CAPINFO_LEN; @@ -1262,10 +1262,10 @@ handle_assoc_request(netdissect_options *ndo, return 0; if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN) return 0; - pbody.capability_info = EXTRACT_LE_16BITS(p); + pbody.capability_info = EXTRACT_LE_U_2(p); offset += IEEE802_11_CAPINFO_LEN; length -= IEEE802_11_CAPINFO_LEN; - pbody.listen_interval = EXTRACT_LE_16BITS(p+offset); + pbody.listen_interval = EXTRACT_LE_U_2(p + offset); offset += IEEE802_11_LISTENINT_LEN; length -= IEEE802_11_LISTENINT_LEN; @@ -1292,13 +1292,13 @@ handle_assoc_response(netdissect_options *ndo, if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_STATUS_LEN + IEEE802_11_AID_LEN) return 0; - pbody.capability_info = EXTRACT_LE_16BITS(p); + pbody.capability_info = EXTRACT_LE_U_2(p); offset += IEEE802_11_CAPINFO_LEN; length -= IEEE802_11_CAPINFO_LEN; - pbody.status_code = EXTRACT_LE_16BITS(p+offset); + pbody.status_code = EXTRACT_LE_U_2(p + offset); offset += IEEE802_11_STATUS_LEN; length -= IEEE802_11_STATUS_LEN; - pbody.aid = EXTRACT_LE_16BITS(p+offset); + pbody.aid = EXTRACT_LE_U_2(p + offset); offset += IEEE802_11_AID_LEN; length -= IEEE802_11_AID_LEN; @@ -1329,10 +1329,10 @@ handle_reassoc_request(netdissect_options *ndo, if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN + IEEE802_11_AP_LEN) return 0; - pbody.capability_info = EXTRACT_LE_16BITS(p); + pbody.capability_info = EXTRACT_LE_U_2(p); offset += IEEE802_11_CAPINFO_LEN; length -= IEEE802_11_CAPINFO_LEN; - pbody.listen_interval = EXTRACT_LE_16BITS(p+offset); + pbody.listen_interval = EXTRACT_LE_U_2(p + offset); offset += IEEE802_11_LISTENINT_LEN; length -= IEEE802_11_LISTENINT_LEN; memcpy(&pbody.ap, p+offset, IEEE802_11_AP_LEN); @@ -1392,10 +1392,10 @@ handle_probe_response(netdissect_options *ndo, memcpy(&pbody.timestamp, p, IEEE802_11_TSTAMP_LEN); offset += IEEE802_11_TSTAMP_LEN; length -= IEEE802_11_TSTAMP_LEN; - pbody.beacon_interval = EXTRACT_LE_16BITS(p+offset); + pbody.beacon_interval = EXTRACT_LE_U_2(p + offset); offset += IEEE802_11_BCNINT_LEN; length -= IEEE802_11_BCNINT_LEN; - pbody.capability_info = EXTRACT_LE_16BITS(p+offset); + pbody.capability_info = EXTRACT_LE_U_2(p + offset); offset += IEEE802_11_CAPINFO_LEN; length -= IEEE802_11_CAPINFO_LEN; @@ -1427,7 +1427,7 @@ handle_disassoc(netdissect_options *ndo, return 0; if (length < IEEE802_11_REASON_LEN) return 0; - pbody.reason_code = EXTRACT_LE_16BITS(p); + pbody.reason_code = EXTRACT_LE_U_2(p); ND_PRINT((ndo, ": %s", (pbody.reason_code < NUM_REASONS) @@ -1451,13 +1451,13 @@ handle_auth(netdissect_options *ndo, return 0; if (length < 6) return 0; - pbody.auth_alg = EXTRACT_LE_16BITS(p); + pbody.auth_alg = EXTRACT_LE_U_2(p); offset += 2; length -= 2; - pbody.auth_trans_seq_num = EXTRACT_LE_16BITS(p + offset); + pbody.auth_trans_seq_num = EXTRACT_LE_U_2(p + offset); offset += 2; length -= 2; - pbody.status_code = EXTRACT_LE_16BITS(p + offset); + pbody.status_code = EXTRACT_LE_U_2(p + offset); offset += 2; length -= 2; @@ -1504,7 +1504,7 @@ handle_deauth(netdissect_options *ndo, return 0; if (length < IEEE802_11_REASON_LEN) return 0; - pbody.reason_code = EXTRACT_LE_16BITS(p); + pbody.reason_code = EXTRACT_LE_U_2(p); reason = (pbody.reason_code < NUM_REASONS) ? reason_text[pbody.reason_code] @@ -1676,8 +1676,8 @@ ctrl_body_print(netdissect_options *ndo, ND_PRINT((ndo, " RA:%s TA:%s CTL(%x) SEQ(%u) ", etheraddr_string(ndo, ((const struct ctrl_bar_hdr_t *)p)->ra), etheraddr_string(ndo, ((const struct ctrl_bar_hdr_t *)p)->ta), - EXTRACT_LE_16BITS(&(((const struct ctrl_bar_hdr_t *)p)->ctl)), - EXTRACT_LE_16BITS(&(((const struct ctrl_bar_hdr_t *)p)->seq)))); + EXTRACT_LE_U_2(&(((const struct ctrl_bar_hdr_t *)p)->ctl)), + EXTRACT_LE_U_2(&(((const struct ctrl_bar_hdr_t *)p)->seq)))); break; case CTRL_BA: if (!ND_TTEST2(*p, CTRL_BA_HDRLEN)) @@ -1690,7 +1690,7 @@ ctrl_body_print(netdissect_options *ndo, if (!ND_TTEST2(*p, CTRL_PS_POLL_HDRLEN)) return 0; ND_PRINT((ndo, " AID(%x)", - EXTRACT_LE_16BITS(&(((const struct ctrl_ps_poll_hdr_t *)p)->aid)))); + EXTRACT_LE_U_2(&(((const struct ctrl_ps_poll_hdr_t *)p)->aid)))); break; case CTRL_RTS: if (!ND_TTEST2(*p, CTRL_RTS_HDRLEN)) @@ -1865,8 +1865,8 @@ ctrl_header_print(netdissect_options *ndo, uint16_t fc, const u_char *p) ND_PRINT((ndo, " RA:%s TA:%s CTL(%x) SEQ(%u) ", etheraddr_string(ndo, ((const struct ctrl_bar_hdr_t *)p)->ra), etheraddr_string(ndo, ((const struct ctrl_bar_hdr_t *)p)->ta), - EXTRACT_LE_16BITS(&(((const struct ctrl_bar_hdr_t *)p)->ctl)), - EXTRACT_LE_16BITS(&(((const struct ctrl_bar_hdr_t *)p)->seq)))); + EXTRACT_LE_U_2(&(((const struct ctrl_bar_hdr_t *)p)->ctl)), + EXTRACT_LE_U_2(&(((const struct ctrl_bar_hdr_t *)p)->seq)))); break; case CTRL_BA: ND_PRINT((ndo, "RA:%s ", @@ -1979,8 +1979,7 @@ ieee_802_11_hdr_print(netdissect_options *ndo, ND_PRINT((ndo, "Protected ")); if (FC_TYPE(fc) != T_CTRL || FC_SUBTYPE(fc) != CTRL_PS_POLL) ND_PRINT((ndo, "%dus ", - EXTRACT_LE_16BITS( - &((const struct mgmt_header_t *)p)->duration))); + EXTRACT_LE_U_2(&((const struct mgmt_header_t *)p)->duration))); } if (meshdrlen != 0) { const struct meshcntl_t *mc = @@ -1988,7 +1987,7 @@ ieee_802_11_hdr_print(netdissect_options *ndo, int ae = mc->flags & 3; ND_PRINT((ndo, "MeshData (AE %d TTL %u seq %u", ae, mc->ttl, - EXTRACT_LE_32BITS(mc->seq))); + EXTRACT_LE_U_4(mc->seq))); if (ae > 0) ND_PRINT((ndo, " A4:%s", etheraddr_string(ndo, mc->addr4))); if (ae > 1) @@ -2048,7 +2047,7 @@ ieee802_11_print(netdissect_options *ndo, return orig_caplen; } - fc = EXTRACT_LE_16BITS(p); + fc = EXTRACT_LE_U_2(p); hdrlen = extract_header_length(ndo, fc); if (hdrlen == 0) { /* Unknown frame type or control frame subtype; quit. */ @@ -3077,7 +3076,7 @@ ieee802_11_radio_print(netdissect_options *ndo, { #define BIT(n) (1U << n) #define IS_EXTENDED(__p) \ - (EXTRACT_LE_32BITS(__p) & BIT(IEEE80211_RADIOTAP_EXT)) != 0 + (EXTRACT_LE_U_4(__p) & BIT(IEEE80211_RADIOTAP_EXT)) != 0 struct cpack_state cpacker; const struct ieee80211_radiotap_header *hdr; @@ -3100,7 +3099,7 @@ ieee802_11_radio_print(netdissect_options *ndo, hdr = (const struct ieee80211_radiotap_header *)p; - len = EXTRACT_LE_16BITS(&hdr->it_len); + len = EXTRACT_LE_U_2(&hdr->it_len); /* * If we don't have the entire radiotap header, just give up. @@ -3139,7 +3138,7 @@ ieee802_11_radio_print(netdissect_options *ndo, fcslen = 0; for (presentp = &hdr->it_present; presentp <= last_presentp; presentp++) { - presentflags = EXTRACT_LE_32BITS(presentp); + presentflags = EXTRACT_LE_U_4(presentp); /* * If this is a vendor namespace, we don't handle it. @@ -3275,7 +3274,7 @@ ieee802_11_avs_radio_print(netdissect_options *ndo, return caplen; } - caphdr_len = EXTRACT_BE_32BITS(p + 4); + caphdr_len = EXTRACT_BE_U_4(p + 4); if (caphdr_len < 8) { /* * Yow! The capture header length is claimed not @@ -3327,7 +3326,7 @@ prism_if_print(netdissect_options *ndo, return caplen; } - msgcode = EXTRACT_BE_32BITS(p); + msgcode = EXTRACT_BE_U_4(p); if (msgcode == WLANCAP_MAGIC_COOKIE_V1 || msgcode == WLANCAP_MAGIC_COOKIE_V2) return ieee802_11_avs_radio_print(ndo, p, length, caplen); diff --git a/print-802_15_4.c b/print-802_15_4.c index 781360b9..8db4a213 100644 --- a/print-802_15_4.c +++ b/print-802_15_4.c @@ -77,8 +77,8 @@ ieee802_15_4_if_print(netdissect_options *ndo, } hdrlen = 3; - fc = EXTRACT_LE_16BITS(p); - seq = EXTRACT_8BITS(p + 2); + fc = EXTRACT_LE_U_2(p); + seq = EXTRACT_U_1(p + 2); p += 3; caplen -= 3; @@ -113,7 +113,7 @@ ieee802_15_4_if_print(netdissect_options *ndo, ND_PRINT((ndo, "[|802.15.4]")); return hdrlen; } - panid = EXTRACT_LE_16BITS(p); + panid = EXTRACT_LE_U_2(p); p += 2; caplen -= 2; hdrlen += 2; @@ -122,7 +122,7 @@ ieee802_15_4_if_print(netdissect_options *ndo, return hdrlen; } if (ndo->ndo_vflag) - ND_PRINT((ndo,"%04x:%04x ", panid, EXTRACT_LE_16BITS(p))); + ND_PRINT((ndo,"%04x:%04x ", panid, EXTRACT_LE_U_2(p))); p += 2; caplen -= 2; hdrlen += 2; @@ -132,7 +132,7 @@ ieee802_15_4_if_print(netdissect_options *ndo, ND_PRINT((ndo, "[|802.15.4]")); return hdrlen; } - panid = EXTRACT_LE_16BITS(p); + panid = EXTRACT_LE_U_2(p); p += 2; caplen -= 2; hdrlen += 2; @@ -173,7 +173,7 @@ ieee802_15_4_if_print(netdissect_options *ndo, ND_PRINT((ndo, "[|802.15.4]")); return hdrlen; } - panid = EXTRACT_LE_16BITS(p); + panid = EXTRACT_LE_U_2(p); p += 2; caplen -= 2; hdrlen += 2; @@ -183,7 +183,7 @@ ieee802_15_4_if_print(netdissect_options *ndo, return hdrlen; } if (ndo->ndo_vflag) - ND_PRINT((ndo,"%04x:%04x ", panid, EXTRACT_LE_16BITS(p))); + ND_PRINT((ndo,"%04x:%04x ", panid, EXTRACT_LE_U_2(p))); p += 2; caplen -= 2; hdrlen += 2; @@ -199,7 +199,7 @@ ieee802_15_4_if_print(netdissect_options *ndo, ND_PRINT((ndo, "[|802.15.4]")); return hdrlen; } - panid = EXTRACT_LE_16BITS(p); + panid = EXTRACT_LE_U_2(p); p += 2; caplen -= 2; hdrlen += 2; @@ -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_BE_32BITS(&ah->ah_spi))); + ND_PRINT((ndo, "AH(spi=0x%08x", EXTRACT_BE_U_4(&ah->ah_spi))); if (ndo->ndo_vflag) ND_PRINT((ndo, ",sumlen=%d", sumlen)); ND_TCHECK_4(ah + 1); - ND_PRINT((ndo, ",seq=0x%x", EXTRACT_BE_32BITS(ah + 1))); + ND_PRINT((ndo, ",seq=0x%x", EXTRACT_BE_U_4(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 e8b9d327..5fb049e5 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_BE_32BITS(cp); + t = EXTRACT_BE_U_4(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_BE_32BITS(cp))); + ND_PRINT((ndo, ": %us", EXTRACT_BE_U_4(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_BE_16BITS(cp); + body_len = EXTRACT_BE_U_2(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_BE_32BITS(cp))); + ND_PRINT((ndo, ", Nonce 0x%08x", EXTRACT_BE_U_4(cp))); cp += 4; /* Source Id */ ND_TCHECK2(*cp, 8); diff --git a/print-aodv.c b/print-aodv.c index 4e4501b5..61a9f0b9 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_BE_32BITS(&ah->interval))); + (unsigned long) EXTRACT_BE_U_4(&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_BE_32BITS(&ap->rreq_id), + (unsigned long) EXTRACT_BE_U_4(&ap->rreq_id), ipaddr_string(ndo, &ap->rreq_da), - (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_ds), + (unsigned long) EXTRACT_BE_U_4(&ap->rreq_ds), ipaddr_string(ndo, &ap->rreq_oa), - (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_os))); + (unsigned long) EXTRACT_BE_U_4(&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_BE_32BITS(&ap->rrep_ds), + (unsigned long) EXTRACT_BE_U_4(&ap->rrep_ds), ipaddr_string(ndo, &ap->rrep_oa), - (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_life))); + (unsigned long) EXTRACT_BE_U_4(&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_BE_32BITS(&dp->u_ds))); + (unsigned long) EXTRACT_BE_U_4(&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_BE_32BITS(&ap->rreq_id), + (unsigned long) EXTRACT_BE_U_4(&ap->rreq_id), ip6addr_string(ndo, &ap->rreq_da), - (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_ds), + (unsigned long) EXTRACT_BE_U_4(&ap->rreq_ds), ip6addr_string(ndo, &ap->rreq_oa), - (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_os))); + (unsigned long) EXTRACT_BE_U_4(&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_BE_32BITS(&ap->rrep_ds), + (unsigned long) EXTRACT_BE_U_4(&ap->rrep_ds), ip6addr_string(ndo, &ap->rrep_oa), - (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_life))); + (unsigned long) EXTRACT_BE_U_4(&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_BE_32BITS(&dp6->u_ds))); + (unsigned long) EXTRACT_BE_U_4(&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_BE_32BITS(&ap->rreq_id), + (unsigned long) EXTRACT_BE_U_4(&ap->rreq_id), ip6addr_string(ndo, &ap->rreq_da), - (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_ds), + (unsigned long) EXTRACT_BE_U_4(&ap->rreq_ds), ip6addr_string(ndo, &ap->rreq_oa), - (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_os))); + (unsigned long) EXTRACT_BE_U_4(&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_BE_32BITS(&ap->rrep_ds), + (unsigned long) EXTRACT_BE_U_4(&ap->rrep_ds), ip6addr_string(ndo, &ap->rrep_oa), - (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_life))); + (unsigned long) EXTRACT_BE_U_4(&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_BE_32BITS(&dp6->u_ds))); + (unsigned long) EXTRACT_BE_U_4(&dp6->u_ds))); dp6++; i -= sizeof(*dp6); } diff --git a/print-aoe.c b/print-aoe.c index a5878ea7..2c97bfd6 100644 --- a/print-aoe.c +++ b/print-aoe.c @@ -149,7 +149,7 @@ aoev1_issue_print(netdissect_options *ndo, goto invalid; /* AFlags */ ND_TCHECK2(*cp, 1); - ND_PRINT((ndo, "\n\tAFlags: [%s]", bittok2str(aoev1_aflag_str, "none", EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, "\n\tAFlags: [%s]", bittok2str(aoev1_aflag_str, "none", EXTRACT_U_1(cp)))); cp += 1; /* Err/Feature */ ND_TCHECK2(*cp, 1); @@ -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_BE_16BITS(cp))); + ND_PRINT((ndo, "\n\tBuffer Count: %u", EXTRACT_BE_U_2(cp))); cp += 2; /* Firmware Version */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", Firmware Version: %u", EXTRACT_BE_16BITS(cp))); + ND_PRINT((ndo, ", Firmware Version: %u", EXTRACT_BE_U_2(cp))); cp += 2; /* Sector Count */ ND_TCHECK2(*cp, 1); @@ -226,12 +226,12 @@ aoev1_query_print(netdissect_options *ndo, cp += 1; /* AoE/CCmd */ ND_TCHECK2(*cp, 1); - ND_PRINT((ndo, ", AoE: %u, CCmd: %s", (EXTRACT_8BITS(cp) & 0xF0) >> 4, - tok2str(aoev1_ccmd_str, "Unknown (0x02x)", EXTRACT_8BITS(cp) & 0x0F))); + ND_PRINT((ndo, ", AoE: %u, CCmd: %s", (EXTRACT_U_1(cp) & 0xF0) >> 4, + tok2str(aoev1_ccmd_str, "Unknown (0x02x)", EXTRACT_U_1(cp) & 0x0F))); cp += 1; /* Config String Length */ ND_TCHECK2(*cp, 2); - cslen = EXTRACT_BE_16BITS(cp); + cslen = EXTRACT_BE_U_2(cp); cp += 2; if (cslen > AOEV1_MAX_CONFSTR_LEN || AOEV1_QUERY_ARG_LEN + cslen > len) goto invalid; @@ -266,11 +266,11 @@ aoev1_mac_print(netdissect_options *ndo, cp += 1; /* MCmd */ ND_TCHECK2(*cp, 1); - ND_PRINT((ndo, "\n\tMCmd: %s", tok2str(aoev1_mcmd_str, "Unknown (0x%02x)", EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, "\n\tMCmd: %s", tok2str(aoev1_mcmd_str, "Unknown (0x%02x)", EXTRACT_U_1(cp)))); cp += 1; /* MError */ ND_TCHECK2(*cp, 1); - ND_PRINT((ndo, ", MError: %s", tok2str(aoev1_merror_str, "Unknown (0x%02x)", EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, ", MError: %s", tok2str(aoev1_merror_str, "Unknown (0x%02x)", EXTRACT_U_1(cp)))); cp += 1; /* Dir Count */ ND_TCHECK2(*cp, 1); @@ -286,7 +286,7 @@ aoev1_mac_print(netdissect_options *ndo, cp += 1; /* DCmd */ ND_TCHECK2(*cp, 1); - ND_PRINT((ndo, "\n\t DCmd: %s", tok2str(aoev1_dcmd_str, "Unknown (0x%02x)", EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, "\n\t DCmd: %s", tok2str(aoev1_dcmd_str, "Unknown (0x%02x)", EXTRACT_U_1(cp)))); cp += 1; /* Ethernet Address */ ND_TCHECK2(*cp, ETHER_ADDR_LEN); @@ -314,7 +314,7 @@ aoev1_reserve_print(netdissect_options *ndo, goto invalid; /* RCmd */ ND_TCHECK2(*cp, 1); - ND_PRINT((ndo, "\n\tRCmd: %s", tok2str(aoev1_rcmd_str, "Unknown (0x%02x)", EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, "\n\tRCmd: %s", tok2str(aoev1_rcmd_str, "Unknown (0x%02x)", EXTRACT_U_1(cp)))); cp += 1; /* NMacs (correlated with the length) */ ND_TCHECK2(*cp, 1); @@ -350,7 +350,7 @@ aoev1_print(netdissect_options *ndo, if (len < AOEV1_COMMON_HDR_LEN) goto invalid; /* Flags */ - flags = EXTRACT_8BITS(cp) & 0x0F; + flags = EXTRACT_U_1(cp) & 0x0F; ND_PRINT((ndo, ", Flags: [%s]", bittok2str(aoev1_flag_str, "none", flags))); cp += 1; if (! ndo->ndo_vflag) @@ -358,11 +358,11 @@ aoev1_print(netdissect_options *ndo, /* Error */ ND_TCHECK2(*cp, 1); if (flags & AOEV1_FLAG_E) - ND_PRINT((ndo, "\n\tError: %s", tok2str(aoev1_errcode_str, "Invalid (%u)", EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, "\n\tError: %s", tok2str(aoev1_errcode_str, "Invalid (%u)", EXTRACT_U_1(cp)))); cp += 1; /* Major */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, "\n\tMajor: 0x%04x", EXTRACT_BE_16BITS(cp))); + ND_PRINT((ndo, "\n\tMajor: 0x%04x", EXTRACT_BE_U_2(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_BE_32BITS(cp))); + ND_PRINT((ndo, ", Tag: 0x%08x", EXTRACT_BE_U_4(cp))); cp += 4; /* Arg */ cmd_decoder = @@ -409,7 +409,7 @@ aoe_print(netdissect_options *ndo, goto invalid; /* Ver/Flags */ ND_TCHECK2(*cp, 1); - ver = (EXTRACT_8BITS(cp) & 0xF0) >> 4; + ver = (EXTRACT_U_1(cp) & 0xF0) >> 4; /* Don't advance cp yet: low order 4 bits are version-specific. */ ND_PRINT((ndo, ", Ver %u", ver)); diff --git a/print-ap1394.c b/print-ap1394.c index 69fe2c1c..869fbcb9 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_BE_16BITS(&fp->firewire_type); + firewire_type = EXTRACT_BE_U_2(&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_BE_16BITS(&fp->firewire_type); + ether_type = EXTRACT_BE_U_2(&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 321bb6a6..36801bfa 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_BE_16BITS(&ap->arc_seqid2); + seqid = EXTRACT_BE_U_2(&ap->arc_seqid2); archdrlen = ARC_HDRNEWLEN_EXC; } else { flag = ap->arc_flag; - seqid = EXTRACT_BE_16BITS(&ap->arc_seqid); + seqid = EXTRACT_BE_U_2(&ap->arc_seqid); archdrlen = ARC_HDRNEWLEN; } } diff --git a/print-arp.c b/print-arp.c index 69a86ce2..7c57870a 100644 --- a/print-arp.c +++ b/print-arp.c @@ -86,11 +86,11 @@ struct arp_pkthdr { #define ARP_HDRLEN 8 -#define HRD(ap) EXTRACT_BE_16BITS(&(ap)->ar_hrd) +#define HRD(ap) EXTRACT_BE_U_2(&(ap)->ar_hrd) #define HRD_LEN(ap) ((ap)->ar_hln) #define PROTO_LEN(ap) ((ap)->ar_pln) -#define OP(ap) EXTRACT_BE_16BITS(&(ap)->ar_op) -#define PRO(ap) EXTRACT_BE_16BITS(&(ap)->ar_pro) +#define OP(ap) EXTRACT_BE_U_2(&(ap)->ar_op) +#define PRO(ap) EXTRACT_BE_U_2(&(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_BE_16BITS(&(ap)->aar_hrd) +#define ATMHRD(ap) EXTRACT_BE_U_2(&(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_BE_16BITS(&(ap)->aar_op) -#define ATMPRO(ap) EXTRACT_BE_16BITS(&(ap)->aar_pro) +#define ATMOP(ap) EXTRACT_BE_U_2(&(ap)->aar_op) +#define ATMPRO(ap) EXTRACT_BE_U_2(&(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 cf93b7e8..2f6242cf 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_BE_16BITS(&dp->srcNet); + snet = EXTRACT_BE_U_2(&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_BE_16BITS(&dp->dstNet), dp->dstNode), + ataddr_string(ndo, EXTRACT_BE_U_2(&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_BE_16BITS(&dp->srcNet); + snet = EXTRACT_BE_U_2(&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_BE_16BITS(&dp->dstNet), dp->dstNode), + ataddr_string(ndo, EXTRACT_BE_U_2(&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_BE_16BITS(&ap->htype) == 1 && - EXTRACT_BE_16BITS(&ap->ptype) == ETHERTYPE_ATALK && + if (EXTRACT_BE_U_2(&ap->htype) == 1 && + EXTRACT_BE_U_2(&ap->ptype) == ETHERTYPE_ATALK && ap->halen == 6 && ap->palen == 4 ) - switch (EXTRACT_BE_16BITS(&ap->op)) { + switch (EXTRACT_BE_U_2(&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_BE_16BITS(&ap->op), EXTRACT_BE_16BITS(&ap->htype), - EXTRACT_BE_16BITS(&ap->ptype), ap->halen, ap->palen)); + length, EXTRACT_BE_U_2(&ap->op), EXTRACT_BE_U_2(&ap->htype), + EXTRACT_BE_U_2(&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_BE_16BITS(&ap->transID))); + EXTRACT_BE_U_2(&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_BE_16BITS(&ap->transID), ap->bitmap, length)); + EXTRACT_BE_U_2(&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_BE_16BITS(&ap->transID))); + ND_PRINT((ndo, " atp-rel %d", EXTRACT_BE_U_2(&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_BE_16BITS(&ap->transID), length)); + EXTRACT_BE_U_2(&ap->transID), length)); break; } - data = EXTRACT_BE_32BITS(&ap->userData); + data = EXTRACT_BE_U_4(&ap->userData); if (data != 0) ND_PRINT((ndo, " 0x%x", data)); } @@ -448,10 +448,10 @@ 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_BE_16BITS(&tp->net) != snet || + if (EXTRACT_BE_U_2(&tp->net) != snet || tp->node != snode || tp->skt != skt) ND_PRINT((ndo, " [addr=%s.%d]", - ataddr_string(ndo, EXTRACT_BE_16BITS(&tp->net), + ataddr_string(ndo, EXTRACT_BE_U_2(&tp->net), tp->node), tp->skt)); break; @@ -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_BE_16BITS(&tp->net) != snet || tp->node != snode) + if (EXTRACT_BE_U_2(&tp->net) != snet || tp->node != snode) ND_PRINT((ndo, " [addr=%s]", - ataddr_string(ndo, EXTRACT_BE_16BITS(&tp->net), tp->node))); + ataddr_string(ndo, EXTRACT_BE_U_2(&tp->net), tp->node))); return (tpn); } diff --git a/print-atm.c b/print-atm.c index 5da96cd5..03c77d45 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_BE_24BITS(p); + llchdr = EXTRACT_BE_U_3(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_BE_32BITS(p), - EXTRACT_BE_32BITS(p + 4), - EXTRACT_BE_32BITS(p + 8), - EXTRACT_BE_32BITS(p + 12))); + EXTRACT_BE_U_4(p), + EXTRACT_BE_U_4(p + 4), + EXTRACT_BE_U_4(p + 8), + EXTRACT_BE_U_4(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_BE_24BITS(p + CALL_REF_POS); + call_ref = EXTRACT_BE_U_3(p + CALL_REF_POS); ND_PRINT((ndo, "CALL_REF:0x%06x", call_ref)); } else { /* SSCOP with some unknown protocol atop it */ @@ -461,9 +461,9 @@ oam_print (netdissect_options *ndo, ND_TCHECK(*(p+ATM_HDR_LEN_NOHEC+hec)); - cell_header = EXTRACT_BE_32BITS(p + hec); - cell_type = (EXTRACT_8BITS((p + ATM_HDR_LEN_NOHEC + hec)) >> 4) & 0x0f; - func_type = EXTRACT_8BITS((p + ATM_HDR_LEN_NOHEC + hec)) & 0x0f; + cell_header = EXTRACT_BE_U_4(p + hec); + cell_type = (EXTRACT_U_1((p + ATM_HDR_LEN_NOHEC + hec)) >> 4) & 0x0f; + func_type = EXTRACT_U_1((p + ATM_HDR_LEN_NOHEC + hec)) & 0x0f; vpi = (cell_header>>20)&0xff; vci = (cell_header>>4)&0xffff; @@ -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_BE_32BITS(&oam_ptr.oam_fm_loopback->correlation_tag))); + EXTRACT_BE_U_4(&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_BE_16BITS(&oam_ptr.oam_fm_loopback->loopback_id[idx]))); + ND_PRINT((ndo, "%04x ", EXTRACT_BE_U_2(&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_BE_16BITS(&oam_ptr.oam_fm_loopback->source_id[idx]))); + ND_PRINT((ndo, "%04x ", EXTRACT_BE_U_2(&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_BE_16BITS(&oam_ptr.oam_fm_ais_rdi->failure_location[idx]))); + ND_PRINT((ndo, "%04x ", EXTRACT_BE_U_2(&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_BE_16BITS(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN) + cksum = EXTRACT_BE_U_2(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 3f5c3d16..3a694421 100644 --- a/print-babel.c +++ b/print-babel.c @@ -274,7 +274,7 @@ subtlvs_print(netdissect_options *ndo, uint32_t t1, t2; while (cp < ep) { - subtype = EXTRACT_8BITS(cp); + subtype = EXTRACT_U_1(cp); cp++; if(subtype == MESSAGE_SUB_PAD1) { ND_PRINT((ndo, " sub-pad1")); @@ -282,7 +282,7 @@ subtlvs_print(netdissect_options *ndo, } if(cp == ep) goto invalid; - sublen = EXTRACT_8BITS(cp); + sublen = EXTRACT_U_1(cp); cp++; if(cp + sublen > ep) goto invalid; @@ -300,7 +300,7 @@ subtlvs_print(netdissect_options *ndo, } sep = " "; while(sublen--) { - ND_PRINT((ndo, "%s%s", sep, tok2str(diversity_str, "%u", EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, "%s%s", sep, tok2str(diversity_str, "%u", EXTRACT_U_1(cp)))); cp++; sep = "-"; } @@ -313,14 +313,14 @@ subtlvs_print(netdissect_options *ndo, if(tlv_type == MESSAGE_HELLO) { if(sublen < 4) goto invalid; - t1 = EXTRACT_BE_32BITS(cp); + t1 = EXTRACT_BE_U_4(cp); ND_PRINT((ndo, " %s", format_timestamp(t1))); } else if(tlv_type == MESSAGE_IHU) { if(sublen < 8) goto invalid; - t1 = EXTRACT_BE_32BITS(cp); + t1 = EXTRACT_BE_U_4(cp); ND_PRINT((ndo, " %s", format_timestamp(t1))); - t2 = EXTRACT_BE_32BITS(cp + 4); + t2 = EXTRACT_BE_U_4(cp + 4); ND_PRINT((ndo, "|%s", format_timestamp(t2))); } else ND_PRINT((ndo, " (bogus)")); @@ -353,7 +353,7 @@ babel_print_v2(netdissect_options *ndo, ND_TCHECK2(*cp, 4); if (length < 4) goto invalid; - bodylen = EXTRACT_BE_16BITS(cp + 2); + bodylen = EXTRACT_BE_U_2(cp + 2); ND_PRINT((ndo, " (%u)", bodylen)); /* Process the TLVs in the body */ @@ -394,8 +394,8 @@ babel_print_v2(netdissect_options *ndo, else { ND_PRINT((ndo, "\n\tAcknowledgment Request ")); if(len < 6) goto invalid; - nonce = EXTRACT_BE_16BITS(message + 4); - interval = EXTRACT_BE_16BITS(message + 6); + nonce = EXTRACT_BE_U_2(message + 4); + interval = EXTRACT_BE_U_2(message + 6); ND_PRINT((ndo, "%04x %s", nonce, format_interval(interval))); } } @@ -408,7 +408,7 @@ babel_print_v2(netdissect_options *ndo, else { ND_PRINT((ndo, "\n\tAcknowledgment ")); if(len < 2) goto invalid; - nonce = EXTRACT_BE_16BITS(message + 2); + nonce = EXTRACT_BE_U_2(message + 2); ND_PRINT((ndo, "%04x", nonce)); } } @@ -421,8 +421,8 @@ babel_print_v2(netdissect_options *ndo, else { ND_PRINT((ndo, "\n\tHello ")); if(len < 6) goto invalid; - seqno = EXTRACT_BE_16BITS(message + 4); - interval = EXTRACT_BE_16BITS(message + 6); + seqno = EXTRACT_BE_U_2(message + 4); + interval = EXTRACT_BE_U_2(message + 6); ND_PRINT((ndo, "seqno %u interval %s", seqno, format_interval(interval))); /* Extra data. */ if(len > 6) @@ -440,8 +440,8 @@ babel_print_v2(netdissect_options *ndo, int rc; ND_PRINT((ndo, "\n\tIHU ")); if(len < 6) goto invalid; - txcost = EXTRACT_BE_16BITS(message + 4); - interval = EXTRACT_BE_16BITS(message + 6); + txcost = EXTRACT_BE_U_2(message + 4); + interval = EXTRACT_BE_U_2(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", @@ -503,9 +503,9 @@ babel_print_v2(netdissect_options *ndo, message[2] == 1 ? v4_prefix : v6_prefix, len - 10, prefix); if(rc < 0) goto invalid; - interval = EXTRACT_BE_16BITS(message + 6); - seqno = EXTRACT_BE_16BITS(message + 8); - metric = EXTRACT_BE_16BITS(message + 10); + interval = EXTRACT_BE_U_2(message + 6); + seqno = EXTRACT_BE_U_2(message + 8); + metric = EXTRACT_BE_U_2(message + 10); ND_PRINT((ndo, "%s%s%s %s metric %u seqno %u interval %s", (message[3] & 0x80) ? "/prefix": "", (message[3] & 0x40) ? "/id" : "", @@ -552,7 +552,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_BE_16BITS(message + 4); + seqno = EXTRACT_BE_U_2(message + 4); rc = network_prefix(message[2], message[3], 0, message + 16, NULL, len - 14, prefix); if(rc < 0) goto invalid; @@ -569,8 +569,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_BE_32BITS(message + 4), - EXTRACT_BE_16BITS(message + 2))); + ND_PRINT((ndo, "timestamp %u packetcounter %u", EXTRACT_BE_U_4(message + 4), + EXTRACT_BE_U_2(message + 2))); } break; case MESSAGE_HMAC : { @@ -580,7 +580,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_BE_16BITS(message + 2), len - 2)); + ND_PRINT((ndo, "key-id %u digest-%u ", EXTRACT_BE_U_2(message + 2), len - 2)); for (j = 0; j < len - 2; j++) ND_PRINT((ndo, "%02X", message[4 + j])); } @@ -602,9 +602,9 @@ babel_print_v2(netdissect_options *ndo, src_plen = message[3]; plen = message[4]; omitted = message[5]; - interval = EXTRACT_BE_16BITS(message + 6); - seqno = EXTRACT_BE_16BITS(message + 8); - metric = EXTRACT_BE_16BITS(message + 10); + interval = EXTRACT_BE_U_2(message + 6); + seqno = EXTRACT_BE_U_2(message + 8); + metric = EXTRACT_BE_U_2(message + 10); rc = network_prefix(ae, plen, omitted, message + 2 + parsed_len, ae == 1 ? v4_prefix : v6_prefix, len - parsed_len, prefix); @@ -676,7 +676,7 @@ babel_print_v2(netdissect_options *ndo, if(len < 14) goto invalid; ae = message[2]; plen = message[3]; - seqno = EXTRACT_BE_16BITS(message + 4); + seqno = EXTRACT_BE_U_2(message + 4); hopc = message[6]; src_plen = message[7]; router_id = message + 8; diff --git a/print-bfd.c b/print-bfd.c index 83e53a89..b2cfd61b 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_BE_32BITS(pptr))); + ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_BE_U_4(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_BE_32BITS(pptr))); + ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_BE_U_4(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_BE_32BITS(bfd_header->desired_min_tx_interval)/1000, + bfd_header->detect_time_multiplier * EXTRACT_BE_U_4(bfd_header->desired_min_tx_interval)/1000, bfd_header->length)); - 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)); + ND_PRINT((ndo, "\n\tMy Discriminator: 0x%08x", EXTRACT_BE_U_4(bfd_header->my_discriminator))); + ND_PRINT((ndo, ", Your Discriminator: 0x%08x", EXTRACT_BE_U_4(bfd_header->your_discriminator))); + ND_PRINT((ndo, "\n\t Desired min Tx Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->desired_min_tx_interval)/1000)); + ND_PRINT((ndo, "\n\t Required min Rx Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->required_min_rx_interval)/1000)); + ND_PRINT((ndo, "\n\t Required min Echo Interval: %4u ms", EXTRACT_BE_U_4(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_BE_32BITS(bfd_header->desired_min_tx_interval)/1000, + bfd_header->detect_time_multiplier * EXTRACT_BE_U_4(bfd_header->desired_min_tx_interval)/1000, bfd_header->length)); - 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)); + ND_PRINT((ndo, "\n\tMy Discriminator: 0x%08x", EXTRACT_BE_U_4(bfd_header->my_discriminator))); + ND_PRINT((ndo, ", Your Discriminator: 0x%08x", EXTRACT_BE_U_4(bfd_header->your_discriminator))); + ND_PRINT((ndo, "\n\t Desired min Tx Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->desired_min_tx_interval)/1000)); + ND_PRINT((ndo, "\n\t Required min Rx Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->required_min_rx_interval)/1000)); + ND_PRINT((ndo, "\n\t Required min Echo Interval: %4u ms", EXTRACT_BE_U_4(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 eed258b4..0f56b003 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -106,13 +106,13 @@ struct bgp_route_refresh { uint8_t afi[2]; /* the compiler messes this structure up */ uint8_t res; /* when doing misaligned sequences of int8 and int16 */ uint8_t safi; /* afi should be int16 - so we have to access it using */ -}; /* EXTRACT_16BITS(&bgp_route_refresh->afi) (sigh) */ +}; /* EXTRACT_BE_U_2(&bgp_route_refresh->afi) (sigh) */ #define BGP_ROUTE_REFRESH_SIZE 23 #define bgp_attr_lenlen(flags, p) \ (((flags) & 0x10) ? 2 : 1) #define bgp_attr_len(flags, p) \ - (((flags) & 0x10) ? EXTRACT_BE_16BITS(p) : *(p)) + (((flags) & 0x10) ? EXTRACT_BE_U_2(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_BE_24BITS(pptr + 1)>>4, + EXTRACT_BE_U_3(pptr + 1)>>4, ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); return 4 + plenbytes; @@ -681,7 +681,7 @@ bgp_vpn_sg_print(netdissect_options *ndo, /* Source address length, encoded in bits */ ND_TCHECK_1(pptr); - addr_length = EXTRACT_8BITS(pptr); + addr_length = EXTRACT_U_1(pptr); pptr++; /* Source address */ @@ -696,7 +696,7 @@ bgp_vpn_sg_print(netdissect_options *ndo, /* Group address length, encoded in bits */ ND_TCHECK_1(pptr); - addr_length = EXTRACT_8BITS(pptr); + addr_length = EXTRACT_U_1(pptr); pptr++; /* Group address */ @@ -725,13 +725,13 @@ bgp_vpn_rd_print(netdissect_options *ndo, char *pos = rd; /* ok lets load the RD format */ - switch (EXTRACT_BE_16BITS(pptr)) { + switch (EXTRACT_BE_U_2(pptr)) { /* 2-byte-AS:number fmt*/ case 0: snprintf(pos, sizeof(rd) - (pos - rd), "%u:%u (= %u.%u.%u.%u)", - EXTRACT_BE_16BITS(pptr + 2), - EXTRACT_BE_32BITS(pptr + 4), + EXTRACT_BE_U_2(pptr + 2), + EXTRACT_BE_U_4(pptr + 4), *(pptr+4), *(pptr+5), *(pptr+6), *(pptr+7)); break; /* IP-address:AS fmt*/ @@ -739,15 +739,15 @@ bgp_vpn_rd_print(netdissect_options *ndo, case 1: snprintf(pos, sizeof(rd) - (pos - rd), "%u.%u.%u.%u:%u", *(pptr+2), *(pptr+3), *(pptr+4), *(pptr+5), - EXTRACT_BE_16BITS(pptr + 6)); + EXTRACT_BE_U_2(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_BE_32BITS(pptr + 2)), - EXTRACT_BE_16BITS(pptr + 6), *(pptr+2), *(pptr+3), *(pptr+4), - *(pptr+5), EXTRACT_BE_16BITS(pptr + 6)); + as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_U_4(pptr + 2)), + EXTRACT_BE_U_2(pptr + 6), *(pptr+2), *(pptr+3), *(pptr+4), + *(pptr+5), EXTRACT_BE_U_2(pptr + 6)); break; default: snprintf(pos, sizeof(rd) - (pos - rd), "unknown RD format"); @@ -785,7 +785,7 @@ decode_rt_routing_info(netdissect_options *ndo, /* With at least "origin AS", possibly with "route target". */ ND_TCHECK_4(pptr + 1); - as_printf(ndo, asbuf, sizeof(asbuf), EXTRACT_BE_32BITS(pptr + 1)); + as_printf(ndo, asbuf, sizeof(asbuf), EXTRACT_BE_U_4(pptr + 1)); plen-=32; /* adjust prefix length */ @@ -844,7 +844,7 @@ decode_labeled_vpn_prefix4(netdissect_options *ndo, bgp_vpn_rd_print(ndo, pptr+4), ipaddr_string(ndo, &addr), plen, - EXTRACT_BE_24BITS(pptr + 1)>>4, + EXTRACT_BE_U_3(pptr + 1)>>4, ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); return 12 + (plen + 7) / 8; @@ -876,7 +876,7 @@ decode_mdt_vpn_nlri(netdissect_options *ndo, ND_TCHECK(pptr[0]); /* if the NLRI is not predefined length, quit.*/ - if (EXTRACT_8BITS(pptr) != MDT_VPN_NLRI_LEN * 8) + if (EXTRACT_U_1(pptr) != MDT_VPN_NLRI_LEN * 8) return -1; pptr++; @@ -930,9 +930,9 @@ decode_multicast_vpn(netdissect_options *ndo, u_int offset; ND_TCHECK2(pptr[0], 2); - route_type = EXTRACT_8BITS(pptr); + route_type = EXTRACT_U_1(pptr); pptr++; - route_length = EXTRACT_8BITS(pptr); + route_length = EXTRACT_U_1(pptr); pptr++; snprintf(buf, buflen, "Route-Type: %s (%u), length: %u", @@ -955,7 +955,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_BE_32BITS(pptr + BGP_VPN_RD_LEN))); + EXTRACT_BE_U_4(pptr + BGP_VPN_RD_LEN))); break; case BGP_MULTICAST_VPN_ROUTE_TYPE_S_PMSI: @@ -991,7 +991,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_BE_32BITS(pptr + BGP_VPN_RD_LEN))); + EXTRACT_BE_U_4(pptr + BGP_VPN_RD_LEN))); pptr += BGP_VPN_RD_LEN + 4; bgp_vpn_sg_print(ndo, pptr, buf, buflen); @@ -1038,7 +1038,7 @@ decode_labeled_vpn_l2(netdissect_options *ndo, int plen,tlen,stringlen,tlv_type,tlv_len,ttlv_len; ND_TCHECK_2(pptr); - plen=EXTRACT_BE_16BITS(pptr); + plen=EXTRACT_BE_U_2(pptr); tlen=plen; pptr+=2; /* Old and new L2VPN NLRI share AFI/SAFI @@ -1065,9 +1065,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_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 */ + EXTRACT_BE_U_2(pptr + 8), + EXTRACT_BE_U_2(pptr + 10), + EXTRACT_BE_U_3(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; @@ -1077,9 +1077,9 @@ decode_labeled_vpn_l2(netdissect_options *ndo, if (tlen < 3) return -1; ND_TCHECK2(pptr[0], 3); - tlv_type=EXTRACT_8BITS(pptr); + tlv_type=EXTRACT_U_1(pptr); pptr++; - tlv_len=EXTRACT_BE_16BITS(pptr); + tlv_len=EXTRACT_BE_U_2(pptr); ttlv_len=tlv_len; pptr+=2; @@ -1095,7 +1095,8 @@ decode_labeled_vpn_l2(netdissect_options *ndo, while (ttlv_len>0) { ND_TCHECK(pptr[0]); if (buflen!=0) { - stringlen=snprintf(buf,buflen, "%02x",EXTRACT_8BITS(pptr)); + stringlen=snprintf(buf,buflen, "%02x", + EXTRACT_U_1(pptr)); pptr++; UPDATE_BUF_BUFLEN(buf, buflen, stringlen); } @@ -1191,7 +1192,7 @@ decode_labeled_prefix6(netdissect_options *ndo, snprintf(buf, buflen, "%s/%d, label:%u %s", ip6addr_string(ndo, &addr), plen, - EXTRACT_BE_24BITS(pptr + 1)>>4, + EXTRACT_BE_U_3(pptr + 1)>>4, ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); return 4 + plenbytes; @@ -1233,7 +1234,7 @@ decode_labeled_vpn_prefix6(netdissect_options *ndo, bgp_vpn_rd_print(ndo, pptr+4), ip6addr_string(ndo, &addr), plen, - EXTRACT_BE_24BITS(pptr + 1)>>4, + EXTRACT_BE_U_3(pptr + 1)>>4, ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); return 12 + (plen + 7) / 8; @@ -1302,7 +1303,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_BE_24BITS(pptr + 1)>>4, + EXTRACT_BE_U_3(pptr + 1)>>4, ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); return 12 + (plen + 7) / 8; @@ -1435,8 +1436,8 @@ bgp_attr_print(netdissect_options *ndo, ND_PRINT((ndo, "%s ", as_printf(ndo, astostr, sizeof(astostr), as_size == 2 ? - EXTRACT_BE_16BITS(tptr + i + 2) : - EXTRACT_BE_32BITS(tptr + i + 2)))); + EXTRACT_BE_U_2(tptr + i + 2) : + EXTRACT_BE_U_4(tptr + i + 2)))); } ND_TCHECK(tptr[0]); ND_PRINT((ndo, "%s", tok2str(bgp_as_path_segment_close_values, @@ -1459,7 +1460,7 @@ bgp_attr_print(netdissect_options *ndo, ND_PRINT((ndo, "invalid len")); else { ND_TCHECK_4(tptr); - ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(tptr))); + ND_PRINT((ndo, "%u", EXTRACT_BE_U_4(tptr))); } break; case BGPTYPE_ATOMIC_AGGREGATE: @@ -1479,12 +1480,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_BE_16BITS(tptr)), + as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_U_2(tptr)), ipaddr_string(ndo, tptr + 2))); } else { ND_PRINT((ndo, " AS #%s, origin %s", as_printf(ndo, astostr, sizeof(astostr), - EXTRACT_BE_32BITS(tptr)), ipaddr_string(ndo, tptr + 4))); + EXTRACT_BE_U_4(tptr)), ipaddr_string(ndo, tptr + 4))); } break; case BGPTYPE_AGGREGATOR4: @@ -1494,7 +1495,7 @@ 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_BE_32BITS(tptr)), + as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_U_4(tptr)), ipaddr_string(ndo, tptr + 4))); break; case BGPTYPE_COMMUNITIES: @@ -1505,7 +1506,7 @@ bgp_attr_print(netdissect_options *ndo, while (tlen>0) { uint32_t comm; ND_TCHECK_4(tptr); - comm = EXTRACT_BE_32BITS(tptr); + comm = EXTRACT_BE_U_4(tptr); switch (comm) { case BGP_COMMUNITY_NO_EXPORT: ND_PRINT((ndo, " NO_EXPORT")); @@ -1551,8 +1552,8 @@ bgp_attr_print(netdissect_options *ndo, break; case BGPTYPE_MP_REACH_NLRI: ND_TCHECK2(tptr[0], 3); - af = EXTRACT_BE_16BITS(tptr); - safi = EXTRACT_8BITS(tptr + 2); + af = EXTRACT_BE_U_2(tptr); + safi = EXTRACT_U_1(tptr + 2); ND_PRINT((ndo, "\n\t AFI: %s (%u), %sSAFI: %s (%u)", tok2str(af_values, "Unknown AFI", af), @@ -1710,10 +1711,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_BE_32BITS(tptr + BGP_VPN_RD_LEN) == 0x47000601) + if (EXTRACT_BE_U_4(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_BE_24BITS(tptr + BGP_VPN_RD_LEN) == 0x350000) + else if (EXTRACT_BE_U_3(tptr + BGP_VPN_RD_LEN) == 0x350000) ND_PRINT((ndo, " = %s", ip6addr_string(ndo, tptr+BGP_VPN_RD_LEN+3))); tptr += tlen; tlen = 0; @@ -1902,7 +1903,7 @@ bgp_attr_print(netdissect_options *ndo, case BGPTYPE_MP_UNREACH_NLRI: ND_TCHECK2(tptr[0], BGP_MP_NLRI_MINSIZE); - af = EXTRACT_BE_16BITS(tptr); + af = EXTRACT_BE_U_2(tptr); safi = tptr[2]; ND_PRINT((ndo, "\n\t AFI: %s (%u), %sSAFI: %s (%u)", @@ -2065,7 +2066,7 @@ bgp_attr_print(netdissect_options *ndo, uint16_t extd_comm; ND_TCHECK_2(tptr); - extd_comm=EXTRACT_BE_16BITS(tptr); + extd_comm=EXTRACT_BE_U_2(tptr); ND_PRINT((ndo, "\n\t %s (0x%04x), Flags [%s]", tok2str(bgp_extd_comm_subtype_values, @@ -2080,8 +2081,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_BE_16BITS(tptr + 2), - EXTRACT_BE_32BITS(tptr + 4), + EXTRACT_BE_U_2(tptr + 2), + EXTRACT_BE_U_4(tptr + 4), ipaddr_string(ndo, tptr+4))); break; case BGP_EXT_COM_RT_1: @@ -2090,16 +2091,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_BE_16BITS(tptr + 6))); + EXTRACT_BE_U_2(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_BE_32BITS(tptr + 2)), EXTRACT_BE_16BITS(tptr + 6))); + EXTRACT_BE_U_4(tptr + 2)), EXTRACT_BE_U_2(tptr + 6))); break; case BGP_EXT_COM_LINKBAND: - bw.i = EXTRACT_BE_32BITS(tptr + 2); + bw.i = EXTRACT_BE_U_4(tptr + 2); ND_PRINT((ndo, ": bandwidth: %.3f Mbps", bw.f*8/1000000)); break; @@ -2117,7 +2118,7 @@ bgp_attr_print(netdissect_options *ndo, ipaddr_string(ndo, tptr+2), tok2str(bgp_extd_comm_ospf_rtype_values, "unknown (0x%02x)", - EXTRACT_8BITS((tptr + 6))), + EXTRACT_U_1((tptr + 6))), (*(tptr+7) & BGP_OSPF_RTYPE_METRIC_TYPE) ? "E2" : "", ((*(tptr+6) == BGP_OSPF_RTYPE_EXT) || (*(tptr+6) == BGP_OSPF_RTYPE_NSSA)) ? "E1" : "")); break; @@ -2125,12 +2126,12 @@ bgp_attr_print(netdissect_options *ndo, ND_PRINT((ndo, ": %s Control Flags [0x%02x]:MTU %u", tok2str(l2vpn_encaps_values, "unknown encaps", - EXTRACT_8BITS((tptr + 2))), - EXTRACT_8BITS((tptr + 3)), - EXTRACT_BE_16BITS(tptr + 4))); + EXTRACT_U_1((tptr + 2))), + EXTRACT_U_1((tptr + 3)), + EXTRACT_BE_U_2(tptr + 4))); break; case BGP_EXT_COM_SOURCE_AS: - ND_PRINT((ndo, ": AS %u", EXTRACT_BE_16BITS(tptr + 2))); + ND_PRINT((ndo, ": AS %u", EXTRACT_BE_U_2(tptr + 2))); break; default: ND_TCHECK2(*tptr,8); @@ -2147,15 +2148,15 @@ bgp_attr_print(netdissect_options *ndo, uint8_t tunnel_type, flags; ND_TCHECK2(tptr[0], 5); - flags = EXTRACT_8BITS(tptr); - tunnel_type = EXTRACT_8BITS(tptr+1); + flags = EXTRACT_U_1(tptr); + tunnel_type = EXTRACT_U_1(tptr + 1); tlen = len; ND_PRINT((ndo, "\n\t Tunnel-type %s (%u), Flags [%s], MPLS Label %u", tok2str(bgp_pmsi_tunnel_values, "Unknown", tunnel_type), tunnel_type, bittok2str(bgp_pmsi_flag_values, "none", flags), - EXTRACT_BE_24BITS(tptr + 2)>>4)); + EXTRACT_BE_U_3(tptr + 2)>>4)); tptr +=5; tlen -= 5; @@ -2185,13 +2186,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_BE_32BITS(tptr + 4))); + EXTRACT_BE_U_4(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_BE_32BITS(tptr + 4))); + EXTRACT_BE_U_4(tptr + 4))); break; default: if (ndo->ndo_vflag <= 1) { @@ -2211,8 +2212,8 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK2(tptr[0], 3); - type = EXTRACT_8BITS(tptr); - length = EXTRACT_BE_16BITS(tptr + 1); + type = EXTRACT_U_1(tptr); + length = EXTRACT_BE_U_2(tptr + 1); tptr += 3; tlen -= 3; @@ -2235,7 +2236,7 @@ bgp_attr_print(netdissect_options *ndo, if (length < 8) goto trunc; ND_PRINT((ndo, ", metric %" PRIu64, - EXTRACT_BE_64BITS(tptr))); + EXTRACT_BE_U_8(tptr))); break; default: @@ -2254,7 +2255,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_BE_32BITS(tptr)))); + as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_U_4(tptr)))); tptr+=4; len -=4; @@ -2264,8 +2265,8 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK2(tptr[0], 2); if (len < 2) goto trunc; - aflags = EXTRACT_8BITS(tptr); - atype = EXTRACT_8BITS(tptr + 1); + aflags = EXTRACT_U_1(tptr); + atype = EXTRACT_U_1(tptr + 1); tptr += 2; len -= 2; alenlen = bgp_attr_lenlen(aflags, tptr); @@ -2309,9 +2310,9 @@ bgp_attr_print(netdissect_options *ndo, while (len > 0) { ND_TCHECK2(*tptr, 12); ND_PRINT((ndo, "%u:%u:%u%s", - EXTRACT_BE_32BITS(tptr), - EXTRACT_BE_32BITS(tptr + 4), - EXTRACT_BE_32BITS(tptr + 8), + EXTRACT_BE_U_4(tptr), + EXTRACT_BE_U_4(tptr + 4), + EXTRACT_BE_U_4(tptr + 8), (len > 12) ? ", " : "")); tptr += 12; len -= 12; @@ -2356,8 +2357,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_BE_16BITS(opt + i + 2)), - EXTRACT_BE_16BITS(opt + i + 2), + EXTRACT_BE_U_2(opt + i + 2)), + EXTRACT_BE_U_2(opt + i + 2), tok2str(bgp_safi_values, "Unknown", opt[i+5]), opt[i+5])); @@ -2365,14 +2366,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_BE_16BITS(opt + i + 2)&0xfff)); + EXTRACT_BE_U_2(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_BE_16BITS(opt + i + cap_offset)), - EXTRACT_BE_16BITS(opt + i + cap_offset), + EXTRACT_BE_U_2(opt + i + cap_offset)), + EXTRACT_BE_U_2(opt + i + cap_offset), tok2str(bgp_safi_values,"Unknown", opt[i+cap_offset+2]), opt[i+cap_offset+2], @@ -2392,7 +2393,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_BE_32BITS(opt + i + 2)))); + EXTRACT_BE_U_4(opt + i + 2)))); } break; case BGP_CAPCODE_ADD_PATH: @@ -2407,8 +2408,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_BE_16BITS(opt + i + cap_offset)), - EXTRACT_BE_16BITS(opt + i + cap_offset), + tok2str(af_values,"Unknown",EXTRACT_BE_U_2(opt + i + cap_offset)), + EXTRACT_BE_U_2(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]) @@ -2519,7 +2520,7 @@ bgp_update_print(netdissect_options *ndo, ND_TCHECK_2(p); if (length < 2) goto trunc; - withdrawn_routes_len = EXTRACT_BE_16BITS(p); + withdrawn_routes_len = EXTRACT_BE_U_2(p); p += 2; length -= 2; if (withdrawn_routes_len) { @@ -2539,7 +2540,7 @@ bgp_update_print(netdissect_options *ndo, ND_TCHECK_2(p); if (length < 2) goto trunc; - len = EXTRACT_BE_16BITS(p); + len = EXTRACT_BE_U_2(p); p += 2; length -= 2; @@ -2559,8 +2560,8 @@ bgp_update_print(netdissect_options *ndo, goto trunc; if (length < 2) goto trunc; - aflags = EXTRACT_8BITS(p); - atype = EXTRACT_8BITS(p + 1); + aflags = EXTRACT_U_1(p); + atype = EXTRACT_U_1(p + 1); p += 2; len -= 2; length -= 2; @@ -2702,11 +2703,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_BE_16BITS(tptr)), - EXTRACT_BE_16BITS(tptr), - tok2str(bgp_safi_values, "Unknown", EXTRACT_8BITS((tptr + 2))), - EXTRACT_8BITS((tptr + 2)), - EXTRACT_BE_32BITS(tptr + 3))); + EXTRACT_BE_U_2(tptr)), + EXTRACT_BE_U_2(tptr), + tok2str(bgp_safi_values, "Unknown", EXTRACT_U_1((tptr + 2))), + EXTRACT_U_1((tptr + 2)), + EXTRACT_BE_U_4(tptr + 3))); } /* * draft-ietf-idr-shutdown describes a method to send a communication @@ -2717,7 +2718,7 @@ bgp_notification_print(netdissect_options *ndo, length >= BGP_NOTIFICATION_SIZE + 1) { tptr = dat + BGP_NOTIFICATION_SIZE; ND_TCHECK_1(tptr); - shutdown_comm_length = EXTRACT_8BITS(tptr); + shutdown_comm_length = EXTRACT_U_1(tptr); remainder_offset = 0; /* garbage, hexdump it all */ if (shutdown_comm_length > BGP_NOTIFY_MINOR_CEASE_ADMIN_SHUTDOWN_LEN || @@ -2770,8 +2771,8 @@ bgp_route_refresh_print(netdissect_options *ndo, tok2str(af_values,"Unknown", /* this stinks but the compiler pads the structure * weird */ - EXTRACT_BE_16BITS(&bgp_route_refresh_header->afi)), - EXTRACT_BE_16BITS(&bgp_route_refresh_header->afi), + EXTRACT_BE_U_2(&bgp_route_refresh_header->afi)), + EXTRACT_BE_U_2(&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 ee7f21bf..737c5afc 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_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))); + if (EXTRACT_BE_U_4(&bp->bp_xid)) + ND_PRINT((ndo, ", xid 0x%x", EXTRACT_BE_U_4(&bp->bp_xid))); + if (EXTRACT_BE_U_2(&bp->bp_secs)) + ND_PRINT((ndo, ", secs %d", EXTRACT_BE_U_2(&bp->bp_secs))); ND_TCHECK(bp->bp_flags); ND_PRINT((ndo, ", Flags [%s]", - bittok2str(bootp_flag_values, "none", EXTRACT_BE_16BITS(&bp->bp_flags)))); + bittok2str(bootp_flag_values, "none", EXTRACT_BE_U_2(&bp->bp_flags)))); if (ndo->ndo_vflag > 1) - ND_PRINT((ndo, " (0x%04x)", EXTRACT_BE_16BITS(&bp->bp_flags))); + ND_PRINT((ndo, " (0x%04x)", EXTRACT_BE_U_2(&bp->bp_flags))); /* Client's ip address */ ND_TCHECK(bp->bp_ciaddr); - if (EXTRACT_BE_32BITS(&bp->bp_ciaddr.s_addr)) + if (EXTRACT_BE_U_4(&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_BE_32BITS(&bp->bp_yiaddr.s_addr)) + if (EXTRACT_BE_U_4(&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_BE_32BITS(&bp->bp_siaddr.s_addr)) + if (EXTRACT_BE_U_4(&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_BE_32BITS(&bp->bp_giaddr.s_addr)) + if (EXTRACT_BE_U_4(&bp->bp_giaddr.s_addr)) ND_PRINT((ndo, "\n\t Gateway-IP %s", ipaddr_string(ndo, &bp->bp_giaddr))); /* Client's Ethernet address */ @@ -355,7 +355,7 @@ bootp_print(netdissect_options *ndo, } ND_TCHECK_1(bp->bp_sname); /* check first char only */ - if (EXTRACT_8BITS(bp->bp_sname)) { + if (EXTRACT_U_1(bp->bp_sname)) { ND_PRINT((ndo, "\n\t sname \"")); if (fn_printztn(ndo, bp->bp_sname, (u_int)sizeof bp->bp_sname, ndo->ndo_snapend)) { @@ -366,7 +366,7 @@ bootp_print(netdissect_options *ndo, ND_PRINT((ndo, "\"")); } ND_TCHECK_1(bp->bp_file); /* check first char only */ - if (EXTRACT_8BITS(bp->bp_file)) { + if (EXTRACT_U_1(bp->bp_file)) { ND_PRINT((ndo, "\n\t file \"")); if (fn_printztn(ndo, bp->bp_file, (u_int)sizeof bp->bp_file, ndo->ndo_snapend)) { @@ -388,7 +388,7 @@ bootp_print(netdissect_options *ndo, else { uint32_t ul; - ul = EXTRACT_BE_32BITS(&bp->bp_vend); + ul = EXTRACT_BE_U_4(&bp->bp_vend); if (ul != 0) ND_PRINT((ndo, "\n\t Vendor-#0x%x", ul)); } @@ -607,12 +607,12 @@ 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_BE_32BITS(bp))); + ND_PRINT((ndo, "\n\t Magic Cookie 0x%08x", EXTRACT_BE_U_4(bp))); bp += sizeof(int32_t); /* Loop while we there is a tag left in the buffer */ while (ND_TTEST_1(bp)) { - tag = EXTRACT_8BITS(bp); + tag = EXTRACT_U_1(bp); bp++; if (tag == TAG_PAD && ndo->ndo_vflag < 3) continue; @@ -620,7 +620,7 @@ rfc1048_print(netdissect_options *ndo, return; if (tag == TAG_EXTENDED_OPTION) { ND_TCHECK_2(bp + 1); - tag = EXTRACT_BE_16BITS(bp + 1); + tag = EXTRACT_BE_U_2(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. @@ -635,7 +635,7 @@ rfc1048_print(netdissect_options *ndo, else { /* Get the length; check for truncation */ ND_TCHECK_1(bp); - len = EXTRACT_8BITS(bp); + len = EXTRACT_U_1(bp); bp++; } @@ -645,7 +645,7 @@ rfc1048_print(netdissect_options *ndo, if (tag == TAG_PAD && ndo->ndo_vflag > 2) { u_int ntag = 1; while (ND_TTEST_1(bp) && - EXTRACT_8BITS(bp) == TAG_PAD) { + EXTRACT_U_1(bp) == TAG_PAD) { bp++; ntag++; } @@ -659,7 +659,7 @@ rfc1048_print(netdissect_options *ndo, } if (tag == TAG_DHCP_MESSAGE && len == 1) { - uc = EXTRACT_8BITS(bp); + uc = EXTRACT_U_1(bp); bp++; ND_PRINT((ndo, "%s", tok2str(dhcp_msg_values, "Unknown (%u)", uc))); continue; @@ -668,7 +668,7 @@ rfc1048_print(netdissect_options *ndo, if (tag == TAG_PARM_REQUEST) { idx = 0; while (len-- > 0) { - uc = EXTRACT_8BITS(bp); + uc = EXTRACT_U_1(bp); bp++; cp = tok2str(tag2str, "?Option %u", uc); if (idx % 4 == 0) @@ -685,7 +685,7 @@ rfc1048_print(netdissect_options *ndo, first = 1; while (len > 1) { len -= 2; - us = EXTRACT_BE_16BITS(bp); + us = EXTRACT_BE_U_2(bp); bp += 2; cp = tok2str(xtag2str, "?xT%u", us); if (!first) @@ -728,7 +728,7 @@ rfc1048_print(netdissect_options *ndo, while (len >= sizeof(ul)) { if (!first) ND_PRINT((ndo, ",")); - ul = EXTRACT_BE_32BITS(bp); + ul = EXTRACT_BE_U_4(bp); if (c == 'i') { ul = htonl(ul); ND_PRINT((ndo, "%s", ipaddr_string(ndo, &ul))); @@ -763,7 +763,7 @@ rfc1048_print(netdissect_options *ndo, while (len >= sizeof(us)) { if (!first) ND_PRINT((ndo, ",")); - us = EXTRACT_BE_16BITS(bp); + us = EXTRACT_BE_U_2(bp); ND_PRINT((ndo, "%u", us)); bp += sizeof(us); len -= sizeof(us); @@ -777,7 +777,7 @@ rfc1048_print(netdissect_options *ndo, uint8_t bool_value; if (!first) ND_PRINT((ndo, ",")); - bool_value = EXTRACT_8BITS(bp); + bool_value = EXTRACT_U_1(bp); switch (bool_value) { case 0: ND_PRINT((ndo, "N")); @@ -803,7 +803,7 @@ rfc1048_print(netdissect_options *ndo, uint8_t byte_value; if (!first) ND_PRINT((ndo, c == 'x' ? ":" : ".")); - byte_value = EXTRACT_8BITS(bp); + byte_value = EXTRACT_U_1(bp); if (c == 'x') ND_PRINT((ndo, "%02x", byte_value)); else @@ -824,7 +824,7 @@ rfc1048_print(netdissect_options *ndo, ND_PRINT((ndo, "ERROR: length < 1 bytes")); break; } - tag = EXTRACT_8BITS(bp); + tag = EXTRACT_U_1(bp); ++bp; --len; ND_PRINT((ndo, "%s", tok2str(nbo2str, NULL, tag))); @@ -836,7 +836,7 @@ rfc1048_print(netdissect_options *ndo, ND_PRINT((ndo, "ERROR: length < 1 bytes")); break; } - tag = EXTRACT_8BITS(bp); + tag = EXTRACT_U_1(bp); ++bp; --len; ND_PRINT((ndo, "%s", tok2str(oo2str, NULL, tag))); @@ -850,11 +850,11 @@ rfc1048_print(netdissect_options *ndo, len = 0; break; } - if (EXTRACT_8BITS(bp)) - ND_PRINT((ndo, "[%s] ", client_fqdn_flags(EXTRACT_8BITS(bp)))); + if (EXTRACT_U_1(bp)) + ND_PRINT((ndo, "[%s] ", client_fqdn_flags(EXTRACT_U_1(bp)))); bp++; - if (EXTRACT_8BITS(bp) || EXTRACT_8BITS(bp+1)) - ND_PRINT((ndo, "%u/%u ", EXTRACT_8BITS(bp), EXTRACT_8BITS(bp+1))); + if (EXTRACT_U_1(bp) || EXTRACT_U_1(bp + 1)) + ND_PRINT((ndo, "%u/%u ", EXTRACT_U_1(bp), EXTRACT_U_1(bp + 1))); bp += 2; ND_PRINT((ndo, "\"")); if (fn_printn(ndo, bp, len - 3, ndo->ndo_snapend)) { @@ -875,7 +875,7 @@ rfc1048_print(netdissect_options *ndo, ND_PRINT((ndo, "ERROR: length < 1 bytes")); break; } - type = EXTRACT_8BITS(bp); + type = EXTRACT_U_1(bp); bp++; len--; if (type == 0) { @@ -893,7 +893,7 @@ rfc1048_print(netdissect_options *ndo, while (len > 0) { if (!first) ND_PRINT((ndo, ":")); - ND_PRINT((ndo, "%02x", EXTRACT_8BITS(bp))); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(bp))); ++bp; --len; first = 0; @@ -904,8 +904,8 @@ rfc1048_print(netdissect_options *ndo, case TAG_AGENT_CIRCUIT: while (len >= 2) { - subopt = EXTRACT_8BITS(bp); - suboptlen = EXTRACT_8BITS(bp+1); + subopt = EXTRACT_U_1(bp); + suboptlen = EXTRACT_U_1(bp + 1); bp += 2; len -= 2; if (suboptlen > len) { @@ -954,7 +954,7 @@ rfc1048_print(netdissect_options *ndo, while (len > 0) { if (!first) ND_PRINT((ndo, ",")); - mask_width = EXTRACT_8BITS(bp); + mask_width = EXTRACT_U_1(bp); bp++; len--; /* mask_width <= 32 */ @@ -979,7 +979,7 @@ rfc1048_print(netdissect_options *ndo, for (i = 0; i < significant_octets ; i++) { if (i > 0) ND_PRINT((ndo, ".")); - ND_PRINT((ndo, "%d", EXTRACT_8BITS(bp))); + ND_PRINT((ndo, "%d", EXTRACT_U_1(bp))); bp++; } for (i = significant_octets ; i < 4 ; i++) @@ -1007,7 +1007,7 @@ rfc1048_print(netdissect_options *ndo, break; } while (len > 0) { - suboptlen = EXTRACT_8BITS(bp); + suboptlen = EXTRACT_U_1(bp); bp++; len--; ND_PRINT((ndo, "\n\t ")); @@ -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_BE_32BITS(&hdr->direction)&0x1)?"in":"out")); + ND_PRINT((ndo, "hci length %d, direction %s, ", length, (EXTRACT_BE_U_4(&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 ceed9b0d..9c7ba4ad 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_BE_16BITS(bp + 6))); + EXTRACT_BE_U_2(bp + 6))); } - ND_PRINT((ndo, "counter=%" PRIu64, EXTRACT_BE_64BITS(bp + 8))); + ND_PRINT((ndo, "counter=%" PRIu64, EXTRACT_BE_U_8(bp + 8))); return; trunc: diff --git a/print-cdp.c b/print-cdp.c index 586a5ec8..1db0675d 100644 --- a/print-cdp.c +++ b/print-cdp.c @@ -105,16 +105,16 @@ cdp_print(netdissect_options *ndo, tptr = pptr; /* temporary pointer */ ND_TCHECK2(*tptr, CDP_HEADER_LEN); - ND_PRINT((ndo, "CDPv%u, ttl: %us", EXTRACT_8BITS((tptr + CDP_HEADER_VERSION_OFFSET)), + ND_PRINT((ndo, "CDPv%u, ttl: %us", EXTRACT_U_1((tptr + CDP_HEADER_VERSION_OFFSET)), *(tptr + CDP_HEADER_TTL_OFFSET))); if (ndo->ndo_vflag) - ND_PRINT((ndo, ", checksum: 0x%04x (unverified), length %u", EXTRACT_BE_16BITS(tptr + CDP_HEADER_CHECKSUM_OFFSET), length)); + ND_PRINT((ndo, ", checksum: 0x%04x (unverified), length %u", EXTRACT_BE_U_2(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_BE_16BITS(tptr + CDP_TLV_TYPE_OFFSET); - len = EXTRACT_BE_16BITS(tptr + CDP_TLV_LEN_OFFSET); /* object length includes the 4 bytes header length */ + type = EXTRACT_BE_U_2(tptr + CDP_TLV_TYPE_OFFSET); + len = EXTRACT_BE_U_2(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,13 +164,13 @@ cdp_print(netdissect_options *ndo, if (len < 4) goto trunc; ND_PRINT((ndo, "(0x%08x): %s", - EXTRACT_BE_32BITS(tptr), - bittok2str(cdp_capability_values, "none", EXTRACT_BE_32BITS(tptr)))); + EXTRACT_BE_U_4(tptr), + bittok2str(cdp_capability_values, "none", EXTRACT_BE_U_4(tptr)))); break; case 0x05: /* Version */ ND_PRINT((ndo, "\n\t ")); for (i=0;i<len;i++) { - j = EXTRACT_8BITS(tptr + i); + j = EXTRACT_U_1(tptr + i); if (j == '\n') /* lets rework the version string to get a nice indentation */ 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_BE_16BITS(tptr))); + ND_PRINT((ndo, "%d", EXTRACT_BE_U_2(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", EXTRACT_8BITS((tptr)), EXTRACT_BE_16BITS(tptr + 1))); + ND_PRINT((ndo, "app %d, vlan %d", EXTRACT_U_1((tptr)), EXTRACT_BE_U_2(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_BE_32BITS(tptr))); + ND_PRINT((ndo, "%u bytes", EXTRACT_BE_U_4(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_BE_32BITS(p); + num = EXTRACT_BE_U_4(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_BE_16BITS(p + pl); /* address length */ + al = EXTRACT_BE_U_2(p + pl); /* address length */ if (pt == PT_NLPID && pl == 1 && *p == NLPID_IP && al == 4) { /* @@ -341,9 +341,9 @@ cdp_print_addr(netdissect_options *ndo, ND_TCHECK2(*p, pl); if (p + pl > endp) goto trunc; - ND_PRINT((ndo, "pt=0x%02x, pl=%d, pb=", EXTRACT_8BITS((p - 2)), pl)); + ND_PRINT((ndo, "pt=0x%02x, pl=%d, pb=", EXTRACT_U_1((p - 2)), pl)); while (pl-- > 0) { - ND_PRINT((ndo, " %02x", EXTRACT_8BITS(p))); + ND_PRINT((ndo, " %02x", EXTRACT_U_1(p))); p++; } ND_TCHECK2(*p, 2); @@ -355,7 +355,7 @@ cdp_print_addr(netdissect_options *ndo, if (p + al > endp) goto trunc; while (al-- > 0) { - ND_PRINT((ndo, " %02x", EXTRACT_8BITS(p))); + ND_PRINT((ndo, " %02x", EXTRACT_U_1(p))); p++; } } @@ -400,7 +400,7 @@ static unsigned long cdp_get_number(const u_char * p, int l) unsigned long res=0; while( l>0 ) { - res = (res<<8) + EXTRACT_8BITS(p); + res = (res<<8) + EXTRACT_U_1(p); p++; l--; } return res; diff --git a/print-cfm.c b/print-cfm.c index ebd92c35..e764e1dc 100644 --- a/print-cfm.c +++ b/print-cfm.c @@ -232,7 +232,7 @@ cfm_network_addr_print(netdissect_options *ndo, return hexdump; } /* The calling function must make any due ND_TCHECK calls. */ - network_addr_type = EXTRACT_8BITS(tptr); + network_addr_type = EXTRACT_U_1(tptr); ND_PRINT((ndo, "\n\t Network Address Type %s (%u)", tok2str(af_values, "Unknown", network_addr_type), network_addr_type)); @@ -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_BE_32BITS(msg_ptr.cfm_ccm->sequence), - EXTRACT_BE_16BITS(msg_ptr.cfm_ccm->ma_epi))); + EXTRACT_BE_U_4(msg_ptr.cfm_ccm->sequence), + EXTRACT_BE_U_2(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_BE_32BITS(msg_ptr.cfm_ltm->transaction_id), + EXTRACT_BE_U_4(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_BE_32BITS(msg_ptr.cfm_ltr->transaction_id), + EXTRACT_BE_U_4(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_BE_16BITS(&cfm_tlv_header->length); + cfm_tlv_len=EXTRACT_BE_U_2(&cfm_tlv_header->length); ND_PRINT((ndo, ", length %u", cfm_tlv_len)); @@ -566,8 +566,8 @@ cfm_print(netdissect_options *ndo, return; } ND_PRINT((ndo, ", Status: %s (%u)", - tok2str(cfm_tlv_port_status_values, "Unknown", EXTRACT_8BITS(tptr)), - EXTRACT_8BITS(tptr))); + tok2str(cfm_tlv_port_status_values, "Unknown", EXTRACT_U_1(tptr)), + EXTRACT_U_1(tptr))); break; case CFM_TLV_INTERFACE_STATUS: @@ -576,8 +576,8 @@ cfm_print(netdissect_options *ndo, return; } ND_PRINT((ndo, ", Status: %s (%u)", - tok2str(cfm_tlv_interface_status_values, "Unknown", EXTRACT_8BITS(tptr)), - EXTRACT_8BITS(tptr))); + tok2str(cfm_tlv_interface_status_values, "Unknown", EXTRACT_U_1(tptr)), + EXTRACT_U_1(tptr))); break; case CFM_TLV_PRIVATE: @@ -586,8 +586,8 @@ cfm_print(netdissect_options *ndo, return; } ND_PRINT((ndo, ", Vendor: %s (%u), Sub-Type %u", - tok2str(oui_values,"Unknown", EXTRACT_BE_24BITS(tptr)), - EXTRACT_BE_24BITS(tptr), + tok2str(oui_values,"Unknown", EXTRACT_BE_U_3(tptr)), + EXTRACT_BE_U_3(tptr), *(tptr + 3))); hexdump = TRUE; break; @@ -606,7 +606,7 @@ cfm_print(netdissect_options *ndo, * Get the Chassis ID length and check it. * IEEE 802.1Q-2014 Section 21.5.3.1 */ - chassis_id_length = EXTRACT_8BITS(tptr); + chassis_id_length = EXTRACT_U_1(tptr); tptr++; tlen--; cfm_tlv_len--; @@ -621,7 +621,7 @@ cfm_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t (TLV too short)")); goto next_tlv; } - chassis_id_type = EXTRACT_8BITS(tptr); + chassis_id_type = EXTRACT_U_1(tptr); cfm_tlv_len--; ND_PRINT((ndo, "\n\t Chassis-ID Type %s (%u), Chassis-ID length %u", tok2str(cfm_tlv_senderid_chassisid_values, @@ -680,7 +680,7 @@ cfm_print(netdissect_options *ndo, } /* Here mgmt_addr_length stands for the management domain length. */ - mgmt_addr_length = EXTRACT_8BITS(tptr); + mgmt_addr_length = EXTRACT_U_1(tptr); tptr++; tlen--; cfm_tlv_len--; @@ -710,7 +710,7 @@ cfm_print(netdissect_options *ndo, } /* Here mgmt_addr_length stands for the management address length. */ - mgmt_addr_length = EXTRACT_8BITS(tptr); + mgmt_addr_length = EXTRACT_U_1(tptr); tptr++; tlen--; cfm_tlv_len--; diff --git a/print-chdlc.c b/print-chdlc.c index 2e6481a6..1fdd37b9 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_BE_16BITS(p + 2); + proto = EXTRACT_BE_U_2(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_BE_32BITS(&slarp->code)) { + switch (EXTRACT_BE_U_4(&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_BE_32BITS(&slarp->un.keep.myseq), - EXTRACT_BE_32BITS(&slarp->un.keep.yourseq), - EXTRACT_BE_16BITS(&slarp->un.keep.rel))); + EXTRACT_BE_U_4(&slarp->un.keep.myseq), + EXTRACT_BE_U_4(&slarp->un.keep.yourseq), + EXTRACT_BE_U_2(&slarp->un.keep.rel))); if (length >= SLARP_MAX_LEN) { /* uptime-stamp is optional */ cp += SLARP_MIN_LEN; ND_TCHECK2(*cp, 4); - sec = EXTRACT_BE_32BITS(cp) / 1000; + sec = EXTRACT_BE_U_4(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_BE_32BITS(&slarp->code))); + ND_PRINT((ndo, "0x%02x unknown", EXTRACT_BE_U_4(&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 f58a8c2d..73570d95 100644 --- a/print-cnfp.c +++ b/print-cnfp.c @@ -168,21 +168,21 @@ cnfp_v1_print(netdissect_options *ndo, const u_char *cp) nh = (const struct nfhdr_v1 *)cp; ND_TCHECK(*nh); - ver = EXTRACT_BE_16BITS(&nh->version); - nrecs = EXTRACT_BE_32BITS(&nh->count); + ver = EXTRACT_BE_U_2(&nh->version); + nrecs = EXTRACT_BE_U_4(&nh->count); #if 0 /* * This is seconds since the UN*X epoch, and is followed by * nanoseconds. XXX - format it, rather than just dumping the * raw seconds-since-the-Epoch. */ - t = EXTRACT_32BITS(&nh->utc_sec); + t = EXTRACT_BE_U_4(&nh->utc_sec); #endif ND_PRINT((ndo, "NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver, - 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))); + EXTRACT_BE_U_4(&nh->msys_uptime)/1000, + EXTRACT_BE_U_4(&nh->msys_uptime)%1000, + EXTRACT_BE_U_4(&nh->utc_sec), EXTRACT_BE_U_4(&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_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)); + EXTRACT_BE_U_4(&nr->start_time)/1000, + EXTRACT_BE_U_4(&nr->start_time)%1000, + EXTRACT_BE_U_4(&nr->last_time)/1000, + EXTRACT_BE_U_4(&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_BE_16BITS(&nr->srcport))); + EXTRACT_BE_U_2(&nr->srcport))); ND_PRINT((ndo, "> %s%s%s:%u ", intoa(nr->dst_ina.s_addr), buf, asbuf, - EXTRACT_BE_16BITS(&nr->dstport))); + EXTRACT_BE_U_2(&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_BE_32BITS(&nr->packets), - EXTRACT_BE_32BITS(&nr->octets), buf)); + EXTRACT_BE_U_4(&nr->packets), + EXTRACT_BE_U_4(&nr->octets), buf)); } return; @@ -257,23 +257,23 @@ cnfp_v5_print(netdissect_options *ndo, const u_char *cp) nh = (const struct nfhdr_v5 *)cp; ND_TCHECK(*nh); - ver = EXTRACT_BE_16BITS(&nh->version); - nrecs = EXTRACT_BE_32BITS(&nh->count); + ver = EXTRACT_BE_U_2(&nh->version); + nrecs = EXTRACT_BE_U_4(&nh->count); #if 0 /* * This is seconds since the UN*X epoch, and is followed by * nanoseconds. XXX - format it, rather than just dumping the * raw seconds-since-the-Epoch. */ - t = EXTRACT_32BITS(&nh->utc_sec); + t = EXTRACT_BE_U_4(&nh->utc_sec); #endif ND_PRINT((ndo, "NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver, - 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))); + EXTRACT_BE_U_4(&nh->msys_uptime)/1000, + EXTRACT_BE_U_4(&nh->msys_uptime)%1000, + EXTRACT_BE_U_4(&nh->utc_sec), EXTRACT_BE_U_4(&nh->utc_nsec))); - ND_PRINT((ndo, "#%u, ", EXTRACT_BE_32BITS(&nh->sequence))); + ND_PRINT((ndo, "#%u, ", EXTRACT_BE_U_4(&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_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)); + EXTRACT_BE_U_4(&nr->start_time)/1000, + EXTRACT_BE_U_4(&nr->start_time)%1000, + EXTRACT_BE_U_4(&nr->last_time)/1000, + EXTRACT_BE_U_4(&nr->last_time)%1000)); asbuf[0] = buf[0] = '\0'; snprintf(buf, sizeof(buf), "/%u", nr->src_mask); snprintf(asbuf, sizeof(asbuf), ":%u", - EXTRACT_BE_16BITS(&nr->src_as)); + EXTRACT_BE_U_2(&nr->src_as)); ND_PRINT((ndo, "\n %s%s%s:%u ", intoa(nr->src_ina.s_addr), buf, asbuf, - EXTRACT_BE_16BITS(&nr->srcport))); + EXTRACT_BE_U_2(&nr->srcport))); snprintf(buf, sizeof(buf), "/%d", nr->dst_mask); snprintf(asbuf, sizeof(asbuf), ":%u", - EXTRACT_BE_16BITS(&nr->dst_as)); + EXTRACT_BE_U_2(&nr->dst_as)); ND_PRINT((ndo, "> %s%s%s:%u ", intoa(nr->dst_ina.s_addr), buf, asbuf, - EXTRACT_BE_16BITS(&nr->dstport))); + EXTRACT_BE_U_2(&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_BE_32BITS(&nr->packets), - EXTRACT_BE_32BITS(&nr->octets), buf)); + EXTRACT_BE_U_4(&nr->packets), + EXTRACT_BE_U_4(&nr->octets), buf)); } return; @@ -353,23 +353,23 @@ cnfp_v6_print(netdissect_options *ndo, const u_char *cp) nh = (const struct nfhdr_v6 *)cp; ND_TCHECK(*nh); - ver = EXTRACT_BE_16BITS(&nh->version); - nrecs = EXTRACT_BE_32BITS(&nh->count); + ver = EXTRACT_BE_U_2(&nh->version); + nrecs = EXTRACT_BE_U_4(&nh->count); #if 0 /* * This is seconds since the UN*X epoch, and is followed by * nanoseconds. XXX - format it, rather than just dumping the * raw seconds-since-the-Epoch. */ - t = EXTRACT_32BITS(&nh->utc_sec); + t = EXTRACT_BE_U_4(&nh->utc_sec); #endif ND_PRINT((ndo, "NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver, - 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))); + EXTRACT_BE_U_4(&nh->msys_uptime)/1000, + EXTRACT_BE_U_4(&nh->msys_uptime)%1000, + EXTRACT_BE_U_4(&nh->utc_sec), EXTRACT_BE_U_4(&nh->utc_nsec))); - ND_PRINT((ndo, "#%u, ", EXTRACT_BE_32BITS(&nh->sequence))); + ND_PRINT((ndo, "#%u, ", EXTRACT_BE_U_4(&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_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)); + EXTRACT_BE_U_4(&nr->start_time)/1000, + EXTRACT_BE_U_4(&nr->start_time)%1000, + EXTRACT_BE_U_4(&nr->last_time)/1000, + EXTRACT_BE_U_4(&nr->last_time)%1000)); asbuf[0] = buf[0] = '\0'; snprintf(buf, sizeof(buf), "/%u", nr->src_mask); snprintf(asbuf, sizeof(asbuf), ":%u", - EXTRACT_BE_16BITS(&nr->src_as)); + EXTRACT_BE_U_2(&nr->src_as)); ND_PRINT((ndo, "\n %s%s%s:%u ", intoa(nr->src_ina.s_addr), buf, asbuf, - EXTRACT_BE_16BITS(&nr->srcport))); + EXTRACT_BE_U_2(&nr->srcport))); snprintf(buf, sizeof(buf), "/%d", nr->dst_mask); snprintf(asbuf, sizeof(asbuf), ":%u", - EXTRACT_BE_16BITS(&nr->dst_as)); + EXTRACT_BE_U_2(&nr->dst_as)); ND_PRINT((ndo, "> %s%s%s:%u ", intoa(nr->dst_ina.s_addr), buf, asbuf, - EXTRACT_BE_16BITS(&nr->dstport))); + EXTRACT_BE_U_2(&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_BE_16BITS(&nr->flags) >> 8) & 0xff, - (EXTRACT_BE_16BITS(&nr->flags)) & 0xff); + (EXTRACT_BE_U_2(&nr->flags) >> 8) & 0xff, + (EXTRACT_BE_U_2(&nr->flags)) & 0xff); ND_PRINT((ndo, "tos %u, %u (%u octets) %s", nr->tos, - EXTRACT_BE_32BITS(&nr->packets), - EXTRACT_BE_32BITS(&nr->octets), buf)); + EXTRACT_BE_U_4(&nr->packets), + EXTRACT_BE_U_4(&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_BE_16BITS(cp); + ver = EXTRACT_BE_U_2(cp); switch (ver) { case 1: diff --git a/print-dccp.c b/print-dccp.c index 7f7f8127..0d58d439 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_BE_48BITS(dhx->dccph_seq); + seqno = EXTRACT_BE_U_6(dhx->dccph_seq); } else { - seqno = EXTRACT_BE_24BITS(dh->dccph_seq); + seqno = EXTRACT_BE_U_3(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_BE_48BITS(ackp + 2); + ackno = EXTRACT_BE_U_6(ackp + 2); } else { ND_TCHECK2(*ackp, 4); - ackno = EXTRACT_BE_24BITS(ackp + 1); + ackno = EXTRACT_BE_U_3(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_BE_16BITS(&dh->dccph_sport); - dport = EXTRACT_BE_16BITS(&dh->dccph_dport); + sport = EXTRACT_BE_U_2(&dh->dccph_sport); + dport = EXTRACT_BE_U_2(&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_BE_16BITS(&dh->dccph_checksum); + dccp_sum = EXTRACT_BE_U_2(&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_BE_32BITS(&dhr->dccph_req_service))); + EXTRACT_BE_U_4(&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_BE_32BITS(&dhr->dccph_resp_service))); + EXTRACT_BE_U_4(&dhr->dccph_resp_service))); break; } case DCCP_PKT_DATA: @@ -539,13 +539,13 @@ static int dccp_print_option(netdissect_options *ndo, const u_char *option, u_in if (*option >= 32) { ND_TCHECK(*(option+1)); - optlen = EXTRACT_8BITS(option + 1); + optlen = EXTRACT_U_1(option + 1); if (optlen < 2) { if (*option >= 128) ND_PRINT((ndo, "CCID option %u optlen too short", *option)); else ND_PRINT((ndo, "%s optlen too short", - tok2str(dccp_option_values, "Option %u", EXTRACT_8BITS(option)))); + tok2str(dccp_option_values, "Option %u", EXTRACT_U_1(option)))); return 0; } } else @@ -557,7 +557,7 @@ static int dccp_print_option(netdissect_options *ndo, const u_char *option, u_in *option)); else ND_PRINT((ndo, "%s optlen goes past header length", - tok2str(dccp_option_values, "Option %u", EXTRACT_8BITS(option)))); + tok2str(dccp_option_values, "Option %u", EXTRACT_U_1(option)))); return 0; } ND_TCHECK2(*option, optlen); @@ -566,16 +566,16 @@ 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_BE_16BITS(option + 2))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_2(option + 2))); break; case 6: - ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(option + 2))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(option + 2))); break; default: break; } } else { - ND_PRINT((ndo, "%s", tok2str(dccp_option_values, "Option %u", EXTRACT_8BITS(option)))); + ND_PRINT((ndo, "%s", tok2str(dccp_option_values, "Option %u", EXTRACT_U_1(option)))); switch (*option) { case 32: case 33: @@ -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_BE_32BITS(option + 2))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(option + 2))); else ND_PRINT((ndo, " optlen != 4")); break; case 42: if (optlen == 4) - ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(option + 2))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(option + 2))); else ND_PRINT((ndo, " optlen != 4")); break; case 43: if (optlen == 6) - ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(option + 2))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(option + 2))); else if (optlen == 4) - ND_PRINT((ndo, " %u", EXTRACT_BE_16BITS(option + 2))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_2(option + 2))); else ND_PRINT((ndo, " optlen != 4 or 6")); break; diff --git a/print-decnet.c b/print-decnet.c index ad0b478f..563b1eb4 100644 --- a/print-decnet.c +++ b/print-decnet.c @@ -513,7 +513,7 @@ decnet_print(netdissect_options *ndo, } ND_TCHECK2(*ap, sizeof(short)); - pktlen = EXTRACT_LE_16BITS(ap); + pktlen = EXTRACT_LE_U_2(ap); if (pktlen < sizeof(struct shorthdr)) { ND_PRINT((ndo, "%s", tstr)); return; @@ -526,7 +526,7 @@ decnet_print(netdissect_options *ndo, rhp = (const union routehdr *)&(ap[sizeof(short)]); ND_TCHECK(rhp->rh_short.sh_flags); - mflags = EXTRACT_8BITS(rhp->rh_short.sh_flags); + mflags = EXTRACT_U_1(rhp->rh_short.sh_flags); if (mflags & RMF_PAD) { /* pad bytes of some sort in front of message */ @@ -543,7 +543,7 @@ decnet_print(netdissect_options *ndo, caplen -= padlen; rhp = (const union routehdr *)&(ap[sizeof(short)]); ND_TCHECK(rhp->rh_short.sh_flags); - mflags = EXTRACT_8BITS(rhp->rh_short.sh_flags); + mflags = EXTRACT_U_1(rhp->rh_short.sh_flags); } if (mflags & RMF_FVER) { @@ -567,18 +567,18 @@ decnet_print(netdissect_options *ndo, } ND_TCHECK(rhp->rh_long); dst = - EXTRACT_LE_16BITS(rhp->rh_long.lg_dst.dne_remote.dne_nodeaddr); + EXTRACT_LE_U_2(rhp->rh_long.lg_dst.dne_remote.dne_nodeaddr); src = - EXTRACT_LE_16BITS(rhp->rh_long.lg_src.dne_remote.dne_nodeaddr); - hops = EXTRACT_8BITS(rhp->rh_long.lg_visits); + EXTRACT_LE_U_2(rhp->rh_long.lg_src.dne_remote.dne_nodeaddr); + hops = EXTRACT_U_1(rhp->rh_long.lg_visits); nspp = &(ap[sizeof(short) + sizeof(struct longhdr)]); nsplen = length - sizeof(struct longhdr); break; case RMF_SHORT: ND_TCHECK(rhp->rh_short); - dst = EXTRACT_LE_16BITS(rhp->rh_short.sh_dst); - src = EXTRACT_LE_16BITS(rhp->rh_short.sh_src); - hops = (EXTRACT_8BITS(rhp->rh_short.sh_visits) & VIS_MASK)+1; + dst = EXTRACT_LE_U_2(rhp->rh_short.sh_dst); + src = EXTRACT_LE_U_2(rhp->rh_short.sh_src); + hops = (EXTRACT_U_1(rhp->rh_short.sh_visits) & VIS_MASK)+1; nspp = &(ap[sizeof(short) + sizeof(struct shorthdr)]); nsplen = length - sizeof(struct shorthdr); break; @@ -615,7 +615,7 @@ print_decnet_ctlmsg(netdissect_options *ndo, u_int caplen) { /* Our caller has already checked for mflags */ - int mflags = EXTRACT_8BITS(rhp->rh_short.sh_flags); + int mflags = EXTRACT_U_1(rhp->rh_short.sh_flags); register const union controlmsg *cmp = (const union controlmsg *)rhp; int src, dst, info, blksize, eco, ueco, hello, other, vers; etheraddr srcea, rtea; @@ -629,13 +629,13 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct initmsg)) goto trunc; ND_TCHECK(cmp->cm_init); - src = EXTRACT_LE_16BITS(cmp->cm_init.in_src); - info = EXTRACT_8BITS(cmp->cm_init.in_info); - blksize = EXTRACT_LE_16BITS(cmp->cm_init.in_blksize); - vers = EXTRACT_8BITS(cmp->cm_init.in_vers); - eco = EXTRACT_8BITS(cmp->cm_init.in_eco); - ueco = EXTRACT_8BITS(cmp->cm_init.in_ueco); - hello = EXTRACT_LE_16BITS(cmp->cm_init.in_hello); + src = EXTRACT_LE_U_2(cmp->cm_init.in_src); + info = EXTRACT_U_1(cmp->cm_init.in_info); + blksize = EXTRACT_LE_U_2(cmp->cm_init.in_blksize); + vers = EXTRACT_U_1(cmp->cm_init.in_vers); + eco = EXTRACT_U_1(cmp->cm_init.in_eco); + ueco = EXTRACT_U_1(cmp->cm_init.in_ueco); + hello = EXTRACT_LE_U_2(cmp->cm_init.in_hello); print_t_info(ndo, info); ND_PRINT((ndo, "src %sblksize %d vers %d eco %d ueco %d hello %d", @@ -648,8 +648,8 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct verifmsg)) goto trunc; ND_TCHECK(cmp->cm_ver); - src = EXTRACT_LE_16BITS(cmp->cm_ver.ve_src); - other = EXTRACT_8BITS(cmp->cm_ver.ve_fcnval); + src = EXTRACT_LE_U_2(cmp->cm_ver.ve_src); + other = EXTRACT_U_1(cmp->cm_ver.ve_fcnval); ND_PRINT((ndo, "src %s fcnval %o", dnaddr_string(ndo, src), other)); ret = 1; break; @@ -658,8 +658,8 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct testmsg)) goto trunc; ND_TCHECK(cmp->cm_test); - src = EXTRACT_LE_16BITS(cmp->cm_test.te_src); - other = EXTRACT_8BITS(cmp->cm_test.te_data); + src = EXTRACT_LE_U_2(cmp->cm_test.te_src); + other = EXTRACT_U_1(cmp->cm_test.te_data); ND_PRINT((ndo, "src %s data %o", dnaddr_string(ndo, src), other)); ret = 1; break; @@ -668,7 +668,7 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct l1rout)) goto trunc; ND_TCHECK(cmp->cm_l1rou); - src = EXTRACT_LE_16BITS(cmp->cm_l1rou.r1_src); + src = EXTRACT_LE_U_2(cmp->cm_l1rou.r1_src); ND_PRINT((ndo, "src %s ", dnaddr_string(ndo, src))); ret = print_l1_routes(ndo, &(rhpx[sizeof(struct l1rout)]), length - sizeof(struct l1rout)); @@ -678,7 +678,7 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct l2rout)) goto trunc; ND_TCHECK(cmp->cm_l2rout); - src = EXTRACT_LE_16BITS(cmp->cm_l2rout.r2_src); + src = EXTRACT_LE_U_2(cmp->cm_l2rout.r2_src); ND_PRINT((ndo, "src %s ", dnaddr_string(ndo, src))); ret = print_l2_routes(ndo, &(rhpx[sizeof(struct l2rout)]), length - sizeof(struct l2rout)); @@ -688,16 +688,16 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct rhellomsg)) goto trunc; ND_TCHECK(cmp->cm_rhello); - vers = EXTRACT_8BITS(cmp->cm_rhello.rh_vers); - eco = EXTRACT_8BITS(cmp->cm_rhello.rh_eco); - ueco = EXTRACT_8BITS(cmp->cm_rhello.rh_ueco); + vers = EXTRACT_U_1(cmp->cm_rhello.rh_vers); + eco = EXTRACT_U_1(cmp->cm_rhello.rh_eco); + ueco = EXTRACT_U_1(cmp->cm_rhello.rh_ueco); memcpy((char *)&srcea, (const char *)&(cmp->cm_rhello.rh_src), sizeof(srcea)); - src = EXTRACT_LE_16BITS(srcea.dne_remote.dne_nodeaddr); - info = EXTRACT_8BITS(cmp->cm_rhello.rh_info); - blksize = EXTRACT_LE_16BITS(cmp->cm_rhello.rh_blksize); - priority = EXTRACT_8BITS(cmp->cm_rhello.rh_priority); - hello = EXTRACT_LE_16BITS(cmp->cm_rhello.rh_hello); + src = EXTRACT_LE_U_2(srcea.dne_remote.dne_nodeaddr); + info = EXTRACT_U_1(cmp->cm_rhello.rh_info); + blksize = EXTRACT_LE_U_2(cmp->cm_rhello.rh_blksize); + priority = EXTRACT_U_1(cmp->cm_rhello.rh_priority); + hello = EXTRACT_LE_U_2(cmp->cm_rhello.rh_hello); print_i_info(ndo, info); ND_PRINT((ndo, "vers %d eco %d ueco %d src %s blksize %d pri %d hello %d", @@ -711,20 +711,20 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct ehellomsg)) goto trunc; ND_TCHECK(cmp->cm_ehello); - vers = EXTRACT_8BITS(cmp->cm_ehello.eh_vers); - eco = EXTRACT_8BITS(cmp->cm_ehello.eh_eco); - ueco = EXTRACT_8BITS(cmp->cm_ehello.eh_ueco); + vers = EXTRACT_U_1(cmp->cm_ehello.eh_vers); + eco = EXTRACT_U_1(cmp->cm_ehello.eh_eco); + ueco = EXTRACT_U_1(cmp->cm_ehello.eh_ueco); memcpy((char *)&srcea, (const char *)&(cmp->cm_ehello.eh_src), sizeof(srcea)); - src = EXTRACT_LE_16BITS(srcea.dne_remote.dne_nodeaddr); - info = EXTRACT_8BITS(cmp->cm_ehello.eh_info); - blksize = EXTRACT_LE_16BITS(cmp->cm_ehello.eh_blksize); + src = EXTRACT_LE_U_2(srcea.dne_remote.dne_nodeaddr); + info = EXTRACT_U_1(cmp->cm_ehello.eh_info); + blksize = EXTRACT_LE_U_2(cmp->cm_ehello.eh_blksize); /*seed*/ memcpy((char *)&rtea, (const char *)&(cmp->cm_ehello.eh_router), sizeof(rtea)); - dst = EXTRACT_LE_16BITS(rtea.dne_remote.dne_nodeaddr); - hello = EXTRACT_LE_16BITS(cmp->cm_ehello.eh_hello); - other = EXTRACT_8BITS(cmp->cm_ehello.eh_data); + dst = EXTRACT_LE_U_2(rtea.dne_remote.dne_nodeaddr); + hello = EXTRACT_LE_U_2(cmp->cm_ehello.eh_hello); + other = EXTRACT_U_1(cmp->cm_ehello.eh_data); print_i_info(ndo, info); ND_PRINT((ndo, "vers %d eco %d ueco %d src %s blksize %d rtr %s hello %d data %o", @@ -773,15 +773,15 @@ print_l1_routes(netdissect_options *ndo, /* The last short is a checksum */ while (len > (3 * sizeof(short))) { ND_TCHECK2(*rp, 3 * sizeof(short)); - count = EXTRACT_LE_16BITS(rp); + count = EXTRACT_LE_U_2(rp); if (count > 1024) return (1); /* seems to be bogus from here on */ rp += sizeof(short); len -= sizeof(short); - id = EXTRACT_LE_16BITS(rp); + id = EXTRACT_LE_U_2(rp); rp += sizeof(short); len -= sizeof(short); - info = EXTRACT_LE_16BITS(rp); + info = EXTRACT_LE_U_2(rp); rp += sizeof(short); len -= sizeof(short); ND_PRINT((ndo, "{ids %d-%d cost %d hops %d} ", id, id + count, @@ -804,15 +804,15 @@ print_l2_routes(netdissect_options *ndo, /* The last short is a checksum */ while (len > (3 * sizeof(short))) { ND_TCHECK2(*rp, 3 * sizeof(short)); - count = EXTRACT_LE_16BITS(rp); + count = EXTRACT_LE_U_2(rp); if (count > 1024) return (1); /* seems to be bogus from here on */ rp += sizeof(short); len -= sizeof(short); - area = EXTRACT_LE_16BITS(rp); + area = EXTRACT_LE_U_2(rp); rp += sizeof(short); len -= sizeof(short); - info = EXTRACT_LE_16BITS(rp); + info = EXTRACT_LE_U_2(rp); rp += sizeof(short); len -= sizeof(short); ND_PRINT((ndo, "{areas %d-%d cost %d hops %d} ", area, area + count, @@ -860,9 +860,9 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct nsphdr)) goto trunc; ND_TCHECK(*nsphp); - flags = EXTRACT_8BITS(nsphp->nh_flags); - dst = EXTRACT_LE_16BITS(nsphp->nh_dst); - src = EXTRACT_LE_16BITS(nsphp->nh_src); + flags = EXTRACT_U_1(nsphp->nh_flags); + dst = EXTRACT_LE_U_2(nsphp->nh_dst); + src = EXTRACT_LE_U_2(nsphp->nh_src); switch (flags & NSP_TYPEMASK) { case MFT_DATA: @@ -880,7 +880,7 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK(shp->sh_seq[0]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[0]); + ack = EXTRACT_LE_U_2(shp->sh_seq[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) ND_PRINT((ndo, "nak %d ", ack & SGQ_MASK)); @@ -890,7 +890,7 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK(shp->sh_seq[1]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[1]); + ack = EXTRACT_LE_U_2(shp->sh_seq[1]); if (ack & SGQ_OACK) { /* ackoth field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) ND_PRINT((ndo, "onak %d ", ack & SGQ_MASK)); @@ -900,7 +900,7 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK(shp->sh_seq[2]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[2]); + ack = EXTRACT_LE_U_2(shp->sh_seq[2]); } } ND_PRINT((ndo, "seg %d ", ack & SGQ_MASK)); @@ -916,7 +916,7 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK(shp->sh_seq[0]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[0]); + ack = EXTRACT_LE_U_2(shp->sh_seq[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) ND_PRINT((ndo, "nak %d ", ack & SGQ_MASK)); @@ -926,7 +926,7 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK(shp->sh_seq[1]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[1]); + ack = EXTRACT_LE_U_2(shp->sh_seq[1]); if (ack & SGQ_OACK) { /* ackdat field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) ND_PRINT((ndo, "nakdat %d ", ack & SGQ_MASK)); @@ -936,7 +936,7 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK(shp->sh_seq[2]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[2]); + ack = EXTRACT_LE_U_2(shp->sh_seq[2]); } } ND_PRINT((ndo, "seg %d ", ack & SGQ_MASK)); @@ -954,27 +954,27 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct seghdr) + sizeof(struct lsmsg)) goto trunc; ND_TCHECK(shp->sh_seq[0]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[0]); + ack = EXTRACT_LE_U_2(shp->sh_seq[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) ND_PRINT((ndo, "nak %d ", ack & SGQ_MASK)); else ND_PRINT((ndo, "ack %d ", ack & SGQ_MASK)); ND_TCHECK(shp->sh_seq[1]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[1]); + ack = EXTRACT_LE_U_2(shp->sh_seq[1]); if (ack & SGQ_OACK) { /* ackdat field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) ND_PRINT((ndo, "nakdat %d ", ack & SGQ_MASK)); else ND_PRINT((ndo, "ackdat %d ", ack & SGQ_MASK)); ND_TCHECK(shp->sh_seq[2]); - ack = EXTRACT_LE_16BITS(shp->sh_seq[2]); + ack = EXTRACT_LE_U_2(shp->sh_seq[2]); } } ND_PRINT((ndo, "seg %d ", ack & SGQ_MASK)); ND_TCHECK(*lsmp); - lsflags = EXTRACT_8BITS(lsmp->ls_lsflags); - fcval = EXTRACT_8BITS(lsmp->ls_fcval); + lsflags = EXTRACT_U_1(lsmp->ls_lsflags); + fcval = EXTRACT_U_1(lsmp->ls_fcval); switch (lsflags & LSI_MASK) { case LSI_DATA: ND_PRINT((ndo, "dat seg count %d ", fcval)); @@ -1017,13 +1017,13 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct ackmsg)) goto trunc; ND_TCHECK(*amp); - ack = EXTRACT_LE_16BITS(amp->ak_acknum[0]); + ack = EXTRACT_LE_U_2(amp->ak_acknum[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) ND_PRINT((ndo, "nak %d ", ack & SGQ_MASK)); else ND_PRINT((ndo, "ack %d ", ack & SGQ_MASK)); - ack = EXTRACT_LE_16BITS(amp->ak_acknum[1]); + ack = EXTRACT_LE_U_2(amp->ak_acknum[1]); if (ack & SGQ_OACK) { /* ackoth field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) ND_PRINT((ndo, "onak %d ", ack & SGQ_MASK)); @@ -1042,14 +1042,14 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct ackmsg)) goto trunc; ND_TCHECK(*amp); - ack = EXTRACT_LE_16BITS(amp->ak_acknum[0]); + ack = EXTRACT_LE_U_2(amp->ak_acknum[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) ND_PRINT((ndo, "nak %d ", ack & SGQ_MASK)); else ND_PRINT((ndo, "ack %d ", ack & SGQ_MASK)); ND_TCHECK(amp->ak_acknum[1]); - ack = EXTRACT_LE_16BITS(amp->ak_acknum[1]); + ack = EXTRACT_LE_U_2(amp->ak_acknum[1]); if (ack & SGQ_OACK) { /* ackdat field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) ND_PRINT((ndo, "nakdat %d ", ack & SGQ_MASK)); @@ -1083,9 +1083,9 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct cimsg)) goto trunc; ND_TCHECK(*cimp); - services = EXTRACT_8BITS(cimp->ci_services); - info = EXTRACT_8BITS(cimp->ci_info); - segsize = EXTRACT_LE_16BITS(cimp->ci_segsize); + services = EXTRACT_U_1(cimp->ci_services); + info = EXTRACT_U_1(cimp->ci_info); + segsize = EXTRACT_LE_U_2(cimp->ci_segsize); switch (services & COS_MASK) { case COS_NONE: @@ -1124,10 +1124,10 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct ccmsg)) goto trunc; ND_TCHECK(*ccmp); - services = EXTRACT_8BITS(ccmp->cc_services); - info = EXTRACT_8BITS(ccmp->cc_info); - segsize = EXTRACT_LE_16BITS(ccmp->cc_segsize); - optlen = EXTRACT_8BITS(ccmp->cc_optlen); + services = EXTRACT_U_1(ccmp->cc_services); + info = EXTRACT_U_1(ccmp->cc_info); + segsize = EXTRACT_LE_U_2(ccmp->cc_segsize); + optlen = EXTRACT_U_1(ccmp->cc_optlen); switch (services & COS_MASK) { case COS_NONE: @@ -1169,8 +1169,8 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct dimsg)) goto trunc; ND_TCHECK(*dimp); - reason = EXTRACT_LE_16BITS(dimp->di_reason); - optlen = EXTRACT_8BITS(dimp->di_optlen); + reason = EXTRACT_LE_U_2(dimp->di_reason); + optlen = EXTRACT_U_1(dimp->di_optlen); print_reason(ndo, reason); if (optlen) { @@ -1185,7 +1185,7 @@ print_nsp(netdissect_options *ndo, int reason; ND_TCHECK(*dcmp); - reason = EXTRACT_LE_16BITS(dcmp->dc_reason); + reason = EXTRACT_LE_U_2(dcmp->dc_reason); print_reason(ndo, reason); } diff --git a/print-dhcp6.c b/print-dhcp6.c index 92ca980c..e2caa58a 100644 --- a/print-dhcp6.c +++ b/print-dhcp6.c @@ -303,10 +303,10 @@ dhcp6opt_print(netdissect_options *ndo, goto trunc; dh6o = (const struct dhcp6opt *)cp; ND_TCHECK(*dh6o); - optlen = EXTRACT_BE_16BITS(&dh6o->dh6opt_len); + optlen = EXTRACT_BE_U_2(&dh6o->dh6opt_len); if (ep < cp + sizeof(*dh6o) + optlen) goto trunc; - opttype = EXTRACT_BE_16BITS(&dh6o->dh6opt_type); + opttype = EXTRACT_BE_U_2(&dh6o->dh6opt_type); ND_PRINT((ndo, " (%s", tok2str(dh6opt_str, "opt_%u", opttype))); ND_TCHECK2(*(cp + sizeof(*dh6o)), optlen); switch (opttype) { @@ -318,12 +318,12 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - switch (EXTRACT_BE_16BITS(tp)) { + switch (EXTRACT_BE_U_2(tp)) { case 1: if (optlen >= 2 + 6) { ND_PRINT((ndo, " hwaddr/time type %u time %u ", - EXTRACT_BE_16BITS(tp + 2), - EXTRACT_BE_32BITS(tp + 4))); + EXTRACT_BE_U_2(tp + 2), + EXTRACT_BE_U_4(tp + 4))); for (i = 8; i < optlen; i++) ND_PRINT((ndo, "%02x", tp[i])); /*(*/ @@ -348,7 +348,7 @@ dhcp6opt_print(netdissect_options *ndo, case 3: if (optlen >= 2 + 2) { ND_PRINT((ndo, " hwaddr type %u ", - EXTRACT_BE_16BITS(tp + 2))); + EXTRACT_BE_U_2(tp + 2))); for (i = 4; i < optlen; i++) ND_PRINT((ndo, "%02x", tp[i])); /*(*/ @@ -359,7 +359,7 @@ dhcp6opt_print(netdissect_options *ndo, } break; default: - ND_PRINT((ndo, " type %d)", EXTRACT_BE_16BITS(tp))); + ND_PRINT((ndo, " type %d)", EXTRACT_BE_U_2(tp))); break; } break; @@ -372,8 +372,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_BE_32BITS(tp + 16), - EXTRACT_BE_32BITS(tp + 20))); + EXTRACT_BE_U_4(tp + 16), + EXTRACT_BE_U_4(tp + 20))); if (optlen > 24) { /* there are sub-options */ dhcp6opt_print(ndo, tp + 24, tp + optlen); @@ -389,7 +389,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_BE_16BITS(tp + i)))); + tok2str(dh6opt_str, "opt_%u", EXTRACT_BE_U_2(tp + i)))); } ND_PRINT((ndo, ")")); break; @@ -399,7 +399,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT((ndo, " %d)", EXTRACT_8BITS(tp))); + ND_PRINT((ndo, " %d)", EXTRACT_U_1(tp))); break; case DH6OPT_ELAPSED_TIME: if (optlen != 2) { @@ -407,7 +407,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT((ndo, " %d)", EXTRACT_BE_16BITS(tp))); + ND_PRINT((ndo, " %d)", EXTRACT_BE_U_2(tp))); break; case DH6OPT_RELAY_MSG: ND_PRINT((ndo, " (")); @@ -421,7 +421,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - auth_proto = EXTRACT_8BITS(tp); + auth_proto = EXTRACT_U_1(tp); switch (auth_proto) { case DH6OPT_AUTHPROTO_DELAYED: ND_PRINT((ndo, " proto: delayed")); @@ -434,7 +434,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp++; - auth_alg = EXTRACT_8BITS(tp); + auth_alg = EXTRACT_U_1(tp); switch (auth_alg) { case DH6OPT_AUTHALG_HMACMD5: /* XXX: may depend on the protocol */ @@ -445,7 +445,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp++; - auth_rdm = EXTRACT_8BITS(tp); + auth_rdm = EXTRACT_U_1(tp); switch (auth_rdm) { case DH6OPT_AUTHRDM_MONOCOUNTER: ND_PRINT((ndo, ", RDM: mono")); @@ -457,7 +457,7 @@ dhcp6opt_print(netdissect_options *ndo, tp++; ND_PRINT((ndo, ", RD:")); for (i = 0; i < 4; i++, tp += 2) - ND_PRINT((ndo, " %04x", EXTRACT_BE_16BITS(tp))); + ND_PRINT((ndo, " %04x", EXTRACT_BE_U_2(tp))); /* protocol dependent part */ authinfolen = optlen - 11; @@ -474,19 +474,19 @@ dhcp6opt_print(netdissect_options *ndo, ND_PRINT((ndo, ", realm: ")); } for (i = 0; i < authrealmlen; i++, tp++) - ND_PRINT((ndo, "%02x", EXTRACT_8BITS(tp))); - ND_PRINT((ndo, ", key ID: %08x", EXTRACT_BE_32BITS(tp))); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(tp))); + ND_PRINT((ndo, ", key ID: %08x", EXTRACT_BE_U_4(tp))); tp += 4; ND_PRINT((ndo, ", HMAC-MD5:")); for (i = 0; i < 4; i++, tp+= 4) - ND_PRINT((ndo, " %08x", EXTRACT_BE_32BITS(tp))); + ND_PRINT((ndo, " %08x", EXTRACT_BE_U_4(tp))); break; case DH6OPT_AUTHPROTO_RECONFIG: if (authinfolen != 17) { ND_PRINT((ndo, " ??")); break; } - switch (EXTRACT_8BITS(tp)) { + switch (EXTRACT_U_1(tp)) { case DH6OPT_AUTHRECONFIG_KEY: ND_PRINT((ndo, " reconfig-key")); break; @@ -500,7 +500,7 @@ dhcp6opt_print(netdissect_options *ndo, tp++; ND_PRINT((ndo, " value:")); for (i = 0; i < 4; i++, tp+= 4) - ND_PRINT((ndo, " %08x", EXTRACT_BE_32BITS(tp))); + ND_PRINT((ndo, " %08x", EXTRACT_BE_U_4(tp))); break; default: ND_PRINT((ndo, " ??")); @@ -530,7 +530,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - dh6_reconf_type = EXTRACT_8BITS(tp); + dh6_reconf_type = EXTRACT_U_1(tp); switch (dh6_reconf_type) { case DH6_RENEW: ND_PRINT((ndo, " for renew)")); @@ -579,7 +579,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT((ndo, " %s)", dhcp6stcode(EXTRACT_BE_16BITS(tp)))); + ND_PRINT((ndo, " %s)", dhcp6stcode(EXTRACT_BE_U_2(tp)))); break; case DH6OPT_IA_NA: case DH6OPT_IA_PD: @@ -589,9 +589,9 @@ dhcp6opt_print(netdissect_options *ndo, } tp = (const u_char *)(dh6o + 1); ND_PRINT((ndo, " IAID:%u T1:%u T2:%u", - EXTRACT_BE_32BITS(tp), - EXTRACT_BE_32BITS(tp + 4), - EXTRACT_BE_32BITS(tp + 8))); + EXTRACT_BE_U_4(tp), + EXTRACT_BE_U_4(tp + 4), + EXTRACT_BE_U_4(tp + 8))); if (optlen > 12) { /* there are sub-options */ dhcp6opt_print(ndo, tp + 12, tp + optlen); @@ -604,7 +604,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT((ndo, " IAID:%u", EXTRACT_BE_32BITS(tp))); + ND_PRINT((ndo, " IAID:%u", EXTRACT_BE_U_4(tp))); if (optlen > 4) { /* there are sub-options */ dhcp6opt_print(ndo, tp + 4, tp + optlen); @@ -619,8 +619,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_BE_32BITS(tp), - EXTRACT_BE_32BITS(tp + 4))); + EXTRACT_BE_U_4(tp), + EXTRACT_BE_U_4(tp + 4))); if (optlen > 25) { /* there are sub-options */ dhcp6opt_print(ndo, tp + 25, tp + optlen); @@ -634,7 +634,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT((ndo, " %d)", EXTRACT_BE_32BITS(tp))); + ND_PRINT((ndo, " %d)", EXTRACT_BE_U_4(tp))); break; case DH6OPT_REMOTE_ID: if (optlen < 4) { @@ -642,7 +642,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT((ndo, " %d ", EXTRACT_BE_32BITS(tp))); + ND_PRINT((ndo, " %d ", EXTRACT_BE_U_4(tp))); /* * Print hex dump first 10 characters. */ @@ -656,7 +656,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - dh6_lq_query_type = EXTRACT_8BITS(tp); + dh6_lq_query_type = EXTRACT_U_1(tp); switch (dh6_lq_query_type) { case 1: ND_PRINT((ndo, " by-address")); @@ -704,9 +704,9 @@ dhcp6opt_print(netdissect_options *ndo, } tp = (const u_char *)(dh6o + 1); while (tp < cp + sizeof(*dh6o) + optlen - 4) { - subopt_code = EXTRACT_BE_16BITS(tp); + subopt_code = EXTRACT_BE_U_2(tp); tp += 2; - subopt_len = EXTRACT_BE_16BITS(tp); + subopt_len = EXTRACT_BE_U_2(tp); tp += 2; if (tp + subopt_len > cp + sizeof(*dh6o) + optlen) goto trunc; @@ -742,14 +742,14 @@ dhcp6opt_print(netdissect_options *ndo, remain_len = optlen; ND_PRINT((ndo, " ")); /* Encoding is described in section 3.1 of RFC 1035 */ - while (remain_len && EXTRACT_8BITS(tp)) { - label_len = EXTRACT_8BITS(tp); + while (remain_len && EXTRACT_U_1(tp)) { + label_len = EXTRACT_U_1(tp); tp++; if (label_len < remain_len - 1) { (void)fn_printn(ndo, tp, label_len, NULL); tp += label_len; remain_len -= (label_len + 1); - if(EXTRACT_8BITS(tp)) ND_PRINT((ndo, ".")); + if(EXTRACT_U_1(tp)) ND_PRINT((ndo, ".")); } else { ND_PRINT((ndo, " ?")); break; @@ -817,7 +817,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_BE_32BITS(&dh6->dh6_xid) & DH6_XIDMASK)); + ND_PRINT((ndo, "xid=%x", EXTRACT_BE_U_4(&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 40179293..95301a9f 100644 --- a/print-domain.c +++ b/print-domain.c @@ -58,7 +58,7 @@ ns_nskip(netdissect_options *ndo, if (!ND_TTEST_1(cp)) return (NULL); - i = EXTRACT_8BITS(cp); + i = EXTRACT_U_1(cp); cp++; while (i) { if ((i & INDIR_MASK) == INDIR_MASK) @@ -70,7 +70,7 @@ ns_nskip(netdissect_options *ndo, return(NULL); /* unknown ELT */ if (!ND_TTEST_1(cp)) return (NULL); - if ((bitlen = EXTRACT_8BITS(cp)) == 0) + if ((bitlen = EXTRACT_U_1(cp)) == 0) bitlen = 256; cp++; bytelen = (bitlen + 7) / 8; @@ -79,7 +79,7 @@ ns_nskip(netdissect_options *ndo, cp += i; if (!ND_TTEST_1(cp)) return (NULL); - i = EXTRACT_8BITS(cp); + i = EXTRACT_U_1(cp); cp++; } return (cp); @@ -96,7 +96,7 @@ blabel_print(netdissect_options *ndo, if (!ND_TTEST_1(cp)) return(NULL); - if ((bitlen = EXTRACT_8BITS(cp)) == 0) + if ((bitlen = EXTRACT_U_1(cp)) == 0) bitlen = 256; slen = (bitlen + 3) / 4; lim = cp + 1 + slen; @@ -109,12 +109,12 @@ blabel_print(netdissect_options *ndo, } if (b > 4) { ND_TCHECK(*bitp); - tc = EXTRACT_8BITS(bitp); + tc = EXTRACT_U_1(bitp); bitp++; ND_PRINT((ndo, "%02x", tc & (0xff << (8 - b)))); } else if (b > 0) { ND_TCHECK(*bitp); - tc = EXTRACT_8BITS(bitp); + tc = EXTRACT_U_1(bitp); bitp++; ND_PRINT((ndo, "%1x", ((tc >> 4) & 0x0f) & (0x0f << (4 - b)))); } @@ -133,7 +133,7 @@ labellen(netdissect_options *ndo, if (!ND_TTEST_1(cp)) return(-1); - i = EXTRACT_8BITS(cp); + i = EXTRACT_U_1(cp); if ((i & INDIR_MASK) == EDNS0_MASK) { int bitlen, elt; if ((elt = (i & ~INDIR_MASK)) != EDNS0_ELT_BITLABEL) { @@ -142,7 +142,7 @@ labellen(netdissect_options *ndo, } if (!ND_TTEST_1(cp + 1)) return(-1); - if ((bitlen = EXTRACT_8BITS(cp + 1)) == 0) + if ((bitlen = EXTRACT_U_1(cp + 1)) == 0) bitlen = 256; return(((bitlen + 7) / 8) + 1); } else @@ -164,7 +164,7 @@ ns_nprint(netdissect_options *ndo, if (!ND_TTEST_1(cp)) return(NULL); max_offset = (u_int)(cp - bp); - i = EXTRACT_8BITS(cp); + i = EXTRACT_U_1(cp); cp++; if ((i & INDIR_MASK) != INDIR_MASK) { compress = 0; @@ -180,7 +180,7 @@ ns_nprint(netdissect_options *ndo, } if (!ND_TTEST_1(cp)) return(NULL); - offset = (((i << 8) | EXTRACT_8BITS(cp)) & 0x3fff); + offset = (((i << 8) | EXTRACT_U_1(cp)) & 0x3fff); /* * This must move backwards in the packet. * No RFC explicitly says that, but BIND's @@ -201,7 +201,7 @@ ns_nprint(netdissect_options *ndo, return(NULL); if (!ND_TTEST_1(cp)) return(NULL); - i = EXTRACT_8BITS(cp); + i = EXTRACT_U_1(cp); cp++; continue; } @@ -228,7 +228,7 @@ ns_nprint(netdissect_options *ndo, return(NULL); if (!ND_TTEST_1(cp)) return(NULL); - i = EXTRACT_8BITS(cp); + i = EXTRACT_U_1(cp); cp++; if (!compress) rp += l + 1; @@ -247,7 +247,7 @@ ns_cprint(netdissect_options *ndo, if (!ND_TTEST_1(cp)) return (NULL); - i = EXTRACT_8BITS(cp); + i = EXTRACT_U_1(cp); cp++; if (fn_printn(ndo, cp, i, ndo->ndo_snapend)) return (NULL); @@ -342,11 +342,11 @@ ns_qprint(netdissect_options *ndo, return(NULL); /* print the qtype */ - i = EXTRACT_BE_16BITS(cp); + i = EXTRACT_BE_U_2(cp); cp += 2; ND_PRINT((ndo, " %s", tok2str(ns_type2str, "Type%d", i))); /* print the qclass (if it's not IN) */ - i = EXTRACT_BE_16BITS(cp); + i = EXTRACT_BE_U_2(cp); cp += 2; if (is_mdns) class = (i & ~C_QU); @@ -383,10 +383,10 @@ ns_rprint(netdissect_options *ndo, return (ndo->ndo_snapend); /* print the type/qtype */ - typ = EXTRACT_BE_16BITS(cp); + typ = EXTRACT_BE_U_2(cp); cp += 2; /* print the class (if it's not IN and the type isn't OPT) */ - i = EXTRACT_BE_16BITS(cp); + i = EXTRACT_BE_U_2(cp); cp += 2; if (is_mdns) class = (i & ~C_CACHE_FLUSH); @@ -402,13 +402,13 @@ ns_rprint(netdissect_options *ndo, if (typ == T_OPT) { /* get opt flags */ cp += 2; - opt_flags = EXTRACT_BE_16BITS(cp); + opt_flags = EXTRACT_BE_U_2(cp); /* ignore rest of ttl field */ cp += 2; } else if (ndo->ndo_vflag > 2) { /* print ttl */ ND_PRINT((ndo, " [")); - unsigned_relts_print(ndo, EXTRACT_BE_32BITS(cp)); + unsigned_relts_print(ndo, EXTRACT_BE_U_4(cp)); ND_PRINT((ndo, "]")); cp += 4; } else { @@ -416,7 +416,7 @@ ns_rprint(netdissect_options *ndo, cp += 4; } - len = EXTRACT_BE_16BITS(cp); + len = EXTRACT_BE_U_2(cp); cp += 2; rp = cp + len; @@ -429,7 +429,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_BE_32BITS(cp))))); + ND_PRINT((ndo, " %s", intoa(htonl(EXTRACT_BE_U_4(cp))))); break; case T_NS: @@ -454,15 +454,15 @@ ns_rprint(netdissect_options *ndo, return(NULL); if (!ND_TTEST2(*cp, 5 * 4)) return(NULL); - ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(cp))); cp += 4; - ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(cp))); cp += 4; - ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(cp))); cp += 4; - ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(cp))); cp += 4; - ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(cp))); cp += 4; break; case T_MX: @@ -471,7 +471,7 @@ ns_rprint(netdissect_options *ndo, return(NULL); if (ns_nprint(ndo, cp + 2, bp) == NULL) return(NULL); - ND_PRINT((ndo, " %d", EXTRACT_BE_16BITS(cp))); + ND_PRINT((ndo, " %d", EXTRACT_BE_U_2(cp))); break; case T_TXT: @@ -490,8 +490,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_BE_16BITS(cp + 4), - EXTRACT_BE_16BITS(cp), EXTRACT_BE_16BITS(cp + 2))); + ND_PRINT((ndo, ":%d %d %d", EXTRACT_BE_U_2(cp + 4), + EXTRACT_BE_U_2(cp), EXTRACT_BE_U_2(cp + 2))); break; case T_AAAA: @@ -514,7 +514,7 @@ ns_rprint(netdissect_options *ndo, if (!ND_TTEST_1(cp)) return(NULL); - pbit = EXTRACT_8BITS(cp); + pbit = EXTRACT_U_1(cp); pbyte = (pbit & ~7) / 8; if (pbit > 128) { ND_PRINT((ndo, " %u(bad plen)", pbit)); @@ -560,23 +560,23 @@ ns_rprint(netdissect_options *ndo, cp += 6; if (!ND_TTEST_2(cp)) return(NULL); - ND_PRINT((ndo, " fudge=%u", EXTRACT_BE_16BITS(cp))); + ND_PRINT((ndo, " fudge=%u", EXTRACT_BE_U_2(cp))); cp += 2; if (!ND_TTEST_2(cp)) return(NULL); - ND_PRINT((ndo, " maclen=%u", EXTRACT_BE_16BITS(cp))); - cp += 2 + EXTRACT_BE_16BITS(cp); + ND_PRINT((ndo, " maclen=%u", EXTRACT_BE_U_2(cp))); + cp += 2 + EXTRACT_BE_U_2(cp); if (!ND_TTEST_2(cp)) return(NULL); - ND_PRINT((ndo, " origid=%u", EXTRACT_BE_16BITS(cp))); + ND_PRINT((ndo, " origid=%u", EXTRACT_BE_U_2(cp))); cp += 2; if (!ND_TTEST_2(cp)) return(NULL); - ND_PRINT((ndo, " error=%u", EXTRACT_BE_16BITS(cp))); + ND_PRINT((ndo, " error=%u", EXTRACT_BE_U_2(cp))); cp += 2; if (!ND_TTEST_2(cp)) return(NULL); - ND_PRINT((ndo, " otherlen=%u", EXTRACT_BE_16BITS(cp))); + ND_PRINT((ndo, " otherlen=%u", EXTRACT_BE_U_2(cp))); cp += 2; } } @@ -595,15 +595,15 @@ domain_print(netdissect_options *ndo, np = (const HEADER *)bp; ND_TCHECK(*np); /* get the byte-order right */ - qdcount = EXTRACT_BE_16BITS(&np->qdcount); - ancount = EXTRACT_BE_16BITS(&np->ancount); - nscount = EXTRACT_BE_16BITS(&np->nscount); - arcount = EXTRACT_BE_16BITS(&np->arcount); + qdcount = EXTRACT_BE_U_2(&np->qdcount); + ancount = EXTRACT_BE_U_2(&np->ancount); + nscount = EXTRACT_BE_U_2(&np->nscount); + arcount = EXTRACT_BE_U_2(&np->arcount); if (DNS_QR(np)) { /* this is a response */ ND_PRINT((ndo, "%d%s%s%s%s%s%s", - EXTRACT_BE_16BITS(&np->id), + EXTRACT_BE_U_2(&np->id), ns_ops[DNS_OPCODE(np)], ns_resp[DNS_RCODE(np)], DNS_AA(np)? "*" : "", @@ -616,7 +616,7 @@ domain_print(netdissect_options *ndo, /* Print QUESTION section on -vv */ cp = (const u_char *)(np + 1); while (qdcount--) { - if (qdcount < EXTRACT_BE_16BITS(&np->qdcount) - 1) + if (qdcount < EXTRACT_BE_U_2(&np->qdcount) - 1) ND_PRINT((ndo, ",")); if (ndo->ndo_vflag > 1) { ND_PRINT((ndo, " q:")); @@ -670,12 +670,12 @@ domain_print(netdissect_options *ndo, } else { /* this is a request */ - ND_PRINT((ndo, "%d%s%s%s", EXTRACT_BE_16BITS(&np->id), ns_ops[DNS_OPCODE(np)], + ND_PRINT((ndo, "%d%s%s%s", EXTRACT_BE_U_2(&np->id), ns_ops[DNS_OPCODE(np)], DNS_RD(np) ? "+" : "", DNS_CD(np) ? "%" : "")); /* any weirdness? */ - b2 = EXTRACT_BE_16BITS(((const u_short *)np) + 1); + b2 = EXTRACT_BE_U_2(((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 43e1291e..e0b670fa 100644 --- a/print-dtp.c +++ b/print-dtp.c @@ -57,7 +57,7 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length) ND_TCHECK2(*tptr, DTP_HEADER_LEN); ND_PRINT((ndo, "DTPv%u, length %u", - EXTRACT_8BITS(tptr), + EXTRACT_U_1(tptr), length)); /* @@ -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_BE_16BITS(tptr); - len = EXTRACT_BE_16BITS(tptr + 2); + type = EXTRACT_BE_U_2(tptr); + len = EXTRACT_BE_U_2(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 a171b982..9aa405d8 100644 --- a/print-dvmrp.c +++ b/print-dvmrp.c @@ -78,7 +78,7 @@ dvmrp_print(netdissect_options *ndo, return; ND_TCHECK_1(bp + 1); - type = EXTRACT_8BITS(bp + 1); + type = EXTRACT_U_1(bp + 1); /* Skip IGMP header */ bp += 8; @@ -123,8 +123,8 @@ dvmrp_print(netdissect_options *ndo, */ bp -= 4; ND_TCHECK2(bp[0], 4); - major_version = EXTRACT_8BITS(bp + 3); - minor_version = EXTRACT_8BITS(bp + 2); + major_version = EXTRACT_U_1(bp + 3); + minor_version = EXTRACT_U_1(bp + 2); bp += 4; if (print_neighbors2(ndo, bp, ep, len, major_version, minor_version) < 0) @@ -199,14 +199,14 @@ print_report(netdissect_options *ndo, origin = 0; for (i = 0; i < width; ++i) { ND_TCHECK_1(bp); - origin = origin << 8 | EXTRACT_8BITS(bp); + origin = origin << 8 | EXTRACT_U_1(bp); bp++; } for ( ; i < 4; ++i) origin <<= 8; ND_TCHECK_1(bp); - metric = EXTRACT_8BITS(bp); + metric = EXTRACT_U_1(bp); bp++; done = metric & 0x80; metric &= 0x7f; @@ -265,11 +265,11 @@ print_neighbors(netdissect_options *ndo, ND_TCHECK2(bp[0], 7); laddr = bp; bp += 4; - metric = EXTRACT_8BITS(bp); + metric = EXTRACT_U_1(bp); bp++; - thresh = EXTRACT_8BITS(bp); + thresh = EXTRACT_U_1(bp); bp++; - ncount = EXTRACT_8BITS(bp); + ncount = EXTRACT_U_1(bp); bp++; len -= 7; while (--ncount >= 0) { @@ -302,13 +302,13 @@ print_neighbors2(netdissect_options *ndo, ND_TCHECK2(bp[0], 8); laddr = bp; bp += 4; - metric = EXTRACT_8BITS(bp); + metric = EXTRACT_U_1(bp); bp++; - thresh = EXTRACT_8BITS(bp); + thresh = EXTRACT_U_1(bp); bp++; - flags = EXTRACT_8BITS(bp); + flags = EXTRACT_U_1(bp); bp++; - ncount = EXTRACT_8BITS(bp); + ncount = EXTRACT_U_1(bp); bp++; len -= 8; while (--ncount >= 0 && (len >= 4) && (bp + 4) <= ep) { @@ -347,7 +347,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_BE_32BITS(bp)); + unsigned_relts_print(ndo, EXTRACT_BE_U_4(bp)); return (0); trunc: return (-1); diff --git a/print-eap.c b/print-eap.c index 2abfc947..84bbe1b4 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_BE_16BITS(eap->length))); + EXTRACT_BE_U_2(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_BE_16BITS(eap->length))); + EXTRACT_BE_U_2(eap->length))); tptr += sizeof(struct eap_frame_t); tlen -= sizeof(struct eap_frame_t); @@ -185,18 +185,18 @@ eap_print(netdissect_options *ndo, ND_TCHECK_1(tptr); type = *(tptr); ND_TCHECK_2(tptr + 2); - len = EXTRACT_BE_16BITS(tptr + 2); + len = EXTRACT_BE_U_2(tptr + 2); ND_PRINT((ndo, ", %s (%u), id %u, len %u", tok2str(eap_code_values, "unknown", type), type, - EXTRACT_8BITS((tptr + 1)), + EXTRACT_U_1((tptr + 1)), len)); ND_TCHECK2(*tptr, len); if (type <= 2) { /* For EAP_REQUEST and EAP_RESPONSE only */ ND_TCHECK_1(tptr + 4); - subtype = EXTRACT_8BITS(tptr + 4); + subtype = EXTRACT_U_1(tptr + 4); ND_PRINT((ndo, "\n\t\t Type %s (%u)", tok2str(eap_type_values, "unknown", subtype), subtype)); @@ -227,7 +227,7 @@ eap_print(netdissect_options *ndo, while (count < len) { ND_TCHECK_1(tptr + count); ND_PRINT((ndo, " %s (%u),", - tok2str(eap_type_values, "unknown", EXTRACT_8BITS((tptr + count))), + tok2str(eap_type_values, "unknown", EXTRACT_U_1((tptr + count))), *(tptr + count))); count++; } @@ -238,28 +238,28 @@ eap_print(netdissect_options *ndo, ND_TCHECK_1(tptr + 5); if (subtype == EAP_TYPE_TTLS) ND_PRINT((ndo, " TTLSv%u", - EAP_TTLS_VERSION(EXTRACT_8BITS((tptr + 5))))); + EAP_TTLS_VERSION(EXTRACT_U_1((tptr + 5))))); ND_PRINT((ndo, " flags [%s] 0x%02x,", - bittok2str(eap_tls_flags_values, "none", EXTRACT_8BITS((tptr + 5))), + bittok2str(eap_tls_flags_values, "none", EXTRACT_U_1((tptr + 5))), *(tptr + 5))); if (EAP_TLS_EXTRACT_BIT_L(*(tptr+5))) { ND_TCHECK_4(tptr + 6); - ND_PRINT((ndo, " len %u", EXTRACT_BE_32BITS(tptr + 6))); + ND_PRINT((ndo, " len %u", EXTRACT_BE_U_4(tptr + 6))); } break; case EAP_TYPE_FAST: ND_TCHECK_1(tptr + 5); ND_PRINT((ndo, " FASTv%u", - EAP_TTLS_VERSION(EXTRACT_8BITS((tptr + 5))))); + EAP_TTLS_VERSION(EXTRACT_U_1((tptr + 5))))); ND_PRINT((ndo, " flags [%s] 0x%02x,", - bittok2str(eap_tls_flags_values, "none", EXTRACT_8BITS((tptr + 5))), + bittok2str(eap_tls_flags_values, "none", EXTRACT_U_1((tptr + 5))), *(tptr + 5))); if (EAP_TLS_EXTRACT_BIT_L(*(tptr+5))) { ND_TCHECK_4(tptr + 6); - ND_PRINT((ndo, " len %u", EXTRACT_BE_32BITS(tptr + 6))); + ND_PRINT((ndo, " len %u", EXTRACT_BE_U_4(tptr + 6))); } /* FIXME - TLV attributes follow */ @@ -269,7 +269,7 @@ eap_print(netdissect_options *ndo, case EAP_TYPE_SIM: ND_TCHECK_1(tptr + 5); ND_PRINT((ndo, " subtype [%s] 0x%02x,", - tok2str(eap_aka_subtype_values, "unknown", EXTRACT_8BITS((tptr + 5))), + tok2str(eap_aka_subtype_values, "unknown", EXTRACT_U_1((tptr + 5))), *(tptr + 5))); /* FIXME - TLV attributes follow */ diff --git a/print-egp.c b/print-egp.c index 6b482c1a..b0d3903c 100644 --- a/print-egp.c +++ b/print-egp.c @@ -166,15 +166,15 @@ egpnrprint(netdissect_options *ndo, switch (netlen) { case 1: - addr = EXTRACT_8BITS(cp); + addr = EXTRACT_U_1(cp); cp++; /* fall through */ case 2: - addr = (addr << 8) | EXTRACT_8BITS(cp); + addr = (addr << 8) | EXTRACT_U_1(cp); cp++; /* fall through */ case 3: - addr = (addr << 8) | EXTRACT_8BITS(cp); + addr = (addr << 8) | EXTRACT_U_1(cp); cp++; break; } @@ -183,7 +183,7 @@ egpnrprint(netdissect_options *ndo, if (length < 1) goto trunc; ND_TCHECK2(cp[0], 1); - distances = EXTRACT_8BITS(cp); + distances = EXTRACT_U_1(cp); cp++; length--; ND_PRINT((ndo, " %s %s ", @@ -196,10 +196,10 @@ egpnrprint(netdissect_options *ndo, if (length < 2) goto trunc; ND_TCHECK2(cp[0], 2); - ND_PRINT((ndo, "%sd%d:", comma, EXTRACT_8BITS(cp))); + ND_PRINT((ndo, "%sd%d:", comma, EXTRACT_U_1(cp))); cp++; comma = ", "; - networks = EXTRACT_8BITS(cp); + networks = EXTRACT_U_1(cp); cp++; length -= 2; while (networks != 0) { @@ -207,23 +207,23 @@ egpnrprint(netdissect_options *ndo, if (length < 1) goto trunc; ND_TCHECK2(cp[0], 1); - addr = ((uint32_t)EXTRACT_8BITS(cp)) << 24; + addr = ((uint32_t) EXTRACT_U_1(cp)) << 24; cp++; length--; if (IN_CLASSB(addr)) { if (length < 1) goto trunc; ND_TCHECK2(cp[0], 1); - addr |= ((uint32_t)EXTRACT_8BITS(cp)) << 16; + addr |= ((uint32_t) EXTRACT_U_1(cp)) << 16; cp++; length--; } else if (!IN_CLASSA(addr)) { if (length < 2) goto trunc; ND_TCHECK2(cp[0], 2); - addr |= ((uint32_t)EXTRACT_8BITS(cp)) << 16; + addr |= ((uint32_t) EXTRACT_U_1(cp)) << 16; cp++; - addr |= ((uint32_t)EXTRACT_8BITS(cp)) << 8; + addr |= ((uint32_t) EXTRACT_U_1(cp)) << 8; cp++; length -= 2; } @@ -257,8 +257,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_BE_16BITS(&egp->egp_as), - EXTRACT_BE_16BITS(&egp->egp_sequence), + EXTRACT_BE_U_2(&egp->egp_as), + EXTRACT_BE_U_2(&egp->egp_sequence), length)); return; } else @@ -294,8 +294,8 @@ egp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, " hello:%d poll:%d", - EXTRACT_BE_16BITS(&egp->egp_hello), - EXTRACT_BE_16BITS(&egp->egp_poll))); + EXTRACT_BE_U_2(&egp->egp_hello), + EXTRACT_BE_U_2(&egp->egp_poll))); break; case EGPC_REFUSE: @@ -376,10 +376,10 @@ egp_print(netdissect_options *ndo, else ND_PRINT((ndo, " [status %d]", status)); - if (EXTRACT_BE_16BITS(&egp->egp_reason) <= EGPR_UVERSION) - ND_PRINT((ndo, " %s", egp_reasons[EXTRACT_BE_16BITS(&egp->egp_reason)])); + if (EXTRACT_BE_U_2(&egp->egp_reason) <= EGPR_UVERSION) + ND_PRINT((ndo, " %s", egp_reasons[EXTRACT_BE_U_2(&egp->egp_reason)])); else - ND_PRINT((ndo, " [reason %d]", EXTRACT_BE_16BITS(&egp->egp_reason))); + ND_PRINT((ndo, " [reason %d]", EXTRACT_BE_U_2(&egp->egp_reason))); break; default: diff --git a/print-eigrp.c b/print-eigrp.c index b37b08b1..c4aea016 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_BE_16BITS(&eigrp_com_header->checksum), + EXTRACT_BE_U_2(&eigrp_com_header->checksum), tok2str(eigrp_common_header_flag_values, "none", - 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), + EXTRACT_BE_U_4(&eigrp_com_header->flags)), + EXTRACT_BE_U_4(&eigrp_com_header->seq), + EXTRACT_BE_U_4(&eigrp_com_header->ack), + EXTRACT_BE_U_4(&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_BE_16BITS(&eigrp_tlv_header->length); - eigrp_tlv_type=EXTRACT_BE_16BITS(&eigrp_tlv_header->type); + eigrp_tlv_len=EXTRACT_BE_U_2(&eigrp_tlv_header->length); + eigrp_tlv_type=EXTRACT_BE_U_2(&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_BE_16BITS(tlv_ptr.eigrp_tlv_general_parm->holdtime), + EXTRACT_BE_U_2(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_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0) + if (EXTRACT_BE_U_4(&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_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), + (EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_ip_int->delay)/100), + EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_ip_int->bandwidth), + EXTRACT_BE_U_3(&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_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0) + if (EXTRACT_BE_U_4(&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_BE_32BITS(tlv_ptr.eigrp_tlv_ip_ext->origin_as), + EXTRACT_BE_U_4(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_BE_32BITS(tlv_ptr.eigrp_tlv_ip_ext->tag), - EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_ip_ext->metric))); + EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->tag), + EXTRACT_BE_U_4(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_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), + (EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_ip_ext->delay)/100), + EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_ip_ext->bandwidth), + EXTRACT_BE_U_3(&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_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))); + EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_start), + EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_end), + EXTRACT_BE_U_4(&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_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_start), - EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_end))); + EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_int->cable_start), + EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_int->cable_end))); - if (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop) == 0) + if (EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_at_int->nexthop) == 0) ND_PRINT((ndo, "self")); else ND_PRINT((ndo, "%u.%u", - EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop), - EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop[2]))); + EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_int->nexthop), + EXTRACT_BE_U_2(&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_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), + (EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_at_int->delay)/100), + EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_at_int->bandwidth), + EXTRACT_BE_U_3(&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_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_start), - EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_end))); + EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_ext->cable_start), + EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_ext->cable_end))); - if (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop) == 0) + if (EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_at_ext->nexthop) == 0) ND_PRINT((ndo, "self")); else ND_PRINT((ndo, "%u.%u", - EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop), - EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop[2]))); + EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_ext->nexthop), + EXTRACT_BE_U_2(&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_BE_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_router), - EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_as), + EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->origin_router), + EXTRACT_BE_U_4(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_BE_32BITS(tlv_ptr.eigrp_tlv_at_ext->tag), - EXTRACT_BE_16BITS(tlv_ptr.eigrp_tlv_at_ext->metric))); + EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->tag), + EXTRACT_BE_U_2(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_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), + (EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_at_ext->delay)/100), + EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_at_ext->bandwidth), + EXTRACT_BE_U_3(&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 0406175c..4a43a491 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_BE_32BITS(&hdr->spi))); + ND_PRINT((ndo, "SPI 0x%08x: ", EXTRACT_BE_U_4(&hdr->spi))); length -= ENC_HDRLEN; caplen -= ENC_HDRLEN; diff --git a/print-esp.c b/print-esp.c index d19b36da..d71bd23e 100644 --- a/print-esp.c +++ b/print-esp.c @@ -683,8 +683,8 @@ esp_print(netdissect_options *ndo, ND_PRINT((ndo, "[|ESP]")); goto fail; } - ND_PRINT((ndo, "ESP(spi=0x%08x", EXTRACT_BE_32BITS(&esp->esp_spi))); - ND_PRINT((ndo, ",seq=0x%x)", EXTRACT_BE_32BITS(&esp->esp_seq))); + ND_PRINT((ndo, "ESP(spi=0x%08x", EXTRACT_BE_U_4(&esp->esp_spi))); + ND_PRINT((ndo, ",seq=0x%x)", EXTRACT_BE_U_4(&esp->esp_seq))); ND_PRINT((ndo, ", length %u", length)); #ifndef HAVE_LIBCRYPTO @@ -706,14 +706,14 @@ esp_print(netdissect_options *ndo, case 6: ip6 = (const struct ip6_hdr *)bp2; /* we do not attempt to decrypt jumbograms */ - if (!EXTRACT_BE_16BITS(&ip6->ip6_plen)) + if (!EXTRACT_BE_U_2(&ip6->ip6_plen)) goto fail; /* if we can't get nexthdr, we do not need to decrypt it */ - len = sizeof(struct ip6_hdr) + EXTRACT_BE_16BITS(&ip6->ip6_plen); + len = sizeof(struct ip6_hdr) + EXTRACT_BE_U_2(&ip6->ip6_plen); /* see if we can find the SA, and if so, decode it */ for (sa = ndo->ndo_sa_list_head; sa != NULL; sa = sa->next) { - if (sa->spi == EXTRACT_BE_32BITS(&esp->esp_spi) && + if (sa->spi == EXTRACT_BE_U_4(&esp->esp_spi) && sa->daddr_version == 6 && UNALIGNED_MEMCMP(&sa->daddr.in6, &ip6->ip6_dst, sizeof(struct in6_addr)) == 0) { @@ -723,13 +723,13 @@ esp_print(netdissect_options *ndo, break; case 4: /* nexthdr & padding are in the last fragment */ - if (EXTRACT_BE_16BITS(&ip->ip_off) & IP_MF) + if (EXTRACT_BE_U_2(&ip->ip_off) & IP_MF) goto fail; - len = EXTRACT_BE_16BITS(&ip->ip_len); + len = EXTRACT_BE_U_2(&ip->ip_len); /* see if we can find the SA, and if so, decode it */ for (sa = ndo->ndo_sa_list_head; sa != NULL; sa = sa->next) { - if (sa->spi == EXTRACT_BE_32BITS(&esp->esp_spi) && + if (sa->spi == EXTRACT_BE_U_4(&esp->esp_spi) && sa->daddr_version == 4 && UNALIGNED_MEMCMP(&sa->daddr.in4, &ip->ip_dst, sizeof(struct in_addr)) == 0) { @@ -807,14 +807,14 @@ esp_print(netdissect_options *ndo, advance = sizeof(struct newesp); /* sanity check for pad length */ - if (ep - bp < EXTRACT_8BITS(ep - 2)) + if (ep - bp < EXTRACT_U_1(ep - 2)) goto fail; if (padlen) - *padlen = EXTRACT_8BITS(ep - 2) + 2; + *padlen = EXTRACT_U_1(ep - 2) + 2; if (nhdr) - *nhdr = EXTRACT_8BITS(ep - 1); + *nhdr = EXTRACT_U_1(ep - 1); ND_PRINT((ndo, ": ")); return advance; diff --git a/print-ether.c b/print-ether.c index 5ffbb273..8d8341ba 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_BE_16BITS(&ep->ether_length_type); + length_type = EXTRACT_BE_U_2(&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_BE_16BITS(&ep->ether_length_type); + length_type = EXTRACT_BE_U_2(&ep->ether_length_type); recurse: /* @@ -201,12 +201,12 @@ recurse: return (hdrlen + length); } if (ndo->ndo_eflag) { - uint16_t tag = EXTRACT_BE_16BITS(p); + uint16_t tag = EXTRACT_BE_U_2(p); ND_PRINT((ndo, "%s, ", ieee8021q_tci_string(tag))); } - length_type = EXTRACT_BE_16BITS(p + 2); + length_type = EXTRACT_BE_U_2(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 bfc49e9f..c5d2e035 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_BE_16BITS(&(forcesh)->fm_len) << 2)) +#define ForCES_BLN(forcesh) ((uint32_t)(EXTRACT_BE_U_2(&(forcesh)->fm_len) << 2)) nd_uint32_t fm_sid; /* Source ID */ -#define ForCES_SID(forcesh) EXTRACT_BE_32BITS(&(forcesh)->fm_sid) +#define ForCES_SID(forcesh) EXTRACT_BE_U_4(&(forcesh)->fm_sid) nd_uint32_t fm_did; /* Destination ID */ -#define ForCES_DID(forcesh) EXTRACT_BE_32BITS(&(forcesh)->fm_did) +#define ForCES_DID(forcesh) EXTRACT_BE_U_4(&(forcesh)->fm_did) nd_uint8_t fm_cor[8]; /* correlator */ nd_uint32_t fm_flags; /* flags */ -#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_ACK(forcesh) ((EXTRACT_BE_U_4(&(forcesh)->fm_flags)&0xC0000000) >> 30) +#define ForCES_PRI(forcesh) ((EXTRACT_BE_U_4(&(forcesh)->fm_flags)&0x38000000) >> 27) +#define ForCES_RS1(forcesh) ((EXTRACT_BE_U_4(&(forcesh)->fm_flags)&0x07000000) >> 24) +#define ForCES_EM(forcesh) ((EXTRACT_BE_U_4(&(forcesh)->fm_flags)&0x00C00000) >> 22) +#define ForCES_AT(forcesh) ((EXTRACT_BE_U_4(&(forcesh)->fm_flags)&0x00200000) >> 21) +#define ForCES_TP(forcesh) ((EXTRACT_BE_U_4(&(forcesh)->fm_flags)&0x00180000) >> 19) +#define ForCES_RS2(forcesh) ((EXTRACT_BE_U_4(&(forcesh)->fm_flags)&0x0007FFFF) >> 0) }; #define ForCES_HLN_VALID(fhl,tlen) ((tlen) >= ForCES_HDRL && \ @@ -387,18 +387,18 @@ struct forces_tlv { #define GET_TOP_TLV(fhdr) ((const struct forces_tlv *)((fhdr) + sizeof (struct forcesh))) #define TLV_SET_LEN(len) (F_ALN_LEN(TLV_HDRL) + (len)) #define TLV_ALN_LEN(len) F_ALN_LEN(TLV_SET_LEN(len)) -#define TLV_RDAT_LEN(tlv) (EXTRACT_16BITS(&(tlv)->length) - TLV_SET_LEN(0) +#define TLV_RDAT_LEN(tlv) (EXTRACT_BE_U_2(&(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_BE_16BITS(&(tlv)->length)), \ +#define GO_NXT_TLV(tlv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_BE_U_2(&(tlv)->length)), \ (const struct forces_tlv*)(((const char*)(tlv)) \ - + F_ALN_LEN(EXTRACT_BE_16BITS(&(tlv)->length)))) + + F_ALN_LEN(EXTRACT_BE_U_2(&(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) (EXTRACT_BE_32BITS(&(ilv)->length)) - ILV_SET_LEN(0) +#define ILV_RDAT_LEN(ilv) (EXTRACT_BE_U_4(&(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_BE_32BITS(&(ilv)->length)), \ +#define GO_NXT_ILV(ilv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_BE_U_4(&(ilv)->length)), \ (const struct forces_ilv *)(((const char*)(ilv)) \ - + F_ALN_LEN(EXTRACT_BE_32BITS(&(ilv)->length)))) + + F_ALN_LEN(EXTRACT_BE_U_4(&(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_BE_16BITS(&tlv->length) < TLV_HDRL) + if (EXTRACT_BE_U_2(&tlv->length) < TLV_HDRL) return INVALID_STLN; - if (EXTRACT_BE_16BITS(&tlv->length) > rlen) + if (EXTRACT_BE_U_2(&tlv->length) > rlen) return INVALID_LTLN; - if (rlen < F_ALN_LEN(EXTRACT_BE_16BITS(&tlv->length))) + if (rlen < F_ALN_LEN(EXTRACT_BE_U_2(&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_BE_32BITS(&ilv->length) < ILV_HDRL) + if (EXTRACT_BE_U_4(&ilv->length) < ILV_HDRL) return INVALID_STLN; - if (EXTRACT_BE_32BITS(&ilv->length) > rlen) + if (EXTRACT_BE_U_4(&ilv->length) > rlen) return INVALID_LTLN; - if (rlen < F_ALN_LEN(EXTRACT_BE_32BITS(&ilv->length))) + if (rlen < F_ALN_LEN(EXTRACT_BE_U_4(&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_BE_16BITS(&tlv->type); + type = EXTRACT_BE_U_2(&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_BE_32BITS(&ilv->length); + int ilvl = EXTRACT_BE_U_4(&ilv->length); ND_PRINT((ndo, "\n%s ILV: type %x length %d\n", &ib[1], - EXTRACT_BE_32BITS(&ilv->type), ilvl)); + EXTRACT_BE_U_4(&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_BE_16BITS(&tlv->type); + type = EXTRACT_BE_U_2(&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_BE_32BITS(tdp); + id = EXTRACT_BE_U_4(tdp); ND_PRINT((ndo, "%sKeyinfo: Key 0x%x\n", ib, id)); ND_TCHECK(*kdtlv); - type = EXTRACT_BE_16BITS(&kdtlv->type); + type = EXTRACT_BE_U_2(&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_BE_16BITS(&kdtlv->length))); + EXTRACT_BE_U_2(&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_BE_16BITS(&kdtlv->length); + tll = EXTRACT_BE_U_2(&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_BE_32BITS(pptr); + id = EXTRACT_BE_U_4(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_BE_32BITS(pptr); + starti = EXTRACT_BE_U_4(pptr); pptr += 4; len -= 4; - endi = EXTRACT_BE_32BITS(pptr); + endi = EXTRACT_BE_U_4(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_BE_16BITS(&keytlv->length); + tll = EXTRACT_BE_U_2(&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_BE_16BITS(&pdtlv->type); + type = EXTRACT_BE_U_2(&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_BE_16BITS(&pdtlv->length))); + EXTRACT_BE_U_2(&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_BE_16BITS(&pdtlv->length) - TLV_HDRL; - aln = F_ALN_LEN(EXTRACT_BE_16BITS(&pdtlv->length)); - if (aln > EXTRACT_BE_16BITS(&pdtlv->length)) { + tll = EXTRACT_BE_U_2(&pdtlv->length) - TLV_HDRL; + aln = F_ALN_LEN(EXTRACT_BE_U_2(&pdtlv->length)); + if (aln > EXTRACT_BE_U_2(&pdtlv->length)) { if (aln > len) { ND_PRINT((ndo, "Invalid padded pathdata TLV type 0x%x len %d missing %d pad bytes\n", - type, EXTRACT_BE_16BITS(&pdtlv->length), aln - len)); + type, EXTRACT_BE_U_2(&pdtlv->length), aln - len)); } else { - pad = aln - EXTRACT_BE_16BITS(&pdtlv->length); + pad = aln - EXTRACT_BE_U_2(&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_BE_16BITS(&pdtlv->length), tll, pad)); + ib, ops->s, EXTRACT_BE_U_2(&pdtlv->length), tll, pad)); else ND_PRINT((ndo, "%s %s (Length %d DataLen %d Bytes)\n", - ib, ops->s, EXTRACT_BE_16BITS(&pdtlv->length), tll)); + ib, ops->s, EXTRACT_BE_U_2(&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_BE_16BITS(&pdtlv->length))); + type, EXTRACT_BE_U_2(&pdtlv->length))); pd_err: - if (EXTRACT_BE_16BITS(&pdtlv->length)) { + if (EXTRACT_BE_U_2(&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_BE_16BITS(&pdh->pflags), EXTRACT_BE_16BITS(&pdh->pIDcnt))); + ib, EXTRACT_BE_U_2(&pdh->pflags), EXTRACT_BE_U_2(&pdh->pIDcnt))); } - if (EXTRACT_BE_16BITS(&pdh->pflags) & F_SELKEY) { + if (EXTRACT_BE_U_2(&pdh->pflags) & F_SELKEY) { op_msk |= B_KEYIN; } /* Table GET Range operation */ - if (EXTRACT_BE_16BITS(&pdh->pflags) & F_SELTABRANGE) { + if (EXTRACT_BE_U_2(&pdh->pflags) & F_SELTABRANGE) { op_msk |= B_TRNG; } /* Table SET append operation */ - if (EXTRACT_BE_16BITS(&pdh->pflags) & F_TABAPPEND) { + if (EXTRACT_BE_U_2(&pdh->pflags) & F_TABAPPEND) { op_msk |= B_APPND; } pptr += sizeof(struct pathdata_h); len -= sizeof(struct pathdata_h); - idcnt = EXTRACT_BE_16BITS(&pdh->pIDcnt); + idcnt = EXTRACT_BE_U_2(&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_BE_16BITS(&pdtlv->type); - tll = EXTRACT_BE_16BITS(&pdtlv->length) - TLV_HDRL; + type = EXTRACT_BE_U_2(&pdtlv->type); + tll = EXTRACT_BE_U_2(&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_BE_16BITS(&pdtlv->length))); + tok2str(ForCES_TLV, NULL, type), type, EXTRACT_BE_U_2(&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_BE_16BITS(&pdtlv->length))); + EXTRACT_BE_U_2(&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_BE_16BITS(&pdtlv->length), tll)); + EXTRACT_BE_U_2(&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_BE_16BITS(&pdtlv->type); + type = EXTRACT_BE_U_2(&pdtlv->type); dp = (const u_char *) TLV_DATA(pdtlv); - tll = EXTRACT_BE_16BITS(&pdtlv->length) - TLV_HDRL; + tll = EXTRACT_BE_U_2(&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_BE_16BITS(&pdtlv->length), - EXTRACT_BE_16BITS(&pdtlv->length) - TLV_HDRL)); + EXTRACT_BE_U_2(&pdtlv->length), + EXTRACT_BE_U_2(&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_BE_16BITS(&pdtlv->type), len - EXTRACT_BE_16BITS(&pdtlv->length))); + EXTRACT_BE_U_2(&pdtlv->type), len - EXTRACT_BE_U_2(&pdtlv->length))); return -1; } @@ -1176,21 +1176,21 @@ otlv_print(netdissect_options *ndo, const struct optlv_h *ops; /* - * lfbselect_print() has ensured that EXTRACT_16BITS(&otlv->length) + * lfbselect_print() has ensured that EXTRACT_BE_U_2(&otlv->length) * >= TLV_HDRL. */ ND_TCHECK(*otlv); - type = EXTRACT_BE_16BITS(&otlv->type); - tll = EXTRACT_BE_16BITS(&otlv->length) - TLV_HDRL; + type = EXTRACT_BE_U_2(&otlv->type); + tll = EXTRACT_BE_U_2(&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_BE_16BITS(&otlv->length))); + EXTRACT_BE_U_2(&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_BE_16BITS(&otlv->length))); + EXTRACT_BE_U_2(&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_BE_32BITS(pptr); + rescode = EXTRACT_BE_U_4(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_BE_32BITS(pptr); + rescode = EXTRACT_BE_U_4(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_BE_32BITS(&ilv->length) - ILV_HDRL; + rlen = EXTRACT_BE_U_4(&ilv->length) - ILV_HDRL; ND_TCHECK(*ilv); - ND_PRINT((ndo, "%sMetaID 0x%x length %d\n", ib, EXTRACT_BE_32BITS(&ilv->type), - EXTRACT_BE_32BITS(&ilv->length))); + ND_PRINT((ndo, "%sMetaID 0x%x length %d\n", ib, EXTRACT_BE_U_4(&ilv->type), + EXTRACT_BE_U_4(&ilv->length))); if (ndo->ndo_vflag >= 3) { hex_print_with_offset(ndo, "\t\t[", ILV_DATA(ilv), rlen, 0); ND_PRINT((ndo, " ]\n")); @@ -1468,18 +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_BE_16BITS(&tlv->type) == F_TLV_METD) { + if (EXTRACT_BE_U_2(&tlv->type) == F_TLV_METD) { print_metatlv(ndo, (const u_char *) TLV_DATA(tlv), - EXTRACT_BE_16BITS(&tlv->length), 0, + EXTRACT_BE_U_2(&tlv->length), 0, indent); - } else if ((EXTRACT_BE_16BITS(&tlv->type) == F_TLV_REDD)) { + } else if ((EXTRACT_BE_U_2(&tlv->type) == F_TLV_REDD)) { print_reddata(ndo, (const u_char *) TLV_DATA(tlv), - EXTRACT_BE_16BITS(&tlv->length), 0, + EXTRACT_BE_U_2(&tlv->length), 0, indent); } else { ND_PRINT((ndo, "Unknown REDIRECT TLV 0x%x len %d\n", - EXTRACT_BE_16BITS(&tlv->type), - EXTRACT_BE_16BITS(&tlv->length))); + EXTRACT_BE_U_2(&tlv->type), + EXTRACT_BE_U_2(&tlv->length))); } tlv = GO_NXT_TLV(tlv, rlen); @@ -1488,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_BE_16BITS(&tlv->type), - rlen - EXTRACT_BE_16BITS(&tlv->length))); + EXTRACT_BE_U_2(&tlv->type), + rlen - EXTRACT_BE_U_2(&tlv->length))); return -1; } @@ -1536,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_BE_32BITS(&lfbs->class)), - EXTRACT_BE_32BITS(&lfbs->class), - EXTRACT_BE_32BITS(&lfbs->instance))); + ib, tok2str(ForCES_LFBs, NULL, EXTRACT_BE_U_4(&lfbs->class)), + EXTRACT_BE_U_4(&lfbs->class), + EXTRACT_BE_U_4(&lfbs->instance))); } otlv = (const struct forces_tlv *)(lfbs + 1); @@ -1555,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_BE_16BITS(&otlv->type), op_msk)) { + if (op_valid(EXTRACT_BE_U_2(&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_BE_16BITS(&otlv->type), EXTRACT_BE_16BITS(&otlv->length))); + EXTRACT_BE_U_2(&otlv->type), EXTRACT_BE_U_2(&otlv->length))); invoptlv_print(ndo, (const u_char *)otlv, rlen, 0, indent); } otlv = GO_NXT_TLV(otlv, rlen); @@ -1571,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_BE_16BITS(&otlv->type), rlen - EXTRACT_BE_16BITS(&otlv->length))); + EXTRACT_BE_U_2(&otlv->type), rlen - EXTRACT_BE_U_2(&otlv->length))); return -1; } @@ -1633,20 +1633,20 @@ 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_BE_16BITS(&tltlv->type))) { + if (!ttlv_valid(EXTRACT_BE_U_2(&tltlv->type))) { ND_PRINT((ndo, "\n\tInvalid ForCES Top TLV type=0x%x", - EXTRACT_BE_16BITS(&tltlv->type))); + EXTRACT_BE_U_2(&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_BE_16BITS(&tltlv->type)), - EXTRACT_BE_16BITS(&tltlv->length), - EXTRACT_BE_16BITS(&tltlv->length) - TLV_HDRL)); + tok2str(ForCES_TLV, NULL, EXTRACT_BE_U_2(&tltlv->type)), + EXTRACT_BE_U_2(&tltlv->length), + EXTRACT_BE_U_2(&tltlv->length) - TLV_HDRL)); rc = tops->print(ndo, (const u_char *) TLV_DATA(tltlv), - EXTRACT_BE_16BITS(&tltlv->length), + EXTRACT_BE_U_2(&tltlv->length), tops->op_msk, 9); if (rc < 0) { return -1; @@ -1662,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_BE_16BITS(&tltlv->length))); + TLV_HDRL, rlen, EXTRACT_BE_U_2(&tltlv->length))); return -1; } @@ -1707,7 +1707,7 @@ forces_print(netdissect_options *ndo, } ND_TCHECK2(*(pptr + 20), 4); - flg_raw = EXTRACT_BE_32BITS(pptr + 20); + flg_raw = EXTRACT_BE_U_4(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)); @@ -1715,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_BE_64BITS(fhdr->fm_cor))); + EXTRACT_BE_U_8(fhdr->fm_cor))); } if (ndo->ndo_vflag >= 2) { @@ -104,20 +104,20 @@ static int parse_q922_addr(netdissect_options *ndo, { if (!ND_TTEST_1(p) || length < 1) return -1; - if ((EXTRACT_8BITS(p) & FR_EA_BIT)) + if ((EXTRACT_U_1(p) & FR_EA_BIT)) return 0; if (!ND_TTEST_1(p + 1) || length < 2) return -1; *addr_len = 2; - *dlci = ((EXTRACT_8BITS(p) & 0xFC) << 2) | ((EXTRACT_8BITS(p+1) & 0xF0) >> 4); + *dlci = ((EXTRACT_U_1(p) & 0xFC) << 2) | ((EXTRACT_U_1(p + 1) & 0xF0) >> 4); - flags[0] = EXTRACT_8BITS(p) & 0x02; /* populate the first flag fields */ - flags[1] = EXTRACT_8BITS(p+1) & 0x0c; + flags[0] = EXTRACT_U_1(p) & 0x02; /* populate the first flag fields */ + flags[1] = EXTRACT_U_1(p + 1) & 0x0c; flags[2] = 0; /* clear the rest of the flags */ flags[3] = 0; - if (EXTRACT_8BITS(p+1) & FR_EA_BIT) + if (EXTRACT_U_1(p + 1) & FR_EA_BIT) return 1; /* 2-byte Q.922 address */ p += 2; @@ -125,8 +125,8 @@ static int parse_q922_addr(netdissect_options *ndo, if (!ND_TTEST_1(p) || length < 1) return -1; (*addr_len)++; /* 3- or 4-byte Q.922 address */ - if ((EXTRACT_8BITS(p) & FR_EA_BIT) == 0) { - *dlci = (*dlci << 7) | (EXTRACT_8BITS(p) >> 1); + if ((EXTRACT_U_1(p) & FR_EA_BIT) == 0) { + *dlci = (*dlci << 7) | (EXTRACT_U_1(p) >> 1); (*addr_len)++; /* 4-byte Q.922 address */ p++; length--; @@ -134,12 +134,12 @@ static int parse_q922_addr(netdissect_options *ndo, if (!ND_TTEST_1(p) || length < 1) return -1; - if ((EXTRACT_8BITS(p) & FR_EA_BIT) == 0) + if ((EXTRACT_U_1(p) & FR_EA_BIT) == 0) return 0; /* more than 4 bytes of Q.922 address? */ - flags[3] = EXTRACT_8BITS(p) & 0x02; + flags[3] = EXTRACT_U_1(p) & 0x02; - *dlci = (*dlci << 6) | (EXTRACT_8BITS(p) >> 2); + *dlci = (*dlci << 6) | (EXTRACT_U_1(p) >> 2); return 1; } @@ -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_BE_32BITS(flags)), + bittok2str(fr_header_flag_values, "none", EXTRACT_BE_U_4(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_BE_32BITS(flags)), + bittok2str(fr_header_flag_values, "none", EXTRACT_BE_U_4(flags)), tok2str(ethertype_values, "unknown", nlpid), nlpid, length)); @@ -257,7 +257,7 @@ fr_print(netdissect_options *ndo, if (length < addr_len + 1) goto trunc; - if (EXTRACT_8BITS(p + addr_len) != LLC_UI && dlci != 0) { + if (EXTRACT_U_1(p + addr_len) != LLC_UI && dlci != 0) { /* * Let's figure out if we have Cisco-style encapsulation, * with an Ethernet type (Cisco HDLC type?) following the @@ -265,9 +265,9 @@ fr_print(netdissect_options *ndo, */ if (!ND_TTEST_2(p + addr_len) || length < addr_len + 2) { /* no Ethertype */ - ND_PRINT((ndo, "UI %02x! ", EXTRACT_8BITS(p + addr_len))); + ND_PRINT((ndo, "UI %02x! ", EXTRACT_U_1(p + addr_len))); } else { - extracted_ethertype = EXTRACT_BE_16BITS(p + addr_len); + extracted_ethertype = EXTRACT_BE_U_2(p + addr_len); if (ndo->ndo_eflag) fr_hdr_print(ndo, length, addr_len, dlci, @@ -279,7 +279,7 @@ fr_print(netdissect_options *ndo, ndo->ndo_snapend-p-addr_len-ETHERTYPE_LEN, NULL, NULL) == 0) /* ether_type not known, probably it wasn't one */ - ND_PRINT((ndo, "UI %02x! ", EXTRACT_8BITS(p + addr_len))); + ND_PRINT((ndo, "UI %02x! ", EXTRACT_U_1(p + addr_len))); else return addr_len + 2; } @@ -289,7 +289,7 @@ fr_print(netdissect_options *ndo, if (length < addr_len + 2) goto trunc; - if (EXTRACT_8BITS(p + addr_len + 1) == 0) { + if (EXTRACT_U_1(p + addr_len + 1) == 0) { /* * Assume a pad byte after the control (UI) byte. * A pad byte should only be used with 3-byte Q.922. @@ -310,7 +310,7 @@ fr_print(netdissect_options *ndo, ND_TCHECK_1(p + hdr_len - 1); if (length < hdr_len) goto trunc; - nlpid = EXTRACT_8BITS(p + hdr_len - 1); + nlpid = EXTRACT_U_1(p + hdr_len - 1); if (ndo->ndo_eflag) fr_hdr_print(ndo, length, addr_len, dlci, flags, nlpid); @@ -458,10 +458,10 @@ mfr_print(netdissect_options *ndo, ND_TCHECK2(*p, 4); /* minimum frame header length */ - if ((EXTRACT_8BITS(p) & MFR_BEC_MASK) == MFR_CTRL_FRAME && EXTRACT_8BITS(p+1) == 0) { + if ((EXTRACT_U_1(p) & MFR_BEC_MASK) == MFR_CTRL_FRAME && EXTRACT_U_1(p + 1) == 0) { ND_PRINT((ndo, "FRF.16 Control, Flags [%s], %s, length %u", - bittok2str(frf_flag_values,"none",(EXTRACT_8BITS(p) & MFR_BEC_MASK)), - tok2str(mfr_ctrl_msg_values,"Unknown Message (0x%02x)",EXTRACT_8BITS(p+2)), + bittok2str(frf_flag_values,"none",(EXTRACT_U_1(p) & MFR_BEC_MASK)), + tok2str(mfr_ctrl_msg_values,"Unknown Message (0x%02x)",EXTRACT_U_1(p + 2)), length)); tptr = p + 3; tlen = length -3; @@ -493,7 +493,7 @@ mfr_print(netdissect_options *ndo, switch (ie_type) { case MFR_CTRL_IE_MAGIC_NUM: - ND_PRINT((ndo, "0x%08x", EXTRACT_BE_32BITS(tptr))); + ND_PRINT((ndo, "0x%08x", EXTRACT_BE_U_4(tptr))); break; case MFR_CTRL_IE_BUNDLE_ID: /* same message format */ @@ -552,13 +552,13 @@ mfr_print(netdissect_options *ndo, * +----+----+----+----+----+----+----+----+ */ - sequence_num = (EXTRACT_8BITS(p)&0x1e)<<7 | EXTRACT_8BITS(p+1); + sequence_num = (EXTRACT_U_1(p)&0x1e)<<7 | EXTRACT_U_1(p + 1); /* whole packet or first fragment ? */ - if ((EXTRACT_8BITS(p) & MFR_BEC_MASK) == MFR_FRAG_FRAME || - (EXTRACT_8BITS(p) & MFR_BEC_MASK) == MFR_B_BIT) { + if ((EXTRACT_U_1(p) & MFR_BEC_MASK) == MFR_FRAG_FRAME || + (EXTRACT_U_1(p) & MFR_BEC_MASK) == MFR_B_BIT) { ND_PRINT((ndo, "FRF.16 Frag, seq %u, Flags [%s], ", sequence_num, - bittok2str(frf_flag_values,"none",(EXTRACT_8BITS(p) & MFR_BEC_MASK)))); + bittok2str(frf_flag_values,"none",(EXTRACT_U_1(p) & MFR_BEC_MASK)))); hdr_len = 2; fr_print(ndo, p+hdr_len,length-hdr_len); return hdr_len; @@ -567,7 +567,7 @@ mfr_print(netdissect_options *ndo, /* must be a middle or the last fragment */ ND_PRINT((ndo, "FRF.16 Frag, seq %u, Flags [%s]", sequence_num, - bittok2str(frf_flag_values,"none",(EXTRACT_8BITS(p) & MFR_BEC_MASK)))); + bittok2str(frf_flag_values,"none",(EXTRACT_U_1(p) & MFR_BEC_MASK)))); print_unknown_data(ndo, p, "\n\t", length); return hdr_len; @@ -604,13 +604,13 @@ frf15_print(netdissect_options *ndo, goto trunc; ND_TCHECK2(*p, 2); - flags = EXTRACT_8BITS(p)&MFR_BEC_MASK; - sequence_num = (EXTRACT_8BITS(p)&0x1e)<<7 | EXTRACT_8BITS(p+1); + flags = EXTRACT_U_1(p)&MFR_BEC_MASK; + sequence_num = (EXTRACT_U_1(p)&0x1e)<<7 | EXTRACT_U_1(p + 1); ND_PRINT((ndo, "FRF.15, seq 0x%03x, Flags [%s],%s Fragmentation, length %u", sequence_num, bittok2str(frf_flag_values,"none",flags), - EXTRACT_8BITS(p)&FR_FRF15_FRAGTYPE ? "Interface" : "End-to-End", + EXTRACT_U_1(p)&FR_FRF15_FRAGTYPE ? "Interface" : "End-to-End", length)); /* TODO: @@ -813,7 +813,7 @@ q933_print(netdissect_options *ndo, * Get the length of the call reference value. */ olen = length; /* preserve the original length for display */ - call_ref_length = EXTRACT_8BITS(p) & 0x0f; + call_ref_length = EXTRACT_U_1(p) & 0x0f; p++; length--; @@ -827,7 +827,7 @@ q933_print(netdissect_options *ndo, ND_PRINT((ndo, "length %u", olen)); goto trunc; } - call_ref[i] = EXTRACT_8BITS(p); + call_ref[i] = EXTRACT_U_1(p); p++; length--; } @@ -841,7 +841,7 @@ q933_print(netdissect_options *ndo, ND_PRINT((ndo, "length %u", olen)); goto trunc; } - msgtype = EXTRACT_8BITS(p); + msgtype = EXTRACT_U_1(p); p++; length--; @@ -857,7 +857,7 @@ q933_print(netdissect_options *ndo, ND_PRINT((ndo, "length %u", olen)); goto trunc; } - iecode = EXTRACT_8BITS(p); + iecode = EXTRACT_U_1(p); if (IE_IS_SHIFT(iecode)) { /* * It's a shift. Skip over it. @@ -908,7 +908,7 @@ q933_print(netdissect_options *ndo, if (call_ref_length != 0) { ND_TCHECK_1(p); - if (call_ref_length > 1 || EXTRACT_8BITS(p) != 0) { + if (call_ref_length > 1 || EXTRACT_U_1(p) != 0) { /* * Not a dummy call reference. */ @@ -958,7 +958,7 @@ q933_print(netdissect_options *ndo, } goto trunc; } - iecode = EXTRACT_8BITS(p); + iecode = EXTRACT_U_1(p); p++; length--; @@ -1001,7 +1001,7 @@ q933_print(netdissect_options *ndo, } goto trunc; } - ielength = EXTRACT_8BITS(p); + ielength = EXTRACT_U_1(p); p++; length--; @@ -1083,8 +1083,8 @@ fr_q933_print_ie_codeset_0_5(netdissect_options *ndo, u_int iecode, } if (ndo->ndo_vflag) { ND_PRINT((ndo, "%s (%u)", - tok2str(fr_lmi_report_type_ie_values,"unknown",EXTRACT_8BITS(p)), - EXTRACT_8BITS(p))); + tok2str(fr_lmi_report_type_ie_values,"unknown",EXTRACT_U_1(p)), + EXTRACT_U_1(p))); } return 1; @@ -1098,7 +1098,7 @@ fr_q933_print_ie_codeset_0_5(netdissect_options *ndo, u_int iecode, ND_PRINT((ndo, "Invalid LINK VERIFY IE")); return 1; } - ND_PRINT((ndo, "TX Seq: %3d, RX Seq: %3d", EXTRACT_8BITS(p), EXTRACT_8BITS(p+1))); + ND_PRINT((ndo, "TX Seq: %3d, RX Seq: %3d", EXTRACT_U_1(p), EXTRACT_U_1(p + 1))); return 1; case FR_LMI_ANSI_PVC_STATUS_IE: /* fall through */ @@ -1108,30 +1108,30 @@ fr_q933_print_ie_codeset_0_5(netdissect_options *ndo, u_int iecode, } /* now parse the DLCI information element. */ if ((ielength < 3) || - (EXTRACT_8BITS(p) & 0x80) || - ((ielength == 3) && !(EXTRACT_8BITS(p+1) & 0x80)) || + (EXTRACT_U_1(p) & 0x80) || + ((ielength == 3) && !(EXTRACT_U_1(p + 1) & 0x80)) || ((ielength == 4) && - ((EXTRACT_8BITS(p+1) & 0x80) || !(EXTRACT_8BITS(p+2) & 0x80))) || + ((EXTRACT_U_1(p + 1) & 0x80) || !(EXTRACT_U_1(p + 2) & 0x80))) || ((ielength == 5) && - ((EXTRACT_8BITS(p+1) & 0x80) || (EXTRACT_8BITS(p+2) & 0x80) || - !(EXTRACT_8BITS(p+3) & 0x80))) || + ((EXTRACT_U_1(p + 1) & 0x80) || (EXTRACT_U_1(p + 2) & 0x80) || + !(EXTRACT_U_1(p + 3) & 0x80))) || (ielength > 5) || - !(EXTRACT_8BITS(p + ielength - 1) & 0x80)) { + !(EXTRACT_U_1(p + ielength - 1) & 0x80)) { ND_PRINT((ndo, "Invalid DLCI in PVC STATUS IE")); return 1; } - dlci = ((EXTRACT_8BITS(p) & 0x3F) << 4) | ((EXTRACT_8BITS(p+1) & 0x78) >> 3); + dlci = ((EXTRACT_U_1(p) & 0x3F) << 4) | ((EXTRACT_U_1(p + 1) & 0x78) >> 3); if (ielength == 4) { - dlci = (dlci << 6) | ((EXTRACT_8BITS(p+2) & 0x7E) >> 1); + dlci = (dlci << 6) | ((EXTRACT_U_1(p + 2) & 0x7E) >> 1); } else if (ielength == 5) { - dlci = (dlci << 13) | (EXTRACT_8BITS(p+2) & 0x7F) | ((EXTRACT_8BITS(p+3) & 0x7E) >> 1); + dlci = (dlci << 13) | (EXTRACT_U_1(p + 2) & 0x7F) | ((EXTRACT_U_1(p + 3) & 0x7E) >> 1); } ND_PRINT((ndo, "DLCI %u: status %s%s", dlci, - EXTRACT_8BITS(p + ielength - 1) & 0x8 ? "New, " : "", - EXTRACT_8BITS(p + ielength - 1) & 0x2 ? "Active" : "Inactive")); + EXTRACT_U_1(p + ielength - 1) & 0x8 ? "New, " : "", + EXTRACT_U_1(p + ielength - 1) & 0x2 ? "Active" : "Inactive")); return 1; } diff --git a/print-frag6.c b/print-frag6.c index 59b9dfef..fe8f3cf7 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_BE_32BITS(&dp->ip6f_ident), - EXTRACT_BE_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK, - sizeof(struct ip6_hdr) + EXTRACT_BE_16BITS(&ip6->ip6_plen) - + EXTRACT_BE_U_4(&dp->ip6f_ident), + EXTRACT_BE_U_2(&dp->ip6f_offlg) & IP6F_OFF_MASK, + sizeof(struct ip6_hdr) + EXTRACT_BE_U_2(&ip6->ip6_plen) - (long)(bp - bp2) - sizeof(struct ip6_frag))); } else { ND_PRINT((ndo, "frag (%d|%ld)", - EXTRACT_BE_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK, - sizeof(struct ip6_hdr) + EXTRACT_BE_16BITS(&ip6->ip6_plen) - + EXTRACT_BE_U_2(&dp->ip6f_offlg) & IP6F_OFF_MASK, + sizeof(struct ip6_hdr) + EXTRACT_BE_U_2(&ip6->ip6_plen) - (long)(bp - bp2) - sizeof(struct ip6_frag))); } /* it is meaningless to decode non-first fragment */ - if ((EXTRACT_BE_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK) != 0) + if ((EXTRACT_BE_U_2(&dp->ip6f_offlg) & IP6F_OFF_MASK) != 0) return -1; else { diff --git a/print-geneve.c b/print-geneve.c index 9ca7bf2e..140a722b 100644 --- a/print-geneve.c +++ b/print-geneve.c @@ -112,8 +112,8 @@ geneve_opts_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_PRINT((ndo, "%s", sep)); sep = ", "; - opt_class = EXTRACT_BE_16BITS(bp); - opt_type = EXTRACT_8BITS(bp + 2); + opt_class = EXTRACT_BE_U_2(bp); + opt_type = EXTRACT_U_1(bp + 2); opt_len = 4 + ((*(bp + 3) & OPT_LEN_MASK) * 4); ND_PRINT((ndo, "class %s (0x%x) type 0x%x%s len %u", @@ -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_BE_32BITS(data))); + ND_PRINT((ndo, " %08x", EXTRACT_BE_U_4(data))); data++; } } @@ -157,7 +157,7 @@ geneve_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_TCHECK2(*bp, 8); - ver_opt = EXTRACT_8BITS(bp); + ver_opt = EXTRACT_U_1(bp); bp += 1; len -= 1; @@ -167,19 +167,19 @@ geneve_print(netdissect_options *ndo, const u_char *bp, u_int len) return; } - flags = EXTRACT_8BITS(bp); + flags = EXTRACT_U_1(bp); bp += 1; len -= 1; - prot = EXTRACT_BE_16BITS(bp); + prot = EXTRACT_BE_U_2(bp); bp += 2; len -= 2; - vni = EXTRACT_BE_24BITS(bp); + vni = EXTRACT_BE_U_3(bp); bp += 3; len -= 3; - reserved = EXTRACT_8BITS(bp); + reserved = EXTRACT_U_1(bp); bp += 1; len -= 1; diff --git a/print-geonet.c b/print-geonet.c index f30e434b..1e98fc5f 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_BE_16BITS(bp + 0); - uint16_t src = EXTRACT_BE_16BITS(bp + 2); + uint16_t dest = EXTRACT_BE_U_2(bp + 0); + uint16_t src = EXTRACT_BE_U_2(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_BE_32BITS(bp + 12); + lat = EXTRACT_BE_U_4(bp + 12); ND_PRINT((ndo, "lat:%d ", lat)); - lon = EXTRACT_BE_32BITS(bp + 16); + lon = EXTRACT_BE_U_4(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_BE_16BITS(bp + 4); + payload_length = EXTRACT_BE_U_2(bp + 4); hop_limit = bp[7]; switch (next_hdr) { diff --git a/print-gre.c b/print-gre.c index a11cb9b8..64768d6a 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_BE_16BITS(bp) & GRE_VERS_MASK; + vers = EXTRACT_BE_U_2(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_BE_16BITS(bp); + flags = EXTRACT_BE_U_2(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_BE_16BITS(bp); + prot = EXTRACT_BE_U_2(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_BE_16BITS(bp))); + ND_PRINT((ndo, ", sum 0x%x", EXTRACT_BE_U_2(bp))); bp += 2; len -= 2; ND_TCHECK2(*bp, 2); if (len < 2) goto trunc; - ND_PRINT((ndo, ", off 0x%x", EXTRACT_BE_16BITS(bp))); + ND_PRINT((ndo, ", off 0x%x", EXTRACT_BE_U_2(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_BE_32BITS(bp))); + ND_PRINT((ndo, ", key=0x%x", EXTRACT_BE_U_4(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_BE_32BITS(bp))); + ND_PRINT((ndo, ", seq %u", EXTRACT_BE_U_4(bp))); bp += 4; len -= 4; } @@ -179,9 +179,9 @@ gre_print_0(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK2(*bp, 4); if (len < 4) goto trunc; - af = EXTRACT_BE_16BITS(bp); - sreoff = EXTRACT_8BITS(bp + 2); - srelen = EXTRACT_8BITS(bp + 3); + af = EXTRACT_BE_U_2(bp); + sreoff = EXTRACT_U_1(bp + 2); + srelen = EXTRACT_U_1(bp + 3); bp += 4; len -= 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_BE_16BITS(bp); + flags = EXTRACT_BE_U_2(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_BE_16BITS(bp); + prot = EXTRACT_BE_U_2(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_BE_32BITS(bp); + k = EXTRACT_BE_U_4(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_BE_32BITS(bp))); + ND_PRINT((ndo, ", seq %u", EXTRACT_BE_U_4(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_BE_32BITS(bp))); + ND_PRINT((ndo, ", ack %u", EXTRACT_BE_U_4(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_BE_16BITS(bp))); + EXTRACT_BE_U_2(bp))); bp += 2; len -= 2; diff --git a/print-hncp.c b/print-hncp.c index 068a2391..4057e519 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_BE_64BITS(data), - EXTRACT_BE_64BITS(data + 8), - EXTRACT_BE_64BITS(data + 16), - EXTRACT_BE_64BITS(data + 24) + EXTRACT_BE_U_8(data), + EXTRACT_BE_U_8(data + 8), + EXTRACT_BE_U_8(data + 16), + EXTRACT_BE_U_8(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_BE_16BITS(tlv); - optlen = EXTRACT_BE_16BITS(tlv + 2); + type = EXTRACT_BE_U_2(tlv); + optlen = EXTRACT_BE_U_2(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_BE_16BITS(tlv); - bodylen = EXTRACT_BE_16BITS(tlv + 2); + type = EXTRACT_BE_U_2(tlv); + bodylen = EXTRACT_BE_U_2(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_BE_32BITS(value + 4); + endpoint_identifier = EXTRACT_BE_U_4(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_BE_64BITS(value); + hash = EXTRACT_BE_U_8(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_BE_32BITS(value + 4); - interval = format_interval(EXTRACT_BE_32BITS(value + 8)); - hash = EXTRACT_BE_64BITS(value + 12); + sequence_number = EXTRACT_BE_U_4(value + 4); + interval = format_interval(EXTRACT_BE_U_4(value + 8)); + hash = EXTRACT_BE_U_8(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_BE_32BITS(value + 4); - endpoint_identifier = EXTRACT_BE_32BITS(value + 8); + peer_endpoint_identifier = EXTRACT_BE_U_4(value + 4); + endpoint_identifier = EXTRACT_BE_U_4(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_BE_32BITS(value); - interval = format_interval(EXTRACT_BE_32BITS(value + 4)); + endpoint_identifier = EXTRACT_BE_U_4(value); + interval = format_interval(EXTRACT_BE_U_4(value + 4)); ND_PRINT((ndo, " EPID: %08x Interval: %s", endpoint_identifier, interval @@ -580,7 +580,7 @@ hncp_print_rec(netdissect_options *ndo, break; } ND_PRINT((ndo, " Verdict: %u Fingerprint: %s Common Name: ", - EXTRACT_8BITS(value), + EXTRACT_U_1(value), format_256(value + 4))); safeputs(ndo, value + 36, bodylen - 36); } @@ -593,7 +593,7 @@ hncp_print_rec(netdissect_options *ndo, ND_PRINT((ndo, " %s", istr)); break; } - capabilities = EXTRACT_BE_16BITS(value + 2); + capabilities = EXTRACT_BE_U_2(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_BE_32BITS(value)), - format_interval(EXTRACT_BE_32BITS(value + 4)) + format_interval(EXTRACT_BE_U_4(value)), + format_interval(EXTRACT_BE_U_4(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_BE_32BITS(value), + EXTRACT_BE_U_4(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_BE_32BITS(value); + endpoint_identifier = EXTRACT_BE_U_4(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 38cdba3e..b949ffb1 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_BE_16BITS(&dp->icmp_id), - EXTRACT_BE_16BITS(&dp->icmp_seq)); + EXTRACT_BE_U_2(&dp->icmp_id), + EXTRACT_BE_U_2(&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_BE_16BITS(&ouh->uh_dport); + dport = EXTRACT_BE_U_2(&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_BE_16BITS(&mp->nexthopmtu); + mtu = EXTRACT_BE_U_2(&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_BE_16BITS(&ihp->ird_lifetime); + lifetime = EXTRACT_BE_U_2(&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_BE_32BITS(&idp->ird_pref)); + EXTRACT_BE_U_4(&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_BE_32BITS(&dp->icmp_mask)); + EXTRACT_BE_U_4(&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_BE_16BITS(&dp->icmp_id), - EXTRACT_BE_16BITS(&dp->icmp_seq)); + EXTRACT_BE_U_2(&dp->icmp_id), + EXTRACT_BE_U_2(&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_BE_16BITS(&dp->icmp_id), - EXTRACT_BE_16BITS(&dp->icmp_seq), - icmp_tstamp_print(EXTRACT_BE_32BITS(&dp->icmp_otime))); + EXTRACT_BE_U_2(&dp->icmp_id), + EXTRACT_BE_U_2(&dp->icmp_seq), + icmp_tstamp_print(EXTRACT_BE_U_4(&dp->icmp_otime))); (void)snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", recv %s", - icmp_tstamp_print(EXTRACT_BE_32BITS(&dp->icmp_rtime))); + icmp_tstamp_print(EXTRACT_BE_U_4(&dp->icmp_rtime))); (void)snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", xmit %s", - icmp_tstamp_print(EXTRACT_BE_32BITS(&dp->icmp_ttime))); + icmp_tstamp_print(EXTRACT_BE_U_4(&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_BE_16BITS(&dp->icmp_cksum); + uint16_t icmp_sum = EXTRACT_BE_U_2(&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_2(&ip->ip_len); - ip_print(ndo, bp, EXTRACT_BE_16BITS(&ip->ip_len)); + ip_print(ndo, bp, EXTRACT_BE_U_2(&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_BE_16BITS(ext_dp->icmp_ext_checksum), + EXTRACT_BE_U_2(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_BE_16BITS(icmp_mpls_ext_object_header->length); + obj_tlen = EXTRACT_BE_U_2(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_BE_32BITS(obj_tptr); + raw_label = EXTRACT_BE_U_4(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 bd920faf..fe32e6fb 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -617,7 +617,7 @@ print_lladdr(netdissect_options *ndo, const uint8_t *p, size_t l) while (l > 0 && q < ep) { if (q > p) ND_PRINT((ndo,":")); - ND_PRINT((ndo,"%02x", EXTRACT_8BITS(q))); + ND_PRINT((ndo,"%02x", EXTRACT_U_1(q))); q++; l--; } @@ -705,7 +705,7 @@ rpl_dio_print(netdissect_options *ndo, dagid_str, dio->rpl_dtsn, dio->rpl_instanceid, - EXTRACT_BE_16BITS(&dio->rpl_dagrank), + EXTRACT_BE_U_2(&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))); @@ -891,7 +891,7 @@ icmp6_print(netdissect_options *ndo, uint16_t sum, udp_sum; if (ND_TTEST2(bp[0], length)) { - udp_sum = EXTRACT_BE_16BITS(&dp->icmp6_cksum); + udp_sum = EXTRACT_BE_U_2(&dp->icmp6_cksum); sum = icmp6_cksum(ndo, ip, dp, length); if (sum != 0) ND_PRINT((ndo,"[bad icmp6 cksum 0x%04x -> 0x%04x!] ", @@ -935,7 +935,7 @@ icmp6_print(netdissect_options *ndo, == NULL) goto trunc; - dport = EXTRACT_BE_16BITS(&ouh->uh_dport); + dport = EXTRACT_BE_U_2(&ouh->uh_dport); switch (prot) { case IPPROTO_TCP: ND_PRINT((ndo,", %s tcp port %s", @@ -964,7 +964,7 @@ icmp6_print(netdissect_options *ndo, break; case ICMP6_PACKET_TOO_BIG: ND_TCHECK(dp->icmp6_mtu); - ND_PRINT((ndo,", mtu %u", EXTRACT_BE_32BITS(&dp->icmp6_mtu))); + ND_PRINT((ndo,", mtu %u", EXTRACT_BE_U_4(&dp->icmp6_mtu))); break; case ICMP6_TIME_EXCEEDED: ND_TCHECK(oip->ip6_dst); @@ -985,13 +985,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_BE_32BITS(&dp->icmp6_pptr))); + ND_PRINT((ndo,", erroneous - octet %u", EXTRACT_BE_U_4(&dp->icmp6_pptr))); break; case ICMP6_PARAMPROB_NEXTHEADER: - ND_PRINT((ndo,", next header - octet %u", EXTRACT_BE_32BITS(&dp->icmp6_pptr))); + ND_PRINT((ndo,", next header - octet %u", EXTRACT_BE_U_4(&dp->icmp6_pptr))); break; case ICMP6_PARAMPROB_OPTION: - ND_PRINT((ndo,", option - octet %u", EXTRACT_BE_32BITS(&dp->icmp6_pptr))); + ND_PRINT((ndo,", option - octet %u", EXTRACT_BE_U_4(&dp->icmp6_pptr))); break; default: ND_PRINT((ndo,", code-#%d", @@ -1002,7 +1002,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_BE_16BITS(&dp->icmp6_seq))); + ND_PRINT((ndo,", seq %u", EXTRACT_BE_U_2(&dp->icmp6_seq))); break; case ICMP6_MEMBERSHIP_QUERY: if (length == MLD_MINLEN) { @@ -1039,9 +1039,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_BE_16BITS(&p->nd_ra_router_lifetime), - EXTRACT_BE_32BITS(&p->nd_ra_reachable), - EXTRACT_BE_32BITS(&p->nd_ra_retransmit))); + EXTRACT_BE_U_2(&p->nd_ra_router_lifetime), + EXTRACT_BE_U_4(&p->nd_ra_reachable), + EXTRACT_BE_U_4(&p->nd_ra_retransmit))); icmp6_opt_print(ndo, (const u_char *)dp + RTADVLEN, length - RTADVLEN); @@ -1072,7 +1072,7 @@ icmp6_print(netdissect_options *ndo, ND_PRINT((ndo,", Flags [%s]", bittok2str(icmp6_nd_na_flag_values, "none", - EXTRACT_BE_32BITS(&p->nd_na_flags_reserved)))); + EXTRACT_BE_U_4(&p->nd_na_flags_reserved)))); #define NDADVLEN 24 icmp6_opt_print(ndo, (const u_char *)dp + NDADVLEN, length - NDADVLEN); @@ -1111,7 +1111,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_BE_16BITS(&dp->icmp6_data16[0]))); + ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_U_2(&dp->icmp6_data16[0]))); break; case ICMP6_HADISCOV_REPLY: if (ndo->ndo_vflag) { @@ -1119,7 +1119,7 @@ icmp6_print(netdissect_options *ndo, const u_char *cp; ND_TCHECK(dp->icmp6_data16[0]); - ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_16BITS(&dp->icmp6_data16[0]))); + ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_U_2(&dp->icmp6_data16[0]))); cp = (const u_char *)dp + length; in6 = (const struct in6_addr *)(dp + 1); for (; (const u_char *)in6 < cp; in6++) { @@ -1131,7 +1131,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_BE_16BITS(&dp->icmp6_data16[0]))); + ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_U_2(&dp->icmp6_data16[0]))); ND_TCHECK(dp->icmp6_data16[1]); if (dp->icmp6_data16[1] & 0xc0) ND_PRINT((ndo," ")); @@ -1212,7 +1212,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_BE_16BITS(&fragh->ip6f_offlg) & IP6F_OFF_MASK) != 0) + if ((EXTRACT_BE_U_2(&fragh->ip6f_offlg) & IP6F_OFF_MASK) != 0) return(NULL); nh = fragh->ip6f_nxt; hlen = sizeof(struct ip6_frag); @@ -1292,8 +1292,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_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)))); + get_lifetime(EXTRACT_BE_U_4(&opp->nd_opt_pi_valid_time)))); + ND_PRINT((ndo,", pref. time %s", get_lifetime(EXTRACT_BE_U_4(&opp->nd_opt_pi_preferred_time)))); break; case ND_OPT_REDIRECTED_HEADER: print_unknown_data(ndo, bp,"\n\t ",op->nd_opt_len<<3); @@ -1303,14 +1303,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_BE_32BITS(&opm->nd_opt_mtu_mtu), + EXTRACT_BE_U_4(&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_BE_32BITS(&oprd->nd_opt_rdnss_lifetime))); + EXTRACT_BE_U_4(&oprd->nd_opt_rdnss_lifetime))); for (i = 0; i < l; i++) { ND_TCHECK(oprd->nd_opt_rdnss_addr[i]); ND_PRINT((ndo," addr: %s", @@ -1320,7 +1320,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_BE_32BITS(&opds->nd_opt_dnssl_lifetime))); + EXTRACT_BE_U_4(&opds->nd_opt_dnssl_lifetime))); domp = cp + 8; /* domain names, variable-sized, RFC1035-encoded */ while (domp < cp + (op->nd_opt_len << 3) && *domp != '\0') { @@ -1332,14 +1332,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_BE_32BITS(&opa->nd_opt_adv_interval))); + ND_PRINT((ndo," %ums", EXTRACT_BE_U_4(&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_BE_16BITS(&oph->nd_opt_hai_preference), - EXTRACT_BE_16BITS(&oph->nd_opt_hai_lifetime))); + EXTRACT_BE_U_2(&oph->nd_opt_hai_preference), + EXTRACT_BE_U_2(&oph->nd_opt_hai_lifetime))); break; case ND_OPT_ROUTE_INFO: opri = (const struct nd_opt_route_info *)op; @@ -1364,7 +1364,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_BE_32BITS(&opri->nd_opt_rti_lifetime)))); + get_lifetime(EXTRACT_BE_U_4(&opri->nd_opt_rti_lifetime)))); break; default: if (ndo->ndo_vflag <= 1) { @@ -1400,7 +1400,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_BE_16BITS(&mp->mld6_maxdelay))); + ND_PRINT((ndo,"max resp delay: %d ", EXTRACT_BE_U_2(&mp->mld6_maxdelay))); ND_PRINT((ndo,"addr: %s", ip6addr_string(ndo, &mp->mld6_addr))); } @@ -1418,7 +1418,7 @@ mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len) } ND_TCHECK(icp->icmp6_data16[1]); - ngroups = EXTRACT_BE_16BITS(&icp->icmp6_data16[1]); + ngroups = EXTRACT_BE_U_2(&icp->icmp6_data16[1]); ND_PRINT((ndo,", %d group record(s)", ngroups)); if (ndo->ndo_vflag > 0) { /* Print the group records */ @@ -1477,7 +1477,7 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len) return; } ND_TCHECK(icp->icmp6_data16[0]); - mrc = EXTRACT_BE_16BITS(&icp->icmp6_data16[0]); + mrc = EXTRACT_BE_U_2(&icp->icmp6_data16[0]); if (mrc < 32768) { mrt = mrc; } else { @@ -1506,7 +1506,7 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len) } ND_TCHECK2(bp[26], 2); - nsrcs = EXTRACT_BE_16BITS(bp + 26); + nsrcs = EXTRACT_BE_U_2(bp + 26); if (nsrcs > 0) { if (len < 28 + nsrcs * sizeof(struct in6_addr)) ND_PRINT((ndo," [invalid number of sources]")); @@ -1536,7 +1536,7 @@ dnsname_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) /* DNS name decoding - no decompression */ ND_PRINT((ndo,", \"")); while (cp < ep) { - i = EXTRACT_8BITS(cp); + i = EXTRACT_U_1(cp); cp++; if (i) { if (i > ep - cp) { @@ -1547,7 +1547,7 @@ dnsname_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) safeputchar(ndo, *cp); cp++; } - if (cp + 1 < ep && EXTRACT_8BITS(cp)) + if (cp + 1 < ep && EXTRACT_U_1(cp)) ND_PRINT((ndo,".")); } else { if (cp == ep) { @@ -1592,13 +1592,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_BE_16BITS(&ni6->ni_qtype)) { + switch (EXTRACT_BE_U_2(&ni6->ni_qtype)) { case NI_QTYPE_NOOP: ND_PRINT((ndo,"noop")); break; case NI_QTYPE_SUPTYPES: ND_PRINT((ndo,"supported qtypes")); - i = EXTRACT_BE_16BITS(&ni6->ni_flags); + i = EXTRACT_BE_U_2(&ni6->ni_flags); if (i) ND_PRINT((ndo," [%s]", (i & 0x01) ? "C" : "")); break; @@ -1734,7 +1734,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, break; } - switch (EXTRACT_BE_16BITS(&ni6->ni_qtype)) { + switch (EXTRACT_BE_U_2(&ni6->ni_qtype)) { case NI_QTYPE_NOOP: if (needcomma) ND_PRINT((ndo,", ")); @@ -1747,7 +1747,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_BE_16BITS(&ni6->ni_flags); + i = EXTRACT_BE_U_2(&ni6->ni_flags); if (i) ND_PRINT((ndo," [%s]", (i & 0x01) ? "C" : "")); break; @@ -1770,8 +1770,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_BE_16BITS(&ni6->ni_flags) & 0x01) != 0) - ND_PRINT((ndo," [TTL=%u]", EXTRACT_BE_32BITS(ni6 + 1))); + if ((EXTRACT_BE_U_2(&ni6->ni_flags) & 0x01) != 0) + ND_PRINT((ndo," [TTL=%u]", EXTRACT_BE_U_4(ni6 + 1))); break; case NI_QTYPE_NODEADDR: if (needcomma) @@ -1783,7 +1783,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_BE_32BITS(bp + i))); + ND_PRINT((ndo,"(%d)", (int32_t) EXTRACT_BE_U_4(bp + i))); i += sizeof(int32_t); } i = ni6->ni_flags; @@ -1846,7 +1846,7 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep) break; } - ND_PRINT((ndo,", seq=%u", EXTRACT_BE_32BITS(&rr6->rr_seqnum))); + ND_PRINT((ndo,", seq=%u", EXTRACT_BE_U_4(&rr6->rr_seqnum))); if (ndo->ndo_vflag) { #define F(x, y) ((rr6->rr_flags) & (x) ? (y) : "") @@ -1859,9 +1859,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_BE_16BITS(&rr6->rr_maxdelay))); + ND_PRINT((ndo,"maxdelay=%u", EXTRACT_BE_U_2(&rr6->rr_maxdelay))); if (rr6->rr_reserved) - ND_PRINT((ndo,"rsvd=0x%x", EXTRACT_BE_32BITS(&rr6->rr_reserved))); + ND_PRINT((ndo,"rsvd=0x%x", EXTRACT_BE_U_4(&rr6->rr_reserved))); /*[*/ ND_PRINT((ndo,"]")); #undef F @@ -1926,12 +1926,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_BE_32BITS(&use->rpu_vltime))); + EXTRACT_BE_U_4(&use->rpu_vltime))); if (~use->rpu_pltime == 0) ND_PRINT((ndo,"pltime=infty,")); else ND_PRINT((ndo,"pltime=%u,", - EXTRACT_BE_32BITS(&use->rpu_pltime))); + EXTRACT_BE_U_4(&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 44da9203..0bc56f08 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_BE_32BITS(&tr->tr_rttlqid)), + TR_GETQID(EXTRACT_BE_U_4(&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_BE_32BITS(&tr->tr_raddr))) - ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_BE_32BITS(&tr->tr_rttlqid)))); + if (IN_CLASSD(EXTRACT_BE_U_4(&tr->tr_raddr))) + ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_BE_U_4(&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_BE_32BITS(&tr->tr_rttlqid)), + (u_long)TR_GETQID(EXTRACT_BE_U_4(&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_BE_32BITS(&tr->tr_raddr))) - ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_BE_32BITS(&tr->tr_rttlqid)))); + if (IN_CLASSD(EXTRACT_BE_U_4(&tr->tr_raddr))) + ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_BE_U_4(&tr->tr_rttlqid)))); return; trunc: ND_PRINT((ndo, "%s", tstr)); @@ -159,7 +159,7 @@ print_igmpv3_report(netdissect_options *ndo, return; } ND_TCHECK_2(bp + 6); - ngroups = EXTRACT_BE_16BITS(bp + 6); + ngroups = EXTRACT_BE_U_2(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_BE_16BITS(bp + group + 2); + nsrcs = EXTRACT_BE_U_2(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)); @@ -216,7 +216,7 @@ print_igmpv3_query(netdissect_options *ndo, return; } ND_TCHECK_1(bp + 1); - mrc = EXTRACT_8BITS(bp + 1); + mrc = EXTRACT_U_1(bp + 1); if (mrc < 128) { mrt = mrc; } else { @@ -232,11 +232,11 @@ print_igmpv3_query(netdissect_options *ndo, ND_PRINT((ndo, "]")); } ND_TCHECK_4(bp + 4); - if (EXTRACT_BE_32BITS(bp + 4) == 0) + if (EXTRACT_BE_U_4(bp + 4) == 0) return; ND_PRINT((ndo, " [gaddr %s", ipaddr_string(ndo, &bp[4]))); ND_TCHECK_2(bp + 10); - nsrcs = EXTRACT_BE_16BITS(bp + 10); + nsrcs = EXTRACT_BE_U_2(bp + 10); if (nsrcs > 0) { if (len < 12 + (nsrcs << 2)) ND_PRINT((ndo, " [invalid number of sources]")); @@ -268,21 +268,21 @@ igmp_print(netdissect_options *ndo, } ND_TCHECK_1(bp); - switch (EXTRACT_8BITS(bp)) { + switch (EXTRACT_U_1(bp)) { case 0x11: ND_PRINT((ndo, "igmp query")); if (len >= 12) print_igmpv3_query(ndo, bp, len); else { ND_TCHECK_1(bp + 1); - if (EXTRACT_8BITS(bp + 1)) { + if (EXTRACT_U_1(bp + 1)) { ND_PRINT((ndo, " v2")); - if (EXTRACT_8BITS(bp + 1) != 100) - ND_PRINT((ndo, " [max resp time %u]", EXTRACT_8BITS(bp + 1))); + if (EXTRACT_U_1(bp + 1) != 100) + ND_PRINT((ndo, " [max resp time %u]", EXTRACT_U_1(bp + 1))); } else ND_PRINT((ndo, " v1")); ND_TCHECK_4(bp + 4); - if (EXTRACT_BE_32BITS(bp + 4)) + if (EXTRACT_BE_U_4(bp + 4)) ND_PRINT((ndo, " [gaddr %s]", ipaddr_string(ndo, &bp[4]))); if (len != 8) ND_PRINT((ndo, " [len %d]", len)); @@ -324,7 +324,7 @@ igmp_print(netdissect_options *ndo, print_mtrace(ndo, bp, len); break; default: - ND_PRINT((ndo, "igmp-%d", EXTRACT_8BITS(bp))); + ND_PRINT((ndo, "igmp-%d", EXTRACT_U_1(bp))); break; } @@ -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_BE_16BITS(bp + 2))); + ND_PRINT((ndo, " bad igmp cksum %x!", EXTRACT_BE_U_2(bp + 2))); } return; trunc: diff --git a/print-igrp.c b/print-igrp.c index f824e1e1..6cd4f69e 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_BE_24BITS(igr->igr_dly); - bandwidth = EXTRACT_BE_24BITS(igr->igr_bw); + delay = EXTRACT_BE_U_3(igr->igr_dly); + bandwidth = EXTRACT_BE_U_3(igr->igr_bw); metric = bandwidth + delay; if (metric > 0xffffff) metric = 0xffffff; - mtu = EXTRACT_BE_16BITS(igr->igr_mtu); + mtu = EXTRACT_BE_U_2(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_BE_16BITS(&hdr->ig_ni); - nsys = EXTRACT_BE_16BITS(&hdr->ig_ns); - next = EXTRACT_BE_16BITS(&hdr->ig_nx); + nint = EXTRACT_BE_U_2(&hdr->ig_ni); + nsys = EXTRACT_BE_U_2(&hdr->ig_ns); + next = EXTRACT_BE_U_2(&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_BE_16BITS(&hdr->ig_as), + EXTRACT_BE_U_2(&hdr->ig_as), nint, nsys, next)); @@ -220,7 +220,7 @@ ip_printts(netdissect_options *ndo, if (ptr == len) type = " ^ "; ND_TCHECK2(cp[len], hoplen); - ND_PRINT((ndo, "%s%d@%s", type, EXTRACT_BE_32BITS(cp + len + hoplen - 4), + ND_PRINT((ndo, "%s%d@%s", type, EXTRACT_BE_U_4(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_BE_16BITS(cp + 2) != 0) - ND_PRINT((ndo, " value %u", EXTRACT_BE_16BITS(cp + 2))); + if (EXTRACT_BE_U_2(cp + 2) != 0) + ND_PRINT((ndo, " value %u", EXTRACT_BE_U_2(cp + 2))); break; case IPOPT_NOP: /* nothing to print - fall through */ @@ -566,7 +566,7 @@ ip_print(netdissect_options *ndo, return; } - ipds->len = EXTRACT_BE_16BITS(&ipds->ip->ip_len); + ipds->len = EXTRACT_BE_U_2(&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_BE_16BITS(&ipds->ip->ip_off); + ipds->off = EXTRACT_BE_U_2(&ipds->ip->ip_off); if (ndo->ndo_vflag) { ND_PRINT((ndo, "(tos 0x%x", 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_BE_16BITS(&ipds->ip->ip_id), + EXTRACT_BE_U_2(&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_BE_16BITS(&ipds->ip->ip_len))); + ND_PRINT((ndo, ", length %u", EXTRACT_BE_U_2(&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_BE_16BITS(&ipds->ip->ip_sum); + ip_sum = EXTRACT_BE_U_2(&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 fc296b81..e13b365a 100644 --- a/print-ip6.c +++ b/print-ip6.c @@ -77,7 +77,7 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst, * the first 8 octets. */ ND_TCHECK2(*cp, 2); - advance = (EXTRACT_8BITS(cp + 1) + 1) << 3; + advance = (EXTRACT_U_1(cp + 1) + 1) << 3; nh = *cp; break; @@ -239,14 +239,14 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) return; } - payload_len = EXTRACT_BE_16BITS(&ip6->ip6_plen); + payload_len = EXTRACT_BE_U_2(&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_BE_32BITS(&ip6->ip6_flow); + flow = EXTRACT_BE_U_4(&ip6->ip6_flow); ND_PRINT((ndo, "(")); #if 0 /* rfc1883 */ @@ -297,19 +297,19 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) advance = hbhopt_print(ndo, cp); if (advance < 0) return; - nh = EXTRACT_8BITS(cp); + nh = EXTRACT_U_1(cp); break; case IPPROTO_DSTOPTS: advance = dstopt_print(ndo, cp); if (advance < 0) return; - nh = EXTRACT_8BITS(cp); + nh = EXTRACT_U_1(cp); break; case IPPROTO_FRAGMENT: advance = frag6_print(ndo, cp, (const u_char *)ip6); if (advance < 0 || ndo->ndo_snapend <= cp + advance) return; - nh = EXTRACT_8BITS(cp); + nh = EXTRACT_U_1(cp); fragmented = 1; break; @@ -326,14 +326,14 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) advance = mobility_print(ndo, cp, (const u_char *)ip6); if (advance < 0) return; - nh = EXTRACT_8BITS(cp); + nh = EXTRACT_U_1(cp); return; case IPPROTO_ROUTING: ND_TCHECK(*cp); advance = rt6_print(ndo, cp, (const u_char *)ip6); if (advance < 0) return; - nh = EXTRACT_8BITS(cp); + nh = EXTRACT_U_1(cp); break; case IPPROTO_SCTP: sctp_print(ndo, cp, (const u_char *)ip6, len); @@ -354,7 +354,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) advance = ah_print(ndo, cp); if (advance < 0) return; - nh = EXTRACT_8BITS(cp); + nh = EXTRACT_U_1(cp); break; case IPPROTO_ESP: { diff --git a/print-ip6opts.c b/print-ip6opts.c index c4edd4b6..d3cac60c 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_BE_16BITS(bp + i + 2))); + ND_PRINT((ndo, "(rtalert: 0x%04x) ", EXTRACT_BE_U_2(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_BE_32BITS(bp + i + 2))); + ND_PRINT((ndo, "(jumbo: %u) ", EXTRACT_BE_U_4(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 d96c30f1..8e5252b2 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_BE_16BITS(&ipcomp->comp_cpi); + cpi = EXTRACT_BE_U_2(&ipcomp->comp_cpi); ND_PRINT((ndo, "IPComp(cpi=0x%04x)", cpi)); diff --git a/print-ipx.c b/print-ipx.c index 9574d477..0c42c54d 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_BE_32BITS(ipx->srcNet), ipx->srcNode), - EXTRACT_BE_16BITS(&ipx->srcSkt))); + ipxaddr_string(EXTRACT_BE_U_4(ipx->srcNet), ipx->srcNode), + EXTRACT_BE_U_2(&ipx->srcSkt))); ND_PRINT((ndo, "%s.%04x: ", - ipxaddr_string(EXTRACT_BE_32BITS(ipx->dstNet), ipx->dstNode), - EXTRACT_BE_16BITS(&ipx->dstSkt))); + ipxaddr_string(EXTRACT_BE_U_4(ipx->dstNet), ipx->dstNode), + EXTRACT_BE_U_2(&ipx->dstSkt))); /* take length from ipx header */ ND_TCHECK(ipx->length); - length = EXTRACT_BE_16BITS(&ipx->length); + length = EXTRACT_BE_U_2(&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_BE_16BITS(&ipx->dstSkt); + dstSkt = EXTRACT_BE_U_2(&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_BE_16BITS(ipx); + command = EXTRACT_BE_U_2(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_BE_16BITS(ipx))))); + ND_PRINT((ndo, " %s", ipxsap_string(ndo, htons(EXTRACT_BE_U_2(ipx))))); 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_BE_16BITS(ipx))))); + ND_PRINT((ndo, " %s '", ipxsap_string(ndo, htons(EXTRACT_BE_U_2(ipx))))); 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_BE_32BITS(ipx + 25), (const u_char *)&ipx[27]))); + ipxaddr_string(EXTRACT_BE_U_4(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_BE_16BITS(ipx); + command = EXTRACT_BE_U_2(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_BE_32BITS(ipx), - EXTRACT_BE_16BITS(ipx + 2), EXTRACT_BE_16BITS(ipx + 3))); + ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_U_4(ipx), + EXTRACT_BE_U_2(ipx + 2), EXTRACT_BE_U_2(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_BE_32BITS(ipx), - EXTRACT_BE_16BITS(ipx + 2), EXTRACT_BE_16BITS(ipx + 3))); + ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_U_4(ipx), + EXTRACT_BE_U_2(ipx + 2), EXTRACT_BE_U_2(ipx + 3))); ipx += 4; length -= 8; diff --git a/print-isakmp.c b/print-isakmp.c index ea8ed264..e902b0b6 100644 --- a/print-isakmp.c +++ b/print-isakmp.c @@ -923,7 +923,7 @@ ikev1_attrmap_print(netdissect_options *ndo, totlen = 4; else { ND_TCHECK_2(&p[2]); - totlen = 4 + EXTRACT_BE_16BITS(p + 2); + totlen = 4 + EXTRACT_BE_U_2(p + 2); } if (ep2 < p + totlen) { ND_PRINT((ndo,"[|attr]")); @@ -932,7 +932,7 @@ ikev1_attrmap_print(netdissect_options *ndo, ND_TCHECK_2(&p[0]); ND_PRINT((ndo,"(")); - t = EXTRACT_BE_16BITS(p) & 0x7fff; + t = EXTRACT_BE_U_2(p) & 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_2(&p[2]); - v = EXTRACT_BE_16BITS(p + 2); + v = EXTRACT_BE_U_2(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_2(&p[2]); - totlen = 4 + EXTRACT_BE_16BITS(p + 2); + totlen = 4 + EXTRACT_BE_U_2(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_2(&p[0]); ND_PRINT((ndo,"(")); - t = EXTRACT_BE_16BITS(p) & 0x7fff; + t = EXTRACT_BE_U_2(p) & 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_BE_32BITS(cp) ? "en" : "dis")); + EXTRACT_BE_U_4(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_BE_32BITS(base->msgid) == 0) ? 1 : 2; + phase = (EXTRACT_BE_U_4(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_BE_32BITS(base->msgid) == 0) ? 1 : 2; + phase = (EXTRACT_BE_U_4(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 c60786b0..20505175 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -678,7 +678,7 @@ isoclns_print(netdissect_options *ndo, const uint8_t *p, u_int length) } if (ndo->ndo_eflag) - ND_PRINT((ndo, "OSI NLPID %s (0x%02x): ", tok2str(nlpid_values, "Unknown", EXTRACT_8BITS(p)), *p)); + ND_PRINT((ndo, "OSI NLPID %s (0x%02x): ", tok2str(nlpid_values, "Unknown", EXTRACT_U_1(p)), *p)); switch (*p) { @@ -798,7 +798,7 @@ clnp_print(netdissect_options *ndo, if (li < sizeof(struct clnp_header_t)) { ND_PRINT((ndo, " length indicator %u < min PDU size:", li)); while (pptr < ndo->ndo_snapend) { - ND_PRINT((ndo, "%02X", EXTRACT_8BITS(pptr))); + ND_PRINT((ndo, "%02X", EXTRACT_U_1(pptr))); pptr++; } return (0); @@ -817,7 +817,7 @@ clnp_print(netdissect_options *ndo, return (0); } ND_TCHECK(*pptr); - dest_address_length = EXTRACT_8BITS(pptr); + dest_address_length = EXTRACT_U_1(pptr); pptr += 1; li -= 1; if (li < dest_address_length) { @@ -834,7 +834,7 @@ clnp_print(netdissect_options *ndo, return (0); } ND_TCHECK(*pptr); - source_address_length = EXTRACT_8BITS(pptr); + source_address_length = EXTRACT_U_1(pptr); pptr += 1; li -= 1; if (li < source_address_length) { @@ -863,10 +863,10 @@ clnp_print(netdissect_options *ndo, clnp_header->version, clnp_header->lifetime/2, (clnp_header->lifetime%2)*5, - EXTRACT_BE_16BITS(clnp_header->segment_length), - EXTRACT_BE_16BITS(clnp_header->cksum))); + EXTRACT_BE_U_2(clnp_header->segment_length), + EXTRACT_BE_U_2(clnp_header->cksum))); - osi_print_cksum(ndo, optr, EXTRACT_BE_16BITS(clnp_header->cksum), 7, + osi_print_cksum(ndo, optr, EXTRACT_BE_U_2(clnp_header->cksum), 7, clnp_header->length_indicator); ND_PRINT((ndo, "\n\tFlags [%s]", @@ -886,9 +886,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_BE_16BITS(clnp_segment_header->data_unit_id), - EXTRACT_BE_16BITS(clnp_segment_header->segment_offset), - EXTRACT_BE_16BITS(clnp_segment_header->total_length))); + EXTRACT_BE_U_2(clnp_segment_header->data_unit_id), + EXTRACT_BE_U_2(clnp_segment_header->segment_offset), + EXTRACT_BE_U_2(clnp_segment_header->total_length))); pptr+=sizeof(struct clnp_segment_header_t); li-=sizeof(struct clnp_segment_header_t); } @@ -903,8 +903,8 @@ clnp_print(netdissect_options *ndo, return (0); } ND_TCHECK2(*pptr, 2); - op = EXTRACT_8BITS(pptr); - opli = EXTRACT_8BITS(pptr + 1); + op = EXTRACT_U_1(pptr); + opli = EXTRACT_U_1(pptr + 1); pptr += 2; li -= 2; if (opli > li) { @@ -939,9 +939,9 @@ clnp_print(netdissect_options *ndo, return (0); } ND_PRINT((ndo, "%s %s", - tok2str(clnp_option_sr_rr_values,"Unknown",EXTRACT_8BITS(tptr)), + tok2str(clnp_option_sr_rr_values,"Unknown",EXTRACT_U_1(tptr)), tok2str(clnp_option_sr_rr_string_values, "Unknown Option %u", op))); - nsap_offset=EXTRACT_8BITS(tptr+1); + nsap_offset=EXTRACT_U_1(tptr + 1); if (nsap_offset == 0) { ND_PRINT((ndo, " Bad NSAP offset (0)")); break; @@ -954,7 +954,7 @@ clnp_print(netdissect_options *ndo, tptr+=nsap_offset; tlen-=nsap_offset; while (tlen > 0) { - source_address_length=EXTRACT_8BITS(tptr); + source_address_length=EXTRACT_U_1(tptr); if (tlen < source_address_length+1) { ND_PRINT((ndo, "\n\t NSAP address goes past end of option")); break; @@ -975,7 +975,7 @@ clnp_print(netdissect_options *ndo, ND_PRINT((ndo, ", bad opt len")); return (0); } - ND_PRINT((ndo, "0x%1x", EXTRACT_8BITS(tptr)&0x0f)); + ND_PRINT((ndo, "0x%1x", EXTRACT_U_1(tptr)&0x0f)); break; case CLNP_OPTION_QOS_MAINTENANCE: @@ -984,13 +984,13 @@ clnp_print(netdissect_options *ndo, return (0); } ND_PRINT((ndo, "\n\t Format Code: %s", - tok2str(clnp_option_scope_values, "Reserved", EXTRACT_8BITS(tptr) & CLNP_OPTION_SCOPE_MASK))); + tok2str(clnp_option_scope_values, "Reserved", EXTRACT_U_1(tptr) & CLNP_OPTION_SCOPE_MASK))); - if ((EXTRACT_8BITS(tptr)&CLNP_OPTION_SCOPE_MASK) == CLNP_OPTION_SCOPE_GLOBAL) + if ((EXTRACT_U_1(tptr)&CLNP_OPTION_SCOPE_MASK) == CLNP_OPTION_SCOPE_GLOBAL) ND_PRINT((ndo, "\n\t QoS Flags [%s]", bittok2str(clnp_option_qos_global_values, "none", - EXTRACT_8BITS(tptr)&CLNP_OPTION_OPTION_QOS_MASK))); + EXTRACT_U_1(tptr)&CLNP_OPTION_OPTION_QOS_MASK))); break; case CLNP_OPTION_SECURITY: @@ -999,8 +999,8 @@ clnp_print(netdissect_options *ndo, return (0); } ND_PRINT((ndo, "\n\t Format Code: %s, Security-Level %u", - tok2str(clnp_option_scope_values,"Reserved",EXTRACT_8BITS(tptr)&CLNP_OPTION_SCOPE_MASK), - EXTRACT_8BITS(tptr+1))); + tok2str(clnp_option_scope_values,"Reserved",EXTRACT_U_1(tptr)&CLNP_OPTION_SCOPE_MASK), + EXTRACT_U_1(tptr + 1))); break; case CLNP_OPTION_DISCARD_REASON: @@ -1008,7 +1008,7 @@ clnp_print(netdissect_options *ndo, ND_PRINT((ndo, ", bad opt len")); return (0); } - rfd_error = EXTRACT_8BITS(tptr); + rfd_error = EXTRACT_U_1(tptr); rfd_error_major = (rfd_error&0xf0) >> 4; rfd_error_minor = rfd_error&0x0f; ND_PRINT((ndo, "\n\t Class: %s Error (0x%01x), %s (0x%01x)", @@ -1041,7 +1041,7 @@ clnp_print(netdissect_options *ndo, case CLNP_PDU_ER: /* fall through */ case CLNP_PDU_ERP: ND_TCHECK(*pptr); - if (EXTRACT_8BITS(pptr) == NLPID_CLNP) { + if (EXTRACT_U_1(pptr) == NLPID_CLNP) { ND_PRINT((ndo, "\n\t-----original packet-----\n\t")); /* FIXME recursion protection */ clnp_print(ndo, pptr, length - clnp_header->length_indicator); @@ -1133,7 +1133,7 @@ esis_print(netdissect_options *ndo, if (li < sizeof(struct esis_header_t) + 2) { ND_PRINT((ndo, " length indicator %u < min PDU size:", li)); while (pptr < ndo->ndo_snapend) { - ND_PRINT((ndo, "%02X", EXTRACT_8BITS(pptr))); + ND_PRINT((ndo, "%02X", EXTRACT_U_1(pptr))); pptr++; } return; @@ -1155,13 +1155,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_BE_16BITS(esis_header->cksum))); + ND_PRINT((ndo, ", checksum: 0x%04x", EXTRACT_BE_U_2(esis_header->cksum))); - osi_print_cksum(ndo, pptr, EXTRACT_BE_16BITS(esis_header->cksum), 7, + osi_print_cksum(ndo, pptr, EXTRACT_BE_U_2(esis_header->cksum), 7, li); ND_PRINT((ndo, ", holding time: %us, length indicator: %u", - EXTRACT_BE_16BITS(esis_header->holdtime), li)); + EXTRACT_BE_U_2(esis_header->holdtime), li)); if (ndo->ndo_vflag > 1) print_unknown_data(ndo, optr, "\n\t", sizeof(struct esis_header_t)); @@ -1179,7 +1179,7 @@ esis_print(netdissect_options *ndo, ND_PRINT((ndo, ", bad redirect/li")); return; } - dstl = EXTRACT_8BITS(pptr); + dstl = EXTRACT_U_1(pptr); pptr++; li--; ND_TCHECK2(*pptr, dstl); @@ -1197,7 +1197,7 @@ esis_print(netdissect_options *ndo, ND_PRINT((ndo, ", bad redirect/li")); return; } - snpal = EXTRACT_8BITS(pptr); + snpal = EXTRACT_U_1(pptr); pptr++; li--; ND_TCHECK2(*pptr, snpal); @@ -1213,7 +1213,7 @@ esis_print(netdissect_options *ndo, ND_PRINT((ndo, ", bad redirect/li")); return; } - netal = EXTRACT_8BITS(pptr); + netal = EXTRACT_U_1(pptr); pptr++; ND_TCHECK2(*pptr, netal); if (li < netal) { @@ -1245,7 +1245,7 @@ esis_print(netdissect_options *ndo, ND_PRINT((ndo, ", bad esh/li")); return; } - source_address_number = EXTRACT_8BITS(pptr); + source_address_number = EXTRACT_U_1(pptr); pptr++; li--; @@ -1257,7 +1257,7 @@ esis_print(netdissect_options *ndo, ND_PRINT((ndo, ", bad esh/li")); return; } - source_address_length = EXTRACT_8BITS(pptr); + source_address_length = EXTRACT_U_1(pptr); pptr++; li--; @@ -1282,7 +1282,7 @@ esis_print(netdissect_options *ndo, ND_PRINT((ndo, ", bad ish/li")); return; } - source_address_length = EXTRACT_8BITS(pptr); + source_address_length = EXTRACT_U_1(pptr); pptr++; li--; ND_TCHECK2(*pptr, source_address_length); @@ -1314,8 +1314,8 @@ esis_print(netdissect_options *ndo, return; } ND_TCHECK2(*pptr, 2); - op = EXTRACT_8BITS(pptr); - opli = EXTRACT_8BITS(pptr + 1); + op = EXTRACT_U_1(pptr); + opli = EXTRACT_U_1(pptr + 1); pptr += 2; li -= 2; if (opli > li) { @@ -1335,7 +1335,7 @@ esis_print(netdissect_options *ndo, case ESIS_OPTION_ES_CONF_TIME: if (opli == 2) { ND_TCHECK2(*pptr, 2); - ND_PRINT((ndo, "%us", EXTRACT_BE_16BITS(tptr))); + ND_PRINT((ndo, "%us", EXTRACT_BE_U_2(tptr))); } else ND_PRINT((ndo, "(bad length)")); break; @@ -1346,8 +1346,8 @@ esis_print(netdissect_options *ndo, ND_PRINT((ndo, "%s (0x%02x)", tok2str(nlpid_values, "unknown", - EXTRACT_8BITS(tptr)), - EXTRACT_8BITS(tptr))); + EXTRACT_U_1(tptr)), + EXTRACT_U_1(tptr))); if (opli>1) /* further NPLIDs ? - put comma */ ND_PRINT((ndo, ", ")); tptr++; @@ -1390,7 +1390,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_BE_16BITS(mcid->revision_lvl))); + ND_PRINT((ndo, "\n\t Lvl: %d", EXTRACT_BE_U_2(mcid->revision_lvl))); ND_PRINT((ndo, ", Digest: ")); @@ -1412,8 +1412,8 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo, while (len > 2) { ND_TCHECK2(*tptr, 2); - stlv_type = EXTRACT_8BITS(tptr); - stlv_len = EXTRACT_8BITS(tptr + 1); + stlv_type = EXTRACT_U_1(tptr); + stlv_len = EXTRACT_U_1(tptr + 1); /* first lets see if we know the subTLVs name*/ ND_PRINT((ndo, "\n\t %s subTLV #%u, length: %u", @@ -1464,10 +1464,10 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo, goto trunc; ND_PRINT((ndo, "\n\t RES: %d V: %d A: %d D: %d", - (EXTRACT_8BITS(tptr) >> 5), - ((EXTRACT_8BITS(tptr) >> 4) & 0x01), - ((EXTRACT_8BITS(tptr) >> 2) & 0x03), - (EXTRACT_8BITS(tptr) & 0x03))); + (EXTRACT_U_1(tptr) >> 5), + ((EXTRACT_U_1(tptr) >> 4) & 0x01), + ((EXTRACT_U_1(tptr) >> 2) & 0x03), + (EXTRACT_U_1(tptr) & 0x03))); tptr++; @@ -1475,7 +1475,7 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo, for(i=1;i<=8; i++) { - ND_PRINT((ndo, "%08x ", EXTRACT_BE_32BITS(tptr))); + ND_PRINT((ndo, "%08x ", EXTRACT_BE_U_4(tptr))); if (i%4 == 0 && i != 8) ND_PRINT((ndo, "\n\t ")); tptr = tptr + 4; @@ -1492,14 +1492,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_BE_32BITS(tptr))); + EXTRACT_BE_U_4(tptr))); tptr = tptr+4; ND_PRINT((ndo, " BVID: %d, U:%01x M:%01x ", - (EXTRACT_BE_16BITS(tptr) >> 4) , - (EXTRACT_BE_16BITS(tptr) >> 3) & 0x01, - (EXTRACT_BE_16BITS(tptr) >> 2) & 0x01)); + (EXTRACT_BE_U_2(tptr) >> 4) , + (EXTRACT_BE_U_2(tptr) >> 3) & 0x01, + (EXTRACT_BE_U_2(tptr) >> 2) & 0x01)); tptr = tptr + 2; len = len - ISIS_SUBTLV_SPB_BVID_MIN_LEN; @@ -1533,8 +1533,8 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, while (len > 2) { ND_TCHECK2(*tptr, 2); - stlv_type = EXTRACT_8BITS(tptr); - stlv_len = EXTRACT_8BITS(tptr + 1); + stlv_type = EXTRACT_U_1(tptr); + stlv_len = EXTRACT_U_1(tptr + 1); tptr = tptr + 2; len = len - 2; @@ -1556,24 +1556,24 @@ 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_BE_32BITS(tptr))); + ND_PRINT((ndo, "\n\t CIST Root-ID: %08x", EXTRACT_BE_U_4(tptr))); tptr = tptr+4; - ND_PRINT((ndo, " %08x", EXTRACT_BE_32BITS(tptr))); + ND_PRINT((ndo, " %08x", EXTRACT_BE_U_4(tptr))); tptr = tptr+4; - ND_PRINT((ndo, ", Path Cost: %08x", EXTRACT_BE_32BITS(tptr))); + ND_PRINT((ndo, ", Path Cost: %08x", EXTRACT_BE_U_4(tptr))); tptr = tptr+4; - ND_PRINT((ndo, ", Prio: %d", EXTRACT_BE_16BITS(tptr))); + ND_PRINT((ndo, ", Prio: %d", EXTRACT_BE_U_2(tptr))); tptr = tptr + 2; ND_PRINT((ndo, "\n\t RES: %d", - EXTRACT_BE_16BITS(tptr) >> 5)); + EXTRACT_BE_U_2(tptr) >> 5)); ND_PRINT((ndo, ", V: %d", - (EXTRACT_BE_16BITS(tptr) >> 4) & 0x0001)); + (EXTRACT_BE_U_2(tptr) >> 4) & 0x0001)); ND_PRINT((ndo, ", SPSource-ID: %d", - (EXTRACT_BE_32BITS(tptr) & 0x000fffff))); + (EXTRACT_BE_U_4(tptr) & 0x000fffff))); tptr = tptr+4; - ND_PRINT((ndo, ", No of Trees: %x", EXTRACT_8BITS(tptr))); + ND_PRINT((ndo, ", No of Trees: %x", EXTRACT_U_1(tptr))); - tmp = EXTRACT_8BITS(tptr); + tmp = EXTRACT_U_1(tptr); tptr++; len = len - ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN; @@ -1585,20 +1585,20 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, goto trunc; ND_PRINT((ndo, "\n\t U:%d, M:%d, A:%d, RES:%d", - EXTRACT_8BITS(tptr) >> 7, - (EXTRACT_8BITS(tptr) >> 6) & 0x01, - (EXTRACT_8BITS(tptr) >> 5) & 0x01, - (EXTRACT_8BITS(tptr) & 0x1f))); + EXTRACT_U_1(tptr) >> 7, + (EXTRACT_U_1(tptr) >> 6) & 0x01, + (EXTRACT_U_1(tptr) >> 5) & 0x01, + (EXTRACT_U_1(tptr) & 0x1f))); tptr++; - ND_PRINT((ndo, ", ECT: %08x", EXTRACT_BE_32BITS(tptr))); + ND_PRINT((ndo, ", ECT: %08x", EXTRACT_BE_U_4(tptr))); tptr = tptr + 4; ND_PRINT((ndo, ", BVID: %d, SPVID: %d", - (EXTRACT_BE_24BITS(tptr) >> 12) & 0x000fff, - EXTRACT_BE_24BITS(tptr) & 0x000fff)); + (EXTRACT_BE_U_3(tptr) >> 12) & 0x000fff, + EXTRACT_BE_U_3(tptr) & 0x000fff)); tptr = tptr + 3; len = len - ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN; @@ -1612,13 +1612,13 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, if (stlv_len < 8) goto trunc; - ND_PRINT((ndo, "\n\t BMAC: %08x", EXTRACT_BE_32BITS(tptr))); + ND_PRINT((ndo, "\n\t BMAC: %08x", EXTRACT_BE_U_4(tptr))); tptr = tptr+4; - ND_PRINT((ndo, "%04x", EXTRACT_BE_16BITS(tptr))); + ND_PRINT((ndo, "%04x", EXTRACT_BE_U_2(tptr))); tptr = tptr+2; - ND_PRINT((ndo, ", RES: %d, VID: %d", EXTRACT_BE_16BITS(tptr) >> 12, - (EXTRACT_BE_16BITS(tptr)) & 0x0fff)); + ND_PRINT((ndo, ", RES: %d, VID: %d", EXTRACT_BE_U_2(tptr) >> 12, + (EXTRACT_BE_U_2(tptr)) & 0x0fff)); tptr = tptr+2; len = len - 8; @@ -1627,10 +1627,10 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, while (stlv_len >= 4) { ND_TCHECK_4(tptr); ND_PRINT((ndo, "\n\t T: %d, R: %d, RES: %d, ISID: %d", - (EXTRACT_BE_32BITS(tptr) >> 31), - (EXTRACT_BE_32BITS(tptr) >> 30) & 0x01, - (EXTRACT_BE_32BITS(tptr) >> 24) & 0x03f, - (EXTRACT_BE_32BITS(tptr)) & 0x0ffffff)); + (EXTRACT_BE_U_4(tptr) >> 31), + (EXTRACT_BE_U_4(tptr) >> 30) & 0x01, + (EXTRACT_BE_U_4(tptr) >> 24) & 0x03f, + (EXTRACT_BE_U_4(tptr)) & 0x0ffffff)); tptr = tptr + 4; len = len - 4; @@ -1724,7 +1724,7 @@ isis_print_tlv_ip_reach(netdissect_options *ndo, if (!ND_TTEST(*tlv_ip_reach)) return (0); - prefix_len = mask2plen(EXTRACT_BE_32BITS(tlv_ip_reach->mask)); + prefix_len = mask2plen(EXTRACT_BE_U_4(tlv_ip_reach->mask)); if (prefix_len == -1) ND_PRINT((ndo, "%sIPv4 prefix: %s mask %s", @@ -1788,8 +1788,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_BE_32BITS(tptr), - EXTRACT_BE_32BITS(tptr))); + EXTRACT_BE_U_4(tptr), + EXTRACT_BE_U_4(tptr))); tptr+=4; subl-=4; } @@ -1797,8 +1797,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_BE_32BITS(tptr), - EXTRACT_BE_32BITS(tptr + 4))); + EXTRACT_BE_U_4(tptr), + EXTRACT_BE_U_4(tptr + 4))); tptr+=8; subl-=8; } @@ -1844,9 +1844,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_BE_32BITS(tptr))); + ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_U_4(tptr))); if (subl == 8) /* rfc4205 */ - ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_32BITS(tptr + 4))); + ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_U_4(tptr + 4))); } break; case ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR: @@ -1857,14 +1857,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_BE_32BITS(tptr); + bw.i = EXTRACT_BE_U_4(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_BE_32BITS(tptr); + bw.i = EXTRACT_BE_U_4(tptr); ND_PRINT((ndo, "%s TE-Class %u: %.3f Mbps", ident, te_class, @@ -1879,12 +1879,12 @@ isis_print_is_reach_subtlv(netdissect_options *ndo, break; ND_PRINT((ndo, "%sBandwidth Constraints Model ID: %s (%u)", ident, - tok2str(diffserv_te_bc_values, "unknown", EXTRACT_8BITS(tptr)), - EXTRACT_8BITS(tptr))); + tok2str(diffserv_te_bc_values, "unknown", EXTRACT_U_1(tptr)), + EXTRACT_U_1(tptr))); tptr++; /* decode BCs until the subTLV ends */ for (te_class = 0; te_class < (subl-1)/4; te_class++) { - bw.i = EXTRACT_BE_32BITS(tptr); + bw.i = EXTRACT_BE_U_4(tptr); ND_PRINT((ndo, "%s Bandwidth constraint CT%u: %.3f Mbps", ident, te_class, @@ -1894,45 +1894,45 @@ 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_BE_24BITS(tptr))); + ND_PRINT((ndo, ", %u", EXTRACT_BE_U_3(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_BE_16BITS(tptr)), - EXTRACT_BE_16BITS(tptr))); + EXTRACT_BE_U_2(tptr)), + EXTRACT_BE_U_2(tptr))); } break; case ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE: if (subl >= 2) { ND_PRINT((ndo, ", %s, Priority %u", - bittok2str(gmpls_link_prot_values, "none", EXTRACT_8BITS(tptr)), - EXTRACT_8BITS(tptr+1))); + bittok2str(gmpls_link_prot_values, "none", EXTRACT_U_1(tptr)), + EXTRACT_U_1(tptr + 1))); } break; case ISIS_SUBTLV_SPB_METRIC: if (subl >= 6) { - ND_PRINT((ndo, ", LM: %u", EXTRACT_BE_24BITS(tptr))); + ND_PRINT((ndo, ", LM: %u", EXTRACT_BE_U_3(tptr))); tptr=tptr+3; - ND_PRINT((ndo, ", P: %u", EXTRACT_8BITS(tptr))); + ND_PRINT((ndo, ", P: %u", EXTRACT_U_1(tptr))); tptr++; - ND_PRINT((ndo, ", P-ID: %u", EXTRACT_BE_16BITS(tptr))); + ND_PRINT((ndo, ", P-ID: %u", EXTRACT_BE_U_2(tptr))); } break; case ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR: if (subl >= 36) { - gmpls_switch_cap = EXTRACT_8BITS(tptr); + gmpls_switch_cap = EXTRACT_U_1(tptr); ND_PRINT((ndo, "%s Interface Switching Capability:%s", ident, tok2str(gmpls_switch_cap_values, "Unknown", gmpls_switch_cap))); ND_PRINT((ndo, ", LSP Encoding: %s", - tok2str(gmpls_encoding_values, "Unknown", EXTRACT_8BITS((tptr + 1))))); + tok2str(gmpls_encoding_values, "Unknown", EXTRACT_U_1((tptr + 1))))); tptr+=4; ND_PRINT((ndo, "%s Max LSP Bandwidth:", ident)); for (priority_level = 0; priority_level < 8; priority_level++) { - bw.i = EXTRACT_BE_32BITS(tptr); + bw.i = EXTRACT_BE_U_4(tptr); ND_PRINT((ndo, "%s priority level %d: %.3f Mbps", ident, priority_level, @@ -1947,17 +1947,17 @@ isis_print_is_reach_subtlv(netdissect_options *ndo, case GMPLS_PSC4: if (subl < 6) break; - bw.i = EXTRACT_BE_32BITS(tptr); + bw.i = EXTRACT_BE_U_4(tptr); ND_PRINT((ndo, "%s Min LSP Bandwidth: %.3f Mbps", ident, bw.f * 8 / 1000000)); - ND_PRINT((ndo, "%s Interface MTU: %u", ident, EXTRACT_BE_16BITS(tptr + 4))); + ND_PRINT((ndo, "%s Interface MTU: %u", ident, EXTRACT_BE_U_2(tptr + 4))); break; case GMPLS_TSC: if (subl < 8) break; - bw.i = EXTRACT_BE_32BITS(tptr); + bw.i = EXTRACT_BE_U_4(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)", EXTRACT_8BITS((tptr + 4))))); + tok2str(gmpls_switch_cap_tsc_indication_values, "Unknown (%u)", EXTRACT_U_1((tptr + 4))))); break; default: /* there is some optional stuff left to decode but this is as of yet @@ -2002,13 +2002,13 @@ 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_TTEST_3(tptr)) /* and is therefore skipped */ return(0); - ND_PRINT((ndo, ", Metric: %d", EXTRACT_BE_24BITS(tptr))); + ND_PRINT((ndo, ", Metric: %d", EXTRACT_BE_U_3(tptr))); tptr+=3; } if (!ND_TTEST_1(tptr)) return(0); - subtlv_sum_len=EXTRACT_8BITS(tptr); /* read out subTLV length */ + subtlv_sum_len=EXTRACT_U_1(tptr); /* read out subTLV length */ tptr++; proc_bytes=NODE_ID_LEN+3+1; ND_PRINT((ndo, ", %ssub-TLVs present",subtlv_sum_len ? "" : "no ")); @@ -2017,8 +2017,8 @@ isis_print_ext_is_reach(netdissect_options *ndo, while (subtlv_sum_len>0) { if (!ND_TTEST2(*tptr,2)) return(0); - subtlv_type=EXTRACT_8BITS(tptr); - subtlv_len=EXTRACT_8BITS(tptr+1); + subtlv_type=EXTRACT_U_1(tptr); + subtlv_len=EXTRACT_U_1(tptr + 1); tptr+=2; /* prepend the indent string */ snprintf(ident_buffer, sizeof(ident_buffer), "%s ",ident); @@ -2048,11 +2048,11 @@ isis_print_mtid(netdissect_options *ndo, ident, tok2str(isis_mt_values, "Reserved for IETF Consensus", - ISIS_MASK_MTID(EXTRACT_BE_16BITS(tptr))))); + ISIS_MASK_MTID(EXTRACT_BE_U_2(tptr))))); ND_PRINT((ndo, " Topology (0x%03x), Flags: [%s]", - ISIS_MASK_MTID(EXTRACT_BE_16BITS(tptr)), - bittok2str(isis_mt_flag_values, "none",ISIS_MASK_MTFLAGS(EXTRACT_BE_16BITS(tptr))))); + ISIS_MASK_MTID(EXTRACT_BE_U_2(tptr)), + bittok2str(isis_mt_flag_values, "none",ISIS_MASK_MTFLAGS(EXTRACT_BE_U_2(tptr))))); return(2); } @@ -2074,14 +2074,14 @@ isis_print_extd_ip_reach(netdissect_options *ndo, if (!ND_TTEST_4(tptr)) return (0); - metric = EXTRACT_BE_32BITS(tptr); + metric = EXTRACT_BE_U_4(tptr); processed=4; tptr+=4; if (afi == AF_INET) { if (!ND_TTEST_1(tptr)) /* fetch status byte */ return (0); - status_byte=EXTRACT_8BITS(tptr); + status_byte=EXTRACT_U_1(tptr); tptr++; bit_length = status_byte&0x3f; if (bit_length > 32) { @@ -2094,8 +2094,8 @@ isis_print_extd_ip_reach(netdissect_options *ndo, } else if (afi == AF_INET6) { if (!ND_TTEST2(*tptr, 2)) /* fetch status & prefix_len byte */ return (0); - status_byte=EXTRACT_8BITS(tptr); - bit_length=EXTRACT_8BITS(tptr+1); + status_byte=EXTRACT_U_1(tptr); + bit_length=EXTRACT_U_1(tptr + 1); if (bit_length > 128) { ND_PRINT((ndo, "%sIPv6 prefix: bad bit length %u", ident, @@ -2147,7 +2147,7 @@ isis_print_extd_ip_reach(netdissect_options *ndo, */ if (!ND_TTEST_1(tptr)) return (0); - sublen=EXTRACT_8BITS(tptr); + sublen=EXTRACT_U_1(tptr); tptr++; processed+=sublen+1; ND_PRINT((ndo, " (%u)", sublen)); /* print out subTLV length */ @@ -2155,8 +2155,8 @@ isis_print_extd_ip_reach(netdissect_options *ndo, while (sublen>0) { if (!ND_TTEST2(*tptr,2)) return (0); - subtlvtype=EXTRACT_8BITS(tptr); - subtlvlen=EXTRACT_8BITS(tptr+1); + subtlvtype=EXTRACT_U_1(tptr); + subtlvlen=EXTRACT_U_1(tptr + 1); tptr+=2; /* prepend the indent string */ snprintf(ident_buffer, sizeof(ident_buffer), "%s ",ident); @@ -2350,7 +2350,7 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, ", length %u", length)); return (1); } - pdu_len=EXTRACT_BE_16BITS(header_iih_lan->pdu_len); + pdu_len=EXTRACT_BE_U_2(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; @@ -2358,7 +2358,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_BE_16BITS(header_iih_lan->holding_time), + EXTRACT_BE_U_2(header_iih_lan->holding_time), tok2str(isis_iih_circuit_type_values, "unknown circuit type 0x%02x", header_iih_lan->circuit_type))); @@ -2391,7 +2391,7 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, ", length %u", length)); return (1); } - pdu_len=EXTRACT_BE_16BITS(header_iih_ptp->pdu_len); + pdu_len=EXTRACT_BE_U_2(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; @@ -2399,7 +2399,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_BE_16BITS(header_iih_ptp->holding_time), + EXTRACT_BE_U_2(header_iih_ptp->holding_time), tok2str(isis_iih_circuit_type_values, "unknown circuit type 0x%02x", header_iih_ptp->circuit_type))); @@ -2430,12 +2430,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_BE_32BITS(header_lsp->sequence_number), - EXTRACT_BE_16BITS(header_lsp->remaining_lifetime))); + EXTRACT_BE_U_4(header_lsp->sequence_number), + EXTRACT_BE_U_2(header_lsp->remaining_lifetime))); ND_PRINT((ndo, ", length %u", length)); return (1); } - pdu_len=EXTRACT_BE_16BITS(header_lsp->pdu_len); + pdu_len=EXTRACT_BE_U_2(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; @@ -2443,12 +2443,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_BE_32BITS(header_lsp->sequence_number), - EXTRACT_BE_16BITS(header_lsp->remaining_lifetime), - EXTRACT_BE_16BITS(header_lsp->checksum))); + EXTRACT_BE_U_4(header_lsp->sequence_number), + EXTRACT_BE_U_2(header_lsp->remaining_lifetime), + EXTRACT_BE_U_2(header_lsp->checksum))); osi_print_cksum(ndo, (const uint8_t *)header_lsp->lsp_id, - EXTRACT_BE_16BITS(header_lsp->checksum), + EXTRACT_BE_U_2(header_lsp->checksum), 12, length-12); ND_PRINT((ndo, ", PDU length: %u, Flags: [ %s", @@ -2490,7 +2490,7 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, ", length %u", length)); return (1); } - pdu_len=EXTRACT_BE_16BITS(header_csnp->pdu_len); + pdu_len=EXTRACT_BE_U_2(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; @@ -2528,7 +2528,7 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, ", length %u", length)); return (1); } - pdu_len=EXTRACT_BE_16BITS(header_psnp->pdu_len); + pdu_len=EXTRACT_BE_U_2(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; @@ -2564,8 +2564,8 @@ isis_print(netdissect_options *ndo, ND_TCHECK2(*pptr, 2); if (packet_len < 2) goto trunc; - tlv_type = EXTRACT_8BITS(pptr); - tlv_len = EXTRACT_8BITS(pptr + 1); + tlv_type = EXTRACT_U_1(pptr); + tlv_len = EXTRACT_U_1(pptr + 1); pptr += 2; packet_len -= 2; tmp =tlv_len; /* copy temporary len & pointer to packet data */ @@ -2589,7 +2589,7 @@ isis_print(netdissect_options *ndo, switch (tlv_type) { case ISIS_TLV_AREA_ADDR: ND_TCHECK_1(tptr); - alen = EXTRACT_8BITS(tptr); + alen = EXTRACT_U_1(tptr); tptr++; while (tmp && alen < tmp) { ND_TCHECK2(*tptr, alen); @@ -2601,7 +2601,7 @@ isis_print(netdissect_options *ndo, if (tmp==0) /* if this is the last area address do not attemt a boundary check */ break; ND_TCHECK_1(tptr); - alen = EXTRACT_8BITS(tptr); + alen = EXTRACT_U_1(tptr); tptr++; } break; @@ -2617,7 +2617,7 @@ isis_print(netdissect_options *ndo, case ISIS_TLV_ISNEIGH_VARLEN: if (!ND_TTEST_1(tptr) || tmp < 3) /* min. TLV length */ goto trunctlv; - lan_alen = EXTRACT_8BITS(tptr); /* LAN address length */ + lan_alen = EXTRACT_U_1(tptr); /* LAN address length */ tptr++; if (lan_alen == 0) { ND_PRINT((ndo, "\n\t LAN address length 0 bytes (invalid)")); @@ -2676,7 +2676,7 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t %s", tok2str(isis_is_reach_virtual_values, "bogus virtual flag 0x%02x", - EXTRACT_8BITS(tptr)))); + EXTRACT_U_1(tptr)))); tptr++; tlv_is_reach = (const struct isis_tlv_is_reach *)tptr; while (tmp >= sizeof(struct isis_tlv_is_reach)) { @@ -2779,9 +2779,9 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t %s: ", tok2str(isis_subtlv_auth_values, "unknown Authentication type 0x%02x", - EXTRACT_8BITS(tptr)))); + EXTRACT_U_1(tptr)))); - switch (EXTRACT_8BITS(tptr)) { + switch (EXTRACT_U_1(tptr)) { case ISIS_SUBTLV_AUTH_SIMPLE: if (fn_printzp(ndo, tptr + 1, tlv_len - 1, ndo->ndo_snapend)) goto trunctlv; @@ -2789,7 +2789,7 @@ isis_print(netdissect_options *ndo, case ISIS_SUBTLV_AUTH_MD5: for(i=1;i<tlv_len;i++) { ND_TCHECK_1(tptr + i); - ND_PRINT((ndo, "%02x", EXTRACT_8BITS(tptr + i))); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(tptr + i))); } if (tlv_len != ISIS_SUBTLV_AUTH_MD5_LEN+1) ND_PRINT((ndo, ", (invalid subTLV) ")); @@ -2802,11 +2802,11 @@ isis_print(netdissect_options *ndo, break; case ISIS_SUBTLV_AUTH_GENERIC: ND_TCHECK_2(tptr + 1); - key_id = EXTRACT_BE_16BITS(tptr + 1); + key_id = EXTRACT_BE_U_2(tptr + 1); ND_PRINT((ndo, "%u, password: ", key_id)); for(i=1 + sizeof(uint16_t);i<tlv_len;i++) { ND_TCHECK_1(tptr + i); - ND_PRINT((ndo, "%02x", EXTRACT_8BITS(tptr + i))); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(tptr + i))); } break; case ISIS_SUBTLV_AUTH_PRIVATE: @@ -2822,14 +2822,14 @@ isis_print(netdissect_options *ndo, if(tmp>=1) { ND_TCHECK_1(tptr); ND_PRINT((ndo, "\n\t Adjacency State: %s (%u)", - tok2str(isis_ptp_adjancey_values, "unknown", EXTRACT_8BITS(tptr)), - EXTRACT_8BITS(tptr))); + tok2str(isis_ptp_adjancey_values, "unknown", EXTRACT_U_1(tptr)), + EXTRACT_U_1(tptr))); tmp--; } 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_BE_32BITS(tlv_ptp_adj->extd_local_circuit_id))); + EXTRACT_BE_U_4(tlv_ptp_adj->extd_local_circuit_id))); tmp-=sizeof(tlv_ptp_adj->extd_local_circuit_id); } if(tmp>=SYSTEM_ID_LEN) { @@ -2841,7 +2841,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_BE_32BITS(tlv_ptp_adj->neighbor_extd_local_circuit_id))); + EXTRACT_BE_U_4(tlv_ptp_adj->neighbor_extd_local_circuit_id))); } break; @@ -2852,8 +2852,8 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, "%s (0x%02x)", tok2str(nlpid_values, "unknown", - EXTRACT_8BITS(tptr)), - EXTRACT_8BITS(tptr))); + EXTRACT_U_1(tptr)), + EXTRACT_U_1(tptr))); if (tmp>1) /* further NPLIDs ? - put comma */ ND_PRINT((ndo, ", ")); tptr++; @@ -2866,8 +2866,8 @@ isis_print(netdissect_options *ndo, ND_TCHECK_2(tptr); ND_PRINT((ndo, "\n\t RES: %d, MTID(s): %d", - (EXTRACT_BE_16BITS(tptr) >> 12), - (EXTRACT_BE_16BITS(tptr) & 0x0fff))); + (EXTRACT_BE_U_2(tptr) >> 12), + (EXTRACT_BE_U_2(tptr) & 0x0fff))); tmp = tmp-2; tptr = tptr+2; @@ -2883,9 +2883,9 @@ isis_print(netdissect_options *ndo, ND_TCHECK_2(tptr); ND_PRINT((ndo, "\n\t O: %d, RES: %d, MTID(s): %d", - (EXTRACT_BE_16BITS(tptr) >> 15) & 0x01, - (EXTRACT_BE_16BITS(tptr) >> 12) & 0x07, - EXTRACT_BE_16BITS(tptr) & 0x0fff)); + (EXTRACT_BE_U_2(tptr) >> 15) & 0x01, + (EXTRACT_BE_U_2(tptr) >> 12) & 0x07, + EXTRACT_BE_U_2(tptr) & 0x0fff)); tmp = tmp-2; tptr = tptr+2; @@ -2926,7 +2926,7 @@ isis_print(netdissect_options *ndo, if (tmp < 1) break; ND_TCHECK_1(tptr); - ND_PRINT((ndo, ", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(EXTRACT_8BITS(tptr)) ? "numbered" : "unnumbered")); + ND_PRINT((ndo, ", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(EXTRACT_U_1(tptr)) ? "numbered" : "unnumbered")); tptr++; tmp--; @@ -2946,7 +2946,7 @@ isis_print(netdissect_options *ndo, while (tmp>=4) { ND_TCHECK_4(tptr); - ND_PRINT((ndo, "\n\t Link-ID: 0x%08x", EXTRACT_BE_32BITS(tptr))); + ND_PRINT((ndo, "\n\t Link-ID: 0x%08x", EXTRACT_BE_U_4(tptr))); tptr+=4; tmp-=4; } @@ -2959,11 +2959,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_BE_32BITS(tlv_lsp->sequence_number))); + ND_PRINT((ndo, ", seq: 0x%08x", EXTRACT_BE_U_4(tlv_lsp->sequence_number))); ND_TCHECK2(tlv_lsp->remaining_lifetime, 2); - ND_PRINT((ndo, ", lifetime: %5ds", EXTRACT_BE_16BITS(tlv_lsp->remaining_lifetime))); + ND_PRINT((ndo, ", lifetime: %5ds", EXTRACT_BE_U_2(tlv_lsp->remaining_lifetime))); ND_TCHECK2(tlv_lsp->checksum, 2); - ND_PRINT((ndo, ", chksum: 0x%04x", EXTRACT_BE_16BITS(tlv_lsp->checksum))); + ND_PRINT((ndo, ", chksum: 0x%04x", EXTRACT_BE_U_2(tlv_lsp->checksum))); tmp-=sizeof(struct isis_tlv_lsp); tlv_lsp++; } @@ -2973,13 +2973,13 @@ 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_BE_16BITS(tptr))); + ND_PRINT((ndo, "\n\t checksum: 0x%04x ", EXTRACT_BE_U_2(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_BE_16BITS(tptr), tptr-optr, + osi_print_cksum(ndo, optr, EXTRACT_BE_U_2(tptr), tptr-optr, length); break; @@ -3022,7 +3022,7 @@ isis_print(netdissect_options *ndo, break; ND_TCHECK2(*tptr, ISIS_TLV_RESTART_SIGNALING_FLAGLEN); ND_PRINT((ndo, "\n\t Flags [%s]", - bittok2str(isis_restart_flag_values, "none", EXTRACT_8BITS(tptr)))); + bittok2str(isis_restart_flag_values, "none", EXTRACT_U_1(tptr)))); tptr+=ISIS_TLV_RESTART_SIGNALING_FLAGLEN; tmp-=ISIS_TLV_RESTART_SIGNALING_FLAGLEN; @@ -3034,7 +3034,7 @@ isis_print(netdissect_options *ndo, break; ND_TCHECK2(*tptr, ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN); - ND_PRINT((ndo, ", Remaining holding time %us", EXTRACT_BE_16BITS(tptr))); + ND_PRINT((ndo, ", Remaining holding time %us", EXTRACT_BE_U_2(tptr))); tptr+=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN; tmp-=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN; @@ -3052,13 +3052,13 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Inter-Domain Information Type: %s", tok2str(isis_subtlv_idrp_values, "Unknown (0x%02x)", - EXTRACT_8BITS(tptr)))); - isis_subtlv_idrp = EXTRACT_8BITS(tptr); + EXTRACT_U_1(tptr)))); + isis_subtlv_idrp = EXTRACT_U_1(tptr); tptr++; switch (isis_subtlv_idrp) { case ISIS_SUBTLV_IDRP_ASN: ND_TCHECK_2(tptr); /* fetch AS number */ - ND_PRINT((ndo, "AS Number: %u", EXTRACT_BE_16BITS(tptr))); + ND_PRINT((ndo, "AS Number: %u", EXTRACT_BE_U_2(tptr))); break; case ISIS_SUBTLV_IDRP_LOCAL: case ISIS_SUBTLV_IDRP_RES: @@ -3073,7 +3073,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_BE_16BITS(tptr))); + ND_PRINT((ndo, "\n\t LSP Buffersize: %u", EXTRACT_BE_U_2(tptr))); break; case ISIS_TLV_PART_DIS: @@ -3096,7 +3096,7 @@ isis_print(netdissect_options *ndo, while(tmp>0) { ND_TCHECK_1(tptr); - prefix_len=EXTRACT_8BITS(tptr); /* read out prefix length in semioctets*/ + prefix_len=EXTRACT_U_1(tptr); /* read out prefix length in semioctets*/ tptr++; if (prefix_len < 2) { ND_PRINT((ndo, "\n\t\tAddress: prefix length %u < 2", prefix_len)); @@ -3117,14 +3117,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_BE_32BITS(tptr))); + ND_PRINT((ndo, "\n\t Sequence number: %u", EXTRACT_BE_U_4(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_BE_24BITS(tptr); + vendor_id = EXTRACT_BE_U_3(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 f023d178..0202e416 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_BE_16BITS(&gh->vlan_id[0]))); + EXTRACT_BE_U_2(&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_BE_16BITS(&ih->sa_index), + EXTRACT_BE_U_2(&ih->sa_index), ih->ttl, tok2str(juniper_ipsec_type_values,"Unknown",ih->type), ih->type, - EXTRACT_BE_32BITS(&ih->spi), + EXTRACT_BE_U_4(&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_BE_16BITS(&ih->sa_index), + EXTRACT_BE_U_2(&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_BE_32BITS(&mh->service_id), - EXTRACT_BE_16BITS(&mh->iif), + EXTRACT_BE_U_4(&mh->service_id), + EXTRACT_BE_U_2(&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_BE_16BITS(&sh->svc_set_id), - EXTRACT_BE_24BITS(&sh->dir_iif[1]))); + EXTRACT_BE_U_2(&sh->svc_set_id), + EXTRACT_BE_U_3(&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_BE_16BITS(p); + extracted_ethertype = EXTRACT_BE_U_2(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_BE_16BITS(&l2info.cookie) != PPP_OSI && - EXTRACT_BE_16BITS(&l2info.cookie) != (PPP_ADDRESS << 8 | PPP_CONTROL)) + EXTRACT_BE_U_2(&l2info.cookie) != PPP_OSI && + EXTRACT_BE_U_2(&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_BE_16BITS(&l2info.cookie)) { + switch (EXTRACT_BE_U_2(&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_BE_32BITS(l2info.cookie) != 1) + if (ndo->ndo_eflag && EXTRACT_BE_U_4(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_BE_32BITS(l2info.cookie) != 1) + if (ndo->ndo_eflag && EXTRACT_BE_U_4(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_BE_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */ - EXTRACT_BE_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */ + if (EXTRACT_BE_U_3(p) == 0xfefe03 || /* NLPID encaps ? */ + EXTRACT_BE_U_3(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_BE_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */ - EXTRACT_BE_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */ + if (EXTRACT_BE_U_3(p) == 0xfefe03 || /* NLPID encaps ? */ + EXTRACT_BE_U_3(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_BE_32BITS(l2info.cookie) & ATM2_GAP_COUNT_MASK)) { + (EXTRACT_BE_U_4(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_BE_16BITS(p)) { + switch(EXTRACT_BE_U_2(p)) { case PPP_IP : case PPP_OSI : case PPP_MPLS_UCAST : @@ -1140,13 +1140,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_LE_16BITS(p); + tlv_value = EXTRACT_LE_U_2(p); break; case 3: - tlv_value = EXTRACT_LE_24BITS(p); + tlv_value = EXTRACT_LE_U_3(p); break; case 4: - tlv_value = EXTRACT_LE_32BITS(p); + tlv_value = EXTRACT_LE_U_4(p); break; default: tlv_value = -1; @@ -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_BE_16BITS(p); + tlv_value = EXTRACT_BE_U_2(p); break; case 3: - tlv_value = EXTRACT_BE_24BITS(p); + tlv_value = EXTRACT_BE_U_3(p); break; case 4: - tlv_value = EXTRACT_BE_32BITS(p); + tlv_value = EXTRACT_BE_U_4(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_BE_24BITS(p) != JUNIPER_MGC_NUMBER) { /* magic number found ? */ + if (EXTRACT_BE_U_3(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_BE_16BITS(tptr); + jnx_ext_len = EXTRACT_BE_U_2(tptr); jnx_header_len += 2; tptr +=2; @@ -1234,9 +1234,9 @@ juniper_parse_header(netdissect_options *ndo, ND_TCHECK2(tptr[0], jnx_ext_len); while (jnx_ext_len > JUNIPER_EXT_TLV_OVERHEAD) { - tlv_type = EXTRACT_8BITS(tptr); + tlv_type = EXTRACT_U_1(tptr); tptr++; - tlv_len = EXTRACT_8BITS(tptr); + tlv_len = EXTRACT_U_1(tptr); tptr++; tlv_value = 0; @@ -1370,7 +1370,7 @@ juniper_parse_header(netdissect_options *ndo, ND_TCHECK_2(p + l2info->cookie_len); - l2info->proto = EXTRACT_BE_16BITS(p + l2info->cookie_len); + l2info->proto = EXTRACT_BE_U_2(p + l2info->cookie_len); break; } ++lp; @@ -1386,7 +1386,7 @@ juniper_parse_header(netdissect_options *ndo, l2info->bundle = l2info->cookie[1]; break; case AS_COOKIE_ID: - l2info->bundle = (EXTRACT_BE_16BITS(&l2info->cookie[6])>>3)&0xfff; + l2info->bundle = (EXTRACT_BE_U_2(&l2info->cookie[6])>>3)&0xfff; l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK; break; default: @@ -1401,13 +1401,13 @@ juniper_parse_header(netdissect_options *ndo, case LS_COOKIE_ID: ND_TCHECK2(p[0], 2); l2info->bundle = l2info->cookie[1]; - l2info->proto = EXTRACT_BE_16BITS(p); + l2info->proto = EXTRACT_BE_U_2(p); l2info->header_len += 2; l2info->length -= 2; l2info->caplen -= 2; break; case AS_COOKIE_ID: - l2info->bundle = (EXTRACT_BE_16BITS(&l2info->cookie[6])>>3)&0xfff; + l2info->bundle = (EXTRACT_BE_U_2(&l2info->cookie[6])>>3)&0xfff; l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK; break; default: @@ -1425,13 +1425,13 @@ juniper_parse_header(netdissect_options *ndo, case LS_COOKIE_ID: ND_TCHECK2(p[0], 2); l2info->bundle = l2info->cookie[1]; - l2info->proto = EXTRACT_BE_16BITS(p); + l2info->proto = EXTRACT_BE_U_2(p); l2info->header_len += 2; l2info->length -= 2; l2info->caplen -= 2; break; case AS_COOKIE_ID: - l2info->bundle = (EXTRACT_BE_16BITS(&l2info->cookie[6])>>3)&0xfff; + l2info->bundle = (EXTRACT_BE_U_2(&l2info->cookie[6])>>3)&0xfff; l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK; break; default: @@ -1445,7 +1445,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_BE_32BITS(p); + control_word = EXTRACT_BE_U_4(p); /* some control word heuristics */ switch(control_word) { case 0: /* zero control word */ diff --git a/print-krb.c b/print-krb.c index ef6a83b2..b275362f 100644 --- a/print-krb.c +++ b/print-krb.c @@ -119,7 +119,7 @@ c_print(netdissect_options *ndo, flag = 1; while (s < ep) { - c = EXTRACT_8BITS(s); + c = EXTRACT_U_1(s); s++; if (c == '\0') { flag = 0; @@ -173,7 +173,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_BE_16BITS(cp)) +#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? EXTRACT_LE_U_2(cp) : EXTRACT_BE_U_2(cp)) kp = (const struct krb *)cp; @@ -203,11 +203,11 @@ krb4_print(netdissect_options *ndo, case AUTH_MSG_APPL_REQUEST: cp += 2; ND_TCHECK(*cp); - ND_PRINT((ndo, "v%d ", EXTRACT_8BITS(cp))); + ND_PRINT((ndo, "v%d ", EXTRACT_U_1(cp))); cp++; PRINT; ND_TCHECK(*cp); - ND_PRINT((ndo, " (%d)", EXTRACT_8BITS(cp))); + ND_PRINT((ndo, " (%d)", EXTRACT_U_1(cp))); cp++; ND_TCHECK(*cp); ND_PRINT((ndo, " (%d)", *cp)); diff --git a/print-l2tp.c b/print-l2tp.c index 782c0fea..9852ff50 100644 --- a/print-l2tp.c +++ b/print-l2tp.c @@ -268,7 +268,7 @@ print_string(netdissect_options *ndo, const u_char *dat, u_int length) { u_int i; for (i=0; i<length; i++) { - ND_PRINT((ndo, "%c", EXTRACT_8BITS(dat))); + ND_PRINT((ndo, "%c", EXTRACT_U_1(dat))); dat++; } } @@ -278,7 +278,7 @@ print_octets(netdissect_options *ndo, const u_char *dat, u_int length) { u_int i; for (i=0; i<length; i++) { - ND_PRINT((ndo, "%02x", EXTRACT_8BITS(dat))); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(dat))); dat++; } } @@ -286,13 +286,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_BE_16BITS(dat))); + ND_PRINT((ndo, "%u", EXTRACT_BE_U_2(dat))); } static void print_32bits_val(netdissect_options *ndo, const uint32_t *dat) { - ND_PRINT((ndo, "%lu", (u_long) EXTRACT_BE_32BITS(dat))); + ND_PRINT((ndo, "%lu", (u_long) EXTRACT_BE_U_4(dat))); } /***********************************/ @@ -308,7 +308,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_BE_16BITS(ptr)))); + EXTRACT_BE_U_2(ptr)))); } static void @@ -321,7 +321,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_BE_16BITS(ptr))); + ND_PRINT((ndo, "%u", EXTRACT_BE_U_2(ptr))); ptr++; length -= 2; @@ -332,7 +332,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_BE_16BITS(ptr))); + ND_PRINT((ndo, "/%u", EXTRACT_BE_U_2(ptr))); ptr++; length -= 2; @@ -350,8 +350,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_BE_16BITS(dat) >> 8), - (EXTRACT_BE_16BITS(dat) & 0xff))); + ND_PRINT((ndo, "%u.%u", (EXTRACT_BE_U_2(dat) >> 8), + (EXTRACT_BE_U_2(dat) & 0xff))); } static void @@ -363,10 +363,10 @@ l2tp_framing_cap_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT((ndo, "AVP too short")); return; } - if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_CAP_ASYNC_MASK) { + if (EXTRACT_BE_U_4(ptr) & L2TP_FRAMING_CAP_ASYNC_MASK) { ND_PRINT((ndo, "A")); } - if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_CAP_SYNC_MASK) { + if (EXTRACT_BE_U_4(ptr) & L2TP_FRAMING_CAP_SYNC_MASK) { ND_PRINT((ndo, "S")); } } @@ -380,10 +380,10 @@ l2tp_bearer_cap_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT((ndo, "AVP too short")); return; } - if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_CAP_ANALOG_MASK) { + if (EXTRACT_BE_U_4(ptr) & L2TP_BEARER_CAP_ANALOG_MASK) { ND_PRINT((ndo, "A")); } - if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_CAP_DIGITAL_MASK) { + if (EXTRACT_BE_U_4(ptr) & L2TP_BEARER_CAP_DIGITAL_MASK) { ND_PRINT((ndo, "D")); } } @@ -414,10 +414,10 @@ l2tp_bearer_type_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT((ndo, "AVP too short")); return; } - if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) { + if (EXTRACT_BE_U_4(ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) { ND_PRINT((ndo, "A")); } - if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) { + if (EXTRACT_BE_U_4(ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) { ND_PRINT((ndo, "D")); } } @@ -431,10 +431,10 @@ l2tp_framing_type_print(netdissect_options *ndo, const u_char *dat, u_int length ND_PRINT((ndo, "AVP too short")); return; } - if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_TYPE_ASYNC_MASK) { + if (EXTRACT_BE_U_4(ptr) & L2TP_FRAMING_TYPE_ASYNC_MASK) { ND_PRINT((ndo, "A")); } - if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_TYPE_SYNC_MASK) { + if (EXTRACT_BE_U_4(ptr) & L2TP_FRAMING_TYPE_SYNC_MASK) { ND_PRINT((ndo, "S")); } } @@ -455,7 +455,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_BE_16BITS(ptr)))); + "AuthType-#%u", EXTRACT_BE_U_2(ptr)))); } static void @@ -467,7 +467,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_BE_16BITS(ptr) & L2TP_PROXY_AUTH_ID_MASK)); + ND_PRINT((ndo, "%u", EXTRACT_BE_U_2(ptr) & L2TP_PROXY_AUTH_ID_MASK)); } static void @@ -487,48 +487,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_BE_16BITS(ptr); ptr++; length -= 2; - val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; + val_h = EXTRACT_BE_U_2(ptr); ptr++; length -= 2; + val_l = EXTRACT_BE_U_2(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_BE_16BITS(ptr); ptr++; length -= 2; - val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; + val_h = EXTRACT_BE_U_2(ptr); ptr++; length -= 2; + val_l = EXTRACT_BE_U_2(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_BE_16BITS(ptr); ptr++; length -= 2; - val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; + val_h = EXTRACT_BE_U_2(ptr); ptr++; length -= 2; + val_l = EXTRACT_BE_U_2(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_BE_16BITS(ptr); ptr++; length -= 2; - val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; + val_h = EXTRACT_BE_U_2(ptr); ptr++; length -= 2; + val_l = EXTRACT_BE_U_2(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_BE_16BITS(ptr); ptr++; length -= 2; - val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; + val_h = EXTRACT_BE_U_2(ptr); ptr++; length -= 2; + val_l = EXTRACT_BE_U_2(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_BE_16BITS(ptr); ptr++; - val_l = EXTRACT_BE_16BITS(ptr); ptr++; + val_h = EXTRACT_BE_U_2(ptr); ptr++; + val_l = EXTRACT_BE_U_2(ptr); ptr++; ND_PRINT((ndo, "AlignErr=%u ", (val_h<<16) + val_l)); } @@ -549,16 +549,16 @@ l2tp_accm_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT((ndo, "AVP too short")); return; } - val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; - val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2; + val_h = EXTRACT_BE_U_2(ptr); ptr++; length -= 2; + val_l = EXTRACT_BE_U_2(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_BE_16BITS(ptr); ptr++; - val_l = EXTRACT_BE_16BITS(ptr); ptr++; + val_h = EXTRACT_BE_U_2(ptr); ptr++; + val_l = EXTRACT_BE_U_2(ptr); ptr++; ND_PRINT((ndo, "recv=%08x ", (val_h<<16) + val_l)); } @@ -572,16 +572,16 @@ l2tp_ppp_discon_cc_print(netdissect_options *ndo, const u_char *dat, u_int lengt return; } /* Disconnect Code */ - ND_PRINT((ndo, "%04x, ", EXTRACT_BE_16BITS(dat))); + ND_PRINT((ndo, "%04x, ", EXTRACT_BE_U_2(dat))); dat += 2; length -= 2; /* Control Protocol Number */ - ND_PRINT((ndo, "%04x ", EXTRACT_BE_16BITS(dat))); + ND_PRINT((ndo, "%04x ", EXTRACT_BE_U_2(dat))); dat += 2; length -= 2; /* Direction */ ND_PRINT((ndo, "%s", tok2str(l2tp_cc_direction2str, - "Direction-#%u", EXTRACT_8BITS(ptr)))); + "Direction-#%u", EXTRACT_U_1(ptr)))); ptr++; length--; @@ -606,7 +606,7 @@ l2tp_avp_print(netdissect_options *ndo, const u_char *dat, int length) ND_PRINT((ndo, " ")); ND_TCHECK(*ptr); /* Flags & Length */ - len = EXTRACT_BE_16BITS(ptr) & L2TP_AVP_HDR_LEN_MASK; + len = EXTRACT_BE_U_2(ptr) & L2TP_AVP_HDR_LEN_MASK; /* If it is not long enough to contain the header, we'll give up. */ if (len < 6) @@ -627,26 +627,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_BE_16BITS(ptr) & L2TP_AVP_HDR_FLAG_MANDATORY) { + if (EXTRACT_BE_U_2(ptr) & L2TP_AVP_HDR_FLAG_MANDATORY) { ND_PRINT((ndo, "*")); } - if (EXTRACT_BE_16BITS(ptr) & L2TP_AVP_HDR_FLAG_HIDDEN) { + if (EXTRACT_BE_U_2(ptr) & L2TP_AVP_HDR_FLAG_HIDDEN) { hidden = TRUE; ND_PRINT((ndo, "?")); } ptr++; - if (EXTRACT_BE_16BITS(ptr)) { + if (EXTRACT_BE_U_2(ptr)) { /* Vendor Specific Attribute */ - ND_PRINT((ndo, "VENDOR%04x:", EXTRACT_BE_16BITS(ptr))); ptr++; - ND_PRINT((ndo, "ATTR%04x", EXTRACT_BE_16BITS(ptr))); ptr++; + ND_PRINT((ndo, "VENDOR%04x:", EXTRACT_BE_U_2(ptr))); ptr++; + ND_PRINT((ndo, "ATTR%04x", EXTRACT_BE_U_2(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_BE_16BITS(ptr); ptr++; + attr_type = EXTRACT_BE_U_2(ptr); ptr++; ND_PRINT((ndo, "%s", tok2str(l2tp_avp2str, "AVP-#%u", attr_type))); ND_PRINT((ndo, "(")); if (hidden) { @@ -778,9 +778,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_BE_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) { + if ((EXTRACT_BE_U_2(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) { ND_PRINT((ndo, " l2tp:")); - } else if ((EXTRACT_BE_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2F) { + } else if ((EXTRACT_BE_U_2(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2F) { ND_PRINT((ndo, " l2f:")); return; /* nothing to do */ } else { @@ -789,23 +789,23 @@ l2tp_print(netdissect_options *ndo, const u_char *dat, u_int length) } ND_PRINT((ndo, "[")); - if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_TYPE) { + if (EXTRACT_BE_U_2(ptr) & L2TP_FLAG_TYPE) { flag_t = TRUE; ND_PRINT((ndo, "T")); } - if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_LENGTH) { + if (EXTRACT_BE_U_2(ptr) & L2TP_FLAG_LENGTH) { flag_l = TRUE; ND_PRINT((ndo, "L")); } - if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_SEQUENCE) { + if (EXTRACT_BE_U_2(ptr) & L2TP_FLAG_SEQUENCE) { flag_s = TRUE; ND_PRINT((ndo, "S")); } - if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_OFFSET) { + if (EXTRACT_BE_U_2(ptr) & L2TP_FLAG_OFFSET) { flag_o = TRUE; ND_PRINT((ndo, "O")); } - if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_PRIORITY) + if (EXTRACT_BE_U_2(ptr) & L2TP_FLAG_PRIORITY) ND_PRINT((ndo, "P")); ND_PRINT((ndo, "]")); @@ -814,7 +814,7 @@ l2tp_print(netdissect_options *ndo, const u_char *dat, u_int length) if (flag_l) { ND_TCHECK2(*ptr, 2); /* Length */ - l2tp_len = EXTRACT_BE_16BITS(ptr); + l2tp_len = EXTRACT_BE_U_2(ptr); ptr += 2; cnt += 2; } else { @@ -822,28 +822,28 @@ l2tp_print(netdissect_options *ndo, const u_char *dat, u_int length) } ND_TCHECK2(*ptr, 2); /* Tunnel ID */ - ND_PRINT((ndo, "(%u/", EXTRACT_BE_16BITS(ptr))); + ND_PRINT((ndo, "(%u/", EXTRACT_BE_U_2(ptr))); ptr += 2; cnt += 2; ND_TCHECK2(*ptr, 2); /* Session ID */ - ND_PRINT((ndo, "%u)", EXTRACT_BE_16BITS(ptr))); + ND_PRINT((ndo, "%u)", EXTRACT_BE_U_2(ptr))); ptr += 2; cnt += 2; if (flag_s) { ND_TCHECK2(*ptr, 2); /* Ns */ - ND_PRINT((ndo, "Ns=%u,", EXTRACT_BE_16BITS(ptr))); + ND_PRINT((ndo, "Ns=%u,", EXTRACT_BE_U_2(ptr))); ptr += 2; cnt += 2; ND_TCHECK2(*ptr, 2); /* Nr */ - ND_PRINT((ndo, "Nr=%u", EXTRACT_BE_16BITS(ptr))); + ND_PRINT((ndo, "Nr=%u", EXTRACT_BE_U_2(ptr))); ptr += 2; cnt += 2; } if (flag_o) { ND_TCHECK2(*ptr, 2); /* Offset Size */ - pad = EXTRACT_BE_16BITS(ptr); + pad = EXTRACT_BE_U_2(ptr); ptr += (2 + pad); cnt += (2 + pad); } diff --git a/print-lane.c b/print-lane.c index b506ce30..ccc23527 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_BE_16BITS(bp))); + ND_PRINT((ndo, "lecid:%x ", EXTRACT_BE_U_2(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_BE_16BITS(&lec->lec_header) == 0xff00) { + if (EXTRACT_BE_U_2(&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_BE_16BITS(&lec->lec_opcode)))); + tok2str(lecop2str, "opcode-#%u", EXTRACT_BE_U_2(&lec->lec_opcode)))); return; } diff --git a/print-ldp.c b/print-ldp.c index df43da78..5a7608b9 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_BE_16BITS(ldp_tlv_header->length); + tlv_len=EXTRACT_BE_U_2(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_BE_16BITS(ldp_tlv_header->type)); + tlv_type=LDP_MASK_TLV_TYPE(EXTRACT_BE_U_2(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_BE_16BITS(&ldp_tlv_header->type)) ? "continue processing" : "ignore", - LDP_MASK_F_BIT(EXTRACT_BE_16BITS(&ldp_tlv_header->type)) ? "do" : "don't")); + LDP_MASK_U_BIT(EXTRACT_BE_U_2(&ldp_tlv_header->type)) ? "continue processing" : "ignore", + LDP_MASK_F_BIT(EXTRACT_BE_U_2(&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_BE_16BITS(tptr), - (EXTRACT_BE_16BITS(tptr + 2)&0x8000) ? "Targeted" : "Link", - (EXTRACT_BE_16BITS(tptr + 2)&0x4000) ? ", Request for targeted Hellos" : "")); + EXTRACT_BE_U_2(tptr), + (EXTRACT_BE_U_2(tptr + 2)&0x8000) ? "Targeted" : "Link", + (EXTRACT_BE_U_2(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_BE_32BITS(tptr))); + ND_PRINT((ndo, "\n\t Sequence Number: %u", EXTRACT_BE_U_4(tptr))); break; case LDP_TLV_ADDRESS_LIST: TLV_TCHECK(LDP_TLV_ADDRESS_LIST_AFNUM_LEN); - af = EXTRACT_BE_16BITS(tptr); + af = EXTRACT_BE_U_2(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_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" + EXTRACT_BE_U_2(tptr), EXTRACT_BE_U_2(tptr + 2), + (EXTRACT_BE_U_2(tptr + 6)&0x8000) ? "On Demand" : "Unsolicited", + (EXTRACT_BE_U_2(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_BE_16BITS(tptr); + af = EXTRACT_BE_U_2(tptr); tptr+=LDP_TLV_ADDRESS_LIST_AFNUM_LEN; tlv_tlen-=LDP_TLV_ADDRESS_LIST_AFNUM_LEN; if (af == AFNUM_INET) { @@ -384,7 +384,7 @@ ldp_tlv_print(netdissect_options *ndo, * Pseudowire Types. */ TLV_TCHECK(7); - vc_info_len = EXTRACT_8BITS(tptr + 2); + vc_info_len = EXTRACT_U_1(tptr + 2); /* * According to RFC 4908, the VC info Length field can be zero, @@ -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_BE_16BITS(tptr)&0x7fff), - EXTRACT_BE_16BITS(tptr)&0x8000 ? "" : "no ", - EXTRACT_BE_32BITS(tptr + 3), + tok2str(mpls_pw_types_values, "Unknown", EXTRACT_BE_U_2(tptr)&0x7fff), + EXTRACT_BE_U_2(tptr)&0x8000 ? "" : "no ", + EXTRACT_BE_U_4(tptr + 3), vc_info_len)); break; } @@ -403,10 +403,10 @@ 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_BE_16BITS(tptr)&0x7fff), - EXTRACT_BE_16BITS(tptr)&0x8000 ? "" : "no ", - EXTRACT_BE_32BITS(tptr + 3), - EXTRACT_BE_32BITS(tptr + 7), + tok2str(mpls_pw_types_values, "Unknown", EXTRACT_BE_U_2(tptr)&0x7fff), + EXTRACT_BE_U_2(tptr)&0x8000 ? "" : "no ", + EXTRACT_BE_U_4(tptr + 3), + EXTRACT_BE_U_4(tptr + 7), vc_info_len)); if (vc_info_len < 4) { /* minimum 4, for the VC ID */ @@ -422,7 +422,7 @@ ldp_tlv_print(netdissect_options *ndo, while (vc_info_len > 2) { vc_info_tlv_type = *tptr; - vc_info_tlv_len = EXTRACT_8BITS(tptr + 1); + vc_info_tlv_len = EXTRACT_U_1(tptr + 1); if (vc_info_tlv_len < 2) break; if (vc_info_len < vc_info_tlv_len) @@ -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_BE_16BITS(tptr + 2))); + ND_PRINT((ndo, ": %u", EXTRACT_BE_U_2(tptr + 2))); break; case LDP_FEC_MARTINI_IFPARM_DESC: @@ -446,11 +446,11 @@ ldp_tlv_print(netdissect_options *ndo, case LDP_FEC_MARTINI_IFPARM_VCCV: ND_PRINT((ndo, "\n\t\t Control Channels (0x%02x) = [%s]", - EXTRACT_8BITS((tptr + 2)), - bittok2str(ldp_fec_martini_ifparm_vccv_cc_values, "none", EXTRACT_8BITS((tptr + 2))))); + EXTRACT_U_1((tptr + 2)), + bittok2str(ldp_fec_martini_ifparm_vccv_cc_values, "none", EXTRACT_U_1((tptr + 2))))); ND_PRINT((ndo, "\n\t\t CV Types (0x%02x) = [%s]", - EXTRACT_8BITS((tptr + 3)), - bittok2str(ldp_fec_martini_ifparm_vccv_cv_values, "none", EXTRACT_8BITS((tptr + 3))))); + EXTRACT_U_1((tptr + 3)), + bittok2str(ldp_fec_martini_ifparm_vccv_cv_values, "none", EXTRACT_U_1((tptr + 3))))); break; default: @@ -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_BE_32BITS(tptr) & 0xfffff)); + ND_PRINT((ndo, "\n\t Label: %u", EXTRACT_BE_U_4(tptr) & 0xfffff)); break; case LDP_TLV_STATUS: TLV_TCHECK(8); - ui = EXTRACT_BE_32BITS(tptr); + ui = EXTRACT_BE_U_4(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_BE_32BITS(tptr); + ui = EXTRACT_BE_U_4(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_BE_16BITS(tptr); + ft_flags = EXTRACT_BE_U_2(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_BE_32BITS(tptr); + ui = EXTRACT_BE_U_4(tptr); if (ui) ND_PRINT((ndo, ", Reconnect Timeout: %ums", ui)); tptr+=4; - ui = EXTRACT_BE_32BITS(tptr); + ui = EXTRACT_BE_U_4(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_BE_16BITS(tptr))); + ND_PRINT((ndo, "\n\t MTU: %u", EXTRACT_BE_U_2(tptr))); break; @@ -573,14 +573,14 @@ ldp_pdu_print(netdissect_options *ndo, /* * Sanity checking of the header. */ - if (EXTRACT_BE_16BITS(&ldp_com_header->version) != LDP_VERSION) { + if (EXTRACT_BE_U_2(&ldp_com_header->version) != LDP_VERSION) { ND_PRINT((ndo, "%sLDP version %u packet not supported", (ndo->ndo_vflag < 1) ? "" : "\n\t", - EXTRACT_BE_16BITS(&ldp_com_header->version))); + EXTRACT_BE_U_2(&ldp_com_header->version))); return 0; } - pdu_len = EXTRACT_BE_16BITS(&ldp_com_header->pdu_length); + pdu_len = EXTRACT_BE_U_2(&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_BE_16BITS(&ldp_com_header->label_space), + EXTRACT_BE_U_2(&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_BE_16BITS(ldp_msg_header->length); - msg_type=LDP_MASK_MSG_TYPE(EXTRACT_BE_16BITS(ldp_msg_header->type)); + msg_len=EXTRACT_BE_U_2(ldp_msg_header->length); + msg_type=LDP_MASK_MSG_TYPE(EXTRACT_BE_U_2(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_BE_32BITS(&ldp_msg_header->id), - LDP_MASK_U_BIT(EXTRACT_BE_16BITS(&ldp_msg_header->type)) ? "continue processing" : "ignore")); + EXTRACT_BE_U_4(&ldp_msg_header->id), + LDP_MASK_U_BIT(EXTRACT_BE_U_2(&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 8d064023..6a25b27b 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_BE_16BITS(&lisp_hdr->auth_data_len); + auth_data_len = EXTRACT_BE_U_2(&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_BE_16BITS(&lisp_hdr->key_id); + key_id = EXTRACT_BE_U_2(&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_BE_16BITS(&lisp_eid->eid_prefix_afi); + eid_afi = EXTRACT_BE_U_2(&lisp_eid->eid_prefix_afi); loc_count = lisp_eid->locator_count; if (ndo->ndo_vflag) { - ttl = EXTRACT_BE_32BITS(&lisp_eid->ttl); + ttl = EXTRACT_BE_U_4(&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_BE_16BITS(&lisp_loc->locator_afi); + loc_afi = EXTRACT_BE_U_2(&lisp_loc->locator_afi); if (ndo->ndo_vflag) ND_PRINT((ndo, "\n ")); @@ -357,7 +357,7 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) lisp_loc->priority, lisp_loc->weight, lisp_loc->m_priority, lisp_loc->m_weight)); loc_hdr_flag(ndo, - EXTRACT_BE_16BITS(&lisp_loc->unused_and_flag)); + EXTRACT_BE_U_2(&lisp_loc->unused_and_flag)); } } } @@ -372,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_BE_64BITS(packet_iterator + packet_offset + 16))); + EXTRACT_BE_U_8(packet_iterator + packet_offset + 16))); } else { /* Check if packet isn't over yet */ if (packet_iterator + packet_offset < ndo->ndo_snapend) { @@ -419,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_BE_32BITS(lisp_hdr)))); + "none", EXTRACT_BE_U_4(lisp_hdr)))); } else if (type == LISP_MAP_NOTIFY) { ND_PRINT((ndo, " flags [%s],", bittok2str(map_notify_hdr_flag, - "none", EXTRACT_BE_32BITS(lisp_hdr)))); + "none", EXTRACT_BE_U_4(lisp_hdr)))); } return; diff --git a/print-llc.c b/print-llc.c index 699cc63c..b4716bcb 100644 --- a/print-llc.c +++ b/print-llc.c @@ -167,7 +167,7 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, } dsap_field = *p; - ssap_field = EXTRACT_8BITS(p + 1); + ssap_field = EXTRACT_U_1(p + 1); /* * OK, what type of LLC frame is this? The length @@ -175,7 +175,7 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, * have a two-byte control field, and U frames have * a one-byte control field. */ - control = EXTRACT_8BITS(p + 2); + control = EXTRACT_U_1(p + 2); if ((control & LLC_U_FMT) == LLC_U_FMT) { /* * U frame. @@ -201,7 +201,7 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, /* * ...and is little-endian. */ - control = EXTRACT_LE_16BITS(p + 2); + control = EXTRACT_LE_U_2(p + 2); is_u = 0; hdrlen = 4; /* DSAP, SSAP, 2-byte control field */ } @@ -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_BE_24BITS(p); - et = EXTRACT_BE_16BITS(p + 3); + orgcode = EXTRACT_BE_U_3(p); + et = EXTRACT_BE_U_2(p + 3); if (ndo->ndo_eflag) { /* diff --git a/print-lldp.c b/print-lldp.c index ed97f40a..9c72182d 100644 --- a/print-lldp.c +++ b/print-lldp.c @@ -656,7 +656,7 @@ lldp_private_8021_print(netdissect_options *ndo, if (tlv_len < 4) { return hexdump; } - subtype = EXTRACT_8BITS(tptr + 3); + subtype = EXTRACT_U_1(tptr + 3); ND_PRINT((ndo, "\n\t %s Subtype (%u)", tok2str(lldp_8021_subtype_values, "unknown", subtype), @@ -668,26 +668,26 @@ lldp_private_8021_print(netdissect_options *ndo, return hexdump; } ND_PRINT((ndo, "\n\t port vlan id (PVID): %u", - EXTRACT_BE_16BITS(tptr + 4))); + EXTRACT_BE_U_2(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_BE_16BITS(tptr + 5), - bittok2str(lldp_8021_port_protocol_id_values, "none", EXTRACT_8BITS((tptr + 4))), + EXTRACT_BE_U_2(tptr + 5), + bittok2str(lldp_8021_port_protocol_id_values, "none", EXTRACT_U_1((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_BE_16BITS(tptr + 4))); + ND_PRINT((ndo, "\n\t vlan id (VID): %u", EXTRACT_BE_U_2(tptr + 4))); if (tlv_len < 7) { return hexdump; } - sublen = EXTRACT_8BITS(tptr + 6); + sublen = EXTRACT_U_1(tptr + 6); if (tlv_len < 7+sublen) { return hexdump; } @@ -698,7 +698,7 @@ lldp_private_8021_print(netdissect_options *ndo, if (tlv_len < 5) { return hexdump; } - sublen = EXTRACT_8BITS(tptr + 4); + sublen = EXTRACT_U_1(tptr + 4); if (tlv_len < 5+sublen) { return hexdump; } @@ -709,13 +709,13 @@ lldp_private_8021_print(netdissect_options *ndo, if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_CONGESTION_NOTIFICATION_LENGTH){ return hexdump; } - tval=EXTRACT_8BITS(tptr + 4); + tval=EXTRACT_U_1(tptr + 4); ND_PRINT((ndo, "\n\t Pre-Priority CNPV Indicator")); ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : ")); for(i=0;i<NO_OF_BITS;i++) ND_PRINT((ndo, "%-2d ", (tval >> i) & 0x01)); - tval=EXTRACT_8BITS(tptr + 5); + tval=EXTRACT_U_1(tptr + 5); ND_PRINT((ndo, "\n\t Pre-Priority Ready Indicator")); ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : ")); @@ -727,7 +727,7 @@ lldp_private_8021_print(netdissect_options *ndo, if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_ETS_CONFIGURATION_LENGTH) { return hexdump; } - tval=EXTRACT_8BITS(tptr + 4); + tval=EXTRACT_U_1(tptr + 4); ND_PRINT((ndo, "\n\t Willing:%d, CBS:%d, RES:%d, Max TCs:%d", tval >> 7, (tval >> 6) & 0x02, (tval >> 3) & 0x07, tval & 0x07)); @@ -759,11 +759,11 @@ lldp_private_8021_print(netdissect_options *ndo, if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_PFC_CONFIGURATION_LENGTH) { return hexdump; } - tval=EXTRACT_8BITS(tptr + 4); + tval=EXTRACT_U_1(tptr + 4); ND_PRINT((ndo, "\n\t Willing: %d, MBC: %d, RES: %d, PFC cap:%d ", tval >> 7, (tval >> 6) & 0x01, (tval >> 4) & 0x03, (tval & 0x0f))); ND_PRINT((ndo, "\n\t PFC Enable")); - tval=EXTRACT_8BITS(tptr + 5); + tval=EXTRACT_U_1(tptr + 5); ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : ")); for(i=0;i<NO_OF_BITS;i++) @@ -786,10 +786,10 @@ lldp_private_8021_print(netdissect_options *ndo, i=0; ND_PRINT((ndo, "\n\t Application Priority Table")); while(i<sublen) { - tval=EXTRACT_8BITS(tptr + i + 5); + tval=EXTRACT_U_1(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_BE_16BITS(tptr + i + 5))); + EXTRACT_BE_U_2(tptr + i + 5))); i=i+3; } break; @@ -798,20 +798,20 @@ lldp_private_8021_print(netdissect_options *ndo, return hexdump; } ND_PRINT((ndo, "\n\t EVB Bridge Status")); - tval=EXTRACT_8BITS(tptr + 4); + tval=EXTRACT_U_1(tptr + 4); ND_PRINT((ndo, "\n\t RES: %d, BGID: %d, RRCAP: %d, RRCTR: %d", tval >> 3, (tval >> 2) & 0x01, (tval >> 1) & 0x01, tval & 0x01)); ND_PRINT((ndo, "\n\t EVB Station Status")); - tval=EXTRACT_8BITS(tptr + 5); + tval=EXTRACT_U_1(tptr + 5); ND_PRINT((ndo, "\n\t RES: %d, SGID: %d, RRREQ: %d,RRSTAT: %d", tval >> 4, (tval >> 3) & 0x01, (tval >> 2) & 0x01, tval & 0x03)); - tval=EXTRACT_8BITS(tptr + 6); + tval=EXTRACT_U_1(tptr + 6); ND_PRINT((ndo, "\n\t R: %d, RTE: %d, ",tval >> 5, tval & 0x1f)); - tval=EXTRACT_8BITS(tptr + 7); + tval=EXTRACT_U_1(tptr + 7); ND_PRINT((ndo, "EVB Mode: %s [%d]", tok2str(lldp_evb_mode_values, "unknown", tval >> 6), tval >> 6)); ND_PRINT((ndo, "\n\t ROL: %d, RWD: %d, ", (tval >> 5) & 0x01, tval & 0x1f)); - tval=EXTRACT_8BITS(tptr + 8); + tval=EXTRACT_U_1(tptr + 8); ND_PRINT((ndo, "RES: %d, ROL: %d, RKA: %d", tval >> 6, (tval >> 5) & 0x01, tval & 0x1f)); break; @@ -819,17 +819,17 @@ lldp_private_8021_print(netdissect_options *ndo, if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_CDCP_MIN_LENGTH){ return hexdump; } - tval=EXTRACT_8BITS(tptr + 4); + tval=EXTRACT_U_1(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_BE_16BITS(tptr + 6) & 0x0fff)); + ND_PRINT((ndo, "ChnCap: %d", EXTRACT_BE_U_2(tptr + 6) & 0x0fff)); sublen=tlv_len-8; if(sublen%3!=0) { return hexdump; } i=0; while(i<sublen) { - tval=EXTRACT_BE_24BITS(tptr + i + 8); + tval=EXTRACT_BE_U_3(tptr + i + 8); ND_PRINT((ndo, "\n\t SCID: %d, SVID: %d", tval >> 12, tval & 0x000fff)); i=i+3; @@ -856,7 +856,7 @@ lldp_private_8023_print(netdissect_options *ndo, if (tlv_len < 4) { return hexdump; } - subtype = EXTRACT_8BITS(tptr + 3); + subtype = EXTRACT_U_1(tptr + 3); ND_PRINT((ndo, "\n\t %s Subtype (%u)", tok2str(lldp_8023_subtype_values, "unknown", subtype), @@ -868,14 +868,14 @@ lldp_private_8023_print(netdissect_options *ndo, return hexdump; } ND_PRINT((ndo, "\n\t autonegotiation [%s] (0x%02x)", - bittok2str(lldp_8023_autonegotiation_values, "none", EXTRACT_8BITS((tptr + 4))), + bittok2str(lldp_8023_autonegotiation_values, "none", EXTRACT_U_1((tptr + 4))), *(tptr + 4))); ND_PRINT((ndo, "\n\t PMD autoneg capability [%s] (0x%04x)", - bittok2str(lldp_pmd_capability_values,"unknown", EXTRACT_BE_16BITS(tptr + 5)), - EXTRACT_BE_16BITS(tptr + 5))); + bittok2str(lldp_pmd_capability_values,"unknown", EXTRACT_BE_U_2(tptr + 5)), + EXTRACT_BE_U_2(tptr + 5))); ND_PRINT((ndo, "\n\t MAU type %s (0x%04x)", - tok2str(lldp_mau_types_values, "unknown", EXTRACT_BE_16BITS(tptr + 7)), - EXTRACT_BE_16BITS(tptr + 7))); + tok2str(lldp_mau_types_values, "unknown", EXTRACT_BE_U_2(tptr + 7)), + EXTRACT_BE_U_2(tptr + 7))); break; case LLDP_PRIVATE_8023_SUBTYPE_MDIPOWER: @@ -883,9 +883,9 @@ lldp_private_8023_print(netdissect_options *ndo, return hexdump; } ND_PRINT((ndo, "\n\t MDI power support [%s], power pair %s, power class %s", - bittok2str(lldp_mdi_values, "none", EXTRACT_8BITS((tptr + 4))), - tok2str(lldp_mdi_power_pairs_values, "unknown", EXTRACT_8BITS((tptr + 5))), - tok2str(lldp_mdi_power_class_values, "unknown", EXTRACT_8BITS((tptr + 6))))); + bittok2str(lldp_mdi_values, "none", EXTRACT_U_1((tptr + 4))), + tok2str(lldp_mdi_power_pairs_values, "unknown", EXTRACT_U_1((tptr + 5))), + tok2str(lldp_mdi_power_class_values, "unknown", EXTRACT_U_1((tptr + 6))))); break; case LLDP_PRIVATE_8023_SUBTYPE_LINKAGGR: @@ -893,15 +893,15 @@ lldp_private_8023_print(netdissect_options *ndo, return hexdump; } ND_PRINT((ndo, "\n\t aggregation status [%s], aggregation port ID %u", - bittok2str(lldp_aggregation_values, "none", EXTRACT_8BITS((tptr + 4))), - EXTRACT_BE_32BITS(tptr + 5))); + bittok2str(lldp_aggregation_values, "none", EXTRACT_U_1((tptr + 4))), + EXTRACT_BE_U_4(tptr + 5))); break; case LLDP_PRIVATE_8023_SUBTYPE_MTU: if (tlv_len < 6) { return hexdump; } - ND_PRINT((ndo, "\n\t MTU size %u", EXTRACT_BE_16BITS(tptr + 4))); + ND_PRINT((ndo, "\n\t MTU size %u", EXTRACT_BE_U_2(tptr + 4))); break; default: @@ -920,8 +920,8 @@ lldp_extract_latlon(const u_char *tptr) { uint64_t latlon; - latlon = EXTRACT_8BITS(tptr) & 0x3; - latlon = (latlon << 32) | EXTRACT_BE_32BITS(tptr + 1); + latlon = EXTRACT_U_1(tptr) & 0x3; + latlon = (latlon << 32) | EXTRACT_BE_U_4(tptr + 1); return latlon; } @@ -940,7 +940,7 @@ lldp_private_iana_print(netdissect_options *ndo, if (tlv_len < 8) { return hexdump; } - subtype = EXTRACT_8BITS(tptr + 3); + subtype = EXTRACT_U_1(tptr + 3); ND_PRINT((ndo, "\n\t %s Subtype (%u)", tok2str(lldp_iana_subtype_values, "unknown", subtype), @@ -976,7 +976,7 @@ lldp_private_tia_print(netdissect_options *ndo, if (tlv_len < 4) { return hexdump; } - subtype = EXTRACT_8BITS(tptr + 3); + subtype = EXTRACT_U_1(tptr + 3); ND_PRINT((ndo, "\n\t %s Subtype (%u)", tok2str(lldp_tia_subtype_values, "unknown", subtype), @@ -989,9 +989,9 @@ lldp_private_tia_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t Media capabilities [%s] (0x%04x)", bittok2str(lldp_tia_capabilities_values, "none", - EXTRACT_BE_16BITS(tptr + 4)), EXTRACT_BE_16BITS(tptr + 4))); + EXTRACT_BE_U_2(tptr + 4)), EXTRACT_BE_U_2(tptr + 4))); ND_PRINT((ndo, "\n\t Device type [%s] (0x%02x)", - tok2str(lldp_tia_device_type_values, "unknown", EXTRACT_8BITS((tptr + 6))), + tok2str(lldp_tia_device_type_values, "unknown", EXTRACT_U_1((tptr + 6))), *(tptr + 6))); break; @@ -1000,23 +1000,23 @@ lldp_private_tia_print(netdissect_options *ndo, return hexdump; } ND_PRINT((ndo, "\n\t Application type [%s] (0x%02x)", - tok2str(lldp_tia_application_type_values, "none", EXTRACT_8BITS((tptr + 4))), + tok2str(lldp_tia_application_type_values, "none", EXTRACT_U_1((tptr + 4))), *(tptr + 4))); ND_PRINT((ndo, ", Flags [%s]", bittok2str( - lldp_tia_network_policy_bits_values, "none", EXTRACT_8BITS((tptr + 5))))); + lldp_tia_network_policy_bits_values, "none", EXTRACT_U_1((tptr + 5))))); ND_PRINT((ndo, "\n\t Vlan id %u", - LLDP_EXTRACT_NETWORK_POLICY_VLAN(EXTRACT_BE_16BITS(tptr + 5)))); + LLDP_EXTRACT_NETWORK_POLICY_VLAN(EXTRACT_BE_U_2(tptr + 5)))); ND_PRINT((ndo, ", L2 priority %u", - LLDP_EXTRACT_NETWORK_POLICY_L2_PRIORITY(EXTRACT_BE_16BITS(tptr + 6)))); + LLDP_EXTRACT_NETWORK_POLICY_L2_PRIORITY(EXTRACT_BE_U_2(tptr + 6)))); ND_PRINT((ndo, ", DSCP value %u", - LLDP_EXTRACT_NETWORK_POLICY_DSCP(EXTRACT_BE_16BITS(tptr + 6)))); + LLDP_EXTRACT_NETWORK_POLICY_DSCP(EXTRACT_BE_U_2(tptr + 6)))); break; case LLDP_PRIVATE_TIA_SUBTYPE_LOCAL_ID: if (tlv_len < 5) { return hexdump; } - location_format = EXTRACT_8BITS(tptr + 4); + location_format = EXTRACT_U_1(tptr + 4); ND_PRINT((ndo, "\n\t Location data format %s (0x%02x)", tok2str(lldp_tia_location_data_format_values, "unknown", location_format), location_format)); @@ -1031,13 +1031,13 @@ lldp_private_tia_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Longitude resolution %u, longitude value %" PRIu64, (*(tptr + 10) >> 2), lldp_extract_latlon(tptr + 10))); ND_PRINT((ndo, "\n\t Altitude type %s (%u)", - tok2str(lldp_tia_location_altitude_type_values, "unknown",EXTRACT_8BITS((tptr + 15)) >> 4), + tok2str(lldp_tia_location_altitude_type_values, "unknown",EXTRACT_U_1((tptr + 15)) >> 4), (*(tptr + 15) >> 4))); ND_PRINT((ndo, "\n\t Altitude resolution %u, altitude value 0x%x", - (EXTRACT_BE_16BITS(tptr + 15)>>6)&0x3f, - ((EXTRACT_BE_32BITS(tptr + 16) & 0x3fffffff)))); + (EXTRACT_BE_U_2(tptr + 15)>>6)&0x3f, + ((EXTRACT_BE_U_4(tptr + 16) & 0x3fffffff)))); ND_PRINT((ndo, "\n\t Datum %s (0x%02x)", - tok2str(lldp_tia_location_datum_type_values, "unknown", EXTRACT_8BITS((tptr + 20))), + tok2str(lldp_tia_location_datum_type_values, "unknown", EXTRACT_U_1((tptr + 20))), *(tptr + 20))); break; @@ -1045,7 +1045,7 @@ lldp_private_tia_print(netdissect_options *ndo, if (tlv_len < 6) { return hexdump; } - lci_len = EXTRACT_8BITS(tptr + 5); + lci_len = EXTRACT_U_1(tptr + 5); if (lci_len < 3) { return hexdump; } @@ -1054,7 +1054,7 @@ lldp_private_tia_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t LCI length %u, LCI what %s (0x%02x), Country-code ", lci_len, - tok2str(lldp_tia_location_lci_what_values, "unknown", EXTRACT_8BITS((tptr + 6))), + tok2str(lldp_tia_location_lci_what_values, "unknown", EXTRACT_U_1((tptr + 6))), *(tptr + 6))); /* Country code */ @@ -1069,7 +1069,7 @@ lldp_private_tia_print(netdissect_options *ndo, return hexdump; } ca_type = *(tptr); - ca_len = EXTRACT_8BITS(tptr + 1); + ca_len = EXTRACT_U_1(tptr + 1); tptr += 2; lci_len -= 2; @@ -1110,11 +1110,11 @@ lldp_private_tia_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Power type [%s]", (*(tptr + 4) & 0xC0 >> 6) ? "PD device" : "PSE device")); ND_PRINT((ndo, ", Power source [%s]", - tok2str(lldp_tia_power_source_values, "none", (EXTRACT_8BITS((tptr + 4)) & 0x30) >> 4))); + tok2str(lldp_tia_power_source_values, "none", (EXTRACT_U_1((tptr + 4)) & 0x30) >> 4))); ND_PRINT((ndo, "\n\t Power priority [%s] (0x%02x)", - tok2str(lldp_tia_power_priority_values, "none", EXTRACT_8BITS((tptr + 4)) & 0x0f), + tok2str(lldp_tia_power_priority_values, "none", EXTRACT_U_1((tptr + 4)) & 0x0f), *(tptr + 4) & 0x0f)); - power_val = EXTRACT_BE_16BITS(tptr + 5); + power_val = EXTRACT_BE_U_2(tptr + 5); if (power_val < LLDP_TIA_POWER_VAL_MAX) { ND_PRINT((ndo, ", Power %.1f Watts", ((float)power_val) / 10)); } else { @@ -1159,7 +1159,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, if (len < 4) { return hexdump; } - subtype = EXTRACT_8BITS(pptr + 3); + subtype = EXTRACT_U_1(pptr + 3); ND_PRINT((ndo, "\n\t %s Subtype (%u)", tok2str(lldp_dcbx_subtype_values, "unknown", subtype), @@ -1176,7 +1176,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, ND_TCHECK2(*tptr, sizeof(tlv)); - tlv = EXTRACT_BE_16BITS(tptr); + tlv = EXTRACT_BE_U_2(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_BE_32BITS(tptr + 2))); + ND_PRINT((ndo, "\n\t Sequence Number: %d", EXTRACT_BE_U_4(tptr + 2))); ND_PRINT((ndo, "\n\t Acknowledgement Number: %d", - EXTRACT_BE_32BITS(tptr + 6))); + EXTRACT_BE_U_4(tptr + 6))); break; case LLDP_DCBX_PRIORITY_GROUPS_TLV: if (tlv_len < 17) { @@ -1218,7 +1218,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr)); ND_PRINT((ndo, "\n\t Max_Version: %d", *(tptr + 1))); ND_PRINT((ndo, "\n\t Info block(0x%02X): ", *(tptr + 2))); - tval = EXTRACT_8BITS(tptr + 2); + tval = EXTRACT_U_1(tptr + 2); ND_PRINT((ndo, "Enable bit: %d, Willing bit: %d, Error Bit: %d", (tval & 0x80) ? 1 : 0, (tval & 0x40) ? 1 : 0, (tval & 0x20) ? 1 : 0)); @@ -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_BE_32BITS(tptr + 4); + pgval = EXTRACT_BE_U_4(tptr + 4); for (i = 0; i <= 7; i++) { ND_PRINT((ndo, "\n\t PgId_%d: %d", i, (pgval >> (28 - 4 * i)) & 0xF)); @@ -1249,12 +1249,12 @@ lldp_private_dcbx_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr)); ND_PRINT((ndo, "\n\t Max_Version: %d", *(tptr + 1))); ND_PRINT((ndo, "\n\t Info block(0x%02X): ", *(tptr + 2))); - tval = EXTRACT_8BITS(tptr + 2); + tval = EXTRACT_U_1(tptr + 2); ND_PRINT((ndo, "Enable bit: %d, Willing bit: %d, Error Bit: %d", (tval & 0x80) ? 1 : 0, (tval & 0x40) ? 1 : 0, (tval & 0x20) ? 1 : 0)); ND_PRINT((ndo, "\n\t SubType: %d", *(tptr + 3))); - tval = EXTRACT_8BITS(tptr + 4); + tval = EXTRACT_U_1(tptr + 4); ND_PRINT((ndo, "\n\t PFC Config (0x%02X)", *(tptr + 4))); for (i = 0; i <= 7; i++) ND_PRINT((ndo, "\n\t Priority Bit %d: %s", @@ -1270,7 +1270,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr)); ND_PRINT((ndo, "\n\t Max_Version: %d", *(tptr + 1))); ND_PRINT((ndo, "\n\t Info block(0x%02X): ", *(tptr + 2))); - tval = EXTRACT_8BITS(tptr + 2); + tval = EXTRACT_U_1(tptr + 2); ND_PRINT((ndo, "Enable bit: %d, Willing bit: %d, Error Bit: %d", (tval & 0x80) ? 1 : 0, (tval & 0x40) ? 1 : 0, (tval & 0x20) ? 1 : 0)); @@ -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_BE_16BITS(mptr))); - uval = EXTRACT_BE_24BITS(mptr + 2); + EXTRACT_BE_U_2(mptr))); + uval = EXTRACT_BE_U_3(mptr + 2); ND_PRINT((ndo, "\n\t SF (0x%x) Application Protocol ID is %s", (uval >> 22), (uval >> 22) ? "Socket Number" : "L2 EtherType")); @@ -1369,7 +1369,7 @@ lldp_mgmt_addr_tlv_print(netdissect_options *ndo, if (tlen < 1) { return 0; } - mgmt_addr_len = EXTRACT_8BITS(tptr); + mgmt_addr_len = EXTRACT_U_1(tptr); tptr++; tlen--; @@ -1394,7 +1394,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_BE_32BITS(tptr + 1))); + EXTRACT_BE_U_4(tptr + 1))); tptr += LLDP_INTF_NUM_LEN; tlen -= LLDP_INTF_NUM_LEN; @@ -1436,7 +1436,7 @@ lldp_print(netdissect_options *ndo, ND_TCHECK2(*tptr, sizeof(tlv)); - tlv = EXTRACT_BE_16BITS(tptr); + tlv = EXTRACT_BE_U_2(tptr); tlv_type = LLDP_EXTRACT_TYPE(tlv); tlv_len = LLDP_EXTRACT_LEN(tlv); @@ -1550,7 +1550,7 @@ lldp_print(netdissect_options *ndo, if (tlv_len < 2) { goto trunc; } - ND_PRINT((ndo, ": TTL %us", EXTRACT_BE_16BITS(tptr))); + ND_PRINT((ndo, ": TTL %us", EXTRACT_BE_U_2(tptr))); } break; @@ -1588,8 +1588,8 @@ lldp_print(netdissect_options *ndo, if (tlv_len < 4) { goto trunc; } - cap = EXTRACT_BE_16BITS(tptr); - ena_cap = EXTRACT_BE_16BITS(tptr + 2); + cap = EXTRACT_BE_U_2(tptr); + ena_cap = EXTRACT_BE_U_2(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)", @@ -1610,7 +1610,7 @@ lldp_print(netdissect_options *ndo, if (tlv_len < 3) { goto trunc; } - oui = EXTRACT_BE_24BITS(tptr); + oui = EXTRACT_BE_U_3(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 999c830f..97db2f47 100644 --- a/print-lmp.c +++ b/print-lmp.c @@ -367,8 +367,8 @@ lmp_print_data_link_subobjs(netdissect_options *ndo, const u_char *obj_tptr, } bw; while (total_subobj_len > 0 && hexdump == FALSE ) { - subobj_type = EXTRACT_8BITS(obj_tptr + offset); - subobj_len = EXTRACT_8BITS(obj_tptr + offset + 1); + subobj_type = EXTRACT_U_1(obj_tptr + offset); + subobj_len = EXTRACT_U_1(obj_tptr + offset + 1); ND_PRINT((ndo, "\n\t Subobject, Type: %s (%u), Length: %u", tok2str(lmp_data_link_subobj, "Unknown", @@ -392,23 +392,23 @@ lmp_print_data_link_subobjs(netdissect_options *ndo, const u_char *obj_tptr, ND_PRINT((ndo, "\n\t Switching Type: %s (%u)", tok2str(gmpls_switch_cap_values, "Unknown", - EXTRACT_8BITS(obj_tptr + offset + 2)), - EXTRACT_8BITS(obj_tptr + offset + 2))); + EXTRACT_U_1(obj_tptr + offset + 2)), + EXTRACT_U_1(obj_tptr + offset + 2))); ND_PRINT((ndo, "\n\t Encoding Type: %s (%u)", tok2str(gmpls_encoding_values, "Unknown", - EXTRACT_8BITS(obj_tptr + offset + 3)), - EXTRACT_8BITS(obj_tptr + offset + 3))); - bw.i = EXTRACT_BE_32BITS(obj_tptr + offset + 4); + EXTRACT_U_1(obj_tptr + offset + 3)), + EXTRACT_U_1(obj_tptr + offset + 3))); + bw.i = EXTRACT_BE_U_4(obj_tptr + offset + 4); ND_PRINT((ndo, "\n\t Min Reservable Bandwidth: %.3f Mbps", bw.f*8/1000000)); - bw.i = EXTRACT_BE_32BITS(obj_tptr + offset + 8); + bw.i = EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr + offset + 4))); + EXTRACT_BE_U_4(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_BE_16BITS(lmp_com_header->length); + tlen=EXTRACT_BE_U_2(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_BE_16BITS(lmp_obj_header->length); + lmp_obj_len=EXTRACT_BE_U_2(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_BE_32BITS(obj_tptr), - EXTRACT_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(obj_tptr), + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr), - EXTRACT_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(obj_tptr), + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr), - EXTRACT_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(obj_tptr), + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr), - EXTRACT_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(obj_tptr), + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(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_BE_16BITS(obj_tptr), - EXTRACT_BE_16BITS(obj_tptr + 2))); + EXTRACT_BE_U_2(obj_tptr), + EXTRACT_BE_U_2(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_BE_32BITS(obj_tptr), - EXTRACT_BE_32BITS(obj_tptr + 4))); + EXTRACT_BE_U_4(obj_tptr), + EXTRACT_BE_U_4(obj_tptr + 4))); break; default: @@ -662,14 +662,14 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: [%s]", bittok2str(lmp_obj_te_link_flag_values, "none", - EXTRACT_8BITS(obj_tptr)))); + EXTRACT_U_1(obj_tptr)))); 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_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 4), ipaddr_string(ndo, obj_tptr+8), - EXTRACT_BE_32BITS(obj_tptr + 8))); + EXTRACT_BE_U_4(obj_tptr + 8))); break; case LMP_CTYPE_IPV6: @@ -680,14 +680,14 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: [%s]", bittok2str(lmp_obj_te_link_flag_values, "none", - EXTRACT_8BITS(obj_tptr)))); + EXTRACT_U_1(obj_tptr)))); 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_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 4), ip6addr_string(ndo, obj_tptr+20), - EXTRACT_BE_32BITS(obj_tptr + 20))); + EXTRACT_BE_U_4(obj_tptr + 20))); break; case LMP_CTYPE_UNMD: @@ -698,14 +698,14 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: [%s]", bittok2str(lmp_obj_te_link_flag_values, "none", - EXTRACT_8BITS(obj_tptr)))); + EXTRACT_U_1(obj_tptr)))); ND_PRINT((ndo, "\n\t Local Link-ID: %u (0x%08x)" "\n\t Remote Link-ID: %u (0x%08x)", - EXTRACT_BE_32BITS(obj_tptr + 4), - EXTRACT_BE_32BITS(obj_tptr + 4), - EXTRACT_BE_32BITS(obj_tptr + 8), - EXTRACT_BE_32BITS(obj_tptr + 8))); + EXTRACT_BE_U_4(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 8), + EXTRACT_BE_U_4(obj_tptr + 8))); break; default: @@ -723,13 +723,13 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: [%s]", bittok2str(lmp_obj_data_link_flag_values, "none", - EXTRACT_8BITS(obj_tptr)))); + EXTRACT_U_1(obj_tptr)))); 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_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 4), ipaddr_string(ndo, obj_tptr+8), - EXTRACT_BE_32BITS(obj_tptr + 8))); + EXTRACT_BE_U_4(obj_tptr + 8))); if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12)) hexdump=TRUE; @@ -743,13 +743,13 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: [%s]", bittok2str(lmp_obj_data_link_flag_values, "none", - EXTRACT_8BITS(obj_tptr)))); + EXTRACT_U_1(obj_tptr)))); 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_BE_32BITS(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 4), ip6addr_string(ndo, obj_tptr+20), - EXTRACT_BE_32BITS(obj_tptr + 20))); + EXTRACT_BE_U_4(obj_tptr + 20))); if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 36, 36)) hexdump=TRUE; @@ -763,13 +763,13 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: [%s]", bittok2str(lmp_obj_data_link_flag_values, "none", - EXTRACT_8BITS(obj_tptr)))); + EXTRACT_U_1(obj_tptr)))); ND_PRINT((ndo, "\n\t Local Interface ID: %u (0x%08x)" "\n\t Remote Interface ID: %u (0x%08x)", - EXTRACT_BE_32BITS(obj_tptr + 4), - EXTRACT_BE_32BITS(obj_tptr + 4), - EXTRACT_BE_32BITS(obj_tptr + 8), - EXTRACT_BE_32BITS(obj_tptr + 8))); + EXTRACT_BE_U_4(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 8), + EXTRACT_BE_U_4(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_BE_16BITS(obj_tptr)))); + EXTRACT_BE_U_2(obj_tptr)))); ND_PRINT((ndo, "\n\t Verify Interval: %u", - EXTRACT_BE_16BITS(obj_tptr + 2))); + EXTRACT_BE_U_2(obj_tptr + 2))); ND_PRINT((ndo, "\n\t Data links: %u", - EXTRACT_BE_32BITS(obj_tptr + 4))); + EXTRACT_BE_U_4(obj_tptr + 4))); ND_PRINT((ndo, "\n\t Encoding type: %s", - tok2str(gmpls_encoding_values, "Unknown", EXTRACT_8BITS((obj_tptr + 8))))); + tok2str(gmpls_encoding_values, "Unknown", EXTRACT_U_1((obj_tptr + 8))))); ND_PRINT((ndo, "\n\t Verify Transport Mechanism: %u (0x%x)%s", - 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); + EXTRACT_BE_U_2(obj_tptr + 10), + EXTRACT_BE_U_2(obj_tptr + 10), + EXTRACT_BE_U_2(obj_tptr + 10)&8000 ? " (Payload test messages capable)" : "")); + bw.i = EXTRACT_BE_U_4(obj_tptr + 12); ND_PRINT((ndo, "\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000)); ND_PRINT((ndo, "\n\t Wavelength: %u", - EXTRACT_BE_32BITS(obj_tptr + 16))); + EXTRACT_BE_U_4(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_BE_16BITS(obj_tptr), - EXTRACT_BE_16BITS(obj_tptr + 2))); + EXTRACT_BE_U_2(obj_tptr), + EXTRACT_BE_U_2(obj_tptr + 2))); break; default: @@ -838,7 +838,7 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT((ndo, "\n\t Verify ID: %u", - EXTRACT_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr + offset))); + EXTRACT_BE_U_4(obj_tptr + offset))); ND_PRINT((ndo, "\n\t\t Active: %s (%u)", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31) ? + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31) ? "Allocated" : "Non-allocated", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31))); + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31))); ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1 ? + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ? "Transmit" : "Receive", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1)); + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1)); ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)", tok2str(lmp_obj_channel_status_values, "Unknown", - EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF), - EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF)); + EXTRACT_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF), + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr + offset))); + EXTRACT_BE_U_4(obj_tptr + offset))); ND_PRINT((ndo, "\n\t\t Active: %s (%u)", - (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>31) ? + (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>31) ? "Allocated" : "Non-allocated", - (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>31))); + (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>31))); ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", - (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>30)&0x1 ? + (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>30)&0x1 ? "Transmit" : "Receive", - (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>30)&0x1)); + (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>30)&0x1)); ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)", tok2str(lmp_obj_channel_status_values, "Unknown", - EXTRACT_BE_32BITS(obj_tptr + offset + 16)&0x3FFFFFF), - EXTRACT_BE_32BITS(obj_tptr + offset + 16)&0x3FFFFFF)); + EXTRACT_BE_U_4(obj_tptr + offset + 16)&0x3FFFFFF), + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr + offset), - EXTRACT_BE_32BITS(obj_tptr + offset))); + EXTRACT_BE_U_4(obj_tptr + offset), + EXTRACT_BE_U_4(obj_tptr + offset))); ND_PRINT((ndo, "\n\t\t Active: %s (%u)", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31) ? + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31) ? "Allocated" : "Non-allocated", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31))); + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31))); ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1 ? + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ? "Transmit" : "Receive", - (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1)); + (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1)); ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)", tok2str(lmp_obj_channel_status_values, "Unknown", - EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF), - EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF)); + EXTRACT_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF), + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr + offset))); + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr + offset))); + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr + offset), - EXTRACT_BE_32BITS(obj_tptr + offset))); + EXTRACT_BE_U_4(obj_tptr + offset), + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr)))); + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr)))); + EXTRACT_BE_U_4(obj_tptr)))); break; default: hexdump=TRUE; @@ -1009,10 +1009,10 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Flags: %s", bittok2str(lmp_obj_service_config_sp_flag_values, "none", - EXTRACT_8BITS(obj_tptr)))); + EXTRACT_U_1(obj_tptr)))); ND_PRINT((ndo, "\n\t UNI Version: %u", - EXTRACT_8BITS(obj_tptr + 1))); + EXTRACT_U_1(obj_tptr + 1))); break; @@ -1022,7 +1022,7 @@ lmp_print(netdissect_options *ndo, break; } - link_type = EXTRACT_8BITS(obj_tptr); + link_type = EXTRACT_U_1(obj_tptr); ND_PRINT((ndo, "\n\t Link Type: %s (%u)", tok2str(lmp_sd_service_config_cpsa_link_type_values, @@ -1034,44 +1034,44 @@ lmp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Signal Type: %s (%u)", tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values, "Unknown", - EXTRACT_8BITS(obj_tptr + 1)), - EXTRACT_8BITS(obj_tptr + 1))); + EXTRACT_U_1(obj_tptr + 1)), + EXTRACT_U_1(obj_tptr + 1))); break; case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET: ND_PRINT((ndo, "\n\t Signal Type: %s (%u)", tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values, "Unknown", - EXTRACT_8BITS(obj_tptr + 1)), - EXTRACT_8BITS(obj_tptr + 1))); + EXTRACT_U_1(obj_tptr + 1)), + EXTRACT_U_1(obj_tptr + 1))); break; } ND_PRINT((ndo, "\n\t Transparency: %s", bittok2str(lmp_obj_service_config_cpsa_tp_flag_values, "none", - EXTRACT_8BITS(obj_tptr + 2)))); + EXTRACT_U_1(obj_tptr + 2)))); ND_PRINT((ndo, "\n\t Contiguous Concatenation Types: %s", bittok2str(lmp_obj_service_config_cpsa_cct_flag_values, "none", - EXTRACT_8BITS(obj_tptr + 3)))); + EXTRACT_U_1(obj_tptr + 3)))); ND_PRINT((ndo, "\n\t Minimum NCC: %u", - EXTRACT_BE_16BITS(obj_tptr + 4))); + EXTRACT_BE_U_2(obj_tptr + 4))); ND_PRINT((ndo, "\n\t Maximum NCC: %u", - EXTRACT_BE_16BITS(obj_tptr + 6))); + EXTRACT_BE_U_2(obj_tptr + 6))); ND_PRINT((ndo, "\n\t Minimum NVC:%u", - EXTRACT_BE_16BITS(obj_tptr + 8))); + EXTRACT_BE_U_2(obj_tptr + 8))); ND_PRINT((ndo, "\n\t Maximum NVC:%u", - EXTRACT_BE_16BITS(obj_tptr + 10))); + EXTRACT_BE_U_2(obj_tptr + 10))); ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+12), - EXTRACT_BE_32BITS(obj_tptr + 12))); + EXTRACT_BE_U_4(obj_tptr + 12))); break; @@ -1085,13 +1085,13 @@ lmp_print(netdissect_options *ndo, bittok2str( lmp_obj_service_config_nsa_transparency_flag_values, "none", - EXTRACT_BE_32BITS(obj_tptr)))); + EXTRACT_BE_U_4(obj_tptr)))); ND_PRINT((ndo, "\n\t TCM Monitoring Flags: %s", bittok2str( lmp_obj_service_config_nsa_tcm_flag_values, "none", - EXTRACT_8BITS(obj_tptr + 7)))); + EXTRACT_U_1(obj_tptr + 7)))); break; @@ -1105,7 +1105,7 @@ lmp_print(netdissect_options *ndo, bittok2str( lmp_obj_service_config_nsa_network_diversity_flag_values, "none", - EXTRACT_8BITS(obj_tptr + 3)))); + EXTRACT_U_1(obj_tptr + 3)))); break; default: diff --git a/print-loopback.c b/print-loopback.c index 10f69310..ac7b1779 100644 --- a/print-loopback.c +++ b/print-loopback.c @@ -64,7 +64,7 @@ loopback_message_print(netdissect_options *ndo, const u_char *cp, const u_int le goto invalid; /* function */ ND_TCHECK2(*cp, 2); - function = EXTRACT_LE_16BITS(cp); + function = EXTRACT_LE_U_2(cp); cp += 2; ND_PRINT((ndo, ", %s", tok2str(fcode_str, " invalid (%u)", function))); @@ -74,7 +74,7 @@ loopback_message_print(netdissect_options *ndo, const u_char *cp, const u_int le goto invalid; /* receipt number */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", receipt number %u", EXTRACT_LE_16BITS(cp))); + ND_PRINT((ndo, ", receipt number %u", EXTRACT_LE_U_2(cp))); cp += 2; /* data */ ND_PRINT((ndo, ", data (%u octets)", len - 4)); @@ -116,7 +116,7 @@ loopback_print(netdissect_options *ndo, const u_char *cp, const u_int len) goto invalid; /* skipCount */ ND_TCHECK2(*cp, 2); - skipCount = EXTRACT_LE_16BITS(cp); + skipCount = EXTRACT_LE_U_2(cp); cp += 2; ND_PRINT((ndo, ", skipCount %u", skipCount)); if (skipCount % 8) diff --git a/print-lspping.c b/print-lspping.c index d4f09124..89edc1dd 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_BE_16BITS(&lspping_com_header->version[0]) != LSPPING_VERSION) { + if (EXTRACT_BE_U_2(&lspping_com_header->version[0]) != LSPPING_VERSION) { ND_PRINT((ndo, "LSP-PING version %u packet not supported", - EXTRACT_BE_16BITS(&lspping_com_header->version[0]))); + EXTRACT_BE_U_2(&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_BE_16BITS(&lspping_com_header->version[0]), + EXTRACT_BE_U_2(&lspping_com_header->version[0]), tok2str(lspping_msg_type_values, "unknown (%u)",lspping_com_header->msg_type), - EXTRACT_BE_32BITS(lspping_com_header->seq_number), + EXTRACT_BE_U_4(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_BE_16BITS(&lspping_com_header->version[0]), + EXTRACT_BE_U_2(&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_BE_32BITS(lspping_com_header->sender_handle), - EXTRACT_BE_32BITS(lspping_com_header->seq_number))); + EXTRACT_BE_U_4(lspping_com_header->sender_handle), + EXTRACT_BE_U_4(lspping_com_header->seq_number))); - timestamp.tv_sec=EXTRACT_BE_32BITS(lspping_com_header->ts_sent_sec); - timestamp.tv_usec=EXTRACT_BE_32BITS(lspping_com_header->ts_sent_usec); + timestamp.tv_sec=EXTRACT_BE_U_4(lspping_com_header->ts_sent_sec); + timestamp.tv_usec=EXTRACT_BE_U_4(lspping_com_header->ts_sent_usec); ND_PRINT((ndo, "\n\t Sender Timestamp: ")); ts_print(ndo, ×tamp); - timestamp.tv_sec=EXTRACT_BE_32BITS(lspping_com_header->ts_rcvd_sec); - timestamp.tv_usec=EXTRACT_BE_32BITS(lspping_com_header->ts_rcvd_usec); + timestamp.tv_sec=EXTRACT_BE_U_4(lspping_com_header->ts_rcvd_sec); + timestamp.tv_usec=EXTRACT_BE_U_4(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_BE_16BITS(lspping_tlv_header->type); - lspping_tlv_len=EXTRACT_BE_16BITS(lspping_tlv_header->length); + lspping_tlv_type=EXTRACT_BE_U_2(lspping_tlv_header->type); + lspping_tlv_len=EXTRACT_BE_U_2(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_BE_16BITS(lspping_subtlv_header->type); - lspping_subtlv_len=EXTRACT_BE_16BITS(lspping_subtlv_header->length); + lspping_subtlv_type=EXTRACT_BE_U_2(lspping_subtlv_header->type); + lspping_subtlv_len=EXTRACT_BE_U_2(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_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), + EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->lsp_id), + EXTRACT_BE_U_2(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_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), + EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->lsp_id), + EXTRACT_BE_U_2(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_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), + EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->sender_ve_id), + EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->receiver_ve_id), tok2str(mpls_pw_types_values, "unknown", - EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)), - EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation))); + EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)), + EXTRACT_BE_U_2(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_BE_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_id), + EXTRACT_BE_U_4(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_id), tok2str(mpls_pw_types_values, "unknown", - 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))); + EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type)), + EXTRACT_BE_U_2(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_BE_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_id), + EXTRACT_BE_U_4(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_id), tok2str(mpls_pw_types_values, "unknown", - 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))); + EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type)), + EXTRACT_BE_U_2(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_BE_16BITS(tlv_ptr.lspping_tlv_downstream_map->mtu), + EXTRACT_BE_U_2(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_BE_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4_unmb->downstream_interface))); + EXTRACT_BE_U_4(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_BE_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv6_unmb->downstream_interface))); + EXTRACT_BE_U_4(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_BE_32BITS(tptr))); + ND_PRINT((ndo, "\n\t BFD Discriminator 0x%08x", EXTRACT_BE_U_4(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_BE_32BITS(tlv_tptr); + vendor_id = EXTRACT_BE_U_4(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 e4a01c81..78dbafe5 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_BE_16BITS(lwapp_trans_header->length); + tlen=EXTRACT_BE_U_2(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_BE_16BITS(lwapp_control_header->len); + msg_tlen = EXTRACT_BE_U_2(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_BE_32BITS(lwapp_control_header->session_id))); + EXTRACT_BE_U_4(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_BE_16BITS(lwapp_trans_header->length); + tlen=EXTRACT_BE_U_2(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 2510ae81..ccd0302a 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_BE_16BITS(p); + l = EXTRACT_BE_U_2(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_BE_16BITS(p); + l = EXTRACT_BE_U_2(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_BE_16BITS(&ap->length); + l = EXTRACT_BE_U_2(&ap->length); /* XXX ap points to packed struct */ p = (const char *)&ap->length + sizeof(ap->length); ND_TCHECK2(*p, l); - switch (EXTRACT_BE_32BITS(&ap->family)) { + switch (EXTRACT_BE_U_4(&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_BE_32BITS(&ap->family))); + ND_PRINT((ndo, " %u/", EXTRACT_BE_U_4(&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_BE_16BITS(&np->version); + v = EXTRACT_BE_U_2(&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_BE_32BITS(&np->length); + s = (const char *)np + EXTRACT_BE_U_4(&np->length); goto tail; } - response = EXTRACT_BE_16BITS(&np->pktflags) & LWRES_LWPACKETFLAG_RESPONSE; + response = EXTRACT_BE_U_2(&np->pktflags) & LWRES_LWPACKETFLAG_RESPONSE; /* opcode and pktflags */ - v = EXTRACT_BE_32BITS(&np->opcode); + v = EXTRACT_BE_U_4(&np->opcode); s = tok2str(opcode, "#0x%x", v); ND_PRINT((ndo, " %s%s", s, response ? "" : "?")); /* pktflags */ - v = EXTRACT_BE_16BITS(&np->pktflags); + v = EXTRACT_BE_U_2(&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_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))); + ND_PRINT((ndo, "serial:0x%x", EXTRACT_BE_U_4(&np->serial))); + ND_PRINT((ndo, " result:0x%x", EXTRACT_BE_U_4(&np->result))); + ND_PRINT((ndo, " recvlen:%u", EXTRACT_BE_U_4(&np->recvlength))); /* BIND910: not used */ if (ndo->ndo_vflag > 2) { - ND_PRINT((ndo, " authtype:0x%x", EXTRACT_BE_16BITS(&np->authtype))); - ND_PRINT((ndo, " authlen:%u", EXTRACT_BE_16BITS(&np->authlength))); + ND_PRINT((ndo, " authtype:0x%x", EXTRACT_BE_U_2(&np->authtype))); + ND_PRINT((ndo, " authlen:%u", EXTRACT_BE_U_2(&np->authlength))); } /*(*/ ND_PRINT((ndo, ")")); @@ -351,7 +351,7 @@ lwres_print(netdissect_options *ndo, gnba = NULL; grbn = NULL; - switch (EXTRACT_BE_32BITS(&np->opcode)) { + switch (EXTRACT_BE_U_4(&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_BE_16BITS(&gabn->namelen); + l = EXTRACT_BE_U_2(&gabn->namelen); /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT((ndo, " flags:0x%x", - EXTRACT_BE_32BITS(&gabn->flags))); + EXTRACT_BE_U_4(&gabn->flags))); } - v = EXTRACT_BE_32BITS(&gabn->addrtypes); + v = EXTRACT_BE_U_4(&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_BE_32BITS(&gnba->flags))); + EXTRACT_BE_U_4(&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_BE_32BITS(&grbn->flags))); + EXTRACT_BE_U_4(&grbn->flags))); } ND_PRINT((ndo, " %s", tok2str(ns_type2str, "Type%d", - EXTRACT_BE_16BITS(&grbn->rdtype)))); - if (EXTRACT_BE_16BITS(&grbn->rdclass) != C_IN) { + EXTRACT_BE_U_2(&grbn->rdtype)))); + if (EXTRACT_BE_U_2(&grbn->rdclass) != C_IN) { ND_PRINT((ndo, " %s", tok2str(ns_class2str, "Class%d", - EXTRACT_BE_16BITS(&grbn->rdclass)))); + EXTRACT_BE_U_2(&grbn->rdclass)))); } /* XXX grbn points to packed struct */ s = (const char *)&grbn->namelen + sizeof(grbn->namelen); - l = EXTRACT_BE_16BITS(&grbn->namelen); + l = EXTRACT_BE_U_2(&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_BE_32BITS(&np->opcode)) { + switch (EXTRACT_BE_U_4(&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_BE_16BITS(&gabn->realnamelen); + l = EXTRACT_BE_U_2(&gabn->realnamelen); /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT((ndo, " flags:0x%x", - EXTRACT_BE_32BITS(&gabn->flags))); + EXTRACT_BE_U_4(&gabn->flags))); } - ND_PRINT((ndo, " %u/%u", EXTRACT_BE_16BITS(&gabn->naliases), - EXTRACT_BE_16BITS(&gabn->naddrs))); + ND_PRINT((ndo, " %u/%u", EXTRACT_BE_U_2(&gabn->naliases), + EXTRACT_BE_U_2(&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_BE_16BITS(&gabn->naliases); + na = EXTRACT_BE_U_2(&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_BE_16BITS(&gabn->naddrs); + na = EXTRACT_BE_U_2(&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_BE_16BITS(&gnba->realnamelen); + l = EXTRACT_BE_U_2(&gnba->realnamelen); /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT((ndo, " flags:0x%x", - EXTRACT_BE_32BITS(&gnba->flags))); + EXTRACT_BE_U_4(&gnba->flags))); } - ND_PRINT((ndo, " %u", EXTRACT_BE_16BITS(&gnba->naliases))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_2(&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_BE_16BITS(&gnba->naliases); + na = EXTRACT_BE_U_2(&gnba->naliases); for (i = 0; i < na; i++) { advance = lwres_printnamelen(ndo, s); if (advance < 0) @@ -532,20 +532,20 @@ lwres_print(netdissect_options *ndo, /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT((ndo, " flags:0x%x", - EXTRACT_BE_32BITS(&grbn->flags))); + EXTRACT_BE_U_4(&grbn->flags))); } ND_PRINT((ndo, " %s", tok2str(ns_type2str, "Type%d", - EXTRACT_BE_16BITS(&grbn->rdtype)))); - if (EXTRACT_BE_16BITS(&grbn->rdclass) != C_IN) { + EXTRACT_BE_U_2(&grbn->rdtype)))); + if (EXTRACT_BE_U_2(&grbn->rdclass) != C_IN) { ND_PRINT((ndo, " %s", tok2str(ns_class2str, "Class%d", - EXTRACT_BE_16BITS(&grbn->rdclass)))); + EXTRACT_BE_U_2(&grbn->rdclass)))); } ND_PRINT((ndo, " TTL ")); unsigned_relts_print(ndo, - EXTRACT_BE_32BITS(&grbn->ttl)); - ND_PRINT((ndo, " %u/%u", EXTRACT_BE_16BITS(&grbn->nrdatas), - EXTRACT_BE_16BITS(&grbn->nsigs))); + EXTRACT_BE_U_4(&grbn->ttl)); + ND_PRINT((ndo, " %u/%u", EXTRACT_BE_U_2(&grbn->nrdatas), + EXTRACT_BE_U_2(&grbn->nsigs))); /* XXX grbn points to packed struct */ s = (const char *)&grbn->nsigs+ sizeof(grbn->nsigs); @@ -556,7 +556,7 @@ lwres_print(netdissect_options *ndo, s += advance; /* rdatas */ - na = EXTRACT_BE_16BITS(&grbn->nrdatas); + na = EXTRACT_BE_U_2(&grbn->nrdatas); for (i = 0; i < na; i++) { /* XXX should decode resource data */ advance = lwres_printbinlen(ndo, s); @@ -566,7 +566,7 @@ lwres_print(netdissect_options *ndo, } /* sigs */ - na = EXTRACT_BE_16BITS(&grbn->nsigs); + na = EXTRACT_BE_U_2(&grbn->nsigs); for (i = 0; i < na; i++) { /* XXX how should we print it? */ advance = lwres_printbinlen(ndo, s); @@ -583,11 +583,11 @@ lwres_print(netdissect_options *ndo, tail: /* length mismatch */ - if (EXTRACT_BE_32BITS(&np->length) != length) { - ND_PRINT((ndo, " [len: %u != %u]", EXTRACT_BE_32BITS(&np->length), + if (EXTRACT_BE_U_4(&np->length) != length) { + ND_PRINT((ndo, " [len: %u != %u]", EXTRACT_BE_U_4(&np->length), length)); } - if (!unsupported && s < (const char *)np + EXTRACT_BE_32BITS(&np->length)) + if (!unsupported && s < (const char *)np + EXTRACT_BE_U_4(&np->length)) ND_PRINT((ndo, "[extra]")); return; diff --git a/print-m3ua.c b/print-m3ua.c index 54b218da..163b6450 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_BE_32BITS(buf))); + ND_PRINT((ndo, "0x%08x", EXTRACT_BE_U_4(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_BE_16BITS(p); + hdr_tag = EXTRACT_BE_U_2(p); ND_PRINT((ndo, "\n\t\t\t%s: ", tok2str(ParamName, "Unknown Parameter (0x%04x)", hdr_tag))); /* Parameter Length */ - hdr_len = EXTRACT_BE_16BITS(p + 2); + hdr_len = EXTRACT_BE_U_2(p + 2); if (hdr_len < sizeof(struct m3ua_param_header)) goto invalid; /* Parameter Value */ @@ -323,11 +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_BE_32BITS(&hdr->len)) - ND_PRINT((ndo, "\n\t\t\t@@@@@@ Corrupted length %u of message @@@@@@", EXTRACT_BE_32BITS(&hdr->len))); + if (size != EXTRACT_BE_U_4(&hdr->len)) + ND_PRINT((ndo, "\n\t\t\t@@@@@@ Corrupted length %u of message @@@@@@", EXTRACT_BE_U_4(&hdr->len))); else m3ua_tags_print(ndo, buf + sizeof(struct m3ua_common_header), - EXTRACT_BE_32BITS(&hdr->len) - sizeof(struct m3ua_common_header)); + EXTRACT_BE_U_4(&hdr->len) - sizeof(struct m3ua_common_header)); return; invalid: diff --git a/print-medsa.c b/print-medsa.c index c1e953b9..95e608f0 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_BE_16BITS(&medsa->ether_type); + ether_type = EXTRACT_BE_U_2(&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 93d7b02c..5f9f54fe 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_BE_16BITS(&mob->proto); - crc = EXTRACT_BE_16BITS(&mob->hcheck); + proto = EXTRACT_BE_U_2(&mob->proto); + crc = EXTRACT_BE_U_2(&mob->hcheck); if (proto & OSRC_PRES) { osp=1; } diff --git a/print-mobility.c b/print-mobility.c index 85a62195..8a352cba 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_2(&bp[i + 2]); ND_PRINT((ndo, "(refresh: %u)", - EXTRACT_BE_16BITS(bp + i + 2) << 2)); + EXTRACT_BE_U_2(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_2(&bp[i + 2]); ND_TCHECK_2(&bp[i + 4]); ND_PRINT((ndo, "(ni: ho=0x%04x co=0x%04x)", - EXTRACT_BE_16BITS(bp + i + 2), - EXTRACT_BE_16BITS(bp + i + 4))); + EXTRACT_BE_U_2(bp + i + 2), + EXTRACT_BE_U_2(bp + i + 4))); break; case IP6MOPT_AUTH: if (len - i < IP6MOPT_AUTH_MINLEN) { @@ -250,36 +250,36 @@ mobility_print(netdissect_options *ndo, ND_TCHECK_4(&bp[hlen + 4]); ND_PRINT((ndo, " %s Init Cookie=%08x:%08x", type == IP6M_HOME_TEST_INIT ? "Home" : "Care-of", - EXTRACT_BE_32BITS(bp + hlen), - EXTRACT_BE_32BITS(bp + hlen + 4))); + EXTRACT_BE_U_4(bp + hlen), + EXTRACT_BE_U_4(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_BE_16BITS(&mh->ip6m_data16[0]))); + ND_PRINT((ndo, " nonce id=0x%x", EXTRACT_BE_U_2(&mh->ip6m_data16[0]))); hlen = IP6M_MINLEN; if (ndo->ndo_vflag) { ND_TCHECK_4(&bp[hlen + 4]); ND_PRINT((ndo, " %s Init Cookie=%08x:%08x", type == IP6M_HOME_TEST ? "Home" : "Care-of", - EXTRACT_BE_32BITS(bp + hlen), - EXTRACT_BE_32BITS(bp + hlen + 4))); + EXTRACT_BE_U_4(bp + hlen), + EXTRACT_BE_U_4(bp + hlen + 4))); } hlen += 8; if (ndo->ndo_vflag) { ND_TCHECK_4(&bp[hlen + 4]); ND_PRINT((ndo, " %s Keygen Token=%08x:%08x", type == IP6M_HOME_TEST ? "Home" : "Care-of", - EXTRACT_BE_32BITS(bp + hlen), - EXTRACT_BE_32BITS(bp + hlen + 4))); + EXTRACT_BE_U_4(bp + hlen), + EXTRACT_BE_U_4(bp + hlen + 4))); } hlen += 8; break; case IP6M_BINDING_UPDATE: ND_TCHECK(mh->ip6m_data16[0]); - ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_16BITS(&mh->ip6m_data16[0]))); + ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_U_2(&mh->ip6m_data16[0]))); hlen = IP6M_MINLEN; ND_TCHECK_2(&bp[hlen]); if (bp[hlen] & 0xf0) { @@ -299,7 +299,7 @@ mobility_print(netdissect_options *ndo, hlen += 1; ND_TCHECK_2(&bp[hlen]); /* units of 4 secs */ - ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_16BITS(bp + hlen) << 2)); + ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_U_2(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_2(&bp[hlen]); - ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_16BITS(bp + hlen))); + ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_U_2(bp + hlen))); hlen += 2; ND_TCHECK_2(&bp[hlen]); /* units of 4 secs */ - ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_16BITS(bp + hlen) << 2)); + ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_U_2(bp + hlen) << 2)); hlen += 2; break; case IP6M_BINDING_ERROR: diff --git a/print-mpcp.c b/print-mpcp.c index d40d03da..4dc92bbc 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_BE_16BITS(mpcp.common_header->opcode); + opcode = EXTRACT_BE_U_2(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_BE_32BITS(mpcp.common_header->timestamp))); + ND_PRINT((ndo, ", Timestamp %u ticks", EXTRACT_BE_U_4(mpcp.common_header->timestamp))); } ND_PRINT((ndo, ", length %u", length)); @@ -159,12 +159,12 @@ mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int case MPCP_OPCODE_GATE: ND_TCHECK2(*tptr, MPCP_GRANT_NUMBER_LEN); - grant_numbers = EXTRACT_8BITS(tptr) & MPCP_GRANT_NUMBER_MASK; + grant_numbers = EXTRACT_U_1(tptr) & MPCP_GRANT_NUMBER_MASK; ND_PRINT((ndo, "\n\tGrant Numbers %u, Flags [ %s ]", grant_numbers, bittok2str(mpcp_grant_flag_values, "?", - EXTRACT_8BITS(tptr) & ~MPCP_GRANT_NUMBER_MASK))); + EXTRACT_U_1(tptr) & ~MPCP_GRANT_NUMBER_MASK))); tptr++; for (grant = 1; grant <= grant_numbers; grant++) { @@ -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_BE_32BITS(mpcp.grant->starttime), - EXTRACT_BE_16BITS(mpcp.grant->duration))); + EXTRACT_BE_U_4(mpcp.grant->starttime), + EXTRACT_BE_U_2(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_BE_16BITS(tptr))); + ND_PRINT((ndo, "\n\tSync-Time %u ticks", EXTRACT_BE_U_2(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_BE_16BITS(tptr))); + EXTRACT_BE_U_2(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_BE_16BITS(mpcp.reg->assigned_port), + EXTRACT_BE_U_2(mpcp.reg->assigned_port), bittok2str(mpcp_reg_flag_values, "Reserved", mpcp.reg->flags), - EXTRACT_BE_16BITS(mpcp.reg->sync_time), + EXTRACT_BE_U_2(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_BE_16BITS(mpcp.reg_ack->echoed_assigned_port), + EXTRACT_BE_U_2(mpcp.reg_ack->echoed_assigned_port), bittok2str(mpcp_reg_ack_flag_values, "Reserved", mpcp.reg_ack->flags), - EXTRACT_BE_16BITS(mpcp.reg_ack->echoed_sync_time))); + EXTRACT_BE_U_2(mpcp.reg_ack->echoed_sync_time))); break; default: diff --git a/print-mpls.c b/print-mpls.c index c8fe9045..9d773214 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_BE_32BITS(p); + label_entry = EXTRACT_BE_U_4(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 8cca477e..db9d7bd5 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_BE_64BITS(mpc->sender_key))); + ND_PRINT((ndo, " {0x%" PRIx64, EXTRACT_BE_U_8(mpc->sender_key))); if (opt_len == 20) /* ACK */ - ND_PRINT((ndo, ",0x%" PRIx64, EXTRACT_BE_64BITS(mpc->receiver_key))); + ND_PRINT((ndo, ",0x%" PRIx64, EXTRACT_BE_U_8(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_BE_32BITS(mpj->u.syn.token), - EXTRACT_BE_32BITS(mpj->u.syn.nonce))); + EXTRACT_BE_U_4(mpj->u.syn.token), + EXTRACT_BE_U_4(mpj->u.syn.nonce))); break; case 16: /* SYN/ACK */ ND_PRINT((ndo, " hmac 0x%" PRIx64 " nonce 0x%x", - EXTRACT_BE_64BITS(mpj->u.synack.mac), - EXTRACT_BE_32BITS(mpj->u.synack.nonce))); + EXTRACT_BE_U_8(mpj->u.synack.mac), + EXTRACT_BE_U_4(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_BE_64BITS(opt))); + ND_PRINT((ndo, "%" PRIu64, EXTRACT_BE_U_8(opt))); opt += 8; opt_len -= 8; } else { if (opt_len < 4) return 0; - ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(opt))); + ND_PRINT((ndo, "%u", EXTRACT_BE_U_4(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_BE_64BITS(opt))); + ND_PRINT((ndo, "%" PRIu64, EXTRACT_BE_U_8(opt))); opt += 8; opt_len -= 8; } else { if (opt_len < 4) return 0; - ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(opt))); + ND_PRINT((ndo, "%u", EXTRACT_BE_U_4(opt))); opt += 4; opt_len -= 4; } if (opt_len < 4) return 0; - ND_PRINT((ndo, " subseq %u", EXTRACT_BE_32BITS(opt))); + ND_PRINT((ndo, " subseq %u", EXTRACT_BE_U_4(opt))); opt += 4; opt_len -= 4; if (opt_len < 2) return 0; - ND_PRINT((ndo, " len %u", EXTRACT_BE_16BITS(opt))); + ND_PRINT((ndo, " len %u", EXTRACT_BE_U_2(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_BE_16BITS(opt))); + ND_PRINT((ndo, " csum 0x%x", EXTRACT_BE_U_2(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_BE_16BITS(add_addr->u.v4.port))); + ND_PRINT((ndo, ":%u", EXTRACT_BE_U_2(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_BE_16BITS(add_addr->u.v6.port))); + ND_PRINT((ndo, ":%u", EXTRACT_BE_U_2(add_addr->u.v6.port))); break; default: return 0; @@ -368,7 +368,7 @@ remove_addr_print(netdissect_options *ndo, opt_len -= 3; ND_PRINT((ndo, " id")); while (opt_len--) { - ND_PRINT((ndo, " %u", EXTRACT_8BITS(addr_id))); + ND_PRINT((ndo, " %u", EXTRACT_U_1(addr_id))); addr_id++; } return 1; @@ -400,7 +400,7 @@ mp_fail_print(netdissect_options *ndo, if (opt_len != 12) return 0; - ND_PRINT((ndo, " seq %" PRIu64, EXTRACT_BE_64BITS(opt + 4))); + ND_PRINT((ndo, " seq %" PRIu64, EXTRACT_BE_U_8(opt + 4))); return 1; } @@ -411,7 +411,7 @@ mp_fast_close_print(netdissect_options *ndo, if (opt_len != 12) return 0; - ND_PRINT((ndo, " key 0x%" PRIx64, EXTRACT_BE_64BITS(opt + 4))); + ND_PRINT((ndo, " key 0x%" PRIx64, EXTRACT_BE_U_8(opt + 4))); return 1; } diff --git a/print-msdp.c b/print-msdp.c index 19b7c5e6..6ac780b8 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_BE_16BITS(sp + 1); + len = EXTRACT_BE_U_2(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_BE_16BITS(sp + 1); + len = EXTRACT_BE_U_2(sp + 1); if (len > 1400 || ndo->ndo_vflag) ND_PRINT((ndo, " [len %u]", len)); if (len < 3) diff --git a/print-msnlb.c b/print-msnlb.c index 5264da49..2352ba38 100644 --- a/print-msnlb.c +++ b/print-msnlb.c @@ -56,7 +56,7 @@ msnlb_print(netdissect_options *ndo, const u_char *bp) ND_TCHECK(*hb); ND_PRINT((ndo, "MS NLB heartbeat, host priority: %u,", - EXTRACT_LE_32BITS(&(hb->host_prio)))); + EXTRACT_LE_U_4(&(hb->host_prio)))); ND_PRINT((ndo, " cluster IP: %s,", ipaddr_string(ndo, &(hb->virtual_ip)))); ND_PRINT((ndo, " host IP: %s", ipaddr_string(ndo, &(hb->host_ip)))); return; diff --git a/print-nfs.c b/print-nfs.c index cf771b0b..a4823842 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_BE_32BITS(dp); + sa3->sa_modeset = EXTRACT_BE_U_4(dp); dp++; if (sa3->sa_modeset) { ND_TCHECK(dp[0]); - sa3->sa_mode = EXTRACT_BE_32BITS(dp); + sa3->sa_mode = EXTRACT_BE_U_4(dp); dp++; } ND_TCHECK(dp[0]); - sa3->sa_uidset = EXTRACT_BE_32BITS(dp); + sa3->sa_uidset = EXTRACT_BE_U_4(dp); dp++; if (sa3->sa_uidset) { ND_TCHECK(dp[0]); - sa3->sa_uid = EXTRACT_BE_32BITS(dp); + sa3->sa_uid = EXTRACT_BE_U_4(dp); dp++; } ND_TCHECK(dp[0]); - sa3->sa_gidset = EXTRACT_BE_32BITS(dp); + sa3->sa_gidset = EXTRACT_BE_U_4(dp); dp++; if (sa3->sa_gidset) { ND_TCHECK(dp[0]); - sa3->sa_gid = EXTRACT_BE_32BITS(dp); + sa3->sa_gid = EXTRACT_BE_U_4(dp); dp++; } ND_TCHECK(dp[0]); - sa3->sa_sizeset = EXTRACT_BE_32BITS(dp); + sa3->sa_sizeset = EXTRACT_BE_U_4(dp); dp++; if (sa3->sa_sizeset) { ND_TCHECK(dp[0]); - sa3->sa_size = EXTRACT_BE_32BITS(dp); + sa3->sa_size = EXTRACT_BE_U_4(dp); dp++; } ND_TCHECK(dp[0]); - sa3->sa_atimetype = EXTRACT_BE_32BITS(dp); + sa3->sa_atimetype = EXTRACT_BE_U_4(dp); dp++; if (sa3->sa_atimetype == NFSV3SATTRTIME_TOCLIENT) { ND_TCHECK(dp[1]); - sa3->sa_atime.nfsv3_sec = EXTRACT_BE_32BITS(dp); + sa3->sa_atime.nfsv3_sec = EXTRACT_BE_U_4(dp); dp++; - sa3->sa_atime.nfsv3_nsec = EXTRACT_BE_32BITS(dp); + sa3->sa_atime.nfsv3_nsec = EXTRACT_BE_U_4(dp); dp++; } ND_TCHECK(dp[0]); - sa3->sa_mtimetype = EXTRACT_BE_32BITS(dp); + sa3->sa_mtimetype = EXTRACT_BE_U_4(dp); dp++; if (sa3->sa_mtimetype == NFSV3SATTRTIME_TOCLIENT) { ND_TCHECK(dp[1]); - sa3->sa_mtime.nfsv3_sec = EXTRACT_BE_32BITS(dp); + sa3->sa_mtime.nfsv3_sec = EXTRACT_BE_U_4(dp); dp++; - sa3->sa_mtime.nfsv3_nsec = EXTRACT_BE_32BITS(dp); + sa3->sa_mtime.nfsv3_nsec = EXTRACT_BE_U_4(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_BE_32BITS(&rp->rm_xid)); + EXTRACT_BE_U_4(&rp->rm_xid)); } else { snprintf(srcid, sizeof(srcid), "%u", NFS_PORT); snprintf(dstid, sizeof(dstid), "%u", - EXTRACT_BE_32BITS(&rp->rm_xid)); + EXTRACT_BE_U_4(&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_BE_32BITS(&rp->rm_reply.rp_stat); + reply_stat = EXTRACT_BE_U_4(&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_BE_32BITS(&rp->rm_reply.rp_reject.rj_stat); + rstat = EXTRACT_BE_U_4(&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_BE_32BITS(&rp->rm_reply.rp_reject.rj_vers.low); - rhigh = EXTRACT_BE_32BITS(&rp->rm_reply.rp_reject.rj_vers.high); + rlow = EXTRACT_BE_U_4(&rp->rm_reply.rp_reject.rj_vers.low); + rhigh = EXTRACT_BE_U_4(&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_BE_32BITS(&rp->rm_reply.rp_reject.rj_why); + rwhy = EXTRACT_BE_U_4(&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_BE_32BITS(dp + 1); + len = EXTRACT_BE_U_4(dp + 1); if (len < length) { dp += (len + (2 * sizeof(*dp) + 3)) / sizeof(*dp); ND_TCHECK(dp[1]); - len = EXTRACT_BE_32BITS(dp + 1); + len = EXTRACT_BE_U_4(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_BE_32BITS(dp) / 4; + len = EXTRACT_BE_U_4(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_BE_32BITS(&rp->rm_call.cb_vers) == NFS_VER3); - proc = EXTRACT_BE_32BITS(&rp->rm_call.cb_proc); + v3 = (EXTRACT_BE_U_4(&rp->rm_call.cb_vers) == NFS_VER3); + proc = EXTRACT_BE_U_4(&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_BE_32BITS(dp); + access_flags = EXTRACT_BE_U_4(dp); 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_BE_32BITS(dp + 2), - EXTRACT_BE_64BITS(dp))); + EXTRACT_BE_U_4(dp + 2), + EXTRACT_BE_U_8(dp))); } else { ND_TCHECK(dp[1]); ND_PRINT((ndo, " %u bytes @ %u", - EXTRACT_BE_32BITS(dp + 1), - EXTRACT_BE_32BITS(dp))); + EXTRACT_BE_U_4(dp + 1), + EXTRACT_BE_U_4(dp))); } 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_BE_32BITS(dp + 4), - EXTRACT_BE_32BITS(dp + 2), - EXTRACT_BE_64BITS(dp))); + EXTRACT_BE_U_4(dp + 4), + EXTRACT_BE_U_4(dp + 2), + EXTRACT_BE_U_8(dp))); if (ndo->ndo_vflag) { ND_PRINT((ndo, " <%s>", tok2str(nfsv3_writemodes, - NULL, EXTRACT_BE_32BITS(dp + 3)))); + NULL, EXTRACT_BE_U_4(dp + 3)))); } } else { ND_TCHECK(dp[3]); ND_PRINT((ndo, " %u (%u) bytes @ %u (%u)", - EXTRACT_BE_32BITS(dp + 3), - EXTRACT_BE_32BITS(dp + 2), - EXTRACT_BE_32BITS(dp + 1), - EXTRACT_BE_32BITS(dp))); + EXTRACT_BE_U_4(dp + 3), + EXTRACT_BE_U_4(dp + 2), + EXTRACT_BE_U_4(dp + 1), + EXTRACT_BE_U_4(dp))); } 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_BE_32BITS(dp); + type = (nfs_type) EXTRACT_BE_U_4(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_BE_32BITS(dp), - EXTRACT_BE_32BITS(dp + 1))); + EXTRACT_BE_U_4(dp), + EXTRACT_BE_U_4(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_BE_32BITS(dp + 4), - EXTRACT_BE_64BITS(dp))); + EXTRACT_BE_U_4(dp + 4), + EXTRACT_BE_U_8(dp))); 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_BE_32BITS(dp + 1), - EXTRACT_BE_32BITS(dp))); + EXTRACT_BE_U_4(dp + 1), + EXTRACT_BE_U_4(dp))); } return; } @@ -741,12 +741,12 @@ nfsreq_noaddr_print(netdissect_options *ndo, * cookie here. */ ND_PRINT((ndo, " %u bytes @ %" PRId64, - EXTRACT_BE_32BITS(dp + 4), - EXTRACT_BE_64BITS(dp))); + EXTRACT_BE_U_4(dp + 4), + EXTRACT_BE_U_8(dp))); if (ndo->ndo_vflag) { ND_TCHECK(dp[5]); ND_PRINT((ndo, " max %u verf %08x%08x", - EXTRACT_BE_32BITS(dp + 5), dp[2], dp[3])); + EXTRACT_BE_U_4(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_BE_32BITS(dp + 2), - EXTRACT_BE_64BITS(dp))); + EXTRACT_BE_U_4(dp + 2), + EXTRACT_BE_U_8(dp))); 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_BE_32BITS(&rp->rm_call.cb_proc); - xmep->vers = EXTRACT_BE_32BITS(&rp->rm_call.cb_vers); + xmep->proc = EXTRACT_BE_U_4(&rp->rm_call.cb_proc); + xmep->vers = EXTRACT_BE_U_4(&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_BE_32BITS(dp + 1); + len = EXTRACT_BE_U_4(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_BE_32BITS(dp); + astat = (enum sunrpc_accept_stat) EXTRACT_BE_U_4(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_BE_32BITS(dp); + errnum = EXTRACT_BE_U_4(dp); 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_BE_32BITS(&fap->fa_type)), - EXTRACT_BE_32BITS(&fap->fa_mode), - EXTRACT_BE_32BITS(&fap->fa_uid), - EXTRACT_BE_32BITS(&fap->fa_gid))); + EXTRACT_BE_U_4(&fap->fa_type)), + EXTRACT_BE_U_4(&fap->fa_mode), + EXTRACT_BE_U_4(&fap->fa_uid), + EXTRACT_BE_U_4(&fap->fa_gid))); if (v3) { ND_TCHECK(fap->fa3_size); ND_PRINT((ndo, " sz %" PRIu64, - EXTRACT_BE_64BITS((const uint32_t *)&fap->fa3_size))); + EXTRACT_BE_U_8((const uint32_t *)&fap->fa3_size))); } else { ND_TCHECK(fap->fa2_size); - ND_PRINT((ndo, " sz %d", EXTRACT_BE_32BITS(&fap->fa2_size))); + ND_PRINT((ndo, " sz %d", EXTRACT_BE_U_4(&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_BE_32BITS(&fap->fa_nlink), - EXTRACT_BE_32BITS(&fap->fa3_rdev.specdata1), - EXTRACT_BE_32BITS(&fap->fa3_rdev.specdata2))); + EXTRACT_BE_U_4(&fap->fa_nlink), + EXTRACT_BE_U_4(&fap->fa3_rdev.specdata1), + EXTRACT_BE_U_4(&fap->fa3_rdev.specdata2))); ND_PRINT((ndo, " fsid %" PRIx64, - EXTRACT_BE_64BITS((const uint32_t *)&fap->fa3_fsid))); + EXTRACT_BE_U_8((const uint32_t *)&fap->fa3_fsid))); ND_PRINT((ndo, " fileid %" PRIx64, - EXTRACT_BE_64BITS((const uint32_t *)&fap->fa3_fileid))); + EXTRACT_BE_U_8((const uint32_t *)&fap->fa3_fileid))); ND_PRINT((ndo, " a/m/ctime %u.%06u", - EXTRACT_BE_32BITS(&fap->fa3_atime.nfsv3_sec), - EXTRACT_BE_32BITS(&fap->fa3_atime.nfsv3_nsec))); + EXTRACT_BE_U_4(&fap->fa3_atime.nfsv3_sec), + EXTRACT_BE_U_4(&fap->fa3_atime.nfsv3_nsec))); ND_PRINT((ndo, " %u.%06u", - EXTRACT_BE_32BITS(&fap->fa3_mtime.nfsv3_sec), - EXTRACT_BE_32BITS(&fap->fa3_mtime.nfsv3_nsec))); + EXTRACT_BE_U_4(&fap->fa3_mtime.nfsv3_sec), + EXTRACT_BE_U_4(&fap->fa3_mtime.nfsv3_nsec))); ND_PRINT((ndo, " %u.%06u", - EXTRACT_BE_32BITS(&fap->fa3_ctime.nfsv3_sec), - EXTRACT_BE_32BITS(&fap->fa3_ctime.nfsv3_nsec))); + EXTRACT_BE_U_4(&fap->fa3_ctime.nfsv3_sec), + EXTRACT_BE_U_4(&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_BE_32BITS(&fap->fa_nlink), - EXTRACT_BE_32BITS(&fap->fa2_rdev), - EXTRACT_BE_32BITS(&fap->fa2_fsid), - EXTRACT_BE_32BITS(&fap->fa2_fileid))); + EXTRACT_BE_U_4(&fap->fa_nlink), + EXTRACT_BE_U_4(&fap->fa2_rdev), + EXTRACT_BE_U_4(&fap->fa2_fsid), + EXTRACT_BE_U_4(&fap->fa2_fileid))); ND_PRINT((ndo, " %u.%06u", - EXTRACT_BE_32BITS(&fap->fa2_atime.nfsv2_sec), - EXTRACT_BE_32BITS(&fap->fa2_atime.nfsv2_usec))); + EXTRACT_BE_U_4(&fap->fa2_atime.nfsv2_sec), + EXTRACT_BE_U_4(&fap->fa2_atime.nfsv2_usec))); ND_PRINT((ndo, " %u.%06u", - EXTRACT_BE_32BITS(&fap->fa2_mtime.nfsv2_sec), - EXTRACT_BE_32BITS(&fap->fa2_mtime.nfsv2_usec))); + EXTRACT_BE_U_4(&fap->fa2_mtime.nfsv2_sec), + EXTRACT_BE_U_4(&fap->fa2_mtime.nfsv2_usec))); ND_PRINT((ndo, " %u.%06u", - EXTRACT_BE_32BITS(&fap->fa2_ctime.nfsv2_sec), - EXTRACT_BE_32BITS(&fap->fa2_ctime.nfsv2_usec))); + EXTRACT_BE_U_4(&fap->fa2_ctime.nfsv2_sec), + EXTRACT_BE_U_4(&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_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))); + EXTRACT_BE_U_8((const uint32_t *)&sfsp->sf_tbytes), + EXTRACT_BE_U_8((const uint32_t *)&sfsp->sf_fbytes), + EXTRACT_BE_U_8((const uint32_t *)&sfsp->sf_abytes))); if (ndo->ndo_vflag) { ND_PRINT((ndo, " tfiles %" PRIu64 " ffiles %" PRIu64 " afiles %" PRIu64 " invar %u", - 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))); + EXTRACT_BE_U_8((const uint32_t *)&sfsp->sf_tfiles), + EXTRACT_BE_U_8((const uint32_t *)&sfsp->sf_ffiles), + EXTRACT_BE_U_8((const uint32_t *)&sfsp->sf_afiles), + EXTRACT_BE_U_4(&sfsp->sf_invarsec))); } } else { ND_PRINT((ndo, " tsize %d bsize %d blocks %d bfree %d bavail %d", - 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))); + EXTRACT_BE_U_4(&sfsp->sf_tsize), + EXTRACT_BE_U_4(&sfsp->sf_bsize), + EXTRACT_BE_U_4(&sfsp->sf_blocks), + EXTRACT_BE_U_4(&sfsp->sf_bfree), + EXTRACT_BE_U_4(&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_BE_32BITS(dp), EXTRACT_BE_32BITS(dp + 1))); + EXTRACT_BE_U_4(dp), EXTRACT_BE_U_4(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_BE_64BITS(dp))); + ND_PRINT((ndo, " sz %" PRIu64, EXTRACT_BE_U_8(dp))); ND_PRINT((ndo, " mtime %u.%06u ctime %u.%06u", - EXTRACT_BE_32BITS(dp + 2), EXTRACT_BE_32BITS(dp + 3), - EXTRACT_BE_32BITS(dp + 4), EXTRACT_BE_32BITS(dp + 5))); + EXTRACT_BE_U_4(dp + 2), EXTRACT_BE_U_4(dp + 3), + EXTRACT_BE_U_4(dp + 4), EXTRACT_BE_U_4(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_BE_32BITS(dp)) + if (!EXTRACT_BE_U_4(dp)) 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_BE_32BITS(dp)) + if (!EXTRACT_BE_U_4(dp)) 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_BE_32BITS(dp)) + if (!EXTRACT_BE_U_4(dp)) 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_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))); + EXTRACT_BE_U_4(&sfp->fs_rtmax), + EXTRACT_BE_U_4(&sfp->fs_rtpref), + EXTRACT_BE_U_4(&sfp->fs_wtmax), + EXTRACT_BE_U_4(&sfp->fs_wtpref), + EXTRACT_BE_U_4(&sfp->fs_dtpref))); if (ndo->ndo_vflag) { ND_PRINT((ndo, " rtmult %u wtmult %u maxfsz %" PRIu64, - EXTRACT_BE_32BITS(&sfp->fs_rtmult), - EXTRACT_BE_32BITS(&sfp->fs_wtmult), - EXTRACT_BE_64BITS((const uint32_t *)&sfp->fs_maxfilesize))); + EXTRACT_BE_U_4(&sfp->fs_rtmult), + EXTRACT_BE_U_4(&sfp->fs_wtmult), + EXTRACT_BE_U_8((const uint32_t *)&sfp->fs_maxfilesize))); ND_PRINT((ndo, " delta %u.%06u ", - EXTRACT_BE_32BITS(&sfp->fs_timedelta.nfsv3_sec), - EXTRACT_BE_32BITS(&sfp->fs_timedelta.nfsv3_nsec))); + EXTRACT_BE_U_4(&sfp->fs_timedelta.nfsv3_sec), + EXTRACT_BE_U_4(&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_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" : "")); + EXTRACT_BE_U_4(&spp->pc_linkmax), + EXTRACT_BE_U_4(&spp->pc_namemax), + EXTRACT_BE_U_4(&spp->pc_notrunc) ? "notrunc" : "", + EXTRACT_BE_U_4(&spp->pc_chownrestricted) ? "chownres" : "", + EXTRACT_BE_U_4(&spp->pc_caseinsensitive) ? "igncase" : "", + EXTRACT_BE_U_4(&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_BE_32BITS(dp))); + ND_PRINT((ndo, " c %04x", EXTRACT_BE_U_4(dp))); } 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_BE_32BITS(dp))); - if (EXTRACT_BE_32BITS(dp + 1)) + ND_PRINT((ndo, " %u bytes", EXTRACT_BE_U_4(dp))); + if (EXTRACT_BE_U_4(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_BE_32BITS(dp))); + ND_PRINT((ndo, " %u bytes", EXTRACT_BE_U_4(dp))); if (ndo->ndo_vflag > 1) { ND_TCHECK(dp[1]); ND_PRINT((ndo, " <%s>", tok2str(nfsv3_writemodes, - NULL, EXTRACT_BE_32BITS(dp + 1)))); + NULL, EXTRACT_BE_U_4(dp + 1)))); } return; } diff --git a/print-nsh.c b/print-nsh.c index 42846777..6abf9f17 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_BE_24BITS(bp); + service_path_id = EXTRACT_BE_U_3(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_BE_32BITS(bp); + ctx = EXTRACT_BE_U_4(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_BE_16BITS(bp); + tlv_class = EXTRACT_BE_U_2(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_BE_32BITS(bp); + ctx = EXTRACT_BE_U_4(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 8da3c93f..b4cc7a79 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_BE_32BITS(&bp->refid))); + ND_PRINT((ndo, "0x%08x", EXTRACT_BE_U_4(&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_BE_32BITS(&bp->key_id))); + ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_U_4(&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_BE_32BITS(&bp->key_id))); + ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_U_4(&bp->key_id))); ND_TCHECK2(bp->message_digest, 16); ND_PRINT((ndo, "\n\tAuthentication: %08x%08x%08x%08x", - 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_U_4(bp->message_digest), + EXTRACT_BE_U_4(bp->message_digest + 4), + EXTRACT_BE_U_4(bp->message_digest + 8), + EXTRACT_BE_U_4(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_BE_32BITS(&bp->key_id))); + ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_U_4(&bp->key_id))); ND_TCHECK2(bp->message_digest, 20); ND_PRINT((ndo, "\n\tAuthentication: %08x%08x%08x%08x%08x", - 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))); + EXTRACT_BE_U_4(bp->message_digest), + EXTRACT_BE_U_4(bp->message_digest + 4), + EXTRACT_BE_U_4(bp->message_digest + 8), + EXTRACT_BE_U_4(bp->message_digest + 12), + EXTRACT_BE_U_4(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_BE_16BITS(&cd->sequence); + sequence = EXTRACT_BE_U_2(&cd->sequence); ND_PRINT((ndo, "\tSequence=%hu", sequence)); ND_TCHECK(cd->status); - status = EXTRACT_BE_16BITS(&cd->status); + status = EXTRACT_BE_U_2(&cd->status); ND_PRINT((ndo, ", Status=%#hx", status)); ND_TCHECK(cd->assoc); - assoc = EXTRACT_BE_16BITS(&cd->assoc); + assoc = EXTRACT_BE_U_2(&cd->assoc); ND_PRINT((ndo, ", Assoc.=%hu", assoc)); ND_TCHECK(cd->offset); - offset = EXTRACT_BE_16BITS(&cd->offset); + offset = EXTRACT_BE_U_2(&cd->offset); ND_PRINT((ndo, ", Offset=%hu", offset)); ND_TCHECK(cd->count); - count = EXTRACT_BE_16BITS(&cd->count); + count = EXTRACT_BE_U_2(&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_BE_16BITS(&sfp->int_part); - f = EXTRACT_BE_16BITS(&sfp->fraction); + i = EXTRACT_BE_U_2(&sfp->int_part); + f = EXTRACT_BE_U_2(&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_BE_32BITS(&lfp->int_part); - uf = EXTRACT_BE_32BITS(&lfp->fraction); + i = EXTRACT_BE_U_4(&lfp->int_part); + uf = EXTRACT_BE_U_4(&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_BE_32BITS(&lfp->int_part); - ou = EXTRACT_BE_32BITS(&olfp->int_part); - uf = EXTRACT_BE_32BITS(&lfp->fraction); - ouf = EXTRACT_BE_32BITS(&olfp->fraction); + u = EXTRACT_BE_U_4(&lfp->int_part); + ou = EXTRACT_BE_U_4(&olfp->int_part); + uf = EXTRACT_BE_U_4(&lfp->fraction); + ouf = EXTRACT_BE_U_4(&olfp->fraction); if (ou == 0 && ouf == 0) { p_ntp_time(ndo, lfp); return; diff --git a/print-olsr.c b/print-olsr.c index 8f727a96..cb0d6b20 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_BE_16BITS(ptr.common->packet_len)); + length = min(length, EXTRACT_BE_U_2(ptr.common->packet_len)); ND_PRINT((ndo, "OLSRv%i, seq 0x%04x, length %u", (is_ipv6 == 0) ? 4 : 6, - EXTRACT_BE_16BITS(ptr.common->packet_seq), + EXTRACT_BE_U_2(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_BE_16BITS(msgptr.v6->msg_len); + msg_len = EXTRACT_BE_U_2(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_BE_16BITS(msgptr.v6->msg_seq), + EXTRACT_BE_U_2(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_BE_16BITS(msgptr.v4->msg_len); + msg_len = EXTRACT_BE_U_2(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_BE_16BITS(msgptr.v4->msg_seq), + EXTRACT_BE_U_2(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_BE_16BITS(ptr.hello_link->len); + hello_len = EXTRACT_BE_U_2(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_BE_16BITS(ptr.tc->ans_seq))); + EXTRACT_BE_U_2(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_BE_32BITS(ptr.hna->mask)))); + mask2plen(EXTRACT_BE_U_4(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_BE_16BITS(msg_data + 2); + name_entries = EXTRACT_BE_U_2(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_BE_16BITS(msg_data), + EXTRACT_BE_U_2(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_BE_16BITS(msg_data); - name_entry_len = EXTRACT_BE_16BITS(msg_data + 2); + name_entry_type = EXTRACT_BE_U_2(msg_data); + name_entry_len = EXTRACT_BE_U_2(msg_data + 2); msg_data += 4; msg_tlen -= 4; diff --git a/print-openflow-1.0.c b/print-openflow-1.0.c index af3ad0e0..f328dbb3 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_BE_32BITS(cp); + subtype = EXTRACT_BE_U_4(cp); cp += 4; ND_PRINT((ndo, "\n\t subtype %s", tok2str(bsn_subtype_str, "unknown (0x%08x)", subtype))); switch (subtype) { @@ -835,7 +835,7 @@ of10_bsn_message_print(netdissect_options *ndo, goto invalid; /* report_mirror_ports */ ND_TCHECK2(*cp, 1); - ND_PRINT((ndo, ", report_mirror_ports %s", tok2str(bsn_onoff_str, "bogus (%u)", EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, ", report_mirror_ports %s", tok2str(bsn_onoff_str, "bogus (%u)", EXTRACT_U_1(cp)))); cp += 1; /* pad */ ND_TCHECK2(*cp, 3); @@ -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_BE_32BITS(cp))); + ND_PRINT((ndo, ", vport_no %u", EXTRACT_BE_U_4(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_BE_32BITS(cp))); + ND_PRINT((ndo, ", service %u", EXTRACT_BE_U_4(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_BE_32BITS(cp))); + ND_PRINT((ndo, ", status 0x%08x", EXTRACT_BE_U_4(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_BE_32BITS(cp); + subtype = EXTRACT_BE_U_4(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_BE_32BITS(cp))); + ND_PRINT((ndo, ", dest_port %u", EXTRACT_BE_U_4(cp))); cp += 4; /* vlan_tag */ ND_TCHECK2(*cp, 4); - vlan_tag = EXTRACT_BE_32BITS(cp); + vlan_tag = EXTRACT_BE_U_4(cp); cp += 4; switch (vlan_tag >> 16) { case 0: @@ -1009,7 +1009,7 @@ of10_bsn_actions_print(netdissect_options *ndo, } /* copy_stage */ ND_TCHECK2(*cp, 1); - ND_PRINT((ndo, ", copy_stage %s", tok2str(bsn_mirror_copy_stage_str, "unknown (%u)", EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, ", copy_stage %s", tok2str(bsn_mirror_copy_stage_str, "unknown (%u)", EXTRACT_U_1(cp)))); cp += 1; /* pad */ ND_TCHECK2(*cp, 3); @@ -1042,7 +1042,7 @@ of10_vendor_action_print(netdissect_options *ndo, goto invalid; /* vendor */ ND_TCHECK2(*cp, 4); - vendor = EXTRACT_BE_32BITS(cp); + vendor = EXTRACT_BE_U_4(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_BE_32BITS(cp); + vendor = EXTRACT_BE_U_4(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_BE_32BITS(cp); + vendor = EXTRACT_BE_U_4(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_BE_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp)))); cp += 2; /* hw_addr */ ND_TCHECK2(*cp, ETHER_ADDR_LEN); @@ -1170,38 +1170,38 @@ of10_phy_ports_print(netdissect_options *ndo, } /* config */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t config 0x%08x", EXTRACT_BE_32BITS(cp))); - of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_32BITS(cp), + ND_PRINT((ndo, "\n\t config 0x%08x", EXTRACT_BE_U_4(cp))); + of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_U_4(cp), OFPPC_U); cp += 4; /* state */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t state 0x%08x", EXTRACT_BE_32BITS(cp))); - of10_bitmap_print(ndo, ofpps_bm, EXTRACT_BE_32BITS(cp), + ND_PRINT((ndo, "\n\t state 0x%08x", EXTRACT_BE_U_4(cp))); + of10_bitmap_print(ndo, ofpps_bm, EXTRACT_BE_U_4(cp), OFPPS_U); cp += 4; /* curr */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t curr 0x%08x", EXTRACT_BE_32BITS(cp))); - of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp), + ND_PRINT((ndo, "\n\t curr 0x%08x", EXTRACT_BE_U_4(cp))); + of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_U_4(cp), OFPPF_U); cp += 4; /* advertised */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t advertised 0x%08x", EXTRACT_BE_32BITS(cp))); - of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp), + ND_PRINT((ndo, "\n\t advertised 0x%08x", EXTRACT_BE_U_4(cp))); + of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_U_4(cp), OFPPF_U); cp += 4; /* supported */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t supported 0x%08x", EXTRACT_BE_32BITS(cp))); - of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp), + ND_PRINT((ndo, "\n\t supported 0x%08x", EXTRACT_BE_U_4(cp))); + of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_U_4(cp), OFPPF_U); cp += 4; /* peer */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t peer 0x%08x", EXTRACT_BE_32BITS(cp))); - of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp), + ND_PRINT((ndo, "\n\t peer 0x%08x", EXTRACT_BE_U_4(cp))); + of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_U_4(cp), OFPPF_U); cp += 4; next_port: @@ -1234,12 +1234,12 @@ of10_queue_props_print(netdissect_options *ndo, goto invalid; /* property */ ND_TCHECK2(*cp, 2); - property = EXTRACT_BE_16BITS(cp); + property = EXTRACT_BE_U_2(cp); cp += 2; ND_PRINT((ndo, "\n\t property %s", tok2str(ofpqt_str, "invalid (0x%04x)", property))); /* len */ ND_TCHECK2(*cp, 2); - plen = EXTRACT_BE_16BITS(cp); + plen = EXTRACT_BE_U_2(cp); cp += 2; ND_PRINT((ndo, ", len %u", plen)); if (plen < OF_QUEUE_PROP_HEADER_LEN || plen > len) @@ -1270,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_BE_16BITS(cp); + rate = EXTRACT_BE_U_2(cp); cp += 2; if (rate > 1000) ND_PRINT((ndo, ", rate disabled")); @@ -1308,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_BE_32BITS(cp))); + ND_PRINT((ndo, "\n\t queue_id %u", EXTRACT_BE_U_4(cp))); cp += 4; /* len */ ND_TCHECK2(*cp, 2); - desclen = EXTRACT_BE_16BITS(cp); + desclen = EXTRACT_BE_U_2(cp); cp += 2; ND_PRINT((ndo, ", len %u", desclen)); if (desclen < OF_PACKET_QUEUE_LEN || desclen > len) @@ -1355,14 +1355,14 @@ of10_match_print(netdissect_options *ndo, /* wildcards */ ND_TCHECK2(*cp, 4); - wildcards = EXTRACT_BE_32BITS(cp); + wildcards = EXTRACT_BE_U_4(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_BE_16BITS(cp)))); + ND_PRINT((ndo, "%smatch in_port %s", pfx, tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp)))); cp += 2; /* dl_src */ ND_TCHECK2(*cp, ETHER_ADDR_LEN); @@ -1377,19 +1377,19 @@ 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_BE_16BITS(cp)))); + ND_PRINT((ndo, "%smatch dl_vlan %s", pfx, vlan_str(EXTRACT_BE_U_2(cp)))); cp += 2; /* dl_vlan_pcp */ ND_TCHECK2(*cp, 1); if (! (wildcards & OFPFW_DL_VLAN_PCP)) - ND_PRINT((ndo, "%smatch dl_vlan_pcp %s", pfx, pcp_str(EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, "%smatch dl_vlan_pcp %s", pfx, pcp_str(EXTRACT_U_1(cp)))); cp += 1; /* pad1 */ ND_TCHECK2(*cp, 1); cp += 1; /* dl_type */ ND_TCHECK2(*cp, 2); - dl_type = EXTRACT_BE_16BITS(cp); + dl_type = EXTRACT_BE_U_2(cp); cp += 2; if (! (wildcards & OFPFW_DL_TYPE)) ND_PRINT((ndo, "%smatch dl_type 0x%04x", pfx, dl_type)); @@ -1428,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_BE_16BITS(cp))); + ND_PRINT((ndo, "%smatch %s %u", pfx, field_name, EXTRACT_BE_U_2(cp))); } cp += 2; /* tp_dst */ @@ -1437,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_BE_16BITS(cp))); + ND_PRINT((ndo, "%smatch %s %u", pfx, field_name, EXTRACT_BE_U_2(cp))); } return cp + 2; @@ -1463,12 +1463,12 @@ of10_actions_print(netdissect_options *ndo, goto invalid; /* type */ ND_TCHECK2(*cp, 2); - type = EXTRACT_BE_16BITS(cp); + type = EXTRACT_BE_U_2(cp); cp += 2; ND_PRINT((ndo, "%saction type %s", pfx, tok2str(ofpat_str, "invalid (0x%04x)", type))); /* length */ ND_TCHECK2(*cp, 2); - alen = EXTRACT_BE_16BITS(cp); + alen = EXTRACT_BE_U_2(cp); cp += 2; ND_PRINT((ndo, ", len %u", alen)); /* On action size underrun/overrun skip the rest of the action list. */ @@ -1513,19 +1513,19 @@ of10_actions_print(netdissect_options *ndo, case OFPAT_OUTPUT: /* port */ ND_TCHECK2(*cp, 2); - output_port = EXTRACT_BE_16BITS(cp); + output_port = EXTRACT_BE_U_2(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_BE_16BITS(cp))); + ND_PRINT((ndo, ", max_len %u", EXTRACT_BE_U_2(cp))); cp += 2; break; case OFPAT_SET_VLAN_VID: /* vlan_vid */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", vlan_vid %s", vlan_str(EXTRACT_BE_16BITS(cp)))); + ND_PRINT((ndo, ", vlan_vid %s", vlan_str(EXTRACT_BE_U_2(cp)))); cp += 2; /* pad */ ND_TCHECK2(*cp, 2); @@ -1534,7 +1534,7 @@ of10_actions_print(netdissect_options *ndo, case OFPAT_SET_VLAN_PCP: /* vlan_pcp */ ND_TCHECK2(*cp, 1); - ND_PRINT((ndo, ", vlan_pcp %s", pcp_str(EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, ", vlan_pcp %s", pcp_str(EXTRACT_U_1(cp)))); cp += 1; /* pad */ ND_TCHECK2(*cp, 3); @@ -1570,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_BE_16BITS(cp))); + ND_PRINT((ndo, ", tp_port %u", EXTRACT_BE_U_2(cp))); cp += 2; /* pad */ ND_TCHECK2(*cp, 2); @@ -1579,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_BE_16BITS(cp)))); + ND_PRINT((ndo, ", port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(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_BE_32BITS(cp)))); + ND_PRINT((ndo, ", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_BE_U_4(cp)))); cp += 4; break; case OFPAT_VENDOR: @@ -1620,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_BE_64BITS(cp))); + ND_PRINT((ndo, "\n\t dpid 0x%016" PRIx64, EXTRACT_BE_U_8(cp))); cp += 8; /* n_buffers */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", n_buffers %u", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, ", n_buffers %u", EXTRACT_BE_U_4(cp))); cp += 4; /* n_tables */ ND_TCHECK2(*cp, 1); @@ -1635,14 +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_BE_32BITS(cp))); - of10_bitmap_print(ndo, ofp_capabilities_bm, EXTRACT_BE_32BITS(cp), + ND_PRINT((ndo, "\n\t capabilities 0x%08x", EXTRACT_BE_U_4(cp))); + of10_bitmap_print(ndo, ofp_capabilities_bm, EXTRACT_BE_U_4(cp), OFPCAP_U); cp += 4; /* actions */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t actions 0x%08x", EXTRACT_BE_32BITS(cp))); - of10_bitmap_print(ndo, ofpat_bm, EXTRACT_BE_32BITS(cp), OFPAT_U); + ND_PRINT((ndo, "\n\t actions 0x%08x", EXTRACT_BE_U_4(cp))); + of10_bitmap_print(ndo, ofpat_bm, EXTRACT_BE_U_4(cp), OFPAT_U); cp += 4; /* ports */ return of10_phy_ports_print(ndo, cp, ep, len - OF_SWITCH_FEATURES_LEN); @@ -1664,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_BE_64BITS(cp))); + ND_PRINT((ndo, "\n\t cookie 0x%016" PRIx64, EXTRACT_BE_U_8(cp))); cp += 8; /* command */ ND_TCHECK2(*cp, 2); - command = EXTRACT_BE_16BITS(cp); + command = EXTRACT_BE_U_2(cp); ND_PRINT((ndo, ", command %s", tok2str(ofpfc_str, "invalid (0x%04x)", command))); cp += 2; /* idle_timeout */ ND_TCHECK2(*cp, 2); - if (EXTRACT_BE_16BITS(cp)) - ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_16BITS(cp))); + if (EXTRACT_BE_U_2(cp)) + ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_U_2(cp))); cp += 2; /* hard_timeout */ ND_TCHECK2(*cp, 2); - if (EXTRACT_BE_16BITS(cp)) - ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_BE_16BITS(cp))); + if (EXTRACT_BE_U_2(cp)) + ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_BE_U_2(cp))); cp += 2; /* priority */ ND_TCHECK2(*cp, 2); - if (EXTRACT_BE_16BITS(cp)) - ND_PRINT((ndo, ", priority %u", EXTRACT_BE_16BITS(cp))); + if (EXTRACT_BE_U_2(cp)) + ND_PRINT((ndo, ", priority %u", EXTRACT_BE_U_2(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_BE_32BITS(cp)))); + ND_PRINT((ndo, ", buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_BE_U_4(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_BE_16BITS(cp)))); + ND_PRINT((ndo, ", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp)))); cp += 2; /* flags */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_16BITS(cp))); - of10_bitmap_print(ndo, ofpff_bm, EXTRACT_BE_16BITS(cp), OFPFF_U); + ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_U_2(cp))); + of10_bitmap_print(ndo, ofpff_bm, EXTRACT_BE_U_2(cp), OFPFF_U); cp += 2; /* actions */ return of10_actions_print(ndo, "\n\t ", cp, ep, len - OF_FLOW_MOD_LEN); @@ -1717,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_BE_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp)))); cp += 2; /* hw_addr */ ND_TCHECK2(*cp, ETHER_ADDR_LEN); @@ -1725,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_BE_32BITS(cp))); - of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_32BITS(cp), OFPPC_U); + ND_PRINT((ndo, "\n\t config 0x%08x", EXTRACT_BE_U_4(cp))); + of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_U_4(cp), OFPPC_U); cp += 4; /* mask */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t mask 0x%08x", EXTRACT_BE_32BITS(cp))); - of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_32BITS(cp), OFPPC_U); + ND_PRINT((ndo, "\n\t mask 0x%08x", EXTRACT_BE_U_4(cp))); + of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_U_4(cp), OFPPC_U); cp += 4; /* advertise */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t advertise 0x%08x", EXTRACT_BE_32BITS(cp))); - of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp), OFPPF_U); + ND_PRINT((ndo, "\n\t advertise 0x%08x", EXTRACT_BE_U_4(cp))); + of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_U_4(cp), OFPPF_U); cp += 4; /* pad */ ND_TCHECK2(*cp, 4); @@ -1758,13 +1758,13 @@ of10_stats_request_print(netdissect_options *ndo, /* type */ ND_TCHECK2(*cp, 2); - type = EXTRACT_BE_16BITS(cp); + type = EXTRACT_BE_U_2(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_BE_16BITS(cp))); - if (EXTRACT_BE_16BITS(cp)) + ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_U_2(cp))); + if (EXTRACT_BE_U_2(cp)) ND_PRINT((ndo, " (bogus)")); cp += 2; /* type-specific body of one of fixed lengths */ @@ -1784,21 +1784,21 @@ of10_stats_request_print(netdissect_options *ndo, return ep; /* end of snapshot */ /* table_id */ ND_TCHECK2(*cp, 1); - ND_PRINT((ndo, "\n\t table_id %s", tok2str(tableid_str, "%u", EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, "\n\t table_id %s", tok2str(tableid_str, "%u", EXTRACT_U_1(cp)))); cp += 1; /* pad */ ND_TCHECK2(*cp, 1); cp += 1; /* out_port */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); + ND_PRINT((ndo, ", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(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_BE_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp)))); cp += 2; /* pad */ ND_TCHECK2(*cp, 6); @@ -1808,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_BE_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(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_BE_32BITS(cp)))); + ND_PRINT((ndo, ", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_BE_U_4(cp)))); return cp + 4; case OFPST_VENDOR: return of10_vendor_data_print(ndo, cp, ep, len); @@ -1892,14 +1892,14 @@ of10_flow_stats_reply_print(netdissect_options *ndo, goto invalid; /* length */ ND_TCHECK2(*cp, 2); - entry_len = EXTRACT_BE_16BITS(cp); + entry_len = EXTRACT_BE_U_2(cp); ND_PRINT((ndo, "\n\t length %u", entry_len)); if (entry_len < OF_FLOW_STATS_LEN || entry_len > len) goto invalid; cp += 2; /* table_id */ ND_TCHECK2(*cp, 1); - ND_PRINT((ndo, ", table_id %s", tok2str(tableid_str, "%u", EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, ", table_id %s", tok2str(tableid_str, "%u", EXTRACT_U_1(cp)))); cp += 1; /* pad */ ND_TCHECK2(*cp, 1); @@ -1909,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_BE_32BITS(cp))); + ND_PRINT((ndo, "\n\t duration_sec %u", EXTRACT_BE_U_4(cp))); cp += 4; /* duration_nsec */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_BE_U_4(cp))); cp += 4; /* priority */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", priority %u", EXTRACT_BE_16BITS(cp))); + ND_PRINT((ndo, ", priority %u", EXTRACT_BE_U_2(cp))); cp += 2; /* idle_timeout */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_16BITS(cp))); + ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_U_2(cp))); cp += 2; /* hard_timeout */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_BE_16BITS(cp))); + ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_BE_U_2(cp))); cp += 2; /* pad2 */ ND_TCHECK2(*cp, 6); cp += 6; /* cookie */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", cookie 0x%016" PRIx64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", cookie 0x%016" PRIx64, EXTRACT_BE_U_8(cp))); cp += 8; /* packet_count */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* byte_count */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* actions */ if (ep == (cp = of10_actions_print(ndo, "\n\t ", cp, ep, entry_len - OF_FLOW_STATS_LEN))) @@ -1969,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_BE_64BITS(cp))); + ND_PRINT((ndo, "\n\t packet_count %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* byte_count */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* flow_count */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", flow_count %u", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, ", flow_count %u", EXTRACT_BE_U_4(cp))); cp += 4; /* pad */ ND_TCHECK2(*cp, 4); @@ -2005,7 +2005,7 @@ of10_table_stats_reply_print(netdissect_options *ndo, goto invalid; /* table_id */ ND_TCHECK2(*cp, 1); - ND_PRINT((ndo, "\n\t table_id %s", tok2str(tableid_str, "%u", EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, "\n\t table_id %s", tok2str(tableid_str, "%u", EXTRACT_U_1(cp)))); cp += 1; /* pad */ ND_TCHECK2(*cp, 3); @@ -2018,25 +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_BE_32BITS(cp))); - of10_bitmap_print(ndo, ofpfw_bm, EXTRACT_BE_32BITS(cp), + ND_PRINT((ndo, "\n\t wildcards 0x%08x", EXTRACT_BE_U_4(cp))); + of10_bitmap_print(ndo, ofpfw_bm, EXTRACT_BE_U_4(cp), OFPFW_U); cp += 4; /* max_entries */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "\n\t max_entries %u", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, "\n\t max_entries %u", EXTRACT_BE_U_4(cp))); cp += 4; /* active_count */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", active_count %u", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, ", active_count %u", EXTRACT_BE_U_4(cp))); cp += 4; /* lookup_count */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", lookup_count %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", lookup_count %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* matched_count */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", matched_count %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", matched_count %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; len -= OF_TABLE_STATS_LEN; @@ -2065,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_BE_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp)))); cp += 2; if (ndo->ndo_vflag < 2) { ND_TCHECK2(*cp, OF_PORT_STATS_LEN - 2); @@ -2077,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_BE_64BITS(cp))); + ND_PRINT((ndo, ", rx_packets %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* tx_packets */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* rx_bytes */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", rx_bytes %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", rx_bytes %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* tx_bytes */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* rx_dropped */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", rx_dropped %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", rx_dropped %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* tx_dropped */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", tx_dropped %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", tx_dropped %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* rx_errors */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", rx_errors %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", rx_errors %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* tx_errors */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* rx_frame_err */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", rx_frame_err %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", rx_frame_err %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* rx_over_err */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", rx_over_err %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", rx_over_err %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* rx_crc_err */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", rx_crc_err %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", rx_crc_err %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* collisions */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", collisions %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", collisions %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; next_port: len -= OF_PORT_STATS_LEN; @@ -2150,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_BE_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp)))); cp += 2; /* pad */ ND_TCHECK2(*cp, 2); cp += 2; /* queue_id */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", queue_id %u", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, ", queue_id %u", EXTRACT_BE_U_4(cp))); cp += 4; /* tx_bytes */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* tx_packets */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* tx_errors */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; len -= OF_QUEUE_STATS_LEN; @@ -2195,13 +2195,13 @@ of10_stats_reply_print(netdissect_options *ndo, /* type */ ND_TCHECK2(*cp, 2); - type = EXTRACT_BE_16BITS(cp); + type = EXTRACT_BE_U_2(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_BE_16BITS(cp))); - of10_bitmap_print(ndo, ofpsf_reply_bm, EXTRACT_BE_16BITS(cp), + ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_U_2(cp))); + of10_bitmap_print(ndo, ofpsf_reply_bm, EXTRACT_BE_U_2(cp), OFPSF_REPLY_U); cp += 2; @@ -2237,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_BE_32BITS(cp))); + ND_PRINT((ndo, "\n\t buffer_id 0x%08x", EXTRACT_BE_U_4(cp))); cp += 4; /* in_port */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); + ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp)))); cp += 2; /* actions_len */ ND_TCHECK2(*cp, 2); - actions_len = EXTRACT_BE_16BITS(cp); + actions_len = EXTRACT_BE_U_2(cp); cp += 2; if (actions_len > len - OF_PACKET_OUT_LEN) goto invalid; @@ -2271,19 +2271,19 @@ 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_BE_32BITS(cp)))); + ND_PRINT((ndo, "\n\t buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_BE_U_4(cp)))); cp += 4; /* total_len */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", total_len %u", EXTRACT_BE_16BITS(cp))); + ND_PRINT((ndo, ", total_len %u", EXTRACT_BE_U_2(cp))); cp += 2; /* in_port */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp)))); + ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp)))); cp += 2; /* reason */ ND_TCHECK2(*cp, 1); - ND_PRINT((ndo, ", reason %s", tok2str(ofpr_str, "invalid (0x%02x)", EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, ", reason %s", tok2str(ofpr_str, "invalid (0x%02x)", EXTRACT_U_1(cp)))); cp += 1; /* pad */ ND_TCHECK2(*cp, 1); @@ -2307,43 +2307,43 @@ 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_BE_64BITS(cp))); + ND_PRINT((ndo, "\n\t cookie 0x%016" PRIx64, EXTRACT_BE_U_8(cp))); cp += 8; /* priority */ ND_TCHECK2(*cp, 2); - if (EXTRACT_BE_16BITS(cp)) - ND_PRINT((ndo, ", priority %u", EXTRACT_BE_16BITS(cp))); + if (EXTRACT_BE_U_2(cp)) + ND_PRINT((ndo, ", priority %u", EXTRACT_BE_U_2(cp))); cp += 2; /* reason */ ND_TCHECK2(*cp, 1); - ND_PRINT((ndo, ", reason %s", tok2str(ofprr_str, "unknown (0x%02x)", EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, ", reason %s", tok2str(ofprr_str, "unknown (0x%02x)", EXTRACT_U_1(cp)))); cp += 1; /* pad */ ND_TCHECK2(*cp, 1); cp += 1; /* duration_sec */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", duration_sec %u", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, ", duration_sec %u", EXTRACT_BE_U_4(cp))); cp += 4; /* duration_nsec */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_BE_U_4(cp))); cp += 4; /* idle_timeout */ ND_TCHECK2(*cp, 2); - if (EXTRACT_BE_16BITS(cp)) - ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_16BITS(cp))); + if (EXTRACT_BE_U_2(cp)) + ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_U_2(cp))); cp += 2; /* pad2 */ ND_TCHECK2(*cp, 2); cp += 2; /* packet_count */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_BE_U_8(cp))); cp += 8; /* byte_count */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_64BITS(cp))); + ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_U_8(cp))); return cp + 8; trunc: @@ -2361,7 +2361,7 @@ of10_error_print(netdissect_options *ndo, /* type */ ND_TCHECK2(*cp, 2); - type = EXTRACT_BE_16BITS(cp); + type = EXTRACT_BE_U_2(cp); cp += 2; ND_PRINT((ndo, "\n\t type %s", tok2str(ofpet_str, "invalid (0x%04x)", type))); /* code */ @@ -2374,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_BE_16BITS(cp)))); + ND_PRINT((ndo, ", code %s", tok2str(code_str, "invalid (0x%04x)", EXTRACT_BE_U_2(cp)))); cp += 2; /* data */ return of10_data_print(ndo, cp, ep, len - OF_ERROR_MSG_LEN); @@ -2420,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_BE_16BITS(cp)))); + ND_PRINT((ndo, "\n\t flags %s", tok2str(ofp_config_str, "invalid (0x%04x)", EXTRACT_BE_U_2(cp)))); cp += 2; /* miss_send_len */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", miss_send_len %u", EXTRACT_BE_16BITS(cp))); + ND_PRINT((ndo, ", miss_send_len %u", EXTRACT_BE_U_2(cp))); return cp + 2; case OFPT_PORT_MOD: if (len != OF_PORT_MOD_LEN) @@ -2439,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_BE_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp)))); cp += 2; /* pad */ ND_TCHECK2(*cp, 2); @@ -2457,7 +2457,7 @@ of10_header_body_print(netdissect_options *ndo, goto next_message; /* reason */ ND_TCHECK2(*cp, 1); - ND_PRINT((ndo, "\n\t reason %s", tok2str(ofppr_str, "invalid (0x%02x)", EXTRACT_8BITS(cp)))); + ND_PRINT((ndo, "\n\t reason %s", tok2str(ofppr_str, "invalid (0x%02x)", EXTRACT_U_1(cp)))); cp += 1; /* pad */ ND_TCHECK2(*cp, 7); @@ -2548,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_BE_16BITS(cp)))); + ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp)))); cp += 2; /* pad */ ND_TCHECK2(*cp, 6); diff --git a/print-openflow.c b/print-openflow.c index 4918faf7..92956292 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_BE_16BITS(cp); + length = EXTRACT_BE_U_2(cp); cp += 2; /* xid */ ND_TCHECK2(*cp, 4); - xid = EXTRACT_BE_32BITS(cp); + xid = EXTRACT_BE_U_4(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 fa0c8f02..b33d90c3 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_BE_16BITS(tptr); - tlv_length = EXTRACT_BE_16BITS(tptr + 2); + tlv_type = EXTRACT_BE_U_2(tptr); + tlv_length = EXTRACT_BE_U_2(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_BE_32BITS(tptr))); + ND_PRINT((ndo, "%us", EXTRACT_BE_U_4(tptr))); break; case LS_OPAQUE_GRACE_TLV_REASON: @@ -230,7 +230,7 @@ ospf_print_grace_lsa(netdissect_options *ndo, return -1; } ND_PRINT((ndo, "%s (%u)", - tok2str(lsa_opaque_grace_tlv_reason_values, "Unknown", EXTRACT_8BITS(tptr)), + tok2str(lsa_opaque_grace_tlv_reason_values, "Unknown", EXTRACT_U_1(tptr)), *tptr)); break; @@ -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_BE_16BITS(tptr); - tlv_length = EXTRACT_BE_16BITS(tptr + 2); + tlv_type = EXTRACT_BE_U_2(tptr); + tlv_length = EXTRACT_BE_U_2(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_BE_16BITS(tptr); - subtlv_length = EXTRACT_BE_16BITS(tptr + 2); + subtlv_type = EXTRACT_BE_U_2(tptr); + subtlv_length = EXTRACT_BE_U_2(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_BE_32BITS(tptr))); + ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_U_4(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_BE_32BITS(tptr))); + EXTRACT_BE_U_4(tptr))); if (subtlv_length == 8) /* rfc4203 */ ND_PRINT((ndo, ", %s (0x%08x)", ipaddr_string(ndo, tptr+4), - EXTRACT_BE_32BITS(tptr + 4))); + EXTRACT_BE_U_4(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_BE_32BITS(tptr); + bw.i = EXTRACT_BE_U_4(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_BE_32BITS(tptr + te_class * 4); + bw.i = EXTRACT_BE_U_4(tptr + te_class * 4); ND_PRINT((ndo, "\n\t\tTE-Class %u: %.3f Mbps", te_class, bw.f * 8 / 1000000)); @@ -382,7 +382,7 @@ ospf_print_te_lsa(netdissect_options *ndo, } /* BC Model Id (1 octet) + Reserved (3 octets) */ ND_PRINT((ndo, "\n\t\tBandwidth Constraints Model ID: %s (%u)", - tok2str(diffserv_te_bc_values, "unknown", EXTRACT_8BITS(tptr)), + tok2str(diffserv_te_bc_values, "unknown", EXTRACT_U_1(tptr)), *tptr)); if (subtlv_length % 4 != 0) { ND_PRINT((ndo, "\n\t\tlength %u != N x 4", subtlv_length)); @@ -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_BE_32BITS(tptr + 4 + te_class * 4); + bw.i = EXTRACT_BE_U_4(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_BE_32BITS(tptr))); + ND_PRINT((ndo, ", Metric %u", EXTRACT_BE_U_4(tptr))); break; case LS_OPAQUE_TE_LINK_SUBTLV_LINK_PROTECTION_TYPE: /* Protection Cap (1 octet) + Reserved ((3 octets) */ @@ -414,7 +414,7 @@ ospf_print_te_lsa(netdissect_options *ndo, goto invalid; } ND_PRINT((ndo, ", %s", - bittok2str(gmpls_link_prot_values, "none", EXTRACT_8BITS(tptr)))); + bittok2str(gmpls_link_prot_values, "none", EXTRACT_U_1(tptr)))); break; case LS_OPAQUE_TE_LINK_SUBTLV_INTF_SW_CAP_DESCR: if (subtlv_length < 36) { @@ -423,11 +423,11 @@ ospf_print_te_lsa(netdissect_options *ndo, } /* Switching Cap (1 octet) + Encoding (1) + Reserved (2) */ ND_PRINT((ndo, "\n\t\tInterface Switching Capability: %s", - tok2str(gmpls_switch_cap_values, "Unknown", EXTRACT_8BITS((tptr))))); + tok2str(gmpls_switch_cap_values, "Unknown", EXTRACT_U_1((tptr))))); ND_PRINT((ndo, "\n\t\tLSP Encoding: %s\n\t\tMax LSP Bandwidth:", - tok2str(gmpls_encoding_values, "Unknown", EXTRACT_8BITS((tptr + 1))))); + tok2str(gmpls_encoding_values, "Unknown", EXTRACT_U_1((tptr + 1))))); for (priority_level = 0; priority_level < 8; priority_level++) { - bw.i = EXTRACT_BE_32BITS(tptr + 4 + (priority_level * 4)); + bw.i = EXTRACT_BE_U_4(tptr + 4 + (priority_level * 4)); ND_PRINT((ndo, "\n\t\t priority level %d: %.3f Mbps", priority_level, bw.f * 8 / 1000000)); @@ -439,7 +439,7 @@ ospf_print_te_lsa(netdissect_options *ndo, goto invalid; } ND_PRINT((ndo, ", %s (%u)", - tok2str(lsa_opaque_te_tlv_link_type_sub_tlv_values,"unknown",EXTRACT_8BITS(tptr)), + tok2str(lsa_opaque_te_tlv_link_type_sub_tlv_values,"unknown",EXTRACT_U_1(tptr)), *tptr)); break; @@ -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_BE_32BITS(tptr); + bw.i = EXTRACT_BE_U_4(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_BE_16BITS(&lshp->ls_length); + ls_length = EXTRACT_BE_U_2(&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_BE_32BITS(&lshp->ls_seq), - EXTRACT_BE_16BITS(&lshp->ls_age), + EXTRACT_BE_U_4(&lshp->ls_seq), + EXTRACT_BE_U_2(&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_BE_24BITS(&lshp->un_lsa_id.opaque_field.opaque_id) + EXTRACT_BE_U_3(&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_BE_16BITS(&tos->metrics.tos_metric))); + EXTRACT_BE_U_2(&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_BE_16BITS(&lsap->lsa_un.un_rla.rla_count); + j = EXTRACT_BE_U_2(&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_BE_32BITS(lp); + ul = EXTRACT_BE_U_4(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_BE_32BITS(lp); + ul = EXTRACT_BE_U_4(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_BE_32BITS(&almp->asla_tosmetric); + ul = EXTRACT_BE_U_4(&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_BE_32BITS(&mcp->mcla_vtype)) { + switch (EXTRACT_BE_U_4(&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_BE_32BITS(&mcp->mcla_vtype))); + EXTRACT_BE_U_4(&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_BE_16BITS(tptr); - tlv_length = EXTRACT_BE_16BITS(tptr + 2); + tlv_type = EXTRACT_BE_U_2(tptr); + tlv_length = EXTRACT_BE_U_2(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_BE_32BITS(tptr)))); + bittok2str(lsa_opaque_ri_tlv_cap_values, "Unknown", EXTRACT_BE_U_4(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_BE_16BITS(&op->ospf_len); + length2 = EXTRACT_BE_U_2(&op->ospf_len); dptr = (const u_char *)op + length2; dataend = (const u_char *)op + length; - if (EXTRACT_BE_16BITS(&op->ospf_authtype) == OSPF_AUTH_MD5) { + if (EXTRACT_BE_U_2(&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_BE_16BITS(dptr))); + ND_PRINT((ndo, "\n\t LLS: checksum: 0x%04x", (u_int) EXTRACT_BE_U_2(dptr))); dptr += 2; ND_TCHECK2(*dptr, 2); - length2 = EXTRACT_BE_16BITS(dptr); + length2 = EXTRACT_BE_U_2(dptr); ND_PRINT((ndo, ", length: %u", length2)); dptr += 2; ND_TCHECK(*dptr); while (dptr < dataend) { ND_TCHECK2(*dptr, 2); - lls_type = EXTRACT_BE_16BITS(dptr); + lls_type = EXTRACT_BE_U_2(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_BE_16BITS(dptr); + lls_len = EXTRACT_BE_U_2(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_BE_32BITS(dptr); + lls_flags = EXTRACT_BE_U_4(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_BE_32BITS(dptr))); + ND_PRINT((ndo, "\n\t Sequence number: 0x%08x", EXTRACT_BE_U_4(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_BE_16BITS(&op->ospf_hello.hello_helloint), - EXTRACT_BE_32BITS(&op->ospf_hello.hello_deadint), + EXTRACT_BE_U_2(&op->ospf_hello.hello_helloint), + EXTRACT_BE_U_4(&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_BE_16BITS(&op->ospf_db.db_ifmtu))); + ND_PRINT((ndo, ", MTU: %u", EXTRACT_BE_U_2(&op->ospf_db.db_ifmtu))); } ND_TCHECK(op->ospf_db.db_seq); - ND_PRINT((ndo, ", Sequence: 0x%08x", EXTRACT_BE_32BITS(&op->ospf_db.db_seq))); + ND_PRINT((ndo, ", Sequence: 0x%08x", EXTRACT_BE_U_4(&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_BE_32BITS(lsrp->ls_type)), - EXTRACT_BE_32BITS(&lsrp->ls_type))); + tok2str(lsa_values,"unknown",EXTRACT_BE_U_4(lsrp->ls_type)), + EXTRACT_BE_U_4(&lsrp->ls_type))); - switch (EXTRACT_BE_32BITS(lsrp->ls_type)) { + switch (EXTRACT_BE_U_4(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_BE_24BITS(&lsrp->un_ls_stateid.opaque_field.opaque_id))); + EXTRACT_BE_U_3(&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_BE_32BITS(&op->ospf_lsu.lsu_count); + lsa_count_max = EXTRACT_BE_U_4(&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_BE_16BITS(&op->ospf_authtype) == OSPF_AUTH_MD5) { + if (EXTRACT_BE_U_2(&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_BE_16BITS(&op->ospf_len)) { - ND_PRINT((ndo, " [len %d]", EXTRACT_BE_16BITS(&op->ospf_len))); + if (length != EXTRACT_BE_U_2(&op->ospf_len)) { + ND_PRINT((ndo, " [len %d]", EXTRACT_BE_U_2(&op->ospf_len))); } - if (length > EXTRACT_BE_16BITS(&op->ospf_len)) { - dataend = bp + EXTRACT_BE_16BITS(&op->ospf_len); + if (length > EXTRACT_BE_U_2(&op->ospf_len)) { + dataend = bp + EXTRACT_BE_U_2(&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_BE_16BITS(&op->ospf_authtype)), - EXTRACT_BE_16BITS(&op->ospf_authtype))); + tok2str(ospf_authtype_values, "unknown", EXTRACT_BE_U_2(&op->ospf_authtype)), + EXTRACT_BE_U_2(&op->ospf_authtype))); - switch (EXTRACT_BE_16BITS(&op->ospf_authtype)) { + switch (EXTRACT_BE_U_2(&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_BE_32BITS((op->ospf_authdata) + 4))); + EXTRACT_BE_U_4((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_BE_16BITS(&op->ospf_len)) { + if (length > EXTRACT_BE_U_2(&op->ospf_len)) { if (ospf_decode_lls(ndo, op, length)) goto trunc; } diff --git a/print-ospf6.c b/print-ospf6.c index ae57d2ab..8ce0fdf5 100644 --- a/print-ospf6.c +++ b/print-ospf6.c @@ -394,11 +394,11 @@ 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_BE_32BITS(&lshp->ls_seq), - EXTRACT_BE_16BITS(&lshp->ls_age), - EXTRACT_BE_16BITS(&lshp->ls_length)-(u_int)sizeof(struct lsa6_hdr))); + EXTRACT_BE_U_4(&lshp->ls_seq), + EXTRACT_BE_U_2(&lshp->ls_age), + EXTRACT_BE_U_2(&lshp->ls_length)-(u_int)sizeof(struct lsa6_hdr))); - ospf6_print_ls_type(ndo, EXTRACT_BE_16BITS(&lshp->ls_type), + ospf6_print_ls_type(ndo, EXTRACT_BE_U_2(&lshp->ls_type), &lshp->ls_stateid); return (0); @@ -436,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_BE_16BITS(&lsapp->lsa_p_metric))); + ND_PRINT((ndo, ", metric %u", EXTRACT_BE_U_2(&lsapp->lsa_p_metric))); return sizeof(*lsapp) - IPV6_ADDR_LEN_BYTES + wordlen * 4; trunc: @@ -474,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_BE_16BITS(&lsap->ls_hdr.ls_length); + length = EXTRACT_BE_U_2(&lsap->ls_hdr.ls_length); /* * The LSA length includes the length of the header; @@ -487,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_BE_16BITS(&lsap->ls_hdr.ls_type)) { + switch (EXTRACT_BE_U_2(&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); @@ -495,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_BE_32BITS(&lsap->lsa_un.un_rla.rla_options)))); + EXTRACT_BE_U_4(&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))); @@ -537,7 +537,7 @@ ospf6_print_lsa(netdissect_options *ndo, rlp->link_type)); return (0); } - ND_PRINT((ndo, ", metric %d", EXTRACT_BE_16BITS(&rlp->link_metric))); + ND_PRINT((ndo, ", metric %d", EXTRACT_BE_U_2(&rlp->link_metric))); rlp++; } break; @@ -549,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_BE_32BITS(&lsap->lsa_un.un_nla.nla_options)))); + EXTRACT_BE_U_4(&lsap->lsa_un.un_nla.nla_options)))); ND_PRINT((ndo, "\n\t Connected Routers:")); ap = lsap->lsa_un.un_nla.nla_router; @@ -569,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_BE_32BITS(&lsap->lsa_un.un_inter_ap.inter_ap_metric) & SLA_MASK_METRIC)); + EXTRACT_BE_U_4(&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) { @@ -586,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_BE_32BITS(&lsap->lsa_un.un_asla.asla_metric); + flags32 = EXTRACT_BE_U_4(&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_BE_32BITS(&lsap->lsa_un.un_asla.asla_metric) & + EXTRACT_BE_U_4(&lsap->lsa_un.un_asla.asla_metric) & ASLA_MASK_METRIC)); tptr = (const uint8_t *)lsap->lsa_un.un_asla.asla_prefix; @@ -644,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_BE_32BITS(&llsap->llsa_options)))); + EXTRACT_BE_U_4(&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_BE_32BITS(&llsap->llsa_nprefix); + prefixes = EXTRACT_BE_U_4(&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), @@ -674,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_BE_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_lstype), + EXTRACT_BE_U_2(&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_BE_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_nprefix); + prefixes = EXTRACT_BE_U_2(&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; @@ -740,21 +740,21 @@ ospf6_decode_v3(netdissect_options *ndo, ND_TCHECK_4(&hellop->hello_options); ND_PRINT((ndo, "\n\tOptions [%s]", bittok2str(ospf6_option_values, "none", - EXTRACT_BE_32BITS(&hellop->hello_options)))); + EXTRACT_BE_U_4(&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_BE_16BITS(&hellop->hello_helloint), - EXTRACT_BE_16BITS(&hellop->hello_deadint), + EXTRACT_BE_U_2(&hellop->hello_helloint), + EXTRACT_BE_U_2(&hellop->hello_deadint), ipaddr_string(ndo, &hellop->hello_ifid), hellop->hello_priority)); ND_TCHECK(hellop->hello_dr); - if (EXTRACT_BE_32BITS(&hellop->hello_dr) != 0) + if (EXTRACT_BE_U_4(&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_BE_32BITS(&hellop->hello_bdr) != 0) + if (EXTRACT_BE_U_4(&hellop->hello_bdr) != 0) ND_PRINT((ndo, ", Backup Designated Router %s", ipaddr_string(ndo, &hellop->hello_bdr))); if (ndo->ndo_vflag > 1) { @@ -775,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_BE_32BITS(&ddp->db_options)))); + EXTRACT_BE_U_4(&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_BE_16BITS(&ddp->db_mtu), - EXTRACT_BE_32BITS(&ddp->db_seq))); + EXTRACT_BE_U_2(&ddp->db_mtu), + EXTRACT_BE_U_4(&ddp->db_seq))); if (ndo->ndo_vflag > 1) { /* Print all the LS adv's */ lshp = ddp->db_lshdr; @@ -803,7 +803,7 @@ ospf6_decode_v3(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Advertising Router %s", ipaddr_string(ndo, &lsrp->ls_router))); ospf6_print_ls_type(ndo, - EXTRACT_BE_16BITS(&lsrp->ls_type), + EXTRACT_BE_U_2(&lsrp->ls_type), &lsrp->ls_stateid); ++lsrp; } @@ -815,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_BE_32BITS(&lsup->lsu_count); + i = EXTRACT_BE_U_4(&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_BE_16BITS(&lsap->ls_hdr.ls_length)); + EXTRACT_BE_U_2(&lsap->ls_hdr.ls_length)); } } break; @@ -857,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_BE_16BITS(cp))); + ND_PRINT((ndo, "\n\tLLS Checksum 0x%04x", EXTRACT_BE_U_2(cp))); cp += 2; /* LLS Data Length */ ND_TCHECK2(*cp, 2); - llsdatalen = EXTRACT_BE_16BITS(cp); + llsdatalen = EXTRACT_BE_U_2(cp); ND_PRINT((ndo, ", Data Length %u", llsdatalen)); if (llsdatalen < OSPF_LLS_HDRLEN || llsdatalen > len) goto trunc; @@ -888,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_BE_16BITS(cp)))); + ND_PRINT((ndo, "\n\tAuthentication Type %s", tok2str(ospf6_auth_type_str, "unknown (0x%04x)", EXTRACT_BE_U_2(cp)))); cp += 2; /* Auth Data Len */ ND_TCHECK2(*cp, 2); - authdatalen = EXTRACT_BE_16BITS(cp); + authdatalen = EXTRACT_BE_U_2(cp); ND_PRINT((ndo, ", Length %u", authdatalen)); if (authdatalen < OSPF6_AT_HDRLEN || authdatalen > len) goto trunc; @@ -902,15 +902,15 @@ ospf6_decode_at(netdissect_options *ndo, cp += 2; /* Security Association ID */ ND_TCHECK2(*cp, 2); - ND_PRINT((ndo, ", SAID %u", EXTRACT_BE_16BITS(cp))); + ND_PRINT((ndo, ", SAID %u", EXTRACT_BE_U_2(cp))); cp += 2; /* Cryptographic Sequence Number (High-Order 32 Bits) */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", CSN 0x%08x", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, ", CSN 0x%08x", EXTRACT_BE_U_4(cp))); cp += 4; /* Cryptographic Sequence Number (Low-Order 32 Bits) */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ":%08x", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, ":%08x", EXTRACT_BE_U_4(cp))); cp += 4; /* Authentication Data */ ND_TCHECK2(*cp, authdatalen - OSPF6_AT_HDRLEN); @@ -938,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_BE_32BITS(&hellop->hello_options) & OSPF6_OPTION_L) + if (EXTRACT_BE_U_4(&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_BE_32BITS(&ddp->db_options) & OSPF6_OPTION_L) + if (EXTRACT_BE_U_4(&ddp->db_options) & OSPF6_OPTION_L) lls_dd = 1; } if ((lls_hello || lls_dd) && (llslen = ospf6_print_lls(ndo, cp, len)) < 0) @@ -980,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_BE_16BITS(&op->ospf6_len); + datalen = EXTRACT_BE_U_2(&op->ospf6_len); if (datalen > length) { ND_PRINT((ndo, " [len %d]", datalen)); return; @@ -991,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_BE_32BITS(&op->ospf6_areaid) != 0) + if (EXTRACT_BE_U_4(&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 7c3e7b11..b500c2f6 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_BE_24BITS(bp))); + ND_PRINT((ndo, "overlay %u, ", EXTRACT_BE_U_3(bp))); bp += 3; ND_TCHECK2(*bp, 3); - ND_PRINT((ndo, "instance %u\n", EXTRACT_BE_24BITS(bp))); + ND_PRINT((ndo, "instance %u\n", EXTRACT_BE_U_3(bp))); bp += 3; /* Reserved */ diff --git a/print-pflog.c b/print-pflog.c index 387a89b3..d53fea81 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_BE_32BITS(&hdr->rulenr); - subrulenr = EXTRACT_BE_32BITS(&hdr->subrulenr); + rulenr = EXTRACT_BE_U_4(&hdr->rulenr); + subrulenr = EXTRACT_BE_U_4(&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 906b2959..723a074d 100644 --- a/print-pgm.c +++ b/print-pgm.c @@ -177,8 +177,8 @@ pgm_print(netdissect_options *ndo, return; } - sport = EXTRACT_BE_16BITS(&pgm->pgm_sport); - dport = EXTRACT_BE_16BITS(&pgm->pgm_dport); + sport = EXTRACT_BE_U_2(&pgm->pgm_sport); + dport = EXTRACT_BE_U_2(&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_BE_16BITS(&pgm->pgm_length))); + ND_PRINT((ndo, "PGM, length %u", EXTRACT_BE_U_2(&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_BE_16BITS(&spm->pgms_nla_afi)) { + switch (EXTRACT_BE_U_2(&spm->pgms_nla_afi)) { case AFNUM_INET: ND_TCHECK2(*bp, sizeof(struct in_addr)); addrtostr(bp, nla_buf, sizeof(nla_buf)); @@ -243,9 +243,9 @@ pgm_print(netdissect_options *ndo, } ND_PRINT((ndo, "SPM seq %u trail %u lead %u nla %s", - EXTRACT_BE_32BITS(&spm->pgms_seq), - EXTRACT_BE_32BITS(&spm->pgms_trailseq), - EXTRACT_BE_32BITS(&spm->pgms_leadseq), + EXTRACT_BE_U_4(&spm->pgms_seq), + EXTRACT_BE_U_4(&spm->pgms_trailseq), + EXTRACT_BE_U_4(&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_BE_32BITS(&poll_msg->pgmp_seq), - EXTRACT_BE_16BITS(&poll_msg->pgmp_round))); + EXTRACT_BE_U_4(&poll_msg->pgmp_seq), + EXTRACT_BE_U_2(&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_BE_16BITS(&polr->pgmp_nla_afi)) { + switch (EXTRACT_BE_U_2(&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_BE_32BITS(bp); + ivl = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); ND_TCHECK2(*bp, sizeof(uint32_t)); - rnd = EXTRACT_BE_32BITS(bp); + rnd = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); ND_TCHECK2(*bp, sizeof(uint32_t)); - mask = EXTRACT_BE_32BITS(bp); + mask = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); ND_PRINT((ndo, "POLR seq %u round %u nla %s ivl %u rnd 0x%08x " - "mask 0x%08x", EXTRACT_BE_32BITS(&polr->pgmp_seq), - EXTRACT_BE_16BITS(&polr->pgmp_round), nla_buf, ivl, rnd, mask)); + "mask 0x%08x", EXTRACT_BE_U_4(&polr->pgmp_seq), + EXTRACT_BE_U_2(&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_BE_32BITS(&odata->pgmd_trailseq), - EXTRACT_BE_32BITS(&odata->pgmd_seq))); + EXTRACT_BE_U_4(&odata->pgmd_trailseq), + EXTRACT_BE_U_4(&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_BE_32BITS(&rdata->pgmd_trailseq), - EXTRACT_BE_32BITS(&rdata->pgmd_seq))); + EXTRACT_BE_U_4(&rdata->pgmd_trailseq), + EXTRACT_BE_U_4(&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_BE_16BITS(&nak->pgmn_source_afi)) { + switch (EXTRACT_BE_U_2(&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_2(bp); - switch (EXTRACT_BE_16BITS(bp)) { + switch (EXTRACT_BE_U_2(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_BE_32BITS(&nak->pgmn_seq))); + source_buf, group_buf, EXTRACT_BE_U_4(&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_BE_32BITS(&ack->pgma_rx_max_seq))); + EXTRACT_BE_U_4(&ack->pgma_rx_max_seq))); bp = (const u_char *) (ack + 1); break; } @@ -433,19 +433,19 @@ pgm_print(netdissect_options *ndo, * That option header MUST be an OPT_LENGTH option * (see the first paragraph of section 9.1 in RFC 3208). */ - opt_type = EXTRACT_8BITS(bp); + opt_type = EXTRACT_U_1(bp); bp++; if ((opt_type & PGM_OPT_MASK) != PGM_OPT_LENGTH) { ND_PRINT((ndo, "[First option bad, should be PGM_OPT_LENGTH, is %u]", opt_type & PGM_OPT_MASK)); return; } - opt_len = EXTRACT_8BITS(bp); + opt_len = EXTRACT_U_1(bp); bp++; if (opt_len != 4) { ND_PRINT((ndo, "[Bad OPT_LENGTH option, length %u != 4]", opt_len)); return; } - opts_len = EXTRACT_BE_16BITS(bp); + opts_len = EXTRACT_BE_U_2(bp); if (opts_len < 4) { ND_PRINT((ndo, "[Bad total option length %u < 4]", opts_len)); return; @@ -463,9 +463,9 @@ pgm_print(netdissect_options *ndo, ND_PRINT((ndo, " [|OPT]")); return; } - opt_type = EXTRACT_8BITS(bp); + opt_type = EXTRACT_U_1(bp); bp++; - opt_len = EXTRACT_8BITS(bp); + opt_len = EXTRACT_U_1(bp); bp++; if (opt_len < PGM_MIN_OPT_LEN) { ND_PRINT((ndo, "[Bad option, length %u < %u]", opt_len, @@ -489,7 +489,7 @@ pgm_print(netdissect_options *ndo, opt_len, PGM_OPT_LENGTH_LEN)); return; } - ND_PRINT((ndo, " OPTS LEN (extra?) %d", EXTRACT_BE_16BITS(bp))); + ND_PRINT((ndo, " OPTS LEN (extra?) %d", EXTRACT_BE_U_2(bp))); bp += 2; opts_len -= PGM_OPT_LENGTH_LEN; break; @@ -502,11 +502,11 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - seq = EXTRACT_BE_32BITS(bp); + seq = EXTRACT_BE_U_4(bp); bp += 4; - offset = EXTRACT_BE_32BITS(bp); + offset = EXTRACT_BE_U_4(bp); bp += 4; - len = EXTRACT_BE_32BITS(bp); + len = EXTRACT_BE_U_4(bp); bp += 4; ND_PRINT((ndo, " FRAG seq %u off %u len %u", seq, offset, len)); opts_len -= PGM_OPT_FRAGMENT_LEN; @@ -522,7 +522,7 @@ pgm_print(netdissect_options *ndo, return; } ND_TCHECK2(*bp, 4); - ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(bp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(bp))); bp += 4; opt_len -= 4; opts_len -= 4; @@ -537,7 +537,7 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - seq = EXTRACT_BE_32BITS(bp); + seq = EXTRACT_BE_U_4(bp); bp += 4; ND_PRINT((ndo, " JOIN %u", seq)); opts_len -= PGM_OPT_JOIN_LEN; @@ -551,9 +551,9 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - offset = EXTRACT_BE_32BITS(bp); + offset = EXTRACT_BE_U_4(bp); bp += 4; - seq = EXTRACT_BE_32BITS(bp); + seq = EXTRACT_BE_U_4(bp); bp += 4; ND_PRINT((ndo, " BACKOFF ivl %u ivlseq %u", offset, seq)); opts_len -= PGM_OPT_NAK_BO_IVL_LEN; @@ -567,9 +567,9 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - offset = EXTRACT_BE_32BITS(bp); + offset = EXTRACT_BE_U_4(bp); bp += 4; - seq = EXTRACT_BE_32BITS(bp); + seq = EXTRACT_BE_U_4(bp); bp += 4; ND_PRINT((ndo, " BACKOFF max %u min %u", offset, seq)); opts_len -= PGM_OPT_NAK_BO_RNG_LEN; @@ -583,7 +583,7 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - nla_afnum = EXTRACT_BE_16BITS(bp); + nla_afnum = EXTRACT_BE_U_2(bp); bp += 2+2; switch (nla_afnum) { case AFNUM_INET: @@ -624,7 +624,7 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - len = EXTRACT_BE_32BITS(bp); + len = EXTRACT_BE_U_4(bp); bp += 4; ND_PRINT((ndo, " PARITY MAXTGS %u", len)); opts_len -= PGM_OPT_PARITY_PRM_LEN; @@ -638,7 +638,7 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - seq = EXTRACT_BE_32BITS(bp); + seq = EXTRACT_BE_U_4(bp); bp += 4; ND_PRINT((ndo, " PARITY GROUP %u", seq)); opts_len -= PGM_OPT_PARITY_GRP_LEN; @@ -652,7 +652,7 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - len = EXTRACT_BE_32BITS(bp); + len = EXTRACT_BE_U_4(bp); bp += 4; ND_PRINT((ndo, " PARITY ATGS %u", len)); opts_len -= PGM_OPT_CURR_TGSIZE_LEN; @@ -738,9 +738,9 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - offset = EXTRACT_BE_32BITS(bp); + offset = EXTRACT_BE_U_4(bp); bp += 4; - nla_afnum = EXTRACT_BE_16BITS(bp); + nla_afnum = EXTRACT_BE_U_2(bp); bp += 2+2; switch (nla_afnum) { case AFNUM_INET: @@ -781,9 +781,9 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - offset = EXTRACT_BE_32BITS(bp); + offset = EXTRACT_BE_U_4(bp); bp += 4; - nla_afnum = EXTRACT_BE_16BITS(bp); + nla_afnum = EXTRACT_BE_U_2(bp); bp += 2+2; switch (nla_afnum) { case AFNUM_INET: @@ -832,7 +832,7 @@ pgm_print(netdissect_options *ndo, if (ndo->ndo_packettype == PT_PGM_ZMTP1 && (pgm->pgm_type == PGM_ODATA || pgm->pgm_type == PGM_RDATA)) zmtp1_datagram_print(ndo, bp, - EXTRACT_BE_16BITS(&pgm->pgm_length)); + EXTRACT_BE_U_2(&pgm->pgm_length)); return; diff --git a/print-pim.c b/print-pim.c index 828a426a..859d7bc6 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_BE_16BITS(bp + 20)) + EXTRACT_BE_16BITS(bp + 22)) == 1) { + ((njoin = EXTRACT_BE_U_2(bp + 20)) + EXTRACT_BE_U_2(bp + 22)) == 1) { int hold; ND_PRINT((ndo, " RPF %s ", ipaddr_string(ndo, bp))); - hold = EXTRACT_BE_16BITS(bp + 6); + hold = EXTRACT_BE_U_2(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_BE_32BITS(bp + 16) != 0xffffffff) + if (EXTRACT_BE_U_4(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_BE_16BITS(bp + 2)); + unsigned_relts_print(ndo, EXTRACT_BE_U_2(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_BE_32BITS(bp) != 0xffffffff) + if (EXTRACT_BE_U_4(bp) != 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_BE_16BITS(bp); - nprune = EXTRACT_BE_16BITS(bp + 2); + njoin = EXTRACT_BE_U_2(bp); + nprune = EXTRACT_BE_U_2(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_BE_16BITS(bp + 10)); + unsigned_relts_print(ndo, EXTRACT_BE_U_2(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_BE_32BITS(bp + 12) != 0xffffffff) + if (EXTRACT_BE_U_4(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_BE_16BITS(bp + 22)); + unsigned_relts_print(ndo, EXTRACT_BE_U_2(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_BE_32BITS(bp + 12) != 0xffffffff) + if (EXTRACT_BE_U_4(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_BE_32BITS(bp + 20) & 0x7fffffff, - EXTRACT_BE_32BITS(bp + 24))); + EXTRACT_BE_U_4(bp + 20) & 0x7fffffff, + EXTRACT_BE_U_4(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_BE_16BITS(bp + 2); + hold = EXTRACT_BE_U_2(bp + 2); if (hold) - unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp + 2)); + unsigned_relts_print(ndo, EXTRACT_BE_U_2(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_BE_16BITS(&pim->pim_cksum))); - if (EXTRACT_BE_16BITS(&pim->pim_cksum) == 0) { + ND_PRINT((ndo, ", cksum 0x%04x ", EXTRACT_BE_U_2(&pim->pim_cksum))); + if (EXTRACT_BE_U_2(&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_BE_16BITS(bp); - olen = EXTRACT_BE_16BITS(bp + 2); + otype = EXTRACT_BE_U_2(bp); + olen = EXTRACT_BE_U_2(bp + 2); ND_PRINT((ndo, "\n\t %s Option (%u), length %u, Value: ", tok2str(pimv2_hello_option_values, "Unknown", otype), otype, @@ -778,7 +778,7 @@ pimv2_print(netdissect_options *ndo, ND_PRINT((ndo, "ERROR: Option Length != 2 Bytes (%u)", olen)); } else { unsigned_relts_print(ndo, - EXTRACT_BE_16BITS(bp)); + EXTRACT_BE_U_2(bp)); } break; @@ -788,8 +788,8 @@ pimv2_print(netdissect_options *ndo, } else { char t_bit; uint16_t lan_delay, override_interval; - lan_delay = EXTRACT_BE_16BITS(bp); - override_interval = EXTRACT_BE_16BITS(bp + 2); + lan_delay = EXTRACT_BE_U_2(bp); + override_interval = EXTRACT_BE_U_2(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", @@ -804,7 +804,7 @@ pimv2_print(netdissect_options *ndo, ND_PRINT((ndo, "Bi-Directional Capability (Old)")); break; case 4: - ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(bp))); + ND_PRINT((ndo, "%u", EXTRACT_BE_U_4(bp))); break; default: ND_PRINT((ndo, "ERROR: Option Length != 4 Bytes (%u)", olen)); @@ -816,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_BE_32BITS(bp))); + ND_PRINT((ndo, "0x%08x", EXTRACT_BE_U_4(bp))); } break; @@ -829,8 +829,8 @@ pimv2_print(netdissect_options *ndo, ND_PRINT((ndo, ", interval ")); unsigned_relts_print(ndo, *(bp+1)); } - if (EXTRACT_BE_16BITS(bp + 2) != 0) { - ND_PRINT((ndo, " ?0x%04x?", EXTRACT_BE_16BITS(bp + 2))); + if (EXTRACT_BE_U_2(bp + 2) != 0) { + ND_PRINT((ndo, " ?0x%04x?", EXTRACT_BE_U_2(bp + 2))); } } break; @@ -878,7 +878,7 @@ pimv2_print(netdissect_options *ndo, ND_PRINT((ndo, ", Flags [ %s ]\n\t", tok2str(pimv2_register_flag_values, "none", - EXTRACT_BE_32BITS(bp)))); + EXTRACT_BE_U_4(bp)))); bp += 4; len -= 4; /* encapsulated multicast packet */ @@ -977,7 +977,7 @@ pimv2_print(netdissect_options *ndo, goto trunc; ND_TCHECK2(*bp, 4); ngroup = bp[1]; - holdtime = EXTRACT_BE_16BITS(bp + 2); + holdtime = EXTRACT_BE_U_2(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: ")); @@ -995,8 +995,8 @@ pimv2_print(netdissect_options *ndo, if (len < 4) goto trunc; ND_TCHECK2(*bp, 4); - njoin = EXTRACT_BE_16BITS(bp); - nprune = EXTRACT_BE_16BITS(bp + 2); + njoin = EXTRACT_BE_U_2(bp); + nprune = EXTRACT_BE_U_2(bp + 2); ND_PRINT((ndo, ", joined sources: %u, pruned sources: %u", njoin, nprune)); bp += 4; len -= 4; for (j = 0; j < njoin; j++) { @@ -1023,7 +1023,7 @@ pimv2_print(netdissect_options *ndo, if (len < 2) goto trunc; ND_TCHECK_2(bp); - ND_PRINT((ndo, " tag=%x", EXTRACT_BE_16BITS(bp))); + ND_PRINT((ndo, " tag=%x", EXTRACT_BE_U_2(bp))); bp += 2; len -= 2; if (len < 1) @@ -1082,7 +1082,7 @@ pimv2_print(netdissect_options *ndo, ND_TCHECK_2(bp); ND_PRINT((ndo, ",holdtime=")); unsigned_relts_print(ndo, - EXTRACT_BE_16BITS(bp)); + EXTRACT_BE_U_2(bp)); if (len < 3) goto trunc; ND_TCHECK(bp[2]); @@ -1110,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_BE_32BITS(bp) & 0x7fffffff)); - ND_PRINT((ndo, " metric=%u", EXTRACT_BE_32BITS(bp + 4))); + ND_PRINT((ndo, " pref=%u", EXTRACT_BE_U_4(bp) & 0x7fffffff)); + ND_PRINT((ndo, " metric=%u", EXTRACT_BE_U_4(bp + 4))); break; case PIMV2_TYPE_CANDIDATE_RP: @@ -1132,7 +1132,7 @@ pimv2_print(netdissect_options *ndo, goto trunc; ND_TCHECK_2(&bp[2]); ND_PRINT((ndo, " holdtime=")); - unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp + 2)); + unsigned_relts_print(ndo, EXTRACT_BE_U_2(bp + 2)); bp += 4; len -= 4; @@ -1174,7 +1174,7 @@ pimv2_print(netdissect_options *ndo, goto trunc; ND_TCHECK_2(bp); ND_PRINT((ndo, " TUNR ")); - unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp)); + unsigned_relts_print(ndo, EXTRACT_BE_U_2(bp)); break; diff --git a/print-pktap.c b/print-pktap.c index 4a295fdf..1d5c7647 100644 --- a/print-pktap.c +++ b/print-pktap.c @@ -76,8 +76,8 @@ pktap_header_print(netdissect_options *ndo, const u_char *bp, u_int length) hdr = (const pktap_header_t *)bp; - dlt = EXTRACT_LE_32BITS(&hdr->pkt_dlt); - hdrlen = EXTRACT_LE_32BITS(&hdr->pkt_len); + dlt = EXTRACT_LE_U_4(&hdr->pkt_dlt); + hdrlen = EXTRACT_LE_U_4(&hdr->pkt_len); dltname = pcap_datalink_val_to_name(dlt); if (!ndo->ndo_qflag) { ND_PRINT((ndo,"DLT %s (%d) len %d", @@ -111,8 +111,8 @@ pktap_if_print(netdissect_options *ndo, return (0); } hdr = (const pktap_header_t *)p; - dlt = EXTRACT_LE_32BITS(&hdr->pkt_dlt); - hdrlen = EXTRACT_LE_32BITS(&hdr->pkt_len); + dlt = EXTRACT_LE_U_4(&hdr->pkt_dlt); + hdrlen = EXTRACT_LE_U_4(&hdr->pkt_len); if (hdrlen < sizeof(pktap_header_t)) { /* * Claimed header length < structure length. @@ -136,7 +136,7 @@ pktap_if_print(netdissect_options *ndo, caplen -= hdrlen; p += hdrlen; - rectype = EXTRACT_LE_32BITS(&hdr->pkt_rectype); + rectype = EXTRACT_LE_U_4(&hdr->pkt_rectype); switch (rectype) { case PKT_REC_NONE: diff --git a/print-ppi.c b/print-ppi.c index 72cd1b86..9cd5fc1e 100644 --- a/print-ppi.c +++ b/print-ppi.c @@ -34,8 +34,8 @@ ppi_header_print(netdissect_options *ndo, const u_char *bp, u_int length) hdr = (const ppi_header_t *)bp; - len = EXTRACT_LE_16BITS(&hdr->ppi_len); - dlt = EXTRACT_LE_32BITS(&hdr->ppi_dlt); + len = EXTRACT_LE_U_2(&hdr->ppi_len); + dlt = EXTRACT_LE_U_4(&hdr->ppi_dlt); dltname = pcap_datalink_val_to_name(dlt); if (!ndo->ndo_qflag) { @@ -68,7 +68,7 @@ ppi_print(netdissect_options *ndo, } hdr = (const ppi_header_t *)p; - len = EXTRACT_LE_16BITS(&hdr->ppi_len); + len = EXTRACT_LE_U_2(&hdr->ppi_len); if (caplen < len) { /* * If we don't have the entire PPI header, don't @@ -81,7 +81,7 @@ ppi_print(netdissect_options *ndo, ND_PRINT((ndo, "[|ppi]")); return (len); } - dlt = EXTRACT_LE_32BITS(&hdr->ppi_dlt); + dlt = EXTRACT_LE_U_4(&hdr->ppi_dlt); if (ndo->ndo_eflag) ppi_header_print(ndo, p, length); diff --git a/print-ppp.c b/print-ppp.c index 7c039d8f..808fc3fd 100644 --- a/print-ppp.c +++ b/print-ppp.c @@ -429,13 +429,13 @@ handle_ctrl_proto(netdissect_options *ndo, goto trunc; ND_TCHECK2(*tptr, 2); - code = EXTRACT_8BITS(tptr); + code = EXTRACT_U_1(tptr); tptr++; ND_PRINT((ndo, "%s (0x%02x), id %u, length %u", tok2str(cpcodes, "Unknown Opcode",code), code, - EXTRACT_8BITS(tptr), /* ID */ + EXTRACT_U_1(tptr), /* ID */ length + 2)); tptr++; @@ -446,7 +446,7 @@ handle_ctrl_proto(netdissect_options *ndo, return; /* there may be a NULL confreq etc. */ ND_TCHECK2(*tptr, 2); - len = EXTRACT_BE_16BITS(tptr); + len = EXTRACT_BE_U_2(tptr); tptr += 2; ND_PRINT((ndo, "\n\tencoded length %u (=Option(s) length %u)", len, len - 4)); @@ -460,12 +460,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_BE_32BITS(tptr))); + ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr))); tptr += 4; ND_TCHECK2(*tptr, 3); ND_PRINT((ndo, " Vendor: %s (%u)", - tok2str(oui_values,"Unknown",EXTRACT_BE_24BITS(tptr)), - EXTRACT_BE_24BITS(tptr))); + tok2str(oui_values,"Unknown",EXTRACT_BE_U_3(tptr)), + EXTRACT_BE_U_3(tptr))); /* XXX: need to decode Kind and Value(s)? */ break; case CPCODES_CONF_REQ: @@ -521,8 +521,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_BE_16BITS(tptr)), - EXTRACT_BE_16BITS(tptr))); + tok2str(ppptype2str,"unknown", EXTRACT_BE_U_2(tptr)), + EXTRACT_BE_U_2(tptr))); /* XXX: need to decode Rejected-Information? - hexdump for now */ if (len > 6) { ND_PRINT((ndo, "\n\t Rejected Packet")); @@ -535,7 +535,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_BE_32BITS(tptr))); + ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr))); /* XXX: need to decode Data? - hexdump for now */ if (len > 8) { ND_PRINT((ndo, "\n\t -----trailing data-----")); @@ -547,7 +547,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_BE_32BITS(tptr))); + ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr))); /* RFC 1661 says this is intended to be human readable */ if (len > 8) { ND_PRINT((ndo, "\n\t Message\n\t ")); @@ -559,9 +559,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_BE_32BITS(tptr))); + ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr))); ND_TCHECK2(*(tptr + 4), 4); - ND_PRINT((ndo, ", Seconds-Remaining %us", EXTRACT_BE_32BITS(tptr + 4))); + ND_PRINT((ndo, ", Seconds-Remaining %us", EXTRACT_BE_U_4(tptr + 4))); /* XXX: need to decode Message? */ break; default: @@ -615,8 +615,8 @@ print_lcp_config_options(netdissect_options *ndo, } ND_TCHECK_3(p + 2); ND_PRINT((ndo, ": Vendor: %s (%u)", - tok2str(oui_values,"Unknown",EXTRACT_BE_24BITS(p + 2)), - EXTRACT_BE_24BITS(p + 2))); + tok2str(oui_values,"Unknown",EXTRACT_BE_U_3(p + 2)), + EXTRACT_BE_U_3(p + 2))); #if 0 ND_TCHECK(p[5]); ND_PRINT((ndo, ", kind: 0x%02x", p[5])); @@ -633,7 +633,7 @@ print_lcp_config_options(netdissect_options *ndo, return len; } ND_TCHECK_2(p + 2); - ND_PRINT((ndo, ": %u", EXTRACT_BE_16BITS(p + 2))); + ND_PRINT((ndo, ": %u", EXTRACT_BE_U_2(p + 2))); break; case LCPOPT_ACCM: if (len != 6) { @@ -641,7 +641,7 @@ print_lcp_config_options(netdissect_options *ndo, return len; } ND_TCHECK_4(p + 2); - ND_PRINT((ndo, ": 0x%08x", EXTRACT_BE_32BITS(p + 2))); + ND_PRINT((ndo, ": 0x%08x", EXTRACT_BE_U_4(p + 2))); break; case LCPOPT_AP: if (len < 4) { @@ -649,9 +649,9 @@ print_lcp_config_options(netdissect_options *ndo, return len; } ND_TCHECK_2(p + 2); - ND_PRINT((ndo, ": %s", tok2str(ppptype2str, "Unknown Auth Proto (0x04x)", EXTRACT_BE_16BITS(p + 2)))); + ND_PRINT((ndo, ": %s", tok2str(ppptype2str, "Unknown Auth Proto (0x04x)", EXTRACT_BE_U_2(p + 2)))); - switch (EXTRACT_BE_16BITS(p + 2)) { + switch (EXTRACT_BE_U_2(p + 2)) { case PPP_CHAP: ND_TCHECK(p[4]); ND_PRINT((ndo, ", %s", tok2str(authalg_values, "Unknown Auth Alg %u", p[4]))); @@ -671,7 +671,7 @@ print_lcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_2(p + 2); - if (EXTRACT_BE_16BITS(p + 2) == PPP_LQM) + if (EXTRACT_BE_U_2(p + 2) == PPP_LQM) ND_PRINT((ndo, ": LQR")); else ND_PRINT((ndo, ": unknown")); @@ -682,7 +682,7 @@ print_lcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_4(p + 2); - ND_PRINT((ndo, ": 0x%08x", EXTRACT_BE_32BITS(p + 2))); + ND_PRINT((ndo, ": 0x%08x", EXTRACT_BE_U_4(p + 2))); break; case LCPOPT_PFC: break; @@ -694,7 +694,7 @@ print_lcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_2(p + 2); - ND_PRINT((ndo, ": 0x%04x", EXTRACT_BE_16BITS(p + 2))); + ND_PRINT((ndo, ": 0x%04x", EXTRACT_BE_U_2(p + 2))); break; case LCPOPT_CBACK: if (len < 3) { @@ -713,7 +713,7 @@ print_lcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_2(p + 2); - ND_PRINT((ndo, ": %u", EXTRACT_BE_16BITS(p + 2))); + ND_PRINT((ndo, ": %u", EXTRACT_BE_U_2(p + 2))); break; case LCPOPT_MLED: if (len < 3) { @@ -823,8 +823,8 @@ handle_mlppp(netdissect_options *ndo, } ND_PRINT((ndo, "seq 0x%03x, Flags [%s], length %u", - (EXTRACT_BE_16BITS(p))&0x0fff, /* only support 12-Bit sequence space for now */ - bittok2str(ppp_ml_flag_values, "none", EXTRACT_8BITS(p) & 0xc0), + (EXTRACT_BE_U_2(p))&0x0fff, /* only support 12-Bit sequence space for now */ + bittok2str(ppp_ml_flag_values, "none", EXTRACT_U_1(p) & 0xc0), length)); } @@ -860,7 +860,7 @@ handle_chap(netdissect_options *ndo, p++; ND_TCHECK2(*p, 2); - len = EXTRACT_BE_16BITS(p); + len = EXTRACT_BE_U_2(p); p += 2; /* @@ -883,14 +883,14 @@ handle_chap(netdissect_options *ndo, ND_PRINT((ndo, ", Value ")); for (i = 0; i < val_size; i++) { ND_TCHECK(*p); - ND_PRINT((ndo, "%02x", EXTRACT_8BITS(p))); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(p))); p++; } name_size = len - (p - p0); ND_PRINT((ndo, ", Name ")); for (i = 0; i < name_size; i++) { ND_TCHECK(*p); - safeputchar(ndo, EXTRACT_8BITS(p)); + safeputchar(ndo, EXTRACT_U_1(p)); p++; } break; @@ -900,7 +900,7 @@ handle_chap(netdissect_options *ndo, ND_PRINT((ndo, ", Msg ")); for (i = 0; i< msg_size; i++) { ND_TCHECK(*p); - safeputchar(ndo, EXTRACT_8BITS(p)); + safeputchar(ndo, EXTRACT_U_1(p)); p++; } break; @@ -943,7 +943,7 @@ handle_pap(netdissect_options *ndo, p++; ND_TCHECK2(*p, 2); - len = EXTRACT_BE_16BITS(p); + len = EXTRACT_BE_U_2(p); p += 2; if ((int)len > length) { @@ -971,7 +971,7 @@ handle_pap(netdissect_options *ndo, ND_PRINT((ndo, ", Peer ")); for (i = 0; i < peerid_len; i++) { ND_TCHECK(*p); - safeputchar(ndo, EXTRACT_8BITS(p)); + safeputchar(ndo, EXTRACT_U_1(p)); p++; } @@ -985,7 +985,7 @@ handle_pap(netdissect_options *ndo, ND_PRINT((ndo, ", Name ")); for (i = 0; i < passwd_len; i++) { ND_TCHECK(*p); - safeputchar(ndo, EXTRACT_8BITS(p)); + safeputchar(ndo, EXTRACT_U_1(p)); p++; } break; @@ -1008,7 +1008,7 @@ handle_pap(netdissect_options *ndo, ND_PRINT((ndo, ", Msg ")); for (i = 0; i< msg_len; i++) { ND_TCHECK(*p); - safeputchar(ndo, EXTRACT_8BITS(p)); + safeputchar(ndo, EXTRACT_U_1(p)); p++; } break; @@ -1073,7 +1073,7 @@ print_ipcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_2(p + 2); - compproto = EXTRACT_BE_16BITS(p + 2); + compproto = EXTRACT_BE_U_2(p + 2); ND_PRINT((ndo, ": %s (0x%02x):", tok2str(ipcpopt_compproto_values, "Unknown", compproto), @@ -1093,11 +1093,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_BE_16BITS(p + 4), - EXTRACT_BE_16BITS(p + 6), - EXTRACT_BE_16BITS(p + 8), - EXTRACT_BE_16BITS(p + 10), - EXTRACT_BE_16BITS(p + 12))); + EXTRACT_BE_U_2(p + 4), + EXTRACT_BE_U_2(p + 6), + EXTRACT_BE_U_2(p + 8), + EXTRACT_BE_U_2(p + 10), + EXTRACT_BE_U_2(p + 12))); /* suboptions present ? */ if (len > IPCPOPT_IPCOMP_MINLEN) { @@ -1109,7 +1109,7 @@ print_ipcp_config_options(netdissect_options *ndo, while (ipcomp_subopttotallen >= 2) { ND_TCHECK2(*p, 2); ipcomp_subopt = *p; - ipcomp_suboptlen = EXTRACT_8BITS(p + 1); + ipcomp_suboptlen = EXTRACT_U_1(p + 1); /* sanity check */ if (ipcomp_subopt == 0 || @@ -1200,10 +1200,10 @@ print_ip6cp_config_options(netdissect_options *ndo, } ND_TCHECK2(*(p + 2), 8); ND_PRINT((ndo, ": %04x:%04x:%04x:%04x", - EXTRACT_BE_16BITS(p + 2), - EXTRACT_BE_16BITS(p + 4), - EXTRACT_BE_16BITS(p + 6), - EXTRACT_BE_16BITS(p + 8))); + EXTRACT_BE_U_2(p + 2), + EXTRACT_BE_U_2(p + 4), + EXTRACT_BE_U_2(p + 6), + EXTRACT_BE_U_2(p + 8))); break; default: /* @@ -1354,7 +1354,7 @@ print_bacp_config_options(netdissect_options *ndo, return len; } ND_TCHECK_4(p + 2); - ND_PRINT((ndo, ": Magic-Num 0x%08x", EXTRACT_BE_32BITS(p + 2))); + ND_PRINT((ndo, ": Magic-Num 0x%08x", EXTRACT_BE_U_4(p + 2))); break; default: /* @@ -1397,13 +1397,13 @@ ppp_hdlc(netdissect_options *ndo, * contents. */ for (s = p, t = b, i = length; i > 0 && ND_TTEST(*s); i--) { - c = EXTRACT_8BITS(s); + c = EXTRACT_U_1(s); s++; if (c == 0x7d) { if (i <= 1 || !ND_TTEST(*s)) break; i--; - c = EXTRACT_8BITS(s) ^ 0x20; + c = EXTRACT_U_1(s) ^ 0x20; s++; } *t++ = c; @@ -1431,13 +1431,13 @@ ppp_hdlc(netdissect_options *ndo, if (length < 2) goto trunc; - proto = EXTRACT_BE_16BITS(b); /* next guess - load two octets */ + proto = EXTRACT_BE_U_2(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_BE_16BITS(b + 2); /* load the PPP proto-id */ + proto = EXTRACT_BE_U_2(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 */ @@ -1535,7 +1535,7 @@ ppp_print(netdissect_options *ndo, if (length < 2) goto trunc; ND_TCHECK2(*p, 2); - ppp_header = EXTRACT_BE_16BITS(p); + ppp_header = EXTRACT_BE_U_2(p); switch(ppp_header) { case (PPP_WITHDIRECTION_IN << 8 | PPP_CONTROL): @@ -1570,7 +1570,7 @@ ppp_print(netdissect_options *ndo, hdr_len++; } else { ND_TCHECK2(*p, 2); - proto = EXTRACT_BE_16BITS(p); + proto = EXTRACT_BE_U_2(p); p += 2; length -= 2; hdr_len += 2; @@ -1686,7 +1686,7 @@ ppp_hdlc_if_print(netdissect_options *ndo, length -= 2; hdrlen += 2; - proto = EXTRACT_BE_16BITS(p); + proto = EXTRACT_BE_U_2(p); p += 2; length -= 2; hdrlen += 2; @@ -1764,7 +1764,7 @@ ppp_bsdos_if_print(netdissect_options *ndo _U_, hdrlength += 1; } else { /* Un-compressed protocol field */ - ptype = EXTRACT_16BITS(p); + ptype = EXTRACT_BE_U_2(p); if (ndo->ndo_eflag) ND_PRINT((ndo, "%04x ", ptype)); p += 2; @@ -1784,7 +1784,7 @@ ppp_bsdos_if_print(netdissect_options *ndo _U_, && ph->phdr_ctl == PPP_CONTROL) { if (ndo->ndo_eflag) ND_PRINT((ndo, "%02x %02x ", q[0], q[1])); - ptype = EXTRACT_16BITS(&ph->phdr_type); + ptype = EXTRACT_BE_U_2(&ph->phdr_type); if (ndo->ndo_eflag && (ptype == PPP_VJC || ptype == PPP_VJNC)) { ND_PRINT((ndo, "%s ", tok2str(ppptype2str, "proto-#%d", ptype))); diff --git a/print-pppoe.c b/print-pppoe.c index 7ee7c729..85af9f09 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_BE_16BITS(pppoe_packet + 2); - pppoe_length = EXTRACT_BE_16BITS(pppoe_packet + 4); + pppoe_sessionid = EXTRACT_BE_U_2(pppoe_packet + 2); + pppoe_length = EXTRACT_BE_U_2(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_BE_16BITS(p); - tag_len = EXTRACT_BE_16BITS(p + 2); + tag_type = EXTRACT_BE_U_2(p); + tag_len = EXTRACT_BE_U_2(p + 2); p += 4; /* p points to tag_value */ diff --git a/print-pptp.c b/print-pptp.c index 3d691bc0..a3422370 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_BE_32BITS(bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK ? "D" : "", - EXTRACT_BE_32BITS(bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK ? "A" : "")); + EXTRACT_BE_U_4(bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK ? "D" : "", + EXTRACT_BE_U_4(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_BE_32BITS(bearer_type)))); + tok2str(pptp_btype_str, "?", EXTRACT_BE_U_4(bearer_type)))); } static void pptp_call_id_print(netdissect_options *ndo, const uint16_t *call_id) { - ND_PRINT((ndo, " CALL_ID(%u)", EXTRACT_BE_16BITS(call_id))); + ND_PRINT((ndo, " CALL_ID(%u)", EXTRACT_BE_U_2(call_id))); } static void pptp_call_ser_print(netdissect_options *ndo, const uint16_t *call_ser) { - ND_PRINT((ndo, " CALL_SER_NUM(%u)", EXTRACT_BE_16BITS(call_ser))); + ND_PRINT((ndo, " CALL_SER_NUM(%u)", EXTRACT_BE_U_2(call_ser))); } static void pptp_cause_code_print(netdissect_options *ndo, const uint16_t *cause_code) { - ND_PRINT((ndo, " CAUSE_CODE(%u)", EXTRACT_BE_16BITS(cause_code))); + ND_PRINT((ndo, " CAUSE_CODE(%u)", EXTRACT_BE_U_2(cause_code))); } static void pptp_conn_speed_print(netdissect_options *ndo, const uint32_t *conn_speed) { - ND_PRINT((ndo, " CONN_SPEED(%u)", EXTRACT_BE_32BITS(conn_speed))); + ND_PRINT((ndo, " CONN_SPEED(%u)", EXTRACT_BE_U_4(conn_speed))); } static const struct tok pptp_errcode_str[] = { @@ -338,7 +338,7 @@ pptp_err_code_print(netdissect_options *ndo, { ND_PRINT((ndo, " ERR_CODE(%u", *err_code)); if (ndo->ndo_vflag) { - ND_PRINT((ndo, ":%s", tok2str(pptp_errcode_str, "?", EXTRACT_8BITS(err_code)))); + ND_PRINT((ndo, ":%s", tok2str(pptp_errcode_str, "?", EXTRACT_U_1(err_code)))); } ND_PRINT((ndo, ")")); } @@ -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_BE_16BITS(firm_rev))); + ND_PRINT((ndo, " FIRM_REV(%u)", EXTRACT_BE_U_2(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_BE_32BITS(framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) { + if (EXTRACT_BE_U_4(framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) { ND_PRINT((ndo, "A")); /* Async */ } - if (EXTRACT_BE_32BITS(framing_cap) & PPTP_FRAMING_CAP_SYNC_MASK) { + if (EXTRACT_BE_U_4(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_BE_32BITS(framing_type)))); + tok2str(pptp_ftype_str, "?", EXTRACT_BE_U_4(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_BE_32BITS(id))); + ND_PRINT((ndo, " ID(%u)", EXTRACT_BE_U_4(id))); } static void pptp_max_channel_print(netdissect_options *ndo, const uint16_t *max_channel) { - ND_PRINT((ndo, " MAX_CHAN(%u)", EXTRACT_BE_16BITS(max_channel))); + ND_PRINT((ndo, " MAX_CHAN(%u)", EXTRACT_BE_U_2(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_BE_16BITS(peer_call_id))); + ND_PRINT((ndo, " PEER_CALL_ID(%u)", EXTRACT_BE_U_2(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_BE_32BITS(phy_chan_id))); + ND_PRINT((ndo, " PHY_CHAN_ID(%u)", EXTRACT_BE_U_4(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_BE_16BITS(pkt_proc_delay))); + ND_PRINT((ndo, " PROC_DELAY(%u)", EXTRACT_BE_U_2(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_BE_16BITS(proto_ver) >> 8, - EXTRACT_BE_16BITS(proto_ver) & 0xff)); + EXTRACT_BE_U_2(proto_ver) >> 8, + EXTRACT_BE_U_2(proto_ver) & 0xff)); } static void pptp_recv_winsiz_print(netdissect_options *ndo, const uint16_t *recv_winsiz) { - ND_PRINT((ndo, " RECV_WIN(%u)", EXTRACT_BE_16BITS(recv_winsiz))); + ND_PRINT((ndo, " RECV_WIN(%u)", EXTRACT_BE_U_2(recv_winsiz))); } static const struct tok pptp_scrrp_str[] = { @@ -493,7 +493,7 @@ pptp_result_code_print(netdissect_options *ndo, ctrl_msg_type == PPTP_CTRL_MSG_TYPE_CDN ? pptp_cdn_str : NULL; /* assertion error */ if (dict != NULL) - ND_PRINT((ndo, ":%s", tok2str(dict, "?", EXTRACT_8BITS(result_code)))); + ND_PRINT((ndo, ":%s", tok2str(dict, "?", EXTRACT_U_1(result_code)))); } ND_PRINT((ndo, ")")); } @@ -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_BE_32BITS(&ptr->min_bps))); + ND_PRINT((ndo, " MIN_BPS(%u)", EXTRACT_BE_U_4(&ptr->min_bps))); ND_TCHECK(ptr->max_bps); - ND_PRINT((ndo, " MAX_BPS(%u)", EXTRACT_BE_32BITS(&ptr->max_bps))); + ND_PRINT((ndo, " MAX_BPS(%u)", EXTRACT_BE_U_4(&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_BE_16BITS(&ptr->phone_no_len))); + ND_PRINT((ndo, " PHONE_NO_LEN(%u)", EXTRACT_BE_U_2(&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_BE_16BITS(&ptr->dialed_no_len))); + ND_PRINT((ndo, " DIALED_NO_LEN(%u)", EXTRACT_BE_U_2(&ptr->dialed_no_len))); ND_TCHECK(ptr->dialing_no_len); - ND_PRINT((ndo, " DIALING_NO_LEN(%u)", EXTRACT_BE_16BITS(&ptr->dialing_no_len))); + ND_PRINT((ndo, " DIALING_NO_LEN(%u)", EXTRACT_BE_U_2(&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_BE_32BITS(&ptr->crc_err))); + ND_PRINT((ndo, " CRC_ERR(%u)", EXTRACT_BE_U_4(&ptr->crc_err))); ND_TCHECK(ptr->framing_err); - ND_PRINT((ndo, " FRAMING_ERR(%u)", EXTRACT_BE_32BITS(&ptr->framing_err))); + ND_PRINT((ndo, " FRAMING_ERR(%u)", EXTRACT_BE_U_4(&ptr->framing_err))); ND_TCHECK(ptr->hardware_overrun); - ND_PRINT((ndo, " HARDWARE_OVERRUN(%u)", EXTRACT_BE_32BITS(&ptr->hardware_overrun))); + ND_PRINT((ndo, " HARDWARE_OVERRUN(%u)", EXTRACT_BE_U_4(&ptr->hardware_overrun))); ND_TCHECK(ptr->buffer_overrun); - ND_PRINT((ndo, " BUFFER_OVERRUN(%u)", EXTRACT_BE_32BITS(&ptr->buffer_overrun))); + ND_PRINT((ndo, " BUFFER_OVERRUN(%u)", EXTRACT_BE_U_4(&ptr->buffer_overrun))); ND_TCHECK(ptr->timeout_err); - ND_PRINT((ndo, " TIMEOUT_ERR(%u)", EXTRACT_BE_32BITS(&ptr->timeout_err))); + ND_PRINT((ndo, " TIMEOUT_ERR(%u)", EXTRACT_BE_U_4(&ptr->timeout_err))); ND_TCHECK(ptr->align_err); - ND_PRINT((ndo, " ALIGN_ERR(%u)", EXTRACT_BE_32BITS(&ptr->align_err))); + ND_PRINT((ndo, " ALIGN_ERR(%u)", EXTRACT_BE_U_4(&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_BE_32BITS(&ptr->send_accm))); + ND_PRINT((ndo, " SEND_ACCM(0x%08x)", EXTRACT_BE_U_4(&ptr->send_accm))); ND_TCHECK(ptr->recv_accm); - ND_PRINT((ndo, " RECV_ACCM(0x%08x)", EXTRACT_BE_32BITS(&ptr->recv_accm))); + ND_PRINT((ndo, " RECV_ACCM(0x%08x)", EXTRACT_BE_U_4(&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_BE_16BITS(&hdr->length))); + ND_PRINT((ndo, " Length=%u", EXTRACT_BE_U_2(&hdr->length))); } ND_TCHECK(hdr->msg_type); if (ndo->ndo_vflag) { - switch(EXTRACT_BE_16BITS(&hdr->msg_type)) { + switch(EXTRACT_BE_U_2(&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_BE_32BITS(&hdr->magic_cookie); + mc = EXTRACT_BE_U_4(&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_BE_16BITS(&hdr->ctrl_msg_type); + ctrl_msg_type = EXTRACT_BE_U_2(&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 0fe1f6f1..2e7dd78d 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_BE_16BITS(data))); + ND_PRINT((ndo, "Salt %u ", EXTRACT_BE_U_2(data))); data+=2; length-=2; break; @@ -625,14 +625,14 @@ print_attr_string(netdissect_options *ndo, if (length < 1) goto trunc; ND_PRINT((ndo, "%s (0x%02x) ", - tok2str(rfc4675_tagged,"Unknown tag",EXTRACT_8BITS(data)), + tok2str(rfc4675_tagged,"Unknown tag",EXTRACT_U_1(data)), *data)); data++; length--; break; } - for (i=0; i < length && EXTRACT_8BITS(data); i++, data++) + for (i=0; i < length && EXTRACT_U_1(data); i++, data++) ND_PRINT((ndo, "%c", (*data < 32 || *data > 126) ? '.' : *data)); return; @@ -656,7 +656,7 @@ print_vendor_attr(netdissect_options *ndo, if (length < 4) goto trunc; ND_TCHECK2(*data, 4); - vendor_id = EXTRACT_BE_32BITS(data); + vendor_id = EXTRACT_BE_U_4(data); data+=4; length-=4; @@ -668,7 +668,7 @@ print_vendor_attr(netdissect_options *ndo, ND_TCHECK2(*data, 2); vendor_type = *(data); - vendor_length = EXTRACT_8BITS(data + 1); + vendor_length = EXTRACT_U_1(data + 1); if (vendor_length < 2) { @@ -736,11 +736,11 @@ print_attr_num(netdissect_options *ndo, else ND_PRINT((ndo, "Tag[%d] ", *data)); data++; - data_value = EXTRACT_BE_24BITS(data); + data_value = EXTRACT_BE_U_3(data); } else { - data_value = EXTRACT_BE_32BITS(data); + data_value = EXTRACT_BE_U_4(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_BE_32BITS(data) == 0xFFFFFFFE ) + if (EXTRACT_BE_U_4(data) == 0xFFFFFFFE ) ND_PRINT((ndo, "NAS Select")); else - ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data))); + ND_PRINT((ndo, "%d", EXTRACT_BE_U_4(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_BE_32BITS(data); + timeout = EXTRACT_BE_U_4(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_BE_32BITS(data)) - ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data))); + if (EXTRACT_BE_U_4(data)) + ND_PRINT((ndo, "%d", EXTRACT_BE_U_4(data))); else ND_PRINT((ndo, "Unnumbered")); break; case FRM_ATALK_NETWORK: - if (EXTRACT_BE_32BITS(data)) - ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data))); + if (EXTRACT_BE_U_4(data)) + ND_PRINT((ndo, "%d", EXTRACT_BE_U_4(data))); else ND_PRINT((ndo, "NAS assigned")); break; @@ -800,19 +800,19 @@ print_attr_num(netdissect_options *ndo, else ND_PRINT((ndo, "Tag[Unused] ")); data++; - ND_PRINT((ndo, "%d", EXTRACT_BE_24BITS(data))); + ND_PRINT((ndo, "%d", EXTRACT_BE_U_3(data))); break; case EGRESS_VLAN_ID: ND_PRINT((ndo, "%s (0x%02x) ", - tok2str(rfc4675_tagged,"Unknown tag",EXTRACT_8BITS(data)), + tok2str(rfc4675_tagged,"Unknown tag",EXTRACT_U_1(data)), *data)); data++; - ND_PRINT((ndo, "%d", EXTRACT_BE_24BITS(data))); + ND_PRINT((ndo, "%d", EXTRACT_BE_U_3(data))); break; default: - ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data))); + ND_PRINT((ndo, "%d", EXTRACT_BE_U_4(data))); break; } /* switch */ @@ -848,10 +848,10 @@ print_attr_address(netdissect_options *ndo, { case FRM_IPADDR: case LOG_IPHOST: - if (EXTRACT_BE_32BITS(data) == 0xFFFFFFFF ) + if (EXTRACT_BE_U_4(data) == 0xFFFFFFFF ) ND_PRINT((ndo, "User Selected")); else - if (EXTRACT_BE_32BITS(data) == 0xFFFFFFFE ) + if (EXTRACT_BE_U_4(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_BE_32BITS(data); + attr_time = EXTRACT_BE_U_4(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_BE_32BITS(data); + error_cause_value = EXTRACT_BE_U_4(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_BE_16BITS(&rad->len); + len = EXTRACT_BE_U_2(&rad->len); if (len < MIN_RADIUS_LEN) { diff --git a/print-rip.c b/print-rip.c index 43f681b8..4a289af5 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_BE_16BITS(&ni->rip_family); + family = EXTRACT_BE_U_2(&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_BE_16BITS(&ni->rip_tag) || - EXTRACT_BE_32BITS(&ni->rip_dest_mask) || - EXTRACT_BE_32BITS(&ni->rip_router)) { + if (EXTRACT_BE_U_2(&ni->rip_tag) || + EXTRACT_BE_U_4(&ni->rip_dest_mask) || + EXTRACT_BE_U_4(&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_BE_32BITS(&ni->rip_metric))); + EXTRACT_BE_U_4(&ni->rip_metric))); return; } /* BSD_AFNUM_INET */ ND_PRINT((ndo, "\n\t %s, metric: %u", ipaddr_string(ndo, &ni->rip_dest), - EXTRACT_BE_32BITS(&ni->rip_metric))); + EXTRACT_BE_U_4(&ni->rip_metric))); } static unsigned @@ -130,9 +130,9 @@ rip_entry_print_v2(netdissect_options *ndo, { register u_short family; - family = EXTRACT_BE_16BITS(&ni->rip_family); + family = EXTRACT_BE_U_2(&ni->rip_family); if (family == 0xFFFF) { /* variable-sized authentication structures */ - uint16_t auth_type = EXTRACT_BE_16BITS(&ni->rip_tag); + uint16_t auth_type = EXTRACT_BE_U_2(&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_BE_16BITS((const uint8_t *)ni + 4))); + ND_PRINT((ndo, " Packet Len %u,", EXTRACT_BE_U_2((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_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))); + ND_PRINT((ndo, " SeqNo %u,", EXTRACT_BE_U_4(&ni->rip_dest_mask))); + ND_PRINT((ndo, " MBZ %u,", EXTRACT_BE_U_4(&ni->rip_router))); + ND_PRINT((ndo, " MBZ %u", EXTRACT_BE_U_4(&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_BE_16BITS(&ni->rip_tag))); + EXTRACT_BE_U_2(&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_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)) + mask2plen(EXTRACT_BE_U_4(&ni->rip_dest_mask)), + EXTRACT_BE_U_2(&ni->rip_tag), + EXTRACT_BE_U_4(&ni->rip_metric))); + if (EXTRACT_BE_U_4(&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 cf090245..19398931 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_BE_16BITS(&ni->rip6_tag))); + l += ND_PRINT((ndo, " [%d]", EXTRACT_BE_U_2(&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 69c69963..2c950fba 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_BE_32BITS(pdu_header->length); + pdu_len = EXTRACT_BE_U_4(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_BE_16BITS(pdu_header->u.session_id), - EXTRACT_BE_32BITS(msg))); + EXTRACT_BE_U_2(pdu_header->u.session_id), + EXTRACT_BE_U_4(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_BE_16BITS(pdu_header->u.session_id))); + EXTRACT_BE_U_2(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_BE_32BITS(pdu->as), pdu->flags)); + EXTRACT_BE_U_4(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_BE_32BITS(pdu->as), pdu->flags)); + EXTRACT_BE_U_4(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_BE_32BITS(pdu->encapsulated_pdu_length); + encapsulated_pdu_length = EXTRACT_BE_U_4(pdu->encapsulated_pdu_length); tlen += 4; - error_code = EXTRACT_BE_16BITS(pdu->pdu_header.u.error_code); + error_code = EXTRACT_BE_U_2(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_BE_32BITS(tptr + tlen); + text_length = EXTRACT_BE_U_4(tptr + tlen); tlen += 4; if (text_length) { diff --git a/print-rrcp.c b/print-rrcp.c index bbbd4334..5b612e83 100644 --- a/print-rrcp.c +++ b/print-rrcp.c @@ -98,9 +98,9 @@ rrcp_print(netdissect_options *ndo, uint8_t rrcp_opcode; ND_TCHECK(*(cp + RRCP_PROTO_OFFSET)); - rrcp_proto = EXTRACT_8BITS(cp + RRCP_PROTO_OFFSET); + rrcp_proto = EXTRACT_U_1(cp + RRCP_PROTO_OFFSET); ND_TCHECK(*(cp + RRCP_OPCODE_ISREPLY_OFFSET)); - rrcp_opcode = EXTRACT_8BITS((cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_OPCODE_MASK; + rrcp_opcode = EXTRACT_U_1((cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_OPCODE_MASK; if (src != NULL && dst != NULL) { ND_PRINT((ndo, "%s > %s, ", (src->addr_string)(ndo, src->addr), @@ -116,13 +116,13 @@ rrcp_print(netdissect_options *ndo, if (rrcp_opcode==1 || rrcp_opcode==2){ ND_TCHECK2(*(cp + RRCP_REG_ADDR_OFFSET), 6); ND_PRINT((ndo, " addr=0x%04x, data=0x%08x", - EXTRACT_LE_16BITS(cp + RRCP_REG_ADDR_OFFSET), - EXTRACT_LE_32BITS(cp + RRCP_REG_DATA_OFFSET))); + EXTRACT_LE_U_2(cp + RRCP_REG_ADDR_OFFSET), + EXTRACT_LE_U_4(cp + RRCP_REG_DATA_OFFSET))); } if (rrcp_proto==1){ ND_TCHECK2(*(cp + RRCP_AUTHKEY_OFFSET), 2); ND_PRINT((ndo, ", auth=0x%04x", - EXTRACT_BE_16BITS(cp + RRCP_AUTHKEY_OFFSET))); + EXTRACT_BE_U_2(cp + RRCP_AUTHKEY_OFFSET))); } if (rrcp_proto==1 && rrcp_opcode==0 && ((*(cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_ISREPLY)){ @@ -131,13 +131,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_BE_32BITS(cp + RRCP_VENDOR_ID_OFFSET), - EXTRACT_BE_16BITS(cp + RRCP_CHIP_ID_OFFSET))); + EXTRACT_BE_U_4(cp + RRCP_VENDOR_ID_OFFSET), + EXTRACT_BE_U_2(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_BE_32BITS(cp + RRCP_COOKIE2_OFFSET), - EXTRACT_BE_32BITS(cp + RRCP_COOKIE1_OFFSET))); + EXTRACT_BE_U_4(cp + RRCP_COOKIE2_OFFSET), + EXTRACT_BE_U_4(cp + RRCP_COOKIE1_OFFSET))); } return; diff --git a/print-rsvp.c b/print-rsvp.c index ad518aad..6b1fe90f 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_BE_16BITS(tptr + 2)<<2; /* convert wordcount to bytecount */ + parameter_length = EXTRACT_BE_U_2(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_BE_32BITS(tptr + 4))); + ND_PRINT((ndo, "\n\t\tIS hop count: %u", EXTRACT_BE_U_4(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_BE_32BITS(tptr + 4); + bw.i = EXTRACT_BE_U_4(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_BE_32BITS(tptr + 4) == 0xffffffff) + if (EXTRACT_BE_U_4(tptr + 4) == 0xffffffff) ND_PRINT((ndo, "don't care")); else - ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(tptr + 4))); + ND_PRINT((ndo, "%u", EXTRACT_BE_U_4(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_BE_32BITS(tptr + 4))); + ND_PRINT((ndo, "\n\t\tComposed MTU: %u bytes", EXTRACT_BE_U_4(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_BE_32BITS(tptr + 4); + bw.i = EXTRACT_BE_U_4(tptr + 4); ND_PRINT((ndo, "\n\t\tToken Bucket Rate: %.10g Mbps", bw.f / 125000)); - bw.i = EXTRACT_BE_32BITS(tptr + 8); + bw.i = EXTRACT_BE_U_4(tptr + 8); ND_PRINT((ndo, "\n\t\tToken Bucket Size: %.10g bytes", bw.f)); - bw.i = EXTRACT_BE_32BITS(tptr + 12); + bw.i = EXTRACT_BE_U_4(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_BE_32BITS(tptr + 16))); - ND_PRINT((ndo, "\n\t\tMaximum Packet Size: %u bytes", EXTRACT_BE_32BITS(tptr + 20))); + ND_PRINT((ndo, "\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_BE_U_4(tptr + 16))); + ND_PRINT((ndo, "\n\t\tMaximum Packet Size: %u bytes", EXTRACT_BE_U_4(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_BE_32BITS(tptr + 4); + bw.i = EXTRACT_BE_U_4(tptr + 4); ND_PRINT((ndo, "\n\t\tRate: %.10g Mbps", bw.f / 125000)); - ND_PRINT((ndo, "\n\t\tSlack Term: %u", EXTRACT_BE_32BITS(tptr + 8))); + ND_PRINT((ndo, "\n\t\tSlack Term: %u", EXTRACT_BE_U_4(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_BE_32BITS(tptr + 4))); + ND_PRINT((ndo, "\n\t\tValue: %u", EXTRACT_BE_U_4(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_BE_16BITS(rsvp_obj_header->length); + rsvp_obj_len=EXTRACT_BE_U_2(rsvp_obj_header->length); rsvp_obj_ctype=rsvp_obj_header->ctype; if(rsvp_obj_len % 4) { @@ -738,11 +738,11 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s IPv4 DestAddress: %s, Protocol ID: 0x%02x", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_8BITS(obj_tptr + sizeof(struct in_addr)))); + EXTRACT_U_1(obj_tptr + sizeof(struct in_addr)))); ND_PRINT((ndo, "%s Flags: [0x%02x], DestPort %u", indent, - EXTRACT_8BITS((obj_tptr + 5)), - EXTRACT_BE_16BITS(obj_tptr + 6))); + EXTRACT_U_1((obj_tptr + 5)), + EXTRACT_BE_U_2(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; @@ -752,11 +752,11 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, "%s IPv6 DestAddress: %s, Protocol ID: 0x%02x", indent, ip6addr_string(ndo, obj_tptr), - EXTRACT_8BITS(obj_tptr + sizeof(struct in6_addr)))); + EXTRACT_U_1(obj_tptr + sizeof(struct in6_addr)))); ND_PRINT((ndo, "%s Flags: [0x%02x], DestPort %u", indent, - EXTRACT_8BITS((obj_tptr + sizeof(struct in6_addr) + 1)), - EXTRACT_BE_16BITS(obj_tptr + sizeof(struct in6_addr) + 2))); + EXTRACT_U_1((obj_tptr + sizeof(struct in6_addr) + 1)), + EXTRACT_BE_U_2(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_BE_16BITS(obj_tptr + 18), + EXTRACT_BE_U_2(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_BE_32BITS(obj_tptr), - EXTRACT_BE_16BITS(obj_tptr + 6), + EXTRACT_BE_U_4(obj_tptr), + EXTRACT_BE_U_2(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_BE_16BITS(obj_tptr + 6), + EXTRACT_BE_U_2(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_BE_16BITS(obj_tptr + 6), + EXTRACT_BE_U_2(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_BE_32BITS(obj_tptr))); + ND_PRINT((ndo, "%s Label: %u", indent, EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr), + EXTRACT_BE_U_4(obj_tptr), indent, - EXTRACT_BE_32BITS(obj_tptr + 4), - EXTRACT_BE_32BITS(obj_tptr + 8))); + EXTRACT_BE_U_4(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; break; @@ -909,8 +909,8 @@ rsvp_obj_print(netdissect_options *ndo, indent, tok2str(rsvp_resstyle_values, "Unknown", - EXTRACT_BE_24BITS(obj_tptr + 1)), - EXTRACT_8BITS(obj_tptr))); + EXTRACT_BE_U_3(obj_tptr + 1)), + EXTRACT_U_1(obj_tptr))); obj_tlen-=4; obj_tptr+=4; break; @@ -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_BE_16BITS(obj_tptr + 6))); + EXTRACT_BE_U_2(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_BE_16BITS(obj_tptr + 18))); + EXTRACT_BE_U_2(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_BE_16BITS(obj_tptr + 18), + EXTRACT_BE_U_2(obj_tptr + 18), indent, ip6addr_string(ndo, obj_tptr+20), - EXTRACT_BE_16BITS(obj_tptr + 38))); + EXTRACT_BE_U_2(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_BE_16BITS(obj_tptr + 6))); + EXTRACT_BE_U_2(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_BE_16BITS(obj_tptr + 6), + EXTRACT_BE_U_2(obj_tptr + 6), indent, ipaddr_string(ndo, obj_tptr+8), - EXTRACT_BE_16BITS(obj_tptr + 12))); + EXTRACT_BE_U_2(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_BE_16BITS(obj_tptr + 2)))); + EXTRACT_BE_U_2(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_BE_16BITS(obj_tptr + 2)))); - ND_PRINT((ndo, ",%s merge capability",((EXTRACT_8BITS(obj_tptr + 4)) & 0x80) ? "no" : "" )); + EXTRACT_BE_U_2(obj_tptr + 2)))); + ND_PRINT((ndo, ",%s merge capability",((EXTRACT_U_1(obj_tptr + 4)) & 0x80) ? "no" : "" )); ND_PRINT((ndo, "%s Minimum VPI/VCI: %u/%u", indent, - (EXTRACT_BE_16BITS(obj_tptr + 4))&0xfff, - (EXTRACT_BE_16BITS(obj_tptr + 6)) & 0xfff)); + (EXTRACT_BE_U_2(obj_tptr + 4))&0xfff, + (EXTRACT_BE_U_2(obj_tptr + 6)) & 0xfff)); ND_PRINT((ndo, "%s Maximum VPI/VCI: %u/%u", indent, - (EXTRACT_BE_16BITS(obj_tptr + 8))&0xfff, - (EXTRACT_BE_16BITS(obj_tptr + 10)) & 0xfff)); + (EXTRACT_BE_U_2(obj_tptr + 8))&0xfff, + (EXTRACT_BE_U_2(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_BE_16BITS(obj_tptr + 2)))); + EXTRACT_BE_U_2(obj_tptr + 2)))); ND_PRINT((ndo, "%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI", indent, - (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" : "")); + (EXTRACT_BE_U_4(obj_tptr + 4))&0x7fffff, + (EXTRACT_BE_U_4(obj_tptr + 8))&0x7fffff, + (((EXTRACT_BE_U_2(obj_tptr + 4)>>7)&3) == 0 ) ? "10" : "", + (((EXTRACT_BE_U_2(obj_tptr + 4) >> 7) & 3) == 2 ) ? "23" : "")); obj_tlen-=12; obj_tptr+=12; break; @@ -1041,18 +1041,18 @@ rsvp_obj_print(netdissect_options *ndo, indent, tok2str(gmpls_encoding_values, "Unknown", - EXTRACT_8BITS(obj_tptr)), - EXTRACT_8BITS(obj_tptr))); + EXTRACT_U_1(obj_tptr)), + EXTRACT_U_1(obj_tptr))); ND_PRINT((ndo, "%s Switching Type: %s (%u), Payload ID: %s (0x%04x)", indent, tok2str(gmpls_switch_cap_values, "Unknown", - EXTRACT_8BITS((obj_tptr + 1))), - EXTRACT_8BITS(obj_tptr+1), + EXTRACT_U_1((obj_tptr + 1))), + EXTRACT_U_1(obj_tptr + 1), tok2str(gmpls_payload_values, "Unknown", - EXTRACT_BE_16BITS(obj_tptr + 2)), - EXTRACT_BE_16BITS(obj_tptr + 2))); + EXTRACT_BE_U_2(obj_tptr + 2)), + EXTRACT_BE_U_2(obj_tptr + 2))); obj_tlen-=4; obj_tptr+=4; break; @@ -1069,12 +1069,12 @@ rsvp_obj_print(netdissect_options *ndo, u_char length; ND_TCHECK2(*obj_tptr, 4); - length = EXTRACT_8BITS(obj_tptr + 1); + length = EXTRACT_U_1(obj_tptr + 1); ND_PRINT((ndo, "%s Subobject Type: %s, length %u", indent, tok2str(rsvp_obj_xro_values, "Unknown %u", - RSVP_OBJ_XRO_MASK_SUBOBJ(EXTRACT_8BITS(obj_tptr))), + RSVP_OBJ_XRO_MASK_SUBOBJ(EXTRACT_U_1(obj_tptr))), length)); if (length == 0) { /* prevent infinite loops */ @@ -1082,7 +1082,7 @@ rsvp_obj_print(netdissect_options *ndo, break; } - switch(RSVP_OBJ_XRO_MASK_SUBOBJ(EXTRACT_8BITS(obj_tptr))) { + switch(RSVP_OBJ_XRO_MASK_SUBOBJ(EXTRACT_U_1(obj_tptr))) { u_char prefix_length; case RSVP_OBJ_XRO_IPV4: @@ -1091,19 +1091,19 @@ rsvp_obj_print(netdissect_options *ndo, goto invalid; } ND_TCHECK2(*obj_tptr, 8); - prefix_length = EXTRACT_8BITS(obj_tptr + 6); + prefix_length = EXTRACT_U_1(obj_tptr + 6); if (prefix_length != 32) { ND_PRINT((ndo, " ERROR: Prefix length %u != 32", prefix_length)); goto invalid; } ND_PRINT((ndo, ", %s, %s/%u, Flags: [%s]", - RSVP_OBJ_XRO_MASK_LOOSE(EXTRACT_8BITS(obj_tptr)) ? "Loose" : "Strict", + RSVP_OBJ_XRO_MASK_LOOSE(EXTRACT_U_1(obj_tptr)) ? "Loose" : "Strict", ipaddr_string(ndo, obj_tptr+2), - EXTRACT_8BITS((obj_tptr + 6)), + EXTRACT_U_1((obj_tptr + 6)), bittok2str(rsvp_obj_rro_flag_values, "none", - EXTRACT_8BITS((obj_tptr + 7))))); /* rfc3209 says that this field is rsvd. */ + EXTRACT_U_1((obj_tptr + 7))))); /* rfc3209 says that this field is rsvd. */ break; case RSVP_OBJ_XRO_LABEL: if (length != 8) { @@ -1114,16 +1114,16 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT((ndo, ", Flags: [%s] (%#x), Class-Type: %s (%u), %u", bittok2str(rsvp_obj_rro_label_flag_values, "none", - EXTRACT_8BITS((obj_tptr + 2))), - EXTRACT_8BITS(obj_tptr+2), + EXTRACT_U_1((obj_tptr + 2))), + EXTRACT_U_1(obj_tptr + 2), tok2str(rsvp_ctype_values, "Unknown", - EXTRACT_8BITS((obj_tptr + 3)) + (256 * RSVP_OBJ_RRO)), - EXTRACT_8BITS((obj_tptr + 3)), - EXTRACT_BE_32BITS(obj_tptr + 4))); + EXTRACT_U_1((obj_tptr + 3)) + (256 * RSVP_OBJ_RRO)), + EXTRACT_U_1((obj_tptr + 3)), + EXTRACT_BE_U_4(obj_tptr + 4))); } - obj_tlen-=EXTRACT_8BITS(obj_tptr + 1); - obj_tptr+=EXTRACT_8BITS(obj_tptr + 1); + obj_tlen-=EXTRACT_U_1(obj_tptr + 1); + obj_tptr+=EXTRACT_U_1(obj_tptr + 1); } break; default: @@ -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_BE_32BITS(obj_tptr), - EXTRACT_BE_32BITS(obj_tptr + 4))); + EXTRACT_BE_U_4(obj_tptr), + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr), - EXTRACT_BE_32BITS(obj_tptr + 4))); + EXTRACT_BE_U_4(obj_tptr), + EXTRACT_BE_U_4(obj_tptr + 4))); obj_tlen-=8; obj_tptr+=8; break; @@ -1171,22 +1171,22 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_TUNNEL_IPV4: if (obj_tlen < 4) return-1; - namelen = EXTRACT_8BITS(obj_tptr + 3); + namelen = EXTRACT_U_1(obj_tptr + 3); if (obj_tlen < 4+namelen) return-1; ND_PRINT((ndo, "%s Session Name: ", indent)); for (i = 0; i < namelen; i++) - safeputchar(ndo, EXTRACT_8BITS(obj_tptr + 4 + i)); + safeputchar(ndo, EXTRACT_U_1(obj_tptr + 4 + i)); ND_PRINT((ndo, "%s Setup Priority: %u, Holding Priority: %u, Flags: [%s] (%#x)", indent, - EXTRACT_8BITS(obj_tptr), - EXTRACT_8BITS(obj_tptr+1), + EXTRACT_U_1(obj_tptr), + EXTRACT_U_1(obj_tptr + 1), bittok2str(rsvp_session_attribute_flag_values, "none", - EXTRACT_8BITS((obj_tptr + 2))), - EXTRACT_8BITS(obj_tptr + 2))); - obj_tlen-=4+EXTRACT_8BITS((obj_tptr + 3)); - obj_tptr+=4+EXTRACT_8BITS((obj_tptr + 3)); + EXTRACT_U_1((obj_tptr + 2))), + EXTRACT_U_1(obj_tptr + 2))); + obj_tlen-=4+EXTRACT_U_1((obj_tptr + 3)); + obj_tptr+=4+EXTRACT_U_1((obj_tptr + 3)); break; default: hexdump=TRUE; @@ -1216,9 +1216,9 @@ rsvp_obj_print(netdissect_options *ndo, */ if (total_subobj_len < 4) goto invalid; - subobj_len = EXTRACT_BE_16BITS(obj_tptr); - subobj_type = (EXTRACT_BE_16BITS(obj_tptr + 2))>>8; - af = (EXTRACT_BE_16BITS(obj_tptr + 2))&0x00FF; + subobj_len = EXTRACT_BE_U_2(obj_tptr); + subobj_type = (EXTRACT_BE_U_2(obj_tptr + 2))>>8; + af = (EXTRACT_BE_U_2(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_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))); + ((EXTRACT_BE_U_4(obj_tptr + 4))>>31), + ((EXTRACT_BE_U_4(obj_tptr + 4))&0xFF), + EXTRACT_BE_U_4(obj_tptr + 8), + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr + 4)) >> 24)); + indent, (EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr + 4))); + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr + 16))); + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(obj_tptr))); obj_tlen-=4; obj_tptr+=4; break; @@ -1369,18 +1369,18 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT((ndo, "%s Msg-Version: %u, length: %u", indent, - (EXTRACT_8BITS(obj_tptr) & 0xf0) >> 4, - EXTRACT_BE_16BITS(obj_tptr + 2) << 2)); + (EXTRACT_U_1(obj_tptr) & 0xf0) >> 4, + EXTRACT_BE_U_2(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_BE_16BITS(obj_tptr + 2)<<2; + intserv_serv_tlen=EXTRACT_BE_U_2(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",EXTRACT_8BITS((obj_tptr))), - EXTRACT_8BITS(obj_tptr), - (EXTRACT_8BITS(obj_tptr+1)&0x80) ? "" : "not", + tok2str(rsvp_intserv_service_type_values,"unknown",EXTRACT_U_1((obj_tptr))), + EXTRACT_U_1(obj_tptr), + (EXTRACT_U_1(obj_tptr + 1)&0x80) ? "" : "not", intserv_serv_tlen)); obj_tptr+=4; /* get to the start of the parameter list */ @@ -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_BE_16BITS(obj_tptr + 6))); + EXTRACT_BE_U_2(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_BE_16BITS(obj_tptr + 18))); + EXTRACT_BE_U_2(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_BE_24BITS(obj_tptr + 17))); + EXTRACT_BE_U_3(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_BE_16BITS(obj_tptr + 18))); + EXTRACT_BE_U_2(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_BE_16BITS(obj_tptr + 18), + EXTRACT_BE_U_2(obj_tptr + 18), indent, ip6addr_string(ndo, obj_tptr+20), - EXTRACT_BE_16BITS(obj_tptr + 38))); + EXTRACT_BE_U_2(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_BE_16BITS(obj_tptr + 6))); + EXTRACT_BE_U_2(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_BE_16BITS(obj_tptr + 6), + EXTRACT_BE_U_2(obj_tptr + 6), indent, ipaddr_string(ndo, obj_tptr+8), - EXTRACT_BE_16BITS(obj_tptr + 12))); + EXTRACT_BE_U_2(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_BE_32BITS(obj_ptr.rsvp_obj_frr->bandwidth); + bw.i = EXTRACT_BE_U_4(obj_ptr.rsvp_obj_frr->bandwidth); ND_PRINT((ndo, "%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps", indent, 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_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))); + EXTRACT_BE_U_4(obj_ptr.rsvp_obj_frr->include_any), + EXTRACT_BE_U_4(obj_ptr.rsvp_obj_frr->exclude_any), + EXTRACT_BE_U_4(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_BE_32BITS(obj_ptr.rsvp_obj_frr->bandwidth); + bw.i = EXTRACT_BE_U_4(obj_ptr.rsvp_obj_frr->bandwidth); ND_PRINT((ndo, "%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps", indent, 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_BE_32BITS(obj_ptr.rsvp_obj_frr->include_any), - EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->exclude_any))); + EXTRACT_BE_U_4(obj_ptr.rsvp_obj_frr->include_any), + EXTRACT_BE_U_4(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_BE_32BITS(obj_tptr) & 0x7)); + EXTRACT_BE_U_4(obj_tptr) & 0x7)); obj_tlen-=4; obj_tptr+=4; break; @@ -1571,12 +1571,12 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_IPV4: if (obj_tlen < 8) return-1; - error_code=EXTRACT_8BITS(obj_tptr + 5); - error_value=EXTRACT_BE_16BITS(obj_tptr + 6); + error_code=EXTRACT_U_1(obj_tptr + 5); + error_value=EXTRACT_BE_U_2(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), - EXTRACT_8BITS(obj_tptr+4), + EXTRACT_U_1(obj_tptr + 4), indent, tok2str(rsvp_obj_error_code_values,"unknown",error_code), error_code)); @@ -1603,12 +1603,12 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_IPV6: if (obj_tlen < 20) return-1; - error_code=EXTRACT_8BITS(obj_tptr + 17); - error_value=EXTRACT_BE_16BITS(obj_tptr + 18); + error_code=EXTRACT_U_1(obj_tptr + 17); + error_value=EXTRACT_BE_U_2(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), - EXTRACT_8BITS(obj_tptr+16), + EXTRACT_U_1(obj_tptr + 16), indent, tok2str(rsvp_obj_error_code_values,"unknown",error_code), error_code)); @@ -1635,10 +1635,10 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; - padbytes = EXTRACT_BE_16BITS(obj_tptr + 2); + padbytes = EXTRACT_BE_U_2(obj_tptr + 2); ND_PRINT((ndo, "%s TLV count: %u, padding bytes: %u", indent, - EXTRACT_BE_16BITS(obj_tptr), + EXTRACT_BE_U_2(obj_tptr), padbytes)); obj_tlen-=4; obj_tptr+=4; @@ -1646,16 +1646,17 @@ rsvp_obj_print(netdissect_options *ndo, while(obj_tlen >= 2 + padbytes) { ND_PRINT((ndo, "%s %s TLV (0x%02x), length: %u", /* length includes header */ indent, - tok2str(rsvp_obj_prop_tlv_values,"unknown",EXTRACT_8BITS(obj_tptr)), - EXTRACT_8BITS(obj_tptr), - EXTRACT_8BITS(obj_tptr + 1))); - if (obj_tlen < EXTRACT_8BITS((obj_tptr + 1))) + tok2str(rsvp_obj_prop_tlv_values,"unknown",EXTRACT_U_1(obj_tptr)), + EXTRACT_U_1(obj_tptr), + EXTRACT_U_1(obj_tptr + 1))); + if (obj_tlen < EXTRACT_U_1((obj_tptr + 1))) return-1; - if (EXTRACT_8BITS(obj_tptr+1) < 2) + if (EXTRACT_U_1(obj_tptr + 1) < 2) return -1; - print_unknown_data(ndo, obj_tptr + 2, "\n\t\t", EXTRACT_8BITS(obj_tptr + 1) - 2); - obj_tlen-=EXTRACT_8BITS(obj_tptr + 1); - obj_tptr+=EXTRACT_8BITS(obj_tptr + 1); + print_unknown_data(ndo, obj_tptr + 2, "\n\t\t", + EXTRACT_U_1(obj_tptr + 1) - 2); + obj_tlen-=EXTRACT_U_1(obj_tptr + 1); + obj_tptr+=EXTRACT_U_1(obj_tptr + 1); } break; default: @@ -1673,16 +1674,16 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT((ndo, "%s Flags [0x%02x], epoch: %u", indent, - EXTRACT_8BITS(obj_tptr), - EXTRACT_BE_24BITS(obj_tptr + 1))); + EXTRACT_U_1(obj_tptr), + EXTRACT_BE_U_3(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_BE_32BITS(obj_tptr), - EXTRACT_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(obj_tptr), + EXTRACT_BE_U_4(obj_tptr))); obj_tlen-=4; obj_tptr+=4; } @@ -1700,19 +1701,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_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), + EXTRACT_BE_U_2(obj_ptr.rsvp_obj_integrity->key_id), + EXTRACT_BE_U_4(obj_ptr.rsvp_obj_integrity->key_id + 2), + EXTRACT_BE_U_4(obj_ptr.rsvp_obj_integrity->sequence), + EXTRACT_BE_U_4(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_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))); + EXTRACT_BE_U_4(obj_ptr.rsvp_obj_integrity->digest), + EXTRACT_BE_U_4(obj_ptr.rsvp_obj_integrity->digest + 4), + EXTRACT_BE_U_4(obj_ptr.rsvp_obj_integrity->digest + 8), + EXTRACT_BE_U_4(obj_ptr.rsvp_obj_integrity->digest + 12))); sigcheck = signature_verify(ndo, pptr, plen, obj_ptr.rsvp_obj_integrity->digest, @@ -1735,7 +1736,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_BE_32BITS(obj_tptr)))); + EXTRACT_BE_U_4(obj_tptr)))); obj_tlen-=4; obj_tptr+=4; break; @@ -1749,11 +1750,11 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; - action = (EXTRACT_BE_16BITS(obj_tptr)>>8); + action = (EXTRACT_BE_U_2(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_BE_32BITS(obj_tptr) & 0x7F)))); + action, ((EXTRACT_BE_U_4(obj_tptr) & 0x7F)))); switch (action) { case LABEL_SET_INCLUSIVE_RANGE: @@ -1763,8 +1764,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_BE_32BITS(obj_tptr + 4), - EXTRACT_BE_32BITS(obj_tptr + 8))); + EXTRACT_BE_U_4(obj_tptr + 4), + EXTRACT_BE_U_4(obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; break; @@ -1775,7 +1776,7 @@ rsvp_obj_print(netdissect_options *ndo, subchannel = 1; while(obj_tlen >= 4 ) { ND_PRINT((ndo, "%s Subchannel #%u: %u", indent, subchannel, - EXTRACT_BE_32BITS(obj_tptr))); + EXTRACT_BE_U_4(obj_tptr))); obj_tptr+=4; obj_tlen-=4; subchannel++; @@ -1878,7 +1879,7 @@ rsvp_print(netdissect_options *ndo, /* ok they seem to want to know everything - lets fully decode it */ - plen = tlen = EXTRACT_BE_16BITS(rsvp_com_header->length); + plen = tlen = EXTRACT_BE_U_2(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 +1888,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_BE_16BITS(rsvp_com_header->checksum))); + EXTRACT_BE_U_2(rsvp_com_header->checksum))); if (tlen < sizeof(struct rsvp_common_header)) { ND_PRINT((ndo, "ERROR: common header too short %u < %lu", tlen, @@ -1924,7 +1925,7 @@ rsvp_print(netdissect_options *ndo, return; } - subplen = subtlen = EXTRACT_BE_16BITS(rsvp_com_header->length); + subplen = subtlen = EXTRACT_BE_U_2(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 +1934,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_BE_16BITS(rsvp_com_header->checksum))); + EXTRACT_BE_U_2(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 146a84b2..0ba3ba66 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_BE_32BITS(dp0->ip6r0_reserved) || ndo->ndo_vflag) { + if (EXTRACT_BE_U_4(dp0->ip6r0_reserved) || ndo->ndo_vflag) { ND_PRINT((ndo, ", rsv=0x%0x", - EXTRACT_BE_32BITS(&dp0->ip6r0_reserved))); + EXTRACT_BE_U_4(&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# %u", - EXTRACT_BE_32BITS(&rxh->cid), - EXTRACT_BE_32BITS(&rxh->callNumber))); + EXTRACT_BE_U_4(&rxh->cid), + EXTRACT_BE_U_4(&rxh->callNumber))); ND_PRINT((ndo, " seq %u ser %u", - EXTRACT_BE_32BITS(&rxh->seq), - EXTRACT_BE_32BITS(&rxh->serial))); + EXTRACT_BE_U_4(&rxh->seq), + EXTRACT_BE_U_4(&rxh->serial))); if (ndo->ndo_vflag > 2) ND_PRINT((ndo, " secindex %u serviceid %hu", rxh->securityIndex, - EXTRACT_BE_16BITS(&rxh->serviceId))); + EXTRACT_BE_U_2(&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_BE_32BITS(&rxh->seq) == 1 && + EXTRACT_BE_U_4(&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_BE_32BITS(&rxh->seq) == 1) || + EXTRACT_BE_U_4(&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_BE_32BITS(&rxh->callNumber); + rxent->callnum = EXTRACT_BE_U_4(&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_BE_32BITS(&rxh->serviceId); - rxent->opcode = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); + rxent->serviceId = EXTRACT_BE_U_4(&rxh->serviceId); + rxent->opcode = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); } /* @@ -722,10 +722,10 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport, i = rx_cache_hint; do { rxent = &rx_cache[i]; - if (rxent->callnum == EXTRACT_BE_32BITS(&rxh->callNumber) && + if (rxent->callnum == EXTRACT_BE_U_4(&rxh->callNumber) && rxent->client.s_addr == clip && rxent->server.s_addr == sip && - rxent->serviceId == EXTRACT_BE_32BITS(&rxh->serviceId) && + rxent->serviceId == EXTRACT_BE_U_4(&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, u_int sport, #define FIDOUT() { uint32_t n1, n2, n3; \ ND_TCHECK2(bp[0], sizeof(uint32_t) * 3); \ - n1 = EXTRACT_BE_32BITS(bp); \ + n1 = EXTRACT_BE_U_4(bp); \ bp += sizeof(uint32_t); \ - n2 = EXTRACT_BE_32BITS(bp); \ + n2 = EXTRACT_BE_U_4(bp); \ bp += sizeof(uint32_t); \ - n3 = EXTRACT_BE_32BITS(bp); \ + n3 = EXTRACT_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT((ndo, " fid %u/%u/%u", n1, n2, n3)); \ } #define STROUT(MAX) { uint32_t _i; \ ND_TCHECK2(bp[0], sizeof(uint32_t)); \ - _i = EXTRACT_BE_32BITS(bp); \ + _i = EXTRACT_BE_U_4(bp); \ if (_i > (MAX)) \ goto trunc; \ bp += sizeof(uint32_t); \ @@ -772,28 +772,28 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport, #define INTOUT() { int32_t _i; \ ND_TCHECK_4(bp); \ - _i = EXTRACT_BE_INT32(bp); \ + _i = EXTRACT_BE_S_4(bp); \ bp += sizeof(int32_t); \ ND_PRINT((ndo, " %d", _i)); \ } #define UINTOUT() { uint32_t _i; \ ND_TCHECK_4(bp); \ - _i = EXTRACT_BE_32BITS(bp); \ + _i = EXTRACT_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT((ndo, " %u", _i)); \ } #define UINT64OUT() { uint64_t _i; \ ND_TCHECK2(bp[0], sizeof(uint64_t)); \ - _i = EXTRACT_BE_64BITS(bp); \ + _i = EXTRACT_BE_U_8(bp); \ bp += sizeof(uint64_t); \ ND_PRINT((ndo, " %" PRIu64, _i)); \ } #define DATEOUT() { time_t _t; struct tm *tm; char str[256]; \ ND_TCHECK_4(bp); \ - _t = (time_t) EXTRACT_BE_INT32(bp); \ + _t = (time_t) EXTRACT_BE_S_4(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, u_int sport, #define STOREATTROUT() { uint32_t mask, _i; \ ND_TCHECK2(bp[0], (sizeof(uint32_t)*6)); \ - mask = EXTRACT_BE_32BITS(bp); bp += sizeof(uint32_t); \ + mask = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \ if (mask) ND_PRINT((ndo, " StoreStatus")); \ if (mask & 1) { ND_PRINT((ndo, " date")); DATEOUT(); } \ else bp += sizeof(uint32_t); \ - _i = EXTRACT_BE_32BITS(bp); bp += sizeof(uint32_t); \ + _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \ if (mask & 2) ND_PRINT((ndo, " owner %u", _i)); \ - _i = EXTRACT_BE_32BITS(bp); bp += sizeof(uint32_t); \ + _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \ if (mask & 4) ND_PRINT((ndo, " group %u", _i)); \ - _i = EXTRACT_BE_32BITS(bp); bp += sizeof(uint32_t); \ + _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \ if (mask & 8) ND_PRINT((ndo, " mode %o", _i & 07777)); \ - _i = EXTRACT_BE_32BITS(bp); bp += sizeof(uint32_t); \ + _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \ if (mask & 16) ND_PRINT((ndo, " segsize %u", _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, u_int sport, #define UBIK_VERSIONOUT() {uint32_t epoch; uint32_t counter; \ ND_TCHECK2(bp[0], sizeof(uint32_t) * 2); \ - epoch = EXTRACT_BE_32BITS(bp); \ + epoch = EXTRACT_BE_U_4(bp); \ bp += sizeof(uint32_t); \ - counter = EXTRACT_BE_32BITS(bp); \ + counter = EXTRACT_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT((ndo, " %u.%u", epoch, counter)); \ } #define AFSUUIDOUT() {uint32_t temp; int _i; \ ND_TCHECK2(bp[0], 11*sizeof(uint32_t)); \ - temp = EXTRACT_BE_32BITS(bp); \ + temp = EXTRACT_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT((ndo, " %08x", temp)); \ - temp = EXTRACT_BE_32BITS(bp); \ + temp = EXTRACT_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT((ndo, "%04x", temp)); \ - temp = EXTRACT_BE_32BITS(bp); \ + temp = EXTRACT_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT((ndo, "%04x", temp)); \ for (_i = 0; _i < 8; _i++) { \ - temp = EXTRACT_BE_32BITS(bp); \ + temp = EXTRACT_BE_U_4(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, u_int sport, ND_TCHECK2(bp[0], (MAX) * sizeof(uint32_t)); \ sp = s; \ for (k = 0; k < (MAX); k++) { \ - *sp++ = (u_char) EXTRACT_BE_32BITS(bp); \ + *sp++ = (u_char) EXTRACT_BE_U_4(bp); \ bp += sizeof(uint32_t); \ } \ s[(MAX)] = '\0'; \ @@ -868,11 +868,11 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport, #define DESTSERVEROUT() { uint32_t n1, n2, n3; \ ND_TCHECK2(bp[0], sizeof(uint32_t) * 3); \ - n1 = EXTRACT_BE_32BITS(bp); \ + n1 = EXTRACT_BE_U_4(bp); \ bp += sizeof(uint32_t); \ - n2 = EXTRACT_BE_32BITS(bp); \ + n2 = EXTRACT_BE_U_4(bp); \ bp += sizeof(uint32_t); \ - n3 = EXTRACT_BE_32BITS(bp); \ + n3 = EXTRACT_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT((ndo, " server %u:%u:%u", n1, n2, n3)); \ } @@ -897,7 +897,7 @@ fs_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - fs_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); + fs_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " fs call %s", tok2str(fs_req, "op#%u", fs_op))); @@ -949,7 +949,7 @@ fs_print(netdissect_options *ndo, char a[AFSOPAQUEMAX+1]; FIDOUT(); ND_TCHECK2(bp[0], 4); - i = EXTRACT_BE_32BITS(bp); + i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); ND_TCHECK2(bp[0], i); i = min(AFSOPAQUEMAX, i); @@ -1006,7 +1006,7 @@ fs_print(netdissect_options *ndo, { uint32_t j; ND_TCHECK_4(bp); - j = EXTRACT_BE_32BITS(bp); + j = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); for (i = 0; i < j; i++) { @@ -1082,7 +1082,7 @@ fs_reply_print(netdissect_options *ndo, { char a[AFSOPAQUEMAX+1]; ND_TCHECK_4(bp); - i = EXTRACT_BE_32BITS(bp); + i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); ND_TCHECK2(bp[0], i); i = min(AFSOPAQUEMAX, i); @@ -1113,7 +1113,7 @@ fs_reply_print(netdissect_options *ndo, int32_t errcode; ND_TCHECK_4(bp); - errcode = EXTRACT_BE_INT32(bp); + errcode = EXTRACT_BE_S_4(bp); bp += sizeof(int32_t); ND_PRINT((ndo, " error %s", tok2str(afs_fs_errors, "#%d", errcode))); @@ -1230,7 +1230,7 @@ cb_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - cb_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); + cb_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " cb call %s", tok2str(cb_req, "op#%u", cb_op))); @@ -1246,7 +1246,7 @@ cb_print(netdissect_options *ndo, { uint32_t j, t; ND_TCHECK_4(bp); - j = EXTRACT_BE_32BITS(bp); + j = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); for (i = 0; i < j; i++) { @@ -1259,7 +1259,7 @@ cb_print(netdissect_options *ndo, ND_PRINT((ndo, " <none!>")); ND_TCHECK_4(bp); - j = EXTRACT_BE_32BITS(bp); + j = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); if (j != 0) @@ -1271,7 +1271,7 @@ cb_print(netdissect_options *ndo, ND_PRINT((ndo, " expires")); DATEOUT(); ND_TCHECK_4(bp); - t = EXTRACT_BE_32BITS(bp); + t = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); tok2str(cb_types, "type %u", t); } @@ -1361,7 +1361,7 @@ prot_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - pt_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); + pt_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " pt")); @@ -1414,7 +1414,7 @@ prot_print(netdissect_options *ndo, { uint32_t j; ND_TCHECK_4(bp); - j = EXTRACT_BE_32BITS(bp); + j = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); /* @@ -1436,7 +1436,7 @@ prot_print(netdissect_options *ndo, uint32_t j; ND_PRINT((ndo, " ids:")); ND_TCHECK_4(bp); - i = EXTRACT_BE_32BITS(bp); + i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); for (j = 0; j < i; j++) INTOUT(); @@ -1526,7 +1526,7 @@ prot_reply_print(netdissect_options *ndo, uint32_t j; ND_PRINT((ndo, " ids:")); ND_TCHECK_4(bp); - i = EXTRACT_BE_32BITS(bp); + i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); for (j = 0; j < i; j++) INTOUT(); @@ -1538,7 +1538,7 @@ prot_reply_print(netdissect_options *ndo, { uint32_t j; ND_TCHECK_4(bp); - j = EXTRACT_BE_32BITS(bp); + j = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); /* @@ -1563,7 +1563,7 @@ prot_reply_print(netdissect_options *ndo, { uint32_t j; ND_TCHECK_4(bp); - j = EXTRACT_BE_32BITS(bp); + j = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); for (i = 0; i < j; i++) { INTOUT(); @@ -1615,7 +1615,7 @@ vldb_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - vldb_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); + vldb_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " vldb")); @@ -1645,7 +1645,7 @@ vldb_print(netdissect_options *ndo, ND_PRINT((ndo, " volid")); INTOUT(); ND_TCHECK_4(bp); - i = EXTRACT_BE_32BITS(bp); + i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); if (i <= 2) ND_PRINT((ndo, " type %s", voltype[i])); @@ -1665,7 +1665,7 @@ vldb_print(netdissect_options *ndo, ND_PRINT((ndo, " volid")); INTOUT(); ND_TCHECK_4(bp); - i = EXTRACT_BE_32BITS(bp); + i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); if (i <= 2) ND_PRINT((ndo, " type %s", voltype[i])); @@ -1738,7 +1738,7 @@ vldb_reply_print(netdissect_options *ndo, bp += sizeof(uint32_t); ND_PRINT((ndo, " numservers")); ND_TCHECK_4(bp); - nservers = EXTRACT_BE_32BITS(bp); + nservers = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); ND_PRINT((ndo, " %u", nservers)); ND_PRINT((ndo, " servers")); @@ -1752,7 +1752,7 @@ vldb_reply_print(netdissect_options *ndo, ND_PRINT((ndo, " partitions")); for (i = 0; i < 8; i++) { ND_TCHECK_4(bp); - j = EXTRACT_BE_32BITS(bp); + j = EXTRACT_BE_U_4(bp); if (i < nservers && j <= 26) ND_PRINT((ndo, " %c", 'a' + j)); else if (i < nservers) @@ -1785,7 +1785,7 @@ vldb_reply_print(netdissect_options *ndo, VECOUT(VLNAMEMAX); ND_PRINT((ndo, " numservers")); ND_TCHECK_4(bp); - nservers = EXTRACT_BE_32BITS(bp); + nservers = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); ND_PRINT((ndo, " %u", nservers)); ND_PRINT((ndo, " servers")); @@ -1799,7 +1799,7 @@ vldb_reply_print(netdissect_options *ndo, ND_PRINT((ndo, " partitions")); for (i = 0; i < 13; i++) { ND_TCHECK_4(bp); - j = EXTRACT_BE_32BITS(bp); + j = EXTRACT_BE_U_4(bp); if (i < nservers && j <= 26) ND_PRINT((ndo, " %c", 'a' + j)); else if (i < nservers) @@ -1822,7 +1822,7 @@ vldb_reply_print(netdissect_options *ndo, VECOUT(VLNAMEMAX); ND_PRINT((ndo, " numservers")); ND_TCHECK_4(bp); - nservers = EXTRACT_BE_32BITS(bp); + nservers = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); ND_PRINT((ndo, " %u", nservers)); ND_PRINT((ndo, " servers")); @@ -1840,7 +1840,7 @@ vldb_reply_print(netdissect_options *ndo, ND_PRINT((ndo, " partitions")); for (i = 0; i < 13; i++) { ND_TCHECK_4(bp); - j = EXTRACT_BE_32BITS(bp); + j = EXTRACT_BE_U_4(bp); if (i < nservers && j <= 26) ND_PRINT((ndo, " %c", 'a' + j)); else if (i < nservers) @@ -1893,7 +1893,7 @@ kauth_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - kauth_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); + kauth_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " kauth")); @@ -1935,7 +1935,7 @@ kauth_print(netdissect_options *ndo, ND_PRINT((ndo, " domain")); STROUT(KANAMEMAX); ND_TCHECK_4(bp); - i = EXTRACT_BE_32BITS(bp); + i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); ND_TCHECK2(bp[0], i); bp += i; @@ -2036,7 +2036,7 @@ vol_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - vol_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); + vol_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " vol call %s", tok2str(vol_req, "op#%u", vol_op))); @@ -2188,7 +2188,7 @@ vol_print(netdissect_options *ndo, { uint32_t i, j; ND_TCHECK_4(bp); - j = EXTRACT_BE_32BITS(bp); + j = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); for (i = 0; i < j; i++) { DESTSERVEROUT(); @@ -2316,7 +2316,7 @@ vol_reply_print(netdissect_options *ndo, { uint32_t i, j; ND_TCHECK_4(bp); - j = EXTRACT_BE_32BITS(bp); + j = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); for (i = 0; i < j; i++) { ND_PRINT((ndo, " name")); @@ -2370,7 +2370,7 @@ bos_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - bos_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header)); + bos_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " bos call %s", tok2str(bos_req, "op#%u", bos_op))); @@ -2519,7 +2519,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_BE_32BITS(bp + sizeof(struct rx_header)); + ubik_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " ubik call %s", tok2str(ubik_req, "op#%u", ubik_op))); @@ -2532,7 +2532,7 @@ ubik_print(netdissect_options *ndo, switch (ubik_op) { case 10000: /* Beacon */ ND_TCHECK_4(bp); - temp = EXTRACT_BE_32BITS(bp); + temp = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); ND_PRINT((ndo, " syncsite %s", temp ? "yes" : "no")); ND_PRINT((ndo, " votestart")); @@ -2564,7 +2564,7 @@ ubik_print(netdissect_options *ndo, ND_PRINT((ndo, " length")); INTOUT(); ND_TCHECK_4(bp); - temp = EXTRACT_BE_32BITS(bp); + temp = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); tok2str(ubik_lock_types, "type %u", temp); break; @@ -2714,12 +2714,12 @@ rx_ack_print(netdissect_options *ndo, if (ndo->ndo_vflag > 2) ND_PRINT((ndo, " bufspace %u maxskew %d", - EXTRACT_BE_16BITS(&rxa->bufferSpace), - EXTRACT_BE_16BITS(&rxa->maxSkew))); + EXTRACT_BE_U_2(&rxa->bufferSpace), + EXTRACT_BE_U_2(&rxa->maxSkew))); - firstPacket = EXTRACT_BE_32BITS(&rxa->firstPacket); + firstPacket = EXTRACT_BE_U_4(&rxa->firstPacket); ND_PRINT((ndo, " first %u serial %u reason %s", - firstPacket, EXTRACT_BE_32BITS(&rxa->serial), + firstPacket, EXTRACT_BE_U_4(&rxa->serial), tok2str(rx_ack_reasons, "#%u", rxa->reason))); /* diff --git a/print-sctp.c b/print-sctp.c index 529faff5..9f169654 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_BE_16BITS(&sctpPktHdr->source); - destPort = EXTRACT_BE_16BITS(&sctpPktHdr->destination); + sourcePort = EXTRACT_BE_U_2(&sctpPktHdr->source); + destPort = EXTRACT_BE_U_2(&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_BE_16BITS(&chunkDescPtr->chunkLength); + chunkLength = EXTRACT_BE_U_2(&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_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))); + ppid = EXTRACT_BE_U_4(&dataHdrPtr->payloadtype); + ND_PRINT((ndo, "[TSN: %u] ", EXTRACT_BE_U_4(&dataHdrPtr->TSN))); + ND_PRINT((ndo, "[SID: %u] ", EXTRACT_BE_U_2(&dataHdrPtr->streamId))); + ND_PRINT((ndo, "[SSEQ %u] ", EXTRACT_BE_U_2(&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_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))); + ND_PRINT((ndo, "[init tag: %u] ", EXTRACT_BE_U_4(&init->initTag))); + ND_PRINT((ndo, "[rwnd: %u] ", EXTRACT_BE_U_4(&init->rcvWindowCredit))); + ND_PRINT((ndo, "[OS: %u] ", EXTRACT_BE_U_2(&init->NumPreopenStreams))); + ND_PRINT((ndo, "[MIS: %u] ", EXTRACT_BE_U_2(&init->MaxInboundStreams))); + ND_PRINT((ndo, "[init TSN: %u] ", EXTRACT_BE_U_4(&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_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))); + ND_PRINT((ndo, "[init tag: %u] ", EXTRACT_BE_U_4(&init->initTag))); + ND_PRINT((ndo, "[rwnd: %u] ", EXTRACT_BE_U_4(&init->rcvWindowCredit))); + ND_PRINT((ndo, "[OS: %u] ", EXTRACT_BE_U_2(&init->NumPreopenStreams))); + ND_PRINT((ndo, "[MIS: %u] ", EXTRACT_BE_U_2(&init->MaxInboundStreams))); + ND_PRINT((ndo, "[init TSN: %u] ", EXTRACT_BE_U_4(&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_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))); + ND_PRINT((ndo, "[cum ack %u] ", EXTRACT_BE_U_4(&sack->highestConseqTSN))); + ND_PRINT((ndo, "[a_rwnd %u] ", EXTRACT_BE_U_4(&sack->updatedRwnd))); + ND_PRINT((ndo, "[#gap acks %u] ", EXTRACT_BE_U_2(&sack->numberOfdesc))); + ND_PRINT((ndo, "[#dup tsns %u] ", EXTRACT_BE_U_2(&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_BE_16BITS(&sack->numberOfdesc); + chunkLengthRemaining != 0 && fragNo < EXTRACT_BE_U_2(&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_BE_32BITS(&sack->highestConseqTSN) + EXTRACT_BE_16BITS(&frag->fragmentStart), - EXTRACT_BE_32BITS(&sack->highestConseqTSN) + EXTRACT_BE_16BITS(&frag->fragmentEnd))); + EXTRACT_BE_U_4(&sack->highestConseqTSN) + EXTRACT_BE_U_2(&frag->fragmentStart), + EXTRACT_BE_U_4(&sack->highestConseqTSN) + EXTRACT_BE_U_2(&frag->fragmentEnd))); } /* print duplicate TSNs */ for (tsnNo=0; - chunkLengthRemaining != 0 && tsnNo<EXTRACT_BE_16BITS(&sack->numDupTsns); + chunkLengthRemaining != 0 && tsnNo<EXTRACT_BE_U_2(&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_BE_32BITS(dupTSN))); + EXTRACT_BE_U_4(dupTSN))); } break; } diff --git a/print-sflow.c b/print-sflow.c index d86db5f4..0ccb1f32 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_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), + EXTRACT_BE_U_4(sflow_gen_counter->ifindex), + EXTRACT_BE_U_4(sflow_gen_counter->iftype), + EXTRACT_BE_U_8(sflow_gen_counter->ifspeed), + EXTRACT_BE_U_4(sflow_gen_counter->ifdirection), tok2str(sflow_iface_direction_values, "Unknown", - EXTRACT_BE_32BITS(sflow_gen_counter->ifdirection)))); + EXTRACT_BE_U_4(sflow_gen_counter->ifdirection)))); ND_PRINT((ndo, "\n\t ifstatus %u, adminstatus: %s, operstatus: %s", - 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")); + EXTRACT_BE_U_4(sflow_gen_counter->ifstatus), + EXTRACT_BE_U_4(sflow_gen_counter->ifstatus)&1 ? "up" : "down", + (EXTRACT_BE_U_4(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_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))); + EXTRACT_BE_U_8(sflow_gen_counter->ifinoctets), + EXTRACT_BE_U_4(sflow_gen_counter->ifinunicastpkts), + EXTRACT_BE_U_4(sflow_gen_counter->ifinmulticastpkts), + EXTRACT_BE_U_4(sflow_gen_counter->ifinbroadcastpkts), + EXTRACT_BE_U_4(sflow_gen_counter->ifindiscards))); ND_PRINT((ndo, "\n\t In errors %u, unknown protos %u", - EXTRACT_BE_32BITS(sflow_gen_counter->ifinerrors), - EXTRACT_BE_32BITS(sflow_gen_counter->ifinunkownprotos))); + EXTRACT_BE_U_4(sflow_gen_counter->ifinerrors), + EXTRACT_BE_U_4(sflow_gen_counter->ifinunkownprotos))); ND_PRINT((ndo, "\n\t Out octets %" PRIu64 ", unicast pkts %u, multicast pkts %u, broadcast pkts %u, discards %u", - 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))); + EXTRACT_BE_U_8(sflow_gen_counter->ifoutoctets), + EXTRACT_BE_U_4(sflow_gen_counter->ifoutunicastpkts), + EXTRACT_BE_U_4(sflow_gen_counter->ifoutmulticastpkts), + EXTRACT_BE_U_4(sflow_gen_counter->ifoutbroadcastpkts), + EXTRACT_BE_U_4(sflow_gen_counter->ifoutdiscards))); ND_PRINT((ndo, "\n\t Out errors %u, promisc mode %u", - EXTRACT_BE_32BITS(sflow_gen_counter->ifouterrors), - EXTRACT_BE_32BITS(sflow_gen_counter->ifpromiscmode))); + EXTRACT_BE_U_4(sflow_gen_counter->ifouterrors), + EXTRACT_BE_U_4(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_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))); + EXTRACT_BE_U_4(sflow_eth_counter->alignerrors), + EXTRACT_BE_U_4(sflow_eth_counter->fcserrors), + EXTRACT_BE_U_4(sflow_eth_counter->single_collision_frames), + EXTRACT_BE_U_4(sflow_eth_counter->multiple_collision_frames), + EXTRACT_BE_U_4(sflow_eth_counter->test_errors))); ND_PRINT((ndo, "\n\t deferred %u, late collision %u, excessive collision %u, mac trans error %u", - 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))); + EXTRACT_BE_U_4(sflow_eth_counter->deferred_transmissions), + EXTRACT_BE_U_4(sflow_eth_counter->late_collisions), + EXTRACT_BE_U_4(sflow_eth_counter->excessive_collisions), + EXTRACT_BE_U_4(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_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))); + EXTRACT_BE_U_4(sflow_eth_counter->carrier_sense_errors), + EXTRACT_BE_U_4(sflow_eth_counter->frame_too_longs), + EXTRACT_BE_U_4(sflow_eth_counter->mac_receive_errors), + EXTRACT_BE_U_4(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_BE_32BITS(sflow_100basevg_counter->in_highpriority_frames), - EXTRACT_BE_64BITS(sflow_100basevg_counter->in_highpriority_octets))); + EXTRACT_BE_U_4(sflow_100basevg_counter->in_highpriority_frames), + EXTRACT_BE_U_8(sflow_100basevg_counter->in_highpriority_octets))); ND_PRINT((ndo, "\n\t in norm prio frames %u, in norm prio octets %" PRIu64, - EXTRACT_BE_32BITS(sflow_100basevg_counter->in_normpriority_frames), - EXTRACT_BE_64BITS(sflow_100basevg_counter->in_normpriority_octets))); + EXTRACT_BE_U_4(sflow_100basevg_counter->in_normpriority_frames), + EXTRACT_BE_U_8(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_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))); + EXTRACT_BE_U_4(sflow_100basevg_counter->in_ipmerrors), + EXTRACT_BE_U_4(sflow_100basevg_counter->in_oversized), + EXTRACT_BE_U_4(sflow_100basevg_counter->in_data_errors), + EXTRACT_BE_U_4(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_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))); + EXTRACT_BE_U_4(sflow_100basevg_counter->out_highpriority_frames), + EXTRACT_BE_U_8(sflow_100basevg_counter->out_highpriority_octets), + EXTRACT_BE_U_4(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_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))); + EXTRACT_BE_U_8(sflow_100basevg_counter->hc_in_highpriority_octets), + EXTRACT_BE_U_8(sflow_100basevg_counter->hc_in_normpriority_octets), + EXTRACT_BE_U_8(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_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))); + EXTRACT_BE_U_4(sflow_vlan_counter->vlan_id), + EXTRACT_BE_U_8(sflow_vlan_counter->octets), + EXTRACT_BE_U_4(sflow_vlan_counter->unicast_pkt), + EXTRACT_BE_U_4(sflow_vlan_counter->multicast_pkt), + EXTRACT_BE_U_4(sflow_vlan_counter->broadcast_pkt), + EXTRACT_BE_U_4(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_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))); + EXTRACT_BE_U_4(sflow_processor_counter->five_sec_util), + EXTRACT_BE_U_4(sflow_processor_counter->one_min_util), + EXTRACT_BE_U_4(sflow_processor_counter->five_min_util), + EXTRACT_BE_U_8(sflow_processor_counter->total_memory), + EXTRACT_BE_U_8(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_BE_32BITS(sflow_counter_record->format); + enterprise = EXTRACT_BE_U_4(sflow_counter_record->format); counter_type = enterprise & 0x0FFF; enterprise = enterprise >> 20; - counter_len = EXTRACT_BE_32BITS(sflow_counter_record->length); + counter_len = EXTRACT_BE_U_4(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_BE_32BITS(sflow_counter_sample->typesource); - nrecords = EXTRACT_BE_32BITS(sflow_counter_sample->records); + typesource = EXTRACT_BE_U_4(sflow_counter_sample->typesource); + nrecords = EXTRACT_BE_U_4(sflow_counter_sample->records); type = typesource >> 24; index = typesource & 0x0FFF; ND_PRINT((ndo, " seqnum %u, type %u, idx %u, records %u", - EXTRACT_BE_32BITS(sflow_counter_sample->seqnum), + EXTRACT_BE_U_4(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_BE_32BITS(sflow_expanded_counter_sample->records); + nrecords = EXTRACT_BE_U_4(sflow_expanded_counter_sample->records); ND_PRINT((ndo, " seqnum %u, type %u, idx %u, records %u", - EXTRACT_BE_32BITS(sflow_expanded_counter_sample->seqnum), - EXTRACT_BE_32BITS(sflow_expanded_counter_sample->type), - EXTRACT_BE_32BITS(sflow_expanded_counter_sample->index), + EXTRACT_BE_U_4(sflow_expanded_counter_sample->seqnum), + EXTRACT_BE_U_4(sflow_expanded_counter_sample->type), + EXTRACT_BE_U_4(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_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))); + tok2str(sflow_flow_raw_protocol_values,"Unknown",EXTRACT_BE_U_4(sflow_flow_raw->protocol)), + EXTRACT_BE_U_4(sflow_flow_raw->protocol), + EXTRACT_BE_U_4(sflow_flow_raw->length), + EXTRACT_BE_U_4(sflow_flow_raw->stripped_bytes), + EXTRACT_BE_U_4(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_BE_32BITS(sflow_ethernet_frame->length), - EXTRACT_BE_32BITS(sflow_ethernet_frame->type))); + EXTRACT_BE_U_4(sflow_ethernet_frame->length), + EXTRACT_BE_U_4(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_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))); + EXTRACT_BE_U_4(sflow_extended_sw_data->src_vlan), + EXTRACT_BE_U_4(sflow_extended_sw_data->src_pri), + EXTRACT_BE_U_4(sflow_extended_sw_data->dst_vlan), + EXTRACT_BE_U_4(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_BE_32BITS(sflow_flow_record->format); + enterprise = EXTRACT_BE_U_4(sflow_flow_record->format); flow_type = enterprise & 0x0FFF; enterprise = enterprise >> 12; - flow_len = EXTRACT_BE_32BITS(sflow_flow_record->length); + flow_len = EXTRACT_BE_U_4(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_BE_32BITS(sflow_flow_sample->typesource); - nrecords = EXTRACT_BE_32BITS(sflow_flow_sample->records); + typesource = EXTRACT_BE_U_4(sflow_flow_sample->typesource); + nrecords = EXTRACT_BE_U_4(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_BE_32BITS(sflow_flow_sample->seqnum), + EXTRACT_BE_U_4(sflow_flow_sample->seqnum), type, index, - 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), + EXTRACT_BE_U_4(sflow_flow_sample->rate), + EXTRACT_BE_U_4(sflow_flow_sample->pool), + EXTRACT_BE_U_4(sflow_flow_sample->drops), + EXTRACT_BE_U_4(sflow_flow_sample->in_interface), + EXTRACT_BE_U_4(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_BE_32BITS(sflow_expanded_flow_sample->records); + nrecords = EXTRACT_BE_U_4(sflow_expanded_flow_sample->records); ND_PRINT((ndo, " seqnum %u, type %u, idx %u, rate %u, pool %u, drops %u, records %u", - 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))); + EXTRACT_BE_U_4(sflow_expanded_flow_sample->seqnum), + EXTRACT_BE_U_4(sflow_expanded_flow_sample->type), + EXTRACT_BE_U_4(sflow_expanded_flow_sample->index), + EXTRACT_BE_U_4(sflow_expanded_flow_sample->rate), + EXTRACT_BE_U_4(sflow_expanded_flow_sample->pool), + EXTRACT_BE_U_4(sflow_expanded_flow_sample->drops), + EXTRACT_BE_U_4(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_BE_32BITS(sflow_datagram->version) != 5) { + if (EXTRACT_BE_U_4(sflow_datagram->version) != 5) { ND_PRINT((ndo, "sFlow version %u packet not supported", - EXTRACT_BE_32BITS(sflow_datagram->version))); + EXTRACT_BE_U_4(sflow_datagram->version))); return; } if (ndo->ndo_vflag < 1) { ND_PRINT((ndo, "sFlowv%u, %s agent %s, agent-id %u, length %u", - EXTRACT_BE_32BITS(sflow_datagram->version), - EXTRACT_BE_32BITS(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6", + EXTRACT_BE_U_4(sflow_datagram->version), + EXTRACT_BE_U_4(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6", ipaddr_string(ndo, sflow_datagram->agent), - EXTRACT_BE_32BITS(sflow_datagram->agent_id), + EXTRACT_BE_U_4(sflow_datagram->agent_id), len)); return; } /* ok they seem to want to know everything - lets fully decode it */ - nsamples=EXTRACT_BE_32BITS(sflow_datagram->samples); + nsamples=EXTRACT_BE_U_4(sflow_datagram->samples); ND_PRINT((ndo, "sFlowv%u, %s agent %s, agent-id %u, seqnum %u, uptime %u, samples %u, length %u", - EXTRACT_BE_32BITS(sflow_datagram->version), - EXTRACT_BE_32BITS(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6", + EXTRACT_BE_U_4(sflow_datagram->version), + EXTRACT_BE_U_4(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6", ipaddr_string(ndo, sflow_datagram->agent), - EXTRACT_BE_32BITS(sflow_datagram->agent_id), - EXTRACT_BE_32BITS(sflow_datagram->seqnum), - EXTRACT_BE_32BITS(sflow_datagram->uptime), + EXTRACT_BE_U_4(sflow_datagram->agent_id), + EXTRACT_BE_U_4(sflow_datagram->seqnum), + EXTRACT_BE_U_4(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_BE_32BITS(sflow_sample->format)&0x0FFF); - sflow_sample_len = EXTRACT_BE_32BITS(sflow_sample->len); + sflow_sample_type = (EXTRACT_BE_U_4(sflow_sample->format)&0x0FFF); + sflow_sample_len = EXTRACT_BE_U_4(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_BE_16BITS(cp); + i = EXTRACT_BE_U_2(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_BE_16BITS(cp); + i = EXTRACT_BE_U_2(cp); cp += 2; } if (i >= 0) @@ -231,10 +231,10 @@ compressed_sl_print(netdissect_options *ndo, register const u_char *cp = chdr; register u_int flags, hlen; - flags = EXTRACT_8BITS(cp); + flags = EXTRACT_U_1(cp); cp++; if (flags & NEW_C) { - lastconn = EXTRACT_8BITS(cp); + lastconn = EXTRACT_U_1(cp); cp++; ND_PRINT((ndo, "ctcp %d", lastconn)); } else diff --git a/print-sll.c b/print-sll.c index 712c2279..58a1649e 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_BE_16BITS(&sllp->sll_pkttype)))); + ND_PRINT((ndo, "%3s ",tok2str(sll_pkttype_values,"?",EXTRACT_BE_U_2(&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_BE_16BITS(&sllp->sll_halen) == 6) + if (EXTRACT_BE_U_2(&sllp->sll_halen) == 6) ND_PRINT((ndo, "%s ", etheraddr_string(ndo, sllp->sll_addr))); if (!ndo->ndo_qflag) { - ether_type = EXTRACT_BE_16BITS(&sllp->sll_protocol); + ether_type = EXTRACT_BE_U_2(&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_BE_16BITS(&sllp->sll_protocol); + ether_type = EXTRACT_BE_U_2(&sllp->sll_protocol); recurse: /* @@ -279,12 +279,12 @@ recurse: return (hdrlen + length); } if (ndo->ndo_eflag) { - uint16_t tag = EXTRACT_BE_16BITS(p); + uint16_t tag = EXTRACT_BE_U_2(p); ND_PRINT((ndo, "%s, ", ieee8021q_tci_string(tag))); } - ether_type = EXTRACT_BE_16BITS(p + 2); + ether_type = EXTRACT_BE_U_2(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 8b3dca10..2e2479ea 100644 --- a/print-slow.c +++ b/print-slow.c @@ -292,7 +292,7 @@ slow_print(netdissect_options *ndo, if (print_version == 1) { ND_PRINT((ndo, "%sv%u, length %u", tok2str(slow_proto_values, "unknown (%u)", subtype), - EXTRACT_8BITS((pptr + 1)), + EXTRACT_U_1((pptr + 1)), len)); } else { /* some slow protos don't have a version number in the header */ @@ -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_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), + EXTRACT_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->sys_pri), + EXTRACT_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->key), + EXTRACT_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->port), + EXTRACT_BE_U_2(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_BE_16BITS(tlv_ptr.lacp_tlv_collector_info->max_delay))); + EXTRACT_BE_U_2(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_BE_16BITS(tlv_ptr.marker_tlv_marker_info->req_port), - EXTRACT_BE_32BITS(tlv_ptr.marker_tlv_marker_info->req_trans_id))); + EXTRACT_BE_U_2(tlv_ptr.marker_tlv_marker_info->req_port), + EXTRACT_BE_U_4(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_BE_16BITS(&ptr.slow_oam_common_header->flags)))); + EXTRACT_BE_U_2(&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_BE_16BITS(&tlv.slow_oam_info->revision))); + EXTRACT_BE_U_2(&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_BE_16BITS(&tlv.slow_oam_info->oam_pdu_config) & + EXTRACT_BE_U_2(&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_BE_24BITS(&tlv.slow_oam_info->oui)), - EXTRACT_BE_24BITS(&tlv.slow_oam_info->oui), - EXTRACT_BE_32BITS(&tlv.slow_oam_info->vendor_private))); + EXTRACT_BE_U_3(&tlv.slow_oam_info->oui)), + EXTRACT_BE_U_3(&tlv.slow_oam_info->oui), + EXTRACT_BE_U_4(&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_BE_16BITS(tptr))); + ND_PRINT((ndo, "\n\t Sequence Number %u", EXTRACT_BE_U_2(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_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))); + EXTRACT_BE_U_2(&tlv.slow_oam_link_event->time_stamp)*100, + EXTRACT_BE_U_8(&tlv.slow_oam_link_event->window), + EXTRACT_BE_U_8(&tlv.slow_oam_link_event->threshold), + EXTRACT_BE_U_8(&tlv.slow_oam_link_event->errors), + EXTRACT_BE_U_8(&tlv.slow_oam_link_event->errors_running_total), + EXTRACT_BE_U_4(&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 f6d8bbbc..fc95562c 100644 --- a/print-smb.c +++ b/print-smb.c @@ -114,7 +114,7 @@ trans2_qfsinfo(netdissect_options *ndo, if (request) { ND_TCHECK2(*param, 2); - level = EXTRACT_LE_16BITS(param); + level = EXTRACT_LE_U_2(param); fmt = "InfoLevel=[d]\n"; smb_fdata(ndo, param, fmt, param + pcnt, unicodestr); } else { @@ -182,11 +182,11 @@ print_trans2(netdissect_options *ndo, ND_TCHECK(words[0]); if (request) { ND_TCHECK2(w[14 * 2], 2); - pcnt = EXTRACT_LE_16BITS(w + 9 * 2); - param = buf + EXTRACT_LE_16BITS(w + 10 * 2); - dcnt = EXTRACT_LE_16BITS(w + 11 * 2); - data = buf + EXTRACT_LE_16BITS(w + 12 * 2); - fn = smbfindint(EXTRACT_LE_16BITS(w + 14 * 2), trans2_fns); + pcnt = EXTRACT_LE_U_2(w + 9 * 2); + param = buf + EXTRACT_LE_U_2(w + 10 * 2); + dcnt = EXTRACT_LE_U_2(w + 11 * 2); + data = buf + EXTRACT_LE_U_2(w + 12 * 2); + fn = smbfindint(EXTRACT_LE_U_2(w + 14 * 2), trans2_fns); } else { if (words[0] == 0) { ND_PRINT((ndo, "%s\n", fn->name)); @@ -194,10 +194,10 @@ print_trans2(netdissect_options *ndo, return; } ND_TCHECK2(w[7 * 2], 2); - pcnt = EXTRACT_LE_16BITS(w + 3 * 2); - param = buf + EXTRACT_LE_16BITS(w + 4 * 2); - dcnt = EXTRACT_LE_16BITS(w + 6 * 2); - data = buf + EXTRACT_LE_16BITS(w + 7 * 2); + pcnt = EXTRACT_LE_U_2(w + 3 * 2); + param = buf + EXTRACT_LE_U_2(w + 4 * 2); + dcnt = EXTRACT_LE_U_2(w + 6 * 2); + data = buf + EXTRACT_LE_U_2(w + 7 * 2); } ND_PRINT((ndo, "%s param_length=%d data_length=%d\n", fn->name, pcnt, dcnt)); @@ -224,7 +224,7 @@ print_trans2(netdissect_options *ndo, } ND_TCHECK2(*dat, 2); - bcc = EXTRACT_LE_16BITS(dat); + bcc = EXTRACT_LE_U_2(dat); ND_PRINT((ndo, "smb_bcc=%u\n", bcc)); if (fn->descript.fn) (*fn->descript.fn)(ndo, param, data, pcnt, dcnt); @@ -343,20 +343,20 @@ print_trans(netdissect_options *ndo, if (request) { ND_TCHECK2(w[12 * 2], 2); - paramlen = EXTRACT_LE_16BITS(w + 9 * 2); - param = buf + EXTRACT_LE_16BITS(w + 10 * 2); - datalen = EXTRACT_LE_16BITS(w + 11 * 2); - data = buf + EXTRACT_LE_16BITS(w + 12 * 2); + paramlen = EXTRACT_LE_U_2(w + 9 * 2); + param = buf + EXTRACT_LE_U_2(w + 10 * 2); + datalen = EXTRACT_LE_U_2(w + 11 * 2); + data = buf + EXTRACT_LE_U_2(w + 12 * 2); f1 = "TotParamCnt=[d] \nTotDataCnt=[d] \nMaxParmCnt=[d] \nMaxDataCnt=[d]\nMaxSCnt=[d] \nTransFlags=[w] \nRes1=[w] \nRes2=[w] \nRes3=[w]\nParamCnt=[d] \nParamOff=[d] \nDataCnt=[d] \nDataOff=[d] \nSUCnt=[d]\n"; f2 = "|Name=[S]\n"; f3 = "|Param "; f4 = "|Data "; } else { ND_TCHECK2(w[7 * 2], 2); - paramlen = EXTRACT_LE_16BITS(w + 3 * 2); - param = buf + EXTRACT_LE_16BITS(w + 4 * 2); - datalen = EXTRACT_LE_16BITS(w + 6 * 2); - data = buf + EXTRACT_LE_16BITS(w + 7 * 2); + paramlen = EXTRACT_LE_U_2(w + 3 * 2); + param = buf + EXTRACT_LE_U_2(w + 4 * 2); + datalen = EXTRACT_LE_U_2(w + 6 * 2); + data = buf + EXTRACT_LE_U_2(w + 7 * 2); f1 = "TotParamCnt=[d] \nTotDataCnt=[d] \nRes1=[d]\nParamCnt=[d] \nParamOff=[d] \nRes2=[d] \nDataCnt=[d] \nDataOff=[d] \nRes3=[d]\nLsetup=[d]\n"; f2 = "|Unknown "; f3 = "|Param "; @@ -367,7 +367,7 @@ print_trans(netdissect_options *ndo, unicodestr); ND_TCHECK2(*data1, 2); - bcc = EXTRACT_LE_16BITS(data1); + bcc = EXTRACT_LE_U_2(data1); ND_PRINT((ndo, "smb_bcc=%u\n", bcc)); if (bcc > 0) { smb_fdata(ndo, data1 + 2, f2, maxbuf - (paramlen + datalen), unicodestr); @@ -420,14 +420,15 @@ print_negprot(netdissect_options *ndo, smb_print_data(ndo, words + 1, min(wct * 2, PTR_DIFF(maxbuf, words + 1))); ND_TCHECK2(*data, 2); - bcc = EXTRACT_LE_16BITS(data); + bcc = EXTRACT_LE_U_2(data); ND_PRINT((ndo, "smb_bcc=%u\n", bcc)); if (bcc > 0) { if (f2) - smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_16BITS(data), - maxbuf), unicodestr); + smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_U_2(data), + maxbuf), unicodestr); else - smb_print_data(ndo, data + 2, min(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2))); + smb_print_data(ndo, data + 2, + min(EXTRACT_LE_U_2(data), PTR_DIFF(maxbuf, data + 2))); } return; trunc: @@ -464,14 +465,15 @@ print_sesssetup(netdissect_options *ndo, smb_print_data(ndo, words + 1, min(wct * 2, PTR_DIFF(maxbuf, words + 1))); ND_TCHECK2(*data, 2); - bcc = EXTRACT_LE_16BITS(data); + bcc = EXTRACT_LE_U_2(data); ND_PRINT((ndo, "smb_bcc=%u\n", bcc)); if (bcc > 0) { if (f2) - smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_16BITS(data), - maxbuf), unicodestr); + smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_U_2(data), + maxbuf), unicodestr); else - smb_print_data(ndo, data + 2, min(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2))); + smb_print_data(ndo, data + 2, + min(EXTRACT_LE_U_2(data), PTR_DIFF(maxbuf, data + 2))); } return; trunc: @@ -504,14 +506,15 @@ print_lockingandx(netdissect_options *ndo, smb_fdata(ndo, words + 1, f1, maxwords, unicodestr); ND_TCHECK2(*data, 2); - bcc = EXTRACT_LE_16BITS(data); + bcc = EXTRACT_LE_U_2(data); ND_PRINT((ndo, "smb_bcc=%u\n", bcc)); if (bcc > 0) { if (f2) - smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_16BITS(data), - maxbuf), unicodestr); + smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_U_2(data), + maxbuf), unicodestr); else - smb_print_data(ndo, data + 2, min(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2))); + smb_print_data(ndo, data + 2, + min(EXTRACT_LE_U_2(data), PTR_DIFF(maxbuf, data + 2))); } return; trunc: @@ -821,7 +824,7 @@ print_smb(netdissect_options *ndo, return; ND_TCHECK_2(&buf[10]); - flags2 = EXTRACT_LE_16BITS(buf + 10); + flags2 = EXTRACT_LE_U_2(buf + 10); unicodestr = flags2 & 0x8000; nterrcodes = flags2 & 0x4000; @@ -829,12 +832,12 @@ print_smb(netdissect_options *ndo, smb_fdata(ndo, buf, fmt_smbheader, buf + 33, unicodestr); if (nterrcodes) { - nterror = EXTRACT_LE_32BITS(buf + 5); + nterror = EXTRACT_LE_U_4(buf + 5); if (nterror) ND_PRINT((ndo, "NTError = %s\n", nt_errstr(nterror))); } else { if (buf[5]) - ND_PRINT((ndo, "SMBError = %s\n", smb_errstr(buf[5], EXTRACT_LE_16BITS(buf + 7)))); + ND_PRINT((ndo, "SMBError = %s\n", smb_errstr(buf[5], EXTRACT_LE_U_2(buf + 7)))); } smboffset = 32; @@ -871,14 +874,14 @@ print_smb(netdissect_options *ndo, for (i = 0; &words[1 + 2 * i] < maxwords; i++) { ND_TCHECK2(words[1 + 2 * i], 2); - v = EXTRACT_LE_16BITS(words + 1 + 2 * i); + v = EXTRACT_LE_U_2(words + 1 + 2 * i); ND_PRINT((ndo, "smb_vwv[%d]=%d (0x%X)\n", i, v, v)); } } } ND_TCHECK2(*data, 2); - bcc = EXTRACT_LE_16BITS(data); + bcc = EXTRACT_LE_U_2(data); ND_PRINT((ndo, "smb_bcc=%u\n", bcc)); if (f2) { if (bcc > 0) @@ -900,7 +903,7 @@ print_smb(netdissect_options *ndo, if (command == 0xFF) break; ND_TCHECK2(words[3], 2); - newsmboffset = EXTRACT_LE_16BITS(words + 3); + newsmboffset = EXTRACT_LE_U_2(words + 3); fn = smbfind(command, smb_fns); @@ -941,7 +944,7 @@ nbt_tcp_print(netdissect_options *ndo, goto trunc; maxbuf = data + caplen; type = data[0]; - nbt_len = EXTRACT_BE_16BITS(data + 2); + nbt_len = EXTRACT_BE_U_2(data + 2); length -= 4; caplen -= 4; @@ -1107,15 +1110,15 @@ nbt_udp137_print(netdissect_options *ndo, int total, i; ND_TCHECK2(data[10], 2); - name_trn_id = EXTRACT_BE_16BITS(data); + name_trn_id = EXTRACT_BE_U_2(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_BE_16BITS(data + 4); - ancount = EXTRACT_BE_16BITS(data + 6); - nscount = EXTRACT_BE_16BITS(data + 8); - arcount = EXTRACT_BE_16BITS(data + 10); + qdcount = EXTRACT_BE_U_2(data + 4); + ancount = EXTRACT_BE_U_2(data + 6); + nscount = EXTRACT_BE_U_2(data + 8); + arcount = EXTRACT_BE_U_2(data + 10); startbuf = data; if (maxbuf <= data) @@ -1168,12 +1171,12 @@ nbt_udp137_print(netdissect_options *ndo, if (p == NULL) goto out; ND_TCHECK_2(p); - restype = EXTRACT_BE_16BITS(p); + restype = EXTRACT_BE_U_2(p); p = smb_fdata(ndo, p, "ResType=[rw]\nResClass=[rw]\nTTL=[rD]\n", p + 8, 0); if (p == NULL) goto out; ND_TCHECK_2(p); - rdlen = EXTRACT_BE_16BITS(p); + rdlen = EXTRACT_BE_U_2(p); ND_PRINT((ndo, "ResourceLength=%d\nResourceData=\n", rdlen)); p += 2; if (rdlen == 6) { @@ -1250,7 +1253,7 @@ smb_tcp_print(netdissect_options *ndo, if (caplen < 4) goto trunc; maxbuf = data + caplen; - smb_len = EXTRACT_BE_24BITS(data + 1); + smb_len = EXTRACT_BE_U_3(data + 1); length -= 4; caplen -= 4; @@ -1382,7 +1385,7 @@ netbeui_print(netdissect_options *ndo, if (maxbuf > ndo->ndo_snapend) maxbuf = ndo->ndo_snapend; ND_TCHECK(data[4]); - len = EXTRACT_LE_16BITS(data); + len = EXTRACT_LE_U_2(data); command = data[4]; data2 = data + len; if (data2 >= maxbuf) { diff --git a/print-snmp.c b/print-snmp.c index 8328e0a6..99df8476 100644 --- a/print-snmp.c +++ b/print-snmp.c @@ -438,9 +438,9 @@ asn1_parse(netdissect_options *ndo, * +---+---+---+---+---+---+---+---+ * 7 6 5 4 3 2 1 0 */ - id = EXTRACT_8BITS(p) & ASN_ID_BITS; /* lower 5 bits, range 00-1f */ + id = EXTRACT_U_1(p) & ASN_ID_BITS; /* lower 5 bits, range 00-1f */ #ifdef notdef - form = (EXTRACT_8BITS(p) & 0xe0) >> 5; /* move upper 3 bits to lower 3 */ + form = (EXTRACT_U_1(p) & 0xe0) >> 5; /* move upper 3 bits to lower 3 */ class = form >> 1; /* bits 7&6 -> bits 1&0, range 0-3 */ form &= 0x1; /* bit 5 -> bit 0, range 0-1 */ #else @@ -481,7 +481,7 @@ asn1_parse(netdissect_options *ndo, return -1; } ND_TCHECK(*p); - elem->id = id = (id << 7) | EXTRACT_8BITS(p); + elem->id = id = (id << 7) | EXTRACT_U_1(p); --len; ++hdr; ++p; @@ -502,7 +502,7 @@ asn1_parse(netdissect_options *ndo, } ND_TCHECK2(*p, noct); for (; noct-- > 0; len--, hdr++) { - elem->asnlen = (elem->asnlen << ASN_SHIFT8) | EXTRACT_8BITS(p); + elem->asnlen = (elem->asnlen << ASN_SHIFT8) | EXTRACT_U_1(p); p++; } } @@ -546,7 +546,7 @@ asn1_parse(netdissect_options *ndo, if (*p & ASN_BIT8) /* negative */ data = -1; for (i = elem->asnlen; i-- > 0; p++) - data = (data << ASN_SHIFT8) | EXTRACT_8BITS(p); + data = (data << ASN_SHIFT8) | EXTRACT_U_1(p); elem->data.integer = data; break; } @@ -583,7 +583,7 @@ asn1_parse(netdissect_options *ndo, elem->type = BE_UNS; data = 0; for (i = elem->asnlen; i-- > 0; p++) - data = (data << 8) + EXTRACT_8BITS(p); + data = (data << 8) + EXTRACT_U_1(p); elem->data.uns = data; break; } @@ -593,7 +593,7 @@ asn1_parse(netdissect_options *ndo, elem->type = BE_UNS64; data64 = 0; for (i = elem->asnlen; i-- > 0; p++) - data64 = (data64 << 8) + EXTRACT_8BITS(p); + data64 = (data64 << 8) + EXTRACT_U_1(p); elem->data.uns64 = data64; break; } diff --git a/print-stp.c b/print-stp.c index 52c3ebe7..0fe292fd 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_BE_16BITS(&stp_bpdu->port_id), length)); + EXTRACT_BE_U_2(&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_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)); + (float) EXTRACT_BE_U_2(&stp_bpdu->message_age) / STP_TIME_BASE, + (float) EXTRACT_BE_U_2(&stp_bpdu->max_age) / STP_TIME_BASE, + (float) EXTRACT_BE_U_2(&stp_bpdu->hello_time) / STP_TIME_BASE, + (float) EXTRACT_BE_U_2(&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_BE_32BITS(&stp_bpdu->root_path_cost))); + EXTRACT_BE_U_4(&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_BE_32BITS(&stp_bpdu->root_path_cost))); + EXTRACT_BE_U_4(&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_BE_16BITS(&stp_bpdu->port_id))); + ND_PRINT((ndo, "CIST port-id %04x,", EXTRACT_BE_U_2(&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_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)); + (float) EXTRACT_BE_U_2(&stp_bpdu->message_age) / STP_TIME_BASE, + (float) EXTRACT_BE_U_2(&stp_bpdu->max_age) / STP_TIME_BASE, + (float) EXTRACT_BE_U_2(&stp_bpdu->hello_time) / STP_TIME_BASE, + (float) EXTRACT_BE_U_2(&stp_bpdu->forward_delay) / STP_TIME_BASE)); ND_TCHECK_2(ptr + MST_BPDU_VER3_LEN_OFFSET); - ND_PRINT((ndo, "\n\tv3len %d, ", EXTRACT_BE_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET))); + ND_PRINT((ndo, "\n\tv3len %d, ", EXTRACT_BE_U_2(ptr + MST_BPDU_VER3_LEN_OFFSET))); ND_TCHECK_4(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_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))); + EXTRACT_BE_U_2(ptr + MST_BPDU_CONFIG_NAME_OFFSET + 32), + EXTRACT_BE_U_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET), + EXTRACT_BE_U_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 4), + EXTRACT_BE_U_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 8), + EXTRACT_BE_U_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12))); ND_TCHECK_4(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET); ND_PRINT((ndo, "CIST int-root-pathcost %u,", - EXTRACT_BE_32BITS(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET))); + EXTRACT_BE_U_4(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,14 +308,14 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, /* Dump all MSTI's */ ND_TCHECK_2(ptr + MST_BPDU_VER3_LEN_OFFSET); - v3len = EXTRACT_BE_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET); + v3len = EXTRACT_BE_U_2(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_BE_16BITS(ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET); + msti = EXTRACT_BE_U_2(ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET); msti = msti & 0x0FFF; ND_PRINT((ndo, "\n\tMSTI %d, Flags [%s], port-role %s", @@ -325,7 +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_BE_32BITS(ptr + offset + MST_BPDU_MSTI_ROOT_PATH_COST_OFFSET))); + EXTRACT_BE_U_4(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, @@ -357,17 +357,17 @@ stp_print_spb_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ptr = (const u_char *)stp_bpdu; ND_TCHECK_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 16); - ND_PRINT((ndo, "\n\tv4len %d, ", EXTRACT_BE_16BITS(ptr + offset))); + ND_PRINT((ndo, "\n\tv4len %d, ", EXTRACT_BE_U_2(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_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))); + EXTRACT_BE_U_2(ptr + offset + SPB_BPDU_CONFIG_REV_OFFSET), + EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET), + EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 4), + EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 8), + EXTRACT_BE_U_4(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, " @@ -381,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_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))); + EXTRACT_BE_U_2(ptr + offset + SPB_BPDU_AGREEMENT_EDGE_OFFSET), + EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET), + EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 4), + EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 8), + EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 12), + EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 16))); return 1; trunc: @@ -410,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_BE_16BITS(&stp_bpdu->protocol_id)) { + if (EXTRACT_BE_U_2(&stp_bpdu->protocol_id)) { ND_PRINT((ndo, "unknown STP version, length %u", length)); return; } @@ -463,7 +463,7 @@ stp_print(netdissect_options *ndo, const u_char *p, u_int length) /* Validate v3 length */ ND_TCHECK_2(p + MST_BPDU_VER3_LEN_OFFSET); - mstp_len = EXTRACT_BE_16BITS(p + MST_BPDU_VER3_LEN_OFFSET); + mstp_len = EXTRACT_BE_U_2(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; @@ -475,7 +475,7 @@ stp_print(netdissect_options *ndo, const u_char *p, u_int length) { /* Validate v4 length */ ND_TCHECK_2(p + MST_BPDU_VER3_LEN_OFFSET + mstp_len); - spb_len = EXTRACT_BE_16BITS(p + MST_BPDU_VER3_LEN_OFFSET + mstp_len); + spb_len = EXTRACT_BE_U_2(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 8c0b26a8..8c0b132a 100644 --- a/print-sunatm.c +++ b/print-sunatm.c @@ -96,7 +96,7 @@ sunatm_if_print(netdissect_options *ndo, break; } - vci = EXTRACT_BE_16BITS(p + VCI_POS); + vci = EXTRACT_BE_U_2(p + VCI_POS); vpi = p[VPI_POS]; p += PKT_BEGIN_POS; diff --git a/print-sunrpc.c b/print-sunrpc.c index 0e7af1b7..ce8b0393 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_BE_32BITS(&rp->rm_xid)); + EXTRACT_BE_U_4(&rp->rm_xid)); strlcpy(dstid, "sunrpc", sizeof(dstid)); } else { snprintf(srcid, sizeof(srcid), "0x%x", - EXTRACT_BE_32BITS(&rp->rm_xid)); + EXTRACT_BE_U_4(&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_BE_32BITS(&rp->rm_call.cb_proc)))); - x = EXTRACT_BE_32BITS(&rp->rm_call.cb_rpcvers); + EXTRACT_BE_U_4(&rp->rm_call.cb_proc)))); + x = EXTRACT_BE_U_4(&rp->rm_call.cb_rpcvers); if (x != 2) ND_PRINT((ndo, " [rpcver %u]", x)); - switch (EXTRACT_BE_32BITS(&rp->rm_call.cb_proc)) { + switch (EXTRACT_BE_U_4(&rp->rm_call.cb_proc)) { case SUNRPC_PMAPPROC_SET: case SUNRPC_PMAPPROC_UNSET: case SUNRPC_PMAPPROC_GETPORT: case SUNRPC_PMAPPROC_CALLIT: - x = EXTRACT_BE_32BITS(&rp->rm_call.cb_prog); + x = EXTRACT_BE_U_4(&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_BE_32BITS(&rp->rm_call.cb_vers))); + ND_PRINT((ndo, ".%u", EXTRACT_BE_U_4(&rp->rm_call.cb_vers))); break; } } diff --git a/print-symantec.c b/print-symantec.c index 595994cd..c1fe3bd4 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_BE_16BITS(&sp->ether_type); + etype = EXTRACT_BE_U_2(&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_BE_16BITS(&sp->ether_type); + ether_type = EXTRACT_BE_U_2(&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 793aec24..b60a5c4b 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -187,8 +187,8 @@ tcp_print(netdissect_options *ndo, return; } - sport = EXTRACT_BE_16BITS(&tp->th_sport); - dport = EXTRACT_BE_16BITS(&tp->th_dport); + sport = EXTRACT_BE_U_2(&tp->th_sport); + dport = EXTRACT_BE_U_2(&tp->th_dport); if (ip6) { if (ip6->ip6_nxt == IPPROTO_TCP) { @@ -224,10 +224,10 @@ tcp_print(netdissect_options *ndo, return; } - 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); + seq = EXTRACT_BE_U_4(&tp->th_seq); + ack = EXTRACT_BE_U_4(&tp->th_ack); + win = EXTRACT_BE_U_2(&tp->th_win); + urp = EXTRACT_BE_U_2(&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_BE_16BITS(&tp->th_sum); + tcp_sum = EXTRACT_BE_U_2(&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_BE_16BITS(&tp->th_sum); + tcp_sum = EXTRACT_BE_U_2(&tp->th_sum); ND_PRINT((ndo, ", cksum 0x%04x", tcp_sum)); if (sum != 0) @@ -429,13 +429,13 @@ tcp_print(netdissect_options *ndo, if (ch != '\0') ND_PRINT((ndo, "%c", ch)); ND_TCHECK(*cp); - opt = EXTRACT_8BITS(cp); + opt = EXTRACT_U_1(cp); cp++; if (ZEROLENOPT(opt)) len = 1; else { ND_TCHECK(*cp); - len = EXTRACT_8BITS(cp); + len = EXTRACT_U_1(cp); cp++; /* total including type, len */ if (len < 2 || len > hlen) goto bad; @@ -455,7 +455,7 @@ tcp_print(netdissect_options *ndo, case TCPOPT_MAXSEG: datalen = 2; LENCHECK(datalen); - ND_PRINT((ndo, " %u", EXTRACT_BE_16BITS(cp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_2(cp))); break; case TCPOPT_WSCALE: @@ -474,9 +474,9 @@ tcp_print(netdissect_options *ndo, ND_PRINT((ndo, " %d ", datalen / 8)); for (i = 0; i < datalen; i += 8) { LENCHECK(i + 4); - s = EXTRACT_BE_32BITS(cp + i); + s = EXTRACT_BE_U_4(cp + i); LENCHECK(i + 8); - e = EXTRACT_BE_32BITS(cp + i + 4); + e = EXTRACT_BE_U_4(cp + i + 4); if (rev) { s -= thseq; e -= thseq; @@ -501,15 +501,15 @@ tcp_print(netdissect_options *ndo, */ datalen = 4; LENCHECK(datalen); - ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(cp))); break; case TCPOPT_TIMESTAMP: datalen = 8; LENCHECK(datalen); ND_PRINT((ndo, " val %u ecr %u", - EXTRACT_BE_32BITS(cp), - EXTRACT_BE_32BITS(cp + 4))); + EXTRACT_BE_U_4(cp), + EXTRACT_BE_U_4(cp + 4))); break; case TCPOPT_SIGNATURE: @@ -582,7 +582,7 @@ tcp_print(netdissect_options *ndo, case TCPOPT_UTO: datalen = 2; LENCHECK(datalen); - utoval = EXTRACT_BE_16BITS(cp); + utoval = EXTRACT_BE_U_2(cp); ND_PRINT((ndo, " 0x%x", utoval)); if (utoval & 0x0001) utoval = (utoval >> 1) * 60; @@ -611,7 +611,7 @@ tcp_print(netdissect_options *ndo, if (datalen < 2) goto bad; /* RFC6994 */ - magic = EXTRACT_BE_16BITS(cp); + magic = EXTRACT_BE_U_2(cp); ND_PRINT((ndo, "-")); switch(magic) { @@ -744,19 +744,19 @@ tcp_print(netdissect_options *ndo, register const struct sunrpc_msg *rp; enum sunrpc_msg_type direction; - fraglen = EXTRACT_BE_32BITS(bp) & 0x7FFFFFFF; + fraglen = EXTRACT_BE_U_4(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_BE_32BITS(&rp->rm_direction); + direction = (enum sunrpc_msg_type) EXTRACT_BE_U_4(&rp->rm_direction); if (dport == NFS_PORT && direction == SUNRPC_CALL) { - ND_PRINT((ndo, ": NFS request xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid))); + ND_PRINT((ndo, ": NFS request xid %u ", EXTRACT_BE_U_4(&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_BE_32BITS(&rp->rm_xid))); + ND_PRINT((ndo, ": NFS reply xid %u ", EXTRACT_BE_U_4(&rp->rm_xid))); nfsreply_noaddr_print(ndo, (const u_char *)rp, fraglen, (const u_char *)ip); return; } @@ -803,7 +803,7 @@ print_tcp_rst_data(netdissect_options *ndo, } ND_PRINT((ndo, " ")); while (length-- && sp < ndo->ndo_snapend) { - c = EXTRACT_8BITS(sp); + c = EXTRACT_U_1(sp); sp++; safeputchar(ndo, c); } @@ -871,14 +871,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_BE_16BITS(&ip->ip_len) - IP_HL(ip) * 4; + tlen = EXTRACT_BE_U_2(&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_BE_16BITS(&ip6->ip6_plen)); + len32 = htonl(EXTRACT_BE_U_2(&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 a47a7847..314dfb41 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_2(bp); - opcode = EXTRACT_BE_16BITS(bp); + opcode = EXTRACT_BE_U_2(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_2(bp); - ND_PRINT((ndo, " block %d", EXTRACT_BE_16BITS(bp))); + ND_PRINT((ndo, " block %d", EXTRACT_BE_U_2(bp))); break; case TFTP_ERROR: @@ -178,7 +178,7 @@ tftp_print(netdissect_options *ndo, goto trunc; /* no error code */ ND_TCHECK_2(bp); ND_PRINT((ndo, " %s", tok2str(err2str, "tftp-err-#%d \"", - EXTRACT_BE_16BITS(bp)))); + EXTRACT_BE_U_2(bp)))); bp += 2; length -= 2; /* Print error message string */ diff --git a/print-timed.c b/print-timed.c index 528cfd45..33397c0d 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_BE_32BITS(&tsp->tsp_time.tv_sec); - usec = EXTRACT_BE_32BITS(&tsp->tsp_time.tv_usec); + sec = EXTRACT_BE_U_4(&tsp->tsp_time.tv_sec); + usec = EXTRACT_BE_U_4(&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 889c06c2..8c421ee3 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_BE_32BITS(&ap->w0); + w0 = EXTRACT_BE_U_4(&ap->w0); user = TIPC_USER(w0); hsize = TIPC_HSIZE(w0); msize = TIPC_MSIZE(w0); - w1 = EXTRACT_BE_32BITS(&ap->w1); + w1 = EXTRACT_BE_U_4(&ap->w1); mtype = TIPC_MTYPE(w1); - prev_node = EXTRACT_BE_32BITS(&ap->prev_node); - orig_port = EXTRACT_BE_32BITS(&ap->orig_port); - dest_port = EXTRACT_BE_32BITS(&ap->dest_port); + prev_node = EXTRACT_BE_U_4(&ap->prev_node); + orig_port = EXTRACT_BE_U_4(&ap->orig_port); + dest_port = EXTRACT_BE_U_4(&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_BE_32BITS(&ap->orig_node); - dest_node = EXTRACT_BE_32BITS(&ap->dest_node); + orig_node = EXTRACT_BE_U_4(&ap->orig_node); + dest_node = EXTRACT_BE_U_4(&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_BE_32BITS(&ap->w2); + w2 = EXTRACT_BE_U_4(&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_BE_32BITS(&ap->w0); + w0 = EXTRACT_BE_U_4(&ap->w0); user = TIPC_USER(w0); hsize = TIPC_HSIZE(w0); msize = TIPC_MSIZE(w0); - w1 = EXTRACT_BE_32BITS(&ap->w1); + w1 = EXTRACT_BE_U_4(&ap->w1); mtype = TIPC_MTYPE(w1); - orig_node = EXTRACT_BE_32BITS(&ap->orig_node); - dest_node = EXTRACT_BE_32BITS(&ap->dest_node); + orig_node = EXTRACT_BE_U_4(&ap->orig_node); + dest_node = EXTRACT_BE_U_4(&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_BE_32BITS(&ap->w2); + w2 = EXTRACT_BE_U_4(&ap->w2); bc_gap_after = TIPC_BC_GAP_AFTER(w2); bc_gap_to = TIPC_BC_GAP_TO(w2); - prev_node = EXTRACT_BE_32BITS(&ap->prev_node); - w4 = EXTRACT_BE_32BITS(&ap->w4); + prev_node = EXTRACT_BE_U_4(&ap->prev_node); + w4 = EXTRACT_BE_U_4(&ap->w4); last_sent_frag = TIPC_LAST_SENT_FRAG(w4); next_sent_frag = TIPC_NEXT_SENT_FRAG(w4); - w5 = EXTRACT_BE_32BITS(&ap->w5); + w5 = EXTRACT_BE_U_4(&ap->w5); sess_no = TIPC_SESS_NO(w5); - trans_seq = EXTRACT_BE_32BITS(&ap->trans_seq); - w9 = EXTRACT_BE_32BITS(&ap->w9); + trans_seq = EXTRACT_BE_U_4(&ap->trans_seq); + w9 = EXTRACT_BE_U_4(&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_BE_32BITS(&ap->w0); + w0 = EXTRACT_BE_U_4(&ap->w0); user = TIPC_USER(w0); hsize = TIPC_HSIZE(w0); msize = TIPC_MSIZE(w0); - w1 = EXTRACT_BE_32BITS(&ap->w1); + w1 = EXTRACT_BE_U_4(&ap->w1); mtype = TIPC_MTYPE(w1); - dest_domain = EXTRACT_BE_32BITS(&ap->dest_domain); - prev_node = EXTRACT_BE_32BITS(&ap->prev_node); + dest_domain = EXTRACT_BE_U_4(&ap->dest_domain); + prev_node = EXTRACT_BE_U_4(&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_BE_32BITS(&ap->ntwrk_id); - w5 = EXTRACT_BE_32BITS(&ap->w5); + ntwrk_id = EXTRACT_BE_U_4(&ap->ntwrk_id); + w5 = EXTRACT_BE_U_4(&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_BE_32BITS(&ap->w0); + w0 = EXTRACT_BE_U_4(&ap->w0); user = TIPC_USER(w0); switch (user) diff --git a/print-token.c b/print-token.c index af351bf4..730c155d 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_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 BROADCAST(trp) ((EXTRACT_BE_U_2(&(trp)->token_rcf) & 0xE000) >> 13) +#define RIF_LENGTH(trp) ((EXTRACT_BE_U_2(&(trp)->token_rcf) & 0x1f00) >> 8) +#define DIRECTION(trp) ((EXTRACT_BE_U_2(&(trp)->token_rcf) & 0x0080) >> 7) +#define LARGEST_FRAME(trp) ((EXTRACT_BE_U_2(&(trp)->token_rcf) & 0x0070) >> 4) +#define RING_NUMBER(trp, x) ((EXTRACT_BE_U_2(&(trp)->token_rseg[x]) & 0xfff0) >> 4) +#define BRIDGE_NUMBER(trp, x) ((EXTRACT_BE_U_2(&(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_BE_16BITS(&trp->token_rcf))); + ND_PRINT((ndo, "rt = %x", EXTRACT_BE_U_2(&trp->token_rcf))); for (seg = 0; seg < SEGMENT_COUNT(trp); seg++) - ND_PRINT((ndo, ":%x", EXTRACT_BE_16BITS(&trp->token_rseg[seg]))); + ND_PRINT((ndo, ":%x", EXTRACT_BE_U_2(&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 011fd8ad..69bdea46 100644 --- a/print-udld.c +++ b/print-udld.c @@ -112,8 +112,8 @@ udld_print (netdissect_options *ndo, const u_char *pptr, u_int length) UDLD_EXTRACT_VERSION(*tptr), tok2str(udld_code_values, "Reserved", code), code, - bittok2str(udld_flags_values, "none", EXTRACT_8BITS((tptr + 1))), - EXTRACT_8BITS((tptr + 1)), + bittok2str(udld_flags_values, "none", EXTRACT_U_1((tptr + 1))), + EXTRACT_U_1((tptr + 1)), length)); /* @@ -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_BE_16BITS(tptr + 2))); + ND_PRINT((ndo, "\n\tChecksum 0x%04x (unverified)", EXTRACT_BE_U_2(tptr + 2))); tptr += UDLD_HEADER_LEN; while (tptr < (pptr+length)) { ND_TCHECK2(*tptr, 4); - type = EXTRACT_BE_16BITS(tptr); - len = EXTRACT_BE_16BITS(tptr + 2); + type = EXTRACT_BE_U_2(tptr); + len = EXTRACT_BE_U_2(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_BE_32BITS(tptr))); + ND_PRINT((ndo, ", %u", EXTRACT_BE_U_4(tptr))); break; default: diff --git a/print-udp.c b/print-udp.c index e4d89e6c..1d6c5e2c 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_2((const u_int *)hdr); - ts = EXTRACT_BE_16BITS(hdr); + ts = EXTRACT_BE_U_2(hdr); if ((ts & 0xf060) != 0) { /* probably vt */ ND_TCHECK_2(&up->uh_ulen); ND_PRINT((ndo, "udp/vt %u %d / %d", - (uint32_t)(EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up)), + (uint32_t)(EXTRACT_BE_U_2(&up->uh_ulen) - sizeof(*up)), ts & 0x3ff, ts >> 10)); } else { /* probably vat */ uint32_t i0, i1; ND_TCHECK_4(&((const u_int *)hdr)[0]); - i0 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[0]); + i0 = EXTRACT_BE_U_4(&((const u_int *)hdr)[0]); ND_TCHECK_4(&((const u_int *)hdr)[1]); - i1 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[1]); + i1 = EXTRACT_BE_U_4(&((const u_int *)hdr)[1]); ND_TCHECK_2(&up->uh_ulen); ND_PRINT((ndo, "udp/vat %u c%d %u%s", - (uint32_t)(EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up) - 8), + (uint32_t)(EXTRACT_BE_U_2(&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_4(&((const u_int *)hdr)[0]); - i0 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[0]); + i0 = EXTRACT_BE_U_4(&((const u_int *)hdr)[0]); ND_TCHECK_4(&((const u_int *)hdr)[1]); - i1 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[1]); + i1 = EXTRACT_BE_U_4(&((const u_int *)hdr)[1]); ND_TCHECK_2(&up->uh_ulen); - dlen = EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up) - 8; + dlen = EXTRACT_BE_U_2(&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_4(&((const u_int *)hdr)[2]); - ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&((const u_int *)hdr)[2]))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(&((const u_int *)hdr)[2]))); if (hasopt) { u_int i2, optlen; do { ND_TCHECK_4(ip); - i2 = EXTRACT_BE_32BITS(ip); + i2 = EXTRACT_BE_U_4(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_4(ip); - i2 = EXTRACT_BE_32BITS(ip); + i2 = EXTRACT_BE_U_4(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_4(ip); if (contype == 0x1f) /*XXX H.261 */ - ND_PRINT((ndo, " 0x%04x", EXTRACT_BE_32BITS(ip) >> 16)); + ND_PRINT((ndo, " 0x%04x", EXTRACT_BE_U_4(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_BE_16BITS(&rh->rh_len) + 1) * 4; - flags = EXTRACT_BE_16BITS(&rh->rh_flags); + len = (EXTRACT_BE_U_2(&rh->rh_len) + 1) * 4; + flags = EXTRACT_BE_U_2(&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_BE_32BITS(&rh->rh_ssrc))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(&rh->rh_ssrc))); if ((const u_char *)(sr + 1) > ep) goto trunc; ND_TCHECK(*sr); - ts = (double)(EXTRACT_BE_32BITS(&sr->sr_ntp.upper)) + - ((double)(EXTRACT_BE_32BITS(&sr->sr_ntp.lower)) / + ts = (double)(EXTRACT_BE_U_4(&sr->sr_ntp.upper)) + + ((double)(EXTRACT_BE_U_4(&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))); + ND_PRINT((ndo, " @%.2f %u %up %ub", ts, EXTRACT_BE_U_4(&sr->sr_ts), + EXTRACT_BE_U_4(&sr->sr_np), EXTRACT_BE_U_4(&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_BE_32BITS(&rh->rh_ssrc))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(&rh->rh_ssrc))); break; case RTCP_PT_SDES: ND_PRINT((ndo, " sdes %d", len)); if (ndo->ndo_vflag) - ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(&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_BE_32BITS(&rh->rh_ssrc))); + ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(&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_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, " %u", EXTRACT_BE_U_4(&rr->rr_srcid))); + ts = (double)(EXTRACT_BE_U_4(&rr->rr_lsr)) / 65536.; + dts = (double)(EXTRACT_BE_U_4(&rr->rr_dlsr)) / 65536.; ND_PRINT((ndo, " %ul %us %uj @%.2f+%.2f", - EXTRACT_BE_32BITS(&rr->rr_nl) & 0x00ffffff, - EXTRACT_BE_32BITS(&rr->rr_ls), - EXTRACT_BE_32BITS(&rr->rr_dv), ts, dts)); + EXTRACT_BE_U_4(&rr->rr_nl) & 0x00ffffff, + EXTRACT_BE_U_4(&rr->rr_ls), + EXTRACT_BE_U_4(&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_BE_16BITS(&up->uh_sport); - dport = EXTRACT_BE_16BITS(&up->uh_dport); + sport = EXTRACT_BE_U_2(&up->uh_sport); + dport = EXTRACT_BE_U_2(&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_BE_16BITS(&up->uh_ulen); + ulen = EXTRACT_BE_U_2(&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_BE_32BITS(&rp->rm_direction); + direction = (enum sunrpc_msg_type) EXTRACT_BE_U_4(&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_BE_32BITS(&rp->rm_direction); + direction = (enum sunrpc_msg_type) EXTRACT_BE_U_4(&rp->rm_direction); if (dport == NFS_PORT && direction == SUNRPC_CALL) { - ND_PRINT((ndo, "NFS request xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid))); + ND_PRINT((ndo, "NFS request xid %u ", EXTRACT_BE_U_4(&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_BE_32BITS(&rp->rm_xid))); + ND_PRINT((ndo, "NFS reply xid %u ", EXTRACT_BE_U_4(&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_BE_16BITS(&up->uh_sum); + udp_sum = EXTRACT_BE_U_2(&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_BE_16BITS(&up->uh_sum); + udp_sum = EXTRACT_BE_U_2(&up->uh_sum); if (sum != 0) { ND_PRINT((ndo, "[bad udp cksum 0x%04x -> 0x%04x!] ", diff --git a/print-vjc.c b/print-vjc.c index 3287b9bc..248bb21e 100644 --- a/print-vjc.c +++ b/print-vjc.c @@ -76,7 +76,7 @@ * unused argument remind us that we should fix this some day. * * XXX - also, it fetches the TCP checksum field in COMPRESSED_TCP - * packets directly, rather than with EXTRACT_16BITS(); RFC 1144 says + * packets directly, rather than with EXTRACT_BE_U_2(); RFC 1144 says * it's "the unmodified TCP checksum", which would imply that it's * big-endian, but perhaps, on the platform where this was developed, * the packets were munged by the networking stack before being handed diff --git a/print-vqp.c b/print-vqp.c index 0db04fd6..e931025c 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_BE_32BITS(&vqp_common_header->sequence), + EXTRACT_BE_U_4(&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_BE_32BITS(vqp_obj_tlv->obj_type); - vqp_obj_len = EXTRACT_BE_16BITS(vqp_obj_tlv->obj_length); + vqp_obj_type = EXTRACT_BE_U_4(vqp_obj_tlv->obj_type); + vqp_obj_len = EXTRACT_BE_U_2(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_BE_32BITS(tptr))); + ND_PRINT((ndo, "%s (0x%08x)", ipaddr_string(ndo, tptr), EXTRACT_BE_U_4(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 fef1e3e0..73eef9a2 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_BE_16BITS(bp + 6))); + EXTRACT_BE_U_2(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_BE_16BITS(bp + 6))); + EXTRACT_BE_U_2(bp + 6))); } ND_PRINT((ndo, ", addrs")); diff --git a/print-vtp.c b/print-vtp.c index f1f4be68..dd9cb2c8 100644 --- a/print-vtp.c +++ b/print-vtp.c @@ -130,7 +130,7 @@ vtp_print (netdissect_options *ndo, ND_TCHECK2(*tptr, VTP_HEADER_LEN); - type = EXTRACT_8BITS(tptr + 1); + type = EXTRACT_U_1(tptr + 1); ND_PRINT((ndo, "VTPv%u, Message %s (0x%02x), length %u", *tptr, tok2str(vtp_message_type_values,"Unknown message type", type), @@ -144,7 +144,7 @@ vtp_print (netdissect_options *ndo, /* verbose mode print all fields */ ND_PRINT((ndo, "\n\tDomain name: ")); - mgmtd_len = EXTRACT_8BITS(tptr + 3); + mgmtd_len = EXTRACT_U_1(tptr + 3); if (mgmtd_len < 1 || mgmtd_len > 32) { ND_PRINT((ndo, " [invalid MgmtD Len %d]", mgmtd_len)); return; @@ -182,21 +182,21 @@ vtp_print (netdissect_options *ndo, ND_TCHECK2(*tptr, 8); ND_PRINT((ndo, "\n\t Config Rev %x, Updater %s", - EXTRACT_BE_32BITS(tptr), + EXTRACT_BE_U_4(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_BE_32BITS(tptr), - EXTRACT_BE_32BITS(tptr + 4), - EXTRACT_BE_32BITS(tptr + 8))); + EXTRACT_BE_U_4(tptr), + EXTRACT_BE_U_4(tptr + 4), + EXTRACT_BE_U_4(tptr + 8))); tptr += VTP_UPDATE_TIMESTAMP_LEN; ND_TCHECK2(*tptr, VTP_MD5_DIGEST_LEN); ND_PRINT((ndo, ", MD5 digest: %08x%08x%08x%08x", - EXTRACT_BE_32BITS(tptr), - EXTRACT_BE_32BITS(tptr + 4), - EXTRACT_BE_32BITS(tptr + 8), - EXTRACT_BE_32BITS(tptr + 12))); + EXTRACT_BE_U_4(tptr), + EXTRACT_BE_U_4(tptr + 4), + EXTRACT_BE_U_4(tptr + 8), + EXTRACT_BE_U_4(tptr + 12))); tptr += VTP_MD5_DIGEST_LEN; break; @@ -223,7 +223,7 @@ vtp_print (netdissect_options *ndo, */ ND_TCHECK_4(tptr); - ND_PRINT((ndo, ", Config Rev %x", EXTRACT_BE_32BITS(tptr))); + ND_PRINT((ndo, ", Config Rev %x", EXTRACT_BE_U_4(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_BE_16BITS(&vtp_vlan->vlanid), - EXTRACT_BE_16BITS(&vtp_vlan->mtu), - EXTRACT_BE_32BITS(&vtp_vlan->index))); + EXTRACT_BE_U_2(&vtp_vlan->vlanid), + EXTRACT_BE_U_2(&vtp_vlan->mtu), + EXTRACT_BE_U_4(&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)) @@ -288,7 +288,7 @@ vtp_print (netdissect_options *ndo, goto trunc; ND_TCHECK2(*tptr, 2); type = *tptr; - tlv_len = EXTRACT_8BITS(tptr + 1); + tlv_len = EXTRACT_U_1(tptr + 1); ND_PRINT((ndo, "\n\t\t%s (0x%04x) TLV", tok2str(vtp_vlan_tlv_values, "Unknown", type), @@ -308,7 +308,7 @@ vtp_print (netdissect_options *ndo, ND_PRINT((ndo, " (invalid TLV length %u != 1)", tlv_len)); return; } else { - tlv_value = EXTRACT_BE_16BITS(tptr + 2); + tlv_value = EXTRACT_BE_U_2(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_BE_32BITS(tptr))); + ND_PRINT((ndo, "\n\tStart value: %u", EXTRACT_BE_U_4(tptr))); break; case VTP_JOIN_MESSAGE: diff --git a/print-vxlan-gpe.c b/print-vxlan-gpe.c index 08ef285f..71c517ba 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_BE_24BITS(bp); + vni = EXTRACT_BE_U_3(bp); bp += 4; ND_PRINT((ndo, "VXLAN-GPE, ")); diff --git a/print-vxlan.c b/print-vxlan.c index a3de7b30..1a7635fd 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_BE_24BITS(bp); + vni = EXTRACT_BE_U_3(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_BE_16BITS(&(d)->dh_len) + sizeof(*(d))))) + DOP_ROUNDUP(EXTRACT_BE_U_2(&(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_BE_32BITS(&id->pi_ps.slot), + EXTRACT_BE_U_4(&id->pi_ps.slot), ipaddr_string(ndo, &id->pi_ps.page.p_sid), - EXTRACT_BE_32BITS(&id->pi_ps.page.p_uid), - EXTRACT_BE_32BITS(&id->pi_mslot), + EXTRACT_BE_U_4(&id->pi_ps.page.p_uid), + EXTRACT_BE_U_4(&id->pi_mslot), ipaddr_string(ndo, &id->pi_mpage.p_sid), - EXTRACT_BE_32BITS(&id->pi_mpage.p_uid))); + EXTRACT_BE_U_4(&id->pi_mpage.p_uid))); - nid = EXTRACT_BE_16BITS(&id->pi_ps.nid); + nid = EXTRACT_BE_U_2(&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_BE_32BITS(&io->off))); + c, ipaddr_string(ndo, &io->id), EXTRACT_BE_U_4(&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_BE_32BITS(&rreq->pr_page.p_uid), - EXTRACT_BE_32BITS(&rreq->pr_sseq), - EXTRACT_BE_32BITS(&rreq->pr_eseq))); + EXTRACT_BE_U_4(&rreq->pr_page.p_uid), + EXTRACT_BE_U_4(&rreq->pr_sseq), + EXTRACT_BE_U_4(&rreq->pr_eseq))); return (0); } @@ -248,9 +248,9 @@ wb_preq(netdissect_options *ndo, return (-1); ND_PRINT((ndo, " need %u/%s:%u", - EXTRACT_BE_32BITS(&preq->pp_low), + EXTRACT_BE_U_4(&preq->pp_low), ipaddr_string(ndo, &preq->pp_page.p_sid), - EXTRACT_BE_32BITS(&preq->pp_page.p_uid))); + EXTRACT_BE_U_4(&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_BE_32BITS(&prep->pp_n); + n = EXTRACT_BE_U_4(&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_BE_32BITS(&ps->slot), + EXTRACT_BE_U_4(&ps->slot), ipaddr_string(ndo, &ps->page.p_sid), - EXTRACT_BE_32BITS(&ps->page.p_uid))); + EXTRACT_BE_U_4(&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_BE_32BITS(&io->off))); + EXTRACT_BE_U_4(&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_BE_32BITS(&dh->dh_ts); + uint32_t ts = EXTRACT_BE_U_4(&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_BE_32BITS(&dop->pd_page.p_uid), - EXTRACT_BE_32BITS(&dop->pd_sseq), - EXTRACT_BE_32BITS(&dop->pd_eseq))); + EXTRACT_BE_U_4(&dop->pd_page.p_uid), + EXTRACT_BE_U_4(&dop->pd_sseq), + EXTRACT_BE_U_4(&dop->pd_eseq))); if (ndo->ndo_vflag) return (wb_dops(ndo, dop, - EXTRACT_BE_32BITS(&dop->pd_sseq), - EXTRACT_BE_32BITS(&dop->pd_eseq))); + EXTRACT_BE_U_4(&dop->pd_sseq), + EXTRACT_BE_U_4(&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_BE_32BITS(&dop->pd_page.p_uid), - EXTRACT_BE_32BITS(&dop->pd_sseq), - EXTRACT_BE_32BITS(&dop->pd_eseq))); + EXTRACT_BE_U_4(&dop->pd_page.p_uid), + EXTRACT_BE_U_4(&dop->pd_sseq), + EXTRACT_BE_U_4(&dop->pd_eseq))); if (ndo->ndo_vflag) return (wb_dops(ndo, dop, - EXTRACT_BE_32BITS(&dop->pd_sseq), - EXTRACT_BE_32BITS(&dop->pd_eseq))); + EXTRACT_BE_U_4(&dop->pd_sseq), + EXTRACT_BE_U_4(&dop->pd_eseq))); return (0); } diff --git a/print-zeromq.c b/print-zeromq.c index 96665534..41d636c2 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_BE_64BITS(cp + 1); + body_len_declared = EXTRACT_BE_U_8(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_BE_16BITS(cp); + frame_offset = EXTRACT_BE_U_2(cp); ND_PRINT((ndo, "\n\t frame offset 0x%04x", frame_offset)); cp += 2; remaining_len = ndo->ndo_snapend - cp; /* without the frame length */ @@ -73,7 +73,7 @@ make_unix_date(const u_char *date_ptr) { uint32_t dos_date = 0; - dos_date = EXTRACT_LE_32BITS(date_ptr); + dos_date = EXTRACT_LE_U_4(date_ptr); return int_unix_date(dos_date); } @@ -87,7 +87,7 @@ make_unix_date2(const u_char *date_ptr) { uint32_t x, x2; - x = EXTRACT_LE_32BITS(date_ptr); + x = EXTRACT_LE_U_4(date_ptr); x2 = ((x & 0xFFFF) << 16) | ((x & 0xFFFF0000) >> 16); return int_unix_date(x2); } @@ -103,7 +103,7 @@ interpret_long_date(const u_char *p) time_t ret; /* this gives us seconds since jan 1st 1601 (approx) */ - d = (EXTRACT_LE_32BITS(p + 4) * 256.0 + p[3]) * (1.0e-7 * (1 << 24)); + d = (EXTRACT_LE_U_4(p + 4) * 256.0 + p[3]) * (1.0e-7 * (1 << 24)); /* now adjust by 369 years to make the secs since 1970 */ d -= 369.0 * 365.25 * 24 * 60 * 60; @@ -133,7 +133,7 @@ name_interpret(netdissect_options *ndo, if (in >= maxbuf) return(-1); /* name goes past the end of the buffer */ ND_TCHECK2(*in, 1); - len = EXTRACT_8BITS(in) / 2; + len = EXTRACT_U_1(in) / 2; in++; *out=0; @@ -186,7 +186,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_BE_16BITS(p) & 0x3FFF; + l = EXTRACT_BE_U_2(p) & 0x3FFF; if (l == 0) { /* We have a pointer that points to itself. */ return(NULL); @@ -451,7 +451,7 @@ smb_fdata1(netdissect_options *ndo, case 'A': ND_TCHECK2(buf[0], 2); - write_bits(ndo, EXTRACT_LE_16BITS(buf), attrib_fmt); + write_bits(ndo, EXTRACT_LE_U_2(buf), attrib_fmt); buf += 2; fmt++; break; @@ -505,8 +505,8 @@ smb_fdata1(netdissect_options *ndo, { unsigned int x; ND_TCHECK2(buf[0], 2); - x = reverse ? EXTRACT_BE_16BITS(buf) : - EXTRACT_LE_16BITS(buf); + x = reverse ? EXTRACT_BE_U_2(buf) : + EXTRACT_LE_U_2(buf); ND_PRINT((ndo, "%d (0x%x)", x, x)); buf += 2; fmt++; @@ -516,8 +516,8 @@ smb_fdata1(netdissect_options *ndo, { unsigned int x; ND_TCHECK2(buf[0], 4); - x = reverse ? EXTRACT_BE_32BITS(buf) : - EXTRACT_LE_32BITS(buf); + x = reverse ? EXTRACT_BE_U_4(buf) : + EXTRACT_LE_U_4(buf); ND_PRINT((ndo, "%d (0x%x)", x, x)); buf += 4; fmt++; @@ -527,8 +527,8 @@ smb_fdata1(netdissect_options *ndo, { uint64_t x; ND_TCHECK2(buf[0], 8); - x = reverse ? EXTRACT_BE_64BITS(buf) : - EXTRACT_LE_64BITS(buf); + x = reverse ? EXTRACT_BE_U_8(buf) : + EXTRACT_LE_U_8(buf); ND_PRINT((ndo, "%" PRIu64 " (0x%" PRIx64 ")", x, x)); buf += 8; fmt++; @@ -540,10 +540,10 @@ smb_fdata1(netdissect_options *ndo, uint32_t x1, x2; uint64_t x; ND_TCHECK2(buf[0], 8); - x1 = reverse ? EXTRACT_BE_32BITS(buf) : - EXTRACT_LE_32BITS(buf); - x2 = reverse ? EXTRACT_BE_32BITS(buf + 4) : - EXTRACT_LE_32BITS(buf + 4); + x1 = reverse ? EXTRACT_BE_U_4(buf) : + EXTRACT_LE_U_4(buf); + x2 = reverse ? EXTRACT_BE_U_4(buf + 4) : + EXTRACT_LE_U_4(buf + 4); x = (((uint64_t)x1) << 32) | x2; ND_PRINT((ndo, "%" PRIu64 " (0x%" PRIx64 ")", x, x)); buf += 8; @@ -564,8 +564,8 @@ smb_fdata1(netdissect_options *ndo, { unsigned int x; ND_TCHECK2(buf[0], 2); - x = reverse ? EXTRACT_BE_16BITS(buf) : - EXTRACT_LE_16BITS(buf); + x = reverse ? EXTRACT_BE_U_2(buf) : + EXTRACT_LE_U_2(buf); ND_PRINT((ndo, "0x%X", x)); buf += 2; fmt++; @@ -575,8 +575,8 @@ smb_fdata1(netdissect_options *ndo, { unsigned int x; ND_TCHECK2(buf[0], 4); - x = reverse ? EXTRACT_BE_32BITS(buf) : - EXTRACT_LE_32BITS(buf); + x = reverse ? EXTRACT_BE_U_4(buf) : + EXTRACT_LE_U_4(buf); ND_PRINT((ndo, "0x%X", x)); buf += 4; fmt++; @@ -596,16 +596,16 @@ smb_fdata1(netdissect_options *ndo, case 'd': ND_TCHECK2(buf[0], 2); - stringlen = reverse ? EXTRACT_BE_16BITS(buf) : - EXTRACT_LE_16BITS(buf); + stringlen = reverse ? EXTRACT_BE_U_2(buf) : + EXTRACT_LE_U_2(buf); ND_PRINT((ndo, "%u", stringlen)); buf += 2; break; case 'D': ND_TCHECK2(buf[0], 4); - stringlen = reverse ? EXTRACT_BE_32BITS(buf) : - EXTRACT_LE_32BITS(buf); + stringlen = reverse ? EXTRACT_BE_U_4(buf) : + EXTRACT_LE_U_4(buf); ND_PRINT((ndo, "%u", stringlen)); buf += 4; break; @@ -686,7 +686,7 @@ smb_fdata1(netdissect_options *ndo, int l = atoi(fmt + 1); ND_TCHECK2(*buf, l); while (l--) { - ND_PRINT((ndo, "%02x", EXTRACT_8BITS(buf))); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(buf))); buf++; } fmt++; @@ -737,7 +737,7 @@ smb_fdata1(netdissect_options *ndo, switch (atoi(fmt + 1)) { case 1: ND_TCHECK2(buf[0], 4); - x = EXTRACT_LE_32BITS(buf); + x = EXTRACT_LE_U_4(buf); if (x == 0 || x == 0xFFFFFFFF) t = 0; else @@ -746,7 +746,7 @@ smb_fdata1(netdissect_options *ndo, break; case 2: ND_TCHECK2(buf[0], 4); - x = EXTRACT_LE_32BITS(buf); + x = EXTRACT_LE_U_4(buf); if (x == 0 || x == 0xFFFFFFFF) t = 0; else |