diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2018-06-16 17:23:21 +0200 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2019-03-26 21:06:24 +0100 |
commit | ee68aa36460d7efeca48747f33b7f2adc0900bfb (patch) | |
tree | 72c1b65d29301835c0e064b433ea685fc856a68e | |
parent | 1af20c3adc4dfef93de41d4fcd02f0aeb6bbfd4e (diff) | |
download | tcpdump-ee68aa36460d7efeca48747f33b7f2adc0900bfb.tar.gz |
Use the new GET_ macros instead of the EXTRACT_ ones
The exceptions are currently:
Some EXTRACT_ in print-juniper.c, not used on packet buffer pointer.
An EXTRACT_BE_U_3 in addrtoname.c, not always used on packet buffer
pointer.
-rw-r--r-- | cpack.c | 16 | ||||
-rw-r--r-- | ip.h | 4 | ||||
-rw-r--r-- | ip6.h | 2 | ||||
-rw-r--r-- | parsenfsfh.c | 114 | ||||
-rw-r--r-- | print-802_11.c | 94 | ||||
-rw-r--r-- | print-802_15_4.c | 276 | ||||
-rw-r--r-- | print-ah.c | 6 | ||||
-rw-r--r-- | print-ahcp.c | 31 | ||||
-rw-r--r-- | print-aodv.c | 128 | ||||
-rw-r--r-- | print-aoe.c | 64 | ||||
-rw-r--r-- | print-ap1394.c | 4 | ||||
-rw-r--r-- | print-arcnet.c | 34 | ||||
-rw-r--r-- | print-arp.c | 36 | ||||
-rw-r--r-- | print-ascii.c | 16 | ||||
-rw-r--r-- | print-atalk.c | 114 | ||||
-rw-r--r-- | print-atm.c | 44 | ||||
-rw-r--r-- | print-babel.c | 137 | ||||
-rw-r--r-- | print-bfd.c | 68 | ||||
-rw-r--r-- | print-bgp.c | 316 | ||||
-rw-r--r-- | print-bootp.c | 98 | ||||
-rw-r--r-- | print-brcmtag.c | 2 | ||||
-rw-r--r-- | print-bt.c | 2 | ||||
-rw-r--r-- | print-calm-fast.c | 4 | ||||
-rw-r--r-- | print-carp.c | 11 | ||||
-rw-r--r-- | print-cdp.c | 62 | ||||
-rw-r--r-- | print-cfm.c | 60 | ||||
-rw-r--r-- | print-chdlc.c | 22 | ||||
-rw-r--r-- | print-cnfp.c | 146 | ||||
-rw-r--r-- | print-dccp.c | 105 | ||||
-rw-r--r-- | print-decnet.c | 148 | ||||
-rw-r--r-- | print-dhcp6.c | 96 | ||||
-rw-r--r-- | print-domain.c | 97 | ||||
-rw-r--r-- | print-dtp.c | 8 | ||||
-rw-r--r-- | print-dvmrp.c | 38 | ||||
-rw-r--r-- | print-eap.c | 42 | ||||
-rw-r--r-- | print-egp.c | 53 | ||||
-rw-r--r-- | print-eigrp.c | 153 | ||||
-rw-r--r-- | print-enc.c | 2 | ||||
-rw-r--r-- | print-esp.c | 22 | ||||
-rw-r--r-- | print-ether.c | 10 | ||||
-rw-r--r-- | print-fddi.c | 4 | ||||
-rw-r--r-- | print-forces.c | 142 | ||||
-rw-r--r-- | print-fr.c | 106 | ||||
-rw-r--r-- | print-frag6.c | 16 | ||||
-rw-r--r-- | print-geneve.c | 18 | ||||
-rw-r--r-- | print-geonet.c | 24 | ||||
-rw-r--r-- | print-gre.c | 32 | ||||
-rw-r--r-- | print-hncp.c | 76 | ||||
-rw-r--r-- | print-hsrp.c | 20 | ||||
-rw-r--r-- | print-icmp.c | 59 | ||||
-rw-r--r-- | print-icmp6.c | 261 | ||||
-rw-r--r-- | print-igmp.c | 38 | ||||
-rw-r--r-- | print-igrp.c | 24 | ||||
-rw-r--r-- | print-ip.c | 68 | ||||
-rw-r--r-- | print-ip6.c | 34 | ||||
-rw-r--r-- | print-ip6opts.c | 44 | ||||
-rw-r--r-- | print-ipcomp.c | 2 | ||||
-rw-r--r-- | print-ipnet.c | 12 | ||||
-rw-r--r-- | print-ipx.c | 36 | ||||
-rw-r--r-- | print-isakmp.c | 219 | ||||
-rw-r--r-- | print-isoclns.c | 432 | ||||
-rw-r--r-- | print-juniper.c | 111 | ||||
-rw-r--r-- | print-krb.c | 22 | ||||
-rw-r--r-- | print-l2tp.c | 102 | ||||
-rw-r--r-- | print-lane.c | 10 | ||||
-rw-r--r-- | print-ldp.c | 90 | ||||
-rw-r--r-- | print-lisp.c | 40 | ||||
-rw-r--r-- | print-llc.c | 18 | ||||
-rw-r--r-- | print-lldp.c | 248 | ||||
-rw-r--r-- | print-lmp.c | 230 | ||||
-rw-r--r-- | print-loopback.c | 6 | ||||
-rw-r--r-- | print-lspping.c | 96 | ||||
-rw-r--r-- | print-lwapp.c | 20 | ||||
-rw-r--r-- | print-lwres.c | 102 | ||||
-rw-r--r-- | print-m3ua.c | 20 | ||||
-rw-r--r-- | print-medsa.c | 24 | ||||
-rw-r--r-- | print-mobile.c | 4 | ||||
-rw-r--r-- | print-mobility.c | 62 | ||||
-rw-r--r-- | print-mpcp.c | 39 | ||||
-rw-r--r-- | print-mpls.c | 4 | ||||
-rw-r--r-- | print-mptcp.c | 56 | ||||
-rw-r--r-- | print-msdp.c | 16 | ||||
-rw-r--r-- | print-msnlb.c | 2 | ||||
-rw-r--r-- | print-nflog.c | 18 | ||||
-rw-r--r-- | print-nfs.c | 267 | ||||
-rw-r--r-- | print-nsh.c | 24 | ||||
-rw-r--r-- | print-ntp.c | 64 | ||||
-rw-r--r-- | print-olsr.c | 58 | ||||
-rw-r--r-- | print-openflow-1.0.c | 325 | ||||
-rw-r--r-- | print-openflow.c | 8 | ||||
-rw-r--r-- | print-ospf.c | 199 | ||||
-rw-r--r-- | print-ospf6.c | 119 | ||||
-rw-r--r-- | print-otv.c | 6 | ||||
-rw-r--r-- | print-pflog.c | 12 | ||||
-rw-r--r-- | print-pgm.c | 103 | ||||
-rw-r--r-- | print-pim.c | 186 | ||||
-rw-r--r-- | print-pktap.c | 10 | ||||
-rw-r--r-- | print-ppi.c | 10 | ||||
-rw-r--r-- | print-ppp.c | 237 | ||||
-rw-r--r-- | print-pppoe.c | 20 | ||||
-rw-r--r-- | print-pptp.c | 94 | ||||
-rw-r--r-- | print-radius.c | 110 | ||||
-rw-r--r-- | print-resp.c | 10 | ||||
-rw-r--r-- | print-rip.c | 42 | ||||
-rw-r--r-- | print-ripng.c | 14 | ||||
-rw-r--r-- | print-rpki-rtr.c | 22 | ||||
-rw-r--r-- | print-rrcp.c | 26 | ||||
-rw-r--r-- | print-rsvp.c | 327 | ||||
-rw-r--r-- | print-rt6.c | 22 | ||||
-rw-r--r-- | print-rx.c | 178 | ||||
-rw-r--r-- | print-sctp.c | 56 | ||||
-rw-r--r-- | print-sflow.c | 226 | ||||
-rw-r--r-- | print-sl.c | 22 | ||||
-rw-r--r-- | print-sll.c | 32 | ||||
-rw-r--r-- | print-slow.c | 82 | ||||
-rw-r--r-- | print-smb.c | 148 | ||||
-rw-r--r-- | print-snmp.c | 44 | ||||
-rw-r--r-- | print-stp.c | 122 | ||||
-rw-r--r-- | print-sunatm.c | 8 | ||||
-rw-r--r-- | print-sunrpc.c | 14 | ||||
-rw-r--r-- | print-symantec.c | 4 | ||||
-rw-r--r-- | print-syslog.c | 12 | ||||
-rw-r--r-- | print-tcp.c | 78 | ||||
-rw-r--r-- | print-telnet.c | 8 | ||||
-rw-r--r-- | print-tftp.c | 10 | ||||
-rw-r--r-- | print-timed.c | 12 | ||||
-rw-r--r-- | print-tipc.c | 50 | ||||
-rw-r--r-- | print-token.c | 23 | ||||
-rw-r--r-- | print-udld.c | 18 | ||||
-rw-r--r-- | print-udp.c | 74 | ||||
-rw-r--r-- | print-usb.c | 8 | ||||
-rw-r--r-- | print-vjc.c | 10 | ||||
-rw-r--r-- | print-vqp.c | 27 | ||||
-rw-r--r-- | print-vrrp.c | 18 | ||||
-rw-r--r-- | print-vtp.c | 48 | ||||
-rw-r--r-- | print-vxlan-gpe.c | 6 | ||||
-rw-r--r-- | print-vxlan.c | 4 | ||||
-rw-r--r-- | print-wb.c | 62 | ||||
-rw-r--r-- | print-zep.c | 32 | ||||
-rw-r--r-- | print-zeromq.c | 10 | ||||
-rw-r--r-- | smbutil.c | 112 | ||||
-rw-r--r-- | tcp.h | 2 | ||||
-rw-r--r-- | util-print.c | 34 |
143 files changed, 4893 insertions, 4708 deletions
@@ -102,7 +102,7 @@ cpack_uint64(netdissect_options *ndo, struct cpack_state *cs, uint64_t *u) if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) return -1; - *u = EXTRACT_LE_U_8(next); + *u = GET_LE_U_8(next); /* Move pointer past the uint64_t. */ cs->c_next = next + sizeof(*u); @@ -118,7 +118,7 @@ cpack_int64(netdissect_options *ndo, struct cpack_state *cs, int64_t *u) if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) return -1; - *u = EXTRACT_LE_S_8(next); + *u = GET_LE_S_8(next); /* Move pointer past the int64_t. */ cs->c_next = next + sizeof(*u); @@ -134,7 +134,7 @@ cpack_uint32(netdissect_options *ndo, struct cpack_state *cs, uint32_t *u) if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) return -1; - *u = EXTRACT_LE_U_4(next); + *u = GET_LE_U_4(next); /* Move pointer past the uint32_t. */ cs->c_next = next + sizeof(*u); @@ -150,7 +150,7 @@ cpack_int32(netdissect_options *ndo, struct cpack_state *cs, int32_t *u) if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) return -1; - *u = EXTRACT_LE_S_4(next); + *u = GET_LE_S_4(next); /* Move pointer past the int32_t. */ cs->c_next = next + sizeof(*u); @@ -166,7 +166,7 @@ cpack_uint16(netdissect_options *ndo, struct cpack_state *cs, uint16_t *u) if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) return -1; - *u = EXTRACT_LE_U_2(next); + *u = GET_LE_U_2(next); /* Move pointer past the uint16_t. */ cs->c_next = next + sizeof(*u); @@ -182,7 +182,7 @@ cpack_int16(netdissect_options *ndo, struct cpack_state *cs, int16_t *u) if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) return -1; - *u = EXTRACT_LE_S_2(next); + *u = GET_LE_S_2(next); /* Move pointer past the int16_t. */ cs->c_next = next + sizeof(*u); @@ -197,7 +197,7 @@ cpack_uint8(netdissect_options *ndo, struct cpack_state *cs, uint8_t *u) if ((size_t)(cs->c_next - cs->c_buf) >= cs->c_len) return -1; - *u = EXTRACT_U_1(cs->c_next); + *u = GET_U_1(cs->c_next); /* Move pointer past the uint8_t. */ cs->c_next++; @@ -212,7 +212,7 @@ cpack_int8(netdissect_options *ndo, struct cpack_state *cs, int8_t *u) if ((size_t)(cs->c_next - cs->c_buf) >= cs->c_len) return -1; - *u = EXTRACT_S_1(cs->c_next); + *u = GET_S_1(cs->c_next); /* Move pointer past the int8_t. */ cs->c_next++; @@ -51,8 +51,8 @@ */ struct ip { nd_uint8_t ip_vhl; /* header length, version */ -#define IP_V(ip) ((EXTRACT_U_1((ip)->ip_vhl) & 0xf0) >> 4) -#define IP_HL(ip) (EXTRACT_U_1((ip)->ip_vhl) & 0x0f) +#define IP_V(ip) ((GET_U_1((ip)->ip_vhl) & 0xf0) >> 4) +#define IP_HL(ip) (GET_U_1((ip)->ip_vhl) & 0x0f) nd_uint8_t ip_tos; /* type of service */ nd_uint16_t ip_len; /* total length */ nd_uint16_t ip_id; /* identification */ @@ -88,7 +88,7 @@ struct ip6_hdr { }; #define ip6_vfc ip6_ctlun.ip6_un2_vfc -#define IP6_VERSION(ip6_hdr) ((EXTRACT_U_1((ip6_hdr)->ip6_vfc) & 0xf0) >> 4) +#define IP6_VERSION(ip6_hdr) ((GET_U_1((ip6_hdr)->ip6_vfc) & 0xf0) >> 4) #define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow #define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen #define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt diff --git a/parsenfsfh.c b/parsenfsfh.c index a569b54b..fa3e545a 100644 --- a/parsenfsfh.c +++ b/parsenfsfh.c @@ -129,10 +129,10 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len, /* * This is basically a big decision tree */ - else if ((EXTRACT_U_1(fhp) == 0) && (EXTRACT_U_1(fhp + 1) == 0)) { + else if ((GET_U_1(fhp) == 0) && (GET_U_1(fhp + 1) == 0)) { /* bytes[0,1] == (0,0); rules out Ultrix, IRIX5, SUNOS5 */ /* probably rules out HP-UX, AIX unless they allow major=0 */ - if ((EXTRACT_U_1(fhp + 2) == 0) && (EXTRACT_U_1(fhp + 3) == 0)) { + if ((GET_U_1(fhp + 2) == 0) && (GET_U_1(fhp + 3) == 0)) { /* bytes[2,3] == (0,0); must be Auspex */ /* XXX or could be Ultrix+MASSBUS "hp" disk? */ fhtype = FHT_AUSPEX; @@ -142,16 +142,16 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len, * bytes[2,3] != (0,0); rules out Auspex, could be * DECOSF, SUNOS4, or IRIX4 */ - if ((EXTRACT_U_1(fhp + 4) != 0) && (EXTRACT_U_1(fhp + 5) == 0) && - (EXTRACT_U_1(fhp + 8) == 12) && (EXTRACT_U_1(fhp + 9) == 0)) { + if ((GET_U_1(fhp + 4) != 0) && (GET_U_1(fhp + 5) == 0) && + (GET_U_1(fhp + 8) == 12) && (GET_U_1(fhp + 9) == 0)) { /* seems to be DECOSF, with minor == 0 */ fhtype = FHT_DECOSF; } else { /* could be SUNOS4 or IRIX4 */ /* XXX the test of fhp[5] == 8 could be wrong */ - if ((EXTRACT_U_1(fhp + 4) == 0) && (EXTRACT_U_1(fhp + 5) == 8) && (EXTRACT_U_1(fhp + 6) == 0) && - (EXTRACT_U_1(fhp + 7) == 0)) { + if ((GET_U_1(fhp + 4) == 0) && (GET_U_1(fhp + 5) == 8) && (GET_U_1(fhp + 6) == 0) && + (GET_U_1(fhp + 7) == 0)) { /* looks like a length, not a file system typecode */ fhtype = FHT_IRIX4; } @@ -168,24 +168,24 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len, * could be IRIX5, DECOSF, UCX, Ultrix, SUNOS5 * could be AIX, HP-UX */ - if ((EXTRACT_U_1(fhp + 2) == 0) && (EXTRACT_U_1(fhp + 3) == 0)) { + if ((GET_U_1(fhp + 2) == 0) && (GET_U_1(fhp + 3) == 0)) { /* * bytes[2,3] == (0,0); rules out OSF, probably not UCX * (unless the exported device name is just one letter!), * could be Ultrix, IRIX5, AIX, or SUNOS5 * might be HP-UX (depends on their values for minor devs) */ - if ((EXTRACT_U_1(fhp + 6) == 0) && (EXTRACT_U_1(fhp + 7) == 0)) { + if ((GET_U_1(fhp + 6) == 0) && (GET_U_1(fhp + 7) == 0)) { fhtype = FHT_BSD44; } /*XXX we probably only need to test of these two bytes */ - else if ((len >= 24/4) && (EXTRACT_U_1(fhp + 21) == 0) && (EXTRACT_U_1(fhp + 23) == 0)) { + else if ((len >= 24/4) && (GET_U_1(fhp + 21) == 0) && (GET_U_1(fhp + 23) == 0)) { fhtype = FHT_ULTRIX; } else { /* Could be SUNOS5/IRIX5, maybe AIX */ /* XXX no obvious difference between SUNOS5 and IRIX5 */ - if (EXTRACT_U_1(fhp + 9) == 10) + if (GET_U_1(fhp + 9) == 10) fhtype = FHT_SUNOS5; /* XXX what about AIX? */ } @@ -195,17 +195,17 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len, * bytes[2,3] != (0,0); rules out Ultrix, could be * DECOSF, SUNOS5, IRIX5, AIX, HP-UX, or UCX */ - if ((EXTRACT_U_1(fhp + 8) == 12) && (EXTRACT_U_1(fhp + 9) == 0)) { + if ((GET_U_1(fhp + 8) == 12) && (GET_U_1(fhp + 9) == 0)) { fhtype = FHT_DECOSF; } - else if ((EXTRACT_U_1(fhp + 8) == 0) && (EXTRACT_U_1(fhp + 9) == 10)) { + else if ((GET_U_1(fhp + 8) == 0) && (GET_U_1(fhp + 9) == 10)) { /* could be SUNOS5/IRIX5, AIX, HP-UX */ - if ((EXTRACT_U_1(fhp + 7) == 0) && (EXTRACT_U_1(fhp + 6) == 0) && - (EXTRACT_U_1(fhp + 5) == 0) && (EXTRACT_U_1(fhp + 4) == 0)) { + if ((GET_U_1(fhp + 7) == 0) && (GET_U_1(fhp + 6) == 0) && + (GET_U_1(fhp + 5) == 0) && (GET_U_1(fhp + 4) == 0)) { /* XXX is this always true of HP-UX? */ fhtype = FHT_HPUX9; } - else if (EXTRACT_U_1(fhp + 7) == 2) { + else if (GET_U_1(fhp + 7) == 2) { /* This would be MNT_NFS on AIX, which is impossible */ fhtype = FHT_SUNOS5; /* or maybe IRIX5 */ } @@ -235,57 +235,57 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len, switch (fhtype) { case FHT_AUSPEX: - fsidp->Fsid_dev.Minor = EXTRACT_U_1(fhp + 7); - fsidp->Fsid_dev.Major = EXTRACT_U_1(fhp + 6); + fsidp->Fsid_dev.Minor = GET_U_1(fhp + 7); + fsidp->Fsid_dev.Major = GET_U_1(fhp + 6); fsidp->fsid_code = 0; - *inop = EXTRACT_BE_U_4(fhp + 12); + *inop = GET_BE_U_4(fhp + 12); if (osnamep) *osnamep = "Auspex"; break; case FHT_BSD44: - fsidp->Fsid_dev.Minor = EXTRACT_U_1(fhp); - fsidp->Fsid_dev.Major = EXTRACT_U_1(fhp + 1); + fsidp->Fsid_dev.Minor = GET_U_1(fhp); + fsidp->Fsid_dev.Major = GET_U_1(fhp + 1); fsidp->fsid_code = 0; - *inop = EXTRACT_LE_U_4(fhp + 12); + *inop = GET_LE_U_4(fhp + 12); if (osnamep) *osnamep = "BSD 4.4"; break; case FHT_DECOSF: - fsidp->fsid_code = EXTRACT_LE_U_4(fhp + 4); + fsidp->fsid_code = GET_LE_U_4(fhp + 4); /* XXX could ignore 3 high-order bytes */ - temp = EXTRACT_LE_U_4(fhp); + temp = GET_LE_U_4(fhp); fsidp->Fsid_dev.Minor = temp & 0xFFFFF; fsidp->Fsid_dev.Major = (temp>>20) & 0xFFF; - *inop = EXTRACT_LE_U_4(fhp + 12); + *inop = GET_LE_U_4(fhp + 12); if (osnamep) *osnamep = "OSF"; break; case FHT_IRIX4: - fsidp->Fsid_dev.Minor = EXTRACT_U_1(fhp + 3); - fsidp->Fsid_dev.Major = EXTRACT_U_1(fhp + 2); + fsidp->Fsid_dev.Minor = GET_U_1(fhp + 3); + fsidp->Fsid_dev.Major = GET_U_1(fhp + 2); fsidp->fsid_code = 0; - *inop = EXTRACT_BE_U_4(fhp + 8); + *inop = GET_BE_U_4(fhp + 8); if (osnamep) *osnamep = "IRIX4"; break; case FHT_IRIX5: - fsidp->Fsid_dev.Minor = EXTRACT_BE_U_2(fhp + 2); - fsidp->Fsid_dev.Major = EXTRACT_BE_U_2(fhp); - fsidp->fsid_code = EXTRACT_BE_U_4(fhp + 4); + fsidp->Fsid_dev.Minor = GET_BE_U_2(fhp + 2); + fsidp->Fsid_dev.Major = GET_BE_U_2(fhp); + fsidp->fsid_code = GET_BE_U_4(fhp + 4); - *inop = EXTRACT_BE_U_4(fhp + 12); + *inop = GET_BE_U_4(fhp + 12); if (osnamep) *osnamep = "IRIX5"; @@ -303,24 +303,24 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len, #endif case FHT_SUNOS4: - fsidp->Fsid_dev.Minor = EXTRACT_U_1(fhp + 3); - fsidp->Fsid_dev.Major = EXTRACT_U_1(fhp + 2); - fsidp->fsid_code = EXTRACT_BE_U_4(fhp + 4); + fsidp->Fsid_dev.Minor = GET_U_1(fhp + 3); + fsidp->Fsid_dev.Major = GET_U_1(fhp + 2); + fsidp->fsid_code = GET_BE_U_4(fhp + 4); - *inop = EXTRACT_BE_U_4(fhp + 12); + *inop = GET_BE_U_4(fhp + 12); if (osnamep) *osnamep = "SUNOS4"; break; case FHT_SUNOS5: - temp = EXTRACT_BE_U_2(fhp); + temp = GET_BE_U_2(fhp); fsidp->Fsid_dev.Major = (temp>>2) & 0x3FFF; - temp = EXTRACT_BE_U_3(fhp + 1); + temp = GET_BE_U_3(fhp + 1); fsidp->Fsid_dev.Minor = temp & 0x3FFFF; - fsidp->fsid_code = EXTRACT_BE_U_4(fhp + 4); + fsidp->fsid_code = GET_BE_U_4(fhp + 4); - *inop = EXTRACT_BE_U_4(fhp + 12); + *inop = GET_BE_U_4(fhp + 12); if (osnamep) *osnamep = "SUNOS5"; @@ -328,10 +328,10 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len, case FHT_ULTRIX: fsidp->fsid_code = 0; - fsidp->Fsid_dev.Minor = EXTRACT_U_1(fhp); - fsidp->Fsid_dev.Major = EXTRACT_U_1(fhp + 1); + fsidp->Fsid_dev.Minor = GET_U_1(fhp); + fsidp->Fsid_dev.Major = GET_U_1(fhp + 1); - temp = EXTRACT_LE_U_4(fhp + 4); + temp = GET_LE_U_4(fhp + 4); *inop = temp; if (osnamep) *osnamep = "Ultrix"; @@ -356,9 +356,9 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len, } /* VMS file ID is: (RVN, FidHi, FidLo) */ - *inop = (((uint32_t)EXTRACT_U_1(fhp + 26)) << 24) | - (((uint32_t)EXTRACT_U_1(fhp + 27)) << 16) | - (EXTRACT_LE_U_2(fhp + 22) << 0); + *inop = (((uint32_t) GET_U_1(fhp + 26)) << 24) | + (((uint32_t) GET_U_1(fhp + 27)) << 16) | + (GET_LE_U_2(fhp + 22) << 0); /* Caller must save (and null-terminate?) this value */ if (fsnamep) @@ -369,23 +369,23 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len, break; case FHT_AIX32: - fsidp->Fsid_dev.Minor = EXTRACT_BE_U_2(fhp + 2); - fsidp->Fsid_dev.Major = EXTRACT_BE_U_2(fhp); - fsidp->fsid_code = EXTRACT_BE_U_4(fhp + 4); + fsidp->Fsid_dev.Minor = GET_BE_U_2(fhp + 2); + fsidp->Fsid_dev.Major = GET_BE_U_2(fhp); + fsidp->fsid_code = GET_BE_U_4(fhp + 4); - *inop = EXTRACT_BE_U_4(fhp + 12); + *inop = GET_BE_U_4(fhp + 12); if (osnamep) *osnamep = "AIX32"; break; case FHT_HPUX9: - fsidp->Fsid_dev.Major = EXTRACT_U_1(fhp); - temp = EXTRACT_BE_U_3(fhp + 1); + fsidp->Fsid_dev.Major = GET_U_1(fhp); + temp = GET_BE_U_3(fhp + 1); fsidp->Fsid_dev.Minor = temp; - fsidp->fsid_code = EXTRACT_BE_U_4(fhp + 4); + fsidp->fsid_code = GET_BE_U_4(fhp + 4); - *inop = EXTRACT_BE_U_4(fhp + 12); + *inop = GET_BE_U_4(fhp + 12); if (osnamep) *osnamep = "HPUX9"; @@ -395,13 +395,13 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len, #ifdef DEBUG /* XXX debugging */ for (i = 0; i < len*4; i++) - (void)fprintf(stderr, "%x.", EXTRACT_U_1(fhp + i)); + (void)fprintf(stderr, "%x.", GET_U_1(fhp + i)); (void)fprintf(stderr, "\n"); #endif /* Save the actual handle, so it can be display with -u */ for (i = 0; i < len*4 && i*2 < sizeof(fsidp->Opaque_Handle) - 1; i++) (void)nd_snprintf(&(fsidp->Opaque_Handle[i*2]), 3, "%.2X", - EXTRACT_U_1(fhp + i)); + GET_U_1(fhp + i)); fsidp->Opaque_Handle[i*2] = '\0'; /* XXX for now, give "bogus" values to aid debugging */ @@ -442,13 +442,13 @@ is_UCX(netdissect_options *ndo, const unsigned char *fhp, u_int len) return(0); for (i = 1; i < 14; i++) { - if (ND_ISPRINT(EXTRACT_U_1(fhp + i))) { + if (ND_ISPRINT(GET_U_1(fhp + i))) { if (seen_null) return(0); else continue; } - else if (EXTRACT_U_1(fhp + i) == 0) { + else if (GET_U_1(fhp + i) == 0) { seen_null = 1; continue; } diff --git a/print-802_11.c b/print-802_11.c index 51bc878b..8ddba1e3 100644 --- a/print-802_11.c +++ b/print-802_11.c @@ -985,7 +985,7 @@ wep_print(netdissect_options *ndo, uint32_t iv; ND_TCHECK_LEN(p, IEEE802_11_IV_LEN + IEEE802_11_KID_LEN); - iv = EXTRACT_LE_U_4(p); + iv = GET_LE_U_4(p); ND_PRINT(" IV:%3x Pad %x KeyID %x", IV_IV(iv), IV_PAD(iv), IV_KEYID(iv)); @@ -1023,14 +1023,14 @@ parse_elements(netdissect_options *ndo, ND_TCHECK_2(p + offset); if (length < 2) goto trunc; - elementlen = EXTRACT_U_1(p + offset + 1); + elementlen = GET_U_1(p + offset + 1); /* Make sure we have the entire element. */ ND_TCHECK_LEN(p + offset + 2, elementlen); if (length < elementlen + 2) goto trunc; - switch (EXTRACT_U_1(p + offset)) { + switch (GET_U_1(p + offset)) { case E_SSID: memcpy(&ssid, p + offset, 2); offset += 2; @@ -1122,7 +1122,7 @@ parse_elements(netdissect_options *ndo, length -= ds.length; break; } - ds.channel = EXTRACT_U_1(p + offset); + ds.channel = GET_U_1(p + offset); offset += 1; length -= 1; /* @@ -1194,7 +1194,7 @@ parse_elements(netdissect_options *ndo, default: #if 0 ND_PRINT("(1) unhandled element_id (%u) ", - EXTRACT_U_1(p + offset)); + GET_U_1(p + offset)); #endif offset += 2 + elementlen; length -= 2 + elementlen; @@ -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_U_2(p + offset); + pbody.beacon_interval = GET_LE_U_2(p + offset); offset += IEEE802_11_BCNINT_LEN; length -= IEEE802_11_BCNINT_LEN; - pbody.capability_info = EXTRACT_LE_U_2(p + offset); + pbody.capability_info = GET_LE_U_2(p + offset); offset += IEEE802_11_CAPINFO_LEN; length -= IEEE802_11_CAPINFO_LEN; @@ -1263,10 +1263,10 @@ handle_assoc_request(netdissect_options *ndo, ND_TCHECK_LEN(p, IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN); if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN) goto trunc; - pbody.capability_info = EXTRACT_LE_U_2(p); + pbody.capability_info = GET_LE_U_2(p); offset += IEEE802_11_CAPINFO_LEN; length -= IEEE802_11_CAPINFO_LEN; - pbody.listen_interval = EXTRACT_LE_U_2(p + offset); + pbody.listen_interval = GET_LE_U_2(p + offset); offset += IEEE802_11_LISTENINT_LEN; length -= IEEE802_11_LISTENINT_LEN; @@ -1294,13 +1294,13 @@ handle_assoc_response(netdissect_options *ndo, if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_STATUS_LEN + IEEE802_11_AID_LEN) goto trunc; - pbody.capability_info = EXTRACT_LE_U_2(p); + pbody.capability_info = GET_LE_U_2(p); offset += IEEE802_11_CAPINFO_LEN; length -= IEEE802_11_CAPINFO_LEN; - pbody.status_code = EXTRACT_LE_U_2(p + offset); + pbody.status_code = GET_LE_U_2(p + offset); offset += IEEE802_11_STATUS_LEN; length -= IEEE802_11_STATUS_LEN; - pbody.aid = EXTRACT_LE_U_2(p + offset); + pbody.aid = GET_LE_U_2(p + offset); offset += IEEE802_11_AID_LEN; length -= IEEE802_11_AID_LEN; @@ -1332,10 +1332,10 @@ handle_reassoc_request(netdissect_options *ndo, if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN + IEEE802_11_AP_LEN) goto trunc; - pbody.capability_info = EXTRACT_LE_U_2(p); + pbody.capability_info = GET_LE_U_2(p); offset += IEEE802_11_CAPINFO_LEN; length -= IEEE802_11_CAPINFO_LEN; - pbody.listen_interval = EXTRACT_LE_U_2(p + offset); + pbody.listen_interval = GET_LE_U_2(p + offset); offset += IEEE802_11_LISTENINT_LEN; length -= IEEE802_11_LISTENINT_LEN; memcpy(&pbody.ap, p+offset, IEEE802_11_AP_LEN); @@ -1396,10 +1396,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_U_2(p + offset); + pbody.beacon_interval = GET_LE_U_2(p + offset); offset += IEEE802_11_BCNINT_LEN; length -= IEEE802_11_BCNINT_LEN; - pbody.capability_info = EXTRACT_LE_U_2(p + offset); + pbody.capability_info = GET_LE_U_2(p + offset); offset += IEEE802_11_CAPINFO_LEN; length -= IEEE802_11_CAPINFO_LEN; @@ -1432,7 +1432,7 @@ handle_disassoc(netdissect_options *ndo, ND_TCHECK_LEN(p, IEEE802_11_REASON_LEN); if (length < IEEE802_11_REASON_LEN) goto trunc; - pbody.reason_code = EXTRACT_LE_U_2(p); + pbody.reason_code = GET_LE_U_2(p); ND_PRINT(": %s", (pbody.reason_code < NUM_REASONS) @@ -1457,13 +1457,13 @@ handle_auth(netdissect_options *ndo, ND_TCHECK_6(p); if (length < 6) goto trunc; - pbody.auth_alg = EXTRACT_LE_U_2(p); + pbody.auth_alg = GET_LE_U_2(p); offset += 2; length -= 2; - pbody.auth_trans_seq_num = EXTRACT_LE_U_2(p + offset); + pbody.auth_trans_seq_num = GET_LE_U_2(p + offset); offset += 2; length -= 2; - pbody.status_code = EXTRACT_LE_U_2(p + offset); + pbody.status_code = GET_LE_U_2(p + offset); offset += 2; length -= 2; @@ -1511,7 +1511,7 @@ handle_deauth(netdissect_options *ndo, ND_TCHECK_LEN(p, IEEE802_11_REASON_LEN); if (length < IEEE802_11_REASON_LEN) goto trunc; - pbody.reason_code = EXTRACT_LE_U_2(p); + pbody.reason_code = GET_LE_U_2(p); reason = (pbody.reason_code < NUM_REASONS) ? reason_text[pbody.reason_code] @@ -1589,22 +1589,22 @@ handle_action(netdissect_options *ndo, } else { ND_PRINT(" (%s): ", etheraddr_string(ndo, src)); } - switch (EXTRACT_U_1(p)) { - case 0: ND_PRINT("Spectrum Management Act#%u", EXTRACT_U_1(p + 1)); break; - case 1: ND_PRINT("QoS Act#%u", EXTRACT_U_1(p + 1)); break; - case 2: ND_PRINT("DLS Act#%u", EXTRACT_U_1(p + 1)); break; - case 3: ND_PRINT("BA "); PRINT_BA_ACTION(EXTRACT_U_1(p + 1)); break; - case 7: ND_PRINT("HT "); PRINT_HT_ACTION(EXTRACT_U_1(p + 1)); break; - case 13: ND_PRINT("MeshAction "); PRINT_MESH_ACTION(EXTRACT_U_1(p + 1)); break; + switch (GET_U_1(p)) { + case 0: ND_PRINT("Spectrum Management Act#%u", GET_U_1(p + 1)); break; + case 1: ND_PRINT("QoS Act#%u", GET_U_1(p + 1)); break; + case 2: ND_PRINT("DLS Act#%u", GET_U_1(p + 1)); break; + case 3: ND_PRINT("BA "); PRINT_BA_ACTION(GET_U_1(p + 1)); break; + case 7: ND_PRINT("HT "); PRINT_HT_ACTION(GET_U_1(p + 1)); break; + case 13: ND_PRINT("MeshAction "); PRINT_MESH_ACTION(GET_U_1(p + 1)); break; case 14: ND_PRINT("MultiohopAction "); - PRINT_MULTIHOP_ACTION(EXTRACT_U_1(p + 1)); break; + PRINT_MULTIHOP_ACTION(GET_U_1(p + 1)); break; case 15: ND_PRINT("SelfprotectAction "); - PRINT_SELFPROT_ACTION(EXTRACT_U_1(p + 1)); break; - case 127: ND_PRINT("Vendor Act#%u", EXTRACT_U_1(p + 1)); break; + PRINT_SELFPROT_ACTION(GET_U_1(p + 1)); break; + case 127: ND_PRINT("Vendor Act#%u", GET_U_1(p + 1)); break; default: - ND_PRINT("Reserved(%u) Act#%u", EXTRACT_U_1(p), EXTRACT_U_1(p + 1)); + ND_PRINT("Reserved(%u) Act#%u", GET_U_1(p), GET_U_1(p + 1)); break; } return 1; @@ -1677,8 +1677,8 @@ ctrl_body_print(netdissect_options *ndo, ND_PRINT(" 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_U_2(((const struct ctrl_bar_hdr_t *)p)->ctl), - EXTRACT_LE_U_2(((const struct ctrl_bar_hdr_t *)p)->seq)); + GET_LE_U_2(((const struct ctrl_bar_hdr_t *)p)->ctl), + GET_LE_U_2(((const struct ctrl_bar_hdr_t *)p)->seq)); break; case CTRL_BA: ND_TCHECK_LEN(p, CTRL_BA_HDRLEN); @@ -1689,7 +1689,7 @@ ctrl_body_print(netdissect_options *ndo, case CTRL_PS_POLL: ND_TCHECK_LEN(p, CTRL_PS_POLL_HDRLEN); ND_PRINT(" AID(%x)", - EXTRACT_LE_U_2(((const struct ctrl_ps_poll_hdr_t *)p)->aid)); + GET_LE_U_2(((const struct ctrl_ps_poll_hdr_t *)p)->aid)); break; case CTRL_RTS: ND_TCHECK_LEN(p, CTRL_RTS_HDRLEN); @@ -1861,8 +1861,8 @@ ctrl_header_print(netdissect_options *ndo, uint16_t fc, const u_char *p) ND_PRINT(" 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_U_2(((const struct ctrl_bar_hdr_t *)p)->ctl), - EXTRACT_LE_U_2(((const struct ctrl_bar_hdr_t *)p)->seq)); + GET_LE_U_2(((const struct ctrl_bar_hdr_t *)p)->ctl), + GET_LE_U_2(((const struct ctrl_bar_hdr_t *)p)->seq)); break; case CTRL_BA: ND_PRINT("RA:%s ", @@ -1949,7 +1949,7 @@ extract_header_length(netdissect_options *ndo, static int extract_mesh_header_length(netdissect_options *ndo, const u_char *p) { - return (EXTRACT_U_1(p) &~ 3) ? 0 : 6*(1 + (EXTRACT_U_1(p) & 3)); + return (GET_U_1(p) &~ 3) ? 0 : 6*(1 + (GET_U_1(p) & 3)); } /* @@ -1975,15 +1975,15 @@ ieee_802_11_hdr_print(netdissect_options *ndo, ND_PRINT("Protected "); if (FC_TYPE(fc) != T_CTRL || FC_SUBTYPE(fc) != CTRL_PS_POLL) ND_PRINT("%uus ", - EXTRACT_LE_U_2(((const struct mgmt_header_t *)p)->duration)); + GET_LE_U_2(((const struct mgmt_header_t *)p)->duration)); } if (meshdrlen != 0) { const struct meshcntl_t *mc = (const struct meshcntl_t *)(p + hdrlen - meshdrlen); - u_int ae = EXTRACT_U_1(mc->flags) & 3; + u_int ae = GET_U_1(mc->flags) & 3; ND_PRINT("MeshData (AE %u TTL %u seq %u", ae, - EXTRACT_U_1(mc->ttl), EXTRACT_LE_U_4(mc->seq)); + GET_U_1(mc->ttl), GET_LE_U_4(mc->seq)); if (ae > 0) ND_PRINT(" A4:%s", etheraddr_string(ndo, mc->addr4)); if (ae > 1) @@ -2038,7 +2038,7 @@ ieee802_11_print(netdissect_options *ndo, return orig_caplen; } - fc = EXTRACT_LE_U_2(p); + fc = GET_LE_U_2(p); hdrlen = extract_header_length(ndo, fc); if (hdrlen == 0) { /* Unknown frame type or control frame subtype; quit. */ @@ -3072,7 +3072,7 @@ ieee802_11_radio_print(netdissect_options *ndo, { #define BIT(n) (1U << n) #define IS_EXTENDED(__p) \ - (EXTRACT_LE_U_4(__p) & BIT(IEEE80211_RADIOTAP_EXT)) != 0 + (GET_LE_U_4(__p) & BIT(IEEE80211_RADIOTAP_EXT)) != 0 struct cpack_state cpacker; const struct ieee80211_radiotap_header *hdr; @@ -3096,7 +3096,7 @@ ieee802_11_radio_print(netdissect_options *ndo, hdr = (const struct ieee80211_radiotap_header *)p; - len = EXTRACT_LE_U_2(hdr->it_len); + len = GET_LE_U_2(hdr->it_len); if (len < sizeof(*hdr)) { /* * The length is the length of the entire header, so @@ -3144,7 +3144,7 @@ ieee802_11_radio_print(netdissect_options *ndo, fcslen = 0; for (presentp = &hdr->it_present; presentp <= last_presentp; presentp++) { - presentflags = EXTRACT_LE_U_4(presentp); + presentflags = GET_LE_U_4(presentp); /* * If this is a vendor namespace, we don't handle it. @@ -3281,7 +3281,7 @@ ieee802_11_radio_avs_print(netdissect_options *ndo, return caplen; } - caphdr_len = EXTRACT_BE_U_4(p + 4); + caphdr_len = GET_BE_U_4(p + 4); if (caphdr_len < 8) { /* * Yow! The capture header length is claimed not @@ -3334,7 +3334,7 @@ prism_if_print(netdissect_options *ndo, return caplen; } - msgcode = EXTRACT_BE_U_4(p); + msgcode = GET_BE_U_4(p); if (msgcode == WLANCAP_MAGIC_COOKIE_V1 || msgcode == WLANCAP_MAGIC_COOKIE_V2) return ieee802_11_radio_avs_print(ndo, p, length, caplen); diff --git a/print-802_15_4.c b/print-802_15_4.c index 03169457..54279cca 100644 --- a/print-802_15_4.c +++ b/print-802_15_4.c @@ -540,7 +540,7 @@ ieee802_15_4_print_addr(netdissect_options *ndo, const u_char *p, ND_PRINT("none"); break; case 2: - ND_PRINT("%04x", EXTRACT_LE_U_2(p)); + ND_PRINT("%04x", GET_LE_U_2(p)); break; case 8: ND_PRINT("%s", le64addr_string(ndo, p)); @@ -585,7 +585,7 @@ ieee802_15_4_print_gts_info(netdissect_options *ndo, u_int len; int i; - gts_spec = EXTRACT_U_1(p); + gts_spec = GET_U_1(p); gts_cnt = gts_spec & 0x7; if (gts_cnt == 0) { @@ -605,14 +605,14 @@ ieee802_15_4_print_gts_info(netdissect_options *ndo, } ND_PRINT("GTS Descriptor Count = %d, ", gts_cnt); ND_PRINT("GTS Directions Mask = %02x, [ ", - EXTRACT_U_1(p + 1) & 0x7f); + GET_U_1(p + 1) & 0x7f); for(i = 0; i < gts_cnt; i++) { ND_PRINT("[ "); ieee802_15_4_print_addr(ndo, p + 2 + i * 3, 2); ND_PRINT(", Start slot = %d, Length = %d ] ", - EXTRACT_U_1(p + 2 + i * 3 + 1) & 0x0f, - (EXTRACT_U_1(p + 2 + i * 3 + 1) >> 4) & 0x0f); + GET_U_1(p + 2 + i * 3 + 1) & 0x0f, + (GET_U_1(p + 2 + i * 3 + 1) >> 4) & 0x0f); } ND_PRINT("]"); return len; @@ -631,7 +631,7 @@ ieee802_15_4_print_pending_addresses(netdissect_options *ndo, { uint8_t pas, s_cnt, e_cnt, len, i; - pas = EXTRACT_U_1(p); + pas = GET_U_1(p); s_cnt = pas & 0x7; e_cnt = (pas >> 4) & 0x7; len = 1 + s_cnt * 2 + e_cnt * 8; @@ -683,11 +683,11 @@ ieee802_15_4_print_header_ie(netdissect_options *ndo, if (ie_len < 3) { ND_PRINT("[ERROR: Vendor OUI missing]"); } else { - ND_PRINT("OUI = 0x%02x%02x%02x, ", EXTRACT_U_1(p), - EXTRACT_U_1(p + 1), EXTRACT_U_1(p + 2)); + ND_PRINT("OUI = 0x%02x%02x%02x, ", GET_U_1(p), + GET_U_1(p + 1), GET_U_1(p + 2)); ND_PRINT("Data = "); for(i = 3; i < ie_len; i++) { - ND_PRINT("%02x ", EXTRACT_U_1(p + i)); + ND_PRINT("%02x ", GET_U_1(p + i)); } } break; @@ -696,10 +696,10 @@ ieee802_15_4_print_header_ie(netdissect_options *ndo, ND_PRINT("[ERROR: Truncated CSL IE]"); } else { ND_PRINT("CSL Phase = %d, CSL Period = %d", - EXTRACT_LE_U_2(p), EXTRACT_LE_U_2(p + 2)); + GET_LE_U_2(p), GET_LE_U_2(p + 2)); if (ie_len >= 6) { ND_PRINT(", Rendezvous time = %d", - EXTRACT_LE_U_2(p + 4)); + GET_LE_U_2(p + 4)); } if (ie_len != 4 && ie_len != 6) { ND_PRINT(" [ERROR: CSL IE length wrong]"); @@ -711,9 +711,9 @@ ieee802_15_4_print_header_ie(netdissect_options *ndo, ND_PRINT("[ERROR: Truncated RIT IE]"); } else { ND_PRINT("Time to First Listen = %d, # of Repeat Listen = %d, Repeat Listen Interval = %d", - EXTRACT_U_1(p), - EXTRACT_U_1(p + 1), - EXTRACT_LE_U_2(p + 2)); + GET_U_1(p), + GET_U_1(p + 1), + GET_LE_U_2(p + 2)); } break; case 0x1c: /* DSME PAN Descriptor IE */ @@ -728,7 +728,7 @@ ieee802_15_4_print_header_ie(netdissect_options *ndo, hopping_present = 0; - ss = EXTRACT_LE_U_2(p); + ss = GET_LE_U_2(p); ieee802_15_4_print_superframe_specification(ndo, ss); if (ie_len < 3) { ND_PRINT("[ERROR: Truncated before pending addresses field]"); @@ -750,7 +750,7 @@ ieee802_15_4_print_header_ie(netdissect_options *ndo, ND_PRINT("[ERROR: Truncated before DSME Superframe Specification]"); break; } - ss = EXTRACT_LE_U_2(p + ptr); + ss = GET_LE_U_2(p + ptr); ptr += 2; ND_PRINT("Multi-superframe Order = %d", ss & 0xff); ND_PRINT(", %s", ((ss & 0x100) ? @@ -771,7 +771,7 @@ ieee802_15_4_print_header_ie(netdissect_options *ndo, ND_PRINT("[ERROR: Truncated before DSME Superframe Specification]"); break; } - ss = EXTRACT_U_1(p + ptr); + ss = GET_U_1(p + ptr); ptr++; ND_PRINT("Multi-superframe Order = %d", ss & 0x0f); @@ -790,17 +790,17 @@ ieee802_15_4_print_header_ie(netdissect_options *ndo, break; } ND_PRINT("Beacon timestamp = %" PRIu64 ", offset = %d", - EXTRACT_LE_U_6(p + ptr), - EXTRACT_LE_U_2(p + ptr + 6)); + GET_LE_U_6(p + ptr), + GET_LE_U_2(p + ptr + 6)); ptr += 8; if (ie_len < ptr + 4) { ND_PRINT(" [ERROR: Truncated before Beacon Bitmap]"); break; } - ulen = EXTRACT_LE_U_2(p + ptr + 2); + ulen = GET_LE_U_2(p + ptr + 2); ND_PRINT("SD Index = %d, Bitmap len = %d, ", - EXTRACT_LE_U_2(p + ptr), ulen); + GET_LE_U_2(p + ptr), ulen); ptr += 4; if (ie_len < ptr + ulen) { ND_PRINT(" [ERROR: Truncated in SD bitmap]"); @@ -808,7 +808,7 @@ ieee802_15_4_print_header_ie(netdissect_options *ndo, } ND_PRINT(" SD Bitmap = "); for(i = 0; i < ulen; i++) { - ND_PRINT("%02x ", EXTRACT_U_1(p + ptr + i)); + ND_PRINT("%02x ", GET_U_1(p + ptr + i)); } ptr += ulen; @@ -817,12 +817,12 @@ ieee802_15_4_print_header_ie(netdissect_options *ndo, break; } - ulen = EXTRACT_LE_U_2(p + ptr + 4); + ulen = GET_LE_U_2(p + ptr + 4); ND_PRINT("Hopping Seq ID = %d, PAN Coordinator BSN = %d, " "Channel offset = %d, Bitmap length = %d, ", - EXTRACT_U_1(p + ptr), - EXTRACT_U_1(p + ptr + 1), - EXTRACT_LE_U_2(p + ptr + 2), + GET_U_1(p + ptr), + GET_U_1(p + ptr + 1), + GET_LE_U_2(p + ptr + 2), ulen); ptr += 5; if (ie_len < ptr + ulen) { @@ -831,7 +831,7 @@ ieee802_15_4_print_header_ie(netdissect_options *ndo, } ND_PRINT(" Channel offset bitmap = "); for(i = 0; i < ulen; i++) { - ND_PRINT("%02x ", EXTRACT_U_1(p + ptr + i)); + ND_PRINT("%02x ", GET_U_1(p + ptr + i)); } ptr += ulen; if (hopping_present) { @@ -839,7 +839,7 @@ ieee802_15_4_print_header_ie(netdissect_options *ndo, ND_PRINT(" [ERROR: Truncated in Hopping Sequence length]"); break; } - ulen = EXTRACT_U_1(p + ptr); + ulen = GET_U_1(p + ptr); ptr++; ND_PRINT("Hopping Seq length = %d [ ", ulen); @@ -852,7 +852,8 @@ ieee802_15_4_print_header_ie(netdissect_options *ndo, break; } for(i = 0; i < ulen; i++) { - ND_PRINT("%02x ", EXTRACT_LE_U_2(p + ptr + i * 2)); + ND_PRINT("%02x ", + GET_LE_U_2(p + ptr + i * 2)); } ND_PRINT("]"); ptr += ulen * 2; @@ -864,8 +865,8 @@ ieee802_15_4_print_header_ie(netdissect_options *ndo, ND_PRINT("[ERROR: Length != 2]"); } else { uint16_t r_time, w_u_interval; - r_time = EXTRACT_LE_U_2(p); - w_u_interval = EXTRACT_LE_U_2(p + 2); + r_time = GET_LE_U_2(p); + w_u_interval = GET_LE_U_2(p + 2); ND_PRINT("Rendezvous time = %d, Wake-up Interval = %d", r_time, w_u_interval); @@ -878,7 +879,7 @@ ieee802_15_4_print_header_ie(netdissect_options *ndo, uint16_t val; int16_t timecorr; - val = EXTRACT_LE_U_2(p); + val = GET_LE_U_2(p); if (val & 0x8000) { ND_PRINT("Negative "); } val &= 0xfff; val <<= 4; @@ -909,7 +910,7 @@ ieee802_15_4_print_header_ie(netdissect_options *ndo, default: ND_PRINT("IE Data = "); for(i = 0; i < ie_len; i++) { - ND_PRINT("%02x ", EXTRACT_U_1(p + i)); + ND_PRINT("%02x ", GET_U_1(p + i)); } break; } @@ -938,7 +939,7 @@ ieee802_15_4_print_header_ie_list(netdissect_options *ndo, return -1; } /* Extract IE Header */ - ie = EXTRACT_LE_U_2(p); + ie = GET_LE_U_2(p); if (CHECK_BIT(ie, 15)) { ND_PRINT("[ERROR: Header IE with type 1] "); } @@ -971,7 +972,7 @@ ieee802_15_4_print_header_ie_list(netdissect_options *ndo, if (ie_len != 0) { ND_PRINT("IE Data = "); for(i = 0; i < ie_len; i++) { - ND_PRINT("%02x ", EXTRACT_U_1(p + i)); + ND_PRINT("%02x ", GET_U_1(p + i)); } } } @@ -1010,12 +1011,12 @@ ieee802_15_4_print_mlme_ie(netdissect_options *ndo, ND_PRINT("[ERROR: Vendor OUI missing]"); } else { ND_PRINT("OUI = 0x%02x%02x%02x, ", - EXTRACT_U_1(p), - EXTRACT_U_1(p + 1), - EXTRACT_U_1(p + 2)); + GET_U_1(p), + GET_U_1(p + 1), + GET_U_1(p + 2)); ND_PRINT("Data = "); for(i = 3; i < sub_ie_len; i++) { - ND_PRINT("%02x ", EXTRACT_U_1(p + i)); + ND_PRINT("%02x ", GET_U_1(p + i)); } } break; @@ -1023,25 +1024,25 @@ ieee802_15_4_print_mlme_ie(netdissect_options *ndo, if (sub_ie_len < 1) { ND_PRINT("[ERROR: Hopping sequence ID missing]"); } else if (sub_ie_len == 1) { - ND_PRINT("Hopping Sequence ID = %d", EXTRACT_U_1(p)); + ND_PRINT("Hopping Sequence ID = %d", GET_U_1(p)); p++; sub_ie_len--; } else { uint16_t channel_page, number_of_channels; - ND_PRINT("Hopping Sequence ID = %d", EXTRACT_U_1(p)); + ND_PRINT("Hopping Sequence ID = %d", GET_U_1(p)); p++; sub_ie_len--; if (sub_ie_len < 7) { ND_PRINT("[ERROR: IE truncated]"); break; } - channel_page = EXTRACT_U_1(p); - number_of_channels = EXTRACT_LE_U_2(p + 1); + channel_page = GET_U_1(p); + number_of_channels = GET_LE_U_2(p + 1); ND_PRINT("Channel Page = %d, Number of Channels = %d, ", channel_page, number_of_channels); ND_PRINT("Phy Configuration = 0x%08x, ", - EXTRACT_LE_U_4(p + 3)); + GET_LE_U_4(p + 3)); p += 7; sub_ie_len -= 7; if (channel_page == 9 || channel_page == 10) { @@ -1052,7 +1053,7 @@ ieee802_15_4_print_mlme_ie(netdissect_options *ndo, } ND_PRINT("Extended bitmap = 0x"); for(i = 0; i < len; i++) { - ND_PRINT("%02x", EXTRACT_U_1(p + i)); + ND_PRINT("%02x", GET_U_1(p + i)); } ND_PRINT(", "); p += len; @@ -1062,7 +1063,7 @@ ieee802_15_4_print_mlme_ie(netdissect_options *ndo, ND_PRINT("[ERROR: IE truncated]"); break; } - len = EXTRACT_LE_U_2(p); + len = GET_LE_U_2(p); p += 2; sub_ie_len -= 2; ND_PRINT("Hopping Seq length = %d [ ", len); @@ -1072,7 +1073,7 @@ ieee802_15_4_print_mlme_ie(netdissect_options *ndo, break; } for(i = 0; i < len; i++) { - ND_PRINT("%02x ", EXTRACT_LE_U_2(p + i * 2)); + ND_PRINT("%02x ", GET_LE_U_2(p + i * 2)); } ND_PRINT("]"); p += len * 2; @@ -1081,7 +1082,7 @@ ieee802_15_4_print_mlme_ie(netdissect_options *ndo, ND_PRINT("[ERROR: IE truncated]"); break; } - ND_PRINT("Current hop = %d", EXTRACT_LE_U_2(p)); + ND_PRINT("Current hop = %d", GET_LE_U_2(p)); } break; @@ -1090,7 +1091,7 @@ ieee802_15_4_print_mlme_ie(netdissect_options *ndo, ND_PRINT("[ERROR: Length != 6]"); } ND_PRINT("ASN = %010" PRIx64 ", Join Metric = %d ", - EXTRACT_LE_U_5(p), EXTRACT_U_1(p + 5)); + GET_LE_U_5(p), GET_U_1(p + 5)); break; case 0x1b: /* TSCH Slotframe and Link IE. */ { @@ -1100,7 +1101,7 @@ ieee802_15_4_print_mlme_ie(netdissect_options *ndo, ND_PRINT("[ERROR: Truncated IE]"); break; } - sf_num = EXTRACT_U_1(p); + sf_num = GET_U_1(p); ND_PRINT("Slotframes = %d ", sf_num); off = 1; for(i = 0; i < sf_num; i++) { @@ -1108,10 +1109,10 @@ ieee802_15_4_print_mlme_ie(netdissect_options *ndo, ND_PRINT("[ERROR: Truncated IE before slotframes]"); break; } - links = EXTRACT_U_1(p + off + 3); + links = GET_U_1(p + off + 3); ND_PRINT("\n\t\t\t[ Handle %d, size = %d, links = %d ", - EXTRACT_U_1(p + off), - EXTRACT_LE_U_2(p + off + 1), + GET_U_1(p + off), + GET_LE_U_2(p + off + 1), links); off += 4; for(j = 0; j < links; j++) { @@ -1119,10 +1120,10 @@ ieee802_15_4_print_mlme_ie(netdissect_options *ndo, ND_PRINT("[ERROR: Truncated IE links]"); break; } - opts = EXTRACT_U_1(p + off + 4); + opts = GET_U_1(p + off + 4); ND_PRINT("\n\t\t\t\t[ Timeslot = %d, Offset = %d, Options = ", - EXTRACT_LE_U_2(p + off), - EXTRACT_LE_U_2(p + off + 2)); + GET_LE_U_2(p + off), + GET_LE_U_2(p + off + 2)); if (opts & 0x1) { ND_PRINT("TX "); } if (opts & 0x2) { ND_PRINT("RX "); } if (opts & 0x4) { ND_PRINT("Shared "); } @@ -1141,42 +1142,42 @@ ieee802_15_4_print_mlme_ie(netdissect_options *ndo, break; case 0x1c: /* TSCH Timeslot IE. */ if (sub_ie_len == 1) { - ND_PRINT("Time slot ID = %d ", EXTRACT_U_1(p)); + ND_PRINT("Time slot ID = %d ", GET_U_1(p)); } else if (sub_ie_len == 25) { ND_PRINT("Time slot ID = %d, CCA Offset = %d, CCA = %d, TX Offset = %d, RX Offset = %d, RX Ack Delay = %d, TX Ack Delay = %d, RX Wait = %d, Ack Wait = %d, RX TX = %d, Max Ack = %d, Max TX = %d, Time slot Length = %d ", - EXTRACT_U_1(p), - EXTRACT_LE_U_2(p + 1), - EXTRACT_LE_U_2(p + 3), - EXTRACT_LE_U_2(p + 5), - EXTRACT_LE_U_2(p + 7), - EXTRACT_LE_U_2(p + 9), - EXTRACT_LE_U_2(p + 11), - EXTRACT_LE_U_2(p + 13), - EXTRACT_LE_U_2(p + 15), - EXTRACT_LE_U_2(p + 17), - EXTRACT_LE_U_2(p + 19), - EXTRACT_LE_U_2(p + 21), - EXTRACT_LE_U_2(p + 23)); + GET_U_1(p), + GET_LE_U_2(p + 1), + GET_LE_U_2(p + 3), + GET_LE_U_2(p + 5), + GET_LE_U_2(p + 7), + GET_LE_U_2(p + 9), + GET_LE_U_2(p + 11), + GET_LE_U_2(p + 13), + GET_LE_U_2(p + 15), + GET_LE_U_2(p + 17), + GET_LE_U_2(p + 19), + GET_LE_U_2(p + 21), + GET_LE_U_2(p + 23)); } else if (sub_ie_len == 27) { ND_PRINT("Time slot ID = %d, CCA Offset = %d, CCA = %d, TX Offset = %d, RX Offset = %d, RX Ack Delay = %d, TX Ack Delay = %d, RX Wait = %d, Ack Wait = %d, RX TX = %d, Max Ack = %d, Max TX = %d, Time slot Length = %d ", - EXTRACT_U_1(p), - EXTRACT_LE_U_2(p + 1), - EXTRACT_LE_U_2(p + 3), - EXTRACT_LE_U_2(p + 5), - EXTRACT_LE_U_2(p + 7), - EXTRACT_LE_U_2(p + 9), - EXTRACT_LE_U_2(p + 11), - EXTRACT_LE_U_2(p + 13), - EXTRACT_LE_U_2(p + 15), - EXTRACT_LE_U_2(p + 17), - EXTRACT_LE_U_2(p + 19), - EXTRACT_LE_U_3(p + 21), - EXTRACT_LE_U_3(p + 24)); + GET_U_1(p), + GET_LE_U_2(p + 1), + GET_LE_U_2(p + 3), + GET_LE_U_2(p + 5), + GET_LE_U_2(p + 7), + GET_LE_U_2(p + 9), + GET_LE_U_2(p + 11), + GET_LE_U_2(p + 13), + GET_LE_U_2(p + 15), + GET_LE_U_2(p + 17), + GET_LE_U_2(p + 19), + GET_LE_U_3(p + 21), + GET_LE_U_3(p + 24)); } else { ND_PRINT("[ERROR: Length not 1, 25, or 27]"); ND_PRINT("\n\t\t\tIE Data = "); for(i = 0; i < sub_ie_len; i++) { - ND_PRINT("%02x ", EXTRACT_U_1(p + i)); + ND_PRINT("%02x ", GET_U_1(p + i)); } } break; @@ -1233,7 +1234,7 @@ ieee802_15_4_print_mlme_ie(netdissect_options *ndo, default: ND_PRINT("IE Data = "); for(i = 0; i < sub_ie_len; i++) { - ND_PRINT("%02x ", EXTRACT_U_1(p + i)); + ND_PRINT("%02x ", GET_U_1(p + i)); } break; } @@ -1257,7 +1258,7 @@ ieee802_15_4_print_mlme_ie_list(netdissect_options *ndo, return; } /* Extract IE header */ - ie = EXTRACT_LE_U_2(p); + ie = GET_LE_U_2(p); type = CHECK_BIT(ie, 15); if (type) { /* Long type */ @@ -1289,7 +1290,7 @@ ieee802_15_4_print_mlme_ie_list(netdissect_options *ndo, } else if (ndo->ndo_vflag > 2) { ND_PRINT("IE Data = "); for(i = 0; i < sub_ie_len; i++) { - ND_PRINT("%02x ", EXTRACT_U_1(p + i)); + ND_PRINT("%02x ", GET_U_1(p + i)); } } } @@ -1320,8 +1321,8 @@ ieee802_15_4_print_mpx_ie(netdissect_options *ndo, return; } - transfer_type = EXTRACT_U_1(p) & 0x7; - tid = EXTRACT_U_1(p) >> 3; + transfer_type = GET_U_1(p) & 0x7; + tid = GET_U_1(p) >> 3; switch (transfer_type) { case 0x00: /* Full upper layer frame. */ case 0x01: /* Full upper layer frame with small Multiplex ID. */ @@ -1335,7 +1336,7 @@ ieee802_15_4_print_mpx_ie(netdissect_options *ndo, } data_start = 3; ND_PRINT("tid = 0x%02x, Multiplex ID = 0x%04x, ", - tid, EXTRACT_LE_U_2(p + 1)); + tid, GET_LE_U_2(p + 1)); } else { data_start = 1; ND_PRINT("Multiplex ID = 0x%04x, ", tid); @@ -1348,7 +1349,7 @@ ieee802_15_4_print_mpx_ie(netdissect_options *ndo, return; } - fragment_number = EXTRACT_U_1(p + 1); + fragment_number = GET_U_1(p + 1); ND_PRINT("Type = %s, tid = 0x%02x, fragment = 0x%02x, ", (transfer_type == 0x02 ? (fragment_number == 0 ? @@ -1363,8 +1364,8 @@ ieee802_15_4_print_mpx_ie(netdissect_options *ndo, ND_PRINT("[ERROR: Total upper layer size or multiplex ID missing]"); return; } - total_size = EXTRACT_LE_U_2(p + 2); - multiplex_id = EXTRACT_LE_U_2(p + 4); + total_size = GET_LE_U_2(p + 2); + multiplex_id = GET_LE_U_2(p + 4); ND_PRINT("Total upper layer size = 0x%04x, Multiplex ID = 0x%04x, ", total_size, multiplex_id); data_start = 6; @@ -1376,13 +1377,13 @@ ieee802_15_4_print_mpx_ie(netdissect_options *ndo, tid); } else if (ie_len == 3) { ND_PRINT("Type = Abort, tid = 0x%02x, max size = 0x%04x", - tid, EXTRACT_LE_U_2(p + 1)); + tid, GET_LE_U_2(p + 1)); } else { ND_PRINT("Type = Abort, tid = 0x%02x, invalid length = %d (not 1 or 3)", tid, ie_len); ND_PRINT("Abort data = "); for(i = 1; i < ie_len; i++) { - ND_PRINT("%02x ", EXTRACT_U_1(p + i)); + ND_PRINT("%02x ", GET_U_1(p + i)); } } return; @@ -1399,7 +1400,7 @@ ieee802_15_4_print_mpx_ie(netdissect_options *ndo, ND_PRINT("Upper layer data = "); for(i = data_start; i < ie_len; i++) { - ND_PRINT("%02x ", EXTRACT_U_1(p + i)); + ND_PRINT("%02x ", GET_U_1(p + i)); } } @@ -1424,7 +1425,7 @@ ieee802_15_4_print_payload_ie_list(netdissect_options *ndo, return -1; } /* Extract IE header */ - ie = EXTRACT_LE_U_2(p); + ie = GET_LE_U_2(p); if ((CHECK_BIT(ie, 15)) == 0) { ND_PRINT("[ERROR: Payload IE with type 0] "); } @@ -1453,13 +1454,13 @@ ieee802_15_4_print_payload_ie_list(netdissect_options *ndo, ND_PRINT("[ERROR: Vendor OUI missing]"); } else { ND_PRINT("OUI = 0x%02x%02x%02x, ", - EXTRACT_U_1(p), - EXTRACT_U_1(p + 1), - EXTRACT_U_1(p + 2)); + GET_U_1(p), + GET_U_1(p + 1), + GET_U_1(p + 2)); ND_PRINT("Data = "); for(i = 3; i < ie_len; i++) { ND_PRINT("%02x ", - EXTRACT_U_1(p + i)); + GET_U_1(p + i)); } } break; @@ -1471,16 +1472,17 @@ ieee802_15_4_print_payload_ie_list(netdissect_options *ndo, ND_PRINT("[ERROR: Subtype ID missing]"); } else { ND_PRINT("Subtype ID = 0x%02x, Subtype content = ", - EXTRACT_U_1(p)); + GET_U_1(p)); for(i = 1; i < ie_len; i++) { - ND_PRINT("%02x ", EXTRACT_U_1(p + i)); + ND_PRINT("%02x ", + GET_U_1(p + i)); } } break; default: ND_PRINT("IE Data = "); for(i = 0; i < ie_len; i++) { - ND_PRINT("%02x ", EXTRACT_U_1(p + i)); + ND_PRINT("%02x ", GET_U_1(p + i)); } break; } @@ -1488,7 +1490,7 @@ ieee802_15_4_print_payload_ie_list(netdissect_options *ndo, if (ie_len != 0) { ND_PRINT("IE Data = "); for(i = 0; i < ie_len; i++) { - ND_PRINT("%02x ", EXTRACT_U_1(p + i)); + ND_PRINT("%02x ", GET_U_1(p + i)); } } } @@ -1520,7 +1522,7 @@ ieee802_15_4_print_aux_sec_header(netdissect_options *ndo, ND_PRINT("[ERROR: Truncated before Aux Security Header]"); return -1; } - sc = EXTRACT_U_1(p); + sc = GET_U_1(p); len = 1; *security_level = sc & 0x7; key_id_mode = (sc >> 3) & 0x3; @@ -1542,7 +1544,7 @@ ieee802_15_4_print_aux_sec_header(netdissect_options *ndo, p += 4; if (ndo->ndo_vflag > 1) { ND_PRINT("Frame Counter 0x%08x ", - EXTRACT_LE_U_4(p + 1)); + GET_LE_U_4(p + 1)); } } switch (key_id_mode) { @@ -1561,7 +1563,7 @@ ieee802_15_4_print_aux_sec_header(netdissect_options *ndo, } if (ndo->ndo_vflag > 1) { ND_PRINT("KeySource 0x%04x:%0x4x, ", - EXTRACT_LE_U_2(p), EXTRACT_LE_U_2(p + 2)); + GET_LE_U_2(p), GET_LE_U_2(p + 2)); } p += 4; caplen -= 4; @@ -1585,7 +1587,7 @@ ieee802_15_4_print_aux_sec_header(netdissect_options *ndo, return -1; } if (ndo->ndo_vflag > 1) { - ND_PRINT("KeyIndex 0x%02x, ", EXTRACT_U_1(p)); + ND_PRINT("KeyIndex 0x%02x, ", GET_U_1(p)); } caplen -= 1; p += 1; @@ -1613,7 +1615,7 @@ ieee802_15_4_print_command_data(netdissect_options *ndo, return -1; } else { uint8_t cap_info; - cap_info = EXTRACT_U_1(p); + cap_info = GET_U_1(p); ND_PRINT("%s%s%s%s%s%s", ((cap_info & 0x02) ? "FFD, " : "RFD, "), @@ -1637,7 +1639,7 @@ ieee802_15_4_print_command_data(netdissect_options *ndo, } else { ND_PRINT("Short address = "); ieee802_15_4_print_addr(ndo, p, 2); - switch (EXTRACT_U_1(p + 2)) { + switch (GET_U_1(p + 2)) { case 0x00: ND_PRINT(", Association successful"); break; @@ -1655,7 +1657,7 @@ ieee802_15_4_print_command_data(netdissect_options *ndo, break; default: ND_PRINT(", Status = 0x%02x", - EXTRACT_U_1(p + 2)); + GET_U_1(p + 2)); break; } return caplen; @@ -1666,7 +1668,7 @@ ieee802_15_4_print_command_data(netdissect_options *ndo, ND_PRINT("Invalid Disassociation Notification command length"); return -1; } else { - switch (EXTRACT_U_1(p)) { + switch (GET_U_1(p)) { case 0x00: ND_PRINT("Reserved"); break; @@ -1677,7 +1679,7 @@ ieee802_15_4_print_command_data(netdissect_options *ndo, ND_PRINT("Reason = The device wishes to leave the PAN"); break; default: - ND_PRINT("Reason = 0x%02x", EXTRACT_U_1(p + 2)); + ND_PRINT("Reason = 0x%02x", GET_U_1(p + 2)); break; } return caplen; @@ -1698,12 +1700,12 @@ ieee802_15_4_print_command_data(netdissect_options *ndo, uint16_t channel, page; ND_PRINT("Pan ID = 0x%04x, Coordinator short address = ", - EXTRACT_LE_U_2(p)); + GET_LE_U_2(p)); ieee802_15_4_print_addr(ndo, p + 2, 2); - channel = EXTRACT_U_1(p + 4); + channel = GET_U_1(p + 4); if (caplen == 8) { - page = EXTRACT_U_1(p + 7); + page = GET_U_1(p + 7); } else { page = 0x80; } @@ -1728,7 +1730,7 @@ ieee802_15_4_print_command_data(netdissect_options *ndo, } else { uint8_t gts; - gts = EXTRACT_U_1(p); + gts = GET_U_1(p); ND_PRINT("GTS Length = %d, %s, %s", gts & 0xf, (CHECK_BIT(gts, 4) ? @@ -1775,7 +1777,7 @@ ieee802_15_4_print_command_data(netdissect_options *ndo, default: ND_PRINT("Command Data = "); for(i = 0; i < caplen; i++) { - ND_PRINT("%02x ", EXTRACT_U_1(p + i)); + ND_PRINT("%02x ", GET_U_1(p + i)); } break; } @@ -1811,14 +1813,14 @@ ieee802_15_4_std_frames(netdissect_options *ndo, fcs = 0; } else { /* Test for 4 octet FCS. */ - fcs = EXTRACT_LE_U_4(p + caplen - 4); + fcs = GET_LE_U_4(p + caplen - 4); crc_check = ieee802_15_4_crc32(p, caplen - 4); if (crc_check == fcs) { /* Remove FCS */ caplen -= 4; } else { /* Test for 2 octet FCS. */ - fcs = EXTRACT_LE_U_2(p + caplen - 2); + fcs = GET_LE_U_2(p + caplen - 2); crc_check = ieee802_15_4_crc16(p, caplen - 2); if (crc_check == fcs) { /* Remove FCS */ @@ -1857,7 +1859,7 @@ ieee802_15_4_std_frames(netdissect_options *ndo, p += 2; caplen -= 2; } else { - seq = EXTRACT_U_1(p + 2); + seq = GET_U_1(p + 2); p += 3; caplen -= 3; if (ndo->ndo_vflag) @@ -1969,7 +1971,7 @@ ieee802_15_4_std_frames(netdissect_options *ndo, ND_PRINT("[ERROR: Truncated before dst_pan]"); return 0; } - ND_PRINT("%04x:", EXTRACT_LE_U_2(p)); + ND_PRINT("%04x:", GET_LE_U_2(p)); p += 2; caplen -= 2; } else { @@ -1991,7 +1993,7 @@ ieee802_15_4_std_frames(netdissect_options *ndo, ND_PRINT("[ERROR: Truncated before dst_pan]"); return 0; } - ND_PRINT("%04x:", EXTRACT_LE_U_2(p)); + ND_PRINT("%04x:", GET_LE_U_2(p)); p += 2; caplen -= 2; } else { @@ -2076,7 +2078,7 @@ ieee802_15_4_std_frames(netdissect_options *ndo, ND_PRINT("\n\tMIC "); for(len = 0; len < miclen; len++) { - ND_PRINT("%02x", EXTRACT_U_1(mic_start + len)); + ND_PRINT("%02x", GET_U_1(mic_start + len)); } ND_PRINT(" "); } @@ -2101,7 +2103,7 @@ ieee802_15_4_std_frames(netdissect_options *ndo, } else { uint16_t ss; - ss = EXTRACT_LE_U_2(p); + ss = GET_LE_U_2(p); ieee802_15_4_print_superframe_specification(ndo, ss); p += 2; caplen -= 2; @@ -2148,7 +2150,7 @@ ieee802_15_4_std_frames(netdissect_options *ndo, } else { uint8_t command_id; - command_id = EXTRACT_U_1(p); + command_id = GET_U_1(p); if (command_id >= 0x30) { ND_PRINT("Command ID = Reserved 0x%02x ", command_id); @@ -2205,13 +2207,13 @@ ieee802_15_4_mp_frame(netdissect_options *ndo, } else { if (caplen > 4) { /* Test for 4 octet FCS. */ - fcs = EXTRACT_LE_U_4(p + caplen - 4); + fcs = GET_LE_U_4(p + caplen - 4); crc_check = ieee802_15_4_crc32(p, caplen - 4); if (crc_check == fcs) { /* Remove FCS */ caplen -= 4; } else { - fcs = EXTRACT_LE_U_2(p + caplen - 2); + fcs = GET_LE_U_2(p + caplen - 2); crc_check = ieee802_15_4_crc16(p, caplen - 2); if (crc_check == fcs) { /* Remove FCS */ @@ -2219,7 +2221,7 @@ ieee802_15_4_mp_frame(netdissect_options *ndo, } } } else { - fcs = EXTRACT_LE_U_2(p + caplen - 2); + fcs = GET_LE_U_2(p + caplen - 2); crc_check = ieee802_15_4_crc16(p, caplen - 2); if (crc_check == fcs) { /* Remove FCS */ @@ -2256,7 +2258,7 @@ ieee802_15_4_mp_frame(netdissect_options *ndo, p += 2; caplen -= 2; } else { - seq = EXTRACT_U_1(p + 2); + seq = GET_U_1(p + 2); p += 3; caplen -= 3; if (ndo->ndo_vflag) @@ -2264,7 +2266,7 @@ ieee802_15_4_mp_frame(netdissect_options *ndo, } } else { /* Short format of header, but with seq no */ - seq = EXTRACT_U_1(p + 1); + seq = GET_U_1(p + 1); p += 2; caplen -= 2; if (ndo->ndo_vflag) @@ -2289,7 +2291,7 @@ ieee802_15_4_mp_frame(netdissect_options *ndo, ND_PRINT("[ERROR: Truncated before dst_pan]"); return 0; } - ND_PRINT("%04x:", EXTRACT_LE_U_2(p)); + ND_PRINT("%04x:", GET_LE_U_2(p)); p += 2; caplen -= 2; } else { @@ -2388,7 +2390,7 @@ ieee802_15_4_mp_frame(netdissect_options *ndo, ND_PRINT("\n\tMIC "); for(len = 0; len < miclen; len++) { - ND_PRINT("%02x", EXTRACT_U_1(mic_start + len)); + ND_PRINT("%02x", GET_U_1(mic_start + len)); } ND_PRINT(" "); } @@ -2447,7 +2449,7 @@ ieee802_15_4_print(netdissect_options *ndo, return caplen; } - fc = EXTRACT_LE_U_2(p); + fc = GET_LE_U_2(p); /* First we need to check the frame type to know how to parse the rest of the FC. Frame type is the first 3 bit of the frame control field. @@ -2507,8 +2509,8 @@ ieee802_15_4_tap_if_print(netdissect_options *ndo, return h->caplen; } - version = EXTRACT_U_1(p); - length = EXTRACT_LE_U_2(p+2); + version = GET_U_1(p); + length = GET_LE_U_2(p + 2); if (version != 0 || length < 4) { nd_print_invalid(ndo); return 0; @@ -45,13 +45,13 @@ ah_print(netdissect_options *ndo, const u_char *bp) ND_TCHECK_SIZE(ah); - sumlen = EXTRACT_U_1(ah->ah_len) << 2; + sumlen = GET_U_1(ah->ah_len) << 2; - ND_PRINT("AH(spi=0x%08x", EXTRACT_BE_U_4(ah->ah_spi)); + ND_PRINT("AH(spi=0x%08x", GET_BE_U_4(ah->ah_spi)); if (ndo->ndo_vflag) ND_PRINT(",sumlen=%u", sumlen); ND_TCHECK_4(ah + 1); - ND_PRINT(",seq=0x%x", EXTRACT_BE_U_4(ah + 1)); + ND_PRINT(",seq=0x%x", GET_BE_U_4(ah + 1)); ND_TCHECK_LEN(bp, sizeof(struct ah) + sumlen); ND_PRINT("): "); diff --git a/print-ahcp.c b/print-ahcp.c index 33866de0..98150a6f 100644 --- a/print-ahcp.c +++ b/print-ahcp.c @@ -106,7 +106,7 @@ ahcp_time_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) if (cp + 4 != ep) goto invalid; ND_TCHECK_4(cp); - t = EXTRACT_BE_U_4(cp); + t = GET_BE_U_4(cp); if (NULL == (tm = gmtime(&t))) ND_PRINT(": gmtime() error"); else if (0 == strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm)) @@ -130,7 +130,7 @@ ahcp_seconds_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) if (cp + 4 != ep) goto invalid; ND_TCHECK_4(cp); - ND_PRINT(": %us", EXTRACT_BE_U_4(cp)); + ND_PRINT(": %us", GET_BE_U_4(cp)); return 0; invalid: @@ -199,7 +199,8 @@ ahcp_ipv6_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char if (cp + 17 > ep) goto invalid; ND_TCHECK_LEN(cp, 17); - ND_PRINT("%s%s/%u", sep, ip6addr_string(ndo, cp), EXTRACT_U_1(cp + 16)); + ND_PRINT("%s%s/%u", sep, ip6addr_string(ndo, cp), + GET_U_1(cp + 16)); cp += 17; sep = ", "; } @@ -223,7 +224,8 @@ ahcp_ipv4_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char if (cp + 5 > ep) goto invalid; ND_TCHECK_5(cp); - ND_PRINT("%s%s/%u", sep, ipaddr_string(ndo, cp), EXTRACT_U_1(cp + 4)); + ND_PRINT("%s%s/%u", sep, ipaddr_string(ndo, cp), + GET_U_1(cp + 4)); cp += 5; sep = ", "; } @@ -265,7 +267,7 @@ ahcp1_options_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) while (cp < ep) { /* Option no */ ND_TCHECK_1(cp); - option_no = EXTRACT_U_1(cp); + option_no = GET_U_1(cp); cp += 1; ND_PRINT("\n\t %s", tok2str(ahcp1_opt_str, "Unknown-%u", option_no)); if (option_no == AHCP1_OPT_PAD || option_no == AHCP1_OPT_MANDATORY) @@ -274,7 +276,7 @@ ahcp1_options_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) if (cp + 1 > ep) goto invalid; ND_TCHECK_1(cp); - option_len = EXTRACT_U_1(cp); + option_len = GET_U_1(cp); cp += 1; if (cp + option_len > ep) goto invalid; @@ -308,15 +310,15 @@ ahcp1_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) goto invalid; /* Type */ ND_TCHECK_1(cp); - type = EXTRACT_U_1(cp); + type = GET_U_1(cp); cp += 1; /* MBZ */ ND_TCHECK_1(cp); - mbz = EXTRACT_U_1(cp); + mbz = GET_U_1(cp); cp += 1; /* Length */ ND_TCHECK_2(cp); - body_len = EXTRACT_BE_U_2(cp); + body_len = GET_BE_U_2(cp); cp += 2; if (ndo->ndo_vflag) { @@ -355,12 +357,12 @@ ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len) goto invalid; /* Magic */ ND_TCHECK_1(cp); - if (EXTRACT_U_1(cp) != AHCP_MAGIC_NUMBER) + if (GET_U_1(cp) != AHCP_MAGIC_NUMBER) goto invalid; cp += 1; /* Version */ ND_TCHECK_1(cp); - version = EXTRACT_U_1(cp); + version = GET_U_1(cp); cp += 1; switch (version) { case AHCP_VERSION_1: { @@ -373,15 +375,16 @@ ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len) } else { /* Hopcount */ ND_TCHECK_1(cp); - ND_PRINT("\n\tHopcount %u", EXTRACT_U_1(cp)); + ND_PRINT("\n\tHopcount %u", GET_U_1(cp)); cp += 1; /* Original Hopcount */ ND_TCHECK_1(cp); - ND_PRINT(", Original Hopcount %u", EXTRACT_U_1(cp)); + ND_PRINT(", Original Hopcount %u", + GET_U_1(cp)); cp += 1; /* Nonce */ ND_TCHECK_4(cp); - ND_PRINT(", Nonce 0x%08x", EXTRACT_BE_U_4(cp)); + ND_PRINT(", Nonce 0x%08x", GET_BE_U_4(cp)); cp += 4; /* Source Id */ ND_TCHECK_8(cp); diff --git a/print-aodv.c b/print-aodv.c index 17942bce..da8de256 100644 --- a/print-aodv.c +++ b/print-aodv.c @@ -181,22 +181,24 @@ aodv_extension(netdissect_options *ndo, const struct aodv_hello *ah; ND_TCHECK_SIZE(ep); - switch (EXTRACT_U_1(ep->type)) { + switch (GET_U_1(ep->type)) { case AODV_EXT_HELLO: ah = (const struct aodv_hello *)(const void *)ep; ND_TCHECK_SIZE(ah); if (length < sizeof(struct aodv_hello)) goto trunc; - if (EXTRACT_U_1(ep->length) < 4) { - ND_PRINT("\n\text HELLO - bad length %u", EXTRACT_U_1(ep->length)); + if (GET_U_1(ep->length) < 4) { + ND_PRINT("\n\text HELLO - bad length %u", + GET_U_1(ep->length)); break; } ND_PRINT("\n\text HELLO %u ms", - EXTRACT_BE_U_4(ah->interval)); + GET_BE_U_4(ah->interval)); break; default: - ND_PRINT("\n\text %u %u", EXTRACT_U_1(ep->type), EXTRACT_U_1(ep->length)); + ND_PRINT("\n\text %u %u", GET_U_1(ep->type), + GET_U_1(ep->length)); break; } return; @@ -216,17 +218,17 @@ aodv_rreq(netdissect_options *ndo, const u_char *dat, u_int length) goto trunc; ND_PRINT(" rreq %u %s%s%s%s%shops %u id 0x%08x\n" "\tdst %s seq %u src %s seq %u", length, - EXTRACT_U_1(ap->rreq_type) & RREQ_JOIN ? "[J]" : "", - EXTRACT_U_1(ap->rreq_type) & RREQ_REPAIR ? "[R]" : "", - EXTRACT_U_1(ap->rreq_type) & RREQ_GRAT ? "[G]" : "", - EXTRACT_U_1(ap->rreq_type) & RREQ_DEST ? "[D]" : "", - EXTRACT_U_1(ap->rreq_type) & RREQ_UNKNOWN ? "[U] " : " ", - EXTRACT_U_1(ap->rreq_hops), - EXTRACT_BE_U_4(ap->rreq_id), + GET_U_1(ap->rreq_type) & RREQ_JOIN ? "[J]" : "", + GET_U_1(ap->rreq_type) & RREQ_REPAIR ? "[R]" : "", + GET_U_1(ap->rreq_type) & RREQ_GRAT ? "[G]" : "", + GET_U_1(ap->rreq_type) & RREQ_DEST ? "[D]" : "", + GET_U_1(ap->rreq_type) & RREQ_UNKNOWN ? "[U] " : " ", + GET_U_1(ap->rreq_hops), + GET_BE_U_4(ap->rreq_id), ipaddr_string(ndo, ap->rreq_da), - EXTRACT_BE_U_4(ap->rreq_ds), + GET_BE_U_4(ap->rreq_ds), ipaddr_string(ndo, ap->rreq_oa), - EXTRACT_BE_U_4(ap->rreq_os)); + GET_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); @@ -247,14 +249,14 @@ aodv_rrep(netdissect_options *ndo, const u_char *dat, u_int length) goto trunc; ND_PRINT(" rrep %u %s%sprefix %u hops %u\n" "\tdst %s dseq %u src %s %u ms", length, - EXTRACT_U_1(ap->rrep_type) & RREP_REPAIR ? "[R]" : "", - EXTRACT_U_1(ap->rrep_type) & RREP_ACK ? "[A] " : " ", - EXTRACT_U_1(ap->rrep_ps) & RREP_PREFIX_MASK, - EXTRACT_U_1(ap->rrep_hops), + GET_U_1(ap->rrep_type) & RREP_REPAIR ? "[R]" : "", + GET_U_1(ap->rrep_type) & RREP_ACK ? "[A] " : " ", + GET_U_1(ap->rrep_ps) & RREP_PREFIX_MASK, + GET_U_1(ap->rrep_hops), ipaddr_string(ndo, ap->rrep_da), - EXTRACT_BE_U_4(ap->rrep_ds), + GET_BE_U_4(ap->rrep_ds), ipaddr_string(ndo, ap->rrep_oa), - EXTRACT_BE_U_4(ap->rrep_life)); + GET_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); @@ -275,16 +277,16 @@ aodv_rerr(netdissect_options *ndo, const u_char *dat, u_int length) if (length < sizeof(*ap)) goto trunc; ND_PRINT(" rerr %s [items %u] [%u]:", - EXTRACT_U_1(ap->rerr_flags) & RERR_NODELETE ? "[D]" : "", - EXTRACT_U_1(ap->rerr_dc), length); + GET_U_1(ap->rerr_flags) & RERR_NODELETE ? "[D]" : "", + GET_U_1(ap->rerr_dc), length); dp = (const struct rerr_unreach *)(dat + sizeof(*ap)); i = length - sizeof(*ap); - for (dc = EXTRACT_U_1(ap->rerr_dc); dc != 0; dc--) { + for (dc = GET_U_1(ap->rerr_dc); dc != 0; dc--) { ND_TCHECK_SIZE(dp); if (i < sizeof(*dp)) goto trunc; ND_PRINT(" {%s}(%u)", ipaddr_string(ndo, dp->u_da), - EXTRACT_BE_U_4(dp->u_ds)); + GET_BE_U_4(dp->u_ds)); dp++; i -= sizeof(*dp); } @@ -305,17 +307,17 @@ aodv_v6_rreq(netdissect_options *ndo, const u_char *dat, u_int length) goto trunc; ND_PRINT(" v6 rreq %u %s%s%s%s%shops %u id 0x%08x\n" "\tdst %s seq %u src %s seq %u", length, - EXTRACT_U_1(ap->rreq_type) & RREQ_JOIN ? "[J]" : "", - EXTRACT_U_1(ap->rreq_type) & RREQ_REPAIR ? "[R]" : "", - EXTRACT_U_1(ap->rreq_type) & RREQ_GRAT ? "[G]" : "", - EXTRACT_U_1(ap->rreq_type) & RREQ_DEST ? "[D]" : "", - EXTRACT_U_1(ap->rreq_type) & RREQ_UNKNOWN ? "[U] " : " ", - EXTRACT_U_1(ap->rreq_hops), - EXTRACT_BE_U_4(ap->rreq_id), + GET_U_1(ap->rreq_type) & RREQ_JOIN ? "[J]" : "", + GET_U_1(ap->rreq_type) & RREQ_REPAIR ? "[R]" : "", + GET_U_1(ap->rreq_type) & RREQ_GRAT ? "[G]" : "", + GET_U_1(ap->rreq_type) & RREQ_DEST ? "[D]" : "", + GET_U_1(ap->rreq_type) & RREQ_UNKNOWN ? "[U] " : " ", + GET_U_1(ap->rreq_hops), + GET_BE_U_4(ap->rreq_id), ip6addr_string(ndo, ap->rreq_da), - EXTRACT_BE_U_4(ap->rreq_ds), + GET_BE_U_4(ap->rreq_ds), ip6addr_string(ndo, ap->rreq_oa), - EXTRACT_BE_U_4(ap->rreq_os)); + GET_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); @@ -336,14 +338,14 @@ aodv_v6_rrep(netdissect_options *ndo, const u_char *dat, u_int length) goto trunc; ND_PRINT(" rrep %u %s%sprefix %u hops %u\n" "\tdst %s dseq %u src %s %u ms", length, - EXTRACT_U_1(ap->rrep_type) & RREP_REPAIR ? "[R]" : "", - EXTRACT_U_1(ap->rrep_type) & RREP_ACK ? "[A] " : " ", - EXTRACT_U_1(ap->rrep_ps) & RREP_PREFIX_MASK, - EXTRACT_U_1(ap->rrep_hops), + GET_U_1(ap->rrep_type) & RREP_REPAIR ? "[R]" : "", + GET_U_1(ap->rrep_type) & RREP_ACK ? "[A] " : " ", + GET_U_1(ap->rrep_ps) & RREP_PREFIX_MASK, + GET_U_1(ap->rrep_hops), ip6addr_string(ndo, ap->rrep_da), - EXTRACT_BE_U_4(ap->rrep_ds), + GET_BE_U_4(ap->rrep_ds), ip6addr_string(ndo, ap->rrep_oa), - EXTRACT_BE_U_4(ap->rrep_life)); + GET_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); @@ -364,16 +366,16 @@ aodv_v6_rerr(netdissect_options *ndo, const u_char *dat, u_int length) if (length < sizeof(*ap)) goto trunc; ND_PRINT(" rerr %s [items %u] [%u]:", - EXTRACT_U_1(ap->rerr_flags) & RERR_NODELETE ? "[D]" : "", - EXTRACT_U_1(ap->rerr_dc), length); + GET_U_1(ap->rerr_flags) & RERR_NODELETE ? "[D]" : "", + GET_U_1(ap->rerr_dc), length); dp6 = (const struct rerr_unreach6 *)(const void *)(ap + 1); i = length - sizeof(*ap); - for (dc = EXTRACT_U_1(ap->rerr_dc); dc != 0; dc--) { + for (dc = GET_U_1(ap->rerr_dc); dc != 0; dc--) { ND_TCHECK_SIZE(dp6); if (i < sizeof(*dp6)) goto trunc; ND_PRINT(" {%s}(%u)", ip6addr_string(ndo, dp6->u_da), - EXTRACT_BE_U_4(dp6->u_ds)); + GET_BE_U_4(dp6->u_ds)); dp6++; i -= sizeof(*dp6); } @@ -394,17 +396,17 @@ aodv_v6_draft_01_rreq(netdissect_options *ndo, const u_char *dat, u_int length) goto trunc; ND_PRINT(" rreq %u %s%s%s%s%shops %u id 0x%08x\n" "\tdst %s seq %u src %s seq %u", length, - EXTRACT_U_1(ap->rreq_type) & RREQ_JOIN ? "[J]" : "", - EXTRACT_U_1(ap->rreq_type) & RREQ_REPAIR ? "[R]" : "", - EXTRACT_U_1(ap->rreq_type) & RREQ_GRAT ? "[G]" : "", - EXTRACT_U_1(ap->rreq_type) & RREQ_DEST ? "[D]" : "", - EXTRACT_U_1(ap->rreq_type) & RREQ_UNKNOWN ? "[U] " : " ", - EXTRACT_U_1(ap->rreq_hops), - EXTRACT_BE_U_4(ap->rreq_id), + GET_U_1(ap->rreq_type) & RREQ_JOIN ? "[J]" : "", + GET_U_1(ap->rreq_type) & RREQ_REPAIR ? "[R]" : "", + GET_U_1(ap->rreq_type) & RREQ_GRAT ? "[G]" : "", + GET_U_1(ap->rreq_type) & RREQ_DEST ? "[D]" : "", + GET_U_1(ap->rreq_type) & RREQ_UNKNOWN ? "[U] " : " ", + GET_U_1(ap->rreq_hops), + GET_BE_U_4(ap->rreq_id), ip6addr_string(ndo, ap->rreq_da), - EXTRACT_BE_U_4(ap->rreq_ds), + GET_BE_U_4(ap->rreq_ds), ip6addr_string(ndo, ap->rreq_oa), - EXTRACT_BE_U_4(ap->rreq_os)); + GET_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); @@ -425,14 +427,14 @@ aodv_v6_draft_01_rrep(netdissect_options *ndo, const u_char *dat, u_int length) goto trunc; ND_PRINT(" rrep %u %s%sprefix %u hops %u\n" "\tdst %s dseq %u src %s %u ms", length, - EXTRACT_U_1(ap->rrep_type) & RREP_REPAIR ? "[R]" : "", - EXTRACT_U_1(ap->rrep_type) & RREP_ACK ? "[A] " : " ", - EXTRACT_U_1(ap->rrep_ps) & RREP_PREFIX_MASK, - EXTRACT_U_1(ap->rrep_hops), + GET_U_1(ap->rrep_type) & RREP_REPAIR ? "[R]" : "", + GET_U_1(ap->rrep_type) & RREP_ACK ? "[A] " : " ", + GET_U_1(ap->rrep_ps) & RREP_PREFIX_MASK, + GET_U_1(ap->rrep_hops), ip6addr_string(ndo, ap->rrep_da), - EXTRACT_BE_U_4(ap->rrep_ds), + GET_BE_U_4(ap->rrep_ds), ip6addr_string(ndo, ap->rrep_oa), - EXTRACT_BE_U_4(ap->rrep_life)); + GET_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); @@ -453,16 +455,16 @@ aodv_v6_draft_01_rerr(netdissect_options *ndo, const u_char *dat, u_int length) if (length < sizeof(*ap)) goto trunc; ND_PRINT(" rerr %s [items %u] [%u]:", - EXTRACT_U_1(ap->rerr_flags) & RERR_NODELETE ? "[D]" : "", - EXTRACT_U_1(ap->rerr_dc), length); + GET_U_1(ap->rerr_flags) & RERR_NODELETE ? "[D]" : "", + GET_U_1(ap->rerr_dc), length); dp6 = (const struct rerr_unreach6_draft_01 *)(const void *)(ap + 1); i = length - sizeof(*ap); - for (dc = EXTRACT_U_1(ap->rerr_dc); dc != 0; dc--) { + for (dc = GET_U_1(ap->rerr_dc); dc != 0; dc--) { ND_TCHECK_SIZE(dp6); if (i < sizeof(*dp6)) goto trunc; ND_PRINT(" {%s}(%u)", ip6addr_string(ndo, dp6->u_da), - EXTRACT_BE_U_4(dp6->u_ds)); + GET_BE_U_4(dp6->u_ds)); dp6++; i -= sizeof(*dp6); } @@ -484,7 +486,7 @@ aodv_print(netdissect_options *ndo, * and then fetch it. */ ND_TCHECK_1(dat); - msg_type = EXTRACT_U_1(dat); + msg_type = GET_U_1(dat); ND_PRINT(" aodv"); switch (msg_type) { diff --git a/print-aoe.c b/print-aoe.c index 411ecf1c..cd088671 100644 --- a/print-aoe.c +++ b/print-aoe.c @@ -147,43 +147,44 @@ aoev1_issue_print(netdissect_options *ndo, goto invalid; /* AFlags */ ND_TCHECK_1(cp); - ND_PRINT("\n\tAFlags: [%s]", bittok2str(aoev1_aflag_str, "none", EXTRACT_U_1(cp))); + ND_PRINT("\n\tAFlags: [%s]", + bittok2str(aoev1_aflag_str, "none", GET_U_1(cp))); cp += 1; /* Err/Feature */ ND_TCHECK_1(cp); - ND_PRINT(", Err/Feature: %u", EXTRACT_U_1(cp)); + ND_PRINT(", Err/Feature: %u", GET_U_1(cp)); cp += 1; /* Sector Count (not correlated with the length) */ ND_TCHECK_1(cp); - ND_PRINT(", Sector Count: %u", EXTRACT_U_1(cp)); + ND_PRINT(", Sector Count: %u", GET_U_1(cp)); cp += 1; /* Cmd/Status */ ND_TCHECK_1(cp); - ND_PRINT(", Cmd/Status: %u", EXTRACT_U_1(cp)); + ND_PRINT(", Cmd/Status: %u", GET_U_1(cp)); cp += 1; /* lba0 */ ND_TCHECK_1(cp); - ND_PRINT("\n\tlba0: %u", EXTRACT_U_1(cp)); + ND_PRINT("\n\tlba0: %u", GET_U_1(cp)); cp += 1; /* lba1 */ ND_TCHECK_1(cp); - ND_PRINT(", lba1: %u", EXTRACT_U_1(cp)); + ND_PRINT(", lba1: %u", GET_U_1(cp)); cp += 1; /* lba2 */ ND_TCHECK_1(cp); - ND_PRINT(", lba2: %u", EXTRACT_U_1(cp)); + ND_PRINT(", lba2: %u", GET_U_1(cp)); cp += 1; /* lba3 */ ND_TCHECK_1(cp); - ND_PRINT(", lba3: %u", EXTRACT_U_1(cp)); + ND_PRINT(", lba3: %u", GET_U_1(cp)); cp += 1; /* lba4 */ ND_TCHECK_1(cp); - ND_PRINT(", lba4: %u", EXTRACT_U_1(cp)); + ND_PRINT(", lba4: %u", GET_U_1(cp)); cp += 1; /* lba5 */ ND_TCHECK_1(cp); - ND_PRINT(", lba5: %u", EXTRACT_U_1(cp)); + ND_PRINT(", lba5: %u", GET_U_1(cp)); cp += 1; /* Reserved */ ND_TCHECK_2(cp); @@ -212,24 +213,24 @@ aoev1_query_print(netdissect_options *ndo, goto invalid; /* Buffer Count */ ND_TCHECK_2(cp); - ND_PRINT("\n\tBuffer Count: %u", EXTRACT_BE_U_2(cp)); + ND_PRINT("\n\tBuffer Count: %u", GET_BE_U_2(cp)); cp += 2; /* Firmware Version */ ND_TCHECK_2(cp); - ND_PRINT(", Firmware Version: %u", EXTRACT_BE_U_2(cp)); + ND_PRINT(", Firmware Version: %u", GET_BE_U_2(cp)); cp += 2; /* Sector Count */ ND_TCHECK_1(cp); - ND_PRINT(", Sector Count: %u", EXTRACT_U_1(cp)); + ND_PRINT(", Sector Count: %u", GET_U_1(cp)); cp += 1; /* AoE/CCmd */ ND_TCHECK_1(cp); - ND_PRINT(", AoE: %u, CCmd: %s", (EXTRACT_U_1(cp) & 0xF0) >> 4, - tok2str(aoev1_ccmd_str, "Unknown (0x02x)", EXTRACT_U_1(cp) & 0x0F)); + ND_PRINT(", AoE: %u, CCmd: %s", (GET_U_1(cp) & 0xF0) >> 4, + tok2str(aoev1_ccmd_str, "Unknown (0x02x)", GET_U_1(cp) & 0x0F)); cp += 1; /* Config String Length */ ND_TCHECK_2(cp); - cslen = EXTRACT_BE_U_2(cp); + cslen = GET_BE_U_2(cp); cp += 2; if (cslen > AOEV1_MAX_CONFSTR_LEN || AOEV1_QUERY_ARG_LEN + cslen > len) goto invalid; @@ -264,15 +265,17 @@ aoev1_mac_print(netdissect_options *ndo, cp += 1; /* MCmd */ ND_TCHECK_1(cp); - ND_PRINT("\n\tMCmd: %s", tok2str(aoev1_mcmd_str, "Unknown (0x%02x)", EXTRACT_U_1(cp))); + ND_PRINT("\n\tMCmd: %s", + tok2str(aoev1_mcmd_str, "Unknown (0x%02x)", GET_U_1(cp))); cp += 1; /* MError */ ND_TCHECK_1(cp); - ND_PRINT(", MError: %s", tok2str(aoev1_merror_str, "Unknown (0x%02x)", EXTRACT_U_1(cp))); + ND_PRINT(", MError: %s", + tok2str(aoev1_merror_str, "Unknown (0x%02x)", GET_U_1(cp))); cp += 1; /* Dir Count */ ND_TCHECK_1(cp); - dircount = EXTRACT_U_1(cp); + dircount = GET_U_1(cp); cp += 1; ND_PRINT(", Dir Count: %u", dircount); if (AOEV1_MAC_ARG_LEN + dircount * 8 > len) @@ -284,7 +287,8 @@ aoev1_mac_print(netdissect_options *ndo, cp += 1; /* DCmd */ ND_TCHECK_1(cp); - ND_PRINT("\n\t DCmd: %s", tok2str(aoev1_dcmd_str, "Unknown (0x%02x)", EXTRACT_U_1(cp))); + ND_PRINT("\n\t DCmd: %s", + tok2str(aoev1_dcmd_str, "Unknown (0x%02x)", GET_U_1(cp))); cp += 1; /* Ethernet Address */ ND_TCHECK_LEN(cp, MAC_ADDR_LEN); @@ -312,11 +316,12 @@ aoev1_reserve_print(netdissect_options *ndo, goto invalid; /* RCmd */ ND_TCHECK_1(cp); - ND_PRINT("\n\tRCmd: %s", tok2str(aoev1_rcmd_str, "Unknown (0x%02x)", EXTRACT_U_1(cp))); + ND_PRINT("\n\tRCmd: %s", + tok2str(aoev1_rcmd_str, "Unknown (0x%02x)", GET_U_1(cp))); cp += 1; /* NMacs (correlated with the length) */ ND_TCHECK_1(cp); - nmacs = EXTRACT_U_1(cp); + nmacs = GET_U_1(cp); cp += 1; ND_PRINT(", NMacs: %u", nmacs); if (AOEV1_RESERVE_ARG_LEN + nmacs * MAC_ADDR_LEN != len) @@ -348,7 +353,7 @@ aoev1_print(netdissect_options *ndo, if (len < AOEV1_COMMON_HDR_LEN) goto invalid; /* Flags */ - flags = EXTRACT_U_1(cp) & 0x0F; + flags = GET_U_1(cp) & 0x0F; ND_PRINT(", Flags: [%s]", bittok2str(aoev1_flag_str, "none", flags)); cp += 1; if (! ndo->ndo_vflag) @@ -356,24 +361,25 @@ aoev1_print(netdissect_options *ndo, /* Error */ ND_TCHECK_1(cp); if (flags & AOEV1_FLAG_E) - ND_PRINT("\n\tError: %s", tok2str(aoev1_errcode_str, "Invalid (%u)", EXTRACT_U_1(cp))); + ND_PRINT("\n\tError: %s", + tok2str(aoev1_errcode_str, "Invalid (%u)", GET_U_1(cp))); cp += 1; /* Major */ ND_TCHECK_2(cp); - ND_PRINT("\n\tMajor: 0x%04x", EXTRACT_BE_U_2(cp)); + ND_PRINT("\n\tMajor: 0x%04x", GET_BE_U_2(cp)); cp += 2; /* Minor */ ND_TCHECK_1(cp); - ND_PRINT(", Minor: 0x%02x", EXTRACT_U_1(cp)); + ND_PRINT(", Minor: 0x%02x", GET_U_1(cp)); cp += 1; /* Command */ ND_TCHECK_1(cp); - command = EXTRACT_U_1(cp); + command = GET_U_1(cp); cp += 1; ND_PRINT(", Command: %s", tok2str(cmdcode_str, "Unknown (0x%02x)", command)); /* Tag */ ND_TCHECK_4(cp); - ND_PRINT(", Tag: 0x%08x", EXTRACT_BE_U_4(cp)); + ND_PRINT(", Tag: 0x%08x", GET_BE_U_4(cp)); cp += 4; /* Arg */ cmd_decoder = @@ -408,7 +414,7 @@ aoe_print(netdissect_options *ndo, goto invalid; /* Ver/Flags */ ND_TCHECK_1(cp); - ver = (EXTRACT_U_1(cp) & 0xF0) >> 4; + ver = (GET_U_1(cp) & 0xF0) >> 4; /* Don't advance cp yet: low order 4 bits are version-specific. */ ND_PRINT(", Ver %u", ver); diff --git a/print-ap1394.c b/print-ap1394.c index d401153c..9dd6ee95 100644 --- a/print-ap1394.c +++ b/print-ap1394.c @@ -67,7 +67,7 @@ ap1394_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length) fwaddr_string(ndo, fp->firewire_shost), fwaddr_string(ndo, fp->firewire_dhost)); - firewire_type = EXTRACT_BE_U_2(fp->firewire_type); + firewire_type = GET_BE_U_2(fp->firewire_type); if (!ndo->ndo_qflag) { ND_PRINT(", ethertype %s (0x%04x)", tok2str(ethertype_values,"Unknown", firewire_type), @@ -108,7 +108,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_U_2(fp->firewire_type); + ether_type = GET_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 e5e9bbfe..d229631a 100644 --- a/print-arcnet.c +++ b/print-arcnet.c @@ -130,18 +130,18 @@ arcnet_print(netdissect_options *ndo, const u_char *bp, u_int length, int phds, if (ndo->ndo_qflag) { ND_PRINT("%02x %02x %u: ", - EXTRACT_U_1(ap->arc_shost), - EXTRACT_U_1(ap->arc_dhost), + GET_U_1(ap->arc_shost), + GET_U_1(ap->arc_dhost), length); return; } - arctypename = tok2str(arctypemap, "%02x", EXTRACT_U_1(ap->arc_type)); + arctypename = tok2str(arctypemap, "%02x", GET_U_1(ap->arc_type)); if (!phds) { ND_PRINT("%02x %02x %s %u: ", - EXTRACT_U_1(ap->arc_shost), - EXTRACT_U_1(ap->arc_dhost), + GET_U_1(ap->arc_shost), + GET_U_1(ap->arc_dhost), arctypename, length); return; @@ -149,8 +149,8 @@ arcnet_print(netdissect_options *ndo, const u_char *bp, u_int length, int phds, if (flag == 0) { ND_PRINT("%02x %02x %s seqid %04x %u: ", - EXTRACT_U_1(ap->arc_shost), - EXTRACT_U_1(ap->arc_dhost), + GET_U_1(ap->arc_shost), + GET_U_1(ap->arc_dhost), arctypename, seqid, length); return; @@ -159,15 +159,15 @@ arcnet_print(netdissect_options *ndo, const u_char *bp, u_int length, int phds, if (flag & 1) ND_PRINT("%02x %02x %s seqid %04x " "(first of %u fragments) %u: ", - EXTRACT_U_1(ap->arc_shost), - EXTRACT_U_1(ap->arc_dhost), + GET_U_1(ap->arc_shost), + GET_U_1(ap->arc_dhost), arctypename, seqid, (flag + 3) / 2, length); else ND_PRINT("%02x %02x %s seqid %04x " "(fragment %u) %u: ", - EXTRACT_U_1(ap->arc_shost), - EXTRACT_U_1(ap->arc_dhost), + GET_U_1(ap->arc_shost), + GET_U_1(ap->arc_dhost), arctypename, seqid, flag/2 + 1, length); } @@ -197,7 +197,7 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch } ap = (const struct arc_header *)p; - arc_type = EXTRACT_U_1(ap->arc_type); + arc_type = GET_U_1(ap->arc_type); switch (arc_type) { default: @@ -219,7 +219,7 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch return (caplen); } - flag = EXTRACT_U_1(ap->arc_flag); + flag = GET_U_1(ap->arc_flag); if (flag == 0xff) { if (caplen < ARC_HDRNEWLEN_EXC) { arcnet_print(ndo, p, length, 0, 0, 0); @@ -227,11 +227,11 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch nd_print_trunc(ndo); return (caplen); } - flag = EXTRACT_U_1(ap->arc_flag2); - seqid = EXTRACT_BE_U_2(ap->arc_seqid2); + flag = GET_U_1(ap->arc_flag2); + seqid = GET_BE_U_2(ap->arc_seqid2); archdrlen = ARC_HDRNEWLEN_EXC; } else { - seqid = EXTRACT_BE_U_2(ap->arc_seqid); + seqid = GET_BE_U_2(ap->arc_seqid); archdrlen = ARC_HDRNEWLEN; } } @@ -287,7 +287,7 @@ arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, cons } ap = (const struct arc_linux_header *)p; - arc_type = EXTRACT_U_1(ap->arc_type); + arc_type = GET_U_1(ap->arc_type); switch (arc_type) { default: diff --git a/print-arp.c b/print-arp.c index 5e744587..9465e8f4 100644 --- a/print-arp.c +++ b/print-arp.c @@ -77,18 +77,18 @@ struct arp_pkthdr { nd_byte ar_tpa[]; /* target protocol address */ #endif #define ar_sha(ap) (((const u_char *)((ap)+1))+ 0) -#define ar_spa(ap) (((const u_char *)((ap)+1))+ EXTRACT_U_1((ap)->ar_hln)) -#define ar_tha(ap) (((const u_char *)((ap)+1))+ EXTRACT_U_1((ap)->ar_hln)+EXTRACT_U_1((ap)->ar_pln)) -#define ar_tpa(ap) (((const u_char *)((ap)+1))+2*EXTRACT_U_1((ap)->ar_hln)+EXTRACT_U_1((ap)->ar_pln)) +#define ar_spa(ap) (((const u_char *)((ap)+1))+ GET_U_1((ap)->ar_hln)) +#define ar_tha(ap) (((const u_char *)((ap)+1))+ GET_U_1((ap)->ar_hln)+GET_U_1((ap)->ar_pln)) +#define ar_tpa(ap) (((const u_char *)((ap)+1))+2*GET_U_1((ap)->ar_hln)+GET_U_1((ap)->ar_pln)) }; #define ARP_HDRLEN 8 -#define HRD(ap) EXTRACT_BE_U_2((ap)->ar_hrd) -#define HRD_LEN(ap) EXTRACT_U_1((ap)->ar_hln) -#define PROTO_LEN(ap) EXTRACT_U_1((ap)->ar_pln) -#define OP(ap) EXTRACT_BE_U_2((ap)->ar_op) -#define PRO(ap) EXTRACT_BE_U_2((ap)->ar_pro) +#define HRD(ap) GET_BE_U_2((ap)->ar_hrd) +#define HRD_LEN(ap) GET_U_1((ap)->ar_hln) +#define PROTO_LEN(ap) GET_U_1((ap)->ar_pln) +#define OP(ap) GET_BE_U_2((ap)->ar_op) +#define PRO(ap) GET_BE_U_2((ap)->ar_pro) #define SHA(ap) (ar_sha(ap)) #define SPA(ap) (ar_spa(ap)) #define THA(ap) (ar_tha(ap)) @@ -151,15 +151,15 @@ struct atmarp_pkthdr { nd_byte aar_tpa[]; /* target protocol address */ #endif -#define ATMHRD(ap) EXTRACT_BE_U_2((ap)->aar_hrd) -#define ATMSHRD_LEN(ap) (EXTRACT_U_1((ap)->aar_shtl) & ATMARP_LEN_MASK) -#define ATMSSLN(ap) (EXTRACT_U_1((ap)->aar_sstl) & ATMARP_LEN_MASK) -#define ATMSPROTO_LEN(ap) EXTRACT_U_1((ap)->aar_spln) -#define ATMOP(ap) EXTRACT_BE_U_2((ap)->aar_op) -#define ATMPRO(ap) EXTRACT_BE_U_2((ap)->aar_pro) -#define ATMTHRD_LEN(ap) (EXTRACT_U_1((ap)->aar_thtl) & ATMARP_LEN_MASK) -#define ATMTSLN(ap) (EXTRACT_U_1((ap)->aar_tstl) & ATMARP_LEN_MASK) -#define ATMTPROTO_LEN(ap) EXTRACT_U_1((ap)->aar_tpln) +#define ATMHRD(ap) GET_BE_U_2((ap)->aar_hrd) +#define ATMSHRD_LEN(ap) (GET_U_1((ap)->aar_shtl) & ATMARP_LEN_MASK) +#define ATMSSLN(ap) (GET_U_1((ap)->aar_sstl) & ATMARP_LEN_MASK) +#define ATMSPROTO_LEN(ap) GET_U_1((ap)->aar_spln) +#define ATMOP(ap) GET_BE_U_2((ap)->aar_op) +#define ATMPRO(ap) GET_BE_U_2((ap)->aar_pro) +#define ATMTHRD_LEN(ap) (GET_U_1((ap)->aar_thtl) & ATMARP_LEN_MASK) +#define ATMTSLN(ap) (GET_U_1((ap)->aar_tstl) & ATMARP_LEN_MASK) +#define ATMTPROTO_LEN(ap) GET_U_1((ap)->aar_tpln) #define aar_sha(ap) ((const u_char *)((ap)+1)) #define aar_ssa(ap) (aar_sha(ap) + ATMSHRD_LEN(ap)) #define aar_spa(ap) (aar_ssa(ap) + ATMSSLN(ap)) @@ -179,7 +179,7 @@ static int isnonzero(netdissect_options *ndo, const u_char *a, size_t len) { while (len > 0) { - if (EXTRACT_U_1(a) != 0) + if (GET_U_1(a) != 0) return (1); a++; len--; diff --git a/print-ascii.c b/print-ascii.c index df3f36a1..8460f84b 100644 --- a/print-ascii.c +++ b/print-ascii.c @@ -70,7 +70,7 @@ ascii_print(netdissect_options *ndo, length = caplength; ND_PRINT("\n"); while (length > 0) { - s = EXTRACT_U_1(cp); + s = GET_U_1(cp); cp++; length--; if (s == '\r') { @@ -83,7 +83,7 @@ ascii_print(netdissect_options *ndo, * * In the middle of a line, just print a '.'. */ - if (length > 1 && EXTRACT_U_1(cp) != '\n') + if (length > 1 && GET_U_1(cp) != '\n') ND_PRINT("."); } else { if (!ND_ISGRAPH(s) && @@ -113,9 +113,9 @@ hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *ident, i = 0; hsp = hexstuff; asp = asciistuff; while (nshorts != 0) { - s1 = EXTRACT_U_1(cp); + s1 = GET_U_1(cp); cp++; - s2 = EXTRACT_U_1(cp); + s2 = GET_U_1(cp); cp++; (void)nd_snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff), " %02x%02x", s1, s2); @@ -134,7 +134,7 @@ hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *ident, nshorts--; } if (length & 1) { - s1 = EXTRACT_U_1(cp); + s1 = GET_U_1(cp); cp++; (void)nd_snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff), " %02x", s1); @@ -179,16 +179,16 @@ hex_print_with_offset(netdissect_options *ndo, ND_PRINT("%s0x%04x: ", ident, oset); oset += HEXDUMP_BYTES_PER_LINE; } - s = EXTRACT_U_1(cp); + s = GET_U_1(cp); cp++; - ND_PRINT(" %02x%02x", s, EXTRACT_U_1(cp)); + ND_PRINT(" %02x%02x", s, GET_U_1(cp)); cp++; nshorts--; } if (length & 1) { if ((i % 8) == 0) ND_PRINT("%s0x%04x: ", ident, oset); - ND_PRINT(" %02x", EXTRACT_U_1(cp)); + ND_PRINT(" %02x", GET_U_1(cp)); } } diff --git a/print-atalk.c b/print-atalk.c index 8faa29f0..99cd850e 100644 --- a/print-atalk.c +++ b/print-atalk.c @@ -113,7 +113,7 @@ llap_print(netdissect_options *ndo, bp += sizeof(*lp); length -= sizeof(*lp); hdrlen = sizeof(*lp); - switch (EXTRACT_U_1(lp->type)) { + switch (GET_U_1(lp->type)) { case lapShortDDP: if (length < ddpSSize) { @@ -126,13 +126,16 @@ llap_print(netdissect_options *ndo, } sdp = (const struct atShortDDP *)bp; ND_PRINT("%s.%s", - ataddr_string(ndo, 0, EXTRACT_U_1(lp->src)), ddpskt_string(ndo, EXTRACT_U_1(sdp->srcSkt))); + ataddr_string(ndo, 0, GET_U_1(lp->src)), + ddpskt_string(ndo, GET_U_1(sdp->srcSkt))); ND_PRINT(" > %s.%s:", - ataddr_string(ndo, 0, EXTRACT_U_1(lp->dst)), ddpskt_string(ndo, EXTRACT_U_1(sdp->dstSkt))); + ataddr_string(ndo, 0, GET_U_1(lp->dst)), + ddpskt_string(ndo, GET_U_1(sdp->dstSkt))); bp += ddpSSize; length -= ddpSSize; hdrlen += ddpSSize; - ddp_print(ndo, bp, length, EXTRACT_U_1(sdp->type), 0, EXTRACT_U_1(lp->src), EXTRACT_U_1(sdp->srcSkt)); + ddp_print(ndo, bp, length, GET_U_1(sdp->type), 0, + GET_U_1(lp->src), GET_U_1(sdp->srcSkt)); break; case lapDDP: @@ -145,16 +148,18 @@ llap_print(netdissect_options *ndo, return (0); /* cut short by the snapshot length */ } dp = (const struct atDDP *)bp; - snet = EXTRACT_BE_U_2(dp->srcNet); - ND_PRINT("%s.%s", ataddr_string(ndo, snet, EXTRACT_U_1(dp->srcNode)), - ddpskt_string(ndo, EXTRACT_U_1(dp->srcSkt))); + snet = GET_BE_U_2(dp->srcNet); + ND_PRINT("%s.%s", + ataddr_string(ndo, snet, GET_U_1(dp->srcNode)), + ddpskt_string(ndo, GET_U_1(dp->srcSkt))); ND_PRINT(" > %s.%s:", - ataddr_string(ndo, EXTRACT_BE_U_2(dp->dstNet), EXTRACT_U_1(dp->dstNode)), - ddpskt_string(ndo, EXTRACT_U_1(dp->dstSkt))); + ataddr_string(ndo, GET_BE_U_2(dp->dstNet), GET_U_1(dp->dstNode)), + ddpskt_string(ndo, GET_U_1(dp->dstSkt))); bp += ddpSize; length -= ddpSize; hdrlen += ddpSize; - ddp_print(ndo, bp, length, EXTRACT_U_1(dp->type), snet, EXTRACT_U_1(dp->srcNode), EXTRACT_U_1(dp->srcSkt)); + ddp_print(ndo, bp, length, GET_U_1(dp->type), snet, + GET_U_1(dp->srcNode), GET_U_1(dp->srcSkt)); break; #ifdef notdef @@ -165,7 +170,8 @@ llap_print(netdissect_options *ndo, default: ND_PRINT("%u > %u at-lap#%u %u", - EXTRACT_U_1(lp->src), EXTRACT_U_1(lp->dst), EXTRACT_U_1(lp->type), length); + GET_U_1(lp->src), GET_U_1(lp->dst), GET_U_1(lp->type), + length); break; } return (hdrlen); @@ -196,15 +202,16 @@ atalk_print(netdissect_options *ndo, return; } dp = (const struct atDDP *)bp; - snet = EXTRACT_BE_U_2(dp->srcNet); - ND_PRINT("%s.%s", ataddr_string(ndo, snet, EXTRACT_U_1(dp->srcNode)), - ddpskt_string(ndo, EXTRACT_U_1(dp->srcSkt))); + snet = GET_BE_U_2(dp->srcNet); + ND_PRINT("%s.%s", ataddr_string(ndo, snet, GET_U_1(dp->srcNode)), + ddpskt_string(ndo, GET_U_1(dp->srcSkt))); ND_PRINT(" > %s.%s: ", - ataddr_string(ndo, EXTRACT_BE_U_2(dp->dstNet), EXTRACT_U_1(dp->dstNode)), - ddpskt_string(ndo, EXTRACT_U_1(dp->dstSkt))); + ataddr_string(ndo, GET_BE_U_2(dp->dstNet), GET_U_1(dp->dstNode)), + ddpskt_string(ndo, GET_U_1(dp->dstSkt))); bp += ddpSize; length -= ddpSize; - ddp_print(ndo, bp, length, EXTRACT_U_1(dp->type), snet, EXTRACT_U_1(dp->srcNode), EXTRACT_U_1(dp->srcSkt)); + ddp_print(ndo, bp, length, GET_U_1(dp->type), snet, + GET_U_1(dp->srcNode), GET_U_1(dp->srcSkt)); } /* XXX should probably pass in the snap header and do checks like arp_print() */ @@ -228,10 +235,10 @@ aarp_print(netdissect_options *ndo, ND_PRINT(" [|aarp %u]", length); return; } - if (EXTRACT_BE_U_2(ap->htype) == 1 && - EXTRACT_BE_U_2(ap->ptype) == ETHERTYPE_ATALK && - EXTRACT_U_1(ap->halen) == 6 && EXTRACT_U_1(ap->palen) == 4 ) - switch (EXTRACT_BE_U_2(ap->op)) { + if (GET_BE_U_2(ap->htype) == 1 && + GET_BE_U_2(ap->ptype) == ETHERTYPE_ATALK && + GET_U_1(ap->halen) == 6 && GET_U_1(ap->palen) == 4 ) + switch (GET_BE_U_2(ap->op)) { case 1: /* request */ ND_PRINT("who-has %s tell %s", AT(pdaddr), AT(psaddr)); @@ -246,8 +253,8 @@ aarp_print(netdissect_options *ndo, return; } ND_PRINT("len %u op %u htype %u ptype %#x halen %u palen %u", - length, EXTRACT_BE_U_2(ap->op), EXTRACT_BE_U_2(ap->htype), - EXTRACT_BE_U_2(ap->ptype), EXTRACT_U_1(ap->halen), EXTRACT_U_1(ap->palen)); + length, GET_BE_U_2(ap->op), GET_BE_U_2(ap->htype), + GET_BE_U_2(ap->ptype), GET_U_1(ap->halen), GET_U_1(ap->palen)); } /* @@ -296,15 +303,15 @@ atp_print(netdissect_options *ndo, return; } length -= sizeof(*ap); - control = EXTRACT_U_1(ap->control); + control = GET_U_1(ap->control); switch (control & 0xc0) { case atpReqCode: ND_PRINT(" atp-req%s %u", control & atpXO? " " : "*", - EXTRACT_BE_U_2(ap->transID)); + GET_BE_U_2(ap->transID)); - atp_bitmap_print(ndo, EXTRACT_U_1(ap->bitmap)); + atp_bitmap_print(ndo, GET_U_1(ap->bitmap)); if (length != 0) ND_PRINT(" [len=%u]", length); @@ -325,7 +332,8 @@ atp_print(netdissect_options *ndo, case atpRspCode: ND_PRINT(" atp-resp%s%u:%u (%u)", control & atpEOM? "*" : " ", - EXTRACT_BE_U_2(ap->transID), EXTRACT_U_1(ap->bitmap), length); + GET_BE_U_2(ap->transID), GET_U_1(ap->bitmap), + length); switch (control & (atpXO|atpSTS)) { case atpXO: ND_PRINT(" [XO]"); @@ -340,9 +348,9 @@ atp_print(netdissect_options *ndo, break; case atpRelCode: - ND_PRINT(" atp-rel %u", EXTRACT_BE_U_2(ap->transID)); + ND_PRINT(" atp-rel %u", GET_BE_U_2(ap->transID)); - atp_bitmap_print(ndo, EXTRACT_U_1(ap->bitmap)); + atp_bitmap_print(ndo, GET_U_1(ap->bitmap)); /* length should be zero */ if (length) @@ -368,10 +376,10 @@ atp_print(netdissect_options *ndo, default: ND_PRINT(" atp-0x%x %u (%u)", control, - EXTRACT_BE_U_2(ap->transID), length); + GET_BE_U_2(ap->transID), length); break; } - data = EXTRACT_BE_U_4(ap->userData); + data = GET_BE_U_4(ap->userData); if (data != 0) ND_PRINT(" 0x%x", data); } @@ -435,12 +443,13 @@ nbp_print(netdissect_options *ndo, nd_print_trunc(ndo); return; } - control = EXTRACT_U_1(np->control); + control = GET_U_1(np->control); switch (i = (control & 0xf0)) { case nbpBrRq: case nbpLkUp: - ND_PRINT(i == nbpLkUp? " nbp-lkup %u:":" nbp-brRq %u:", EXTRACT_U_1(np->id)); + ND_PRINT(i == nbpLkUp? " nbp-lkup %u:":" nbp-brRq %u:", + GET_U_1(np->id)); if ((const u_char *)(tp + 1) > ep) { nd_print_trunc(ndo); return; @@ -453,19 +462,19 @@ nbp_print(netdissect_options *ndo, */ if ((control & 0xf) != 1) ND_PRINT(" [ntup=%u]", control & 0xf); - if (EXTRACT_U_1(tp->enumerator)) - ND_PRINT(" [enum=%u]", EXTRACT_U_1(tp->enumerator)); - if (EXTRACT_BE_U_2(tp->net) != snet || - EXTRACT_U_1(tp->node) != snode || - EXTRACT_U_1(tp->skt) != skt) + if (GET_U_1(tp->enumerator)) + ND_PRINT(" [enum=%u]", GET_U_1(tp->enumerator)); + if (GET_BE_U_2(tp->net) != snet || + GET_U_1(tp->node) != snode || + GET_U_1(tp->skt) != skt) ND_PRINT(" [addr=%s.%u]", - ataddr_string(ndo, EXTRACT_BE_U_2(tp->net), - EXTRACT_U_1(tp->node)), - EXTRACT_U_1(tp->skt)); + ataddr_string(ndo, GET_BE_U_2(tp->net), + GET_U_1(tp->node)), + GET_U_1(tp->skt)); break; case nbpLkUpReply: - ND_PRINT(" nbp-reply %u:", EXTRACT_U_1(np->id)); + ND_PRINT(" nbp-reply %u:", GET_U_1(np->id)); /* print each of the tuples in the reply */ for (i = control & 0xf; i != 0 && tp; i--) @@ -473,7 +482,8 @@ nbp_print(netdissect_options *ndo, break; default: - ND_PRINT(" nbp-0x%x %u (%u)", control, EXTRACT_U_1(np->id), length); + ND_PRINT(" nbp-0x%x %u (%u)", control, GET_U_1(np->id), + length); break; } } @@ -489,7 +499,7 @@ print_cstring(netdissect_options *ndo, nd_print_trunc(ndo); return (0); } - length = EXTRACT_U_1(cp); + length = GET_U_1(cp); cp++; /* Spec says string can be at most 32 bytes long */ @@ -502,7 +512,7 @@ print_cstring(netdissect_options *ndo, nd_print_trunc(ndo); return (0); } - fn_print_char(ndo, EXTRACT_U_1(cp)); + fn_print_char(ndo, GET_U_1(cp)); cp++; length--; } @@ -523,18 +533,18 @@ nbp_tuple_print(netdissect_options *ndo, tpn = nbp_name_print(ndo, tp, ep); /* if the enumerator isn't 1, print it */ - if (EXTRACT_U_1(tp->enumerator) != 1) - ND_PRINT("(%u)", EXTRACT_U_1(tp->enumerator)); + if (GET_U_1(tp->enumerator) != 1) + ND_PRINT("(%u)", GET_U_1(tp->enumerator)); /* if the socket doesn't match the src socket, print it */ - if (EXTRACT_U_1(tp->skt) != skt) - ND_PRINT(" %u", EXTRACT_U_1(tp->skt)); + if (GET_U_1(tp->skt) != skt) + ND_PRINT(" %u", GET_U_1(tp->skt)); /* if the address doesn't match the src address, it's an anomaly */ - if (EXTRACT_BE_U_2(tp->net) != snet || - EXTRACT_U_1(tp->node) != snode) + if (GET_BE_U_2(tp->net) != snet || + GET_U_1(tp->node) != snode) ND_PRINT(" [addr=%s]", - ataddr_string(ndo, EXTRACT_BE_U_2(tp->net), EXTRACT_U_1(tp->node))); + ataddr_string(ndo, GET_BE_U_2(tp->net), GET_U_1(tp->node))); return (tpn); } diff --git a/print-atm.c b/print-atm.c index 3bc135d7..e6b7caa3 100644 --- a/print-atm.c +++ b/print-atm.c @@ -259,7 +259,7 @@ atm_if_print(netdissect_options *ndo, } /* Cisco Style NLPID ? */ - if (EXTRACT_U_1(p) == LLC_UI) { + if (GET_U_1(p) == LLC_UI) { if (ndo->ndo_eflag) ND_PRINT("CNLPID "); isoclns_print(ndo, p + 1, length - 1); @@ -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_U_3(p); + llchdr = GET_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("%08x%08x %08x%08x ", - EXTRACT_BE_U_4(p), - EXTRACT_BE_U_4(p + 4), - EXTRACT_BE_U_4(p + 8), - EXTRACT_BE_U_4(p + 12)); + GET_BE_U_4(p), + GET_BE_U_4(p + 4), + GET_BE_U_4(p + 8), + GET_BE_U_4(p + 12)); p += 20; length -= 20; caplen -= 20; @@ -350,7 +350,7 @@ sig_print(netdissect_options *ndo, uint32_t call_ref; ND_TCHECK_1(p + PROTO_POS); - if (EXTRACT_U_1(p + PROTO_POS) == Q2931) { + if (GET_U_1(p + PROTO_POS) == Q2931) { /* * protocol:Q.2931 for User to Network Interface * (UNI 3.1) signalling @@ -358,7 +358,7 @@ sig_print(netdissect_options *ndo, ND_PRINT("Q.2931"); ND_TCHECK_1(p + MSG_TYPE_POS); ND_PRINT(":%s ", - tok2str(msgtype2str, "msgtype#%u", EXTRACT_U_1(p + MSG_TYPE_POS))); + tok2str(msgtype2str, "msgtype#%u", GET_U_1(p + MSG_TYPE_POS))); /* * The call reference comes before the message type, @@ -366,11 +366,11 @@ sig_print(netdissect_options *ndo, * do from the caplen test above, we also know we have * the call reference. */ - call_ref = EXTRACT_BE_U_3(p + CALL_REF_POS); + call_ref = GET_BE_U_3(p + CALL_REF_POS); ND_PRINT("CALL_REF:0x%06x", call_ref); } else { /* SSCOP with some unknown protocol atop it */ - ND_PRINT("SSCOP, proto %u ", EXTRACT_U_1(p + PROTO_POS)); + ND_PRINT("SSCOP, proto %u ", GET_U_1(p + PROTO_POS)); } return; @@ -462,9 +462,9 @@ oam_print(netdissect_options *ndo, ndo->ndo_protocol = "oam"; ND_TCHECK_1(p + ATM_HDR_LEN_NOHEC + hec); - 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; + cell_header = GET_BE_U_4(p + hec); + cell_type = (GET_U_1((p + ATM_HDR_LEN_NOHEC + hec)) >> 4) & 0x0f; + func_type = GET_U_1((p + ATM_HDR_LEN_NOHEC + hec)) & 0x0f; vpi = (cell_header>>20)&0xff; vci = (cell_header>>4)&0xffff; @@ -501,18 +501,20 @@ oam_print(netdissect_options *ndo, ND_PRINT("\n\tLoopback-Indicator %s, Correlation-Tag 0x%08x", tok2str(oam_fm_loopback_indicator_values, "Unknown", - EXTRACT_U_1(oam_ptr.oam_fm_loopback->loopback_indicator) & OAM_FM_LOOPBACK_INDICATOR_MASK), - EXTRACT_BE_U_4(oam_ptr.oam_fm_loopback->correlation_tag)); + GET_U_1(oam_ptr.oam_fm_loopback->loopback_indicator) & OAM_FM_LOOPBACK_INDICATOR_MASK), + GET_BE_U_4(oam_ptr.oam_fm_loopback->correlation_tag)); ND_PRINT("\n\tLocation-ID "); for (idx = 0; idx < sizeof(oam_ptr.oam_fm_loopback->loopback_id); idx++) { if (idx % 2) { - ND_PRINT("%04x ", EXTRACT_BE_U_2(&oam_ptr.oam_fm_loopback->loopback_id[idx])); + ND_PRINT("%04x ", + GET_BE_U_2(&oam_ptr.oam_fm_loopback->loopback_id[idx])); } } ND_PRINT("\n\tSource-ID "); for (idx = 0; idx < sizeof(oam_ptr.oam_fm_loopback->source_id); idx++) { if (idx % 2) { - ND_PRINT("%04x ", EXTRACT_BE_U_2(&oam_ptr.oam_fm_loopback->source_id[idx])); + ND_PRINT("%04x ", + GET_BE_U_2(&oam_ptr.oam_fm_loopback->source_id[idx])); } } break; @@ -521,11 +523,13 @@ oam_print(netdissect_options *ndo, case (OAM_CELLTYPE_FM << 4 | OAM_FM_FUNCTYPE_RDI): oam_ptr.oam_fm_ais_rdi = (const struct oam_fm_ais_rdi_t *)(p + OAM_CELLTYPE_FUNCTYPE_LEN); ND_TCHECK_SIZE(oam_ptr.oam_fm_ais_rdi); - ND_PRINT("\n\tFailure-type 0x%02x", EXTRACT_U_1(oam_ptr.oam_fm_ais_rdi->failure_type)); + ND_PRINT("\n\tFailure-type 0x%02x", + GET_U_1(oam_ptr.oam_fm_ais_rdi->failure_type)); ND_PRINT("\n\tLocation-ID "); for (idx = 0; idx < sizeof(oam_ptr.oam_fm_ais_rdi->failure_location); idx++) { if (idx % 2) { - ND_PRINT("%04x ", EXTRACT_BE_U_2(&oam_ptr.oam_fm_ais_rdi->failure_location[idx])); + ND_PRINT("%04x ", + GET_BE_U_2(&oam_ptr.oam_fm_ais_rdi->failure_location[idx])); } } break; @@ -540,7 +544,7 @@ oam_print(netdissect_options *ndo, /* crc10 checksum verification */ ND_TCHECK_2(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN); - cksum = EXTRACT_BE_U_2(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN) + cksum = GET_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 e2ed5663..29865dd2 100644 --- a/print-babel.c +++ b/print-babel.c @@ -53,14 +53,14 @@ babel_print(netdissect_options *ndo, ND_TCHECK_4(cp); - if(EXTRACT_U_1(cp) != 42) { + if(GET_U_1(cp) != 42) { ND_PRINT(" invalid header"); return; } else { - ND_PRINT(" %u", EXTRACT_U_1(cp + 1)); + ND_PRINT(" %u", GET_U_1(cp + 1)); } - switch(EXTRACT_U_1(cp + 1)) { + switch(GET_U_1(cp + 1)) { case 2: babel_print_v2(ndo, cp, length); break; @@ -112,9 +112,9 @@ format_id(netdissect_options *ndo, const u_char *id) { static char buf[25]; nd_snprintf(buf, 25, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", - EXTRACT_U_1(id), EXTRACT_U_1(id + 1), EXTRACT_U_1(id + 2), - EXTRACT_U_1(id + 3), EXTRACT_U_1(id + 4), EXTRACT_U_1(id + 5), - EXTRACT_U_1(id + 6), EXTRACT_U_1(id + 7)); + GET_U_1(id), GET_U_1(id + 1), GET_U_1(id + 2), + GET_U_1(id + 3), GET_U_1(id + 4), GET_U_1(id + 5), + GET_U_1(id + 6), GET_U_1(id + 7)); buf[24] = '\0'; return buf; } @@ -276,7 +276,7 @@ subtlvs_print(netdissect_options *ndo, uint32_t t1, t2; while (cp < ep) { - subtype = EXTRACT_U_1(cp); + subtype = GET_U_1(cp); cp++; if(subtype == MESSAGE_SUB_PAD1) { ND_PRINT(" sub-pad1"); @@ -284,7 +284,7 @@ subtlvs_print(netdissect_options *ndo, } if(cp == ep) goto invalid; - sublen = EXTRACT_U_1(cp); + sublen = GET_U_1(cp); cp++; if(cp + sublen > ep) goto invalid; @@ -302,7 +302,8 @@ subtlvs_print(netdissect_options *ndo, } sep = " "; while (sublen) { - ND_PRINT("%s%s", sep, tok2str(diversity_str, "%u", EXTRACT_U_1(cp))); + ND_PRINT("%s%s", sep, + tok2str(diversity_str, "%u", GET_U_1(cp))); cp++; sep = "-"; sublen--; @@ -316,14 +317,14 @@ subtlvs_print(netdissect_options *ndo, if(tlv_type == MESSAGE_HELLO) { if(sublen < 4) goto invalid; - t1 = EXTRACT_BE_U_4(cp); + t1 = GET_BE_U_4(cp); ND_PRINT(" %s", format_timestamp(t1)); } else if(tlv_type == MESSAGE_IHU) { if(sublen < 8) goto invalid; - t1 = EXTRACT_BE_U_4(cp); + t1 = GET_BE_U_4(cp); ND_PRINT(" %s", format_timestamp(t1)); - t2 = EXTRACT_BE_U_4(cp + 4); + t2 = GET_BE_U_4(cp + 4); ND_PRINT("|%s", format_timestamp(t2)); } else ND_PRINT(" (bogus)"); @@ -356,7 +357,7 @@ babel_print_v2(netdissect_options *ndo, ND_TCHECK_4(cp); if (length < 4) goto invalid; - bodylen = EXTRACT_BE_U_2(cp + 2); + bodylen = GET_BE_U_2(cp + 2); ND_PRINT(" (%u)", bodylen); /* Process the TLVs in the body */ @@ -368,7 +369,7 @@ babel_print_v2(netdissect_options *ndo, message = cp + 4 + i; ND_TCHECK_1(message); - if((type = EXTRACT_U_1(message)) == MESSAGE_PAD1) { + if((type = GET_U_1(message)) == MESSAGE_PAD1) { ND_PRINT(ndo->ndo_vflag ? "\n\tPad 1" : " pad1"); i += 1; continue; @@ -376,7 +377,7 @@ babel_print_v2(netdissect_options *ndo, ND_TCHECK_2(message); ICHECK(i, 2); - len = EXTRACT_U_1(message + 1); + len = GET_U_1(message + 1); ND_TCHECK_LEN(message, 2 + len); ICHECK(i, 2 + len); @@ -397,8 +398,8 @@ babel_print_v2(netdissect_options *ndo, else { ND_PRINT("\n\tAcknowledgment Request "); if(len < 6) goto invalid; - nonce = EXTRACT_BE_U_2(message + 4); - interval = EXTRACT_BE_U_2(message + 6); + nonce = GET_BE_U_2(message + 4); + interval = GET_BE_U_2(message + 6); ND_PRINT("%04x %s", nonce, format_interval(interval)); } } @@ -411,7 +412,7 @@ babel_print_v2(netdissect_options *ndo, else { ND_PRINT("\n\tAcknowledgment "); if(len < 2) goto invalid; - nonce = EXTRACT_BE_U_2(message + 2); + nonce = GET_BE_U_2(message + 2); ND_PRINT("%04x", nonce); } } @@ -424,8 +425,8 @@ babel_print_v2(netdissect_options *ndo, else { ND_PRINT("\n\tHello "); if(len < 6) goto invalid; - seqno = EXTRACT_BE_U_2(message + 4); - interval = EXTRACT_BE_U_2(message + 6); + seqno = GET_BE_U_2(message + 4); + interval = GET_BE_U_2(message + 6); ND_PRINT("seqno %u interval %s", seqno, format_interval(interval)); /* Extra data. */ if(len > 6) @@ -444,9 +445,9 @@ babel_print_v2(netdissect_options *ndo, int rc; ND_PRINT("\n\tIHU "); if(len < 6) goto invalid; - rxcost = EXTRACT_BE_U_2(message + 4); - interval = EXTRACT_BE_U_2(message + 6); - ae = EXTRACT_U_1(message + 2); + rxcost = GET_BE_U_2(message + 4); + interval = GET_BE_U_2(message + 6); + ae = GET_U_1(message + 2); rc = network_address(ae, message + 8, len - 6, address); if(rc < 0) { nd_print_trunc(ndo); break; } @@ -481,7 +482,7 @@ babel_print_v2(netdissect_options *ndo, u_char nh[16]; ND_PRINT("\n\tNext Hop"); if(len < 2) goto invalid; - ae = EXTRACT_U_1(message + 2); + ae = GET_U_1(message + 2); rc = network_address(ae, message + 4, len - 2, nh); if(rc < 0) goto invalid; @@ -497,9 +498,9 @@ babel_print_v2(netdissect_options *ndo, ND_PRINT("/truncated"); else ND_PRINT("%s%s%s", - (EXTRACT_U_1(message + 3) & 0x80) ? "/prefix": "", - (EXTRACT_U_1(message + 3) & 0x40) ? "/id" : "", - (EXTRACT_U_1(message + 3) & 0x3f) ? "/unknown" : ""); + (GET_U_1(message + 3) & 0x80) ? "/prefix": "", + (GET_U_1(message + 3) & 0x40) ? "/id" : "", + (GET_U_1(message + 3) & 0x3f) ? "/unknown" : ""); } else { u_short interval, seqno, metric; u_char ae, plen; @@ -507,26 +508,26 @@ babel_print_v2(netdissect_options *ndo, u_char prefix[16]; ND_PRINT("\n\tUpdate"); if(len < 10) goto invalid; - ae = EXTRACT_U_1(message + 2); - plen = EXTRACT_U_1(message + 4) + (EXTRACT_U_1(message + 2) == 1 ? 96 : 0); + ae = GET_U_1(message + 2); + plen = GET_U_1(message + 4) + (GET_U_1(message + 2) == 1 ? 96 : 0); rc = network_prefix(ae, - EXTRACT_U_1(message + 4), - EXTRACT_U_1(message + 5), + GET_U_1(message + 4), + GET_U_1(message + 5), message + 12, - EXTRACT_U_1(message + 2) == 1 ? v4_prefix : v6_prefix, + GET_U_1(message + 2) == 1 ? v4_prefix : v6_prefix, len - 10, prefix); if(rc < 0) goto invalid; - interval = EXTRACT_BE_U_2(message + 6); - seqno = EXTRACT_BE_U_2(message + 8); - metric = EXTRACT_BE_U_2(message + 10); + interval = GET_BE_U_2(message + 6); + seqno = GET_BE_U_2(message + 8); + metric = GET_BE_U_2(message + 10); ND_PRINT("%s%s%s %s metric %u seqno %u interval %s", - (EXTRACT_U_1(message + 3) & 0x80) ? "/prefix": "", - (EXTRACT_U_1(message + 3) & 0x40) ? "/id" : "", - (EXTRACT_U_1(message + 3) & 0x3f) ? "/unknown" : "", + (GET_U_1(message + 3) & 0x80) ? "/prefix": "", + (GET_U_1(message + 3) & 0x40) ? "/id" : "", + (GET_U_1(message + 3) & 0x3f) ? "/unknown" : "", ae == 0 ? "any" : format_prefix(ndo, prefix, plen), metric, seqno, format_interval_update(interval)); - if(EXTRACT_U_1(message + 3) & 0x80) { - if(EXTRACT_U_1(message + 2) == 1) + if(GET_U_1(message + 3) & 0x80) { + if(GET_U_1(message + 2) == 1) memcpy(v4_prefix, prefix, 16); else memcpy(v6_prefix, prefix, 16); @@ -546,10 +547,10 @@ babel_print_v2(netdissect_options *ndo, u_char prefix[16], ae, plen; ND_PRINT("\n\tRoute Request "); if(len < 2) goto invalid; - ae = EXTRACT_U_1(message + 2); - plen = EXTRACT_U_1(message + 3) + (EXTRACT_U_1(message + 2) == 1 ? 96 : 0); + ae = GET_U_1(message + 2); + plen = GET_U_1(message + 3) + (GET_U_1(message + 2) == 1 ? 96 : 0); rc = network_prefix(ae, - EXTRACT_U_1(message + 3), 0, + GET_U_1(message + 3), 0, message + 4, NULL, len - 2, prefix); if(rc < 0) goto invalid; ND_PRINT("for %s", @@ -567,15 +568,15 @@ babel_print_v2(netdissect_options *ndo, u_char prefix[16], ae, plen; ND_PRINT("\n\tSeqno Request "); if(len < 14) goto invalid; - ae = EXTRACT_U_1(message + 2); - seqno = EXTRACT_BE_U_2(message + 4); + ae = GET_U_1(message + 2); + seqno = GET_BE_U_2(message + 4); rc = network_prefix(ae, - EXTRACT_U_1(message + 3), 0, + GET_U_1(message + 3), 0, message + 16, NULL, len - 14, prefix); if(rc < 0) goto invalid; - plen = EXTRACT_U_1(message + 3) + (EXTRACT_U_1(message + 2) == 1 ? 96 : 0); + plen = GET_U_1(message + 3) + (GET_U_1(message + 2) == 1 ? 96 : 0); ND_PRINT("(%u hops) for %s seqno %u id %s", - EXTRACT_U_1(message + 6), + GET_U_1(message + 6), ae == 0 ? "invalid AE 0" : format_prefix(ndo, prefix, plen), seqno, format_id(ndo, message + 8)); } @@ -587,8 +588,9 @@ babel_print_v2(netdissect_options *ndo, else { ND_PRINT("\n\tTS/PC "); if(len < 6) goto invalid; - ND_PRINT("timestamp %u packetcounter %u", EXTRACT_BE_U_4(message + 4), - EXTRACT_BE_U_2(message + 2)); + ND_PRINT("timestamp %u packetcounter %u", + GET_BE_U_4(message + 4), + GET_BE_U_2(message + 2)); } break; case MESSAGE_HMAC : { @@ -598,9 +600,10 @@ babel_print_v2(netdissect_options *ndo, unsigned j; ND_PRINT("\n\tHMAC "); if(len < 18) goto invalid; - ND_PRINT("key-id %u digest-%u ", EXTRACT_BE_U_2(message + 2), len - 2); + ND_PRINT("key-id %u digest-%u ", GET_BE_U_2(message + 2), + len - 2); for (j = 0; j < len - 2; j++) - ND_PRINT("%02X", EXTRACT_U_1(message + j + 4)); + ND_PRINT("%02X", GET_U_1(message + j + 4)); } } break; @@ -616,13 +619,13 @@ babel_print_v2(netdissect_options *ndo, int parsed_len = 10; ND_PRINT("\n\tSS-Update"); if(len < 10) goto invalid; - ae = EXTRACT_U_1(message + 2); - src_plen = EXTRACT_U_1(message + 3); - plen = EXTRACT_U_1(message + 4); - omitted = EXTRACT_U_1(message + 5); - interval = EXTRACT_BE_U_2(message + 6); - seqno = EXTRACT_BE_U_2(message + 8); - metric = EXTRACT_BE_U_2(message + 10); + ae = GET_U_1(message + 2); + src_plen = GET_U_1(message + 3); + plen = GET_U_1(message + 4); + omitted = GET_U_1(message + 5); + interval = GET_BE_U_2(message + 6); + seqno = GET_BE_U_2(message + 8); + metric = GET_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); @@ -657,9 +660,9 @@ babel_print_v2(netdissect_options *ndo, u_char ae, plen, src_plen, prefix[16], src_prefix[16]; ND_PRINT("\n\tSS-Request "); if(len < 3) goto invalid; - ae = EXTRACT_U_1(message + 2); - plen = EXTRACT_U_1(message + 3); - src_plen = EXTRACT_U_1(message + 4); + ae = GET_U_1(message + 2); + plen = GET_U_1(message + 3); + src_plen = GET_U_1(message + 4); rc = network_prefix(ae, plen, 0, message + 2 + parsed_len, NULL, len - parsed_len, prefix); if(rc < 0) goto invalid; @@ -692,11 +695,11 @@ babel_print_v2(netdissect_options *ndo, const u_char *router_id = NULL; ND_PRINT("\n\tSS-MH-Request "); if(len < 14) goto invalid; - ae = EXTRACT_U_1(message + 2); - plen = EXTRACT_U_1(message + 3); - seqno = EXTRACT_BE_U_2(message + 4); - hopc = EXTRACT_U_1(message + 6); - src_plen = EXTRACT_U_1(message + 7); + ae = GET_U_1(message + 2); + plen = GET_U_1(message + 3); + seqno = GET_BE_U_2(message + 4); + hopc = GET_U_1(message + 6); + src_plen = GET_U_1(message + 7); router_id = message + 8; rc = network_prefix(ae, plen, 0, message + 2 + parsed_len, NULL, len - parsed_len, prefix); diff --git a/print-bfd.c b/print-bfd.c index d3376be0..941586d7 100644 --- a/print-bfd.c +++ b/print-bfd.c @@ -184,13 +184,13 @@ auth_print(netdissect_options *ndo, const u_char *pptr) pptr += sizeof (struct bfd_header_t); bfd_auth_header = (const struct bfd_auth_header_t *)pptr; ND_TCHECK_SIZE(bfd_auth_header); - auth_type = EXTRACT_U_1(bfd_auth_header->auth_type); - auth_len = EXTRACT_U_1(bfd_auth_header->auth_len); + auth_type = GET_U_1(bfd_auth_header->auth_type); + auth_len = GET_U_1(bfd_auth_header->auth_len); ND_PRINT("\n\tAuthentication: %s (%u), length: %u", tok2str(bfd_v1_authentication_values,"Unknown",auth_type), auth_type, auth_len); pptr += 2; - ND_PRINT("\n\t Auth Key ID: %u", EXTRACT_U_1(pptr)); + ND_PRINT("\n\t Auth Key ID: %u", GET_U_1(pptr)); switch(auth_type) { case AUTH_PASSWORD: @@ -242,12 +242,12 @@ auth_print(netdissect_options *ndo, const u_char *pptr) } pptr += 2; ND_TCHECK_4(pptr); - ND_PRINT(", Sequence Number: 0x%08x", EXTRACT_BE_U_4(pptr)); + ND_PRINT(", Sequence Number: 0x%08x", GET_BE_U_4(pptr)); pptr += 4; ND_TCHECK_LEN(pptr, AUTH_MD5_HASH_LEN); ND_PRINT("\n\t Digest: "); for(i = 0; i < AUTH_MD5_HASH_LEN; i++) - ND_PRINT("%02x", EXTRACT_U_1(pptr + i)); + ND_PRINT("%02x", GET_U_1(pptr + i)); break; case AUTH_SHA1: case AUTH_MET_SHA1: @@ -273,12 +273,12 @@ auth_print(netdissect_options *ndo, const u_char *pptr) } pptr += 2; ND_TCHECK_4(pptr); - ND_PRINT(", Sequence Number: 0x%08x", EXTRACT_BE_U_4(pptr)); + ND_PRINT(", Sequence Number: 0x%08x", GET_BE_U_4(pptr)); pptr += 4; ND_TCHECK_LEN(pptr, AUTH_SHA1_HASH_LEN); ND_PRINT("\n\t Hash: "); for(i = 0; i < AUTH_SHA1_HASH_LEN; i++) - ND_PRINT("%02x", EXTRACT_U_1(pptr + i)); + ND_PRINT("%02x", GET_U_1(pptr + i)); break; } return 0; @@ -303,9 +303,9 @@ bfd_print(netdissect_options *ndo, const u_char *pptr, bfd_header = (const struct bfd_header_t *)pptr; ND_TCHECK_SIZE(bfd_header); - version_diag = EXTRACT_U_1(bfd_header->version_diag); + version_diag = GET_U_1(bfd_header->version_diag); version = BFD_EXTRACT_VERSION(version_diag); - flags = EXTRACT_U_1(bfd_header->flags); + flags = GET_U_1(bfd_header->flags); switch (version) { @@ -326,16 +326,21 @@ bfd_print(netdissect_options *ndo, const u_char *pptr, BFD_EXTRACT_DIAG(version_diag)); ND_PRINT("\n\tDetection Timer Multiplier: %u (%u ms Detection time), BFD Length: %u", - EXTRACT_U_1(bfd_header->detect_time_multiplier), - EXTRACT_U_1(bfd_header->detect_time_multiplier) * EXTRACT_BE_U_4(bfd_header->desired_min_tx_interval)/1000, - EXTRACT_U_1(bfd_header->length)); - - - ND_PRINT("\n\tMy Discriminator: 0x%08x", EXTRACT_BE_U_4(bfd_header->my_discriminator)); - ND_PRINT(", Your Discriminator: 0x%08x", EXTRACT_BE_U_4(bfd_header->your_discriminator)); - ND_PRINT("\n\t Desired min Tx Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->desired_min_tx_interval)/1000); - ND_PRINT("\n\t Required min Rx Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->required_min_rx_interval)/1000); - ND_PRINT("\n\t Required min Echo Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->required_min_echo_interval)/1000); + GET_U_1(bfd_header->detect_time_multiplier), + GET_U_1(bfd_header->detect_time_multiplier) * GET_BE_U_4(bfd_header->desired_min_tx_interval)/1000, + GET_U_1(bfd_header->length)); + + + ND_PRINT("\n\tMy Discriminator: 0x%08x", + GET_BE_U_4(bfd_header->my_discriminator)); + ND_PRINT(", Your Discriminator: 0x%08x", + GET_BE_U_4(bfd_header->your_discriminator)); + ND_PRINT("\n\t Desired min Tx Interval: %4u ms", + GET_BE_U_4(bfd_header->desired_min_tx_interval)/1000); + ND_PRINT("\n\t Required min Rx Interval: %4u ms", + GET_BE_U_4(bfd_header->required_min_rx_interval)/1000); + ND_PRINT("\n\t Required min Echo Interval: %4u ms", + GET_BE_U_4(bfd_header->required_min_echo_interval)/1000); if (flags & BFD_FLAG_AUTH) { if (auth_print(ndo, pptr)) @@ -362,16 +367,21 @@ bfd_print(netdissect_options *ndo, const u_char *pptr, BFD_EXTRACT_DIAG(version_diag)); ND_PRINT("\n\tDetection Timer Multiplier: %u (%u ms Detection time), BFD Length: %u", - EXTRACT_U_1(bfd_header->detect_time_multiplier), - EXTRACT_U_1(bfd_header->detect_time_multiplier) * EXTRACT_BE_U_4(bfd_header->desired_min_tx_interval)/1000, - EXTRACT_U_1(bfd_header->length)); - - - ND_PRINT("\n\tMy Discriminator: 0x%08x", EXTRACT_BE_U_4(bfd_header->my_discriminator)); - ND_PRINT(", Your Discriminator: 0x%08x", EXTRACT_BE_U_4(bfd_header->your_discriminator)); - ND_PRINT("\n\t Desired min Tx Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->desired_min_tx_interval)/1000); - ND_PRINT("\n\t Required min Rx Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->required_min_rx_interval)/1000); - ND_PRINT("\n\t Required min Echo Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->required_min_echo_interval)/1000); + GET_U_1(bfd_header->detect_time_multiplier), + GET_U_1(bfd_header->detect_time_multiplier) * GET_BE_U_4(bfd_header->desired_min_tx_interval)/1000, + GET_U_1(bfd_header->length)); + + + ND_PRINT("\n\tMy Discriminator: 0x%08x", + GET_BE_U_4(bfd_header->my_discriminator)); + ND_PRINT(", Your Discriminator: 0x%08x", + GET_BE_U_4(bfd_header->your_discriminator)); + ND_PRINT("\n\t Desired min Tx Interval: %4u ms", + GET_BE_U_4(bfd_header->desired_min_tx_interval)/1000); + ND_PRINT("\n\t Required min Rx Interval: %4u ms", + GET_BE_U_4(bfd_header->required_min_rx_interval)/1000); + ND_PRINT("\n\t Required min Echo Interval: %4u ms", + GET_BE_U_4(bfd_header->required_min_echo_interval)/1000); if (flags & BFD_FLAG_AUTH) { if (auth_print(ndo, pptr)) diff --git a/print-bgp.c b/print-bgp.c index 6f523585..7b398581 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -114,7 +114,7 @@ struct bgp_route_refresh { #define bgp_attr_lenlen(flags, p) \ (((flags) & 0x10) ? 2U : 1U) #define bgp_attr_len(flags, p) \ - (((flags) & 0x10) ? EXTRACT_BE_U_2(p) : EXTRACT_U_1(p)) + (((flags) & 0x10) ? GET_BE_U_2(p) : GET_U_1(p)) #define BGPTYPE_ORIGIN 1 #define BGPTYPE_AS_PATH 2 @@ -542,7 +542,7 @@ decode_prefix4(netdissect_options *ndo, ND_TCHECK_1(pptr); ITEMCHECK(1); - plen = EXTRACT_U_1(pptr); + plen = GET_U_1(pptr); if (32 < plen) return -1; itemlen -= 1; @@ -575,7 +575,7 @@ decode_labeled_prefix4(netdissect_options *ndo, /* prefix length and label = 4 bytes */ ND_TCHECK_4(pptr); ITEMCHECK(4); - plen = EXTRACT_U_1(pptr); /* get prefix length */ + plen = GET_U_1(pptr); /* get prefix length */ /* this is one of the weirdnesses of rfc3107 the label length (actually the label + COS bits) @@ -606,8 +606,8 @@ decode_labeled_prefix4(netdissect_options *ndo, nd_snprintf(buf, buflen, "%s/%u, label:%u %s", ipaddr_string(ndo, (const u_char *)&addr), plen, - EXTRACT_BE_U_3(pptr + 1)>>4, - ((EXTRACT_U_1(pptr + 3) & 1) == 0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); + GET_BE_U_3(pptr + 1)>>4, + ((GET_U_1(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_U_1(pptr); + addr_length = GET_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_U_1(pptr); + addr_length = GET_U_1(pptr); pptr++; /* Group address */ @@ -723,32 +723,32 @@ bgp_vpn_rd_print(netdissect_options *ndo, char *pos = rd; /* ok lets load the RD format */ - switch (EXTRACT_BE_U_2(pptr)) { + switch (GET_BE_U_2(pptr)) { case 0: /* 2-byte-AS:number fmt */ nd_snprintf(pos, sizeof(rd) - (pos - rd), "%u:%u (= %u.%u.%u.%u)", - EXTRACT_BE_U_2(pptr + 2), - EXTRACT_BE_U_4(pptr + 4), - EXTRACT_U_1(pptr + 4), EXTRACT_U_1(pptr + 5), - EXTRACT_U_1(pptr + 6), EXTRACT_U_1(pptr + 7)); + GET_BE_U_2(pptr + 2), + GET_BE_U_4(pptr + 4), + GET_U_1(pptr + 4), GET_U_1(pptr + 5), + GET_U_1(pptr + 6), GET_U_1(pptr + 7)); break; case 1: /* IP-address:AS fmt */ nd_snprintf(pos, sizeof(rd) - (pos - rd), "%u.%u.%u.%u:%u", - EXTRACT_U_1(pptr + 2), EXTRACT_U_1(pptr + 3), - EXTRACT_U_1(pptr + 4), EXTRACT_U_1(pptr + 5), - EXTRACT_BE_U_2(pptr + 6)); + GET_U_1(pptr + 2), GET_U_1(pptr + 3), + GET_U_1(pptr + 4), GET_U_1(pptr + 5), + GET_BE_U_2(pptr + 6)); break; case 2: /* 4-byte-AS:number fmt */ nd_snprintf(pos, sizeof(rd) - (pos - rd), "%s:%u (%u.%u.%u.%u:%u)", - as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_U_4(pptr + 2)), - EXTRACT_BE_U_2(pptr + 6), EXTRACT_U_1(pptr + 2), - EXTRACT_U_1(pptr + 3), EXTRACT_U_1(pptr + 4), - EXTRACT_U_1(pptr + 5), EXTRACT_BE_U_2(pptr + 6)); + as_printf(ndo, astostr, sizeof(astostr), GET_BE_U_4(pptr + 2)), + GET_BE_U_2(pptr + 6), GET_U_1(pptr + 2), + GET_U_1(pptr + 3), GET_U_1(pptr + 4), + GET_U_1(pptr + 5), GET_BE_U_2(pptr + 6)); break; default: nd_snprintf(pos, sizeof(rd) - (pos - rd), "unknown RD format"); @@ -771,14 +771,14 @@ bgp_extended_community_print(netdissect_options *ndo, uint32_t i; } bw; - switch (EXTRACT_BE_U_2(pptr)) { + switch (GET_BE_U_2(pptr)) { case BGP_EXT_COM_RT_0: case BGP_EXT_COM_RO_0: case BGP_EXT_COM_L2VPN_RT_0: ND_PRINT("%u:%u (= %s)", - EXTRACT_BE_U_2(pptr + 2), - EXTRACT_BE_U_4(pptr + 4), + GET_BE_U_2(pptr + 2), + GET_BE_U_4(pptr + 4), ipaddr_string(ndo, pptr+4)); break; @@ -788,18 +788,18 @@ bgp_extended_community_print(netdissect_options *ndo, case BGP_EXT_COM_VRF_RT_IMP: ND_PRINT("%s:%u", ipaddr_string(ndo, pptr+2), - EXTRACT_BE_U_2(pptr + 6)); + GET_BE_U_2(pptr + 6)); break; case BGP_EXT_COM_RT_2: case BGP_EXT_COM_RO_2: ND_PRINT("%s:%u", as_printf(ndo, astostr, sizeof(astostr), - EXTRACT_BE_U_4(pptr + 2)), EXTRACT_BE_U_2(pptr + 6)); + GET_BE_U_4(pptr + 2)), GET_BE_U_2(pptr + 6)); break; case BGP_EXT_COM_LINKBAND: - bw.i = EXTRACT_BE_U_4(pptr + 2); + bw.i = GET_BE_U_4(pptr + 2); ND_PRINT("bandwidth: %.3f Mbps", bw.f*8/1000000); break; @@ -819,32 +819,32 @@ bgp_extended_community_print(netdissect_options *ndo, ipaddr_string(ndo, pptr+2), tok2str(bgp_extd_comm_ospf_rtype_values, "unknown (0x%02x)", - EXTRACT_U_1((pptr + 6))), - (EXTRACT_U_1(pptr + 7) & BGP_OSPF_RTYPE_METRIC_TYPE) ? "E2" : "", - ((EXTRACT_U_1(pptr + 6) == BGP_OSPF_RTYPE_EXT) || (EXTRACT_U_1(pptr + 6) == BGP_OSPF_RTYPE_NSSA)) ? "E1" : ""); + GET_U_1((pptr + 6))), + (GET_U_1(pptr + 7) & BGP_OSPF_RTYPE_METRIC_TYPE) ? "E2" : "", + ((GET_U_1(pptr + 6) == BGP_OSPF_RTYPE_EXT) || (GET_U_1(pptr + 6) == BGP_OSPF_RTYPE_NSSA)) ? "E1" : ""); break; case BGP_EXT_COM_L2INFO: ND_PRINT("%s Control Flags [0x%02x]:MTU %u", tok2str(l2vpn_encaps_values, "unknown encaps", - EXTRACT_U_1((pptr + 2))), - EXTRACT_U_1((pptr + 3)), - EXTRACT_BE_U_2(pptr + 4)); + GET_U_1((pptr + 2))), + GET_U_1((pptr + 3)), + GET_BE_U_2(pptr + 4)); break; case BGP_EXT_COM_SOURCE_AS: - ND_PRINT("AS %u", EXTRACT_BE_U_2(pptr + 2)); + ND_PRINT("AS %u", GET_BE_U_2(pptr + 2)); break; default: ND_PRINT("%02x%02x%02x%02x%02x%02x", - EXTRACT_U_1(pptr + 2), - EXTRACT_U_1(pptr + 3), - EXTRACT_U_1(pptr + 4), - EXTRACT_U_1(pptr + 5), - EXTRACT_U_1(pptr + 6), - EXTRACT_U_1(pptr + 7)); + GET_U_1(pptr + 2), + GET_U_1(pptr + 3), + GET_U_1(pptr + 4), + GET_U_1(pptr + 5), + GET_U_1(pptr + 6), + GET_U_1(pptr + 7)); break; } } @@ -859,7 +859,7 @@ decode_rt_routing_info(netdissect_options *ndo, /* NLRI "prefix length" from RFC 2858 Section 4. */ ND_TCHECK_1(pptr); - plen = EXTRACT_U_1(pptr); /* get prefix length */ + plen = GET_U_1(pptr); /* get prefix length */ /* NLRI "prefix" (ibid), valid lengths are { 0, 32, 33, ..., 96 } bits. * RFC 4684 Section 4 defines the layout of "origin AS" and "route @@ -878,7 +878,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_U_4(pptr + 1)); + as_printf(ndo, asbuf, sizeof(asbuf), GET_BE_U_4(pptr + 1)); plen -= 32; /* adjust prefix length */ @@ -907,7 +907,7 @@ decode_labeled_vpn_prefix4(netdissect_options *ndo, u_int plen; ND_TCHECK_1(pptr); - plen = EXTRACT_U_1(pptr); /* get prefix length */ + plen = GET_U_1(pptr); /* get prefix length */ if ((24+64) > plen) return -1; @@ -929,8 +929,8 @@ decode_labeled_vpn_prefix4(netdissect_options *ndo, bgp_vpn_rd_print(ndo, pptr+4), ipaddr_string(ndo, (const u_char *)&addr), plen, - EXTRACT_BE_U_3(pptr + 1)>>4, - ((EXTRACT_U_1(pptr + 3) & 1) == 0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); + GET_BE_U_3(pptr + 1)>>4, + ((GET_U_1(pptr + 3) & 1) == 0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); return 12 + (plen + 7) / 8; @@ -960,7 +960,7 @@ decode_mdt_vpn_nlri(netdissect_options *ndo, ND_TCHECK_1(pptr); /* if the NLRI is not predefined length, quit.*/ - if (EXTRACT_U_1(pptr) != MDT_VPN_NLRI_LEN * 8) + if (GET_U_1(pptr) != MDT_VPN_NLRI_LEN * 8) return -1; pptr++; @@ -1014,9 +1014,9 @@ decode_multicast_vpn(netdissect_options *ndo, u_int offset; ND_TCHECK_2(pptr); - route_type = EXTRACT_U_1(pptr); + route_type = GET_U_1(pptr); pptr++; - route_length = EXTRACT_U_1(pptr); + route_length = GET_U_1(pptr); pptr++; nd_snprintf(buf, buflen, "Route-Type: %s (%u), length: %u", @@ -1039,7 +1039,7 @@ decode_multicast_vpn(netdissect_options *ndo, nd_snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s", bgp_vpn_rd_print(ndo, pptr), as_printf(ndo, astostr, sizeof(astostr), - EXTRACT_BE_U_4(pptr + BGP_VPN_RD_LEN))); + GET_BE_U_4(pptr + BGP_VPN_RD_LEN))); break; case BGP_MULTICAST_VPN_ROUTE_TYPE_S_PMSI: @@ -1075,7 +1075,7 @@ decode_multicast_vpn(netdissect_options *ndo, nd_snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s", bgp_vpn_rd_print(ndo, pptr), as_printf(ndo, astostr, sizeof(astostr), - EXTRACT_BE_U_4(pptr + BGP_VPN_RD_LEN))); + GET_BE_U_4(pptr + BGP_VPN_RD_LEN))); pptr += BGP_VPN_RD_LEN + 4; bgp_vpn_sg_print(ndo, pptr, buf, buflen); @@ -1123,7 +1123,7 @@ decode_labeled_vpn_l2(netdissect_options *ndo, int stringlen; ND_TCHECK_2(pptr); - plen = EXTRACT_BE_U_2(pptr); + plen = GET_BE_U_2(pptr); tlen = plen; pptr += 2; /* Old and new L2VPN NLRI share AFI/SAFI @@ -1149,9 +1149,9 @@ decode_labeled_vpn_l2(netdissect_options *ndo, buf[0] = '\0'; stringlen = nd_snprintf(buf, buflen, "RD: %s, CE-ID: %u, Label-Block Offset: %u, Label Base %u", bgp_vpn_rd_print(ndo, pptr), - 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 */ + GET_BE_U_2(pptr + 8), + GET_BE_U_2(pptr + 10), + GET_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; @@ -1166,9 +1166,9 @@ decode_labeled_vpn_l2(netdissect_options *ndo, return plen + 2; } ND_TCHECK_3(pptr); - tlv_type = EXTRACT_U_1(pptr); + tlv_type = GET_U_1(pptr); pptr++; - tlv_len = EXTRACT_BE_U_2(pptr); /* length, in *bits* */ + tlv_len = GET_BE_U_2(pptr); /* length, in *bits* */ ttlv_len = (tlv_len + 7)/8; /* length, in *bytes* */ pptr += 2; @@ -1191,7 +1191,7 @@ decode_labeled_vpn_l2(netdissect_options *ndo, ND_TCHECK_1(pptr); if (buflen != 0) { stringlen=nd_snprintf(buf,buflen, "%02x", - EXTRACT_U_1(pptr)); + GET_U_1(pptr)); pptr++; UPDATE_BUF_BUFLEN(buf, buflen, stringlen); } @@ -1237,7 +1237,7 @@ decode_prefix6(netdissect_options *ndo, ND_TCHECK_1(pd); ITEMCHECK(1); - plen = EXTRACT_U_1(pd); + plen = GET_U_1(pd); if (128 < plen) return -1; itemlen -= 1; @@ -1271,7 +1271,7 @@ decode_labeled_prefix6(netdissect_options *ndo, /* prefix length and label = 4 bytes */ ND_TCHECK_4(pptr); ITEMCHECK(4); - plen = EXTRACT_U_1(pptr); /* get prefix length */ + plen = GET_U_1(pptr); /* get prefix length */ if (24 > plen) return -1; @@ -1294,8 +1294,8 @@ decode_labeled_prefix6(netdissect_options *ndo, nd_snprintf(buf, buflen, "%s/%u, label:%u %s", ip6addr_string(ndo, (const u_char *)&addr), plen, - EXTRACT_BE_U_3(pptr + 1)>>4, - ((EXTRACT_U_1(pptr + 3) & 1) == 0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); + GET_BE_U_3(pptr + 1)>>4, + ((GET_U_1(pptr + 3) & 1) == 0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); return 4 + plenbytes; @@ -1314,7 +1314,7 @@ decode_labeled_vpn_prefix6(netdissect_options *ndo, u_int plen; ND_TCHECK_1(pptr); - plen = EXTRACT_U_1(pptr); /* get prefix length */ + plen = GET_U_1(pptr); /* get prefix length */ if ((24+64) > plen) return -1; @@ -1336,8 +1336,8 @@ decode_labeled_vpn_prefix6(netdissect_options *ndo, bgp_vpn_rd_print(ndo, pptr+4), ip6addr_string(ndo, (const u_char *)&addr), plen, - EXTRACT_BE_U_3(pptr + 1)>>4, - ((EXTRACT_U_1(pptr + 3) & 1) == 0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); + GET_BE_U_3(pptr + 1)>>4, + ((GET_U_1(pptr + 3) & 1) == 0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); return 12 + (plen + 7) / 8; @@ -1353,7 +1353,7 @@ decode_clnp_prefix(netdissect_options *ndo, u_int plen; ND_TCHECK_1(pptr); - plen = EXTRACT_U_1(pptr); /* get prefix length */ + plen = GET_U_1(pptr); /* get prefix length */ if (152 < plen) return -1; @@ -1383,7 +1383,7 @@ decode_labeled_vpn_clnp_prefix(netdissect_options *ndo, u_int plen; ND_TCHECK_1(pptr); - plen = EXTRACT_U_1(pptr); /* get prefix length */ + plen = GET_U_1(pptr); /* get prefix length */ if ((24+64) > plen) return -1; @@ -1404,8 +1404,8 @@ 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_U_3(pptr + 1)>>4, - ((EXTRACT_U_1(pptr + 3) & 1) == 0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); + GET_BE_U_3(pptr + 1)>>4, + ((GET_U_1(pptr + 3) & 1) == 0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); return 12 + (plen + 7) / 8; @@ -1445,11 +1445,11 @@ bgp_attr_get_as_size(netdissect_options *ndo, /* * If we do not find a valid segment type, our guess might be wrong. */ - if (EXTRACT_U_1(tptr) < BGP_AS_SEG_TYPE_MIN || EXTRACT_U_1(tptr) > BGP_AS_SEG_TYPE_MAX) { + if (GET_U_1(tptr) < BGP_AS_SEG_TYPE_MIN || GET_U_1(tptr) > BGP_AS_SEG_TYPE_MAX) { goto trunc; } ND_TCHECK_1(tptr + 1); - tptr += 2 + EXTRACT_U_1(tptr + 1) * 2; + tptr += 2 + GET_U_1(tptr + 1) * 2; } /* @@ -1497,7 +1497,7 @@ check_add_path(netdissect_options *ndo, const u_char *pptr, u_int length, /* We ran out of captured data; quit scanning. */ break; } - prefix_length = EXTRACT_U_1(pptr + offset); + prefix_length = GET_U_1(pptr + offset); /* * Add 4 to cover the path id * and check the prefix length isn't greater than 32/128. @@ -1519,7 +1519,7 @@ check_add_path(netdissect_options *ndo, const u_char *pptr, u_int length, /* We ran out of captured data; quit scanning. */ break; } - prefix_length = EXTRACT_U_1(pptr + offset); + prefix_length = GET_U_1(pptr + offset); /* * If the prefix_length is zero (0.0.0.0/0) * and since it's not the only address (length >= 5) @@ -1564,7 +1564,7 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK_1(tptr); ND_PRINT("%s", tok2str(bgp_origin_values, "Unknown Origin Typecode", - EXTRACT_U_1(tptr))); + GET_U_1(tptr))); } break; @@ -1595,21 +1595,21 @@ bgp_attr_print(netdissect_options *ndo, while (tptr < pptr + len) { ND_TCHECK_1(tptr); ND_PRINT("%s", tok2str(bgp_as_path_segment_open_values, - "?", EXTRACT_U_1(tptr))); + "?", GET_U_1(tptr))); ND_TCHECK_1(tptr + 1); - for (i = 0; i < EXTRACT_U_1(tptr + 1) * as_size; i += as_size) { + for (i = 0; i < GET_U_1(tptr + 1) * as_size; i += as_size) { ND_TCHECK_LEN(tptr + 2 + i, as_size); ND_PRINT("%s ", as_printf(ndo, astostr, sizeof(astostr), as_size == 2 ? - EXTRACT_BE_U_2(tptr + i + 2) : - EXTRACT_BE_U_4(tptr + i + 2))); + GET_BE_U_2(tptr + i + 2) : + GET_BE_U_4(tptr + i + 2))); } ND_TCHECK_1(tptr); ND_PRINT("%s", tok2str(bgp_as_path_segment_close_values, - "?", EXTRACT_U_1(tptr))); + "?", GET_U_1(tptr))); ND_TCHECK_1(tptr + 1); - tptr += 2 + EXTRACT_U_1(tptr + 1) * as_size; + tptr += 2 + GET_U_1(tptr + 1) * as_size; } break; case BGPTYPE_NEXT_HOP: @@ -1626,7 +1626,7 @@ bgp_attr_print(netdissect_options *ndo, ND_PRINT("invalid len"); else { ND_TCHECK_4(tptr); - ND_PRINT("%u", EXTRACT_BE_U_4(tptr)); + ND_PRINT("%u", GET_BE_U_4(tptr)); } break; case BGPTYPE_ATOMIC_AGGREGATE: @@ -1646,12 +1646,12 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK_LEN(tptr, len); if (len == 6) { ND_PRINT(" AS #%s, origin %s", - as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_U_2(tptr)), + as_printf(ndo, astostr, sizeof(astostr), GET_BE_U_2(tptr)), ipaddr_string(ndo, tptr + 2)); } else { ND_PRINT(" AS #%s, origin %s", as_printf(ndo, astostr, sizeof(astostr), - EXTRACT_BE_U_4(tptr)), ipaddr_string(ndo, tptr + 4)); + GET_BE_U_4(tptr)), ipaddr_string(ndo, tptr + 4)); } break; case BGPTYPE_AGGREGATOR4: @@ -1661,7 +1661,7 @@ bgp_attr_print(netdissect_options *ndo, } ND_TCHECK_8(tptr); ND_PRINT(" AS #%s, origin %s", - as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_U_4(tptr)), + as_printf(ndo, astostr, sizeof(astostr), GET_BE_U_4(tptr)), ipaddr_string(ndo, tptr + 4)); break; case BGPTYPE_COMMUNITIES: @@ -1674,7 +1674,7 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK_4(tptr); if (tlen < 4) goto trunc; - comm = EXTRACT_BE_U_4(tptr); + comm = GET_BE_U_4(tptr); switch (comm) { case BGP_COMMUNITY_NO_EXPORT: ND_PRINT(" NO_EXPORT"); @@ -1724,8 +1724,8 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK_3(tptr); if (tlen < 3) goto trunc; - af = EXTRACT_BE_U_2(tptr); - safi = EXTRACT_U_1(tptr + 2); + af = GET_BE_U_2(tptr); + safi = GET_U_1(tptr + 2); ND_PRINT("\n\t AFI: %s (%u), %sSAFI: %s (%u)", tok2str(af_values, "Unknown AFI", af), @@ -1775,7 +1775,7 @@ bgp_attr_print(netdissect_options *ndo, tptr +=3; ND_TCHECK_1(tptr); - nhlen = EXTRACT_U_1(tptr); + nhlen = GET_U_1(tptr); tlen = nhlen; tptr++; @@ -1885,10 +1885,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_U_4(tptr + BGP_VPN_RD_LEN) == 0x47000601) + if (GET_BE_U_4(tptr + BGP_VPN_RD_LEN) == 0x47000601) ND_PRINT(" = %s", ipaddr_string(ndo, tptr+BGP_VPN_RD_LEN+4)); /* rfc1888 mapped IPv6 address ? */ - else if (EXTRACT_BE_U_3(tptr + BGP_VPN_RD_LEN) == 0x350000) + else if (GET_BE_U_3(tptr + BGP_VPN_RD_LEN) == 0x350000) ND_PRINT(" = %s", ip6addr_string(ndo, tptr+BGP_VPN_RD_LEN+3)); tptr += tlen; tlen = 0; @@ -1910,15 +1910,15 @@ bgp_attr_print(netdissect_options *ndo, tptr += tlen; ND_TCHECK_1(tptr); - snpa = EXTRACT_U_1(tptr); + snpa = GET_U_1(tptr); tptr++; if (snpa) { ND_PRINT("\n\t %u SNPA", snpa); for (/*nothing*/; snpa != 0; snpa--) { ND_TCHECK_1(tptr); - ND_PRINT("\n\t %u bytes", EXTRACT_U_1(tptr)); - tptr += EXTRACT_U_1(tptr) + 1; + ND_PRINT("\n\t %u bytes", GET_U_1(tptr)); + tptr += GET_U_1(tptr) + 1; } } else { ND_PRINT(", no SNPA"); @@ -1933,7 +1933,7 @@ bgp_attr_print(netdissect_options *ndo, case (AFNUM_INET<<8 | SAFNUM_MULTICAST): case (AFNUM_INET<<8 | SAFNUM_UNIMULTICAST): if (add_path4) { - path_id = EXTRACT_BE_U_4(tptr); + path_id = GET_BE_U_4(tptr); tptr += 4; } advance = decode_prefix4(ndo, tptr, len, buf, sizeof(buf)); @@ -2000,7 +2000,7 @@ bgp_attr_print(netdissect_options *ndo, case (AFNUM_INET6<<8 | SAFNUM_MULTICAST): case (AFNUM_INET6<<8 | SAFNUM_UNIMULTICAST): if (add_path6) { - path_id = EXTRACT_BE_U_4(tptr); + path_id = GET_BE_U_4(tptr); tptr += 4; } advance = decode_prefix6(ndo, tptr, len, buf, sizeof(buf)); @@ -2090,8 +2090,8 @@ bgp_attr_print(netdissect_options *ndo, case BGPTYPE_MP_UNREACH_NLRI: ND_TCHECK_LEN(tptr, BGP_MP_NLRI_MINSIZE); - af = EXTRACT_BE_U_2(tptr); - safi = EXTRACT_U_1(tptr + 2); + af = GET_BE_U_2(tptr); + safi = GET_U_1(tptr + 2); ND_PRINT("\n\t AFI: %s (%u), %sSAFI: %s (%u)", tok2str(af_values, "Unknown AFI", af), @@ -2114,7 +2114,7 @@ bgp_attr_print(netdissect_options *ndo, case (AFNUM_INET<<8 | SAFNUM_MULTICAST): case (AFNUM_INET<<8 | SAFNUM_UNIMULTICAST): if (add_path4) { - path_id = EXTRACT_BE_U_4(tptr); + path_id = GET_BE_U_4(tptr); tptr += 4; } advance = decode_prefix4(ndo, tptr, len, buf, sizeof(buf)); @@ -2156,7 +2156,7 @@ bgp_attr_print(netdissect_options *ndo, case (AFNUM_INET6<<8 | SAFNUM_MULTICAST): case (AFNUM_INET6<<8 | SAFNUM_UNIMULTICAST): if (add_path6) { - path_id = EXTRACT_BE_U_4(tptr); + path_id = GET_BE_U_4(tptr); tptr += 4; } advance = decode_prefix6(ndo, tptr, len, buf, sizeof(buf)); @@ -2272,7 +2272,7 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK_2(tptr); if (tlen < 2) goto trunc; - extd_comm=EXTRACT_BE_U_2(tptr); + extd_comm=GET_BE_U_2(tptr); ND_PRINT("\n\t %s (0x%04x), Flags [%s]", tok2str(bgp_extd_comm_subtype_values, @@ -2298,15 +2298,15 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK_5(tptr); if (tlen < 5) goto trunc; - flags = EXTRACT_U_1(tptr); - tunnel_type = EXTRACT_U_1(tptr + 1); + flags = GET_U_1(tptr); + tunnel_type = GET_U_1(tptr + 1); tlen = len; ND_PRINT("\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_U_3(tptr + 2)>>4); + GET_BE_U_3(tptr + 2)>>4); tptr +=5; tlen -= 5; @@ -2336,13 +2336,13 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK_8(tptr); ND_PRINT("\n\t Root-Node %s, LSP-ID 0x%08x", ipaddr_string(ndo, tptr), - EXTRACT_BE_U_4(tptr + 4)); + GET_BE_U_4(tptr + 4)); break; case BGP_PMSI_TUNNEL_RSVP_P2MP: ND_TCHECK_8(tptr); ND_PRINT("\n\t Extended-Tunnel-ID %s, P2MP-ID 0x%08x", ipaddr_string(ndo, tptr), - EXTRACT_BE_U_4(tptr + 4)); + GET_BE_U_4(tptr + 4)); break; default: if (ndo->ndo_vflag <= 1) { @@ -2362,8 +2362,8 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK_3(tptr); - type = EXTRACT_U_1(tptr); - length = EXTRACT_BE_U_2(tptr + 1); + type = GET_U_1(tptr); + length = GET_BE_U_2(tptr + 1); tptr += 3; tlen -= 3; @@ -2388,7 +2388,7 @@ bgp_attr_print(netdissect_options *ndo, if (length < 8) goto trunc; ND_PRINT(", metric %" PRIu64, - EXTRACT_BE_U_8(tptr)); + GET_BE_U_8(tptr)); break; default: @@ -2407,7 +2407,7 @@ bgp_attr_print(netdissect_options *ndo, if (len < 4) goto trunc; ND_PRINT("\n\t Origin AS: %s", - as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_U_4(tptr))); + as_printf(ndo, astostr, sizeof(astostr), GET_BE_U_4(tptr))); tptr += 4; len -= 4; @@ -2420,8 +2420,8 @@ bgp_attr_print(netdissect_options *ndo, tptr += len; break; } - aflags = EXTRACT_U_1(tptr); - atype = EXTRACT_U_1(tptr + 1); + aflags = GET_U_1(tptr); + atype = GET_U_1(tptr + 1); tptr += 2; len -= 2; alenlen = bgp_attr_lenlen(aflags, tptr); @@ -2474,9 +2474,9 @@ bgp_attr_print(netdissect_options *ndo, while (len != 0) { ND_TCHECK_LEN(tptr, 12); ND_PRINT("%u:%u:%u%s", - EXTRACT_BE_U_4(tptr), - EXTRACT_BE_U_4(tptr + 4), - EXTRACT_BE_U_4(tptr + 8), + GET_BE_U_4(tptr), + GET_BE_U_4(tptr + 4), + GET_BE_U_4(tptr + 8), (len > 12) ? ", " : ""); tptr += 12; /* @@ -2512,8 +2512,8 @@ bgp_capabilities_print(netdissect_options *ndo, while (i < caps_len) { ND_TCHECK_LEN(opt + i, BGP_CAP_HEADER_SIZE); - cap_type=EXTRACT_U_1(opt + i); - cap_len=EXTRACT_U_1(opt + i + 1); + cap_type=GET_U_1(opt + i); + cap_len=GET_U_1(opt + i + 1); ND_PRINT("\n\t %s (%u), length: %u", tok2str(bgp_capcode_values, "Unknown", cap_type), cap_type, @@ -2527,10 +2527,10 @@ bgp_capabilities_print(netdissect_options *ndo, return; } ND_PRINT("\n\t\tAFI %s (%u), SAFI %s (%u)", - tok2str(af_values, "Unknown", EXTRACT_BE_U_2(opt + i + 2)), - EXTRACT_BE_U_2(opt + i + 2), - tok2str(bgp_safi_values, "Unknown", EXTRACT_U_1(opt + i + 5)), - EXTRACT_U_1(opt + i + 5)); + tok2str(af_values, "Unknown", GET_BE_U_2(opt + i + 2)), + GET_BE_U_2(opt + i + 2), + tok2str(bgp_safi_values, "Unknown", GET_U_1(opt + i + 5)), + GET_U_1(opt + i + 5)); break; case BGP_CAPCODE_RESTART: /* Restart Flags (4 bits), Restart Time in seconds (12 bits) */ @@ -2540,19 +2540,19 @@ bgp_capabilities_print(netdissect_options *ndo, } tcap_len=cap_len; ND_PRINT("\n\t\tRestart Flags: [%s], Restart Time %us", - ((EXTRACT_U_1(opt + i + 2))&0x80) ? "R" : "none", - EXTRACT_BE_U_2(opt + i + 2)&0xfff); + ((GET_U_1(opt + i + 2))&0x80) ? "R" : "none", + GET_BE_U_2(opt + i + 2)&0xfff); tcap_len-=2; cap_offset=4; while(tcap_len>=4) { ND_PRINT("\n\t\t AFI %s (%u), SAFI %s (%u), Forwarding state preserved: %s", tok2str(af_values,"Unknown", - EXTRACT_BE_U_2(opt + i + cap_offset)), - EXTRACT_BE_U_2(opt + i + cap_offset), + GET_BE_U_2(opt + i + cap_offset)), + GET_BE_U_2(opt + i + cap_offset), tok2str(bgp_safi_values,"Unknown", - EXTRACT_U_1(opt + i + cap_offset + 2)), - EXTRACT_U_1(opt + (i + cap_offset + 2)), - ((EXTRACT_U_1(opt + (i + cap_offset + 3)))&0x80) ? "yes" : "no" ); + GET_U_1(opt + i + cap_offset + 2)), + GET_U_1(opt + (i + cap_offset + 2)), + ((GET_U_1(opt + (i + cap_offset + 3)))&0x80) ? "yes" : "no" ); tcap_len -= 4; cap_offset += 4; } @@ -2570,7 +2570,7 @@ bgp_capabilities_print(netdissect_options *ndo, } ND_PRINT("\n\t\t 4 Byte AS %s", as_printf(ndo, astostr, sizeof(astostr), - EXTRACT_BE_U_4(opt + i + 2))); + GET_BE_U_4(opt + i + 2))); break; case BGP_CAPCODE_ADD_PATH: if (cap_len == 0) { @@ -2585,11 +2585,11 @@ bgp_capabilities_print(netdissect_options *ndo, break; } ND_PRINT("\n\t\tAFI %s (%u), SAFI %s (%u), Send/Receive: %s", - 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",EXTRACT_U_1(opt + i + cap_offset + 2)), - EXTRACT_U_1(opt + (i + cap_offset + 2)), - tok2str(bgp_add_path_recvsend,"Bogus (0x%02x)",EXTRACT_U_1(opt + i + cap_offset + 3)) + tok2str(af_values,"Unknown",GET_BE_U_2(opt + i + cap_offset)), + GET_BE_U_2(opt + i + cap_offset), + tok2str(bgp_safi_values,"Unknown",GET_U_1(opt + i + cap_offset + 2)), + GET_U_1(opt + (i + cap_offset + 2)), + tok2str(bgp_add_path_recvsend,"Bogus (0x%02x)",GET_U_1(opt + i + cap_offset + 3)) ); tcap_len -= 4; cap_offset += 4; @@ -2631,13 +2631,13 @@ bgp_open_print(netdissect_options *ndo, bgp_open_header = (const struct bgp_open *)dat; ND_PRINT("\n\t Version %u, ", - EXTRACT_U_1(bgp_open_header->bgpo_version)); + GET_U_1(bgp_open_header->bgpo_version)); ND_PRINT("my AS %s, ", - as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_U_2(bgp_open_header->bgpo_myas))); + as_printf(ndo, astostr, sizeof(astostr), GET_BE_U_2(bgp_open_header->bgpo_myas))); ND_PRINT("Holdtime %us, ", - EXTRACT_BE_U_2(bgp_open_header->bgpo_holdtime)); + GET_BE_U_2(bgp_open_header->bgpo_holdtime)); ND_PRINT("ID %s", ipaddr_string(ndo, bgp_open_header->bgpo_id)); - optslen = EXTRACT_U_1(bgp_open_header->bgpo_optlen); + optslen = GET_U_1(bgp_open_header->bgpo_optlen); ND_PRINT("\n\t Optional parameters, length: %u", optslen); opt = dat + BGP_OPEN_SIZE; @@ -2651,8 +2651,8 @@ bgp_open_print(netdissect_options *ndo, if (length < BGP_OPT_SIZE + i) goto trunc; bgpopt = (const struct bgp_opt *)(opt + i); - opt_type = EXTRACT_U_1(bgpopt->bgpopt_type); - opt_len = EXTRACT_U_1(bgpopt->bgpopt_len); + opt_type = GET_U_1(bgpopt->bgpopt_type); + opt_len = GET_U_1(bgpopt->bgpopt_len); if (BGP_OPT_SIZE + i + opt_len > optslen) { ND_PRINT("\n\t Option %u, length: %u, goes past the end of the options", opt_type, opt_len); @@ -2708,7 +2708,7 @@ bgp_update_print(netdissect_options *ndo, ND_TCHECK_2(p); if (length < 2) goto trunc; - withdrawn_routes_len = EXTRACT_BE_U_2(p); + withdrawn_routes_len = GET_BE_U_2(p); p += 2; length -= 2; if (withdrawn_routes_len > 1) { @@ -2729,7 +2729,7 @@ bgp_update_print(netdissect_options *ndo, length -= withdrawn_routes_len; break; } - path_id = EXTRACT_BE_U_4(p); + path_id = GET_BE_U_4(p); p += 4; length -= 4; withdrawn_routes_len -= 4; @@ -2763,7 +2763,7 @@ bgp_update_print(netdissect_options *ndo, ND_TCHECK_2(p); if (length < 2) goto trunc; - len = EXTRACT_BE_U_2(p); + len = GET_BE_U_2(p); p += 2; length -= 2; @@ -2787,8 +2787,8 @@ bgp_update_print(netdissect_options *ndo, length -= len; break; } - aflags = EXTRACT_U_1(p); - atype = EXTRACT_U_1(p + 1); + aflags = GET_U_1(p); + atype = GET_U_1(p + 1); p += 2; len -= 2; length -= 2; @@ -2846,7 +2846,7 @@ bgp_update_print(netdissect_options *ndo, ND_TCHECK_4(p); if (length < 4) goto trunc; - path_id = EXTRACT_BE_U_4(p); + path_id = GET_BE_U_4(p); p += 4; length -= 4; } @@ -2888,8 +2888,8 @@ bgp_notification_print(netdissect_options *ndo, return; bgp_notification_header = (const struct bgp_notification *)dat; - bgpn_major = EXTRACT_U_1(bgp_notification_header->bgpn_major); - bgpn_minor = EXTRACT_U_1(bgp_notification_header->bgpn_minor); + bgpn_major = GET_U_1(bgp_notification_header->bgpn_major); + bgpn_minor = GET_U_1(bgp_notification_header->bgpn_minor); ND_PRINT(", %s (%u)", tok2str(bgp_notify_major_values, "Unknown Error", @@ -2941,11 +2941,11 @@ bgp_notification_print(netdissect_options *ndo, tptr = dat + BGP_NOTIFICATION_SIZE; ND_TCHECK_7(tptr); ND_PRINT(", AFI %s (%u), SAFI %s (%u), Max Prefixes: %u", - tok2str(af_values, "Unknown", 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)); + tok2str(af_values, "Unknown", GET_BE_U_2(tptr)), + GET_BE_U_2(tptr), + tok2str(bgp_safi_values, "Unknown", GET_U_1((tptr + 2))), + GET_U_1((tptr + 2)), + GET_BE_U_4(tptr + 3)); } /* * draft-ietf-idr-shutdown describes a method to send a communication @@ -2956,7 +2956,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_U_1(tptr); + shutdown_comm_length = GET_U_1(tptr); remainder_offset = 0; /* garbage, hexdump it all */ if (shutdown_comm_length > BGP_NOTIFY_MINOR_CEASE_ADMIN_SHUTDOWN_LEN || @@ -3007,11 +3007,11 @@ bgp_route_refresh_print(netdissect_options *ndo, ND_PRINT("\n\t AFI %s (%u), SAFI %s (%u)", tok2str(af_values,"Unknown", - EXTRACT_BE_U_2(bgp_route_refresh_header->afi)), - EXTRACT_BE_U_2(bgp_route_refresh_header->afi), + GET_BE_U_2(bgp_route_refresh_header->afi)), + GET_BE_U_2(bgp_route_refresh_header->afi), tok2str(bgp_safi_values,"Unknown", - EXTRACT_U_1(bgp_route_refresh_header->safi)), - EXTRACT_U_1(bgp_route_refresh_header->safi)); + GET_U_1(bgp_route_refresh_header->safi)), + GET_U_1(bgp_route_refresh_header->safi)); if (ndo->ndo_vflag > 1) { ND_TCHECK_LEN(pptr, len); @@ -3032,7 +3032,7 @@ bgp_pdu_print(netdissect_options *ndo, ND_TCHECK_LEN(dat, BGP_SIZE); bgp_header = (const struct bgp *)dat; - bgp_type = EXTRACT_U_1(bgp_header->bgp_type); + bgp_type = GET_U_1(bgp_header->bgp_type); ND_PRINT("\n\t%s Message (%u), length: %u", tok2str(bgp_msg_values, "Unknown", bgp_type), @@ -3092,7 +3092,7 @@ bgp_print(netdissect_options *ndo, while (p < ep) { if (!ND_TTEST_1(p)) break; - if (EXTRACT_U_1(p) != 0xff) { + if (GET_U_1(p) != 0xff) { p++; continue; } @@ -3111,7 +3111,7 @@ bgp_print(netdissect_options *ndo, if (start != p) nd_print_trunc(ndo); - hlen = EXTRACT_BE_U_2(bgp_header->bgp_len); + hlen = GET_BE_U_2(bgp_header->bgp_len); if (hlen < BGP_SIZE) { ND_PRINT("\nmessage length %u < %u", hlen, BGP_SIZE); nd_print_invalid(ndo); @@ -3127,7 +3127,7 @@ bgp_print(netdissect_options *ndo, ND_PRINT("\n[|BGP %s]", tok2str(bgp_msg_values, "Unknown Message Type", - EXTRACT_U_1(bgp_header->bgp_type))); + GET_U_1(bgp_header->bgp_type))); break; } } diff --git a/print-bootp.c b/print-bootp.c index 41c82889..89bd59be 100644 --- a/print-bootp.c +++ b/print-bootp.c @@ -290,13 +290,13 @@ bootp_print(netdissect_options *ndo, ndo->ndo_protocol = "bootp"; bp = (const struct bootp *)cp; ND_TCHECK_1(bp->bp_op); - bp_op = EXTRACT_U_1(bp->bp_op); + bp_op = GET_U_1(bp->bp_op); ND_PRINT("BOOTP/DHCP, %s", tok2str(bootp_op_values, "unknown (0x%02x)", bp_op)); ND_TCHECK_1(bp->bp_hlen); - bp_htype = EXTRACT_U_1(bp->bp_htype); - bp_hlen = EXTRACT_U_1(bp->bp_hlen); + bp_htype = GET_U_1(bp->bp_htype); + bp_hlen = GET_U_1(bp->bp_hlen); if (bp_htype == 1 && bp_hlen == 6 && bp_op == BOOTPREQUEST) { ND_TCHECK_6(bp->bp_chaddr); ND_PRINT(" from %s", etheraddr_string(ndo, bp->bp_chaddr)); @@ -318,37 +318,37 @@ bootp_print(netdissect_options *ndo, ND_PRINT(", hlen %u", bp_hlen); /* Only print interesting fields */ - if (EXTRACT_U_1(bp->bp_hops)) - ND_PRINT(", hops %u", EXTRACT_U_1(bp->bp_hops)); - if (EXTRACT_BE_U_4(bp->bp_xid)) - ND_PRINT(", xid 0x%x", EXTRACT_BE_U_4(bp->bp_xid)); - if (EXTRACT_BE_U_2(bp->bp_secs)) - ND_PRINT(", secs %u", EXTRACT_BE_U_2(bp->bp_secs)); + if (GET_U_1(bp->bp_hops)) + ND_PRINT(", hops %u", GET_U_1(bp->bp_hops)); + if (GET_BE_U_4(bp->bp_xid)) + ND_PRINT(", xid 0x%x", GET_BE_U_4(bp->bp_xid)); + if (GET_BE_U_2(bp->bp_secs)) + ND_PRINT(", secs %u", GET_BE_U_2(bp->bp_secs)); ND_TCHECK_2(bp->bp_flags); ND_PRINT(", Flags [%s]", - bittok2str(bootp_flag_values, "none", EXTRACT_BE_U_2(bp->bp_flags))); + bittok2str(bootp_flag_values, "none", GET_BE_U_2(bp->bp_flags))); if (ndo->ndo_vflag > 1) - ND_PRINT(" (0x%04x)", EXTRACT_BE_U_2(bp->bp_flags)); + ND_PRINT(" (0x%04x)", GET_BE_U_2(bp->bp_flags)); /* Client's ip address */ ND_TCHECK_4(bp->bp_ciaddr); - if (EXTRACT_IPV4_TO_NETWORK_ORDER(bp->bp_ciaddr)) + if (GET_IPV4_TO_NETWORK_ORDER(bp->bp_ciaddr)) ND_PRINT("\n\t Client-IP %s", ipaddr_string(ndo, bp->bp_ciaddr)); /* 'your' ip address (bootp client) */ ND_TCHECK_4(bp->bp_yiaddr); - if (EXTRACT_IPV4_TO_NETWORK_ORDER(bp->bp_yiaddr)) + if (GET_IPV4_TO_NETWORK_ORDER(bp->bp_yiaddr)) ND_PRINT("\n\t Your-IP %s", ipaddr_string(ndo, bp->bp_yiaddr)); /* Server's ip address */ ND_TCHECK_4(bp->bp_siaddr); - if (EXTRACT_IPV4_TO_NETWORK_ORDER(bp->bp_siaddr)) + if (GET_IPV4_TO_NETWORK_ORDER(bp->bp_siaddr)) ND_PRINT("\n\t Server-IP %s", ipaddr_string(ndo, bp->bp_siaddr)); /* Gateway's ip address */ ND_TCHECK_4(bp->bp_giaddr); - if (EXTRACT_IPV4_TO_NETWORK_ORDER(bp->bp_giaddr)) + if (GET_IPV4_TO_NETWORK_ORDER(bp->bp_giaddr)) ND_PRINT("\n\t Gateway-IP %s", ipaddr_string(ndo, bp->bp_giaddr)); /* Client's Ethernet address */ @@ -358,7 +358,7 @@ bootp_print(netdissect_options *ndo, } ND_TCHECK_1(bp->bp_sname); /* check first char only */ - if (EXTRACT_U_1(bp->bp_sname)) { + if (GET_U_1(bp->bp_sname)) { ND_PRINT("\n\t sname \""); if (nd_printztn(ndo, bp->bp_sname, (u_int)sizeof(bp->bp_sname), ndo->ndo_snapend) == 0) { @@ -369,7 +369,7 @@ bootp_print(netdissect_options *ndo, ND_PRINT("\""); } ND_TCHECK_1(bp->bp_file); /* check first char only */ - if (EXTRACT_U_1(bp->bp_file)) { + if (GET_U_1(bp->bp_file)) { ND_PRINT("\n\t file \""); if (nd_printztn(ndo, bp->bp_file, (u_int)sizeof(bp->bp_file), ndo->ndo_snapend) == 0) { @@ -391,7 +391,7 @@ bootp_print(netdissect_options *ndo, else { uint32_t ul; - ul = EXTRACT_BE_U_4(bp->bp_vend); + ul = GET_BE_U_4(bp->bp_vend); if (ul != 0) ND_PRINT("\n\t Vendor-#0x%x", ul); } @@ -608,12 +608,12 @@ rfc1048_print(netdissect_options *ndo, ND_PRINT("\n\t Vendor-rfc1048 Extensions"); /* Step over magic cookie */ - ND_PRINT("\n\t Magic Cookie 0x%08x", EXTRACT_BE_U_4(bp)); + ND_PRINT("\n\t Magic Cookie 0x%08x", GET_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_U_1(bp); + tag = GET_U_1(bp); bp++; if (tag == TAG_PAD && ndo->ndo_vflag < 3) continue; @@ -621,7 +621,7 @@ rfc1048_print(netdissect_options *ndo, return; if (tag == TAG_EXTENDED_OPTION) { ND_TCHECK_2(bp + 1); - tag = EXTRACT_BE_U_2(bp + 1); + tag = GET_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. @@ -636,7 +636,7 @@ rfc1048_print(netdissect_options *ndo, else { /* Get the length; check for truncation */ ND_TCHECK_1(bp); - len = EXTRACT_U_1(bp); + len = GET_U_1(bp); bp++; } @@ -646,7 +646,7 @@ rfc1048_print(netdissect_options *ndo, if (tag == TAG_PAD && ndo->ndo_vflag > 2) { u_int ntag = 1; while (ND_TTEST_1(bp) && - EXTRACT_U_1(bp) == TAG_PAD) { + GET_U_1(bp) == TAG_PAD) { bp++; ntag++; } @@ -657,7 +657,8 @@ rfc1048_print(netdissect_options *ndo, ND_TCHECK_LEN(bp, len); if (tag == TAG_DHCP_MESSAGE && len == 1) { - ND_PRINT("%s", tok2str(dhcp_msg_values, "Unknown (%u)", EXTRACT_U_1(bp))); + ND_PRINT("%s", + tok2str(dhcp_msg_values, "Unknown (%u)", GET_U_1(bp))); bp++; continue; } @@ -665,7 +666,8 @@ rfc1048_print(netdissect_options *ndo, if (tag == TAG_PARM_REQUEST) { idx = 0; while (len > 0) { - cp = tok2str(tag2str, "?Option %u", EXTRACT_U_1(bp)); + cp = tok2str(tag2str, "?Option %u", + GET_U_1(bp)); bp++; len--; if (idx % 4 == 0) @@ -681,7 +683,8 @@ rfc1048_print(netdissect_options *ndo, if (tag == TAG_EXTENDED_REQUEST) { first = 1; while (len > 1) { - cp = tok2str(xtag2str, "?xT%u", EXTRACT_BE_U_2(bp)); + cp = tok2str(xtag2str, "?xT%u", + GET_BE_U_2(bp)); bp += 2; len -= 2; if (!first) @@ -727,9 +730,9 @@ rfc1048_print(netdissect_options *ndo, if (c == 'i') ND_PRINT("%s", ipaddr_string(ndo, bp)); else if (c == 'L') - ND_PRINT("%d", EXTRACT_BE_S_4(bp)); + ND_PRINT("%d", GET_BE_S_4(bp)); else - ND_PRINT("%u", EXTRACT_BE_U_4(bp)); + ND_PRINT("%u", GET_BE_U_4(bp)); bp += 4; len -= 4; first = 0; @@ -756,7 +759,7 @@ rfc1048_print(netdissect_options *ndo, while (len >= 2) { if (!first) ND_PRINT(","); - ND_PRINT("%u", EXTRACT_BE_U_2(bp)); + ND_PRINT("%u", GET_BE_U_2(bp)); bp += 2; len -= 2; first = 0; @@ -769,7 +772,7 @@ rfc1048_print(netdissect_options *ndo, uint8_t bool_value; if (!first) ND_PRINT(","); - bool_value = EXTRACT_U_1(bp); + bool_value = GET_U_1(bp); switch (bool_value) { case 0: ND_PRINT("N"); @@ -795,7 +798,7 @@ rfc1048_print(netdissect_options *ndo, uint8_t byte_value; if (!first) ND_PRINT(c == 'x' ? ":" : "."); - byte_value = EXTRACT_U_1(bp); + byte_value = GET_U_1(bp); if (c == 'x') ND_PRINT("%02x", byte_value); else @@ -816,7 +819,7 @@ rfc1048_print(netdissect_options *ndo, ND_PRINT("ERROR: length < 1 bytes"); break; } - tag = EXTRACT_U_1(bp); + tag = GET_U_1(bp); ++bp; --len; ND_PRINT("%s", tok2str(nbo2str, NULL, tag)); @@ -828,7 +831,7 @@ rfc1048_print(netdissect_options *ndo, ND_PRINT("ERROR: length < 1 bytes"); break; } - tag = EXTRACT_U_1(bp); + tag = GET_U_1(bp); ++bp; --len; ND_PRINT("%s", tok2str(oo2str, NULL, tag)); @@ -842,11 +845,13 @@ rfc1048_print(netdissect_options *ndo, len = 0; break; } - if (EXTRACT_U_1(bp)) - ND_PRINT("[%s] ", client_fqdn_flags(EXTRACT_U_1(bp))); + if (GET_U_1(bp)) + ND_PRINT("[%s] ", + client_fqdn_flags(GET_U_1(bp))); bp++; - if (EXTRACT_U_1(bp) || EXTRACT_U_1(bp + 1)) - ND_PRINT("%u/%u ", EXTRACT_U_1(bp), EXTRACT_U_1(bp + 1)); + if (GET_U_1(bp) || GET_U_1(bp + 1)) + ND_PRINT("%u/%u ", GET_U_1(bp), + GET_U_1(bp + 1)); bp += 2; ND_PRINT("\""); if (nd_printn(ndo, bp, len - 3, ndo->ndo_snapend)) { @@ -867,7 +872,7 @@ rfc1048_print(netdissect_options *ndo, ND_PRINT("ERROR: length < 1 bytes"); break; } - type = EXTRACT_U_1(bp); + type = GET_U_1(bp); bp++; len--; if (type == 0) { @@ -885,7 +890,7 @@ rfc1048_print(netdissect_options *ndo, while (len > 0) { if (!first) ND_PRINT(":"); - ND_PRINT("%02x", EXTRACT_U_1(bp)); + ND_PRINT("%02x", GET_U_1(bp)); ++bp; --len; first = 0; @@ -896,8 +901,8 @@ rfc1048_print(netdissect_options *ndo, case TAG_AGENT_CIRCUIT: while (len >= 2) { - subopt = EXTRACT_U_1(bp); - suboptlen = EXTRACT_U_1(bp + 1); + subopt = GET_U_1(bp); + suboptlen = GET_U_1(bp + 1); bp += 2; len -= 2; if (suboptlen > len) { @@ -946,7 +951,7 @@ rfc1048_print(netdissect_options *ndo, while (len > 0) { if (!first) ND_PRINT(","); - mask_width = EXTRACT_U_1(bp); + mask_width = GET_U_1(bp); bp++; len--; /* mask_width <= 32 */ @@ -971,7 +976,8 @@ rfc1048_print(netdissect_options *ndo, for (i = 0; i < significant_octets ; i++) { if (i > 0) ND_PRINT("."); - ND_PRINT("%u", EXTRACT_U_1(bp)); + ND_PRINT("%u", + GET_U_1(bp)); bp++; } for (i = significant_octets ; i < 4 ; i++) @@ -998,7 +1004,7 @@ rfc1048_print(netdissect_options *ndo, break; } while (len > 0) { - suboptlen = EXTRACT_U_1(bp); + suboptlen = GET_U_1(bp); bp++; len--; ND_PRINT("\n\t "); @@ -1050,7 +1056,7 @@ trunc: } #define PRINTCMUADDR(m, s) { ND_TCHECK_4(&cmu->m); \ - if (EXTRACT_IPV4_TO_NETWORK_ORDER(cmu->m) != 0) \ + if (GET_IPV4_TO_NETWORK_ORDER(cmu->m) != 0) \ ND_PRINT(" %s:%s", s, ipaddr_string(ndo, cmu->m)); } static void @@ -1065,7 +1071,7 @@ cmu_print(netdissect_options *ndo, /* Only print if there are unknown bits */ ND_TCHECK_4(cmu->v_flags); - v_flags = EXTRACT_U_1(cmu->v_flags); + v_flags = GET_U_1(cmu->v_flags); if ((v_flags & ~(VF_SMASK)) != 0) ND_PRINT(" F:0x%x", v_flags); PRINTCMUADDR(v_dgate, "DG"); diff --git a/print-brcmtag.c b/print-brcmtag.c index 851635ed..1c00da7d 100644 --- a/print-brcmtag.c +++ b/print-brcmtag.c @@ -93,7 +93,7 @@ static int brcm_tag_print_full(netdissect_options *ndo, const u_char *bp, return (1); for (i = 0; i < BRCM_TAG_LEN; i++) - tag[i] = EXTRACT_U_1(bp + i); + tag[i] = GET_U_1(bp + i); ND_PRINT("BRCM tag OP: %s", tag[0] ? "IG" : "EG"); if (tag[0] & (1 << BRCM_OPCODE_SHIFT)) { @@ -63,7 +63,7 @@ bt_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char * ND_TCHECK_4(&hdr->direction); if (ndo->ndo_eflag) ND_PRINT(", hci length %u, direction %s", length, - (EXTRACT_BE_U_4(hdr->direction)&0x1) ? "in" : "out"); + (GET_BE_U_4(hdr->direction)&0x1) ? "in" : "out"); if (!ndo->ndo_suppress_default_print) ND_DEFAULTPRINT(p, caplen); diff --git a/print-calm-fast.c b/print-calm-fast.c index 45bb5cc7..6331a9c9 100644 --- a/print-calm-fast.c +++ b/print-calm-fast.c @@ -47,8 +47,8 @@ calm_fast_print(netdissect_options *ndo, const u_char *bp, u_int length, const s ND_TCHECK_2(bp); if (length < 2) goto trunc; - srcNwref = EXTRACT_U_1(bp); - dstNwref = EXTRACT_U_1(bp + 1); + srcNwref = GET_U_1(bp); + dstNwref = GET_U_1(bp + 1); length -= 2; bp += 2; diff --git a/print-carp.c b/print-carp.c index 4d46c97a..6ce70566 100644 --- a/print-carp.c +++ b/print-carp.c @@ -53,8 +53,8 @@ carp_print(netdissect_options *ndo, const u_char *bp, u_int len, u_int ttl) ndo->ndo_protocol = "carp"; ND_TCHECK_1(bp); - version = (EXTRACT_U_1(bp) & 0xf0) >> 4; - type = EXTRACT_U_1(bp) & 0x0f; + version = (GET_U_1(bp) & 0xf0) >> 4; + type = GET_U_1(bp) & 0x0f; if (type == 1) type_s = "advertise"; else @@ -67,16 +67,17 @@ carp_print(netdissect_options *ndo, const u_char *bp, u_int len, u_int ttl) ND_TCHECK_1(bp + 2); ND_TCHECK_1(bp + 5); ND_PRINT("vhid=%u advbase=%u advskew=%u authlen=%u ", - EXTRACT_U_1(bp + 1), EXTRACT_U_1(bp + 5), EXTRACT_U_1(bp + 2), EXTRACT_U_1(bp + 3)); + GET_U_1(bp + 1), GET_U_1(bp + 5), GET_U_1(bp + 2), + GET_U_1(bp + 3)); if (ndo->ndo_vflag) { struct cksum_vec vec[1]; vec[0].ptr = (const uint8_t *)bp; vec[0].len = len; if (ND_TTEST_LEN(bp, len) && in_cksum(vec, 1)) ND_PRINT(" (bad carp cksum %x!)", - EXTRACT_BE_U_2(bp + 6)); + GET_BE_U_2(bp + 6)); } - ND_PRINT("counter=%" PRIu64, EXTRACT_BE_U_8(bp + 8)); + ND_PRINT("counter=%" PRIu64, GET_BE_U_8(bp + 8)); return; trunc: diff --git a/print-cdp.c b/print-cdp.c index 0efa0b49..fede229d 100644 --- a/print-cdp.c +++ b/print-cdp.c @@ -105,16 +105,19 @@ cdp_print(netdissect_options *ndo, tptr = pptr; /* temporary pointer */ ND_TCHECK_LEN(tptr, CDP_HEADER_LEN); - ND_PRINT("CDPv%u, ttl: %us", EXTRACT_U_1((tptr + CDP_HEADER_VERSION_OFFSET)), - EXTRACT_U_1(tptr + CDP_HEADER_TTL_OFFSET)); + ND_PRINT("CDPv%u, ttl: %us", + GET_U_1((tptr + CDP_HEADER_VERSION_OFFSET)), + GET_U_1(tptr + CDP_HEADER_TTL_OFFSET)); if (ndo->ndo_vflag) - ND_PRINT(", checksum: 0x%04x (unverified), length %u", EXTRACT_BE_U_2(tptr + CDP_HEADER_CHECKSUM_OFFSET), length); + ND_PRINT(", checksum: 0x%04x (unverified), length %u", + GET_BE_U_2(tptr + CDP_HEADER_CHECKSUM_OFFSET), + length); tptr += CDP_HEADER_LEN; while (tptr < (pptr+length)) { ND_TCHECK_LEN(tptr, CDP_TLV_HEADER_LEN); /* read out Type and 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 */ + type = GET_BE_U_2(tptr + CDP_TLV_TYPE_OFFSET); + len = GET_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("\n\t%s (0x%02x), TLV length: %u byte%s (too short)", @@ -164,13 +167,13 @@ cdp_print(netdissect_options *ndo, if (len < 4) goto trunc; ND_PRINT("(0x%08x): %s", - EXTRACT_BE_U_4(tptr), - bittok2str(cdp_capability_values, "none", EXTRACT_BE_U_4(tptr))); + GET_BE_U_4(tptr), + bittok2str(cdp_capability_values, "none", GET_BE_U_4(tptr))); break; case 0x05: /* Version */ ND_PRINT("\n\t "); for (i=0;i<len;i++) { - j = EXTRACT_U_1(tptr + i); + j = GET_U_1(tptr + i); if (j == '\n') /* lets rework the version string to get a nice indentation */ ND_PRINT("\n\t "); @@ -197,12 +200,12 @@ cdp_print(netdissect_options *ndo, case 0x0a: /* Native VLAN ID - CDPv2 */ if (len < 2) goto trunc; - ND_PRINT("%u", EXTRACT_BE_U_2(tptr)); + ND_PRINT("%u", GET_BE_U_2(tptr)); break; case 0x0b: /* Duplex - CDPv2 */ if (len < 1) goto trunc; - ND_PRINT("%s", EXTRACT_U_1(tptr) ? "full": "half"); + ND_PRINT("%s", GET_U_1(tptr) ? "full": "half"); break; /* http://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cata/186/2_12_m/english/release/notes/186rn21m.html @@ -220,15 +223,17 @@ cdp_print(netdissect_options *ndo, case 0x0e: /* ATA-186 VoIP VLAN assignment - incomplete doc. */ if (len < 3) goto trunc; - ND_PRINT("app %u, vlan %u", EXTRACT_U_1(tptr), EXTRACT_BE_U_2(tptr + 1)); + ND_PRINT("app %u, vlan %u", GET_U_1(tptr), + GET_BE_U_2(tptr + 1)); break; case 0x0f: /* ATA-186 VoIP VLAN request - incomplete doc. */ if (len < 2) goto trunc; if (len == 2) - ND_PRINT("unknown 0x%04x", EXTRACT_BE_U_2(tptr)); + ND_PRINT("unknown 0x%04x", GET_BE_U_2(tptr)); else - ND_PRINT("app %u, vlan %u", EXTRACT_U_1(tptr), EXTRACT_BE_U_2(tptr + 1)); + ND_PRINT("app %u, vlan %u", GET_U_1(tptr), + GET_BE_U_2(tptr + 1)); break; case 0x10: /* Power - not documented */ ND_PRINT("%1.2fW", cdp_get_number(ndo, tptr, len) / 1000.0); @@ -236,17 +241,17 @@ cdp_print(netdissect_options *ndo, case 0x11: /* MTU - not documented */ if (len < 4) goto trunc; - ND_PRINT("%u bytes", EXTRACT_BE_U_4(tptr)); + ND_PRINT("%u bytes", GET_BE_U_4(tptr)); break; case 0x12: /* AVVID trust bitmap - not documented */ if (len < 1) goto trunc; - ND_PRINT("0x%02x", EXTRACT_U_1(tptr)); + ND_PRINT("0x%02x", GET_U_1(tptr)); break; case 0x13: /* AVVID untrusted port CoS - not documented */ if (len < 1) goto trunc; - ND_PRINT("0x%02x", EXTRACT_U_1(tptr)); + ND_PRINT("0x%02x", GET_U_1(tptr)); break; case 0x14: /* System Name - not documented */ ND_PRINT("'"); @@ -260,7 +265,7 @@ cdp_print(netdissect_options *ndo, case 0x17: /* Physical Location - not documented */ if (len < 1) goto trunc; - ND_PRINT("0x%02x", EXTRACT_U_1(tptr)); + ND_PRINT("0x%02x", GET_U_1(tptr)); if (len > 1) { ND_PRINT("/"); (void)nd_printn(ndo, tptr + 1, len - 1, NULL); @@ -305,23 +310,23 @@ cdp_print_addr(netdissect_options *ndo, ND_TCHECK_4(p); if (p + 4 > endp) goto trunc; - num = EXTRACT_BE_U_4(p); + num = GET_BE_U_4(p); p += 4; while (p < endp && num != 0) { ND_TCHECK_2(p); if (p + 2 > endp) goto trunc; - pt = EXTRACT_U_1(p); /* type of "protocol" field */ - pl = EXTRACT_U_1(p + 1); /* length of "protocol" field */ + pt = GET_U_1(p); /* type of "protocol" field */ + pl = GET_U_1(p + 1); /* length of "protocol" field */ p += 2; ND_TCHECK_2(p + pl); if (p + pl + 2 > endp) goto trunc; - al = EXTRACT_BE_U_2(p + pl); /* address length */ + al = GET_BE_U_2(p + pl); /* address length */ - if (pt == PT_NLPID && pl == 1 && EXTRACT_U_1(p) == NLPID_IP && + if (pt == PT_NLPID && pl == 1 && GET_U_1(p) == NLPID_IP && al == 4) { /* * IPv4: protocol type = NLPID, protocol length = 1 @@ -359,9 +364,10 @@ cdp_print_addr(netdissect_options *ndo, ND_TCHECK_LEN(p, pl); if (p + pl > endp) goto trunc; - ND_PRINT("pt=0x%02x, pl=%u, pb=", EXTRACT_U_1((p - 2)), pl); + ND_PRINT("pt=0x%02x, pl=%u, pb=", GET_U_1((p - 2)), + pl); while (pl != 0) { - ND_PRINT(" %02x", EXTRACT_U_1(p)); + ND_PRINT(" %02x", GET_U_1(p)); p++; pl--; } @@ -374,7 +380,7 @@ cdp_print_addr(netdissect_options *ndo, if (p + al > endp) goto trunc; while (al != 0) { - ND_PRINT(" %02x", EXTRACT_U_1(p)); + ND_PRINT(" %02x", GET_U_1(p)); p++; al--; } @@ -402,8 +408,8 @@ cdp_print_prefixes(netdissect_options *ndo, while (l > 0) { ND_PRINT(" %u.%u.%u.%u/%u", - EXTRACT_U_1(p), EXTRACT_U_1(p + 1), EXTRACT_U_1(p + 2), - EXTRACT_U_1(p + 3), EXTRACT_U_1(p + 4)); + GET_U_1(p), GET_U_1(p + 1), GET_U_1(p + 2), + GET_U_1(p + 3), GET_U_1(p + 4)); l -= 5; p += 5; } @@ -423,7 +429,7 @@ cdp_get_number(netdissect_options *ndo, const u_char * p, u_int l) unsigned int res=0; while( l>0 ) { - res = (res<<8) + EXTRACT_U_1(p); + res = (res<<8) + GET_U_1(p); p++; l--; } return res; diff --git a/print-cfm.c b/print-cfm.c index 45608256..971c9600 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_U_1(tptr); + network_addr_type = GET_U_1(tptr); ND_PRINT("\n\t Network Address Type %s (%u)", tok2str(af_values, "Unknown", network_addr_type), network_addr_type); @@ -301,14 +301,14 @@ cfm_print(netdissect_options *ndo, /* * Sanity checking of the header. */ - mdlevel_version = EXTRACT_U_1(cfm_common_header->mdlevel_version); + mdlevel_version = GET_U_1(cfm_common_header->mdlevel_version); if (CFM_EXTRACT_VERSION(mdlevel_version) != CFM_VERSION) { ND_PRINT("CFMv%u not supported, length %u", CFM_EXTRACT_VERSION(mdlevel_version), length); return; } - opcode = EXTRACT_U_1(cfm_common_header->opcode); + opcode = GET_U_1(cfm_common_header->opcode); ND_PRINT("CFMv%u %s, MD Level %u, length %u", CFM_EXTRACT_VERSION(mdlevel_version), tok2str(cfm_opcode_values, "unknown (%u)", opcode), @@ -322,8 +322,8 @@ cfm_print(netdissect_options *ndo, return; } - flags = EXTRACT_U_1(cfm_common_header->flags); - first_tlv_offset = EXTRACT_U_1(cfm_common_header->first_tlv_offset); + flags = GET_U_1(cfm_common_header->flags); + first_tlv_offset = GET_U_1(cfm_common_header->first_tlv_offset); ND_PRINT("\n\tFirst TLV offset %u", first_tlv_offset); tptr += sizeof(struct cfm_common_header_t); @@ -367,8 +367,8 @@ cfm_print(netdissect_options *ndo, } ND_PRINT("\n\t Sequence Number 0x%08x, MA-End-Point-ID 0x%04x", - EXTRACT_BE_U_4(msg_ptr.cfm_ccm->sequence), - EXTRACT_BE_U_2(msg_ptr.cfm_ccm->ma_epi)); + GET_BE_U_4(msg_ptr.cfm_ccm->sequence), + GET_BE_U_2(msg_ptr.cfm_ccm->ma_epi)); namesp = msg_ptr.cfm_ccm->names; names_data_remaining = sizeof(msg_ptr.cfm_ccm->names); @@ -376,11 +376,11 @@ cfm_print(netdissect_options *ndo, /* * Resolve the MD fields. */ - md_nameformat = EXTRACT_U_1(namesp); + md_nameformat = GET_U_1(namesp); namesp++; names_data_remaining--; /* We know this is != 0 */ if (md_nameformat != CFM_CCM_MD_FORMAT_NONE) { - md_namelength = EXTRACT_U_1(namesp); + md_namelength = GET_U_1(namesp); namesp++; names_data_remaining--; /* We know this is !=0 */ ND_PRINT("\n\t MD Name Format %s (%u), MD Name length %u", @@ -434,10 +434,10 @@ cfm_print(netdissect_options *ndo, /* * Resolve the MA fields. */ - ma_nameformat = EXTRACT_U_1(namesp); + ma_nameformat = GET_U_1(namesp); namesp++; names_data_remaining--; /* We know this is != 0 */ - ma_namelength = EXTRACT_U_1(namesp); + ma_namelength = GET_U_1(namesp); namesp++; names_data_remaining--; /* We know this is != 0 */ ND_PRINT("\n\t MA Name-Format %s (%u), MA name length %u", @@ -483,8 +483,8 @@ cfm_print(netdissect_options *ndo, bittok2str(cfm_ltm_flag_values, "none", flags)); ND_PRINT("\n\t Transaction-ID 0x%08x, ttl %u", - EXTRACT_BE_U_4(msg_ptr.cfm_ltm->transaction_id), - EXTRACT_U_1(msg_ptr.cfm_ltm->ttl)); + GET_BE_U_4(msg_ptr.cfm_ltm->transaction_id), + GET_U_1(msg_ptr.cfm_ltm->ttl)); ND_PRINT("\n\t Original-MAC %s, Target-MAC %s", etheraddr_string(ndo, msg_ptr.cfm_ltm->original_mac), @@ -506,14 +506,14 @@ cfm_print(netdissect_options *ndo, bittok2str(cfm_ltr_flag_values, "none", flags)); ND_PRINT("\n\t Transaction-ID 0x%08x, ttl %u", - EXTRACT_BE_U_4(msg_ptr.cfm_ltr->transaction_id), - EXTRACT_U_1(msg_ptr.cfm_ltr->ttl)); + GET_BE_U_4(msg_ptr.cfm_ltr->transaction_id), + GET_U_1(msg_ptr.cfm_ltr->ttl)); ND_PRINT("\n\t Replay-Action %s (%u)", tok2str(cfm_ltr_replay_action_values, "Unknown", - EXTRACT_U_1(msg_ptr.cfm_ltr->replay_action)), - EXTRACT_U_1(msg_ptr.cfm_ltr->replay_action)); + GET_U_1(msg_ptr.cfm_ltr->replay_action)), + GET_U_1(msg_ptr.cfm_ltr->replay_action)); break; /* @@ -536,7 +536,7 @@ cfm_print(netdissect_options *ndo, /* Enough to read the tlv type ? */ ND_TCHECK_1(cfm_tlv_header->type); - cfm_tlv_type = EXTRACT_U_1(cfm_tlv_header->type); + cfm_tlv_type = GET_U_1(cfm_tlv_header->type); ND_PRINT("\n\t%s TLV (0x%02x)", tok2str(cfm_tlv_values, "Unknown", cfm_tlv_type), @@ -551,7 +551,7 @@ cfm_print(netdissect_options *ndo, if (tlen < sizeof(struct cfm_tlv_header_t)) goto tooshort; ND_TCHECK_LEN(tptr, sizeof(struct cfm_tlv_header_t)); - cfm_tlv_len=EXTRACT_BE_U_2(cfm_tlv_header->length); + cfm_tlv_len=GET_BE_U_2(cfm_tlv_header->length); ND_PRINT(", length %u", cfm_tlv_len); @@ -572,8 +572,8 @@ cfm_print(netdissect_options *ndo, return; } ND_PRINT(", Status: %s (%u)", - tok2str(cfm_tlv_port_status_values, "Unknown", EXTRACT_U_1(tptr)), - EXTRACT_U_1(tptr)); + tok2str(cfm_tlv_port_status_values, "Unknown", GET_U_1(tptr)), + GET_U_1(tptr)); break; case CFM_TLV_INTERFACE_STATUS: @@ -582,8 +582,8 @@ cfm_print(netdissect_options *ndo, return; } ND_PRINT(", Status: %s (%u)", - tok2str(cfm_tlv_interface_status_values, "Unknown", EXTRACT_U_1(tptr)), - EXTRACT_U_1(tptr)); + tok2str(cfm_tlv_interface_status_values, "Unknown", GET_U_1(tptr)), + GET_U_1(tptr)); break; case CFM_TLV_PRIVATE: @@ -592,9 +592,9 @@ cfm_print(netdissect_options *ndo, return; } ND_PRINT(", Vendor: %s (%u), Sub-Type %u", - tok2str(oui_values,"Unknown", EXTRACT_BE_U_3(tptr)), - EXTRACT_BE_U_3(tptr), - EXTRACT_U_1(tptr + 3)); + tok2str(oui_values,"Unknown", GET_BE_U_3(tptr)), + GET_BE_U_3(tptr), + GET_U_1(tptr + 3)); hexdump = TRUE; break; @@ -612,7 +612,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_U_1(tptr); + chassis_id_length = GET_U_1(tptr); tptr++; tlen--; cfm_tlv_len--; @@ -627,7 +627,7 @@ cfm_print(netdissect_options *ndo, ND_PRINT("\n\t (TLV too short)"); goto next_tlv; } - chassis_id_type = EXTRACT_U_1(tptr); + chassis_id_type = GET_U_1(tptr); cfm_tlv_len--; ND_PRINT("\n\t Chassis-ID Type %s (%u), Chassis-ID length %u", tok2str(cfm_tlv_senderid_chassisid_values, @@ -686,7 +686,7 @@ cfm_print(netdissect_options *ndo, } /* Here mgmt_addr_length stands for the management domain length. */ - mgmt_addr_length = EXTRACT_U_1(tptr); + mgmt_addr_length = GET_U_1(tptr); tptr++; tlen--; cfm_tlv_len--; @@ -716,7 +716,7 @@ cfm_print(netdissect_options *ndo, } /* Here mgmt_addr_length stands for the management address length. */ - mgmt_addr_length = EXTRACT_U_1(tptr); + mgmt_addr_length = GET_U_1(tptr); tptr++; tlen--; cfm_tlv_len--; diff --git a/print-chdlc.c b/print-chdlc.c index bd3133bb..6659f9df 100644 --- a/print-chdlc.c +++ b/print-chdlc.c @@ -61,10 +61,10 @@ chdlc_print(netdissect_options *ndo, const u_char *p, u_int length) if (length < CHDLC_HDRLEN) goto trunc; ND_TCHECK_LEN(p, CHDLC_HDRLEN); - proto = EXTRACT_BE_U_2(p + 2); + proto = GET_BE_U_2(p + 2); if (ndo->ndo_eflag) { ND_PRINT("%s, ethertype %s (0x%04x), length %u: ", - tok2str(chdlc_cast_values, "0x%02x", EXTRACT_U_1(p)), + tok2str(chdlc_cast_values, "0x%02x", GET_U_1(p)), tok2str(ethertype_values, "Unknown", proto), proto, length); @@ -97,9 +97,9 @@ chdlc_print(netdissect_options *ndo, const u_char *p, u_int length) if (length < 2) goto trunc; ND_TCHECK_2(p); - if (EXTRACT_U_1(p + 1) == NLPID_CLNP || - EXTRACT_U_1(p + 1) == NLPID_ESIS || - EXTRACT_U_1(p + 1) == NLPID_ISIS) + if (GET_U_1(p + 1) == NLPID_CLNP || + GET_U_1(p + 1) == NLPID_ESIS || + GET_U_1(p + 1) == NLPID_ISIS) isoclns_print(ndo, p + 1, length - 1); else isoclns_print(ndo, p, length); @@ -154,7 +154,7 @@ chdlc_slarp_print(netdissect_options *ndo, const u_char *cp, u_int length) slarp = (const struct cisco_slarp *)cp; ND_TCHECK_LEN(slarp, SLARP_MIN_LEN); - switch (EXTRACT_BE_U_4(slarp->code)) { + switch (GET_BE_U_4(slarp->code)) { case SLARP_REQUEST: ND_PRINT("request"); /* @@ -174,14 +174,14 @@ chdlc_slarp_print(netdissect_options *ndo, const u_char *cp, u_int length) break; case SLARP_KEEPALIVE: ND_PRINT("keepalive: mineseen=0x%08x, yourseen=0x%08x, reliability=0x%04x", - EXTRACT_BE_U_4(slarp->un.keep.myseq), - EXTRACT_BE_U_4(slarp->un.keep.yourseq), - EXTRACT_BE_U_2(slarp->un.keep.rel)); + GET_BE_U_4(slarp->un.keep.myseq), + GET_BE_U_4(slarp->un.keep.yourseq), + GET_BE_U_2(slarp->un.keep.rel)); if (length >= SLARP_MAX_LEN) { /* uptime-stamp is optional */ cp += SLARP_MIN_LEN; ND_TCHECK_4(cp); - sec = EXTRACT_BE_U_4(cp) / 1000; + sec = GET_BE_U_4(cp) / 1000; min = sec / 60; sec -= min * 60; hrs = min / 60; min -= hrs * 60; days = hrs / 24; hrs -= days * 24; @@ -189,7 +189,7 @@ chdlc_slarp_print(netdissect_options *ndo, const u_char *cp, u_int length) } break; default: - ND_PRINT("0x%02x unknown", EXTRACT_BE_U_4(slarp->code)); + ND_PRINT("0x%02x unknown", GET_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 b06e27f0..0ce51144 100644 --- a/print-cnfp.c +++ b/print-cnfp.c @@ -169,21 +169,21 @@ cnfp_v1_print(netdissect_options *ndo, const u_char *cp) nh = (const struct nfhdr_v1 *)cp; ND_TCHECK_SIZE(nh); - ver = EXTRACT_BE_U_2(nh->version); - nrecs = EXTRACT_BE_U_4(nh->count); + ver = GET_BE_U_2(nh->version); + nrecs = GET_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_BE_U_4(nh->utc_sec); + t = GET_BE_U_4(nh->utc_sec); #endif ND_PRINT("NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver, - 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)); + GET_BE_U_4(nh->msys_uptime)/1000, + GET_BE_U_4(nh->msys_uptime)%1000, + GET_BE_U_4(nh->utc_sec), GET_BE_U_4(nh->utc_nsec)); nr = (const struct nfrec_v1 *)&nh[1]; @@ -198,26 +198,26 @@ cnfp_v1_print(netdissect_options *ndo, const u_char *cp) */ ND_TCHECK_SIZE(nr); ND_PRINT("\n started %u.%03u, last %u.%03u", - 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); + GET_BE_U_4(nr->start_time)/1000, + GET_BE_U_4(nr->start_time)%1000, + GET_BE_U_4(nr->last_time)/1000, + GET_BE_U_4(nr->last_time)%1000); asbuf[0] = buf[0] = '\0'; ND_PRINT("\n %s%s%s:%u ", - intoa(EXTRACT_IPV4_TO_NETWORK_ORDER(nr->src_ina)), + intoa(GET_IPV4_TO_NETWORK_ORDER(nr->src_ina)), buf, asbuf, - EXTRACT_BE_U_2(nr->srcport)); + GET_BE_U_2(nr->srcport)); ND_PRINT("> %s%s%s:%u ", - intoa(EXTRACT_IPV4_TO_NETWORK_ORDER(nr->dst_ina)), + intoa(GET_IPV4_TO_NETWORK_ORDER(nr->dst_ina)), buf, asbuf, - EXTRACT_BE_U_2(nr->dstport)); + GET_BE_U_2(nr->dstport)); ND_PRINT(">> %s\n ", - intoa(EXTRACT_IPV4_TO_NETWORK_ORDER(nr->nhop_ina))); + intoa(GET_IPV4_TO_NETWORK_ORDER(nr->nhop_ina))); - proto = EXTRACT_U_1(nr->proto); + proto = GET_U_1(nr->proto); if (!ndo->ndo_nflag && (p_name = netdb_protoname(proto)) != NULL) ND_PRINT("%s ", p_name); else @@ -226,7 +226,7 @@ cnfp_v1_print(netdissect_options *ndo, const u_char *cp) /* tcp flags for tcp only */ if (proto == IPPROTO_TCP) { u_int flags; - flags = EXTRACT_U_1(nr->tcp_flags); + flags = GET_U_1(nr->tcp_flags); ND_PRINT("%s%s%s%s%s%s%s", flags & TH_FIN ? "F" : "", flags & TH_SYN ? "S" : "", @@ -239,9 +239,9 @@ cnfp_v1_print(netdissect_options *ndo, const u_char *cp) buf[0]='\0'; ND_PRINT("tos %u, %u (%u octets) %s", - EXTRACT_U_1(nr->tos), - EXTRACT_BE_U_4(nr->packets), - EXTRACT_BE_U_4(nr->octets), buf); + GET_U_1(nr->tos), + GET_BE_U_4(nr->packets), + GET_BE_U_4(nr->octets), buf); } return; @@ -265,23 +265,23 @@ cnfp_v5_print(netdissect_options *ndo, const u_char *cp) nh = (const struct nfhdr_v5 *)cp; ND_TCHECK_SIZE(nh); - ver = EXTRACT_BE_U_2(nh->version); - nrecs = EXTRACT_BE_U_4(nh->count); + ver = GET_BE_U_2(nh->version); + nrecs = GET_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_BE_U_4(nh->utc_sec); + t = GET_BE_U_4(nh->utc_sec); #endif ND_PRINT("NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver, - 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)); + GET_BE_U_4(nh->msys_uptime)/1000, + GET_BE_U_4(nh->msys_uptime)%1000, + GET_BE_U_4(nh->utc_sec), GET_BE_U_4(nh->utc_nsec)); - ND_PRINT("#%u, ", EXTRACT_BE_U_4(nh->sequence)); + ND_PRINT("#%u, ", GET_BE_U_4(nh->sequence)); nr = (const struct nfrec_v5 *)&nh[1]; ND_PRINT("%2u recs", nrecs); @@ -295,32 +295,32 @@ cnfp_v5_print(netdissect_options *ndo, const u_char *cp) */ ND_TCHECK_SIZE(nr); ND_PRINT("\n started %u.%03u, last %u.%03u", - 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); + GET_BE_U_4(nr->start_time)/1000, + GET_BE_U_4(nr->start_time)%1000, + GET_BE_U_4(nr->last_time)/1000, + GET_BE_U_4(nr->last_time)%1000); asbuf[0] = buf[0] = '\0'; - nd_snprintf(buf, sizeof(buf), "/%u", EXTRACT_U_1(nr->src_mask)); + nd_snprintf(buf, sizeof(buf), "/%u", GET_U_1(nr->src_mask)); nd_snprintf(asbuf, sizeof(asbuf), ":%u", - EXTRACT_BE_U_2(nr->src_as)); + GET_BE_U_2(nr->src_as)); ND_PRINT("\n %s%s%s:%u ", - intoa(EXTRACT_IPV4_TO_NETWORK_ORDER(nr->src_ina)), + intoa(GET_IPV4_TO_NETWORK_ORDER(nr->src_ina)), buf, asbuf, - EXTRACT_BE_U_2(nr->srcport)); + GET_BE_U_2(nr->srcport)); - nd_snprintf(buf, sizeof(buf), "/%u", EXTRACT_U_1(nr->dst_mask)); + nd_snprintf(buf, sizeof(buf), "/%u", GET_U_1(nr->dst_mask)); nd_snprintf(asbuf, sizeof(asbuf), ":%u", - EXTRACT_BE_U_2(nr->dst_as)); + GET_BE_U_2(nr->dst_as)); ND_PRINT("> %s%s%s:%u ", - intoa(EXTRACT_IPV4_TO_NETWORK_ORDER(nr->dst_ina)), + intoa(GET_IPV4_TO_NETWORK_ORDER(nr->dst_ina)), buf, asbuf, - EXTRACT_BE_U_2(nr->dstport)); + GET_BE_U_2(nr->dstport)); ND_PRINT(">> %s\n ", - intoa(EXTRACT_IPV4_TO_NETWORK_ORDER(nr->nhop_ina))); + intoa(GET_IPV4_TO_NETWORK_ORDER(nr->nhop_ina))); - proto = EXTRACT_U_1(nr->proto); + proto = GET_U_1(nr->proto); if (!ndo->ndo_nflag && (p_name = netdb_protoname(proto)) != NULL) ND_PRINT("%s ", p_name); else @@ -329,7 +329,7 @@ cnfp_v5_print(netdissect_options *ndo, const u_char *cp) /* tcp flags for tcp only */ if (proto == IPPROTO_TCP) { u_int flags; - flags = EXTRACT_U_1(nr->tcp_flags); + flags = GET_U_1(nr->tcp_flags); ND_PRINT("%s%s%s%s%s%s%s", flags & TH_FIN ? "F" : "", flags & TH_SYN ? "S" : "", @@ -342,9 +342,9 @@ cnfp_v5_print(netdissect_options *ndo, const u_char *cp) buf[0]='\0'; ND_PRINT("tos %u, %u (%u octets) %s", - EXTRACT_U_1(nr->tos), - EXTRACT_BE_U_4(nr->packets), - EXTRACT_BE_U_4(nr->octets), buf); + GET_U_1(nr->tos), + GET_BE_U_4(nr->packets), + GET_BE_U_4(nr->octets), buf); } return; @@ -368,23 +368,23 @@ cnfp_v6_print(netdissect_options *ndo, const u_char *cp) nh = (const struct nfhdr_v6 *)cp; ND_TCHECK_SIZE(nh); - ver = EXTRACT_BE_U_2(nh->version); - nrecs = EXTRACT_BE_U_4(nh->count); + ver = GET_BE_U_2(nh->version); + nrecs = GET_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_BE_U_4(nh->utc_sec); + t = GET_BE_U_4(nh->utc_sec); #endif ND_PRINT("NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver, - 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)); + GET_BE_U_4(nh->msys_uptime)/1000, + GET_BE_U_4(nh->msys_uptime)%1000, + GET_BE_U_4(nh->utc_sec), GET_BE_U_4(nh->utc_nsec)); - ND_PRINT("#%u, ", EXTRACT_BE_U_4(nh->sequence)); + ND_PRINT("#%u, ", GET_BE_U_4(nh->sequence)); nr = (const struct nfrec_v6 *)&nh[1]; ND_PRINT("%2u recs", nrecs); @@ -398,32 +398,32 @@ cnfp_v6_print(netdissect_options *ndo, const u_char *cp) */ ND_TCHECK_SIZE(nr); ND_PRINT("\n started %u.%03u, last %u.%03u", - 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); + GET_BE_U_4(nr->start_time)/1000, + GET_BE_U_4(nr->start_time)%1000, + GET_BE_U_4(nr->last_time)/1000, + GET_BE_U_4(nr->last_time)%1000); asbuf[0] = buf[0] = '\0'; - nd_snprintf(buf, sizeof(buf), "/%u", EXTRACT_U_1(nr->src_mask)); + nd_snprintf(buf, sizeof(buf), "/%u", GET_U_1(nr->src_mask)); nd_snprintf(asbuf, sizeof(asbuf), ":%u", - EXTRACT_BE_U_2(nr->src_as)); + GET_BE_U_2(nr->src_as)); ND_PRINT("\n %s%s%s:%u ", - intoa(EXTRACT_IPV4_TO_NETWORK_ORDER(nr->src_ina)), + intoa(GET_IPV4_TO_NETWORK_ORDER(nr->src_ina)), buf, asbuf, - EXTRACT_BE_U_2(nr->srcport)); + GET_BE_U_2(nr->srcport)); - nd_snprintf(buf, sizeof(buf), "/%u", EXTRACT_U_1(nr->dst_mask)); + nd_snprintf(buf, sizeof(buf), "/%u", GET_U_1(nr->dst_mask)); nd_snprintf(asbuf, sizeof(asbuf), ":%u", - EXTRACT_BE_U_2(nr->dst_as)); + GET_BE_U_2(nr->dst_as)); ND_PRINT("> %s%s%s:%u ", - intoa(EXTRACT_IPV4_TO_NETWORK_ORDER(nr->dst_ina)), + intoa(GET_IPV4_TO_NETWORK_ORDER(nr->dst_ina)), buf, asbuf, - EXTRACT_BE_U_2(nr->dstport)); + GET_BE_U_2(nr->dstport)); ND_PRINT(">> %s\n ", - intoa(EXTRACT_IPV4_TO_NETWORK_ORDER(nr->nhop_ina))); + intoa(GET_IPV4_TO_NETWORK_ORDER(nr->nhop_ina))); - proto = EXTRACT_U_1(nr->proto); + proto = GET_U_1(nr->proto); if (!ndo->ndo_nflag && (p_name = netdb_protoname(proto)) != NULL) ND_PRINT("%s ", p_name); else @@ -432,7 +432,7 @@ cnfp_v6_print(netdissect_options *ndo, const u_char *cp) /* tcp flags for tcp only */ if (proto == IPPROTO_TCP) { u_int flags; - flags = EXTRACT_U_1(nr->tcp_flags); + flags = GET_U_1(nr->tcp_flags); ND_PRINT("%s%s%s%s%s%s%s", flags & TH_FIN ? "F" : "", flags & TH_SYN ? "S" : "", @@ -445,12 +445,12 @@ cnfp_v6_print(netdissect_options *ndo, const u_char *cp) buf[0]='\0'; nd_snprintf(buf, sizeof(buf), "(%u<>%u encaps)", - (EXTRACT_BE_U_2(nr->flags) >> 8) & 0xff, - (EXTRACT_BE_U_2(nr->flags)) & 0xff); + (GET_BE_U_2(nr->flags) >> 8) & 0xff, + (GET_BE_U_2(nr->flags)) & 0xff); ND_PRINT("tos %u, %u (%u octets) %s", - EXTRACT_U_1(nr->tos), - EXTRACT_BE_U_4(nr->packets), - EXTRACT_BE_U_4(nr->octets), buf); + GET_U_1(nr->tos), + GET_BE_U_4(nr->packets), + GET_BE_U_4(nr->octets), buf); } return; @@ -469,7 +469,7 @@ cnfp_print(netdissect_options *ndo, const u_char *cp) */ ndo->ndo_protocol = "cnfp"; ND_TCHECK_2(cp); - ver = EXTRACT_BE_U_2(cp); + ver = GET_BE_U_2(cp); switch (ver) { case 1: diff --git a/print-dccp.c b/print-dccp.c index b1df446a..ae25c00d 100644 --- a/print-dccp.c +++ b/print-dccp.c @@ -78,11 +78,11 @@ struct dccp_hdr_ext { nd_uint48_t dccph_seq; }; -#define DCCPH_CCVAL(dh) ((EXTRACT_U_1((dh)->dccph_ccval_cscov) >> 4) & 0xF) -#define DCCPH_CSCOV(dh) (EXTRACT_U_1((dh)->dccph_ccval_cscov) & 0xF) +#define DCCPH_CCVAL(dh) ((GET_U_1((dh)->dccph_ccval_cscov) >> 4) & 0xF) +#define DCCPH_CSCOV(dh) (GET_U_1((dh)->dccph_ccval_cscov) & 0xF) -#define DCCPH_X(dh) (EXTRACT_U_1((dh)->dccph_xtr) & 1) -#define DCCPH_TYPE(dh) ((EXTRACT_U_1((dh)->dccph_xtr) >> 1) & 0xF) +#define DCCPH_X(dh) (GET_U_1((dh)->dccph_xtr) & 1) +#define DCCPH_TYPE(dh) ((GET_U_1((dh)->dccph_xtr) >> 1) & 0xF) /** * struct dccp_hdr_request - Connection initiation request header @@ -198,7 +198,7 @@ dccp_csum_coverage(netdissect_options *ndo, if (DCCPH_CSCOV(dh) == 0) return len; - cov = (EXTRACT_U_1(dh->dccph_doff) + DCCPH_CSCOV(dh) - 1) * sizeof(uint32_t); + cov = (GET_U_1(dh->dccph_doff) + DCCPH_CSCOV(dh) - 1) * sizeof(uint32_t); return (cov > len)? len : cov; } @@ -231,9 +231,9 @@ dccp_seqno(netdissect_options *ndo, const u_char *bp) if (DCCPH_X(dh) != 0) { const struct dccp_hdr_ext *dhx = (const struct dccp_hdr_ext *)bp; - seqno = EXTRACT_BE_U_6(dhx->dccph_seq); + seqno = GET_BE_U_6(dhx->dccph_seq); } else { - seqno = EXTRACT_BE_U_3(dh->dccph_seq); + seqno = GET_BE_U_3(dh->dccph_seq); } return seqno; @@ -253,10 +253,10 @@ static void dccp_print_ack_no(netdissect_options *ndo, const u_char *bp) if (DCCPH_X(dh) != 0) { ND_TCHECK_8(ackp); - ackno = EXTRACT_BE_U_6(ackp + 2); + ackno = GET_BE_U_6(ackp + 2); } else { ND_TCHECK_4(ackp); - ackno = EXTRACT_BE_U_3(ackp + 1); + ackno = GET_BE_U_3(ackp + 1); } ND_PRINT("(ack=%" PRIu64 ") ", ackno); @@ -313,9 +313,9 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, } ND_TCHECK_LEN(dh, fixed_hdrlen); - sport = EXTRACT_BE_U_2(dh->dccph_sport); - dport = EXTRACT_BE_U_2(dh->dccph_dport); - hlen = EXTRACT_U_1(dh->dccph_doff) * 4; + sport = GET_BE_U_2(dh->dccph_sport); + dport = GET_BE_U_2(dh->dccph_dport); + hlen = GET_U_1(dh->dccph_doff) * 4; if (ip6) { ND_PRINT("%s.%u > %s.%u: ", @@ -347,7 +347,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, if (ndo->ndo_vflag && ND_TTEST_LEN(bp, len)) { uint16_t sum = 0, dccp_sum; - dccp_sum = EXTRACT_BE_U_2(dh->dccph_checksum); + dccp_sum = GET_BE_U_2(dh->dccph_checksum); ND_PRINT("cksum 0x%04x ", dccp_sum); if (IP_V(ip) == 4) sum = dccp_cksum(ndo, ip, dh, len); @@ -378,7 +378,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, ND_TCHECK_SIZE(dhr); ND_PRINT("%s (service=%u) ", tok2str(dccp_pkt_type_str, "", dccph_type), - EXTRACT_BE_U_4(dhr->dccph_req_service)); + GET_BE_U_4(dhr->dccph_req_service)); break; } case DCCP_PKT_RESPONSE: { @@ -394,7 +394,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, ND_TCHECK_SIZE(dhr); ND_PRINT("%s (service=%u) ", tok2str(dccp_pkt_type_str, "", dccph_type), - EXTRACT_BE_U_4(dhr->dccph_resp_service)); + GET_BE_U_4(dhr->dccph_resp_service)); break; } case DCCP_PKT_DATA: @@ -455,7 +455,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, ND_TCHECK_SIZE(dhr); ND_PRINT("%s (code=%s) ", tok2str(dccp_pkt_type_str, "", dccph_type), - dccp_reset_code(EXTRACT_U_1(dhr->dccph_reset_code))); + dccp_reset_code(GET_U_1(dhr->dccph_reset_code))); break; } case DCCP_PKT_SYNC: @@ -544,46 +544,48 @@ dccp_print_option(netdissect_options *ndo, const u_char *option, u_int hlen) ND_TCHECK_1(option); - if (EXTRACT_U_1(option) >= 32) { + if (GET_U_1(option) >= 32) { ND_TCHECK_1(option + 1); - optlen = EXTRACT_U_1(option + 1); + optlen = GET_U_1(option + 1); if (optlen < 2) { - if (EXTRACT_U_1(option) >= 128) - ND_PRINT("CCID option %u optlen too short", EXTRACT_U_1(option)); + if (GET_U_1(option) >= 128) + ND_PRINT("CCID option %u optlen too short", + GET_U_1(option)); else ND_PRINT("%s optlen too short", - tok2str(dccp_option_values, "Option %u", EXTRACT_U_1(option))); + tok2str(dccp_option_values, "Option %u", GET_U_1(option))); return 0; } } else optlen = 1; if (hlen < optlen) { - if (EXTRACT_U_1(option) >= 128) + if (GET_U_1(option) >= 128) ND_PRINT("CCID option %u optlen goes past header length", - EXTRACT_U_1(option)); + GET_U_1(option)); else ND_PRINT("%s optlen goes past header length", - tok2str(dccp_option_values, "Option %u", EXTRACT_U_1(option))); + tok2str(dccp_option_values, "Option %u", GET_U_1(option))); return 0; } ND_TCHECK_LEN(option, optlen); - if (EXTRACT_U_1(option) >= 128) { - ND_PRINT("CCID option %u", EXTRACT_U_1(option)); + if (GET_U_1(option) >= 128) { + ND_PRINT("CCID option %u", GET_U_1(option)); switch (optlen) { case 4: - ND_PRINT(" %u", EXTRACT_BE_U_2(option + 2)); + ND_PRINT(" %u", GET_BE_U_2(option + 2)); break; case 6: - ND_PRINT(" %u", EXTRACT_BE_U_4(option + 2)); + ND_PRINT(" %u", GET_BE_U_4(option + 2)); break; default: break; } } else { - ND_PRINT("%s", tok2str(dccp_option_values, "Option %u", EXTRACT_U_1(option))); - switch (EXTRACT_U_1(option)) { + ND_PRINT("%s", + tok2str(dccp_option_values, "Option %u", GET_U_1(option))); + switch (GET_U_1(option)) { case 32: case 33: case 34: @@ -592,42 +594,48 @@ dccp_print_option(netdissect_options *ndo, const u_char *option, u_int hlen) ND_PRINT(" optlen too short"); return optlen; } - if (EXTRACT_U_1(option + 2) < 10){ - ND_PRINT(" %s", dccp_feature_nums[EXTRACT_U_1(option + 2)]); + if (GET_U_1(option + 2) < 10){ + ND_PRINT(" %s", + dccp_feature_nums[GET_U_1(option + 2)]); for (i = 0; i < optlen - 3; i++) - ND_PRINT(" %u", EXTRACT_U_1(option + 3 + i)); + ND_PRINT(" %u", + GET_U_1(option + 3 + i)); } break; case 36: if (optlen > 2) { ND_PRINT(" 0x"); for (i = 0; i < optlen - 2; i++) - ND_PRINT("%02x", EXTRACT_U_1(option + 2 + i)); + ND_PRINT("%02x", + GET_U_1(option + 2 + i)); } break; case 37: for (i = 0; i < optlen - 2; i++) - ND_PRINT(" %u", EXTRACT_U_1(option + 2 + i)); + ND_PRINT(" %u", GET_U_1(option + 2 + i)); break; case 38: if (optlen > 2) { ND_PRINT(" 0x"); for (i = 0; i < optlen - 2; i++) - ND_PRINT("%02x", EXTRACT_U_1(option + 2 + i)); + ND_PRINT("%02x", + GET_U_1(option + 2 + i)); } break; case 39: if (optlen > 2) { ND_PRINT(" 0x"); for (i = 0; i < optlen - 2; i++) - ND_PRINT("%02x", EXTRACT_U_1(option + 2 + i)); + ND_PRINT("%02x", + GET_U_1(option + 2 + i)); } break; case 40: if (optlen > 2) { ND_PRINT(" 0x"); for (i = 0; i < optlen - 2; i++) - ND_PRINT("%02x", EXTRACT_U_1(option + 2 + i)); + ND_PRINT("%02x", + GET_U_1(option + 2 + i)); } break; case 41: @@ -640,7 +648,7 @@ dccp_print_option(netdissect_options *ndo, const u_char *option, u_int hlen) * Type=41 Length=6 */ if (optlen == 6) - ND_PRINT(" %u", EXTRACT_BE_U_4(option + 2)); + ND_PRINT(" %u", GET_BE_U_4(option + 2)); else ND_PRINT(" [optlen != 6]"); break; @@ -665,15 +673,17 @@ dccp_print_option(netdissect_options *ndo, const u_char *option, u_int hlen) */ switch (optlen) { case 6: - ND_PRINT(" %u", EXTRACT_BE_U_4(option + 2)); + ND_PRINT(" %u", GET_BE_U_4(option + 2)); break; case 8: - ND_PRINT(" %u", EXTRACT_BE_U_4(option + 2)); - ND_PRINT(" (elapsed time %u)", EXTRACT_BE_U_2(option + 6)); + ND_PRINT(" %u", GET_BE_U_4(option + 2)); + ND_PRINT(" (elapsed time %u)", + GET_BE_U_2(option + 6)); break; case 10: - ND_PRINT(" %u", EXTRACT_BE_U_4(option + 2)); - ND_PRINT(" (elapsed time %u)", EXTRACT_BE_U_4(option + 6)); + ND_PRINT(" %u", GET_BE_U_4(option + 2)); + ND_PRINT(" (elapsed time %u)", + GET_BE_U_4(option + 6)); break; default: ND_PRINT(" [optlen != 6 or 8 or 10]"); @@ -682,9 +692,9 @@ dccp_print_option(netdissect_options *ndo, const u_char *option, u_int hlen) break; case 43: if (optlen == 6) - ND_PRINT(" %u", EXTRACT_BE_U_4(option + 2)); + ND_PRINT(" %u", GET_BE_U_4(option + 2)); else if (optlen == 4) - ND_PRINT(" %u", EXTRACT_BE_U_2(option + 2)); + ND_PRINT(" %u", GET_BE_U_2(option + 2)); else ND_PRINT(" [optlen != 4 or 6]"); break; @@ -692,7 +702,8 @@ dccp_print_option(netdissect_options *ndo, const u_char *option, u_int hlen) if (optlen > 2) { ND_PRINT(" "); for (i = 0; i < optlen - 2; i++) - ND_PRINT("%02x", EXTRACT_U_1(option + 2 + i)); + ND_PRINT("%02x", + GET_U_1(option + 2 + i)); } break; } diff --git a/print-decnet.c b/print-decnet.c index 06985d0d..fcb85225 100644 --- a/print-decnet.c +++ b/print-decnet.c @@ -513,7 +513,7 @@ decnet_print(netdissect_options *ndo, } ND_TCHECK_LEN(ap, sizeof(short)); - pktlen = EXTRACT_LE_U_2(ap); + pktlen = GET_LE_U_2(ap); if (pktlen < sizeof(struct shorthdr)) { nd_print_trunc(ndo); return; @@ -526,7 +526,7 @@ decnet_print(netdissect_options *ndo, rhp = (const union routehdr *)(ap + sizeof(short)); ND_TCHECK_1(rhp->rh_short.sh_flags); - mflags = EXTRACT_U_1(rhp->rh_short.sh_flags); + mflags = GET_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_1(rhp->rh_short.sh_flags); - mflags = EXTRACT_U_1(rhp->rh_short.sh_flags); + mflags = GET_U_1(rhp->rh_short.sh_flags); } if (mflags & RMF_FVER) { @@ -567,18 +567,18 @@ decnet_print(netdissect_options *ndo, } ND_TCHECK_SIZE(&rhp->rh_long); dst = - EXTRACT_LE_U_2(rhp->rh_long.lg_dst.dne_remote.dne_nodeaddr); + GET_LE_U_2(rhp->rh_long.lg_dst.dne_remote.dne_nodeaddr); src = - EXTRACT_LE_U_2(rhp->rh_long.lg_src.dne_remote.dne_nodeaddr); - hops = EXTRACT_U_1(rhp->rh_long.lg_visits); + GET_LE_U_2(rhp->rh_long.lg_src.dne_remote.dne_nodeaddr); + hops = GET_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_SIZE(&rhp->rh_short); - 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; + dst = GET_LE_U_2(rhp->rh_short.sh_dst); + src = GET_LE_U_2(rhp->rh_short.sh_src); + hops = (GET_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 */ - u_int mflags = EXTRACT_U_1(rhp->rh_short.sh_flags); + u_int mflags = GET_U_1(rhp->rh_short.sh_flags); const union controlmsg *cmp = (const union controlmsg *)rhp; u_int src, dst, info, blksize, eco, ueco, hello, other, vers; u_int priority; @@ -628,13 +628,13 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct initmsg)) goto trunc; ND_TCHECK_SIZE(&cmp->cm_init); - 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); + src = GET_LE_U_2(cmp->cm_init.in_src); + info = GET_U_1(cmp->cm_init.in_info); + blksize = GET_LE_U_2(cmp->cm_init.in_blksize); + vers = GET_U_1(cmp->cm_init.in_vers); + eco = GET_U_1(cmp->cm_init.in_eco); + ueco = GET_U_1(cmp->cm_init.in_ueco); + hello = GET_LE_U_2(cmp->cm_init.in_hello); print_t_info(ndo, info); ND_PRINT("src %sblksize %u vers %u eco %u ueco %u hello %u", dnaddr_string(ndo, src), blksize, vers, eco, ueco, @@ -646,8 +646,8 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct verifmsg)) goto trunc; ND_TCHECK_SIZE(&cmp->cm_ver); - src = EXTRACT_LE_U_2(cmp->cm_ver.ve_src); - other = EXTRACT_U_1(cmp->cm_ver.ve_fcnval); + src = GET_LE_U_2(cmp->cm_ver.ve_src); + other = GET_U_1(cmp->cm_ver.ve_fcnval); ND_PRINT("src %s fcnval %o", dnaddr_string(ndo, src), other); ret = 1; break; @@ -656,8 +656,8 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct testmsg)) goto trunc; ND_TCHECK_SIZE(&cmp->cm_test); - src = EXTRACT_LE_U_2(cmp->cm_test.te_src); - other = EXTRACT_U_1(cmp->cm_test.te_data); + src = GET_LE_U_2(cmp->cm_test.te_src); + other = GET_U_1(cmp->cm_test.te_data); ND_PRINT("src %s data %o", dnaddr_string(ndo, src), other); ret = 1; break; @@ -666,7 +666,7 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct l1rout)) goto trunc; ND_TCHECK_SIZE(&cmp->cm_l1rou); - src = EXTRACT_LE_U_2(cmp->cm_l1rou.r1_src); + src = GET_LE_U_2(cmp->cm_l1rou.r1_src); ND_PRINT("src %s ", dnaddr_string(ndo, src)); ret = print_l1_routes(ndo, &(rhpx[sizeof(struct l1rout)]), length - sizeof(struct l1rout)); @@ -676,7 +676,7 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct l2rout)) goto trunc; ND_TCHECK_SIZE(&cmp->cm_l2rout); - src = EXTRACT_LE_U_2(cmp->cm_l2rout.r2_src); + src = GET_LE_U_2(cmp->cm_l2rout.r2_src); ND_PRINT("src %s ", dnaddr_string(ndo, src)); ret = print_l2_routes(ndo, &(rhpx[sizeof(struct l2rout)]), length - sizeof(struct l2rout)); @@ -686,15 +686,15 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct rhellomsg)) goto trunc; ND_TCHECK_SIZE(&cmp->cm_rhello); - 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); + vers = GET_U_1(cmp->cm_rhello.rh_vers); + eco = GET_U_1(cmp->cm_rhello.rh_eco); + ueco = GET_U_1(cmp->cm_rhello.rh_ueco); src = - EXTRACT_LE_U_2(cmp->cm_rhello.rh_src.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); + GET_LE_U_2(cmp->cm_rhello.rh_src.dne_remote.dne_nodeaddr); + info = GET_U_1(cmp->cm_rhello.rh_info); + blksize = GET_LE_U_2(cmp->cm_rhello.rh_blksize); + priority = GET_U_1(cmp->cm_rhello.rh_priority); + hello = GET_LE_U_2(cmp->cm_rhello.rh_hello); print_i_info(ndo, info); ND_PRINT("vers %u eco %u ueco %u src %s blksize %u pri %u hello %u", vers, eco, ueco, dnaddr_string(ndo, src), @@ -707,18 +707,18 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct ehellomsg)) goto trunc; ND_TCHECK_SIZE(&cmp->cm_ehello); - 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); + vers = GET_U_1(cmp->cm_ehello.eh_vers); + eco = GET_U_1(cmp->cm_ehello.eh_eco); + ueco = GET_U_1(cmp->cm_ehello.eh_ueco); src = - EXTRACT_LE_U_2(cmp->cm_ehello.eh_src.dne_remote.dne_nodeaddr); - info = EXTRACT_U_1(cmp->cm_ehello.eh_info); - blksize = EXTRACT_LE_U_2(cmp->cm_ehello.eh_blksize); + GET_LE_U_2(cmp->cm_ehello.eh_src.dne_remote.dne_nodeaddr); + info = GET_U_1(cmp->cm_ehello.eh_info); + blksize = GET_LE_U_2(cmp->cm_ehello.eh_blksize); /*seed*/ dst = - EXTRACT_LE_U_2(cmp->cm_ehello.eh_router.dne_remote.dne_nodeaddr); - hello = EXTRACT_LE_U_2(cmp->cm_ehello.eh_hello); - other = EXTRACT_U_1(cmp->cm_ehello.eh_data); + GET_LE_U_2(cmp->cm_ehello.eh_router.dne_remote.dne_nodeaddr); + hello = GET_LE_U_2(cmp->cm_ehello.eh_hello); + other = GET_U_1(cmp->cm_ehello.eh_data); print_i_info(ndo, info); ND_PRINT("vers %u eco %u ueco %u src %s blksize %u rtr %s hello %u data %o", vers, eco, ueco, dnaddr_string(ndo, src), @@ -766,15 +766,15 @@ print_l1_routes(netdissect_options *ndo, /* The last short is a checksum */ while (len > (3 * sizeof(short))) { ND_TCHECK_LEN(rp, 3 * sizeof(short)); - count = EXTRACT_LE_U_2(rp); + count = GET_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_U_2(rp); + id = GET_LE_U_2(rp); rp += sizeof(short); len -= sizeof(short); - info = EXTRACT_LE_U_2(rp); + info = GET_LE_U_2(rp); rp += sizeof(short); len -= sizeof(short); ND_PRINT("{ids %u-%u cost %u hops %u} ", id, id + count, @@ -797,15 +797,15 @@ print_l2_routes(netdissect_options *ndo, /* The last short is a checksum */ while (len > (3 * sizeof(short))) { ND_TCHECK_LEN(rp, 3 * sizeof(short)); - count = EXTRACT_LE_U_2(rp); + count = GET_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_U_2(rp); + area = GET_LE_U_2(rp); rp += sizeof(short); len -= sizeof(short); - info = EXTRACT_LE_U_2(rp); + info = GET_LE_U_2(rp); rp += sizeof(short); len -= sizeof(short); ND_PRINT("{areas %u-%u cost %u hops %u} ", area, area + count, @@ -853,9 +853,9 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct nsphdr)) goto trunc; ND_TCHECK_SIZE(nsphp); - flags = EXTRACT_U_1(nsphp->nh_flags); - dst = EXTRACT_LE_U_2(nsphp->nh_dst); - src = EXTRACT_LE_U_2(nsphp->nh_src); + flags = GET_U_1(nsphp->nh_flags); + dst = GET_LE_U_2(nsphp->nh_dst); + src = GET_LE_U_2(nsphp->nh_src); switch (flags & NSP_TYPEMASK) { case MFT_DATA: @@ -873,7 +873,7 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK_2(shp->sh_seq[0]); - ack = EXTRACT_LE_U_2(shp->sh_seq[0]); + ack = GET_LE_U_2(shp->sh_seq[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) ND_PRINT("nak %u ", ack & SGQ_MASK); @@ -883,7 +883,7 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK_2(shp->sh_seq[1]); - ack = EXTRACT_LE_U_2(shp->sh_seq[1]); + ack = GET_LE_U_2(shp->sh_seq[1]); if (ack & SGQ_OACK) { /* ackoth field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) ND_PRINT("onak %u ", ack & SGQ_MASK); @@ -893,7 +893,7 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK_2(shp->sh_seq[2]); - ack = EXTRACT_LE_U_2(shp->sh_seq[2]); + ack = GET_LE_U_2(shp->sh_seq[2]); } } ND_PRINT("seg %u ", ack & SGQ_MASK); @@ -909,7 +909,7 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK_2(shp->sh_seq[0]); - ack = EXTRACT_LE_U_2(shp->sh_seq[0]); + ack = GET_LE_U_2(shp->sh_seq[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) ND_PRINT("nak %u ", ack & SGQ_MASK); @@ -919,7 +919,7 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK_2(shp->sh_seq[1]); - ack = EXTRACT_LE_U_2(shp->sh_seq[1]); + ack = GET_LE_U_2(shp->sh_seq[1]); if (ack & SGQ_OACK) { /* ackdat field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) ND_PRINT("nakdat %u ", ack & SGQ_MASK); @@ -929,7 +929,7 @@ print_nsp(netdissect_options *ndo, if (nsplen < data_off) goto trunc; ND_TCHECK_2(shp->sh_seq[2]); - ack = EXTRACT_LE_U_2(shp->sh_seq[2]); + ack = GET_LE_U_2(shp->sh_seq[2]); } } ND_PRINT("seg %u ", ack & SGQ_MASK); @@ -947,27 +947,27 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct seghdr) + sizeof(struct lsmsg)) goto trunc; ND_TCHECK_2(shp->sh_seq[0]); - ack = EXTRACT_LE_U_2(shp->sh_seq[0]); + ack = GET_LE_U_2(shp->sh_seq[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) ND_PRINT("nak %u ", ack & SGQ_MASK); else ND_PRINT("ack %u ", ack & SGQ_MASK); ND_TCHECK_2(shp->sh_seq[1]); - ack = EXTRACT_LE_U_2(shp->sh_seq[1]); + ack = GET_LE_U_2(shp->sh_seq[1]); if (ack & SGQ_OACK) { /* ackdat field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) ND_PRINT("nakdat %u ", ack & SGQ_MASK); else ND_PRINT("ackdat %u ", ack & SGQ_MASK); ND_TCHECK_2(shp->sh_seq[2]); - ack = EXTRACT_LE_U_2(shp->sh_seq[2]); + ack = GET_LE_U_2(shp->sh_seq[2]); } } ND_PRINT("seg %u ", ack & SGQ_MASK); ND_TCHECK_SIZE(lsmp); - lsflags = EXTRACT_U_1(lsmp->ls_lsflags); - fcval = EXTRACT_U_1(lsmp->ls_fcval); + lsflags = GET_U_1(lsmp->ls_lsflags); + fcval = GET_U_1(lsmp->ls_fcval); switch (lsflags & LSI_MASK) { case LSI_DATA: ND_PRINT("dat seg count %u ", fcval); @@ -1010,13 +1010,13 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct ackmsg)) goto trunc; ND_TCHECK_SIZE(amp); - ack = EXTRACT_LE_U_2(amp->ak_acknum[0]); + ack = GET_LE_U_2(amp->ak_acknum[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) ND_PRINT("nak %u ", ack & SGQ_MASK); else ND_PRINT("ack %u ", ack & SGQ_MASK); - ack = EXTRACT_LE_U_2(amp->ak_acknum[1]); + ack = GET_LE_U_2(amp->ak_acknum[1]); if (ack & SGQ_OACK) { /* ackoth field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) ND_PRINT("onak %u ", ack & SGQ_MASK); @@ -1035,14 +1035,14 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct ackmsg)) goto trunc; ND_TCHECK_SIZE(amp); - ack = EXTRACT_LE_U_2(amp->ak_acknum[0]); + ack = GET_LE_U_2(amp->ak_acknum[0]); if (ack & SGQ_ACK) { /* acknum field */ if ((ack & SGQ_NAK) == SGQ_NAK) ND_PRINT("nak %u ", ack & SGQ_MASK); else ND_PRINT("ack %u ", ack & SGQ_MASK); ND_TCHECK_2(amp->ak_acknum[1]); - ack = EXTRACT_LE_U_2(amp->ak_acknum[1]); + ack = GET_LE_U_2(amp->ak_acknum[1]); if (ack & SGQ_OACK) { /* ackdat field */ if ((ack & SGQ_ONAK) == SGQ_ONAK) ND_PRINT("nakdat %u ", ack & SGQ_MASK); @@ -1076,9 +1076,9 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct cimsg)) goto trunc; ND_TCHECK_SIZE(cimp); - services = EXTRACT_U_1(cimp->ci_services); - info = EXTRACT_U_1(cimp->ci_info); - segsize = EXTRACT_LE_U_2(cimp->ci_segsize); + services = GET_U_1(cimp->ci_services); + info = GET_U_1(cimp->ci_info); + segsize = GET_LE_U_2(cimp->ci_segsize); switch (services & COS_MASK) { case COS_NONE: @@ -1117,10 +1117,10 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct ccmsg)) goto trunc; ND_TCHECK_SIZE(ccmp); - 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); + services = GET_U_1(ccmp->cc_services); + info = GET_U_1(ccmp->cc_info); + segsize = GET_LE_U_2(ccmp->cc_segsize); + optlen = GET_U_1(ccmp->cc_optlen); switch (services & COS_MASK) { case COS_NONE: @@ -1162,8 +1162,8 @@ print_nsp(netdissect_options *ndo, if (nsplen < sizeof(struct dimsg)) goto trunc; ND_TCHECK_SIZE(dimp); - reason = EXTRACT_LE_U_2(dimp->di_reason); - optlen = EXTRACT_U_1(dimp->di_optlen); + reason = GET_LE_U_2(dimp->di_reason); + optlen = GET_U_1(dimp->di_optlen); print_reason(ndo, reason); if (optlen) { @@ -1178,7 +1178,7 @@ print_nsp(netdissect_options *ndo, u_int reason; ND_TCHECK_SIZE(dcmp); - reason = EXTRACT_LE_U_2(dcmp->dc_reason); + reason = GET_LE_U_2(dcmp->dc_reason); print_reason(ndo, reason); } diff --git a/print-dhcp6.c b/print-dhcp6.c index 5c8f1516..1dd6e4ea 100644 --- a/print-dhcp6.c +++ b/print-dhcp6.c @@ -301,10 +301,10 @@ dhcp6opt_print(netdissect_options *ndo, goto trunc; dh6o = (const struct dhcp6opt *)cp; ND_TCHECK_SIZE(dh6o); - optlen = EXTRACT_BE_U_2(dh6o->dh6opt_len); + optlen = GET_BE_U_2(dh6o->dh6opt_len); if (ep < cp + sizeof(*dh6o) + optlen) goto trunc; - opttype = EXTRACT_BE_U_2(dh6o->dh6opt_type); + opttype = GET_BE_U_2(dh6o->dh6opt_type); ND_PRINT(" (%s", tok2str(dh6opt_str, "opt_%u", opttype)); ND_TCHECK_LEN(cp + sizeof(*dh6o), optlen); switch (opttype) { @@ -316,14 +316,15 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - switch (EXTRACT_BE_U_2(tp)) { + switch (GET_BE_U_2(tp)) { case 1: if (optlen >= 2 + 6) { ND_PRINT(" hwaddr/time type %u time %u ", - EXTRACT_BE_U_2(tp + 2), - EXTRACT_BE_U_4(tp + 4)); + GET_BE_U_2(tp + 2), + GET_BE_U_4(tp + 4)); for (i = 8; i < optlen; i++) - ND_PRINT("%02x", EXTRACT_U_1(tp + i)); + ND_PRINT("%02x", + GET_U_1(tp + i)); /*(*/ ND_PRINT(")"); } else { @@ -335,7 +336,8 @@ dhcp6opt_print(netdissect_options *ndo, if (optlen >= 2 + 8) { ND_PRINT(" vid "); for (i = 2; i < 2 + 8; i++) - ND_PRINT("%02x", EXTRACT_U_1(tp + i)); + ND_PRINT("%02x", + GET_U_1(tp + i)); /*(*/ ND_PRINT(")"); } else { @@ -346,9 +348,10 @@ dhcp6opt_print(netdissect_options *ndo, case 3: if (optlen >= 2 + 2) { ND_PRINT(" hwaddr type %u ", - EXTRACT_BE_U_2(tp + 2)); + GET_BE_U_2(tp + 2)); for (i = 4; i < optlen; i++) - ND_PRINT("%02x", EXTRACT_U_1(tp + i)); + ND_PRINT("%02x", + GET_U_1(tp + i)); /*(*/ ND_PRINT(")"); } else { @@ -357,7 +360,7 @@ dhcp6opt_print(netdissect_options *ndo, } break; default: - ND_PRINT(" type %u)", EXTRACT_BE_U_2(tp)); + ND_PRINT(" type %u)", GET_BE_U_2(tp)); break; } break; @@ -370,8 +373,8 @@ dhcp6opt_print(netdissect_options *ndo, tp = (const u_char *)(dh6o + 1); ND_PRINT(" %s", ip6addr_string(ndo, tp)); ND_PRINT(" pltime:%u vltime:%u", - EXTRACT_BE_U_4(tp + 16), - EXTRACT_BE_U_4(tp + 20)); + GET_BE_U_4(tp + 16), + GET_BE_U_4(tp + 20)); if (optlen > 24) { /* there are sub-options */ dhcp6opt_print(ndo, tp + 24, tp + optlen); @@ -387,7 +390,7 @@ dhcp6opt_print(netdissect_options *ndo, tp = (const u_char *)(dh6o + 1); for (i = 0; i < optlen; i += 2) { ND_PRINT(" %s", - tok2str(dh6opt_str, "opt_%u", EXTRACT_BE_U_2(tp + i))); + tok2str(dh6opt_str, "opt_%u", GET_BE_U_2(tp + i))); } ND_PRINT(")"); break; @@ -397,7 +400,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT(" %u)", EXTRACT_U_1(tp)); + ND_PRINT(" %u)", GET_U_1(tp)); break; case DH6OPT_ELAPSED_TIME: if (optlen != 2) { @@ -405,7 +408,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT(" %u)", EXTRACT_BE_U_2(tp)); + ND_PRINT(" %u)", GET_BE_U_2(tp)); break; case DH6OPT_RELAY_MSG: ND_PRINT(" ("); @@ -419,7 +422,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - auth_proto = EXTRACT_U_1(tp); + auth_proto = GET_U_1(tp); switch (auth_proto) { case DH6OPT_AUTHPROTO_DELAYED: ND_PRINT(" proto: delayed"); @@ -432,7 +435,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp++; - auth_alg = EXTRACT_U_1(tp); + auth_alg = GET_U_1(tp); switch (auth_alg) { case DH6OPT_AUTHALG_HMACMD5: /* XXX: may depend on the protocol */ @@ -443,7 +446,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp++; - auth_rdm = EXTRACT_U_1(tp); + auth_rdm = GET_U_1(tp); switch (auth_rdm) { case DH6OPT_AUTHRDM_MONOCOUNTER: ND_PRINT(", RDM: mono"); @@ -455,7 +458,7 @@ dhcp6opt_print(netdissect_options *ndo, tp++; ND_PRINT(", RD:"); for (i = 0; i < 4; i++, tp += 2) - ND_PRINT(" %04x", EXTRACT_BE_U_2(tp)); + ND_PRINT(" %04x", GET_BE_U_2(tp)); /* protocol dependent part */ authinfolen = optlen - 11; @@ -472,19 +475,19 @@ dhcp6opt_print(netdissect_options *ndo, ND_PRINT(", realm: "); } for (i = 0; i < authrealmlen; i++, tp++) - ND_PRINT("%02x", EXTRACT_U_1(tp)); - ND_PRINT(", key ID: %08x", EXTRACT_BE_U_4(tp)); + ND_PRINT("%02x", GET_U_1(tp)); + ND_PRINT(", key ID: %08x", GET_BE_U_4(tp)); tp += 4; ND_PRINT(", HMAC-MD5:"); for (i = 0; i < 4; i++, tp+= 4) - ND_PRINT(" %08x", EXTRACT_BE_U_4(tp)); + ND_PRINT(" %08x", GET_BE_U_4(tp)); break; case DH6OPT_AUTHPROTO_RECONFIG: if (authinfolen != 17) { ND_PRINT(" ??"); break; } - switch (EXTRACT_U_1(tp)) { + switch (GET_U_1(tp)) { case DH6OPT_AUTHRECONFIG_KEY: ND_PRINT(" reconfig-key"); break; @@ -498,7 +501,7 @@ dhcp6opt_print(netdissect_options *ndo, tp++; ND_PRINT(" value:"); for (i = 0; i < 4; i++, tp+= 4) - ND_PRINT(" %08x", EXTRACT_BE_U_4(tp)); + ND_PRINT(" %08x", GET_BE_U_4(tp)); break; default: ND_PRINT(" ??"); @@ -519,7 +522,7 @@ dhcp6opt_print(netdissect_options *ndo, tp = (const u_char *)(dh6o + 1); ND_PRINT(" "); for (i = 0; i < optlen && i < 10; i++) - ND_PRINT("%02x", EXTRACT_U_1(tp + i)); + ND_PRINT("%02x", GET_U_1(tp + i)); ND_PRINT("...)"); break; case DH6OPT_RECONF_MSG: @@ -528,7 +531,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - dh6_reconf_type = EXTRACT_U_1(tp); + dh6_reconf_type = GET_U_1(tp); switch (dh6_reconf_type) { case DH6_RENEW: ND_PRINT(" for renew)"); @@ -577,7 +580,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT(" %s)", dhcp6stcode(EXTRACT_BE_U_2(tp))); + ND_PRINT(" %s)", dhcp6stcode(GET_BE_U_2(tp))); break; case DH6OPT_IA_NA: case DH6OPT_IA_PD: @@ -587,9 +590,9 @@ dhcp6opt_print(netdissect_options *ndo, } tp = (const u_char *)(dh6o + 1); ND_PRINT(" IAID:%u T1:%u T2:%u", - EXTRACT_BE_U_4(tp), - EXTRACT_BE_U_4(tp + 4), - EXTRACT_BE_U_4(tp + 8)); + GET_BE_U_4(tp), + GET_BE_U_4(tp + 4), + GET_BE_U_4(tp + 8)); if (optlen > 12) { /* there are sub-options */ dhcp6opt_print(ndo, tp + 12, tp + optlen); @@ -602,7 +605,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT(" IAID:%u", EXTRACT_BE_U_4(tp)); + ND_PRINT(" IAID:%u", GET_BE_U_4(tp)); if (optlen > 4) { /* there are sub-options */ dhcp6opt_print(ndo, tp + 4, tp + optlen); @@ -615,10 +618,11 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT(" %s/%u", ip6addr_string(ndo, tp + 9), EXTRACT_U_1(tp + 8)); + ND_PRINT(" %s/%u", ip6addr_string(ndo, tp + 9), + GET_U_1(tp + 8)); ND_PRINT(" pltime:%u vltime:%u", - EXTRACT_BE_U_4(tp), - EXTRACT_BE_U_4(tp + 4)); + GET_BE_U_4(tp), + GET_BE_U_4(tp + 4)); if (optlen > 25) { /* there are sub-options */ dhcp6opt_print(ndo, tp + 25, tp + optlen); @@ -632,7 +636,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT(" %u)", EXTRACT_BE_U_4(tp)); + ND_PRINT(" %u)", GET_BE_U_4(tp)); break; case DH6OPT_REMOTE_ID: if (optlen < 4) { @@ -640,12 +644,12 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT(" %u ", EXTRACT_BE_U_4(tp)); + ND_PRINT(" %u ", GET_BE_U_4(tp)); /* * Print hex dump first 10 characters. */ for (i = 4; i < optlen && i < 14; i++) - ND_PRINT("%02x", EXTRACT_U_1(tp + i)); + ND_PRINT("%02x", GET_U_1(tp + i)); ND_PRINT("...)"); break; case DH6OPT_LQ_QUERY: @@ -654,7 +658,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - dh6_lq_query_type = EXTRACT_U_1(tp); + dh6_lq_query_type = GET_U_1(tp); switch (dh6_lq_query_type) { case 1: ND_PRINT(" by-address"); @@ -692,7 +696,7 @@ dhcp6opt_print(netdissect_options *ndo, * Print hex dump first 10 characters. */ for (i = 16; i < optlen && i < 26; i++) - ND_PRINT("%02x", EXTRACT_U_1(tp + i)); + ND_PRINT("%02x", GET_U_1(tp + i)); ND_PRINT("...)"); break; case DH6OPT_NTP_SERVER: @@ -702,9 +706,9 @@ dhcp6opt_print(netdissect_options *ndo, } tp = (const u_char *)(dh6o + 1); while (tp < cp + sizeof(*dh6o) + optlen - 4) { - subopt_code = EXTRACT_BE_U_2(tp); + subopt_code = GET_BE_U_2(tp); tp += 2; - subopt_len = EXTRACT_BE_U_2(tp); + subopt_len = GET_BE_U_2(tp); tp += 2; if (tp + subopt_len > cp + sizeof(*dh6o) + optlen) goto trunc; @@ -740,14 +744,14 @@ dhcp6opt_print(netdissect_options *ndo, remain_len = optlen; ND_PRINT(" "); /* Encoding is described in section 3.1 of RFC 1035 */ - while (remain_len && EXTRACT_U_1(tp)) { - label_len = EXTRACT_U_1(tp); + while (remain_len && GET_U_1(tp)) { + label_len = GET_U_1(tp); tp++; if (label_len < remain_len - 1) { (void)nd_printn(ndo, tp, label_len, NULL); tp += label_len; remain_len -= (label_len + 1); - if(EXTRACT_U_1(tp)) ND_PRINT("."); + if(GET_U_1(tp)) ND_PRINT("."); } else { ND_PRINT(" ?"); break; @@ -805,7 +809,7 @@ dhcp6_print(netdissect_options *ndo, dh6 = (const struct dhcp6 *)cp; dh6relay = (const struct dhcp6_relay *)cp; ND_TCHECK_4(dh6->dh6_msgtypexid.xid); - msgtype = EXTRACT_U_1(dh6->dh6_msgtypexid.msgtype); + msgtype = GET_U_1(dh6->dh6_msgtypexid.msgtype); name = tok2str(dh6_msgtype_str, "msgtype-%u", msgtype); if (!ndo->ndo_vflag) { @@ -818,7 +822,7 @@ dhcp6_print(netdissect_options *ndo, ND_PRINT(" %s (", name); /*)*/ if (msgtype != DH6_RELAY_FORW && msgtype != DH6_RELAY_REPLY) { ND_PRINT("xid=%x", - EXTRACT_BE_U_4(dh6->dh6_msgtypexid.xid) & DH6_XIDMASK); + GET_BE_U_4(dh6->dh6_msgtypexid.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 cec085be..db8b8f4c 100644 --- a/print-domain.c +++ b/print-domain.c @@ -71,7 +71,7 @@ ns_nskip(netdissect_options *ndo, if (!ND_TTEST_1(cp)) return (NULL); - i = EXTRACT_U_1(cp); + i = GET_U_1(cp); cp++; while (i) { if ((i & INDIR_MASK) == INDIR_MASK) @@ -83,7 +83,7 @@ ns_nskip(netdissect_options *ndo, return(NULL); /* unknown ELT */ if (!ND_TTEST_1(cp)) return (NULL); - if ((bitlen = EXTRACT_U_1(cp)) == 0) + if ((bitlen = GET_U_1(cp)) == 0) bitlen = 256; cp++; bytelen = (bitlen + 7) / 8; @@ -92,7 +92,7 @@ ns_nskip(netdissect_options *ndo, cp += i; if (!ND_TTEST_1(cp)) return (NULL); - i = EXTRACT_U_1(cp); + i = GET_U_1(cp); cp++; } return (cp); @@ -109,7 +109,7 @@ blabel_print(netdissect_options *ndo, if (!ND_TTEST_1(cp)) return(NULL); - if ((bitlen = EXTRACT_U_1(cp)) == 0) + if ((bitlen = GET_U_1(cp)) == 0) bitlen = 256; slen = (bitlen + 3) / 4; lim = cp + 1 + slen; @@ -118,16 +118,16 @@ blabel_print(netdissect_options *ndo, ND_PRINT("\\[x"); for (bitp = cp + 1, b = bitlen; bitp < lim && b > 7; b -= 8, bitp++) { ND_TCHECK_1(bitp); - ND_PRINT("%02x", EXTRACT_U_1(bitp)); + ND_PRINT("%02x", GET_U_1(bitp)); } if (b > 4) { ND_TCHECK_1(bitp); - tc = EXTRACT_U_1(bitp); + tc = GET_U_1(bitp); bitp++; ND_PRINT("%02x", tc & (0xff << (8 - b))); } else if (b > 0) { ND_TCHECK_1(bitp); - tc = EXTRACT_U_1(bitp); + tc = GET_U_1(bitp); bitp++; ND_PRINT("%1x", ((tc >> 4) & 0x0f) & (0x0f << (4 - b))); } @@ -146,7 +146,7 @@ labellen(netdissect_options *ndo, if (!ND_TTEST_1(cp)) return(-1); - i = EXTRACT_U_1(cp); + i = GET_U_1(cp); if ((i & INDIR_MASK) == EDNS0_MASK) { u_int bitlen, elt; if ((elt = (i & ~INDIR_MASK)) != EDNS0_ELT_BITLABEL) { @@ -155,7 +155,7 @@ labellen(netdissect_options *ndo, } if (!ND_TTEST_1(cp + 1)) return(-1); - if ((bitlen = EXTRACT_U_1(cp + 1)) == 0) + if ((bitlen = GET_U_1(cp + 1)) == 0) bitlen = 256; return(((bitlen + 7) / 8) + 1); } else @@ -177,7 +177,7 @@ ns_nprint(netdissect_options *ndo, if (!ND_TTEST_1(cp)) return(NULL); max_offset = (u_int)(cp - bp); - i = EXTRACT_U_1(cp); + i = GET_U_1(cp); cp++; if ((i & INDIR_MASK) != INDIR_MASK) { compress = 0; @@ -193,7 +193,7 @@ ns_nprint(netdissect_options *ndo, } if (!ND_TTEST_1(cp)) return(NULL); - offset = (((i << 8) | EXTRACT_U_1(cp)) & 0x3fff); + offset = (((i << 8) | GET_U_1(cp)) & 0x3fff); /* * This must move backwards in the packet. * No RFC explicitly says that, but BIND's @@ -214,7 +214,7 @@ ns_nprint(netdissect_options *ndo, return(NULL); if (!ND_TTEST_1(cp)) return(NULL); - i = EXTRACT_U_1(cp); + i = GET_U_1(cp); cp++; continue; } @@ -241,7 +241,7 @@ ns_nprint(netdissect_options *ndo, return(NULL); if (!ND_TTEST_1(cp)) return(NULL); - i = EXTRACT_U_1(cp); + i = GET_U_1(cp); cp++; if (!compress) rp += l + 1; @@ -260,7 +260,7 @@ ns_cprint(netdissect_options *ndo, if (!ND_TTEST_1(cp)) return (NULL); - i = EXTRACT_U_1(cp); + i = GET_U_1(cp); cp++; if (nd_printn(ndo, cp, i, ndo->ndo_snapend)) return (NULL); @@ -359,11 +359,11 @@ ns_qprint(netdissect_options *ndo, return(NULL); /* print the qtype */ - i = EXTRACT_BE_U_2(cp); + i = GET_BE_U_2(cp); cp += 2; ND_PRINT(" %s", tok2str(ns_type2str, "Type%u", i)); /* print the qclass (if it's not IN) */ - i = EXTRACT_BE_U_2(cp); + i = GET_BE_U_2(cp); cp += 2; if (is_mdns) class = (i & ~C_QU); @@ -400,10 +400,10 @@ ns_rprint(netdissect_options *ndo, return (ndo->ndo_snapend); /* print the type/qtype */ - typ = EXTRACT_BE_U_2(cp); + typ = GET_BE_U_2(cp); cp += 2; /* print the class (if it's not IN and the type isn't OPT) */ - i = EXTRACT_BE_U_2(cp); + i = GET_BE_U_2(cp); cp += 2; if (is_mdns) class = (i & ~C_CACHE_FLUSH); @@ -419,13 +419,13 @@ ns_rprint(netdissect_options *ndo, if (typ == T_OPT) { /* get opt flags */ cp += 2; - opt_flags = EXTRACT_BE_U_2(cp); + opt_flags = GET_BE_U_2(cp); /* ignore rest of ttl field */ cp += 2; } else if (ndo->ndo_vflag > 2) { /* print ttl */ ND_PRINT(" ["); - unsigned_relts_print(ndo, EXTRACT_BE_U_4(cp)); + unsigned_relts_print(ndo, GET_BE_U_4(cp)); ND_PRINT("]"); cp += 4; } else { @@ -433,7 +433,7 @@ ns_rprint(netdissect_options *ndo, cp += 4; } - len = EXTRACT_BE_U_2(cp); + len = GET_BE_U_2(cp); cp += 2; rp = cp + len; @@ -446,7 +446,7 @@ ns_rprint(netdissect_options *ndo, case T_A: if (!ND_TTEST_LEN(cp, sizeof(nd_ipv4))) return(NULL); - ND_PRINT(" %s", intoa(EXTRACT_IPV4_TO_NETWORK_ORDER(cp))); + ND_PRINT(" %s", intoa(GET_IPV4_TO_NETWORK_ORDER(cp))); break; case T_NS: @@ -471,15 +471,15 @@ ns_rprint(netdissect_options *ndo, return(NULL); if (!ND_TTEST_LEN(cp, 5 * 4)) return(NULL); - ND_PRINT(" %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(" %u", GET_BE_U_4(cp)); cp += 4; - ND_PRINT(" %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(" %u", GET_BE_U_4(cp)); cp += 4; - ND_PRINT(" %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(" %u", GET_BE_U_4(cp)); cp += 4; - ND_PRINT(" %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(" %u", GET_BE_U_4(cp)); cp += 4; - ND_PRINT(" %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(" %u", GET_BE_U_4(cp)); cp += 4; break; case T_MX: @@ -488,7 +488,7 @@ ns_rprint(netdissect_options *ndo, return(NULL); if (ns_nprint(ndo, cp + 2, bp) == NULL) return(NULL); - ND_PRINT(" %u", EXTRACT_BE_U_2(cp)); + ND_PRINT(" %u", GET_BE_U_2(cp)); break; case T_TXT: @@ -507,8 +507,8 @@ ns_rprint(netdissect_options *ndo, return(NULL); if (ns_nprint(ndo, cp + 6, bp) == NULL) return(NULL); - ND_PRINT(":%u %u %u", EXTRACT_BE_U_2(cp + 4), - EXTRACT_BE_U_2(cp), EXTRACT_BE_U_2(cp + 2)); + ND_PRINT(":%u %u %u", GET_BE_U_2(cp + 4), + GET_BE_U_2(cp), GET_BE_U_2(cp + 2)); break; case T_AAAA: @@ -531,7 +531,7 @@ ns_rprint(netdissect_options *ndo, if (!ND_TTEST_1(cp)) return(NULL); - pbit = EXTRACT_U_1(cp); + pbit = GET_U_1(cp); pbyte = (pbit & ~7) / 8; if (pbit > 128) { ND_PRINT(" %u(bad plen)", pbit); @@ -577,23 +577,23 @@ ns_rprint(netdissect_options *ndo, cp += 6; if (!ND_TTEST_2(cp)) return(NULL); - ND_PRINT(" fudge=%u", EXTRACT_BE_U_2(cp)); + ND_PRINT(" fudge=%u", GET_BE_U_2(cp)); cp += 2; if (!ND_TTEST_2(cp)) return(NULL); - ND_PRINT(" maclen=%u", EXTRACT_BE_U_2(cp)); - cp += 2 + EXTRACT_BE_U_2(cp); + ND_PRINT(" maclen=%u", GET_BE_U_2(cp)); + cp += 2 + GET_BE_U_2(cp); if (!ND_TTEST_2(cp)) return(NULL); - ND_PRINT(" origid=%u", EXTRACT_BE_U_2(cp)); + ND_PRINT(" origid=%u", GET_BE_U_2(cp)); cp += 2; if (!ND_TTEST_2(cp)) return(NULL); - ND_PRINT(" error=%u", EXTRACT_BE_U_2(cp)); + ND_PRINT(" error=%u", GET_BE_U_2(cp)); cp += 2; if (!ND_TTEST_2(cp)) return(NULL); - ND_PRINT(" otherlen=%u", EXTRACT_BE_U_2(cp)); + ND_PRINT(" otherlen=%u", GET_BE_U_2(cp)); cp += 2; } } @@ -614,12 +614,12 @@ domain_print(netdissect_options *ndo, ndo->ndo_protocol = "domain"; np = (const dns_header_t *)bp; ND_TCHECK_SIZE(np); - flags = EXTRACT_BE_U_2(np->flags); + flags = GET_BE_U_2(np->flags); /* get the byte-order right */ - 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); + qdcount = GET_BE_U_2(np->qdcount); + ancount = GET_BE_U_2(np->ancount); + nscount = GET_BE_U_2(np->nscount); + arcount = GET_BE_U_2(np->arcount); /* find the opt record to extract extended rcode */ cp = (const u_char *)(np + 1); @@ -637,7 +637,7 @@ domain_print(netdissect_options *ndo, cp += 8; /* skip TYPE, CLASS and TTL */ if (cp + 2 > ndo->ndo_snapend) goto print; - rdlen = EXTRACT_BE_U_2(cp); + rdlen = GET_BE_U_2(cp); cp += 2 + rdlen; if (cp >= ndo->ndo_snapend) goto print; @@ -647,7 +647,7 @@ domain_print(netdissect_options *ndo, goto print; if (cp + 2 > ndo->ndo_snapend) goto print; - type = EXTRACT_BE_U_2(cp); + type = GET_BE_U_2(cp); cp += 4; /* skip TYPE and CLASS */ if (cp + 1 > ndo->ndo_snapend) goto print; @@ -658,7 +658,7 @@ domain_print(netdissect_options *ndo, cp += 4; if (cp + 2 > ndo->ndo_snapend) goto print; - rdlen = EXTRACT_BE_U_2(cp); + rdlen = GET_BE_U_2(cp); cp += 2 + rdlen; if (cp >= ndo->ndo_snapend) goto print; @@ -668,7 +668,7 @@ domain_print(netdissect_options *ndo, if (DNS_QR(flags)) { /* this is a response */ ND_PRINT("%u%s%s%s%s%s%s", - EXTRACT_BE_U_2(np->id), + GET_BE_U_2(np->id), ns_ops[DNS_OPCODE(flags)], ns_rcode(rcode), DNS_AA(flags)? "*" : "", @@ -741,12 +741,13 @@ domain_print(netdissect_options *ndo, } else { /* this is a request */ - ND_PRINT("%u%s%s%s", EXTRACT_BE_U_2(np->id), ns_ops[DNS_OPCODE(flags)], + ND_PRINT("%u%s%s%s", GET_BE_U_2(np->id), + ns_ops[DNS_OPCODE(flags)], DNS_RD(flags) ? "+" : "", DNS_CD(flags) ? "%" : ""); /* any weirdness? */ - b2 = EXTRACT_BE_U_2(((const u_short *)np) + 1); + b2 = GET_BE_U_2(((const u_short *)np) + 1); if (b2 & 0x6cf) ND_PRINT(" [b2&3=0x%x]", b2); diff --git a/print-dtp.c b/print-dtp.c index 004f7d31..1ea36fce 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_TCHECK_LEN(tptr, DTP_HEADER_LEN); ND_PRINT("DTPv%u, length %u", - EXTRACT_U_1(tptr), + GET_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_TCHECK_4(tptr); - type = EXTRACT_BE_U_2(tptr); - len = EXTRACT_BE_U_2(tptr + 2); + type = GET_BE_U_2(tptr); + len = GET_BE_U_2(tptr + 2); /* XXX: should not be but sometimes it is, see the test captures */ if (type == 0) return; @@ -96,7 +96,7 @@ dtp_print(netdissect_options *ndo, const u_char *pptr, u_int length) case DTP_DTP_TYPE_TLV: if (len < 5) goto invalid; - ND_PRINT(", 0x%x", EXTRACT_U_1(tptr + 4)); + ND_PRINT(", 0x%x", GET_U_1(tptr + 4)); break; case DTP_NEIGHBOR_TLV: diff --git a/print-dvmrp.c b/print-dvmrp.c index 983b63b4..7e57a49b 100644 --- a/print-dvmrp.c +++ b/print-dvmrp.c @@ -79,7 +79,7 @@ dvmrp_print(netdissect_options *ndo, return; ND_TCHECK_1(bp + 1); - type = EXTRACT_U_1(bp + 1); + type = GET_U_1(bp + 1); /* Skip IGMP header */ bp += 8; @@ -124,8 +124,8 @@ dvmrp_print(netdissect_options *ndo, */ bp -= 4; ND_TCHECK_4(bp); - major_version = EXTRACT_U_1(bp + 3); - minor_version = EXTRACT_U_1(bp + 2); + major_version = GET_U_1(bp + 3); + minor_version = GET_U_1(bp + 2); bp += 4; if (print_neighbors2(ndo, bp, ep, len, major_version, minor_version) < 0) @@ -176,14 +176,14 @@ print_report(netdissect_options *ndo, return (0); } ND_TCHECK_3(bp); - mask = (uint32_t)0xff << 24 | EXTRACT_U_1(bp) << 16 | - EXTRACT_U_1(bp + 1) << 8 | EXTRACT_U_1(bp + 2); + mask = (uint32_t)0xff << 24 | GET_U_1(bp) << 16 | + GET_U_1(bp + 1) << 8 | GET_U_1(bp + 2); width = 1; - if (EXTRACT_U_1(bp)) + if (GET_U_1(bp)) width = 2; - if (EXTRACT_U_1(bp + 1)) + if (GET_U_1(bp + 1)) width = 3; - if (EXTRACT_U_1(bp + 2)) + if (GET_U_1(bp + 2)) width = 4; ND_PRINT("\n\tMask %s", intoa(htonl(mask))); @@ -201,14 +201,14 @@ print_report(netdissect_options *ndo, origin = 0; for (i = 0; i < width; ++i) { ND_TCHECK_1(bp); - origin = origin << 8 | EXTRACT_U_1(bp); + origin = origin << 8 | GET_U_1(bp); bp++; } for ( ; i < 4; ++i) origin <<= 8; ND_TCHECK_1(bp); - metric = EXTRACT_U_1(bp); + metric = GET_U_1(bp); bp++; done = metric & 0x80; metric &= 0x7f; @@ -235,7 +235,7 @@ print_probe(netdissect_options *ndo, ND_PRINT(" [|}"); return (0); } - genid = EXTRACT_BE_U_4(bp); + genid = GET_BE_U_4(bp); bp += 4; len -= 4; ND_PRINT(ndo->ndo_vflag > 1 ? "\n\t" : " "); @@ -267,11 +267,11 @@ print_neighbors(netdissect_options *ndo, ND_TCHECK_7(bp); laddr = bp; bp += 4; - metric = EXTRACT_U_1(bp); + metric = GET_U_1(bp); bp++; - thresh = EXTRACT_U_1(bp); + thresh = GET_U_1(bp); bp++; - ncount = EXTRACT_U_1(bp); + ncount = GET_U_1(bp); bp++; len -= 7; while (--ncount >= 0) { @@ -304,13 +304,13 @@ print_neighbors2(netdissect_options *ndo, ND_TCHECK_8(bp); laddr = bp; bp += 4; - metric = EXTRACT_U_1(bp); + metric = GET_U_1(bp); bp++; - thresh = EXTRACT_U_1(bp); + thresh = GET_U_1(bp); bp++; - flags = EXTRACT_U_1(bp); + flags = GET_U_1(bp); bp++; - ncount = EXTRACT_U_1(bp); + ncount = GET_U_1(bp); bp++; len -= 8; while (--ncount >= 0 && (len >= 4) && (bp + 4) <= ep) { @@ -349,7 +349,7 @@ print_prune(netdissect_options *ndo, ND_PRINT(" src %s grp %s", ipaddr_string(ndo, bp), ipaddr_string(ndo, bp + 4)); bp += 8; ND_PRINT(" timer "); - unsigned_relts_print(ndo, EXTRACT_BE_U_4(bp)); + unsigned_relts_print(ndo, GET_BE_U_4(bp)); return (0); trunc: return (-1); diff --git a/print-eap.c b/print-eap.c index 0dcf7e0b..0009fe2f 100644 --- a/print-eap.c +++ b/print-eap.c @@ -161,13 +161,13 @@ eap_print(netdissect_options *ndo, tlen = length; eap = (const struct eap_frame_t *)cp; ND_TCHECK_SIZE(eap); - eap_type = EXTRACT_U_1(eap->type); + eap_type = GET_U_1(eap->type); ND_PRINT("%s (%u) v%u, len %u", tok2str(eap_frame_type_values, "unknown", eap_type), eap_type, - EXTRACT_U_1(eap->version), - EXTRACT_BE_U_2(eap->length)); + GET_U_1(eap->version), + GET_BE_U_2(eap->length)); if (ndo->ndo_vflag < 1) return; @@ -178,13 +178,13 @@ eap_print(netdissect_options *ndo, switch (eap_type) { case EAP_FRAME_TYPE_PACKET: ND_TCHECK_1(tptr); - type = EXTRACT_U_1(tptr); + type = GET_U_1(tptr); ND_TCHECK_2(tptr + 2); - len = EXTRACT_BE_U_2(tptr + 2); + len = GET_BE_U_2(tptr + 2); ND_PRINT(", %s (%u), id %u, len %u", tok2str(eap_code_values, "unknown", type), type, - EXTRACT_U_1((tptr + 1)), + GET_U_1((tptr + 1)), len); ND_TCHECK_LEN(tptr, len); @@ -192,7 +192,7 @@ eap_print(netdissect_options *ndo, if (type == EAP_REQUEST || type == EAP_RESPONSE) { /* RFC 3748 Section 4.1 */ ND_TCHECK_1(tptr + 4); - subtype = EXTRACT_U_1(tptr + 4); + subtype = GET_U_1(tptr + 4); ND_PRINT("\n\t\t Type %s (%u)", tok2str(eap_type_values, "unknown", subtype), subtype); @@ -223,8 +223,8 @@ eap_print(netdissect_options *ndo, while (count < len) { ND_TCHECK_1(tptr + count); ND_PRINT(" %s (%u),", - tok2str(eap_type_values, "unknown", EXTRACT_U_1((tptr + count))), - EXTRACT_U_1(tptr + count)); + tok2str(eap_type_values, "unknown", GET_U_1((tptr + count))), + GET_U_1(tptr + count)); count++; } break; @@ -234,28 +234,28 @@ eap_print(netdissect_options *ndo, ND_TCHECK_1(tptr + 5); if (subtype == EAP_TYPE_TTLS) ND_PRINT(" TTLSv%u", - EAP_TTLS_VERSION(EXTRACT_U_1((tptr + 5)))); + EAP_TTLS_VERSION(GET_U_1((tptr + 5)))); ND_PRINT(" flags [%s] 0x%02x,", - bittok2str(eap_tls_flags_values, "none", EXTRACT_U_1((tptr + 5))), - EXTRACT_U_1(tptr + 5)); + bittok2str(eap_tls_flags_values, "none", GET_U_1((tptr + 5))), + GET_U_1(tptr + 5)); - if (EAP_TLS_EXTRACT_BIT_L(EXTRACT_U_1(tptr + 5))) { + if (EAP_TLS_EXTRACT_BIT_L(GET_U_1(tptr + 5))) { ND_TCHECK_4(tptr + 6); - ND_PRINT(" len %u", EXTRACT_BE_U_4(tptr + 6)); + ND_PRINT(" len %u", GET_BE_U_4(tptr + 6)); } break; case EAP_TYPE_FAST: ND_TCHECK_1(tptr + 5); ND_PRINT(" FASTv%u", - EAP_TTLS_VERSION(EXTRACT_U_1((tptr + 5)))); + EAP_TTLS_VERSION(GET_U_1((tptr + 5)))); ND_PRINT(" flags [%s] 0x%02x,", - bittok2str(eap_tls_flags_values, "none", EXTRACT_U_1((tptr + 5))), - EXTRACT_U_1(tptr + 5)); + bittok2str(eap_tls_flags_values, "none", GET_U_1((tptr + 5))), + GET_U_1(tptr + 5)); - if (EAP_TLS_EXTRACT_BIT_L(EXTRACT_U_1(tptr + 5))) { + if (EAP_TLS_EXTRACT_BIT_L(GET_U_1(tptr + 5))) { ND_TCHECK_4(tptr + 6); - ND_PRINT(" len %u", EXTRACT_BE_U_4(tptr + 6)); + ND_PRINT(" len %u", GET_BE_U_4(tptr + 6)); } /* FIXME - TLV attributes follow */ @@ -265,8 +265,8 @@ eap_print(netdissect_options *ndo, case EAP_TYPE_SIM: ND_TCHECK_1(tptr + 5); ND_PRINT(" subtype [%s] 0x%02x,", - tok2str(eap_aka_subtype_values, "unknown", EXTRACT_U_1((tptr + 5))), - EXTRACT_U_1(tptr + 5)); + tok2str(eap_aka_subtype_values, "unknown", GET_U_1((tptr + 5))), + GET_U_1(tptr + 5)); /* FIXME - TLV attributes follow */ break; diff --git a/print-egp.c b/print-egp.c index 1f171bc7..15dd07d0 100644 --- a/print-egp.c +++ b/print-egp.c @@ -143,7 +143,7 @@ egpnr_print(netdissect_options *ndo, u_int intgw, extgw, t_gateways; const char *comma; - addr = EXTRACT_IPV4_TO_NETWORK_ORDER(egp->egp_sourcenet); + addr = GET_IPV4_TO_NETWORK_ORDER(egp->egp_sourcenet); if (IN_CLASSA(addr)) { net = addr & IN_CLASSA_NET; netlen = 1; @@ -160,8 +160,8 @@ egpnr_print(netdissect_options *ndo, cp = (const uint8_t *)(egp + 1); length -= sizeof(*egp); - intgw = EXTRACT_U_1(egp->egp_intgw); - extgw = EXTRACT_U_1(egp->egp_extgw); + intgw = GET_U_1(egp->egp_intgw); + extgw = GET_U_1(egp->egp_extgw); t_gateways = intgw + extgw; for (gateways = 0; gateways < t_gateways; ++gateways) { /* Pickup host part of gateway address */ @@ -172,15 +172,15 @@ egpnr_print(netdissect_options *ndo, switch (netlen) { case 1: - addr = EXTRACT_U_1(cp); + addr = GET_U_1(cp); cp++; /* fall through */ case 2: - addr = (addr << 8) | EXTRACT_U_1(cp); + addr = (addr << 8) | GET_U_1(cp); cp++; /* fall through */ case 3: - addr = (addr << 8) | EXTRACT_U_1(cp); + addr = (addr << 8) | GET_U_1(cp); cp++; break; } @@ -189,7 +189,7 @@ egpnr_print(netdissect_options *ndo, if (length < 1) goto trunc; ND_TCHECK_1(cp); - distances = EXTRACT_U_1(cp); + distances = GET_U_1(cp); cp++; length--; ND_PRINT(" %s %s ", @@ -202,10 +202,10 @@ egpnr_print(netdissect_options *ndo, if (length < 2) goto trunc; ND_TCHECK_2(cp); - ND_PRINT("%sd%u:", comma, EXTRACT_U_1(cp)); + ND_PRINT("%sd%u:", comma, GET_U_1(cp)); cp++; comma = ", "; - networks = EXTRACT_U_1(cp); + networks = GET_U_1(cp); cp++; length -= 2; while (networks != 0) { @@ -213,23 +213,23 @@ egpnr_print(netdissect_options *ndo, if (length < 1) goto trunc; ND_TCHECK_1(cp); - addr = ((uint32_t) EXTRACT_U_1(cp)) << 24; + addr = ((uint32_t) GET_U_1(cp)) << 24; cp++; length--; if (IN_CLASSB(addr)) { if (length < 1) goto trunc; ND_TCHECK_1(cp); - addr |= ((uint32_t) EXTRACT_U_1(cp)) << 16; + addr |= ((uint32_t) GET_U_1(cp)) << 16; cp++; length--; } else if (!IN_CLASSA(addr)) { if (length < 2) goto trunc; ND_TCHECK_2(cp); - addr |= ((uint32_t) EXTRACT_U_1(cp)) << 16; + addr |= ((uint32_t) GET_U_1(cp)) << 16; cp++; - addr |= ((uint32_t) EXTRACT_U_1(cp)) << 8; + addr |= ((uint32_t) GET_U_1(cp)) << 8; cp++; length -= 2; } @@ -262,12 +262,12 @@ egp_print(netdissect_options *ndo, return; } - version = EXTRACT_U_1(egp->egp_version); + version = GET_U_1(egp->egp_version); if (!ndo->ndo_vflag) { ND_PRINT("EGPv%u, AS %u, seq %u, length %u", version, - EXTRACT_BE_U_2(egp->egp_as), - EXTRACT_BE_U_2(egp->egp_sequence), + GET_BE_U_2(egp->egp_as), + GET_BE_U_2(egp->egp_sequence), length); return; } else @@ -280,9 +280,9 @@ egp_print(netdissect_options *ndo, return; } - type = EXTRACT_U_1(egp->egp_type); - code = EXTRACT_U_1(egp->egp_code); - status = EXTRACT_U_1(egp->egp_status); + type = GET_U_1(egp->egp_type); + code = GET_U_1(egp->egp_code); + status = GET_U_1(egp->egp_status); switch (type) { case EGPT_ACQUIRE: @@ -303,8 +303,8 @@ egp_print(netdissect_options *ndo, break; } ND_PRINT(" hello:%u poll:%u", - EXTRACT_BE_U_2(egp->egp_hello), - EXTRACT_BE_U_2(egp->egp_poll)); + GET_BE_U_2(egp->egp_hello), + GET_BE_U_2(egp->egp_poll)); break; case EGPC_REFUSE: @@ -372,8 +372,8 @@ egp_print(netdissect_options *ndo, ND_PRINT(" [status %u]", status); ND_PRINT(" %s int %u ext %u", ipaddr_string(ndo, egp->egp_sourcenet), - EXTRACT_U_1(egp->egp_intgw), - EXTRACT_U_1(egp->egp_extgw)); + GET_U_1(egp->egp_intgw), + GET_U_1(egp->egp_extgw)); if (ndo->ndo_vflag) egpnr_print(ndo, egp, length); break; @@ -385,10 +385,11 @@ egp_print(netdissect_options *ndo, else ND_PRINT(" [status %u]", status); - if (EXTRACT_BE_U_2(egp->egp_reason) <= EGPR_UVERSION) - ND_PRINT(" %s", egp_reasons[EXTRACT_BE_U_2(egp->egp_reason)]); + if (GET_BE_U_2(egp->egp_reason) <= EGPR_UVERSION) + ND_PRINT(" %s", + egp_reasons[GET_BE_U_2(egp->egp_reason)]); else - ND_PRINT(" [reason %u]", EXTRACT_BE_U_2(egp->egp_reason)); + ND_PRINT(" [reason %u]", GET_BE_U_2(egp->egp_reason)); break; default: diff --git a/print-eigrp.c b/print-eigrp.c index d206237d..5c975552 100644 --- a/print-eigrp.c +++ b/print-eigrp.c @@ -235,15 +235,16 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) /* * Sanity checking of the header. */ - if (EXTRACT_U_1(eigrp_com_header->version) != EIGRP_VERSION) { - ND_PRINT("EIGRP version %u packet not supported",EXTRACT_U_1(eigrp_com_header->version)); + if (GET_U_1(eigrp_com_header->version) != EIGRP_VERSION) { + ND_PRINT("EIGRP version %u packet not supported", + GET_U_1(eigrp_com_header->version)); return; } /* in non-verbose mode just lets print the basic Message Type*/ if (ndo->ndo_vflag < 1) { ND_PRINT("EIGRP %s, length: %u", - tok2str(eigrp_opcode_values, "unknown (%u)",EXTRACT_U_1(eigrp_com_header->opcode)), + tok2str(eigrp_opcode_values, "unknown (%u)",GET_U_1(eigrp_com_header->opcode)), len); return; } @@ -252,7 +253,7 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) if (len < sizeof(struct eigrp_common_header)) { ND_PRINT("EIGRP %s, length: %u (too short, < %u)", - tok2str(eigrp_opcode_values, "unknown (%u)",EXTRACT_U_1(eigrp_com_header->opcode)), + tok2str(eigrp_opcode_values, "unknown (%u)",GET_U_1(eigrp_com_header->opcode)), len, (u_int) sizeof(struct eigrp_common_header)); return; } @@ -260,16 +261,16 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) /* FIXME print other header info */ ND_PRINT("\n\tEIGRP v%u, opcode: %s (%u), chksum: 0x%04x, Flags: [%s]\n\tseq: 0x%08x, ack: 0x%08x, AS: %u, length: %u", - EXTRACT_U_1(eigrp_com_header->version), - tok2str(eigrp_opcode_values, "unknown, type: %u",EXTRACT_U_1(eigrp_com_header->opcode)), - EXTRACT_U_1(eigrp_com_header->opcode), - EXTRACT_BE_U_2(eigrp_com_header->checksum), + GET_U_1(eigrp_com_header->version), + tok2str(eigrp_opcode_values, "unknown, type: %u",GET_U_1(eigrp_com_header->opcode)), + GET_U_1(eigrp_com_header->opcode), + GET_BE_U_2(eigrp_com_header->checksum), tok2str(eigrp_common_header_flag_values, "none", - 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), + GET_BE_U_4(eigrp_com_header->flags)), + GET_BE_U_4(eigrp_com_header->seq), + GET_BE_U_4(eigrp_com_header->ack), + GET_BE_U_4(eigrp_com_header->asn), tlen); tptr+=sizeof(struct eigrp_common_header); @@ -279,8 +280,8 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) ND_TCHECK_LEN(tptr, sizeof(struct eigrp_tlv_header)); eigrp_tlv_header = (const struct eigrp_tlv_header *)tptr; - eigrp_tlv_len=EXTRACT_BE_U_2(eigrp_tlv_header->length); - eigrp_tlv_type=EXTRACT_BE_U_2(eigrp_tlv_header->type); + eigrp_tlv_len=GET_BE_U_2(eigrp_tlv_header->length); + eigrp_tlv_type=GET_BE_U_2(eigrp_tlv_header->type); if (eigrp_tlv_len < sizeof(struct eigrp_tlv_header) || @@ -318,12 +319,12 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) } ND_PRINT("\n\t holdtime: %us, k1 %u, k2 %u, k3 %u, k4 %u, k5 %u", - EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_general_parm->holdtime), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_general_parm->k1), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_general_parm->k2), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_general_parm->k3), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_general_parm->k4), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_general_parm->k5)); + GET_BE_U_2(tlv_ptr.eigrp_tlv_general_parm->holdtime), + GET_U_1(tlv_ptr.eigrp_tlv_general_parm->k1), + GET_U_1(tlv_ptr.eigrp_tlv_general_parm->k2), + GET_U_1(tlv_ptr.eigrp_tlv_general_parm->k3), + GET_U_1(tlv_ptr.eigrp_tlv_general_parm->k4), + GET_U_1(tlv_ptr.eigrp_tlv_general_parm->k5)); break; case EIGRP_TLV_SW_VERSION: @@ -335,10 +336,10 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) } ND_PRINT("\n\t IOS version: %u.%u, EIGRP version %u.%u", - EXTRACT_U_1(tlv_ptr.eigrp_tlv_sw_version->ios_major), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_sw_version->ios_minor), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_sw_version->eigrp_major), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_sw_version->eigrp_minor)); + GET_U_1(tlv_ptr.eigrp_tlv_sw_version->ios_major), + GET_U_1(tlv_ptr.eigrp_tlv_sw_version->ios_minor), + GET_U_1(tlv_ptr.eigrp_tlv_sw_version->eigrp_major), + GET_U_1(tlv_ptr.eigrp_tlv_sw_version->eigrp_minor)); break; case EIGRP_TLV_IP_INT: @@ -349,7 +350,7 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) break; } - bit_length = EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_int->plen); + bit_length = GET_U_1(tlv_ptr.eigrp_tlv_ip_int->plen); if (bit_length > 32) { ND_PRINT("\n\t illegal prefix length %u",bit_length); break; @@ -361,19 +362,19 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) ND_PRINT("\n\t IPv4 prefix: %15s/%u, nexthop: ", ipaddr_string(ndo, prefix), bit_length); - if (EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0) + if (GET_BE_U_4(tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0) ND_PRINT("self"); else ND_PRINT("%s", ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_int->nexthop)); ND_PRINT("\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u", - (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), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_int->hopcount), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_int->reliability), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_int->load)); + (GET_BE_U_4(tlv_ptr.eigrp_tlv_ip_int->delay)/100), + GET_BE_U_4(tlv_ptr.eigrp_tlv_ip_int->bandwidth), + GET_BE_U_3(tlv_ptr.eigrp_tlv_ip_int->mtu), + GET_U_1(tlv_ptr.eigrp_tlv_ip_int->hopcount), + GET_U_1(tlv_ptr.eigrp_tlv_ip_int->reliability), + GET_U_1(tlv_ptr.eigrp_tlv_ip_int->load)); break; case EIGRP_TLV_IP_EXT: @@ -384,7 +385,7 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) break; } - bit_length = EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_ext->plen); + bit_length = GET_U_1(tlv_ptr.eigrp_tlv_ip_ext->plen); if (bit_length > 32) { ND_PRINT("\n\t illegal prefix length %u",bit_length); break; @@ -396,7 +397,7 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) ND_PRINT("\n\t IPv4 prefix: %15s/%u, nexthop: ", ipaddr_string(ndo, prefix), bit_length); - if (EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0) + if (GET_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0) ND_PRINT("self"); else ND_PRINT("%s", @@ -404,19 +405,19 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) ND_PRINT("\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_U_4(tlv_ptr.eigrp_tlv_ip_ext->origin_as), - tok2str(eigrp_ext_proto_id_values,"unknown",EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_ext->proto_id)), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_ext->flags), - EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->tag), - EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->metric)); + GET_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->origin_as), + tok2str(eigrp_ext_proto_id_values,"unknown",GET_U_1(tlv_ptr.eigrp_tlv_ip_ext->proto_id)), + GET_U_1(tlv_ptr.eigrp_tlv_ip_ext->flags), + GET_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->tag), + GET_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->metric)); ND_PRINT("\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u", - (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), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_ext->hopcount), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_ext->reliability), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_ext->load)); + (GET_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->delay)/100), + GET_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->bandwidth), + GET_BE_U_3(tlv_ptr.eigrp_tlv_ip_ext->mtu), + GET_U_1(tlv_ptr.eigrp_tlv_ip_ext->hopcount), + GET_U_1(tlv_ptr.eigrp_tlv_ip_ext->reliability), + GET_U_1(tlv_ptr.eigrp_tlv_ip_ext->load)); break; case EIGRP_TLV_AT_CABLE_SETUP: @@ -428,9 +429,9 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) } ND_PRINT("\n\t Cable-range: %u-%u, Router-ID %u", - 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)); + GET_BE_U_2(tlv_ptr.eigrp_tlv_at_cable_setup->cable_start), + GET_BE_U_2(tlv_ptr.eigrp_tlv_at_cable_setup->cable_end), + GET_BE_U_4(tlv_ptr.eigrp_tlv_at_cable_setup->router_id)); break; case EIGRP_TLV_AT_INT: @@ -442,23 +443,23 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) } ND_PRINT("\n\t Cable-Range: %u-%u, nexthop: ", - EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_at_int->cable_start), - EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_at_int->cable_end)); + GET_BE_U_2(tlv_ptr.eigrp_tlv_at_int->cable_start), + GET_BE_U_2(tlv_ptr.eigrp_tlv_at_int->cable_end)); - if (EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_int->nexthop) == 0) + if (GET_BE_U_4(tlv_ptr.eigrp_tlv_at_int->nexthop) == 0) ND_PRINT("self"); else ND_PRINT("%u.%u", - EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_int->nexthop[0]), - EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_int->nexthop[2])); + GET_BE_U_2(&tlv_ptr.eigrp_tlv_at_int->nexthop[0]), + GET_BE_U_2(&tlv_ptr.eigrp_tlv_at_int->nexthop[2])); ND_PRINT("\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u", - (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), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_int->hopcount), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_int->reliability), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_int->load)); + (GET_BE_U_4(tlv_ptr.eigrp_tlv_at_int->delay)/100), + GET_BE_U_4(tlv_ptr.eigrp_tlv_at_int->bandwidth), + GET_BE_U_3(tlv_ptr.eigrp_tlv_at_int->mtu), + GET_U_1(tlv_ptr.eigrp_tlv_at_int->hopcount), + GET_U_1(tlv_ptr.eigrp_tlv_at_int->reliability), + GET_U_1(tlv_ptr.eigrp_tlv_at_int->load)); break; case EIGRP_TLV_AT_EXT: @@ -470,31 +471,31 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) } ND_PRINT("\n\t Cable-Range: %u-%u, nexthop: ", - EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_at_ext->cable_start), - EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_at_ext->cable_end)); + GET_BE_U_2(tlv_ptr.eigrp_tlv_at_ext->cable_start), + GET_BE_U_2(tlv_ptr.eigrp_tlv_at_ext->cable_end)); - if (EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->nexthop) == 0) + if (GET_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->nexthop) == 0) ND_PRINT("self"); else ND_PRINT("%u.%u", - EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_ext->nexthop[0]), - EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_ext->nexthop[2])); + GET_BE_U_2(&tlv_ptr.eigrp_tlv_at_ext->nexthop[0]), + GET_BE_U_2(&tlv_ptr.eigrp_tlv_at_ext->nexthop[2])); ND_PRINT("\n\t origin-router %u, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u", - 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",EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_ext->proto_id)), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_ext->flags), - EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->tag), - EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_at_ext->metric)); + GET_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->origin_router), + GET_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->origin_as), + tok2str(eigrp_ext_proto_id_values,"unknown",GET_U_1(tlv_ptr.eigrp_tlv_at_ext->proto_id)), + GET_U_1(tlv_ptr.eigrp_tlv_at_ext->flags), + GET_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->tag), + GET_BE_U_2(tlv_ptr.eigrp_tlv_at_ext->metric)); ND_PRINT("\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u", - (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), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_ext->hopcount), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_ext->reliability), - EXTRACT_U_1(tlv_ptr.eigrp_tlv_at_ext->load)); + (GET_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->delay)/100), + GET_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->bandwidth), + GET_BE_U_3(tlv_ptr.eigrp_tlv_at_ext->mtu), + GET_U_1(tlv_ptr.eigrp_tlv_at_ext->hopcount), + GET_U_1(tlv_ptr.eigrp_tlv_at_ext->reliability), + GET_U_1(tlv_ptr.eigrp_tlv_at_ext->load)); break; /* diff --git a/print-enc.c b/print-enc.c index 630f6b31..e6c27870 100644 --- a/print-enc.c +++ b/print-enc.c @@ -142,7 +142,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("SPI 0x%08x: ", EXTRACT_BE_U_4(hdr->spi)); + ND_PRINT("SPI 0x%08x: ", GET_BE_U_4(hdr->spi)); length -= ENC_HDRLEN; caplen -= ENC_HDRLEN; diff --git a/print-esp.c b/print-esp.c index e5a490f5..3b238933 100644 --- a/print-esp.c +++ b/print-esp.c @@ -714,8 +714,8 @@ esp_print(netdissect_options *ndo, nd_print_trunc(ndo); goto fail; } - ND_PRINT("ESP(spi=0x%08x", EXTRACT_BE_U_4(esp->esp_spi)); - ND_PRINT(",seq=0x%x)", EXTRACT_BE_U_4(esp->esp_seq)); + ND_PRINT("ESP(spi=0x%08x", GET_BE_U_4(esp->esp_spi)); + ND_PRINT(",seq=0x%x)", GET_BE_U_4(esp->esp_seq)); ND_PRINT(", length %u", length); #ifndef HAVE_LIBCRYPTO @@ -737,14 +737,14 @@ esp_print(netdissect_options *ndo, case 6: ip6 = (const struct ip6_hdr *)bp2; /* we do not attempt to decrypt jumbograms */ - if (!EXTRACT_BE_U_2(ip6->ip6_plen)) + if (!GET_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_U_2(ip6->ip6_plen); + len = sizeof(struct ip6_hdr) + GET_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_U_4(esp->esp_spi) && + if (sa->spi == GET_BE_U_4(esp->esp_spi) && sa->daddr_version == 6 && UNALIGNED_MEMCMP(&sa->daddr.in6, &ip6->ip6_dst, sizeof(nd_ipv6)) == 0) { @@ -754,13 +754,13 @@ esp_print(netdissect_options *ndo, break; case 4: /* nexthdr & padding are in the last fragment */ - if (EXTRACT_BE_U_2(ip->ip_off) & IP_MF) + if (GET_BE_U_2(ip->ip_off) & IP_MF) goto fail; - len = EXTRACT_BE_U_2(ip->ip_len); + len = GET_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_U_4(esp->esp_spi) && + if (sa->spi == GET_BE_U_4(esp->esp_spi) && sa->daddr_version == 4 && UNALIGNED_MEMCMP(&sa->daddr.in4, &ip->ip_dst, sizeof(nd_ipv4)) == 0) { @@ -860,14 +860,14 @@ esp_print(netdissect_options *ndo, advance = sizeof(struct newesp); /* sanity check for pad length */ - if (ep - bp < EXTRACT_U_1(ep - 2)) + if (ep - bp < GET_U_1(ep - 2)) goto fail; if (padlen) - *padlen = EXTRACT_U_1(ep - 2) + 2; + *padlen = GET_U_1(ep - 2) + 2; if (nhdr) - *nhdr = EXTRACT_U_1(ep - 1); + *nhdr = GET_U_1(ep - 1); ND_PRINT(": "); return advance; diff --git a/print-ether.c b/print-ether.c index ba488343..8e07bb32 100644 --- a/print-ether.c +++ b/print-ether.c @@ -118,8 +118,7 @@ ether_hdr_print(netdissect_options *ndo, etheraddr_string(ndo, ehp->ether_shost), etheraddr_string(ndo, ehp->ether_dhost)); - length_type = EXTRACT_BE_U_2(bp + - (hdrlen - sizeof(ehp->ether_length_type))); + length_type = GET_BE_U_2(bp + (hdrlen - sizeof(ehp->ether_length_type))); if (!ndo->ndo_qflag) { if (length_type <= MAX_ETHERNET_LENGTH_VAL) { ND_PRINT(", 802.3"); @@ -193,8 +192,7 @@ ether_print_hdr_len(netdissect_options *ndo, src.addr_string = etheraddr_string; dst.addr = ehp->ether_dhost; dst.addr_string = etheraddr_string; - length_type = EXTRACT_BE_U_2((const u_char *)ehp + - (hdrlen - sizeof(ehp->ether_length_type))); + length_type = GET_BE_U_2((const u_char *)ehp + (hdrlen - sizeof(ehp->ether_length_type))); recurse: /* @@ -229,12 +227,12 @@ recurse: return (hdrlen + length); } if (ndo->ndo_eflag) { - uint16_t tag = EXTRACT_BE_U_2(p); + uint16_t tag = GET_BE_U_2(p); ND_PRINT("%s, ", ieee8021q_tci_string(tag)); } - length_type = EXTRACT_BE_U_2(p + 2); + length_type = GET_BE_U_2(p + 2); if (ndo->ndo_eflag && length_type > MAX_ETHERNET_LENGTH_VAL) ND_PRINT("ethertype %s, ", tok2str(ethertype_values,"0x%04x", length_type)); p += 4; diff --git a/print-fddi.c b/print-fddi.c index d73d92d6..db5222f6 100644 --- a/print-fddi.c +++ b/print-fddi.c @@ -261,7 +261,7 @@ fddi_hdr_print(netdissect_options *ndo, dstname = etheraddr_string(ndo, fdst); if (!ndo->ndo_qflag) - print_fddi_fc(ndo, EXTRACT_U_1(fddip->fddi_fc)); + print_fddi_fc(ndo, GET_U_1(fddip->fddi_fc)); ND_PRINT("%s > %s, length %u: ", srcname, dstname, length); @@ -288,7 +288,7 @@ fddi_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) return (caplen); } - fc = EXTRACT_U_1(fddip->fddi_fc); + fc = GET_U_1(fddip->fddi_fc); /* * Get the FDDI addresses into a canonical form diff --git a/print-forces.c b/print-forces.c index f7f0cd55..65d6e77f 100644 --- a/print-forces.c +++ b/print-forces.c @@ -155,23 +155,23 @@ static const struct tok ForCES_TPs[] = { */ struct forcesh { nd_uint8_t fm_vrsvd; /* version and reserved */ -#define ForCES_V(forcesh) (EXTRACT_U_1((forcesh)->fm_vrsvd) >> 4) +#define ForCES_V(forcesh) (GET_U_1((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_U_2((forcesh)->fm_len) << 2)) +#define ForCES_BLN(forcesh) ((uint32_t)(GET_BE_U_2((forcesh)->fm_len) << 2)) nd_uint32_t fm_sid; /* Source ID */ -#define ForCES_SID(forcesh) EXTRACT_BE_U_4((forcesh)->fm_sid) +#define ForCES_SID(forcesh) GET_BE_U_4((forcesh)->fm_sid) nd_uint32_t fm_did; /* Destination ID */ -#define ForCES_DID(forcesh) EXTRACT_BE_U_4((forcesh)->fm_did) +#define ForCES_DID(forcesh) GET_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_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_ACK(forcesh) ((GET_BE_U_4((forcesh)->fm_flags)&0xC0000000) >> 30) +#define ForCES_PRI(forcesh) ((GET_BE_U_4((forcesh)->fm_flags)&0x38000000) >> 27) +#define ForCES_RS1(forcesh) ((GET_BE_U_4((forcesh)->fm_flags)&0x07000000) >> 24) +#define ForCES_EM(forcesh) ((GET_BE_U_4((forcesh)->fm_flags)&0x00C00000) >> 22) +#define ForCES_AT(forcesh) ((GET_BE_U_4((forcesh)->fm_flags)&0x00200000) >> 21) +#define ForCES_TP(forcesh) ((GET_BE_U_4((forcesh)->fm_flags)&0x00180000) >> 19) +#define ForCES_RS2(forcesh) ((GET_BE_U_4((forcesh)->fm_flags)&0x0007FFFF) >> 0) }; #define ForCES_HLN_VALID(fhl,tlen) ((tlen) >= ForCES_HDRL && \ @@ -392,14 +392,14 @@ 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_DATA(tlvp) ((const void*)(((const char*)(tlvp)) + TLV_SET_LEN(0))) -#define GO_NXT_TLV(tlv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_BE_U_2((tlv)->length)), \ +#define GO_NXT_TLV(tlv,rlen) ((rlen) -= F_ALN_LEN(GET_BE_U_2((tlv)->length)), \ (const struct forces_tlv*)(((const char*)(tlv)) \ - + F_ALN_LEN(EXTRACT_BE_U_2((tlv)->length)))) + + F_ALN_LEN(GET_BE_U_2((tlv)->length)))) #define ILV_SET_LEN(len) (F_ALN_LEN(ILV_HDRL) + (len)) #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_U_4((ilv)->length)), \ +#define GO_NXT_ILV(ilv,rlen) ((rlen) -= F_ALN_LEN(GET_BE_U_4((ilv)->length)), \ (const struct forces_ilv *)(((const char*)(ilv)) \ - + F_ALN_LEN(EXTRACT_BE_U_4((ilv)->length)))) + + F_ALN_LEN(GET_BE_U_4((ilv)->length)))) #define INVALID_RLEN 1 #define INVALID_STLN 2 #define INVALID_LTLN 3 @@ -433,11 +433,11 @@ ilv_valid(netdissect_options *ndo, const struct forces_ilv *ilv, u_int rlen) { if (rlen < ILV_HDRL) return INVALID_RLEN; - if (EXTRACT_BE_U_4(ilv->length) < ILV_HDRL) + if (GET_BE_U_4(ilv->length) < ILV_HDRL) return INVALID_STLN; - if (EXTRACT_BE_U_4(ilv->length) > rlen) + if (GET_BE_U_4(ilv->length) > rlen) return INVALID_LTLN; - if (rlen < F_ALN_LEN(EXTRACT_BE_U_4(ilv->length))) + if (rlen < F_ALN_LEN(GET_BE_U_4(ilv->length))) return INVALID_ALEN; return 0; @@ -667,7 +667,7 @@ prestlv_print(netdissect_options *ndo, } ND_TCHECK_SIZE(r); - result = EXTRACT_U_1(r->result); + result = GET_U_1(r->result); if (result >= 0x18 && result <= 0xFE) { ND_PRINT("illegal reserved result code: 0x%x!\n", result); return -1; @@ -701,7 +701,7 @@ fdatatlv_print(netdissect_options *ndo, */ rlen = len - TLV_HDRL; ND_TCHECK_SIZE(tlv); - type = EXTRACT_BE_U_2(tlv->type); + type = GET_BE_U_2(tlv->type); if (type != F_TLV_FULD) { ND_PRINT("Error: expecting FULLDATA!\n"); return -1; @@ -750,9 +750,9 @@ sdatailv_print(netdissect_options *ndo, return -1; } if (ndo->ndo_vflag >= 3) { - u_int ilvl = EXTRACT_BE_U_4(ilv->length); + u_int ilvl = GET_BE_U_4(ilv->length); ND_PRINT("\n%s ILV: type %x length %u\n", ib + 1, - EXTRACT_BE_U_4(ilv->type), ilvl); + GET_BE_U_4(ilv->type), ilvl); hex_print_with_offset(ndo, "\t\t[", tdp, ilvl-ILV_HDRL, 0); } @@ -782,7 +782,7 @@ sdatatlv_print(netdissect_options *ndo, */ rlen = len - TLV_HDRL; ND_TCHECK_SIZE(tlv); - type = EXTRACT_BE_U_2(tlv->type); + type = GET_BE_U_2(tlv->type); if (type != F_TLV_SPAD) { ND_PRINT("Error: expecting SPARSEDATA!\n"); return -1; @@ -810,11 +810,11 @@ pkeyitlv_print(netdissect_options *ndo, u_int invtlv; ND_TCHECK_1(tdp); - id = EXTRACT_BE_U_4(tdp); + id = GET_BE_U_4(tdp); ND_PRINT("%sKeyinfo: Key 0x%x\n", ib, id); ND_TCHECK_SIZE(kdtlv); - type = EXTRACT_BE_U_2(kdtlv->type); - tll = EXTRACT_BE_U_2(kdtlv->length); + type = GET_BE_U_2(kdtlv->type); + tll = GET_BE_U_2(kdtlv->length); invtlv = tlv_valid(tll, len); if (invtlv) { @@ -828,7 +828,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_U_2(kdtlv->length); + tll = GET_BE_U_2(kdtlv->length); dp = (const u_char *) TLV_DATA(kdtlv); return fdatatlv_print(ndo, dp, tll, op_msk, indent); @@ -855,7 +855,7 @@ pdatacnt_print(netdissect_options *ndo, ND_TCHECK_4(pptr); if (len < 4) goto trunc; - id = EXTRACT_BE_U_4(pptr); + id = GET_BE_U_4(pptr); if (ndo->ndo_vflag >= 3) ND_PRINT("%sID#%02u: %u\n", ib, i + 1, id); len -= 4; @@ -875,11 +875,11 @@ pdatacnt_print(netdissect_options *ndo, pptr += sizeof(struct forces_tlv); len -= sizeof(struct forces_tlv); - starti = EXTRACT_BE_U_4(pptr); + starti = GET_BE_U_4(pptr); pptr += 4; len -= 4; - endi = EXTRACT_BE_U_4(pptr); + endi = GET_BE_U_4(pptr); pptr += 4; len -= 4; @@ -905,7 +905,7 @@ pdatacnt_print(netdissect_options *ndo, pptr += sizeof(struct forces_tlv); len -= sizeof(struct forces_tlv); /* skip key content */ - tll = EXTRACT_BE_U_2(keytlv->length); + tll = GET_BE_U_2(keytlv->length); if (tll < TLV_HDRL) { ND_PRINT("key content length %u < %u\n", tll, TLV_HDRL); @@ -931,8 +931,8 @@ pdatacnt_print(netdissect_options *ndo, u_int invtlv; ND_TCHECK_SIZE(pdtlv); - type = EXTRACT_BE_U_2(pdtlv->type); - tlvl = EXTRACT_BE_U_2(pdtlv->length); + type = GET_BE_U_2(pdtlv->type); + tlvl = GET_BE_U_2(pdtlv->length); invtlv = tlv_valid(tlvl, len); if (invtlv) { ND_PRINT("%s Outstanding bytes %u for TLV type 0x%x TLV len %u\n", @@ -1010,26 +1010,26 @@ pdata_print(netdissect_options *ndo, goto trunc; if (ndo->ndo_vflag >= 3) { ND_PRINT("\n%sPathdata: Flags 0x%x ID count %u\n", - ib, EXTRACT_BE_U_2(pdh->pflags), - EXTRACT_BE_U_2(pdh->pIDcnt)); + ib, GET_BE_U_2(pdh->pflags), + GET_BE_U_2(pdh->pIDcnt)); } - if (EXTRACT_BE_U_2(pdh->pflags) & F_SELKEY) { + if (GET_BE_U_2(pdh->pflags) & F_SELKEY) { op_msk |= B_KEYIN; } /* Table GET Range operation */ - if (EXTRACT_BE_U_2(pdh->pflags) & F_SELTABRANGE) { + if (GET_BE_U_2(pdh->pflags) & F_SELTABRANGE) { op_msk |= B_TRNG; } /* Table SET append operation */ - if (EXTRACT_BE_U_2(pdh->pflags) & F_TABAPPEND) { + if (GET_BE_U_2(pdh->pflags) & F_TABAPPEND) { op_msk |= B_APPND; } pptr += sizeof(struct pathdata_h); len -= sizeof(struct pathdata_h); - idcnt = EXTRACT_BE_U_2(pdh->pIDcnt); + idcnt = GET_BE_U_2(pdh->pIDcnt); minsize = idcnt * 4; if (len < minsize) { ND_PRINT("\t\t\ttruncated IDs expected %uB got %uB\n", minsize, @@ -1071,8 +1071,8 @@ genoptlv_print(netdissect_options *ndo, char *ib = indent_pr(indent, 0); ND_TCHECK_SIZE(pdtlv); - type = EXTRACT_BE_U_2(pdtlv->type); - tlvl = EXTRACT_BE_U_2(pdtlv->length); + type = GET_BE_U_2(pdtlv->type); + tlvl = GET_BE_U_2(pdtlv->length); invtlv = tlv_valid(tlvl, len); ND_PRINT("genoptlvprint - %s TLV type 0x%x len %u\n", tok2str(ForCES_TLV, NULL, type), type, tlvl); @@ -1120,7 +1120,7 @@ recpdoptlv_print(netdissect_options *ndo, const u_char *dp; ND_TCHECK_SIZE(pdtlv); - tlvl = EXTRACT_BE_U_2(pdtlv->length); + tlvl = GET_BE_U_2(pdtlv->length); invtlv = tlv_valid(tlvl, len); if (invtlv) { break; @@ -1132,7 +1132,7 @@ recpdoptlv_print(netdissect_options *ndo, * go past the end of the containing TLV). */ ib = indent_pr(indent, 0); - type = EXTRACT_BE_U_2(pdtlv->type); + type = GET_BE_U_2(pdtlv->type); dp = (const u_char *) TLV_DATA(pdtlv); if (ndo->ndo_vflag >= 3) @@ -1148,8 +1148,8 @@ recpdoptlv_print(netdissect_options *ndo, if (len) { ND_PRINT("\n\t\tMessy PATHDATA TLV header, type (0x%x)\n\t\texcess of %u Bytes ", - EXTRACT_BE_U_2(pdtlv->type), - len - EXTRACT_BE_U_2(pdtlv->length)); + GET_BE_U_2(pdtlv->type), + len - GET_BE_U_2(pdtlv->length)); return -1; } @@ -1191,17 +1191,17 @@ otlv_print(netdissect_options *ndo, * >= TLV_HDRL. */ ND_TCHECK_SIZE(otlv); - type = EXTRACT_BE_U_2(otlv->type); - tll = EXTRACT_BE_U_2(otlv->length) - TLV_HDRL; + type = GET_BE_U_2(otlv->type); + tll = GET_BE_U_2(otlv->length) - TLV_HDRL; ops = get_forces_optlv_h(type); if (ndo->ndo_vflag >= 3) { ND_PRINT("%sOper TLV %s(0x%x) length %u\n", ib, ops->s, type, - EXTRACT_BE_U_2(otlv->length)); + GET_BE_U_2(otlv->length)); } /* rest of ops must at least have 12B {pathinfo} */ if (tll < OP_MIN_SIZ) { ND_PRINT("\t\tOper TLV %s(0x%x) length %u\n", ops->s, type, - EXTRACT_BE_U_2(otlv->length)); + GET_BE_U_2(otlv->length)); ND_PRINT("\t\tTruncated data size %u minimum required %u\n", tll, OP_MIN_SIZ); return invoptlv_print(ndo, dp, tll, ops->op_msk, indent); @@ -1240,7 +1240,7 @@ asttlv_print(netdissect_options *ndo, return -1; } ND_TCHECK_4(pptr); - rescode = EXTRACT_BE_U_4(pptr); + rescode = GET_BE_U_4(pptr); if (rescode > ASTMCD) { ND_PRINT("illegal ASTresult result code: %u!\n", rescode); return -1; @@ -1298,7 +1298,7 @@ asrtlv_print(netdissect_options *ndo, return -1; } ND_TCHECK_4(pptr); - rescode = EXTRACT_BE_U_4(pptr); + rescode = GET_BE_U_4(pptr); if (rescode > ASRMCD) { ND_PRINT("illegal ASRresult result code: %u!\n", rescode); @@ -1364,10 +1364,10 @@ print_metailv(netdissect_options *ndo, * print_metatlv() has ensured that len (what remains in the * ILV) >= ILV_HDRL. */ - rlen = EXTRACT_BE_U_4(ilv->length) - ILV_HDRL; + rlen = GET_BE_U_4(ilv->length) - ILV_HDRL; ND_TCHECK_SIZE(ilv); - ND_PRINT("%sMetaID 0x%x length %u\n", ib, EXTRACT_BE_U_4(ilv->type), - EXTRACT_BE_U_4(ilv->length)); + ND_PRINT("%sMetaID 0x%x length %u\n", ib, GET_BE_U_4(ilv->type), + GET_BE_U_4(ilv->length)); if (ndo->ndo_vflag >= 3) { hex_print_with_offset(ndo, "\t\t[", ILV_DATA(ilv), rlen, 0); ND_PRINT(" ]\n"); @@ -1470,8 +1470,8 @@ redirect_print(netdissect_options *ndo, uint16_t type, tlvl; ND_TCHECK_SIZE(tlv); - type = EXTRACT_BE_U_2(tlv->type); - tlvl = EXTRACT_BE_U_2(tlv->length); + type = GET_BE_U_2(tlv->type); + tlvl = GET_BE_U_2(tlv->length); invtlv = tlv_valid(tlvl, rlen); if (invtlv) { ND_PRINT("Bad Redirect data\n"); @@ -1502,8 +1502,8 @@ redirect_print(netdissect_options *ndo, if (rlen) { ND_PRINT("\n\t\tMessy Redirect TLV header, type (0x%x)\n\t\texcess of %u Bytes ", - EXTRACT_BE_U_2(tlv->type), - rlen - EXTRACT_BE_U_2(tlv->length)); + GET_BE_U_2(tlv->type), + rlen - GET_BE_U_2(tlv->length)); return -1; } @@ -1551,9 +1551,9 @@ lfbselect_print(netdissect_options *ndo, if (ndo->ndo_vflag >= 3) { ND_PRINT("\n%s%s(Classid %x) instance %x\n", ib, - tok2str(ForCES_LFBs, NULL, EXTRACT_BE_U_4(lfbs->class)), - EXTRACT_BE_U_4(lfbs->class), - EXTRACT_BE_U_4(lfbs->instance)); + tok2str(ForCES_LFBs, NULL, GET_BE_U_4(lfbs->class)), + GET_BE_U_4(lfbs->class), + GET_BE_U_4(lfbs->instance)); } otlv = (const struct forces_tlv *)(lfbs + 1); @@ -1563,8 +1563,8 @@ lfbselect_print(netdissect_options *ndo, uint16_t type, tlvl; ND_TCHECK_SIZE(otlv); - type = EXTRACT_BE_U_2(otlv->type); - tlvl = EXTRACT_BE_U_2(otlv->length); + type = GET_BE_U_2(otlv->type); + tlvl = GET_BE_U_2(otlv->length); invtlv = tlv_valid(tlvl, rlen); if (invtlv) break; @@ -1588,8 +1588,8 @@ lfbselect_print(netdissect_options *ndo, if (rlen) { ND_PRINT("\n\t\tMessy oper TLV header, type (0x%x)\n\t\texcess of %u Bytes ", - EXTRACT_BE_U_2(otlv->type), - rlen - EXTRACT_BE_U_2(otlv->length)); + GET_BE_U_2(otlv->type), + rlen - GET_BE_U_2(otlv->length)); return -1; } @@ -1644,8 +1644,8 @@ forces_type_print(netdissect_options *ndo, u_int type, tlvl; ND_TCHECK_SIZE(tltlv); - type = EXTRACT_BE_U_2(tltlv->type); - tlvl = EXTRACT_BE_U_2(tltlv->length); + type = GET_BE_U_2(tltlv->type); + tlvl = GET_BE_U_2(tltlv->length); invtlv = tlv_valid(tlvl, rlen); if (invtlv) break; @@ -1684,7 +1684,7 @@ forces_type_print(netdissect_options *ndo, */ if (rlen) { ND_PRINT("\tMess TopTLV header: min %u, total %u advertised %u ", - TLV_HDRL, rlen, EXTRACT_BE_U_2(tltlv->length)); + TLV_HDRL, rlen, GET_BE_U_2(tltlv->length)); return -1; } @@ -1709,7 +1709,7 @@ forces_print(netdissect_options *ndo, ndo->ndo_protocol = "forces"; fhdr = (const struct forcesh *)pptr; ND_TCHECK_SIZE(fhdr); - tom = EXTRACT_U_1(fhdr->fm_tom); + tom = GET_U_1(fhdr->fm_tom); if (!tom_valid(tom)) { ND_PRINT("Invalid ForCES message type %u\n", tom); goto error; @@ -1731,14 +1731,14 @@ forces_print(netdissect_options *ndo, } ND_TCHECK_4(pptr + 20); - flg_raw = EXTRACT_BE_U_4(pptr + 20); + flg_raw = GET_BE_U_4(pptr + 20); if (ndo->ndo_vflag >= 1) { ND_PRINT("\n\tForCES Version %u len %uB flags 0x%08x ", ForCES_V(fhdr), mlen, flg_raw); ND_PRINT("\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_U_8(fhdr->fm_cor)); + GET_BE_U_8(fhdr->fm_cor)); } if (ndo->ndo_vflag >= 2) { @@ -104,18 +104,18 @@ static int parse_q922_header(netdissect_options *ndo, { if (!ND_TTEST_1(p) || length < 1) return -1; - if ((EXTRACT_U_1(p) & FR_EA_BIT)) + if ((GET_U_1(p) & FR_EA_BIT)) return 0; if (!ND_TTEST_1(p + 1) || length < 2) return -1; *addr_len = 2; - *dlci = ((EXTRACT_U_1(p) & 0xFC) << 2) | ((EXTRACT_U_1(p + 1) & 0xF0) >> 4); + *dlci = ((GET_U_1(p) & 0xFC) << 2) | ((GET_U_1(p + 1) & 0xF0) >> 4); - *flags = ((EXTRACT_U_1(p) & 0x02) << 24) | /* CR flag */ - ((EXTRACT_U_1(p + 1) & 0x0e) << 16); /* FECN,BECN,DE flags */ + *flags = ((GET_U_1(p) & 0x02) << 24) | /* CR flag */ + ((GET_U_1(p + 1) & 0x0e) << 16); /* FECN,BECN,DE flags */ - if (EXTRACT_U_1(p + 1) & FR_EA_BIT) + if (GET_U_1(p + 1) & FR_EA_BIT) return 1; /* 2-byte Q.922 address */ p += 2; @@ -123,8 +123,8 @@ static int parse_q922_header(netdissect_options *ndo, if (!ND_TTEST_1(p) || length < 1) return -1; (*addr_len)++; /* 3- or 4-byte Q.922 address */ - if ((EXTRACT_U_1(p) & FR_EA_BIT) == 0) { - *dlci = (*dlci << 7) | (EXTRACT_U_1(p) >> 1); + if ((GET_U_1(p) & FR_EA_BIT) == 0) { + *dlci = (*dlci << 7) | (GET_U_1(p) >> 1); (*addr_len)++; /* 4-byte Q.922 address */ p++; length--; @@ -132,12 +132,12 @@ static int parse_q922_header(netdissect_options *ndo, if (!ND_TTEST_1(p) || length < 1) return -1; - if ((EXTRACT_U_1(p) & FR_EA_BIT) == 0) + if ((GET_U_1(p) & FR_EA_BIT) == 0) return 0; /* more than 4 bytes of Q.922 address? */ - *flags = *flags | (EXTRACT_U_1(p) & 0x02); /* SDLC flag */ + *flags = *flags | (GET_U_1(p) & 0x02); /* SDLC flag */ - *dlci = (*dlci << 6) | (EXTRACT_U_1(p) >> 2); + *dlci = (*dlci << 6) | (GET_U_1(p) >> 2); return 1; } @@ -257,7 +257,7 @@ fr_print(netdissect_options *ndo, if (length < addr_len + 1) goto trunc; - if (EXTRACT_U_1(p + addr_len) != LLC_UI && dlci != 0) { + if (GET_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("UI %02x! ", EXTRACT_U_1(p + addr_len)); + ND_PRINT("UI %02x! ", GET_U_1(p + addr_len)); } else { - extracted_ethertype = EXTRACT_BE_U_2(p + addr_len); + extracted_ethertype = GET_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("UI %02x! ", EXTRACT_U_1(p + addr_len)); + ND_PRINT("UI %02x! ", GET_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_U_1(p + addr_len + 1) == 0) { + if (GET_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_U_1(p + hdr_len - 1); + nlpid = GET_U_1(p + hdr_len - 1); if (ndo->ndo_eflag) fr_hdr_print(ndo, length, addr_len, dlci, flags, nlpid); @@ -460,10 +460,10 @@ mfr_print(netdissect_options *ndo, ndo->ndo_protocol = "mfr"; ND_TCHECK_4(p); /* minimum frame header length */ - if ((EXTRACT_U_1(p) & MFR_BEC_MASK) == MFR_CTRL_FRAME && EXTRACT_U_1(p + 1) == 0) { + if ((GET_U_1(p) & MFR_BEC_MASK) == MFR_CTRL_FRAME && GET_U_1(p + 1) == 0) { ND_PRINT("FRF.16 Control, Flags [%s], %s, length %u", - 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)), + bittok2str(frf_flag_values,"none",(GET_U_1(p) & MFR_BEC_MASK)), + tok2str(mfr_ctrl_msg_values,"Unknown Message (0x%02x)",GET_U_1(p + 2)), length); tptr = p + 3; tlen = length -3; @@ -474,8 +474,8 @@ mfr_print(netdissect_options *ndo, while (tlen>sizeof(struct ie_tlv_header_t)) { ND_TCHECK_LEN(tptr, sizeof(struct ie_tlv_header_t)); - ie_type=EXTRACT_U_1(tptr); - ie_len=EXTRACT_U_1(tptr + 1); + ie_type=GET_U_1(tptr); + ie_len=GET_U_1(tptr + 1); ND_PRINT("\n\tIE %s (%u), length %u: ", tok2str(mfr_ctrl_ie_values,"Unknown",ie_type), @@ -495,14 +495,14 @@ mfr_print(netdissect_options *ndo, switch (ie_type) { case MFR_CTRL_IE_MAGIC_NUM: - ND_PRINT("0x%08x", EXTRACT_BE_U_4(tptr)); + ND_PRINT("0x%08x", GET_BE_U_4(tptr)); break; case MFR_CTRL_IE_BUNDLE_ID: /* same message format */ case MFR_CTRL_IE_LINK_ID: for (idx = 0; idx < ie_len && idx < MFR_ID_STRING_MAXLEN; idx++) { - if (EXTRACT_U_1(tptr + idx) != 0) /* don't print null termination */ - fn_print_char(ndo, EXTRACT_U_1(tptr + idx)); + if (GET_U_1(tptr + idx) != 0) /* don't print null termination */ + fn_print_char(ndo, GET_U_1(tptr + idx)); else break; } @@ -554,13 +554,13 @@ mfr_print(netdissect_options *ndo, * +----+----+----+----+----+----+----+----+ */ - sequence_num = (EXTRACT_U_1(p)&0x1e)<<7 | EXTRACT_U_1(p + 1); + sequence_num = (GET_U_1(p)&0x1e)<<7 | GET_U_1(p + 1); /* whole packet or first fragment ? */ - if ((EXTRACT_U_1(p) & MFR_BEC_MASK) == MFR_FRAG_FRAME || - (EXTRACT_U_1(p) & MFR_BEC_MASK) == MFR_B_BIT) { + if ((GET_U_1(p) & MFR_BEC_MASK) == MFR_FRAG_FRAME || + (GET_U_1(p) & MFR_BEC_MASK) == MFR_B_BIT) { ND_PRINT("FRF.16 Frag, seq %u, Flags [%s], ", sequence_num, - bittok2str(frf_flag_values,"none",(EXTRACT_U_1(p) & MFR_BEC_MASK))); + bittok2str(frf_flag_values,"none",(GET_U_1(p) & MFR_BEC_MASK))); hdr_len = 2; fr_print(ndo, p+hdr_len,length-hdr_len); return hdr_len; @@ -569,7 +569,7 @@ mfr_print(netdissect_options *ndo, /* must be a middle or the last fragment */ ND_PRINT("FRF.16 Frag, seq %u, Flags [%s]", sequence_num, - bittok2str(frf_flag_values,"none",(EXTRACT_U_1(p) & MFR_BEC_MASK))); + bittok2str(frf_flag_values,"none",(GET_U_1(p) & MFR_BEC_MASK))); print_unknown_data(ndo, p, "\n\t", length); return hdr_len; @@ -606,13 +606,13 @@ frf15_print(netdissect_options *ndo, goto trunc; ND_TCHECK_2(p); - flags = EXTRACT_U_1(p)&MFR_BEC_MASK; - sequence_num = (EXTRACT_U_1(p)&0x1e)<<7 | EXTRACT_U_1(p + 1); + flags = GET_U_1(p)&MFR_BEC_MASK; + sequence_num = (GET_U_1(p)&0x1e)<<7 | GET_U_1(p + 1); ND_PRINT("FRF.15, seq 0x%03x, Flags [%s],%s Fragmentation, length %u", sequence_num, bittok2str(frf_flag_values,"none",flags), - EXTRACT_U_1(p)&FR_FRF15_FRAGTYPE ? "Interface" : "End-to-End", + GET_U_1(p)&FR_FRF15_FRAGTYPE ? "Interface" : "End-to-End", length); /* TODO: @@ -816,7 +816,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_U_1(p) & 0x0f; + call_ref_length = GET_U_1(p) & 0x0f; p++; length--; @@ -830,7 +830,7 @@ q933_print(netdissect_options *ndo, ND_PRINT("length %u", olen); goto trunc; } - call_ref[i] = EXTRACT_U_1(p); + call_ref[i] = GET_U_1(p); p++; length--; } @@ -844,7 +844,7 @@ q933_print(netdissect_options *ndo, ND_PRINT("length %u", olen); goto trunc; } - msgtype = EXTRACT_U_1(p); + msgtype = GET_U_1(p); p++; length--; @@ -860,7 +860,7 @@ q933_print(netdissect_options *ndo, ND_PRINT("length %u", olen); goto trunc; } - iecode = EXTRACT_U_1(p); + iecode = GET_U_1(p); if (IE_IS_SHIFT(iecode)) { /* * It's a shift. Skip over it. @@ -911,7 +911,7 @@ q933_print(netdissect_options *ndo, if (call_ref_length != 0) { ND_TCHECK_1(p); - if (call_ref_length > 1 || EXTRACT_U_1(p) != 0) { + if (call_ref_length > 1 || GET_U_1(p) != 0) { /* * Not a dummy call reference. */ @@ -961,7 +961,7 @@ q933_print(netdissect_options *ndo, } goto trunc; } - iecode = EXTRACT_U_1(p); + iecode = GET_U_1(p); p++; length--; @@ -1004,7 +1004,7 @@ q933_print(netdissect_options *ndo, } goto trunc; } - ielength = EXTRACT_U_1(p); + ielength = GET_U_1(p); p++; length--; @@ -1086,8 +1086,8 @@ fr_q933_print_ie_codeset_0_5(netdissect_options *ndo, u_int iecode, } if (ndo->ndo_vflag) { ND_PRINT("%s (%u)", - tok2str(fr_lmi_report_type_ie_values,"unknown",EXTRACT_U_1(p)), - EXTRACT_U_1(p)); + tok2str(fr_lmi_report_type_ie_values,"unknown",GET_U_1(p)), + GET_U_1(p)); } return 1; @@ -1101,7 +1101,7 @@ fr_q933_print_ie_codeset_0_5(netdissect_options *ndo, u_int iecode, ND_PRINT("Invalid LINK VERIFY IE"); return 1; } - ND_PRINT("TX Seq: %3d, RX Seq: %3d", EXTRACT_U_1(p), EXTRACT_U_1(p + 1)); + ND_PRINT("TX Seq: %3d, RX Seq: %3d", GET_U_1(p), GET_U_1(p + 1)); return 1; case FR_LMI_ANSI_PVC_STATUS_IE: /* fall through */ @@ -1111,30 +1111,30 @@ fr_q933_print_ie_codeset_0_5(netdissect_options *ndo, u_int iecode, } /* now parse the DLCI information element. */ if ((ielength < 3) || - (EXTRACT_U_1(p) & 0x80) || - ((ielength == 3) && !(EXTRACT_U_1(p + 1) & 0x80)) || + (GET_U_1(p) & 0x80) || + ((ielength == 3) && !(GET_U_1(p + 1) & 0x80)) || ((ielength == 4) && - ((EXTRACT_U_1(p + 1) & 0x80) || !(EXTRACT_U_1(p + 2) & 0x80))) || + ((GET_U_1(p + 1) & 0x80) || !(GET_U_1(p + 2) & 0x80))) || ((ielength == 5) && - ((EXTRACT_U_1(p + 1) & 0x80) || (EXTRACT_U_1(p + 2) & 0x80) || - !(EXTRACT_U_1(p + 3) & 0x80))) || + ((GET_U_1(p + 1) & 0x80) || (GET_U_1(p + 2) & 0x80) || + !(GET_U_1(p + 3) & 0x80))) || (ielength > 5) || - !(EXTRACT_U_1(p + ielength - 1) & 0x80)) { + !(GET_U_1(p + ielength - 1) & 0x80)) { ND_PRINT("Invalid DLCI in PVC STATUS IE"); return 1; } - dlci = ((EXTRACT_U_1(p) & 0x3F) << 4) | ((EXTRACT_U_1(p + 1) & 0x78) >> 3); + dlci = ((GET_U_1(p) & 0x3F) << 4) | ((GET_U_1(p + 1) & 0x78) >> 3); if (ielength == 4) { - dlci = (dlci << 6) | ((EXTRACT_U_1(p + 2) & 0x7E) >> 1); + dlci = (dlci << 6) | ((GET_U_1(p + 2) & 0x7E) >> 1); } else if (ielength == 5) { - dlci = (dlci << 13) | (EXTRACT_U_1(p + 2) & 0x7F) | ((EXTRACT_U_1(p + 3) & 0x7E) >> 1); + dlci = (dlci << 13) | (GET_U_1(p + 2) & 0x7F) | ((GET_U_1(p + 3) & 0x7E) >> 1); } ND_PRINT("DLCI %u: status %s%s", dlci, - EXTRACT_U_1(p + ielength - 1) & 0x8 ? "New, " : "", - EXTRACT_U_1(p + ielength - 1) & 0x2 ? "Active" : "Inactive"); + GET_U_1(p + ielength - 1) & 0x8 ? "New, " : "", + GET_U_1(p + ielength - 1) & 0x2 ? "Active" : "Inactive"); return 1; } diff --git a/print-frag6.c b/print-frag6.c index 618e93bb..818cce2a 100644 --- a/print-frag6.c +++ b/print-frag6.c @@ -46,19 +46,19 @@ frag6_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2) if (ndo->ndo_vflag) { ND_PRINT("frag (0x%08x:%u|%u)", - EXTRACT_BE_U_4(dp->ip6f_ident), - EXTRACT_BE_U_2(dp->ip6f_offlg) & IP6F_OFF_MASK, - (u_int)(sizeof(struct ip6_hdr) + EXTRACT_BE_U_2(ip6->ip6_plen) - - (bp - bp2) - sizeof(struct ip6_frag))); + GET_BE_U_4(dp->ip6f_ident), + GET_BE_U_2(dp->ip6f_offlg) & IP6F_OFF_MASK, + (u_int)(sizeof(struct ip6_hdr) + GET_BE_U_2(ip6->ip6_plen) - + (bp - bp2) - sizeof(struct ip6_frag))); } else { ND_PRINT("frag (%u|%u)", - EXTRACT_BE_U_2(dp->ip6f_offlg) & IP6F_OFF_MASK, - (u_int)(sizeof(struct ip6_hdr) + EXTRACT_BE_U_2(ip6->ip6_plen) - - (bp - bp2) - sizeof(struct ip6_frag))); + GET_BE_U_2(dp->ip6f_offlg) & IP6F_OFF_MASK, + (u_int)(sizeof(struct ip6_hdr) + GET_BE_U_2(ip6->ip6_plen) - + (bp - bp2) - sizeof(struct ip6_frag))); } /* it is meaningless to decode non-first fragment */ - if ((EXTRACT_BE_U_2(dp->ip6f_offlg) & IP6F_OFF_MASK) != 0) + if ((GET_BE_U_2(dp->ip6f_offlg) & IP6F_OFF_MASK) != 0) return -1; else { diff --git a/print-geneve.c b/print-geneve.c index c6ec3a53..fa679110 100644 --- a/print-geneve.c +++ b/print-geneve.c @@ -112,9 +112,9 @@ geneve_opts_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_PRINT("%s", sep); sep = ", "; - opt_class = EXTRACT_BE_U_2(bp); - opt_type = EXTRACT_U_1(bp + 2); - opt_len = 4 + ((EXTRACT_U_1(bp + 3) & OPT_LEN_MASK) * 4); + opt_class = GET_BE_U_2(bp); + opt_type = GET_U_1(bp + 2); + opt_len = 4 + ((GET_U_1(bp + 3) & OPT_LEN_MASK) * 4); ND_PRINT("class %s (0x%x) type 0x%x%s len %u", format_opt_class(opt_class), opt_class, opt_type, @@ -132,7 +132,7 @@ geneve_opts_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_PRINT(" data"); for (i = 4; i < opt_len; i += 4) { - ND_PRINT(" %08x", EXTRACT_BE_U_4(data)); + ND_PRINT(" %08x", GET_BE_U_4(data)); data++; } } @@ -158,7 +158,7 @@ geneve_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_TCHECK_8(bp); - ver_opt = EXTRACT_U_1(bp); + ver_opt = GET_U_1(bp); bp += 1; len -= 1; @@ -168,19 +168,19 @@ geneve_print(netdissect_options *ndo, const u_char *bp, u_int len) return; } - flags = EXTRACT_U_1(bp); + flags = GET_U_1(bp); bp += 1; len -= 1; - prot = EXTRACT_BE_U_2(bp); + prot = GET_BE_U_2(bp); bp += 2; len -= 2; - vni = EXTRACT_BE_U_3(bp); + vni = GET_BE_U_3(bp); bp += 3; len -= 3; - reserved = EXTRACT_U_1(bp); + reserved = GET_U_1(bp); bp += 1; len -= 1; diff --git a/print-geonet.c b/print-geonet.c index af3f1ec9..7ede5f3e 100644 --- a/print-geonet.c +++ b/print-geonet.c @@ -65,8 +65,8 @@ print_btp_body(netdissect_options *ndo, /* Assuming ItsDpuHeader */ /* 2 bytes ND_TCHECKed in geonet_print() */ - version = EXTRACT_U_1(bp); - msg_type = EXTRACT_U_1(bp + 1); + version = GET_U_1(bp); + msg_type = GET_U_1(bp + 1); msg_type_str = tok2str(msg_type_values, "unknown (%u)", msg_type); ND_PRINT("; ItsPduHeader v:%u t:%u-%s", version, msg_type, msg_type_str); @@ -77,8 +77,8 @@ print_btp(netdissect_options *ndo, const u_char *bp) { /* 4 bytes ND_TCHECKed in geonet_print() */ - uint16_t dest = EXTRACT_BE_U_2(bp + 0); - uint16_t src = EXTRACT_BE_U_2(bp + 2); + uint16_t dest = GET_BE_U_2(bp + 0); + uint16_t src = GET_BE_U_2(bp + 2); ND_PRINT("; BTP Dst:%u Src:%u", dest, src); } @@ -92,9 +92,9 @@ print_long_pos_vector(netdissect_options *ndo, ND_PRINT("GN_ADDR:%s ", linkaddr_string (ndo, bp, 0, GEONET_ADDR_LEN)); ND_TCHECK_8(bp + 12); - lat = EXTRACT_BE_U_4(bp + 12); + lat = GET_BE_U_4(bp + 12); ND_PRINT("lat:%u ", lat); - lon = EXTRACT_BE_U_4(bp + 16); + lon = GET_BE_U_4(bp + 16); ND_PRINT("lon:%u", lon); return (0); trunc: @@ -131,12 +131,12 @@ geonet_print(netdissect_options *ndo, const u_char *bp, u_int length, goto invalid; ND_TCHECK_8(bp); - version = EXTRACT_U_1(bp) >> 4; - next_hdr = EXTRACT_U_1(bp) & 0x0f; - hdr_type = EXTRACT_U_1(bp + 1) >> 4; - hdr_subtype = EXTRACT_U_1(bp + 1) & 0x0f; - payload_length = EXTRACT_BE_U_2(bp + 4); - hop_limit = EXTRACT_U_1(bp + 7); + version = GET_U_1(bp) >> 4; + next_hdr = GET_U_1(bp) & 0x0f; + hdr_type = GET_U_1(bp + 1) >> 4; + hdr_subtype = GET_U_1(bp + 1) & 0x0f; + payload_length = GET_BE_U_2(bp + 4); + hop_limit = GET_U_1(bp + 7); switch (next_hdr) { case 0: next_hdr_txt = "Any"; break; diff --git a/print-gre.c b/print-gre.c index f363f8b1..773c030c 100644 --- a/print-gre.c +++ b/print-gre.c @@ -87,7 +87,7 @@ gre_print(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK_2(bp); if (len < 2) goto trunc; - vers = EXTRACT_BE_U_2(bp) & GRE_VERS_MASK; + vers = GET_BE_U_2(bp) & GRE_VERS_MASK; ND_PRINT("GREv%u",vers); switch(vers) { @@ -115,7 +115,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_U_2(bp); + flags = GET_BE_U_2(bp); if (ndo->ndo_vflag) ND_PRINT(", Flags [%s]", bittok2str(gre_flag_values,"none",flags)); @@ -126,7 +126,7 @@ gre_print_0(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK_2(bp); if (len < 2) goto trunc; - prot = EXTRACT_BE_U_2(bp); + prot = GET_BE_U_2(bp); len -= 2; bp += 2; @@ -135,14 +135,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(", sum 0x%x", EXTRACT_BE_U_2(bp)); + ND_PRINT(", sum 0x%x", GET_BE_U_2(bp)); bp += 2; len -= 2; ND_TCHECK_2(bp); if (len < 2) goto trunc; - ND_PRINT(", off 0x%x", EXTRACT_BE_U_2(bp)); + ND_PRINT(", off 0x%x", GET_BE_U_2(bp)); bp += 2; len -= 2; } @@ -151,7 +151,7 @@ gre_print_0(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK_4(bp); if (len < 4) goto trunc; - ND_PRINT(", key=0x%x", EXTRACT_BE_U_4(bp)); + ND_PRINT(", key=0x%x", GET_BE_U_4(bp)); bp += 4; len -= 4; } @@ -160,7 +160,7 @@ gre_print_0(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK_4(bp); if (len < 4) goto trunc; - ND_PRINT(", seq %u", EXTRACT_BE_U_4(bp)); + ND_PRINT(", seq %u", GET_BE_U_4(bp)); bp += 4; len -= 4; } @@ -174,9 +174,9 @@ gre_print_0(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK_4(bp); if (len < 4) goto trunc; - af = EXTRACT_BE_U_2(bp); - sreoff = EXTRACT_U_1(bp + 2); - srelen = EXTRACT_U_1(bp + 3); + af = GET_BE_U_2(bp); + sreoff = GET_U_1(bp + 2); + srelen = GET_U_1(bp + 3); bp += 4; len -= 4; @@ -242,7 +242,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_U_2(bp); + flags = GET_BE_U_2(bp); len -= 2; bp += 2; @@ -253,7 +253,7 @@ gre_print_1(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK_2(bp); if (len < 2) goto trunc; - prot = EXTRACT_BE_U_2(bp); + prot = GET_BE_U_2(bp); len -= 2; bp += 2; @@ -264,7 +264,7 @@ gre_print_1(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK_4(bp); if (len < 4) goto trunc; - k = EXTRACT_BE_U_4(bp); + k = GET_BE_U_4(bp); ND_PRINT(", call %u", k & 0xffff); len -= 4; bp += 4; @@ -274,7 +274,7 @@ gre_print_1(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK_4(bp); if (len < 4) goto trunc; - ND_PRINT(", seq %u", EXTRACT_BE_U_4(bp)); + ND_PRINT(", seq %u", GET_BE_U_4(bp)); bp += 4; len -= 4; } @@ -283,7 +283,7 @@ gre_print_1(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK_4(bp); if (len < 4) goto trunc; - ND_PRINT(", ack %u", EXTRACT_BE_U_4(bp)); + ND_PRINT(", ack %u", GET_BE_U_4(bp)); bp += 4; len -= 4; } @@ -406,7 +406,7 @@ gre_sre_asn_print(netdissect_options *ndo, uint8_t sreoff, uint8_t srelen, return (0); ND_PRINT(" %s%x", - ((bp - up) == sreoff) ? "*" : "", EXTRACT_BE_U_2(bp)); + ((bp - up) == sreoff) ? "*" : "", GET_BE_U_2(bp)); bp += 2; len -= 2; diff --git a/print-hncp.c b/print-hncp.c index 867c6ddc..4df4b1c4 100644 --- a/print-hncp.c +++ b/print-hncp.c @@ -163,8 +163,8 @@ format_nid(netdissect_options *ndo, const u_char *data) static int i = 0; i = (i + 1) % 4; nd_snprintf(buf[i], sizeof(buf[i]), "%02x:%02x:%02x:%02x", - EXTRACT_U_1(data), EXTRACT_U_1(data + 1), EXTRACT_U_1(data + 2), - EXTRACT_U_1(data + 3)); + GET_U_1(data), GET_U_1(data + 1), GET_U_1(data + 2), + GET_U_1(data + 3)); return buf[i]; } @@ -175,10 +175,10 @@ format_256(netdissect_options *ndo, const u_char *data) static int i = 0; i = (i + 1) % 4; nd_snprintf(buf[i], sizeof(buf[i]), "%016" PRIx64 "%016" PRIx64 "%016" PRIx64 "%016" PRIx64, - EXTRACT_BE_U_8(data), - EXTRACT_BE_U_8(data + 8), - EXTRACT_BE_U_8(data + 16), - EXTRACT_BE_U_8(data + 24) + GET_BE_U_8(data), + GET_BE_U_8(data + 8), + GET_BE_U_8(data + 16), + GET_BE_U_8(data + 24) ); return buf[i]; } @@ -208,12 +208,12 @@ print_prefix(netdissect_options *ndo, const u_char *prefix, u_int max_length) int plenbytes; char buf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx::/128")]; - if (EXTRACT_U_1(prefix) >= 96 && max_length >= IPV4_MAPPED_HEADING_LEN + 1 && + if (GET_U_1(prefix) >= 96 && max_length >= IPV4_MAPPED_HEADING_LEN + 1 && is_ipv4_mapped_address(prefix + 1)) { struct in_addr addr; u_int plen; - plen = EXTRACT_U_1(prefix) - 96; + plen = GET_U_1(prefix) - 96; if (32 < plen) return -1; max_length -= 1; @@ -243,7 +243,7 @@ print_dns_label(netdissect_options *ndo, { u_int length = 0; while (length < max_length) { - u_int lab_length = EXTRACT_U_1(cp + length); + u_int lab_length = GET_U_1(cp + length); length++; if (lab_length == 0) return (int)length; @@ -276,8 +276,8 @@ dhcpv4_print(netdissect_options *ndo, if (i + 2 > length) return -1; tlv = cp + i; - type = EXTRACT_U_1(tlv); - optlen = EXTRACT_U_1(tlv + 1); + type = GET_U_1(tlv); + optlen = GET_U_1(tlv + 1); value = tlv + 2; ND_PRINT("\n"); @@ -328,8 +328,8 @@ dhcpv6_print(netdissect_options *ndo, if (i + 4 > length) return -1; tlv = cp + i; - type = EXTRACT_BE_U_2(tlv); - optlen = EXTRACT_BE_U_2(tlv + 2); + type = GET_BE_U_2(tlv); + optlen = GET_BE_U_2(tlv + 2); value = tlv + 4; ND_PRINT("\n"); @@ -429,8 +429,8 @@ hncp_print_rec(netdissect_options *ndo, if (i + 4 > length) goto invalid; - type = EXTRACT_BE_U_2(tlv); - bodylen = EXTRACT_BE_U_2(tlv + 2); + type = GET_BE_U_2(tlv); + bodylen = GET_BE_U_2(tlv + 2); value = tlv + 4; ND_TCHECK_LEN(value, bodylen); if (i + bodylen + 4 > length) @@ -502,7 +502,7 @@ hncp_print_rec(netdissect_options *ndo, break; } node_identifier = format_nid(ndo, value); - endpoint_identifier = EXTRACT_BE_U_4(value + 4); + endpoint_identifier = GET_BE_U_4(value + 4); ND_PRINT(" NID: %s EPID: %08x", node_identifier, endpoint_identifier @@ -516,7 +516,7 @@ hncp_print_rec(netdissect_options *ndo, nd_print_invalid(ndo); break; } - hash = EXTRACT_BE_U_8(value); + hash = GET_BE_U_8(value); ND_PRINT(" hash: %016" PRIx64, hash); } break; @@ -530,9 +530,9 @@ hncp_print_rec(netdissect_options *ndo, break; } node_identifier = format_nid(ndo, value); - sequence_number = EXTRACT_BE_U_4(value + 4); - interval = format_interval(EXTRACT_BE_U_4(value + 8)); - hash = EXTRACT_BE_U_8(value + 12); + sequence_number = GET_BE_U_4(value + 4); + interval = format_interval(GET_BE_U_4(value + 8)); + hash = GET_BE_U_8(value + 12); ND_PRINT(" NID: %s seqno: %u %s hash: %016" PRIx64, node_identifier, sequence_number, @@ -551,8 +551,8 @@ hncp_print_rec(netdissect_options *ndo, break; } peer_node_identifier = format_nid(ndo, value); - peer_endpoint_identifier = EXTRACT_BE_U_4(value + 4); - endpoint_identifier = EXTRACT_BE_U_4(value + 8); + peer_endpoint_identifier = GET_BE_U_4(value + 4); + endpoint_identifier = GET_BE_U_4(value + 8); ND_PRINT(" Peer-NID: %s Peer-EPID: %08x Local-EPID: %08x", peer_node_identifier, peer_endpoint_identifier, @@ -568,8 +568,8 @@ hncp_print_rec(netdissect_options *ndo, nd_print_invalid(ndo); break; } - endpoint_identifier = EXTRACT_BE_U_4(value); - interval = format_interval(EXTRACT_BE_U_4(value + 4)); + endpoint_identifier = GET_BE_U_4(value); + interval = format_interval(GET_BE_U_4(value + 4)); ND_PRINT(" EPID: %08x Interval: %s", endpoint_identifier, interval @@ -583,7 +583,7 @@ hncp_print_rec(netdissect_options *ndo, break; } ND_PRINT(" Verdict: %u Fingerprint: %s Common Name: ", - EXTRACT_U_1(value), + GET_U_1(value), format_256(ndo, value + 4)); (void)nd_printzp(ndo, value + 36, bodylen - 36, NULL); } @@ -596,7 +596,7 @@ hncp_print_rec(netdissect_options *ndo, nd_print_invalid(ndo); break; } - capabilities = EXTRACT_BE_U_2(value + 2); + capabilities = GET_BE_U_2(value + 2); M = (uint8_t)((capabilities >> 12) & 0xf); P = (uint8_t)((capabilities >> 8) & 0xf); H = (uint8_t)((capabilities >> 4) & 0xf); @@ -616,13 +616,13 @@ hncp_print_rec(netdissect_options *ndo, case HNCP_DELEGATED_PREFIX: { int l; - if (bodylen < 9 || bodylen < 9 + (EXTRACT_U_1(value + 8) + 7) / 8) { + if (bodylen < 9 || bodylen < 9 + (GET_U_1(value + 8) + 7) / 8) { nd_print_invalid(ndo); break; } ND_PRINT(" VLSO: %s PLSO: %s Prefix: ", - format_interval(EXTRACT_BE_U_4(value)), - format_interval(EXTRACT_BE_U_4(value + 4)) + format_interval(GET_BE_U_4(value)), + format_interval(GET_BE_U_4(value + 4)) ); l = print_prefix(ndo, value + 8, bodylen - 8); if (l == -1) { @@ -656,7 +656,7 @@ hncp_print_rec(netdissect_options *ndo, nd_print_invalid(ndo); break; } - policy = EXTRACT_U_1(value); + policy = GET_U_1(value); ND_PRINT(" type: "); if (policy == 0) { if (bodylen != 1) { @@ -727,13 +727,13 @@ hncp_print_rec(netdissect_options *ndo, case HNCP_ASSIGNED_PREFIX: { uint8_t prty; int l; - if (bodylen < 6 || bodylen < 6 + (EXTRACT_U_1(value + 5) + 7) / 8) { + if (bodylen < 6 || bodylen < 6 + (GET_U_1(value + 5) + 7) / 8) { nd_print_invalid(ndo); break; } - prty = EXTRACT_U_1(value + 4) & 0xf; + prty = GET_U_1(value + 4) & 0xf; ND_PRINT(" EPID: %08x Prty: %u", - EXTRACT_BE_U_4(value), + GET_BE_U_4(value), prty ); ND_PRINT(" Prefix: "); @@ -756,7 +756,7 @@ hncp_print_rec(netdissect_options *ndo, nd_print_invalid(ndo); break; } - endpoint_identifier = EXTRACT_BE_U_4(value); + endpoint_identifier = GET_BE_U_4(value); ip_address = format_ip6addr(ndo, value + 4); ND_PRINT(" EPID: %08x IP Address: %s", endpoint_identifier, @@ -777,9 +777,9 @@ hncp_print_rec(netdissect_options *ndo, ip_address = format_ip6addr(ndo, value); ND_PRINT(" IP-Address: %s %c%c%c ", ip_address, - (EXTRACT_U_1(value + 16) & 4) ? 'l' : '-', - (EXTRACT_U_1(value + 16) & 2) ? 'b' : '-', - (EXTRACT_U_1(value + 16) & 1) ? 's' : '-' + (GET_U_1(value + 16) & 4) ? 'l' : '-', + (GET_U_1(value + 16) & 2) ? 'b' : '-', + (GET_U_1(value + 16) & 1) ? 's' : '-' ); len = print_dns_label(ndo, value+17, bodylen-17, 1); if (len < 0) { @@ -809,7 +809,7 @@ hncp_print_rec(netdissect_options *ndo, nd_print_invalid(ndo); break; } - l = EXTRACT_U_1(value + 16); + l = GET_U_1(value + 16); if (bodylen < 17 + l) { nd_print_invalid(ndo); break; diff --git a/print-hsrp.c b/print-hsrp.c index 138a8c05..7daed4f0 100644 --- a/print-hsrp.c +++ b/print-hsrp.c @@ -101,30 +101,32 @@ hsrp_print(netdissect_options *ndo, const u_char *bp, u_int len) ndo->ndo_protocol = "hsrp"; ND_TCHECK_1(hp->hsrp_version); - version = EXTRACT_U_1(hp->hsrp_version); + version = GET_U_1(hp->hsrp_version); ND_PRINT("HSRPv%u", version); if (version != 0) return; ND_TCHECK_1(hp->hsrp_op_code); ND_PRINT("-"); - ND_PRINT("%s ", tok2strary(op_code_str, "unknown (%u)", EXTRACT_U_1(hp->hsrp_op_code))); + ND_PRINT("%s ", + tok2strary(op_code_str, "unknown (%u)", GET_U_1(hp->hsrp_op_code))); ND_PRINT("%u: ", len); ND_TCHECK_1(hp->hsrp_state); - ND_PRINT("state=%s ", tok2str(states, "Unknown (%u)", EXTRACT_U_1(hp->hsrp_state))); + ND_PRINT("state=%s ", + tok2str(states, "Unknown (%u)", GET_U_1(hp->hsrp_state))); ND_TCHECK_1(hp->hsrp_group); - ND_PRINT("group=%u ", EXTRACT_U_1(hp->hsrp_group)); + ND_PRINT("group=%u ", GET_U_1(hp->hsrp_group)); ND_TCHECK_1(hp->hsrp_reserved); - if (EXTRACT_U_1(hp->hsrp_reserved) != 0) { - ND_PRINT("[reserved=%u!] ", EXTRACT_U_1(hp->hsrp_reserved)); + if (GET_U_1(hp->hsrp_reserved) != 0) { + ND_PRINT("[reserved=%u!] ", GET_U_1(hp->hsrp_reserved)); } ND_TCHECK_4(hp->hsrp_virtaddr); ND_PRINT("addr=%s", ipaddr_string(ndo, hp->hsrp_virtaddr)); if (ndo->ndo_vflag) { ND_PRINT(" hellotime="); - unsigned_relts_print(ndo, EXTRACT_U_1(hp->hsrp_hellotime)); + unsigned_relts_print(ndo, GET_U_1(hp->hsrp_hellotime)); ND_PRINT(" holdtime="); - unsigned_relts_print(ndo, EXTRACT_U_1(hp->hsrp_holdtime)); - ND_PRINT(" priority=%u", EXTRACT_U_1(hp->hsrp_priority)); + unsigned_relts_print(ndo, GET_U_1(hp->hsrp_holdtime)); + ND_PRINT(" priority=%u", GET_U_1(hp->hsrp_priority)); ND_PRINT(" auth=\""); if (nd_printn(ndo, hp->hsrp_authdata, sizeof(hp->hsrp_authdata), ndo->ndo_snapend)) { diff --git a/print-icmp.c b/print-icmp.c index 91af3ec3..2b8c1ff7 100644 --- a/print-icmp.c +++ b/print-icmp.c @@ -354,8 +354,8 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * str = buf; ND_TCHECK_1(dp->icmp_code); - icmp_type = EXTRACT_U_1(dp->icmp_type); - icmp_code = EXTRACT_U_1(dp->icmp_code); + icmp_type = GET_U_1(dp->icmp_type); + icmp_code = GET_U_1(dp->icmp_code); switch (icmp_type) { case ICMP_ECHO: @@ -364,8 +364,8 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * (void)nd_snprintf(buf, sizeof(buf), "echo %s, id %u, seq %u", icmp_type == ICMP_ECHO ? "request" : "reply", - EXTRACT_BE_U_2(dp->icmp_id), - EXTRACT_BE_U_2(dp->icmp_seq)); + GET_BE_U_2(dp->icmp_id), + GET_BE_U_2(dp->icmp_seq)); break; case ICMP_UNREACH: @@ -377,7 +377,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * (void)nd_snprintf(buf, sizeof(buf), "%s protocol %u unreachable", ipaddr_string(ndo, dp->icmp_ip.ip_dst), - EXTRACT_U_1(dp->icmp_ip.ip_p)); + GET_U_1(dp->icmp_ip.ip_p)); break; case ICMP_UNREACH_PORT: @@ -386,8 +386,8 @@ 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_2(ouh->uh_dport); - dport = EXTRACT_BE_U_2(ouh->uh_dport); - ip_proto = EXTRACT_U_1(oip->ip_p); + dport = GET_BE_U_2(ouh->uh_dport); + ip_proto = GET_U_1(oip->ip_p); switch (ip_proto) { case IPPROTO_TCP: @@ -417,7 +417,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * { const struct mtu_discovery *mp; mp = (const struct mtu_discovery *)(const u_char *)&dp->icmp_void; - mtu = EXTRACT_BE_U_2(mp->nexthopmtu); + mtu = GET_BE_U_2(mp->nexthopmtu); if (mtu) { (void)nd_snprintf(buf, sizeof(buf), "%s unreachable - need to frag (mtu %u)", @@ -461,7 +461,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * ND_TCHECK_SIZE(ihp); (void)strncpy(cp, " lifetime ", sizeof(buf) - (cp - buf)); cp = buf + strlen(buf); - lifetime = EXTRACT_BE_U_2(ihp->ird_lifetime); + lifetime = GET_BE_U_2(ihp->ird_lifetime); if (lifetime < 60) { (void)nd_snprintf(cp, sizeof(buf) - (cp - buf), "%u", lifetime); @@ -477,11 +477,11 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * } cp = buf + strlen(buf); - num = EXTRACT_U_1(ihp->ird_addrnum); + num = GET_U_1(ihp->ird_addrnum); (void)nd_snprintf(cp, sizeof(buf) - (cp - buf), " %u:", num); cp = buf + strlen(buf); - size = EXTRACT_U_1(ihp->ird_addrsiz); + size = GET_U_1(ihp->ird_addrsiz); if (size != 2) { (void)nd_snprintf(cp, sizeof(buf) - (cp - buf), " [size %u]", size); @@ -492,7 +492,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * ND_TCHECK_SIZE(idp); (void)nd_snprintf(cp, sizeof(buf) - (cp - buf), " {%s %u}", ipaddr_string(ndo, idp->ird_addr), - EXTRACT_BE_U_4(idp->ird_pref)); + GET_BE_U_4(idp->ird_pref)); cp = buf + strlen(buf); ++idp; num--; @@ -526,36 +526,37 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * else { ND_TCHECK_1(dp->icmp_pptr); (void)nd_snprintf(buf, sizeof(buf), - "parameter problem - octet %u", EXTRACT_U_1(dp->icmp_pptr)); + "parameter problem - octet %u", + GET_U_1(dp->icmp_pptr)); } break; case ICMP_MASKREPLY: ND_TCHECK_4(dp->icmp_mask); (void)nd_snprintf(buf, sizeof(buf), "address mask is 0x%08x", - EXTRACT_BE_U_4(dp->icmp_mask)); + GET_BE_U_4(dp->icmp_mask)); break; case ICMP_TSTAMP: ND_TCHECK_2(dp->icmp_seq); (void)nd_snprintf(buf, sizeof(buf), "time stamp query id %u seq %u", - EXTRACT_BE_U_2(dp->icmp_id), - EXTRACT_BE_U_2(dp->icmp_seq)); + GET_BE_U_2(dp->icmp_id), + GET_BE_U_2(dp->icmp_seq)); break; case ICMP_TSTAMPREPLY: ND_TCHECK_4(dp->icmp_ttime); (void)nd_snprintf(buf, sizeof(buf), "time stamp reply id %u seq %u: org %s", - EXTRACT_BE_U_2(dp->icmp_id), - EXTRACT_BE_U_2(dp->icmp_seq), - icmp_tstamp_print(EXTRACT_BE_U_4(dp->icmp_otime))); + GET_BE_U_2(dp->icmp_id), + GET_BE_U_2(dp->icmp_seq), + icmp_tstamp_print(GET_BE_U_4(dp->icmp_otime))); (void)nd_snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", recv %s", - icmp_tstamp_print(EXTRACT_BE_U_4(dp->icmp_rtime))); + icmp_tstamp_print(GET_BE_U_4(dp->icmp_rtime))); (void)nd_snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", xmit %s", - icmp_tstamp_print(EXTRACT_BE_U_4(dp->icmp_ttime))); + icmp_tstamp_print(GET_BE_U_4(dp->icmp_ttime))); break; default: @@ -571,7 +572,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_U_2(dp->icmp_cksum); + uint16_t icmp_sum = GET_BE_U_2(dp->icmp_cksum); ND_PRINT(" (wrong icmp cksum %x (->%x)!)", icmp_sum, in_cksum_shouldbe(icmp_sum, sum)); @@ -589,7 +590,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_U_2(ip->ip_len)); + ip_print(ndo, bp, GET_BE_U_2(ip->ip_len)); ndo->ndo_snapend = snapend_save; } @@ -609,7 +610,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * * to check if an extension header is present. This is expedient, * however not all implementations set the length field proper. */ - if (EXTRACT_U_1(ext_dp->icmp_length) == 0 && + if (GET_U_1(ext_dp->icmp_length) == 0 && ND_TTEST_LEN(ext_dp->icmp_ext_version_res, plen - ICMP_EXTD_MINLEN)) { vec[0].ptr = (const uint8_t *)(const void *)&ext_dp->icmp_ext_version_res; vec[0].len = plen - ICMP_EXTD_MINLEN; @@ -635,7 +636,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(", checksum 0x%04x (%scorrect), length %u", - EXTRACT_BE_U_2(ext_dp->icmp_ext_checksum), + GET_BE_U_2(ext_dp->icmp_ext_checksum), in_cksum(vec, 1) ? "in" : "", hlen); } @@ -647,9 +648,9 @@ 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_SIZE(icmp_mpls_ext_object_header); - obj_tlen = EXTRACT_BE_U_2(icmp_mpls_ext_object_header->length); - obj_class_num = EXTRACT_U_1(icmp_mpls_ext_object_header->class_num); - obj_ctype = EXTRACT_U_1(icmp_mpls_ext_object_header->ctype); + obj_tlen = GET_BE_U_2(icmp_mpls_ext_object_header->length); + obj_class_num = GET_U_1(icmp_mpls_ext_object_header->class_num); + obj_ctype = GET_U_1(icmp_mpls_ext_object_header->ctype); obj_tptr += sizeof(struct icmp_mpls_ext_object_header_t); ND_PRINT("\n\t %s Object (%u), Class-Type: %u, length %u", @@ -672,7 +673,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * switch(obj_ctype) { case 1: ND_TCHECK_4(obj_tptr); - raw_label = EXTRACT_BE_U_4(obj_tptr); + raw_label = GET_BE_U_4(obj_tptr); ND_PRINT("\n\t label %u, exp %u", MPLS_LABEL(raw_label), MPLS_EXP(raw_label)); if (MPLS_STACK(raw_label)) ND_PRINT(", [S]"); diff --git a/print-icmp6.c b/print-icmp6.c index eb662c3c..72e353d1 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -772,7 +772,7 @@ print_lladdr(netdissect_options *ndo, const uint8_t *p, size_t l) while (l > 0 && q < ep) { if (q > p) ND_PRINT(":"); - ND_PRINT("%02x", EXTRACT_U_1(q)); + ND_PRINT("%02x", GET_U_1(q)); q++; l--; } @@ -816,14 +816,14 @@ rpl_printopts(netdissect_options *ndo, const uint8_t *opts, u_int length) while (length != 0) { opt = (const struct rpl_genoption *)opts; ND_TCHECK_1(opt->rpl_dio_type); - dio_type = EXTRACT_U_1(opt->rpl_dio_type); + dio_type = GET_U_1(opt->rpl_dio_type); if (dio_type == RPL_OPT_PAD1) { optlen = 1; ND_PRINT(" opt:pad1"); } else { if (length < RPL_GENOPTION_LEN) goto trunc; - optlen = EXTRACT_U_1(opt->rpl_dio_len)+RPL_GENOPTION_LEN; + optlen = GET_U_1(opt->rpl_dio_len)+RPL_GENOPTION_LEN; ND_PRINT(" opt:%s len:%u ", tok2str(rpl_subopt_values, "subopt:%u", dio_type), optlen); @@ -858,12 +858,12 @@ rpl_dio_print(netdissect_options *ndo, ND_PRINT(" [dagid:%s,seq:%u,instance:%u,rank:%u,%smop:%s,prf:%u]", dagid_str, - EXTRACT_U_1(dio->rpl_dtsn), - EXTRACT_U_1(dio->rpl_instanceid), - EXTRACT_BE_U_2(dio->rpl_dagrank), - RPL_DIO_GROUNDED(EXTRACT_U_1(dio->rpl_mopprf)) ? "grounded,":"", - tok2str(rpl_mop_values, "mop%u", RPL_DIO_MOP(EXTRACT_U_1(dio->rpl_mopprf))), - RPL_DIO_PRF(EXTRACT_U_1(dio->rpl_mopprf))); + GET_U_1(dio->rpl_dtsn), + GET_U_1(dio->rpl_instanceid), + GET_BE_U_2(dio->rpl_dagrank), + RPL_DIO_GROUNDED(GET_U_1(dio->rpl_mopprf)) ? "grounded,":"", + tok2str(rpl_mop_values, "mop%u", RPL_DIO_MOP(GET_U_1(dio->rpl_mopprf))), + RPL_DIO_PRF(GET_U_1(dio->rpl_mopprf))); if(ndo->ndo_vflag > 1) { rpl_printopts(ndo, bp + sizeof(struct nd_rpl_dio), @@ -889,7 +889,7 @@ rpl_dao_print(netdissect_options *ndo, bp += ND_RPL_DAO_MIN_LEN; length -= ND_RPL_DAO_MIN_LEN; - rpl_flags = EXTRACT_U_1(dao->rpl_flags); + rpl_flags = GET_U_1(dao->rpl_flags); if(RPL_DAO_D(rpl_flags)) { ND_TCHECK_LEN(dao->rpl_dagid, DAGID_LEN); if (length < DAGID_LEN) @@ -901,8 +901,8 @@ rpl_dao_print(netdissect_options *ndo, ND_PRINT(" [dagid:%s,seq:%u,instance:%u%s%s,%02x]", dagid_str, - EXTRACT_U_1(dao->rpl_daoseq), - EXTRACT_U_1(dao->rpl_instanceid), + GET_U_1(dao->rpl_daoseq), + GET_U_1(dao->rpl_instanceid), RPL_DAO_K(rpl_flags) ? ",acK":"", RPL_DAO_D(rpl_flags) ? ",Dagid":"", rpl_flags); @@ -934,7 +934,7 @@ rpl_daoack_print(netdissect_options *ndo, bp += ND_RPL_DAOACK_MIN_LEN; length -= ND_RPL_DAOACK_MIN_LEN; - if(RPL_DAOACK_D(EXTRACT_U_1(daoack->rpl_flags))) { + if(RPL_DAOACK_D(GET_U_1(daoack->rpl_flags))) { ND_TCHECK_LEN(daoack->rpl_dagid, DAGID_LEN); if (length < DAGID_LEN) goto tooshort; @@ -945,9 +945,9 @@ rpl_daoack_print(netdissect_options *ndo, ND_PRINT(" [dagid:%s,seq:%u,instance:%u,status:%u]", dagid_str, - EXTRACT_U_1(daoack->rpl_daoseq), - EXTRACT_U_1(daoack->rpl_instanceid), - EXTRACT_U_1(daoack->rpl_status)); + GET_U_1(daoack->rpl_daoseq), + GET_U_1(daoack->rpl_instanceid), + GET_U_1(daoack->rpl_status)); /* no officially defined options for DAOACK, but print any we find */ if(ndo->ndo_vflag > 1) { @@ -1052,7 +1052,7 @@ icmp6_print(netdissect_options *ndo, if (ND_TTEST_LEN(bp, length)) { ND_TCHECK_2(dp->icmp6_cksum); - udp_sum = EXTRACT_BE_U_2(dp->icmp6_cksum); + udp_sum = GET_BE_U_2(dp->icmp6_cksum); sum = icmp6_cksum(ndo, ip, dp, length); if (sum != 0) ND_PRINT("[bad icmp6 cksum 0x%04x -> 0x%04x!] ", @@ -1064,7 +1064,7 @@ icmp6_print(netdissect_options *ndo, } ND_TCHECK_1(dp->icmp6_type); - icmp6_type = EXTRACT_U_1(dp->icmp6_type); + icmp6_type = GET_U_1(dp->icmp6_type); ND_PRINT("ICMP6, %s", tok2str(icmp6_type_values,"unknown icmp6 type (%u)",icmp6_type)); /* display cosmetics: print the packet length for printer that use the vflag now */ @@ -1078,7 +1078,7 @@ icmp6_print(netdissect_options *ndo, ND_PRINT(", length %u", length); ND_TCHECK_1(dp->icmp6_code); - icmp6_code = EXTRACT_U_1(dp->icmp6_code); + icmp6_code = GET_U_1(dp->icmp6_code); switch (icmp6_type) { case ICMP6_DST_UNREACH: @@ -1101,7 +1101,7 @@ icmp6_print(netdissect_options *ndo, == NULL) goto trunc; - dport = EXTRACT_BE_U_2(ouh->uh_dport); + dport = GET_BE_U_2(ouh->uh_dport); switch (prot) { case IPPROTO_TCP: ND_PRINT(", %s tcp port %s", @@ -1130,7 +1130,7 @@ icmp6_print(netdissect_options *ndo, break; case ICMP6_PACKET_TOO_BIG: ND_TCHECK_4(dp->icmp6_mtu); - ND_PRINT(", mtu %u", EXTRACT_BE_U_4(dp->icmp6_mtu)); + ND_PRINT(", mtu %u", GET_BE_U_4(dp->icmp6_mtu)); break; case ICMP6_TIME_EXCEEDED: ND_TCHECK_16(oip->ip6_dst); @@ -1151,13 +1151,16 @@ icmp6_print(netdissect_options *ndo, ND_TCHECK_16(oip->ip6_dst); switch (icmp6_code) { case ICMP6_PARAMPROB_HEADER: - ND_PRINT(", erroneous - octet %u", EXTRACT_BE_U_4(dp->icmp6_pptr)); + ND_PRINT(", erroneous - octet %u", + GET_BE_U_4(dp->icmp6_pptr)); break; case ICMP6_PARAMPROB_NEXTHEADER: - ND_PRINT(", next header - octet %u", EXTRACT_BE_U_4(dp->icmp6_pptr)); + ND_PRINT(", next header - octet %u", + GET_BE_U_4(dp->icmp6_pptr)); break; case ICMP6_PARAMPROB_OPTION: - ND_PRINT(", option - octet %u", EXTRACT_BE_U_4(dp->icmp6_pptr)); + ND_PRINT(", option - octet %u", + GET_BE_U_4(dp->icmp6_pptr)); break; default: ND_PRINT(", code-#%u", @@ -1169,7 +1172,8 @@ icmp6_print(netdissect_options *ndo, case ICMP6_ECHO_REPLY: /* The check below covers both icmp6_id and icmp6_seq. */ ND_TCHECK_2(dp->icmp6_seq); - ND_PRINT(", id %u, seq %u", EXTRACT_BE_U_2(dp->icmp6_id), EXTRACT_BE_U_2(dp->icmp6_seq)); + ND_PRINT(", id %u, seq %u", GET_BE_U_2(dp->icmp6_id), + GET_BE_U_2(dp->icmp6_seq)); break; case ICMP6_MEMBERSHIP_QUERY: if (length == MLD_MINLEN) { @@ -1204,12 +1208,12 @@ icmp6_print(netdissect_options *ndo, ND_TCHECK_4(p->nd_ra_retransmit); ND_PRINT("\n\thop limit %u, Flags [%s]" ", pref %s, router lifetime %us, reachable time %ums, retrans timer %ums", - EXTRACT_U_1(p->nd_ra_curhoplimit), - bittok2str(icmp6_opt_ra_flag_values,"none",EXTRACT_U_1(p->nd_ra_flags_reserved)), - get_rtpref(EXTRACT_U_1(p->nd_ra_flags_reserved)), - 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)); + GET_U_1(p->nd_ra_curhoplimit), + bittok2str(icmp6_opt_ra_flag_values,"none",GET_U_1(p->nd_ra_flags_reserved)), + get_rtpref(GET_U_1(p->nd_ra_flags_reserved)), + GET_BE_U_2(p->nd_ra_router_lifetime), + GET_BE_U_4(p->nd_ra_reachable), + GET_BE_U_4(p->nd_ra_retransmit)); if (icmp6_opt_print(ndo, (const u_char *)dp + RTADVLEN, length - RTADVLEN) == -1) @@ -1242,7 +1246,7 @@ icmp6_print(netdissect_options *ndo, ND_PRINT(", Flags [%s]", bittok2str(icmp6_nd_na_flag_values, "none", - EXTRACT_BE_U_4(p->nd_na_flags_reserved))); + GET_BE_U_4(p->nd_na_flags_reserved))); #define NDADVLEN 24 if (icmp6_opt_print(ndo, (const u_char *)dp + NDADVLEN, length - NDADVLEN) == -1) @@ -1285,7 +1289,7 @@ icmp6_print(netdissect_options *ndo, case ICMP6_MOBILEPREFIX_SOLICIT: /* fall through */ case ICMP6_HADISCOV_REQUEST: ND_TCHECK_2(dp->icmp6_data16[0]); - ND_PRINT(", id 0x%04x", EXTRACT_BE_U_2(dp->icmp6_data16[0])); + ND_PRINT(", id 0x%04x", GET_BE_U_2(dp->icmp6_data16[0])); break; case ICMP6_HADISCOV_REPLY: if (ndo->ndo_vflag) { @@ -1293,7 +1297,8 @@ icmp6_print(netdissect_options *ndo, const u_char *p; ND_TCHECK_2(dp->icmp6_data16[0]); - ND_PRINT(", id 0x%04x", EXTRACT_BE_U_2(dp->icmp6_data16[0])); + ND_PRINT(", id 0x%04x", + GET_BE_U_2(dp->icmp6_data16[0])); cp = (const u_char *)dp + length; p = (const u_char *)(dp + 1); while (p < cp) { @@ -1308,9 +1313,10 @@ icmp6_print(netdissect_options *ndo, uint16_t flags; ND_TCHECK_2(dp->icmp6_data16[0]); - ND_PRINT(", id 0x%04x", EXTRACT_BE_U_2(dp->icmp6_data16[0])); + ND_PRINT(", id 0x%04x", + GET_BE_U_2(dp->icmp6_data16[0])); ND_TCHECK_2(dp->icmp6_data16[1]); - flags = EXTRACT_BE_U_2(dp->icmp6_data16[1]); + flags = GET_BE_U_2(dp->icmp6_data16[1]); if (flags & 0xc000) ND_PRINT(" "); if (flags & 0x8000) @@ -1358,7 +1364,7 @@ get_upperlayer(netdissect_options *ndo, const u_char *bp, u_int *prot) if (!ND_TTEST_1(ip6->ip6_nxt)) return NULL; - nh = EXTRACT_U_1(ip6->ip6_nxt); + nh = GET_U_1(ip6->ip6_nxt); hlen = sizeof(struct ip6_hdr); while (bp < ep) { @@ -1382,8 +1388,8 @@ get_upperlayer(netdissect_options *ndo, const u_char *bp, u_int *prot) hbh = (const struct ip6_hbh *)bp; if (!ND_TTEST_1(hbh->ip6h_len)) return(NULL); - nh = EXTRACT_U_1(hbh->ip6h_nxt); - hlen = (EXTRACT_U_1(hbh->ip6h_len) + 1) << 3; + nh = GET_U_1(hbh->ip6h_nxt); + hlen = (GET_U_1(hbh->ip6h_len) + 1) << 3; break; case IPPROTO_FRAGMENT: /* this should be odd, but try anyway */ @@ -1391,9 +1397,9 @@ get_upperlayer(netdissect_options *ndo, const u_char *bp, u_int *prot) if (!ND_TTEST_2(fragh->ip6f_offlg)) return(NULL); /* fragments with non-zero offset are meaningless */ - if ((EXTRACT_BE_U_2(fragh->ip6f_offlg) & IP6F_OFF_MASK) != 0) + if ((GET_BE_U_2(fragh->ip6f_offlg) & IP6F_OFF_MASK) != 0) return(NULL); - nh = EXTRACT_U_1(fragh->ip6f_nxt); + nh = GET_U_1(fragh->ip6f_nxt); hlen = sizeof(struct ip6_frag); break; @@ -1401,8 +1407,8 @@ get_upperlayer(netdissect_options *ndo, const u_char *bp, u_int *prot) ah = (const struct ah *)bp; if (!ND_TTEST_1(ah->ah_len)) return(NULL); - nh = EXTRACT_U_1(ah->ah_nxt); - hlen = (EXTRACT_U_1(ah->ah_len) + 2) << 2; + nh = GET_U_1(ah->ah_nxt); + hlen = (GET_U_1(ah->ah_len) + 2) << 2; break; default: /* unknown or undecodable header */ @@ -1441,8 +1447,8 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) ND_TCHECK_1(op->nd_opt_len); if (resid <= 0) return 0; - opt_type = EXTRACT_U_1(op->nd_opt_type); - opt_len = EXTRACT_U_1(op->nd_opt_len); + opt_type = GET_U_1(op->nd_opt_type); + opt_len = GET_U_1(op->nd_opt_len); if (opt_len == 0) goto trunc; if (cp + (opt_len << 3) > ep) @@ -1468,11 +1474,12 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) ND_TCHECK_16(opp->nd_opt_pi_prefix); ND_PRINT("%s/%u%s, Flags [%s], valid time %s", ip6addr_string(ndo, opp->nd_opt_pi_prefix), - EXTRACT_U_1(opp->nd_opt_pi_prefix_len), + GET_U_1(opp->nd_opt_pi_prefix_len), (opt_len != 4) ? "badlen" : "", - bittok2str(icmp6_opt_pi_flag_values, "none", EXTRACT_U_1(opp->nd_opt_pi_flags_reserved)), - get_lifetime(EXTRACT_BE_U_4(opp->nd_opt_pi_valid_time))); - ND_PRINT(", pref. time %s", get_lifetime(EXTRACT_BE_U_4(opp->nd_opt_pi_preferred_time))); + bittok2str(icmp6_opt_pi_flag_values, "none", GET_U_1(opp->nd_opt_pi_flags_reserved)), + get_lifetime(GET_BE_U_4(opp->nd_opt_pi_valid_time))); + ND_PRINT(", pref. time %s", + get_lifetime(GET_BE_U_4(opp->nd_opt_pi_preferred_time))); break; case ND_OPT_REDIRECTED_HEADER: print_unknown_data(ndo, bp,"\n\t ",opt_len<<3); @@ -1482,14 +1489,14 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) opm = (const struct nd_opt_mtu *)op; ND_TCHECK_4(opm->nd_opt_mtu_mtu); ND_PRINT(" %u%s", - EXTRACT_BE_U_4(opm->nd_opt_mtu_mtu), + GET_BE_U_4(opm->nd_opt_mtu_mtu), (opt_len != 1) ? "bad option length" : "" ); break; case ND_OPT_RDNSS: oprd = (const struct nd_opt_rdnss *)op; l = (opt_len - 1) / 2; ND_PRINT(" lifetime %us,", - EXTRACT_BE_U_4(oprd->nd_opt_rdnss_lifetime)); + GET_BE_U_4(oprd->nd_opt_rdnss_lifetime)); for (i = 0; i < l; i++) { ND_TCHECK_16(oprd->nd_opt_rdnss_addr[i]); ND_PRINT(" addr: %s", @@ -1499,9 +1506,9 @@ 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(" lifetime %us, domain(s):", - EXTRACT_BE_U_4(opds->nd_opt_dnssl_lifetime)); + GET_BE_U_4(opds->nd_opt_dnssl_lifetime)); domp = cp + 8; /* domain names, variable-sized, RFC1035-encoded */ - while (domp < cp + (opt_len << 3) && EXTRACT_U_1(domp) != '\0') + while (domp < cp + (opt_len << 3) && GET_U_1(domp) != '\0') { ND_PRINT(" "); if ((domp = ns_nprint(ndo, domp, bp)) == NULL) @@ -1511,14 +1518,15 @@ 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_4(opa->nd_opt_adv_interval); - ND_PRINT(" %ums", EXTRACT_BE_U_4(opa->nd_opt_adv_interval)); + ND_PRINT(" %ums", + GET_BE_U_4(opa->nd_opt_adv_interval)); break; case ND_OPT_HOMEAGENT_INFO: oph = (const struct nd_opt_homeagent_info *)op; ND_TCHECK_2(oph->nd_opt_hai_lifetime); ND_PRINT(" preference %u, lifetime %u", - EXTRACT_BE_U_2(oph->nd_opt_hai_preference), - EXTRACT_BE_U_2(oph->nd_opt_hai_lifetime)); + GET_BE_U_2(oph->nd_opt_hai_preference), + GET_BE_U_2(oph->nd_opt_hai_lifetime)); break; case ND_OPT_ROUTE_INFO: opri = (const struct nd_opt_route_info *)op; @@ -1539,10 +1547,11 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) goto trunc; } ND_PRINT(" %s/%u", ip6addr_string(ndo, (const u_char *)&in6), - EXTRACT_U_1(opri->nd_opt_rti_prefixlen)); - ND_PRINT(", pref=%s", get_rtpref(EXTRACT_U_1(opri->nd_opt_rti_flags))); + GET_U_1(opri->nd_opt_rti_prefixlen)); + ND_PRINT(", pref=%s", + get_rtpref(GET_U_1(opri->nd_opt_rti_flags))); ND_PRINT(", lifetime=%s", - get_lifetime(EXTRACT_BE_U_4(opri->nd_opt_rti_lifetime))); + get_lifetime(GET_BE_U_4(opri->nd_opt_rti_lifetime))); break; default: if (ndo->ndo_vflag <= 1) { @@ -1576,7 +1585,7 @@ mld6_print(netdissect_options *ndo, const u_char *bp) if ((const u_char *)mp + sizeof(*mp) > ep) return; - ND_PRINT("max resp delay: %u ", EXTRACT_BE_U_2(mp->mld6_maxdelay)); + ND_PRINT("max resp delay: %u ", GET_BE_U_2(mp->mld6_maxdelay)); ND_PRINT("addr: %s", ip6addr_string(ndo, mp->mld6_addr)); } @@ -1594,7 +1603,7 @@ mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len) } ND_TCHECK_2(icp->icmp6_data16[1]); - ngroups = EXTRACT_BE_U_2(icp->icmp6_data16[1]); + ngroups = GET_BE_U_2(icp->icmp6_data16[1]); ND_PRINT(", %u group record(s)", ngroups); if (ndo->ndo_vflag > 0) { /* Print the group records */ @@ -1608,8 +1617,8 @@ mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_TCHECK_LEN(bp + 4 + group, sizeof(nd_ipv6)); ND_PRINT(" [gaddr %s", ip6addr_string(ndo, bp + group + 4)); ND_PRINT(" %s", tok2str(mldv2report2str, " [v2-report-#%u]", - EXTRACT_U_1(bp + group))); - nsrcs = EXTRACT_BE_U_2(bp + group + 2); + GET_U_1(bp + group))); + nsrcs = GET_BE_U_2(bp + group + 2); /* Check the number of sources and print them */ if (len < group + 20 + (nsrcs * sizeof(nd_ipv6))) { ND_PRINT(" [invalid number of sources %u]", nsrcs); @@ -1653,7 +1662,7 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len) return; } ND_TCHECK_2(icp->icmp6_data16[0]); - mrc = EXTRACT_BE_U_2(icp->icmp6_data16[0]); + mrc = GET_BE_U_2(icp->icmp6_data16[0]); if (mrc < 32768) { mrt = mrc; } else { @@ -1667,23 +1676,23 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len) if (ndo->ndo_vflag) { ND_TCHECK_1(bp + 25); - if (EXTRACT_U_1(bp + 24) & 0x08) { + if (GET_U_1(bp + 24) & 0x08) { ND_PRINT(" sflag"); } - if (EXTRACT_U_1(bp + 24) & 0x07) { - ND_PRINT(" robustness=%u", EXTRACT_U_1(bp + 24) & 0x07); + if (GET_U_1(bp + 24) & 0x07) { + ND_PRINT(" robustness=%u", GET_U_1(bp + 24) & 0x07); } - if (EXTRACT_U_1(bp + 25) < 128) { - qqi = EXTRACT_U_1(bp + 25); + if (GET_U_1(bp + 25) < 128) { + qqi = GET_U_1(bp + 25); } else { - qqi = ((EXTRACT_U_1(bp + 25) & 0x0f) | 0x10) << - (((EXTRACT_U_1(bp + 25) & 0x70) >> 4) + 3); + qqi = ((GET_U_1(bp + 25) & 0x0f) | 0x10) << + (((GET_U_1(bp + 25) & 0x70) >> 4) + 3); } ND_PRINT(" qqi=%u", qqi); } ND_TCHECK_2(bp + 26); - nsrcs = EXTRACT_BE_U_2(bp + 26); + nsrcs = GET_BE_U_2(bp + 26); if (nsrcs > 0) { if (len < 28 + nsrcs * sizeof(nd_ipv6)) ND_PRINT(" [invalid number of sources]"); @@ -1713,7 +1722,7 @@ dnsname_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) /* DNS name decoding - no decompression */ ND_PRINT(", \""); while (cp < ep) { - i = EXTRACT_U_1(cp); + i = GET_U_1(cp); cp++; if (i) { if (i > ep - cp) { @@ -1721,16 +1730,16 @@ dnsname_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) break; } while (i-- && cp < ep) { - fn_print_char(ndo, EXTRACT_U_1(cp)); + fn_print_char(ndo, GET_U_1(cp)); cp++; } - if (cp + 1 < ep && EXTRACT_U_1(cp)) + if (cp + 1 < ep && GET_U_1(cp)) ND_PRINT("."); } else { if (cp == ep) { /* FQDN */ ND_PRINT("."); - } else if (cp + 1 == ep && EXTRACT_U_1(cp) == '\0') { + } else if (cp + 1 == ep && GET_U_1(cp) == '\0') { /* truncated */ } else { /* invalid */ @@ -1757,7 +1766,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, ni6 = (const struct icmp6_nodeinfo *)bp; siz = ep - bp; - switch (EXTRACT_U_1(ni6->ni_type)) { + switch (GET_U_1(ni6->ni_type)) { case ICMP6_NI_QUERY: if (siz == sizeof(*dp) + 4) { /* KAME who-are-you */ @@ -1769,13 +1778,13 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, ND_TCHECK_LEN(dp, sizeof(*ni6)); ni6 = (const struct icmp6_nodeinfo *)dp; ND_PRINT(" ("); /*)*/ - switch (EXTRACT_BE_U_2(ni6->ni_qtype)) { + switch (GET_BE_U_2(ni6->ni_qtype)) { case NI_QTYPE_NOOP: ND_PRINT("noop"); break; case NI_QTYPE_SUPTYPES: ND_PRINT("supported qtypes"); - i = EXTRACT_BE_U_2(ni6->ni_flags); + i = GET_BE_U_2(ni6->ni_flags); if (i) ND_PRINT(" [%s]", (i & 0x01) ? "C" : ""); break; @@ -1784,7 +1793,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, break; case NI_QTYPE_NODEADDR: ND_PRINT("node addresses"); - i = EXTRACT_BE_U_2(ni6->ni_flags); + i = GET_BE_U_2(ni6->ni_flags); if (!i) break; /* NI_NODEADDR_FLAG_TRUNCATE undefined for query */ @@ -1801,8 +1810,8 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, break; } - if (EXTRACT_BE_U_2(ni6->ni_qtype) == NI_QTYPE_NOOP || - EXTRACT_BE_U_2(ni6->ni_qtype) == NI_QTYPE_SUPTYPES) { + if (GET_BE_U_2(ni6->ni_qtype) == NI_QTYPE_NOOP || + GET_BE_U_2(ni6->ni_qtype) == NI_QTYPE_SUPTYPES) { if (siz != sizeof(*ni6)) if (ndo->ndo_vflag) ND_PRINT(", invalid len"); @@ -1821,7 +1830,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, } cp = (const u_char *)(ni6 + 1); - switch (EXTRACT_U_1(ni6->ni_code)) { + switch (GET_U_1(ni6->ni_code)) { case ICMP6_NI_SUBJ_IPV6: if (!ND_TTEST_LEN(dp, sizeof(*ni6) + sizeof(nd_ipv6))) break; @@ -1835,14 +1844,14 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, break; case ICMP6_NI_SUBJ_FQDN: ND_PRINT(", subject=DNS name"); - if (EXTRACT_U_1(cp) == ep - cp - 1) { + if (GET_U_1(cp) == ep - cp - 1) { /* icmp-name-lookup-03, pascal string */ if (ndo->ndo_vflag) ND_PRINT(", 03 draft"); cp++; ND_PRINT(", \""); while (cp < ep) { - fn_print_char(ndo, EXTRACT_U_1(cp)); + fn_print_char(ndo, GET_U_1(cp)); cp++; } ND_PRINT("\""); @@ -1879,7 +1888,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, ni6 = (const struct icmp6_nodeinfo *)dp; ND_PRINT(" node information reply"); ND_PRINT(" ("); /*)*/ - switch (EXTRACT_U_1(ni6->ni_code)) { + switch (GET_U_1(ni6->ni_code)) { case ICMP6_NI_SUCCESS: if (ndo->ndo_vflag) { ND_PRINT("success"); @@ -1902,13 +1911,13 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, break; } - if (EXTRACT_U_1(ni6->ni_code) != ICMP6_NI_SUCCESS) { + if (GET_U_1(ni6->ni_code) != ICMP6_NI_SUCCESS) { /*(*/ ND_PRINT(")"); break; } - switch (EXTRACT_BE_U_2(ni6->ni_qtype)) { + switch (GET_BE_U_2(ni6->ni_qtype)) { case NI_QTYPE_NOOP: if (needcomma) ND_PRINT(", "); @@ -1921,7 +1930,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, if (needcomma) ND_PRINT(", "); ND_PRINT("supported qtypes"); - i = EXTRACT_BE_U_2(ni6->ni_flags); + i = GET_BE_U_2(ni6->ni_flags); if (i) ND_PRINT(" [%s]", (i & 0x01) ? "C" : ""); break; @@ -1931,21 +1940,21 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, ND_PRINT("DNS name"); cp = (const u_char *)(ni6 + 1) + 4; ND_TCHECK_1(cp); - if (EXTRACT_U_1(cp) == ep - cp - 1) { + if (GET_U_1(cp) == ep - cp - 1) { /* icmp-name-lookup-03, pascal string */ if (ndo->ndo_vflag) ND_PRINT(", 03 draft"); cp++; ND_PRINT(", \""); while (cp < ep) { - fn_print_char(ndo, EXTRACT_U_1(cp)); + fn_print_char(ndo, GET_U_1(cp)); cp++; } ND_PRINT("\""); } else dnsname_print(ndo, cp, ep); - if ((EXTRACT_BE_U_2(ni6->ni_flags) & 0x01) != 0) - ND_PRINT(" [TTL=%u]", EXTRACT_BE_U_4(ni6 + 1)); + if ((GET_BE_U_2(ni6->ni_flags) & 0x01) != 0) + ND_PRINT(" [TTL=%u]", GET_BE_U_4(ni6 + 1)); break; case NI_QTYPE_NODEADDR: if (needcomma) @@ -1957,10 +1966,10 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, break; ND_PRINT(" %s(%u)", ip6addr_string(ndo, bp + i + sizeof(uint32_t)), - EXTRACT_BE_U_4(bp + i)); + GET_BE_U_4(bp + i)); i += sizeof(uint32_t) + sizeof(nd_ipv6); } - i = EXTRACT_BE_U_2(ni6->ni_flags); + i = GET_BE_U_2(ni6->ni_flags); if (!i) break; ND_PRINT(" [%s%s%s%s%s%s%s]", @@ -2005,7 +2014,7 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep) cp = (const char *)(rr6 + 1); ND_TCHECK_4(rr6->rr_reserved); - switch (EXTRACT_U_1(rr6->rr_code)) { + switch (GET_U_1(rr6->rr_code)) { case ICMP6_ROUTER_RENUMBERING_COMMAND: ND_PRINT("router renum: command"); break; @@ -2016,14 +2025,14 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep) ND_PRINT("router renum: sequence number reset"); break; default: - ND_PRINT("router renum: code-#%u", EXTRACT_U_1(rr6->rr_code)); + ND_PRINT("router renum: code-#%u", GET_U_1(rr6->rr_code)); break; } - ND_PRINT(", seq=%u", EXTRACT_BE_U_4(rr6->rr_seqnum)); + ND_PRINT(", seq=%u", GET_BE_U_4(rr6->rr_seqnum)); if (ndo->ndo_vflag) { - uint8_t rr_flags = EXTRACT_U_1(rr6->rr_flags); + uint8_t rr_flags = GET_U_1(rr6->rr_flags); #define F(x, y) (rr_flags & (x) ? (y) : "") ND_PRINT("["); /*]*/ if (rr_flags) { @@ -2033,16 +2042,16 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep) F(ICMP6_RR_FLAGS_SPECSITE, "S"), F(ICMP6_RR_FLAGS_PREVDONE, "P")); } - ND_PRINT("seg=%u,", EXTRACT_U_1(rr6->rr_segnum)); - ND_PRINT("maxdelay=%u", EXTRACT_BE_U_2(rr6->rr_maxdelay)); - if (EXTRACT_BE_U_4(rr6->rr_reserved)) - ND_PRINT("rsvd=0x%x", EXTRACT_BE_U_4(rr6->rr_reserved)); + ND_PRINT("seg=%u,", GET_U_1(rr6->rr_segnum)); + ND_PRINT("maxdelay=%u", GET_BE_U_2(rr6->rr_maxdelay)); + if (GET_BE_U_4(rr6->rr_reserved)) + ND_PRINT("rsvd=0x%x", GET_BE_U_4(rr6->rr_reserved)); /*[*/ ND_PRINT("]"); #undef F } - if (EXTRACT_U_1(rr6->rr_code) == ICMP6_ROUTER_RENUMBERING_COMMAND) { + if (GET_U_1(rr6->rr_code) == ICMP6_ROUTER_RENUMBERING_COMMAND) { match = (const struct rr_pco_match *)cp; cp = (const char *)(match + 1); @@ -2053,26 +2062,27 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep) else ND_PRINT(" "); ND_PRINT("match("); /*)*/ - switch (EXTRACT_U_1(match->rpm_code)) { + switch (GET_U_1(match->rpm_code)) { case RPM_PCO_ADD: ND_PRINT("add"); break; case RPM_PCO_CHANGE: ND_PRINT("change"); break; case RPM_PCO_SETGLOBAL: ND_PRINT("setglobal"); break; - default: ND_PRINT("#%u", EXTRACT_U_1(match->rpm_code)); break; + default: ND_PRINT("#%u", + GET_U_1(match->rpm_code)); break; } if (ndo->ndo_vflag) { - ND_PRINT(",ord=%u", EXTRACT_U_1(match->rpm_ordinal)); - ND_PRINT(",min=%u", EXTRACT_U_1(match->rpm_minlen)); - ND_PRINT(",max=%u", EXTRACT_U_1(match->rpm_maxlen)); + ND_PRINT(",ord=%u", GET_U_1(match->rpm_ordinal)); + ND_PRINT(",min=%u", GET_U_1(match->rpm_minlen)); + ND_PRINT(",max=%u", GET_U_1(match->rpm_maxlen)); } if (addrtostr6(match->rpm_prefix, hbuf, sizeof(hbuf))) - ND_PRINT(",%s/%u", hbuf, EXTRACT_U_1(match->rpm_matchlen)); + ND_PRINT(",%s/%u", hbuf, GET_U_1(match->rpm_matchlen)); else - ND_PRINT(",?/%u", EXTRACT_U_1(match->rpm_matchlen)); + ND_PRINT(",?/%u", GET_U_1(match->rpm_matchlen)); /*(*/ ND_PRINT(")"); - n = EXTRACT_U_1(match->rpm_len) - 3; + n = GET_U_1(match->rpm_len) - 3; if (n % 4) goto trunc; n /= 4; @@ -2087,33 +2097,36 @@ icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep) else ND_PRINT(" "); ND_PRINT("use("); /*)*/ - if (EXTRACT_U_1(use->rpu_flags)) { -#define F(x, y) (EXTRACT_U_1(use->rpu_flags) & (x) ? (y) : "") + if (GET_U_1(use->rpu_flags)) { +#define F(x, y) (GET_U_1(use->rpu_flags) & (x) ? (y) : "") ND_PRINT("%s%s,", F(ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME, "V"), F(ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME, "P")); #undef F } if (ndo->ndo_vflag) { - ND_PRINT("mask=0x%x,", EXTRACT_U_1(use->rpu_ramask)); - ND_PRINT("raflags=0x%x,", EXTRACT_U_1(use->rpu_raflags)); - if (EXTRACT_BE_U_4(use->rpu_vltime) == 0xffffffff) + ND_PRINT("mask=0x%x,", + GET_U_1(use->rpu_ramask)); + ND_PRINT("raflags=0x%x,", + GET_U_1(use->rpu_raflags)); + if (GET_BE_U_4(use->rpu_vltime) == 0xffffffff) ND_PRINT("vltime=infty,"); else ND_PRINT("vltime=%u,", - EXTRACT_BE_U_4(use->rpu_vltime)); - if (EXTRACT_BE_U_4(use->rpu_pltime) == 0xffffffff) + GET_BE_U_4(use->rpu_vltime)); + if (GET_BE_U_4(use->rpu_pltime) == 0xffffffff) ND_PRINT("pltime=infty,"); else ND_PRINT("pltime=%u,", - EXTRACT_BE_U_4(use->rpu_pltime)); + GET_BE_U_4(use->rpu_pltime)); } if (addrtostr6(use->rpu_prefix, hbuf, sizeof(hbuf))) - ND_PRINT("%s/%u/%u", hbuf, EXTRACT_U_1(use->rpu_uselen), - EXTRACT_U_1(use->rpu_keeplen)); + ND_PRINT("%s/%u/%u", hbuf, + GET_U_1(use->rpu_uselen), + GET_U_1(use->rpu_keeplen)); else - ND_PRINT("?/%u/%u", EXTRACT_U_1(use->rpu_uselen), - EXTRACT_U_1(use->rpu_keeplen)); + ND_PRINT("?/%u/%u", GET_U_1(use->rpu_uselen), + GET_U_1(use->rpu_keeplen)); /*(*/ ND_PRINT(")"); } diff --git a/print-igmp.c b/print-igmp.c index 3205a224..3c7c0304 100644 --- a/print-igmp.c +++ b/print-igmp.c @@ -119,11 +119,11 @@ print_mtrace(netdissect_options *ndo, return; } ND_PRINT("mtrace %u: %s to %s reply-to %s", - EXTRACT_BE_U_3(tr->tr_qid), + GET_BE_U_3(tr->tr_qid), ipaddr_string(ndo, tr->tr_src), ipaddr_string(ndo, tr->tr_dst), ipaddr_string(ndo, tr->tr_raddr)); - if (IN_CLASSD(EXTRACT_BE_U_4(tr->tr_raddr))) - ND_PRINT(" with-ttl %u", EXTRACT_U_1(tr->tr_rttl)); + if (IN_CLASSD(GET_BE_U_4(tr->tr_raddr))) + ND_PRINT(" with-ttl %u", GET_U_1(tr->tr_rttl)); return; trunc: nd_print_trunc(ndo); @@ -141,11 +141,11 @@ print_mresp(netdissect_options *ndo, return; } ND_PRINT("mresp %u: %s to %s reply-to %s", - EXTRACT_BE_U_3(tr->tr_qid), + GET_BE_U_3(tr->tr_qid), ipaddr_string(ndo, tr->tr_src), ipaddr_string(ndo, tr->tr_dst), ipaddr_string(ndo, tr->tr_raddr)); - if (IN_CLASSD(EXTRACT_BE_U_4(tr->tr_raddr))) - ND_PRINT(" with-ttl %u", EXTRACT_U_1(tr->tr_rttl)); + if (IN_CLASSD(GET_BE_U_4(tr->tr_raddr))) + ND_PRINT(" with-ttl %u", GET_U_1(tr->tr_rttl)); return; trunc: nd_print_trunc(ndo); @@ -164,7 +164,7 @@ print_igmpv3_report(netdissect_options *ndo, return; } ND_TCHECK_2(bp + 6); - ngroups = EXTRACT_BE_U_2(bp + 6); + ngroups = GET_BE_U_2(bp + 6); ND_PRINT(", %u group record(s)", ngroups); if (ndo->ndo_vflag > 0) { /* Print the group records */ @@ -177,8 +177,8 @@ print_igmpv3_report(netdissect_options *ndo, ND_TCHECK_4(bp + (group + 4)); ND_PRINT(" [gaddr %s", ipaddr_string(ndo, bp + group + 4)); ND_PRINT(" %s", tok2str(igmpv3report2str, " [v3-report-#%u]", - EXTRACT_U_1(bp + group))); - nsrcs = EXTRACT_BE_U_2(bp + group + 2); + GET_U_1(bp + group))); + nsrcs = GET_BE_U_2(bp + group + 2); /* Check the number of sources and print them */ if (len < group+8+(nsrcs<<2)) { ND_PRINT(" [invalid number of sources %u]", nsrcs); @@ -221,7 +221,7 @@ print_igmpv3_query(netdissect_options *ndo, return; } ND_TCHECK_1(bp + 1); - mrc = EXTRACT_U_1(bp + 1); + mrc = GET_U_1(bp + 1); if (mrc < 128) { mrt = mrc; } else { @@ -237,11 +237,11 @@ print_igmpv3_query(netdissect_options *ndo, ND_PRINT("]"); } ND_TCHECK_4(bp + 4); - if (EXTRACT_BE_U_4(bp + 4) == 0) + if (GET_BE_U_4(bp + 4) == 0) return; ND_PRINT(" [gaddr %s", ipaddr_string(ndo, bp + 4)); ND_TCHECK_2(bp + 10); - nsrcs = EXTRACT_BE_U_2(bp + 10); + nsrcs = GET_BE_U_2(bp + 10); if (nsrcs > 0) { if (len < 12 + (nsrcs << 2)) ND_PRINT(" [invalid number of sources]"); @@ -274,21 +274,21 @@ igmp_print(netdissect_options *ndo, } ND_TCHECK_1(bp); - switch (EXTRACT_U_1(bp)) { + switch (GET_U_1(bp)) { case 0x11: ND_PRINT("igmp query"); if (len >= 12) print_igmpv3_query(ndo, bp, len); else { ND_TCHECK_1(bp + 1); - if (EXTRACT_U_1(bp + 1)) { + if (GET_U_1(bp + 1)) { ND_PRINT(" v2"); - if (EXTRACT_U_1(bp + 1) != 100) - ND_PRINT(" [max resp time %u]", EXTRACT_U_1(bp + 1)); + if (GET_U_1(bp + 1) != 100) + ND_PRINT(" [max resp time %u]", GET_U_1(bp + 1)); } else ND_PRINT(" v1"); ND_TCHECK_4(bp + 4); - if (EXTRACT_BE_U_4(bp + 4)) + if (GET_BE_U_4(bp + 4)) ND_PRINT(" [gaddr %s]", ipaddr_string(ndo, bp + 4)); if (len != 8) ND_PRINT(" [len %u]", len); @@ -330,7 +330,7 @@ igmp_print(netdissect_options *ndo, print_mtrace(ndo, bp, len); break; default: - ND_PRINT("igmp-%u", EXTRACT_U_1(bp)); + ND_PRINT("igmp-%u", GET_U_1(bp)); break; } @@ -339,7 +339,7 @@ igmp_print(netdissect_options *ndo, vec[0].ptr = bp; vec[0].len = len; if (in_cksum(vec, 1)) - ND_PRINT(" bad igmp cksum %x!", EXTRACT_BE_U_2(bp + 2)); + ND_PRINT(" bad igmp cksum %x!", GET_BE_U_2(bp + 2)); } return; trunc: diff --git a/print-igrp.c b/print-igrp.c index a9eb28ef..fedc561f 100644 --- a/print-igrp.c +++ b/print-igrp.c @@ -82,17 +82,17 @@ igrp_entry_print(netdissect_options *ndo, const struct igrprte *igr, ND_PRINT(" %u.%u.%u.0", igr->igr_net[0], igr->igr_net[1], igr->igr_net[2]); - delay = EXTRACT_BE_U_3(igr->igr_dly); - bandwidth = EXTRACT_BE_U_3(igr->igr_bw); + delay = GET_BE_U_3(igr->igr_dly); + bandwidth = GET_BE_U_3(igr->igr_bw); metric = bandwidth + delay; if (metric > 0xffffff) metric = 0xffffff; - mtu = EXTRACT_BE_U_2(igr->igr_mtu); + mtu = GET_BE_U_2(igr->igr_mtu); ND_PRINT(" d=%u b=%u r=%u l=%u M=%u mtu=%u in %u hops", 10 * delay, bandwidth == 0 ? 0 : 10000000 / bandwidth, - EXTRACT_U_1(igr->igr_rel), EXTRACT_U_1(igr->igr_ld), metric, - mtu, EXTRACT_U_1(igr->igr_hct)); + GET_U_1(igr->igr_rel), GET_U_1(igr->igr_ld), metric, + mtu, GET_U_1(igr->igr_hct)); } static const struct tok op2str[] = { @@ -115,15 +115,15 @@ igrp_print(netdissect_options *ndo, const u_char *bp, u_int length) /* Header */ ND_TCHECK_SIZE(hdr); - nint = EXTRACT_BE_U_2(hdr->ig_ni); - nsys = EXTRACT_BE_U_2(hdr->ig_ns); - next = EXTRACT_BE_U_2(hdr->ig_nx); + nint = GET_BE_U_2(hdr->ig_ni); + nsys = GET_BE_U_2(hdr->ig_ns); + next = GET_BE_U_2(hdr->ig_nx); ND_PRINT(" %s V%u edit=%u AS=%u (%u/%u/%u)", - tok2str(op2str, "op-#%u", IGRP_OP(EXTRACT_U_1(hdr->ig_vop))), - IGRP_V(EXTRACT_U_1(hdr->ig_vop)), - EXTRACT_U_1(hdr->ig_ed), - EXTRACT_BE_U_2(hdr->ig_as), + tok2str(op2str, "op-#%u", IGRP_OP(GET_U_1(hdr->ig_vop))), + IGRP_V(GET_U_1(hdr->ig_vop)), + GET_U_1(hdr->ig_ed), + GET_BE_U_2(hdr->ig_as), nint, nsys, next); @@ -67,9 +67,9 @@ ip_printroute(netdissect_options *ndo, if ((length + 1) & 3) ND_PRINT(" [bad length %u]", length); ND_TCHECK_1(cp + 2); - ptr = EXTRACT_U_1(cp + 2) - 1; + ptr = GET_U_1(cp + 2) - 1; if (ptr < 3 || ((ptr + 1) & 3) || ptr > length + 1) - ND_PRINT(" [bad ptr %u]", EXTRACT_U_1(cp + 2)); + ND_PRINT(" [bad ptr %u]", GET_U_1(cp + 2)); for (len = 3; len < length; len += 4) { ND_TCHECK_4(cp + len); @@ -108,14 +108,14 @@ ip_finddst(netdissect_options *ndo, int tt; ND_TCHECK_1(cp); - tt = EXTRACT_U_1(cp); + tt = GET_U_1(cp); if (tt == IPOPT_EOL) break; else if (tt == IPOPT_NOP) len = 1; else { ND_TCHECK_1(cp + 1); - len = EXTRACT_U_1(cp + 1); + len = GET_U_1(cp + 1); if (len < 2) break; } @@ -128,11 +128,11 @@ ip_finddst(netdissect_options *ndo, case IPOPT_LSRR: if (len < 7) break; - return (EXTRACT_IPV4_TO_NETWORK_ORDER(cp + len - 4)); + return (GET_IPV4_TO_NETWORK_ORDER(cp + len - 4)); } } trunc: - return (EXTRACT_IPV4_TO_NETWORK_ORDER(ip->ip_dst)); + return (GET_IPV4_TO_NETWORK_ORDER(ip->ip_dst)); } /* @@ -156,9 +156,9 @@ nextproto4_cksum(netdissect_options *ndo, ph.len = htons((uint16_t)len); ph.mbz = 0; ph.proto = next_proto; - ph.src = EXTRACT_IPV4_TO_NETWORK_ORDER(ip->ip_src); + ph.src = GET_IPV4_TO_NETWORK_ORDER(ip->ip_src); if (IP_HL(ip) == 5) - ph.dst = EXTRACT_IPV4_TO_NETWORK_ORDER(ip->ip_dst); + ph.dst = GET_IPV4_TO_NETWORK_ORDER(ip->ip_dst); else ph.dst = ip_finddst(ndo, ip); @@ -184,16 +184,16 @@ ip_printts(netdissect_options *ndo, } ND_PRINT(" TS{"); ND_TCHECK_1(cp + 3); - hoplen = ((EXTRACT_U_1(cp + 3) & 0xF) != IPOPT_TS_TSONLY) ? 8 : 4; + hoplen = ((GET_U_1(cp + 3) & 0xF) != IPOPT_TS_TSONLY) ? 8 : 4; if ((length - 4) & (hoplen-1)) ND_PRINT("[bad length %u]", length); ND_TCHECK_1(cp + 2); - ptr = EXTRACT_U_1(cp + 2) - 1; + ptr = GET_U_1(cp + 2) - 1; len = 0; if (ptr < 4 || ((ptr - 4) & (hoplen-1)) || ptr > length + 1) - ND_PRINT("[bad ptr %u]", EXTRACT_U_1(cp + 2)); + ND_PRINT("[bad ptr %u]", GET_U_1(cp + 2)); ND_TCHECK_1(cp + 3); - switch (EXTRACT_U_1(cp + 3)&0xF) { + switch (GET_U_1(cp + 3)&0xF) { case IPOPT_TS_TSONLY: ND_PRINT("TSONLY"); break; @@ -213,7 +213,7 @@ ip_printts(netdissect_options *ndo, ND_PRINT("PRESPEC"); break; default: - ND_PRINT("[bad ts type %u]", EXTRACT_U_1(cp + 3)&0xF); + ND_PRINT("[bad ts type %u]", GET_U_1(cp + 3)&0xF); goto done; } @@ -222,7 +222,7 @@ ip_printts(netdissect_options *ndo, if (ptr == len) type = " ^ "; ND_TCHECK_LEN(cp + len, hoplen); - ND_PRINT("%s%u@%s", type, EXTRACT_BE_U_4(cp + len + hoplen - 4), + ND_PRINT("%s%u@%s", type, GET_BE_U_4(cp + len + hoplen - 4), hoplen!=8 ? "" : ipaddr_string(ndo, cp + len)); type = " "; } @@ -230,8 +230,8 @@ ip_printts(netdissect_options *ndo, done: ND_PRINT("%s", ptr == len ? " ^ " : ""); - if (EXTRACT_U_1(cp + 3) >> 4) - ND_PRINT(" [%u hops not recorded]} ", EXTRACT_U_1(cp + 3)>>4); + if (GET_U_1(cp + 3) >> 4) + ND_PRINT(" [%u hops not recorded]} ", GET_U_1(cp + 3)>>4); else ND_PRINT("}"); return (0); @@ -258,7 +258,7 @@ ip_optprint(netdissect_options *ndo, sep = ","; ND_TCHECK_1(cp); - option_code = EXTRACT_U_1(cp); + option_code = GET_U_1(cp); ND_PRINT("%s", tok2str(ip_option_values,"unknown %u",option_code)); @@ -269,7 +269,7 @@ ip_optprint(netdissect_options *ndo, else { ND_TCHECK_1(cp + 1); - option_len = EXTRACT_U_1(cp + 1); + option_len = GET_U_1(cp + 1); if (option_len < 2) { ND_PRINT(" [bad length %u]", option_len); return 0; @@ -305,8 +305,8 @@ ip_optprint(netdissect_options *ndo, break; } ND_TCHECK_1(cp + 3); - if (EXTRACT_BE_U_2(cp + 2) != 0) - ND_PRINT(" value %u", EXTRACT_BE_U_2(cp + 2)); + if (GET_BE_U_2(cp + 2) != 0) + ND_PRINT(" value %u", GET_BE_U_2(cp + 2)); break; case IPOPT_NOP: /* nothing to print - fall through */ @@ -353,7 +353,7 @@ again: nd_print_trunc(ndo); break; } - ipds->nh = EXTRACT_U_1(ipds->cp); + ipds->nh = GET_U_1(ipds->cp); ipds->advance = ah_print(ndo, ipds->cp); if (ipds->advance <= 0) break; @@ -488,7 +488,7 @@ again: ipaddr_string(ndo, ipds->ip->ip_src), ipaddr_string(ndo, ipds->ip->ip_dst)); carp_print(ndo, ipds->cp, ipds->len, - EXTRACT_U_1(ipds->ip->ip_ttl)); + GET_U_1(ipds->ip->ip_ttl)); } else { if (ndo->ndo_vflag) ND_PRINT("vrrp %s > %s: ", @@ -496,7 +496,7 @@ again: ipaddr_string(ndo, ipds->ip->ip_dst)); vrrp_print(ndo, ipds->cp, ipds->len, (const u_char *)ipds->ip, - EXTRACT_U_1(ipds->ip->ip_ttl)); + GET_U_1(ipds->ip->ip_ttl)); } break; @@ -576,7 +576,7 @@ ip_print(netdissect_options *ndo, return; } - ipds->len = EXTRACT_BE_U_2(ipds->ip->ip_len); + ipds->len = GET_BE_U_2(ipds->ip->ip_len); if (length < ipds->len) ND_PRINT("truncated-ip - %u bytes missing! ", ipds->len - length); @@ -605,12 +605,12 @@ ip_print(netdissect_options *ndo, ipds->len -= hlen; - ipds->off = EXTRACT_BE_U_2(ipds->ip->ip_off); + ipds->off = GET_BE_U_2(ipds->ip->ip_off); - ip_proto = EXTRACT_U_1(ipds->ip->ip_p); + ip_proto = GET_U_1(ipds->ip->ip_p); if (ndo->ndo_vflag) { - ip_tos = EXTRACT_U_1(ipds->ip->ip_tos); + ip_tos = GET_U_1(ipds->ip->ip_tos); ND_PRINT("(tos 0x%x", ip_tos); /* ECN bits */ switch (ip_tos & 0x03) { @@ -631,7 +631,7 @@ ip_print(netdissect_options *ndo, break; } - ip_ttl = EXTRACT_U_1(ipds->ip->ip_ttl); + ip_ttl = GET_U_1(ipds->ip->ip_ttl); if (ip_ttl >= 1) ND_PRINT(", ttl %u", ip_ttl); @@ -641,13 +641,13 @@ ip_print(netdissect_options *ndo, * For unfragmented datagrams, note the don't fragment flag. */ ND_PRINT(", id %u, offset %u, flags [%s], proto %s (%u)", - EXTRACT_BE_U_2(ipds->ip->ip_id), + GET_BE_U_2(ipds->ip->ip_id), (ipds->off & 0x1fff) * 8, bittok2str(ip_frag_values, "none", ipds->off&0xe000), tok2str(ipproto_values, "unknown", ip_proto), ip_proto); - ND_PRINT(", length %u", EXTRACT_BE_U_2(ipds->ip->ip_len)); + ND_PRINT(", length %u", GET_BE_U_2(ipds->ip->ip_len)); if ((hlen - sizeof(struct ip)) > 0) { ND_PRINT(", options ("); @@ -664,7 +664,7 @@ ip_print(netdissect_options *ndo, vec[0].len = hlen; sum = in_cksum(vec, 1); if (sum != 0) { - ip_sum = EXTRACT_BE_U_2(ipds->ip->ip_sum); + ip_sum = GET_BE_U_2(ipds->ip->ip_sum); ND_PRINT(", bad cksum %x (->%x)!", ip_sum, in_cksum_shouldbe(ip_sum, sum)); } @@ -685,7 +685,7 @@ ip_print(netdissect_options *ndo, */ if ((ipds->off & 0x1fff) == 0) { ipds->cp = (const u_char *)ipds->ip + hlen; - ipds->nh = EXTRACT_U_1(ipds->ip->ip_p); + ipds->nh = GET_U_1(ipds->ip->ip_p); if (ipds->nh != IPPROTO_TCP && ipds->nh != IPPROTO_UDP && ipds->nh != IPPROTO_SCTP && ipds->nh != IPPROTO_DCCP) { @@ -731,7 +731,7 @@ ipN_print(netdissect_options *ndo, const u_char *bp, u_int length) } ND_TCHECK_1(bp); - switch (EXTRACT_U_1(bp) & 0xF0) { + switch (GET_U_1(bp) & 0xF0) { case 0x40: ip_print(ndo, bp, length); break; @@ -739,7 +739,7 @@ ipN_print(netdissect_options *ndo, const u_char *bp, u_int length) ip6_print(ndo, bp, length); break; default: - ND_PRINT("unknown ip %u", (EXTRACT_U_1(bp) & 0xF0) >> 4); + ND_PRINT("unknown ip %u", (GET_U_1(bp) & 0xF0) >> 4); break; } return; diff --git a/print-ip6.c b/print-ip6.c index faffb4a2..9802ce04 100644 --- a/print-ip6.c +++ b/print-ip6.c @@ -58,7 +58,7 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst, cp = (const u_char *)ip6; advance = sizeof(struct ip6_hdr); - nh = EXTRACT_U_1(ip6->ip6_nxt); + nh = GET_U_1(ip6->ip6_nxt); dst_addr = (const void *)ip6->ip6_dst; while (cp < ndo->ndo_snapend) { @@ -77,8 +77,8 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst, * the first 8 octets. */ ND_TCHECK_2(cp); - advance = (EXTRACT_U_1(cp + 1) + 1) << 3; - nh = EXTRACT_U_1(cp); + advance = (GET_U_1(cp + 1) + 1) << 3; + nh = GET_U_1(cp); break; case IPPROTO_FRAGMENT: @@ -89,7 +89,7 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst, */ ND_TCHECK_1(cp); advance = sizeof(struct ip6_frag); - nh = EXTRACT_U_1(cp); + nh = GET_U_1(cp); break; case IPPROTO_ROUTING: @@ -98,8 +98,8 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst, */ dp = (const struct ip6_rthdr *)cp; ND_TCHECK_SIZE(dp); - len = EXTRACT_U_1(dp->ip6r_len); - switch (EXTRACT_U_1(dp->ip6r_type)) { + len = GET_U_1(dp->ip6r_len); + switch (GET_U_1(dp->ip6r_type)) { case IPV6_RTHDR_TYPE_0: case IPV6_RTHDR_TYPE_2: /* Mobile IPv6 ID-20 */ @@ -175,7 +175,7 @@ nextproto6_cksum(netdissect_options *ndo, /* pseudo-header */ memset(&ph, 0, sizeof(ph)); UNALIGNED_MEMCPY(&ph.ph_src, ip6->ip6_src, sizeof (struct in6_addr)); - nh = EXTRACT_U_1(ip6->ip6_nxt); + nh = GET_U_1(ip6->ip6_nxt); switch (nh) { case IPPROTO_HOPOPTS: @@ -241,15 +241,15 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) return; } - payload_len = EXTRACT_BE_U_2(ip6->ip6_plen); + payload_len = GET_BE_U_2(ip6->ip6_plen); len = payload_len + sizeof(struct ip6_hdr); if (length < len) ND_PRINT("truncated-ip6 - %u bytes missing!", len - length); - nh = EXTRACT_U_1(ip6->ip6_nxt); + nh = GET_U_1(ip6->ip6_nxt); if (ndo->ndo_vflag) { - flow = EXTRACT_BE_U_4(ip6->ip6_flow); + flow = GET_BE_U_4(ip6->ip6_flow); ND_PRINT("("); #if 0 /* rfc1883 */ @@ -266,7 +266,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) #endif ND_PRINT("hlim %u, next-header %s (%u) payload length: %u) ", - EXTRACT_U_1(ip6->ip6_hlim), + GET_U_1(ip6->ip6_hlim), tok2str(ipproto_values,"unknown",nh), nh, payload_len); @@ -299,19 +299,19 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) advance = hbhopt_print(ndo, cp); if (advance < 0) return; - nh = EXTRACT_U_1(cp); + nh = GET_U_1(cp); break; case IPPROTO_DSTOPTS: advance = dstopt_print(ndo, cp); if (advance < 0) return; - nh = EXTRACT_U_1(cp); + nh = GET_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_U_1(cp); + nh = GET_U_1(cp); fragmented = 1; break; @@ -328,14 +328,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_U_1(cp); + nh = GET_U_1(cp); return; case IPPROTO_ROUTING: ND_TCHECK_1(cp); advance = rt6_print(ndo, cp, (const u_char *)ip6); if (advance < 0) return; - nh = EXTRACT_U_1(cp); + nh = GET_U_1(cp); break; case IPPROTO_SCTP: sctp_print(ndo, cp, (const u_char *)ip6, len); @@ -356,7 +356,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) advance = ah_print(ndo, cp); if (advance < 0) return; - nh = EXTRACT_U_1(cp); + nh = GET_U_1(cp); break; case IPPROTO_ESP: { diff --git a/print-ip6opts.c b/print-ip6opts.c index ab07c06e..acc36713 100644 --- a/print-ip6opts.c +++ b/print-ip6opts.c @@ -48,18 +48,18 @@ ip6_sopt_print(netdissect_options *ndo, const u_char *bp, int len) int optlen; for (i = 0; i < len; i += optlen) { - if (EXTRACT_U_1(bp + i) == IP6OPT_PAD1) + if (GET_U_1(bp + i) == IP6OPT_PAD1) optlen = 1; else { if (i + 1 < len) - optlen = EXTRACT_U_1(bp + i + 1) + 2; + optlen = GET_U_1(bp + i + 1) + 2; else goto trunc; } if (i + optlen > len) goto trunc; - switch (EXTRACT_U_1(bp + i)) { + switch (GET_U_1(bp + i)) { case IP6OPT_PAD1: ND_PRINT(", pad1"); break; @@ -72,10 +72,11 @@ ip6_sopt_print(netdissect_options *ndo, const u_char *bp, int len) break; default: if (len - i < IP6OPT_MINLEN) { - ND_PRINT(", sopt_type %u: trunc)", EXTRACT_U_1(bp + i)); + ND_PRINT(", sopt_type %u: trunc)", GET_U_1(bp + i)); goto trunc; } - ND_PRINT(", sopt_type 0x%02x: len=%u", EXTRACT_U_1(bp + i), EXTRACT_U_1(bp + i + 1)); + ND_PRINT(", sopt_type 0x%02x: len=%u", GET_U_1(bp + i), + GET_U_1(bp + i + 1)); break; } } @@ -94,18 +95,18 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len) if (len == 0) return 0; for (i = 0; i < len; i += optlen) { - if (EXTRACT_U_1(bp + i) == IP6OPT_PAD1) + if (GET_U_1(bp + i) == IP6OPT_PAD1) optlen = 1; else { if (i + 1 < len) - optlen = EXTRACT_U_1(bp + i + 1) + 2; + optlen = GET_U_1(bp + i + 1) + 2; else goto trunc; } if (i + optlen > len) goto trunc; - switch (EXTRACT_U_1(bp + i)) { + switch (GET_U_1(bp + i)) { case IP6OPT_PAD1: ND_PRINT("(pad1)"); break; @@ -121,34 +122,34 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len) ND_PRINT("(rtalert: trunc)"); goto trunc; } - if (EXTRACT_U_1(bp + i + 1) != IP6OPT_RTALERT_LEN - 2) { - ND_PRINT("(rtalert: invalid len %u)", EXTRACT_U_1(bp + i + 1)); + if (GET_U_1(bp + i + 1) != IP6OPT_RTALERT_LEN - 2) { + ND_PRINT("(rtalert: invalid len %u)", GET_U_1(bp + i + 1)); goto trunc; } - ND_PRINT("(rtalert: 0x%04x) ", EXTRACT_BE_U_2(bp + i + 2)); + ND_PRINT("(rtalert: 0x%04x) ", GET_BE_U_2(bp + i + 2)); break; case IP6OPT_JUMBO: if (len - i < IP6OPT_JUMBO_LEN) { ND_PRINT("(jumbo: trunc)"); goto trunc; } - if (EXTRACT_U_1(bp + i + 1) != IP6OPT_JUMBO_LEN - 2) { - ND_PRINT("(jumbo: invalid len %u)", EXTRACT_U_1(bp + i + 1)); + if (GET_U_1(bp + i + 1) != IP6OPT_JUMBO_LEN - 2) { + ND_PRINT("(jumbo: invalid len %u)", GET_U_1(bp + i + 1)); goto trunc; } - ND_PRINT("(jumbo: %u) ", EXTRACT_BE_U_4(bp + i + 2)); + ND_PRINT("(jumbo: %u) ", GET_BE_U_4(bp + i + 2)); break; case IP6OPT_HOME_ADDRESS: if (len - i < IP6OPT_HOMEADDR_MINLEN) { ND_PRINT("(homeaddr: trunc)"); goto trunc; } - if (EXTRACT_U_1(bp + i + 1) < IP6OPT_HOMEADDR_MINLEN - 2) { - ND_PRINT("(homeaddr: invalid len %u)", EXTRACT_U_1(bp + i + 1)); + if (GET_U_1(bp + i + 1) < IP6OPT_HOMEADDR_MINLEN - 2) { + ND_PRINT("(homeaddr: invalid len %u)", GET_U_1(bp + i + 1)); goto trunc; } ND_PRINT("(homeaddr: %s", ip6addr_string(ndo, bp + i + 2)); - if (EXTRACT_U_1(bp + i + 1) > IP6OPT_HOMEADDR_MINLEN - 2) { + if (GET_U_1(bp + i + 1) > IP6OPT_HOMEADDR_MINLEN - 2) { if (ip6_sopt_print(ndo, bp + i + IP6OPT_HOMEADDR_MINLEN, (optlen - IP6OPT_HOMEADDR_MINLEN)) == -1) goto trunc; @@ -157,10 +158,11 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len) break; default: if (len - i < IP6OPT_MINLEN) { - ND_PRINT("(type %u: trunc)", EXTRACT_U_1(bp + i)); + ND_PRINT("(type %u: trunc)", GET_U_1(bp + i)); goto trunc; } - ND_PRINT("(opt_type 0x%02x: len=%u)", EXTRACT_U_1(bp + i), EXTRACT_U_1(bp + i + 1)); + ND_PRINT("(opt_type 0x%02x: len=%u)", GET_U_1(bp + i), + GET_U_1(bp + i + 1)); break; } } @@ -179,7 +181,7 @@ hbhopt_print(netdissect_options *ndo, const u_char *bp) ndo->ndo_protocol = "hbhopt"; ND_TCHECK_1(dp->ip6h_len); - hbhlen = (EXTRACT_U_1(dp->ip6h_len) + 1) << 3; + hbhlen = (GET_U_1(dp->ip6h_len) + 1) << 3; ND_TCHECK_LEN(dp, hbhlen); ND_PRINT("HBH "); if (ndo->ndo_vflag) @@ -201,7 +203,7 @@ dstopt_print(netdissect_options *ndo, const u_char *bp) ndo->ndo_protocol = "dstopt"; ND_TCHECK_1(dp->ip6d_len); - dstoptlen = (EXTRACT_U_1(dp->ip6d_len) + 1) << 3; + dstoptlen = (GET_U_1(dp->ip6d_len) + 1) << 3; ND_TCHECK_LEN(dp, dstoptlen); ND_PRINT("DSTOPT "); if (ndo->ndo_vflag) { diff --git a/print-ipcomp.c b/print-ipcomp.c index 9897dac7..98e2999c 100644 --- a/print-ipcomp.c +++ b/print-ipcomp.c @@ -45,7 +45,7 @@ ipcomp_print(netdissect_options *ndo, const u_char *bp) ndo->ndo_protocol = "ipcomp"; ipcomp = (const struct ipcomp *)bp; ND_TCHECK_SIZE(ipcomp); - cpi = EXTRACT_BE_U_2(ipcomp->comp_cpi); + cpi = GET_BE_U_2(ipcomp->comp_cpi); ND_PRINT("IPComp(cpi=0x%04x)", cpi); diff --git a/print-ipnet.c b/print-ipnet.c index 6a521ecc..7c6a301b 100644 --- a/print-ipnet.c +++ b/print-ipnet.c @@ -39,19 +39,19 @@ ipnet_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length) hdr = (const ipnet_hdr_t *)bp; ND_TCHECK_SIZE(hdr); - ND_PRINT("%u > %u", EXTRACT_BE_U_4(hdr->iph_zsrc), - EXTRACT_BE_U_4(hdr->iph_zdst)); + ND_PRINT("%u > %u", GET_BE_U_4(hdr->iph_zsrc), + GET_BE_U_4(hdr->iph_zdst)); if (!ndo->ndo_qflag) { ND_PRINT(", family %s (%u)", tok2str(ipnet_values, "Unknown", - EXTRACT_U_1(hdr->iph_family)), - EXTRACT_U_1(hdr->iph_family)); + GET_U_1(hdr->iph_family)), + GET_U_1(hdr->iph_family)); } else { ND_PRINT(", %s", tok2str(ipnet_values, "Unknown Ethertype (0x%04x)", - EXTRACT_U_1(hdr->iph_family))); + GET_U_1(hdr->iph_family))); } ND_PRINT(", length %u: ", length); @@ -78,7 +78,7 @@ ipnet_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen p += sizeof(ipnet_hdr_t); ND_TCHECK_1(hdr->iph_family); - switch (EXTRACT_U_1(hdr->iph_family)) { + switch (GET_U_1(hdr->iph_family)) { case IPH_AF_INET: ip_print(ndo, p, length); diff --git a/print-ipx.c b/print-ipx.c index 67e0eb7f..4f4e3059 100644 --- a/print-ipx.c +++ b/print-ipx.c @@ -79,16 +79,16 @@ ipx_print(netdissect_options *ndo, const u_char *p, u_int length) ND_TCHECK_2(ipx->srcSkt); ND_PRINT("%s.%04x > ", - ipxaddr_string(ndo, EXTRACT_BE_U_4(ipx->srcNet), ipx->srcNode), - EXTRACT_BE_U_2(ipx->srcSkt)); + ipxaddr_string(ndo, GET_BE_U_4(ipx->srcNet), ipx->srcNode), + GET_BE_U_2(ipx->srcSkt)); ND_PRINT("%s.%04x: ", - ipxaddr_string(ndo, EXTRACT_BE_U_4(ipx->dstNet), ipx->dstNode), - EXTRACT_BE_U_2(ipx->dstSkt)); + ipxaddr_string(ndo, GET_BE_U_4(ipx->dstNet), ipx->dstNode), + GET_BE_U_2(ipx->dstSkt)); /* take length from ipx header */ ND_TCHECK_2(ipx->length); - length = EXTRACT_BE_U_2(ipx->length); + length = GET_BE_U_2(ipx->length); if (length < ipxSize) { ND_PRINT("[length %u < %u]", length, ipxSize); @@ -107,9 +107,9 @@ ipxaddr_string(netdissect_options *ndo, uint32_t net, const u_char *node) static char line[256]; nd_snprintf(line, sizeof(line), "%08x.%02x:%02x:%02x:%02x:%02x:%02x", - net, EXTRACT_U_1(node), EXTRACT_U_1(node + 1), - EXTRACT_U_1(node + 2), EXTRACT_U_1(node + 3), - EXTRACT_U_1(node + 4), EXTRACT_U_1(node + 5)); + net, GET_U_1(node), GET_U_1(node + 1), + GET_U_1(node + 2), GET_U_1(node + 3), + GET_U_1(node + 4), GET_U_1(node + 5)); return line; } @@ -119,7 +119,7 @@ ipx_decode(netdissect_options *ndo, const struct ipxHdr *ipx, const u_char *data { u_short dstSkt; - dstSkt = EXTRACT_BE_U_2(ipx->dstSkt); + dstSkt = GET_BE_U_2(ipx->dstSkt); switch (dstSkt) { case IPX_SKT_NCP: ND_PRINT("ipx-ncp %u", length); @@ -160,7 +160,7 @@ ipx_sap_print(netdissect_options *ndo, const u_char *ipx, u_int length) int command, i; ND_TCHECK_2(ipx); - command = EXTRACT_BE_U_2(ipx); + command = GET_BE_U_2(ipx); ipx += 2; length -= 2; @@ -173,7 +173,7 @@ ipx_sap_print(netdissect_options *ndo, const u_char *ipx, u_int length) ND_PRINT("ipx-sap-nearest-req"); ND_TCHECK_2(ipx); - ND_PRINT(" %s", ipxsap_string(ndo, htons(EXTRACT_BE_U_2(ipx)))); + ND_PRINT(" %s", ipxsap_string(ndo, htons(GET_BE_U_2(ipx)))); break; case 2: @@ -187,7 +187,7 @@ ipx_sap_print(netdissect_options *ndo, const u_char *ipx, u_int length) ND_TCHECK_2(ipx); if (length < 2) goto trunc; - ND_PRINT(" %s '", ipxsap_string(ndo, htons(EXTRACT_BE_U_2(ipx)))); + ND_PRINT(" %s '", ipxsap_string(ndo, htons(GET_BE_U_2(ipx)))); ipx += 2; length -= 2; if (length < 48) { @@ -208,7 +208,7 @@ ipx_sap_print(netdissect_options *ndo, const u_char *ipx, u_int length) if (length < 10) goto trunc; ND_PRINT(" addr %s", - ipxaddr_string(ndo, EXTRACT_BE_U_4(ipx), ipx + 4)); + ipxaddr_string(ndo, GET_BE_U_4(ipx), ipx + 4)); ipx += 10; length -= 10; /* @@ -237,7 +237,7 @@ ipx_rip_print(netdissect_options *ndo, const u_char *ipx, u_int length) int command, i; ND_TCHECK_2(ipx); - command = EXTRACT_BE_U_2(ipx); + command = GET_BE_U_2(ipx); ipx += 2; length -= 2; @@ -248,8 +248,8 @@ ipx_rip_print(netdissect_options *ndo, const u_char *ipx, u_int length) if (length < 8) goto trunc; ND_TCHECK_8(ipx); - ND_PRINT(" %08x/%u.%u", EXTRACT_BE_U_4(ipx), - EXTRACT_BE_U_2(ipx + 4), EXTRACT_BE_U_2(ipx + 6)); + ND_PRINT(" %08x/%u.%u", GET_BE_U_4(ipx), + GET_BE_U_2(ipx + 4), GET_BE_U_2(ipx + 6)); } break; case 2: @@ -258,8 +258,8 @@ ipx_rip_print(netdissect_options *ndo, const u_char *ipx, u_int length) if (length < 8) goto trunc; ND_TCHECK_8(ipx); - ND_PRINT(" %08x/%u.%u", EXTRACT_BE_U_4(ipx), - EXTRACT_BE_U_2(ipx + 4), EXTRACT_BE_U_2(ipx + 6)); + ND_PRINT(" %08x/%u.%u", GET_BE_U_4(ipx), + GET_BE_U_2(ipx + 4), GET_BE_U_2(ipx + 6)); ipx += 8; length -= 8; diff --git a/print-isakmp.c b/print-isakmp.c index 3af263a8..fd0cb6c5 100644 --- a/print-isakmp.c +++ b/print-isakmp.c @@ -913,11 +913,11 @@ ikev1_attrmap_print(netdissect_options *ndo, uint32_t t, v; ND_TCHECK_1(p); - if (EXTRACT_U_1(p) & 0x80) + if (GET_U_1(p) & 0x80) totlen = 4; else { ND_TCHECK_2(p + 2); - totlen = 4 + EXTRACT_BE_U_2(p + 2); + totlen = 4 + GET_BE_U_2(p + 2); } if (ep2 < p + totlen) { ND_PRINT("[|attr]"); @@ -926,15 +926,15 @@ ikev1_attrmap_print(netdissect_options *ndo, ND_TCHECK_2(p); ND_PRINT("("); - t = EXTRACT_BE_U_2(p) & 0x7fff; + t = GET_BE_U_2(p) & 0x7fff; if (map && t < nmap && map[t].type) ND_PRINT("type=%s ", map[t].type); else ND_PRINT("type=#%u ", t); - if (EXTRACT_U_1(p) & 0x80) { + if (GET_U_1(p) & 0x80) { ND_PRINT("value="); ND_TCHECK_2(p + 2); - v = EXTRACT_BE_U_2(p + 2); + v = GET_BE_U_2(p + 2); if (map && t < nmap && v < map[t].nvalue && map[t].value[v]) ND_PRINT("%s", map[t].value[v]); else { @@ -964,11 +964,11 @@ ikev1_attr_print(netdissect_options *ndo, const u_char *p, const u_char *ep2) uint32_t t; ND_TCHECK_1(p); - if (EXTRACT_U_1(p) & 0x80) + if (GET_U_1(p) & 0x80) totlen = 4; else { ND_TCHECK_2(p + 2); - totlen = 4 + EXTRACT_BE_U_2(p + 2); + totlen = 4 + GET_BE_U_2(p + 2); } if (ep2 < p + totlen) { ND_PRINT("[|attr]"); @@ -977,11 +977,11 @@ ikev1_attr_print(netdissect_options *ndo, const u_char *p, const u_char *ep2) ND_TCHECK_2(p); ND_PRINT("("); - t = EXTRACT_BE_U_2(p) & 0x7fff; + t = GET_BE_U_2(p) & 0x7fff; ND_PRINT("type=#%u ", t); - if (EXTRACT_U_1(p) & 0x80) { + if (GET_U_1(p) & 0x80) { ND_PRINT("value="); - t = EXTRACT_U_1(p + 2); + t = GET_U_1(p + 2); if (!rawprint(ndo, (const uint8_t *)(p + 2), 2)) { ND_PRINT(")"); goto trunc; @@ -1016,8 +1016,8 @@ ikev1_sa_print(netdissect_options *ndo, u_char tpay _U_, p = (const struct ikev1_pl_sa *)ext; ND_TCHECK_SIZE(p); - doi = EXTRACT_BE_U_4(p->doi); - sit = EXTRACT_BE_U_4(p->sit); + doi = GET_BE_U_4(p->doi); + sit = GET_BE_U_4(p->sit); if (doi != 1) { ND_PRINT(" doi=%u", doi); ND_PRINT(" situation=%u", sit); @@ -1041,7 +1041,7 @@ ikev1_sa_print(netdissect_options *ndo, u_char tpay _U_, np = (const u_char *)ext + sizeof(struct ikev1_pl_sa); if (sit != 0x01) { ND_TCHECK_4(ext + 1); - ident = EXTRACT_BE_U_4(ext + 1); + ident = GET_BE_U_4(ext + 1); ND_PRINT(" ident=%u", ident); np += sizeof(ident); } @@ -1073,9 +1073,9 @@ ikev1_p_print(netdissect_options *ndo, u_char tpay _U_, p = (const struct ikev1_pl_p *)ext; ND_TCHECK_SIZE(p); ND_PRINT(" #%u protoid=%s transform=%u", - EXTRACT_U_1(p->p_no), PROTOIDSTR(EXTRACT_U_1(p->prot_id)), - EXTRACT_U_1(p->num_t)); - spi_size = EXTRACT_U_1(p->spi_size); + GET_U_1(p->p_no), PROTOIDSTR(GET_U_1(p->prot_id)), + GET_U_1(p->num_t)); + spi_size = GET_U_1(p->spi_size); if (spi_size) { ND_PRINT(" spi="); if (!rawprint(ndo, (const uint8_t *)(p + 1), spi_size)) @@ -1086,7 +1086,7 @@ ikev1_p_print(netdissect_options *ndo, u_char tpay _U_, ND_TCHECK_SIZE(ext); cp = ikev1_sub_print(ndo, ISAKMP_NPTYPE_T, ext, ep, phase, doi0, - EXTRACT_U_1(p->prot_id), depth); + GET_U_1(p->prot_id), depth); return cp; trunc: @@ -1242,22 +1242,22 @@ ikev1_t_print(netdissect_options *ndo, u_char tpay _U_, switch (proto) { case 1: - idstr = STR_OR_ID(EXTRACT_U_1(p->t_id), ikev1_p_map); + idstr = STR_OR_ID(GET_U_1(p->t_id), ikev1_p_map); map = oakley_t_map; nmap = sizeof(oakley_t_map)/sizeof(oakley_t_map[0]); break; case 2: - idstr = STR_OR_ID(EXTRACT_U_1(p->t_id), ah_p_map); + idstr = STR_OR_ID(GET_U_1(p->t_id), ah_p_map); map = ipsec_t_map; nmap = sizeof(ipsec_t_map)/sizeof(ipsec_t_map[0]); break; case 3: - idstr = STR_OR_ID(EXTRACT_U_1(p->t_id), esp_p_map); + idstr = STR_OR_ID(GET_U_1(p->t_id), esp_p_map); map = ipsec_t_map; nmap = sizeof(ipsec_t_map)/sizeof(ipsec_t_map[0]); break; case 4: - idstr = STR_OR_ID(EXTRACT_U_1(p->t_id), ipcomp_p_map); + idstr = STR_OR_ID(GET_U_1(p->t_id), ipcomp_p_map); map = ipsec_t_map; nmap = sizeof(ipsec_t_map)/sizeof(ipsec_t_map[0]); break; @@ -1269,9 +1269,9 @@ ikev1_t_print(netdissect_options *ndo, u_char tpay _U_, } if (idstr) - ND_PRINT(" #%u id=%s ", EXTRACT_U_1(p->t_no), idstr); + ND_PRINT(" #%u id=%s ", GET_U_1(p->t_no), idstr); else - ND_PRINT(" #%u id=%u ", EXTRACT_U_1(p->t_no), EXTRACT_U_1(p->t_id)); + ND_PRINT(" #%u id=%u ", GET_U_1(p->t_no), GET_U_1(p->t_id)); cp = (const u_char *)(p + 1); ep2 = (const u_char *)p + item_len; while (cp < ep && cp < ep2) { @@ -1354,9 +1354,10 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_, case 1: #endif default: - ND_PRINT(" idtype=%s", STR_OR_ID(EXTRACT_U_1(p->d.id_type), idtypestr)); + ND_PRINT(" idtype=%s", + STR_OR_ID(GET_U_1(p->d.id_type), idtypestr)); ND_PRINT(" doi_data=%u", - EXTRACT_BE_U_4(p->d.doi_data) & 0xffffff); + GET_BE_U_4(p->d.doi_data) & 0xffffff); break; #ifdef USE_IPSECDOI_IN_PHASE1 @@ -1370,15 +1371,15 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_, doi_p = (const struct ipsecdoi_id *)ext; ND_TCHECK_SIZE(doi_p); - type = EXTRACT_U_1(doi_p->type); + type = GET_U_1(doi_p->type); ND_PRINT(" idtype=%s", STR_OR_ID(type, ipsecidtypestr)); /* A protocol ID of 0 DOES NOT mean IPPROTO_IP! */ - proto_id = EXTRACT_U_1(doi_p->proto_id); + proto_id = GET_U_1(doi_p->proto_id); if (!ndo->ndo_nflag && proto_id && (p_name = netdb_protoname(proto_id)) != NULL) ND_PRINT(" protoid=%s", p_name); else ND_PRINT(" protoid=%u", proto_id); - ND_PRINT(" port=%u", EXTRACT_BE_U_2(doi_p->port)); + ND_PRINT(" port=%u", GET_BE_U_2(doi_p->port)); if (!len) break; if (data == NULL) @@ -1398,7 +1399,7 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_, u_int i; ND_PRINT(" len=%u ", len); for (i = 0; i < len; i++) - fn_print_char(ndo, EXTRACT_U_1(data + i)); + fn_print_char(ndo, GET_U_1(data + i)); len = 0; break; } @@ -1411,8 +1412,9 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_, mask = data + sizeof(nd_ipv4); ND_PRINT(" len=%u %s/%u.%u.%u.%u", len, ipaddr_string(ndo, data), - EXTRACT_U_1(mask), EXTRACT_U_1(mask + 1), - EXTRACT_U_1(mask + 2), EXTRACT_U_1(mask + 3)); + GET_U_1(mask), GET_U_1(mask + 1), + GET_U_1(mask + 2), + GET_U_1(mask + 3)); } len = 0; break; @@ -1434,10 +1436,21 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_, /*XXX*/ ND_PRINT(" len=%u %s/0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", len, ip6addr_string(ndo, data), - EXTRACT_U_1(mask), EXTRACT_U_1(mask + 1), EXTRACT_U_1(mask + 2), EXTRACT_U_1(mask + 3), - EXTRACT_U_1(mask + 4), EXTRACT_U_1(mask + 5), EXTRACT_U_1(mask + 6), EXTRACT_U_1(mask + 7), - EXTRACT_U_1(mask + 8), EXTRACT_U_1(mask + 9), EXTRACT_U_1(mask + 10), EXTRACT_U_1(mask + 11), - EXTRACT_U_1(mask + 12), EXTRACT_U_1(mask + 13), EXTRACT_U_1(mask + 14), EXTRACT_U_1(mask + 15)); + GET_U_1(mask), GET_U_1(mask + 1), + GET_U_1(mask + 2), + GET_U_1(mask + 3), + GET_U_1(mask + 4), + GET_U_1(mask + 5), + GET_U_1(mask + 6), + GET_U_1(mask + 7), + GET_U_1(mask + 8), + GET_U_1(mask + 9), + GET_U_1(mask + 10), + GET_U_1(mask + 11), + GET_U_1(mask + 12), + GET_U_1(mask + 13), + GET_U_1(mask + 14), + GET_U_1(mask + 15)); } len = 0; break; @@ -1506,7 +1519,7 @@ ikev1_cert_print(netdissect_options *ndo, u_char tpay _U_, * Our caller has ensured that the length is >= 4. */ ND_PRINT(" len=%u", item_len - 4); - ND_PRINT(" type=%s", STR_OR_ID(EXTRACT_U_1(p->encode), certstr)); + ND_PRINT(" type=%s", STR_OR_ID(GET_U_1(p->encode), certstr)); if (2 < ndo->ndo_vflag && 4 < item_len) { /* Print the entire payload in hex */ ND_PRINT(" "); @@ -1540,7 +1553,7 @@ ikev1_cr_print(netdissect_options *ndo, u_char tpay _U_, * Our caller has ensured that the length is >= 4. */ ND_PRINT(" len=%u", item_len - 4); - ND_PRINT(" type=%s", STR_OR_ID(EXTRACT_U_1(p->encode), certstr)); + ND_PRINT(" type=%s", STR_OR_ID(GET_U_1(p->encode), certstr)); if (2 < ndo->ndo_vflag && 4 < item_len) { /* Print the entire payload in hex */ ND_PRINT(" "); @@ -1698,12 +1711,12 @@ ikev1_n_print(netdissect_options *ndo, u_char tpay _U_, p = (const struct ikev1_pl_n *)ext; ND_TCHECK_SIZE(p); - doi = EXTRACT_BE_U_4(p->doi); - proto = EXTRACT_U_1(p->prot_id); + doi = GET_BE_U_4(p->doi); + proto = GET_U_1(p->prot_id); if (doi != 1) { ND_PRINT(" doi=%u", doi); ND_PRINT(" proto=%u", proto); - type = EXTRACT_BE_U_2(p->type); + type = GET_BE_U_2(p->type); if (type < 8192) ND_PRINT(" type=%s", NOTIFY_ERROR_STR(type)); else if (type < 16384) @@ -1712,7 +1725,7 @@ ikev1_n_print(netdissect_options *ndo, u_char tpay _U_, ND_PRINT(" type=%s", NOTIFY_STATUS_STR(type)); else ND_PRINT(" type=%s", numstr(type)); - spi_size = EXTRACT_U_1(p->spi_size); + spi_size = GET_U_1(p->spi_size); if (spi_size) { ND_PRINT(" spi="); if (!rawprint(ndo, (const uint8_t *)(p + 1), spi_size)) @@ -1723,7 +1736,7 @@ ikev1_n_print(netdissect_options *ndo, u_char tpay _U_, ND_PRINT(" doi=ipsec"); ND_PRINT(" proto=%s", PROTOIDSTR(proto)); - type = EXTRACT_BE_U_2(p->type); + type = GET_BE_U_2(p->type); if (type < 8192) ND_PRINT(" type=%s", NOTIFY_ERROR_STR(type)); else if (type < 16384) @@ -1734,7 +1747,7 @@ ikev1_n_print(netdissect_options *ndo, u_char tpay _U_, ND_PRINT(" type=%s", IPSEC_NOTIFY_STATUS_STR(type)); else ND_PRINT(" type=%s", numstr(type)); - spi_size = EXTRACT_U_1(p->spi_size); + spi_size = GET_U_1(p->spi_size); if (spi_size) { ND_PRINT(" spi="); if (!rawprint(ndo, (const uint8_t *)(p + 1), spi_size)) @@ -1764,7 +1777,7 @@ ikev1_n_print(netdissect_options *ndo, u_char tpay _U_, case IPSECDOI_NTYPE_REPLAY_STATUS: ND_PRINT(" status=("); ND_PRINT("replay detection %sabled", - EXTRACT_BE_U_4(cp) ? "en" : "dis"); + GET_BE_U_4(cp) ? "en" : "dis"); ND_PRINT(")"); break; default: @@ -1808,8 +1821,8 @@ ikev1_d_print(netdissect_options *ndo, u_char tpay _U_, p = (const struct ikev1_pl_d *)ext; ND_TCHECK_SIZE(p); - doi = EXTRACT_BE_U_4(p->doi); - proto = EXTRACT_U_1(p->prot_id); + doi = GET_BE_U_4(p->doi); + proto = GET_U_1(p->prot_id); if (doi != 1) { ND_PRINT(" doi=%u", doi); ND_PRINT(" proto=%u", proto); @@ -1817,9 +1830,9 @@ ikev1_d_print(netdissect_options *ndo, u_char tpay _U_, ND_PRINT(" doi=ipsec"); ND_PRINT(" proto=%s", PROTOIDSTR(proto)); } - spi_size = EXTRACT_U_1(p->spi_size); + spi_size = GET_U_1(p->spi_size); ND_PRINT(" spilen=%u", spi_size); - num_spi = EXTRACT_BE_U_2(p->num_spi); + num_spi = GET_BE_U_2(p->num_spi); ND_PRINT(" nspi=%u", num_spi); ND_PRINT(" spi="); q = (const uint8_t *)(p + 1); @@ -1881,7 +1894,7 @@ ikev2_gen_print(netdissect_options *ndo, u_char tpay, const struct isakmp_gen *p = (const struct isakmp_gen *)ext; ND_TCHECK_SIZE(ext); - ikev2_pay_print(ndo, NPSTR(tpay), EXTRACT_U_1(p->critical)); + ikev2_pay_print(ndo, NPSTR(tpay), GET_U_1(p->critical)); /* * Our caller has ensured that the length is >= 4. @@ -1915,14 +1928,14 @@ ikev2_t_print(netdissect_options *ndo, int tcount, p = (const struct ikev2_t *)ext; ND_TCHECK_SIZE(p); - ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_T), EXTRACT_U_1(p->h.critical)); + ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_T), GET_U_1(p->h.critical)); - t_id = EXTRACT_BE_U_2(p->t_id); + t_id = GET_BE_U_2(p->t_id); map = NULL; nmap = 0; - t_type = EXTRACT_U_1(p->t_type); + t_type = GET_U_1(p->t_type); switch (t_type) { case IV2_T_ENCR: idstr = STR_OR_ID(t_id, esp_p_map); @@ -1994,18 +2007,18 @@ ikev2_p_print(netdissect_options *ndo, u_char tpay _U_, int pcount _U_, p = (const struct ikev2_p *)ext; ND_TCHECK_SIZE(p); - ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_P), EXTRACT_U_1(p->h.critical)); + ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_P), GET_U_1(p->h.critical)); /* * ikev2_sa_print() guarantees that this is >= 4. */ prop_length = oprop_length - 4; ND_PRINT(" #%u protoid=%s transform=%u len=%u", - EXTRACT_U_1(p->p_no), PROTOIDSTR(EXTRACT_U_1(p->prot_id)), - EXTRACT_U_1(p->num_t), oprop_length); + GET_U_1(p->p_no), PROTOIDSTR(GET_U_1(p->prot_id)), + GET_U_1(p->num_t), oprop_length); cp = (const u_char *)(p + 1); - spi_size = EXTRACT_U_1(p->spi_size); + spi_size = GET_U_1(p->spi_size); if (spi_size) { if (prop_length < spi_size) goto toolong; @@ -2020,7 +2033,7 @@ ikev2_p_print(netdissect_options *ndo, u_char tpay _U_, int pcount _U_, * Print the transforms. */ tcount = 0; - for (np = ISAKMP_NPTYPE_T; np != 0; np = EXTRACT_U_1(ext->np)) { + for (np = ISAKMP_NPTYPE_T; np != 0; np = GET_U_1(ext->np)) { tcount++; ext = (const struct isakmp_gen *)cp; if (prop_length < sizeof(*ext)) @@ -2033,7 +2046,7 @@ ikev2_p_print(netdissect_options *ndo, u_char tpay _U_, int pcount _U_, * or truncated, otherwise we could loop forever processing * zero-length items or otherwise misdissect the packet. */ - item_len = EXTRACT_BE_U_2(ext->len); + item_len = GET_BE_U_2(ext->len); if (item_len <= 4) goto trunc; @@ -2089,12 +2102,12 @@ ikev2_sa_print(netdissect_options *ndo, u_char tpay, u_int item_len; ND_TCHECK_SIZE(ext1); - ikev2_pay_print(ndo, "sa", EXTRACT_U_1(ext1->critical)); + ikev2_pay_print(ndo, "sa", GET_U_1(ext1->critical)); /* * ikev2_sub0_print() guarantees that this is >= 4. */ - osa_length= EXTRACT_BE_U_2(ext1->len); + osa_length= GET_BE_U_2(ext1->len); sa_length = osa_length - 4; ND_PRINT(" len=%u", sa_length); @@ -2103,7 +2116,7 @@ ikev2_sa_print(netdissect_options *ndo, u_char tpay, */ cp = (const u_char *)(ext1 + 1); pcount = 0; - for (np = ISAKMP_NPTYPE_P; np != 0; np = EXTRACT_U_1(ext->np)) { + for (np = ISAKMP_NPTYPE_P; np != 0; np = GET_U_1(ext->np)) { pcount++; ext = (const struct isakmp_gen *)cp; if (sa_length < sizeof(*ext)) @@ -2116,7 +2129,7 @@ ikev2_sa_print(netdissect_options *ndo, u_char tpay, * or truncated, otherwise we could loop forever processing * zero-length items or otherwise misdissect the packet. */ - item_len = EXTRACT_BE_U_2(ext->len); + item_len = GET_BE_U_2(ext->len); if (item_len <= 4) goto trunc; @@ -2168,14 +2181,14 @@ ikev2_ke_print(netdissect_options *ndo, u_char tpay, k = (const struct ikev2_ke *)ext; ND_TCHECK_SIZE(k); - ikev2_pay_print(ndo, NPSTR(tpay), EXTRACT_U_1(k->h.critical)); + ikev2_pay_print(ndo, NPSTR(tpay), GET_U_1(k->h.critical)); if (item_len < 8) { ND_PRINT(" len=%u < 8", item_len); return (const u_char *)ext + item_len; } ND_PRINT(" len=%u group=%s", item_len - 8, - STR_OR_ID(EXTRACT_BE_U_2(k->ke_group), dh_p_map)); + STR_OR_ID(GET_BE_U_2(k->ke_group), dh_p_map)); if (2 < ndo->ndo_vflag && 8 < item_len) { ND_PRINT(" "); @@ -2202,7 +2215,7 @@ ikev2_ID_print(netdissect_options *ndo, u_char tpay, idp = (const struct ikev2_id *)ext; ND_TCHECK_SIZE(idp); - ikev2_pay_print(ndo, NPSTR(tpay), EXTRACT_U_1(idp->h.critical)); + ikev2_pay_print(ndo, NPSTR(tpay), GET_U_1(idp->h.critical)); /* * Our caller has ensured that the length is >= 4. @@ -2220,7 +2233,7 @@ ikev2_ID_print(netdissect_options *ndo, u_char tpay, dumphex = 0; typedata = (const unsigned char *)(ext)+sizeof(struct ikev2_id); - switch(EXTRACT_U_1(idp->type)) { + switch(GET_U_1(idp->type)) { case ID_IPV4_ADDR: ND_PRINT(" ipv4:"); dumphex=1; @@ -2254,8 +2267,8 @@ ikev2_ID_print(netdissect_options *ndo, u_char tpay, if(dumpascii) { ND_TCHECK_LEN(typedata, idtype_len); for(i=0; i<idtype_len; i++) { - if(ND_ISPRINT(EXTRACT_U_1(typedata + i))) { - ND_PRINT("%c", EXTRACT_U_1(typedata + i)); + if(ND_ISPRINT(GET_U_1(typedata + i))) { + ND_PRINT("%c", GET_U_1(typedata + i)); } else { ND_PRINT("."); } @@ -2306,13 +2319,13 @@ ikev2_auth_print(netdissect_options *ndo, u_char tpay, ND_TCHECK_LEN(ext, sizeof(struct ikev2_auth)); p = (const struct ikev2_auth *)ext; - ikev2_pay_print(ndo, NPSTR(tpay), EXTRACT_U_1(p->h.critical)); + ikev2_pay_print(ndo, NPSTR(tpay), GET_U_1(p->h.critical)); /* * Our caller has ensured that the length is >= 4. */ ND_PRINT(" len=%u method=%s", item_len-4, - STR_OR_ID(EXTRACT_U_1(p->auth_method), v2_auth)); + STR_OR_ID(GET_U_1(p->auth_method), v2_auth)); if (item_len > 4) { if (ndo->ndo_vflag > 1) { ND_PRINT(" authdata=("); @@ -2339,7 +2352,7 @@ ikev2_nonce_print(netdissect_options *ndo, u_char tpay, uint32_t proto _U_, int depth _U_) { ND_TCHECK_SIZE(ext); - ikev2_pay_print(ndo, "nonce", EXTRACT_U_1(ext->critical)); + ikev2_pay_print(ndo, "nonce", GET_U_1(ext->critical)); /* * Our caller has ensured that the length is >= 4. @@ -2377,15 +2390,15 @@ ikev2_n_print(netdissect_options *ndo, u_char tpay _U_, p = (const struct ikev2_n *)ext; ND_TCHECK_SIZE(p); - ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_N), EXTRACT_U_1(p->h.critical)); + ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_N), GET_U_1(p->h.critical)); showspi = 1; showsomedata=0; notify_name=NULL; - ND_PRINT(" prot_id=%s", PROTOIDSTR(EXTRACT_U_1(p->prot_id))); + ND_PRINT(" prot_id=%s", PROTOIDSTR(GET_U_1(p->prot_id))); - type = EXTRACT_BE_U_2(p->type); + type = GET_BE_U_2(p->type); /* notify space is annoying sparse */ switch(type) { @@ -2537,7 +2550,7 @@ ikev2_n_print(netdissect_options *ndo, u_char tpay _U_, } - spi_size = EXTRACT_U_1(p->spi_size); + spi_size = GET_U_1(p->spi_size); if (showspi && spi_size) { ND_PRINT(" spi="); if (!rawprint(ndo, (const uint8_t *)(p + 1), spi_size)) @@ -2586,7 +2599,7 @@ ikev2_vid_print(netdissect_options *ndo, u_char tpay, u_int i, len; ND_TCHECK_SIZE(ext); - ikev2_pay_print(ndo, NPSTR(tpay), EXTRACT_U_1(ext->critical)); + ikev2_pay_print(ndo, NPSTR(tpay), GET_U_1(ext->critical)); /* * Our caller has ensured that the length is >= 4. @@ -2597,8 +2610,8 @@ ikev2_vid_print(netdissect_options *ndo, u_char tpay, len = item_len - 4; ND_TCHECK_LEN(vid, len); for(i=0; i<len; i++) { - if(ND_ISPRINT(EXTRACT_U_1(vid + i))) - ND_PRINT("%c", EXTRACT_U_1(vid + i)); + if(ND_ISPRINT(GET_U_1(vid + i))) + ND_PRINT("%c", GET_U_1(vid + i)); else ND_PRINT("."); } if (2 < ndo->ndo_vflag && 4 < len) { @@ -2656,7 +2669,7 @@ ikev2_e_print(netdissect_options *ndo, #endif ND_TCHECK_SIZE(ext); - ikev2_pay_print(ndo, NPSTR(tpay), EXTRACT_U_1(ext->critical)); + ikev2_pay_print(ndo, NPSTR(tpay), GET_U_1(ext->critical)); dlen = item_len-4; @@ -2671,11 +2684,11 @@ ikev2_e_print(netdissect_options *ndo, ND_TCHECK_LEN(dat, dlen); #ifdef HAVE_LIBCRYPTO - np = EXTRACT_U_1(ext->np); + np = GET_U_1(ext->np); /* try to decypt it! */ if(esp_print_decrypt_buffer_by_ikev2(ndo, - EXTRACT_U_1(base->flags) & ISAKMP_FLAG_I, + GET_U_1(base->flags) & ISAKMP_FLAG_I, base->i_ck, base->r_ck, dat, dat+dlen)) { @@ -2735,7 +2748,7 @@ ike_sub0_print(netdissect_options *ndo, * or truncated, otherwise we could loop forever processing * zero-length items or otherwise misdissect the packet. */ - item_len = EXTRACT_BE_U_2(ext->len); + item_len = GET_BE_U_2(ext->len); if (item_len <= 4) return NULL; @@ -2770,7 +2783,7 @@ ikev1_sub_print(netdissect_options *ndo, while (np) { ND_TCHECK_SIZE(ext); - item_len = EXTRACT_BE_U_2(ext->len); + item_len = GET_BE_U_2(ext->len); ND_TCHECK_LEN(ext, item_len); depth++; @@ -2787,7 +2800,7 @@ ikev1_sub_print(netdissect_options *ndo, return NULL; } - np = EXTRACT_U_1(ext->np); + np = GET_U_1(ext->np); ext = (const struct isakmp_gen *)cp; } return cp; @@ -2819,7 +2832,7 @@ ikev1_print(netdissect_options *ndo, p = (const struct isakmp *)bp; ep = ndo->ndo_snapend; - phase = (EXTRACT_BE_U_4(base->msgid) == 0) ? 1 : 2; + phase = (GET_BE_U_4(base->msgid) == 0) ? 1 : 2; if (phase == 1) ND_PRINT(" phase %u", phase); else @@ -2843,8 +2856,8 @@ ikev1_print(netdissect_options *ndo, ND_PRINT(" ?"); } - ND_PRINT(" %s", ETYPESTR(EXTRACT_U_1(base->etype))); - flags = EXTRACT_U_1(base->flags); + ND_PRINT(" %s", ETYPESTR(GET_U_1(base->etype))); + flags = GET_U_1(base->flags); if (flags) { ND_PRINT("[%s%s]", flags & ISAKMP_FLAG_E ? "E" : "", flags & ISAKMP_FLAG_C ? "C" : ""); @@ -2855,7 +2868,7 @@ ikev1_print(netdissect_options *ndo, ND_PRINT(":"); - np = EXTRACT_U_1(base->np); + np = GET_U_1(base->np); /* regardless of phase... */ if (flags & ISAKMP_FLAG_E) { @@ -2874,9 +2887,9 @@ ikev1_print(netdissect_options *ndo, done: if (ndo->ndo_vflag) { - if (EXTRACT_BE_U_4(base->len) != length) { + if (GET_BE_U_4(base->len) != length) { ND_PRINT(" (len mismatch: isakmp %u/ip %u)", - EXTRACT_BE_U_4(base->len), length); + GET_BE_U_4(base->len), length); } } } @@ -2899,7 +2912,7 @@ ikev2_sub0_print(netdissect_options *ndo, const struct isakmp *base, * or truncated, otherwise we could loop forever processing * zero-length items or otherwise misdissect the packet. */ - item_len = EXTRACT_BE_U_2(ext->len); + item_len = GET_BE_U_2(ext->len); if (item_len <= 4) return NULL; @@ -2937,7 +2950,7 @@ ikev2_sub_print(netdissect_options *ndo, while (np) { ND_TCHECK_SIZE(ext); - ND_TCHECK_LEN(ext, EXTRACT_BE_U_2(ext->len)); + ND_TCHECK_LEN(ext, GET_BE_U_2(ext->len)); depth++; ND_PRINT("\n"); @@ -2954,7 +2967,7 @@ ikev2_sub_print(netdissect_options *ndo, return NULL; } - np = EXTRACT_U_1(ext->np); + np = GET_U_1(ext->np); ext = (const struct isakmp_gen *)cp; } return cp; @@ -2977,14 +2990,14 @@ ikev2_print(netdissect_options *ndo, p = (const struct isakmp *)bp; ep = ndo->ndo_snapend; - phase = (EXTRACT_BE_U_4(base->msgid) == 0) ? 1 : 2; + phase = (GET_BE_U_4(base->msgid) == 0) ? 1 : 2; if (phase == 1) ND_PRINT(" parent_sa"); else ND_PRINT(" child_sa "); - ND_PRINT(" %s", ETYPESTR(EXTRACT_U_1(base->etype))); - flags = EXTRACT_U_1(base->flags); + ND_PRINT(" %s", ETYPESTR(GET_U_1(base->etype))); + flags = GET_U_1(base->flags); if (flags) { ND_PRINT("[%s%s%s]", flags & ISAKMP_FLAG_I ? "I" : "", @@ -2997,7 +3010,7 @@ ikev2_print(netdissect_options *ndo, ND_PRINT(":"); - np = EXTRACT_U_1(base->np); + np = GET_U_1(base->np); /* regardless of phase... */ if (flags & ISAKMP_FLAG_E) { @@ -3016,9 +3029,9 @@ ikev2_print(netdissect_options *ndo, done: if (ndo->ndo_vflag) { - if (EXTRACT_BE_U_4(base->len) != length) { + if (GET_BE_U_4(base->len) != length) { ND_PRINT(" (len mismatch: isakmp %u/ip %u)", - EXTRACT_BE_U_4(base->len), length); + GET_BE_U_4(base->len), length); } } } @@ -3050,9 +3063,9 @@ isakmp_print(netdissect_options *ndo, } ND_PRINT("isakmp"); - major = (EXTRACT_U_1(p->vers) & ISAKMP_VERS_MAJOR) + major = (GET_U_1(p->vers) & ISAKMP_VERS_MAJOR) >> ISAKMP_VERS_MAJOR_SHIFT; - minor = (EXTRACT_U_1(p->vers) & ISAKMP_VERS_MINOR) + minor = (GET_U_1(p->vers) & ISAKMP_VERS_MINOR) >> ISAKMP_VERS_MINOR_SHIFT; if (ndo->ndo_vflag) { @@ -3090,7 +3103,7 @@ isakmp_rfc3948_print(netdissect_options *ndo, { ndo->ndo_protocol = "isakmp_rfc3948"; ND_TCHECK_1(bp); - if(length == 1 && EXTRACT_U_1(bp)==0xff) { + if(length == 1 && GET_U_1(bp)==0xff) { ND_PRINT("isakmp-nat-keep-alive"); return; } @@ -3103,7 +3116,7 @@ isakmp_rfc3948_print(netdissect_options *ndo, /* * see if this is an IKE packet */ - if (EXTRACT_BE_U_4(bp) == 0) { + if (GET_BE_U_4(bp) == 0) { ND_PRINT("NONESP-encap: "); isakmp_print(ndo, bp+4, length-4, bp2); return; diff --git a/print-isoclns.c b/print-isoclns.c index d4b0214c..30170fda 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -487,14 +487,14 @@ static const struct tok clnp_flag_values[] = { { 0, NULL} }; -#define ISIS_MASK_LSP_OL_BIT(x) (EXTRACT_U_1(x)&0x4) -#define ISIS_MASK_LSP_ISTYPE_BITS(x) (EXTRACT_U_1(x)&0x3) -#define ISIS_MASK_LSP_PARTITION_BIT(x) (EXTRACT_U_1(x)&0x80) -#define ISIS_MASK_LSP_ATT_BITS(x) (EXTRACT_U_1(x)&0x78) -#define ISIS_MASK_LSP_ATT_ERROR_BIT(x) (EXTRACT_U_1(x)&0x40) -#define ISIS_MASK_LSP_ATT_EXPENSE_BIT(x) (EXTRACT_U_1(x)&0x20) -#define ISIS_MASK_LSP_ATT_DELAY_BIT(x) (EXTRACT_U_1(x)&0x10) -#define ISIS_MASK_LSP_ATT_DEFAULT_BIT(x) (EXTRACT_U_1(x)&0x8) +#define ISIS_MASK_LSP_OL_BIT(x) (GET_U_1(x)&0x4) +#define ISIS_MASK_LSP_ISTYPE_BITS(x) (GET_U_1(x)&0x3) +#define ISIS_MASK_LSP_PARTITION_BIT(x) (GET_U_1(x)&0x80) +#define ISIS_MASK_LSP_ATT_BITS(x) (GET_U_1(x)&0x78) +#define ISIS_MASK_LSP_ATT_ERROR_BIT(x) (GET_U_1(x)&0x40) +#define ISIS_MASK_LSP_ATT_EXPENSE_BIT(x) (GET_U_1(x)&0x20) +#define ISIS_MASK_LSP_ATT_DELAY_BIT(x) (GET_U_1(x)&0x10) +#define ISIS_MASK_LSP_ATT_DEFAULT_BIT(x) (GET_U_1(x)&0x8) #define ISIS_MASK_MTID(x) ((x)&0x0fff) #define ISIS_MASK_MTFLAGS(x) ((x)&0xf000) @@ -511,10 +511,10 @@ static const struct tok isis_mt_flag_values[] = { #define ISIS_MASK_TLV_EXTD_IP6_IE(x) ((x)&0x40) #define ISIS_MASK_TLV_EXTD_IP6_SUBTLV(x) ((x)&0x20) -#define ISIS_LSP_TLV_METRIC_SUPPORTED(x) (EXTRACT_U_1(x)&0x80) -#define ISIS_LSP_TLV_METRIC_IE(x) (EXTRACT_U_1(x)&0x40) -#define ISIS_LSP_TLV_METRIC_UPDOWN(x) (EXTRACT_U_1(x)&0x80) -#define ISIS_LSP_TLV_METRIC_VALUE(x) (EXTRACT_U_1(x)&0x3f) +#define ISIS_LSP_TLV_METRIC_SUPPORTED(x) (GET_U_1(x)&0x80) +#define ISIS_LSP_TLV_METRIC_IE(x) (GET_U_1(x)&0x40) +#define ISIS_LSP_TLV_METRIC_UPDOWN(x) (GET_U_1(x)&0x80) +#define ISIS_LSP_TLV_METRIC_VALUE(x) (GET_U_1(x)&0x3f) #define ISIS_MASK_TLV_SHARED_RISK_GROUP(x) ((x)&0x1) @@ -682,9 +682,11 @@ isoclns_print(netdissect_options *ndo, const u_char *p, u_int length) ND_TCHECK_1(p); /* enough bytes on the wire ? */ if (ndo->ndo_eflag) - ND_PRINT("OSI NLPID %s (0x%02x): ", tok2str(nlpid_values, "Unknown", EXTRACT_U_1(p)), EXTRACT_U_1(p)); + ND_PRINT("OSI NLPID %s (0x%02x): ", + tok2str(nlpid_values, "Unknown", GET_U_1(p)), + GET_U_1(p)); - switch (EXTRACT_U_1(p)) { + switch (GET_U_1(p)) { case NLPID_CLNP: if (!clnp_print(ndo, p, length)) @@ -722,7 +724,7 @@ isoclns_print(netdissect_options *ndo, const u_char *p, u_int length) default: if (!ndo->ndo_eflag) - ND_PRINT("OSI NLPID 0x%02x unknown", EXTRACT_U_1(p)); + ND_PRINT("OSI NLPID 0x%02x unknown", GET_U_1(p)); ND_PRINT("%slength: %u", ndo->ndo_eflag ? "" : ", ", length); if (length > 1) print_unknown_data(ndo, p, "\n\t", length); @@ -783,7 +785,7 @@ clnp_print(netdissect_options *ndo, clnp_header = (const struct clnp_header_t *) pptr; ND_TCHECK_SIZE(clnp_header); - li = EXTRACT_U_1(clnp_header->length_indicator); + li = GET_U_1(clnp_header->length_indicator); li_remaining = li; optr = pptr; @@ -794,8 +796,9 @@ clnp_print(netdissect_options *ndo, * Sanity checking of the header. */ - if (EXTRACT_U_1(clnp_header->version) != CLNP_VERSION) { - ND_PRINT("version %u packet not supported", EXTRACT_U_1(clnp_header->version)); + if (GET_U_1(clnp_header->version) != CLNP_VERSION) { + ND_PRINT("version %u packet not supported", + GET_U_1(clnp_header->version)); return (0); } @@ -807,7 +810,7 @@ clnp_print(netdissect_options *ndo, if (li < sizeof(struct clnp_header_t)) { ND_PRINT(" length indicator %u < min PDU size:", li); while (pptr < ndo->ndo_snapend) { - ND_PRINT("%02X", EXTRACT_U_1(pptr)); + ND_PRINT("%02X", GET_U_1(pptr)); pptr++; } return (0); @@ -815,8 +818,8 @@ clnp_print(netdissect_options *ndo, /* FIXME further header sanity checking */ - clnp_pdu_type = EXTRACT_U_1(clnp_header->type) & CLNP_PDU_TYPE_MASK; - clnp_flags = EXTRACT_U_1(clnp_header->type) & CLNP_FLAG_MASK; + clnp_pdu_type = GET_U_1(clnp_header->type) & CLNP_PDU_TYPE_MASK; + clnp_flags = GET_U_1(clnp_header->type) & CLNP_FLAG_MASK; pptr += sizeof(struct clnp_header_t); li_remaining -= sizeof(struct clnp_header_t); @@ -826,7 +829,7 @@ clnp_print(netdissect_options *ndo, return (0); } ND_TCHECK_1(pptr); - dest_address_length = EXTRACT_U_1(pptr); + dest_address_length = GET_U_1(pptr); pptr += 1; li_remaining -= 1; if (li_remaining < dest_address_length) { @@ -843,7 +846,7 @@ clnp_print(netdissect_options *ndo, return (0); } ND_TCHECK_1(pptr); - source_address_length = EXTRACT_U_1(pptr); + source_address_length = GET_U_1(pptr); pptr += 1; li_remaining -= 1; if (li_remaining < source_address_length) { @@ -868,15 +871,15 @@ clnp_print(netdissect_options *ndo, ND_PRINT("\n\t%s PDU, hlen: %u, v: %u, lifetime: %u.%us, Segment PDU length: %u, checksum: 0x%04x", tok2str(clnp_pdu_values, "unknown (%u)",clnp_pdu_type), - EXTRACT_U_1(clnp_header->length_indicator), - EXTRACT_U_1(clnp_header->version), - EXTRACT_U_1(clnp_header->lifetime)/2, - (EXTRACT_U_1(clnp_header->lifetime)%2)*5, - EXTRACT_BE_U_2(clnp_header->segment_length), - EXTRACT_BE_U_2(clnp_header->cksum)); + GET_U_1(clnp_header->length_indicator), + GET_U_1(clnp_header->version), + GET_U_1(clnp_header->lifetime)/2, + (GET_U_1(clnp_header->lifetime)%2)*5, + GET_BE_U_2(clnp_header->segment_length), + GET_BE_U_2(clnp_header->cksum)); - osi_print_cksum(ndo, optr, EXTRACT_BE_U_2(clnp_header->cksum), 7, - EXTRACT_U_1(clnp_header->length_indicator)); + osi_print_cksum(ndo, optr, GET_BE_U_2(clnp_header->cksum), 7, + GET_U_1(clnp_header->length_indicator)); ND_PRINT("\n\tFlags [%s]", bittok2str(clnp_flag_values, "none", clnp_flags)); @@ -895,9 +898,9 @@ clnp_print(netdissect_options *ndo, clnp_segment_header = (const struct clnp_segment_header_t *) pptr; ND_TCHECK_SIZE(clnp_segment_header); ND_PRINT("\n\tData Unit ID: 0x%04x, Segment Offset: %u, Total PDU Length: %u", - 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)); + GET_BE_U_2(clnp_segment_header->data_unit_id), + GET_BE_U_2(clnp_segment_header->segment_offset), + GET_BE_U_2(clnp_segment_header->total_length)); pptr+=sizeof(struct clnp_segment_header_t); li_remaining-=sizeof(struct clnp_segment_header_t); } @@ -912,8 +915,8 @@ clnp_print(netdissect_options *ndo, return (0); } ND_TCHECK_2(pptr); - op = EXTRACT_U_1(pptr); - opli = EXTRACT_U_1(pptr + 1); + op = GET_U_1(pptr); + opli = GET_U_1(pptr + 1); pptr += 2; li_remaining -= 2; if (opli > li_remaining) { @@ -948,9 +951,9 @@ clnp_print(netdissect_options *ndo, return (0); } ND_PRINT("%s %s", - tok2str(clnp_option_sr_rr_values,"Unknown",EXTRACT_U_1(tptr)), + tok2str(clnp_option_sr_rr_values,"Unknown",GET_U_1(tptr)), tok2str(clnp_option_sr_rr_string_values, "Unknown Option %u", op)); - nsap_offset=EXTRACT_U_1(tptr + 1); + nsap_offset=GET_U_1(tptr + 1); if (nsap_offset == 0) { ND_PRINT(" Bad NSAP offset (0)"); break; @@ -963,7 +966,7 @@ clnp_print(netdissect_options *ndo, tptr+=nsap_offset; tlen-=nsap_offset; while (tlen > 0) { - source_address_length=EXTRACT_U_1(tptr); + source_address_length=GET_U_1(tptr); if (tlen < source_address_length+1) { ND_PRINT("\n\t NSAP address goes past end of option"); break; @@ -985,7 +988,7 @@ clnp_print(netdissect_options *ndo, ND_PRINT(", bad opt len"); return (0); } - ND_PRINT("0x%1x", EXTRACT_U_1(tptr)&0x0f); + ND_PRINT("0x%1x", GET_U_1(tptr)&0x0f); break; case CLNP_OPTION_QOS_MAINTENANCE: @@ -994,13 +997,13 @@ clnp_print(netdissect_options *ndo, return (0); } ND_PRINT("\n\t Format Code: %s", - tok2str(clnp_option_scope_values, "Reserved", EXTRACT_U_1(tptr) & CLNP_OPTION_SCOPE_MASK)); + tok2str(clnp_option_scope_values, "Reserved", GET_U_1(tptr) & CLNP_OPTION_SCOPE_MASK)); - if ((EXTRACT_U_1(tptr)&CLNP_OPTION_SCOPE_MASK) == CLNP_OPTION_SCOPE_GLOBAL) + if ((GET_U_1(tptr)&CLNP_OPTION_SCOPE_MASK) == CLNP_OPTION_SCOPE_GLOBAL) ND_PRINT("\n\t QoS Flags [%s]", bittok2str(clnp_option_qos_global_values, "none", - EXTRACT_U_1(tptr)&CLNP_OPTION_OPTION_QOS_MASK)); + GET_U_1(tptr)&CLNP_OPTION_OPTION_QOS_MASK)); break; case CLNP_OPTION_SECURITY: @@ -1009,8 +1012,8 @@ clnp_print(netdissect_options *ndo, return (0); } ND_PRINT("\n\t Format Code: %s, Security-Level %u", - tok2str(clnp_option_scope_values,"Reserved",EXTRACT_U_1(tptr)&CLNP_OPTION_SCOPE_MASK), - EXTRACT_U_1(tptr + 1)); + tok2str(clnp_option_scope_values,"Reserved",GET_U_1(tptr)&CLNP_OPTION_SCOPE_MASK), + GET_U_1(tptr + 1)); break; case CLNP_OPTION_DISCARD_REASON: @@ -1018,7 +1021,7 @@ clnp_print(netdissect_options *ndo, ND_PRINT(", bad opt len"); return (0); } - rfd_error = EXTRACT_U_1(tptr); + rfd_error = GET_U_1(tptr); rfd_error_major = (rfd_error&0xf0) >> 4; rfd_error_minor = rfd_error&0x0f; ND_PRINT("\n\t Class: %s Error (0x%01x), %s (0x%01x)", @@ -1051,7 +1054,7 @@ clnp_print(netdissect_options *ndo, case CLNP_PDU_ER: /* fall through */ case CLNP_PDU_ERP: ND_TCHECK_1(pptr); - if (EXTRACT_U_1(pptr) == NLPID_CLNP) { + if (GET_U_1(pptr) == NLPID_CLNP) { ND_PRINT("\n\t-----original packet-----\n\t"); /* FIXME recursion protection */ clnp_print(ndo, pptr, length - li); @@ -1131,19 +1134,20 @@ esis_print(netdissect_options *ndo, esis_header = (const struct esis_header_t *) pptr; ND_TCHECK_SIZE(esis_header); - li = EXTRACT_U_1(esis_header->length_indicator); + li = GET_U_1(esis_header->length_indicator); optr = pptr; /* * Sanity checking of the header. */ - if (EXTRACT_U_1(esis_header->nlpid) != NLPID_ESIS) { - ND_PRINT(" nlpid 0x%02x packet not supported", EXTRACT_U_1(esis_header->nlpid)); + if (GET_U_1(esis_header->nlpid) != NLPID_ESIS) { + ND_PRINT(" nlpid 0x%02x packet not supported", + GET_U_1(esis_header->nlpid)); return; } - version = EXTRACT_U_1(esis_header->version); + version = GET_U_1(esis_header->version); if (version != ESIS_VERSION) { ND_PRINT(" version %u packet not supported", version); return; @@ -1157,13 +1161,13 @@ esis_print(netdissect_options *ndo, if (li < sizeof(struct esis_header_t) + 2) { ND_PRINT(" length indicator %u < min PDU size:", li); while (pptr < ndo->ndo_snapend) { - ND_PRINT("%02X", EXTRACT_U_1(pptr)); + ND_PRINT("%02X", GET_U_1(pptr)); pptr++; } return; } - esis_pdu_type = EXTRACT_U_1(esis_header->type) & ESIS_PDU_TYPE_MASK; + esis_pdu_type = GET_U_1(esis_header->type) & ESIS_PDU_TYPE_MASK; if (ndo->ndo_vflag < 1) { ND_PRINT("%s%s, length %u", @@ -1179,13 +1183,13 @@ esis_print(netdissect_options *ndo, esis_pdu_type); ND_PRINT(", v: %u%s", version, version == ESIS_VERSION ? "" : "unsupported" ); - ND_PRINT(", checksum: 0x%04x", EXTRACT_BE_U_2(esis_header->cksum)); + ND_PRINT(", checksum: 0x%04x", GET_BE_U_2(esis_header->cksum)); - osi_print_cksum(ndo, pptr, EXTRACT_BE_U_2(esis_header->cksum), 7, + osi_print_cksum(ndo, pptr, GET_BE_U_2(esis_header->cksum), 7, li); ND_PRINT(", holding time: %us, length indicator: %u", - EXTRACT_BE_U_2(esis_header->holdtime), li); + GET_BE_U_2(esis_header->holdtime), li); if (ndo->ndo_vflag > 1) print_unknown_data(ndo, optr, "\n\t", sizeof(struct esis_header_t)); @@ -1203,7 +1207,7 @@ esis_print(netdissect_options *ndo, ND_PRINT(", bad redirect/li"); return; } - dstl = EXTRACT_U_1(pptr); + dstl = GET_U_1(pptr); pptr++; li--; ND_TCHECK_LEN(pptr, dstl); @@ -1221,7 +1225,7 @@ esis_print(netdissect_options *ndo, ND_PRINT(", bad redirect/li"); return; } - snpal = EXTRACT_U_1(pptr); + snpal = GET_U_1(pptr); pptr++; li--; ND_TCHECK_LEN(pptr, snpal); @@ -1237,7 +1241,7 @@ esis_print(netdissect_options *ndo, ND_PRINT(", bad redirect/li"); return; } - netal = EXTRACT_U_1(pptr); + netal = GET_U_1(pptr); pptr++; ND_TCHECK_LEN(pptr, netal); if (li < netal) { @@ -1269,7 +1273,7 @@ esis_print(netdissect_options *ndo, ND_PRINT(", bad esh/li"); return; } - source_address_number = EXTRACT_U_1(pptr); + source_address_number = GET_U_1(pptr); pptr++; li--; @@ -1281,7 +1285,7 @@ esis_print(netdissect_options *ndo, ND_PRINT(", bad esh/li"); return; } - source_address_length = EXTRACT_U_1(pptr); + source_address_length = GET_U_1(pptr); pptr++; li--; @@ -1306,7 +1310,7 @@ esis_print(netdissect_options *ndo, ND_PRINT(", bad ish/li"); return; } - source_address_length = EXTRACT_U_1(pptr); + source_address_length = GET_U_1(pptr); pptr++; li--; ND_TCHECK_LEN(pptr, source_address_length); @@ -1338,8 +1342,8 @@ esis_print(netdissect_options *ndo, return; } ND_TCHECK_2(pptr); - op = EXTRACT_U_1(pptr); - opli = EXTRACT_U_1(pptr + 1); + op = GET_U_1(pptr); + opli = GET_U_1(pptr + 1); pptr += 2; li -= 2; if (opli > li) { @@ -1359,7 +1363,7 @@ esis_print(netdissect_options *ndo, case ESIS_OPTION_ES_CONF_TIME: if (opli == 2) { ND_TCHECK_2(pptr); - ND_PRINT("%us", EXTRACT_BE_U_2(tptr)); + ND_PRINT("%us", GET_BE_U_2(tptr)); } else ND_PRINT("(bad length)"); break; @@ -1370,8 +1374,8 @@ esis_print(netdissect_options *ndo, ND_PRINT("%s (0x%02x)", tok2str(nlpid_values, "unknown", - EXTRACT_U_1(tptr)), - EXTRACT_U_1(tptr)); + GET_U_1(tptr)), + GET_U_1(tptr)); if (opli>1) /* further NPLIDs ? - put comma */ ND_PRINT(", "); tptr++; @@ -1411,12 +1415,12 @@ isis_print_mcid(netdissect_options *ndo, int i; ND_TCHECK_SIZE(mcid); - ND_PRINT("ID: %u, Name: ", EXTRACT_U_1(mcid->format_id)); + ND_PRINT("ID: %u, Name: ", GET_U_1(mcid->format_id)); if (nd_printzp(ndo, mcid->name, 32, ndo->ndo_snapend)) goto trunc; - ND_PRINT("\n\t Lvl: %u", EXTRACT_BE_U_2(mcid->revision_lvl)); + ND_PRINT("\n\t Lvl: %u", GET_BE_U_2(mcid->revision_lvl)); ND_PRINT(", Digest: "); @@ -1439,8 +1443,8 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo, while (len > 2) { ND_TCHECK_2(tptr); - stlv_type = EXTRACT_U_1(tptr); - stlv_len = EXTRACT_U_1(tptr + 1); + stlv_type = GET_U_1(tptr); + stlv_len = GET_U_1(tptr + 1); /* first lets see if we know the subTLVs name*/ ND_PRINT("\n\t %s subTLV #%u, length: %u", @@ -1491,10 +1495,10 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo, goto trunc; ND_PRINT("\n\t RES: %u V: %u A: %u D: %u", - (EXTRACT_U_1(tptr) >> 5), - ((EXTRACT_U_1(tptr) >> 4) & 0x01), - ((EXTRACT_U_1(tptr) >> 2) & 0x03), - (EXTRACT_U_1(tptr) & 0x03)); + (GET_U_1(tptr) >> 5), + ((GET_U_1(tptr) >> 4) & 0x01), + ((GET_U_1(tptr) >> 2) & 0x03), + (GET_U_1(tptr) & 0x03)); tptr++; @@ -1502,7 +1506,7 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo, for(i=1;i<=8; i++) { - ND_PRINT("%08x ", EXTRACT_BE_U_4(tptr)); + ND_PRINT("%08x ", GET_BE_U_4(tptr)); if (i%4 == 0 && i != 8) ND_PRINT("\n\t "); tptr = tptr + 4; @@ -1519,14 +1523,14 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo, while (stlv_len >= ISIS_SUBTLV_SPB_BVID_MIN_LEN) { ND_PRINT("\n\t ECT: %08x", - EXTRACT_BE_U_4(tptr)); + GET_BE_U_4(tptr)); tptr = tptr+4; ND_PRINT(" BVID: %u, U:%01x M:%01x ", - (EXTRACT_BE_U_2(tptr) >> 4) , - (EXTRACT_BE_U_2(tptr) >> 3) & 0x01, - (EXTRACT_BE_U_2(tptr) >> 2) & 0x01); + (GET_BE_U_2(tptr) >> 4) , + (GET_BE_U_2(tptr) >> 3) & 0x01, + (GET_BE_U_2(tptr) >> 2) & 0x01); tptr = tptr + 2; len = len - ISIS_SUBTLV_SPB_BVID_MIN_LEN; @@ -1559,8 +1563,8 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, while (len > 2) { ND_TCHECK_2(tptr); - stlv_type = EXTRACT_U_1(tptr); - stlv_len = EXTRACT_U_1(tptr + 1); + stlv_type = GET_U_1(tptr); + stlv_len = GET_U_1(tptr + 1); tptr = tptr + 2; len = len - 2; @@ -1582,24 +1586,24 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, if (stlv_len < ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN) goto trunc; - ND_PRINT("\n\t CIST Root-ID: %08x", EXTRACT_BE_U_4(tptr)); + ND_PRINT("\n\t CIST Root-ID: %08x", GET_BE_U_4(tptr)); tptr = tptr+4; - ND_PRINT(" %08x", EXTRACT_BE_U_4(tptr)); + ND_PRINT(" %08x", GET_BE_U_4(tptr)); tptr = tptr+4; - ND_PRINT(", Path Cost: %08x", EXTRACT_BE_U_4(tptr)); + ND_PRINT(", Path Cost: %08x", GET_BE_U_4(tptr)); tptr = tptr+4; - ND_PRINT(", Prio: %u", EXTRACT_BE_U_2(tptr)); + ND_PRINT(", Prio: %u", GET_BE_U_2(tptr)); tptr = tptr + 2; ND_PRINT("\n\t RES: %u", - EXTRACT_BE_U_2(tptr) >> 5); + GET_BE_U_2(tptr) >> 5); ND_PRINT(", V: %u", - (EXTRACT_BE_U_2(tptr) >> 4) & 0x0001); + (GET_BE_U_2(tptr) >> 4) & 0x0001); ND_PRINT(", SPSource-ID: %u", - (EXTRACT_BE_U_4(tptr) & 0x000fffff)); + (GET_BE_U_4(tptr) & 0x000fffff)); tptr = tptr+4; - ND_PRINT(", No of Trees: %x", EXTRACT_U_1(tptr)); + ND_PRINT(", No of Trees: %x", GET_U_1(tptr)); - treecount = EXTRACT_U_1(tptr); + treecount = GET_U_1(tptr); tptr++; len = len - ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN; @@ -1611,20 +1615,20 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, goto trunc; ND_PRINT("\n\t U:%u, M:%u, A:%u, RES:%u", - EXTRACT_U_1(tptr) >> 7, - (EXTRACT_U_1(tptr) >> 6) & 0x01, - (EXTRACT_U_1(tptr) >> 5) & 0x01, - (EXTRACT_U_1(tptr) & 0x1f)); + GET_U_1(tptr) >> 7, + (GET_U_1(tptr) >> 6) & 0x01, + (GET_U_1(tptr) >> 5) & 0x01, + (GET_U_1(tptr) & 0x1f)); tptr++; - ND_PRINT(", ECT: %08x", EXTRACT_BE_U_4(tptr)); + ND_PRINT(", ECT: %08x", GET_BE_U_4(tptr)); tptr = tptr + 4; ND_PRINT(", BVID: %u, SPVID: %u", - (EXTRACT_BE_U_3(tptr) >> 12) & 0x000fff, - EXTRACT_BE_U_3(tptr) & 0x000fff); + (GET_BE_U_3(tptr) >> 12) & 0x000fff, + GET_BE_U_3(tptr) & 0x000fff); tptr = tptr + 3; len = len - ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN; @@ -1638,13 +1642,13 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, if (stlv_len < 8) goto trunc; - ND_PRINT("\n\t BMAC: %08x", EXTRACT_BE_U_4(tptr)); + ND_PRINT("\n\t BMAC: %08x", GET_BE_U_4(tptr)); tptr = tptr+4; - ND_PRINT("%04x", EXTRACT_BE_U_2(tptr)); + ND_PRINT("%04x", GET_BE_U_2(tptr)); tptr = tptr+2; - ND_PRINT(", RES: %u, VID: %u", EXTRACT_BE_U_2(tptr) >> 12, - (EXTRACT_BE_U_2(tptr)) & 0x0fff); + ND_PRINT(", RES: %u, VID: %u", GET_BE_U_2(tptr) >> 12, + (GET_BE_U_2(tptr)) & 0x0fff); tptr = tptr+2; len = len - 8; @@ -1653,10 +1657,10 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, while (stlv_len >= 4) { ND_TCHECK_4(tptr); ND_PRINT("\n\t T: %u, R: %u, RES: %u, ISID: %u", - (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); + (GET_BE_U_4(tptr) >> 31), + (GET_BE_U_4(tptr) >> 30) & 0x01, + (GET_BE_U_4(tptr) >> 24) & 0x03f, + (GET_BE_U_4(tptr)) & 0x0ffffff); tptr = tptr + 4; len = len - 4; @@ -1691,19 +1695,19 @@ isis_print_id(netdissect_options *ndo, const uint8_t *cp, u_int id_len) if (sysid_len > id_len) sysid_len = id_len; for (i = 1; i <= sysid_len; i++) { - nd_snprintf(pos, sizeof(id) - (pos - id), "%02x", EXTRACT_U_1(cp)); + nd_snprintf(pos, sizeof(id) - (pos - id), "%02x", GET_U_1(cp)); cp++; pos += strlen(pos); if (i == 2 || i == 4) *pos++ = '.'; } if (id_len >= NODE_ID_LEN) { - nd_snprintf(pos, sizeof(id) - (pos - id), ".%02x", EXTRACT_U_1(cp)); + nd_snprintf(pos, sizeof(id) - (pos - id), ".%02x", GET_U_1(cp)); cp++; pos += strlen(pos); } if (id_len == LSP_ID_LEN) - nd_snprintf(pos, sizeof(id) - (pos - id), "-%02x", EXTRACT_U_1(cp)); + nd_snprintf(pos, sizeof(id) - (pos - id), "-%02x", GET_U_1(cp)); return (id); } @@ -1750,7 +1754,7 @@ isis_print_tlv_ip_reach(netdissect_options *ndo, ND_TCHECK_SIZE(tlv_ip_reach); - prefix_len = mask2plen(EXTRACT_IPV4_TO_HOST_ORDER(tlv_ip_reach->mask)); + prefix_len = mask2plen(GET_IPV4_TO_HOST_ORDER(tlv_ip_reach->mask)); if (prefix_len == -1) ND_PRINT("%sIPv4 prefix: %s mask %s", @@ -1816,8 +1820,8 @@ isis_print_ip_reach_subtlv(netdissect_options *ndo, case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32: while (subl >= 4) { ND_PRINT(", 0x%08x (=%u)", - EXTRACT_BE_U_4(tptr), - EXTRACT_BE_U_4(tptr)); + GET_BE_U_4(tptr), + GET_BE_U_4(tptr)); tptr+=4; subl-=4; } @@ -1825,8 +1829,8 @@ isis_print_ip_reach_subtlv(netdissect_options *ndo, case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64: while (subl >= 8) { ND_PRINT(", 0x%08x%08x", - EXTRACT_BE_U_4(tptr), - EXTRACT_BE_U_4(tptr + 4)); + GET_BE_U_4(tptr), + GET_BE_U_4(tptr + 4)); tptr+=8; subl-=8; } @@ -1874,7 +1878,7 @@ isis_print_ext_is_reach(netdissect_options *ndo, ND_TCHECK_3(tptr); if (tlv_remaining < 3) return(0); - ND_PRINT(", Metric: %u", EXTRACT_BE_U_3(tptr)); + ND_PRINT(", Metric: %u", GET_BE_U_3(tptr)); tptr+=3; tlv_remaining-=3; } @@ -1882,7 +1886,7 @@ isis_print_ext_is_reach(netdissect_options *ndo, ND_TCHECK_1(tptr); if (tlv_remaining < 1) return(0); - subtlv_sum_len=EXTRACT_U_1(tptr); /* read out subTLV length */ + subtlv_sum_len=GET_U_1(tptr); /* read out subTLV length */ tptr++; tlv_remaining--; proc_bytes=NODE_ID_LEN+3+1; @@ -1904,8 +1908,8 @@ isis_print_ext_is_reach(netdissect_options *ndo, proc_bytes += subtlv_sum_len; break; } - subtlv_type=EXTRACT_U_1(tptr); - subtlv_len=EXTRACT_U_1(tptr + 1); + subtlv_type=GET_U_1(tptr); + subtlv_len=GET_U_1(tptr + 1); tptr += 2; tlv_remaining -= 2; subtlv_sum_len -= 2; @@ -1933,9 +1937,9 @@ isis_print_ext_is_reach(netdissect_options *ndo, case ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID: case ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID: if (subtlv_len >= 4) { - ND_PRINT(", 0x%08x", EXTRACT_BE_U_4(tptr)); + ND_PRINT(", 0x%08x", GET_BE_U_4(tptr)); if (subtlv_len == 8) /* rfc4205 */ - ND_PRINT(", 0x%08x", EXTRACT_BE_U_4(tptr + 4)); + ND_PRINT(", 0x%08x", GET_BE_U_4(tptr + 4)); } break; case ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR: @@ -1946,14 +1950,14 @@ isis_print_ext_is_reach(netdissect_options *ndo, case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW : case ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW: if (subtlv_len >= 4) { - bw.i = EXTRACT_BE_U_4(tptr); + bw.i = GET_BE_U_4(tptr); ND_PRINT(", %.3f Mbps", bw.f * 8 / 1000000); } break; case ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW : if (subtlv_len >= 32) { for (te_class = 0; te_class < 8; te_class++) { - bw.i = EXTRACT_BE_U_4(tptr); + bw.i = GET_BE_U_4(tptr); ND_PRINT("%s TE-Class %u: %.3f Mbps", ident, te_class, @@ -1971,8 +1975,8 @@ isis_print_ext_is_reach(netdissect_options *ndo, break; ND_PRINT("%sBandwidth Constraints Model ID: %s (%u)", ident, - tok2str(diffserv_te_bc_values, "unknown", EXTRACT_U_1(tptr)), - EXTRACT_U_1(tptr)); + tok2str(diffserv_te_bc_values, "unknown", GET_U_1(tptr)), + GET_U_1(tptr)); tptr++; subtlv_len--; subtlv_sum_len--; @@ -1981,7 +1985,7 @@ isis_print_ext_is_reach(netdissect_options *ndo, for (te_class = 0; subtlv_len != 0; te_class++) { if (subtlv_len < 4) break; - bw.i = EXTRACT_BE_U_4(tptr); + bw.i = GET_BE_U_4(tptr); ND_PRINT("%s Bandwidth constraint CT%u: %.3f Mbps", ident, te_class, @@ -1994,54 +1998,54 @@ isis_print_ext_is_reach(netdissect_options *ndo, break; case ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC: if (subtlv_len >= 3) - ND_PRINT(", %u", EXTRACT_BE_U_3(tptr)); + ND_PRINT(", %u", GET_BE_U_3(tptr)); break; case ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE: if (subtlv_len == 2) { ND_PRINT(", [ %s ] (0x%04x)", bittok2str(isis_subtlv_link_attribute_values, "Unknown", - EXTRACT_BE_U_2(tptr)), - EXTRACT_BE_U_2(tptr)); + GET_BE_U_2(tptr)), + GET_BE_U_2(tptr)); } break; case ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE: if (subtlv_len >= 2) { ND_PRINT(", %s, Priority %u", - bittok2str(gmpls_link_prot_values, "none", EXTRACT_U_1(tptr)), - EXTRACT_U_1(tptr + 1)); + bittok2str(gmpls_link_prot_values, "none", GET_U_1(tptr)), + GET_U_1(tptr + 1)); } break; case ISIS_SUBTLV_SPB_METRIC: if (subtlv_len >= 6) { - ND_PRINT(", LM: %u", EXTRACT_BE_U_3(tptr)); + ND_PRINT(", LM: %u", GET_BE_U_3(tptr)); tptr += 3; subtlv_len -= 3; subtlv_sum_len -= 3; proc_bytes += 3; - ND_PRINT(", P: %u", EXTRACT_U_1(tptr)); + ND_PRINT(", P: %u", GET_U_1(tptr)); tptr++; subtlv_len--; subtlv_sum_len--; proc_bytes++; - ND_PRINT(", P-ID: %u", EXTRACT_BE_U_2(tptr)); + ND_PRINT(", P-ID: %u", GET_BE_U_2(tptr)); } break; case ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR: if (subtlv_len >= 36) { - gmpls_switch_cap = EXTRACT_U_1(tptr); + gmpls_switch_cap = GET_U_1(tptr); ND_PRINT("%s Interface Switching Capability:%s", ident, tok2str(gmpls_switch_cap_values, "Unknown", gmpls_switch_cap)); ND_PRINT(", LSP Encoding: %s", - tok2str(gmpls_encoding_values, "Unknown", EXTRACT_U_1((tptr + 1)))); + tok2str(gmpls_encoding_values, "Unknown", GET_U_1((tptr + 1)))); tptr += 4; subtlv_len -= 4; subtlv_sum_len -= 4; proc_bytes += 4; ND_PRINT("%s Max LSP Bandwidth:", ident); for (priority_level = 0; priority_level < 8; priority_level++) { - bw.i = EXTRACT_BE_U_4(tptr); + bw.i = GET_BE_U_4(tptr); ND_PRINT("%s priority level %u: %.3f Mbps", ident, priority_level, @@ -2058,17 +2062,18 @@ isis_print_ext_is_reach(netdissect_options *ndo, case GMPLS_PSC4: if (subtlv_len < 6) break; - bw.i = EXTRACT_BE_U_4(tptr); + bw.i = GET_BE_U_4(tptr); ND_PRINT("%s Min LSP Bandwidth: %.3f Mbps", ident, bw.f * 8 / 1000000); - ND_PRINT("%s Interface MTU: %u", ident, EXTRACT_BE_U_2(tptr + 4)); + ND_PRINT("%s Interface MTU: %u", ident, + GET_BE_U_2(tptr + 4)); break; case GMPLS_TSC: if (subtlv_len < 8) break; - bw.i = EXTRACT_BE_U_4(tptr); + bw.i = GET_BE_U_4(tptr); ND_PRINT("%s Min LSP Bandwidth: %.3f Mbps", ident, bw.f * 8 / 1000000); ND_PRINT("%s Indication %s", ident, - tok2str(gmpls_switch_cap_tsc_indication_values, "Unknown (%u)", EXTRACT_U_1((tptr + 4)))); + tok2str(gmpls_switch_cap_tsc_indication_values, "Unknown (%u)", GET_U_1((tptr + 4)))); break; default: /* there is some optional stuff left to decode but this is as of yet @@ -2113,11 +2118,11 @@ isis_print_mtid(netdissect_options *ndo, ident, tok2str(isis_mt_values, "Reserved for IETF Consensus", - ISIS_MASK_MTID(EXTRACT_BE_U_2(tptr)))); + ISIS_MASK_MTID(GET_BE_U_2(tptr)))); ND_PRINT(" Topology (0x%03x), Flags: [%s]", - ISIS_MASK_MTID(EXTRACT_BE_U_2(tptr)), - bittok2str(isis_mt_flag_values, "none",ISIS_MASK_MTFLAGS(EXTRACT_BE_U_2(tptr)))); + ISIS_MASK_MTID(GET_BE_U_2(tptr)), + bittok2str(isis_mt_flag_values, "none",ISIS_MASK_MTFLAGS(GET_BE_U_2(tptr)))); return(2); trunc: @@ -2140,13 +2145,13 @@ isis_print_extd_ip_reach(netdissect_options *ndo, u_int metric, status_byte, bit_length, byte_length, sublen, processed, subtlvtype, subtlvlen; ND_TCHECK_4(tptr); - metric = EXTRACT_BE_U_4(tptr); + metric = GET_BE_U_4(tptr); processed=4; tptr+=4; if (afi == AF_INET) { ND_TCHECK_1(tptr); - status_byte=EXTRACT_U_1(tptr); + status_byte=GET_U_1(tptr); tptr++; bit_length = status_byte&0x3f; if (bit_length > 32) { @@ -2158,8 +2163,8 @@ isis_print_extd_ip_reach(netdissect_options *ndo, processed++; } else if (afi == AF_INET6) { ND_TCHECK_2(tptr); - status_byte=EXTRACT_U_1(tptr); - bit_length=EXTRACT_U_1(tptr + 1); + status_byte=GET_U_1(tptr); + bit_length=GET_U_1(tptr + 1); if (bit_length > 128) { ND_PRINT("%sIPv6 prefix: bad bit length %u", ident, @@ -2209,15 +2214,15 @@ isis_print_extd_ip_reach(netdissect_options *ndo, the aggregate bytecount of the subTLVs for this prefix */ ND_TCHECK_1(tptr); - sublen=EXTRACT_U_1(tptr); + sublen=GET_U_1(tptr); tptr++; processed+=sublen+1; ND_PRINT(" (%u)", sublen); /* print out subTLV length */ while (sublen>0) { ND_TCHECK_2(tptr); - subtlvtype=EXTRACT_U_1(tptr); - subtlvlen=EXTRACT_U_1(tptr + 1); + subtlvtype=GET_U_1(tptr); + subtlvlen=GET_U_1(tptr + 1); tptr+=2; /* prepend the indent string */ nd_snprintf(ident_buffer, sizeof(ident_buffer), "%s ",ident); @@ -2301,26 +2306,26 @@ isis_print(netdissect_options *ndo, * Sanity checking of the header. */ - version = EXTRACT_U_1(isis_header->version); + version = GET_U_1(isis_header->version); if (version != ISIS_VERSION) { ND_PRINT("version %u packet not supported", version); return (0); } - pdu_id_length = EXTRACT_U_1(isis_header->id_length); + pdu_id_length = GET_U_1(isis_header->id_length); if ((pdu_id_length != SYSTEM_ID_LEN) && (pdu_id_length != 0)) { ND_PRINT("system ID length of %u is not supported", pdu_id_length); return (0); } - pdu_version = EXTRACT_U_1(isis_header->pdu_version); + pdu_version = GET_U_1(isis_header->pdu_version); if (pdu_version != ISIS_VERSION) { ND_PRINT("version %u packet not supported", pdu_version); return (0); } - fixed_len = EXTRACT_U_1(isis_header->fixed_len); + fixed_len = GET_U_1(isis_header->fixed_len); if (length < fixed_len) { ND_PRINT("fixed header length %u > packet length %u", fixed_len, length); return (0); @@ -2331,7 +2336,7 @@ isis_print(netdissect_options *ndo, return (0); } - pdu_max_area = EXTRACT_U_1(isis_header->max_area); + pdu_max_area = GET_U_1(isis_header->max_area); switch(pdu_max_area) { case 0: max_area = 3; /* silly shit */ @@ -2372,7 +2377,7 @@ isis_print(netdissect_options *ndo, return (0); } - pdu_type = EXTRACT_U_1(isis_header->pdu_type); + pdu_type = GET_U_1(isis_header->pdu_type); /* in non-verbose mode print the basic PDU Type plus PDU specific brief information*/ if (ndo->ndo_vflag == 0) { @@ -2418,11 +2423,11 @@ isis_print(netdissect_options *ndo, isis_print_id(ndo, header_iih_lan->source_id, SYSTEM_ID_LEN)); ND_PRINT(", lan-id %s, prio %u", isis_print_id(ndo, header_iih_lan->lan_id,NODE_ID_LEN), - EXTRACT_U_1(header_iih_lan->priority)); + GET_U_1(header_iih_lan->priority)); ND_PRINT(", length %u", length); return (1); } - pdu_len=EXTRACT_BE_U_2(header_iih_lan->pdu_len); + pdu_len=GET_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; @@ -2430,14 +2435,14 @@ isis_print(netdissect_options *ndo, ND_PRINT("\n\t source-id: %s, holding time: %us, Flags: [%s]", isis_print_id(ndo, header_iih_lan->source_id,SYSTEM_ID_LEN), - EXTRACT_BE_U_2(header_iih_lan->holding_time), + GET_BE_U_2(header_iih_lan->holding_time), tok2str(isis_iih_circuit_type_values, "unknown circuit type 0x%02x", - EXTRACT_U_1(header_iih_lan->circuit_type))); + GET_U_1(header_iih_lan->circuit_type))); ND_PRINT("\n\t lan-id: %s, Priority: %u, PDU length: %u", isis_print_id(ndo, header_iih_lan->lan_id, NODE_ID_LEN), - EXTRACT_U_1(header_iih_lan->priority) & ISIS_LAN_PRIORITY_MASK, + GET_U_1(header_iih_lan->priority) & ISIS_LAN_PRIORITY_MASK, pdu_len); if (ndo->ndo_vflag > 1) { @@ -2463,7 +2468,7 @@ isis_print(netdissect_options *ndo, ND_PRINT(", length %u", length); return (1); } - pdu_len=EXTRACT_BE_U_2(header_iih_ptp->pdu_len); + pdu_len=GET_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; @@ -2471,13 +2476,13 @@ isis_print(netdissect_options *ndo, ND_PRINT("\n\t source-id: %s, holding time: %us, Flags: [%s]", isis_print_id(ndo, header_iih_ptp->source_id,SYSTEM_ID_LEN), - EXTRACT_BE_U_2(header_iih_ptp->holding_time), + GET_BE_U_2(header_iih_ptp->holding_time), tok2str(isis_iih_circuit_type_values, "unknown circuit type 0x%02x", - EXTRACT_U_1(header_iih_ptp->circuit_type))); + GET_U_1(header_iih_ptp->circuit_type))); ND_PRINT("\n\t circuit-id: 0x%02x, PDU length: %u", - EXTRACT_U_1(header_iih_ptp->circuit_id), + GET_U_1(header_iih_ptp->circuit_id), pdu_len); if (ndo->ndo_vflag > 1) { @@ -2502,12 +2507,12 @@ isis_print(netdissect_options *ndo, if (ndo->ndo_vflag == 0) { ND_PRINT(", lsp-id %s, seq 0x%08x, lifetime %5us", isis_print_id(ndo, header_lsp->lsp_id, LSP_ID_LEN), - EXTRACT_BE_U_4(header_lsp->sequence_number), - EXTRACT_BE_U_2(header_lsp->remaining_lifetime)); + GET_BE_U_4(header_lsp->sequence_number), + GET_BE_U_2(header_lsp->remaining_lifetime)); ND_PRINT(", length %u", length); return (1); } - pdu_len=EXTRACT_BE_U_2(header_lsp->pdu_len); + pdu_len=GET_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; @@ -2515,12 +2520,12 @@ isis_print(netdissect_options *ndo, ND_PRINT("\n\t lsp-id: %s, seq: 0x%08x, lifetime: %5us\n\t chksum: 0x%04x", isis_print_id(ndo, header_lsp->lsp_id, LSP_ID_LEN), - EXTRACT_BE_U_4(header_lsp->sequence_number), - EXTRACT_BE_U_2(header_lsp->remaining_lifetime), - EXTRACT_BE_U_2(header_lsp->checksum)); + GET_BE_U_4(header_lsp->sequence_number), + GET_BE_U_2(header_lsp->remaining_lifetime), + GET_BE_U_2(header_lsp->checksum)); osi_print_cksum(ndo, (const uint8_t *)header_lsp->lsp_id, - EXTRACT_BE_U_2(header_lsp->checksum), + GET_BE_U_2(header_lsp->checksum), 12, length-12); ND_PRINT(", PDU length: %u, Flags: [ %s", @@ -2562,7 +2567,7 @@ isis_print(netdissect_options *ndo, ND_PRINT(", length %u", length); return (1); } - pdu_len=EXTRACT_BE_U_2(header_csnp->pdu_len); + pdu_len=GET_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; @@ -2600,7 +2605,7 @@ isis_print(netdissect_options *ndo, ND_PRINT(", length %u", length); return (1); } - pdu_len=EXTRACT_BE_U_2(header_psnp->pdu_len); + pdu_len=GET_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; @@ -2636,8 +2641,8 @@ isis_print(netdissect_options *ndo, ND_TCHECK_2(pptr); if (packet_len < 2) goto trunc; - tlv_type = EXTRACT_U_1(pptr); - tlv_len = EXTRACT_U_1(pptr + 1); + tlv_type = GET_U_1(pptr); + tlv_len = GET_U_1(pptr + 1); pptr += 2; packet_len -= 2; tlen = tlv_len; /* copy temporary len & pointer to packet data */ @@ -2661,7 +2666,7 @@ isis_print(netdissect_options *ndo, switch (tlv_type) { case ISIS_TLV_AREA_ADDR: ND_TCHECK_1(tptr); - alen = EXTRACT_U_1(tptr); + alen = GET_U_1(tptr); tptr++; while (tlen && alen < tlen) { ND_TCHECK_LEN(tptr, alen); @@ -2673,7 +2678,7 @@ isis_print(netdissect_options *ndo, if (tlen==0) /* if this is the last area address do not attempt a boundary check */ break; ND_TCHECK_1(tptr); - alen = EXTRACT_U_1(tptr); + alen = GET_U_1(tptr); tptr++; } break; @@ -2689,7 +2694,7 @@ isis_print(netdissect_options *ndo, case ISIS_TLV_ISNEIGH_VARLEN: if (!ND_TTEST_1(tptr) || tlen < 3) /* min. TLV length */ goto trunc; - lan_alen = EXTRACT_U_1(tptr); /* LAN address length */ + lan_alen = GET_U_1(tptr); /* LAN address length */ tptr++; if (lan_alen == 0) { ND_PRINT("\n\t LAN address length 0 bytes"); @@ -2749,7 +2754,7 @@ isis_print(netdissect_options *ndo, ND_PRINT("\n\t %s", tok2str(isis_is_reach_virtual_values, "bogus virtual flag 0x%02x", - EXTRACT_U_1(tptr))); + GET_U_1(tptr))); tptr++; tlv_is_reach = (const struct isis_tlv_is_reach *)tptr; while (tlen >= sizeof(struct isis_tlv_is_reach)) { @@ -2852,9 +2857,9 @@ isis_print(netdissect_options *ndo, ND_PRINT("\n\t %s: ", tok2str(isis_subtlv_auth_values, "unknown Authentication type 0x%02x", - EXTRACT_U_1(tptr))); + GET_U_1(tptr))); - switch (EXTRACT_U_1(tptr)) { + switch (GET_U_1(tptr)) { case ISIS_SUBTLV_AUTH_SIMPLE: if (nd_printzp(ndo, tptr + 1, tlv_len - 1, ndo->ndo_snapend)) goto trunc; @@ -2862,7 +2867,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("%02x", EXTRACT_U_1(tptr + i)); + ND_PRINT("%02x", GET_U_1(tptr + i)); } if (tlv_len != ISIS_SUBTLV_AUTH_MD5_LEN+1) ND_PRINT(", (invalid subTLV) "); @@ -2875,11 +2880,11 @@ isis_print(netdissect_options *ndo, break; case ISIS_SUBTLV_AUTH_GENERIC: ND_TCHECK_2(tptr + 1); - key_id = EXTRACT_BE_U_2(tptr + 1); + key_id = GET_BE_U_2(tptr + 1); ND_PRINT("%u, password: ", key_id); for(i=1 + sizeof(uint16_t);i<tlv_len;i++) { ND_TCHECK_1(tptr + i); - ND_PRINT("%02x", EXTRACT_U_1(tptr + i)); + ND_PRINT("%02x", GET_U_1(tptr + i)); } break; case ISIS_SUBTLV_AUTH_PRIVATE: @@ -2895,14 +2900,14 @@ isis_print(netdissect_options *ndo, if(tlen>=1) { ND_TCHECK_1(tptr); ND_PRINT("\n\t Adjacency State: %s (%u)", - tok2str(isis_ptp_adjancey_values, "unknown", EXTRACT_U_1(tptr)), - EXTRACT_U_1(tptr)); + tok2str(isis_ptp_adjancey_values, "unknown", GET_U_1(tptr)), + GET_U_1(tptr)); tlen--; } if(tlen>sizeof(tlv_ptp_adj->extd_local_circuit_id)) { ND_TCHECK_4(tlv_ptp_adj->extd_local_circuit_id); ND_PRINT("\n\t Extended Local circuit-ID: 0x%08x", - EXTRACT_BE_U_4(tlv_ptp_adj->extd_local_circuit_id)); + GET_BE_U_4(tlv_ptp_adj->extd_local_circuit_id)); tlen-=sizeof(tlv_ptp_adj->extd_local_circuit_id); } if(tlen>=SYSTEM_ID_LEN) { @@ -2914,7 +2919,7 @@ isis_print(netdissect_options *ndo, if(tlen>=sizeof(tlv_ptp_adj->neighbor_extd_local_circuit_id)) { ND_TCHECK_4(tlv_ptp_adj->neighbor_extd_local_circuit_id); ND_PRINT("\n\t Neighbor Extended Local circuit-ID: 0x%08x", - EXTRACT_BE_U_4(tlv_ptp_adj->neighbor_extd_local_circuit_id)); + GET_BE_U_4(tlv_ptp_adj->neighbor_extd_local_circuit_id)); } break; @@ -2925,8 +2930,8 @@ isis_print(netdissect_options *ndo, ND_PRINT("%s (0x%02x)", tok2str(nlpid_values, "unknown", - EXTRACT_U_1(tptr)), - EXTRACT_U_1(tptr)); + GET_U_1(tptr)), + GET_U_1(tptr)); if (tlen>1) /* further NPLIDs ? - put comma */ ND_PRINT(", "); tptr++; @@ -2939,8 +2944,8 @@ isis_print(netdissect_options *ndo, ND_TCHECK_2(tptr); ND_PRINT("\n\t RES: %u, MTID(s): %u", - (EXTRACT_BE_U_2(tptr) >> 12), - (EXTRACT_BE_U_2(tptr) & 0x0fff)); + (GET_BE_U_2(tptr) >> 12), + (GET_BE_U_2(tptr) & 0x0fff)); tlen = tlen-2; tptr = tptr+2; @@ -2956,9 +2961,9 @@ isis_print(netdissect_options *ndo, ND_TCHECK_2(tptr); ND_PRINT("\n\t O: %u, RES: %u, MTID(s): %u", - (EXTRACT_BE_U_2(tptr) >> 15) & 0x01, - (EXTRACT_BE_U_2(tptr) >> 12) & 0x07, - EXTRACT_BE_U_2(tptr) & 0x0fff); + (GET_BE_U_2(tptr) >> 15) & 0x01, + (GET_BE_U_2(tptr) >> 12) & 0x07, + GET_BE_U_2(tptr) & 0x0fff); tlen = tlen-2; tptr = tptr+2; @@ -2999,7 +3004,8 @@ isis_print(netdissect_options *ndo, if (tlen < 1) break; ND_TCHECK_1(tptr); - ND_PRINT(", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(EXTRACT_U_1(tptr)) ? "numbered" : "unnumbered"); + ND_PRINT(", Flags: [%s]", + ISIS_MASK_TLV_SHARED_RISK_GROUP(GET_U_1(tptr)) ? "numbered" : "unnumbered"); tptr++; tlen--; @@ -3019,7 +3025,7 @@ isis_print(netdissect_options *ndo, while (tlen>=4) { ND_TCHECK_4(tptr); - ND_PRINT("\n\t Link-ID: 0x%08x", EXTRACT_BE_U_4(tptr)); + ND_PRINT("\n\t Link-ID: 0x%08x", GET_BE_U_4(tptr)); tptr+=4; tlen-=4; } @@ -3032,11 +3038,13 @@ isis_print(netdissect_options *ndo, ND_PRINT("\n\t lsp-id: %s", isis_print_id(ndo, tlv_lsp->lsp_id, LSP_ID_LEN)); ND_TCHECK_4(tlv_lsp->sequence_number); - ND_PRINT(", seq: 0x%08x", EXTRACT_BE_U_4(tlv_lsp->sequence_number)); + ND_PRINT(", seq: 0x%08x", + GET_BE_U_4(tlv_lsp->sequence_number)); ND_TCHECK_2(tlv_lsp->remaining_lifetime); - ND_PRINT(", lifetime: %5ds", EXTRACT_BE_U_2(tlv_lsp->remaining_lifetime)); + ND_PRINT(", lifetime: %5ds", + GET_BE_U_2(tlv_lsp->remaining_lifetime)); ND_TCHECK_2(tlv_lsp->checksum); - ND_PRINT(", chksum: 0x%04x", EXTRACT_BE_U_2(tlv_lsp->checksum)); + ND_PRINT(", chksum: 0x%04x", GET_BE_U_2(tlv_lsp->checksum)); tlen-=sizeof(struct isis_tlv_lsp); tlv_lsp++; } @@ -3046,13 +3054,13 @@ isis_print(netdissect_options *ndo, if (tlen < ISIS_TLV_CHECKSUM_MINLEN) break; ND_TCHECK_LEN(tptr, ISIS_TLV_CHECKSUM_MINLEN); - ND_PRINT("\n\t checksum: 0x%04x ", EXTRACT_BE_U_2(tptr)); + ND_PRINT("\n\t checksum: 0x%04x ", GET_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_U_2(tptr), (int)(tptr-optr), + osi_print_cksum(ndo, optr, GET_BE_U_2(tptr), (int)(tptr-optr), length); break; @@ -3095,7 +3103,7 @@ isis_print(netdissect_options *ndo, break; ND_TCHECK_LEN(tptr, ISIS_TLV_RESTART_SIGNALING_FLAGLEN); ND_PRINT("\n\t Flags [%s]", - bittok2str(isis_restart_flag_values, "none", EXTRACT_U_1(tptr))); + bittok2str(isis_restart_flag_values, "none", GET_U_1(tptr))); tptr+=ISIS_TLV_RESTART_SIGNALING_FLAGLEN; tlen-=ISIS_TLV_RESTART_SIGNALING_FLAGLEN; @@ -3107,7 +3115,7 @@ isis_print(netdissect_options *ndo, break; ND_TCHECK_LEN(tptr, ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN); - ND_PRINT(", Remaining holding time %us", EXTRACT_BE_U_2(tptr)); + ND_PRINT(", Remaining holding time %us", GET_BE_U_2(tptr)); tptr+=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN; tlen-=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN; @@ -3125,13 +3133,13 @@ isis_print(netdissect_options *ndo, ND_PRINT("\n\t Inter-Domain Information Type: %s", tok2str(isis_subtlv_idrp_values, "Unknown (0x%02x)", - EXTRACT_U_1(tptr))); - isis_subtlv_idrp = EXTRACT_U_1(tptr); + GET_U_1(tptr))); + isis_subtlv_idrp = GET_U_1(tptr); tptr++; switch (isis_subtlv_idrp) { case ISIS_SUBTLV_IDRP_ASN: ND_TCHECK_2(tptr); /* fetch AS number */ - ND_PRINT("AS Number: %u", EXTRACT_BE_U_2(tptr)); + ND_PRINT("AS Number: %u", GET_BE_U_2(tptr)); break; case ISIS_SUBTLV_IDRP_LOCAL: case ISIS_SUBTLV_IDRP_RES: @@ -3146,7 +3154,7 @@ isis_print(netdissect_options *ndo, if (tlen < ISIS_TLV_LSP_BUFFERSIZE_MINLEN) break; ND_TCHECK_LEN(tptr, ISIS_TLV_LSP_BUFFERSIZE_MINLEN); - ND_PRINT("\n\t LSP Buffersize: %u", EXTRACT_BE_U_2(tptr)); + ND_PRINT("\n\t LSP Buffersize: %u", GET_BE_U_2(tptr)); break; case ISIS_TLV_PART_DIS: @@ -3169,7 +3177,7 @@ isis_print(netdissect_options *ndo, while(tlen>0) { ND_TCHECK_1(tptr); - prefix_len=EXTRACT_U_1(tptr); /* read out prefix length in semioctets*/ + prefix_len=GET_U_1(tptr); /* read out prefix length in semioctets*/ tptr++; if (prefix_len < 2) { ND_PRINT("\n\t\tAddress: prefix length %u < 2", prefix_len); @@ -3190,14 +3198,14 @@ isis_print(netdissect_options *ndo, if (tlen < ISIS_TLV_IIH_SEQNR_MINLEN) break; ND_TCHECK_LEN(tptr, ISIS_TLV_IIH_SEQNR_MINLEN); /* check if four bytes are on the wire */ - ND_PRINT("\n\t Sequence number: %u", EXTRACT_BE_U_4(tptr)); + ND_PRINT("\n\t Sequence number: %u", GET_BE_U_4(tptr)); break; case ISIS_TLV_VENDOR_PRIVATE: if (tlen < ISIS_TLV_VENDOR_PRIVATE_MINLEN) break; ND_TCHECK_LEN(tptr, ISIS_TLV_VENDOR_PRIVATE_MINLEN); /* check if enough byte for a full oui */ - vendor_id = EXTRACT_BE_U_3(tptr); + vendor_id = GET_BE_U_3(tptr); ND_PRINT("\n\t Vendor: %s (%u)", tok2str(oui_values, "Unknown", vendor_id), vendor_id); diff --git a/print-juniper.c b/print-juniper.c index c4fb9dd8..009897da 100644 --- a/print-juniper.c +++ b/print-juniper.c @@ -492,12 +492,12 @@ juniper_ggsn_if_print(netdissect_options *ndo, gh = (struct juniper_ggsn_header *)&l2info.cookie; ND_TCHECK_SIZE(gh); - proto = EXTRACT_U_1(gh->proto); + proto = GET_U_1(gh->proto); if (ndo->ndo_eflag) { ND_PRINT("proto %s (%u), vlan %u: ", tok2str(juniper_protocol_values,"Unknown",proto), proto, - EXTRACT_BE_U_2(gh->vlan_id)); + GET_BE_U_2(gh->vlan_id)); } switch (proto) { @@ -546,7 +546,7 @@ juniper_es_if_print(netdissect_options *ndo, ih = (const struct juniper_ipsec_header *)p; ND_TCHECK_SIZE(ih); - switch (EXTRACT_U_1(ih->type)) { + switch (GET_U_1(ih->type)) { case JUNIPER_IPSEC_O_ESP_ENCRYPT_ESP_AUTHEN_TYPE: case JUNIPER_IPSEC_O_ESP_ENCRYPT_AH_AUTHEN_TYPE: rewrite_len = 0; @@ -560,7 +560,7 @@ juniper_es_if_print(netdissect_options *ndo, break; default: ND_PRINT("ES Invalid type %u, length %u", - EXTRACT_U_1(ih->type), + GET_U_1(ih->type), l2info.length); return l2info.header_len; } @@ -571,20 +571,20 @@ juniper_es_if_print(netdissect_options *ndo, if (ndo->ndo_eflag) { if (!es_type_bundle) { ND_PRINT("ES SA, index %u, ttl %u type %s (%u), spi %u, Tunnel %s > %s, length %u\n", - EXTRACT_BE_U_2(ih->sa_index), - EXTRACT_U_1(ih->ttl), - tok2str(juniper_ipsec_type_values,"Unknown",EXTRACT_U_1(ih->type)), - EXTRACT_U_1(ih->type), - EXTRACT_BE_U_4(ih->spi), + GET_BE_U_2(ih->sa_index), + GET_U_1(ih->ttl), + tok2str(juniper_ipsec_type_values,"Unknown",GET_U_1(ih->type)), + GET_U_1(ih->type), + GET_BE_U_4(ih->spi), ipaddr_string(ndo, ih->src_ip), ipaddr_string(ndo, ih->dst_ip), l2info.length); } else { ND_PRINT("ES SA, index %u, ttl %u type %s (%u), length %u\n", - EXTRACT_BE_U_2(ih->sa_index), - EXTRACT_U_1(ih->ttl), - tok2str(juniper_ipsec_type_values,"Unknown",EXTRACT_U_1(ih->type)), - EXTRACT_U_1(ih->type), + GET_BE_U_2(ih->sa_index), + GET_U_1(ih->ttl), + tok2str(juniper_ipsec_type_values,"Unknown",GET_U_1(ih->type)), + GET_U_1(ih->type), l2info.length); } } @@ -623,9 +623,9 @@ juniper_monitor_if_print(netdissect_options *ndo, ND_TCHECK_SIZE(mh); if (ndo->ndo_eflag) ND_PRINT("service-id %u, iif %u, pkt-type %u: ", - EXTRACT_BE_U_4(mh->service_id), - EXTRACT_BE_U_2(mh->iif), - EXTRACT_U_1(mh->pkt_type)); + GET_BE_U_4(mh->service_id), + GET_BE_U_2(mh->iif), + GET_U_1(mh->pkt_type)); /* no proto field - lets guess by first byte of IP header*/ ip_heuristic_guess (ndo, p, l2info.length); @@ -664,10 +664,10 @@ juniper_services_if_print(netdissect_options *ndo, ND_TCHECK_SIZE(sh); if (ndo->ndo_eflag) ND_PRINT("service-id %u flags 0x%02x service-set-id 0x%04x iif %u: ", - EXTRACT_U_1(sh->svc_id), - EXTRACT_U_1(sh->flags_len), - EXTRACT_BE_U_2(sh->svc_set_id), - EXTRACT_BE_U_3(sh->dir_iif)); + GET_U_1(sh->svc_id), + GET_U_1(sh->flags_len), + GET_BE_U_2(sh->svc_set_id), + GET_BE_U_3(sh->dir_iif)); /* no proto field - lets guess by first byte of IP header*/ ip_heuristic_guess (ndo, p, l2info.length); @@ -791,7 +791,7 @@ juniper_pppoe_atm_if_print(netdissect_options *ndo, p+=l2info.header_len; ND_TCHECK_2(p); - extracted_ethertype = EXTRACT_BE_U_2(p); + extracted_ethertype = GET_BE_U_2(p); /* this DLT contains nothing but raw PPPoE frames, * prepended with a type field*/ if (ethertype_print(ndo, extracted_ethertype, @@ -825,7 +825,9 @@ 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 && + /* use EXTRACT_, not GET_ (not packet buffer pointer) */ EXTRACT_BE_U_2(&l2info.cookie) != PPP_OSI && + /* use EXTRACT_, not GET_ (not packet buffer pointer) */ EXTRACT_BE_U_2(&l2info.cookie) != (PPP_ADDRESS << 8 | PPP_CONTROL)) ND_PRINT("Bundle-ID %u: ", l2info.bundle); @@ -856,6 +858,7 @@ juniper_mlppp_if_print(netdissect_options *ndo, } /* zero length cookie ? */ + /* use EXTRACT_, not GET_ (not packet buffer pointer) */ switch (EXTRACT_BE_U_2(&l2info.cookie)) { case PPP_OSI: ppp_print(ndo, p - 2, l2info.length + 2); @@ -914,6 +917,7 @@ juniper_mfr_if_print(netdissect_options *ndo, } /* suppress Bundle-ID if frame was captured on a child-link */ + /* use EXTRACT_, not GET_ (not packet buffer pointer) */ if (ndo->ndo_eflag && EXTRACT_BE_U_4(l2info.cookie) != 1) ND_PRINT("Bundle-ID %u, ", l2info.bundle); switch (l2info.proto) { @@ -949,6 +953,7 @@ juniper_mlfr_if_print(netdissect_options *ndo, p+=l2info.header_len; /* suppress Bundle-ID if frame was captured on a child-link */ + /* use EXTRACT_, not GET_ (not packet buffer pointer) */ if (ndo->ndo_eflag && EXTRACT_BE_U_4(l2info.cookie) != 1) ND_PRINT("Bundle-ID %u, ", l2info.bundle); switch (l2info.proto) { @@ -1000,15 +1005,15 @@ juniper_atm1_if_print(netdissect_options *ndo, } ND_TCHECK_3(p); - if (EXTRACT_BE_U_3(p) == 0xfefe03 || /* NLPID encaps ? */ - EXTRACT_BE_U_3(p) == 0xaaaa03) { /* SNAP encaps ? */ + if (GET_BE_U_3(p) == 0xfefe03 || /* NLPID encaps ? */ + GET_BE_U_3(p) == 0xaaaa03) { /* SNAP encaps ? */ llc_hdrlen = llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL); if (llc_hdrlen > 0) return l2info.header_len; } - if (EXTRACT_U_1(p) == 0x03) { /* Cisco style NLPID encaps ? */ + if (GET_U_1(p) == 0x03) { /* Cisco style NLPID encaps ? */ isoclns_print(ndo, p + 1, l2info.length - 1); /* FIXME check if frame was recognized */ return l2info.header_len; @@ -1055,8 +1060,8 @@ juniper_atm2_if_print(netdissect_options *ndo, } ND_TCHECK_3(p); - if (EXTRACT_BE_U_3(p) == 0xfefe03 || /* NLPID encaps ? */ - EXTRACT_BE_U_3(p) == 0xaaaa03) { /* SNAP encaps ? */ + if (GET_BE_U_3(p) == 0xfefe03 || /* NLPID encaps ? */ + GET_BE_U_3(p) == 0xaaaa03) { /* SNAP encaps ? */ llc_hdrlen = llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL); if (llc_hdrlen > 0) @@ -1064,12 +1069,13 @@ juniper_atm2_if_print(netdissect_options *ndo, } if (l2info.direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */ + /* use EXTRACT_, not GET_ (not packet buffer pointer) */ (EXTRACT_BE_U_4(l2info.cookie) & ATM2_GAP_COUNT_MASK)) { ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL); return l2info.header_len; } - if (EXTRACT_U_1(p) == 0x03) { /* Cisco style NLPID encaps ? */ + if (GET_U_1(p) == 0x03) { /* Cisco style NLPID encaps ? */ isoclns_print(ndo, p + 1, l2info.length - 1); /* FIXME check if frame was recognized */ return l2info.header_len; @@ -1094,7 +1100,7 @@ static int juniper_ppp_heuristic_guess(netdissect_options *ndo, const u_char *p, u_int length) { - switch(EXTRACT_BE_U_2(p)) { + switch(GET_BE_U_2(p)) { case PPP_IP : case PPP_OSI : case PPP_MPLS_UCAST : @@ -1123,7 +1129,7 @@ static int ip_heuristic_guess(netdissect_options *ndo, const u_char *p, u_int length) { - switch(EXTRACT_U_1(p)) { + switch(GET_U_1(p)) { case 0x45: case 0x46: case 0x47: @@ -1172,16 +1178,16 @@ juniper_read_tlv_value(netdissect_options *ndo, if (tlv_type < 128) { switch (tlv_len) { case 1: - tlv_value = EXTRACT_U_1(p); + tlv_value = GET_U_1(p); break; case 2: - tlv_value = EXTRACT_LE_U_2(p); + tlv_value = GET_LE_U_2(p); break; case 3: - tlv_value = EXTRACT_LE_U_3(p); + tlv_value = GET_LE_U_3(p); break; case 4: - tlv_value = EXTRACT_LE_U_4(p); + tlv_value = GET_LE_U_4(p); break; default: tlv_value = -1; @@ -1191,16 +1197,16 @@ juniper_read_tlv_value(netdissect_options *ndo, /* TLVs >= 128 are big endian encoded */ switch (tlv_len) { case 1: - tlv_value = EXTRACT_U_1(p); + tlv_value = GET_U_1(p); break; case 2: - tlv_value = EXTRACT_BE_U_2(p); + tlv_value = GET_BE_U_2(p); break; case 3: - tlv_value = EXTRACT_BE_U_3(p); + tlv_value = GET_BE_U_3(p); break; case 4: - tlv_value = EXTRACT_BE_U_4(p); + tlv_value = GET_BE_U_4(p); break; default: tlv_value = -1; @@ -1232,10 +1238,10 @@ juniper_parse_header(netdissect_options *ndo, l2info->length = h->len; l2info->caplen = h->caplen; ND_TCHECK_4(p); - l2info->flags = EXTRACT_U_1(p + 3); - l2info->direction = EXTRACT_U_1(p + 3) & JUNIPER_BPF_PKT_IN; + l2info->flags = GET_U_1(p + 3); + l2info->direction = GET_U_1(p + 3) & JUNIPER_BPF_PKT_IN; - if (EXTRACT_BE_U_3(p) != JUNIPER_MGC_NUMBER) { /* magic number found ? */ + if (GET_BE_U_3(p) != JUNIPER_MGC_NUMBER) { /* magic number found ? */ ND_PRINT("no magic-number found!"); return 0; } @@ -1257,7 +1263,7 @@ juniper_parse_header(netdissect_options *ndo, /* ok to read extension length ? */ ND_TCHECK_2(tptr); - jnx_ext_len = EXTRACT_BE_U_2(tptr); + jnx_ext_len = GET_BE_U_2(tptr); jnx_header_len += 2; tptr +=2; @@ -1271,9 +1277,9 @@ juniper_parse_header(netdissect_options *ndo, ND_TCHECK_LEN(tptr, jnx_ext_len); while (jnx_ext_len > JUNIPER_EXT_TLV_OVERHEAD) { - tlv_type = EXTRACT_U_1(tptr); + tlv_type = GET_U_1(tptr); tptr++; - tlv_len = EXTRACT_U_1(tptr); + tlv_len = GET_U_1(tptr); tptr++; tlv_value = 0; @@ -1360,7 +1366,7 @@ juniper_parse_header(netdissect_options *ndo, l2info->cookie_len += lp->cookie_len; - switch (EXTRACT_U_1(p)) { + switch (GET_U_1(p)) { case LS_COOKIE_ID: l2info->cookie_type = LS_COOKIE_ID; l2info->cookie_len += 2; @@ -1379,7 +1385,7 @@ juniper_parse_header(netdissect_options *ndo, #ifdef DLT_JUNIPER_MFR /* MFR child links don't carry cookies */ if (l2info->pictype == DLT_JUNIPER_MFR && - (EXTRACT_U_1(p) & MFR_BE_MASK) == MFR_BE_MASK) { + (GET_U_1(p) & MFR_BE_MASK) == MFR_BE_MASK) { l2info->cookie_len = 0; } #endif @@ -1398,8 +1404,8 @@ juniper_parse_header(netdissect_options *ndo, if (ndo->ndo_eflag) ND_PRINT(", cookie 0x"); for (idx = 0; idx < l2info->cookie_len; idx++) { - l2info->cookie[idx] = EXTRACT_U_1(p + idx); /* copy cookie data */ - if (ndo->ndo_eflag) ND_PRINT("%02x", EXTRACT_U_1(p + idx)); + l2info->cookie[idx] = GET_U_1(p + idx); /* copy cookie data */ + if (ndo->ndo_eflag) ND_PRINT("%02x", GET_U_1(p + idx)); } } @@ -1407,7 +1413,7 @@ juniper_parse_header(netdissect_options *ndo, ND_TCHECK_2(p + l2info->cookie_len); - l2info->proto = EXTRACT_BE_U_2(p + l2info->cookie_len); + l2info->proto = GET_BE_U_2(p + l2info->cookie_len); break; } ++lp; @@ -1423,6 +1429,7 @@ juniper_parse_header(netdissect_options *ndo, l2info->bundle = l2info->cookie[1]; break; case AS_COOKIE_ID: + /* use EXTRACT_, not GET_ (not packet buffer pointer) */ l2info->bundle = (EXTRACT_BE_U_2(&l2info->cookie[6])>>3)&0xfff; l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK; break; @@ -1438,12 +1445,13 @@ juniper_parse_header(netdissect_options *ndo, case LS_COOKIE_ID: ND_TCHECK_2(p); l2info->bundle = l2info->cookie[1]; - l2info->proto = EXTRACT_BE_U_2(p); + l2info->proto = GET_BE_U_2(p); l2info->header_len += 2; l2info->length -= 2; l2info->caplen -= 2; break; case AS_COOKIE_ID: + /* use EXTRACT_, not GET_ (not packet buffer pointer) */ l2info->bundle = (EXTRACT_BE_U_2(&l2info->cookie[6])>>3)&0xfff; l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK; break; @@ -1462,12 +1470,13 @@ juniper_parse_header(netdissect_options *ndo, case LS_COOKIE_ID: ND_TCHECK_2(p); l2info->bundle = l2info->cookie[1]; - l2info->proto = EXTRACT_BE_U_2(p); + l2info->proto = GET_BE_U_2(p); l2info->header_len += 2; l2info->length -= 2; l2info->caplen -= 2; break; case AS_COOKIE_ID: + /* use EXTRACT_, not GET_ (not packet buffer pointer) */ l2info->bundle = (EXTRACT_BE_U_2(&l2info->cookie[6])>>3)&0xfff; l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK; break; @@ -1482,7 +1491,7 @@ juniper_parse_header(netdissect_options *ndo, ND_TCHECK_4(p); /* ATM cell relay control word present ? */ if (l2info->cookie[7] & ATM2_PKT_TYPE_MASK) { - control_word = EXTRACT_BE_U_4(p); + control_word = GET_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 656c154e..5d525320 100644 --- a/print-krb.c +++ b/print-krb.c @@ -118,7 +118,7 @@ c_print(netdissect_options *ndo, flag = 1; while (s < ep) { - c = EXTRACT_U_1(s); + c = GET_U_1(s); s++; if (c == '\0') { flag = 0; @@ -163,14 +163,14 @@ 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) ((EXTRACT_U_1((kp)->type) & 0x01) != 0) -#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? EXTRACT_LE_U_2(cp) : EXTRACT_BE_U_2(cp)) +#define IS_LENDIAN(kp) ((GET_U_1((kp)->type) & 0x01) != 0) +#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? GET_LE_U_2(cp) : GET_BE_U_2(cp)) kp = (const struct krb *)cp; ND_TCHECK_1(kp->type); - type = EXTRACT_U_1(kp->type) & (0xFF << 1); + type = GET_U_1(kp->type) & (0xFF << 1); ND_PRINT(" %s %s: ", IS_LENDIAN(kp) ? "le" : "be", tok2str(type2str, NULL, type)); @@ -182,7 +182,7 @@ krb4_print(netdissect_options *ndo, return; cp += 4; /* ctime */ ND_TCHECK_1(cp); - ND_PRINT(" %umin ", EXTRACT_U_1(cp) * 5); + ND_PRINT(" %umin ", GET_U_1(cp) * 5); cp++; PRINT; ND_PRINT("."); @@ -192,14 +192,14 @@ krb4_print(netdissect_options *ndo, case AUTH_MSG_APPL_REQUEST: cp += 2; ND_TCHECK_1(cp); - ND_PRINT("v%u ", EXTRACT_U_1(cp)); + ND_PRINT("v%u ", GET_U_1(cp)); cp++; PRINT; ND_TCHECK_1(cp); - ND_PRINT(" (%u)", EXTRACT_U_1(cp)); + ND_PRINT(" (%u)", GET_U_1(cp)); cp++; ND_TCHECK_1(cp); - ND_PRINT(" (%u)", EXTRACT_U_1(cp)); + ND_PRINT(" (%u)", GET_U_1(cp)); break; case AUTH_MSG_KDC_REPLY: @@ -245,16 +245,16 @@ krb_print(netdissect_options *ndo, return; } - switch (EXTRACT_U_1(kp->pvno)) { + switch (GET_U_1(kp->pvno)) { case 1: case 2: case 3: - ND_PRINT(" v%u", EXTRACT_U_1(kp->pvno)); + ND_PRINT(" v%u", GET_U_1(kp->pvno)); break; case 4: - ND_PRINT(" v%u", EXTRACT_U_1(kp->pvno)); + ND_PRINT(" v%u", GET_U_1(kp->pvno)); krb4_print(ndo, (const u_char *)kp); break; diff --git a/print-l2tp.c b/print-l2tp.c index 6e7804ab..0d464544 100644 --- a/print-l2tp.c +++ b/print-l2tp.c @@ -269,7 +269,7 @@ print_string(netdissect_options *ndo, const u_char *dat, u_int length) { u_int i; for (i=0; i<length; i++) { - fn_print_char(ndo, EXTRACT_U_1(dat)); + fn_print_char(ndo, GET_U_1(dat)); dat++; } } @@ -279,7 +279,7 @@ print_octets(netdissect_options *ndo, const u_char *dat, u_int length) { u_int i; for (i=0; i<length; i++) { - ND_PRINT("%02x", EXTRACT_U_1(dat)); + ND_PRINT("%02x", GET_U_1(dat)); dat++; } } @@ -287,13 +287,13 @@ print_octets(netdissect_options *ndo, const u_char *dat, u_int length) static void print_16bits_val(netdissect_options *ndo, const uint8_t *dat) { - ND_PRINT("%u", EXTRACT_BE_U_2(dat)); + ND_PRINT("%u", GET_BE_U_2(dat)); } static void print_32bits_val(netdissect_options *ndo, const uint8_t *dat) { - ND_PRINT("%u", EXTRACT_BE_U_4(dat)); + ND_PRINT("%u", GET_BE_U_4(dat)); } /***********************************/ @@ -307,7 +307,7 @@ l2tp_msgtype_print(netdissect_options *ndo, const u_char *dat, u_int length) return; } ND_PRINT("%s", tok2str(l2tp_msgtype2str, "MSGTYPE-#%u", - EXTRACT_BE_U_2(dat))); + GET_BE_U_2(dat))); } static void @@ -318,7 +318,7 @@ l2tp_result_code_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT("AVP too short"); return; } - ND_PRINT("%u", EXTRACT_BE_U_2(dat)); + ND_PRINT("%u", GET_BE_U_2(dat)); dat += 2; length -= 2; @@ -329,7 +329,7 @@ l2tp_result_code_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT(" AVP too short"); return; } - ND_PRINT("/%u", EXTRACT_BE_U_2(dat)); + ND_PRINT("/%u", GET_BE_U_2(dat)); dat += 2; length -= 2; @@ -347,8 +347,8 @@ l2tp_proto_ver_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT("AVP too short"); return; } - ND_PRINT("%u.%u", (EXTRACT_BE_U_2(dat) >> 8), - (EXTRACT_BE_U_2(dat) & 0xff)); + ND_PRINT("%u.%u", (GET_BE_U_2(dat) >> 8), + (GET_BE_U_2(dat) & 0xff)); } static void @@ -358,10 +358,10 @@ l2tp_framing_cap_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT("AVP too short"); return; } - if (EXTRACT_BE_U_4(dat) & L2TP_FRAMING_CAP_ASYNC_MASK) { + if (GET_BE_U_4(dat) & L2TP_FRAMING_CAP_ASYNC_MASK) { ND_PRINT("A"); } - if (EXTRACT_BE_U_4(dat) & L2TP_FRAMING_CAP_SYNC_MASK) { + if (GET_BE_U_4(dat) & L2TP_FRAMING_CAP_SYNC_MASK) { ND_PRINT("S"); } } @@ -373,10 +373,10 @@ l2tp_bearer_cap_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT("AVP too short"); return; } - if (EXTRACT_BE_U_4(dat) & L2TP_BEARER_CAP_ANALOG_MASK) { + if (GET_BE_U_4(dat) & L2TP_BEARER_CAP_ANALOG_MASK) { ND_PRINT("A"); } - if (EXTRACT_BE_U_4(dat) & L2TP_BEARER_CAP_DIGITAL_MASK) { + if (GET_BE_U_4(dat) & L2TP_BEARER_CAP_DIGITAL_MASK) { ND_PRINT("D"); } } @@ -389,7 +389,7 @@ l2tp_q931_cc_print(netdissect_options *ndo, const u_char *dat, u_int length) return; } print_16bits_val(ndo, dat); - ND_PRINT(", %02x", EXTRACT_U_1(dat + 2)); + ND_PRINT(", %02x", GET_U_1(dat + 2)); dat += 3; length -= 3; if (length != 0) { @@ -405,10 +405,10 @@ l2tp_bearer_type_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT("AVP too short"); return; } - if (EXTRACT_BE_U_4(dat) & L2TP_BEARER_TYPE_ANALOG_MASK) { + if (GET_BE_U_4(dat) & L2TP_BEARER_TYPE_ANALOG_MASK) { ND_PRINT("A"); } - if (EXTRACT_BE_U_4(dat) & L2TP_BEARER_TYPE_DIGITAL_MASK) { + if (GET_BE_U_4(dat) & L2TP_BEARER_TYPE_DIGITAL_MASK) { ND_PRINT("D"); } } @@ -420,10 +420,10 @@ l2tp_framing_type_print(netdissect_options *ndo, const u_char *dat, u_int length ND_PRINT("AVP too short"); return; } - if (EXTRACT_BE_U_4(dat) & L2TP_FRAMING_TYPE_ASYNC_MASK) { + if (GET_BE_U_4(dat) & L2TP_FRAMING_TYPE_ASYNC_MASK) { ND_PRINT("A"); } - if (EXTRACT_BE_U_4(dat) & L2TP_FRAMING_TYPE_SYNC_MASK) { + if (GET_BE_U_4(dat) & L2TP_FRAMING_TYPE_SYNC_MASK) { ND_PRINT("S"); } } @@ -442,7 +442,7 @@ l2tp_proxy_auth_type_print(netdissect_options *ndo, const u_char *dat, u_int len return; } ND_PRINT("%s", tok2str(l2tp_authentype2str, - "AuthType-#%u", EXTRACT_BE_U_2(dat))); + "AuthType-#%u", GET_BE_U_2(dat))); } static void @@ -452,7 +452,7 @@ l2tp_proxy_auth_id_print(netdissect_options *ndo, const u_char *dat, u_int lengt ND_PRINT("AVP too short"); return; } - ND_PRINT("%u", EXTRACT_BE_U_2(dat) & L2TP_PROXY_AUTH_ID_MASK); + ND_PRINT("%u", GET_BE_U_2(dat) & L2TP_PROXY_AUTH_ID_MASK); } static void @@ -471,42 +471,42 @@ l2tp_call_errors_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT("AVP too short"); return; } - val = EXTRACT_BE_U_4(dat); dat += 4; length -= 4; + val = GET_BE_U_4(dat); dat += 4; length -= 4; ND_PRINT("CRCErr=%u ", val); if (length < 4) { ND_PRINT("AVP too short"); return; } - val = EXTRACT_BE_U_4(dat); dat += 4; length -= 4; + val = GET_BE_U_4(dat); dat += 4; length -= 4; ND_PRINT("FrameErr=%u ", val); if (length < 4) { ND_PRINT("AVP too short"); return; } - val = EXTRACT_BE_U_4(dat); dat += 4; length -= 4; + val = GET_BE_U_4(dat); dat += 4; length -= 4; ND_PRINT("HardOver=%u ", val); if (length < 4) { ND_PRINT("AVP too short"); return; } - val = EXTRACT_BE_U_4(dat); dat += 4; length -= 4; + val = GET_BE_U_4(dat); dat += 4; length -= 4; ND_PRINT("BufOver=%u ", val); if (length < 4) { ND_PRINT("AVP too short"); return; } - val = EXTRACT_BE_U_4(dat); dat += 4; length -= 4; + val = GET_BE_U_4(dat); dat += 4; length -= 4; ND_PRINT("Timeout=%u ", val); if (length < 4) { ND_PRINT("AVP too short"); return; } - val = EXTRACT_BE_U_4(dat); dat += 4; length -= 4; + val = GET_BE_U_4(dat); dat += 4; length -= 4; ND_PRINT("AlignErr=%u ", val); } @@ -526,14 +526,14 @@ l2tp_accm_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT("AVP too short"); return; } - val = EXTRACT_BE_U_4(dat); dat += 4; length -= 4; + val = GET_BE_U_4(dat); dat += 4; length -= 4; ND_PRINT("send=%08x ", val); if (length < 4) { ND_PRINT("AVP too short"); return; } - val = EXTRACT_BE_U_4(dat); dat += 4; length -= 4; + val = GET_BE_U_4(dat); dat += 4; length -= 4; ND_PRINT("recv=%08x ", val); } @@ -545,16 +545,16 @@ l2tp_ppp_discon_cc_print(netdissect_options *ndo, const u_char *dat, u_int lengt return; } /* Disconnect Code */ - ND_PRINT("%04x, ", EXTRACT_BE_U_2(dat)); + ND_PRINT("%04x, ", GET_BE_U_2(dat)); dat += 2; length -= 2; /* Control Protocol Number */ - ND_PRINT("%04x ", EXTRACT_BE_U_2(dat)); + ND_PRINT("%04x ", GET_BE_U_2(dat)); dat += 2; length -= 2; /* Direction */ ND_PRINT("%s", tok2str(l2tp_cc_direction2str, - "Direction-#%u", EXTRACT_U_1(dat))); + "Direction-#%u", GET_U_1(dat))); dat++; length--; @@ -574,7 +574,7 @@ l2tp_avp_print(netdissect_options *ndo, const u_char *dat, u_int length) ND_PRINT(" "); ND_TCHECK_2(dat); /* Flags & Length */ - len = EXTRACT_BE_U_2(dat) & L2TP_AVP_HDR_LEN_MASK; + len = GET_BE_U_2(dat) & L2TP_AVP_HDR_LEN_MASK; /* If it is not long enough to contain the header, we'll give up. */ if (len < 6) @@ -595,26 +595,26 @@ l2tp_avp_print(netdissect_options *ndo, const u_char *dat, u_int length) * check whether we go past the end of the AVP. */ - if (EXTRACT_BE_U_2(dat) & L2TP_AVP_HDR_FLAG_MANDATORY) { + if (GET_BE_U_2(dat) & L2TP_AVP_HDR_FLAG_MANDATORY) { ND_PRINT("*"); } - if (EXTRACT_BE_U_2(dat) & L2TP_AVP_HDR_FLAG_HIDDEN) { + if (GET_BE_U_2(dat) & L2TP_AVP_HDR_FLAG_HIDDEN) { hidden = TRUE; ND_PRINT("?"); } dat += 2; - if (EXTRACT_BE_U_2(dat)) { + if (GET_BE_U_2(dat)) { /* Vendor Specific Attribute */ - ND_PRINT("VENDOR%04x:", EXTRACT_BE_U_2(dat)); dat += 2; - ND_PRINT("ATTR%04x", EXTRACT_BE_U_2(dat)); dat += 2; + ND_PRINT("VENDOR%04x:", GET_BE_U_2(dat)); dat += 2; + ND_PRINT("ATTR%04x", GET_BE_U_2(dat)); dat += 2; ND_PRINT("("); print_octets(ndo, dat, len-6); ND_PRINT(")"); } else { /* IETF-defined Attributes */ dat += 2; - attr_type = EXTRACT_BE_U_2(dat); dat += 2; + attr_type = GET_BE_U_2(dat); dat += 2; ND_PRINT("%s", tok2str(l2tp_avp2str, "AVP-#%u", attr_type)); ND_PRINT("("); if (hidden) { @@ -747,9 +747,9 @@ l2tp_print(netdissect_options *ndo, const u_char *dat, u_int length) flag_t = flag_l = flag_s = flag_o = FALSE; ND_TCHECK_2(ptr); /* Flags & Version */ - if ((EXTRACT_BE_U_2(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) { + if ((GET_BE_U_2(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) { ND_PRINT(" l2tp:"); - } else if ((EXTRACT_BE_U_2(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2F) { + } else if ((GET_BE_U_2(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2F) { ND_PRINT(" l2f:"); return; /* nothing to do */ } else { @@ -758,23 +758,23 @@ l2tp_print(netdissect_options *ndo, const u_char *dat, u_int length) } ND_PRINT("["); - if (EXTRACT_BE_U_2(ptr) & L2TP_FLAG_TYPE) { + if (GET_BE_U_2(ptr) & L2TP_FLAG_TYPE) { flag_t = TRUE; ND_PRINT("T"); } - if (EXTRACT_BE_U_2(ptr) & L2TP_FLAG_LENGTH) { + if (GET_BE_U_2(ptr) & L2TP_FLAG_LENGTH) { flag_l = TRUE; ND_PRINT("L"); } - if (EXTRACT_BE_U_2(ptr) & L2TP_FLAG_SEQUENCE) { + if (GET_BE_U_2(ptr) & L2TP_FLAG_SEQUENCE) { flag_s = TRUE; ND_PRINT("S"); } - if (EXTRACT_BE_U_2(ptr) & L2TP_FLAG_OFFSET) { + if (GET_BE_U_2(ptr) & L2TP_FLAG_OFFSET) { flag_o = TRUE; ND_PRINT("O"); } - if (EXTRACT_BE_U_2(ptr) & L2TP_FLAG_PRIORITY) + if (GET_BE_U_2(ptr) & L2TP_FLAG_PRIORITY) ND_PRINT("P"); ND_PRINT("]"); @@ -783,7 +783,7 @@ l2tp_print(netdissect_options *ndo, const u_char *dat, u_int length) if (flag_l) { ND_TCHECK_2(ptr); /* Length */ - l2tp_len = EXTRACT_BE_U_2(ptr); + l2tp_len = GET_BE_U_2(ptr); ptr += 2; cnt += 2; } else { @@ -791,28 +791,28 @@ l2tp_print(netdissect_options *ndo, const u_char *dat, u_int length) } ND_TCHECK_2(ptr); /* Tunnel ID */ - ND_PRINT("(%u/", EXTRACT_BE_U_2(ptr)); + ND_PRINT("(%u/", GET_BE_U_2(ptr)); ptr += 2; cnt += 2; ND_TCHECK_2(ptr); /* Session ID */ - ND_PRINT("%u)", EXTRACT_BE_U_2(ptr)); + ND_PRINT("%u)", GET_BE_U_2(ptr)); ptr += 2; cnt += 2; if (flag_s) { ND_TCHECK_2(ptr); /* Ns */ - ND_PRINT("Ns=%u,", EXTRACT_BE_U_2(ptr)); + ND_PRINT("Ns=%u,", GET_BE_U_2(ptr)); ptr += 2; cnt += 2; ND_TCHECK_2(ptr); /* Nr */ - ND_PRINT("Nr=%u", EXTRACT_BE_U_2(ptr)); + ND_PRINT("Nr=%u", GET_BE_U_2(ptr)); ptr += 2; cnt += 2; } if (flag_o) { ND_TCHECK_2(ptr); /* Offset Size */ - pad = EXTRACT_BE_U_2(ptr); + pad = GET_BE_U_2(ptr); ptr += (2 + pad); cnt += (2 + pad); } diff --git a/print-lane.c b/print-lane.c index e4f8a08b..a6f83b1a 100644 --- a/print-lane.c +++ b/print-lane.c @@ -68,7 +68,7 @@ static const struct tok lecop2str[] = { static void lane_hdr_print(netdissect_options *ndo, const u_char *bp) { - ND_PRINT("lecid:%x ", EXTRACT_BE_U_2(bp)); + ND_PRINT("lecid:%x ", GET_BE_U_2(bp)); } /* @@ -91,14 +91,14 @@ lane_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) } lec = (const struct lane_controlhdr *)p; - if (EXTRACT_BE_U_2(lec->lec_header) == 0xff00) { + if (GET_BE_U_2(lec->lec_header) == 0xff00) { /* * LE Control. */ ND_PRINT("lec: proto %x vers %x %s", - EXTRACT_U_1(lec->lec_proto), - EXTRACT_U_1(lec->lec_vers), - tok2str(lecop2str, "opcode-#%u", EXTRACT_BE_U_2(lec->lec_opcode))); + GET_U_1(lec->lec_proto), + GET_U_1(lec->lec_vers), + tok2str(lecop2str, "opcode-#%u", GET_BE_U_2(lec->lec_opcode))); return; } diff --git a/print-ldp.c b/print-ldp.c index 351c1f81..87805d24 100644 --- a/print-ldp.c +++ b/print-ldp.c @@ -252,13 +252,13 @@ ldp_tlv_print(netdissect_options *ndo, ldp_tlv_header = (const struct ldp_tlv_header *)tptr; ND_TCHECK_SIZE(ldp_tlv_header); - tlv_len=EXTRACT_BE_U_2(ldp_tlv_header->length); + tlv_len=GET_BE_U_2(ldp_tlv_header->length); if (tlv_len + 4 > msg_tlen) { ND_PRINT("\n\t\t TLV contents go past end of message"); return 0; } tlv_tlen=tlv_len; - tlv_type=LDP_MASK_TLV_TYPE(EXTRACT_BE_U_2(ldp_tlv_header->type)); + tlv_type=LDP_MASK_TLV_TYPE(GET_BE_U_2(ldp_tlv_header->type)); /* FIXME vendor private / experimental check */ ND_PRINT("\n\t %s TLV (0x%04x), length: %u, Flags: [%s and %s forward if unknown]", @@ -267,8 +267,8 @@ ldp_tlv_print(netdissect_options *ndo, tlv_type), tlv_type, tlv_len, - 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"); + LDP_MASK_U_BIT(GET_BE_U_2(ldp_tlv_header->type)) ? "continue processing" : "ignore", + LDP_MASK_F_BIT(GET_BE_U_2(ldp_tlv_header->type)) ? "do" : "don't"); tptr+=sizeof(struct ldp_tlv_header); @@ -277,9 +277,9 @@ ldp_tlv_print(netdissect_options *ndo, case LDP_TLV_COMMON_HELLO: TLV_TCHECK(4); ND_PRINT("\n\t Hold Time: %us, Flags: [%s Hello%s]", - 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" : ""); + GET_BE_U_2(tptr), + (GET_BE_U_2(tptr + 2)&0x8000) ? "Targeted" : "Link", + (GET_BE_U_2(tptr + 2)&0x4000) ? ", Request for targeted Hellos" : ""); break; case LDP_TLV_IPV4_TRANSPORT_ADDR: @@ -292,12 +292,12 @@ ldp_tlv_print(netdissect_options *ndo, break; case LDP_TLV_CONFIG_SEQ_NUMBER: TLV_TCHECK(4); - ND_PRINT("\n\t Sequence Number: %u", EXTRACT_BE_U_4(tptr)); + ND_PRINT("\n\t Sequence Number: %u", GET_BE_U_4(tptr)); break; case LDP_TLV_ADDRESS_LIST: TLV_TCHECK(LDP_TLV_ADDRESS_LIST_AFNUM_LEN); - af = EXTRACT_BE_U_2(tptr); + af = GET_BE_U_2(tptr); tptr+=LDP_TLV_ADDRESS_LIST_AFNUM_LEN; tlv_tlen -= LDP_TLV_ADDRESS_LIST_AFNUM_LEN; ND_PRINT("\n\t Address Family: %s, addresses", @@ -328,15 +328,15 @@ ldp_tlv_print(netdissect_options *ndo, case LDP_TLV_COMMON_SESSION: TLV_TCHECK(8); ND_PRINT("\n\t Version: %u, Keepalive: %us, Flags: [Downstream %s, Loop Detection %s]", - 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" + GET_BE_U_2(tptr), GET_BE_U_2(tptr + 2), + (GET_BE_U_2(tptr + 6)&0x8000) ? "On Demand" : "Unsolicited", + (GET_BE_U_2(tptr + 6)&0x4000) ? "Enabled" : "Disabled" ); break; case LDP_TLV_FEC: TLV_TCHECK(1); - fec_type = EXTRACT_U_1(tptr); + fec_type = GET_U_1(tptr); ND_PRINT("\n\t %s FEC (0x%02x)", tok2str(ldp_fec_values, "Unknown", fec_type), fec_type); @@ -349,7 +349,7 @@ ldp_tlv_print(netdissect_options *ndo, break; case LDP_FEC_PREFIX: TLV_TCHECK(2); - af = EXTRACT_BE_U_2(tptr); + af = GET_BE_U_2(tptr); tptr+=LDP_TLV_ADDRESS_LIST_AFNUM_LEN; tlv_tlen-=LDP_TLV_ADDRESS_LIST_AFNUM_LEN; if (af == AFNUM_INET) { @@ -385,7 +385,7 @@ ldp_tlv_print(netdissect_options *ndo, * Pseudowire Types. */ TLV_TCHECK(7); - vc_info_len = EXTRACT_U_1(tptr + 2); + vc_info_len = GET_U_1(tptr + 2); /* * According to RFC 4908, the VC info Length field can be zero, @@ -394,9 +394,9 @@ ldp_tlv_print(netdissect_options *ndo, */ if (vc_info_len == 0) { ND_PRINT(": %s, %scontrol word, group-ID %u, VC-info-length: %u", - 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), + tok2str(mpls_pw_types_values, "Unknown", GET_BE_U_2(tptr)&0x7fff), + GET_BE_U_2(tptr)&0x8000 ? "" : "no ", + GET_BE_U_4(tptr + 3), vc_info_len); break; } @@ -404,10 +404,10 @@ ldp_tlv_print(netdissect_options *ndo, /* Make sure we have the VC ID as well */ TLV_TCHECK(11); ND_PRINT(": %s, %scontrol word, group-ID %u, VC-ID %u, VC-info-length: %u", - 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), + tok2str(mpls_pw_types_values, "Unknown", GET_BE_U_2(tptr)&0x7fff), + GET_BE_U_2(tptr)&0x8000 ? "" : "no ", + GET_BE_U_4(tptr + 3), + GET_BE_U_4(tptr + 7), vc_info_len); if (vc_info_len < 4) { /* minimum 4, for the VC ID */ @@ -422,8 +422,8 @@ ldp_tlv_print(netdissect_options *ndo, TLV_TCHECK(vc_info_len); while (vc_info_len > 2) { - vc_info_tlv_type = EXTRACT_U_1(tptr); - vc_info_tlv_len = EXTRACT_U_1(tptr + 1); + vc_info_tlv_type = GET_U_1(tptr); + vc_info_tlv_len = GET_U_1(tptr + 1); if (vc_info_tlv_len < 2) break; if (vc_info_len < vc_info_tlv_len) @@ -436,22 +436,22 @@ ldp_tlv_print(netdissect_options *ndo, switch(vc_info_tlv_type) { case LDP_FEC_MARTINI_IFPARM_MTU: - ND_PRINT(": %u", EXTRACT_BE_U_2(tptr + 2)); + ND_PRINT(": %u", GET_BE_U_2(tptr + 2)); break; case LDP_FEC_MARTINI_IFPARM_DESC: ND_PRINT(": "); for (idx = 2; idx < vc_info_tlv_len; idx++) - fn_print_char(ndo, EXTRACT_U_1(tptr + idx)); + fn_print_char(ndo, GET_U_1(tptr + idx)); break; case LDP_FEC_MARTINI_IFPARM_VCCV: ND_PRINT("\n\t\t Control Channels (0x%02x) = [%s]", - EXTRACT_U_1((tptr + 2)), - bittok2str(ldp_fec_martini_ifparm_vccv_cc_values, "none", EXTRACT_U_1((tptr + 2)))); + GET_U_1((tptr + 2)), + bittok2str(ldp_fec_martini_ifparm_vccv_cc_values, "none", GET_U_1((tptr + 2)))); ND_PRINT("\n\t\t CV Types (0x%02x) = [%s]", - EXTRACT_U_1((tptr + 3)), - bittok2str(ldp_fec_martini_ifparm_vccv_cv_values, "none", EXTRACT_U_1((tptr + 3)))); + GET_U_1((tptr + 3)), + bittok2str(ldp_fec_martini_ifparm_vccv_cv_values, "none", GET_U_1((tptr + 3)))); break; default: @@ -469,18 +469,18 @@ ldp_tlv_print(netdissect_options *ndo, case LDP_TLV_GENERIC_LABEL: TLV_TCHECK(4); - ND_PRINT("\n\t Label: %u", EXTRACT_BE_U_4(tptr) & 0xfffff); + ND_PRINT("\n\t Label: %u", GET_BE_U_4(tptr) & 0xfffff); break; case LDP_TLV_STATUS: TLV_TCHECK(8); - ui = EXTRACT_BE_U_4(tptr); + ui = GET_BE_U_4(tptr); tptr+=4; ND_PRINT("\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_U_4(tptr); + ui = GET_BE_U_4(tptr); tptr+=4; if (ui) ND_PRINT(", causing Message ID: 0x%08x", ui); @@ -488,7 +488,7 @@ ldp_tlv_print(netdissect_options *ndo, case LDP_TLV_FT_SESSION: TLV_TCHECK(8); - ft_flags = EXTRACT_BE_U_2(tptr); + ft_flags = GET_BE_U_2(tptr); ND_PRINT("\n\t Flags: [%sReconnect, %sSave State, %sAll-Label Protection, %s Checkpoint, %sRe-Learn State]", ft_flags&0x8000 ? "" : "No ", ft_flags&0x8 ? "" : "Don't ", @@ -496,18 +496,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_U_4(tptr); + ui = GET_BE_U_4(tptr); if (ui) ND_PRINT(", Reconnect Timeout: %ums", ui); tptr+=4; - ui = EXTRACT_BE_U_4(tptr); + ui = GET_BE_U_4(tptr); if (ui) ND_PRINT(", Recovery Time: %ums", ui); break; case LDP_TLV_MTU: TLV_TCHECK(2); - ND_PRINT("\n\t MTU: %u", EXTRACT_BE_U_2(tptr)); + ND_PRINT("\n\t MTU: %u", GET_BE_U_2(tptr)); break; @@ -576,14 +576,14 @@ ldp_pdu_print(netdissect_options *ndo, /* * Sanity checking of the header. */ - if (EXTRACT_BE_U_2(ldp_com_header->version) != LDP_VERSION) { + if (GET_BE_U_2(ldp_com_header->version) != LDP_VERSION) { ND_PRINT("%sLDP version %u packet not supported", (ndo->ndo_vflag < 1) ? "" : "\n\t", - EXTRACT_BE_U_2(ldp_com_header->version)); + GET_BE_U_2(ldp_com_header->version)); return 0; } - pdu_len = EXTRACT_BE_U_2(ldp_com_header->pdu_length); + pdu_len = GET_BE_U_2(ldp_com_header->pdu_length); if (pdu_len < sizeof(struct ldp_common_header)-4) { /* length too short */ ND_PRINT("%sLDP, pdu-length: %u (too short, < %u)", @@ -597,7 +597,7 @@ ldp_pdu_print(netdissect_options *ndo, ND_PRINT("%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_U_2(ldp_com_header->label_space), + GET_BE_U_2(ldp_com_header->label_space), pdu_len); /* bail out if non-verbose */ @@ -613,8 +613,8 @@ ldp_pdu_print(netdissect_options *ndo, ND_TCHECK_LEN(tptr, sizeof(struct ldp_msg_header)); ldp_msg_header = (const struct ldp_msg_header *)tptr; - msg_len=EXTRACT_BE_U_2(ldp_msg_header->length); - msg_type=LDP_MASK_MSG_TYPE(EXTRACT_BE_U_2(ldp_msg_header->type)); + msg_len=GET_BE_U_2(ldp_msg_header->length); + msg_type=LDP_MASK_MSG_TYPE(GET_BE_U_2(ldp_msg_header->type)); if (msg_len < sizeof(struct ldp_msg_header)-4) { /* length too short */ @@ -636,8 +636,8 @@ ldp_pdu_print(netdissect_options *ndo, msg_type), msg_type, msg_len, - EXTRACT_BE_U_4(ldp_msg_header->id), - LDP_MASK_U_BIT(EXTRACT_BE_U_2(ldp_msg_header->type)) ? "continue processing" : "ignore"); + GET_BE_U_4(ldp_msg_header->id), + LDP_MASK_U_BIT(GET_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 74290639..a7d088d4 100644 --- a/print-lisp.c +++ b/print-lisp.c @@ -255,7 +255,7 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) lisp_hdr = (const lisp_map_register_hdr *) bp; lisp_hdr_flag(ndo, lisp_hdr); /* Supporting only MAP NOTIFY and MAP REGISTER LISP packets */ - type_and_flag = EXTRACT_U_1(lisp_hdr->type_and_flag); + type_and_flag = GET_U_1(lisp_hdr->type_and_flag); type = extract_lisp_type(type_and_flag); if ((type != LISP_MAP_REGISTER) && (type != LISP_MAP_NOTIFY)) return; @@ -264,13 +264,13 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) xtr_present = is_xtr_data_present(type, type_and_flag); /* Extract the number of EID records present */ - auth_data_len = EXTRACT_BE_U_2(lisp_hdr->auth_data_len); + auth_data_len = GET_BE_U_2(lisp_hdr->auth_data_len); packet_iterator = (const u_char *)(lisp_hdr); packet_offset = MAP_REGISTER_HDR_LEN; - record_count = EXTRACT_U_1(lisp_hdr->record_count); + record_count = GET_U_1(lisp_hdr->record_count); if (ndo->ndo_vflag) { - key_id = EXTRACT_BE_U_2(lisp_hdr->key_id); + key_id = GET_BE_U_2(lisp_hdr->key_id); ND_PRINT("\n %u record(s), ", record_count); ND_PRINT("Authentication %s,", tok2str(auth_type, "unknown-type", key_id)); @@ -293,15 +293,15 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) lisp_eid = (const lisp_map_register_eid *) ((const u_char *)lisp_hdr + packet_offset); packet_offset += MAP_REGISTER_EID_LEN; - mask_len = EXTRACT_U_1(lisp_eid->eid_prefix_mask_length); - eid_afi = EXTRACT_BE_U_2(lisp_eid->eid_prefix_afi); - loc_count = EXTRACT_U_1(lisp_eid->locator_count); + mask_len = GET_U_1(lisp_eid->eid_prefix_mask_length); + eid_afi = GET_BE_U_2(lisp_eid->eid_prefix_afi); + loc_count = GET_U_1(lisp_eid->locator_count); if (ndo->ndo_vflag) { - ttl = EXTRACT_BE_U_4(lisp_eid->ttl); + ttl = GET_BE_U_4(lisp_eid->ttl); ND_PRINT(" Record TTL %u,", ttl); - action_flag(ndo, EXTRACT_U_1(lisp_eid->act_auth_inc_res)); - map_version = EXTRACT_BE_U_2(lisp_eid->reserved_and_version) & 0x0FFF; + action_flag(ndo, GET_U_1(lisp_eid->act_auth_inc_res)); + map_version = GET_BE_U_2(lisp_eid->reserved_and_version) & 0x0FFF; ND_PRINT(" Map Version: %u,", map_version); } @@ -334,7 +334,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_U_2(lisp_loc->locator_afi); + loc_afi = GET_BE_U_2(lisp_loc->locator_afi); if (ndo->ndo_vflag) ND_PRINT("\n "); @@ -356,12 +356,12 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) if (ndo->ndo_vflag) { ND_PRINT("\n Priority/Weight %u/%u," " Multicast Priority/Weight %u/%u,", - EXTRACT_U_1(lisp_loc->priority), - EXTRACT_U_1(lisp_loc->weight), - EXTRACT_U_1(lisp_loc->m_priority), - EXTRACT_U_1(lisp_loc->m_weight)); + GET_U_1(lisp_loc->priority), + GET_U_1(lisp_loc->weight), + GET_U_1(lisp_loc->m_priority), + GET_U_1(lisp_loc->m_weight)); loc_hdr_flag(ndo, - EXTRACT_BE_U_2(lisp_loc->unused_and_flag)); + GET_BE_U_2(lisp_loc->unused_and_flag)); } } } @@ -376,7 +376,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("\n SITE-ID: %" PRIu64, - EXTRACT_BE_U_8(packet_iterator + packet_offset + 16)); + GET_BE_U_8(packet_iterator + packet_offset + 16)); } else { /* Check if packet isn't over yet */ if (packet_iterator + packet_offset < ndo->ndo_snapend) { @@ -414,7 +414,7 @@ is_xtr_data_present(uint8_t type, uint8_t lisp_hdr_flags) static void lisp_hdr_flag(netdissect_options *ndo, const lisp_map_register_hdr *lisp_hdr) { - uint8_t type = extract_lisp_type(EXTRACT_U_1(lisp_hdr->type_and_flag)); + uint8_t type = extract_lisp_type(GET_U_1(lisp_hdr->type_and_flag)); if (!ndo->ndo_vflag) { ND_PRINT("%s,", tok2str(lisp_type, "unknown-type-%u", type)); @@ -425,10 +425,10 @@ static void lisp_hdr_flag(netdissect_options *ndo, const lisp_map_register_hdr * if (type == LISP_MAP_REGISTER) { ND_PRINT(" flags [%s],", bittok2str(map_register_hdr_flag, - "none", EXTRACT_BE_U_4(lisp_hdr))); + "none", GET_BE_U_4(lisp_hdr))); } else if (type == LISP_MAP_NOTIFY) { ND_PRINT(" flags [%s],", bittok2str(map_notify_hdr_flag, - "none", EXTRACT_BE_U_4(lisp_hdr))); + "none", GET_BE_U_4(lisp_hdr))); } return; diff --git a/print-llc.c b/print-llc.c index e7c50196..750a8ccd 100644 --- a/print-llc.c +++ b/print-llc.c @@ -167,8 +167,8 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, return (length); } - dsap_field = EXTRACT_U_1(p); - ssap_field = EXTRACT_U_1(p + 1); + dsap_field = GET_U_1(p); + ssap_field = GET_U_1(p + 1); /* * OK, what type of LLC frame is this? The length @@ -176,7 +176,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_U_1(p + 2); + control = GET_U_1(p + 2); if ((control & LLC_U_FMT) == LLC_U_FMT) { /* * U frame. @@ -202,7 +202,7 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, /* * ...and is little-endian. */ - control = EXTRACT_LE_U_2(p + 2); + control = GET_LE_U_2(p + 2); is_u = 0; hdrlen = 4; /* DSAP, SSAP, 2-byte control field */ } @@ -373,15 +373,15 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, ND_DEFAULTPRINT((const u_char *)p, caplen); return (hdrlen); } - if (EXTRACT_U_1(p) == LLC_XID_FI) { + if (GET_U_1(p) == LLC_XID_FI) { if (caplen < 3 || length < 3) { nd_print_trunc(ndo); if (caplen > 0) ND_DEFAULTPRINT((const u_char *)p, caplen); } else ND_PRINT(": %02x %02x", - EXTRACT_U_1(p + 1), - EXTRACT_U_1(p + 2)); + GET_U_1(p + 1), + GET_U_1(p + 2)); return (hdrlen); } } @@ -432,8 +432,8 @@ snap_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, ND_TCHECK_5(p); if (caplen < 5 || length < 5) goto trunc; - orgcode = EXTRACT_BE_U_3(p); - et = EXTRACT_BE_U_2(p + 3); + orgcode = GET_BE_U_3(p); + et = GET_BE_U_2(p + 3); if (ndo->ndo_eflag) { /* diff --git a/print-lldp.c b/print-lldp.c index ba412566..e728bae6 100644 --- a/print-lldp.c +++ b/print-lldp.c @@ -617,10 +617,10 @@ print_ets_priority_assignment_table(netdissect_options *ndo, ND_PRINT("\n\t Priority Assignment Table"); ND_PRINT("\n\t Priority : 0 1 2 3 4 5 6 7"); ND_PRINT("\n\t Value : %-3d %-3d %-3d %-3d %-3d %-3d %-3d %-3d", - EXTRACT_U_1(ptr) >> 4, EXTRACT_U_1(ptr) & 0x0f, - EXTRACT_U_1(ptr + 1) >> 4, EXTRACT_U_1(ptr + 1) & 0x0f, - EXTRACT_U_1(ptr + 2) >> 4, EXTRACT_U_1(ptr + 2) & 0x0f, - EXTRACT_U_1(ptr + 3) >> 4, EXTRACT_U_1(ptr + 3) & 0x0f); + GET_U_1(ptr) >> 4, GET_U_1(ptr) & 0x0f, + GET_U_1(ptr + 1) >> 4, GET_U_1(ptr + 1) & 0x0f, + GET_U_1(ptr + 2) >> 4, GET_U_1(ptr + 2) & 0x0f, + GET_U_1(ptr + 3) >> 4, GET_U_1(ptr + 3) & 0x0f); } static void @@ -630,9 +630,9 @@ print_tc_bandwidth_table(netdissect_options *ndo, ND_PRINT("\n\t TC Bandwidth Table"); ND_PRINT("\n\t TC%% : 0 1 2 3 4 5 6 7"); ND_PRINT("\n\t Value : %-3d %-3d %-3d %-3d %-3d %-3d %-3d %-3d", - EXTRACT_U_1(ptr), EXTRACT_U_1(ptr + 1), EXTRACT_U_1(ptr + 2), - EXTRACT_U_1(ptr + 3), EXTRACT_U_1(ptr + 4), EXTRACT_U_1(ptr + 5), - EXTRACT_U_1(ptr + 6), EXTRACT_U_1(ptr + 7)); + GET_U_1(ptr), GET_U_1(ptr + 1), GET_U_1(ptr + 2), + GET_U_1(ptr + 3), GET_U_1(ptr + 4), GET_U_1(ptr + 5), + GET_U_1(ptr + 6), GET_U_1(ptr + 7)); } static void @@ -642,9 +642,9 @@ print_tsa_assignment_table(netdissect_options *ndo, ND_PRINT("\n\t TSA Assignment Table"); ND_PRINT("\n\t Traffic Class: 0 1 2 3 4 5 6 7"); ND_PRINT("\n\t Value : %-3d %-3d %-3d %-3d %-3d %-3d %-3d %-3d", - EXTRACT_U_1(ptr), EXTRACT_U_1(ptr + 1), EXTRACT_U_1(ptr + 2), - EXTRACT_U_1(ptr + 3), EXTRACT_U_1(ptr + 4), EXTRACT_U_1(ptr + 5), - EXTRACT_U_1(ptr + 6), EXTRACT_U_1(ptr + 7)); + GET_U_1(ptr), GET_U_1(ptr + 1), GET_U_1(ptr + 2), + GET_U_1(ptr + 3), GET_U_1(ptr + 4), GET_U_1(ptr + 5), + GET_U_1(ptr + 6), GET_U_1(ptr + 7)); } /* @@ -663,7 +663,7 @@ lldp_private_8021_print(netdissect_options *ndo, if (tlv_len < 4) { return hexdump; } - subtype = EXTRACT_U_1(tptr + 3); + subtype = GET_U_1(tptr + 3); ND_PRINT("\n\t %s Subtype (%u)", tok2str(lldp_8021_subtype_values, "unknown", subtype), @@ -675,26 +675,26 @@ lldp_private_8021_print(netdissect_options *ndo, return hexdump; } ND_PRINT("\n\t port vlan id (PVID): %u", - EXTRACT_BE_U_2(tptr + 4)); + GET_BE_U_2(tptr + 4)); break; case LLDP_PRIVATE_8021_SUBTYPE_PROTOCOL_VLAN_ID: if (tlv_len < 7) { return hexdump; } ND_PRINT("\n\t port and protocol vlan id (PPVID): %u, flags [%s] (0x%02x)", - EXTRACT_BE_U_2(tptr + 5), - bittok2str(lldp_8021_port_protocol_id_values, "none", EXTRACT_U_1(tptr + 4)), - EXTRACT_U_1(tptr + 4)); + GET_BE_U_2(tptr + 5), + bittok2str(lldp_8021_port_protocol_id_values, "none", GET_U_1(tptr + 4)), + GET_U_1(tptr + 4)); break; case LLDP_PRIVATE_8021_SUBTYPE_VLAN_NAME: if (tlv_len < 6) { return hexdump; } - ND_PRINT("\n\t vlan id (VID): %u", EXTRACT_BE_U_2(tptr + 4)); + ND_PRINT("\n\t vlan id (VID): %u", GET_BE_U_2(tptr + 4)); if (tlv_len < 7) { return hexdump; } - sublen = EXTRACT_U_1(tptr + 6); + sublen = GET_U_1(tptr + 6); if (tlv_len < 7+sublen) { return hexdump; } @@ -705,7 +705,7 @@ lldp_private_8021_print(netdissect_options *ndo, if (tlv_len < 5) { return hexdump; } - sublen = EXTRACT_U_1(tptr + 4); + sublen = GET_U_1(tptr + 4); if (tlv_len < 5+sublen) { return hexdump; } @@ -716,13 +716,13 @@ lldp_private_8021_print(netdissect_options *ndo, if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_CONGESTION_NOTIFICATION_LENGTH){ return hexdump; } - tval=EXTRACT_U_1(tptr + 4); + tval=GET_U_1(tptr + 4); ND_PRINT("\n\t Pre-Priority CNPV Indicator"); ND_PRINT("\n\t Priority : 0 1 2 3 4 5 6 7"); ND_PRINT("\n\t Value : "); for(i=0;i<NO_OF_BITS;i++) ND_PRINT("%-2d ", (tval >> i) & 0x01); - tval=EXTRACT_U_1(tptr + 5); + tval=GET_U_1(tptr + 5); ND_PRINT("\n\t Pre-Priority Ready Indicator"); ND_PRINT("\n\t Priority : 0 1 2 3 4 5 6 7"); ND_PRINT("\n\t Value : "); @@ -734,7 +734,7 @@ lldp_private_8021_print(netdissect_options *ndo, if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_ETS_CONFIGURATION_LENGTH) { return hexdump; } - tval=EXTRACT_U_1(tptr + 4); + tval=GET_U_1(tptr + 4); ND_PRINT("\n\t Willing:%u, CBS:%u, RES:%u, Max TCs:%u", tval >> 7, (tval >> 6) & 0x02, (tval >> 3) & 0x07, tval & 0x07); @@ -753,7 +753,7 @@ lldp_private_8021_print(netdissect_options *ndo, if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_ETS_RECOMMENDATION_LENGTH) { return hexdump; } - ND_PRINT("\n\t RES: %u", EXTRACT_U_1(tptr + 4)); + ND_PRINT("\n\t RES: %u", GET_U_1(tptr + 4)); /*Print Priority Assignment Table */ print_ets_priority_assignment_table(ndo, tptr + 5); /*Print TC Bandwidth Table */ @@ -766,11 +766,11 @@ lldp_private_8021_print(netdissect_options *ndo, if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_PFC_CONFIGURATION_LENGTH) { return hexdump; } - tval=EXTRACT_U_1(tptr + 4); + tval=GET_U_1(tptr + 4); ND_PRINT("\n\t Willing: %u, MBC: %u, RES: %u, PFC cap:%u ", tval >> 7, (tval >> 6) & 0x01, (tval >> 4) & 0x03, (tval & 0x0f)); ND_PRINT("\n\t PFC Enable"); - tval=EXTRACT_U_1(tptr + 5); + tval=GET_U_1(tptr + 5); ND_PRINT("\n\t Priority : 0 1 2 3 4 5 6 7"); ND_PRINT("\n\t Value : "); for(i=0;i<NO_OF_BITS;i++) @@ -781,7 +781,7 @@ lldp_private_8021_print(netdissect_options *ndo, if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_APPLICATION_PRIORITY_MIN_LENGTH) { return hexdump; } - ND_PRINT("\n\t RES: %u", EXTRACT_U_1(tptr + 4)); + ND_PRINT("\n\t RES: %u", GET_U_1(tptr + 4)); if(tlv_len<=LLDP_PRIVATE_8021_SUBTYPE_APPLICATION_PRIORITY_MIN_LENGTH){ return hexdump; } @@ -793,10 +793,10 @@ lldp_private_8021_print(netdissect_options *ndo, i=0; ND_PRINT("\n\t Application Priority Table"); while(i<sublen) { - tval=EXTRACT_U_1(tptr + i + 5); + tval=GET_U_1(tptr + i + 5); ND_PRINT("\n\t Priority: %u, RES: %u, Sel: %u, Protocol ID: %u", tval >> 5, (tval >> 3) & 0x03, (tval & 0x07), - EXTRACT_BE_U_2(tptr + i + 5)); + GET_BE_U_2(tptr + i + 5)); i=i+3; } break; @@ -805,20 +805,20 @@ lldp_private_8021_print(netdissect_options *ndo, return hexdump; } ND_PRINT("\n\t EVB Bridge Status"); - tval=EXTRACT_U_1(tptr + 4); + tval=GET_U_1(tptr + 4); ND_PRINT("\n\t RES: %u, BGID: %u, RRCAP: %u, RRCTR: %u", tval >> 3, (tval >> 2) & 0x01, (tval >> 1) & 0x01, tval & 0x01); ND_PRINT("\n\t EVB Station Status"); - tval=EXTRACT_U_1(tptr + 5); + tval=GET_U_1(tptr + 5); ND_PRINT("\n\t RES: %u, SGID: %u, RRREQ: %u,RRSTAT: %u", tval >> 4, (tval >> 3) & 0x01, (tval >> 2) & 0x01, tval & 0x03); - tval=EXTRACT_U_1(tptr + 6); + tval=GET_U_1(tptr + 6); ND_PRINT("\n\t R: %u, RTE: %u, ",tval >> 5, tval & 0x1f); - tval=EXTRACT_U_1(tptr + 7); + tval=GET_U_1(tptr + 7); ND_PRINT("EVB Mode: %s [%u]", tok2str(lldp_evb_mode_values, "unknown", tval >> 6), tval >> 6); ND_PRINT("\n\t ROL: %u, RWD: %u, ", (tval >> 5) & 0x01, tval & 0x1f); - tval=EXTRACT_U_1(tptr + 8); + tval=GET_U_1(tptr + 8); ND_PRINT("RES: %u, ROL: %u, RKA: %u", tval >> 6, (tval >> 5) & 0x01, tval & 0x1f); break; @@ -826,17 +826,17 @@ lldp_private_8021_print(netdissect_options *ndo, if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_CDCP_MIN_LENGTH){ return hexdump; } - tval=EXTRACT_U_1(tptr + 4); + tval=GET_U_1(tptr + 4); ND_PRINT("\n\t Role: %u, RES: %u, Scomp: %u ", tval >> 7, (tval >> 4) & 0x07, (tval >> 3) & 0x01); - ND_PRINT("ChnCap: %u", EXTRACT_BE_U_2(tptr + 6) & 0x0fff); + ND_PRINT("ChnCap: %u", GET_BE_U_2(tptr + 6) & 0x0fff); sublen=tlv_len-8; if(sublen%3!=0) { return hexdump; } i=0; while(i<sublen) { - tval=EXTRACT_BE_U_3(tptr + i + 8); + tval=GET_BE_U_3(tptr + i + 8); ND_PRINT("\n\t SCID: %u, SVID: %u", tval >> 12, tval & 0x000fff); i=i+3; @@ -864,7 +864,7 @@ lldp_private_8023_print(netdissect_options *ndo, if (tlv_len < 4) { return hexdump; } - subtype = EXTRACT_U_1(tptr + 3); + subtype = GET_U_1(tptr + 3); ND_PRINT("\n\t %s Subtype (%u)", tok2str(lldp_8023_subtype_values, "unknown", subtype), @@ -876,14 +876,14 @@ lldp_private_8023_print(netdissect_options *ndo, return hexdump; } ND_PRINT("\n\t autonegotiation [%s] (0x%02x)", - bittok2str(lldp_8023_autonegotiation_values, "none", EXTRACT_U_1(tptr + 4)), - EXTRACT_U_1(tptr + 4)); + bittok2str(lldp_8023_autonegotiation_values, "none", GET_U_1(tptr + 4)), + GET_U_1(tptr + 4)); ND_PRINT("\n\t PMD autoneg capability [%s] (0x%04x)", - bittok2str(lldp_pmd_capability_values,"unknown", EXTRACT_BE_U_2(tptr + 5)), - EXTRACT_BE_U_2(tptr + 5)); + bittok2str(lldp_pmd_capability_values,"unknown", GET_BE_U_2(tptr + 5)), + GET_BE_U_2(tptr + 5)); ND_PRINT("\n\t MAU type %s (0x%04x)", - tok2str(lldp_mau_types_values, "unknown", EXTRACT_BE_U_2(tptr + 7)), - EXTRACT_BE_U_2(tptr + 7)); + tok2str(lldp_mau_types_values, "unknown", GET_BE_U_2(tptr + 7)), + GET_BE_U_2(tptr + 7)); break; case LLDP_PRIVATE_8023_SUBTYPE_MDIPOWER: @@ -891,9 +891,9 @@ lldp_private_8023_print(netdissect_options *ndo, return hexdump; } ND_PRINT("\n\t MDI power support [%s], power pair %s, power class %s", - 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)))); + bittok2str(lldp_mdi_values, "none", GET_U_1((tptr + 4))), + tok2str(lldp_mdi_power_pairs_values, "unknown", GET_U_1((tptr + 5))), + tok2str(lldp_mdi_power_class_values, "unknown", GET_U_1((tptr + 6)))); break; case LLDP_PRIVATE_8023_SUBTYPE_LINKAGGR: @@ -901,15 +901,15 @@ lldp_private_8023_print(netdissect_options *ndo, return hexdump; } ND_PRINT("\n\t aggregation status [%s], aggregation port ID %u", - bittok2str(lldp_aggregation_values, "none", EXTRACT_U_1((tptr + 4))), - EXTRACT_BE_U_4(tptr + 5)); + bittok2str(lldp_aggregation_values, "none", GET_U_1((tptr + 4))), + GET_BE_U_4(tptr + 5)); break; case LLDP_PRIVATE_8023_SUBTYPE_MTU: if (tlv_len < 6) { return hexdump; } - ND_PRINT("\n\t MTU size %u", EXTRACT_BE_U_2(tptr + 4)); + ND_PRINT("\n\t MTU size %u", GET_BE_U_2(tptr + 4)); break; default: @@ -928,8 +928,8 @@ lldp_extract_latlon(netdissect_options *ndo, const u_char *tptr) { uint64_t latlon; - latlon = EXTRACT_U_1(tptr) & 0x3; - latlon = (latlon << 32) | EXTRACT_BE_U_4(tptr + 1); + latlon = GET_U_1(tptr) & 0x3; + latlon = (latlon << 32) | GET_BE_U_4(tptr + 1); return latlon; } @@ -949,7 +949,7 @@ lldp_private_iana_print(netdissect_options *ndo, if (tlv_len < 8) { return hexdump; } - subtype = EXTRACT_U_1(tptr + 3); + subtype = GET_U_1(tptr + 3); ND_PRINT("\n\t %s Subtype (%u)", tok2str(lldp_iana_subtype_values, "unknown", subtype), @@ -986,7 +986,7 @@ lldp_private_tia_print(netdissect_options *ndo, if (tlv_len < 4) { return hexdump; } - subtype = EXTRACT_U_1(tptr + 3); + subtype = GET_U_1(tptr + 3); ND_PRINT("\n\t %s Subtype (%u)", tok2str(lldp_tia_subtype_values, "unknown", subtype), @@ -999,10 +999,10 @@ lldp_private_tia_print(netdissect_options *ndo, } ND_PRINT("\n\t Media capabilities [%s] (0x%04x)", bittok2str(lldp_tia_capabilities_values, "none", - EXTRACT_BE_U_2(tptr + 4)), EXTRACT_BE_U_2(tptr + 4)); + GET_BE_U_2(tptr + 4)), GET_BE_U_2(tptr + 4)); ND_PRINT("\n\t Device type [%s] (0x%02x)", - tok2str(lldp_tia_device_type_values, "unknown", EXTRACT_U_1(tptr + 6)), - EXTRACT_U_1(tptr + 6)); + tok2str(lldp_tia_device_type_values, "unknown", GET_U_1(tptr + 6)), + GET_U_1(tptr + 6)); break; case LLDP_PRIVATE_TIA_SUBTYPE_NETWORK_POLICY: @@ -1010,23 +1010,23 @@ lldp_private_tia_print(netdissect_options *ndo, return hexdump; } ND_PRINT("\n\t Application type [%s] (0x%02x)", - tok2str(lldp_tia_application_type_values, "none", EXTRACT_U_1(tptr + 4)), - EXTRACT_U_1(tptr + 4)); + tok2str(lldp_tia_application_type_values, "none", GET_U_1(tptr + 4)), + GET_U_1(tptr + 4)); ND_PRINT(", Flags [%s]", bittok2str( - lldp_tia_network_policy_bits_values, "none", EXTRACT_U_1((tptr + 5)))); + lldp_tia_network_policy_bits_values, "none", GET_U_1((tptr + 5)))); ND_PRINT("\n\t Vlan id %u", - LLDP_EXTRACT_NETWORK_POLICY_VLAN(EXTRACT_BE_U_2(tptr + 5))); + LLDP_EXTRACT_NETWORK_POLICY_VLAN(GET_BE_U_2(tptr + 5))); ND_PRINT(", L2 priority %u", - LLDP_EXTRACT_NETWORK_POLICY_L2_PRIORITY(EXTRACT_BE_U_2(tptr + 6))); + LLDP_EXTRACT_NETWORK_POLICY_L2_PRIORITY(GET_BE_U_2(tptr + 6))); ND_PRINT(", DSCP value %u", - LLDP_EXTRACT_NETWORK_POLICY_DSCP(EXTRACT_BE_U_2(tptr + 6))); + LLDP_EXTRACT_NETWORK_POLICY_DSCP(GET_BE_U_2(tptr + 6))); break; case LLDP_PRIVATE_TIA_SUBTYPE_LOCAL_ID: if (tlv_len < 5) { return hexdump; } - location_format = EXTRACT_U_1(tptr + 4); + location_format = GET_U_1(tptr + 4); ND_PRINT("\n\t Location data format %s (0x%02x)", tok2str(lldp_tia_location_data_format_values, "unknown", location_format), location_format); @@ -1037,25 +1037,27 @@ lldp_private_tia_print(netdissect_options *ndo, return hexdump; } ND_PRINT("\n\t Latitude resolution %u, latitude value %" PRIu64, - (EXTRACT_U_1(tptr + 5) >> 2), lldp_extract_latlon(ndo, tptr + 5)); + (GET_U_1(tptr + 5) >> 2), + lldp_extract_latlon(ndo, tptr + 5)); ND_PRINT("\n\t Longitude resolution %u, longitude value %" PRIu64, - (EXTRACT_U_1(tptr + 10) >> 2), lldp_extract_latlon(ndo, tptr + 10)); + (GET_U_1(tptr + 10) >> 2), + lldp_extract_latlon(ndo, tptr + 10)); ND_PRINT("\n\t Altitude type %s (%u)", - tok2str(lldp_tia_location_altitude_type_values, "unknown",EXTRACT_U_1(tptr + 15) >> 4), - (EXTRACT_U_1(tptr + 15) >> 4)); + tok2str(lldp_tia_location_altitude_type_values, "unknown",GET_U_1(tptr + 15) >> 4), + (GET_U_1(tptr + 15) >> 4)); ND_PRINT("\n\t Altitude resolution %u, altitude value 0x%x", - (EXTRACT_BE_U_2(tptr + 15)>>6)&0x3f, - (EXTRACT_BE_U_4(tptr + 16) & 0x3fffffff)); + (GET_BE_U_2(tptr + 15)>>6)&0x3f, + (GET_BE_U_4(tptr + 16) & 0x3fffffff)); ND_PRINT("\n\t Datum %s (0x%02x)", - tok2str(lldp_tia_location_datum_type_values, "unknown", EXTRACT_U_1(tptr + 20)), - EXTRACT_U_1(tptr + 20)); + tok2str(lldp_tia_location_datum_type_values, "unknown", GET_U_1(tptr + 20)), + GET_U_1(tptr + 20)); break; case LLDP_TIA_LOCATION_DATA_FORMAT_CIVIC_ADDRESS: if (tlv_len < 6) { return hexdump; } - lci_len = EXTRACT_U_1(tptr + 5); + lci_len = GET_U_1(tptr + 5); if (lci_len < 3) { return hexdump; } @@ -1064,8 +1066,8 @@ lldp_private_tia_print(netdissect_options *ndo, } ND_PRINT("\n\t LCI length %u, LCI what %s (0x%02x), Country-code ", lci_len, - tok2str(lldp_tia_location_lci_what_values, "unknown", EXTRACT_U_1(tptr + 6)), - EXTRACT_U_1(tptr + 6)); + tok2str(lldp_tia_location_lci_what_values, "unknown", GET_U_1(tptr + 6)), + GET_U_1(tptr + 6)); /* Country code */ (void)nd_printzp(ndo, tptr + 7, 2, NULL); @@ -1078,8 +1080,8 @@ lldp_private_tia_print(netdissect_options *ndo, if (lci_len < 2) { return hexdump; } - ca_type = EXTRACT_U_1(tptr); - ca_len = EXTRACT_U_1(tptr + 1); + ca_type = GET_U_1(tptr); + ca_len = GET_U_1(tptr + 1); tptr += 2; lci_len -= 2; @@ -1118,13 +1120,13 @@ lldp_private_tia_print(netdissect_options *ndo, return hexdump; } ND_PRINT("\n\t Power type [%s]", - (EXTRACT_U_1(tptr + 4) & 0xC0 >> 6) ? "PD device" : "PSE device"); + (GET_U_1(tptr + 4) & 0xC0 >> 6) ? "PD device" : "PSE device"); ND_PRINT(", Power source [%s]", - tok2str(lldp_tia_power_source_values, "none", (EXTRACT_U_1((tptr + 4)) & 0x30) >> 4)); + tok2str(lldp_tia_power_source_values, "none", (GET_U_1((tptr + 4)) & 0x30) >> 4)); ND_PRINT("\n\t Power priority [%s] (0x%02x)", - tok2str(lldp_tia_power_priority_values, "none", EXTRACT_U_1(tptr + 4) & 0x0f), - EXTRACT_U_1(tptr + 4) & 0x0f); - power_val = EXTRACT_BE_U_2(tptr + 5); + tok2str(lldp_tia_power_priority_values, "none", GET_U_1(tptr + 4) & 0x0f), + GET_U_1(tptr + 4) & 0x0f); + power_val = GET_BE_U_2(tptr + 5); if (power_val < LLDP_TIA_POWER_VAL_MAX) { ND_PRINT(", Power %.1f Watts", ((float)power_val) / 10); } else { @@ -1170,7 +1172,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, if (len < 4) { return hexdump; } - subtype = EXTRACT_U_1(pptr + 3); + subtype = GET_U_1(pptr + 3); ND_PRINT("\n\t %s Subtype (%u)", tok2str(lldp_dcbx_subtype_values, "unknown", subtype), @@ -1187,7 +1189,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, ND_TCHECK_LEN(tptr, sizeof(tlv)); - tlv = EXTRACT_BE_U_2(tptr); + tlv = GET_BE_U_2(tptr); tlv_type = LLDP_EXTRACT_TYPE(tlv); tlv_len = LLDP_EXTRACT_LEN(tlv); @@ -1214,11 +1216,11 @@ lldp_private_dcbx_print(netdissect_options *ndo, } ND_PRINT("\n\t Control - Protocol Control (type 0x%x, length %u)", LLDP_DCBX_CONTROL_TLV, tlv_len); - ND_PRINT("\n\t Oper_Version: %u", EXTRACT_U_1(tptr)); - ND_PRINT("\n\t Max_Version: %u", EXTRACT_U_1(tptr + 1)); - ND_PRINT("\n\t Sequence Number: %u", EXTRACT_BE_U_4(tptr + 2)); + ND_PRINT("\n\t Oper_Version: %u", GET_U_1(tptr)); + ND_PRINT("\n\t Max_Version: %u", GET_U_1(tptr + 1)); + ND_PRINT("\n\t Sequence Number: %u", GET_BE_U_4(tptr + 2)); ND_PRINT("\n\t Acknowledgement Number: %u", - EXTRACT_BE_U_4(tptr + 6)); + GET_BE_U_4(tptr + 6)); break; case LLDP_DCBX_PRIORITY_GROUPS_TLV: if (tlv_len < 17) { @@ -1226,29 +1228,30 @@ lldp_private_dcbx_print(netdissect_options *ndo, } ND_PRINT("\n\t Feature - Priority Group (type 0x%x, length %u)", LLDP_DCBX_PRIORITY_GROUPS_TLV, tlv_len); - ND_PRINT("\n\t Oper_Version: %u", EXTRACT_U_1(tptr)); - ND_PRINT("\n\t Max_Version: %u", EXTRACT_U_1(tptr + 1)); - ND_PRINT("\n\t Info block(0x%02X): ", EXTRACT_U_1(tptr + 2)); - tval = EXTRACT_U_1(tptr + 2); + ND_PRINT("\n\t Oper_Version: %u", GET_U_1(tptr)); + ND_PRINT("\n\t Max_Version: %u", GET_U_1(tptr + 1)); + ND_PRINT("\n\t Info block(0x%02X): ", GET_U_1(tptr + 2)); + tval = GET_U_1(tptr + 2); ND_PRINT("Enable bit: %u, Willing bit: %u, Error Bit: %u", (tval & 0x80) ? 1 : 0, (tval & 0x40) ? 1 : 0, (tval & 0x20) ? 1 : 0); - ND_PRINT("\n\t SubType: %u", EXTRACT_U_1(tptr + 3)); + ND_PRINT("\n\t SubType: %u", GET_U_1(tptr + 3)); ND_PRINT("\n\t Priority Allocation"); /* * Array of 8 4-bit priority group ID values; we fetch all * 32 bits and extract each nibble. */ - pgval = EXTRACT_BE_U_4(tptr + 4); + pgval = GET_BE_U_4(tptr + 4); for (i = 0; i <= 7; i++) { ND_PRINT("\n\t PgId_%u: %u", i, (pgval >> (28 - 4 * i)) & 0xF); } ND_PRINT("\n\t Priority Group Allocation"); for (i = 0; i <= 7; i++) - ND_PRINT("\n\t Pg percentage[%u]: %u", i, EXTRACT_U_1(tptr + 8 + i)); - ND_PRINT("\n\t NumTCsSupported: %u", EXTRACT_U_1(tptr + 8 + 8)); + ND_PRINT("\n\t Pg percentage[%u]: %u", i, + GET_U_1(tptr + 8 + i)); + ND_PRINT("\n\t NumTCsSupported: %u", GET_U_1(tptr + 8 + 8)); break; case LLDP_DCBX_PRIORITY_FLOW_CONTROL_TLV: if (tlv_len < 6) { @@ -1257,20 +1260,20 @@ lldp_private_dcbx_print(netdissect_options *ndo, ND_PRINT("\n\t Feature - Priority Flow Control"); ND_PRINT(" (type 0x%x, length %u)", LLDP_DCBX_PRIORITY_FLOW_CONTROL_TLV, tlv_len); - ND_PRINT("\n\t Oper_Version: %u", EXTRACT_U_1(tptr)); - ND_PRINT("\n\t Max_Version: %u", EXTRACT_U_1(tptr + 1)); - ND_PRINT("\n\t Info block(0x%02X): ", EXTRACT_U_1(tptr + 2)); - tval = EXTRACT_U_1(tptr + 2); + ND_PRINT("\n\t Oper_Version: %u", GET_U_1(tptr)); + ND_PRINT("\n\t Max_Version: %u", GET_U_1(tptr + 1)); + ND_PRINT("\n\t Info block(0x%02X): ", GET_U_1(tptr + 2)); + tval = GET_U_1(tptr + 2); ND_PRINT("Enable bit: %u, Willing bit: %u, Error Bit: %u", (tval & 0x80) ? 1 : 0, (tval & 0x40) ? 1 : 0, (tval & 0x20) ? 1 : 0); - ND_PRINT("\n\t SubType: %u", EXTRACT_U_1(tptr + 3)); - tval = EXTRACT_U_1(tptr + 4); - ND_PRINT("\n\t PFC Config (0x%02X)", EXTRACT_U_1(tptr + 4)); + ND_PRINT("\n\t SubType: %u", GET_U_1(tptr + 3)); + tval = GET_U_1(tptr + 4); + ND_PRINT("\n\t PFC Config (0x%02X)", GET_U_1(tptr + 4)); for (i = 0; i <= 7; i++) ND_PRINT("\n\t Priority Bit %u: %s", i, (tval & (1 << i)) ? "Enabled" : "Disabled"); - ND_PRINT("\n\t NumTCPFCSupported: %u", EXTRACT_U_1(tptr + 5)); + ND_PRINT("\n\t NumTCPFCSupported: %u", GET_U_1(tptr + 5)); break; case LLDP_DCBX_APPLICATION_TLV: if (tlv_len < 4) { @@ -1278,26 +1281,27 @@ lldp_private_dcbx_print(netdissect_options *ndo, } ND_PRINT("\n\t Feature - Application (type 0x%x, length %u)", LLDP_DCBX_APPLICATION_TLV, tlv_len); - ND_PRINT("\n\t Oper_Version: %u", EXTRACT_U_1(tptr)); - ND_PRINT("\n\t Max_Version: %u", EXTRACT_U_1(tptr + 1)); - ND_PRINT("\n\t Info block(0x%02X): ", EXTRACT_U_1(tptr + 2)); - tval = EXTRACT_U_1(tptr + 2); + ND_PRINT("\n\t Oper_Version: %u", GET_U_1(tptr)); + ND_PRINT("\n\t Max_Version: %u", GET_U_1(tptr + 1)); + ND_PRINT("\n\t Info block(0x%02X): ", GET_U_1(tptr + 2)); + tval = GET_U_1(tptr + 2); ND_PRINT("Enable bit: %u, Willing bit: %u, Error Bit: %u", (tval & 0x80) ? 1 : 0, (tval & 0x40) ? 1 : 0, (tval & 0x20) ? 1 : 0); - ND_PRINT("\n\t SubType: %u", EXTRACT_U_1(tptr + 3)); + ND_PRINT("\n\t SubType: %u", GET_U_1(tptr + 3)); tval = tlv_len - 4; mptr = tptr + 4; while (tval >= 6) { ND_PRINT("\n\t Application Value"); ND_PRINT("\n\t Application Protocol ID: 0x%04x", - EXTRACT_BE_U_2(mptr)); - uval = EXTRACT_BE_U_3(mptr + 2); + GET_BE_U_2(mptr)); + uval = GET_BE_U_3(mptr + 2); ND_PRINT("\n\t SF (0x%x) Application Protocol ID is %s", (uval >> 22), (uval >> 22) ? "Socket Number" : "L2 EtherType"); ND_PRINT("\n\t OUI: 0x%06x", uval & 0x3fffff); - ND_PRINT("\n\t User Priority Map: 0x%02x", EXTRACT_U_1(mptr + 5)); + ND_PRINT("\n\t User Priority Map: 0x%02x", + GET_U_1(mptr + 5)); tval = tval - 6; mptr = mptr + 6; } @@ -1330,7 +1334,7 @@ lldp_network_addr_print(netdissect_options *ndo, const u_char *tptr, u_int len) if (len < 1) return NULL; len--; - af = EXTRACT_U_1(tptr); + af = GET_U_1(tptr); switch (af) { case AFNUM_INET: if (len < 4) @@ -1380,7 +1384,7 @@ lldp_mgmt_addr_tlv_print(netdissect_options *ndo, if (tlen < 1) { return 0; } - mgmt_addr_len = EXTRACT_U_1(tptr); + mgmt_addr_len = GET_U_1(tptr); tptr++; tlen--; @@ -1401,11 +1405,11 @@ lldp_mgmt_addr_tlv_print(netdissect_options *ndo, return 0; } - intf_num_subtype = EXTRACT_U_1(tptr); + intf_num_subtype = GET_U_1(tptr); ND_PRINT("\n\t %s Interface Numbering (%u): %u", tok2str(lldp_intf_numb_subtype_values, "Unknown", intf_num_subtype), intf_num_subtype, - EXTRACT_BE_U_4(tptr + 1)); + GET_BE_U_4(tptr + 1)); tptr += LLDP_INTF_NUM_LEN; tlen -= LLDP_INTF_NUM_LEN; @@ -1414,7 +1418,7 @@ lldp_mgmt_addr_tlv_print(netdissect_options *ndo, * The OID is optional. */ if (tlen) { - oid_len = EXTRACT_U_1(tptr); + oid_len = GET_U_1(tptr); if (tlen < 1U + oid_len) { return 0; @@ -1448,7 +1452,7 @@ lldp_print(netdissect_options *ndo, ND_TCHECK_LEN(tptr, sizeof(tlv)); - tlv = EXTRACT_BE_U_2(tptr); + tlv = GET_BE_U_2(tptr); tlv_type = LLDP_EXTRACT_TYPE(tlv); tlv_len = LLDP_EXTRACT_LEN(tlv); @@ -1480,7 +1484,7 @@ lldp_print(netdissect_options *ndo, if (tlv_len < 2) { goto trunc; } - subtype = EXTRACT_U_1(tptr); + subtype = GET_U_1(tptr); ND_PRINT("\n\t Subtype %s (%u): ", tok2str(lldp_chassis_subtype_values, "Unknown", subtype), subtype); @@ -1521,7 +1525,7 @@ lldp_print(netdissect_options *ndo, if (tlv_len < 2) { goto trunc; } - subtype = EXTRACT_U_1(tptr); + subtype = GET_U_1(tptr); ND_PRINT("\n\t Subtype %s (%u): ", tok2str(lldp_port_subtype_values, "Unknown", subtype), subtype); @@ -1562,7 +1566,7 @@ lldp_print(netdissect_options *ndo, if (tlv_len < 2) { goto trunc; } - ND_PRINT(": TTL %us", EXTRACT_BE_U_2(tptr)); + ND_PRINT(": TTL %us", GET_BE_U_2(tptr)); } break; @@ -1600,8 +1604,8 @@ lldp_print(netdissect_options *ndo, if (tlv_len < 4) { goto trunc; } - cap = EXTRACT_BE_U_2(tptr); - ena_cap = EXTRACT_BE_U_2(tptr + 2); + cap = GET_BE_U_2(tptr); + ena_cap = GET_BE_U_2(tptr + 2); ND_PRINT("\n\t System Capabilities [%s] (0x%04x)", bittok2str(lldp_cap_values, "none", cap), cap); ND_PRINT("\n\t Enabled Capabilities [%s] (0x%04x)", @@ -1622,7 +1626,7 @@ lldp_print(netdissect_options *ndo, if (tlv_len < 3) { goto trunc; } - oui = EXTRACT_BE_U_3(tptr); + oui = GET_BE_U_3(tptr); ND_PRINT(": OUI %s (0x%06x)", tok2str(oui_values, "Unknown", oui), oui); switch (oui) { diff --git a/print-lmp.c b/print-lmp.c index 4999e786..1e2d4b98 100644 --- a/print-lmp.c +++ b/print-lmp.c @@ -368,8 +368,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_U_1(obj_tptr + offset); - subobj_len = EXTRACT_U_1(obj_tptr + offset + 1); + subobj_type = GET_U_1(obj_tptr + offset); + subobj_len = GET_U_1(obj_tptr + offset + 1); ND_PRINT("\n\t Subobject, Type: %s (%u), Length: %u", tok2str(lmp_data_link_subobj, "Unknown", @@ -393,23 +393,23 @@ lmp_print_data_link_subobjs(netdissect_options *ndo, const u_char *obj_tptr, ND_PRINT("\n\t Switching Type: %s (%u)", tok2str(gmpls_switch_cap_values, "Unknown", - EXTRACT_U_1(obj_tptr + offset + 2)), - EXTRACT_U_1(obj_tptr + offset + 2)); + GET_U_1(obj_tptr + offset + 2)), + GET_U_1(obj_tptr + offset + 2)); ND_PRINT("\n\t Encoding Type: %s (%u)", tok2str(gmpls_encoding_values, "Unknown", - EXTRACT_U_1(obj_tptr + offset + 3)), - EXTRACT_U_1(obj_tptr + offset + 3)); - bw.i = EXTRACT_BE_U_4(obj_tptr + offset + 4); + GET_U_1(obj_tptr + offset + 3)), + GET_U_1(obj_tptr + offset + 3)); + bw.i = GET_BE_U_4(obj_tptr + offset + 4); ND_PRINT("\n\t Min Reservable Bandwidth: %.3f Mbps", bw.f*8/1000000); - bw.i = EXTRACT_BE_U_4(obj_tptr + offset + 8); + bw.i = GET_BE_U_4(obj_tptr + offset + 8); ND_PRINT("\n\t Max Reservable Bandwidth: %.3f Mbps", bw.f*8/1000000); break; case WAVELENGTH_SUBOBJ: ND_PRINT("\n\t Wavelength: %u", - EXTRACT_BE_U_4(obj_tptr + offset + 4)); + GET_BE_U_4(obj_tptr + offset + 4)); break; default: /* Any Unknown Subobject ==> Exit loop */ @@ -444,7 +444,7 @@ lmp_print(netdissect_options *ndo, lmp_com_header = (const struct lmp_common_header *)pptr; ND_TCHECK_SIZE(lmp_com_header); - version_res = EXTRACT_BE_U_2(lmp_com_header->version_res); + version_res = GET_BE_U_2(lmp_com_header->version_res); /* * Sanity checking of the header. @@ -459,19 +459,19 @@ lmp_print(netdissect_options *ndo, if (ndo->ndo_vflag < 1) { ND_PRINT("LMPv%u %s Message, length: %u", LMP_EXTRACT_VERSION(version_res), - tok2str(lmp_msg_type_values, "unknown (%u)",EXTRACT_U_1(lmp_com_header->msg_type)), + tok2str(lmp_msg_type_values, "unknown (%u)",GET_U_1(lmp_com_header->msg_type)), length); return; } /* ok they seem to want to know everything - lets fully decode it */ - tlen=EXTRACT_BE_U_2(lmp_com_header->length); + tlen=GET_BE_U_2(lmp_com_header->length); ND_PRINT("\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u", LMP_EXTRACT_VERSION(version_res), - tok2str(lmp_msg_type_values, "unknown, type: %u",EXTRACT_U_1(lmp_com_header->msg_type)), - bittok2str(lmp_header_flag_values,"none",EXTRACT_U_1(lmp_com_header->flags)), + tok2str(lmp_msg_type_values, "unknown, type: %u",GET_U_1(lmp_com_header->msg_type)), + bittok2str(lmp_header_flag_values,"none",GET_U_1(lmp_com_header->flags)), tlen); if (tlen < sizeof(struct lmp_common_header)) { ND_PRINT(" (too short)"); @@ -490,19 +490,19 @@ lmp_print(netdissect_options *ndo, ND_TCHECK_LEN(tptr, sizeof(struct lmp_object_header)); lmp_obj_header = (const struct lmp_object_header *)tptr; - lmp_obj_len=EXTRACT_BE_U_2(lmp_obj_header->length); - lmp_obj_ctype=EXTRACT_U_1(lmp_obj_header->ctype)&0x7f; + lmp_obj_len=GET_BE_U_2(lmp_obj_header->length); + lmp_obj_ctype=GET_U_1(lmp_obj_header->ctype)&0x7f; ND_PRINT("\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u", tok2str(lmp_obj_values, "Unknown", - EXTRACT_U_1(lmp_obj_header->class_num)), - EXTRACT_U_1(lmp_obj_header->class_num), + GET_U_1(lmp_obj_header->class_num)), + GET_U_1(lmp_obj_header->class_num), tok2str(lmp_ctype_values, "Unknown", - (EXTRACT_U_1(lmp_obj_header->class_num)<<8)+lmp_obj_ctype), + (GET_U_1(lmp_obj_header->class_num)<<8)+lmp_obj_ctype), lmp_obj_ctype, - EXTRACT_U_1(lmp_obj_header->ctype)&0x80 ? "" : "non-", + GET_U_1(lmp_obj_header->ctype)&0x80 ? "" : "non-", lmp_obj_len); if (lmp_obj_len < 4) { @@ -521,7 +521,7 @@ lmp_print(netdissect_options *ndo, ND_TCHECK_LEN(tptr, lmp_obj_len); hexdump=FALSE; - switch(EXTRACT_U_1(lmp_obj_header->class_num)) { + switch(GET_U_1(lmp_obj_header->class_num)) { case LMP_OBJ_CC_ID: switch(lmp_obj_ctype) { @@ -532,8 +532,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT("\n\t Control Channel ID: %u (0x%08x)", - EXTRACT_BE_U_4(obj_tptr), - EXTRACT_BE_U_4(obj_tptr)); + GET_BE_U_4(obj_tptr), + GET_BE_U_4(obj_tptr)); break; default: @@ -552,7 +552,7 @@ lmp_print(netdissect_options *ndo, } ND_PRINT("\n\t IPv4 Link ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr), - EXTRACT_BE_U_4(obj_tptr)); + GET_BE_U_4(obj_tptr)); break; case LMP_CTYPE_IPV6_LOC: case LMP_CTYPE_IPV6_RMT: @@ -562,7 +562,7 @@ lmp_print(netdissect_options *ndo, } ND_PRINT("\n\t IPv6 Link ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr), - EXTRACT_BE_U_4(obj_tptr)); + GET_BE_U_4(obj_tptr)); break; case LMP_CTYPE_UNMD_LOC: case LMP_CTYPE_UNMD_RMT: @@ -571,8 +571,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT("\n\t Link ID: %u (0x%08x)", - EXTRACT_BE_U_4(obj_tptr), - EXTRACT_BE_U_4(obj_tptr)); + GET_BE_U_4(obj_tptr), + GET_BE_U_4(obj_tptr)); break; default: hexdump=TRUE; @@ -587,8 +587,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT("\n\t Message ID: %u (0x%08x)", - EXTRACT_BE_U_4(obj_tptr), - EXTRACT_BE_U_4(obj_tptr)); + GET_BE_U_4(obj_tptr), + GET_BE_U_4(obj_tptr)); break; case LMP_CTYPE_2: if (obj_tlen != 4) { @@ -596,8 +596,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT("\n\t Message ID Ack: %u (0x%08x)", - EXTRACT_BE_U_4(obj_tptr), - EXTRACT_BE_U_4(obj_tptr)); + GET_BE_U_4(obj_tptr), + GET_BE_U_4(obj_tptr)); break; default: hexdump=TRUE; @@ -614,7 +614,7 @@ lmp_print(netdissect_options *ndo, } ND_PRINT("\n\t Node ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr), - EXTRACT_BE_U_4(obj_tptr)); + GET_BE_U_4(obj_tptr)); break; default: @@ -630,8 +630,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT("\n\t Hello Interval: %u\n\t Hello Dead Interval: %u", - EXTRACT_BE_U_2(obj_tptr), - EXTRACT_BE_U_2(obj_tptr + 2)); + GET_BE_U_2(obj_tptr), + GET_BE_U_2(obj_tptr + 2)); break; default: @@ -647,8 +647,8 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT("\n\t Tx Seq: %u, Rx Seq: %u", - EXTRACT_BE_U_4(obj_tptr), - EXTRACT_BE_U_4(obj_tptr + 4)); + GET_BE_U_4(obj_tptr), + GET_BE_U_4(obj_tptr + 4)); break; default: @@ -666,14 +666,14 @@ lmp_print(netdissect_options *ndo, ND_PRINT("\n\t Flags: [%s]", bittok2str(lmp_obj_te_link_flag_values, "none", - EXTRACT_U_1(obj_tptr))); + GET_U_1(obj_tptr))); ND_PRINT("\n\t Local Link-ID: %s (0x%08x)" "\n\t Remote Link-ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+4), - EXTRACT_BE_U_4(obj_tptr + 4), + GET_BE_U_4(obj_tptr + 4), ipaddr_string(ndo, obj_tptr+8), - EXTRACT_BE_U_4(obj_tptr + 8)); + GET_BE_U_4(obj_tptr + 8)); break; case LMP_CTYPE_IPV6: @@ -684,14 +684,14 @@ lmp_print(netdissect_options *ndo, ND_PRINT("\n\t Flags: [%s]", bittok2str(lmp_obj_te_link_flag_values, "none", - EXTRACT_U_1(obj_tptr))); + GET_U_1(obj_tptr))); ND_PRINT("\n\t Local Link-ID: %s (0x%08x)" "\n\t Remote Link-ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr+4), - EXTRACT_BE_U_4(obj_tptr + 4), + GET_BE_U_4(obj_tptr + 4), ip6addr_string(ndo, obj_tptr+20), - EXTRACT_BE_U_4(obj_tptr + 20)); + GET_BE_U_4(obj_tptr + 20)); break; case LMP_CTYPE_UNMD: @@ -702,14 +702,14 @@ lmp_print(netdissect_options *ndo, ND_PRINT("\n\t Flags: [%s]", bittok2str(lmp_obj_te_link_flag_values, "none", - EXTRACT_U_1(obj_tptr))); + GET_U_1(obj_tptr))); ND_PRINT("\n\t Local Link-ID: %u (0x%08x)" "\n\t Remote Link-ID: %u (0x%08x)", - 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)); + GET_BE_U_4(obj_tptr + 4), + GET_BE_U_4(obj_tptr + 4), + GET_BE_U_4(obj_tptr + 8), + GET_BE_U_4(obj_tptr + 8)); break; default: @@ -727,13 +727,13 @@ lmp_print(netdissect_options *ndo, ND_PRINT("\n\t Flags: [%s]", bittok2str(lmp_obj_data_link_flag_values, "none", - EXTRACT_U_1(obj_tptr))); + GET_U_1(obj_tptr))); ND_PRINT("\n\t Local Interface ID: %s (0x%08x)" "\n\t Remote Interface ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+4), - EXTRACT_BE_U_4(obj_tptr + 4), + GET_BE_U_4(obj_tptr + 4), ipaddr_string(ndo, obj_tptr+8), - EXTRACT_BE_U_4(obj_tptr + 8)); + GET_BE_U_4(obj_tptr + 8)); if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12)) hexdump=TRUE; @@ -747,13 +747,13 @@ lmp_print(netdissect_options *ndo, ND_PRINT("\n\t Flags: [%s]", bittok2str(lmp_obj_data_link_flag_values, "none", - EXTRACT_U_1(obj_tptr))); + GET_U_1(obj_tptr))); ND_PRINT("\n\t Local Interface ID: %s (0x%08x)" "\n\t Remote Interface ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr+4), - EXTRACT_BE_U_4(obj_tptr + 4), + GET_BE_U_4(obj_tptr + 4), ip6addr_string(ndo, obj_tptr+20), - EXTRACT_BE_U_4(obj_tptr + 20)); + GET_BE_U_4(obj_tptr + 20)); if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 36, 36)) hexdump=TRUE; @@ -767,13 +767,13 @@ lmp_print(netdissect_options *ndo, ND_PRINT("\n\t Flags: [%s]", bittok2str(lmp_obj_data_link_flag_values, "none", - EXTRACT_U_1(obj_tptr))); + GET_U_1(obj_tptr))); ND_PRINT("\n\t Local Interface ID: %u (0x%08x)" "\n\t Remote Interface ID: %u (0x%08x)", - 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)); + GET_BE_U_4(obj_tptr + 4), + GET_BE_U_4(obj_tptr + 4), + GET_BE_U_4(obj_tptr + 8), + GET_BE_U_4(obj_tptr + 8)); if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12)) hexdump=TRUE; @@ -794,21 +794,21 @@ lmp_print(netdissect_options *ndo, ND_PRINT("\n\t Flags: %s", bittok2str(lmp_obj_begin_verify_flag_values, "none", - EXTRACT_BE_U_2(obj_tptr))); + GET_BE_U_2(obj_tptr))); ND_PRINT("\n\t Verify Interval: %u", - EXTRACT_BE_U_2(obj_tptr + 2)); + GET_BE_U_2(obj_tptr + 2)); ND_PRINT("\n\t Data links: %u", - EXTRACT_BE_U_4(obj_tptr + 4)); + GET_BE_U_4(obj_tptr + 4)); ND_PRINT("\n\t Encoding type: %s", - tok2str(gmpls_encoding_values, "Unknown", EXTRACT_U_1((obj_tptr + 8)))); + tok2str(gmpls_encoding_values, "Unknown", GET_U_1((obj_tptr + 8)))); ND_PRINT("\n\t Verify Transport Mechanism: %u (0x%x)%s", - 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); + GET_BE_U_2(obj_tptr + 10), + GET_BE_U_2(obj_tptr + 10), + GET_BE_U_2(obj_tptr + 10)&8000 ? " (Payload test messages capable)" : ""); + bw.i = GET_BE_U_4(obj_tptr + 12); ND_PRINT("\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000); ND_PRINT("\n\t Wavelength: %u", - EXTRACT_BE_U_4(obj_tptr + 16)); + GET_BE_U_4(obj_tptr + 16)); break; default: @@ -825,8 +825,8 @@ lmp_print(netdissect_options *ndo, } ND_PRINT("\n\t Verify Dead Interval: %u" "\n\t Verify Transport Response: %u", - EXTRACT_BE_U_2(obj_tptr), - EXTRACT_BE_U_2(obj_tptr + 2)); + GET_BE_U_2(obj_tptr), + GET_BE_U_2(obj_tptr + 2)); break; default: @@ -842,7 +842,7 @@ lmp_print(netdissect_options *ndo, break; } ND_PRINT("\n\t Verify ID: %u", - EXTRACT_BE_U_4(obj_tptr)); + GET_BE_U_4(obj_tptr)); break; default: @@ -858,23 +858,23 @@ lmp_print(netdissect_options *ndo, while (offset+8 <= obj_tlen) { ND_PRINT("\n\t Interface ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+offset), - EXTRACT_BE_U_4(obj_tptr + offset)); + GET_BE_U_4(obj_tptr + offset)); ND_PRINT("\n\t\t Active: %s (%u)", - (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31) ? + (GET_BE_U_4(obj_tptr + offset + 4)>>31) ? "Allocated" : "Non-allocated", - (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31)); + (GET_BE_U_4(obj_tptr + offset + 4)>>31)); ND_PRINT("\n\t\t Direction: %s (%u)", - (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ? + (GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ? "Transmit" : "Receive", - (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1); + (GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1); ND_PRINT("\n\t\t Channel Status: %s (%u)", tok2str(lmp_obj_channel_status_values, "Unknown", - EXTRACT_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF), - EXTRACT_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF); + GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF), + GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF); offset+=8; } break; @@ -885,23 +885,23 @@ lmp_print(netdissect_options *ndo, while (offset+20 <= obj_tlen) { ND_PRINT("\n\t Interface ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr+offset), - EXTRACT_BE_U_4(obj_tptr + offset)); + GET_BE_U_4(obj_tptr + offset)); ND_PRINT("\n\t\t Active: %s (%u)", - (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>31) ? + (GET_BE_U_4(obj_tptr + offset + 16)>>31) ? "Allocated" : "Non-allocated", - (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>31)); + (GET_BE_U_4(obj_tptr + offset + 16)>>31)); ND_PRINT("\n\t\t Direction: %s (%u)", - (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>30)&0x1 ? + (GET_BE_U_4(obj_tptr + offset + 16)>>30)&0x1 ? "Transmit" : "Receive", - (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>30)&0x1); + (GET_BE_U_4(obj_tptr + offset + 16)>>30)&0x1); ND_PRINT("\n\t\t Channel Status: %s (%u)", tok2str(lmp_obj_channel_status_values, "Unknown", - EXTRACT_BE_U_4(obj_tptr + offset + 16)&0x3FFFFFF), - EXTRACT_BE_U_4(obj_tptr + offset + 16)&0x3FFFFFF); + GET_BE_U_4(obj_tptr + offset + 16)&0x3FFFFFF), + GET_BE_U_4(obj_tptr + offset + 16)&0x3FFFFFF); offset+=20; } break; @@ -911,24 +911,24 @@ lmp_print(netdissect_options *ndo, /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */ while (offset+8 <= obj_tlen) { ND_PRINT("\n\t Interface ID: %u (0x%08x)", - EXTRACT_BE_U_4(obj_tptr + offset), - EXTRACT_BE_U_4(obj_tptr + offset)); + GET_BE_U_4(obj_tptr + offset), + GET_BE_U_4(obj_tptr + offset)); ND_PRINT("\n\t\t Active: %s (%u)", - (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31) ? + (GET_BE_U_4(obj_tptr + offset + 4)>>31) ? "Allocated" : "Non-allocated", - (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31)); + (GET_BE_U_4(obj_tptr + offset + 4)>>31)); ND_PRINT("\n\t\t Direction: %s (%u)", - (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ? + (GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ? "Transmit" : "Receive", - (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1); + (GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1); ND_PRINT("\n\t\t Channel Status: %s (%u)", tok2str(lmp_obj_channel_status_values, "Unknown", - EXTRACT_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF), - EXTRACT_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF); + GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF), + GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF); offset+=8; } break; @@ -945,7 +945,7 @@ lmp_print(netdissect_options *ndo, while (offset+4 <= obj_tlen) { ND_PRINT("\n\t Interface ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+offset), - EXTRACT_BE_U_4(obj_tptr + offset)); + GET_BE_U_4(obj_tptr + offset)); offset+=4; } break; @@ -955,7 +955,7 @@ lmp_print(netdissect_options *ndo, while (offset+16 <= obj_tlen) { ND_PRINT("\n\t Interface ID: %s (0x%08x)", ip6addr_string(ndo, obj_tptr+offset), - EXTRACT_BE_U_4(obj_tptr + offset)); + GET_BE_U_4(obj_tptr + offset)); offset+=16; } break; @@ -964,8 +964,8 @@ lmp_print(netdissect_options *ndo, offset = 0; while (offset+4 <= obj_tlen) { ND_PRINT("\n\t Interface ID: %u (0x%08x)", - EXTRACT_BE_U_4(obj_tptr + offset), - EXTRACT_BE_U_4(obj_tptr + offset)); + GET_BE_U_4(obj_tptr + offset), + GET_BE_U_4(obj_tptr + offset)); offset+=4; } break; @@ -985,7 +985,7 @@ lmp_print(netdissect_options *ndo, ND_PRINT("\n\t Error Code: %s", bittok2str(lmp_obj_begin_verify_error_values, "none", - EXTRACT_BE_U_4(obj_tptr))); + GET_BE_U_4(obj_tptr))); break; case LMP_CTYPE_LINK_SUMMARY_ERROR: @@ -996,7 +996,7 @@ lmp_print(netdissect_options *ndo, ND_PRINT("\n\t Error Code: %s", bittok2str(lmp_obj_link_summary_error_values, "none", - EXTRACT_BE_U_4(obj_tptr))); + GET_BE_U_4(obj_tptr))); break; default: hexdump=TRUE; @@ -1013,10 +1013,10 @@ lmp_print(netdissect_options *ndo, ND_PRINT("\n\t Flags: %s", bittok2str(lmp_obj_service_config_sp_flag_values, "none", - EXTRACT_U_1(obj_tptr))); + GET_U_1(obj_tptr))); ND_PRINT("\n\t UNI Version: %u", - EXTRACT_U_1(obj_tptr + 1)); + GET_U_1(obj_tptr + 1)); break; @@ -1026,7 +1026,7 @@ lmp_print(netdissect_options *ndo, break; } - link_type = EXTRACT_U_1(obj_tptr); + link_type = GET_U_1(obj_tptr); ND_PRINT("\n\t Link Type: %s (%u)", tok2str(lmp_sd_service_config_cpsa_link_type_values, @@ -1038,44 +1038,44 @@ lmp_print(netdissect_options *ndo, ND_PRINT("\n\t Signal Type: %s (%u)", tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values, "Unknown", - EXTRACT_U_1(obj_tptr + 1)), - EXTRACT_U_1(obj_tptr + 1)); + GET_U_1(obj_tptr + 1)), + GET_U_1(obj_tptr + 1)); break; case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET: ND_PRINT("\n\t Signal Type: %s (%u)", tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values, "Unknown", - EXTRACT_U_1(obj_tptr + 1)), - EXTRACT_U_1(obj_tptr + 1)); + GET_U_1(obj_tptr + 1)), + GET_U_1(obj_tptr + 1)); break; } ND_PRINT("\n\t Transparency: %s", bittok2str(lmp_obj_service_config_cpsa_tp_flag_values, "none", - EXTRACT_U_1(obj_tptr + 2))); + GET_U_1(obj_tptr + 2))); ND_PRINT("\n\t Contiguous Concatenation Types: %s", bittok2str(lmp_obj_service_config_cpsa_cct_flag_values, "none", - EXTRACT_U_1(obj_tptr + 3))); + GET_U_1(obj_tptr + 3))); ND_PRINT("\n\t Minimum NCC: %u", - EXTRACT_BE_U_2(obj_tptr + 4)); + GET_BE_U_2(obj_tptr + 4)); ND_PRINT("\n\t Maximum NCC: %u", - EXTRACT_BE_U_2(obj_tptr + 6)); + GET_BE_U_2(obj_tptr + 6)); ND_PRINT("\n\t Minimum NVC:%u", - EXTRACT_BE_U_2(obj_tptr + 8)); + GET_BE_U_2(obj_tptr + 8)); ND_PRINT("\n\t Maximum NVC:%u", - EXTRACT_BE_U_2(obj_tptr + 10)); + GET_BE_U_2(obj_tptr + 10)); ND_PRINT("\n\t Local Interface ID: %s (0x%08x)", ipaddr_string(ndo, obj_tptr+12), - EXTRACT_BE_U_4(obj_tptr + 12)); + GET_BE_U_4(obj_tptr + 12)); break; @@ -1089,13 +1089,13 @@ lmp_print(netdissect_options *ndo, bittok2str( lmp_obj_service_config_nsa_transparency_flag_values, "none", - EXTRACT_BE_U_4(obj_tptr))); + GET_BE_U_4(obj_tptr))); ND_PRINT("\n\t TCM Monitoring Flags: %s", bittok2str( lmp_obj_service_config_nsa_tcm_flag_values, "none", - EXTRACT_U_1(obj_tptr + 7))); + GET_U_1(obj_tptr + 7))); break; @@ -1109,7 +1109,7 @@ lmp_print(netdissect_options *ndo, bittok2str( lmp_obj_service_config_nsa_network_diversity_flag_values, "none", - EXTRACT_U_1(obj_tptr + 3))); + GET_U_1(obj_tptr + 3))); break; default: diff --git a/print-loopback.c b/print-loopback.c index ea7d7280..a18bde2c 100644 --- a/print-loopback.c +++ b/print-loopback.c @@ -62,7 +62,7 @@ loopback_message_print(netdissect_options *ndo, const u_char *cp, const u_int le goto invalid; /* function */ ND_TCHECK_2(cp); - function = EXTRACT_LE_U_2(cp); + function = GET_LE_U_2(cp); cp += 2; ND_PRINT(", %s", tok2str(fcode_str, " invalid (%u)", function)); @@ -72,7 +72,7 @@ loopback_message_print(netdissect_options *ndo, const u_char *cp, const u_int le goto invalid; /* receipt number */ ND_TCHECK_2(cp); - ND_PRINT(", receipt number %u", EXTRACT_LE_U_2(cp)); + ND_PRINT(", receipt number %u", GET_LE_U_2(cp)); cp += 2; /* data */ ND_PRINT(", data (%u octets)", len - 4); @@ -115,7 +115,7 @@ loopback_print(netdissect_options *ndo, const u_char *cp, const u_int len) goto invalid; /* skipCount */ ND_TCHECK_2(cp); - skipCount = EXTRACT_LE_U_2(cp); + skipCount = GET_LE_U_2(cp); cp += 2; ND_PRINT(", skipCount %u", skipCount); if (skipCount % 8) diff --git a/print-lspping.c b/print-lspping.c index 077f07b1..cf2abb2b 100644 --- a/print-lspping.c +++ b/print-lspping.c @@ -534,18 +534,18 @@ lspping_print(netdissect_options *ndo, /* * Sanity checking of the header. */ - if (EXTRACT_BE_U_2(lspping_com_header->version) != LSPPING_VERSION) { + if (GET_BE_U_2(lspping_com_header->version) != LSPPING_VERSION) { ND_PRINT("LSP-PING version %u packet not supported", - EXTRACT_BE_U_2(lspping_com_header->version)); + GET_BE_U_2(lspping_com_header->version)); return; } /* in non-verbose mode just lets print the basic Message Type*/ if (ndo->ndo_vflag < 1) { ND_PRINT("LSP-PINGv%u, %s, seq %u, length: %u", - EXTRACT_BE_U_2(lspping_com_header->version), - tok2str(lspping_msg_type_values, "unknown (%u)",EXTRACT_U_1(lspping_com_header->msg_type)), - EXTRACT_BE_U_4(lspping_com_header->seq_number), + GET_BE_U_2(lspping_com_header->version), + tok2str(lspping_msg_type_values, "unknown (%u)",GET_U_1(lspping_com_header->msg_type)), + GET_BE_U_4(lspping_com_header->seq_number), len); return; } @@ -555,19 +555,19 @@ lspping_print(netdissect_options *ndo, tlen=len; ND_PRINT("\n\tLSP-PINGv%u, msg-type: %s (%u), length: %u\n\t reply-mode: %s (%u)", - EXTRACT_BE_U_2(lspping_com_header->version), - tok2str(lspping_msg_type_values, "unknown",EXTRACT_U_1(lspping_com_header->msg_type)), - EXTRACT_U_1(lspping_com_header->msg_type), + GET_BE_U_2(lspping_com_header->version), + tok2str(lspping_msg_type_values, "unknown",GET_U_1(lspping_com_header->msg_type)), + GET_U_1(lspping_com_header->msg_type), len, - tok2str(lspping_reply_mode_values, "unknown",EXTRACT_U_1(lspping_com_header->reply_mode)), - EXTRACT_U_1(lspping_com_header->reply_mode)); + tok2str(lspping_reply_mode_values, "unknown",GET_U_1(lspping_com_header->reply_mode)), + GET_U_1(lspping_com_header->reply_mode)); /* * the following return codes require that the subcode is attached * at the end of the translated token output */ - return_code = EXTRACT_U_1(lspping_com_header->return_code); - return_subcode = EXTRACT_U_1(lspping_com_header->return_subcode); + return_code = GET_U_1(lspping_com_header->return_code); + return_subcode = GET_U_1(lspping_com_header->return_subcode); if (return_code == 3 || return_code == 4 || return_code == 8 || @@ -586,16 +586,16 @@ lspping_print(netdissect_options *ndo, return_subcode); ND_PRINT("\n\t Sender Handle: 0x%08x, Sequence: %u", - EXTRACT_BE_U_4(lspping_com_header->sender_handle), - EXTRACT_BE_U_4(lspping_com_header->seq_number)); + GET_BE_U_4(lspping_com_header->sender_handle), + GET_BE_U_4(lspping_com_header->seq_number)); - 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); + timestamp.tv_sec=GET_BE_U_4(lspping_com_header->ts_sent_sec); + timestamp.tv_usec=GET_BE_U_4(lspping_com_header->ts_sent_usec); ND_PRINT("\n\t Sender Timestamp: "); ts_print(ndo, ×tamp); - 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); + timestamp.tv_sec=GET_BE_U_4(lspping_com_header->ts_rcvd_sec); + timestamp.tv_usec=GET_BE_U_4(lspping_com_header->ts_rcvd_usec); ND_PRINT("Receiver Timestamp: "); if ((timestamp.tv_sec != 0) && (timestamp.tv_usec != 0)) ts_print(ndo, ×tamp); @@ -614,8 +614,8 @@ lspping_print(netdissect_options *ndo, ND_TCHECK_LEN(tptr, sizeof(struct lspping_tlv_header)); lspping_tlv_header = (const struct lspping_tlv_header *)tptr; - lspping_tlv_type=EXTRACT_BE_U_2(lspping_tlv_header->type); - lspping_tlv_len=EXTRACT_BE_U_2(lspping_tlv_header->length); + lspping_tlv_type=GET_BE_U_2(lspping_tlv_header->type); + lspping_tlv_len=GET_BE_U_2(lspping_tlv_header->length); ND_PRINT("\n\t %s TLV (%u), length: %u", tok2str(lspping_tlv_values, @@ -655,8 +655,8 @@ lspping_print(netdissect_options *ndo, subtlv_hexdump=FALSE; lspping_subtlv_header = (const struct lspping_tlv_header *)tlv_tptr; - lspping_subtlv_type=EXTRACT_BE_U_2(lspping_subtlv_header->type); - lspping_subtlv_len=EXTRACT_BE_U_2(lspping_subtlv_header->length); + lspping_subtlv_type=GET_BE_U_2(lspping_subtlv_header->type); + lspping_subtlv_len=GET_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? */ @@ -688,7 +688,7 @@ lspping_print(netdissect_options *ndo, (const struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t *)subtlv_tptr; ND_PRINT("\n\t %s/%u", ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix), - EXTRACT_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix_len)); + GET_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix_len)); } break; @@ -702,7 +702,7 @@ lspping_print(netdissect_options *ndo, (const struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t *)subtlv_tptr; ND_PRINT("\n\t %s/%u", ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix), - EXTRACT_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix_len)); + GET_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix_len)); } break; @@ -716,7 +716,7 @@ lspping_print(netdissect_options *ndo, (const struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t *)subtlv_tptr; ND_PRINT("\n\t %s/%u", ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix), - EXTRACT_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix_len)); + GET_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix_len)); } break; @@ -730,7 +730,7 @@ lspping_print(netdissect_options *ndo, (const struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t *)subtlv_tptr; ND_PRINT("\n\t %s/%u", ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix), - EXTRACT_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix_len)); + GET_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix_len)); } break; @@ -746,8 +746,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_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), + GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->lsp_id), + GET_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; @@ -764,8 +764,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_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), + GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->lsp_id), + GET_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; @@ -781,7 +781,7 @@ lspping_print(netdissect_options *ndo, ND_PRINT("\n\t RD: %s, %s/%u", bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->rd), ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix), - EXTRACT_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix_len)); + GET_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix_len)); } break; @@ -796,7 +796,7 @@ lspping_print(netdissect_options *ndo, ND_PRINT("\n\t RD: %s, %s/%u", bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->rd), ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix), - EXTRACT_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix_len)); + GET_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix_len)); } break; @@ -811,12 +811,12 @@ lspping_print(netdissect_options *ndo, ND_PRINT("\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_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), + GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->sender_ve_id), + GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->receiver_ve_id), tok2str(mpls_pw_types_values, "unknown", - 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)); + GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)), + GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)); } break; @@ -832,11 +832,11 @@ lspping_print(netdissect_options *ndo, ND_PRINT("\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_U_4(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_id), + GET_BE_U_4(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_id), tok2str(mpls_pw_types_values, "unknown", - 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)); + GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type)), + GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type)); } break; @@ -852,11 +852,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_U_4(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_id), + GET_BE_U_4(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_id), tok2str(mpls_pw_types_values, "unknown", - 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)); + GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type)), + GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type)); } break; @@ -902,9 +902,9 @@ lspping_print(netdissect_options *ndo, * we do not know if its IPv4 or IPv6 or is unnumbered; after * we find the address-type, we recast the tlv_tptr and move on. */ - address_type = EXTRACT_U_1(tlv_ptr.lspping_tlv_downstream_map->address_type); + address_type = GET_U_1(tlv_ptr.lspping_tlv_downstream_map->address_type); ND_PRINT("\n\t MTU: %u, Address-Type: %s (%u)", - EXTRACT_BE_U_2(tlv_ptr.lspping_tlv_downstream_map->mtu), + GET_BE_U_2(tlv_ptr.lspping_tlv_downstream_map->mtu), tok2str(lspping_tlv_downstream_addr_values, "unknown", address_type), @@ -948,7 +948,7 @@ lspping_print(netdissect_options *ndo, ND_PRINT("\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_U_4(tlv_ptr.lspping_tlv_downstream_map_ipv4_unmb->downstream_interface)); + GET_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; @@ -988,7 +988,7 @@ lspping_print(netdissect_options *ndo, ND_PRINT("\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_U_4(tlv_ptr.lspping_tlv_downstream_map_ipv6_unmb->downstream_interface)); + GET_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; @@ -1029,7 +1029,7 @@ lspping_print(netdissect_options *ndo, goto tlv_tooshort; } else { ND_TCHECK_LEN(tptr, LSPPING_TLV_BFD_DISCRIMINATOR_LEN); - ND_PRINT("\n\t BFD Discriminator 0x%08x", EXTRACT_BE_U_4(tptr)); + ND_PRINT("\n\t BFD Discriminator 0x%08x", GET_BE_U_4(tptr)); } break; @@ -1043,7 +1043,7 @@ lspping_print(netdissect_options *ndo, goto tlv_tooshort; } else { ND_TCHECK_LEN(tptr, LSPPING_TLV_VENDOR_ENTERPRISE_LEN); - vendor_id = EXTRACT_BE_U_4(tlv_tptr); + vendor_id = GET_BE_U_4(tlv_tptr); ND_PRINT("\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 f8ca6657..e1b2d94b 100644 --- a/print-lwapp.c +++ b/print-lwapp.c @@ -184,7 +184,7 @@ lwapp_control_print(netdissect_options *ndo, lwapp_trans_header = (const struct lwapp_transport_header *)pptr; } ND_TCHECK_SIZE(lwapp_trans_header); - version = EXTRACT_U_1(lwapp_trans_header->version); + version = GET_U_1(lwapp_trans_header->version); /* * Sanity checking of the header. @@ -206,14 +206,14 @@ lwapp_control_print(netdissect_options *ndo, } /* ok they seem to want to know everything - lets fully decode it */ - tlen=EXTRACT_BE_U_2(lwapp_trans_header->length); + tlen=GET_BE_U_2(lwapp_trans_header->length); ND_PRINT("LWAPPv%u, %s frame, Radio-id %u, Flags [%s], Frag-id %u, length %u", LWAPP_EXTRACT_VERSION(version), LWAPP_EXTRACT_CONTROL_BIT(version) ? "Control" : "Data", LWAPP_EXTRACT_RID(version), bittok2str(lwapp_header_bits_values,"none",version&0x07), - EXTRACT_U_1(lwapp_trans_header->frag_id), + GET_U_1(lwapp_trans_header->frag_id), tlen); if (has_ap_ident) { @@ -233,20 +233,20 @@ lwapp_control_print(netdissect_options *ndo, } lwapp_control_header = (const struct lwapp_control_header *)tptr; - msg_tlen = EXTRACT_BE_U_2(lwapp_control_header->len); + msg_tlen = GET_BE_U_2(lwapp_control_header->len); if (tlen < sizeof(struct lwapp_control_header) + msg_tlen) { ND_PRINT("\n\t Msg goes past end of PDU"); break; } /* print message header */ - msg_type = EXTRACT_U_1(lwapp_control_header->msg_type); + msg_type = GET_U_1(lwapp_control_header->msg_type); ND_PRINT("\n\t Msg type: %s (%u), Seqnum: %u, Msg len: %u, Session: 0x%08x", tok2str(lwapp_msg_type_values,"Unknown",msg_type), msg_type, - EXTRACT_U_1(lwapp_control_header->seq_num), + GET_U_1(lwapp_control_header->seq_num), msg_tlen, - EXTRACT_BE_U_4(lwapp_control_header->session_id)); + GET_BE_U_4(lwapp_control_header->session_id)); /* did we capture enough for fully decoding the message */ ND_TCHECK_LEN(tptr, msg_tlen); @@ -313,7 +313,7 @@ lwapp_data_print(netdissect_options *ndo, ND_TCHECK_6(tptr); lwapp_trans_header = (const struct lwapp_transport_header *)pptr; ND_TCHECK_SIZE(lwapp_trans_header); - version = EXTRACT_U_1(lwapp_trans_header->version); + version = GET_U_1(lwapp_trans_header->version); /* * Sanity checking of the header. @@ -335,7 +335,7 @@ lwapp_data_print(netdissect_options *ndo, } /* ok they seem to want to know everything - lets fully decode it */ - tlen=EXTRACT_BE_U_2(lwapp_trans_header->length); + tlen=GET_BE_U_2(lwapp_trans_header->length); if (tlen < sizeof(struct lwapp_transport_header)) { ND_PRINT("LWAPPv%u, %s frame, Radio-id %u, Flags [%s], length %u < transport header length", LWAPP_EXTRACT_VERSION(version), @@ -351,7 +351,7 @@ lwapp_data_print(netdissect_options *ndo, LWAPP_EXTRACT_CONTROL_BIT(version) ? "Control" : "Data", LWAPP_EXTRACT_RID(version), bittok2str(lwapp_header_bits_values,"none",version&0x07), - EXTRACT_U_1(lwapp_trans_header->frag_id), + GET_U_1(lwapp_trans_header->frag_id), tlen); tptr+=sizeof(struct lwapp_transport_header); diff --git a/print-lwres.c b/print-lwres.c index 32024429..a8e83bf5 100644 --- a/print-lwres.c +++ b/print-lwres.c @@ -205,7 +205,7 @@ lwres_printname(netdissect_options *ndo, ND_PRINT(" "); for (i = 0; i < l; i++) { - fn_print_char(ndo, EXTRACT_U_1(p)); + fn_print_char(ndo, GET_U_1(p)); p++; } p++; /* skip terminating \0 */ @@ -225,7 +225,7 @@ lwres_printnamelen(netdissect_options *ndo, if (p + 2 > ndo->ndo_snapend) goto trunc; - l = EXTRACT_BE_U_2(p); + l = GET_BE_U_2(p); advance = lwres_printname(ndo, l, p + 2); if (advance < 0) goto trunc; @@ -246,12 +246,12 @@ lwres_printbinlen(netdissect_options *ndo, p = p0; if (p + 2 > ndo->ndo_snapend) goto trunc; - l = EXTRACT_BE_U_2(p); + l = GET_BE_U_2(p); if (p + 2 + l > ndo->ndo_snapend) goto trunc; p += 2; for (i = 0; i < l; i++) { - ND_PRINT("%02x", EXTRACT_U_1(p)); + ND_PRINT("%02x", GET_U_1(p)); p++; } return p - p0; @@ -272,11 +272,11 @@ lwres_printaddr(netdissect_options *ndo, p = p0; ap = (const lwres_addr_t *)p; ND_TCHECK_2(ap->length); - l = EXTRACT_BE_U_2(ap->length); + l = GET_BE_U_2(ap->length); p += LWRES_ADDR_LEN; ND_TCHECK_LEN(p, l); - switch (EXTRACT_BE_U_4(ap->family)) { + switch (GET_BE_U_4(ap->family)) { case 1: /* IPv4 */ if (l < 4) return -1; @@ -290,9 +290,9 @@ lwres_printaddr(netdissect_options *ndo, p += sizeof(nd_ipv6); break; default: - ND_PRINT(" %u/", EXTRACT_BE_U_4(ap->family)); + ND_PRINT(" %u/", GET_BE_U_4(ap->family)); for (i = 0; i < l; i++) { - ND_PRINT("%02x", EXTRACT_U_1(p)); + ND_PRINT("%02x", GET_U_1(p)); p++; } } @@ -320,34 +320,34 @@ lwres_print(netdissect_options *ndo, ND_TCHECK_2(np->authlength); ND_PRINT(" lwres"); - v = EXTRACT_BE_U_2(np->version); + v = GET_BE_U_2(np->version); if (ndo->ndo_vflag || v != LWRES_LWPACKETVERSION_0) ND_PRINT(" v%u", v); if (v != LWRES_LWPACKETVERSION_0) { - s = bp + EXTRACT_BE_U_4(np->length); + s = bp + GET_BE_U_4(np->length); goto tail; } - response = EXTRACT_BE_U_2(np->pktflags) & LWRES_LWPACKETFLAG_RESPONSE; + response = GET_BE_U_2(np->pktflags) & LWRES_LWPACKETFLAG_RESPONSE; /* opcode and pktflags */ - v = EXTRACT_BE_U_4(np->opcode); + v = GET_BE_U_4(np->opcode); ND_PRINT(" %s%s", tok2str(opcode, "#0x%x", v), response ? "" : "?"); /* pktflags */ - v = EXTRACT_BE_U_2(np->pktflags); + v = GET_BE_U_2(np->pktflags); if (v & ~LWRES_LWPACKETFLAG_RESPONSE) ND_PRINT("[0x%x]", v); if (ndo->ndo_vflag > 1) { ND_PRINT(" ("); /*)*/ - ND_PRINT("serial:0x%x", EXTRACT_BE_U_4(np->serial)); - ND_PRINT(" result:0x%x", EXTRACT_BE_U_4(np->result)); - ND_PRINT(" recvlen:%u", EXTRACT_BE_U_4(np->recvlength)); + ND_PRINT("serial:0x%x", GET_BE_U_4(np->serial)); + ND_PRINT(" result:0x%x", GET_BE_U_4(np->result)); + ND_PRINT(" recvlen:%u", GET_BE_U_4(np->recvlength)); /* BIND910: not used */ if (ndo->ndo_vflag > 2) { - ND_PRINT(" authtype:0x%x", EXTRACT_BE_U_2(np->authtype)); - ND_PRINT(" authlen:%u", EXTRACT_BE_U_2(np->authlength)); + ND_PRINT(" authtype:0x%x", GET_BE_U_2(np->authtype)); + ND_PRINT(" authlen:%u", GET_BE_U_2(np->authlength)); } /*(*/ ND_PRINT(")"); @@ -368,7 +368,7 @@ lwres_print(netdissect_options *ndo, grbn = NULL; p = (const u_char *)(np + 1); - switch (EXTRACT_BE_U_4(np->opcode)) { + switch (GET_BE_U_4(np->opcode)) { case LWRES_OPCODE_NOOP: s = p; break; @@ -379,10 +379,10 @@ lwres_print(netdissect_options *ndo, /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT(" flags:0x%x", - EXTRACT_BE_U_4(gabn->flags)); + GET_BE_U_4(gabn->flags)); } - v = EXTRACT_BE_U_4(gabn->addrtypes); + v = GET_BE_U_4(gabn->addrtypes); switch (v & (LWRES_ADDRTYPE_V4 | LWRES_ADDRTYPE_V6)) { case LWRES_ADDRTYPE_V4: ND_PRINT(" IPv4"); @@ -398,7 +398,7 @@ lwres_print(netdissect_options *ndo, ND_PRINT("[0x%x]", v); s = p + LWRES_GABNREQUEST_LEN; - l = EXTRACT_BE_U_2(gabn->namelen); + l = GET_BE_U_2(gabn->namelen); advance = lwres_printname(ndo, l, s); if (advance < 0) goto trunc; @@ -411,7 +411,7 @@ lwres_print(netdissect_options *ndo, /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT(" flags:0x%x", - EXTRACT_BE_U_4(gnba->flags)); + GET_BE_U_4(gnba->flags)); } s = p + LWRES_GNBAREQUEST_LEN; @@ -428,18 +428,18 @@ lwres_print(netdissect_options *ndo, /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT(" flags:0x%x", - EXTRACT_BE_U_4(grbn->flags)); + GET_BE_U_4(grbn->flags)); } ND_PRINT(" %s", tok2str(ns_type2str, "Type%u", - EXTRACT_BE_U_2(grbn->rdtype))); - if (EXTRACT_BE_U_2(grbn->rdclass) != C_IN) { + GET_BE_U_2(grbn->rdtype))); + if (GET_BE_U_2(grbn->rdclass) != C_IN) { ND_PRINT(" %s", tok2str(ns_class2str, "Class%u", - EXTRACT_BE_U_2(grbn->rdclass))); + GET_BE_U_2(grbn->rdclass))); } s = p + LWRES_GRBNREQUEST_LEN; - l = EXTRACT_BE_U_2(grbn->namelen); + l = GET_BE_U_2(grbn->namelen); advance = lwres_printname(ndo, l, s); if (advance < 0) goto trunc; @@ -465,7 +465,7 @@ lwres_print(netdissect_options *ndo, grbn = NULL; p = (const u_char *)(np + 1); - switch (EXTRACT_BE_U_4(np->opcode)) { + switch (GET_BE_U_4(np->opcode)) { case LWRES_OPCODE_NOOP: s = p; break; @@ -476,21 +476,21 @@ lwres_print(netdissect_options *ndo, /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT(" flags:0x%x", - EXTRACT_BE_U_4(gabn->flags)); + GET_BE_U_4(gabn->flags)); } - ND_PRINT(" %u/%u", EXTRACT_BE_U_2(gabn->naliases), - EXTRACT_BE_U_2(gabn->naddrs)); + ND_PRINT(" %u/%u", GET_BE_U_2(gabn->naliases), + GET_BE_U_2(gabn->naddrs)); s = p + LWRES_GABNRESPONSE_LEN; - l = EXTRACT_BE_U_2(gabn->realnamelen); + l = GET_BE_U_2(gabn->realnamelen); advance = lwres_printname(ndo, l, s); if (advance < 0) goto trunc; s += advance; /* aliases */ - na = EXTRACT_BE_U_2(gabn->naliases); + na = GET_BE_U_2(gabn->naliases); for (i = 0; i < na; i++) { advance = lwres_printnamelen(ndo, s); if (advance < 0) @@ -499,7 +499,7 @@ lwres_print(netdissect_options *ndo, } /* addrs */ - na = EXTRACT_BE_U_2(gabn->naddrs); + na = GET_BE_U_2(gabn->naddrs); for (i = 0; i < na; i++) { advance = lwres_printaddr(ndo, s); if (advance < 0) @@ -514,20 +514,20 @@ lwres_print(netdissect_options *ndo, /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT(" flags:0x%x", - EXTRACT_BE_U_4(gnba->flags)); + GET_BE_U_4(gnba->flags)); } - ND_PRINT(" %u", EXTRACT_BE_U_2(gnba->naliases)); + ND_PRINT(" %u", GET_BE_U_2(gnba->naliases)); s = p + LWRES_GNBARESPONSE_LEN; - l = EXTRACT_BE_U_2(gnba->realnamelen); + l = GET_BE_U_2(gnba->realnamelen); advance = lwres_printname(ndo, l, s); if (advance < 0) goto trunc; s += advance; /* aliases */ - na = EXTRACT_BE_U_2(gnba->naliases); + na = GET_BE_U_2(gnba->naliases); for (i = 0; i < na; i++) { advance = lwres_printnamelen(ndo, s); if (advance < 0) @@ -543,20 +543,20 @@ lwres_print(netdissect_options *ndo, /* BIND910: not used */ if (ndo->ndo_vflag > 2) { ND_PRINT(" flags:0x%x", - EXTRACT_BE_U_4(grbn->flags)); + GET_BE_U_4(grbn->flags)); } ND_PRINT(" %s", tok2str(ns_type2str, "Type%u", - EXTRACT_BE_U_2(grbn->rdtype))); - if (EXTRACT_BE_U_2(grbn->rdclass) != C_IN) { + GET_BE_U_2(grbn->rdtype))); + if (GET_BE_U_2(grbn->rdclass) != C_IN) { ND_PRINT(" %s", tok2str(ns_class2str, "Class%u", - EXTRACT_BE_U_2(grbn->rdclass))); + GET_BE_U_2(grbn->rdclass))); } ND_PRINT(" TTL "); unsigned_relts_print(ndo, - EXTRACT_BE_U_4(grbn->ttl)); - ND_PRINT(" %u/%u", EXTRACT_BE_U_2(grbn->nrdatas), - EXTRACT_BE_U_2(grbn->nsigs)); + GET_BE_U_4(grbn->ttl)); + ND_PRINT(" %u/%u", GET_BE_U_2(grbn->nrdatas), + GET_BE_U_2(grbn->nsigs)); s = p + LWRES_GRBNRESPONSE_LEN; advance = lwres_printnamelen(ndo, s); @@ -565,7 +565,7 @@ lwres_print(netdissect_options *ndo, s += advance; /* rdatas */ - na = EXTRACT_BE_U_2(grbn->nrdatas); + na = GET_BE_U_2(grbn->nrdatas); for (i = 0; i < na; i++) { /* XXX should decode resource data */ advance = lwres_printbinlen(ndo, s); @@ -575,7 +575,7 @@ lwres_print(netdissect_options *ndo, } /* sigs */ - na = EXTRACT_BE_U_2(grbn->nsigs); + na = GET_BE_U_2(grbn->nsigs); for (i = 0; i < na; i++) { /* XXX how should we print it? */ advance = lwres_printbinlen(ndo, s); @@ -593,11 +593,11 @@ lwres_print(netdissect_options *ndo, tail: /* length mismatch */ - if (EXTRACT_BE_U_4(np->length) != length) { - ND_PRINT(" [len: %u != %u]", EXTRACT_BE_U_4(np->length), + if (GET_BE_U_4(np->length) != length) { + ND_PRINT(" [len: %u != %u]", GET_BE_U_4(np->length), length); } - if (!unsupported && s < bp + EXTRACT_BE_U_4(np->length)) + if (!unsupported && s < bp + GET_BE_U_4(np->length)) ND_PRINT("[extra]"); return; diff --git a/print-m3ua.c b/print-m3ua.c index 7e2b0c8c..cd588fd0 100644 --- a/print-m3ua.c +++ b/print-m3ua.c @@ -219,7 +219,7 @@ tag_value_print(netdissect_options *ndo, if (size < 4) goto invalid; ND_TCHECK_LEN(buf, size); - ND_PRINT("0x%08x", EXTRACT_BE_U_4(buf)); + ND_PRINT("0x%08x", GET_BE_U_4(buf)); break; /* ... */ default: @@ -261,10 +261,10 @@ m3ua_tags_print(netdissect_options *ndo, goto invalid; ND_TCHECK_LEN(p, sizeof(struct m3ua_param_header)); /* Parameter Tag */ - hdr_tag = EXTRACT_BE_U_2(p); + hdr_tag = GET_BE_U_2(p); ND_PRINT("\n\t\t\t%s: ", tok2str(ParamName, "Unknown Parameter (0x%04x)", hdr_tag)); /* Parameter Length */ - hdr_len = EXTRACT_BE_U_2(p + 2); + hdr_len = GET_BE_U_2(p + 2); if (hdr_len < sizeof(struct m3ua_param_header)) goto invalid; /* Parameter Value */ @@ -308,10 +308,10 @@ m3ua_print(netdissect_options *ndo, if (size < sizeof(struct m3ua_common_header)) goto invalid; ND_TCHECK_SIZE(hdr); - if (EXTRACT_U_1(hdr->v) != M3UA_REL_1_0) + if (GET_U_1(hdr->v) != M3UA_REL_1_0) return; - msg_class = EXTRACT_U_1(hdr->msg_class); + msg_class = GET_U_1(hdr->msg_class); dict = msg_class == M3UA_MSGC_MGMT ? MgmtMessages : msg_class == M3UA_MSGC_TRANSFER ? TransferMessages : @@ -323,13 +323,15 @@ m3ua_print(netdissect_options *ndo, ND_PRINT("\n\t\t%s", tok2str(MessageClasses, "Unknown message class %i", msg_class)); if (dict != NULL) - ND_PRINT(" %s Message", tok2str(dict, "Unknown (0x%02x)", EXTRACT_U_1(hdr->msg_type))); + ND_PRINT(" %s Message", + tok2str(dict, "Unknown (0x%02x)", GET_U_1(hdr->msg_type))); - if (size != EXTRACT_BE_U_4(hdr->len)) - ND_PRINT("\n\t\t\t@@@@@@ Corrupted length %u of message @@@@@@", EXTRACT_BE_U_4(hdr->len)); + if (size != GET_BE_U_4(hdr->len)) + ND_PRINT("\n\t\t\t@@@@@@ Corrupted length %u of message @@@@@@", + GET_BE_U_4(hdr->len)); else m3ua_tags_print(ndo, buf + sizeof(struct m3ua_common_header), - EXTRACT_BE_U_4(hdr->len) - sizeof(struct m3ua_common_header)); + GET_BE_U_4(hdr->len) - sizeof(struct m3ua_common_header)); return; invalid: diff --git a/print-medsa.c b/print-medsa.c index 655cd01c..aa3e7c84 100644 --- a/print-medsa.c +++ b/print-medsa.c @@ -53,23 +53,23 @@ struct medsa_pkthdr { }; /* Bytes 0 and 1 are reserved and should contain 0 */ -#define TAG(medsa) (EXTRACT_U_1(medsa->tag_flags_dev) >> 6) +#define TAG(medsa) (GET_U_1(medsa->tag_flags_dev) >> 6) #define TAG_TO_CPU 0 #define TAG_FROM_CPU 1 #define TAG_FORWARD 3 -#define SRC_TAG(medsa) ((EXTRACT_U_1(medsa->tag_flags_dev) >> 5) & 0x01) -#define SRC_DEV(medsa) (EXTRACT_U_1(medsa->tag_flags_dev) & 0x1f) -#define SRC_PORT(medsa) ((EXTRACT_U_1(medsa->port_trunc_codehi_cfi) >> 3) & 0x01f) -#define TRUNK(medsa) ((EXTRACT_U_1(medsa->port_trunc_codehi_cfi) >> 2) & 0x01) -#define CODE(medsa) ((EXTRACT_U_1(medsa->port_trunc_codehi_cfi) & 0x06) | \ - ((EXTRACT_U_1(medsa->pri_vidhi_codelo) >> 4) & 0x01)) +#define SRC_TAG(medsa) ((GET_U_1(medsa->tag_flags_dev) >> 5) & 0x01) +#define SRC_DEV(medsa) (GET_U_1(medsa->tag_flags_dev) & 0x1f) +#define SRC_PORT(medsa) ((GET_U_1(medsa->port_trunc_codehi_cfi) >> 3) & 0x01f) +#define TRUNK(medsa) ((GET_U_1(medsa->port_trunc_codehi_cfi) >> 2) & 0x01) +#define CODE(medsa) ((GET_U_1(medsa->port_trunc_codehi_cfi) & 0x06) | \ + ((GET_U_1(medsa->pri_vidhi_codelo) >> 4) & 0x01)) #define CODE_BDPU 0 #define CODE_IGMP_MLD 2 #define CODE_ARP_MIRROR 4 -#define CFI(medsa) (EXTRACT_U_1(medsa->port_trunc_codehi_cfi) & 0x01) -#define PRI(medsa) (EXTRACT_U_1(medsa->pri_vidhi_codelo) >> 5) -#define VID(medsa) ((u_short)(EXTRACT_U_1(medsa->pri_vidhi_codelo) & 0xf) << 8 | \ - EXTRACT_U_1(medsa->vidlo)) +#define CFI(medsa) (GET_U_1(medsa->port_trunc_codehi_cfi) & 0x01) +#define PRI(medsa) (GET_U_1(medsa->pri_vidhi_codelo) >> 5) +#define VID(medsa) ((u_short)(GET_U_1(medsa->pri_vidhi_codelo) & 0xf) << 8 | \ + GET_U_1(medsa->vidlo)) static const struct tok tag_values[] = { { TAG_TO_CPU, "To_CPU" }, @@ -160,7 +160,7 @@ medsa_print(netdissect_options *ndo, length -= 8; caplen -= 8; - ether_type = EXTRACT_BE_U_2(medsa->ether_type); + ether_type = GET_BE_U_2(medsa->ether_type); if (ether_type <= MAX_ETHERNET_LENGTH_VAL) { /* 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 28713acc..50bcd3eb 100644 --- a/print-mobile.c +++ b/print-mobile.c @@ -79,8 +79,8 @@ mobile_print(netdissect_options *ndo, const u_char *bp, u_int length) } ND_PRINT("mobile: "); - proto = EXTRACT_BE_U_2(mob->proto); - crc = EXTRACT_BE_U_2(mob->hcheck); + proto = GET_BE_U_2(mob->proto); + crc = GET_BE_U_2(mob->hcheck); if (proto & OSRC_PRES) { osp=1; } diff --git a/print-mobility.c b/print-mobility.c index 6fd95628..4dbfb6ff 100644 --- a/print-mobility.c +++ b/print-mobility.c @@ -118,12 +118,12 @@ mobility_opt_print(netdissect_options *ndo, for (i = 0; i < len; i += optlen) { ND_TCHECK_1(bp + i); - if (EXTRACT_U_1(bp + i) == IP6MOPT_PAD1) + if (GET_U_1(bp + i) == IP6MOPT_PAD1) optlen = 1; else { if (i + 1 < len) { ND_TCHECK_1(bp + i + 1); - optlen = EXTRACT_U_1(bp + i + 1) + 2; + optlen = GET_U_1(bp + i + 1) + 2; } else goto trunc; @@ -132,7 +132,7 @@ mobility_opt_print(netdissect_options *ndo, goto trunc; ND_TCHECK_1(bp + i + optlen); - switch (EXTRACT_U_1(bp + i)) { + switch (GET_U_1(bp + i)) { case IP6MOPT_PAD1: ND_PRINT("(pad1)"); break; @@ -151,7 +151,7 @@ mobility_opt_print(netdissect_options *ndo, /* units of 4 secs */ ND_TCHECK_2(bp + i + 2); ND_PRINT("(refresh: %u)", - EXTRACT_BE_U_2(bp + i + 2) << 2); + GET_BE_U_2(bp + i + 2) << 2); break; case IP6MOPT_ALTCOA: if (len - i < IP6MOPT_ALTCOA_MINLEN) { @@ -169,8 +169,8 @@ mobility_opt_print(netdissect_options *ndo, ND_TCHECK_2(bp + i + 2); ND_TCHECK_2(bp + i + 4); ND_PRINT("(ni: ho=0x%04x co=0x%04x)", - EXTRACT_BE_U_2(bp + i + 2), - EXTRACT_BE_U_2(bp + i + 4)); + GET_BE_U_2(bp + i + 2), + GET_BE_U_2(bp + i + 4)); break; case IP6MOPT_AUTH: if (len - i < IP6MOPT_AUTH_MINLEN) { @@ -181,10 +181,12 @@ mobility_opt_print(netdissect_options *ndo, break; default: if (len - i < IP6MOPT_MINLEN) { - ND_PRINT("(sopt_type %u: trunc)", EXTRACT_U_1(bp + i)); + ND_PRINT("(sopt_type %u: trunc)", + GET_U_1(bp + i)); goto trunc; } - ND_PRINT("(type-0x%02x: len=%u)", EXTRACT_U_1(bp + i), EXTRACT_U_1(bp + i + 1)); + ND_PRINT("(type-0x%02x: len=%u)", GET_U_1(bp + i), + GET_U_1(bp + i + 1)); break; } } @@ -228,12 +230,12 @@ mobility_print(netdissect_options *ndo, mhlen = ep - bp; goto trunc; } - mhlen = (EXTRACT_U_1(mh->ip6m_len) + 1) << 3; + mhlen = (GET_U_1(mh->ip6m_len) + 1) << 3; /* XXX ip6m_cksum */ ND_TCHECK_1(mh->ip6m_type); - type = EXTRACT_U_1(mh->ip6m_type); + type = GET_U_1(mh->ip6m_type); if (type <= IP6M_MAX && mhlen < ip6m_hdrlen[type]) { ND_PRINT("(header length %u is too small for type %u)", mhlen, type); goto trunc; @@ -250,47 +252,47 @@ mobility_print(netdissect_options *ndo, ND_TCHECK_4(bp + hlen + 4); ND_PRINT(" %s Init Cookie=%08x:%08x", type == IP6M_HOME_TEST_INIT ? "Home" : "Care-of", - EXTRACT_BE_U_4(bp + hlen), - EXTRACT_BE_U_4(bp + hlen + 4)); + GET_BE_U_4(bp + hlen), + GET_BE_U_4(bp + hlen + 4)); } hlen += 8; break; case IP6M_HOME_TEST: case IP6M_CAREOF_TEST: ND_TCHECK_2(mh->ip6m_data16[0]); - ND_PRINT(" nonce id=0x%x", EXTRACT_BE_U_2(mh->ip6m_data16[0])); + ND_PRINT(" nonce id=0x%x", GET_BE_U_2(mh->ip6m_data16[0])); hlen = IP6M_MINLEN; if (ndo->ndo_vflag) { ND_TCHECK_4(bp + hlen + 4); ND_PRINT(" %s Init Cookie=%08x:%08x", type == IP6M_HOME_TEST ? "Home" : "Care-of", - EXTRACT_BE_U_4(bp + hlen), - EXTRACT_BE_U_4(bp + hlen + 4)); + GET_BE_U_4(bp + hlen), + GET_BE_U_4(bp + hlen + 4)); } hlen += 8; if (ndo->ndo_vflag) { ND_TCHECK_4(bp + hlen + 4); ND_PRINT(" %s Keygen Token=%08x:%08x", type == IP6M_HOME_TEST ? "Home" : "Care-of", - EXTRACT_BE_U_4(bp + hlen), - EXTRACT_BE_U_4(bp + hlen + 4)); + GET_BE_U_4(bp + hlen), + GET_BE_U_4(bp + hlen + 4)); } hlen += 8; break; case IP6M_BINDING_UPDATE: ND_TCHECK_2(mh->ip6m_data16[0]); - ND_PRINT(" seq#=%u", EXTRACT_BE_U_2(mh->ip6m_data16[0])); + ND_PRINT(" seq#=%u", GET_BE_U_2(mh->ip6m_data16[0])); hlen = IP6M_MINLEN; ND_TCHECK_2(bp + hlen); - if (EXTRACT_U_1(bp + hlen) & 0xf0) { + if (GET_U_1(bp + hlen) & 0xf0) { ND_PRINT(" "); - if (EXTRACT_U_1(bp + hlen) & 0x80) + if (GET_U_1(bp + hlen) & 0x80) ND_PRINT("A"); - if (EXTRACT_U_1(bp + hlen) & 0x40) + if (GET_U_1(bp + hlen) & 0x40) ND_PRINT("H"); - if (EXTRACT_U_1(bp + hlen) & 0x20) + if (GET_U_1(bp + hlen) & 0x20) ND_PRINT("L"); - if (EXTRACT_U_1(bp + hlen) & 0x10) + if (GET_U_1(bp + hlen) & 0x10) ND_PRINT("K"); } /* Reserved (4bits) */ @@ -299,28 +301,28 @@ mobility_print(netdissect_options *ndo, hlen += 1; ND_TCHECK_2(bp + hlen); /* units of 4 secs */ - ND_PRINT(" lifetime=%u", EXTRACT_BE_U_2(bp + hlen) << 2); + ND_PRINT(" lifetime=%u", GET_BE_U_2(bp + hlen) << 2); hlen += 2; break; case IP6M_BINDING_ACK: ND_TCHECK_1(mh->ip6m_data8[0]); - ND_PRINT(" status=%u", EXTRACT_U_1(mh->ip6m_data8[0])); + ND_PRINT(" status=%u", GET_U_1(mh->ip6m_data8[0])); ND_TCHECK_1(mh->ip6m_data8[1]); - if (EXTRACT_U_1(mh->ip6m_data8[1]) & 0x80) + if (GET_U_1(mh->ip6m_data8[1]) & 0x80) ND_PRINT(" K"); /* Reserved (7bits) */ hlen = IP6M_MINLEN; ND_TCHECK_2(bp + hlen); - ND_PRINT(" seq#=%u", EXTRACT_BE_U_2(bp + hlen)); + ND_PRINT(" seq#=%u", GET_BE_U_2(bp + hlen)); hlen += 2; ND_TCHECK_2(bp + hlen); /* units of 4 secs */ - ND_PRINT(" lifetime=%u", EXTRACT_BE_U_2(bp + hlen) << 2); + ND_PRINT(" lifetime=%u", GET_BE_U_2(bp + hlen) << 2); hlen += 2; break; case IP6M_BINDING_ERROR: ND_TCHECK_1(mh->ip6m_data8[0]); - ND_PRINT(" status=%u", EXTRACT_U_1(mh->ip6m_data8[0])); + ND_PRINT(" status=%u", GET_U_1(mh->ip6m_data8[0])); /* Reserved */ hlen = IP6M_MINLEN; ND_TCHECK_16(bp + hlen); @@ -328,7 +330,7 @@ mobility_print(netdissect_options *ndo, hlen += 16; break; default: - ND_PRINT(" len=%u", EXTRACT_U_1(mh->ip6m_len)); + ND_PRINT(" len=%u", GET_U_1(mh->ip6m_len)); return(mhlen); break; } diff --git a/print-mpcp.c b/print-mpcp.c index ebfe74a6..47b2a107 100644 --- a/print-mpcp.c +++ b/print-mpcp.c @@ -139,10 +139,11 @@ mpcp_print(netdissect_options *ndo, const u_char *pptr, u_int length) mpcp.common_header = (const struct mpcp_common_header_t *)pptr; ND_TCHECK_LEN(tptr, sizeof(struct mpcp_common_header_t)); - opcode = EXTRACT_BE_U_2(mpcp.common_header->opcode); + opcode = GET_BE_U_2(mpcp.common_header->opcode); ND_PRINT("MPCP, Opcode %s", tok2str(mpcp_opcode_values, "Unknown (%u)", opcode)); if (opcode != MPCP_OPCODE_PAUSE) { - ND_PRINT(", Timestamp %u ticks", EXTRACT_BE_U_4(mpcp.common_header->timestamp)); + ND_PRINT(", Timestamp %u ticks", + GET_BE_U_4(mpcp.common_header->timestamp)); } ND_PRINT(", length %u", length); @@ -157,12 +158,12 @@ mpcp_print(netdissect_options *ndo, const u_char *pptr, u_int length) case MPCP_OPCODE_GATE: ND_TCHECK_LEN(tptr, MPCP_GRANT_NUMBER_LEN); - grant_numbers = EXTRACT_U_1(tptr) & MPCP_GRANT_NUMBER_MASK; + grant_numbers = GET_U_1(tptr) & MPCP_GRANT_NUMBER_MASK; ND_PRINT("\n\tGrant Numbers %u, Flags [ %s ]", grant_numbers, bittok2str(mpcp_grant_flag_values, "?", - EXTRACT_U_1(tptr) & ~MPCP_GRANT_NUMBER_MASK)); + GET_U_1(tptr) & ~MPCP_GRANT_NUMBER_MASK)); tptr++; for (grant = 1; grant <= grant_numbers; grant++) { @@ -170,25 +171,25 @@ mpcp_print(netdissect_options *ndo, const u_char *pptr, u_int length) mpcp.grant = (const struct mpcp_grant_t *)tptr; ND_PRINT("\n\tGrant #%u, Start-Time %u ticks, duration %u ticks", grant, - EXTRACT_BE_U_4(mpcp.grant->starttime), - EXTRACT_BE_U_2(mpcp.grant->duration)); + GET_BE_U_4(mpcp.grant->starttime), + GET_BE_U_2(mpcp.grant->duration)); tptr += sizeof(struct mpcp_grant_t); } ND_TCHECK_2(tptr); - ND_PRINT("\n\tSync-Time %u ticks", EXTRACT_BE_U_2(tptr)); + ND_PRINT("\n\tSync-Time %u ticks", GET_BE_U_2(tptr)); break; case MPCP_OPCODE_REPORT: ND_TCHECK_LEN(tptr, MPCP_REPORT_QUEUESETS_LEN); - queue_sets = EXTRACT_U_1(tptr); + queue_sets = GET_U_1(tptr); tptr+=MPCP_REPORT_QUEUESETS_LEN; ND_PRINT("\n\tTotal Queue-Sets %u", queue_sets); for (queue_set = 1; queue_set < queue_sets; queue_set++) { ND_TCHECK_LEN(tptr, MPCP_REPORT_REPORTBITMAP_LEN); - report_bitmap = EXTRACT_U_1(tptr); + report_bitmap = GET_U_1(tptr); ND_PRINT("\n\t Queue-Set #%u, Report-Bitmap [ %s ]", queue_sets, bittok2str(mpcp_report_bitmap_values, "Unknown", report_bitmap)); @@ -200,7 +201,7 @@ mpcp_print(netdissect_options *ndo, const u_char *pptr, u_int length) ND_TCHECK_2(tptr); ND_PRINT("\n\t Q%u Report, Duration %u ticks", report, - EXTRACT_BE_U_2(tptr)); + GET_BE_U_2(tptr)); tptr += 2; } report++; @@ -213,8 +214,8 @@ mpcp_print(netdissect_options *ndo, const u_char *pptr, u_int length) ND_TCHECK_LEN(tptr, sizeof(struct mpcp_reg_req_t)); mpcp.reg_req = (const struct mpcp_reg_req_t *)tptr; ND_PRINT("\n\tFlags [ %s ], Pending-Grants %u", - bittok2str(mpcp_reg_req_flag_values, "Reserved", EXTRACT_U_1(mpcp.reg_req->flags)), - EXTRACT_U_1(mpcp.reg_req->pending_grants)); + bittok2str(mpcp_reg_req_flag_values, "Reserved", GET_U_1(mpcp.reg_req->flags)), + GET_U_1(mpcp.reg_req->pending_grants)); break; case MPCP_OPCODE_REG: @@ -222,10 +223,10 @@ mpcp_print(netdissect_options *ndo, const u_char *pptr, u_int length) mpcp.reg = (const struct mpcp_reg_t *)tptr; ND_PRINT("\n\tAssigned-Port %u, Flags [ %s ]" "\n\tSync-Time %u ticks, Echoed-Pending-Grants %u", - EXTRACT_BE_U_2(mpcp.reg->assigned_port), - bittok2str(mpcp_reg_flag_values, "Reserved", EXTRACT_U_1(mpcp.reg->flags)), - EXTRACT_BE_U_2(mpcp.reg->sync_time), - EXTRACT_U_1(mpcp.reg->echoed_pending_grants)); + GET_BE_U_2(mpcp.reg->assigned_port), + bittok2str(mpcp_reg_flag_values, "Reserved", GET_U_1(mpcp.reg->flags)), + GET_BE_U_2(mpcp.reg->sync_time), + GET_U_1(mpcp.reg->echoed_pending_grants)); break; case MPCP_OPCODE_REG_ACK: @@ -233,9 +234,9 @@ mpcp_print(netdissect_options *ndo, const u_char *pptr, u_int length) mpcp.reg_ack = (const struct mpcp_reg_ack_t *)tptr; ND_PRINT("\n\tEchoed-Assigned-Port %u, Flags [ %s ]" "\n\tEchoed-Sync-Time %u ticks", - EXTRACT_BE_U_2(mpcp.reg_ack->echoed_assigned_port), - bittok2str(mpcp_reg_ack_flag_values, "Reserved", EXTRACT_U_1(mpcp.reg_ack->flags)), - EXTRACT_BE_U_2(mpcp.reg_ack->echoed_sync_time)); + GET_BE_U_2(mpcp.reg_ack->echoed_assigned_port), + bittok2str(mpcp_reg_ack_flag_values, "Reserved", GET_U_1(mpcp.reg_ack->flags)), + GET_BE_U_2(mpcp.reg_ack->echoed_sync_time)); break; default: diff --git a/print-mpls.c b/print-mpls.c index 77ed2f3b..bdc66c64 100644 --- a/print-mpls.c +++ b/print-mpls.c @@ -71,7 +71,7 @@ mpls_print(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK_LEN(p, sizeof(label_entry)); if (length < sizeof(label_entry)) goto trunc; - label_entry = EXTRACT_BE_U_4(p); + label_entry = GET_BE_U_4(p); ND_PRINT("%s(label %u", (label_stack_depth && ndo->ndo_vflag) ? "\n\t" : " ", MPLS_LABEL(label_entry)); @@ -133,7 +133,7 @@ mpls_print(netdissect_options *ndo, const u_char *bp, u_int length) /* nothing to print */ return; } - switch(EXTRACT_U_1(p)) { + switch(GET_U_1(p)) { case 0x45: case 0x46: diff --git a/print-mptcp.c b/print-mptcp.c index 631b4e80..0f5df402 100644 --- a/print-mptcp.c +++ b/print-mptcp.c @@ -63,7 +63,7 @@ struct mptcp_option { nd_uint8_t sub_etc; /* subtype upper 4 bits, other stuff lower 4 bits */ }; -#define MPTCP_OPT_SUBTYPE(sub_etc) ((EXTRACT_U_1(sub_etc) >> 4) & 0xF) +#define MPTCP_OPT_SUBTYPE(sub_etc) ((GET_U_1(sub_etc) >> 4) & 0xF) struct mp_capable { nd_uint8_t kind; @@ -74,7 +74,7 @@ struct mp_capable { nd_uint64_t receiver_key; }; -#define MP_CAPABLE_OPT_VERSION(sub_ver) ((EXTRACT_U_1(sub_ver) >> 0) & 0xF) +#define MP_CAPABLE_OPT_VERSION(sub_ver) ((GET_U_1(sub_ver) >> 0) & 0xF) #define MP_CAPABLE_C 0x80 #define MP_CAPABLE_S 0x01 @@ -130,7 +130,7 @@ struct mp_add_addr { } u; }; -#define MP_ADD_ADDR_IPVER(sub_ipver) ((EXTRACT_U_1(sub_ipver) >> 0) & 0xF) +#define MP_ADD_ADDR_IPVER(sub_ipver) ((GET_U_1(sub_ipver) >> 0) & 0xF) struct mp_remove_addr { nd_uint8_t kind; @@ -187,11 +187,11 @@ mp_capable_print(netdissect_options *ndo, return 1; } - if (EXTRACT_U_1(mpc->flags) & MP_CAPABLE_C) + if (GET_U_1(mpc->flags) & MP_CAPABLE_C) ND_PRINT(" csum"); - ND_PRINT(" {0x%" PRIx64, EXTRACT_BE_U_8(mpc->sender_key)); + ND_PRINT(" {0x%" PRIx64, GET_BE_U_8(mpc->sender_key)); if (opt_len == 20) /* ACK */ - ND_PRINT(",0x%" PRIx64, EXTRACT_BE_U_8(mpc->receiver_key)); + ND_PRINT(",0x%" PRIx64, GET_BE_U_8(mpc->receiver_key)); ND_PRINT("}"); return 1; } @@ -208,21 +208,21 @@ mp_join_print(netdissect_options *ndo, return 0; if (opt_len != 24) { - if (EXTRACT_U_1(mpj->sub_b) & MP_JOIN_B) + if (GET_U_1(mpj->sub_b) & MP_JOIN_B) ND_PRINT(" backup"); - ND_PRINT(" id %u", EXTRACT_U_1(mpj->addr_id)); + ND_PRINT(" id %u", GET_U_1(mpj->addr_id)); } switch (opt_len) { case 12: /* SYN */ ND_PRINT(" token 0x%x" " nonce 0x%x", - EXTRACT_BE_U_4(mpj->u.syn.token), - EXTRACT_BE_U_4(mpj->u.syn.nonce)); + GET_BE_U_4(mpj->u.syn.token), + GET_BE_U_4(mpj->u.syn.nonce)); break; case 16: /* SYN/ACK */ ND_PRINT(" hmac 0x%" PRIx64 " nonce 0x%x", - EXTRACT_BE_U_8(mpj->u.synack.mac), - EXTRACT_BE_U_4(mpj->u.synack.nonce)); + GET_BE_U_8(mpj->u.synack.mac), + GET_BE_U_4(mpj->u.synack.nonce)); break; case 24: {/* ACK */ size_t i; @@ -250,7 +250,7 @@ mp_dss_print(netdissect_options *ndo, if (flags & TH_SYN) return 0; - mdss_flags = EXTRACT_U_1(mdss->flags); + mdss_flags = GET_U_1(mdss->flags); if (mdss_flags & MP_DSS_F) ND_PRINT(" fin"); @@ -266,13 +266,13 @@ mp_dss_print(netdissect_options *ndo, if (mdss_flags & MP_DSS_a) { if (opt_len < 8) return 0; - ND_PRINT("%" PRIu64, EXTRACT_BE_U_8(opt)); + ND_PRINT("%" PRIu64, GET_BE_U_8(opt)); opt += 8; opt_len -= 8; } else { if (opt_len < 4) return 0; - ND_PRINT("%u", EXTRACT_BE_U_4(opt)); + ND_PRINT("%u", GET_BE_U_4(opt)); opt += 4; opt_len -= 4; } @@ -291,24 +291,24 @@ mp_dss_print(netdissect_options *ndo, if (mdss_flags & MP_DSS_m) { if (opt_len < 8) return 0; - ND_PRINT("%" PRIu64, EXTRACT_BE_U_8(opt)); + ND_PRINT("%" PRIu64, GET_BE_U_8(opt)); opt += 8; opt_len -= 8; } else { if (opt_len < 4) return 0; - ND_PRINT("%u", EXTRACT_BE_U_4(opt)); + ND_PRINT("%u", GET_BE_U_4(opt)); opt += 4; opt_len -= 4; } if (opt_len < 4) return 0; - ND_PRINT(" subseq %u", EXTRACT_BE_U_4(opt)); + ND_PRINT(" subseq %u", GET_BE_U_4(opt)); opt += 4; opt_len -= 4; if (opt_len < 2) return 0; - ND_PRINT(" len %u", EXTRACT_BE_U_2(opt)); + ND_PRINT(" len %u", GET_BE_U_2(opt)); opt += 2; opt_len -= 2; @@ -318,7 +318,7 @@ mp_dss_print(netdissect_options *ndo, * bytes as the Checksum. */ if (opt_len >= 2) { - ND_PRINT(" csum 0x%x", EXTRACT_BE_U_2(opt)); + ND_PRINT(" csum 0x%x", GET_BE_U_2(opt)); opt_len -= 2; } } @@ -338,17 +338,17 @@ add_addr_print(netdissect_options *ndo, !((opt_len == 20 || opt_len == 22) && ipver == 6)) return 0; - ND_PRINT(" id %u", EXTRACT_U_1(add_addr->addr_id)); + ND_PRINT(" id %u", GET_U_1(add_addr->addr_id)); switch (ipver) { case 4: ND_PRINT(" %s", ipaddr_string(ndo, add_addr->u.v4.addr)); if (opt_len == 10) - ND_PRINT(":%u", EXTRACT_BE_U_2(add_addr->u.v4.port)); + ND_PRINT(":%u", GET_BE_U_2(add_addr->u.v4.port)); break; case 6: ND_PRINT(" %s", ip6addr_string(ndo, add_addr->u.v6.addr)); if (opt_len == 22) - ND_PRINT(":%u", EXTRACT_BE_U_2(add_addr->u.v6.port)); + ND_PRINT(":%u", GET_BE_U_2(add_addr->u.v6.port)); break; default: return 0; @@ -370,7 +370,7 @@ remove_addr_print(netdissect_options *ndo, opt_len -= 3; ND_PRINT(" id"); for (i = 0; i < opt_len; i++) - ND_PRINT(" %u", EXTRACT_U_1(remove_addr->addrs_id[i])); + ND_PRINT(" %u", GET_U_1(remove_addr->addrs_id[i])); return 1; } @@ -383,12 +383,12 @@ mp_prio_print(netdissect_options *ndo, if (opt_len != 3 && opt_len != 4) return 0; - if (EXTRACT_U_1(mpp->sub_b) & MP_PRIO_B) + if (GET_U_1(mpp->sub_b) & MP_PRIO_B) ND_PRINT(" backup"); else ND_PRINT(" non-backup"); if (opt_len == 4) - ND_PRINT(" id %u", EXTRACT_U_1(mpp->addr_id)); + ND_PRINT(" id %u", GET_U_1(mpp->addr_id)); return 1; } @@ -400,7 +400,7 @@ mp_fail_print(netdissect_options *ndo, if (opt_len != 12) return 0; - ND_PRINT(" seq %" PRIu64, EXTRACT_BE_U_8(opt + 4)); + ND_PRINT(" seq %" PRIu64, GET_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(" key 0x%" PRIx64, EXTRACT_BE_U_8(opt + 4)); + ND_PRINT(" key 0x%" PRIx64, GET_BE_U_8(opt + 4)); return 1; } diff --git a/print-msdp.c b/print-msdp.c index 00481836..297fbbb3 100644 --- a/print-msdp.c +++ b/print-msdp.c @@ -38,15 +38,15 @@ msdp_print(netdissect_options *ndo, const u_char *sp, u_int length) ndo->ndo_protocol = "msdp"; ND_TCHECK_3(sp); /* See if we think we're at the beginning of a compound packet */ - type = EXTRACT_U_1(sp); - len = EXTRACT_BE_U_2(sp + 1); + type = GET_U_1(sp); + len = GET_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(" msdp:"); while (length != 0) { ND_TCHECK_3(sp); - type = EXTRACT_U_1(sp); - len = EXTRACT_BE_U_2(sp + 1); + type = GET_U_1(sp); + len = GET_BE_U_2(sp + 1); if (len > 1400 || ndo->ndo_vflag) ND_PRINT(" [len %u]", len); if (len < 3) @@ -63,14 +63,14 @@ msdp_print(netdissect_options *ndo, const u_char *sp, u_int length) else ND_PRINT(" SA-Response"); ND_TCHECK_1(sp); - ND_PRINT(" %u entries", EXTRACT_U_1(sp)); - if ((u_int)((EXTRACT_U_1(sp) * 12) + 8) < len) { + ND_PRINT(" %u entries", GET_U_1(sp)); + if ((u_int)((GET_U_1(sp) * 12) + 8) < len) { ND_PRINT(" [w/data]"); if (ndo->ndo_vflag > 1) { ND_PRINT(" "); ip_print(ndo, sp + - EXTRACT_U_1(sp) * 12 + 8 - 3, - len - (EXTRACT_U_1(sp) * 12 + 8)); + GET_U_1(sp) * 12 + 8 - 3, + len - (GET_U_1(sp) * 12 + 8)); } } break; diff --git a/print-msnlb.c b/print-msnlb.c index 7a86ff06..5d25f568 100644 --- a/print-msnlb.c +++ b/print-msnlb.c @@ -57,7 +57,7 @@ msnlb_print(netdissect_options *ndo, const u_char *bp) ND_TCHECK_SIZE(hb); ND_PRINT("MS NLB heartbeat, host priority: %u,", - EXTRACT_LE_U_4((hb->host_prio))); + GET_LE_U_4((hb->host_prio))); ND_PRINT(" cluster IP: %s,", ipaddr_string(ndo, hb->virtual_ip)); ND_PRINT(" host IP: %s", ipaddr_string(ndo, hb->host_ip)); return; diff --git a/print-nflog.c b/print-nflog.c index 28929747..d10f8539 100644 --- a/print-nflog.c +++ b/print-nflog.c @@ -111,18 +111,18 @@ static void nflog_hdr_print(netdissect_options *ndo, const nflog_hdr_t *hdr, u_int length) { ND_PRINT("version %u, resource ID %u", - EXTRACT_U_1(hdr->nflog_version), EXTRACT_BE_U_2(hdr->nflog_rid)); + GET_U_1(hdr->nflog_version), GET_BE_U_2(hdr->nflog_rid)); if (!ndo->ndo_qflag) { ND_PRINT(", family %s (%u)", tok2str(nflog_values, "Unknown", - EXTRACT_U_1(hdr->nflog_family)), - EXTRACT_U_1(hdr->nflog_family)); + GET_U_1(hdr->nflog_family)), + GET_U_1(hdr->nflog_family)); } else { ND_PRINT(", %s", tok2str(nflog_values, "Unknown NFLOG (0x%02x)", - EXTRACT_U_1(hdr->nflog_family))); + GET_U_1(hdr->nflog_family))); } ND_PRINT(", length %u: ", length); @@ -143,8 +143,8 @@ nflog_if_print(netdissect_options *ndo, goto trunc; ND_TCHECK_SIZE(hdr); - if (EXTRACT_U_1(hdr->nflog_version) != 0) { - ND_PRINT("version %u (unknown)", EXTRACT_U_1(hdr->nflog_version)); + if (GET_U_1(hdr->nflog_version) != 0) { + ND_PRINT("version %u (unknown)", GET_U_1(hdr->nflog_version)); return h_size; } @@ -164,7 +164,7 @@ nflog_if_print(netdissect_options *ndo, tlv = (const nflog_tlv_t *) p; ND_TCHECK_SIZE(tlv); - size = EXTRACT_HE_U_2(tlv->tlv_length); + size = GET_HE_U_2(tlv->tlv_length); if (size % 4 != 0) size += 4 - size % 4; @@ -176,7 +176,7 @@ nflog_if_print(netdissect_options *ndo, if (caplen < size) goto trunc; /* No. */ - if (EXTRACT_HE_U_2(tlv->tlv_type) == NFULA_PAYLOAD) { + if (GET_HE_U_2(tlv->tlv_type) == NFULA_PAYLOAD) { /* * This TLV's data is the packet payload. * Skip past the TLV header, and break out @@ -195,7 +195,7 @@ nflog_if_print(netdissect_options *ndo, caplen -= size; } - switch (EXTRACT_U_1(hdr->nflog_family)) { + switch (GET_U_1(hdr->nflog_family)) { case AF_INET: ip_print(ndo, p, length); diff --git a/print-nfs.c b/print-nfs.c index f1db2d77..a6755513 100644 --- a/print-nfs.c +++ b/print-nfs.c @@ -261,60 +261,60 @@ parse_sattr3(netdissect_options *ndo, const uint32_t *dp, struct nfsv3_sattr *sa3) { ND_TCHECK_4(dp); - sa3->sa_modeset = EXTRACT_BE_U_4(dp); + sa3->sa_modeset = GET_BE_U_4(dp); dp++; if (sa3->sa_modeset) { ND_TCHECK_4(dp); - sa3->sa_mode = EXTRACT_BE_U_4(dp); + sa3->sa_mode = GET_BE_U_4(dp); dp++; } ND_TCHECK_4(dp); - sa3->sa_uidset = EXTRACT_BE_U_4(dp); + sa3->sa_uidset = GET_BE_U_4(dp); dp++; if (sa3->sa_uidset) { ND_TCHECK_4(dp); - sa3->sa_uid = EXTRACT_BE_U_4(dp); + sa3->sa_uid = GET_BE_U_4(dp); dp++; } ND_TCHECK_4(dp); - sa3->sa_gidset = EXTRACT_BE_U_4(dp); + sa3->sa_gidset = GET_BE_U_4(dp); dp++; if (sa3->sa_gidset) { ND_TCHECK_4(dp); - sa3->sa_gid = EXTRACT_BE_U_4(dp); + sa3->sa_gid = GET_BE_U_4(dp); dp++; } ND_TCHECK_4(dp); - sa3->sa_sizeset = EXTRACT_BE_U_4(dp); + sa3->sa_sizeset = GET_BE_U_4(dp); dp++; if (sa3->sa_sizeset) { ND_TCHECK_4(dp); - sa3->sa_size = EXTRACT_BE_U_4(dp); + sa3->sa_size = GET_BE_U_4(dp); dp++; } ND_TCHECK_4(dp); - sa3->sa_atimetype = EXTRACT_BE_U_4(dp); + sa3->sa_atimetype = GET_BE_U_4(dp); dp++; if (sa3->sa_atimetype == NFSV3SATTRTIME_TOCLIENT) { ND_TCHECK_4(dp + 1); - sa3->sa_atime.nfsv3_sec = EXTRACT_BE_U_4(dp); + sa3->sa_atime.nfsv3_sec = GET_BE_U_4(dp); dp++; - sa3->sa_atime.nfsv3_nsec = EXTRACT_BE_U_4(dp); + sa3->sa_atime.nfsv3_nsec = GET_BE_U_4(dp); dp++; } ND_TCHECK_4(dp); - sa3->sa_mtimetype = EXTRACT_BE_U_4(dp); + sa3->sa_mtimetype = GET_BE_U_4(dp); dp++; if (sa3->sa_mtimetype == NFSV3SATTRTIME_TOCLIENT) { ND_TCHECK_4(dp + 1); - sa3->sa_mtime.nfsv3_sec = EXTRACT_BE_U_4(dp); + sa3->sa_mtime.nfsv3_sec = GET_BE_U_4(dp); dp++; - sa3->sa_mtime.nfsv3_nsec = EXTRACT_BE_U_4(dp); + sa3->sa_mtime.nfsv3_nsec = GET_BE_U_4(dp); dp++; } @@ -358,11 +358,11 @@ nfsreply_print(netdissect_options *ndo, if (!ndo->ndo_nflag) { strlcpy(srcid, "nfs", sizeof(srcid)); nd_snprintf(dstid, sizeof(dstid), "%u", - EXTRACT_BE_U_4(rp->rm_xid)); + GET_BE_U_4(rp->rm_xid)); } else { nd_snprintf(srcid, sizeof(srcid), "%u", NFS_PORT); nd_snprintf(dstid, sizeof(dstid), "%u", - EXTRACT_BE_U_4(rp->rm_xid)); + GET_BE_U_4(rp->rm_xid)); } print_nfsaddr(ndo, bp2, srcid, dstid); @@ -389,7 +389,7 @@ nfsreply_noaddr_print(netdissect_options *ndo, rp = (const struct sunrpc_msg *)bp; ND_TCHECK_4(rp->rm_reply.rp_stat); - reply_stat = EXTRACT_BE_U_4(&rp->rm_reply.rp_stat); + reply_stat = GET_BE_U_4(&rp->rm_reply.rp_stat); switch (reply_stat) { case SUNRPC_MSG_ACCEPTED: @@ -401,19 +401,19 @@ nfsreply_noaddr_print(netdissect_options *ndo, case SUNRPC_MSG_DENIED: ND_PRINT("reply ERR %u: ", length); ND_TCHECK_4(rp->rm_reply.rp_reject.rj_stat); - rstat = EXTRACT_BE_U_4(&rp->rm_reply.rp_reject.rj_stat); + rstat = GET_BE_U_4(&rp->rm_reply.rp_reject.rj_stat); switch (rstat) { case SUNRPC_RPC_MISMATCH: ND_TCHECK_4(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); + rlow = GET_BE_U_4(&rp->rm_reply.rp_reject.rj_vers.low); + rhigh = GET_BE_U_4(&rp->rm_reply.rp_reject.rj_vers.high); ND_PRINT("RPC Version mismatch (%u-%u)", rlow, rhigh); break; case SUNRPC_AUTH_ERROR: ND_TCHECK_4(rp->rm_reply.rp_reject.rj_why); - rwhy = EXTRACT_BE_U_4(&rp->rm_reply.rp_reject.rj_why); + rwhy = GET_BE_U_4(&rp->rm_reply.rp_reject.rj_why); ND_PRINT("Auth %s", tok2str(sunrpc_auth_str, "Invalid failure code %u", rwhy)); break; @@ -453,7 +453,7 @@ parsereq(netdissect_options *ndo, if (length < 2 * sizeof(*dp)) goto trunc; ND_TCHECK_4(dp + 1); - len = EXTRACT_BE_U_4(dp + 1); + len = GET_BE_U_4(dp + 1); rounded_len = roundup2(len, 4); ND_TCHECK_LEN(dp + 2, rounded_len); if (2 * sizeof(*dp) + rounded_len <= length) { @@ -473,7 +473,7 @@ parsereq(netdissect_options *ndo, if (length < 2 * sizeof(*dp)) goto trunc; ND_TCHECK_4(dp + 1); - len = EXTRACT_BE_U_4(dp + 1); + len = GET_BE_U_4(dp + 1); rounded_len = roundup2(len, 4); ND_TCHECK_LEN(dp + 2, rounded_len); if (2 * sizeof(*dp) + rounded_len < length) { @@ -503,7 +503,7 @@ parsefh(netdissect_options *ndo, if (v3) { ND_TCHECK_4(dp); - len = EXTRACT_BE_U_4(dp) / 4; + len = GET_BE_U_4(dp) / 4; dp++; } else len = NFSX_V2FH / 4; @@ -531,7 +531,7 @@ parsefn(netdissect_options *ndo, ND_TCHECK_4(dp); /* Fetch big-endian string length */ - len = EXTRACT_BE_U_4(dp); + len = GET_BE_U_4(dp); dp++; if (UINT_MAX - len < 3) { @@ -593,8 +593,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_U_4(&rp->rm_call.cb_vers) == NFS_VER3); - proc = EXTRACT_BE_U_4(&rp->rm_call.cb_proc); + v3 = (GET_BE_U_4(&rp->rm_call.cb_vers) == NFS_VER3); + proc = GET_BE_U_4(&rp->rm_call.cb_proc); if (!v3 && proc < NFS_NPROCS) proc = nfsv3_procid[proc]; @@ -635,7 +635,7 @@ nfsreq_noaddr_print(netdissect_options *ndo, if (dp == NULL) goto trunc; ND_TCHECK_4(dp); - access_flags = EXTRACT_BE_U_4(dp); + access_flags = GET_BE_U_4(dp); if (access_flags & ~NFSV3ACCESS_FULL) { /* NFSV3ACCESS definitions aren't up to date */ ND_PRINT(" %04x", access_flags); @@ -678,13 +678,13 @@ nfsreq_noaddr_print(netdissect_options *ndo, if (v3) { ND_TCHECK_4(dp + 2); ND_PRINT(" %u bytes @ %" PRIu64, - EXTRACT_BE_U_4(dp + 2), - EXTRACT_BE_U_8(dp)); + GET_BE_U_4(dp + 2), + GET_BE_U_8(dp)); } else { ND_TCHECK_4(dp + 1); ND_PRINT(" %u bytes @ %u", - EXTRACT_BE_U_4(dp + 1), - EXTRACT_BE_U_4(dp)); + GET_BE_U_4(dp + 1), + GET_BE_U_4(dp)); } break; @@ -698,21 +698,21 @@ nfsreq_noaddr_print(netdissect_options *ndo, if (v3) { ND_TCHECK_4(dp + 4); ND_PRINT(" %u (%u) bytes @ %" PRIu64, - EXTRACT_BE_U_4(dp + 4), - EXTRACT_BE_U_4(dp + 2), - EXTRACT_BE_U_8(dp)); + GET_BE_U_4(dp + 4), + GET_BE_U_4(dp + 2), + GET_BE_U_8(dp)); if (ndo->ndo_vflag) { ND_PRINT(" <%s>", tok2str(nfsv3_writemodes, - NULL, EXTRACT_BE_U_4(dp + 3))); + NULL, GET_BE_U_4(dp + 3))); } } else { ND_TCHECK_4(dp + 3); ND_PRINT(" %u (%u) bytes @ %u (%u)", - EXTRACT_BE_U_4(dp + 3), - EXTRACT_BE_U_4(dp + 2), - EXTRACT_BE_U_4(dp + 1), - EXTRACT_BE_U_4(dp)); + GET_BE_U_4(dp + 3), + GET_BE_U_4(dp + 2), + GET_BE_U_4(dp + 1), + GET_BE_U_4(dp)); } break; @@ -740,7 +740,7 @@ nfsreq_noaddr_print(netdissect_options *ndo, if (dp == NULL) goto trunc; ND_TCHECK_4(dp); - type = (nfs_type) EXTRACT_BE_U_4(dp); + type = (nfs_type) GET_BE_U_4(dp); dp++; dp = parse_sattr3(ndo, dp, &sa3); if (dp == NULL) @@ -749,8 +749,8 @@ nfsreq_noaddr_print(netdissect_options *ndo, if (ndo->ndo_vflag && (type == NFCHR || type == NFBLK)) { ND_TCHECK_4(dp + 1); ND_PRINT(" %u/%u", - EXTRACT_BE_U_4(dp), - EXTRACT_BE_U_4(dp + 1)); + GET_BE_U_4(dp), + GET_BE_U_4(dp + 1)); dp += 2; } if (ndo->ndo_vflag) @@ -795,8 +795,8 @@ nfsreq_noaddr_print(netdissect_options *ndo, * offset cookie here. */ ND_PRINT(" %u bytes @ %" PRId64, - EXTRACT_BE_U_4(dp + 4), - EXTRACT_BE_U_8(dp)); + GET_BE_U_4(dp + 4), + GET_BE_U_8(dp)); if (ndo->ndo_vflag) { /* * This displays the 8 bytes @@ -805,8 +805,8 @@ nfsreq_noaddr_print(netdissect_options *ndo, * to the high-order byte. */ ND_PRINT(" verf %08x%08x", - EXTRACT_BE_U_4(dp + 2), - EXTRACT_BE_U_4(dp + 3)); + GET_BE_U_4(dp + 2), + GET_BE_U_4(dp + 3)); } } else { ND_TCHECK_4(dp + 1); @@ -815,8 +815,8 @@ nfsreq_noaddr_print(netdissect_options *ndo, * common, but offsets > 2^31 aren't. */ ND_PRINT(" %u bytes @ %u", - EXTRACT_BE_U_4(dp + 1), - EXTRACT_BE_U_4(dp)); + GET_BE_U_4(dp + 1), + GET_BE_U_4(dp)); } break; @@ -833,8 +833,8 @@ nfsreq_noaddr_print(netdissect_options *ndo, * cookie here. */ ND_PRINT(" %u bytes @ %" PRId64, - EXTRACT_BE_U_4(dp + 4), - EXTRACT_BE_U_8(dp)); + GET_BE_U_4(dp + 4), + GET_BE_U_8(dp)); if (ndo->ndo_vflag) { ND_TCHECK_4(dp + 5); /* @@ -844,9 +844,9 @@ nfsreq_noaddr_print(netdissect_options *ndo, * to the high-order byte. */ ND_PRINT(" max %u verf %08x%08x", - EXTRACT_BE_U_4(dp + 5), - EXTRACT_BE_U_4(dp + 2), - EXTRACT_BE_U_4(dp + 3)); + GET_BE_U_4(dp + 5), + GET_BE_U_4(dp + 2), + GET_BE_U_4(dp + 3)); } break; @@ -859,8 +859,8 @@ nfsreq_noaddr_print(netdissect_options *ndo, goto trunc; ND_TCHECK_4(dp + 2); ND_PRINT(" %u bytes @ %" PRIu64, - EXTRACT_BE_U_4(dp + 2), - EXTRACT_BE_U_8(dp)); + GET_BE_U_4(dp + 2), + GET_BE_U_8(dp)); break; default: @@ -908,7 +908,7 @@ nfs_printfh(netdissect_options *ndo, * running tcpdump may show the same file * handle in different ways. */ - ND_PRINT("%s%x", sep, EXTRACT_BE_U_4(dp + i)); + ND_PRINT("%s%x", sep, GET_BE_U_4(dp + i)); sep = ":"; } ND_PRINT("]"); @@ -1015,8 +1015,8 @@ xid_map_enter(netdissect_options *ndo, UNALIGNED_MEMCPY(&xmep->server, ip6->ip6_dst, sizeof(ip6->ip6_dst)); } - xmep->proc = EXTRACT_BE_U_4(&rp->rm_call.cb_proc); - xmep->vers = EXTRACT_BE_U_4(&rp->rm_call.cb_vers); + xmep->proc = GET_BE_U_4(&rp->rm_call.cb_proc); + xmep->vers = GET_BE_U_4(&rp->rm_call.cb_vers); return (1); } @@ -1113,7 +1113,7 @@ parserep(netdissect_options *ndo, */ dp = ((const uint32_t *)&rp->rm_reply) + 1; ND_TCHECK_4(dp + 1); - len = EXTRACT_BE_U_4(dp + 1); + len = GET_BE_U_4(dp + 1); if (len >= length) return (NULL); /* @@ -1125,7 +1125,7 @@ parserep(netdissect_options *ndo, * now we can check the ar_stat field */ ND_TCHECK_4(dp); - astat = (enum sunrpc_accept_stat) EXTRACT_BE_U_4(dp); + astat = (enum sunrpc_accept_stat) GET_BE_U_4(dp); if (astat != SUNRPC_SUCCESS) { ND_PRINT(" %s", tok2str(sunrpc_str, "ar_stat %u", astat)); *nfserrp = 1; /* suppress trunc string */ @@ -1146,7 +1146,7 @@ parsestatus(netdissect_options *ndo, ND_TCHECK_4(dp); - errnum = EXTRACT_BE_U_4(dp); + errnum = GET_BE_U_4(dp); if (er) *er = errnum; if (errnum != 0) { @@ -1177,17 +1177,17 @@ parsefattr(netdissect_options *ndo, */ ND_PRINT(" %s %o ids %d/%d", tok2str(type2str, "unk-ft %u ", - EXTRACT_BE_U_4(fap->fa_type)), - EXTRACT_BE_U_4(fap->fa_mode), - EXTRACT_BE_S_4(fap->fa_uid), - EXTRACT_BE_S_4(fap->fa_gid)); + GET_BE_U_4(fap->fa_type)), + GET_BE_U_4(fap->fa_mode), + GET_BE_S_4(fap->fa_uid), + GET_BE_S_4(fap->fa_gid)); if (v3) { ND_TCHECK_8(fap->fa3_size); ND_PRINT(" sz %" PRIu64, - EXTRACT_BE_U_8(fap->fa3_size)); + GET_BE_U_8(fap->fa3_size)); } else { ND_TCHECK_4(fap->fa2_size); - ND_PRINT(" sz %u", EXTRACT_BE_U_4(fap->fa2_size)); + ND_PRINT(" sz %u", GET_BE_U_4(fap->fa2_size)); } } /* print lots more stuff */ @@ -1195,38 +1195,38 @@ parsefattr(netdissect_options *ndo, if (v3) { ND_TCHECK_8(&fap->fa3_ctime); ND_PRINT(" nlink %u rdev %u/%u", - EXTRACT_BE_U_4(fap->fa_nlink), - EXTRACT_BE_U_4(fap->fa3_rdev.specdata1), - EXTRACT_BE_U_4(fap->fa3_rdev.specdata2)); + GET_BE_U_4(fap->fa_nlink), + GET_BE_U_4(fap->fa3_rdev.specdata1), + GET_BE_U_4(fap->fa3_rdev.specdata2)); ND_PRINT(" fsid %" PRIx64, - EXTRACT_BE_U_8(fap->fa3_fsid)); + GET_BE_U_8(fap->fa3_fsid)); ND_PRINT(" fileid %" PRIx64, - EXTRACT_BE_U_8(fap->fa3_fileid)); + GET_BE_U_8(fap->fa3_fileid)); ND_PRINT(" a/m/ctime %u.%06u", - EXTRACT_BE_U_4(fap->fa3_atime.nfsv3_sec), - EXTRACT_BE_U_4(fap->fa3_atime.nfsv3_nsec)); + GET_BE_U_4(fap->fa3_atime.nfsv3_sec), + GET_BE_U_4(fap->fa3_atime.nfsv3_nsec)); ND_PRINT(" %u.%06u", - EXTRACT_BE_U_4(fap->fa3_mtime.nfsv3_sec), - EXTRACT_BE_U_4(fap->fa3_mtime.nfsv3_nsec)); + GET_BE_U_4(fap->fa3_mtime.nfsv3_sec), + GET_BE_U_4(fap->fa3_mtime.nfsv3_nsec)); ND_PRINT(" %u.%06u", - EXTRACT_BE_U_4(fap->fa3_ctime.nfsv3_sec), - EXTRACT_BE_U_4(fap->fa3_ctime.nfsv3_nsec)); + GET_BE_U_4(fap->fa3_ctime.nfsv3_sec), + GET_BE_U_4(fap->fa3_ctime.nfsv3_nsec)); } else { ND_TCHECK_8(&fap->fa2_ctime); ND_PRINT(" nlink %u rdev 0x%x fsid 0x%x nodeid 0x%x a/m/ctime", - 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)); + GET_BE_U_4(fap->fa_nlink), + GET_BE_U_4(fap->fa2_rdev), + GET_BE_U_4(fap->fa2_fsid), + GET_BE_U_4(fap->fa2_fileid)); ND_PRINT(" %u.%06u", - EXTRACT_BE_U_4(fap->fa2_atime.nfsv2_sec), - EXTRACT_BE_U_4(fap->fa2_atime.nfsv2_usec)); + GET_BE_U_4(fap->fa2_atime.nfsv2_sec), + GET_BE_U_4(fap->fa2_atime.nfsv2_usec)); ND_PRINT(" %u.%06u", - EXTRACT_BE_U_4(fap->fa2_mtime.nfsv2_sec), - EXTRACT_BE_U_4(fap->fa2_mtime.nfsv2_usec)); + GET_BE_U_4(fap->fa2_mtime.nfsv2_sec), + GET_BE_U_4(fap->fa2_mtime.nfsv2_usec)); ND_PRINT(" %u.%06u", - EXTRACT_BE_U_4(fap->fa2_ctime.nfsv2_sec), - EXTRACT_BE_U_4(fap->fa2_ctime.nfsv2_usec)); + GET_BE_U_4(fap->fa2_ctime.nfsv2_sec), + GET_BE_U_4(fap->fa2_ctime.nfsv2_usec)); } } return ((const uint32_t *)((const unsigned char *)dp + @@ -1319,23 +1319,23 @@ parsestatfs(netdissect_options *ndo, if (v3) { ND_PRINT(" tbytes %" PRIu64 " fbytes %" PRIu64 " abytes %" PRIu64, - EXTRACT_BE_U_8(sfsp->sf_tbytes), - EXTRACT_BE_U_8(sfsp->sf_fbytes), - EXTRACT_BE_U_8(sfsp->sf_abytes)); + GET_BE_U_8(sfsp->sf_tbytes), + GET_BE_U_8(sfsp->sf_fbytes), + GET_BE_U_8(sfsp->sf_abytes)); if (ndo->ndo_vflag) { ND_PRINT(" tfiles %" PRIu64 " ffiles %" PRIu64 " afiles %" PRIu64 " invar %u", - EXTRACT_BE_U_8(sfsp->sf_tfiles), - EXTRACT_BE_U_8(sfsp->sf_ffiles), - EXTRACT_BE_U_8(sfsp->sf_afiles), - EXTRACT_BE_U_4(sfsp->sf_invarsec)); + GET_BE_U_8(sfsp->sf_tfiles), + GET_BE_U_8(sfsp->sf_ffiles), + GET_BE_U_8(sfsp->sf_afiles), + GET_BE_U_4(sfsp->sf_invarsec)); } } else { ND_PRINT(" tsize %u bsize %u blocks %u bfree %u bavail %u", - 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)); + GET_BE_U_4(sfsp->sf_tsize), + GET_BE_U_4(sfsp->sf_bsize), + GET_BE_U_4(sfsp->sf_blocks), + GET_BE_U_4(sfsp->sf_bfree), + GET_BE_U_4(sfsp->sf_bavail)); } return (1); @@ -1359,8 +1359,8 @@ parserddires(netdissect_options *ndo, ND_TCHECK_4(dp + 2); ND_PRINT(" offset 0x%x size %u ", - EXTRACT_BE_U_4(dp), EXTRACT_BE_U_4(dp + 1)); - if (EXTRACT_BE_U_4(dp + 2) != 0) + GET_BE_U_4(dp), GET_BE_U_4(dp + 1)); + if (GET_BE_U_4(dp + 2) != 0) ND_PRINT(" eof"); return (1); @@ -1373,10 +1373,10 @@ parse_wcc_attr(netdissect_options *ndo, const uint32_t *dp) { /* Our caller has already checked this */ - ND_PRINT(" sz %" PRIu64, EXTRACT_BE_U_8(dp)); + ND_PRINT(" sz %" PRIu64, GET_BE_U_8(dp)); ND_PRINT(" mtime %u.%06u ctime %u.%06u", - EXTRACT_BE_U_4(dp + 2), EXTRACT_BE_U_4(dp + 3), - EXTRACT_BE_U_4(dp + 4), EXTRACT_BE_U_4(dp + 5)); + GET_BE_U_4(dp + 2), GET_BE_U_4(dp + 3), + GET_BE_U_4(dp + 4), GET_BE_U_4(dp + 5)); return (dp + 6); } @@ -1388,7 +1388,7 @@ parse_pre_op_attr(netdissect_options *ndo, const uint32_t *dp, int verbose) { ND_TCHECK_4(dp); - if (!EXTRACT_BE_U_4(dp)) + if (!GET_BE_U_4(dp)) return (dp + 1); dp++; ND_TCHECK_LEN(dp, 24); @@ -1410,7 +1410,7 @@ parse_post_op_attr(netdissect_options *ndo, const uint32_t *dp, int verbose) { ND_TCHECK_4(dp); - if (!EXTRACT_BE_U_4(dp)) + if (!GET_BE_U_4(dp)) return (dp + 1); dp++; if (verbose) { @@ -1449,7 +1449,7 @@ parsecreateopres(netdissect_options *ndo, dp = parse_wcc_data(ndo, dp, verbose); else { ND_TCHECK_4(dp); - if (!EXTRACT_BE_U_4(dp)) + if (!GET_BE_U_4(dp)) return (dp + 1); dp++; dp = parsefh(ndo, dp, 1); @@ -1505,7 +1505,7 @@ parsev3rddirres(netdissect_options *ndo, * from the low-order byte to the high-order byte. */ ND_PRINT(" verf %08x%08x", - EXTRACT_BE_U_4(dp), EXTRACT_BE_U_4(dp + 1)); + GET_BE_U_4(dp), GET_BE_U_4(dp + 1)); dp += 2; } return dp; @@ -1534,19 +1534,19 @@ parsefsinfo(netdissect_options *ndo, sfp = (const struct nfsv3_fsinfo *)dp; ND_TCHECK_SIZE(sfp); ND_PRINT(" rtmax %u rtpref %u wtmax %u wtpref %u dtpref %u", - 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)); + GET_BE_U_4(sfp->fs_rtmax), + GET_BE_U_4(sfp->fs_rtpref), + GET_BE_U_4(sfp->fs_wtmax), + GET_BE_U_4(sfp->fs_wtpref), + GET_BE_U_4(sfp->fs_dtpref)); if (ndo->ndo_vflag) { ND_PRINT(" rtmult %u wtmult %u maxfsz %" PRIu64, - EXTRACT_BE_U_4(sfp->fs_rtmult), - EXTRACT_BE_U_4(sfp->fs_wtmult), - EXTRACT_BE_U_8(sfp->fs_maxfilesize)); + GET_BE_U_4(sfp->fs_rtmult), + GET_BE_U_4(sfp->fs_wtmult), + GET_BE_U_8(sfp->fs_maxfilesize)); ND_PRINT(" delta %u.%06u ", - EXTRACT_BE_U_4(sfp->fs_timedelta.nfsv3_sec), - EXTRACT_BE_U_4(sfp->fs_timedelta.nfsv3_nsec)); + GET_BE_U_4(sfp->fs_timedelta.nfsv3_sec), + GET_BE_U_4(sfp->fs_timedelta.nfsv3_nsec)); } return (1); trunc: @@ -1575,12 +1575,12 @@ parsepathconf(netdissect_options *ndo, ND_TCHECK_SIZE(spp); ND_PRINT(" linkmax %u namemax %u %s %s %s %s", - 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" : ""); + GET_BE_U_4(spp->pc_linkmax), + GET_BE_U_4(spp->pc_namemax), + GET_BE_U_4(spp->pc_notrunc) ? "notrunc" : "", + GET_BE_U_4(spp->pc_chownrestricted) ? "chownres" : "", + GET_BE_U_4(spp->pc_caseinsensitive) ? "igncase" : "", + GET_BE_U_4(spp->pc_casepreserving) ? "keepcase" : ""); return (1); trunc: return (0); @@ -1674,7 +1674,7 @@ interp_reply(netdissect_options *ndo, goto trunc; if (!er) { ND_TCHECK_4(dp); - ND_PRINT(" c %04x", EXTRACT_BE_U_4(dp)); + ND_PRINT(" c %04x", GET_BE_U_4(dp)); } break; @@ -1700,8 +1700,8 @@ interp_reply(netdissect_options *ndo, if (!er) { if (ndo->ndo_vflag) { ND_TCHECK_4(dp + 1); - ND_PRINT(" %u bytes", EXTRACT_BE_U_4(dp)); - if (EXTRACT_BE_U_4(dp + 1)) + ND_PRINT(" %u bytes", GET_BE_U_4(dp)); + if (GET_BE_U_4(dp + 1)) ND_PRINT(" EOF"); } } @@ -1725,16 +1725,17 @@ interp_reply(netdissect_options *ndo, if (!er) { if (ndo->ndo_vflag) { ND_TCHECK_4(dp); - ND_PRINT(" %u bytes", EXTRACT_BE_U_4(dp)); + ND_PRINT(" %u bytes", GET_BE_U_4(dp)); if (ndo->ndo_vflag > 1) { ND_TCHECK_4(dp + 1); ND_PRINT(" <%s>", tok2str(nfsv3_writemodes, - NULL, EXTRACT_BE_U_4(dp + 1))); + NULL, GET_BE_U_4(dp + 1))); /* write-verf-cookie */ ND_TCHECK_8(dp + 2); - ND_PRINT(" verf %" PRIx64, EXTRACT_BE_U_8(dp + 2)); + ND_PRINT(" verf %" PRIx64, + GET_BE_U_8(dp + 2)); } } } @@ -1898,7 +1899,7 @@ interp_reply(netdissect_options *ndo, if (ndo->ndo_vflag > 1) { /* write-verf-cookie */ ND_TCHECK_8(dp); - ND_PRINT(" verf %" PRIx64, EXTRACT_BE_U_8(dp)); + ND_PRINT(" verf %" PRIx64, GET_BE_U_8(dp)); } break; diff --git a/print-nsh.c b/print-nsh.c index 7de9002f..d752b247 100644 --- a/print-nsh.c +++ b/print-nsh.c @@ -68,18 +68,18 @@ nsh_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_TCHECK_LEN(bp, NSH_BASE_HDR_LEN + NSH_SERVICE_PATH_HDR_LEN); - ver = (uint8_t)(EXTRACT_U_1(bp) >> 6); - flags = EXTRACT_U_1(bp); + ver = (uint8_t)(GET_U_1(bp) >> 6); + flags = GET_U_1(bp); bp += 1; - length = EXTRACT_U_1(bp); + length = GET_U_1(bp); bp += 1; - md_type = EXTRACT_U_1(bp); + md_type = GET_U_1(bp); bp += 1; - next_protocol = EXTRACT_U_1(bp); + next_protocol = GET_U_1(bp); bp += 1; - service_path_id = EXTRACT_BE_U_3(bp); + service_path_id = GET_BE_U_3(bp); bp += 3; - service_index = EXTRACT_U_1(bp); + service_index = GET_U_1(bp); bp += 1; ND_PRINT("NSH, "); @@ -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_U_4(bp); + ctx = GET_BE_U_4(bp); bp += NSH_HDR_WORD_SIZE; ND_PRINT("\n Context[%02u]: 0x%08x", n, ctx); } @@ -125,11 +125,11 @@ 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_U_2(bp); + tlv_class = GET_BE_U_2(bp); bp += 2; - tlv_type = EXTRACT_U_1(bp); + tlv_type = GET_U_1(bp); bp += 1; - tlv_len = EXTRACT_U_1(bp); + tlv_len = GET_U_1(bp); bp += 1; ND_PRINT("\n TLV Class %u, Type %u, Len %u", @@ -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_U_4(bp); + ctx = GET_BE_U_4(bp); bp += NSH_HDR_WORD_SIZE; ND_PRINT("\n Value[%02u]: 0x%08x", vn, ctx); } diff --git a/print-ntp.c b/print-ntp.c index 9cfda05f..b60b5523 100644 --- a/print-ntp.c +++ b/print-ntp.c @@ -269,17 +269,17 @@ ntp_time_print(netdissect_options *ndo, goto invalid; ND_TCHECK_1(bp->stratum); - stratum = EXTRACT_U_1(bp->stratum); + stratum = GET_U_1(bp->stratum); ND_PRINT(", Stratum %u (%s)", stratum, tok2str(ntp_stratum_values, (stratum >=2 && stratum<=15) ? "secondary reference" : "reserved", stratum)); ND_TCHECK_1(bp->ppoll); - ND_PRINT(", poll %d", EXTRACT_S_1(bp->ppoll)); - p_poll(ndo, EXTRACT_S_1(bp->ppoll)); + ND_PRINT(", poll %d", GET_S_1(bp->ppoll)); + p_poll(ndo, GET_S_1(bp->ppoll)); ND_TCHECK_1(bp->precision); - ND_PRINT(", precision %d", EXTRACT_S_1(bp->precision)); + ND_PRINT(", precision %d", GET_S_1(bp->precision)); ND_TCHECK_SIZE(&bp->root_delay); ND_PRINT("\n\tRoot Delay: "); @@ -316,7 +316,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("0x%08x", EXTRACT_BE_U_4(bp->refid)); + ND_PRINT("0x%08x", GET_BE_U_4(bp->refid)); break; } @@ -345,26 +345,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_4(bp->key_id); - ND_PRINT("\n\tKey id: %u", EXTRACT_BE_U_4(bp->key_id)); + ND_PRINT("\n\tKey id: %u", GET_BE_U_4(bp->key_id)); } else if (length == NTP_TIMEMSG_MINLEN + 4 + 16) { /* Optional: key-id + 128-bit digest */ ND_TCHECK_4(bp->key_id); - ND_PRINT("\n\tKey id: %u", EXTRACT_BE_U_4(bp->key_id)); + ND_PRINT("\n\tKey id: %u", GET_BE_U_4(bp->key_id)); ND_TCHECK_LEN(bp->message_digest, 16); ND_PRINT("\n\tAuthentication: %08x%08x%08x%08x", - 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)); + GET_BE_U_4(bp->message_digest), + GET_BE_U_4(bp->message_digest + 4), + GET_BE_U_4(bp->message_digest + 8), + GET_BE_U_4(bp->message_digest + 12)); } else if (length == NTP_TIMEMSG_MINLEN + 4 + 20) { /* Optional: key-id + 160-bit digest */ ND_TCHECK_4(bp->key_id); - ND_PRINT("\n\tKey id: %u", EXTRACT_BE_U_4(bp->key_id)); + ND_PRINT("\n\tKey id: %u", GET_BE_U_4(bp->key_id)); ND_TCHECK_LEN(bp->message_digest, 20); ND_PRINT("\n\tAuthentication: %08x%08x%08x%08x%08x", - 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)); + GET_BE_U_4(bp->message_digest), + GET_BE_U_4(bp->message_digest + 4), + GET_BE_U_4(bp->message_digest + 8), + GET_BE_U_4(bp->message_digest + 12), + GET_BE_U_4(bp->message_digest + 16)); } else if (length > NTP_TIMEMSG_MINLEN) { ND_PRINT("\n\t(%u more bytes after the header)", length - NTP_TIMEMSG_MINLEN); } @@ -393,7 +393,7 @@ ntp_control_print(netdissect_options *ndo, goto invalid; ND_TCHECK_1(cd->control); - control = EXTRACT_U_1(cd->control); + control = GET_U_1(cd->control); R = (control & 0x80) != 0; E = (control & 0x40) != 0; M = (control & 0x20) != 0; @@ -403,23 +403,23 @@ ntp_control_print(netdissect_options *ndo, M ? "More" : "Last", opcode); ND_TCHECK_2(cd->sequence); - sequence = EXTRACT_BE_U_2(cd->sequence); + sequence = GET_BE_U_2(cd->sequence); ND_PRINT("\tSequence=%hu", sequence); ND_TCHECK_2(cd->status); - status = EXTRACT_BE_U_2(cd->status); + status = GET_BE_U_2(cd->status); ND_PRINT(", Status=%#hx", status); ND_TCHECK_2(cd->assoc); - assoc = EXTRACT_BE_U_2(cd->assoc); + assoc = GET_BE_U_2(cd->assoc); ND_PRINT(", Assoc.=%hu", assoc); ND_TCHECK_2(cd->offset); - offset = EXTRACT_BE_U_2(cd->offset); + offset = GET_BE_U_2(cd->offset); ND_PRINT(", Offset=%hu", offset); ND_TCHECK_2(cd->count); - count = EXTRACT_BE_U_2(cd->count); + count = GET_BE_U_2(cd->count); ND_PRINT(", Count=%hu", count); if (NTP_CTRLMSG_MINLEN + count > length) @@ -457,7 +457,7 @@ ntp_print(netdissect_options *ndo, ndo->ndo_protocol = "ntp"; ND_TCHECK_1(bp->td.status); - status = EXTRACT_U_1(bp->td.status); + status = GET_U_1(bp->td.status); version = (status & VERSIONMASK) >> VERSIONSHIFT; ND_PRINT("NTPv%u", version); @@ -511,8 +511,8 @@ p_sfix(netdissect_options *ndo, int f; double ff; - i = EXTRACT_BE_U_2(sfp->int_part); - f = EXTRACT_BE_U_2(sfp->fraction); + i = GET_BE_U_2(sfp->int_part); + f = GET_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("%d.%06d", i, f); @@ -529,8 +529,8 @@ p_ntp_time(netdissect_options *ndo, uint32_t f; double ff; - i = EXTRACT_BE_U_4(lfp->int_part); - uf = EXTRACT_BE_U_4(lfp->fraction); + i = GET_BE_U_4(lfp->int_part); + uf = GET_BE_U_4(lfp->fraction); ff = uf; if (ff < 0.0) /* some compilers are buggy */ ff += FMAXINT; @@ -587,10 +587,10 @@ p_ntp_delta(netdissect_options *ndo, double ff; int signbit; - 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); + u = GET_BE_U_4(lfp->int_part); + ou = GET_BE_U_4(olfp->int_part); + uf = GET_BE_U_4(lfp->fraction); + ouf = GET_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 f22c82a8..8e3adbbb 100644 --- a/print-olsr.c +++ b/print-olsr.c @@ -245,8 +245,8 @@ olsr_print_lq_neighbor4(netdissect_options *ndo, ND_PRINT("\n\t neighbor %s, link-quality %.2f%%" ", neighbor-link-quality %.2f%%", ipaddr_string(ndo, lq_neighbor->neighbor), - ((double)EXTRACT_U_1(lq_neighbor->link_quality)/2.55), - ((double)EXTRACT_U_1(lq_neighbor->neighbor_link_quality)/2.55)); + ((double) GET_U_1(lq_neighbor->link_quality)/2.55), + ((double) GET_U_1(lq_neighbor->neighbor_link_quality)/2.55)); msg_data += sizeof(struct olsr_lq_neighbor4); hello_len -= sizeof(struct olsr_lq_neighbor4); @@ -270,8 +270,8 @@ olsr_print_lq_neighbor6(netdissect_options *ndo, ND_PRINT("\n\t neighbor %s, link-quality %.2f%%" ", neighbor-link-quality %.2f%%", ip6addr_string(ndo, lq_neighbor->neighbor), - ((double)EXTRACT_U_1(lq_neighbor->link_quality)/2.55), - ((double)EXTRACT_U_1(lq_neighbor->neighbor_link_quality)/2.55)); + ((double) GET_U_1(lq_neighbor->link_quality)/2.55), + ((double) GET_U_1(lq_neighbor->neighbor_link_quality)/2.55)); msg_data += sizeof(struct olsr_lq_neighbor6); hello_len -= sizeof(struct olsr_lq_neighbor6); @@ -340,11 +340,11 @@ olsr_print(netdissect_options *ndo, ND_TCHECK_LEN(tptr, sizeof(struct olsr_common)); ptr.common = (const struct olsr_common *)tptr; - length = min(length, EXTRACT_BE_U_2(ptr.common->packet_len)); + length = min(length, GET_BE_U_2(ptr.common->packet_len)); ND_PRINT("OLSRv%i, seq 0x%04x, length %u", (is_ipv6 == 0) ? 4 : 6, - EXTRACT_BE_U_2(ptr.common->packet_seq), + GET_BE_U_2(ptr.common->packet_seq), length); tptr += sizeof(struct olsr_common); @@ -368,8 +368,8 @@ olsr_print(netdissect_options *ndo, { ND_TCHECK_LEN(tptr, sizeof(struct olsr_msg6)); msgptr.v6 = (const struct olsr_msg6 *) tptr; - msg_type = EXTRACT_U_1(msgptr.v6->msg_type); - msg_len = EXTRACT_BE_U_2(msgptr.v6->msg_len); + msg_type = GET_U_1(msgptr.v6->msg_type); + msg_len = GET_BE_U_2(msgptr.v6->msg_len); if ((msg_len >= sizeof (struct olsr_msg6)) && (msg_len <= length)) msg_len_valid = 1; @@ -383,10 +383,10 @@ olsr_print(netdissect_options *ndo, "\n\t vtime %.3fs, msg-seq 0x%04x, length %u%s", tok2str(olsr_msg_values, "Unknown", msg_type), msg_type, ip6addr_string(ndo, msgptr.v6->originator), - EXTRACT_U_1(msgptr.v6->ttl), - EXTRACT_U_1(msgptr.v6->hopcount), - ME_TO_DOUBLE(EXTRACT_U_1(msgptr.v6->vtime)), - EXTRACT_BE_U_2(msgptr.v6->msg_seq), + GET_U_1(msgptr.v6->ttl), + GET_U_1(msgptr.v6->hopcount), + ME_TO_DOUBLE(GET_U_1(msgptr.v6->vtime)), + GET_BE_U_2(msgptr.v6->msg_seq), msg_len, (msg_len_valid == 0) ? " (invalid)" : ""); if (!msg_len_valid) { return; @@ -399,8 +399,8 @@ olsr_print(netdissect_options *ndo, { ND_TCHECK_LEN(tptr, sizeof(struct olsr_msg4)); msgptr.v4 = (const struct olsr_msg4 *) tptr; - msg_type = EXTRACT_U_1(msgptr.v4->msg_type); - msg_len = EXTRACT_BE_U_2(msgptr.v4->msg_len); + msg_type = GET_U_1(msgptr.v4->msg_type); + msg_len = GET_BE_U_2(msgptr.v4->msg_len); if ((msg_len >= sizeof (struct olsr_msg4)) && (msg_len <= length)) msg_len_valid = 1; @@ -414,10 +414,10 @@ olsr_print(netdissect_options *ndo, "\n\t vtime %.3fs, msg-seq 0x%04x, length %u%s", tok2str(olsr_msg_values, "Unknown", msg_type), msg_type, ipaddr_string(ndo, msgptr.v4->originator), - EXTRACT_U_1(msgptr.v4->ttl), - EXTRACT_U_1(msgptr.v4->hopcount), - ME_TO_DOUBLE(EXTRACT_U_1(msgptr.v4->vtime)), - EXTRACT_BE_U_2(msgptr.v4->msg_seq), + GET_U_1(msgptr.v4->ttl), + GET_U_1(msgptr.v4->hopcount), + ME_TO_DOUBLE(GET_U_1(msgptr.v4->vtime)), + GET_BE_U_2(msgptr.v4->msg_seq), msg_len, (msg_len_valid == 0) ? " (invalid)" : ""); if (!msg_len_valid) { return; @@ -436,8 +436,8 @@ olsr_print(netdissect_options *ndo, ptr.hello = (const struct olsr_hello *)msg_data; ND_PRINT("\n\t hello-time %.3fs, MPR willingness %u", - ME_TO_DOUBLE(EXTRACT_U_1(ptr.hello->htime)), - EXTRACT_U_1(ptr.hello->will)); + ME_TO_DOUBLE(GET_U_1(ptr.hello->htime)), + GET_U_1(ptr.hello->will)); msg_data += sizeof(struct olsr_hello); msg_tlen -= sizeof(struct olsr_hello); @@ -451,9 +451,9 @@ olsr_print(netdissect_options *ndo, ptr.hello_link = (const struct olsr_hello_link *)msg_data; - hello_len = EXTRACT_BE_U_2(ptr.hello_link->len); - link_type = OLSR_EXTRACT_LINK_TYPE(EXTRACT_U_1(ptr.hello_link->link_code)); - neighbor_type = OLSR_EXTRACT_NEIGHBOR_TYPE(EXTRACT_U_1(ptr.hello_link->link_code)); + hello_len = GET_BE_U_2(ptr.hello_link->len); + link_type = OLSR_EXTRACT_LINK_TYPE(GET_U_1(ptr.hello_link->link_code)); + neighbor_type = OLSR_EXTRACT_NEIGHBOR_TYPE(GET_U_1(ptr.hello_link->link_code)); if ((hello_len <= msg_tlen) && (hello_len >= sizeof(struct olsr_hello_link))) @@ -499,7 +499,7 @@ olsr_print(netdissect_options *ndo, ptr.tc = (const struct olsr_tc *)msg_data; ND_PRINT("\n\t advertised neighbor seq 0x%04x", - EXTRACT_BE_U_2(ptr.tc->ans_seq)); + GET_BE_U_2(ptr.tc->ans_seq)); msg_data += sizeof(struct olsr_tc); msg_tlen -= sizeof(struct olsr_tc); @@ -609,7 +609,7 @@ olsr_print(netdissect_options *ndo, ND_PRINT("%s%s/%u", col == 0 ? "\n\t " : ", ", ipaddr_string(ndo, ptr.hna->network), - mask2plen(EXTRACT_BE_U_4(ptr.hna->mask))); + mask2plen(GET_BE_U_4(ptr.hna->mask))); } msg_data += sizeof(struct olsr_hna4); @@ -631,7 +631,7 @@ olsr_print(netdissect_options *ndo, goto trunc; ND_TCHECK_4(msg_data); - name_entries = EXTRACT_BE_U_2(msg_data + 2); + name_entries = GET_BE_U_2(msg_data + 2); addr_size = 4; if (is_ipv6) addr_size = 16; @@ -642,7 +642,7 @@ olsr_print(netdissect_options *ndo, name_entries_valid = 1; ND_PRINT("\n\t Version %u, Entries %u%s", - EXTRACT_BE_U_2(msg_data), + GET_BE_U_2(msg_data), name_entries, (name_entries_valid == 0) ? " (invalid)" : ""); if (name_entries_valid == 0) @@ -658,8 +658,8 @@ olsr_print(netdissect_options *ndo, break; ND_TCHECK_4(msg_data); - name_entry_type = EXTRACT_BE_U_2(msg_data); - name_entry_len = EXTRACT_BE_U_2(msg_data + 2); + name_entry_type = GET_BE_U_2(msg_data); + name_entry_len = GET_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 d019f492..12051992 100644 --- a/print-openflow-1.0.c +++ b/print-openflow-1.0.c @@ -761,7 +761,7 @@ of10_bsn_message_print(netdissect_options *ndo, goto invalid; /* subtype */ ND_TCHECK_4(cp); - subtype = EXTRACT_BE_U_4(cp); + subtype = GET_BE_U_4(cp); cp += 4; ND_PRINT("\n\t subtype %s", tok2str(bsn_subtype_str, "unknown (0x%08x)", subtype)); switch (subtype) { @@ -782,7 +782,7 @@ of10_bsn_message_print(netdissect_options *ndo, goto invalid; /* index */ ND_TCHECK_1(cp); - ND_PRINT(", index %u", EXTRACT_U_1(cp)); + ND_PRINT(", index %u", GET_U_1(cp)); cp += 1; /* pad */ ND_TCHECK_7(cp); @@ -806,7 +806,7 @@ of10_bsn_message_print(netdissect_options *ndo, goto invalid; /* index */ ND_TCHECK_1(cp); - ND_PRINT(", index %u", EXTRACT_U_1(cp)); + ND_PRINT(", index %u", GET_U_1(cp)); cp += 1; /* pad */ ND_TCHECK_3(cp); @@ -833,7 +833,8 @@ of10_bsn_message_print(netdissect_options *ndo, goto invalid; /* report_mirror_ports */ ND_TCHECK_1(cp); - ND_PRINT(", report_mirror_ports %s", tok2str(bsn_onoff_str, "bogus (%u)", EXTRACT_U_1(cp))); + ND_PRINT(", report_mirror_ports %s", + tok2str(bsn_onoff_str, "bogus (%u)", GET_U_1(cp))); cp += 1; /* pad */ ND_TCHECK_3(cp); @@ -870,7 +871,7 @@ of10_bsn_message_print(netdissect_options *ndo, goto invalid; /* vport_no */ ND_TCHECK_4(cp); - ND_PRINT(", vport_no %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(", vport_no %u", GET_BE_U_4(cp)); cp += 4; break; case BSN_SHELL_COMMAND: @@ -890,7 +891,7 @@ of10_bsn_message_print(netdissect_options *ndo, goto invalid; /* service */ ND_TCHECK_4(cp); - ND_PRINT(", service %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(", service %u", GET_BE_U_4(cp)); cp += 4; /* data */ ND_PRINT(", data '"); @@ -937,7 +938,7 @@ of10_bsn_message_print(netdissect_options *ndo, goto invalid; /* status */ ND_TCHECK_4(cp); - ND_PRINT(", status 0x%08x", EXTRACT_BE_U_4(cp)); + ND_PRINT(", status 0x%08x", GET_BE_U_4(cp)); cp += 4; break; default: @@ -966,7 +967,7 @@ of10_bsn_actions_print(netdissect_options *ndo, goto invalid; /* subtype */ ND_TCHECK_4(cp); - subtype = EXTRACT_BE_U_4(cp); + subtype = GET_BE_U_4(cp); cp += 4; ND_PRINT("\n\t subtype %s", tok2str(bsn_action_subtype_str, "unknown (0x%08x)", subtype)); switch (subtype) { @@ -989,11 +990,11 @@ of10_bsn_actions_print(netdissect_options *ndo, goto invalid; /* dest_port */ ND_TCHECK_4(cp); - ND_PRINT(", dest_port %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(", dest_port %u", GET_BE_U_4(cp)); cp += 4; /* vlan_tag */ ND_TCHECK_4(cp); - vlan_tag = EXTRACT_BE_U_4(cp); + vlan_tag = GET_BE_U_4(cp); cp += 4; switch (vlan_tag >> 16) { case 0: @@ -1007,7 +1008,8 @@ of10_bsn_actions_print(netdissect_options *ndo, } /* copy_stage */ ND_TCHECK_1(cp); - ND_PRINT(", copy_stage %s", tok2str(bsn_mirror_copy_stage_str, "unknown (%u)", EXTRACT_U_1(cp))); + ND_PRINT(", copy_stage %s", + tok2str(bsn_mirror_copy_stage_str, "unknown (%u)", GET_U_1(cp))); cp += 1; /* pad */ ND_TCHECK_3(cp); @@ -1040,7 +1042,7 @@ of10_vendor_action_print(netdissect_options *ndo, goto invalid; /* vendor */ ND_TCHECK_4(cp); - vendor = EXTRACT_BE_U_4(cp); + vendor = GET_BE_U_4(cp); cp += 4; ND_PRINT(", vendor 0x%08x (%s)", vendor, of_vendor_name(vendor)); /* data */ @@ -1069,7 +1071,7 @@ of10_vendor_message_print(netdissect_options *ndo, goto invalid; /* vendor */ ND_TCHECK_4(cp); - vendor = EXTRACT_BE_U_4(cp); + vendor = GET_BE_U_4(cp); cp += 4; ND_PRINT(", vendor 0x%08x (%s)", vendor, of_vendor_name(vendor)); /* data */ @@ -1098,7 +1100,7 @@ of10_vendor_data_print(netdissect_options *ndo, goto invalid; /* vendor */ ND_TCHECK_4(cp); - vendor = EXTRACT_BE_U_4(cp); + vendor = GET_BE_U_4(cp); cp += 4; ND_PRINT(", vendor 0x%08x (%s)", vendor, of_vendor_name(vendor)); /* data */ @@ -1148,7 +1150,8 @@ of10_phy_ports_print(netdissect_options *ndo, goto invalid; /* port_no */ ND_TCHECK_2(cp); - ND_PRINT("\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))); + ND_PRINT("\n\t port_no %s", + tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); cp += 2; /* hw_addr */ ND_TCHECK_LEN(cp, MAC_ADDR_LEN); @@ -1168,38 +1171,38 @@ of10_phy_ports_print(netdissect_options *ndo, } /* config */ ND_TCHECK_4(cp); - ND_PRINT("\n\t config 0x%08x", EXTRACT_BE_U_4(cp)); - of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_U_4(cp), + ND_PRINT("\n\t config 0x%08x", GET_BE_U_4(cp)); + of10_bitmap_print(ndo, ofppc_bm, GET_BE_U_4(cp), OFPPC_U); cp += 4; /* state */ ND_TCHECK_4(cp); - ND_PRINT("\n\t state 0x%08x", EXTRACT_BE_U_4(cp)); - of10_bitmap_print(ndo, ofpps_bm, EXTRACT_BE_U_4(cp), + ND_PRINT("\n\t state 0x%08x", GET_BE_U_4(cp)); + of10_bitmap_print(ndo, ofpps_bm, GET_BE_U_4(cp), OFPPS_U); cp += 4; /* curr */ ND_TCHECK_4(cp); - ND_PRINT("\n\t curr 0x%08x", EXTRACT_BE_U_4(cp)); - of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_U_4(cp), + ND_PRINT("\n\t curr 0x%08x", GET_BE_U_4(cp)); + of10_bitmap_print(ndo, ofppf_bm, GET_BE_U_4(cp), OFPPF_U); cp += 4; /* advertised */ ND_TCHECK_4(cp); - ND_PRINT("\n\t advertised 0x%08x", EXTRACT_BE_U_4(cp)); - of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_U_4(cp), + ND_PRINT("\n\t advertised 0x%08x", GET_BE_U_4(cp)); + of10_bitmap_print(ndo, ofppf_bm, GET_BE_U_4(cp), OFPPF_U); cp += 4; /* supported */ ND_TCHECK_4(cp); - ND_PRINT("\n\t supported 0x%08x", EXTRACT_BE_U_4(cp)); - of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_U_4(cp), + ND_PRINT("\n\t supported 0x%08x", GET_BE_U_4(cp)); + of10_bitmap_print(ndo, ofppf_bm, GET_BE_U_4(cp), OFPPF_U); cp += 4; /* peer */ ND_TCHECK_4(cp); - ND_PRINT("\n\t peer 0x%08x", EXTRACT_BE_U_4(cp)); - of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_U_4(cp), + ND_PRINT("\n\t peer 0x%08x", GET_BE_U_4(cp)); + of10_bitmap_print(ndo, ofppf_bm, GET_BE_U_4(cp), OFPPF_U); cp += 4; next_port: @@ -1232,12 +1235,12 @@ of10_queue_props_print(netdissect_options *ndo, goto invalid; /* property */ ND_TCHECK_2(cp); - property = EXTRACT_BE_U_2(cp); + property = GET_BE_U_2(cp); cp += 2; ND_PRINT("\n\t property %s", tok2str(ofpqt_str, "invalid (0x%04x)", property)); /* len */ ND_TCHECK_2(cp); - plen = EXTRACT_BE_U_2(cp); + plen = GET_BE_U_2(cp); cp += 2; ND_PRINT(", len %u", plen); if (plen < OF_QUEUE_PROP_HEADER_LEN || plen > len) @@ -1268,7 +1271,7 @@ of10_queue_props_print(netdissect_options *ndo, if (property == OFPQT_MIN_RATE) { /* the only case of property decoding */ /* rate */ ND_TCHECK_2(cp); - rate = EXTRACT_BE_U_2(cp); + rate = GET_BE_U_2(cp); cp += 2; if (rate > 1000) ND_PRINT(", rate disabled"); @@ -1306,11 +1309,11 @@ of10_queues_print(netdissect_options *ndo, goto invalid; /* queue_id */ ND_TCHECK_4(cp); - ND_PRINT("\n\t queue_id %u", EXTRACT_BE_U_4(cp)); + ND_PRINT("\n\t queue_id %u", GET_BE_U_4(cp)); cp += 4; /* len */ ND_TCHECK_2(cp); - desclen = EXTRACT_BE_U_2(cp); + desclen = GET_BE_U_2(cp); cp += 2; ND_PRINT(", len %u", desclen); if (desclen < OF_PACKET_QUEUE_LEN || desclen > len) @@ -1353,14 +1356,15 @@ of10_match_print(netdissect_options *ndo, /* wildcards */ ND_TCHECK_4(cp); - wildcards = EXTRACT_BE_U_4(cp); + wildcards = GET_BE_U_4(cp); if (wildcards & OFPFW_U) ND_PRINT("%swildcards 0x%08x (bogus)", pfx, wildcards); cp += 4; /* in_port */ ND_TCHECK_2(cp); if (! (wildcards & OFPFW_IN_PORT)) - ND_PRINT("%smatch in_port %s", pfx, tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))); + ND_PRINT("%smatch in_port %s", pfx, + tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); cp += 2; /* dl_src */ ND_TCHECK_LEN(cp, MAC_ADDR_LEN); @@ -1375,30 +1379,30 @@ of10_match_print(netdissect_options *ndo, /* dl_vlan */ ND_TCHECK_2(cp); if (! (wildcards & OFPFW_DL_VLAN)) - ND_PRINT("%smatch dl_vlan %s", pfx, vlan_str(EXTRACT_BE_U_2(cp))); + ND_PRINT("%smatch dl_vlan %s", pfx, vlan_str(GET_BE_U_2(cp))); cp += 2; /* dl_vlan_pcp */ ND_TCHECK_1(cp); if (! (wildcards & OFPFW_DL_VLAN_PCP)) - ND_PRINT("%smatch dl_vlan_pcp %s", pfx, pcp_str(EXTRACT_U_1(cp))); + ND_PRINT("%smatch dl_vlan_pcp %s", pfx, pcp_str(GET_U_1(cp))); cp += 1; /* pad1 */ ND_TCHECK_1(cp); cp += 1; /* dl_type */ ND_TCHECK_2(cp); - dl_type = EXTRACT_BE_U_2(cp); + dl_type = GET_BE_U_2(cp); cp += 2; if (! (wildcards & OFPFW_DL_TYPE)) ND_PRINT("%smatch dl_type 0x%04x", pfx, dl_type); /* nw_tos */ ND_TCHECK_1(cp); if (! (wildcards & OFPFW_NW_TOS)) - ND_PRINT("%smatch nw_tos 0x%02x", pfx, EXTRACT_U_1(cp)); + ND_PRINT("%smatch nw_tos 0x%02x", pfx, GET_U_1(cp)); cp += 1; /* nw_proto */ ND_TCHECK_1(cp); - nw_proto = EXTRACT_U_1(cp); + nw_proto = GET_U_1(cp); cp += 1; if (! (wildcards & OFPFW_NW_PROTO)) { field_name = ! (wildcards & OFPFW_DL_TYPE) && dl_type == ETHERTYPE_ARP @@ -1426,7 +1430,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("%smatch %s %u", pfx, field_name, EXTRACT_BE_U_2(cp)); + ND_PRINT("%smatch %s %u", pfx, field_name, GET_BE_U_2(cp)); } cp += 2; /* tp_dst */ @@ -1435,7 +1439,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("%smatch %s %u", pfx, field_name, EXTRACT_BE_U_2(cp)); + ND_PRINT("%smatch %s %u", pfx, field_name, GET_BE_U_2(cp)); } return cp + 2; @@ -1461,12 +1465,12 @@ of10_actions_print(netdissect_options *ndo, goto invalid; /* type */ ND_TCHECK_2(cp); - type = EXTRACT_BE_U_2(cp); + type = GET_BE_U_2(cp); cp += 2; ND_PRINT("%saction type %s", pfx, tok2str(ofpat_str, "invalid (0x%04x)", type)); /* length */ ND_TCHECK_2(cp); - alen = EXTRACT_BE_U_2(cp); + alen = GET_BE_U_2(cp); cp += 2; ND_PRINT(", len %u", alen); /* On action size underrun/overrun skip the rest of the action list. */ @@ -1511,19 +1515,19 @@ of10_actions_print(netdissect_options *ndo, case OFPAT_OUTPUT: /* port */ ND_TCHECK_2(cp); - output_port = EXTRACT_BE_U_2(cp); + output_port = GET_BE_U_2(cp); cp += 2; ND_PRINT(", port %s", tok2str(ofpp_str, "%u", output_port)); /* max_len */ ND_TCHECK_2(cp); if (output_port == OFPP_CONTROLLER) - ND_PRINT(", max_len %u", EXTRACT_BE_U_2(cp)); + ND_PRINT(", max_len %u", GET_BE_U_2(cp)); cp += 2; break; case OFPAT_SET_VLAN_VID: /* vlan_vid */ ND_TCHECK_2(cp); - ND_PRINT(", vlan_vid %s", vlan_str(EXTRACT_BE_U_2(cp))); + ND_PRINT(", vlan_vid %s", vlan_str(GET_BE_U_2(cp))); cp += 2; /* pad */ ND_TCHECK_2(cp); @@ -1532,7 +1536,7 @@ of10_actions_print(netdissect_options *ndo, case OFPAT_SET_VLAN_PCP: /* vlan_pcp */ ND_TCHECK_1(cp); - ND_PRINT(", vlan_pcp %s", pcp_str(EXTRACT_U_1(cp))); + ND_PRINT(", vlan_pcp %s", pcp_str(GET_U_1(cp))); cp += 1; /* pad */ ND_TCHECK_3(cp); @@ -1558,7 +1562,7 @@ of10_actions_print(netdissect_options *ndo, case OFPAT_SET_NW_TOS: /* nw_tos */ ND_TCHECK_1(cp); - ND_PRINT(", nw_tos 0x%02x", EXTRACT_U_1(cp)); + ND_PRINT(", nw_tos 0x%02x", GET_U_1(cp)); cp += 1; /* pad */ ND_TCHECK_3(cp); @@ -1568,7 +1572,7 @@ of10_actions_print(netdissect_options *ndo, case OFPAT_SET_TP_DST: /* nw_tos */ ND_TCHECK_2(cp); - ND_PRINT(", tp_port %u", EXTRACT_BE_U_2(cp)); + ND_PRINT(", tp_port %u", GET_BE_U_2(cp)); cp += 2; /* pad */ ND_TCHECK_2(cp); @@ -1577,14 +1581,16 @@ of10_actions_print(netdissect_options *ndo, case OFPAT_ENQUEUE: /* port */ ND_TCHECK_2(cp); - ND_PRINT(", port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))); + ND_PRINT(", port %s", + tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); cp += 2; /* pad */ ND_TCHECK_6(cp); cp += 6; /* queue_id */ ND_TCHECK_4(cp); - ND_PRINT(", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_BE_U_4(cp))); + ND_PRINT(", queue_id %s", + tok2str(ofpq_str, "%u", GET_BE_U_4(cp))); cp += 4; break; case OFPAT_VENDOR: @@ -1618,29 +1624,29 @@ of10_features_reply_print(netdissect_options *ndo, { /* datapath_id */ ND_TCHECK_8(cp); - ND_PRINT("\n\t dpid 0x%016" PRIx64, EXTRACT_BE_U_8(cp)); + ND_PRINT("\n\t dpid 0x%016" PRIx64, GET_BE_U_8(cp)); cp += 8; /* n_buffers */ ND_TCHECK_4(cp); - ND_PRINT(", n_buffers %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(", n_buffers %u", GET_BE_U_4(cp)); cp += 4; /* n_tables */ ND_TCHECK_1(cp); - ND_PRINT(", n_tables %u", EXTRACT_U_1(cp)); + ND_PRINT(", n_tables %u", GET_U_1(cp)); cp += 1; /* pad */ ND_TCHECK_3(cp); cp += 3; /* capabilities */ ND_TCHECK_4(cp); - ND_PRINT("\n\t capabilities 0x%08x", EXTRACT_BE_U_4(cp)); - of10_bitmap_print(ndo, ofp_capabilities_bm, EXTRACT_BE_U_4(cp), + ND_PRINT("\n\t capabilities 0x%08x", GET_BE_U_4(cp)); + of10_bitmap_print(ndo, ofp_capabilities_bm, GET_BE_U_4(cp), OFPCAP_U); cp += 4; /* actions */ ND_TCHECK_4(cp); - ND_PRINT("\n\t actions 0x%08x", EXTRACT_BE_U_4(cp)); - of10_bitmap_print(ndo, ofpat_bm, EXTRACT_BE_U_4(cp), OFPAT_U); + ND_PRINT("\n\t actions 0x%08x", GET_BE_U_4(cp)); + of10_bitmap_print(ndo, ofpat_bm, GET_BE_U_4(cp), OFPAT_U); cp += 4; /* ports */ return of10_phy_ports_print(ndo, cp, ep, len - OF_SWITCH_FEATURES_LEN); @@ -1662,43 +1668,45 @@ of10_flow_mod_print(netdissect_options *ndo, return ep; /* end of snapshot */ /* cookie */ ND_TCHECK_8(cp); - ND_PRINT("\n\t cookie 0x%016" PRIx64, EXTRACT_BE_U_8(cp)); + ND_PRINT("\n\t cookie 0x%016" PRIx64, GET_BE_U_8(cp)); cp += 8; /* command */ ND_TCHECK_2(cp); - command = EXTRACT_BE_U_2(cp); + command = GET_BE_U_2(cp); ND_PRINT(", command %s", tok2str(ofpfc_str, "invalid (0x%04x)", command)); cp += 2; /* idle_timeout */ ND_TCHECK_2(cp); - if (EXTRACT_BE_U_2(cp)) - ND_PRINT(", idle_timeout %u", EXTRACT_BE_U_2(cp)); + if (GET_BE_U_2(cp)) + ND_PRINT(", idle_timeout %u", GET_BE_U_2(cp)); cp += 2; /* hard_timeout */ ND_TCHECK_2(cp); - if (EXTRACT_BE_U_2(cp)) - ND_PRINT(", hard_timeout %u", EXTRACT_BE_U_2(cp)); + if (GET_BE_U_2(cp)) + ND_PRINT(", hard_timeout %u", GET_BE_U_2(cp)); cp += 2; /* priority */ ND_TCHECK_2(cp); - if (EXTRACT_BE_U_2(cp)) - ND_PRINT(", priority %u", EXTRACT_BE_U_2(cp)); + if (GET_BE_U_2(cp)) + ND_PRINT(", priority %u", GET_BE_U_2(cp)); cp += 2; /* buffer_id */ ND_TCHECK_4(cp); if (command == OFPFC_ADD || command == OFPFC_MODIFY || command == OFPFC_MODIFY_STRICT) - ND_PRINT(", buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_BE_U_4(cp))); + ND_PRINT(", buffer_id %s", + tok2str(bufferid_str, "0x%08x", GET_BE_U_4(cp))); cp += 4; /* out_port */ ND_TCHECK_2(cp); if (command == OFPFC_DELETE || command == OFPFC_DELETE_STRICT) - ND_PRINT(", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))); + ND_PRINT(", out_port %s", + tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); cp += 2; /* flags */ ND_TCHECK_2(cp); - ND_PRINT(", flags 0x%04x", EXTRACT_BE_U_2(cp)); - of10_bitmap_print(ndo, ofpff_bm, EXTRACT_BE_U_2(cp), OFPFF_U); + ND_PRINT(", flags 0x%04x", GET_BE_U_2(cp)); + of10_bitmap_print(ndo, ofpff_bm, GET_BE_U_2(cp), OFPFF_U); cp += 2; /* actions */ return of10_actions_print(ndo, "\n\t ", cp, ep, len - OF_FLOW_MOD_LEN); @@ -1715,7 +1723,7 @@ of10_port_mod_print(netdissect_options *ndo, { /* port_no */ ND_TCHECK_2(cp); - ND_PRINT("\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))); + ND_PRINT("\n\t port_no %s", tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); cp += 2; /* hw_addr */ ND_TCHECK_LEN(cp, MAC_ADDR_LEN); @@ -1723,18 +1731,18 @@ of10_port_mod_print(netdissect_options *ndo, cp += MAC_ADDR_LEN; /* config */ ND_TCHECK_4(cp); - ND_PRINT("\n\t config 0x%08x", EXTRACT_BE_U_4(cp)); - of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_U_4(cp), OFPPC_U); + ND_PRINT("\n\t config 0x%08x", GET_BE_U_4(cp)); + of10_bitmap_print(ndo, ofppc_bm, GET_BE_U_4(cp), OFPPC_U); cp += 4; /* mask */ ND_TCHECK_4(cp); - ND_PRINT("\n\t mask 0x%08x", EXTRACT_BE_U_4(cp)); - of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_U_4(cp), OFPPC_U); + ND_PRINT("\n\t mask 0x%08x", GET_BE_U_4(cp)); + of10_bitmap_print(ndo, ofppc_bm, GET_BE_U_4(cp), OFPPC_U); cp += 4; /* advertise */ ND_TCHECK_4(cp); - ND_PRINT("\n\t advertise 0x%08x", EXTRACT_BE_U_4(cp)); - of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_U_4(cp), OFPPF_U); + ND_PRINT("\n\t advertise 0x%08x", GET_BE_U_4(cp)); + of10_bitmap_print(ndo, ofppf_bm, GET_BE_U_4(cp), OFPPF_U); cp += 4; /* pad */ ND_TCHECK_4(cp); @@ -1756,13 +1764,13 @@ of10_stats_request_print(netdissect_options *ndo, /* type */ ND_TCHECK_2(cp); - type = EXTRACT_BE_U_2(cp); + type = GET_BE_U_2(cp); cp += 2; ND_PRINT("\n\t type %s", tok2str(ofpst_str, "invalid (0x%04x)", type)); /* flags */ ND_TCHECK_2(cp); - ND_PRINT(", flags 0x%04x", EXTRACT_BE_U_2(cp)); - if (EXTRACT_BE_U_2(cp)) + ND_PRINT(", flags 0x%04x", GET_BE_U_2(cp)); + if (GET_BE_U_2(cp)) ND_PRINT(" (bogus)"); cp += 2; /* type-specific body of one of fixed lengths */ @@ -1782,21 +1790,24 @@ of10_stats_request_print(netdissect_options *ndo, return ep; /* end of snapshot */ /* table_id */ ND_TCHECK_1(cp); - ND_PRINT("\n\t table_id %s", tok2str(tableid_str, "%u", EXTRACT_U_1(cp))); + ND_PRINT("\n\t table_id %s", + tok2str(tableid_str, "%u", GET_U_1(cp))); cp += 1; /* pad */ ND_TCHECK_1(cp); cp += 1; /* out_port */ ND_TCHECK_2(cp); - ND_PRINT(", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))); + ND_PRINT(", out_port %s", + tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); return cp + 2; case OFPST_PORT: if (len != OF_PORT_STATS_REQUEST_LEN) goto invalid; /* port_no */ ND_TCHECK_2(cp); - ND_PRINT("\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))); + ND_PRINT("\n\t port_no %s", + tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); cp += 2; /* pad */ ND_TCHECK_6(cp); @@ -1806,14 +1817,16 @@ of10_stats_request_print(netdissect_options *ndo, goto invalid; /* port_no */ ND_TCHECK_2(cp); - ND_PRINT("\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))); + ND_PRINT("\n\t port_no %s", + tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); cp += 2; /* pad */ ND_TCHECK_2(cp); cp += 2; /* queue_id */ ND_TCHECK_4(cp); - ND_PRINT(", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_BE_U_4(cp))); + ND_PRINT(", queue_id %s", + tok2str(ofpq_str, "%u", GET_BE_U_4(cp))); return cp + 4; case OFPST_VENDOR: return of10_vendor_data_print(ndo, cp, ep, len); @@ -1890,14 +1903,15 @@ of10_flow_stats_reply_print(netdissect_options *ndo, goto invalid; /* length */ ND_TCHECK_2(cp); - entry_len = EXTRACT_BE_U_2(cp); + entry_len = GET_BE_U_2(cp); ND_PRINT("\n\t length %u", entry_len); if (entry_len < OF_FLOW_STATS_LEN || entry_len > len) goto invalid; cp += 2; /* table_id */ ND_TCHECK_1(cp); - ND_PRINT(", table_id %s", tok2str(tableid_str, "%u", EXTRACT_U_1(cp))); + ND_PRINT(", table_id %s", + tok2str(tableid_str, "%u", GET_U_1(cp))); cp += 1; /* pad */ ND_TCHECK_1(cp); @@ -1907,38 +1921,38 @@ of10_flow_stats_reply_print(netdissect_options *ndo, return ep; /* end of snapshot */ /* duration_sec */ ND_TCHECK_4(cp); - ND_PRINT("\n\t duration_sec %u", EXTRACT_BE_U_4(cp)); + ND_PRINT("\n\t duration_sec %u", GET_BE_U_4(cp)); cp += 4; /* duration_nsec */ ND_TCHECK_4(cp); - ND_PRINT(", duration_nsec %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(", duration_nsec %u", GET_BE_U_4(cp)); cp += 4; /* priority */ ND_TCHECK_2(cp); - ND_PRINT(", priority %u", EXTRACT_BE_U_2(cp)); + ND_PRINT(", priority %u", GET_BE_U_2(cp)); cp += 2; /* idle_timeout */ ND_TCHECK_2(cp); - ND_PRINT(", idle_timeout %u", EXTRACT_BE_U_2(cp)); + ND_PRINT(", idle_timeout %u", GET_BE_U_2(cp)); cp += 2; /* hard_timeout */ ND_TCHECK_2(cp); - ND_PRINT(", hard_timeout %u", EXTRACT_BE_U_2(cp)); + ND_PRINT(", hard_timeout %u", GET_BE_U_2(cp)); cp += 2; /* pad2 */ ND_TCHECK_6(cp); cp += 6; /* cookie */ ND_TCHECK_8(cp); - ND_PRINT(", cookie 0x%016" PRIx64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", cookie 0x%016" PRIx64, GET_BE_U_8(cp)); cp += 8; /* packet_count */ ND_TCHECK_8(cp); - ND_PRINT(", packet_count %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", packet_count %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* byte_count */ ND_TCHECK_8(cp); - ND_PRINT(", byte_count %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", byte_count %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* actions */ if (ep == (cp = of10_actions_print(ndo, "\n\t ", cp, ep, entry_len - OF_FLOW_STATS_LEN))) @@ -1967,15 +1981,15 @@ of10_aggregate_stats_reply_print(netdissect_options *ndo, goto invalid; /* packet_count */ ND_TCHECK_8(cp); - ND_PRINT("\n\t packet_count %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT("\n\t packet_count %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* byte_count */ ND_TCHECK_8(cp); - ND_PRINT(", byte_count %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", byte_count %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* flow_count */ ND_TCHECK_4(cp); - ND_PRINT(", flow_count %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(", flow_count %u", GET_BE_U_4(cp)); cp += 4; /* pad */ ND_TCHECK_4(cp); @@ -2003,7 +2017,8 @@ of10_table_stats_reply_print(netdissect_options *ndo, goto invalid; /* table_id */ ND_TCHECK_1(cp); - ND_PRINT("\n\t table_id %s", tok2str(tableid_str, "%u", EXTRACT_U_1(cp))); + ND_PRINT("\n\t table_id %s", + tok2str(tableid_str, "%u", GET_U_1(cp))); cp += 1; /* pad */ ND_TCHECK_3(cp); @@ -2016,25 +2031,25 @@ of10_table_stats_reply_print(netdissect_options *ndo, cp += OFP_MAX_TABLE_NAME_LEN; /* wildcards */ ND_TCHECK_4(cp); - ND_PRINT("\n\t wildcards 0x%08x", EXTRACT_BE_U_4(cp)); - of10_bitmap_print(ndo, ofpfw_bm, EXTRACT_BE_U_4(cp), + ND_PRINT("\n\t wildcards 0x%08x", GET_BE_U_4(cp)); + of10_bitmap_print(ndo, ofpfw_bm, GET_BE_U_4(cp), OFPFW_U); cp += 4; /* max_entries */ ND_TCHECK_4(cp); - ND_PRINT("\n\t max_entries %u", EXTRACT_BE_U_4(cp)); + ND_PRINT("\n\t max_entries %u", GET_BE_U_4(cp)); cp += 4; /* active_count */ ND_TCHECK_4(cp); - ND_PRINT(", active_count %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(", active_count %u", GET_BE_U_4(cp)); cp += 4; /* lookup_count */ ND_TCHECK_8(cp); - ND_PRINT(", lookup_count %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", lookup_count %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* matched_count */ ND_TCHECK_8(cp); - ND_PRINT(", matched_count %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", matched_count %" PRIu64, GET_BE_U_8(cp)); cp += 8; len -= OF_TABLE_STATS_LEN; @@ -2063,7 +2078,8 @@ of10_port_stats_reply_print(netdissect_options *ndo, goto invalid; /* port_no */ ND_TCHECK_2(cp); - ND_PRINT("\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))); + ND_PRINT("\n\t port_no %s", + tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); cp += 2; if (ndo->ndo_vflag < 2) { ND_TCHECK_LEN(cp, OF_PORT_STATS_LEN - 2); @@ -2075,51 +2091,51 @@ of10_port_stats_reply_print(netdissect_options *ndo, cp += 6; /* rx_packets */ ND_TCHECK_8(cp); - ND_PRINT(", rx_packets %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", rx_packets %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* tx_packets */ ND_TCHECK_8(cp); - ND_PRINT(", tx_packets %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", tx_packets %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* rx_bytes */ ND_TCHECK_8(cp); - ND_PRINT(", rx_bytes %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", rx_bytes %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* tx_bytes */ ND_TCHECK_8(cp); - ND_PRINT(", tx_bytes %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", tx_bytes %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* rx_dropped */ ND_TCHECK_8(cp); - ND_PRINT(", rx_dropped %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", rx_dropped %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* tx_dropped */ ND_TCHECK_8(cp); - ND_PRINT(", tx_dropped %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", tx_dropped %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* rx_errors */ ND_TCHECK_8(cp); - ND_PRINT(", rx_errors %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", rx_errors %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* tx_errors */ ND_TCHECK_8(cp); - ND_PRINT(", tx_errors %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", tx_errors %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* rx_frame_err */ ND_TCHECK_8(cp); - ND_PRINT(", rx_frame_err %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", rx_frame_err %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* rx_over_err */ ND_TCHECK_8(cp); - ND_PRINT(", rx_over_err %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", rx_over_err %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* rx_crc_err */ ND_TCHECK_8(cp); - ND_PRINT(", rx_crc_err %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", rx_crc_err %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* collisions */ ND_TCHECK_8(cp); - ND_PRINT(", collisions %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", collisions %" PRIu64, GET_BE_U_8(cp)); cp += 8; next_port: len -= OF_PORT_STATS_LEN; @@ -2148,26 +2164,27 @@ of10_queue_stats_reply_print(netdissect_options *ndo, goto invalid; /* port_no */ ND_TCHECK_2(cp); - ND_PRINT("\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))); + ND_PRINT("\n\t port_no %s", + tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); cp += 2; /* pad */ ND_TCHECK_2(cp); cp += 2; /* queue_id */ ND_TCHECK_4(cp); - ND_PRINT(", queue_id %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(", queue_id %u", GET_BE_U_4(cp)); cp += 4; /* tx_bytes */ ND_TCHECK_8(cp); - ND_PRINT(", tx_bytes %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", tx_bytes %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* tx_packets */ ND_TCHECK_8(cp); - ND_PRINT(", tx_packets %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", tx_packets %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* tx_errors */ ND_TCHECK_8(cp); - ND_PRINT(", tx_errors %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", tx_errors %" PRIu64, GET_BE_U_8(cp)); cp += 8; len -= OF_QUEUE_STATS_LEN; @@ -2193,13 +2210,13 @@ of10_stats_reply_print(netdissect_options *ndo, /* type */ ND_TCHECK_2(cp); - type = EXTRACT_BE_U_2(cp); + type = GET_BE_U_2(cp); ND_PRINT("\n\t type %s", tok2str(ofpst_str, "invalid (0x%04x)", type)); cp += 2; /* flags */ ND_TCHECK_2(cp); - ND_PRINT(", flags 0x%04x", EXTRACT_BE_U_2(cp)); - of10_bitmap_print(ndo, ofpsf_reply_bm, EXTRACT_BE_U_2(cp), + ND_PRINT(", flags 0x%04x", GET_BE_U_2(cp)); + of10_bitmap_print(ndo, ofpsf_reply_bm, GET_BE_U_2(cp), OFPSF_REPLY_U); cp += 2; @@ -2235,15 +2252,15 @@ of10_packet_out_print(netdissect_options *ndo, /* buffer_id */ ND_TCHECK_4(cp); - ND_PRINT("\n\t buffer_id 0x%08x", EXTRACT_BE_U_4(cp)); + ND_PRINT("\n\t buffer_id 0x%08x", GET_BE_U_4(cp)); cp += 4; /* in_port */ ND_TCHECK_2(cp); - ND_PRINT(", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))); + ND_PRINT(", in_port %s", tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); cp += 2; /* actions_len */ ND_TCHECK_2(cp); - actions_len = EXTRACT_BE_U_2(cp); + actions_len = GET_BE_U_2(cp); cp += 2; if (actions_len > len - OF_PACKET_OUT_LEN) goto invalid; @@ -2269,19 +2286,21 @@ of10_packet_in_print(netdissect_options *ndo, { /* buffer_id */ ND_TCHECK_4(cp); - ND_PRINT("\n\t buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_BE_U_4(cp))); + ND_PRINT("\n\t buffer_id %s", + tok2str(bufferid_str, "0x%08x", GET_BE_U_4(cp))); cp += 4; /* total_len */ ND_TCHECK_2(cp); - ND_PRINT(", total_len %u", EXTRACT_BE_U_2(cp)); + ND_PRINT(", total_len %u", GET_BE_U_2(cp)); cp += 2; /* in_port */ ND_TCHECK_2(cp); - ND_PRINT(", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))); + ND_PRINT(", in_port %s", tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); cp += 2; /* reason */ ND_TCHECK_1(cp); - ND_PRINT(", reason %s", tok2str(ofpr_str, "invalid (0x%02x)", EXTRACT_U_1(cp))); + ND_PRINT(", reason %s", + tok2str(ofpr_str, "invalid (0x%02x)", GET_U_1(cp))); cp += 1; /* pad */ ND_TCHECK_1(cp); @@ -2305,43 +2324,44 @@ of10_flow_removed_print(netdissect_options *ndo, return ep; /* end of snapshot */ /* cookie */ ND_TCHECK_8(cp); - ND_PRINT("\n\t cookie 0x%016" PRIx64, EXTRACT_BE_U_8(cp)); + ND_PRINT("\n\t cookie 0x%016" PRIx64, GET_BE_U_8(cp)); cp += 8; /* priority */ ND_TCHECK_2(cp); - if (EXTRACT_BE_U_2(cp)) - ND_PRINT(", priority %u", EXTRACT_BE_U_2(cp)); + if (GET_BE_U_2(cp)) + ND_PRINT(", priority %u", GET_BE_U_2(cp)); cp += 2; /* reason */ ND_TCHECK_1(cp); - ND_PRINT(", reason %s", tok2str(ofprr_str, "unknown (0x%02x)", EXTRACT_U_1(cp))); + ND_PRINT(", reason %s", + tok2str(ofprr_str, "unknown (0x%02x)", GET_U_1(cp))); cp += 1; /* pad */ ND_TCHECK_1(cp); cp += 1; /* duration_sec */ ND_TCHECK_4(cp); - ND_PRINT(", duration_sec %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(", duration_sec %u", GET_BE_U_4(cp)); cp += 4; /* duration_nsec */ ND_TCHECK_4(cp); - ND_PRINT(", duration_nsec %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(", duration_nsec %u", GET_BE_U_4(cp)); cp += 4; /* idle_timeout */ ND_TCHECK_2(cp); - if (EXTRACT_BE_U_2(cp)) - ND_PRINT(", idle_timeout %u", EXTRACT_BE_U_2(cp)); + if (GET_BE_U_2(cp)) + ND_PRINT(", idle_timeout %u", GET_BE_U_2(cp)); cp += 2; /* pad2 */ ND_TCHECK_2(cp); cp += 2; /* packet_count */ ND_TCHECK_8(cp); - ND_PRINT(", packet_count %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", packet_count %" PRIu64, GET_BE_U_8(cp)); cp += 8; /* byte_count */ ND_TCHECK_8(cp); - ND_PRINT(", byte_count %" PRIu64, EXTRACT_BE_U_8(cp)); + ND_PRINT(", byte_count %" PRIu64, GET_BE_U_8(cp)); return cp + 8; trunc: @@ -2359,7 +2379,7 @@ of10_error_print(netdissect_options *ndo, /* type */ ND_TCHECK_2(cp); - type = EXTRACT_BE_U_2(cp); + type = GET_BE_U_2(cp); cp += 2; ND_PRINT("\n\t type %s", tok2str(ofpet_str, "invalid (0x%04x)", type)); /* code */ @@ -2372,7 +2392,8 @@ of10_error_print(netdissect_options *ndo, type == OFPET_PORT_MOD_FAILED ? ofppmfc_str : type == OFPET_QUEUE_OP_FAILED ? ofpqofc_str : empty_str; - ND_PRINT(", code %s", tok2str(code_str, "invalid (0x%04x)", EXTRACT_BE_U_2(cp))); + ND_PRINT(", code %s", + tok2str(code_str, "invalid (0x%04x)", GET_BE_U_2(cp))); cp += 2; /* data */ return of10_data_print(ndo, cp, ep, len - OF_ERROR_MSG_LEN); @@ -2418,11 +2439,12 @@ of10_header_body_print(netdissect_options *ndo, goto next_message; /* flags */ ND_TCHECK_2(cp); - ND_PRINT("\n\t flags %s", tok2str(ofp_config_str, "invalid (0x%04x)", EXTRACT_BE_U_2(cp))); + ND_PRINT("\n\t flags %s", + tok2str(ofp_config_str, "invalid (0x%04x)", GET_BE_U_2(cp))); cp += 2; /* miss_send_len */ ND_TCHECK_2(cp); - ND_PRINT(", miss_send_len %u", EXTRACT_BE_U_2(cp)); + ND_PRINT(", miss_send_len %u", GET_BE_U_2(cp)); return cp + 2; case OFPT_PORT_MOD: if (len != OF_PORT_MOD_LEN) @@ -2437,7 +2459,8 @@ of10_header_body_print(netdissect_options *ndo, goto next_message; /* port */ ND_TCHECK_2(cp); - ND_PRINT("\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))); + ND_PRINT("\n\t port_no %s", + tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); cp += 2; /* pad */ ND_TCHECK_2(cp); @@ -2455,7 +2478,8 @@ of10_header_body_print(netdissect_options *ndo, goto next_message; /* reason */ ND_TCHECK_1(cp); - ND_PRINT("\n\t reason %s", tok2str(ofppr_str, "invalid (0x%02x)", EXTRACT_U_1(cp))); + ND_PRINT("\n\t reason %s", + tok2str(ofppr_str, "invalid (0x%02x)", GET_U_1(cp))); cp += 1; /* pad */ ND_TCHECK_7(cp); @@ -2546,7 +2570,8 @@ of10_header_body_print(netdissect_options *ndo, goto next_message; /* port */ ND_TCHECK_2(cp); - ND_PRINT("\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))); + ND_PRINT("\n\t port_no %s", + tok2str(ofpp_str, "%u", GET_BE_U_2(cp))); cp += 2; /* pad */ ND_TCHECK_6(cp); diff --git a/print-openflow.c b/print-openflow.c index 8a912063..63666336 100644 --- a/print-openflow.c +++ b/print-openflow.c @@ -85,19 +85,19 @@ of_header_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep goto invalid; /* version */ ND_TCHECK_1(cp); - version = EXTRACT_U_1(cp); + version = GET_U_1(cp); cp += 1; /* type */ ND_TCHECK_1(cp); - type = EXTRACT_U_1(cp); + type = GET_U_1(cp); cp += 1; /* length */ ND_TCHECK_2(cp); - length = EXTRACT_BE_U_2(cp); + length = GET_BE_U_2(cp); cp += 2; /* xid */ ND_TCHECK_4(cp); - xid = EXTRACT_BE_U_4(cp); + xid = GET_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 2a502a6c..eeb7c40d 100644 --- a/print-ospf.c +++ b/print-ospf.c @@ -191,8 +191,8 @@ ospf_grace_lsa_print(netdissect_options *ndo, ND_PRINT("\n\t Remaining LS length %u < 4", ls_length); return -1; } - tlv_type = EXTRACT_BE_U_2(tptr); - tlv_length = EXTRACT_BE_U_2(tptr + 2); + tlv_type = GET_BE_U_2(tptr); + tlv_length = GET_BE_U_2(tptr + 2); tptr+=4; ls_length-=4; @@ -220,7 +220,7 @@ ospf_grace_lsa_print(netdissect_options *ndo, ND_PRINT("\n\t Bogus length %u != 4", tlv_length); return -1; } - ND_PRINT("%us", EXTRACT_BE_U_4(tptr)); + ND_PRINT("%us", GET_BE_U_4(tptr)); break; case LS_OPAQUE_GRACE_TLV_REASON: @@ -229,8 +229,8 @@ ospf_grace_lsa_print(netdissect_options *ndo, return -1; } ND_PRINT("%s (%u)", - tok2str(lsa_opaque_grace_tlv_reason_values, "Unknown", EXTRACT_U_1(tptr)), - EXTRACT_U_1(tptr)); + tok2str(lsa_opaque_grace_tlv_reason_values, "Unknown", GET_U_1(tptr)), + GET_U_1(tptr)); break; case LS_OPAQUE_GRACE_TLV_INT_ADDRESS: @@ -278,8 +278,8 @@ ospf_te_lsa_print(netdissect_options *ndo, ND_PRINT("\n\t Remaining LS length %u < 4", ls_length); return -1; } - tlv_type = EXTRACT_BE_U_2(tptr); - tlv_length = EXTRACT_BE_U_2(tptr + 2); + tlv_type = GET_BE_U_2(tptr); + tlv_length = GET_BE_U_2(tptr + 2); tptr+=4; ls_length-=4; @@ -308,8 +308,8 @@ ospf_te_lsa_print(netdissect_options *ndo, return -1; } ND_TCHECK_4(tptr); - subtlv_type = EXTRACT_BE_U_2(tptr); - subtlv_length = EXTRACT_BE_U_2(tptr + 2); + subtlv_type = GET_BE_U_2(tptr); + subtlv_length = GET_BE_U_2(tptr + 2); tptr+=4; tlv_length-=4; @@ -329,7 +329,7 @@ ospf_te_lsa_print(netdissect_options *ndo, ND_PRINT(" != 4"); goto invalid; } - ND_PRINT(", 0x%08x", EXTRACT_BE_U_4(tptr)); + ND_PRINT(", 0x%08x", GET_BE_U_4(tptr)); break; case LS_OPAQUE_TE_LINK_SUBTLV_LINK_ID: case LS_OPAQUE_TE_LINK_SUBTLV_LINK_LOCAL_REMOTE_ID: @@ -339,11 +339,11 @@ ospf_te_lsa_print(netdissect_options *ndo, } ND_PRINT(", %s (0x%08x)", ipaddr_string(ndo, tptr), - EXTRACT_BE_U_4(tptr)); + GET_BE_U_4(tptr)); if (subtlv_length == 8) /* rfc4203 */ ND_PRINT(", %s (0x%08x)", ipaddr_string(ndo, tptr+4), - EXTRACT_BE_U_4(tptr + 4)); + GET_BE_U_4(tptr + 4)); break; case LS_OPAQUE_TE_LINK_SUBTLV_LOCAL_IP: case LS_OPAQUE_TE_LINK_SUBTLV_REMOTE_IP: @@ -359,7 +359,7 @@ ospf_te_lsa_print(netdissect_options *ndo, ND_PRINT(" != 4"); goto invalid; } - bw.i = EXTRACT_BE_U_4(tptr); + bw.i = GET_BE_U_4(tptr); ND_PRINT(", %.3f Mbps", bw.f * 8 / 1000000); break; case LS_OPAQUE_TE_LINK_SUBTLV_UNRES_BW: @@ -368,7 +368,7 @@ ospf_te_lsa_print(netdissect_options *ndo, goto invalid; } for (te_class = 0; te_class < 8; te_class++) { - bw.i = EXTRACT_BE_U_4(tptr + te_class * 4); + bw.i = GET_BE_U_4(tptr + te_class * 4); ND_PRINT("\n\t\tTE-Class %u: %.3f Mbps", te_class, bw.f * 8 / 1000000); @@ -381,8 +381,8 @@ ospf_te_lsa_print(netdissect_options *ndo, } /* BC Model Id (1 octet) + Reserved (3 octets) */ ND_PRINT("\n\t\tBandwidth Constraints Model ID: %s (%u)", - tok2str(diffserv_te_bc_values, "unknown", EXTRACT_U_1(tptr)), - EXTRACT_U_1(tptr)); + tok2str(diffserv_te_bc_values, "unknown", GET_U_1(tptr)), + GET_U_1(tptr)); if (subtlv_length % 4 != 0) { ND_PRINT("\n\t\tlength %u != N x 4", subtlv_length); goto invalid; @@ -393,7 +393,7 @@ ospf_te_lsa_print(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_U_4(tptr + 4 + te_class * 4); + bw.i = GET_BE_U_4(tptr + 4 + te_class * 4); ND_PRINT("\n\t\t Bandwidth constraint CT%u: %.3f Mbps", te_class, bw.f * 8 / 1000000); @@ -404,7 +404,7 @@ ospf_te_lsa_print(netdissect_options *ndo, ND_PRINT(" != 4"); goto invalid; } - ND_PRINT(", Metric %u", EXTRACT_BE_U_4(tptr)); + ND_PRINT(", Metric %u", GET_BE_U_4(tptr)); break; case LS_OPAQUE_TE_LINK_SUBTLV_LINK_PROTECTION_TYPE: /* Protection Cap (1 octet) + Reserved ((3 octets) */ @@ -413,7 +413,7 @@ ospf_te_lsa_print(netdissect_options *ndo, goto invalid; } ND_PRINT(", %s", - bittok2str(gmpls_link_prot_values, "none", EXTRACT_U_1(tptr))); + bittok2str(gmpls_link_prot_values, "none", GET_U_1(tptr))); break; case LS_OPAQUE_TE_LINK_SUBTLV_INTF_SW_CAP_DESCR: if (subtlv_length < 36) { @@ -422,11 +422,11 @@ ospf_te_lsa_print(netdissect_options *ndo, } /* Switching Cap (1 octet) + Encoding (1) + Reserved (2) */ ND_PRINT("\n\t\tInterface Switching Capability: %s", - tok2str(gmpls_switch_cap_values, "Unknown", EXTRACT_U_1((tptr)))); + tok2str(gmpls_switch_cap_values, "Unknown", GET_U_1((tptr)))); ND_PRINT("\n\t\tLSP Encoding: %s\n\t\tMax LSP Bandwidth:", - tok2str(gmpls_encoding_values, "Unknown", EXTRACT_U_1((tptr + 1)))); + tok2str(gmpls_encoding_values, "Unknown", GET_U_1((tptr + 1)))); for (priority_level = 0; priority_level < 8; priority_level++) { - bw.i = EXTRACT_BE_U_4(tptr + 4 + (priority_level * 4)); + bw.i = GET_BE_U_4(tptr + 4 + (priority_level * 4)); ND_PRINT("\n\t\t priority level %u: %.3f Mbps", priority_level, bw.f * 8 / 1000000); @@ -438,8 +438,8 @@ ospf_te_lsa_print(netdissect_options *ndo, goto invalid; } ND_PRINT(", %s (%u)", - tok2str(lsa_opaque_te_tlv_link_type_sub_tlv_values,"unknown",EXTRACT_U_1(tptr)), - EXTRACT_U_1(tptr)); + tok2str(lsa_opaque_te_tlv_link_type_sub_tlv_values,"unknown",GET_U_1(tptr)), + GET_U_1(tptr)); break; case LS_OPAQUE_TE_LINK_SUBTLV_SHARED_RISK_GROUP: @@ -451,7 +451,7 @@ ospf_te_lsa_print(netdissect_options *ndo, if (count_srlg != 0) ND_PRINT("\n\t\t Shared risk group: "); while (count_srlg > 0) { - bw.i = EXTRACT_BE_U_4(tptr); + bw.i = GET_BE_U_4(tptr); ND_PRINT("%u", bw.i); tptr+=4; count_srlg--; @@ -515,7 +515,7 @@ ospf_print_lshdr(netdissect_options *ndo, u_int ls_length; ND_TCHECK_2(lshp->ls_length); - ls_length = EXTRACT_BE_U_2(lshp->ls_length); + ls_length = GET_BE_U_2(lshp->ls_length); if (ls_length < sizeof(struct lsa_hdr)) { ND_PRINT("\n\t Bogus length %u < header (%lu)", ls_length, (unsigned long)sizeof(struct lsa_hdr)); @@ -525,12 +525,12 @@ ospf_print_lshdr(netdissect_options *ndo, ND_TCHECK_4(lshp->ls_seq); /* XXX - ls_length check checked this */ ND_PRINT("\n\t Advertising Router %s, seq 0x%08x, age %us, length %u", ipaddr_string(ndo, lshp->ls_router), - EXTRACT_BE_U_4(lshp->ls_seq), - EXTRACT_BE_U_2(lshp->ls_age), + GET_BE_U_4(lshp->ls_seq), + GET_BE_U_2(lshp->ls_age), ls_length - (u_int)sizeof(struct lsa_hdr)); ND_TCHECK_1(lshp->ls_type); /* XXX - ls_length check checked this */ - ls_type = EXTRACT_U_1(lshp->ls_type); + ls_type = GET_U_1(lshp->ls_type); switch (ls_type) { /* the LSA header for opaque LSAs was slightly changed */ case LS_TYPE_OPAQUE_LL: @@ -542,9 +542,9 @@ ospf_print_lshdr(netdissect_options *ndo, tok2str(lsa_opaque_values, "unknown", - EXTRACT_U_1(lshp->un_lsa_id.opaque_field.opaque_type)), - EXTRACT_U_1(lshp->un_lsa_id.opaque_field.opaque_type), - EXTRACT_BE_U_3(lshp->un_lsa_id.opaque_field.opaque_id) + GET_U_1(lshp->un_lsa_id.opaque_field.opaque_type)), + GET_U_1(lshp->un_lsa_id.opaque_field.opaque_type), + GET_BE_U_3(lshp->un_lsa_id.opaque_field.opaque_id) ); break; @@ -559,7 +559,8 @@ ospf_print_lshdr(netdissect_options *ndo, } ND_TCHECK_1(lshp->ls_options); /* XXX - ls_length check checked this */ - ND_PRINT("\n\t Options: [%s]", bittok2str(ospf_option_values, "none", EXTRACT_U_1(lshp->ls_options))); + ND_PRINT("\n\t Options: [%s]", + bittok2str(ospf_option_values, "none", GET_U_1(lshp->ls_options))); return (ls_length); trunc: @@ -585,7 +586,7 @@ ospf_print_tos_metrics(netdissect_options *ndo, u_int toscount; u_int tos_type; - toscount = EXTRACT_U_1(tos->link.link_tos_count)+1; + toscount = GET_U_1(tos->link.link_tos_count)+1; metric_count = 0; /* @@ -593,12 +594,12 @@ ospf_print_tos_metrics(netdissect_options *ndo, */ while (toscount != 0) { ND_TCHECK_SIZE(tos); - tos_type = EXTRACT_U_1(tos->metrics.tos_type); + tos_type = GET_U_1(tos->metrics.tos_type); ND_PRINT("\n\t\ttopology %s (%u), metric %u", tok2str(ospf_topology_values, "Unknown", metric_count ? tos_type : 0), metric_count ? tos_type : 0, - EXTRACT_BE_U_2(tos->metrics.tos_metric)); + GET_BE_U_2(tos->metrics.tos_metric)); metric_count++; tos++; toscount--; @@ -634,20 +635,20 @@ ospf_print_lsa(netdissect_options *ndo, ls_end = (const uint8_t *)lsap + ls_length; ls_length -= sizeof(struct lsa_hdr); - switch (EXTRACT_U_1(lsap->ls_hdr.ls_type)) { + switch (GET_U_1(lsap->ls_hdr.ls_type)) { case LS_TYPE_ROUTER: ND_TCHECK_1(lsap->lsa_un.un_rla.rla_flags); ND_PRINT("\n\t Router LSA Options: [%s]", - bittok2str(ospf_rla_flag_values, "none", EXTRACT_U_1(lsap->lsa_un.un_rla.rla_flags))); + bittok2str(ospf_rla_flag_values, "none", GET_U_1(lsap->lsa_un.un_rla.rla_flags))); ND_TCHECK_2(lsap->lsa_un.un_rla.rla_count); - j = EXTRACT_BE_U_2(lsap->lsa_un.un_rla.rla_count); + j = GET_BE_U_2(lsap->lsa_un.un_rla.rla_count); ND_TCHECK_SIZE(lsap->lsa_un.un_rla.rla_link); rlp = lsap->lsa_un.un_rla.rla_link; while (j--) { ND_TCHECK_SIZE(rlp); - switch (EXTRACT_U_1(rlp->un_tos.link.link_type)) { + switch (GET_U_1(rlp->un_tos.link.link_type)) { case RLA_TYPE_VIRTUAL: ND_PRINT("\n\t Virtual Link: Neighbor Router-ID: %s, Interface Address: %s", @@ -675,7 +676,7 @@ ospf_print_lsa(netdissect_options *ndo, default: ND_PRINT("\n\t Unknown Router Link Type (%u)", - EXTRACT_U_1(rlp->un_tos.link.link_type)); + GET_U_1(rlp->un_tos.link.link_type)); return (ls_end); } @@ -683,7 +684,7 @@ ospf_print_lsa(netdissect_options *ndo, goto trunc; rlp = (const struct rlalink *)((const u_char *)(rlp + 1) + - (EXTRACT_U_1(rlp->un_tos.link.link_tos_count) * sizeof(union un_tos))); + (GET_U_1(rlp->un_tos.link.link_tos_count) * sizeof(union un_tos))); } break; @@ -709,7 +710,7 @@ ospf_print_lsa(netdissect_options *ndo, uint32_t ul; ND_TCHECK_4(lp); - ul = EXTRACT_BE_U_4(lp); + ul = GET_BE_U_4(lp); topology = (ul & SLA_MASK_TOS) >> SLA_SHIFT_TOS; ND_PRINT("\n\t\ttopology %s (%u) metric %u", tok2str(ospf_topology_values, "Unknown", topology), @@ -726,7 +727,7 @@ ospf_print_lsa(netdissect_options *ndo, uint32_t ul; ND_TCHECK_4(lp); - ul = EXTRACT_BE_U_4(lp); + ul = GET_BE_U_4(lp); topology = (ul & SLA_MASK_TOS) >> SLA_SHIFT_TOS; ND_PRINT("\n\t\ttopology %s (%u) metric %u", tok2str(ospf_topology_values, "Unknown", topology), @@ -748,7 +749,7 @@ ospf_print_lsa(netdissect_options *ndo, uint32_t ul; ND_TCHECK_4(almp->asla_tosmetric); - ul = EXTRACT_BE_U_4(almp->asla_tosmetric); + ul = GET_BE_U_4(almp->asla_tosmetric); topology = ((ul & ASLA_MASK_TOS) >> ASLA_SHIFT_TOS); ND_PRINT("\n\t\ttopology %s (%u), type %u, metric", tok2str(ospf_topology_values, "Unknown", topology), @@ -760,11 +761,11 @@ ospf_print_lsa(netdissect_options *ndo, ND_PRINT(" %u", (ul & ASLA_MASK_METRIC)); ND_TCHECK_4(almp->asla_forward); - if (EXTRACT_IPV4_TO_NETWORK_ORDER(almp->asla_forward) != 0) { + if (GET_IPV4_TO_NETWORK_ORDER(almp->asla_forward) != 0) { ND_PRINT(", forward %s", ipaddr_string(ndo, almp->asla_forward)); } ND_TCHECK_4(almp->asla_tag); - if (EXTRACT_IPV4_TO_NETWORK_ORDER(almp->asla_tag) != 0) { + if (GET_IPV4_TO_NETWORK_ORDER(almp->asla_tag) != 0) { ND_PRINT(", tag %s", ipaddr_string(ndo, almp->asla_tag)); } ++almp; @@ -776,7 +777,7 @@ ospf_print_lsa(netdissect_options *ndo, mcp = lsap->lsa_un.un_mcla; while ((const u_char *)mcp < ls_end) { ND_TCHECK_4(mcp->mcla_vid); - switch (EXTRACT_BE_U_4(mcp->mcla_vtype)) { + switch (GET_BE_U_4(mcp->mcla_vtype)) { case MCLA_VERTEX_ROUTER: ND_PRINT("\n\t Router Router-ID %s", @@ -790,7 +791,7 @@ ospf_print_lsa(netdissect_options *ndo, default: ND_PRINT("\n\t unknown VertexType (%u)", - EXTRACT_BE_U_4(mcp->mcla_vtype)); + GET_BE_U_4(mcp->mcla_vtype)); break; } ++mcp; @@ -801,7 +802,7 @@ ospf_print_lsa(netdissect_options *ndo, case LS_TYPE_OPAQUE_AL: case LS_TYPE_OPAQUE_DW: - switch (EXTRACT_U_1(lsap->ls_hdr.un_lsa_id.opaque_field.opaque_type)) { + switch (GET_U_1(lsap->ls_hdr.un_lsa_id.opaque_field.opaque_type)) { case LS_OPAQUE_TYPE_RI: tptr = (const uint8_t *)(lsap->lsa_un.un_ri_tlv); @@ -811,8 +812,8 @@ ospf_print_lsa(netdissect_options *ndo, ND_PRINT("\n\t Remaining LS length %u < 4", ls_length); return(ls_end); } - tlv_type = EXTRACT_BE_U_2(tptr); - tlv_length = EXTRACT_BE_U_2(tptr + 2); + tlv_type = GET_BE_U_2(tptr); + tlv_length = GET_BE_U_2(tptr + 2); tptr+=4; ls_length-=4; @@ -835,7 +836,7 @@ ospf_print_lsa(netdissect_options *ndo, return(ls_end); } ND_PRINT("Capabilities: %s", - bittok2str(lsa_opaque_ri_tlv_cap_values, "Unknown", EXTRACT_BE_U_4(tptr))); + bittok2str(lsa_opaque_ri_tlv_cap_values, "Unknown", GET_BE_U_4(tptr))); break; default: if (ndo->ndo_vflag <= 1) { @@ -896,15 +897,15 @@ ospf_decode_lls(netdissect_options *ndo, uint16_t lls_type, lls_len; uint32_t lls_flags; - switch (EXTRACT_U_1(op->ospf_type)) { + switch (GET_U_1(op->ospf_type)) { case OSPF_TYPE_HELLO: - if (!(EXTRACT_U_1(op->ospf_hello.hello_options) & OSPF_OPTION_L)) + if (!(GET_U_1(op->ospf_hello.hello_options) & OSPF_OPTION_L)) return (0); break; case OSPF_TYPE_DD: - if (!(EXTRACT_U_1(op->ospf_db.db_options) & OSPF_OPTION_L)) + if (!(GET_U_1(op->ospf_db.db_options) & OSPF_OPTION_L)) return (0); break; @@ -913,11 +914,11 @@ ospf_decode_lls(netdissect_options *ndo, } /* dig deeper if LLS data is available; see RFC4813 */ - length2 = EXTRACT_BE_U_2(op->ospf_len); + length2 = GET_BE_U_2(op->ospf_len); dptr = (const u_char *)op + length2; dataend = (const u_char *)op + length; - if (EXTRACT_BE_U_2(op->ospf_authtype) == OSPF_AUTH_MD5) { + if (GET_BE_U_2(op->ospf_authtype) == OSPF_AUTH_MD5) { dptr = dptr + op->ospf_authdata[3]; length2 += op->ospf_authdata[3]; } @@ -926,24 +927,24 @@ ospf_decode_lls(netdissect_options *ndo, return (1); } ND_TCHECK_2(dptr); - ND_PRINT("\n\t LLS: checksum: 0x%04x", (u_int) EXTRACT_BE_U_2(dptr)); + ND_PRINT("\n\t LLS: checksum: 0x%04x", (u_int) GET_BE_U_2(dptr)); dptr += 2; ND_TCHECK_2(dptr); - length2 = EXTRACT_BE_U_2(dptr); + length2 = GET_BE_U_2(dptr); ND_PRINT(", length: %u", length2); dptr += 2; ND_TCHECK_1(dptr); while (dptr < dataend) { ND_TCHECK_2(dptr); - lls_type = EXTRACT_BE_U_2(dptr); + lls_type = GET_BE_U_2(dptr); ND_PRINT("\n\t %s (%u)", tok2str(ospf_lls_tlv_values,"Unknown TLV",lls_type), lls_type); dptr += 2; ND_TCHECK_2(dptr); - lls_len = EXTRACT_BE_U_2(dptr); + lls_len = GET_BE_U_2(dptr); ND_PRINT(", length: %u", lls_len); dptr += 2; switch (lls_type) { @@ -954,7 +955,7 @@ ospf_decode_lls(netdissect_options *ndo, lls_len = 4; } ND_TCHECK_4(dptr); - lls_flags = EXTRACT_BE_U_4(dptr); + lls_flags = GET_BE_U_4(dptr); ND_PRINT("\n\t Options: 0x%08x [%s]", lls_flags, bittok2str(ospf_lls_eo_options, "?", lls_flags)); @@ -966,7 +967,7 @@ ospf_decode_lls(netdissect_options *ndo, lls_len = 20; } ND_TCHECK_4(dptr); - ND_PRINT("\n\t Sequence number: 0x%08x", EXTRACT_BE_U_4(dptr)); + ND_PRINT("\n\t Sequence number: 0x%08x", GET_BE_U_4(dptr)); break; } @@ -988,27 +989,27 @@ ospf_decode_v2(netdissect_options *ndo, const struct lsa *lsap; uint32_t lsa_count,lsa_count_max; - switch (EXTRACT_U_1(op->ospf_type)) { + switch (GET_U_1(op->ospf_type)) { case OSPF_TYPE_HELLO: ND_TCHECK_1(op->ospf_hello.hello_options); ND_PRINT("\n\tOptions [%s]", - bittok2str(ospf_option_values,"none",EXTRACT_U_1(op->ospf_hello.hello_options))); + bittok2str(ospf_option_values,"none",GET_U_1(op->ospf_hello.hello_options))); ND_TCHECK_4(op->ospf_hello.hello_deadint); ND_PRINT("\n\t Hello Timer %us, Dead Timer %us, Mask %s, Priority %u", - EXTRACT_BE_U_2(op->ospf_hello.hello_helloint), - EXTRACT_BE_U_4(op->ospf_hello.hello_deadint), + GET_BE_U_2(op->ospf_hello.hello_helloint), + GET_BE_U_4(op->ospf_hello.hello_deadint), ipaddr_string(ndo, op->ospf_hello.hello_mask), - EXTRACT_U_1(op->ospf_hello.hello_priority)); + GET_U_1(op->ospf_hello.hello_priority)); ND_TCHECK_4(op->ospf_hello.hello_dr); - if (EXTRACT_IPV4_TO_NETWORK_ORDER(op->ospf_hello.hello_dr) != 0) + if (GET_IPV4_TO_NETWORK_ORDER(op->ospf_hello.hello_dr) != 0) ND_PRINT("\n\t Designated Router %s", ipaddr_string(ndo, op->ospf_hello.hello_dr)); ND_TCHECK_4(op->ospf_hello.hello_bdr); - if (EXTRACT_IPV4_TO_NETWORK_ORDER(op->ospf_hello.hello_bdr) != 0) + if (GET_IPV4_TO_NETWORK_ORDER(op->ospf_hello.hello_bdr) != 0) ND_PRINT(", Backup Designated Router %s", ipaddr_string(ndo, op->ospf_hello.hello_bdr)); @@ -1025,16 +1026,17 @@ ospf_decode_v2(netdissect_options *ndo, case OSPF_TYPE_DD: ND_TCHECK_1(op->ospf_db.db_options); ND_PRINT("\n\tOptions [%s]", - bittok2str(ospf_option_values, "none", EXTRACT_U_1(op->ospf_db.db_options))); + bittok2str(ospf_option_values, "none", GET_U_1(op->ospf_db.db_options))); ND_TCHECK_1(op->ospf_db.db_flags); ND_PRINT(", DD Flags [%s]", - bittok2str(ospf_dd_flag_values, "none", EXTRACT_U_1(op->ospf_db.db_flags))); + bittok2str(ospf_dd_flag_values, "none", GET_U_1(op->ospf_db.db_flags))); ND_TCHECK_2(op->ospf_db.db_ifmtu); - if (EXTRACT_BE_U_2(op->ospf_db.db_ifmtu)) { - ND_PRINT(", MTU: %u", EXTRACT_BE_U_2(op->ospf_db.db_ifmtu)); + if (GET_BE_U_2(op->ospf_db.db_ifmtu)) { + ND_PRINT(", MTU: %u", + GET_BE_U_2(op->ospf_db.db_ifmtu)); } ND_TCHECK_4(op->ospf_db.db_seq); - ND_PRINT(", Sequence: 0x%08x", EXTRACT_BE_U_4(op->ospf_db.db_seq)); + ND_PRINT(", Sequence: 0x%08x", GET_BE_U_4(op->ospf_db.db_seq)); /* Print all the LS adv's */ lshp = op->ospf_db.db_lshdr; @@ -1050,18 +1052,18 @@ ospf_decode_v2(netdissect_options *ndo, ND_PRINT("\n\t Advertising Router: %s, %s LSA (%u)", ipaddr_string(ndo, lsrp->ls_router), - tok2str(lsa_values,"unknown",EXTRACT_BE_U_4(lsrp->ls_type)), - EXTRACT_BE_U_4(lsrp->ls_type)); + tok2str(lsa_values,"unknown",GET_BE_U_4(lsrp->ls_type)), + GET_BE_U_4(lsrp->ls_type)); - switch (EXTRACT_BE_U_4(lsrp->ls_type)) { + switch (GET_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: case LS_TYPE_OPAQUE_DW: ND_PRINT(", Opaque-Type: %s LSA (%u), Opaque-ID: %u", - tok2str(lsa_opaque_values, "unknown",EXTRACT_U_1(lsrp->un_ls_stateid.opaque_field.opaque_type)), - EXTRACT_U_1(lsrp->un_ls_stateid.opaque_field.opaque_type), - EXTRACT_BE_U_3(lsrp->un_ls_stateid.opaque_field.opaque_id)); + tok2str(lsa_opaque_values, "unknown",GET_U_1(lsrp->un_ls_stateid.opaque_field.opaque_type)), + GET_U_1(lsrp->un_ls_stateid.opaque_field.opaque_type), + GET_BE_U_3(lsrp->un_ls_stateid.opaque_field.opaque_id)); break; default: ND_PRINT(", LSA-ID: %s", @@ -1076,7 +1078,7 @@ ospf_decode_v2(netdissect_options *ndo, case OSPF_TYPE_LS_UPDATE: lsap = op->ospf_lsu.lsu_lsa; ND_TCHECK_4(op->ospf_lsu.lsu_count); - lsa_count_max = EXTRACT_BE_U_4(op->ospf_lsu.lsu_count); + lsa_count_max = GET_BE_U_4(op->ospf_lsu.lsu_count); ND_PRINT(", %u LSA%s", lsa_count_max, PLURAL_SUFFIX(lsa_count_max)); for (lsa_count=1;lsa_count <= lsa_count_max;lsa_count++) { ND_PRINT("\n\t LSA #%u", lsa_count); @@ -1115,7 +1117,7 @@ ospf_print(netdissect_options *ndo, /* XXX Before we do anything else, strip off the MD5 trailer */ ND_TCHECK_2(op->ospf_authtype); - if (EXTRACT_BE_U_2(op->ospf_authtype) == OSPF_AUTH_MD5) { + if (GET_BE_U_2(op->ospf_authtype) == OSPF_AUTH_MD5) { length -= OSPF_AUTH_MD5_LEN; ndo->ndo_snapend -= OSPF_AUTH_MD5_LEN; } @@ -1123,8 +1125,9 @@ ospf_print(netdissect_options *ndo, /* If the type is valid translate it, or just print the type */ /* value. If it's not valid, say so and return */ ND_TCHECK_1(op->ospf_type); - cp = tok2str(type2str, "unknown LS-type %u", EXTRACT_U_1(op->ospf_type)); - ND_PRINT("OSPFv%u, %s, length %u", EXTRACT_U_1(op->ospf_version), cp, length); + cp = tok2str(type2str, "unknown LS-type %u", GET_U_1(op->ospf_type)); + ND_PRINT("OSPFv%u, %s, length %u", GET_U_1(op->ospf_version), cp, + length); if (*cp == 'u') return; @@ -1133,12 +1136,12 @@ ospf_print(netdissect_options *ndo, } ND_TCHECK_2(op->ospf_len); - if (length != EXTRACT_BE_U_2(op->ospf_len)) { - ND_PRINT(" [len %u]", EXTRACT_BE_U_2(op->ospf_len)); + if (length != GET_BE_U_2(op->ospf_len)) { + ND_PRINT(" [len %u]", GET_BE_U_2(op->ospf_len)); } - if (length > EXTRACT_BE_U_2(op->ospf_len)) { - dataend = bp + EXTRACT_BE_U_2(op->ospf_len); + if (length > GET_BE_U_2(op->ospf_len)) { + dataend = bp + GET_BE_U_2(op->ospf_len); } else { dataend = bp + length; } @@ -1147,7 +1150,7 @@ ospf_print(netdissect_options *ndo, ND_PRINT("\n\tRouter-ID %s", ipaddr_string(ndo, op->ospf_routerid)); ND_TCHECK_4(op->ospf_areaid); - if (EXTRACT_IPV4_TO_NETWORK_ORDER(op->ospf_areaid) != 0) + if (GET_IPV4_TO_NETWORK_ORDER(op->ospf_areaid) != 0) ND_PRINT(", Area %s", ipaddr_string(ndo, op->ospf_areaid)); else ND_PRINT(", Backbone Area"); @@ -1157,10 +1160,10 @@ ospf_print(netdissect_options *ndo, ND_TCHECK_LEN(op->ospf_authdata, sizeof(op->ospf_authdata)); ND_PRINT(", Authentication Type: %s (%u)", - tok2str(ospf_authtype_values, "unknown", EXTRACT_BE_U_2(op->ospf_authtype)), - EXTRACT_BE_U_2(op->ospf_authtype)); + tok2str(ospf_authtype_values, "unknown", GET_BE_U_2(op->ospf_authtype)), + GET_BE_U_2(op->ospf_authtype)); - switch (EXTRACT_BE_U_2(op->ospf_authtype)) { + switch (GET_BE_U_2(op->ospf_authtype)) { case OSPF_AUTH_NONE: break; @@ -1174,7 +1177,7 @@ ospf_print(netdissect_options *ndo, ND_PRINT("\n\tKey-ID: %u, Auth-Length: %u, Crypto Sequence Number: 0x%08x", *((op->ospf_authdata) + 2), *((op->ospf_authdata) + 3), - EXTRACT_BE_U_4((op->ospf_authdata) + 4)); + GET_BE_U_4((op->ospf_authdata) + 4)); break; default: @@ -1182,20 +1185,20 @@ ospf_print(netdissect_options *ndo, } } /* Do rest according to version. */ - switch (EXTRACT_U_1(op->ospf_version)) { + switch (GET_U_1(op->ospf_version)) { case 2: /* ospf version 2 */ if (ospf_decode_v2(ndo, op, dataend)) goto trunc; - if (length > EXTRACT_BE_U_2(op->ospf_len)) { + if (length > GET_BE_U_2(op->ospf_len)) { if (ospf_decode_lls(ndo, op, length)) goto trunc; } break; default: - ND_PRINT(" ospf [version %u]", EXTRACT_U_1(op->ospf_version)); + ND_PRINT(" ospf [version %u]", GET_U_1(op->ospf_version)); break; } /* end switch on version */ diff --git a/print-ospf6.c b/print-ospf6.c index 756d25e2..c734b4d2 100644 --- a/print-ospf6.c +++ b/print-ospf6.c @@ -393,11 +393,11 @@ ospf6_print_lshdr(netdissect_options *ndo, ND_PRINT("\n\t Advertising Router %s, seq 0x%08x, age %us, length %u", ipaddr_string(ndo, lshp->ls_router), - 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)); + GET_BE_U_4(lshp->ls_seq), + GET_BE_U_2(lshp->ls_age), + GET_BE_U_2(lshp->ls_length)-(u_int)sizeof(struct lsa6_hdr)); - ospf6_print_ls_type(ndo, EXTRACT_BE_U_2(lshp->ls_type), + ospf6_print_ls_type(ndo, GET_BE_U_2(lshp->ls_type), &lshp->ls_stateid); return (0); @@ -417,9 +417,9 @@ ospf6_print_lsaprefix(netdissect_options *ndo, goto trunc; lsa_length -= sizeof (*lsapp) - IPV6_ADDR_LEN_BYTES; ND_TCHECK_LEN(lsapp, sizeof(*lsapp) - IPV6_ADDR_LEN_BYTES); - wordlen = (EXTRACT_U_1(lsapp->lsa_p_len) + 31) / 32; + wordlen = (GET_U_1(lsapp->lsa_p_len) + 31) / 32; if (wordlen * 4 > sizeof(nd_ipv6)) { - ND_PRINT(" bogus prefixlen /%u", EXTRACT_U_1(lsapp->lsa_p_len)); + ND_PRINT(" bogus prefixlen /%u", GET_U_1(lsapp->lsa_p_len)); goto trunc; } if (lsa_length < wordlen * 4) @@ -429,13 +429,13 @@ ospf6_print_lsaprefix(netdissect_options *ndo, memset(prefix, 0, sizeof(prefix)); memcpy(prefix, lsapp->lsa_p_prefix, wordlen * 4); ND_PRINT("\n\t\t%s/%u", ip6addr_string(ndo, prefix), - EXTRACT_U_1(lsapp->lsa_p_len)); - if (EXTRACT_U_1(lsapp->lsa_p_opt)) { + GET_U_1(lsapp->lsa_p_len)); + if (GET_U_1(lsapp->lsa_p_opt)) { ND_PRINT(", Options [%s]", bittok2str(ospf6_lsa_prefix_option_values, - "none", EXTRACT_U_1(lsapp->lsa_p_opt))); + "none", GET_U_1(lsapp->lsa_p_opt))); } - ND_PRINT(", metric %u", EXTRACT_BE_U_2(lsapp->lsa_p_metric)); + ND_PRINT(", metric %u", GET_BE_U_2(lsapp->lsa_p_metric)); return sizeof(*lsapp) - IPV6_ADDR_LEN_BYTES + wordlen * 4; trunc: @@ -473,7 +473,7 @@ ospf6_print_lsa(netdissect_options *ndo, if (ospf6_print_lshdr(ndo, &lsap->ls_hdr, dataend)) return (1); ND_TCHECK_2(lsap->ls_hdr.ls_length); - length = EXTRACT_BE_U_2(lsap->ls_hdr.ls_length); + length = GET_BE_U_2(lsap->ls_hdr.ls_length); /* * The LSA length includes the length of the header; @@ -486,7 +486,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_U_2(lsap->ls_hdr.ls_type)) { + switch (GET_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); @@ -494,10 +494,10 @@ ospf6_print_lsa(netdissect_options *ndo, ND_TCHECK_4(lsap->lsa_un.un_rla.rla_options); ND_PRINT("\n\t Options [%s]", bittok2str(ospf6_option_values, "none", - EXTRACT_BE_U_4(lsap->lsa_un.un_rla.rla_options))); + GET_BE_U_4(lsap->lsa_un.un_rla.rla_options))); ND_PRINT(", RLA-Flags [%s]", bittok2str(ospf6_rla_flag_values, "none", - EXTRACT_U_1(lsap->lsa_un.un_rla.rla_flags))); + GET_U_1(lsap->lsa_un.un_rla.rla_flags))); rlp = lsap->lsa_un.un_rla.rla_link; while (lsa_length != 0) { @@ -505,7 +505,7 @@ ospf6_print_lsa(netdissect_options *ndo, return (1); lsa_length -= sizeof (*rlp); ND_TCHECK_SIZE(rlp); - switch (EXTRACT_U_1(rlp->link_type)) { + switch (GET_U_1(rlp->link_type)) { case RLA_TYPE_VIRTUAL: ND_PRINT("\n\t Virtual Link: Neighbor Router-ID %s" @@ -533,10 +533,10 @@ ospf6_print_lsa(netdissect_options *ndo, default: ND_PRINT("\n\t Unknown Router Links Type 0x%02x", - EXTRACT_U_1(rlp->link_type)); + GET_U_1(rlp->link_type)); return (0); } - ND_PRINT(", metric %u", EXTRACT_BE_U_2(rlp->link_metric)); + ND_PRINT(", metric %u", GET_BE_U_2(rlp->link_metric)); rlp++; } break; @@ -548,7 +548,7 @@ ospf6_print_lsa(netdissect_options *ndo, ND_TCHECK_4(lsap->lsa_un.un_nla.nla_options); ND_PRINT("\n\t Options [%s]", bittok2str(ospf6_option_values, "none", - EXTRACT_BE_U_4(lsap->lsa_un.un_nla.nla_options))); + GET_BE_U_4(lsap->lsa_un.un_nla.nla_options))); ND_PRINT("\n\t Connected Routers:"); ap = lsap->lsa_un.un_nla.nla_router; @@ -568,7 +568,7 @@ ospf6_print_lsa(netdissect_options *ndo, lsa_length -= sizeof (lsap->lsa_un.un_inter_ap.inter_ap_metric); ND_TCHECK_4(lsap->lsa_un.un_inter_ap.inter_ap_metric); ND_PRINT(", metric %u", - EXTRACT_BE_U_4(lsap->lsa_un.un_inter_ap.inter_ap_metric) & SLA_MASK_METRIC); + GET_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) { @@ -585,11 +585,11 @@ ospf6_print_lsa(netdissect_options *ndo, return (1); lsa_length -= sizeof (lsap->lsa_un.un_asla.asla_metric); ND_TCHECK_4(lsap->lsa_un.un_asla.asla_metric); - flags32 = EXTRACT_BE_U_4(lsap->lsa_un.un_asla.asla_metric); + flags32 = GET_BE_U_4(lsap->lsa_un.un_asla.asla_metric); ND_PRINT("\n\t Flags [%s]", bittok2str(ospf6_asla_flag_values, "none", flags32)); ND_PRINT(" metric %u", - EXTRACT_BE_U_4(lsap->lsa_un.un_asla.asla_metric) & + GET_BE_U_4(lsap->lsa_un.un_asla.asla_metric) & ASLA_MASK_METRIC); tptr = (const uint8_t *)lsap->lsa_un.un_asla.asla_prefix; @@ -620,7 +620,7 @@ ospf6_print_lsa(netdissect_options *ndo, tptr += sizeof(uint32_t); } - if (EXTRACT_U_1(lsapp->lsa_p_metric)) { + if (GET_U_1(lsapp->lsa_p_metric)) { if (lsa_length < sizeof (uint32_t)) return (1); lsa_length -= sizeof (uint32_t); @@ -640,15 +640,15 @@ ospf6_print_lsa(netdissect_options *ndo, ND_TCHECK_SIZE(&llsap->llsa_priandopt); ND_PRINT("\n\t Options [%s]", bittok2str(ospf6_option_values, "none", - EXTRACT_BE_U_4(llsap->llsa_options))); + GET_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_4(llsap->llsa_nprefix); - prefixes = EXTRACT_BE_U_4(llsap->llsa_nprefix); + prefixes = GET_BE_U_4(llsap->llsa_nprefix); ND_PRINT("\n\t Priority %u, Link-local address %s, Prefixes %u:", - EXTRACT_U_1(llsap->llsa_priority), + GET_U_1(llsap->llsa_priority), ip6addr_string(ndo, llsap->llsa_lladdr), prefixes); @@ -670,14 +670,14 @@ ospf6_print_lsa(netdissect_options *ndo, lsa_length -= sizeof (lsap->lsa_un.un_intra_ap.intra_ap_rtid); ND_TCHECK_4(lsap->lsa_un.un_intra_ap.intra_ap_rtid); ospf6_print_ls_type(ndo, - EXTRACT_BE_U_2(lsap->lsa_un.un_intra_ap.intra_ap_lstype), + GET_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_2(lsap->lsa_un.un_intra_ap.intra_ap_nprefix); - prefixes = EXTRACT_BE_U_2(lsap->lsa_un.un_intra_ap.intra_ap_nprefix); + prefixes = GET_BE_U_2(lsap->lsa_un.un_intra_ap.intra_ap_nprefix); ND_PRINT("\n\t Prefixes %u:", prefixes); tptr = (const uint8_t *)lsap->lsa_un.un_intra_ap.intra_ap_prefix; @@ -728,7 +728,7 @@ ospf6_decode_v3(netdissect_options *ndo, const struct lsa6 *lsap; int i; - switch (EXTRACT_U_1(op->ospf6_type)) { + switch (GET_U_1(op->ospf6_type)) { case OSPF_TYPE_HELLO: { const struct hello6 *hellop = (const struct hello6 *)((const uint8_t *)op + OSPF6HDR_LEN); @@ -736,21 +736,21 @@ ospf6_decode_v3(netdissect_options *ndo, ND_TCHECK_4(hellop->hello_options); ND_PRINT("\n\tOptions [%s]", bittok2str(ospf6_option_values, "none", - EXTRACT_BE_U_4(hellop->hello_options))); + GET_BE_U_4(hellop->hello_options))); ND_TCHECK_2(hellop->hello_deadint); ND_PRINT("\n\t Hello Timer %us, Dead Timer %us, Interface-ID %s, Priority %u", - EXTRACT_BE_U_2(hellop->hello_helloint), - EXTRACT_BE_U_2(hellop->hello_deadint), + GET_BE_U_2(hellop->hello_helloint), + GET_BE_U_2(hellop->hello_deadint), ipaddr_string(ndo, hellop->hello_ifid), - EXTRACT_U_1(hellop->hello_priority)); + GET_U_1(hellop->hello_priority)); ND_TCHECK_4(hellop->hello_dr); - if (EXTRACT_BE_U_4(hellop->hello_dr) != 0) + if (GET_BE_U_4(hellop->hello_dr) != 0) ND_PRINT("\n\t Designated Router %s", ipaddr_string(ndo, hellop->hello_dr)); ND_TCHECK_4(hellop->hello_bdr); - if (EXTRACT_BE_U_4(hellop->hello_bdr) != 0) + if (GET_BE_U_4(hellop->hello_bdr) != 0) ND_PRINT(", Backup Designated Router %s", ipaddr_string(ndo, hellop->hello_bdr)); if (ndo->ndo_vflag > 1) { @@ -771,15 +771,15 @@ ospf6_decode_v3(netdissect_options *ndo, ND_TCHECK_4(ddp->db_options); ND_PRINT("\n\tOptions [%s]", bittok2str(ospf6_option_values, "none", - EXTRACT_BE_U_4(ddp->db_options))); + GET_BE_U_4(ddp->db_options))); ND_TCHECK_1(ddp->db_flags); ND_PRINT(", DD Flags [%s]", - bittok2str(ospf6_dd_flag_values,"none",EXTRACT_U_1(ddp->db_flags))); + bittok2str(ospf6_dd_flag_values,"none",GET_U_1(ddp->db_flags))); ND_TCHECK_4(ddp->db_seq); ND_PRINT(", MTU %u, DD-Sequence 0x%08x", - EXTRACT_BE_U_2(ddp->db_mtu), - EXTRACT_BE_U_4(ddp->db_seq)); + GET_BE_U_2(ddp->db_mtu), + GET_BE_U_4(ddp->db_seq)); if (ndo->ndo_vflag > 1) { /* Print all the LS adv's */ lshp = ddp->db_lshdr; @@ -799,7 +799,7 @@ ospf6_decode_v3(netdissect_options *ndo, ND_PRINT("\n\t Advertising Router %s", ipaddr_string(ndo, lsrp->ls_router)); ospf6_print_ls_type(ndo, - EXTRACT_BE_U_2(lsrp->ls_type), + GET_BE_U_2(lsrp->ls_type), &lsrp->ls_stateid); ++lsrp; } @@ -811,13 +811,13 @@ ospf6_decode_v3(netdissect_options *ndo, const struct lsu6 *lsup = (const struct lsu6 *)((const uint8_t *)op + OSPF6HDR_LEN); ND_TCHECK_4(lsup->lsu_count); - i = EXTRACT_BE_U_4(lsup->lsu_count); + i = GET_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_U_2(lsap->ls_hdr.ls_length)); + GET_BE_U_2(lsap->ls_hdr.ls_length)); } } break; @@ -853,11 +853,11 @@ ospf6_print_lls(netdissect_options *ndo, goto trunc; /* Checksum */ ND_TCHECK_2(cp); - ND_PRINT("\n\tLLS Checksum 0x%04x", EXTRACT_BE_U_2(cp)); + ND_PRINT("\n\tLLS Checksum 0x%04x", GET_BE_U_2(cp)); cp += 2; /* LLS Data Length */ ND_TCHECK_2(cp); - llsdatalen = EXTRACT_BE_U_2(cp); + llsdatalen = GET_BE_U_2(cp); ND_PRINT(", Data Length %u", llsdatalen); if (llsdatalen < OSPF_LLS_HDRLEN || llsdatalen > len) goto trunc; @@ -884,11 +884,12 @@ ospf6_decode_at(netdissect_options *ndo, goto trunc; /* Authentication Type */ ND_TCHECK_2(cp); - ND_PRINT("\n\tAuthentication Type %s", tok2str(ospf6_auth_type_str, "unknown (0x%04x)", EXTRACT_BE_U_2(cp))); + ND_PRINT("\n\tAuthentication Type %s", + tok2str(ospf6_auth_type_str, "unknown (0x%04x)", GET_BE_U_2(cp))); cp += 2; /* Auth Data Len */ ND_TCHECK_2(cp); - authdatalen = EXTRACT_BE_U_2(cp); + authdatalen = GET_BE_U_2(cp); ND_PRINT(", Length %u", authdatalen); if (authdatalen < OSPF6_AT_HDRLEN || authdatalen > len) goto trunc; @@ -898,15 +899,15 @@ ospf6_decode_at(netdissect_options *ndo, cp += 2; /* Security Association ID */ ND_TCHECK_2(cp); - ND_PRINT(", SAID %u", EXTRACT_BE_U_2(cp)); + ND_PRINT(", SAID %u", GET_BE_U_2(cp)); cp += 2; /* Cryptographic Sequence Number (High-Order 32 Bits) */ ND_TCHECK_4(cp); - ND_PRINT(", CSN 0x%08x", EXTRACT_BE_U_4(cp)); + ND_PRINT(", CSN 0x%08x", GET_BE_U_4(cp)); cp += 4; /* Cryptographic Sequence Number (Low-Order 32 Bits) */ ND_TCHECK_4(cp); - ND_PRINT(":%08x", EXTRACT_BE_U_4(cp)); + ND_PRINT(":%08x", GET_BE_U_4(cp)); cp += 4; /* Authentication Data */ ND_TCHECK_LEN(cp, authdatalen - OSPF6_AT_HDRLEN); @@ -932,16 +933,16 @@ ospf6_decode_v3_trailer(netdissect_options *ndo, int lls_hello = 0; int lls_dd = 0; - type = EXTRACT_U_1(op->ospf6_type); + type = GET_U_1(op->ospf6_type); if (type == OSPF_TYPE_HELLO) { const struct hello6 *hellop = (const struct hello6 *)((const uint8_t *)op + OSPF6HDR_LEN); ND_TCHECK_4(hellop->hello_options); - if (EXTRACT_BE_U_4(hellop->hello_options) & OSPF6_OPTION_L) + if (GET_BE_U_4(hellop->hello_options) & OSPF6_OPTION_L) lls_hello = 1; } else if (type == OSPF_TYPE_DD) { const struct dd6 *ddp = (const struct dd6 *)((const uint8_t *)op + OSPF6HDR_LEN); ND_TCHECK_4(ddp->db_options); - if (EXTRACT_BE_U_4(ddp->db_options) & OSPF6_OPTION_L) + if (GET_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) @@ -967,8 +968,10 @@ ospf6_print(netdissect_options *ndo, /* If the type is valid translate it, or just print the type */ /* value. If it's not valid, say so and return */ ND_TCHECK_1(op->ospf6_type); - cp = tok2str(ospf6_type_values, "unknown packet type (%u)", EXTRACT_U_1(op->ospf6_type)); - ND_PRINT("OSPFv%u, %s, length %u", EXTRACT_U_1(op->ospf6_version), cp, length); + cp = tok2str(ospf6_type_values, "unknown packet type (%u)", + GET_U_1(op->ospf6_type)); + ND_PRINT("OSPFv%u, %s, length %u", GET_U_1(op->ospf6_version), cp, + length); if (*cp == 'u') { return; } @@ -979,7 +982,7 @@ ospf6_print(netdissect_options *ndo, /* OSPFv3 data always comes first and optional trailing data may follow. */ ND_TCHECK_2(op->ospf6_len); - datalen = EXTRACT_BE_U_2(op->ospf6_len); + datalen = GET_BE_U_2(op->ospf6_len); if (datalen > length) { ND_PRINT(" [len %u]", datalen); return; @@ -990,16 +993,16 @@ ospf6_print(netdissect_options *ndo, ND_PRINT("\n\tRouter-ID %s", ipaddr_string(ndo, op->ospf6_routerid)); ND_TCHECK_4(op->ospf6_areaid); - if (EXTRACT_BE_U_4(op->ospf6_areaid) != 0) + if (GET_BE_U_4(op->ospf6_areaid) != 0) ND_PRINT(", Area %s", ipaddr_string(ndo, op->ospf6_areaid)); else ND_PRINT(", Backbone Area"); ND_TCHECK_1(op->ospf6_instanceid); - if (EXTRACT_U_1(op->ospf6_instanceid)) - ND_PRINT(", Instance %u", EXTRACT_U_1(op->ospf6_instanceid)); + if (GET_U_1(op->ospf6_instanceid)) + ND_PRINT(", Instance %u", GET_U_1(op->ospf6_instanceid)); /* Do rest according to version. */ - switch (EXTRACT_U_1(op->ospf6_version)) { + switch (GET_U_1(op->ospf6_version)) { case 3: /* ospf version 3 */ diff --git a/print-otv.c b/print-otv.c index f382cdd2..d7f0d86b 100644 --- a/print-otv.c +++ b/print-otv.c @@ -51,16 +51,16 @@ otv_print(netdissect_options *ndo, const u_char *bp, u_int len) goto trunc; ND_TCHECK_1(bp); - flags = EXTRACT_U_1(bp); + flags = GET_U_1(bp); ND_PRINT("flags [%s] (0x%02x), ", flags & 0x08 ? "I" : ".", flags); bp += 1; ND_TCHECK_3(bp); - ND_PRINT("overlay %u, ", EXTRACT_BE_U_3(bp)); + ND_PRINT("overlay %u, ", GET_BE_U_3(bp)); bp += 3; ND_TCHECK_3(bp); - ND_PRINT("instance %u\n", EXTRACT_BE_U_3(bp)); + ND_PRINT("instance %u\n", GET_BE_U_3(bp)); bp += 3; /* Reserved */ diff --git a/print-pflog.c b/print-pflog.c index 7cd96b2e..fc83a04b 100644 --- a/print-pflog.c +++ b/print-pflog.c @@ -90,17 +90,17 @@ pflog_print(netdissect_options *ndo, const struct pfloghdr *hdr) uint32_t rulenr, subrulenr; ndo->ndo_protocol = "pflog"; - rulenr = EXTRACT_BE_U_4(&hdr->rulenr); - subrulenr = EXTRACT_BE_U_4(&hdr->subrulenr); + rulenr = GET_BE_U_4(&hdr->rulenr); + subrulenr = GET_BE_U_4(&hdr->subrulenr); if (subrulenr == (uint32_t)-1) ND_PRINT("rule %u/", rulenr); else ND_PRINT("rule %u.%s.%u/", rulenr, hdr->ruleset, subrulenr); ND_PRINT("%s: %s %s on %s: ", - tok2str(pf_reasons, "unkn(%u)", EXTRACT_U_1(&hdr->reason)), - tok2str(pf_actions, "unkn(%u)", EXTRACT_U_1(&hdr->action)), - tok2str(pf_directions, "unkn(%u)", EXTRACT_U_1(&hdr->dir)), + tok2str(pf_reasons, "unkn(%u)", GET_U_1(&hdr->reason)), + tok2str(pf_actions, "unkn(%u)", GET_U_1(&hdr->action)), + tok2str(pf_directions, "unkn(%u)", GET_U_1(&hdr->dir)), hdr->ifname); } @@ -140,7 +140,7 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, pflog_print(ndo, hdr); /* skip to the real packet */ - af = EXTRACT_U_1(&hdr->af); + af = GET_U_1(&hdr->af); length -= hdrlen; caplen -= hdrlen; p += hdrlen; diff --git a/print-pgm.c b/print-pgm.c index 83fab6be..306c50d0 100644 --- a/print-pgm.c +++ b/print-pgm.c @@ -178,11 +178,11 @@ pgm_print(netdissect_options *ndo, return; } - sport = EXTRACT_BE_U_2(pgm->pgm_sport); - dport = EXTRACT_BE_U_2(pgm->pgm_dport); + sport = GET_BE_U_2(pgm->pgm_sport); + dport = GET_BE_U_2(pgm->pgm_dport); if (ip6) { - if (EXTRACT_U_1(ip6->ip6_nxt) == IPPROTO_PGM) { + if (GET_U_1(ip6->ip6_nxt) == IPPROTO_PGM) { ND_PRINT("%s.%s > %s.%s: ", ip6addr_string(ndo, ip6->ip6_src), tcpport_string(ndo, sport), @@ -193,7 +193,7 @@ pgm_print(netdissect_options *ndo, tcpport_string(ndo, sport), tcpport_string(ndo, dport)); } } else { - if (EXTRACT_U_1(ip->ip_p) == IPPROTO_PGM) { + if (GET_U_1(ip->ip_p) == IPPROTO_PGM) { ND_PRINT("%s.%s > %s.%s: ", ipaddr_string(ndo, ip->ip_src), tcpport_string(ndo, sport), @@ -207,12 +207,12 @@ pgm_print(netdissect_options *ndo, ND_TCHECK_SIZE(pgm); - ND_PRINT("PGM, length %u", EXTRACT_BE_U_2(pgm->pgm_length)); + ND_PRINT("PGM, length %u", GET_BE_U_2(pgm->pgm_length)); if (!ndo->ndo_vflag) return; - pgm_type_val = EXTRACT_U_1(pgm->pgm_type); + pgm_type_val = GET_U_1(pgm->pgm_type); ND_PRINT(" 0x%02x%02x%02x%02x%02x%02x ", pgm->pgm_gsid[0], pgm->pgm_gsid[1], @@ -228,7 +228,7 @@ pgm_print(netdissect_options *ndo, ND_TCHECK_SIZE(spm); bp = (const u_char *) (spm + 1); - switch (EXTRACT_BE_U_2(spm->pgms_nla_afi)) { + switch (GET_BE_U_2(spm->pgms_nla_afi)) { case AFNUM_INET: ND_TCHECK_LEN(bp, sizeof(nd_ipv4)); addrtostr(bp, nla_buf, sizeof(nla_buf)); @@ -245,9 +245,9 @@ pgm_print(netdissect_options *ndo, } ND_PRINT("SPM seq %u trail %u lead %u nla %s", - EXTRACT_BE_U_4(spm->pgms_seq), - EXTRACT_BE_U_4(spm->pgms_trailseq), - EXTRACT_BE_U_4(spm->pgms_leadseq), + GET_BE_U_4(spm->pgms_seq), + GET_BE_U_4(spm->pgms_trailseq), + GET_BE_U_4(spm->pgms_leadseq), nla_buf); break; } @@ -258,8 +258,8 @@ pgm_print(netdissect_options *ndo, poll_msg = (const struct pgm_poll *)(pgm + 1); ND_TCHECK_SIZE(poll_msg); ND_PRINT("POLL seq %u round %u", - EXTRACT_BE_U_4(poll_msg->pgmp_seq), - EXTRACT_BE_U_2(poll_msg->pgmp_round)); + GET_BE_U_4(poll_msg->pgmp_seq), + GET_BE_U_2(poll_msg->pgmp_round)); bp = (const u_char *) (poll_msg + 1); break; } @@ -271,7 +271,7 @@ pgm_print(netdissect_options *ndo, ND_TCHECK_SIZE(polr); bp = (const u_char *) (polr + 1); - switch (EXTRACT_BE_U_2(polr->pgmp_nla_afi)) { + switch (GET_BE_U_2(polr->pgmp_nla_afi)) { case AFNUM_INET: ND_TCHECK_LEN(bp, sizeof(nd_ipv4)); addrtostr(bp, nla_buf, sizeof(nla_buf)); @@ -288,20 +288,21 @@ pgm_print(netdissect_options *ndo, } ND_TCHECK_LEN(bp, sizeof(uint32_t)); - ivl = EXTRACT_BE_U_4(bp); + ivl = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_TCHECK_LEN(bp, sizeof(uint32_t)); - rnd = EXTRACT_BE_U_4(bp); + rnd = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_TCHECK_LEN(bp, sizeof(uint32_t)); - mask = EXTRACT_BE_U_4(bp); + mask = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_PRINT("POLR seq %u round %u nla %s ivl %u rnd 0x%08x " - "mask 0x%08x", EXTRACT_BE_U_4(polr->pgmp_seq), - EXTRACT_BE_U_2(polr->pgmp_round), nla_buf, ivl, rnd, mask); + "mask 0x%08x", GET_BE_U_4(polr->pgmp_seq), + GET_BE_U_2(polr->pgmp_round), nla_buf, ivl, rnd, + mask); break; } case PGM_ODATA: { @@ -310,8 +311,8 @@ pgm_print(netdissect_options *ndo, odata = (const struct pgm_data *)(pgm + 1); ND_TCHECK_SIZE(odata); ND_PRINT("ODATA trail %u seq %u", - EXTRACT_BE_U_4(odata->pgmd_trailseq), - EXTRACT_BE_U_4(odata->pgmd_seq)); + GET_BE_U_4(odata->pgmd_trailseq), + GET_BE_U_4(odata->pgmd_seq)); bp = (const u_char *) (odata + 1); break; } @@ -322,8 +323,8 @@ pgm_print(netdissect_options *ndo, rdata = (const struct pgm_data *)(pgm + 1); ND_TCHECK_SIZE(rdata); ND_PRINT("RDATA trail %u seq %u", - EXTRACT_BE_U_4(rdata->pgmd_trailseq), - EXTRACT_BE_U_4(rdata->pgmd_seq)); + GET_BE_U_4(rdata->pgmd_trailseq), + GET_BE_U_4(rdata->pgmd_seq)); bp = (const u_char *) (rdata + 1); break; } @@ -342,7 +343,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_U_2(nak->pgmn_source_afi)) { + switch (GET_BE_U_2(nak->pgmn_source_afi)) { case AFNUM_INET: ND_TCHECK_LEN(bp, sizeof(nd_ipv4)); addrtostr(bp, source_buf, sizeof(source_buf)); @@ -364,7 +365,7 @@ pgm_print(netdissect_options *ndo, */ bp += (2 * sizeof(uint16_t)); ND_TCHECK_2(bp); - switch (EXTRACT_BE_U_2(bp)) { + switch (GET_BE_U_2(bp)) { case AFNUM_INET: ND_TCHECK_LEN(bp, sizeof(nd_ipv4)); addrtostr(bp, group_buf, sizeof(group_buf)); @@ -397,7 +398,7 @@ pgm_print(netdissect_options *ndo, break; } ND_PRINT("(%s -> %s), seq %u", - source_buf, group_buf, EXTRACT_BE_U_4(nak->pgmn_seq)); + source_buf, group_buf, GET_BE_U_4(nak->pgmn_seq)); break; } @@ -407,7 +408,7 @@ pgm_print(netdissect_options *ndo, ack = (const struct pgm_ack *)(pgm + 1); ND_TCHECK_SIZE(ack); ND_PRINT("ACK seq %u", - EXTRACT_BE_U_4(ack->pgma_rx_max_seq)); + GET_BE_U_4(ack->pgma_rx_max_seq)); bp = (const u_char *) (ack + 1); break; } @@ -421,7 +422,7 @@ pgm_print(netdissect_options *ndo, break; } - if (EXTRACT_U_1(pgm->pgm_options) & PGM_OPT_BIT_PRESENT) { + if (GET_U_1(pgm->pgm_options) & PGM_OPT_BIT_PRESENT) { /* * make sure there's enough for the first option header @@ -432,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_U_1(bp); + opt_type = GET_U_1(bp); bp++; if ((opt_type & PGM_OPT_MASK) != PGM_OPT_LENGTH) { ND_PRINT("[First option bad, should be PGM_OPT_LENGTH, is %u]", opt_type & PGM_OPT_MASK); return; } - opt_len = EXTRACT_U_1(bp); + opt_len = GET_U_1(bp); bp++; if (opt_len != 4) { ND_PRINT("[Bad OPT_LENGTH option, length %u != 4]", opt_len); return; } - opts_len = EXTRACT_BE_U_2(bp); + opts_len = GET_BE_U_2(bp); bp += sizeof(uint16_t); if (opts_len < 4) { ND_PRINT("[Bad total option length %u < 4]", opts_len); @@ -459,9 +460,9 @@ pgm_print(netdissect_options *ndo, return; } ND_TCHECK_2(bp); - opt_type = EXTRACT_U_1(bp); + opt_type = GET_U_1(bp); bp++; - opt_len = EXTRACT_U_1(bp); + opt_len = GET_U_1(bp); bp++; if (opt_len < PGM_MIN_OPT_LEN) { ND_PRINT("[Bad option, length %u < %u]", opt_len, @@ -482,7 +483,7 @@ pgm_print(netdissect_options *ndo, opt_len, PGM_OPT_LENGTH_LEN); return; } - ND_PRINT(" OPTS LEN (extra?) %u", EXTRACT_BE_U_2(bp)); + ND_PRINT(" OPTS LEN (extra?) %u", GET_BE_U_2(bp)); bp += 2; opts_len -= PGM_OPT_LENGTH_LEN; break; @@ -495,11 +496,11 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - seq = EXTRACT_BE_U_4(bp); + seq = GET_BE_U_4(bp); bp += 4; - offset = EXTRACT_BE_U_4(bp); + offset = GET_BE_U_4(bp); bp += 4; - len = EXTRACT_BE_U_4(bp); + len = GET_BE_U_4(bp); bp += 4; ND_PRINT(" FRAG seq %u off %u len %u", seq, offset, len); opts_len -= PGM_OPT_FRAGMENT_LEN; @@ -515,7 +516,7 @@ pgm_print(netdissect_options *ndo, return; } ND_TCHECK_4(bp); - ND_PRINT(" %u", EXTRACT_BE_U_4(bp)); + ND_PRINT(" %u", GET_BE_U_4(bp)); bp += 4; opt_len -= 4; opts_len -= 4; @@ -530,7 +531,7 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - seq = EXTRACT_BE_U_4(bp); + seq = GET_BE_U_4(bp); bp += 4; ND_PRINT(" JOIN %u", seq); opts_len -= PGM_OPT_JOIN_LEN; @@ -544,9 +545,9 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - offset = EXTRACT_BE_U_4(bp); + offset = GET_BE_U_4(bp); bp += 4; - seq = EXTRACT_BE_U_4(bp); + seq = GET_BE_U_4(bp); bp += 4; ND_PRINT(" BACKOFF ivl %u ivlseq %u", offset, seq); opts_len -= PGM_OPT_NAK_BO_IVL_LEN; @@ -560,9 +561,9 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - offset = EXTRACT_BE_U_4(bp); + offset = GET_BE_U_4(bp); bp += 4; - seq = EXTRACT_BE_U_4(bp); + seq = GET_BE_U_4(bp); bp += 4; ND_PRINT(" BACKOFF max %u min %u", offset, seq); opts_len -= PGM_OPT_NAK_BO_RNG_LEN; @@ -576,7 +577,7 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - nla_afnum = EXTRACT_BE_U_2(bp); + nla_afnum = GET_BE_U_2(bp); bp += 2+2; switch (nla_afnum) { case AFNUM_INET: @@ -617,7 +618,7 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - len = EXTRACT_BE_U_4(bp); + len = GET_BE_U_4(bp); bp += 4; ND_PRINT(" PARITY MAXTGS %u", len); opts_len -= PGM_OPT_PARITY_PRM_LEN; @@ -631,7 +632,7 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - seq = EXTRACT_BE_U_4(bp); + seq = GET_BE_U_4(bp); bp += 4; ND_PRINT(" PARITY GROUP %u", seq); opts_len -= PGM_OPT_PARITY_GRP_LEN; @@ -645,7 +646,7 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - len = EXTRACT_BE_U_4(bp); + len = GET_BE_U_4(bp); bp += 4; ND_PRINT(" PARITY ATGS %u", len); opts_len -= PGM_OPT_CURR_TGSIZE_LEN; @@ -731,9 +732,9 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - offset = EXTRACT_BE_U_4(bp); + offset = GET_BE_U_4(bp); bp += 4; - nla_afnum = EXTRACT_BE_U_2(bp); + nla_afnum = GET_BE_U_2(bp); bp += 2+2; switch (nla_afnum) { case AFNUM_INET: @@ -774,9 +775,9 @@ pgm_print(netdissect_options *ndo, return; } bp += 2; - offset = EXTRACT_BE_U_4(bp); + offset = GET_BE_U_4(bp); bp += 4; - nla_afnum = EXTRACT_BE_U_2(bp); + nla_afnum = GET_BE_U_2(bp); bp += 2+2; switch (nla_afnum) { case AFNUM_INET: @@ -825,7 +826,7 @@ pgm_print(netdissect_options *ndo, if (ndo->ndo_packettype == PT_PGM_ZMTP1 && (pgm_type_val == PGM_ODATA || pgm_type_val == PGM_RDATA)) zmtp1_datagram_print(ndo, bp, - EXTRACT_BE_U_2(pgm->pgm_length)); + GET_BE_U_2(pgm->pgm_length)); return; diff --git a/print-pim.c b/print-pim.c index a8e0be01..5b1d61bc 100644 --- a/print-pim.c +++ b/print-pim.c @@ -147,25 +147,25 @@ pimv1_join_prune_print(netdissect_options *ndo, u_int njp; /* If it's a single group and a single source, use 1-line output. */ - if (ND_TTEST_LEN(bp, 30) && EXTRACT_U_1(bp + 11) == 1 && - ((njoin = EXTRACT_BE_U_2(bp + 20)) + EXTRACT_BE_U_2(bp + 22)) == 1) { + if (ND_TTEST_LEN(bp, 30) && GET_U_1(bp + 11) == 1 && + ((njoin = GET_BE_U_2(bp + 20)) + GET_BE_U_2(bp + 22)) == 1) { u_int hold; ND_PRINT(" RPF %s ", ipaddr_string(ndo, bp)); - hold = EXTRACT_BE_U_2(bp + 6); + hold = GET_BE_U_2(bp + 6); if (hold != 180) { ND_PRINT("Hold "); unsigned_relts_print(ndo, hold); } ND_PRINT("%s (%s/%u, %s", njoin ? "Join" : "Prune", - ipaddr_string(ndo, bp + 26), EXTRACT_U_1(bp + 25) & 0x3f, + ipaddr_string(ndo, bp + 26), GET_U_1(bp + 25) & 0x3f, ipaddr_string(ndo, bp + 12)); - if (EXTRACT_BE_U_4(bp + 16) != 0xffffffff) + if (GET_BE_U_4(bp + 16) != 0xffffffff) ND_PRINT("/%s", ipaddr_string(ndo, bp + 16)); ND_PRINT(") %s%s %s", - (EXTRACT_U_1(bp + 24) & 0x01) ? "Sparse" : "Dense", - (EXTRACT_U_1(bp + 25) & 0x80) ? " WC" : "", - (EXTRACT_U_1(bp + 25) & 0x40) ? "RP" : "SPT"); + (GET_U_1(bp + 24) & 0x01) ? "Sparse" : "Dense", + (GET_U_1(bp + 25) & 0x80) ? " WC" : "", + (GET_U_1(bp + 25) & 0x40) ? "RP" : "SPT"); return; } @@ -183,7 +183,7 @@ pimv1_join_prune_print(netdissect_options *ndo, if (ndo->ndo_vflag > 1) ND_PRINT("\n"); ND_PRINT(" Hold time: "); - unsigned_relts_print(ndo, EXTRACT_BE_U_2(bp + 2)); + unsigned_relts_print(ndo, GET_BE_U_2(bp + 2)); if (ndo->ndo_vflag < 2) return; bp += 4; @@ -192,7 +192,7 @@ pimv1_join_prune_print(netdissect_options *ndo, if (len < 4) goto trunc; ND_TCHECK_4(bp); - ngroups = EXTRACT_U_1(bp + 3); + ngroups = GET_U_1(bp + 3); bp += 4; len -= 4; while (ngroups != 0) { @@ -209,15 +209,15 @@ pimv1_join_prune_print(netdissect_options *ndo, if (len < 4) goto trunc; ND_TCHECK_LEN(bp, sizeof(nd_ipv4)); - if (EXTRACT_BE_U_4(bp) != 0xffffffff) + if (GET_BE_U_4(bp) != 0xffffffff) ND_PRINT("/%s", ipaddr_string(ndo, bp)); bp += 4; len -= 4; if (len < 4) goto trunc; ND_TCHECK_4(bp); - njoin = EXTRACT_BE_U_2(bp); - nprune = EXTRACT_BE_U_2(bp + 2); + njoin = GET_BE_U_2(bp); + nprune = GET_BE_U_2(bp + 2); ND_PRINT(" joined: %u pruned: %u", njoin, nprune); bp += 4; len -= 4; @@ -232,11 +232,11 @@ pimv1_join_prune_print(netdissect_options *ndo, goto trunc; ND_TCHECK_6(bp); ND_PRINT("\n\t%s %s%s%s%s/%u", type, - (EXTRACT_U_1(bp) & 0x01) ? "Sparse " : "Dense ", - (EXTRACT_U_1(bp + 1) & 0x80) ? "WC " : "", - (EXTRACT_U_1(bp + 1) & 0x40) ? "RP " : "SPT ", + (GET_U_1(bp) & 0x01) ? "Sparse " : "Dense ", + (GET_U_1(bp + 1) & 0x80) ? "WC " : "", + (GET_U_1(bp + 1) & 0x40) ? "RP " : "SPT ", ipaddr_string(ndo, bp + 2), - EXTRACT_U_1(bp + 1) & 0x3f); + GET_U_1(bp + 1) & 0x3f); bp += 6; len -= 6; } @@ -256,13 +256,13 @@ pimv1_print(netdissect_options *ndo, ndo->ndo_protocol = "pimv1"; ND_TCHECK_1(bp + 1); - type = EXTRACT_U_1(bp + 1); + type = GET_U_1(bp + 1); ND_PRINT(" %s", tok2str(pimv1_type_str, "[type %u]", type)); switch (type) { case PIMV1_TYPE_QUERY: if (ND_TTEST_1(bp + 8)) { - switch (EXTRACT_U_1(bp + 8) >> 4) { + switch (GET_U_1(bp + 8) >> 4) { case 0: ND_PRINT(" Dense-mode"); break; @@ -273,14 +273,14 @@ pimv1_print(netdissect_options *ndo, ND_PRINT(" Sparse-Dense-mode"); break; default: - ND_PRINT(" mode-%u", EXTRACT_U_1(bp + 8) >> 4); + ND_PRINT(" mode-%u", GET_U_1(bp + 8) >> 4); break; } } if (ndo->ndo_vflag) { ND_TCHECK_2(bp + 10); ND_PRINT(" (Hold-time "); - unsigned_relts_print(ndo, EXTRACT_BE_U_2(bp + 10)); + unsigned_relts_print(ndo, GET_BE_U_2(bp + 10)); ND_PRINT(")"); } break; @@ -299,23 +299,23 @@ pimv1_print(netdissect_options *ndo, if (ndo->ndo_vflag) { ND_TCHECK_2(bp + 22); ND_PRINT(" group %s", ipaddr_string(ndo, bp + 8)); - if (EXTRACT_BE_U_4(bp + 12) != 0xffffffff) + if (GET_BE_U_4(bp + 12) != 0xffffffff) ND_PRINT("/%s", ipaddr_string(ndo, bp + 12)); ND_PRINT(" RP %s hold ", ipaddr_string(ndo, bp + 16)); - unsigned_relts_print(ndo, EXTRACT_BE_U_2(bp + 22)); + unsigned_relts_print(ndo, GET_BE_U_2(bp + 22)); } break; case PIMV1_TYPE_ASSERT: ND_TCHECK_LEN(bp + 16, sizeof(nd_ipv4)); ND_PRINT(" for %s > %s", ipaddr_string(ndo, bp + 16), ipaddr_string(ndo, bp + 8)); - if (EXTRACT_BE_U_4(bp + 12) != 0xffffffff) + if (GET_BE_U_4(bp + 12) != 0xffffffff) ND_PRINT("/%s", ipaddr_string(ndo, bp + 12)); ND_TCHECK_4(bp + 24); ND_PRINT(" %s pref %u metric %u", - (EXTRACT_U_1(bp + 20) & 0x80) ? "RP-tree" : "SPT", - EXTRACT_BE_U_4(bp + 20) & 0x7fffffff, - EXTRACT_BE_U_4(bp + 24)); + (GET_U_1(bp + 20) & 0x80) ? "RP-tree" : "SPT", + GET_BE_U_4(bp + 20) & 0x7fffffff, + GET_BE_U_4(bp + 24)); break; case PIMV1_TYPE_JOIN_PRUNE: case PIMV1_TYPE_GRAFT: @@ -328,8 +328,8 @@ pimv1_print(netdissect_options *ndo, break; } ND_TCHECK_1(bp + 4); - if ((EXTRACT_U_1(bp + 4) >> 4) != 1) - ND_PRINT(" [v%u]", EXTRACT_U_1(bp + 4) >> 4); + if ((GET_U_1(bp + 4) >> 4) != 1) + ND_PRINT(" [v%u]", GET_U_1(bp + 4) >> 4); return; trunc: @@ -356,7 +356,7 @@ cisco_autorp_print(netdissect_options *ndo, goto trunc; ND_TCHECK_1(bp); ND_PRINT(" auto-rp "); - type = EXTRACT_U_1(bp); + type = GET_U_1(bp); switch (type) { case 0x11: ND_PRINT("candidate-advert"); @@ -370,13 +370,13 @@ cisco_autorp_print(netdissect_options *ndo, } ND_TCHECK_1(bp + 1); - numrps = EXTRACT_U_1(bp + 1); + numrps = GET_U_1(bp + 1); ND_TCHECK_2(bp + 2); ND_PRINT(" Hold "); - hold = EXTRACT_BE_U_2(bp + 2); + hold = GET_BE_U_2(bp + 2); if (hold) - unsigned_relts_print(ndo, EXTRACT_BE_U_2(bp + 2)); + unsigned_relts_print(ndo, GET_BE_U_2(bp + 2)); else ND_PRINT("FOREVER"); @@ -410,7 +410,7 @@ cisco_autorp_print(netdissect_options *ndo, if (len < 1) goto trunc; ND_TCHECK_1(bp); - switch (EXTRACT_U_1(bp) & 0x3) { + switch (GET_U_1(bp) & 0x3) { case 0: ND_PRINT(" PIMv?"); break; case 1: ND_PRINT(" PIMv1"); @@ -420,14 +420,14 @@ cisco_autorp_print(netdissect_options *ndo, case 3: ND_PRINT(" PIMv1+2"); break; } - if (EXTRACT_U_1(bp) & 0xfc) - ND_PRINT(" [rsvd=0x%02x]", EXTRACT_U_1(bp) & 0xfc); + if (GET_U_1(bp) & 0xfc) + ND_PRINT(" [rsvd=0x%02x]", GET_U_1(bp) & 0xfc); bp += 1; len -= 1; if (len < 1) goto trunc; ND_TCHECK_1(bp); - nentries = EXTRACT_U_1(bp); + nentries = GET_U_1(bp); bp += 1; len -= 1; s = ' '; @@ -435,13 +435,13 @@ cisco_autorp_print(netdissect_options *ndo, if (len < 6) goto trunc; ND_TCHECK_6(bp); - ND_PRINT("%c%s%s/%u", s, EXTRACT_U_1(bp) & 1 ? "!" : "", - ipaddr_string(ndo, bp + 2), EXTRACT_U_1(bp + 1)); - if (EXTRACT_U_1(bp) & 0x02) { + ND_PRINT("%c%s%s/%u", s, GET_U_1(bp) & 1 ? "!" : "", + ipaddr_string(ndo, bp + 2), GET_U_1(bp + 1)); + if (GET_U_1(bp) & 0x02) { ND_PRINT(" bidir"); } - if (EXTRACT_U_1(bp) & 0xfc) { - ND_PRINT("[rsvd=0x%02x]", EXTRACT_U_1(bp) & 0xfc); + if (GET_U_1(bp) & 0xfc) { + ND_PRINT("[rsvd=0x%02x]", GET_U_1(bp) & 0xfc); } s = ','; bp += 6; len -= 6; @@ -469,7 +469,7 @@ pim_print(netdissect_options *ndo, #endif ND_TCHECK_1(pim->pim_typever); - pim_typever = EXTRACT_U_1(pim->pim_typever); + pim_typever = GET_U_1(pim->pim_typever); switch (PIM_VER(pim_typever)) { case 2: if (!ndo->ndo_vflag) { @@ -575,7 +575,7 @@ pimv2_addr_print(netdissect_options *ndo, if (len < 2) goto trunc; ND_TCHECK_1(bp + 1); - switch (EXTRACT_U_1(bp)) { + switch (GET_U_1(bp)) { case 1: af = AF_INET; addr_len = (u_int)sizeof(nd_ipv4); @@ -587,7 +587,7 @@ pimv2_addr_print(netdissect_options *ndo, default: return -1; } - if (EXTRACT_U_1(bp + 1) != 0) + if (GET_U_1(bp + 1) != 0) return -1; hdrlen = 2; } else { @@ -629,27 +629,28 @@ pimv2_addr_print(netdissect_options *ndo, if (af == AF_INET) { if (!silent) { ND_PRINT("%s", ipaddr_string(ndo, bp + 2)); - if (EXTRACT_U_1(bp + 1) != 32) - ND_PRINT("/%u", EXTRACT_U_1(bp + 1)); + if (GET_U_1(bp + 1) != 32) + ND_PRINT("/%u", GET_U_1(bp + 1)); } } else if (af == AF_INET6) { if (!silent) { ND_PRINT("%s", ip6addr_string(ndo, bp + 2)); - if (EXTRACT_U_1(bp + 1) != 128) - ND_PRINT("/%u", EXTRACT_U_1(bp + 1)); + if (GET_U_1(bp + 1) != 128) + ND_PRINT("/%u", GET_U_1(bp + 1)); } } - if (EXTRACT_U_1(bp) && !silent) { + if (GET_U_1(bp) && !silent) { if (at == pimv2_group) { - ND_PRINT("(0x%02x)", EXTRACT_U_1(bp)); + ND_PRINT("(0x%02x)", GET_U_1(bp)); } else { ND_PRINT("(%s%s%s", - EXTRACT_U_1(bp) & 0x04 ? "S" : "", - EXTRACT_U_1(bp) & 0x02 ? "W" : "", - EXTRACT_U_1(bp) & 0x01 ? "R" : ""); - if (EXTRACT_U_1(bp) & 0xf8) { - ND_PRINT("+0x%02x", EXTRACT_U_1(bp) & 0xf8); + GET_U_1(bp) & 0x04 ? "S" : "", + GET_U_1(bp) & 0x02 ? "W" : "", + GET_U_1(bp) & 0x01 ? "R" : ""); + if (GET_U_1(bp) & 0xf8) { + ND_PRINT("+0x%02x", + GET_U_1(bp) & 0xf8); } ND_PRINT(")"); } @@ -712,16 +713,16 @@ pimv2_print(netdissect_options *ndo, if (len < 2) goto trunc; ND_TCHECK_1(pim->pim_rsv); - pim_typever = EXTRACT_U_1(pim->pim_typever); - pimv2_addr_len = EXTRACT_U_1(pim->pim_rsv); + pim_typever = GET_U_1(pim->pim_typever); + pimv2_addr_len = GET_U_1(pim->pim_rsv); if (pimv2_addr_len != 0) ND_PRINT(", RFC2117-encoding"); if (len < 4) goto trunc; ND_TCHECK_2(pim->pim_cksum); - ND_PRINT(", cksum 0x%04x ", EXTRACT_BE_U_2(pim->pim_cksum)); - if (EXTRACT_BE_U_2(pim->pim_cksum) == 0) { + ND_PRINT(", cksum 0x%04x ", GET_BE_U_2(pim->pim_cksum)); + if (GET_BE_U_2(pim->pim_cksum) == 0) { ND_PRINT("(unverified)"); } else { if (PIM_TYPE(pim_typever) == PIMV2_TYPE_REGISTER) { @@ -771,8 +772,8 @@ pimv2_print(netdissect_options *ndo, if (len < 4) goto trunc; ND_TCHECK_4(bp); - otype = EXTRACT_BE_U_2(bp); - olen = EXTRACT_BE_U_2(bp + 2); + otype = GET_BE_U_2(bp); + olen = GET_BE_U_2(bp + 2); ND_PRINT("\n\t %s Option (%u), length %u, Value: ", tok2str(pimv2_hello_option_values, "Unknown", otype), otype, @@ -789,7 +790,7 @@ pimv2_print(netdissect_options *ndo, ND_PRINT("ERROR: Option Length != 2 Bytes (%u)", olen); } else { unsigned_relts_print(ndo, - EXTRACT_BE_U_2(bp)); + GET_BE_U_2(bp)); } break; @@ -799,8 +800,8 @@ pimv2_print(netdissect_options *ndo, } else { char t_bit; uint16_t lan_delay, override_interval; - lan_delay = EXTRACT_BE_U_2(bp); - override_interval = EXTRACT_BE_U_2(bp + 2); + lan_delay = GET_BE_U_2(bp); + override_interval = GET_BE_U_2(bp + 2); t_bit = (lan_delay & 0x8000)? 1 : 0; lan_delay &= ~0x8000; ND_PRINT("\n\t T-bit=%u, LAN delay %ums, Override interval %ums", @@ -815,7 +816,7 @@ pimv2_print(netdissect_options *ndo, ND_PRINT("Bi-Directional Capability (Old)"); break; case 4: - ND_PRINT("%u", EXTRACT_BE_U_4(bp)); + ND_PRINT("%u", GET_BE_U_4(bp)); break; default: ND_PRINT("ERROR: Option Length != 4 Bytes (%u)", olen); @@ -827,7 +828,7 @@ pimv2_print(netdissect_options *ndo, if (olen != 4) { ND_PRINT("ERROR: Option Length != 4 Bytes (%u)", olen); } else { - ND_PRINT("0x%08x", EXTRACT_BE_U_4(bp)); + ND_PRINT("0x%08x", GET_BE_U_4(bp)); } break; @@ -835,14 +836,15 @@ pimv2_print(netdissect_options *ndo, if (olen != 4) { ND_PRINT("ERROR: Option Length != 4 Bytes (%u)", olen); } else { - ND_PRINT("v%u", EXTRACT_U_1(bp)); - if (EXTRACT_U_1(bp + 1) != 0) { + ND_PRINT("v%u", GET_U_1(bp)); + if (GET_U_1(bp + 1) != 0) { ND_PRINT(", interval "); unsigned_relts_print(ndo, - EXTRACT_U_1(bp + 1)); + GET_U_1(bp + 1)); } - if (EXTRACT_BE_U_2(bp + 2) != 0) { - ND_PRINT(" ?0x%04x?", EXTRACT_BE_U_2(bp + 2)); + if (GET_BE_U_2(bp + 2) != 0) { + ND_PRINT(" ?0x%04x?", + GET_BE_U_2(bp + 2)); } } break; @@ -890,7 +892,7 @@ pimv2_print(netdissect_options *ndo, ND_PRINT(", Flags [ %s ]\n\t", tok2str(pimv2_register_flag_values, "none", - EXTRACT_BE_U_4(bp))); + GET_BE_U_4(bp))); bp += 4; len -= 4; /* encapsulated multicast packet */ @@ -988,8 +990,8 @@ pimv2_print(netdissect_options *ndo, if (len < 4) goto trunc; ND_TCHECK_4(bp); - ngroup = EXTRACT_U_1(bp + 1); - holdtime = EXTRACT_BE_U_2(bp + 2); + ngroup = GET_U_1(bp + 1); + holdtime = GET_BE_U_2(bp + 2); ND_PRINT("\n\t %u group(s)", ngroup); if (PIM_TYPE(pim_typever) != 7) { /*not for Graft-ACK*/ ND_PRINT(", holdtime: "); @@ -1007,8 +1009,8 @@ pimv2_print(netdissect_options *ndo, if (len < 4) goto trunc; ND_TCHECK_4(bp); - njoin = EXTRACT_BE_U_2(bp); - nprune = EXTRACT_BE_U_2(bp + 2); + njoin = GET_BE_U_2(bp); + nprune = GET_BE_U_2(bp + 2); ND_PRINT(", joined sources: %u, pruned sources: %u", njoin, nprune); bp += 4; len -= 4; for (j = 0; j < njoin; j++) { @@ -1035,17 +1037,17 @@ pimv2_print(netdissect_options *ndo, if (len < 2) goto trunc; ND_TCHECK_2(bp); - ND_PRINT(" tag=%x", EXTRACT_BE_U_2(bp)); + ND_PRINT(" tag=%x", GET_BE_U_2(bp)); bp += 2; len -= 2; if (len < 1) goto trunc; ND_TCHECK_1(bp); - ND_PRINT(" hashmlen=%u", EXTRACT_U_1(bp)); + ND_PRINT(" hashmlen=%u", GET_U_1(bp)); if (len < 2) goto trunc; ND_TCHECK_1(bp + 2); - ND_PRINT(" BSRprio=%u", EXTRACT_U_1(bp + 1)); + ND_PRINT(" BSRprio=%u", GET_U_1(bp + 1)); bp += 2; len -= 2; @@ -1068,11 +1070,11 @@ pimv2_print(netdissect_options *ndo, if (len < 1) goto trunc; ND_TCHECK_1(bp); - ND_PRINT(" RPcnt=%u", EXTRACT_U_1(bp)); + ND_PRINT(" RPcnt=%u", GET_U_1(bp)); if (len < 2) goto trunc; ND_TCHECK_1(bp + 1); - frpcnt = EXTRACT_U_1(bp + 1); + frpcnt = GET_U_1(bp + 1); ND_PRINT(" FRPcnt=%u", frpcnt); if (len < 4) goto trunc; @@ -1095,11 +1097,11 @@ pimv2_print(netdissect_options *ndo, ND_TCHECK_2(bp); ND_PRINT(",holdtime="); unsigned_relts_print(ndo, - EXTRACT_BE_U_2(bp)); + GET_BE_U_2(bp)); if (len < 3) goto trunc; ND_TCHECK_1(bp + 2); - ND_PRINT(",prio=%u", EXTRACT_U_1(bp + 2)); + ND_PRINT(",prio=%u", GET_U_1(bp + 2)); if (len < 4) goto trunc; bp += 4; @@ -1121,10 +1123,10 @@ pimv2_print(netdissect_options *ndo, if (len < 8) goto trunc; ND_TCHECK_8(bp); - if (EXTRACT_U_1(bp) & 0x80) + if (GET_U_1(bp) & 0x80) ND_PRINT(" RPT"); - ND_PRINT(" pref=%u", EXTRACT_BE_U_4(bp) & 0x7fffffff); - ND_PRINT(" metric=%u", EXTRACT_BE_U_4(bp + 4)); + ND_PRINT(" pref=%u", GET_BE_U_4(bp) & 0x7fffffff); + ND_PRINT(" metric=%u", GET_BE_U_4(bp + 4)); break; case PIMV2_TYPE_CANDIDATE_RP: @@ -1135,17 +1137,17 @@ pimv2_print(netdissect_options *ndo, if (len < 1) goto trunc; ND_TCHECK_1(bp); - ND_PRINT(" prefix-cnt=%u", EXTRACT_U_1(bp)); - pfxcnt = EXTRACT_U_1(bp); + ND_PRINT(" prefix-cnt=%u", GET_U_1(bp)); + pfxcnt = GET_U_1(bp); if (len < 2) goto trunc; ND_TCHECK_1(bp + 1); - ND_PRINT(" prio=%u", EXTRACT_U_1(bp + 1)); + ND_PRINT(" prio=%u", GET_U_1(bp + 1)); if (len < 4) goto trunc; ND_TCHECK_2(bp + 2); ND_PRINT(" holdtime="); - unsigned_relts_print(ndo, EXTRACT_BE_U_2(bp + 2)); + unsigned_relts_print(ndo, GET_BE_U_2(bp + 2)); bp += 4; len -= 4; @@ -1187,7 +1189,7 @@ pimv2_print(netdissect_options *ndo, goto trunc; ND_TCHECK_2(bp); ND_PRINT(" TUNR "); - unsigned_relts_print(ndo, EXTRACT_BE_U_2(bp)); + unsigned_relts_print(ndo, GET_BE_U_2(bp)); break; diff --git a/print-pktap.c b/print-pktap.c index 0e10aeba..af3b3973 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_U_4(hdr->pkt_dlt); - hdrlen = EXTRACT_LE_U_4(hdr->pkt_len); + dlt = GET_LE_U_4(hdr->pkt_dlt); + hdrlen = GET_LE_U_4(hdr->pkt_len); dltname = pcap_datalink_val_to_name(dlt); if (!ndo->ndo_qflag) { ND_PRINT("DLT %s (%u) len %u", @@ -112,8 +112,8 @@ pktap_if_print(netdissect_options *ndo, return (caplen); } hdr = (const pktap_header_t *)p; - dlt = EXTRACT_LE_U_4(hdr->pkt_dlt); - hdrlen = EXTRACT_LE_U_4(hdr->pkt_len); + dlt = GET_LE_U_4(hdr->pkt_dlt); + hdrlen = GET_LE_U_4(hdr->pkt_len); if (hdrlen < sizeof(pktap_header_t)) { /* * Claimed header length < structure length. @@ -137,7 +137,7 @@ pktap_if_print(netdissect_options *ndo, caplen -= hdrlen; p += hdrlen; - rectype = EXTRACT_LE_U_4(hdr->pkt_rectype); + rectype = GET_LE_U_4(hdr->pkt_rectype); switch (rectype) { case PKT_REC_NONE: diff --git a/print-ppi.c b/print-ppi.c index 398ed689..8f47fcfc 100644 --- a/print-ppi.c +++ b/print-ppi.c @@ -35,12 +35,12 @@ ppi_header_print(netdissect_options *ndo, const u_char *bp, u_int length) hdr = (const ppi_header_t *)bp; - len = EXTRACT_LE_U_2(hdr->ppi_len); - dlt = EXTRACT_LE_U_4(hdr->ppi_dlt); + len = GET_LE_U_2(hdr->ppi_len); + dlt = GET_LE_U_4(hdr->ppi_dlt); dltname = pcap_datalink_val_to_name(dlt); if (!ndo->ndo_qflag) { - ND_PRINT("V.%u DLT %s (%u) len %u", EXTRACT_U_1(hdr->ppi_ver), + ND_PRINT("V.%u DLT %s (%u) len %u", GET_U_1(hdr->ppi_ver), (dltname != NULL ? dltname : "UNKNOWN"), dlt, len); } else { @@ -71,7 +71,7 @@ ppi_print(netdissect_options *ndo, hdr = (const ppi_header_t *)p; ND_TCHECK_2(hdr->ppi_len); - len = EXTRACT_LE_U_2(hdr->ppi_len); + len = GET_LE_U_2(hdr->ppi_len); if (caplen < len) { /* * If we don't have the entire PPI header, don't @@ -85,7 +85,7 @@ ppi_print(netdissect_options *ndo, return (len); } ND_TCHECK_4(hdr->ppi_dlt); - dlt = EXTRACT_LE_U_4(hdr->ppi_dlt); + dlt = GET_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 787f34c7..1f82e7da 100644 --- a/print-ppp.c +++ b/print-ppp.c @@ -429,13 +429,13 @@ handle_ctrl_proto(netdissect_options *ndo, goto trunc; ND_TCHECK_2(tptr); - code = EXTRACT_U_1(tptr); + code = GET_U_1(tptr); tptr++; ND_PRINT("%s (0x%02x), id %u, length %u", tok2str(cpcodes, "Unknown Opcode",code), code, - EXTRACT_U_1(tptr), /* ID */ + GET_U_1(tptr), /* ID */ length + 2); tptr++; @@ -443,7 +443,7 @@ handle_ctrl_proto(netdissect_options *ndo, return; ND_TCHECK_2(tptr); - len = EXTRACT_BE_U_2(tptr); + len = GET_BE_U_2(tptr); tptr += 2; if (len < 4) { @@ -471,12 +471,12 @@ handle_ctrl_proto(netdissect_options *ndo, if (length < 11) break; ND_TCHECK_4(tptr); - ND_PRINT("\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr)); + ND_PRINT("\n\t Magic-Num 0x%08x", GET_BE_U_4(tptr)); tptr += 4; ND_TCHECK_3(tptr); ND_PRINT(" Vendor: %s (%u)", - tok2str(oui_values,"Unknown",EXTRACT_BE_U_3(tptr)), - EXTRACT_BE_U_3(tptr)); + tok2str(oui_values,"Unknown",GET_BE_U_3(tptr)), + GET_BE_U_3(tptr)); /* XXX: need to decode Kind and Value(s)? */ break; case CPCODES_CONF_REQ: @@ -538,8 +538,8 @@ handle_ctrl_proto(netdissect_options *ndo, break; ND_TCHECK_2(tptr); ND_PRINT("\n\t Rejected %s Protocol (0x%04x)", - tok2str(ppptype2str,"unknown", EXTRACT_BE_U_2(tptr)), - EXTRACT_BE_U_2(tptr)); + tok2str(ppptype2str,"unknown", GET_BE_U_2(tptr)), + GET_BE_U_2(tptr)); /* XXX: need to decode Rejected-Information? - hexdump for now */ if (len > 6) { ND_PRINT("\n\t Rejected Packet"); @@ -552,7 +552,7 @@ handle_ctrl_proto(netdissect_options *ndo, if (length < 8) break; ND_TCHECK_4(tptr); - ND_PRINT("\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr)); + ND_PRINT("\n\t Magic-Num 0x%08x", GET_BE_U_4(tptr)); /* XXX: need to decode Data? - hexdump for now */ if (len > 8) { ND_PRINT("\n\t -----trailing data-----"); @@ -564,7 +564,7 @@ handle_ctrl_proto(netdissect_options *ndo, if (length < 8) break; ND_TCHECK_4(tptr); - ND_PRINT("\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr)); + ND_PRINT("\n\t Magic-Num 0x%08x", GET_BE_U_4(tptr)); /* RFC 1661 says this is intended to be human readable */ if (len > 8) { ND_PRINT("\n\t Message\n\t "); @@ -576,9 +576,9 @@ handle_ctrl_proto(netdissect_options *ndo, if (length < 12) break; ND_TCHECK_4(tptr); - ND_PRINT("\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr)); + ND_PRINT("\n\t Magic-Num 0x%08x", GET_BE_U_4(tptr)); ND_TCHECK_4(tptr + 4); - ND_PRINT(", Seconds-Remaining %us", EXTRACT_BE_U_4(tptr + 4)); + ND_PRINT(", Seconds-Remaining %us", GET_BE_U_4(tptr + 4)); /* XXX: need to decode Message? */ break; default: @@ -605,8 +605,8 @@ print_lcp_config_options(netdissect_options *ndo, if (length < 2) return 0; ND_TCHECK_2(p); - opt = EXTRACT_U_1(p); - len = EXTRACT_U_1(p + 1); + opt = GET_U_1(p); + len = GET_U_1(p + 1); if (length < len) return 0; if (len < 2) { @@ -632,15 +632,15 @@ print_lcp_config_options(netdissect_options *ndo, } ND_TCHECK_3(p + 2); ND_PRINT(": Vendor: %s (%u)", - tok2str(oui_values,"Unknown",EXTRACT_BE_U_3(p + 2)), - EXTRACT_BE_U_3(p + 2)); + tok2str(oui_values,"Unknown",GET_BE_U_3(p + 2)), + GET_BE_U_3(p + 2)); #if 0 ND_TCHECK_1(p + 5); - ND_PRINT(", kind: 0x%02x", EXTRACT_U_1(p + 5)); + ND_PRINT(", kind: 0x%02x", GET_U_1(p + 5)); ND_PRINT(", Value: 0x"); for (i = 0; i < len - 6; i++) { ND_TCHECK_1(p + 6 + i); - ND_PRINT("%02x", EXTRACT_U_1(p + 6 + i)); + ND_PRINT("%02x", GET_U_1(p + 6 + i)); } #endif break; @@ -650,7 +650,7 @@ print_lcp_config_options(netdissect_options *ndo, return len; } ND_TCHECK_2(p + 2); - ND_PRINT(": %u", EXTRACT_BE_U_2(p + 2)); + ND_PRINT(": %u", GET_BE_U_2(p + 2)); break; case LCPOPT_ACCM: if (len != 6) { @@ -658,7 +658,7 @@ print_lcp_config_options(netdissect_options *ndo, return len; } ND_TCHECK_4(p + 2); - ND_PRINT(": 0x%08x", EXTRACT_BE_U_4(p + 2)); + ND_PRINT(": 0x%08x", GET_BE_U_4(p + 2)); break; case LCPOPT_AP: if (len < 4) { @@ -666,12 +666,14 @@ print_lcp_config_options(netdissect_options *ndo, return len; } ND_TCHECK_2(p + 2); - ND_PRINT(": %s", tok2str(ppptype2str, "Unknown Auth Proto (0x04x)", EXTRACT_BE_U_2(p + 2))); + ND_PRINT(": %s", + tok2str(ppptype2str, "Unknown Auth Proto (0x04x)", GET_BE_U_2(p + 2))); - switch (EXTRACT_BE_U_2(p + 2)) { + switch (GET_BE_U_2(p + 2)) { case PPP_CHAP: ND_TCHECK_1(p + 4); - ND_PRINT(", %s", tok2str(authalg_values, "Unknown Auth Alg %u", EXTRACT_U_1(p + 4))); + ND_PRINT(", %s", + tok2str(authalg_values, "Unknown Auth Alg %u", GET_U_1(p + 4))); break; case PPP_PAP: /* fall through */ case PPP_EAP: @@ -688,7 +690,7 @@ print_lcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_2(p + 2); - if (EXTRACT_BE_U_2(p + 2) == PPP_LQM) + if (GET_BE_U_2(p + 2) == PPP_LQM) ND_PRINT(": LQR"); else ND_PRINT(": unknown"); @@ -699,7 +701,7 @@ print_lcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_4(p + 2); - ND_PRINT(": 0x%08x", EXTRACT_BE_U_4(p + 2)); + ND_PRINT(": 0x%08x", GET_BE_U_4(p + 2)); break; case LCPOPT_PFC: break; @@ -711,7 +713,7 @@ print_lcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_2(p + 2); - ND_PRINT(": 0x%04x", EXTRACT_BE_U_2(p + 2)); + ND_PRINT(": 0x%04x", GET_BE_U_2(p + 2)); break; case LCPOPT_CBACK: if (len < 3) { @@ -721,8 +723,8 @@ print_lcp_config_options(netdissect_options *ndo, ND_PRINT(": "); ND_TCHECK_1(p + 2); ND_PRINT(": Callback Operation %s (%u)", - tok2str(ppp_callback_values, "Unknown", EXTRACT_U_1(p + 2)), - EXTRACT_U_1(p + 2)); + tok2str(ppp_callback_values, "Unknown", GET_U_1(p + 2)), + GET_U_1(p + 2)); break; case LCPOPT_MLMRRU: if (len != 4) { @@ -730,7 +732,7 @@ print_lcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_2(p + 2); - ND_PRINT(": %u", EXTRACT_BE_U_2(p + 2)); + ND_PRINT(": %u", GET_BE_U_2(p + 2)); break; case LCPOPT_MLED: if (len < 3) { @@ -738,7 +740,7 @@ print_lcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_1(p + 2); - switch (EXTRACT_U_1(p + 2)) { /* class */ + switch (GET_U_1(p + 2)) { /* class */ case MEDCLASS_NULL: ND_PRINT(": Null"); break; @@ -768,7 +770,7 @@ print_lcp_config_options(netdissect_options *ndo, ND_PRINT(": PSNDN"); /* XXX */ break; default: - ND_PRINT(": Unknown class %u", EXTRACT_U_1(p + 2)); + ND_PRINT(": Unknown class %u", GET_U_1(p + 2)); break; } break; @@ -840,8 +842,9 @@ handle_mlppp(netdissect_options *ndo, } ND_PRINT("seq 0x%03x, Flags [%s], length %u", - (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), + (GET_BE_U_2(p))&0x0fff, + /* only support 12-Bit sequence space for now */ + bittok2str(ppp_ml_flag_values, "none", GET_U_1(p) & 0xc0), length); } @@ -861,23 +864,23 @@ handle_chap(netdissect_options *ndo, return; } else if (length < 4) { ND_TCHECK_1(p); - ND_PRINT("[|chap 0x%02x]", EXTRACT_U_1(p)); + ND_PRINT("[|chap 0x%02x]", GET_U_1(p)); return; } ND_TCHECK_1(p); - code = EXTRACT_U_1(p); + code = GET_U_1(p); ND_PRINT("CHAP, %s (0x%02x)", tok2str(chapcode_values,"unknown",code), code); p++; ND_TCHECK_1(p); - ND_PRINT(", id %u", EXTRACT_U_1(p)); /* ID */ + ND_PRINT(", id %u", GET_U_1(p)); /* ID */ p++; ND_TCHECK_2(p); - len = EXTRACT_BE_U_2(p); + len = GET_BE_U_2(p); p += 2; /* @@ -893,21 +896,21 @@ handle_chap(netdissect_options *ndo, if (length - (p - p0) < 1) return; ND_TCHECK_1(p); - val_size = EXTRACT_U_1(p); /* value size */ + val_size = GET_U_1(p); /* value size */ p++; if (length - (p - p0) < val_size) return; ND_PRINT(", Value "); for (i = 0; i < val_size; i++) { ND_TCHECK_1(p); - ND_PRINT("%02x", EXTRACT_U_1(p)); + ND_PRINT("%02x", GET_U_1(p)); p++; } name_size = len - (p - p0); ND_PRINT(", Name "); for (i = 0; i < name_size; i++) { ND_TCHECK_1(p); - fn_print_char(ndo, EXTRACT_U_1(p)); + fn_print_char(ndo, GET_U_1(p)); p++; } break; @@ -917,7 +920,7 @@ handle_chap(netdissect_options *ndo, ND_PRINT(", Msg "); for (i = 0; i< msg_size; i++) { ND_TCHECK_1(p); - fn_print_char(ndo, EXTRACT_U_1(p)); + fn_print_char(ndo, GET_U_1(p)); p++; } break; @@ -944,23 +947,23 @@ handle_pap(netdissect_options *ndo, return; } else if (length < 4) { ND_TCHECK_1(p); - ND_PRINT("[|pap 0x%02x]", EXTRACT_U_1(p)); + ND_PRINT("[|pap 0x%02x]", GET_U_1(p)); return; } ND_TCHECK_1(p); - code = EXTRACT_U_1(p); + code = GET_U_1(p); ND_PRINT("PAP, %s (0x%02x)", tok2str(papcode_values, "unknown", code), code); p++; ND_TCHECK_1(p); - ND_PRINT(", id %u", EXTRACT_U_1(p)); /* ID */ + ND_PRINT(", id %u", GET_U_1(p)); /* ID */ p++; ND_TCHECK_2(p); - len = EXTRACT_BE_U_2(p); + len = GET_BE_U_2(p); p += 2; if (len > length) { @@ -981,28 +984,28 @@ handle_pap(netdissect_options *ndo, if (length - (p - p0) < 1) return; ND_TCHECK_1(p); - peerid_len = EXTRACT_U_1(p); /* Peer-ID Length */ + peerid_len = GET_U_1(p); /* Peer-ID Length */ p++; if (length - (p - p0) < peerid_len) return; ND_PRINT(", Peer "); for (i = 0; i < peerid_len; i++) { ND_TCHECK_1(p); - fn_print_char(ndo, EXTRACT_U_1(p)); + fn_print_char(ndo, GET_U_1(p)); p++; } if (length - (p - p0) < 1) return; ND_TCHECK_1(p); - passwd_len = EXTRACT_U_1(p); /* Password Length */ + passwd_len = GET_U_1(p); /* Password Length */ p++; if (length - (p - p0) < passwd_len) return; ND_PRINT(", Name "); for (i = 0; i < passwd_len; i++) { ND_TCHECK_1(p); - fn_print_char(ndo, EXTRACT_U_1(p)); + fn_print_char(ndo, GET_U_1(p)); p++; } break; @@ -1018,14 +1021,14 @@ handle_pap(netdissect_options *ndo, if (length - (p - p0) < 1) return; ND_TCHECK_1(p); - msg_len = EXTRACT_U_1(p); /* Msg-Length */ + msg_len = GET_U_1(p); /* Msg-Length */ p++; if (length - (p - p0) < msg_len) return; ND_PRINT(", Msg "); for (i = 0; i< msg_len; i++) { ND_TCHECK_1(p); - fn_print_char(ndo, EXTRACT_U_1(p)); + fn_print_char(ndo, GET_U_1(p)); p++; } break; @@ -1056,8 +1059,8 @@ print_ipcp_config_options(netdissect_options *ndo, if (length < 2) return 0; ND_TCHECK_2(p); - opt = EXTRACT_U_1(p); - len = EXTRACT_U_1(p + 1); + opt = GET_U_1(p); + len = GET_U_1(p + 1); if (length < len) return 0; if (len < 2) { @@ -1090,7 +1093,7 @@ print_ipcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK_2(p + 2); - compproto = EXTRACT_BE_U_2(p + 2); + compproto = GET_BE_U_2(p + 2); ND_PRINT(": %s (0x%02x):", tok2str(ipcpopt_compproto_values, "Unknown", compproto), @@ -1110,11 +1113,11 @@ print_ipcp_config_options(netdissect_options *ndo, ND_TCHECK_LEN(p + 2, IPCPOPT_IPCOMP_MINLEN); ND_PRINT("\n\t TCP Space %u, non-TCP Space %u" ", maxPeriod %u, maxTime %u, maxHdr %u", - 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)); + GET_BE_U_2(p + 4), + GET_BE_U_2(p + 6), + GET_BE_U_2(p + 8), + GET_BE_U_2(p + 10), + GET_BE_U_2(p + 12)); /* suboptions present ? */ if (len > IPCPOPT_IPCOMP_MINLEN) { @@ -1125,8 +1128,8 @@ print_ipcp_config_options(netdissect_options *ndo, while (ipcomp_subopttotallen >= 2) { ND_TCHECK_2(p); - ipcomp_subopt = EXTRACT_U_1(p); - ipcomp_suboptlen = EXTRACT_U_1(p + 1); + ipcomp_subopt = GET_U_1(p); + ipcomp_suboptlen = GET_U_1(p + 1); /* sanity check */ if (ipcomp_subopt == 0 || @@ -1197,8 +1200,8 @@ print_ip6cp_config_options(netdissect_options *ndo, if (length < 2) return 0; ND_TCHECK_2(p); - opt = EXTRACT_U_1(p); - len = EXTRACT_U_1(p + 1); + opt = GET_U_1(p); + len = GET_U_1(p + 1); if (length < len) return 0; if (len < 2) { @@ -1222,10 +1225,10 @@ print_ip6cp_config_options(netdissect_options *ndo, } ND_TCHECK_8(p + 2); ND_PRINT(": %04x:%04x:%04x:%04x", - EXTRACT_BE_U_2(p + 2), - EXTRACT_BE_U_2(p + 4), - EXTRACT_BE_U_2(p + 6), - EXTRACT_BE_U_2(p + 8)); + GET_BE_U_2(p + 2), + GET_BE_U_2(p + 4), + GET_BE_U_2(p + 6), + GET_BE_U_2(p + 8)); break; default: /* @@ -1257,8 +1260,8 @@ print_ccp_config_options(netdissect_options *ndo, if (length < 2) return 0; ND_TCHECK_2(p); - opt = EXTRACT_U_1(p); - len = EXTRACT_U_1(p + 1); + opt = GET_U_1(p); + len = GET_U_1(p + 1); if (length < len) return 0; if (len < 2) { @@ -1282,8 +1285,8 @@ print_ccp_config_options(netdissect_options *ndo, } ND_TCHECK_1(p + 2); ND_PRINT(": Version: %u, Dictionary Bits: %u", - EXTRACT_U_1(p + 2) >> 5, - EXTRACT_U_1(p + 2) & 0x1f); + GET_U_1(p + 2) >> 5, + GET_U_1(p + 2) & 0x1f); break; case CCPOPT_MVRCA: if (len < 4) { @@ -1292,10 +1295,10 @@ print_ccp_config_options(netdissect_options *ndo, } ND_TCHECK_1(p + 3); ND_PRINT(": Features: %u, PxP: %s, History: %u, #CTX-ID: %u", - (EXTRACT_U_1(p + 2) & 0xc0) >> 6, - (EXTRACT_U_1(p + 2) & 0x20) ? "Enabled" : "Disabled", - EXTRACT_U_1(p + 2) & 0x1f, - EXTRACT_U_1(p + 3)); + (GET_U_1(p + 2) & 0xc0) >> 6, + (GET_U_1(p + 2) & 0x20) ? "Enabled" : "Disabled", + GET_U_1(p + 2) & 0x1f, + GET_U_1(p + 3)); break; case CCPOPT_DEFLATE: if (len < 4) { @@ -1304,11 +1307,11 @@ print_ccp_config_options(netdissect_options *ndo, } ND_TCHECK_1(p + 3); ND_PRINT(": Window: %uK, Method: %s (0x%x), MBZ: %u, CHK: %u", - (EXTRACT_U_1(p + 2) & 0xf0) >> 4, - ((EXTRACT_U_1(p + 2) & 0x0f) == 8) ? "zlib" : "unknown", - EXTRACT_U_1(p + 2) & 0x0f, - (EXTRACT_U_1(p + 3) & 0xfc) >> 2, - EXTRACT_U_1(p + 3) & 0x03); + (GET_U_1(p + 2) & 0xf0) >> 4, + ((GET_U_1(p + 2) & 0x0f) == 8) ? "zlib" : "unknown", + GET_U_1(p + 2) & 0x0f, + (GET_U_1(p + 3) & 0xfc) >> 2, + GET_U_1(p + 3) & 0x03); break; /* XXX: to be supported */ @@ -1356,8 +1359,8 @@ print_bacp_config_options(netdissect_options *ndo, if (length < 2) return 0; ND_TCHECK_2(p); - opt = EXTRACT_U_1(p); - len = EXTRACT_U_1(p + 1); + opt = GET_U_1(p); + len = GET_U_1(p + 1); if (length < len) return 0; if (len < 2) { @@ -1380,7 +1383,7 @@ print_bacp_config_options(netdissect_options *ndo, return len; } ND_TCHECK_4(p + 2); - ND_PRINT(": Magic-Num 0x%08x", EXTRACT_BE_U_4(p + 2)); + ND_PRINT(": Magic-Num 0x%08x", GET_BE_U_4(p + 2)); break; default: /* @@ -1423,13 +1426,13 @@ ppp_hdlc(netdissect_options *ndo, * contents. */ for (s = p, t = b, i = length; i != 0 && ND_TTEST_1(s); i--) { - c = EXTRACT_U_1(s); + c = GET_U_1(s); s++; if (c == 0x7d) { if (i <= 1 || !ND_TTEST_1(s)) break; i--; - c = EXTRACT_U_1(s) ^ 0x20; + c = GET_U_1(s) ^ 0x20; s++; } *t++ = c; @@ -1445,7 +1448,7 @@ ppp_hdlc(netdissect_options *ndo, /* now lets guess about the payload codepoint format */ if (length < 1) goto trunc; - proto = EXTRACT_U_1(b); /* start with a one-octet codepoint guess */ + proto = GET_U_1(b); /* start with a one-octet codepoint guess */ switch (proto) { case PPP_IP: @@ -1460,13 +1463,13 @@ ppp_hdlc(netdissect_options *ndo, if (length < 2) goto trunc; - proto = EXTRACT_BE_U_2(b); /* next guess - load two octets */ + proto = GET_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_U_2(b + 2); /* load the PPP proto-id */ + proto = GET_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 */ @@ -1563,7 +1566,7 @@ ppp_print(netdissect_options *ndo, if (length < 2) goto trunc; ND_TCHECK_2(p); - ppp_header = EXTRACT_BE_U_2(p); + ppp_header = GET_BE_U_2(p); switch(ppp_header) { case (PPP_WITHDIRECTION_IN << 8 | PPP_CONTROL): @@ -1591,14 +1594,14 @@ ppp_print(netdissect_options *ndo, if (length < 2) goto trunc; ND_TCHECK_1(p); - if (EXTRACT_U_1(p) % 2) { - proto = EXTRACT_U_1(p); /* PFC is used */ + if (GET_U_1(p) % 2) { + proto = GET_U_1(p); /* PFC is used */ p++; length--; hdr_len++; } else { ND_TCHECK_2(p); - proto = EXTRACT_BE_U_2(p); + proto = GET_BE_U_2(p); p += 2; length -= 2; hdr_len += 2; @@ -1670,8 +1673,8 @@ ppp_if_print(netdissect_options *ndo, * BSD/OS, is?) */ if (ndo->ndo_eflag) - ND_PRINT("%c %4d %02x ", EXTRACT_U_1(p) ? 'O' : 'I', - length, EXTRACT_U_1(p + 1)); + ND_PRINT("%c %4d %02x ", GET_U_1(p) ? 'O' : 'I', + length, GET_U_1(p + 1)); #endif ppp_print(ndo, p, length); @@ -1703,7 +1706,7 @@ ppp_hdlc_if_print(netdissect_options *ndo, return (caplen); } - switch (EXTRACT_U_1(p)) { + switch (GET_U_1(p)) { case PPP_ADDRESS: if (caplen < 4) { @@ -1712,13 +1715,13 @@ ppp_hdlc_if_print(netdissect_options *ndo, } if (ndo->ndo_eflag) - ND_PRINT("%02x %02x %u ", EXTRACT_U_1(p), - EXTRACT_U_1(p + 1), length); + ND_PRINT("%02x %02x %u ", GET_U_1(p), + GET_U_1(p + 1), length); p += 2; length -= 2; hdrlen += 2; - proto = EXTRACT_BE_U_2(p); + proto = GET_BE_U_2(p); p += 2; length -= 2; hdrlen += 2; @@ -1738,8 +1741,8 @@ ppp_hdlc_if_print(netdissect_options *ndo, } if (ndo->ndo_eflag) - ND_PRINT("%02x %02x %u ", EXTRACT_U_1(p), - EXTRACT_U_1(p + 1), length); + ND_PRINT("%02x %02x %u ", GET_U_1(p), + GET_U_1(p + 1), length); p += 2; hdrlen += 2; @@ -1748,8 +1751,8 @@ ppp_hdlc_if_print(netdissect_options *ndo, * the next two octets as an Ethernet type; does that * ever happen? */ - ND_PRINT("unknown addr %02x; ctrl %02x", EXTRACT_U_1(p), - EXTRACT_U_1(p + 1)); + ND_PRINT("unknown addr %02x; ctrl %02x", GET_U_1(p), + GET_U_1(p + 1)); break; } @@ -1781,11 +1784,11 @@ ppp_bsdos_if_print(netdissect_options *ndo _U_, hdrlength = 0; #if 0 - if (EXTRACT_U_1(p) == PPP_ADDRESS && - EXTRACT_U_1(p + 1) == PPP_CONTROL) { + if (GET_U_1(p) == PPP_ADDRESS && + GET_U_1(p + 1) == PPP_CONTROL) { if (ndo->ndo_eflag) - ND_PRINT("%02x %02x ", EXTRACT_U_1(p), - EXTRACT_U_1(p + 1)); + ND_PRINT("%02x %02x ", GET_U_1(p), + GET_U_1(p + 1)); p += 2; hdrlength = 2; } @@ -1793,16 +1796,16 @@ ppp_bsdos_if_print(netdissect_options *ndo _U_, if (ndo->ndo_eflag) ND_PRINT("%u ", length); /* Retrieve the protocol type */ - if (EXTRACT_U_1(p) & 01) { + if (GET_U_1(p) & 01) { /* Compressed protocol field */ - ptype = EXTRACT_U_1(p); + ptype = GET_U_1(p); if (ndo->ndo_eflag) ND_PRINT("%02x ", ptype); p++; hdrlength += 1; } else { /* Un-compressed protocol field */ - ptype = EXTRACT_BE_U_2(p); + ptype = GET_BE_U_2(p); if (ndo->ndo_eflag) ND_PRINT("%04x ", ptype); p += 2; @@ -1811,8 +1814,8 @@ ppp_bsdos_if_print(netdissect_options *ndo _U_, #else ptype = 0; /*XXX*/ if (ndo->ndo_eflag) - ND_PRINT("%c ", EXTRACT_U_1(p + SLC_DIR) ? 'O' : 'I'); - llhl = EXTRACT_U_1(p + SLC_LLHL); + ND_PRINT("%c ", GET_U_1(p + SLC_DIR) ? 'O' : 'I'); + llhl = GET_U_1(p + SLC_LLHL); if (llhl) { /* link level header */ struct ppp_header *ph; @@ -1822,9 +1825,9 @@ ppp_bsdos_if_print(netdissect_options *ndo _U_, if (ph->phdr_addr == PPP_ADDRESS && ph->phdr_ctl == PPP_CONTROL) { if (ndo->ndo_eflag) - ND_PRINT("%02x %02x ", EXTRACT_U_1(q), - EXTRACT_U_1(q + 1)); - ptype = EXTRACT_BE_U_2(&ph->phdr_type); + ND_PRINT("%02x %02x ", GET_U_1(q), + GET_U_1(q + 1)); + ptype = GET_BE_U_2(&ph->phdr_type); if (ndo->ndo_eflag && (ptype == PPP_VJC || ptype == PPP_VJNC)) { ND_PRINT("%s ", tok2str(ppptype2str, "proto-#%u", ptype)); @@ -1833,14 +1836,14 @@ ppp_bsdos_if_print(netdissect_options *ndo _U_, if (ndo->ndo_eflag) { ND_PRINT("LLH=["); for (i = 0; i < llhl; i++) - ND_PRINT("%02x", EXTRACT_U_1(q + i)); + ND_PRINT("%02x", GET_U_1(q + i)); ND_PRINT("] "); } } } if (ndo->ndo_eflag) ND_PRINT("%u ", length); - if (EXTRACT_U_1(p + SLC_CHL)) { + if (GET_U_1(p + SLC_CHL)) { q = p + SLC_BPFHDRLEN + llhl; switch (ptype) { @@ -1883,7 +1886,7 @@ ppp_bsdos_if_print(netdissect_options *ndo _U_, ND_PRINT("CH=["); for (i = 0; i < llhl; i++) ND_PRINT("%02x", - EXTRACT_U_1(q + i)); + GET_U_1(q + i)); ND_PRINT("] "); } break; diff --git a/print-pppoe.c b/print-pppoe.c index 5e6dd526..e3d6e222 100644 --- a/print-pppoe.c +++ b/print-pppoe.c @@ -106,11 +106,11 @@ pppoe_print(netdissect_options *ndo, const u_char *bp, u_int length) length -= PPPOE_HDRLEN; pppoe_packet = bp; ND_TCHECK_LEN(pppoe_packet, PPPOE_HDRLEN); - pppoe_ver = (EXTRACT_U_1(pppoe_packet) & 0xF0) >> 4; - pppoe_type = (EXTRACT_U_1(pppoe_packet) & 0x0F); - pppoe_code = EXTRACT_U_1(pppoe_packet + 1); - pppoe_sessionid = EXTRACT_BE_U_2(pppoe_packet + 2); - pppoe_length = EXTRACT_BE_U_2(pppoe_packet + 4); + pppoe_ver = (GET_U_1(pppoe_packet) & 0xF0) >> 4; + pppoe_type = (GET_U_1(pppoe_packet) & 0x0F); + pppoe_code = GET_U_1(pppoe_packet + 1); + pppoe_sessionid = GET_BE_U_2(pppoe_packet + 2); + pppoe_length = GET_BE_U_2(pppoe_packet + 4); pppoe_payload = pppoe_packet + PPPOE_HDRLEN; if (pppoe_ver != 1) { @@ -144,8 +144,8 @@ pppoe_print(netdissect_options *ndo, const u_char *bp, u_int length) */ while (tag_type && p < pppoe_payload + pppoe_length) { ND_TCHECK_4(p); - tag_type = EXTRACT_BE_U_2(p); - tag_len = EXTRACT_BE_U_2(p + 2); + tag_type = GET_BE_U_2(p); + tag_len = GET_BE_U_2(p + 2); p += 4; /* p points to tag_value */ @@ -158,8 +158,8 @@ pppoe_print(netdissect_options *ndo, const u_char *bp, u_int length) /* TODO print UTF-8 decoded text */ ND_TCHECK_LEN(p, tag_len); for (v = p; v < p + tag_len && tag_str_len < MAXTAGPRINT-1; v++) - if (ND_ISPRINT(EXTRACT_U_1(v))) { - tag_str[tag_str_len++] = EXTRACT_U_1(v); + if (ND_ISPRINT(GET_U_1(v))) { + tag_str[tag_str_len++] = GET_U_1(v); ascii_count++; } else { tag_str[tag_str_len++] = '.'; @@ -177,7 +177,7 @@ pppoe_print(netdissect_options *ndo, const u_char *bp, u_int length) /* Print hex, not fast to abuse printf but this doesn't get used much */ ND_PRINT(" [%s 0x", tok2str(pppoetag2str, "TAG-0x%x", tag_type)); for (v=p; v<p+tag_len; v++) { - ND_PRINT("%02X", EXTRACT_U_1(v)); + ND_PRINT("%02X", GET_U_1(v)); } ND_PRINT("]"); } diff --git a/print-pptp.c b/print-pptp.c index 7bdc7d82..b2adc1d9 100644 --- a/print-pptp.c +++ b/print-pptp.c @@ -263,14 +263,14 @@ struct pptp_msg_sli { */ #define PRINT_RESERVED_IF_NOT_ZERO_1(reserved) \ - if (EXTRACT_U_1(reserved)) \ + if (GET_U_1(reserved)) \ ND_PRINT(" [ERROR: reserved=%u must be zero]", \ - EXTRACT_U_1(reserved)); + GET_U_1(reserved)); #define PRINT_RESERVED_IF_NOT_ZERO_2(reserved) \ - if (EXTRACT_BE_U_2(reserved)) \ + if (GET_BE_U_2(reserved)) \ ND_PRINT(" [ERROR: reserved=%u must be zero]", \ - EXTRACT_BE_U_2(reserved)); + GET_BE_U_2(reserved)); /******************************************/ /* Attribute-specific print out functions */ @@ -285,8 +285,8 @@ pptp_bearer_cap_print(netdissect_options *ndo, const nd_uint32_t *bearer_cap) { ND_PRINT(" BEARER_CAP(%s%s)", - EXTRACT_BE_U_4(*bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK ? "D" : "", - EXTRACT_BE_U_4(*bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK ? "A" : ""); + GET_BE_U_4(*bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK ? "D" : "", + GET_BE_U_4(*bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK ? "A" : ""); } static const struct tok pptp_btype_str[] = { @@ -301,35 +301,35 @@ pptp_bearer_type_print(netdissect_options *ndo, const nd_uint32_t *bearer_type) { ND_PRINT(" BEARER_TYPE(%s)", - tok2str(pptp_btype_str, "?", EXTRACT_BE_U_4(*bearer_type))); + tok2str(pptp_btype_str, "?", GET_BE_U_4(*bearer_type))); } static void pptp_call_id_print(netdissect_options *ndo, const nd_uint16_t *call_id) { - ND_PRINT(" CALL_ID(%u)", EXTRACT_BE_U_2(*call_id)); + ND_PRINT(" CALL_ID(%u)", GET_BE_U_2(*call_id)); } static void pptp_call_ser_print(netdissect_options *ndo, const nd_uint16_t *call_ser) { - ND_PRINT(" CALL_SER_NUM(%u)", EXTRACT_BE_U_2(*call_ser)); + ND_PRINT(" CALL_SER_NUM(%u)", GET_BE_U_2(*call_ser)); } static void pptp_cause_code_print(netdissect_options *ndo, const nd_uint16_t *cause_code) { - ND_PRINT(" CAUSE_CODE(%u)", EXTRACT_BE_U_2(*cause_code)); + ND_PRINT(" CAUSE_CODE(%u)", GET_BE_U_2(*cause_code)); } static void pptp_conn_speed_print(netdissect_options *ndo, const nd_uint32_t *conn_speed) { - ND_PRINT(" CONN_SPEED(%u)", EXTRACT_BE_U_4(*conn_speed)); + ND_PRINT(" CONN_SPEED(%u)", GET_BE_U_4(*conn_speed)); } static const struct tok pptp_errcode_str[] = { @@ -347,9 +347,10 @@ static void pptp_err_code_print(netdissect_options *ndo, const nd_uint8_t *err_code) { - ND_PRINT(" ERR_CODE(%u", EXTRACT_U_1(*err_code)); + ND_PRINT(" ERR_CODE(%u", GET_U_1(*err_code)); if (ndo->ndo_vflag) { - ND_PRINT(":%s", tok2str(pptp_errcode_str, "?", EXTRACT_U_1(*err_code))); + ND_PRINT(":%s", + tok2str(pptp_errcode_str, "?", GET_U_1(*err_code))); } ND_PRINT(")"); } @@ -358,7 +359,7 @@ static void pptp_firm_rev_print(netdissect_options *ndo, const nd_uint16_t *firm_rev) { - ND_PRINT(" FIRM_REV(%u)", EXTRACT_BE_U_2(*firm_rev)); + ND_PRINT(" FIRM_REV(%u)", GET_BE_U_2(*firm_rev)); } static void @@ -366,10 +367,10 @@ pptp_framing_cap_print(netdissect_options *ndo, const nd_uint32_t *framing_cap) { ND_PRINT(" FRAME_CAP("); - if (EXTRACT_BE_U_4(*framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) { + if (GET_BE_U_4(*framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) { ND_PRINT("A"); /* Async */ } - if (EXTRACT_BE_U_4(*framing_cap) & PPTP_FRAMING_CAP_SYNC_MASK) { + if (GET_BE_U_4(*framing_cap) & PPTP_FRAMING_CAP_SYNC_MASK) { ND_PRINT("S"); /* Sync */ } ND_PRINT(")"); @@ -387,7 +388,7 @@ pptp_framing_type_print(netdissect_options *ndo, const nd_uint32_t *framing_type) { ND_PRINT(" FRAME_TYPE(%s)", - tok2str(pptp_ftype_str, "?", EXTRACT_BE_U_4(*framing_type))); + tok2str(pptp_ftype_str, "?", GET_BE_U_4(*framing_type))); } static void @@ -401,35 +402,35 @@ static void pptp_id_print(netdissect_options *ndo, const nd_uint32_t *id) { - ND_PRINT(" ID(%u)", EXTRACT_BE_U_4(*id)); + ND_PRINT(" ID(%u)", GET_BE_U_4(*id)); } static void pptp_max_channel_print(netdissect_options *ndo, const nd_uint16_t *max_channel) { - ND_PRINT(" MAX_CHAN(%u)", EXTRACT_BE_U_2(*max_channel)); + ND_PRINT(" MAX_CHAN(%u)", GET_BE_U_2(*max_channel)); } static void pptp_peer_call_id_print(netdissect_options *ndo, const nd_uint16_t *peer_call_id) { - ND_PRINT(" PEER_CALL_ID(%u)", EXTRACT_BE_U_2(*peer_call_id)); + ND_PRINT(" PEER_CALL_ID(%u)", GET_BE_U_2(*peer_call_id)); } static void pptp_phy_chan_id_print(netdissect_options *ndo, const nd_uint32_t *phy_chan_id) { - ND_PRINT(" PHY_CHAN_ID(%u)", EXTRACT_BE_U_4(*phy_chan_id)); + ND_PRINT(" PHY_CHAN_ID(%u)", GET_BE_U_4(*phy_chan_id)); } static void pptp_pkt_proc_delay_print(netdissect_options *ndo, const nd_uint16_t *pkt_proc_delay) { - ND_PRINT(" PROC_DELAY(%u)", EXTRACT_BE_U_2(*pkt_proc_delay)); + ND_PRINT(" PROC_DELAY(%u)", GET_BE_U_2(*pkt_proc_delay)); } static void @@ -437,15 +438,15 @@ pptp_proto_ver_print(netdissect_options *ndo, const nd_uint16_t *proto_ver) { ND_PRINT(" PROTO_VER(%u.%u)", /* Version.Revision */ - EXTRACT_BE_U_2(*proto_ver) >> 8, - EXTRACT_BE_U_2(*proto_ver) & 0xff); + GET_BE_U_2(*proto_ver) >> 8, + GET_BE_U_2(*proto_ver) & 0xff); } static void pptp_recv_winsiz_print(netdissect_options *ndo, const nd_uint16_t *recv_winsiz) { - ND_PRINT(" RECV_WIN(%u)", EXTRACT_BE_U_2(*recv_winsiz)); + ND_PRINT(" RECV_WIN(%u)", GET_BE_U_2(*recv_winsiz)); } static const struct tok pptp_scrrp_str[] = { @@ -493,7 +494,7 @@ static void pptp_result_code_print(netdissect_options *ndo, const nd_uint8_t *result_code, int ctrl_msg_type) { - ND_PRINT(" RESULT_CODE(%u", EXTRACT_U_1(*result_code)); + ND_PRINT(" RESULT_CODE(%u", GET_U_1(*result_code)); if (ndo->ndo_vflag) { const struct tok *dict = ctrl_msg_type == PPTP_CTRL_MSG_TYPE_SCCRP ? pptp_scrrp_str : @@ -504,7 +505,8 @@ 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(":%s", tok2str(dict, "?", EXTRACT_U_1(*result_code))); + ND_PRINT(":%s", + tok2str(dict, "?", GET_U_1(*result_code))); } ND_PRINT(")"); } @@ -593,9 +595,9 @@ pptp_stopccrq_print(netdissect_options *ndo, const struct pptp_msg_stopccrq *ptr = (const struct pptp_msg_stopccrq *)dat; ND_TCHECK_1(ptr->reason); - ND_PRINT(" REASON(%u", EXTRACT_U_1(ptr->reason)); + ND_PRINT(" REASON(%u", GET_U_1(ptr->reason)); if (ndo->ndo_vflag) { - switch (EXTRACT_U_1(ptr->reason)) { + switch (GET_U_1(ptr->reason)) { case 1: ND_PRINT(":None"); break; @@ -688,9 +690,9 @@ pptp_ocrq_print(netdissect_options *ndo, ND_TCHECK_2(ptr->call_ser); pptp_call_ser_print(ndo, &ptr->call_ser); ND_TCHECK_4(ptr->min_bps); - ND_PRINT(" MIN_BPS(%u)", EXTRACT_BE_U_4(ptr->min_bps)); + ND_PRINT(" MIN_BPS(%u)", GET_BE_U_4(ptr->min_bps)); ND_TCHECK_4(ptr->max_bps); - ND_PRINT(" MAX_BPS(%u)", EXTRACT_BE_U_4(ptr->max_bps)); + ND_PRINT(" MAX_BPS(%u)", GET_BE_U_4(ptr->max_bps)); ND_TCHECK_4(ptr->bearer_type); pptp_bearer_type_print(ndo, &ptr->bearer_type); ND_TCHECK_4(ptr->framing_type); @@ -700,7 +702,7 @@ pptp_ocrq_print(netdissect_options *ndo, ND_TCHECK_2(ptr->pkt_proc_delay); pptp_pkt_proc_delay_print(ndo, &ptr->pkt_proc_delay); ND_TCHECK_2(ptr->phone_no_len); - ND_PRINT(" PHONE_NO_LEN(%u)", EXTRACT_BE_U_2(ptr->phone_no_len)); + ND_PRINT(" PHONE_NO_LEN(%u)", GET_BE_U_2(ptr->phone_no_len)); ND_TCHECK_2(ptr->reserved1); PRINT_RESERVED_IF_NOT_ZERO_2(ptr->reserved1); ND_TCHECK_SIZE(&ptr->phone_no); @@ -760,9 +762,9 @@ pptp_icrq_print(netdissect_options *ndo, ND_TCHECK_4(ptr->phy_chan_id); pptp_phy_chan_id_print(ndo, &ptr->phy_chan_id); ND_TCHECK_2(ptr->dialed_no_len); - ND_PRINT(" DIALED_NO_LEN(%u)", EXTRACT_BE_U_2(ptr->dialed_no_len)); + ND_PRINT(" DIALED_NO_LEN(%u)", GET_BE_U_2(ptr->dialed_no_len)); ND_TCHECK_2(ptr->dialing_no_len); - ND_PRINT(" DIALING_NO_LEN(%u)", EXTRACT_BE_U_2(ptr->dialing_no_len)); + ND_PRINT(" DIALING_NO_LEN(%u)", GET_BE_U_2(ptr->dialing_no_len)); ND_TCHECK_SIZE(&ptr->dialed_no); ND_PRINT(" DIALED_NO(%.64s)", ptr->dialed_no); ND_TCHECK_SIZE(&ptr->dialing_no); @@ -881,17 +883,17 @@ pptp_wen_print(netdissect_options *ndo, ND_TCHECK_2(ptr->reserved1); PRINT_RESERVED_IF_NOT_ZERO_2(ptr->reserved1); ND_TCHECK_4(ptr->crc_err); - ND_PRINT(" CRC_ERR(%u)", EXTRACT_BE_U_4(ptr->crc_err)); + ND_PRINT(" CRC_ERR(%u)", GET_BE_U_4(ptr->crc_err)); ND_TCHECK_4(ptr->framing_err); - ND_PRINT(" FRAMING_ERR(%u)", EXTRACT_BE_U_4(ptr->framing_err)); + ND_PRINT(" FRAMING_ERR(%u)", GET_BE_U_4(ptr->framing_err)); ND_TCHECK_4(ptr->hardware_overrun); - ND_PRINT(" HARDWARE_OVERRUN(%u)", EXTRACT_BE_U_4(ptr->hardware_overrun)); + ND_PRINT(" HARDWARE_OVERRUN(%u)", GET_BE_U_4(ptr->hardware_overrun)); ND_TCHECK_4(ptr->buffer_overrun); - ND_PRINT(" BUFFER_OVERRUN(%u)", EXTRACT_BE_U_4(ptr->buffer_overrun)); + ND_PRINT(" BUFFER_OVERRUN(%u)", GET_BE_U_4(ptr->buffer_overrun)); ND_TCHECK_4(ptr->timeout_err); - ND_PRINT(" TIMEOUT_ERR(%u)", EXTRACT_BE_U_4(ptr->timeout_err)); + ND_PRINT(" TIMEOUT_ERR(%u)", GET_BE_U_4(ptr->timeout_err)); ND_TCHECK_4(ptr->align_err); - ND_PRINT(" ALIGN_ERR(%u)", EXTRACT_BE_U_4(ptr->align_err)); + ND_PRINT(" ALIGN_ERR(%u)", GET_BE_U_4(ptr->align_err)); return; @@ -910,9 +912,9 @@ pptp_sli_print(netdissect_options *ndo, ND_TCHECK_2(ptr->reserved1); PRINT_RESERVED_IF_NOT_ZERO_2(ptr->reserved1); ND_TCHECK_4(ptr->send_accm); - ND_PRINT(" SEND_ACCM(0x%08x)", EXTRACT_BE_U_4(ptr->send_accm)); + ND_PRINT(" SEND_ACCM(0x%08x)", GET_BE_U_4(ptr->send_accm)); ND_TCHECK_4(ptr->recv_accm); - ND_PRINT(" RECV_ACCM(0x%08x)", EXTRACT_BE_U_4(ptr->recv_accm)); + ND_PRINT(" RECV_ACCM(0x%08x)", GET_BE_U_4(ptr->recv_accm)); return; @@ -935,11 +937,11 @@ pptp_print(netdissect_options *ndo, ND_TCHECK_2(hdr->length); if (ndo->ndo_vflag) { - ND_PRINT(" Length=%u", EXTRACT_BE_U_2(hdr->length)); + ND_PRINT(" Length=%u", GET_BE_U_2(hdr->length)); } ND_TCHECK_2(hdr->msg_type); if (ndo->ndo_vflag) { - switch(EXTRACT_BE_U_2(hdr->msg_type)) { + switch(GET_BE_U_2(hdr->msg_type)) { case PPTP_MSG_TYPE_CTRL: ND_PRINT(" CTRL-MSG"); break; @@ -953,7 +955,7 @@ pptp_print(netdissect_options *ndo, } ND_TCHECK_4(hdr->magic_cookie); - mc = EXTRACT_BE_U_4(hdr->magic_cookie); + mc = GET_BE_U_4(hdr->magic_cookie); if (mc != PPTP_MAGIC_COOKIE) { ND_PRINT(" UNEXPECTED Magic-Cookie!!(%08x)", mc); } @@ -961,7 +963,7 @@ pptp_print(netdissect_options *ndo, ND_PRINT(" Magic-Cookie=%08x", mc); } ND_TCHECK_2(hdr->ctrl_msg_type); - ctrl_msg_type = EXTRACT_BE_U_2(hdr->ctrl_msg_type); + ctrl_msg_type = GET_BE_U_2(hdr->ctrl_msg_type); if (ctrl_msg_type < PPTP_MAX_MSGTYPE_INDEX) { ND_PRINT(" CTRL_MSGTYPE=%s", pptp_message_type_string[ctrl_msg_type]); diff --git a/print-radius.c b/print-radius.c index c723fd5a..f2e6bab7 100644 --- a/print-radius.c +++ b/print-radius.c @@ -634,13 +634,13 @@ print_attr_string(netdissect_options *ndo, case TUNNEL_PASS: if (length < 3) goto trunc; - if (EXTRACT_U_1(data) && (EXTRACT_U_1(data) <= 0x1F)) - ND_PRINT("Tag[%u] ", EXTRACT_U_1(data)); + if (GET_U_1(data) && (GET_U_1(data) <= 0x1F)) + ND_PRINT("Tag[%u] ", GET_U_1(data)); else ND_PRINT("Tag[Unused] "); data++; length--; - ND_PRINT("Salt %u ", EXTRACT_BE_U_2(data)); + ND_PRINT("Salt %u ", GET_BE_U_2(data)); data+=2; length-=2; break; @@ -650,12 +650,12 @@ print_attr_string(netdissect_options *ndo, case TUNNEL_ASSIGN_ID: case TUNNEL_CLIENT_AUTH: case TUNNEL_SERVER_AUTH: - if (EXTRACT_U_1(data) <= 0x1F) + if (GET_U_1(data) <= 0x1F) { if (length < 1) goto trunc; - if (EXTRACT_U_1(data)) - ND_PRINT("Tag[%u] ", EXTRACT_U_1(data)); + if (GET_U_1(data)) + ND_PRINT("Tag[%u] ", GET_U_1(data)); else ND_PRINT("Tag[Unused] "); data++; @@ -666,15 +666,15 @@ print_attr_string(netdissect_options *ndo, if (length < 1) goto trunc; ND_PRINT("%s (0x%02x) ", - tok2str(rfc4675_tagged,"Unknown tag",EXTRACT_U_1(data)), - EXTRACT_U_1(data)); + tok2str(rfc4675_tagged,"Unknown tag",GET_U_1(data)), + GET_U_1(data)); data++; length--; break; } - for (i=0; i < length && EXTRACT_U_1(data); i++, data++) - ND_PRINT("%c", ND_ISPRINT(EXTRACT_U_1(data)) ? EXTRACT_U_1(data) : '.'); + for (i=0; i < length && GET_U_1(data); i++, data++) + ND_PRINT("%c", ND_ISPRINT(GET_U_1(data)) ? GET_U_1(data) : '.'); return; @@ -697,7 +697,7 @@ print_vendor_attr(netdissect_options *ndo, if (length < 4) goto trunc; ND_TCHECK_4(data); - vendor_id = EXTRACT_BE_U_4(data); + vendor_id = GET_BE_U_4(data); data+=4; length-=4; @@ -708,8 +708,8 @@ print_vendor_attr(netdissect_options *ndo, while (length >= 2) { ND_TCHECK_2(data); - vendor_type = EXTRACT_U_1(data); - vendor_length = EXTRACT_U_1(data + 1); + vendor_type = GET_U_1(data); + vendor_length = GET_U_1(data + 1); if (vendor_length < 2) { @@ -734,7 +734,7 @@ print_vendor_attr(netdissect_options *ndo, vendor_type, vendor_length); for (idx = 0; idx < vendor_length ; idx++, data++) - ND_PRINT("%c", ND_ISPRINT(EXTRACT_U_1(data)) ? EXTRACT_U_1(data) : '.'); + ND_PRINT("%c", ND_ISPRINT(GET_U_1(data)) ? GET_U_1(data) : '.'); length-=vendor_length; } return; @@ -772,16 +772,16 @@ print_attr_num(netdissect_options *ndo, if ( (attr_code == TUNNEL_TYPE) || (attr_code == TUNNEL_MEDIUM) ) { - if (!EXTRACT_U_1(data)) + if (!GET_U_1(data)) ND_PRINT("Tag[Unused] "); else - ND_PRINT("Tag[%u] ", EXTRACT_U_1(data)); + ND_PRINT("Tag[%u] ", GET_U_1(data)); data++; - data_value = EXTRACT_BE_U_3(data); + data_value = GET_BE_U_3(data); } else { - data_value = EXTRACT_BE_U_4(data); + data_value = GET_BE_U_4(data); } if ( data_value <= (uint32_t)(attr_type[attr_code].siz_subtypes - 1 + attr_type[attr_code].first_subtype) && @@ -795,10 +795,10 @@ print_attr_num(netdissect_options *ndo, switch(attr_code) /* Be aware of special cases... */ { case FRM_IPX: - if (EXTRACT_BE_U_4(data) == 0xFFFFFFFE ) + if (GET_BE_U_4(data) == 0xFFFFFFFE ) ND_PRINT("NAS Select"); else - ND_PRINT("%u", EXTRACT_BE_U_4(data)); + ND_PRINT("%u", GET_BE_U_4(data)); break; case SESSION_TIMEOUT: @@ -806,7 +806,7 @@ print_attr_num(netdissect_options *ndo, case ACCT_DELAY: case ACCT_SESSION_TIME: case ACCT_INT_INTERVAL: - timeout = EXTRACT_BE_U_4(data); + timeout = GET_BE_U_4(data); if ( timeout < 60 ) ND_PRINT("%02d secs", timeout); else @@ -822,38 +822,38 @@ print_attr_num(netdissect_options *ndo, break; case FRM_ATALK_LINK: - if (EXTRACT_BE_U_4(data)) - ND_PRINT("%u", EXTRACT_BE_U_4(data)); + if (GET_BE_U_4(data)) + ND_PRINT("%u", GET_BE_U_4(data)); else ND_PRINT("Unnumbered"); break; case FRM_ATALK_NETWORK: - if (EXTRACT_BE_U_4(data)) - ND_PRINT("%u", EXTRACT_BE_U_4(data)); + if (GET_BE_U_4(data)) + ND_PRINT("%u", GET_BE_U_4(data)); else ND_PRINT("NAS assigned"); break; case TUNNEL_PREFERENCE: - if (EXTRACT_U_1(data)) - ND_PRINT("Tag[%u] ", EXTRACT_U_1(data)); + if (GET_U_1(data)) + ND_PRINT("Tag[%u] ", GET_U_1(data)); else ND_PRINT("Tag[Unused] "); data++; - ND_PRINT("%u", EXTRACT_BE_U_3(data)); + ND_PRINT("%u", GET_BE_U_3(data)); break; case EGRESS_VLAN_ID: ND_PRINT("%s (0x%02x) ", - tok2str(rfc4675_tagged,"Unknown tag",EXTRACT_U_1(data)), - EXTRACT_U_1(data)); + tok2str(rfc4675_tagged,"Unknown tag",GET_U_1(data)), + GET_U_1(data)); data++; - ND_PRINT("%u", EXTRACT_BE_U_3(data)); + ND_PRINT("%u", GET_BE_U_3(data)); break; default: - ND_PRINT("%u", EXTRACT_BE_U_4(data)); + ND_PRINT("%u", GET_BE_U_4(data)); break; } /* switch */ @@ -889,10 +889,10 @@ print_attr_address(netdissect_options *ndo, { case FRM_IPADDR: case LOG_IPHOST: - if (EXTRACT_BE_U_4(data) == 0xFFFFFFFF ) + if (GET_BE_U_4(data) == 0xFFFFFFFF ) ND_PRINT("User Selected"); else - if (EXTRACT_BE_U_4(data) == 0xFFFFFFFE ) + if (GET_BE_U_4(data) == 0xFFFFFFFE ) ND_PRINT("NAS Select"); else ND_PRINT("%s",ipaddr_string(ndo, data)); @@ -948,9 +948,9 @@ print_attr_netmask6(netdissect_options *ndo, return; } ND_TCHECK_LEN(data, length); - if (EXTRACT_U_1(data + 1) > 128) + if (GET_U_1(data + 1) > 128) { - ND_PRINT("ERROR: netmask %u not in range (0..128)", EXTRACT_U_1(data + 1)); + ND_PRINT("ERROR: netmask %u not in range (0..128)", GET_U_1(data + 1)); return; } @@ -958,9 +958,9 @@ print_attr_netmask6(netdissect_options *ndo, if (length > 2) memcpy(data2, data+2, length-2); - ND_PRINT("%s/%u", ip6addr_string(ndo, data2), EXTRACT_U_1(data + 1)); + ND_PRINT("%s/%u", ip6addr_string(ndo, data2), GET_U_1(data + 1)); - if (EXTRACT_U_1(data + 1) > 8 * (length - 2)) + if (GET_U_1(data + 1) > 8 * (length - 2)) ND_PRINT(" (inconsistent prefix length)"); return; @@ -979,13 +979,13 @@ print_attr_mip6_home_link_prefix(netdissect_options *ndo, return; } ND_TCHECK_LEN(data, length); - if (EXTRACT_U_1(data) > 128) + if (GET_U_1(data) > 128) { - ND_PRINT("ERROR: netmask %u not in range (0..128)", EXTRACT_U_1(data)); + ND_PRINT("ERROR: netmask %u not in range (0..128)", GET_U_1(data)); return; } - ND_PRINT("%s/%u", ip6addr_string(ndo, data + 1), EXTRACT_U_1(data)); + ND_PRINT("%s/%u", ip6addr_string(ndo, data + 1), GET_U_1(data)); return; @@ -1016,7 +1016,7 @@ print_attr_time(netdissect_options *ndo, ND_TCHECK_4(data); - attr_time = EXTRACT_BE_U_4(data); + attr_time = GET_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_vector64(netdissect_options *ndo, ND_PRINT("["); ND_TCHECK_8(data[0]); - data_value = EXTRACT_BE_U_8(data); + data_value = GET_BE_U_8(data); /* Print the 64-bit field in a format similar to bittok2str(), less * flagging any unknown bits. This way it should be easier to replace * the custom code with a library function later. @@ -1103,13 +1103,13 @@ print_attr_strange(netdissect_options *ndo, return; } ND_TCHECK_1(data); - if (EXTRACT_U_1(data)) + if (GET_U_1(data)) ND_PRINT("User can change password"); else ND_PRINT("User cannot change password"); data++; ND_TCHECK_1(data); - ND_PRINT(", Min password length: %u", EXTRACT_U_1(data)); + ND_PRINT(", Min password length: %u", GET_U_1(data)); data++; ND_PRINT(", created at: "); ND_TCHECK_4(data); @@ -1144,7 +1144,7 @@ print_attr_strange(netdissect_options *ndo, } ND_TCHECK_4(data); - error_cause_value = EXTRACT_BE_U_4(data); + error_cause_value = GET_BE_U_4(data); ND_PRINT("Error cause %u: %s", error_cause_value, tok2str(errorcausetype, "Error-Cause %u not known", error_cause_value)); break; } @@ -1168,8 +1168,8 @@ radius_attrs_print(netdissect_options *ndo, goto trunc; ND_TCHECK_SIZE(rad_attr); - type = EXTRACT_U_1(rad_attr->type); - len = EXTRACT_U_1(rad_attr->len); + type = GET_U_1(rad_attr->type); + len = GET_U_1(rad_attr->len); if (type != 0 && type < TAM_SIZE(attr_type)) attr_string = attr_type[type].name; else @@ -1224,7 +1224,7 @@ radius_print(netdissect_options *ndo, ndo->ndo_protocol = "radius"; ND_TCHECK_LEN(dat, MIN_RADIUS_LEN); rad = (const struct radius_hdr *)dat; - len = EXTRACT_BE_U_2(rad->len); + len = GET_BE_U_2(rad->len); if (len < MIN_RADIUS_LEN) { @@ -1237,18 +1237,18 @@ radius_print(netdissect_options *ndo, if (ndo->ndo_vflag < 1) { ND_PRINT("RADIUS, %s (%u), id: 0x%02x length: %u", - tok2str(radius_command_values,"Unknown Command",EXTRACT_U_1(rad->code)), - EXTRACT_U_1(rad->code), - EXTRACT_U_1(rad->id), + tok2str(radius_command_values,"Unknown Command",GET_U_1(rad->code)), + GET_U_1(rad->code), + GET_U_1(rad->id), len); return; } else { ND_PRINT("RADIUS, length: %u\n\t%s (%u), id: 0x%02x, Authenticator: ", len, - tok2str(radius_command_values,"Unknown Command",EXTRACT_U_1(rad->code)), - EXTRACT_U_1(rad->code), - EXTRACT_U_1(rad->id)); + tok2str(radius_command_values,"Unknown Command",GET_U_1(rad->code)), + GET_U_1(rad->code), + GET_U_1(rad->id)); for(auth_idx=0; auth_idx < 16; auth_idx++) ND_PRINT("%02x", rad->auth[auth_idx]); diff --git a/print-resp.c b/print-resp.c index 6529c745..beeec1ce 100644 --- a/print-resp.c +++ b/print-resp.c @@ -248,7 +248,7 @@ resp_parse(netdissect_options *ndo, const u_char *bp, int length) LCHECK2(length, 1); ND_TCHECK_1(bp); - op = EXTRACT_U_1(bp); + op = GET_U_1(bp); /* bp now points to the op, so these routines must skip it */ switch(op) { @@ -467,7 +467,7 @@ resp_get_length(netdissect_options *ndo, const u_char *bp, int len, const u_char ND_TCHECK_1(bp); too_large = 0; neg = 0; - if (EXTRACT_U_1(bp) == '-') { + if (GET_U_1(bp) == '-') { neg = 1; bp++; len--; @@ -479,7 +479,7 @@ resp_get_length(netdissect_options *ndo, const u_char *bp, int len, const u_char if (len == 0) goto trunc; ND_TCHECK_1(bp); - c = EXTRACT_U_1(bp); + c = GET_U_1(bp); if (!(c >= '0' && c <= '9')) { if (!saw_digit) { bp++; @@ -508,7 +508,7 @@ resp_get_length(netdissect_options *ndo, const u_char *bp, int len, const u_char * OK, we found a non-digit character. It should be a \r, followed * by a \n. */ - if (EXTRACT_U_1(bp) != '\r') { + if (GET_U_1(bp) != '\r') { bp++; goto invalid; } @@ -517,7 +517,7 @@ resp_get_length(netdissect_options *ndo, const u_char *bp, int len, const u_char if (len == 0) goto trunc; ND_TCHECK_1(bp); - if (EXTRACT_U_1(bp) != '\n') { + if (GET_U_1(bp) != '\n') { bp++; goto invalid; } diff --git a/print-rip.c b/print-rip.c index 47f0ac7c..c8d17c3e 100644 --- a/print-rip.c +++ b/print-rip.c @@ -190,15 +190,15 @@ rip_entry_print_v1(netdissect_options *ndo, const u_char *p, if (remaining < RIP_ROUTELEN) return (0); ND_TCHECK_SIZE(ni); - family = EXTRACT_BE_U_2(ni->rip_family); + family = GET_BE_U_2(ni->rip_family); if (family != BSD_AFNUM_INET && family != 0) { ND_PRINT("\n\t AFI %s, ", tok2str(bsd_af_values, "Unknown (%u)", family)); print_unknown_data(ndo, p + sizeof(*eh), "\n\t ", RIP_ROUTELEN - sizeof(*eh)); return (RIP_ROUTELEN); } - if (EXTRACT_BE_U_2(ni->rip_mbz1) || - EXTRACT_BE_U_4(ni->rip_mbz2) || - EXTRACT_BE_U_4(ni->rip_mbz3)) { + if (GET_BE_U_2(ni->rip_mbz1) || + GET_BE_U_4(ni->rip_mbz2) || + GET_BE_U_4(ni->rip_mbz3)) { /* MBZ fields not zero */ print_unknown_data(ndo, p, "\n\t ", RIP_ROUTELEN); return (RIP_ROUTELEN); @@ -206,12 +206,12 @@ rip_entry_print_v1(netdissect_options *ndo, const u_char *p, if (family == 0) { ND_PRINT("\n\t AFI 0, %s, metric: %u", ipaddr_string(ndo, ni->rip_dest), - EXTRACT_BE_U_4(ni->rip_metric)); + GET_BE_U_4(ni->rip_metric)); return (RIP_ROUTELEN); } /* BSD_AFNUM_INET */ ND_PRINT("\n\t %s, metric: %u", ipaddr_string(ndo, ni->rip_dest), - EXTRACT_BE_U_4(ni->rip_metric)); + GET_BE_U_4(ni->rip_metric)); return (RIP_ROUTELEN); trunc: return 0; @@ -228,9 +228,9 @@ rip_entry_print_v2(netdissect_options *ndo, const u_char *p, if (remaining < sizeof(*eh)) return (0); ND_TCHECK_SIZE(eh); - family = EXTRACT_BE_U_2(eh->rip_family); + family = GET_BE_U_2(eh->rip_family); if (family == 0xFFFF) { /* variable-sized authentication structures */ - uint16_t auth_type = EXTRACT_BE_U_2(eh->rip_tag); + uint16_t auth_type = GET_BE_U_2(eh->rip_tag); p += sizeof(*eh); remaining -= sizeof(*eh); @@ -246,12 +246,14 @@ rip_entry_print_v2(netdissect_options *ndo, const u_char *p, if (remaining < sizeof(*ch)) return (0); ND_PRINT("\n\t Auth header:"); - ND_PRINT(" Packet Len %u,", EXTRACT_BE_U_2(ch->rip_packet_len)); - ND_PRINT(" Key-ID %u,", EXTRACT_U_1(ch->rip_key_id)); - ND_PRINT(" Auth Data Len %u,", EXTRACT_U_1(ch->rip_auth_data_len)); - ND_PRINT(" SeqNo %u,", EXTRACT_BE_U_4(ch->rip_seq_num)); - ND_PRINT(" MBZ %u,", EXTRACT_BE_U_4(ch->rip_mbz1)); - ND_PRINT(" MBZ %u", EXTRACT_BE_U_4(ch->rip_mbz2)); + ND_PRINT(" Packet Len %u,", + GET_BE_U_2(ch->rip_packet_len)); + ND_PRINT(" Key-ID %u,", GET_U_1(ch->rip_key_id)); + ND_PRINT(" Auth Data Len %u,", + GET_U_1(ch->rip_auth_data_len)); + ND_PRINT(" SeqNo %u,", GET_BE_U_4(ch->rip_seq_num)); + ND_PRINT(" MBZ %u,", GET_BE_U_4(ch->rip_mbz1)); + ND_PRINT(" MBZ %u", GET_BE_U_4(ch->rip_mbz2)); } else if (auth_type == 1) { ND_PRINT("\n\t Auth trailer:"); print_unknown_data(ndo, p, "\n\t ", remaining); @@ -273,10 +275,10 @@ rip_entry_print_v2(netdissect_options *ndo, const u_char *p, ND_PRINT("\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_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)) + mask2plen(GET_BE_U_4(ni->rip_dest_mask)), + GET_BE_U_2(ni->rip_tag), + GET_BE_U_4(ni->rip_metric)); + if (GET_BE_U_4(ni->rip_router)) ND_PRINT("%s", ipaddr_string(ndo, ni->rip_router)); else ND_PRINT("self"); @@ -313,7 +315,7 @@ rip_print(netdissect_options *ndo, rp = (const struct rip *)dat; ND_TCHECK_SIZE(rp); - vers = EXTRACT_U_1(rp->rip_vers); + vers = GET_U_1(rp->rip_vers); ND_PRINT("%sRIPv%u", (ndo->ndo_vflag >= 1) ? "\n\t" : "", vers); @@ -335,7 +337,7 @@ rip_print(netdissect_options *ndo, } /* dump version and lets see if we know the commands name*/ - cmd = EXTRACT_U_1(rp->rip_cmd); + cmd = GET_U_1(rp->rip_cmd); ND_PRINT(", %s, length: %u", tok2str(rip_cmd_values, "unknown command (%u)", cmd), length); diff --git a/print-ripng.c b/print-ripng.c index 15a9aff7..3cfcff57 100644 --- a/print-ripng.c +++ b/print-ripng.c @@ -98,8 +98,8 @@ rip6_entry_print(netdissect_options *ndo, const struct netinfo6 *ni, u_int metri uint16_t tag; l = ND_PRINT("%s/%u", ip6addr_string(ndo, ni->rip6_dest), - EXTRACT_U_1(ni->rip6_plen)); - tag = EXTRACT_BE_U_2(ni->rip6_tag); + GET_U_1(ni->rip6_plen)); + tag = GET_BE_U_2(ni->rip6_tag); if (tag) l += ND_PRINT(" [%u]", tag); if (metric) @@ -118,7 +118,7 @@ ripng_print(netdissect_options *ndo, const u_char *dat, unsigned int length) ndo->ndo_protocol = "ripng"; ND_TCHECK_1(rp->rip6_cmd); - cmd = EXTRACT_U_1(rp->rip6_cmd); + cmd = GET_U_1(rp->rip6_cmd); switch (cmd) { case RIP6_REQUEST: @@ -129,7 +129,7 @@ ripng_print(netdissect_options *ndo, const u_char *dat, unsigned int length) j = length_left / sizeof(*ni); if (j == 1) { ND_TCHECK_SIZE(rp->rip6_nets); - if (EXTRACT_U_1(rp->rip6_nets->rip6_metric) == HOPCNT_INFINITY6 + if (GET_U_1(rp->rip6_nets->rip6_metric) == HOPCNT_INFINITY6 && ND_IN6_IS_ADDR_UNSPECIFIED(&rp->rip6_nets->rip6_dest)) { ND_PRINT(" ripng-req dump"); break; @@ -168,7 +168,7 @@ ripng_print(netdissect_options *ndo, const u_char *dat, unsigned int length) ND_PRINT("\n\t"); else ND_PRINT(" "); - rip6_entry_print(ndo, ni, EXTRACT_U_1(ni->rip6_metric)); + rip6_entry_print(ndo, ni, GET_U_1(ni->rip6_metric)); } if (length_left != 0) goto trunc; @@ -178,8 +178,8 @@ ripng_print(netdissect_options *ndo, const u_char *dat, unsigned int length) break; } ND_TCHECK_1(rp->rip6_vers); - if (EXTRACT_U_1(rp->rip6_vers) != RIP6_VERSION) - ND_PRINT(" [vers %u]", EXTRACT_U_1(rp->rip6_vers)); + if (GET_U_1(rp->rip6_vers) != RIP6_VERSION) + ND_PRINT(" [vers %u]", GET_U_1(rp->rip6_vers)); return; trunc: diff --git a/print-rpki-rtr.c b/print-rpki-rtr.c index a354ebeb..7f26bf91 100644 --- a/print-rpki-rtr.c +++ b/print-rpki-rtr.c @@ -182,14 +182,14 @@ rpki_rtr_pdu_print(netdissect_options *ndo, const u_char *tptr, const u_int len, /* Protocol Version */ ND_TCHECK_1(tptr); - if (EXTRACT_U_1(tptr) != 0) { + if (GET_U_1(tptr) != 0) { /* Skip the rest of the input buffer because even if this is * a well-formed PDU of a future RPKI-Router protocol version * followed by a well-formed PDU of RPKI-Router protocol * version 0, there is no way to know exactly how to skip the * current PDU. */ - ND_PRINT("%sRPKI-RTRv%u (unknown)", indent_string(8), EXTRACT_U_1(tptr)); + ND_PRINT("%sRPKI-RTRv%u (unknown)", indent_string(8), GET_U_1(tptr)); return len; } if (len < sizeof(rpki_rtr_pdu)) { @@ -199,7 +199,7 @@ rpki_rtr_pdu_print(netdissect_options *ndo, const u_char *tptr, const u_int len, ND_TCHECK_LEN(tptr, sizeof(rpki_rtr_pdu)); pdu_header = (const rpki_rtr_pdu *)tptr; pdu_type = pdu_header->pdu_type; - pdu_len = EXTRACT_BE_U_4(pdu_header->length); + pdu_len = GET_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. @@ -228,8 +228,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("%sSession ID: 0x%04x, Serial: %u", indent_string(indent+2), - EXTRACT_BE_U_2(pdu_header->u.session_id), - EXTRACT_BE_U_4(msg)); + GET_BE_U_2(pdu_header->u.session_id), + GET_BE_U_4(msg)); break; /* @@ -252,7 +252,7 @@ rpki_rtr_pdu_print(netdissect_options *ndo, const u_char *tptr, const u_int len, /* no additional boundary to check */ ND_PRINT("%sSession ID: 0x%04x", indent_string(indent+2), - EXTRACT_BE_U_2(pdu_header->u.session_id)); + GET_BE_U_2(pdu_header->u.session_id)); break; case RPKI_RTR_IPV4_PREFIX_PDU: @@ -267,7 +267,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_U_4(pdu->as), pdu->flags); + GET_BE_U_4(pdu->as), pdu->flags); } break; @@ -283,7 +283,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_U_4(pdu->as), pdu->flags); + GET_BE_U_4(pdu->as), pdu->flags); } break; @@ -301,10 +301,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_U_4(pdu->encapsulated_pdu_length); + encapsulated_pdu_length = GET_BE_U_4(pdu->encapsulated_pdu_length); tlen += 4; - error_code = EXTRACT_BE_U_2(pdu->pdu_header.u.error_code); + error_code = GET_BE_U_2(pdu->pdu_header.u.error_code); ND_PRINT("%sError code: %s (%u), Encapsulated PDU length: %u", indent_string(indent+2), tok2str(rpki_rtr_error_codes, "Unknown", error_code), @@ -346,7 +346,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_U_4(tptr + tlen); + text_length = GET_BE_U_4(tptr + tlen); tlen += 4; if (text_length) { diff --git a/print-rrcp.c b/print-rrcp.c index 1d76613d..4aaae6d9 100644 --- a/print-rrcp.c +++ b/print-rrcp.c @@ -98,9 +98,9 @@ rrcp_print(netdissect_options *ndo, ndo->ndo_protocol = "rrcp"; ND_TCHECK_1(cp + RRCP_PROTO_OFFSET); - rrcp_proto = EXTRACT_U_1(cp + RRCP_PROTO_OFFSET); + rrcp_proto = GET_U_1(cp + RRCP_PROTO_OFFSET); ND_TCHECK_1(cp + RRCP_OPCODE_ISREPLY_OFFSET); - rrcp_opcode = EXTRACT_U_1((cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_OPCODE_MASK; + rrcp_opcode = GET_U_1((cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_OPCODE_MASK; if (src != NULL && dst != NULL) { ND_PRINT("%s > %s, ", (src->addr_string)(ndo, src->addr), @@ -108,7 +108,7 @@ rrcp_print(netdissect_options *ndo, } ND_PRINT("%s %s", tok2str(proto_values,"RRCP-0x%02x",rrcp_proto), - ((EXTRACT_U_1(cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_ISREPLY) ? "reply" : "query"); + ((GET_U_1(cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_ISREPLY) ? "reply" : "query"); if (rrcp_proto==1){ ND_PRINT(": %s", tok2str(opcode_values,"unknown opcode (0x%02x)",rrcp_opcode)); @@ -116,28 +116,28 @@ rrcp_print(netdissect_options *ndo, if (rrcp_opcode==1 || rrcp_opcode==2){ ND_TCHECK_6(cp + RRCP_REG_ADDR_OFFSET); ND_PRINT(" addr=0x%04x, data=0x%08x", - EXTRACT_LE_U_2(cp + RRCP_REG_ADDR_OFFSET), - EXTRACT_LE_U_4(cp + RRCP_REG_DATA_OFFSET)); + GET_LE_U_2(cp + RRCP_REG_ADDR_OFFSET), + GET_LE_U_4(cp + RRCP_REG_DATA_OFFSET)); } if (rrcp_proto==1){ ND_TCHECK_2(cp + RRCP_AUTHKEY_OFFSET); ND_PRINT(", auth=0x%04x", - EXTRACT_BE_U_2(cp + RRCP_AUTHKEY_OFFSET)); + GET_BE_U_2(cp + RRCP_AUTHKEY_OFFSET)); } if (rrcp_proto==1 && rrcp_opcode==0 && - ((EXTRACT_U_1(cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_ISREPLY)){ + ((GET_U_1(cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_ISREPLY)){ ND_TCHECK_4(cp + RRCP_VENDOR_ID_OFFSET); ND_PRINT(" downlink_port=%u, uplink_port=%u, uplink_mac=%s, vendor_id=%08x ,chip_id=%04x ", - EXTRACT_U_1(cp + RRCP_DOWNLINK_PORT_OFFSET), - EXTRACT_U_1(cp + RRCP_UPLINK_PORT_OFFSET), + GET_U_1(cp + RRCP_DOWNLINK_PORT_OFFSET), + GET_U_1(cp + RRCP_UPLINK_PORT_OFFSET), etheraddr_string(ndo, cp + RRCP_UPLINK_MAC_OFFSET), - EXTRACT_BE_U_4(cp + RRCP_VENDOR_ID_OFFSET), - EXTRACT_BE_U_2(cp + RRCP_CHIP_ID_OFFSET)); + GET_BE_U_4(cp + RRCP_VENDOR_ID_OFFSET), + GET_BE_U_2(cp + RRCP_CHIP_ID_OFFSET)); }else if (rrcp_opcode==1 || rrcp_opcode==2 || rrcp_proto==2){ ND_TCHECK_4(cp + RRCP_COOKIE2_OFFSET); ND_PRINT(", cookie=0x%08x%08x ", - EXTRACT_BE_U_4(cp + RRCP_COOKIE2_OFFSET), - EXTRACT_BE_U_4(cp + RRCP_COOKIE1_OFFSET)); + GET_BE_U_4(cp + RRCP_COOKIE2_OFFSET), + GET_BE_U_4(cp + RRCP_COOKIE1_OFFSET)); } return; diff --git a/print-rsvp.c b/print-rsvp.c index 421f4ac8..21b422f6 100644 --- a/print-rsvp.c +++ b/print-rsvp.c @@ -501,15 +501,15 @@ rsvp_intserv_print(netdissect_options *ndo, if (obj_tlen < 4) return 0; ND_TCHECK_1(tptr); - parameter_id = EXTRACT_U_1(tptr); + parameter_id = GET_U_1(tptr); ND_TCHECK_2(tptr + 2); - parameter_length = EXTRACT_BE_U_2(tptr + 2)<<2; /* convert wordcount to bytecount */ + parameter_length = GET_BE_U_2(tptr + 2)<<2; /* convert wordcount to bytecount */ ND_PRINT("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]", tok2str(rsvp_intserv_parameter_id_values,"unknown",parameter_id), parameter_id, parameter_length, - EXTRACT_U_1(tptr + 1)); + GET_U_1(tptr + 1)); if (obj_tlen < parameter_length+4) return 0; @@ -525,7 +525,7 @@ rsvp_intserv_print(netdissect_options *ndo, */ if (parameter_length == 4) { ND_TCHECK_4(tptr + 4); - ND_PRINT("\n\t\tIS hop count: %u", EXTRACT_BE_U_4(tptr + 4)); + ND_PRINT("\n\t\tIS hop count: %u", GET_BE_U_4(tptr + 4)); } break; @@ -539,7 +539,7 @@ rsvp_intserv_print(netdissect_options *ndo, */ if (parameter_length == 4) { ND_TCHECK_4(tptr + 4); - bw.i = EXTRACT_BE_U_4(tptr + 4); + bw.i = GET_BE_U_4(tptr + 4); ND_PRINT("\n\t\tPath b/w estimate: %.10g Mbps", bw.f / 125000); } break; @@ -555,10 +555,10 @@ rsvp_intserv_print(netdissect_options *ndo, if (parameter_length == 4) { ND_TCHECK_4(tptr + 4); ND_PRINT("\n\t\tMinimum path latency: "); - if (EXTRACT_BE_U_4(tptr + 4) == 0xffffffff) + if (GET_BE_U_4(tptr + 4) == 0xffffffff) ND_PRINT("don't care"); else - ND_PRINT("%u", EXTRACT_BE_U_4(tptr + 4)); + ND_PRINT("%u", GET_BE_U_4(tptr + 4)); } break; @@ -573,7 +573,7 @@ rsvp_intserv_print(netdissect_options *ndo, */ if (parameter_length == 4) { ND_TCHECK_4(tptr + 4); - ND_PRINT("\n\t\tComposed MTU: %u bytes", EXTRACT_BE_U_4(tptr + 4)); + ND_PRINT("\n\t\tComposed MTU: %u bytes", GET_BE_U_4(tptr + 4)); } break; case 127: @@ -595,14 +595,16 @@ rsvp_intserv_print(netdissect_options *ndo, if (parameter_length == 20) { ND_TCHECK_LEN(tptr + 4, 20); - bw.i = EXTRACT_BE_U_4(tptr + 4); + bw.i = GET_BE_U_4(tptr + 4); ND_PRINT("\n\t\tToken Bucket Rate: %.10g Mbps", bw.f / 125000); - bw.i = EXTRACT_BE_U_4(tptr + 8); + bw.i = GET_BE_U_4(tptr + 8); ND_PRINT("\n\t\tToken Bucket Size: %.10g bytes", bw.f); - bw.i = EXTRACT_BE_U_4(tptr + 12); + bw.i = GET_BE_U_4(tptr + 12); ND_PRINT("\n\t\tPeak Data Rate: %.10g Mbps", bw.f / 125000); - ND_PRINT("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_BE_U_4(tptr + 16)); - ND_PRINT("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_BE_U_4(tptr + 20)); + ND_PRINT("\n\t\tMinimum Policed Unit: %u bytes", + GET_BE_U_4(tptr + 16)); + ND_PRINT("\n\t\tMaximum Packet Size: %u bytes", + GET_BE_U_4(tptr + 20)); } break; @@ -619,9 +621,9 @@ rsvp_intserv_print(netdissect_options *ndo, if (parameter_length == 8) { ND_TCHECK_8(tptr + 4); - bw.i = EXTRACT_BE_U_4(tptr + 4); + bw.i = GET_BE_U_4(tptr + 4); ND_PRINT("\n\t\tRate: %.10g Mbps", bw.f / 125000); - ND_PRINT("\n\t\tSlack Term: %u", EXTRACT_BE_U_4(tptr + 8)); + ND_PRINT("\n\t\tSlack Term: %u", GET_BE_U_4(tptr + 8)); } break; @@ -631,7 +633,7 @@ rsvp_intserv_print(netdissect_options *ndo, case 136: if (parameter_length == 4) { ND_TCHECK_4(tptr + 4); - ND_PRINT("\n\t\tValue: %u", EXTRACT_BE_U_4(tptr + 4)); + ND_PRINT("\n\t\tValue: %u", GET_BE_U_4(tptr + 4)); } break; @@ -688,8 +690,8 @@ rsvp_obj_print(netdissect_options *ndo, ND_TCHECK_LEN(tptr, sizeof(struct rsvp_object_header)); rsvp_obj_header = (const struct rsvp_object_header *)tptr; - rsvp_obj_len=EXTRACT_BE_U_2(rsvp_obj_header->length); - rsvp_obj_ctype=EXTRACT_U_1(rsvp_obj_header->ctype); + rsvp_obj_len=GET_BE_U_2(rsvp_obj_header->length); + rsvp_obj_ctype=GET_U_1(rsvp_obj_header->ctype); if(rsvp_obj_len % 4) { ND_PRINT("%sERROR: object header size %u not a multiple of 4", indent, rsvp_obj_len); @@ -701,7 +703,7 @@ rsvp_obj_print(netdissect_options *ndo, return -1; } - rsvp_obj_class_num = EXTRACT_U_1(rsvp_obj_header->class_num); + rsvp_obj_class_num = GET_U_1(rsvp_obj_header->class_num); ND_PRINT("%s%s Object (%u) Flags: [%s", indent, tok2str(rsvp_obj_values, @@ -741,11 +743,11 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_U_1(obj_tptr + sizeof(nd_ipv4))); + GET_U_1(obj_tptr + sizeof(nd_ipv4))); ND_PRINT("%s Flags: [0x%02x], DestPort %u", indent, - EXTRACT_U_1((obj_tptr + 5)), - EXTRACT_BE_U_2(obj_tptr + 6)); + GET_U_1((obj_tptr + 5)), + GET_BE_U_2(obj_tptr + 6)); obj_tlen-=8; obj_tptr+=8; break; @@ -755,11 +757,11 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x", indent, ip6addr_string(ndo, obj_tptr), - EXTRACT_U_1(obj_tptr + sizeof(nd_ipv6))); + GET_U_1(obj_tptr + sizeof(nd_ipv6))); ND_PRINT("%s Flags: [0x%02x], DestPort %u", indent, - EXTRACT_U_1((obj_tptr + sizeof(nd_ipv6) + 1)), - EXTRACT_BE_U_2(obj_tptr + sizeof(nd_ipv6) + 2)); + GET_U_1((obj_tptr + sizeof(nd_ipv6) + 1)), + GET_BE_U_2(obj_tptr + sizeof(nd_ipv6) + 2)); obj_tlen-=20; obj_tptr+=20; break; @@ -770,7 +772,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s", indent, ip6addr_string(ndo, obj_tptr), - EXTRACT_BE_U_2(obj_tptr + 18), + GET_BE_U_2(obj_tptr + 18), ip6addr_string(ndo, obj_tptr + 20)); obj_tlen-=36; obj_tptr+=36; @@ -781,8 +783,8 @@ rsvp_obj_print(netdissect_options *ndo, return -1; ND_PRINT("%s IPv6 P2MP LSP ID: 0x%08x, Tunnel ID: 0x%04x, Extended Tunnel ID: %s", indent, - EXTRACT_BE_U_4(obj_tptr), - EXTRACT_BE_U_2(obj_tptr + 6), + GET_BE_U_4(obj_tptr), + GET_BE_U_2(obj_tptr + 6), ip6addr_string(ndo, obj_tptr + 8)); obj_tlen-=26; obj_tptr+=26; @@ -793,7 +795,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s IPv4 P2MP LSP ID: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_BE_U_2(obj_tptr + 6), + GET_BE_U_2(obj_tptr + 6), ipaddr_string(ndo, obj_tptr + 8)); obj_tlen-=12; obj_tptr+=12; @@ -805,7 +807,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_BE_U_2(obj_tptr + 6), + GET_BE_U_2(obj_tptr + 6), ipaddr_string(ndo, obj_tptr + 8)); obj_tlen-=12; obj_tptr+=12; @@ -872,7 +874,7 @@ rsvp_obj_print(netdissect_options *ndo, switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: while(obj_tlen >= 4 ) { - ND_PRINT("%s Label: %u", indent, EXTRACT_BE_U_4(obj_tptr)); + ND_PRINT("%s Label: %u", indent, GET_BE_U_4(obj_tptr)); obj_tlen-=4; obj_tptr+=4; } @@ -882,7 +884,7 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT("%s Generalized Label: %u", indent, - EXTRACT_BE_U_4(obj_tptr)); + GET_BE_U_4(obj_tptr)); obj_tlen-=4; obj_tptr+=4; break; @@ -891,10 +893,10 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u", indent, - EXTRACT_BE_U_4(obj_tptr), + GET_BE_U_4(obj_tptr), indent, - EXTRACT_BE_U_4(obj_tptr + 4), - EXTRACT_BE_U_4(obj_tptr + 8)); + GET_BE_U_4(obj_tptr + 4), + GET_BE_U_4(obj_tptr + 8)); obj_tlen-=12; obj_tptr+=12; break; @@ -912,8 +914,8 @@ rsvp_obj_print(netdissect_options *ndo, indent, tok2str(rsvp_resstyle_values, "Unknown", - EXTRACT_BE_U_3(obj_tptr + 1)), - EXTRACT_U_1(obj_tptr)); + GET_BE_U_3(obj_tptr + 1)), + GET_U_1(obj_tptr)); obj_tlen-=4; obj_tptr+=4; break; @@ -930,7 +932,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s Source Address: %s, Source Port: %u", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_BE_U_2(obj_tptr + 6)); + GET_BE_U_2(obj_tptr + 6)); obj_tlen-=8; obj_tptr+=8; break; @@ -940,7 +942,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s Source Address: %s, Source Port: %u", indent, ip6addr_string(ndo, obj_tptr), - EXTRACT_BE_U_2(obj_tptr + 18)); + GET_BE_U_2(obj_tptr + 18)); obj_tlen-=20; obj_tptr+=20; break; @@ -951,10 +953,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_U_2(obj_tptr + 18), + GET_BE_U_2(obj_tptr + 18), indent, ip6addr_string(ndo, obj_tptr+20), - EXTRACT_BE_U_2(obj_tptr + 38)); + GET_BE_U_2(obj_tptr + 38)); obj_tlen-=40; obj_tptr+=40; break; @@ -964,7 +966,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_BE_U_2(obj_tptr + 6)); + GET_BE_U_2(obj_tptr + 6)); obj_tlen-=8; obj_tptr+=8; break; @@ -975,10 +977,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_U_2(obj_tptr + 6), + GET_BE_U_2(obj_tptr + 6), indent, ipaddr_string(ndo, obj_tptr+8), - EXTRACT_BE_U_2(obj_tptr + 12)); + GET_BE_U_2(obj_tptr + 12)); obj_tlen-=16; obj_tptr+=16; break; @@ -995,7 +997,7 @@ rsvp_obj_print(netdissect_options *ndo, indent, tok2str(ethertype_values, "Unknown Protocol (0x%04x)", - EXTRACT_BE_U_2(obj_tptr + 2))); + GET_BE_U_2(obj_tptr + 2))); obj_tlen-=4; obj_tptr+=4; } @@ -1007,16 +1009,17 @@ rsvp_obj_print(netdissect_options *ndo, indent, tok2str(ethertype_values, "Unknown Protocol (0x%04x)", - EXTRACT_BE_U_2(obj_tptr + 2))); - ND_PRINT(",%s merge capability",((EXTRACT_U_1(obj_tptr + 4)) & 0x80) ? "no" : "" ); + GET_BE_U_2(obj_tptr + 2))); + ND_PRINT(",%s merge capability", + ((GET_U_1(obj_tptr + 4)) & 0x80) ? "no" : "" ); ND_PRINT("%s Minimum VPI/VCI: %u/%u", indent, - (EXTRACT_BE_U_2(obj_tptr + 4))&0xfff, - (EXTRACT_BE_U_2(obj_tptr + 6)) & 0xfff); + (GET_BE_U_2(obj_tptr + 4))&0xfff, + (GET_BE_U_2(obj_tptr + 6)) & 0xfff); ND_PRINT("%s Maximum VPI/VCI: %u/%u", indent, - (EXTRACT_BE_U_2(obj_tptr + 8))&0xfff, - (EXTRACT_BE_U_2(obj_tptr + 10)) & 0xfff); + (GET_BE_U_2(obj_tptr + 8))&0xfff, + (GET_BE_U_2(obj_tptr + 10)) & 0xfff); obj_tlen-=12; obj_tptr+=12; break; @@ -1027,13 +1030,13 @@ rsvp_obj_print(netdissect_options *ndo, indent, tok2str(ethertype_values, "Unknown Protocol (0x%04x)", - EXTRACT_BE_U_2(obj_tptr + 2))); + GET_BE_U_2(obj_tptr + 2))); ND_PRINT("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI", indent, - (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" : ""); + (GET_BE_U_4(obj_tptr + 4))&0x7fffff, + (GET_BE_U_4(obj_tptr + 8))&0x7fffff, + (((GET_BE_U_2(obj_tptr + 4)>>7)&3) == 0 ) ? "10" : "", + (((GET_BE_U_2(obj_tptr + 4) >> 7) & 3) == 2 ) ? "23" : ""); obj_tlen-=12; obj_tptr+=12; break; @@ -1044,18 +1047,18 @@ rsvp_obj_print(netdissect_options *ndo, indent, tok2str(gmpls_encoding_values, "Unknown", - EXTRACT_U_1(obj_tptr)), - EXTRACT_U_1(obj_tptr)); + GET_U_1(obj_tptr)), + GET_U_1(obj_tptr)); ND_PRINT("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)", indent, tok2str(gmpls_switch_cap_values, "Unknown", - EXTRACT_U_1((obj_tptr + 1))), - EXTRACT_U_1(obj_tptr + 1), + GET_U_1((obj_tptr + 1))), + GET_U_1(obj_tptr + 1), tok2str(gmpls_payload_values, "Unknown", - EXTRACT_BE_U_2(obj_tptr + 2)), - EXTRACT_BE_U_2(obj_tptr + 2)); + GET_BE_U_2(obj_tptr + 2)), + GET_BE_U_2(obj_tptr + 2)); obj_tlen-=4; obj_tptr+=4; break; @@ -1072,12 +1075,12 @@ rsvp_obj_print(netdissect_options *ndo, u_char length; ND_TCHECK_4(obj_tptr); - length = EXTRACT_U_1(obj_tptr + 1); + length = GET_U_1(obj_tptr + 1); ND_PRINT("%s Subobject Type: %s, length %u", indent, tok2str(rsvp_obj_xro_values, "Unknown %u", - RSVP_OBJ_XRO_MASK_SUBOBJ(EXTRACT_U_1(obj_tptr))), + RSVP_OBJ_XRO_MASK_SUBOBJ(GET_U_1(obj_tptr))), length); if (obj_tlen < length) { ND_PRINT("%s ERROR: ERO subobject length > object length", indent); @@ -1089,7 +1092,7 @@ rsvp_obj_print(netdissect_options *ndo, break; } - switch(RSVP_OBJ_XRO_MASK_SUBOBJ(EXTRACT_U_1(obj_tptr))) { + switch(RSVP_OBJ_XRO_MASK_SUBOBJ(GET_U_1(obj_tptr))) { u_char prefix_length; case RSVP_OBJ_XRO_IPV4: @@ -1098,19 +1101,19 @@ rsvp_obj_print(netdissect_options *ndo, goto invalid; } ND_TCHECK_8(obj_tptr); - prefix_length = EXTRACT_U_1(obj_tptr + 6); + prefix_length = GET_U_1(obj_tptr + 6); if (prefix_length != 32) { ND_PRINT(" ERROR: Prefix length %u != 32", prefix_length); goto invalid; } ND_PRINT(", %s, %s/%u, Flags: [%s]", - RSVP_OBJ_XRO_MASK_LOOSE(EXTRACT_U_1(obj_tptr)) ? "Loose" : "Strict", + RSVP_OBJ_XRO_MASK_LOOSE(GET_U_1(obj_tptr)) ? "Loose" : "Strict", ipaddr_string(ndo, obj_tptr+2), - EXTRACT_U_1((obj_tptr + 6)), + GET_U_1((obj_tptr + 6)), bittok2str(rsvp_obj_rro_flag_values, "none", - EXTRACT_U_1((obj_tptr + 7)))); /* rfc3209 says that this field is rsvd. */ + GET_U_1((obj_tptr + 7)))); /* rfc3209 says that this field is rsvd. */ break; case RSVP_OBJ_XRO_LABEL: if (length != 8) { @@ -1121,13 +1124,13 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT(", Flags: [%s] (%#x), Class-Type: %s (%u), %u", bittok2str(rsvp_obj_rro_label_flag_values, "none", - EXTRACT_U_1((obj_tptr + 2))), - EXTRACT_U_1(obj_tptr + 2), + GET_U_1((obj_tptr + 2))), + GET_U_1(obj_tptr + 2), tok2str(rsvp_ctype_values, "Unknown", - EXTRACT_U_1((obj_tptr + 3)) + (256 * RSVP_OBJ_RRO)), - EXTRACT_U_1((obj_tptr + 3)), - EXTRACT_BE_U_4(obj_tptr + 4)); + GET_U_1((obj_tptr + 3)) + (256 * RSVP_OBJ_RRO)), + GET_U_1((obj_tptr + 3)), + GET_BE_U_4(obj_tptr + 4)); } obj_tlen-=length; obj_tptr+=length; @@ -1146,8 +1149,8 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT("%s Source Instance: 0x%08x, Destination Instance: 0x%08x", indent, - EXTRACT_BE_U_4(obj_tptr), - EXTRACT_BE_U_4(obj_tptr + 4)); + GET_BE_U_4(obj_tptr), + GET_BE_U_4(obj_tptr + 4)); obj_tlen-=8; obj_tptr+=8; break; @@ -1163,8 +1166,8 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT("%s Restart Time: %ums, Recovery Time: %ums", indent, - EXTRACT_BE_U_4(obj_tptr), - EXTRACT_BE_U_4(obj_tptr + 4)); + GET_BE_U_4(obj_tptr), + GET_BE_U_4(obj_tptr + 4)); obj_tlen-=8; obj_tptr+=8; break; @@ -1178,20 +1181,20 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_TUNNEL_IPV4: if (obj_tlen < 4) return-1; - namelen = EXTRACT_U_1(obj_tptr + 3); + namelen = GET_U_1(obj_tptr + 3); if (obj_tlen < 4+namelen) return-1; ND_PRINT("%s Session Name: ", indent); for (i = 0; i < namelen; i++) - fn_print_char(ndo, EXTRACT_U_1(obj_tptr + 4 + i)); + fn_print_char(ndo, GET_U_1(obj_tptr + 4 + i)); ND_PRINT("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s] (%#x)", indent, - EXTRACT_U_1(obj_tptr), - EXTRACT_U_1(obj_tptr + 1), + GET_U_1(obj_tptr), + GET_U_1(obj_tptr + 1), bittok2str(rsvp_session_attribute_flag_values, "none", - EXTRACT_U_1((obj_tptr + 2))), - EXTRACT_U_1(obj_tptr + 2)); + GET_U_1((obj_tptr + 2))), + GET_U_1(obj_tptr + 2)); obj_tlen-=4+namelen; obj_tptr+=4+namelen; break; @@ -1223,9 +1226,9 @@ rsvp_obj_print(netdissect_options *ndo, */ if (total_subobj_len < 4) goto invalid; - 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; + subobj_len = GET_BE_U_2(obj_tptr); + subobj_type = (GET_BE_U_2(obj_tptr + 2))>>8; + af = (GET_BE_U_2(obj_tptr + 2))&0x00FF; ND_PRINT("%s Subobject Type: %s (%u), AF: %s (%u), length: %u", indent, @@ -1304,10 +1307,10 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s U-bit: %x, Label type: %u, Logical port id: %u, Label: %u", indent, - ((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)); + ((GET_BE_U_4(obj_tptr + 4))>>31), + ((GET_BE_U_4(obj_tptr + 4))&0xFF), + GET_BE_U_4(obj_tptr + 8), + GET_BE_U_4(obj_tptr + 12)); break; case RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL: @@ -1316,7 +1319,7 @@ rsvp_obj_print(netdissect_options *ndo, } ND_PRINT("%s Service level: %u", - indent, (EXTRACT_BE_U_4(obj_tptr + 4)) >> 24); + indent, (GET_BE_U_4(obj_tptr + 4)) >> 24); break; default: @@ -1343,7 +1346,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_BE_U_4(obj_tptr + 4)); + GET_BE_U_4(obj_tptr + 4)); obj_tlen-=8; obj_tptr+=8; if (obj_tlen) @@ -1356,7 +1359,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x", indent, ip6addr_string(ndo, obj_tptr), - EXTRACT_BE_U_4(obj_tptr + 16)); + GET_BE_U_4(obj_tptr + 16)); obj_tlen-=20; obj_tptr+=20; hexdump=TRUE; /* unless we have a TLV parser lets just hexdump */ @@ -1373,7 +1376,7 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT("%s Refresh Period: %ums", indent, - EXTRACT_BE_U_4(obj_tptr)); + GET_BE_U_4(obj_tptr)); obj_tlen-=4; obj_tptr+=4; break; @@ -1392,18 +1395,18 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT("%s Msg-Version: %u, length: %u", indent, - (EXTRACT_U_1(obj_tptr) & 0xf0) >> 4, - EXTRACT_BE_U_2(obj_tptr + 2) << 2); + (GET_U_1(obj_tptr) & 0xf0) >> 4, + GET_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_U_2(obj_tptr + 2)<<2; + intserv_serv_tlen=GET_BE_U_2(obj_tptr + 2)<<2; ND_PRINT("%s Service Type: %s (%u), break bit %sset, Service length: %u", indent, - 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 ", + tok2str(rsvp_intserv_service_type_values,"unknown",GET_U_1((obj_tptr))), + GET_U_1(obj_tptr), + (GET_U_1(obj_tptr + 1)&0x80) ? "" : "not ", intserv_serv_tlen); obj_tptr+=4; /* get to the start of the parameter list */ @@ -1432,7 +1435,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s Source Address: %s, Source Port: %u", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_BE_U_2(obj_tptr + 6)); + GET_BE_U_2(obj_tptr + 6)); obj_tlen-=8; obj_tptr+=8; break; @@ -1442,7 +1445,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s Source Address: %s, Source Port: %u", indent, ip6addr_string(ndo, obj_tptr), - EXTRACT_BE_U_2(obj_tptr + 18)); + GET_BE_U_2(obj_tptr + 18)); obj_tlen-=20; obj_tptr+=20; break; @@ -1452,7 +1455,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s Source Address: %s, Flow Label: %u", indent, ip6addr_string(ndo, obj_tptr), - EXTRACT_BE_U_3(obj_tptr + 17)); + GET_BE_U_3(obj_tptr + 17)); obj_tlen-=20; obj_tptr+=20; break; @@ -1462,7 +1465,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s Source Address: %s, LSP-ID: 0x%04x", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_BE_U_2(obj_tptr + 18)); + GET_BE_U_2(obj_tptr + 18)); obj_tlen-=20; obj_tptr+=20; break; @@ -1473,10 +1476,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_U_2(obj_tptr + 18), + GET_BE_U_2(obj_tptr + 18), indent, ip6addr_string(ndo, obj_tptr+20), - EXTRACT_BE_U_2(obj_tptr + 38)); + GET_BE_U_2(obj_tptr + 38)); obj_tlen-=40; obj_tptr+=40; break; @@ -1486,7 +1489,7 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT("%s Source Address: %s, LSP-ID: 0x%04x", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_BE_U_2(obj_tptr + 6)); + GET_BE_U_2(obj_tptr + 6)); obj_tlen-=8; obj_tptr+=8; break; @@ -1497,10 +1500,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_U_2(obj_tptr + 6), + GET_BE_U_2(obj_tptr + 6), indent, ipaddr_string(ndo, obj_tptr+8), - EXTRACT_BE_U_2(obj_tptr + 12)); + GET_BE_U_2(obj_tptr + 12)); obj_tlen-=16; obj_tptr+=16; break; @@ -1517,7 +1520,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_U_4(obj_ptr.rsvp_obj_frr->bandwidth); + bw.i = GET_BE_U_4(obj_ptr.rsvp_obj_frr->bandwidth); ND_PRINT("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps", indent, obj_ptr.rsvp_obj_frr->setup_prio, @@ -1526,9 +1529,9 @@ rsvp_obj_print(netdissect_options *ndo, bw.f * 8 / 1000000); ND_PRINT("%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x", indent, - 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)); + GET_BE_U_4(obj_ptr.rsvp_obj_frr->include_any), + GET_BE_U_4(obj_ptr.rsvp_obj_frr->exclude_any), + GET_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; @@ -1536,7 +1539,7 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_TUNNEL_IPV4: /* old style */ if (obj_tlen < 16) return-1; - bw.i = EXTRACT_BE_U_4(obj_ptr.rsvp_obj_frr->bandwidth); + bw.i = GET_BE_U_4(obj_ptr.rsvp_obj_frr->bandwidth); ND_PRINT("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps", indent, obj_ptr.rsvp_obj_frr->setup_prio, @@ -1545,8 +1548,8 @@ rsvp_obj_print(netdissect_options *ndo, bw.f * 8 / 1000000); ND_PRINT("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x", indent, - EXTRACT_BE_U_4(obj_ptr.rsvp_obj_frr->include_any), - EXTRACT_BE_U_4(obj_ptr.rsvp_obj_frr->exclude_any)); + GET_BE_U_4(obj_ptr.rsvp_obj_frr->include_any), + GET_BE_U_4(obj_ptr.rsvp_obj_frr->exclude_any)); obj_tlen-=16; obj_tptr+=16; break; @@ -1579,7 +1582,7 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_1: ND_PRINT("%s CT: %u", indent, - EXTRACT_BE_U_4(obj_tptr) & 0x7); + GET_BE_U_4(obj_tptr) & 0x7); obj_tlen-=4; obj_tptr+=4; break; @@ -1594,12 +1597,12 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_IPV4: if (obj_tlen < 8) return-1; - error_code=EXTRACT_U_1(obj_tptr + 5); - error_value=EXTRACT_BE_U_2(obj_tptr + 6); + error_code=GET_U_1(obj_tptr + 5); + error_value=GET_BE_U_2(obj_tptr + 6); ND_PRINT("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)", indent, ipaddr_string(ndo, obj_tptr), - EXTRACT_U_1(obj_tptr + 4), + GET_U_1(obj_tptr + 4), indent, tok2str(rsvp_obj_error_code_values,"unknown",error_code), error_code); @@ -1626,12 +1629,12 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_IPV6: if (obj_tlen < 20) return-1; - error_code=EXTRACT_U_1(obj_tptr + 17); - error_value=EXTRACT_BE_U_2(obj_tptr + 18); + error_code=GET_U_1(obj_tptr + 17); + error_value=GET_BE_U_2(obj_tptr + 18); ND_PRINT("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)", indent, ip6addr_string(ndo, obj_tptr), - EXTRACT_U_1(obj_tptr + 16), + GET_U_1(obj_tptr + 16), indent, tok2str(rsvp_obj_error_code_values,"unknown",error_code), error_code); @@ -1658,10 +1661,10 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; - padbytes = EXTRACT_BE_U_2(obj_tptr + 2); + padbytes = GET_BE_U_2(obj_tptr + 2); ND_PRINT("%s TLV count: %u, padding bytes: %u", indent, - EXTRACT_BE_U_2(obj_tptr), + GET_BE_U_2(obj_tptr), padbytes); obj_tlen-=4; obj_tptr+=4; @@ -1669,17 +1672,17 @@ rsvp_obj_print(netdissect_options *ndo, while(obj_tlen >= 2 + padbytes) { ND_PRINT("%s %s TLV (0x%02x), length: %u", /* length includes header */ indent, - 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)) + tok2str(rsvp_obj_prop_tlv_values,"unknown",GET_U_1(obj_tptr)), + GET_U_1(obj_tptr), + GET_U_1(obj_tptr + 1)); + if (obj_tlen < GET_U_1(obj_tptr + 1)) return-1; - if (EXTRACT_U_1(obj_tptr + 1) < 2) + if (GET_U_1(obj_tptr + 1) < 2) return -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); + GET_U_1(obj_tptr + 1) - 2); + obj_tlen-=GET_U_1(obj_tptr + 1); + obj_tptr+=GET_U_1(obj_tptr + 1); } break; default: @@ -1697,16 +1700,16 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT("%s Flags [0x%02x], epoch: %u", indent, - EXTRACT_U_1(obj_tptr), - EXTRACT_BE_U_3(obj_tptr + 1)); + GET_U_1(obj_tptr), + GET_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("%s Message-ID 0x%08x (%u)", indent, - EXTRACT_BE_U_4(obj_tptr), - EXTRACT_BE_U_4(obj_tptr)); + GET_BE_U_4(obj_tptr), + GET_BE_U_4(obj_tptr)); obj_tlen-=4; obj_tptr+=4; } @@ -1724,19 +1727,19 @@ rsvp_obj_print(netdissect_options *ndo, obj_ptr.rsvp_obj_integrity = (const struct rsvp_obj_integrity_t *)obj_tptr; ND_PRINT("%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]", indent, - 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), + GET_BE_U_2(obj_ptr.rsvp_obj_integrity->key_id), + GET_BE_U_4(obj_ptr.rsvp_obj_integrity->key_id + 2), + GET_BE_U_4(obj_ptr.rsvp_obj_integrity->sequence), + GET_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("%s MD5-sum 0x%08x%08x%08x%08x ", indent, - 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)); + GET_BE_U_4(obj_ptr.rsvp_obj_integrity->digest), + GET_BE_U_4(obj_ptr.rsvp_obj_integrity->digest + 4), + GET_BE_U_4(obj_ptr.rsvp_obj_integrity->digest + 8), + GET_BE_U_4(obj_ptr.rsvp_obj_integrity->digest + 12)); sigcheck = signature_verify(ndo, pptr, plen, obj_ptr.rsvp_obj_integrity->digest, @@ -1759,7 +1762,7 @@ rsvp_obj_print(netdissect_options *ndo, return-1; ND_PRINT("%s Flags [%s]", indent, bittok2str(rsvp_obj_admin_status_flag_values, "none", - EXTRACT_BE_U_4(obj_tptr))); + GET_BE_U_4(obj_tptr))); obj_tlen-=4; obj_tptr+=4; break; @@ -1773,11 +1776,11 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; - action = (EXTRACT_BE_U_2(obj_tptr)>>8); + action = (GET_BE_U_2(obj_tptr)>>8); ND_PRINT("%s Action: %s (%u), Label type: %u", indent, tok2str(rsvp_obj_label_set_action_values, "Unknown", action), - action, (EXTRACT_BE_U_4(obj_tptr) & 0x7F)); + action, (GET_BE_U_4(obj_tptr) & 0x7F)); switch (action) { case LABEL_SET_INCLUSIVE_RANGE: @@ -1787,8 +1790,8 @@ rsvp_obj_print(netdissect_options *ndo, if (obj_tlen < 12) return -1; ND_PRINT("%s Start range: %u, End range: %u", indent, - EXTRACT_BE_U_4(obj_tptr + 4), - EXTRACT_BE_U_4(obj_tptr + 8)); + GET_BE_U_4(obj_tptr + 4), + GET_BE_U_4(obj_tptr + 8)); obj_tlen-=12; obj_tptr+=12; break; @@ -1799,7 +1802,7 @@ rsvp_obj_print(netdissect_options *ndo, subchannel = 1; while(obj_tlen >= 4 ) { ND_PRINT("%s Subchannel #%u: %u", indent, subchannel, - EXTRACT_BE_U_4(obj_tptr)); + GET_BE_U_4(obj_tptr)); obj_tptr+=4; obj_tlen-=4; subchannel++; @@ -1882,7 +1885,7 @@ rsvp_print(netdissect_options *ndo, rsvp_com_header = (const struct rsvp_common_header *)pptr; ND_TCHECK_SIZE(rsvp_com_header); - version_flags = EXTRACT_U_1(rsvp_com_header->version_flags); + version_flags = GET_U_1(rsvp_com_header->version_flags); /* * Sanity checking of the header. @@ -1893,7 +1896,7 @@ rsvp_print(netdissect_options *ndo, return; } - msg_type = EXTRACT_U_1(rsvp_com_header->msg_type); + msg_type = GET_U_1(rsvp_com_header->msg_type); /* in non-verbose mode just lets print the basic Message Type*/ if (ndo->ndo_vflag < 1) { @@ -1906,7 +1909,7 @@ rsvp_print(netdissect_options *ndo, /* ok they seem to want to know everything - lets fully decode it */ - plen = tlen = EXTRACT_BE_U_2(rsvp_com_header->length); + plen = tlen = GET_BE_U_2(rsvp_com_header->length); ND_PRINT("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x", RSVP_EXTRACT_VERSION(version_flags), @@ -1914,8 +1917,8 @@ rsvp_print(netdissect_options *ndo, msg_type, bittok2str(rsvp_header_flag_values,"none",RSVP_EXTRACT_FLAGS(version_flags)), tlen, - EXTRACT_U_1(rsvp_com_header->ttl), - EXTRACT_BE_U_2(rsvp_com_header->checksum)); + GET_U_1(rsvp_com_header->ttl), + GET_BE_U_2(rsvp_com_header->checksum)); if (tlen < sizeof(struct rsvp_common_header)) { ND_PRINT("ERROR: common header too short %u < %lu", tlen, @@ -1942,7 +1945,7 @@ rsvp_print(netdissect_options *ndo, rsvp_com_header = (const struct rsvp_common_header *)subpptr; ND_TCHECK_SIZE(rsvp_com_header); - version_flags = EXTRACT_U_1(rsvp_com_header->version_flags); + version_flags = GET_U_1(rsvp_com_header->version_flags); /* * Sanity checking of the header. @@ -1953,17 +1956,17 @@ rsvp_print(netdissect_options *ndo, return; } - subplen = subtlen = EXTRACT_BE_U_2(rsvp_com_header->length); + subplen = subtlen = GET_BE_U_2(rsvp_com_header->length); - msg_type = EXTRACT_U_1(rsvp_com_header->msg_type); + msg_type = GET_U_1(rsvp_com_header->msg_type); ND_PRINT("\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x", RSVP_EXTRACT_VERSION(version_flags), tok2str(rsvp_msg_type_values, "unknown, type: %u",msg_type), msg_type, bittok2str(rsvp_header_flag_values,"none",RSVP_EXTRACT_FLAGS(version_flags)), subtlen, - EXTRACT_U_1(rsvp_com_header->ttl), - EXTRACT_BE_U_2(rsvp_com_header->checksum)); + GET_U_1(rsvp_com_header->ttl), + GET_BE_U_2(rsvp_com_header->checksum)); if (subtlen < sizeof(struct rsvp_common_header)) { ND_PRINT("ERROR: common header too short %u < %lu", subtlen, diff --git a/print-rt6.c b/print-rt6.c index ab279876..70301106 100644 --- a/print-rt6.c +++ b/print-rt6.c @@ -49,11 +49,11 @@ rt6_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2 _U_) ND_TCHECK_1(dp->ip6r_segleft); - len = EXTRACT_U_1(dp->ip6r_len); + len = GET_U_1(dp->ip6r_len); ND_PRINT("srcrt (len=%u", len); /*)*/ - type = EXTRACT_U_1(dp->ip6r_type); + type = GET_U_1(dp->ip6r_type); ND_PRINT(", type=%u", type); - ND_PRINT(", segleft=%u", EXTRACT_U_1(dp->ip6r_segleft)); + ND_PRINT(", segleft=%u", GET_U_1(dp->ip6r_segleft)); switch (type) { case IPV6_RTHDR_TYPE_0: @@ -61,9 +61,9 @@ rt6_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2 _U_) dp0 = (const struct ip6_rthdr0 *)dp; ND_TCHECK_4(dp0->ip6r0_reserved); - if (EXTRACT_BE_U_4(dp0->ip6r0_reserved) || ndo->ndo_vflag) { + if (GET_BE_U_4(dp0->ip6r0_reserved) || ndo->ndo_vflag) { ND_PRINT(", rsv=0x%0x", - EXTRACT_BE_U_4(dp0->ip6r0_reserved)); + GET_BE_U_4(dp0->ip6r0_reserved)); } if (len % 2 == 1) @@ -77,21 +77,21 @@ rt6_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2 _U_) } /*(*/ ND_PRINT(") "); - return((EXTRACT_U_1(dp0->ip6r0_len) + 1) << 3); + return((GET_U_1(dp0->ip6r0_len) + 1) << 3); break; case IPV6_RTHDR_TYPE_4: srh = (const struct ip6_srh *)dp; ND_TCHECK_1(srh->srh_last_ent); - ND_PRINT(", last-entry=%u", EXTRACT_U_1(srh->srh_last_ent)); + ND_PRINT(", last-entry=%u", GET_U_1(srh->srh_last_ent)); ND_TCHECK_1(srh->srh_flags); - if (EXTRACT_U_1(srh->srh_flags) || ndo->ndo_vflag) { + if (GET_U_1(srh->srh_flags) || ndo->ndo_vflag) { ND_PRINT(", flags=0x%0x", - EXTRACT_U_1(srh->srh_flags)); + GET_U_1(srh->srh_flags)); } ND_TCHECK_2(srh->srh_tag); - ND_PRINT(", tag=%x", EXTRACT_BE_U_2(srh->srh_tag)); + ND_PRINT(", tag=%x", GET_BE_U_2(srh->srh_tag)); if (len % 2 == 1) goto trunc; @@ -104,7 +104,7 @@ rt6_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2 _U_) } /*(*/ ND_PRINT(") "); - return((EXTRACT_U_1(srh->srh_len) + 1) << 3); + return((GET_U_1(srh->srh_len) + 1) << 3); break; default: goto trunc; @@ -542,26 +542,26 @@ rx_print(netdissect_options *ndo, rxh = (const struct rx_header *) bp; - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); ND_PRINT(" rx %s", tok2str(rx_types, "type %u", type)); - flags = EXTRACT_U_1(rxh->flags); + flags = GET_U_1(rxh->flags); if (ndo->ndo_vflag) { int firstflag = 0; if (ndo->ndo_vflag > 1) ND_PRINT(" cid %08x call# %u", - EXTRACT_BE_U_4(rxh->cid), - EXTRACT_BE_U_4(rxh->callNumber)); + GET_BE_U_4(rxh->cid), + GET_BE_U_4(rxh->callNumber)); ND_PRINT(" seq %u ser %u", - EXTRACT_BE_U_4(rxh->seq), - EXTRACT_BE_U_4(rxh->serial)); + GET_BE_U_4(rxh->seq), + GET_BE_U_4(rxh->serial)); if (ndo->ndo_vflag > 2) ND_PRINT(" secindex %u serviceid %hu", - EXTRACT_U_1(rxh->securityIndex), - EXTRACT_BE_U_2(rxh->serviceId)); + GET_U_1(rxh->securityIndex), + GET_BE_U_2(rxh->serviceId)); if (ndo->ndo_vflag > 1) for (i = 0; i < NUM_RX_FLAGS; i++) { @@ -589,7 +589,7 @@ rx_print(netdissect_options *ndo, */ if (type == RX_PACKET_TYPE_DATA && - EXTRACT_BE_U_4(rxh->seq) == 1 && + GET_BE_U_4(rxh->seq) == 1 && flags & RX_CLIENT_INITIATED) { /* @@ -633,7 +633,7 @@ rx_print(netdissect_options *ndo, */ } else if (((type == RX_PACKET_TYPE_DATA && - EXTRACT_BE_U_4(rxh->seq) == 1) || + GET_BE_U_4(rxh->seq) == 1) || type == RX_PACKET_TYPE_ABORT) && (flags & RX_CLIENT_INITIATED) == 0 && rx_cache_find(ndo, rxh, (const struct ip *) bp2, @@ -697,12 +697,12 @@ rx_cache_insert(netdissect_options *ndo, if (++rx_cache_next >= RX_CACHE_SIZE) rx_cache_next = 0; - rxent->callnum = EXTRACT_BE_U_4(rxh->callNumber); + rxent->callnum = GET_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_U_2(rxh->serviceId); - rxent->opcode = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + rxent->serviceId = GET_BE_U_2(rxh->serviceId); + rxent->opcode = GET_BE_U_4(bp + sizeof(struct rx_header)); } /* @@ -729,10 +729,10 @@ rx_cache_find(netdissect_options *ndo, const struct rx_header *rxh, i = rx_cache_hint; do { rxent = &rx_cache[i]; - if (rxent->callnum == EXTRACT_BE_U_4(rxh->callNumber) && + if (rxent->callnum == GET_BE_U_4(rxh->callNumber) && rxent->client.s_addr == clip && rxent->server.s_addr == sip && - rxent->serviceId == EXTRACT_BE_U_2(rxh->serviceId) && + rxent->serviceId == GET_BE_U_2(rxh->serviceId) && rxent->dport == sport) { /* We got a match! */ @@ -755,18 +755,18 @@ rx_cache_find(netdissect_options *ndo, const struct rx_header *rxh, #define FIDOUT() { uint32_t n1, n2, n3; \ ND_TCHECK_LEN(bp, sizeof(uint32_t) * 3); \ - n1 = EXTRACT_BE_U_4(bp); \ + n1 = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ - n2 = EXTRACT_BE_U_4(bp); \ + n2 = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ - n3 = EXTRACT_BE_U_4(bp); \ + n3 = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT(" fid %u/%u/%u", n1, n2, n3); \ } #define STROUT(MAX) { uint32_t _i; \ ND_TCHECK_LEN(bp, sizeof(uint32_t)); \ - _i = EXTRACT_BE_U_4(bp); \ + _i = GET_BE_U_4(bp); \ if (_i > (MAX)) \ goto trunc; \ bp += sizeof(uint32_t); \ @@ -779,28 +779,28 @@ rx_cache_find(netdissect_options *ndo, const struct rx_header *rxh, #define INTOUT() { int32_t _i; \ ND_TCHECK_4(bp); \ - _i = EXTRACT_BE_S_4(bp); \ + _i = GET_BE_S_4(bp); \ bp += sizeof(int32_t); \ ND_PRINT(" %d", _i); \ } #define UINTOUT() { uint32_t _i; \ ND_TCHECK_4(bp); \ - _i = EXTRACT_BE_U_4(bp); \ + _i = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT(" %u", _i); \ } #define UINT64OUT() { uint64_t _i; \ ND_TCHECK_LEN(bp, sizeof(uint64_t)); \ - _i = EXTRACT_BE_U_8(bp); \ + _i = GET_BE_U_8(bp); \ bp += sizeof(uint64_t); \ ND_PRINT(" %" PRIu64, _i); \ } #define DATEOUT() { time_t _t; struct tm *tm; char str[256]; \ ND_TCHECK_4(bp); \ - _t = (time_t) EXTRACT_BE_S_4(bp); \ + _t = (time_t) GET_BE_S_4(bp); \ bp += sizeof(int32_t); \ tm = localtime(&_t); \ strftime(str, 256, "%Y/%m/%d %H:%M:%S", tm); \ @@ -809,17 +809,17 @@ rx_cache_find(netdissect_options *ndo, const struct rx_header *rxh, #define STOREATTROUT() { uint32_t mask, _i; \ ND_TCHECK_LEN(bp, (sizeof(uint32_t) * 6)); \ - mask = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \ + mask = GET_BE_U_4(bp); bp += sizeof(uint32_t); \ if (mask) ND_PRINT(" StoreStatus"); \ if (mask & 1) { ND_PRINT(" date"); DATEOUT(); } \ else bp += sizeof(uint32_t); \ - _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \ + _i = GET_BE_U_4(bp); bp += sizeof(uint32_t); \ if (mask & 2) ND_PRINT(" owner %u", _i); \ - _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \ + _i = GET_BE_U_4(bp); bp += sizeof(uint32_t); \ if (mask & 4) ND_PRINT(" group %u", _i); \ - _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \ + _i = GET_BE_U_4(bp); bp += sizeof(uint32_t); \ if (mask & 8) ND_PRINT(" mode %o", _i & 07777); \ - _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \ + _i = GET_BE_U_4(bp); bp += sizeof(uint32_t); \ if (mask & 16) ND_PRINT(" segsize %u", _i); \ /* undocumented in 3.3 docu */ \ if (mask & 1024) ND_PRINT(" fsync"); \ @@ -827,26 +827,26 @@ rx_cache_find(netdissect_options *ndo, const struct rx_header *rxh, #define UBIK_VERSIONOUT() {uint32_t epoch; uint32_t counter; \ ND_TCHECK_LEN(bp, sizeof(uint32_t) * 2); \ - epoch = EXTRACT_BE_U_4(bp); \ + epoch = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ - counter = EXTRACT_BE_U_4(bp); \ + counter = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT(" %u.%u", epoch, counter); \ } #define AFSUUIDOUT() {uint32_t temp; int _i; \ ND_TCHECK_LEN(bp, 11 * sizeof(uint32_t)); \ - temp = EXTRACT_BE_U_4(bp); \ + temp = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT(" %08x", temp); \ - temp = EXTRACT_BE_U_4(bp); \ + temp = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT("%04x", temp); \ - temp = EXTRACT_BE_U_4(bp); \ + temp = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT("%04x", temp); \ for (_i = 0; _i < 8; _i++) { \ - temp = EXTRACT_BE_U_4(bp); \ + temp = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT("%02x", (unsigned char) temp); \ } \ @@ -864,7 +864,7 @@ rx_cache_find(netdissect_options *ndo, const struct rx_header *rxh, ND_TCHECK_LEN(bp, (MAX) * sizeof(uint32_t)); \ sp = s; \ for (k = 0; k < (MAX); k++) { \ - *sp++ = (u_char) EXTRACT_BE_U_4(bp); \ + *sp++ = (u_char) GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ } \ s[(MAX)] = '\0'; \ @@ -875,11 +875,11 @@ rx_cache_find(netdissect_options *ndo, const struct rx_header *rxh, #define DESTSERVEROUT() { uint32_t n1, n2, n3; \ ND_TCHECK_LEN(bp, sizeof(uint32_t) * 3); \ - n1 = EXTRACT_BE_U_4(bp); \ + n1 = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ - n2 = EXTRACT_BE_U_4(bp); \ + n2 = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ - n3 = EXTRACT_BE_U_4(bp); \ + n3 = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT(" server %u:%u:%u", n1, n2, n3); \ } @@ -904,7 +904,7 @@ fs_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - fs_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + fs_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" fs call %s", tok2str(fs_req, "op#%u", fs_op)); @@ -956,7 +956,7 @@ fs_print(netdissect_options *ndo, char a[AFSOPAQUEMAX+1]; FIDOUT(); ND_TCHECK_4(bp); - i = EXTRACT_BE_U_4(bp); + i = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_TCHECK_LEN(bp, i); i = min(AFSOPAQUEMAX, i); @@ -1013,7 +1013,7 @@ fs_print(netdissect_options *ndo, { uint32_t j; ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); for (i = 0; i < j; i++) { @@ -1079,7 +1079,7 @@ fs_reply_print(netdissect_options *ndo, ND_PRINT(" fs reply %s", tok2str(fs_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -1092,7 +1092,7 @@ fs_reply_print(netdissect_options *ndo, { char a[AFSOPAQUEMAX+1]; ND_TCHECK_4(bp); - i = EXTRACT_BE_U_4(bp); + i = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_TCHECK_LEN(bp, i); i = min(AFSOPAQUEMAX, i); @@ -1123,7 +1123,7 @@ fs_reply_print(netdissect_options *ndo, int32_t errcode; ND_TCHECK_4(bp); - errcode = EXTRACT_BE_S_4(bp); + errcode = GET_BE_S_4(bp); bp += sizeof(int32_t); ND_PRINT(" error %s", tok2str(afs_fs_errors, "#%d", errcode)); @@ -1240,7 +1240,7 @@ cb_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - cb_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + cb_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" cb call %s", tok2str(cb_req, "op#%u", cb_op)); @@ -1256,7 +1256,7 @@ cb_print(netdissect_options *ndo, { uint32_t j, t; ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); for (i = 0; i < j; i++) { @@ -1269,7 +1269,7 @@ cb_print(netdissect_options *ndo, ND_PRINT(" <none!>"); ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); if (j != 0) @@ -1281,7 +1281,7 @@ cb_print(netdissect_options *ndo, ND_PRINT(" expires"); DATEOUT(); ND_TCHECK_4(bp); - t = EXTRACT_BE_U_4(bp); + t = GET_BE_U_4(bp); bp += sizeof(uint32_t); tok2str(cb_types, "type %u", t); } @@ -1325,7 +1325,7 @@ cb_reply_print(netdissect_options *ndo, ND_PRINT(" cb reply %s", tok2str(cb_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -1374,7 +1374,7 @@ prot_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - pt_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + pt_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" pt"); @@ -1427,7 +1427,7 @@ prot_print(netdissect_options *ndo, { uint32_t j; ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); /* @@ -1449,7 +1449,7 @@ prot_print(netdissect_options *ndo, uint32_t j; ND_PRINT(" ids:"); ND_TCHECK_4(bp); - i = EXTRACT_BE_U_4(bp); + i = GET_BE_U_4(bp); bp += sizeof(uint32_t); for (j = 0; j < i; j++) INTOUT(); @@ -1527,7 +1527,7 @@ prot_reply_print(netdissect_options *ndo, ND_PRINT(" reply %s", tok2str(pt_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -1541,7 +1541,7 @@ prot_reply_print(netdissect_options *ndo, uint32_t j; ND_PRINT(" ids:"); ND_TCHECK_4(bp); - i = EXTRACT_BE_U_4(bp); + i = GET_BE_U_4(bp); bp += sizeof(uint32_t); for (j = 0; j < i; j++) INTOUT(); @@ -1553,7 +1553,7 @@ prot_reply_print(netdissect_options *ndo, { uint32_t j; ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); /* @@ -1578,7 +1578,7 @@ prot_reply_print(netdissect_options *ndo, { uint32_t j; ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); for (i = 0; i < j; i++) { INTOUT(); @@ -1630,7 +1630,7 @@ vldb_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - vldb_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + vldb_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" vldb"); @@ -1660,7 +1660,7 @@ vldb_print(netdissect_options *ndo, ND_PRINT(" volid"); INTOUT(); ND_TCHECK_4(bp); - i = EXTRACT_BE_U_4(bp); + i = GET_BE_U_4(bp); bp += sizeof(uint32_t); if (i <= 2) ND_PRINT(" type %s", voltype[i]); @@ -1680,7 +1680,7 @@ vldb_print(netdissect_options *ndo, ND_PRINT(" volid"); INTOUT(); ND_TCHECK_4(bp); - i = EXTRACT_BE_U_4(bp); + i = GET_BE_U_4(bp); bp += sizeof(uint32_t); if (i <= 2) ND_PRINT(" type %s", voltype[i]); @@ -1733,7 +1733,7 @@ vldb_reply_print(netdissect_options *ndo, ND_PRINT(" reply %s", tok2str(vldb_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -1756,7 +1756,7 @@ vldb_reply_print(netdissect_options *ndo, bp += sizeof(uint32_t); ND_PRINT(" numservers"); ND_TCHECK_4(bp); - nservers = EXTRACT_BE_U_4(bp); + nservers = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_PRINT(" %u", nservers); ND_PRINT(" servers"); @@ -1764,13 +1764,13 @@ vldb_reply_print(netdissect_options *ndo, ND_TCHECK_4(bp); if (i < nservers) ND_PRINT(" %s", - intoa(EXTRACT_IPV4_TO_NETWORK_ORDER(bp))); + intoa(GET_IPV4_TO_NETWORK_ORDER(bp))); bp += sizeof(nd_ipv4); } ND_PRINT(" partitions"); for (i = 0; i < 8; i++) { ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); if (i < nservers && j <= 26) ND_PRINT(" %c", 'a' + j); else if (i < nservers) @@ -1804,7 +1804,7 @@ vldb_reply_print(netdissect_options *ndo, VECOUT(VLNAMEMAX); ND_PRINT(" numservers"); ND_TCHECK_4(bp); - nservers = EXTRACT_BE_U_4(bp); + nservers = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_PRINT(" %u", nservers); ND_PRINT(" servers"); @@ -1812,13 +1812,13 @@ vldb_reply_print(netdissect_options *ndo, ND_TCHECK_4(bp); if (i < nservers) ND_PRINT(" %s", - intoa(EXTRACT_IPV4_TO_NETWORK_ORDER(bp))); + intoa(GET_IPV4_TO_NETWORK_ORDER(bp))); bp += sizeof(nd_ipv4); } ND_PRINT(" partitions"); for (i = 0; i < 13; i++) { ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); if (i < nservers && j <= 26) ND_PRINT(" %c", 'a' + j); else if (i < nservers) @@ -1841,7 +1841,7 @@ vldb_reply_print(netdissect_options *ndo, VECOUT(VLNAMEMAX); ND_PRINT(" numservers"); ND_TCHECK_4(bp); - nservers = EXTRACT_BE_U_4(bp); + nservers = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_PRINT(" %u", nservers); ND_PRINT(" servers"); @@ -1859,7 +1859,7 @@ vldb_reply_print(netdissect_options *ndo, ND_PRINT(" partitions"); for (i = 0; i < 13; i++) { ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); if (i < nservers && j <= 26) ND_PRINT(" %c", 'a' + j); else if (i < nservers) @@ -1912,7 +1912,7 @@ kauth_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - kauth_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + kauth_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" kauth"); @@ -1954,7 +1954,7 @@ kauth_print(netdissect_options *ndo, ND_PRINT(" domain"); STROUT(KANAMEMAX); ND_TCHECK_4(bp); - i = EXTRACT_BE_U_4(bp); + i = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_TCHECK_LEN(bp, i); bp += i; @@ -2014,7 +2014,7 @@ kauth_reply_print(netdissect_options *ndo, ND_PRINT(" reply %s", tok2str(kauth_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -2057,7 +2057,7 @@ vol_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - vol_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + vol_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" vol call %s", tok2str(vol_req, "op#%u", vol_op)); @@ -2209,7 +2209,7 @@ vol_print(netdissect_options *ndo, { uint32_t i, j; ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); for (i = 0; i < j; i++) { DESTSERVEROUT(); @@ -2260,7 +2260,7 @@ vol_reply_print(netdissect_options *ndo, ND_PRINT(" vol reply %s", tok2str(vol_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -2339,7 +2339,7 @@ vol_reply_print(netdissect_options *ndo, { uint32_t i, j; ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); for (i = 0; i < j; i++) { ND_PRINT(" name"); @@ -2393,7 +2393,7 @@ bos_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - bos_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + bos_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" bos call %s", tok2str(bos_req, "op#%u", bos_op)); @@ -2486,7 +2486,7 @@ bos_reply_print(netdissect_options *ndo, ND_PRINT(" bos reply %s", tok2str(bos_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -2544,7 +2544,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_U_4(bp + sizeof(struct rx_header)); + ubik_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" ubik call %s", tok2str(ubik_req, "op#%u", ubik_op)); @@ -2557,7 +2557,7 @@ ubik_print(netdissect_options *ndo, switch (ubik_op) { case 10000: /* Beacon */ ND_TCHECK_4(bp); - temp = EXTRACT_BE_U_4(bp); + temp = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_PRINT(" syncsite %s", temp ? "yes" : "no"); ND_PRINT(" votestart"); @@ -2589,7 +2589,7 @@ ubik_print(netdissect_options *ndo, ND_PRINT(" length"); INTOUT(); ND_TCHECK_4(bp); - temp = EXTRACT_BE_U_4(bp); + temp = GET_BE_U_4(bp); bp += sizeof(uint32_t); tok2str(ubik_lock_types, "type %u", temp); break; @@ -2662,7 +2662,7 @@ ubik_reply_print(netdissect_options *ndo, ND_PRINT(" ubik reply %s", tok2str(ubik_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -2734,13 +2734,13 @@ rx_ack_print(netdissect_options *ndo, if (ndo->ndo_vflag > 2) ND_PRINT(" bufspace %u maxskew %u", - EXTRACT_BE_U_2(rxa->bufferSpace), - EXTRACT_BE_U_2(rxa->maxSkew)); + GET_BE_U_2(rxa->bufferSpace), + GET_BE_U_2(rxa->maxSkew)); - firstPacket = EXTRACT_BE_U_4(rxa->firstPacket); + firstPacket = GET_BE_U_4(rxa->firstPacket); ND_PRINT(" first %u serial %u reason %s", - firstPacket, EXTRACT_BE_U_4(rxa->serial), - tok2str(rx_ack_reasons, "#%u", EXTRACT_U_1(rxa->reason))); + firstPacket, GET_BE_U_4(rxa->serial), + tok2str(rx_ack_reasons, "#%u", GET_U_1(rxa->reason))); /* * Okay, now we print out the ack array. The way _this_ works @@ -2761,7 +2761,7 @@ rx_ack_print(netdissect_options *ndo, * to bp after this, so bp ends up at the right spot. Go figure. */ - nAcks = EXTRACT_U_1(rxa->nAcks); + nAcks = GET_U_1(rxa->nAcks); if (nAcks != 0) { ND_TCHECK_LEN(bp, nAcks); @@ -2772,7 +2772,7 @@ rx_ack_print(netdissect_options *ndo, */ for (i = 0, start = last = -2; i < nAcks; i++) - if (EXTRACT_U_1(bp + i) == RX_ACK_TYPE_ACK) { + if (GET_U_1(bp + i) == RX_ACK_TYPE_ACK) { /* * I figured this deserved _some_ explanation. @@ -2843,7 +2843,7 @@ rx_ack_print(netdissect_options *ndo, */ for (i = 0, start = last = -2; i < nAcks; i++) - if (EXTRACT_U_1(bp + i) == RX_ACK_TYPE_NACK) { + if (GET_U_1(bp + i) == RX_ACK_TYPE_NACK) { if (last == -2) { ND_PRINT(" nacked %u", firstPacket + i); start = i; diff --git a/print-sctp.c b/print-sctp.c index 519cf518..e0c22076 100644 --- a/print-sctp.c +++ b/print-sctp.c @@ -475,8 +475,8 @@ sctp_print(netdissect_options *ndo, ND_TCHECK_SIZE(sctpPktHdr); sctpPacketLengthRemaining = sctpPacketLength; - sourcePort = EXTRACT_BE_U_2(sctpPktHdr->source); - destPort = EXTRACT_BE_U_2(sctpPktHdr->destination); + sourcePort = GET_BE_U_2(sctpPktHdr->source); + destPort = GET_BE_U_2(sctpPktHdr->destination); ip = (const struct ip *)bp2; if (IP_V(ip) == 6) @@ -529,7 +529,7 @@ sctp_print(netdissect_options *ndo, break; } ND_TCHECK_SIZE(chunkDescPtr); - chunkLength = EXTRACT_BE_U_2(chunkDescPtr->chunkLength); + chunkLength = GET_BE_U_2(chunkDescPtr->chunkLength); if (chunkLength < sizeof(*chunkDescPtr)) { ND_PRINT("%s%u) [Bad chunk length %u, < size of chunk descriptor]", sep, chunkCount+1, chunkLength); break; @@ -552,7 +552,7 @@ sctp_print(netdissect_options *ndo, chunkLengthRemaining -= sizeof(*chunkDescPtr); ND_PRINT("%s%u) ", sep, chunkCount+1); - chunkID = EXTRACT_U_1(chunkDescPtr->chunkID); + chunkID = GET_U_1(chunkDescPtr->chunkID); ND_PRINT("[%s] ", tok2str(sctp_chunkid_str, "Unknown chunk type: 0x%x", chunkID)); switch (chunkID) @@ -564,7 +564,7 @@ sctp_print(netdissect_options *ndo, uint32_t ppid; u_int payload_size; - chunkFlg = EXTRACT_U_1(chunkDescPtr->chunkFlg); + chunkFlg = GET_U_1(chunkDescPtr->chunkFlg); if ((chunkFlg & SCTP_DATA_UNORDERED) == SCTP_DATA_UNORDERED) ND_PRINT("(U)"); @@ -585,10 +585,10 @@ sctp_print(netdissect_options *ndo, } dataHdrPtr=(const struct sctpDataPart*)bp; - ppid = EXTRACT_BE_U_4(dataHdrPtr->payloadtype); - ND_PRINT("[TSN: %u] ", EXTRACT_BE_U_4(dataHdrPtr->TSN)); - ND_PRINT("[SID: %u] ", EXTRACT_BE_U_2(dataHdrPtr->streamId)); - ND_PRINT("[SSEQ %u] ", EXTRACT_BE_U_2(dataHdrPtr->sequence)); + ppid = GET_BE_U_4(dataHdrPtr->payloadtype); + ND_PRINT("[TSN: %u] ", GET_BE_U_4(dataHdrPtr->TSN)); + ND_PRINT("[SID: %u] ", GET_BE_U_2(dataHdrPtr->streamId)); + ND_PRINT("[SSEQ %u] ", GET_BE_U_2(dataHdrPtr->sequence)); ND_PRINT("[PPID %s] ", tok2str(PayloadProto_idents, "0x%x", ppid)); @@ -643,11 +643,11 @@ sctp_print(netdissect_options *ndo, return; } init=(const struct sctpInitiation*)bp; - ND_PRINT("[init tag: %u] ", EXTRACT_BE_U_4(init->initTag)); - ND_PRINT("[rwnd: %u] ", EXTRACT_BE_U_4(init->rcvWindowCredit)); - ND_PRINT("[OS: %u] ", EXTRACT_BE_U_2(init->NumPreopenStreams)); - ND_PRINT("[MIS: %u] ", EXTRACT_BE_U_2(init->MaxInboundStreams)); - ND_PRINT("[init TSN: %u] ", EXTRACT_BE_U_4(init->initialTSN)); + ND_PRINT("[init tag: %u] ", GET_BE_U_4(init->initTag)); + ND_PRINT("[rwnd: %u] ", GET_BE_U_4(init->rcvWindowCredit)); + ND_PRINT("[OS: %u] ", GET_BE_U_2(init->NumPreopenStreams)); + ND_PRINT("[MIS: %u] ", GET_BE_U_2(init->MaxInboundStreams)); + ND_PRINT("[init TSN: %u] ", GET_BE_U_4(init->initialTSN)); bp += sizeof(*init); sctpPacketLengthRemaining -= sizeof(*init); chunkLengthRemaining -= sizeof(*init); @@ -671,11 +671,11 @@ sctp_print(netdissect_options *ndo, return; } init=(const struct sctpInitiation*)bp; - ND_PRINT("[init tag: %u] ", EXTRACT_BE_U_4(init->initTag)); - ND_PRINT("[rwnd: %u] ", EXTRACT_BE_U_4(init->rcvWindowCredit)); - ND_PRINT("[OS: %u] ", EXTRACT_BE_U_2(init->NumPreopenStreams)); - ND_PRINT("[MIS: %u] ", EXTRACT_BE_U_2(init->MaxInboundStreams)); - ND_PRINT("[init TSN: %u] ", EXTRACT_BE_U_4(init->initialTSN)); + ND_PRINT("[init tag: %u] ", GET_BE_U_4(init->initTag)); + ND_PRINT("[rwnd: %u] ", GET_BE_U_4(init->rcvWindowCredit)); + ND_PRINT("[OS: %u] ", GET_BE_U_2(init->NumPreopenStreams)); + ND_PRINT("[MIS: %u] ", GET_BE_U_2(init->MaxInboundStreams)); + ND_PRINT("[init TSN: %u] ", GET_BE_U_4(init->initialTSN)); bp += sizeof(*init); sctpPacketLengthRemaining -= sizeof(*init); chunkLengthRemaining -= sizeof(*init); @@ -702,10 +702,10 @@ sctp_print(netdissect_options *ndo, return; } sack=(const struct sctpSelectiveAck*)bp; - ND_PRINT("[cum ack %u] ", EXTRACT_BE_U_4(sack->highestConseqTSN)); - ND_PRINT("[a_rwnd %u] ", EXTRACT_BE_U_4(sack->updatedRwnd)); - ND_PRINT("[#gap acks %u] ", EXTRACT_BE_U_2(sack->numberOfdesc)); - ND_PRINT("[#dup tsns %u] ", EXTRACT_BE_U_2(sack->numDupTsns)); + ND_PRINT("[cum ack %u] ", GET_BE_U_4(sack->highestConseqTSN)); + ND_PRINT("[a_rwnd %u] ", GET_BE_U_4(sack->updatedRwnd)); + ND_PRINT("[#gap acks %u] ", GET_BE_U_2(sack->numberOfdesc)); + ND_PRINT("[#dup tsns %u] ", GET_BE_U_2(sack->numDupTsns)); bp += sizeof(*sack); sctpPacketLengthRemaining -= sizeof(*sack); chunkLengthRemaining -= sizeof(*sack); @@ -713,7 +713,7 @@ sctp_print(netdissect_options *ndo, /* print gaps */ for (fragNo=0; - chunkLengthRemaining != 0 && fragNo < EXTRACT_BE_U_2(sack->numberOfdesc); + chunkLengthRemaining != 0 && fragNo < GET_BE_U_2(sack->numberOfdesc); bp += sizeof(*frag), sctpPacketLengthRemaining -= sizeof(*frag), chunkLengthRemaining -= sizeof(*frag), fragNo++) { if (chunkLengthRemaining < sizeof(*frag)) { ND_PRINT("bogus chunk length %u]", chunkLength); @@ -722,13 +722,13 @@ sctp_print(netdissect_options *ndo, frag = (const struct sctpSelectiveFrag *)bp; ND_PRINT("\n\t\t[gap ack block #%u: start = %u, end = %u] ", fragNo+1, - EXTRACT_BE_U_4(sack->highestConseqTSN) + EXTRACT_BE_U_2(frag->fragmentStart), - EXTRACT_BE_U_4(sack->highestConseqTSN) + EXTRACT_BE_U_2(frag->fragmentEnd)); + GET_BE_U_4(sack->highestConseqTSN) + GET_BE_U_2(frag->fragmentStart), + GET_BE_U_4(sack->highestConseqTSN) + GET_BE_U_2(frag->fragmentEnd)); } /* print duplicate TSNs */ for (tsnNo=0; - chunkLengthRemaining != 0 && tsnNo<EXTRACT_BE_U_2(sack->numDupTsns); + chunkLengthRemaining != 0 && tsnNo<GET_BE_U_2(sack->numDupTsns); bp += 4, sctpPacketLengthRemaining -= 4, chunkLengthRemaining -= 4, tsnNo++) { if (chunkLengthRemaining < 4) { ND_PRINT("bogus chunk length %u]", chunkLength); @@ -736,7 +736,7 @@ sctp_print(netdissect_options *ndo, } dupTSN = (const u_char *)bp; ND_PRINT("\n\t\t[dup TSN #%u: %u] ", tsnNo+1, - EXTRACT_BE_U_4(dupTSN)); + GET_BE_U_4(dupTSN)); } break; } diff --git a/print-sflow.c b/print-sflow.c index 78aaafb6..68bca017 100644 --- a/print-sflow.c +++ b/print-sflow.c @@ -310,36 +310,36 @@ print_sflow_counter_generic(netdissect_options *ndo, sflow_gen_counter = (const struct sflow_generic_counter_t *)pointer; ND_TCHECK_SIZE(sflow_gen_counter); ND_PRINT("\n\t ifindex %u, iftype %u, ifspeed %" PRIu64 ", ifdirection %u (%s)", - 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), + GET_BE_U_4(sflow_gen_counter->ifindex), + GET_BE_U_4(sflow_gen_counter->iftype), + GET_BE_U_8(sflow_gen_counter->ifspeed), + GET_BE_U_4(sflow_gen_counter->ifdirection), tok2str(sflow_iface_direction_values, "Unknown", - EXTRACT_BE_U_4(sflow_gen_counter->ifdirection))); + GET_BE_U_4(sflow_gen_counter->ifdirection))); ND_PRINT("\n\t ifstatus %u, adminstatus: %s, operstatus: %s", - 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"); + GET_BE_U_4(sflow_gen_counter->ifstatus), + GET_BE_U_4(sflow_gen_counter->ifstatus)&1 ? "up" : "down", + (GET_BE_U_4(sflow_gen_counter->ifstatus)>>1)&1 ? "up" : "down"); ND_PRINT("\n\t In octets %" PRIu64 ", unicast pkts %u, multicast pkts %u, broadcast pkts %u, discards %u", - 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)); + GET_BE_U_8(sflow_gen_counter->ifinoctets), + GET_BE_U_4(sflow_gen_counter->ifinunicastpkts), + GET_BE_U_4(sflow_gen_counter->ifinmulticastpkts), + GET_BE_U_4(sflow_gen_counter->ifinbroadcastpkts), + GET_BE_U_4(sflow_gen_counter->ifindiscards)); ND_PRINT("\n\t In errors %u, unknown protos %u", - EXTRACT_BE_U_4(sflow_gen_counter->ifinerrors), - EXTRACT_BE_U_4(sflow_gen_counter->ifinunkownprotos)); + GET_BE_U_4(sflow_gen_counter->ifinerrors), + GET_BE_U_4(sflow_gen_counter->ifinunkownprotos)); ND_PRINT("\n\t Out octets %" PRIu64 ", unicast pkts %u, multicast pkts %u, broadcast pkts %u, discards %u", - 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)); + GET_BE_U_8(sflow_gen_counter->ifoutoctets), + GET_BE_U_4(sflow_gen_counter->ifoutunicastpkts), + GET_BE_U_4(sflow_gen_counter->ifoutmulticastpkts), + GET_BE_U_4(sflow_gen_counter->ifoutbroadcastpkts), + GET_BE_U_4(sflow_gen_counter->ifoutdiscards)); ND_PRINT("\n\t Out errors %u, promisc mode %u", - EXTRACT_BE_U_4(sflow_gen_counter->ifouterrors), - EXTRACT_BE_U_4(sflow_gen_counter->ifpromiscmode)); + GET_BE_U_4(sflow_gen_counter->ifouterrors), + GET_BE_U_4(sflow_gen_counter->ifpromiscmode)); return 0; @@ -359,21 +359,21 @@ print_sflow_counter_ethernet(netdissect_options *ndo, sflow_eth_counter = (const struct sflow_ethernet_counter_t *)pointer; ND_TCHECK_SIZE(sflow_eth_counter); ND_PRINT("\n\t align errors %u, fcs errors %u, single collision %u, multiple collision %u, test error %u", - 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)); + GET_BE_U_4(sflow_eth_counter->alignerrors), + GET_BE_U_4(sflow_eth_counter->fcserrors), + GET_BE_U_4(sflow_eth_counter->single_collision_frames), + GET_BE_U_4(sflow_eth_counter->multiple_collision_frames), + GET_BE_U_4(sflow_eth_counter->test_errors)); ND_PRINT("\n\t deferred %u, late collision %u, excessive collision %u, mac trans error %u", - 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)); + GET_BE_U_4(sflow_eth_counter->deferred_transmissions), + GET_BE_U_4(sflow_eth_counter->late_collisions), + GET_BE_U_4(sflow_eth_counter->excessive_collisions), + GET_BE_U_4(sflow_eth_counter->mac_transmit_errors)); ND_PRINT("\n\t carrier error %u, frames too long %u, mac receive errors %u, symbol errors %u", - 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)); + GET_BE_U_4(sflow_eth_counter->carrier_sense_errors), + GET_BE_U_4(sflow_eth_counter->frame_too_longs), + GET_BE_U_4(sflow_eth_counter->mac_receive_errors), + GET_BE_U_4(sflow_eth_counter->symbol_errors)); return 0; @@ -400,27 +400,27 @@ print_sflow_counter_basevg(netdissect_options *ndo, sflow_100basevg_counter = (const struct sflow_100basevg_counter_t *)pointer; ND_TCHECK_SIZE(sflow_100basevg_counter); ND_PRINT("\n\t in high prio frames %u, in high prio octets %" PRIu64, - EXTRACT_BE_U_4(sflow_100basevg_counter->in_highpriority_frames), - EXTRACT_BE_U_8(sflow_100basevg_counter->in_highpriority_octets)); + GET_BE_U_4(sflow_100basevg_counter->in_highpriority_frames), + GET_BE_U_8(sflow_100basevg_counter->in_highpriority_octets)); ND_PRINT("\n\t in norm prio frames %u, in norm prio octets %" PRIu64, - EXTRACT_BE_U_4(sflow_100basevg_counter->in_normpriority_frames), - EXTRACT_BE_U_8(sflow_100basevg_counter->in_normpriority_octets)); + GET_BE_U_4(sflow_100basevg_counter->in_normpriority_frames), + GET_BE_U_8(sflow_100basevg_counter->in_normpriority_octets)); ND_PRINT("\n\t in ipm errors %u, oversized %u, in data errors %u, null addressed frames %u", - 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)); + GET_BE_U_4(sflow_100basevg_counter->in_ipmerrors), + GET_BE_U_4(sflow_100basevg_counter->in_oversized), + GET_BE_U_4(sflow_100basevg_counter->in_data_errors), + GET_BE_U_4(sflow_100basevg_counter->in_null_addressed_frames)); ND_PRINT("\n\t out high prio frames %u, out high prio octets %" PRIu64 ", trans into frames %u", - 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)); + GET_BE_U_4(sflow_100basevg_counter->out_highpriority_frames), + GET_BE_U_8(sflow_100basevg_counter->out_highpriority_octets), + GET_BE_U_4(sflow_100basevg_counter->transitioninto_frames)); ND_PRINT("\n\t in hc high prio octets %" PRIu64 ", in hc norm prio octets %" PRIu64 ", out hc high prio octets %" PRIu64, - 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)); + GET_BE_U_8(sflow_100basevg_counter->hc_in_highpriority_octets), + GET_BE_U_8(sflow_100basevg_counter->hc_in_normpriority_octets), + GET_BE_U_8(sflow_100basevg_counter->hc_out_highpriority_octets)); return 0; @@ -441,12 +441,12 @@ print_sflow_counter_vlan(netdissect_options *ndo, ND_TCHECK_SIZE(sflow_vlan_counter); ND_PRINT("\n\t vlan_id %u, octets %" PRIu64 ", unicast_pkt %u, multicast_pkt %u, broadcast_pkt %u, discards %u", - 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)); + GET_BE_U_4(sflow_vlan_counter->vlan_id), + GET_BE_U_8(sflow_vlan_counter->octets), + GET_BE_U_4(sflow_vlan_counter->unicast_pkt), + GET_BE_U_4(sflow_vlan_counter->multicast_pkt), + GET_BE_U_4(sflow_vlan_counter->broadcast_pkt), + GET_BE_U_4(sflow_vlan_counter->discards)); return 0; @@ -475,11 +475,11 @@ print_sflow_counter_processor(netdissect_options *ndo, ND_TCHECK_SIZE(sflow_processor_counter); ND_PRINT("\n\t 5sec %u, 1min %u, 5min %u, total_mem %" PRIu64 ", total_mem %" PRIu64, - 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)); + GET_BE_U_4(sflow_processor_counter->five_sec_util), + GET_BE_U_4(sflow_processor_counter->one_min_util), + GET_BE_U_4(sflow_processor_counter->five_min_util), + GET_BE_U_8(sflow_processor_counter->total_memory), + GET_BE_U_8(sflow_processor_counter->free_memory)); return 0; @@ -510,10 +510,10 @@ sflow_print_counter_records(netdissect_options *ndo, sflow_counter_record = (const struct sflow_counter_record_t *)tptr; ND_TCHECK_SIZE(sflow_counter_record); - enterprise = EXTRACT_BE_U_4(sflow_counter_record->format); + enterprise = GET_BE_U_4(sflow_counter_record->format); counter_type = enterprise & 0x0FFF; enterprise = enterprise >> 20; - counter_len = EXTRACT_BE_U_4(sflow_counter_record->length); + counter_len = GET_BE_U_4(sflow_counter_record->length); ND_PRINT("\n\t enterprise %u, %s (%u) length %u", enterprise, (enterprise == 0) ? tok2str(sflow_counter_type_values,"Unknown",counter_type) : "Unknown", @@ -582,12 +582,12 @@ sflow_print_counter_sample(netdissect_options *ndo, sflow_counter_sample = (const struct sflow_counter_sample_t *)pointer; ND_TCHECK_SIZE(sflow_counter_sample); - nrecords = EXTRACT_BE_U_4(sflow_counter_sample->records); + nrecords = GET_BE_U_4(sflow_counter_sample->records); ND_PRINT(" seqnum %u, type %u, idx %u, records %u", - EXTRACT_BE_U_4(sflow_counter_sample->seqnum), - EXTRACT_U_1(sflow_counter_sample->type), - EXTRACT_BE_U_3(sflow_counter_sample->index), + GET_BE_U_4(sflow_counter_sample->seqnum), + GET_U_1(sflow_counter_sample->type), + GET_BE_U_3(sflow_counter_sample->index), nrecords); return sflow_print_counter_records(ndo, pointer + sizeof(struct sflow_counter_sample_t), @@ -612,12 +612,12 @@ sflow_print_expanded_counter_sample(netdissect_options *ndo, sflow_expanded_counter_sample = (const struct sflow_expanded_counter_sample_t *)pointer; ND_TCHECK_SIZE(sflow_expanded_counter_sample); - nrecords = EXTRACT_BE_U_4(sflow_expanded_counter_sample->records); + nrecords = GET_BE_U_4(sflow_expanded_counter_sample->records); ND_PRINT(" seqnum %u, type %u, idx %u, records %u", - 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), + GET_BE_U_4(sflow_expanded_counter_sample->seqnum), + GET_BE_U_4(sflow_expanded_counter_sample->type), + GET_BE_U_4(sflow_expanded_counter_sample->index), nrecords); return sflow_print_counter_records(ndo, pointer + sizeof(struct sflow_expanded_counter_sample_t), @@ -640,11 +640,11 @@ print_sflow_raw_packet(netdissect_options *ndo, sflow_flow_raw = (const struct sflow_expanded_flow_raw_t *)pointer; ND_TCHECK_SIZE(sflow_flow_raw); ND_PRINT("\n\t protocol %s (%u), length %u, stripped bytes %u, header_size %u", - 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)); + tok2str(sflow_flow_raw_protocol_values,"Unknown",GET_BE_U_4(sflow_flow_raw->protocol)), + GET_BE_U_4(sflow_flow_raw->protocol), + GET_BE_U_4(sflow_flow_raw->length), + GET_BE_U_4(sflow_flow_raw->stripped_bytes), + GET_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... */ @@ -668,8 +668,8 @@ print_sflow_ethernet_frame(netdissect_options *ndo, ND_TCHECK_SIZE(sflow_ethernet_frame); ND_PRINT("\n\t frame len %u, type %u", - EXTRACT_BE_U_4(sflow_ethernet_frame->length), - EXTRACT_BE_U_4(sflow_ethernet_frame->type)); + GET_BE_U_4(sflow_ethernet_frame->length), + GET_BE_U_4(sflow_ethernet_frame->type)); return 0; @@ -689,10 +689,10 @@ print_sflow_extended_switch_data(netdissect_options *ndo, sflow_extended_sw_data = (const struct sflow_extended_switch_data_t *)pointer; ND_TCHECK_SIZE(sflow_extended_sw_data); ND_PRINT("\n\t src vlan %u, src pri %u, dst vlan %u, dst pri %u", - 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)); + GET_BE_U_4(sflow_extended_sw_data->src_vlan), + GET_BE_U_4(sflow_extended_sw_data->src_pri), + GET_BE_U_4(sflow_extended_sw_data->dst_vlan), + GET_BE_U_4(sflow_extended_sw_data->dst_pri)); return 0; @@ -727,10 +727,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_U_4(sflow_flow_record->format); + enterprise = GET_BE_U_4(sflow_flow_record->format); flow_type = enterprise & 0x0FFF; enterprise = enterprise >> 12; - flow_len = EXTRACT_BE_U_4(sflow_flow_record->length); + flow_len = GET_BE_U_4(sflow_flow_record->length); ND_PRINT("\n\t enterprise %u %s (%u) length %u", enterprise, (enterprise == 0) ? tok2str(sflow_flow_type_values,"Unknown",flow_type) : "Unknown", @@ -803,17 +803,17 @@ sflow_print_flow_sample(netdissect_options *ndo, sflow_flow_sample = (const struct sflow_flow_sample_t *)pointer; ND_TCHECK_SIZE(sflow_flow_sample); - nrecords = EXTRACT_BE_U_4(sflow_flow_sample->records); + nrecords = GET_BE_U_4(sflow_flow_sample->records); ND_PRINT(" seqnum %u, type %u, idx %u, rate %u, pool %u, drops %u, input %u output %u records %u", - EXTRACT_BE_U_4(sflow_flow_sample->seqnum), - EXTRACT_U_1(sflow_flow_sample->type), - EXTRACT_BE_U_3(sflow_flow_sample->index), - 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), + GET_BE_U_4(sflow_flow_sample->seqnum), + GET_U_1(sflow_flow_sample->type), + GET_BE_U_3(sflow_flow_sample->index), + GET_BE_U_4(sflow_flow_sample->rate), + GET_BE_U_4(sflow_flow_sample->pool), + GET_BE_U_4(sflow_flow_sample->drops), + GET_BE_U_4(sflow_flow_sample->in_interface), + GET_BE_U_4(sflow_flow_sample->out_interface), nrecords); return sflow_print_flow_records(ndo, pointer + sizeof(struct sflow_flow_sample_t), @@ -837,16 +837,16 @@ sflow_print_expanded_flow_sample(netdissect_options *ndo, sflow_expanded_flow_sample = (const struct sflow_expanded_flow_sample_t *)pointer; ND_TCHECK_SIZE(sflow_expanded_flow_sample); - nrecords = EXTRACT_BE_U_4(sflow_expanded_flow_sample->records); + nrecords = GET_BE_U_4(sflow_expanded_flow_sample->records); ND_PRINT(" seqnum %u, type %u, idx %u, rate %u, pool %u, drops %u, records %u", - 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)); + GET_BE_U_4(sflow_expanded_flow_sample->seqnum), + GET_BE_U_4(sflow_expanded_flow_sample->type), + GET_BE_U_4(sflow_expanded_flow_sample->index), + GET_BE_U_4(sflow_expanded_flow_sample->rate), + GET_BE_U_4(sflow_expanded_flow_sample->pool), + GET_BE_U_4(sflow_expanded_flow_sample->drops), + GET_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), @@ -877,31 +877,31 @@ sflow_print(netdissect_options *ndo, /* * Sanity checking of the header. */ - if (EXTRACT_BE_U_4(sflow_datagram->version) != 5) { + if (GET_BE_U_4(sflow_datagram->version) != 5) { ND_PRINT("sFlow version %u packet not supported", - EXTRACT_BE_U_4(sflow_datagram->version)); + GET_BE_U_4(sflow_datagram->version)); return; } if (ndo->ndo_vflag < 1) { ND_PRINT("sFlowv%u, %s agent %s, agent-id %u, length %u", - EXTRACT_BE_U_4(sflow_datagram->version), - EXTRACT_BE_U_4(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6", + GET_BE_U_4(sflow_datagram->version), + GET_BE_U_4(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6", ipaddr_string(ndo, sflow_datagram->agent), - EXTRACT_BE_U_4(sflow_datagram->agent_id), + GET_BE_U_4(sflow_datagram->agent_id), len); return; } /* ok they seem to want to know everything - lets fully decode it */ - nsamples=EXTRACT_BE_U_4(sflow_datagram->samples); + nsamples=GET_BE_U_4(sflow_datagram->samples); ND_PRINT("sFlowv%u, %s agent %s, agent-id %u, seqnum %u, uptime %u, samples %u, length %u", - EXTRACT_BE_U_4(sflow_datagram->version), - EXTRACT_BE_U_4(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6", + GET_BE_U_4(sflow_datagram->version), + GET_BE_U_4(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6", ipaddr_string(ndo, sflow_datagram->agent), - EXTRACT_BE_U_4(sflow_datagram->agent_id), - EXTRACT_BE_U_4(sflow_datagram->seqnum), - EXTRACT_BE_U_4(sflow_datagram->uptime), + GET_BE_U_4(sflow_datagram->agent_id), + GET_BE_U_4(sflow_datagram->seqnum), + GET_BE_U_4(sflow_datagram->uptime), nsamples, len); @@ -913,8 +913,8 @@ sflow_print(netdissect_options *ndo, sflow_sample = (const struct sflow_sample_header *)tptr; ND_TCHECK_SIZE(sflow_sample); - sflow_sample_type = (EXTRACT_BE_U_4(sflow_sample->format)&0x0FFF); - sflow_sample_len = EXTRACT_BE_U_4(sflow_sample->len); + sflow_sample_type = (GET_BE_U_4(sflow_sample->format)&0x0FFF); + sflow_sample_len = GET_BE_U_4(sflow_sample->len); if (tlen < sizeof(struct sflow_sample_header)) goto trunc; @@ -134,7 +134,7 @@ sliplink_print(netdissect_options *ndo, int dir; u_int hlen; - dir = EXTRACT_U_1(p + SLX_DIR); + dir = GET_U_1(p + SLX_DIR); switch (dir) { case SLIPDIR_IN: @@ -150,7 +150,7 @@ sliplink_print(netdissect_options *ndo, dir = -1; break; } - switch (EXTRACT_U_1(p + SLX_CHDR) & 0xf0) { + switch (GET_U_1(p + SLX_CHDR) & 0xf0) { case TYPE_IP: ND_PRINT("ip %u: ", length + SLIP_HDRLEN); @@ -162,7 +162,7 @@ sliplink_print(netdissect_options *ndo, * Get it from the link layer since sl_uncompress_tcp() * has restored the IP header copy to IPPROTO_TCP. */ - lastconn = EXTRACT_U_1(((const struct ip *)(p + SLX_CHDR))->ip_p); + lastconn = GET_U_1(((const struct ip *)(p + SLX_CHDR))->ip_p); ND_PRINT("utcp %u: ", lastconn); if (dir == -1) { /* Direction is bogus, don't use it */ @@ -180,13 +180,13 @@ sliplink_print(netdissect_options *ndo, /* Direction is bogus, don't use it */ return 0; } - if (EXTRACT_U_1(p + SLX_CHDR) & TYPE_COMPRESSED_TCP) { + if (GET_U_1(p + SLX_CHDR) & TYPE_COMPRESSED_TCP) { if (compressed_sl_print(ndo, p + SLX_CHDR, ip, length, dir) == -1) goto trunc; ND_PRINT(": "); } else - ND_PRINT("slip-%u!: ", EXTRACT_U_1(p + SLX_CHDR)); + ND_PRINT("slip-%u!: ", GET_U_1(p + SLX_CHDR)); } return 0; trunc: @@ -199,9 +199,9 @@ print_sl_change(netdissect_options *ndo, { u_int i; - if ((i = EXTRACT_U_1(cp)) == 0) { + if ((i = GET_U_1(cp)) == 0) { cp++; - i = EXTRACT_BE_U_2(cp); + i = GET_BE_U_2(cp); cp += 2; } ND_PRINT(" %s%u", str, i); @@ -214,9 +214,9 @@ print_sl_winchange(netdissect_options *ndo, { int16_t i; - if ((i = EXTRACT_U_1(cp)) == 0) { + if ((i = GET_U_1(cp)) == 0) { cp++; - i = EXTRACT_BE_S_2(cp); + i = GET_BE_S_2(cp); cp += 2; } if (i >= 0) @@ -234,10 +234,10 @@ compressed_sl_print(netdissect_options *ndo, const u_char *cp = chdr; u_int flags, hlen; - flags = EXTRACT_U_1(cp); + flags = GET_U_1(cp); cp++; if (flags & NEW_C) { - lastconn = EXTRACT_U_1(cp); + lastconn = GET_U_1(cp); cp++; ND_PRINT("ctcp %u", lastconn); } else diff --git a/print-sll.c b/print-sll.c index e87bd032..d165da22 100644 --- a/print-sll.c +++ b/print-sll.c @@ -154,18 +154,19 @@ sll_print(netdissect_options *ndo, const struct sll_header *sllp, u_int length) u_short ether_type; ndo->ndo_protocol = "sll"; - ND_PRINT("%3s ",tok2str(sll_pkttype_values,"?",EXTRACT_BE_U_2(sllp->sll_pkttype))); + ND_PRINT("%3s ", + tok2str(sll_pkttype_values,"?",GET_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_U_2(sllp->sll_halen) == 6) + if (GET_BE_U_2(sllp->sll_halen) == 6) ND_PRINT("%s ", etheraddr_string(ndo, sllp->sll_addr)); if (!ndo->ndo_qflag) { - ether_type = EXTRACT_BE_U_2(sllp->sll_protocol); + ether_type = GET_BE_U_2(sllp->sll_protocol); if (ether_type <= MAX_ETHERNET_LENGTH_VAL) { /* @@ -245,7 +246,7 @@ sll_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char p += SLL_HDR_LEN; hdrlen = SLL_HDR_LEN; - hatype = EXTRACT_BE_U_2(sllp->sll_hatype); + hatype = GET_BE_U_2(sllp->sll_hatype); switch (hatype) { case 803: @@ -255,7 +256,7 @@ sll_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char */ return (SLL_HDR_LEN + ieee802_11_radio_print(ndo, p, length, caplen)); } - ether_type = EXTRACT_BE_U_2(sllp->sll_protocol); + ether_type = GET_BE_U_2(sllp->sll_protocol); recurse: /* @@ -306,12 +307,12 @@ recurse: return (hdrlen + caplen); } if (ndo->ndo_eflag) { - uint16_t tag = EXTRACT_BE_U_2(p); + uint16_t tag = GET_BE_U_2(p); ND_PRINT("%s, ", ieee8021q_tci_string(tag)); } - ether_type = EXTRACT_BE_U_2(p + 2); + ether_type = GET_BE_U_2(p + 2); if (ether_type <= MAX_ETHERNET_LENGTH_VAL) ether_type = LINUX_SLL_P_802_2; if (!ndo->ndo_qflag) { @@ -342,18 +343,19 @@ sll2_print(netdissect_options *ndo, const struct sll2_header *sllp, u_int length u_short ether_type; ndo->ndo_protocol = "sll2"; - ND_PRINT("%3s ",tok2str(sll_pkttype_values,"?",EXTRACT_U_1(sllp->sll2_pkttype))); + ND_PRINT("%3s ", + tok2str(sll_pkttype_values,"?",GET_U_1(sllp->sll2_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_U_1(sllp->sll2_halen) == 6) + if (GET_U_1(sllp->sll2_halen) == 6) ND_PRINT("%s ", etheraddr_string(ndo, sllp->sll2_addr)); if (!ndo->ndo_qflag) { - ether_type = EXTRACT_BE_U_2(sllp->sll2_protocol); + ether_type = GET_BE_U_2(sllp->sll2_protocol); if (ether_type <= MAX_ETHERNET_LENGTH_VAL) { /* @@ -426,7 +428,7 @@ sll2_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char sllp = (const struct sll2_header *)p; #ifdef HAVE_NET_IF_H - if_index = EXTRACT_BE_U_4(sllp->sll2_if_index); + if_index = GET_BE_U_4(sllp->sll2_if_index); if (if_indextoname(if_index, ifname)) ND_PRINT("ifindex %u (%s) ", if_index, ifname); else @@ -444,7 +446,7 @@ sll2_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char p += SLL2_HDR_LEN; hdrlen = SLL2_HDR_LEN; - hatype = EXTRACT_BE_U_2(sllp->sll2_hatype); + hatype = GET_BE_U_2(sllp->sll2_hatype); switch (hatype) { case 803: @@ -454,7 +456,7 @@ sll2_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char */ return (SLL_HDR_LEN + ieee802_11_radio_print(ndo, p, length, caplen)); } - ether_type = EXTRACT_BE_U_2(sllp->sll2_protocol); + ether_type = GET_BE_U_2(sllp->sll2_protocol); recurse: /* @@ -505,12 +507,12 @@ recurse: return (hdrlen + caplen); } if (ndo->ndo_eflag) { - uint16_t tag = EXTRACT_BE_U_2(p); + uint16_t tag = GET_BE_U_2(p); ND_PRINT("%s, ", ieee8021q_tci_string(tag)); } - ether_type = EXTRACT_BE_U_2(p + 2); + ether_type = GET_BE_U_2(p + 2); if (ether_type <= MAX_ETHERNET_LENGTH_VAL) ether_type = LINUX_SLL_P_802_2; if (!ndo->ndo_qflag) { diff --git a/print-slow.c b/print-slow.c index 4e0ab030..dc364cec 100644 --- a/print-slow.c +++ b/print-slow.c @@ -252,7 +252,7 @@ slow_print(netdissect_options *ndo, if (len < 1) goto tooshort; ND_TCHECK_1(pptr); - subtype = EXTRACT_U_1(pptr); + subtype = GET_U_1(pptr); /* * Sanity checking of the header. @@ -262,8 +262,9 @@ slow_print(netdissect_options *ndo, if (len < 2) goto tooshort; ND_TCHECK_1(pptr + 1); - if (EXTRACT_U_1(pptr + 1) != LACP_VERSION) { - ND_PRINT("LACP version %u packet not supported", EXTRACT_U_1(pptr + 1)); + if (GET_U_1(pptr + 1) != LACP_VERSION) { + ND_PRINT("LACP version %u packet not supported", + GET_U_1(pptr + 1)); return; } print_version = 1; @@ -273,8 +274,9 @@ slow_print(netdissect_options *ndo, if (len < 2) goto tooshort; ND_TCHECK_1(pptr + 1); - if (EXTRACT_U_1(pptr + 1) != MARKER_VERSION) { - ND_PRINT("MARKER version %u packet not supported", EXTRACT_U_1(pptr + 1)); + if (GET_U_1(pptr + 1) != MARKER_VERSION) { + ND_PRINT("MARKER version %u packet not supported", + GET_U_1(pptr + 1)); return; } print_version = 1; @@ -293,7 +295,7 @@ slow_print(netdissect_options *ndo, if (print_version == 1) { ND_PRINT("%sv%u, length %u", tok2str(slow_proto_values, "unknown (%u)", subtype), - EXTRACT_U_1((pptr + 1)), + GET_U_1((pptr + 1)), len); } else { /* some slow protos don't have a version number in the header */ @@ -366,8 +368,8 @@ slow_marker_lacp_print(netdissect_options *ndo, /* did we capture enough for fully decoding the tlv header ? */ ND_TCHECK_LEN(tptr, sizeof(struct tlv_header_t)); tlv_header = (const struct tlv_header_t *)tptr; - tlv_type = EXTRACT_U_1(tlv_header->type); - tlv_len = EXTRACT_U_1(tlv_header->length); + tlv_type = GET_U_1(tlv_header->type); + tlv_len = GET_U_1(tlv_header->length); ND_PRINT("\n\t%s TLV (0x%02x), length %u", tok2str(slow_tlv_values, @@ -417,13 +419,13 @@ slow_marker_lacp_print(netdissect_options *ndo, ND_PRINT("\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_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), + GET_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->sys_pri), + GET_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->key), + GET_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->port), + GET_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->port_pri), bittok2str(lacp_tlv_actor_partner_info_state_values, "none", - EXTRACT_U_1(tlv_ptr.lacp_tlv_actor_partner_info->state))); + GET_U_1(tlv_ptr.lacp_tlv_actor_partner_info->state))); break; @@ -438,7 +440,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("\n\t Max Delay %u", - EXTRACT_BE_U_2(tlv_ptr.lacp_tlv_collector_info->max_delay)); + GET_BE_U_2(tlv_ptr.lacp_tlv_collector_info->max_delay)); break; @@ -454,8 +456,8 @@ slow_marker_lacp_print(netdissect_options *ndo, ND_PRINT("\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_U_2(tlv_ptr.marker_tlv_marker_info->req_port), - EXTRACT_BE_U_4(tlv_ptr.marker_tlv_marker_info->req_trans_id)); + GET_BE_U_2(tlv_ptr.marker_tlv_marker_info->req_port), + GET_BE_U_4(tlv_ptr.marker_tlv_marker_info->req_trans_id)); break; @@ -525,12 +527,12 @@ slow_oam_print(netdissect_options *ndo, tptr += sizeof(struct slow_oam_common_header_t); tlen -= sizeof(struct slow_oam_common_header_t); - code = EXTRACT_U_1(ptr.slow_oam_common_header->code); + code = GET_U_1(ptr.slow_oam_common_header->code); ND_PRINT("\n\tCode %s OAM PDU, Flags [%s]", tok2str(slow_oam_code_values, "Unknown (%u)", code), bittok2str(slow_oam_flag_values, "none", - EXTRACT_BE_U_2(ptr.slow_oam_common_header->flags))); + GET_BE_U_2(ptr.slow_oam_common_header->flags))); switch (code) { case SLOW_OAM_CODE_INFO: @@ -539,8 +541,8 @@ slow_oam_print(netdissect_options *ndo, if (tlen < sizeof(*ptr.slow_oam_tlv_header)) goto tooshort; ND_TCHECK_SIZE(ptr.slow_oam_tlv_header); - type = EXTRACT_U_1(ptr.slow_oam_tlv_header->type); - length = EXTRACT_U_1(ptr.slow_oam_tlv_header->length); + type = GET_U_1(ptr.slow_oam_tlv_header->type); + length = GET_U_1(ptr.slow_oam_tlv_header->length); ND_PRINT("\n\t %s Information Type (%u), length %u", tok2str(slow_oam_info_type_values, "Reserved", type), type, @@ -571,7 +573,7 @@ slow_oam_print(netdissect_options *ndo, case SLOW_OAM_INFO_TYPE_REMOTE: tlv.slow_oam_info = (const struct slow_oam_info_t *)tptr; - if (EXTRACT_U_1(tlv.slow_oam_info->info_length) != + if (GET_U_1(tlv.slow_oam_info->info_length) != sizeof(struct slow_oam_info_t)) { ND_PRINT("\n\t ERROR: illegal length - should be %lu", (unsigned long) sizeof(struct slow_oam_info_t)); @@ -580,10 +582,10 @@ slow_oam_print(netdissect_options *ndo, } ND_PRINT("\n\t OAM-Version %u, Revision %u", - EXTRACT_U_1(tlv.slow_oam_info->oam_version), - EXTRACT_BE_U_2(tlv.slow_oam_info->revision)); + GET_U_1(tlv.slow_oam_info->oam_version), + GET_BE_U_2(tlv.slow_oam_info->revision)); - state = EXTRACT_U_1(tlv.slow_oam_info->state); + state = GET_U_1(tlv.slow_oam_info->state); ND_PRINT("\n\t State-Parser-Action %s, State-MUX-Action %s", tok2str(slow_oam_info_type_state_parser_values, "Reserved", state & OAM_INFO_TYPE_PARSER_MASK), @@ -591,14 +593,14 @@ slow_oam_print(netdissect_options *ndo, state & OAM_INFO_TYPE_MUX_MASK)); ND_PRINT("\n\t OAM-Config Flags [%s], OAM-PDU-Config max-PDU size %u", bittok2str(slow_oam_info_type_oam_config_values, "none", - EXTRACT_U_1(tlv.slow_oam_info->oam_config)), - EXTRACT_BE_U_2(tlv.slow_oam_info->oam_pdu_config) & + GET_U_1(tlv.slow_oam_info->oam_config)), + GET_BE_U_2(tlv.slow_oam_info->oam_pdu_config) & OAM_INFO_TYPE_PDU_SIZE_MASK); ND_PRINT("\n\t OUI %s (0x%06x), Vendor-Private 0x%08x", tok2str(oui_values, "Unknown", - 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)); + GET_BE_U_3(tlv.slow_oam_info->oui)), + GET_BE_U_3(tlv.slow_oam_info->oui), + GET_BE_U_4(tlv.slow_oam_info->vendor_private)); break; case SLOW_OAM_INFO_TYPE_ORG_SPECIFIC: @@ -627,7 +629,7 @@ slow_oam_print(netdissect_options *ndo, if (tlen < 2) goto tooshort; ND_TCHECK_2(tptr); - ND_PRINT("\n\t Sequence Number %u", EXTRACT_BE_U_2(tptr)); + ND_PRINT("\n\t Sequence Number %u", GET_BE_U_2(tptr)); tlen -= 2; tptr += 2; @@ -637,8 +639,8 @@ slow_oam_print(netdissect_options *ndo, if (tlen < sizeof(*ptr.slow_oam_tlv_header)) goto tooshort; ND_TCHECK_SIZE(ptr.slow_oam_tlv_header); - type = EXTRACT_U_1(ptr.slow_oam_tlv_header->type); - length = EXTRACT_U_1(ptr.slow_oam_tlv_header->length); + type = GET_U_1(ptr.slow_oam_tlv_header->type); + length = GET_U_1(ptr.slow_oam_tlv_header->length); ND_PRINT("\n\t %s Link Event Type (%u), length %u", tok2str(slow_oam_link_event_values, "Reserved", type), @@ -672,7 +674,7 @@ slow_oam_print(netdissect_options *ndo, case SLOW_OAM_LINK_EVENT_ERR_FRM_SUMM: tlv.slow_oam_link_event = (const struct slow_oam_link_event_t *)tptr; - if (EXTRACT_U_1(tlv.slow_oam_link_event->event_length) != + if (GET_U_1(tlv.slow_oam_link_event->event_length) != sizeof(struct slow_oam_link_event_t)) { ND_PRINT("\n\t ERROR: illegal length - should be %lu", (unsigned long) sizeof(struct slow_oam_link_event_t)); @@ -685,12 +687,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_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)); + GET_BE_U_2(tlv.slow_oam_link_event->time_stamp)*100, + GET_BE_U_8(tlv.slow_oam_link_event->window), + GET_BE_U_8(tlv.slow_oam_link_event->threshold), + GET_BE_U_8(tlv.slow_oam_link_event->errors), + GET_BE_U_8(tlv.slow_oam_link_event->errors_running_total), + GET_BE_U_4(tlv.slow_oam_link_event->event_running_total)); break; case SLOW_OAM_LINK_EVENT_ORG_SPECIFIC: @@ -719,7 +721,7 @@ slow_oam_print(netdissect_options *ndo, if (tlen < sizeof(*tlv.slow_oam_loopbackctrl)) goto tooshort; ND_TCHECK_SIZE(tlv.slow_oam_loopbackctrl); - command = EXTRACT_U_1(tlv.slow_oam_loopbackctrl->command); + command = GET_U_1(tlv.slow_oam_loopbackctrl->command); ND_PRINT("\n\t Command %s (%u)", tok2str(slow_oam_loopbackctrl_cmd_values, "Unknown", diff --git a/print-smb.c b/print-smb.c index 6592c5eb..d12779d8 100644 --- a/print-smb.c +++ b/print-smb.c @@ -115,7 +115,7 @@ trans2_qfsinfo(netdissect_options *ndo, if (request) { ND_TCHECK_2(param); - level = EXTRACT_LE_U_2(param); + level = GET_LE_U_2(param); fmt = "InfoLevel=[u]\n"; smb_fdata(ndo, param, fmt, param + pcnt, unicodestr); } else { @@ -183,28 +183,28 @@ print_trans2(netdissect_options *ndo, ND_TCHECK_1(words); if (request) { ND_TCHECK_2(w + (14 * 2)); - 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); + pcnt = GET_LE_U_2(w + 9 * 2); + param = buf + GET_LE_U_2(w + 10 * 2); + dcnt = GET_LE_U_2(w + 11 * 2); + data = buf + GET_LE_U_2(w + 12 * 2); + fn = smbfindint(GET_LE_U_2(w + 14 * 2), trans2_fns); } else { - if (EXTRACT_U_1(words) == 0) { + if (GET_U_1(words) == 0) { ND_PRINT("%s\n", fn->name); ND_PRINT("Trans2Interim\n"); return; } ND_TCHECK_2(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); + pcnt = GET_LE_U_2(w + 3 * 2); + param = buf + GET_LE_U_2(w + 4 * 2); + dcnt = GET_LE_U_2(w + 6 * 2); + data = buf + GET_LE_U_2(w + 7 * 2); } ND_PRINT("%s param_length=%u data_length=%u\n", fn->name, pcnt, dcnt); if (request) { - if (EXTRACT_U_1(words) == 8) { + if (GET_U_1(words) == 8) { smb_fdata(ndo, words + 1, "Trans2Secondary\nTotParam=[u]\nTotData=[u]\nParamCnt=[u]\nParamOff=[u]\nParamDisp=[u]\nDataCnt=[u]\nDataOff=[u]\nDataDisp=[u]\nHandle=[u]\n", maxbuf, unicodestr); @@ -225,7 +225,7 @@ print_trans2(netdissect_options *ndo, } ND_TCHECK_2(dat); - bcc = EXTRACT_LE_U_2(dat); + bcc = GET_LE_U_2(dat); ND_PRINT("smb_bcc=%u\n", bcc); if (fn->descript.fn) (*fn->descript.fn)(ndo, param, data, pcnt, dcnt); @@ -246,7 +246,7 @@ print_browse(netdissect_options *ndo, u_int command; ND_TCHECK_1(data); - command = EXTRACT_U_1(data); + command = GET_U_1(data); smb_fdata(ndo, param, "BROWSE PACKET\n|Param ", param+paramlen, unicodestr); @@ -344,20 +344,20 @@ print_trans(netdissect_options *ndo, if (request) { ND_TCHECK_2(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); + paramlen = GET_LE_U_2(w + 9 * 2); + param = buf + GET_LE_U_2(w + 10 * 2); + datalen = GET_LE_U_2(w + 11 * 2); + data = buf + GET_LE_U_2(w + 12 * 2); f1 = "TotParamCnt=[u]\nTotDataCnt=[u]\nMaxParmCnt=[u]\nMaxDataCnt=[u]\nMaxSCnt=[u]\nTransFlags=[w]\nRes1=[w]\nRes2=[w]\nRes3=[w]\nParamCnt=[u]\nParamOff=[u]\nDataCnt=[u]\nDataOff=[u]\nSUCnt=[u]\n"; f2 = "|Name=[S]\n"; f3 = "|Param "; f4 = "|Data "; } else { ND_TCHECK_2(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); + paramlen = GET_LE_U_2(w + 3 * 2); + param = buf + GET_LE_U_2(w + 4 * 2); + datalen = GET_LE_U_2(w + 6 * 2); + data = buf + GET_LE_U_2(w + 7 * 2); f1 = "TotParamCnt=[u]\nTotDataCnt=[u]\nRes1=[u]\nParamCnt=[u]\nParamOff=[u]\nRes2=[u]\nDataCnt=[u]\nDataOff=[u]\nRes3=[u]\nLsetup=[u]\n"; f2 = "|Unknown "; f3 = "|Param "; @@ -365,11 +365,11 @@ print_trans(netdissect_options *ndo, } smb_fdata(ndo, words + 1, f1, - min(words + 1 + 2 * EXTRACT_U_1(words), maxbuf), + min(words + 1 + 2 * GET_U_1(words), maxbuf), unicodestr); ND_TCHECK_2(data1); - bcc = EXTRACT_LE_U_2(data1); + bcc = GET_LE_U_2(data1); ND_PRINT("smb_bcc=%u\n", bcc); if (bcc > 0) { smb_fdata(ndo, data1 + 2, f2, maxbuf - (paramlen + datalen), unicodestr); @@ -403,7 +403,7 @@ print_negprot(netdissect_options *ndo, const char *f1 = NULL, *f2 = NULL; ND_TCHECK_1(words); - wct = EXTRACT_U_1(words); + wct = GET_U_1(words); if (request) f2 = "*|Dialect=[Y]\n"; else { @@ -422,15 +422,15 @@ print_negprot(netdissect_options *ndo, smb_data_print(ndo, words + 1, min(wct * 2, PTR_DIFF(maxbuf, words + 1))); ND_TCHECK_2(data); - bcc = EXTRACT_LE_U_2(data); + bcc = GET_LE_U_2(data); ND_PRINT("smb_bcc=%u\n", bcc); if (bcc > 0) { if (f2) - smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_U_2(data), + smb_fdata(ndo, data + 2, f2, min(data + 2 + GET_LE_U_2(data), maxbuf), unicodestr); else smb_data_print(ndo, data + 2, - min(EXTRACT_LE_U_2(data), PTR_DIFF(maxbuf, data + 2))); + min(GET_LE_U_2(data), PTR_DIFF(maxbuf, data + 2))); } return; trunc: @@ -445,7 +445,7 @@ print_sesssetup(netdissect_options *ndo, const char *f1 = NULL, *f2 = NULL; ND_TCHECK_1(words); - wct = EXTRACT_U_1(words); + wct = GET_U_1(words); if (request) { if (wct == 10) f1 = "Com2=[w]\nOff2=[u]\nBufSize=[u]\nMpxMax=[u]\nVcNum=[u]\nSessionKey=[W]\nPassLen=[u]\nCryptLen=[u]\nCryptOff=[u]\nPass&Name=\n"; @@ -467,15 +467,15 @@ print_sesssetup(netdissect_options *ndo, smb_data_print(ndo, words + 1, min(wct * 2, PTR_DIFF(maxbuf, words + 1))); ND_TCHECK_2(data); - bcc = EXTRACT_LE_U_2(data); + bcc = GET_LE_U_2(data); ND_PRINT("smb_bcc=%u\n", bcc); if (bcc > 0) { if (f2) - smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_U_2(data), + smb_fdata(ndo, data + 2, f2, min(data + 2 + GET_LE_U_2(data), maxbuf), unicodestr); else smb_data_print(ndo, data + 2, - min(EXTRACT_LE_U_2(data), PTR_DIFF(maxbuf, data + 2))); + min(GET_LE_U_2(data), PTR_DIFF(maxbuf, data + 2))); } return; trunc: @@ -491,11 +491,11 @@ print_lockingandx(netdissect_options *ndo, const char *f1 = NULL, *f2 = NULL; ND_TCHECK_1(words); - wct = EXTRACT_U_1(words); + wct = GET_U_1(words); if (request) { f1 = "Com2=[w]\nOff2=[u]\nHandle=[u]\nLockType=[w]\nTimeOut=[D]\nUnlockCount=[u]\nLockCount=[u]\n"; ND_TCHECK_1(words + 7); - if (EXTRACT_U_1(words + 7) & 0x10) + if (GET_U_1(words + 7) & 0x10) f2 = "*Process=[u]\n[P2]Offset=[M]\nLength=[M]\n"; else f2 = "*Process=[u]\nOffset=[D]\nLength=[U]\n"; @@ -508,15 +508,15 @@ print_lockingandx(netdissect_options *ndo, smb_fdata(ndo, words + 1, f1, maxwords, unicodestr); ND_TCHECK_2(data); - bcc = EXTRACT_LE_U_2(data); + bcc = GET_LE_U_2(data); ND_PRINT("smb_bcc=%u\n", bcc); if (bcc > 0) { if (f2) - smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_U_2(data), + smb_fdata(ndo, data + 2, f2, min(data + 2 + GET_LE_U_2(data), maxbuf), unicodestr); else smb_data_print(ndo, data + 2, - min(EXTRACT_LE_U_2(data), PTR_DIFF(maxbuf, data + 2))); + min(GET_LE_U_2(data), PTR_DIFF(maxbuf, data + 2))); } return; trunc: @@ -810,10 +810,10 @@ print_smb(netdissect_options *ndo, u_int smboffset; ND_TCHECK_1(buf + 9); - request = (EXTRACT_U_1(buf + 9) & 0x80) ? 0 : 1; + request = (GET_U_1(buf + 9) & 0x80) ? 0 : 1; startbuf = buf; - command = EXTRACT_U_1(buf + 4); + command = GET_U_1(buf + 4); fn = smbfind(command, smb_fns); @@ -826,7 +826,7 @@ print_smb(netdissect_options *ndo, return; ND_TCHECK_2(buf + 10); - flags2 = EXTRACT_LE_U_2(buf + 10); + flags2 = GET_LE_U_2(buf + 10); unicodestr = flags2 & 0x8000; nterrcodes = flags2 & 0x4000; @@ -834,13 +834,13 @@ print_smb(netdissect_options *ndo, smb_fdata(ndo, buf, fmt_smbheader, buf + 33, unicodestr); if (nterrcodes) { - nterror = EXTRACT_LE_U_4(buf + 5); + nterror = GET_LE_U_4(buf + 5); if (nterror) ND_PRINT("NTError = %s\n", nt_errstr(nterror)); } else { - if (EXTRACT_U_1(buf + 5)) - ND_PRINT("SMBError = %s\n", smb_errstr(EXTRACT_U_1(buf + 5), - EXTRACT_LE_U_2(buf + 7))); + if (GET_U_1(buf + 5)) + ND_PRINT("SMBError = %s\n", smb_errstr(GET_U_1(buf + 5), + GET_LE_U_2(buf + 7))); } smboffset = 32; @@ -853,7 +853,7 @@ print_smb(netdissect_options *ndo, words = buf + smboffset; ND_TCHECK_1(words); - wct = EXTRACT_U_1(words); + wct = GET_U_1(words); data = words + 1 + wct * 2; maxwords = min(data, maxbuf); @@ -877,14 +877,14 @@ print_smb(netdissect_options *ndo, for (i = 0; words + 1 + 2 * i < maxwords; i++) { ND_TCHECK_2(words + 1 + 2 * i); - v = EXTRACT_LE_U_2(words + 1 + 2 * i); + v = GET_LE_U_2(words + 1 + 2 * i); ND_PRINT("smb_vwv[%u]=%u (0x%X)\n", i, v, v); } } } ND_TCHECK_2(data); - bcc = EXTRACT_LE_U_2(data); + bcc = GET_LE_U_2(data); ND_PRINT("smb_bcc=%u\n", bcc); if (f2) { if (bcc > 0) @@ -902,11 +902,11 @@ print_smb(netdissect_options *ndo, if (wct == 0) break; ND_TCHECK_1(words + 1); - command = EXTRACT_U_1(words + 1); + command = GET_U_1(words + 1); if (command == 0xFF) break; ND_TCHECK_2(words + 3); - newsmboffset = EXTRACT_LE_U_2(words + 3); + newsmboffset = GET_LE_U_2(words + 3); fn = smbfind(command, smb_fns); @@ -948,9 +948,9 @@ nbt_tcp_print(netdissect_options *ndo, goto trunc; maxbuf = data + caplen; ND_TCHECK_1(data); - type = EXTRACT_U_1(data); + type = GET_U_1(data); ND_TCHECK_2(data + 2); - nbt_len = EXTRACT_BE_U_2(data + 2); + nbt_len = GET_BE_U_2(data + 2); length -= 4; caplen -= 4; @@ -981,7 +981,7 @@ nbt_tcp_print(netdissect_options *ndo, goto trunc; if (caplen < 4) goto trunc; - ecode = EXTRACT_U_1(data + 4); + ecode = GET_U_1(data + 4); ND_PRINT("Session Reject, "); switch (ecode) { @@ -1054,7 +1054,7 @@ nbt_tcp_print(netdissect_options *ndo, if (data == NULL) break; if (nbt_len >= 1 && caplen >= 1) { - ecode = EXTRACT_U_1(origdata + 4); + ecode = GET_U_1(origdata + 4); switch (ecode) { case 0x80: ND_PRINT("Not listening on called name\n"); @@ -1117,15 +1117,15 @@ nbt_udp137_print(netdissect_options *ndo, ndo->ndo_protocol = "nbt_udp137"; ND_TCHECK_2(data + 10); - name_trn_id = EXTRACT_BE_U_2(data); - response = (EXTRACT_U_1(data + 2) >> 7); - opcode = (EXTRACT_U_1(data + 2) >> 3) & 0xF; - nm_flags = ((EXTRACT_U_1(data + 2) & 0x7) << 4) + (EXTRACT_U_1(data + 3) >> 4); - rcode = EXTRACT_U_1(data + 3) & 0xF; - 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); + name_trn_id = GET_BE_U_2(data); + response = (GET_U_1(data + 2) >> 7); + opcode = (GET_U_1(data + 2) >> 3) & 0xF; + nm_flags = ((GET_U_1(data + 2) & 0x7) << 4) + (GET_U_1(data + 3) >> 4); + rcode = GET_U_1(data + 3) & 0xF; + qdcount = GET_BE_U_2(data + 4); + ancount = GET_BE_U_2(data + 6); + nscount = GET_BE_U_2(data + 8); + arcount = GET_BE_U_2(data + 10); startbuf = data; if (maxbuf <= data) @@ -1178,12 +1178,12 @@ nbt_udp137_print(netdissect_options *ndo, if (p == NULL) goto out; ND_TCHECK_2(p); - restype = EXTRACT_BE_U_2(p); + restype = GET_BE_U_2(p); p = smb_fdata(ndo, p, "ResType=[rw]\nResClass=[rw]\nTTL=[rU]\n", p + 8, 0); if (p == NULL) goto out; ND_TCHECK_2(p); - rdlen = EXTRACT_BE_U_2(p); + rdlen = GET_BE_U_2(p); ND_PRINT("ResourceLength=%u\nResourceData=\n", rdlen); p += 2; if (rdlen == 6) { @@ -1195,7 +1195,7 @@ nbt_udp137_print(netdissect_options *ndo, u_int numnames; ND_TCHECK_1(p); - numnames = EXTRACT_U_1(p); + numnames = GET_U_1(p); p = smb_fdata(ndo, p, "NumNames=[B]\n", p + 1, 0); if (p == NULL) goto out; @@ -1206,21 +1206,21 @@ nbt_udp137_print(netdissect_options *ndo, ND_TCHECK_1(p); if (p >= maxbuf) goto out; - if (EXTRACT_U_1(p) & 0x80) + if (GET_U_1(p) & 0x80) ND_PRINT("<GROUP> "); - switch (EXTRACT_U_1(p) & 0x60) { + switch (GET_U_1(p) & 0x60) { case 0x00: ND_PRINT("B "); break; case 0x20: ND_PRINT("P "); break; case 0x40: ND_PRINT("M "); break; case 0x60: ND_PRINT("_ "); break; } - if (EXTRACT_U_1(p) & 0x10) + if (GET_U_1(p) & 0x10) ND_PRINT("<DEREGISTERING> "); - if (EXTRACT_U_1(p) & 0x08) + if (GET_U_1(p) & 0x08) ND_PRINT("<CONFLICT> "); - if (EXTRACT_U_1(p) & 0x04) + if (GET_U_1(p) & 0x04) ND_PRINT("<ACTIVE> "); - if (EXTRACT_U_1(p) & 0x02) + if (GET_U_1(p) & 0x02) ND_PRINT("<PERMANENT> "); ND_PRINT("\n"); p += 2; @@ -1266,7 +1266,7 @@ smb_tcp_print(netdissect_options *ndo, if (caplen < 4) goto trunc; maxbuf = data + caplen; - smb_len = EXTRACT_BE_U_3(data + 1); + smb_len = GET_BE_U_3(data + 1); length -= 4; caplen -= 4; @@ -1400,8 +1400,8 @@ netbeui_print(netdissect_options *ndo, if (maxbuf > ndo->ndo_snapend) maxbuf = ndo->ndo_snapend; ND_TCHECK_1(data + 4); - len = EXTRACT_LE_U_2(data); - command = EXTRACT_U_1(data + 4); + len = GET_LE_U_2(data); + command = GET_U_1(data + 4); data2 = data + len; if (data2 >= maxbuf) { data2 = maxbuf; diff --git a/print-snmp.c b/print-snmp.c index c0ae232e..aa2974cc 100644 --- a/print-snmp.c +++ b/print-snmp.c @@ -437,14 +437,14 @@ asn1_parse(netdissect_options *ndo, * +---+---+---+---+---+---+---+---+ * 7 6 5 4 3 2 1 0 */ - id = EXTRACT_U_1(p) & ASN_ID_BITS; /* lower 5 bits, range 00-1f */ + id = GET_U_1(p) & ASN_ID_BITS; /* lower 5 bits, range 00-1f */ #ifdef notdef - form = (EXTRACT_U_1(p) & 0xe0) >> 5; /* move upper 3 bits to lower 3 */ + form = (GET_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 - form = (u_char)(EXTRACT_U_1(p) & ASN_FORM_BITS) >> ASN_FORM_SHIFT; - class = (u_char)(EXTRACT_U_1(p) & ASN_CLASS_BITS) >> ASN_CLASS_SHIFT; + form = (u_char)(GET_U_1(p) & ASN_FORM_BITS) >> ASN_FORM_SHIFT; + class = (u_char)(GET_U_1(p) & ASN_CLASS_BITS) >> ASN_CLASS_SHIFT; #endif elem->form = form; elem->class = class; @@ -464,12 +464,12 @@ asn1_parse(netdissect_options *ndo, */ id = 0; ND_TCHECK_1(p); - while (EXTRACT_U_1(p) & ASN_BIT8) { + while (GET_U_1(p) & ASN_BIT8) { if (len < 1) { ND_PRINT("[Xtagfield?]"); return -1; } - id = (id << 7) | (EXTRACT_U_1(p) & ~ASN_BIT8); + id = (id << 7) | (GET_U_1(p) & ~ASN_BIT8); len--; hdr++; p++; @@ -480,7 +480,7 @@ asn1_parse(netdissect_options *ndo, return -1; } ND_TCHECK_1(p); - elem->id = id = (id << 7) | EXTRACT_U_1(p); + elem->id = id = (id << 7) | GET_U_1(p); --len; ++hdr; ++p; @@ -490,7 +490,7 @@ asn1_parse(netdissect_options *ndo, return -1; } ND_TCHECK_1(p); - elem->asnlen = EXTRACT_U_1(p); + elem->asnlen = GET_U_1(p); p++; len--; hdr++; if (elem->asnlen & ASN_BIT8) { uint32_t noct = elem->asnlen % ASN_BIT8; @@ -501,7 +501,7 @@ asn1_parse(netdissect_options *ndo, } ND_TCHECK_LEN(p, noct); for (; noct != 0; len--, hdr++, noct--) { - elem->asnlen = (elem->asnlen << ASN_SHIFT8) | EXTRACT_U_1(p); + elem->asnlen = (elem->asnlen << ASN_SHIFT8) | GET_U_1(p); p++; } } @@ -542,10 +542,10 @@ asn1_parse(netdissect_options *ndo, ND_PRINT("[asnlen=0]"); return -1; } - if (EXTRACT_U_1(p) & ASN_BIT8) /* negative */ + if (GET_U_1(p) & ASN_BIT8) /* negative */ data = -1; for (i = elem->asnlen; i != 0; p++, i--) - data = (data << ASN_SHIFT8) | EXTRACT_U_1(p); + data = (data << ASN_SHIFT8) | GET_U_1(p); elem->data.integer = data; break; } @@ -582,7 +582,7 @@ asn1_parse(netdissect_options *ndo, elem->type = BE_UNS; data = 0; for (i = elem->asnlen; i != 0; p++, i--) - data = (data << 8) + EXTRACT_U_1(p); + data = (data << 8) + GET_U_1(p); elem->data.uns = data; break; } @@ -592,7 +592,7 @@ asn1_parse(netdissect_options *ndo, elem->type = BE_UNS64; data64 = 0; for (i = elem->asnlen; i != 0; p++, i--) - data64 = (data64 << 8) + EXTRACT_U_1(p); + data64 = (data64 << 8) + GET_U_1(p); elem->data.uns64 = data64; break; } @@ -681,7 +681,7 @@ asn1_print_octets(netdissect_options *ndo, struct be *elem) ND_TCHECK_LEN(p, asnlen); for (i = asnlen; i != 0; p++, i--) - ND_PRINT("_%.2x", EXTRACT_U_1(p)); + ND_PRINT("_%.2x", GET_U_1(p)); return 0; trunc: @@ -700,7 +700,7 @@ asn1_print_string(netdissect_options *ndo, struct be *elem) p = elem->data.str; ND_TCHECK_LEN(p, asnlen); for (i = asnlen; printable && i != 0; p++, i--) - printable = ND_ISPRINT(EXTRACT_U_1(p)); + printable = ND_ISPRINT(GET_U_1(p)); p = elem->data.str; if (printable) { ND_PRINT("\""); @@ -711,7 +711,7 @@ asn1_print_string(netdissect_options *ndo, struct be *elem) ND_PRINT("\""); } else { for (i = asnlen; i != 0; p++, i--) { - ND_PRINT(first ? "%.2x" : "_%.2x", EXTRACT_U_1(p)); + ND_PRINT(first ? "%.2x" : "_%.2x", GET_U_1(p)); first = 0; } } @@ -770,8 +770,8 @@ asn1_print(netdissect_options *ndo, for (; i != 0; p++, i--) { ND_TCHECK_1(p); - o = (o << ASN_SHIFT7) + (EXTRACT_U_1(p) & ~ASN_BIT8); - if (EXTRACT_U_1(p) & ASN_LONGLEN) + o = (o << ASN_SHIFT7) + (GET_U_1(p) & ~ASN_BIT8); + if (GET_U_1(p) & ASN_LONGLEN) continue; /* @@ -824,7 +824,7 @@ asn1_print(netdissect_options *ndo, p = (const u_char *)elem->data.raw; ND_TCHECK_LEN(p, asnlen); for (i = asnlen; i != 0; p++, i--) { - ND_PRINT((i == asnlen) ? "%u" : ".%u", EXTRACT_U_1(p)); + ND_PRINT((i == asnlen) ? "%u" : ".%u", GET_U_1(p)); } break; @@ -923,8 +923,8 @@ smi_decode_oid(netdissect_options *ndo, for (*oidlen = 0; i != 0; p++, i--) { ND_TCHECK_1(p); - o = (o << ASN_SHIFT7) + (EXTRACT_U_1(p) & ~ASN_BIT8); - if (EXTRACT_U_1(p) & ASN_LONGLEN) + o = (o << ASN_SHIFT7) + (GET_U_1(p) & ~ASN_BIT8); + if (GET_U_1(p) & ASN_LONGLEN) continue; /* @@ -1798,7 +1798,7 @@ v3msg_print(netdissect_options *ndo, ND_PRINT("[msgFlags size %d]", elem.asnlen); return; } - flags = EXTRACT_U_1(elem.data.str); + flags = GET_U_1(elem.data.str); if (flags != 0x00 && flags != 0x01 && flags != 0x03 && flags != 0x04 && flags != 0x05 && flags != 0x07) { ND_PRINT("[msgFlags=0x%02X]", flags); diff --git a/print-stp.c b/print-stp.c index b42a019d..b22c5375 100644 --- a/print-stp.c +++ b/print-stp.c @@ -93,9 +93,9 @@ stp_print_bridge_id(netdissect_options *ndo, const u_char *p) nd_snprintf(bridge_id_str, sizeof(bridge_id_str), "%.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", - EXTRACT_U_1(p), EXTRACT_U_1(p + 1), EXTRACT_U_1(p + 2), - EXTRACT_U_1(p + 3), EXTRACT_U_1(p + 4), EXTRACT_U_1(p + 5), - EXTRACT_U_1(p + 6), EXTRACT_U_1(p + 7)); + GET_U_1(p), GET_U_1(p + 1), GET_U_1(p + 2), + GET_U_1(p + 3), GET_U_1(p + 4), GET_U_1(p + 5), + GET_U_1(p + 6), GET_U_1(p + 7)); return bridge_id_str; } @@ -107,14 +107,14 @@ stp_print_config_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, uint8_t bpdu_flags; ND_TCHECK_1(stp_bpdu->flags); - bpdu_flags = EXTRACT_U_1(stp_bpdu->flags); + bpdu_flags = GET_U_1(stp_bpdu->flags); ND_PRINT(", Flags [%s]", bittok2str(stp_bpdu_flag_values, "none", bpdu_flags)); ND_TCHECK_2(stp_bpdu->port_id); ND_PRINT(", bridge-id %s.%04x, length %u", stp_print_bridge_id(ndo, (const u_char *)&stp_bpdu->bridge_id), - EXTRACT_BE_U_2(stp_bpdu->port_id), length); + GET_BE_U_2(stp_bpdu->port_id), length); /* in non-verbose mode just print the bridge-id */ if (!ndo->ndo_vflag) { @@ -124,17 +124,17 @@ stp_print_config_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ND_TCHECK_2(stp_bpdu->forward_delay); ND_PRINT("\n\tmessage-age %.2fs, max-age %.2fs" ", hello-time %.2fs, forwarding-delay %.2fs", - (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); + (float) GET_BE_U_2(stp_bpdu->message_age) / STP_TIME_BASE, + (float) GET_BE_U_2(stp_bpdu->max_age) / STP_TIME_BASE, + (float) GET_BE_U_2(stp_bpdu->hello_time) / STP_TIME_BASE, + (float) GET_BE_U_2(stp_bpdu->forward_delay) / STP_TIME_BASE); ND_PRINT("\n\troot-id %s, root-pathcost %u", stp_print_bridge_id(ndo, (const u_char *)&stp_bpdu->root_id), - EXTRACT_BE_U_4(stp_bpdu->root_path_cost)); + GET_BE_U_4(stp_bpdu->root_path_cost)); /* Port role is only valid for 802.1w */ - if (EXTRACT_U_1(stp_bpdu->protocol_version) == STP_PROTO_RAPID) { + if (GET_U_1(stp_bpdu->protocol_version) == STP_PROTO_RAPID) { ND_PRINT(", port-role %s", tok2str(rstp_obj_port_role_values, "Unknown", RSTP_EXTRACT_PORT_ROLE(bpdu_flags))); @@ -253,7 +253,7 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ptr = (const u_char *)stp_bpdu; ND_TCHECK_1(stp_bpdu->flags); - bpdu_flags = EXTRACT_U_1(stp_bpdu->flags); + bpdu_flags = GET_U_1(stp_bpdu->flags); ND_PRINT(", CIST Flags [%s], length %u", bittok2str(stp_bpdu_flag_values, "none", bpdu_flags), length); @@ -271,72 +271,74 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ND_TCHECK_4(stp_bpdu->root_path_cost); ND_PRINT("CIST root-id %s, CIST ext-pathcost %u", stp_print_bridge_id(ndo, (const u_char *)&stp_bpdu->root_id), - EXTRACT_BE_U_4(stp_bpdu->root_path_cost)); + GET_BE_U_4(stp_bpdu->root_path_cost)); ND_TCHECK_SIZE(&stp_bpdu->bridge_id); ND_PRINT("\n\tCIST regional-root-id %s, ", stp_print_bridge_id(ndo, (const u_char *)&stp_bpdu->bridge_id)); ND_TCHECK_2(stp_bpdu->port_id); - ND_PRINT("CIST port-id %04x,", EXTRACT_BE_U_2(stp_bpdu->port_id)); + ND_PRINT("CIST port-id %04x,", GET_BE_U_2(stp_bpdu->port_id)); ND_TCHECK_2(stp_bpdu->forward_delay); ND_PRINT("\n\tmessage-age %.2fs, max-age %.2fs" ", hello-time %.2fs, forwarding-delay %.2fs", - (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); + (float) GET_BE_U_2(stp_bpdu->message_age) / STP_TIME_BASE, + (float) GET_BE_U_2(stp_bpdu->max_age) / STP_TIME_BASE, + (float) GET_BE_U_2(stp_bpdu->hello_time) / STP_TIME_BASE, + (float) GET_BE_U_2(stp_bpdu->forward_delay) / STP_TIME_BASE); ND_TCHECK_2(ptr + MST_BPDU_VER3_LEN_OFFSET); - ND_PRINT("\n\tv3len %u, ", EXTRACT_BE_U_2(ptr + MST_BPDU_VER3_LEN_OFFSET)); + ND_PRINT("\n\tv3len %u, ", GET_BE_U_2(ptr + MST_BPDU_VER3_LEN_OFFSET)); ND_TCHECK_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12); ND_PRINT("MCID Name "); if (nd_printzp(ndo, ptr + MST_BPDU_CONFIG_NAME_OFFSET, 32, ndo->ndo_snapend)) goto trunc; ND_PRINT(", rev %u," "\n\t\tdigest %08x%08x%08x%08x, ", - 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)); + GET_BE_U_2(ptr + MST_BPDU_CONFIG_NAME_OFFSET + 32), + GET_BE_U_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET), + GET_BE_U_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 4), + GET_BE_U_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 8), + GET_BE_U_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12)); ND_TCHECK_4(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET); ND_PRINT("CIST int-root-pathcost %u,", - EXTRACT_BE_U_4(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET)); + GET_BE_U_4(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET)); ND_TCHECK_BRIDGE_ID(ptr + MST_BPDU_CIST_BRIDGE_ID_OFFSET); ND_PRINT("\n\tCIST bridge-id %s, ", stp_print_bridge_id(ndo, ptr + MST_BPDU_CIST_BRIDGE_ID_OFFSET)); ND_TCHECK_1(ptr + MST_BPDU_CIST_REMAIN_HOPS_OFFSET); - ND_PRINT("CIST remaining-hops %u", EXTRACT_U_1(ptr + MST_BPDU_CIST_REMAIN_HOPS_OFFSET)); + ND_PRINT("CIST remaining-hops %u", + GET_U_1(ptr + MST_BPDU_CIST_REMAIN_HOPS_OFFSET)); /* Dump all MSTI's */ ND_TCHECK_2(ptr + MST_BPDU_VER3_LEN_OFFSET); - v3len = EXTRACT_BE_U_2(ptr + MST_BPDU_VER3_LEN_OFFSET); + v3len = GET_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_TCHECK_LEN(ptr + offset, MST_BPDU_MSTI_LENGTH); - msti = EXTRACT_BE_U_2(ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET); + msti = GET_BE_U_2(ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET); msti = msti & 0x0FFF; ND_PRINT("\n\tMSTI %u, Flags [%s], port-role %s", - msti, bittok2str(stp_bpdu_flag_values, "none", EXTRACT_U_1(ptr + offset)), + msti, + bittok2str(stp_bpdu_flag_values, "none", GET_U_1(ptr + offset)), tok2str(rstp_obj_port_role_values, "Unknown", - RSTP_EXTRACT_PORT_ROLE(EXTRACT_U_1(ptr + offset)))); + RSTP_EXTRACT_PORT_ROLE(GET_U_1(ptr + offset)))); ND_PRINT("\n\t\tMSTI regional-root-id %s, pathcost %u", stp_print_bridge_id(ndo, ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET), - EXTRACT_BE_U_4(ptr + offset + MST_BPDU_MSTI_ROOT_PATH_COST_OFFSET)); + GET_BE_U_4(ptr + offset + MST_BPDU_MSTI_ROOT_PATH_COST_OFFSET)); ND_PRINT("\n\t\tMSTI bridge-prio %u, port-prio %u, hops %u", - EXTRACT_U_1(ptr + offset + MST_BPDU_MSTI_BRIDGE_PRIO_OFFSET) >> 4, - EXTRACT_U_1(ptr + offset + MST_BPDU_MSTI_PORT_PRIO_OFFSET) >> 4, - EXTRACT_U_1(ptr + offset + MST_BPDU_MSTI_REMAIN_HOPS_OFFSET)); + GET_U_1(ptr + offset + MST_BPDU_MSTI_BRIDGE_PRIO_OFFSET) >> 4, + GET_U_1(ptr + offset + MST_BPDU_MSTI_PORT_PRIO_OFFSET) >> 4, + GET_U_1(ptr + offset + MST_BPDU_MSTI_REMAIN_HOPS_OFFSET)); len -= MST_BPDU_MSTI_LENGTH; offset += MST_BPDU_MSTI_LENGTH; @@ -364,36 +366,36 @@ 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("\n\tv4len %u, ", EXTRACT_BE_U_2(ptr + offset)); + ND_PRINT("\n\tv4len %u, ", GET_BE_U_2(ptr + offset)); ND_PRINT("AUXMCID Name "); if (nd_printzp(ndo, ptr + offset + SPB_BPDU_CONFIG_NAME_OFFSET, 32, ndo->ndo_snapend)) goto trunc; ND_PRINT(", Rev %u,\n\t\tdigest %08x%08x%08x%08x", - 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)); + GET_BE_U_2(ptr + offset + SPB_BPDU_CONFIG_REV_OFFSET), + GET_BE_U_4(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET), + GET_BE_U_4(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 4), + GET_BE_U_4(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 8), + GET_BE_U_4(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 12)); ND_PRINT("\n\tAgreement num %u, Discarded Agreement num %u, Agreement valid-" "flag %u,\n\tRestricted role-flag: %u, Format id %u cap %u, " "Convention id %u cap %u,\n\tEdge count %u, " "Agreement digest %08x%08x%08x%08x%08x\n", - EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_OFFSET)>>6, - EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_OFFSET)>>4 & 0x3, - EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_OFFSET)>>3 & 0x1, - EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_OFFSET)>>2 & 0x1, - EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_FORMAT_OFFSET)>>4, - EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_FORMAT_OFFSET)&0x00ff, - EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_CON_OFFSET)>>4, - EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_CON_OFFSET)&0x00ff, - 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)); + GET_U_1(ptr + offset + SPB_BPDU_AGREEMENT_OFFSET)>>6, + GET_U_1(ptr + offset + SPB_BPDU_AGREEMENT_OFFSET)>>4 & 0x3, + GET_U_1(ptr + offset + SPB_BPDU_AGREEMENT_OFFSET)>>3 & 0x1, + GET_U_1(ptr + offset + SPB_BPDU_AGREEMENT_OFFSET)>>2 & 0x1, + GET_U_1(ptr + offset + SPB_BPDU_AGREEMENT_FORMAT_OFFSET)>>4, + GET_U_1(ptr + offset + SPB_BPDU_AGREEMENT_FORMAT_OFFSET)&0x00ff, + GET_U_1(ptr + offset + SPB_BPDU_AGREEMENT_CON_OFFSET)>>4, + GET_U_1(ptr + offset + SPB_BPDU_AGREEMENT_CON_OFFSET)&0x00ff, + GET_BE_U_2(ptr + offset + SPB_BPDU_AGREEMENT_EDGE_OFFSET), + GET_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET), + GET_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 4), + GET_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 8), + GET_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 12), + GET_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 16)); return 1; trunc: @@ -420,13 +422,13 @@ stp_print(netdissect_options *ndo, const u_char *p, u_int length) goto trunc; ND_TCHECK_2(stp_bpdu->protocol_id); - if (EXTRACT_BE_U_2(stp_bpdu->protocol_id)) { + if (GET_BE_U_2(stp_bpdu->protocol_id)) { ND_PRINT("unknown STP version, length %u", length); return; } ND_TCHECK_1(stp_bpdu->protocol_version); - protocol_version = EXTRACT_U_1(stp_bpdu->protocol_version); + protocol_version = GET_U_1(stp_bpdu->protocol_version); ND_PRINT("STP %s", tok2str(stp_proto_values, "Unknown STP protocol (0x%02x)", protocol_version)); @@ -441,7 +443,7 @@ stp_print(netdissect_options *ndo, const u_char *p, u_int length) } ND_TCHECK_1(stp_bpdu->bpdu_type); - bpdu_type = EXTRACT_U_1(stp_bpdu->bpdu_type); + bpdu_type = GET_U_1(stp_bpdu->bpdu_type); ND_PRINT(", %s", tok2str(stp_bpdu_type_values, "Unknown BPDU Type (0x%02x)", bpdu_type)); @@ -468,14 +470,14 @@ stp_print(netdissect_options *ndo, const u_char *p, u_int length) } ND_TCHECK_1(stp_bpdu->v1_length); - if (EXTRACT_U_1(stp_bpdu->v1_length) != 0) { + if (GET_U_1(stp_bpdu->v1_length) != 0) { /* FIX ME: Emit a message here ? */ goto trunc; } /* Validate v3 length */ ND_TCHECK_2(p + MST_BPDU_VER3_LEN_OFFSET); - mstp_len = EXTRACT_BE_U_2(p + MST_BPDU_VER3_LEN_OFFSET); + mstp_len = GET_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; @@ -487,7 +489,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_U_2(p + MST_BPDU_VER3_LEN_OFFSET + mstp_len); + spb_len = GET_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 e1686d83..0e8fe57d 100644 --- a/print-sunatm.c +++ b/print-sunatm.c @@ -76,10 +76,10 @@ sunatm_if_print(netdissect_options *ndo, } if (ndo->ndo_eflag) { - ND_PRINT(EXTRACT_U_1(p + DIR_POS) & 0x80 ? "Tx: " : "Rx: "); + ND_PRINT(GET_U_1(p + DIR_POS) & 0x80 ? "Tx: " : "Rx: "); } - switch (EXTRACT_U_1(p + DIR_POS) & 0x0f) { + switch (GET_U_1(p + DIR_POS) & 0x0f) { case PT_LANE: traftype = ATM_LANE; @@ -94,8 +94,8 @@ sunatm_if_print(netdissect_options *ndo, break; } - vci = EXTRACT_BE_U_2(p + VCI_POS); - vpi = EXTRACT_U_1(p + VPI_POS); + vci = GET_BE_U_2(p + VCI_POS); + vpi = GET_U_1(p + VPI_POS); p += PKT_BEGIN_POS; caplen -= PKT_BEGIN_POS; diff --git a/print-sunrpc.c b/print-sunrpc.c index f83f4eb9..773e8b56 100644 --- a/print-sunrpc.c +++ b/print-sunrpc.c @@ -173,11 +173,11 @@ sunrpc_print(netdissect_options *ndo, const u_char *bp, if (!ndo->ndo_nflag) { nd_snprintf(srcid, sizeof(srcid), "0x%x", - EXTRACT_BE_U_4(rp->rm_xid)); + GET_BE_U_4(rp->rm_xid)); strlcpy(dstid, "sunrpc", sizeof(dstid)); } else { nd_snprintf(srcid, sizeof(srcid), "0x%x", - EXTRACT_BE_U_4(rp->rm_xid)); + GET_BE_U_4(rp->rm_xid)); nd_snprintf(dstid, sizeof(dstid), "0x%x", SUNRPC_PMAPPORT); } @@ -200,23 +200,23 @@ sunrpc_print(netdissect_options *ndo, const u_char *bp, } ND_PRINT(" %s", tok2str(proc2str, " proc #%u", - EXTRACT_BE_U_4(rp->rm_call.cb_proc))); - x = EXTRACT_BE_U_4(rp->rm_call.cb_rpcvers); + GET_BE_U_4(rp->rm_call.cb_proc))); + x = GET_BE_U_4(rp->rm_call.cb_rpcvers); if (x != 2) ND_PRINT(" [rpcver %u]", x); - switch (EXTRACT_BE_U_4(rp->rm_call.cb_proc)) { + switch (GET_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_U_4(rp->rm_call.cb_prog); + x = GET_BE_U_4(rp->rm_call.cb_prog); if (!ndo->ndo_nflag) ND_PRINT(" %s", progstr(x)); else ND_PRINT(" %u", x); - ND_PRINT(".%u", EXTRACT_BE_U_4(rp->rm_call.cb_vers)); + ND_PRINT(".%u", GET_BE_U_4(rp->rm_call.cb_vers)); break; } return; diff --git a/print-symantec.c b/print-symantec.c index 617cf447..6a0b4918 100644 --- a/print-symantec.c +++ b/print-symantec.c @@ -45,7 +45,7 @@ symantec_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length) sp = (const struct symantec_header *)bp; - etype = EXTRACT_BE_U_2(sp->ether_type); + etype = GET_BE_U_2(sp->ether_type); if (!ndo->ndo_qflag) { if (etype <= MAX_ETHERNET_LENGTH_VAL) ND_PRINT("invalid ethertype %u", etype); @@ -91,7 +91,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_U_2(sp->ether_type); + ether_type = GET_BE_U_2(sp->ether_type); if (ether_type <= MAX_ETHERNET_LENGTH_VAL) { /* ether_type not known, print raw packet */ diff --git a/print-syslog.c b/print-syslog.c index 3c27fb39..ede1d6ba 100644 --- a/print-syslog.c +++ b/print-syslog.c @@ -91,17 +91,17 @@ syslog_print(netdissect_options *ndo, */ ND_TCHECK_1(pptr); - if (EXTRACT_U_1(pptr + msg_off) == '<') { + if (GET_U_1(pptr + msg_off) == '<') { msg_off++; ND_TCHECK_1(pptr + msg_off); while (msg_off <= SYSLOG_MAX_DIGITS && - EXTRACT_U_1(pptr + msg_off) >= '0' && - EXTRACT_U_1(pptr + msg_off) <= '9') { - pri = pri * 10 + (EXTRACT_U_1(pptr + msg_off) - '0'); + GET_U_1(pptr + msg_off) >= '0' && + GET_U_1(pptr + msg_off) <= '9') { + pri = pri * 10 + (GET_U_1(pptr + msg_off) - '0'); msg_off++; ND_TCHECK_1(pptr + msg_off); } - if (EXTRACT_U_1(pptr + msg_off) != '>') { + if (GET_U_1(pptr + msg_off) != '>') { nd_print_trunc(ndo); return; } @@ -133,7 +133,7 @@ syslog_print(netdissect_options *ndo, /* print the syslog text in verbose mode */ for (; msg_off < len; msg_off++) { ND_TCHECK_1(pptr + msg_off); - fn_print_char(ndo, EXTRACT_U_1(pptr + msg_off)); + fn_print_char(ndo, GET_U_1(pptr + msg_off)); } if (ndo->ndo_vflag > 1) diff --git a/print-tcp.c b/print-tcp.c index 66834e84..2db0f547 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -195,11 +195,11 @@ tcp_print(netdissect_options *ndo, return; } - sport = EXTRACT_BE_U_2(tp->th_sport); - dport = EXTRACT_BE_U_2(tp->th_dport); + sport = GET_BE_U_2(tp->th_sport); + dport = GET_BE_U_2(tp->th_dport); if (ip6) { - if (EXTRACT_U_1(ip6->ip6_nxt) == IPPROTO_TCP) { + if (GET_U_1(ip6->ip6_nxt) == IPPROTO_TCP) { ND_PRINT("%s.%s > %s.%s: ", ip6addr_string(ndo, ip6->ip6_src), tcpport_string(ndo, sport), @@ -210,7 +210,7 @@ tcp_print(netdissect_options *ndo, tcpport_string(ndo, sport), tcpport_string(ndo, dport)); } } else { - if (EXTRACT_U_1(ip->ip_p) == IPPROTO_TCP) { + if (GET_U_1(ip->ip_p) == IPPROTO_TCP) { ND_PRINT("%s.%s > %s.%s: ", ipaddr_string(ndo, ip->ip_src), tcpport_string(ndo, sport), @@ -232,10 +232,10 @@ tcp_print(netdissect_options *ndo, return; } - 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); + seq = GET_BE_U_4(tp->th_seq); + ack = GET_BE_U_4(tp->th_ack); + win = GET_BE_U_2(tp->th_win); + urp = GET_BE_U_2(tp->th_urp); if (ndo->ndo_qflag) { ND_PRINT("tcp %u", length - hlen); @@ -246,7 +246,7 @@ tcp_print(netdissect_options *ndo, return; } - flags = EXTRACT_U_1(tp->th_flags); + flags = GET_U_1(tp->th_flags); ND_PRINT("Flags [%s]", bittok2str_nosep(tcp_flag_values, "none", flags)); if (!ndo->ndo_Sflag && (flags & TH_ACK)) { @@ -390,7 +390,7 @@ tcp_print(netdissect_options *ndo, if (IP_V(ip) == 4) { if (ND_TTEST_LEN(tp->th_sport, length)) { sum = tcp_cksum(ndo, ip, tp, length); - tcp_sum = EXTRACT_BE_U_2(tp->th_sum); + tcp_sum = GET_BE_U_2(tp->th_sum); ND_PRINT(", cksum 0x%04x", tcp_sum); if (sum != 0) @@ -402,7 +402,7 @@ tcp_print(netdissect_options *ndo, } else if (IP_V(ip) == 6 && ip6->ip6_plen) { if (ND_TTEST_LEN(tp->th_sport, length)) { sum = tcp6_cksum(ndo, ip6, tp, length); - tcp_sum = EXTRACT_BE_U_2(tp->th_sum); + tcp_sum = GET_BE_U_2(tp->th_sum); ND_PRINT(", cksum 0x%04x", tcp_sum); if (sum != 0) @@ -447,13 +447,13 @@ tcp_print(netdissect_options *ndo, if (ch != '\0') ND_PRINT("%c", ch); ND_TCHECK_1(cp); - opt = EXTRACT_U_1(cp); + opt = GET_U_1(cp); cp++; if (ZEROLENOPT(opt)) len = 1; else { ND_TCHECK_1(cp); - len = EXTRACT_U_1(cp); + len = GET_U_1(cp); cp++; /* total including type, len */ if (len < 2 || len > hlen) goto bad; @@ -473,13 +473,13 @@ tcp_print(netdissect_options *ndo, case TCPOPT_MAXSEG: datalen = 2; LENCHECK(datalen); - ND_PRINT(" %u", EXTRACT_BE_U_2(cp)); + ND_PRINT(" %u", GET_BE_U_2(cp)); break; case TCPOPT_WSCALE: datalen = 1; LENCHECK(datalen); - ND_PRINT(" %u", EXTRACT_U_1(cp)); + ND_PRINT(" %u", GET_U_1(cp)); break; case TCPOPT_SACK: @@ -492,9 +492,9 @@ tcp_print(netdissect_options *ndo, ND_PRINT(" %u ", datalen / 8); for (i = 0; i < datalen; i += 8) { LENCHECK(i + 4); - s = EXTRACT_BE_U_4(cp + i); + s = GET_BE_U_4(cp + i); LENCHECK(i + 8); - e = EXTRACT_BE_U_4(cp + i + 4); + e = GET_BE_U_4(cp + i + 4); if (rev) { s -= thseq; e -= thseq; @@ -519,15 +519,15 @@ tcp_print(netdissect_options *ndo, */ datalen = 4; LENCHECK(datalen); - ND_PRINT(" %u", EXTRACT_BE_U_4(cp)); + ND_PRINT(" %u", GET_BE_U_4(cp)); break; case TCPOPT_TIMESTAMP: datalen = 8; LENCHECK(datalen); ND_PRINT(" val %u ecr %u", - EXTRACT_BE_U_4(cp), - EXTRACT_BE_U_4(cp + 4)); + GET_BE_U_4(cp), + GET_BE_U_4(cp + 4)); break; case TCPOPT_SIGNATURE: @@ -549,19 +549,21 @@ tcp_print(netdissect_options *ndo, case CANT_CHECK_SIGNATURE: ND_PRINT("can't check - "); for (i = 0; i < TCP_SIGLEN; ++i) - ND_PRINT("%02x", EXTRACT_U_1(cp + i)); + ND_PRINT("%02x", + GET_U_1(cp + i)); break; } #else for (i = 0; i < TCP_SIGLEN; ++i) - ND_PRINT("%02x", EXTRACT_U_1(cp + i)); + ND_PRINT("%02x", GET_U_1(cp + i)); #endif break; case TCPOPT_SCPS: datalen = 2; LENCHECK(datalen); - ND_PRINT(" cap %02x id %u", EXTRACT_U_1(cp), EXTRACT_U_1(cp + 1)); + ND_PRINT(" cap %02x id %u", GET_U_1(cp), + GET_U_1(cp + 1)); break; case TCPOPT_TCPAO: @@ -575,14 +577,16 @@ tcp_print(netdissect_options *ndo, nd_print_invalid(ndo); } else { LENCHECK(1); - ND_PRINT(" keyid %u", EXTRACT_U_1(cp)); + ND_PRINT(" keyid %u", GET_U_1(cp)); LENCHECK(2); - ND_PRINT(" rnextkeyid %u", EXTRACT_U_1(cp + 1)); + ND_PRINT(" rnextkeyid %u", + GET_U_1(cp + 1)); if (datalen > 2) { ND_PRINT(" mac 0x"); for (i = 2; i < datalen; i++) { LENCHECK(i + 1); - ND_PRINT("%02x", EXTRACT_U_1(cp + i)); + ND_PRINT("%02x", + GET_U_1(cp + i)); } } } @@ -600,7 +604,7 @@ tcp_print(netdissect_options *ndo, case TCPOPT_UTO: datalen = 2; LENCHECK(datalen); - utoval = EXTRACT_BE_U_2(cp); + utoval = GET_BE_U_2(cp); ND_PRINT(" 0x%x", utoval); if (utoval & 0x0001) utoval = (utoval >> 1) * 60; @@ -629,7 +633,7 @@ tcp_print(netdissect_options *ndo, if (datalen < 2) goto bad; /* RFC6994 */ - magic = EXTRACT_BE_U_2(cp); + magic = GET_BE_U_2(cp); ND_PRINT("-"); switch(magic) { @@ -651,7 +655,7 @@ tcp_print(netdissect_options *ndo, ND_PRINT(" 0x"); for (i = 0; i < datalen; ++i) { LENCHECK(i + 1); - ND_PRINT("%02x", EXTRACT_U_1(cp + i)); + ND_PRINT("%02x", GET_U_1(cp + i)); } break; } @@ -769,21 +773,21 @@ tcp_print(netdissect_options *ndo, const struct sunrpc_msg *rp; enum sunrpc_msg_type direction; - fraglen = EXTRACT_BE_U_4(bp) & 0x7FFFFFFF; + fraglen = GET_BE_U_4(bp) & 0x7FFFFFFF; if (fraglen > (length) - 4) fraglen = (length) - 4; rp = (const struct sunrpc_msg *)(bp + 4); if (ND_TTEST_4(rp->rm_direction)) { - direction = (enum sunrpc_msg_type) EXTRACT_BE_U_4(rp->rm_direction); + direction = (enum sunrpc_msg_type) GET_BE_U_4(rp->rm_direction); if (dport == NFS_PORT && direction == SUNRPC_CALL) { ND_PRINT(": NFS request xid %u ", - EXTRACT_BE_U_4(rp->rm_xid)); + GET_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(": NFS reply xid %u ", - EXTRACT_BE_U_4(rp->rm_xid)); + GET_BE_U_4(rp->rm_xid)); nfsreply_noaddr_print(ndo, (const u_char *)rp, fraglen, (const u_char *)ip); return; } @@ -830,7 +834,7 @@ print_tcp_rst_data(netdissect_options *ndo, } ND_PRINT(" "); while (length && sp < ndo->ndo_snapend) { - c = EXTRACT_U_1(sp); + c = GET_U_1(sp); sp++; fn_print_char(ndo, c); length--; @@ -857,7 +861,7 @@ print_tcp_fastopen_option(netdissect_options *ndo, const u_char *cp, } else { ND_PRINT(" cookie "); for (i = 0; i < datalen; ++i) - ND_PRINT("%02x", EXTRACT_U_1(cp + i)); + ND_PRINT("%02x", GET_U_1(cp + i)); } } } @@ -899,14 +903,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_U_2(ip->ip_len) - IP_HL(ip) * 4; + tlen = GET_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_U_2(ip6->ip6_plen)); + len32 = htonl(GET_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-telnet.c b/print-telnet.c index 3bfb19a2..e6223d9b 100644 --- a/print-telnet.c +++ b/print-telnet.c @@ -397,7 +397,7 @@ telnet_parse(netdissect_options *ndo, const u_char *sp, u_int length, int print) if (length < 1) \ goto pktend; \ ND_TCHECK_1(sp); \ - c = EXTRACT_U_1(sp); \ + c = GET_U_1(sp); \ sp++; \ length--; \ } while (0) @@ -439,12 +439,12 @@ telnet_parse(netdissect_options *ndo, const u_char *sp, u_int length, int print) p = sp; while (length > (u_int)(p + 1 - sp)) { ND_TCHECK_2(p); - if (EXTRACT_U_1(p) == IAC && EXTRACT_U_1(p + 1) == SE) + if (GET_U_1(p) == IAC && GET_U_1(p + 1) == SE) break; p++; } ND_TCHECK_1(p); - if (EXTRACT_U_1(p) != IAC) + if (GET_U_1(p) != IAC) goto pktend; switch (x) { @@ -517,7 +517,7 @@ telnet_print(netdissect_options *ndo, const u_char *sp, u_int length) osp = sp; ND_TCHECK_1(sp); - while (length > 0 && EXTRACT_U_1(sp) == IAC) { + while (length > 0 && GET_U_1(sp) == IAC) { /* * Parse the Telnet command without printing it, * to determine its length. diff --git a/print-tftp.c b/print-tftp.c index 2d765822..de9d4ebb 100644 --- a/print-tftp.c +++ b/print-tftp.c @@ -105,7 +105,7 @@ tftp_print(netdissect_options *ndo, if (length < 2) goto trunc; ND_TCHECK_2(bp); - opcode = EXTRACT_BE_U_2(bp); + opcode = GET_BE_U_2(bp); cp = tok2str(op2str, "tftp-#%u", opcode); ND_PRINT(", %s", cp); /* Bail if bogus opcode */ @@ -143,7 +143,7 @@ tftp_print(netdissect_options *ndo, /* Print options, if any */ while (length != 0) { ND_TCHECK_1(bp); - if (EXTRACT_U_1(bp) != '\0') + if (GET_U_1(bp) != '\0') ND_PRINT(" "); ui = nd_printztn(ndo, bp, length, ndo->ndo_snapend); if (ui == 0) @@ -157,7 +157,7 @@ tftp_print(netdissect_options *ndo, /* Print options */ while (length != 0) { ND_TCHECK_1(bp); - if (EXTRACT_U_1(bp) != '\0') + if (GET_U_1(bp) != '\0') ND_PRINT(" "); ui = nd_printztn(ndo, bp, length, ndo->ndo_snapend); if (ui == 0) @@ -172,7 +172,7 @@ tftp_print(netdissect_options *ndo, if (length < 2) goto trunc; /* no block number */ ND_TCHECK_2(bp); - ND_PRINT(" block %u", EXTRACT_BE_U_2(bp)); + ND_PRINT(" block %u", GET_BE_U_2(bp)); break; case TFTP_ERROR: @@ -181,7 +181,7 @@ tftp_print(netdissect_options *ndo, goto trunc; /* no error code */ ND_TCHECK_2(bp); ND_PRINT(" %s", tok2str(err2str, "tftp-err-#%u \"", - EXTRACT_BE_U_2(bp))); + GET_BE_U_2(bp))); bp += 2; length -= 2; /* Print error message string */ diff --git a/print-timed.c b/print-timed.c index f9a5835a..819f0161 100644 --- a/print-timed.c +++ b/print-timed.c @@ -99,30 +99,30 @@ timed_print(netdissect_options *ndo, ndo->ndo_protocol = "timed"; ND_TCHECK_1(tsp->tsp_type); - tsp_type = EXTRACT_U_1(tsp->tsp_type); + tsp_type = GET_U_1(tsp->tsp_type); if (tsp_type < TSPTYPENUMBER) ND_PRINT("TSP_%s", tsptype[tsp_type]); else ND_PRINT("(tsp_type %#x)", tsp_type); ND_TCHECK_1(tsp->tsp_vers); - ND_PRINT(" vers %u", EXTRACT_U_1(tsp->tsp_vers)); + ND_PRINT(" vers %u", GET_U_1(tsp->tsp_vers)); ND_TCHECK_2(tsp->tsp_seq); - ND_PRINT(" seq %u", EXTRACT_BE_U_2(tsp->tsp_seq)); + ND_PRINT(" seq %u", GET_BE_U_2(tsp->tsp_seq)); switch (tsp_type) { case TSP_LOOP: ND_TCHECK_1(tsp->tsp_hopcnt); - ND_PRINT(" hopcnt %u", EXTRACT_U_1(tsp->tsp_hopcnt)); + ND_PRINT(" hopcnt %u", GET_U_1(tsp->tsp_hopcnt)); break; case TSP_SETTIME: case TSP_ADJTIME: case TSP_SETDATE: case TSP_SETDATEREQ: ND_TCHECK_8(&tsp->tsp_time); - sec = EXTRACT_BE_S_4(tsp->tsp_time.tv_sec); - usec = EXTRACT_BE_S_4(tsp->tsp_time.tv_usec); + sec = GET_BE_S_4(tsp->tsp_time.tv_sec); + usec = GET_BE_S_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 45de7387..ec81d925 100644 --- a/print-tipc.c +++ b/print-tipc.c @@ -171,15 +171,15 @@ print_payload(netdissect_options *ndo, const struct payload_tipc_pkthdr *ap) u_int dest_node; ND_TCHECK_4(ap->dest_port); - w0 = EXTRACT_BE_U_4(ap->w0); + w0 = GET_BE_U_4(ap->w0); user = TIPC_USER(w0); hsize = TIPC_HSIZE(w0); msize = TIPC_MSIZE(w0); - w1 = EXTRACT_BE_U_4(ap->w1); + w1 = GET_BE_U_4(ap->w1); mtype = TIPC_MTYPE(w1); - 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); + prev_node = GET_BE_U_4(ap->prev_node); + orig_port = GET_BE_U_4(ap->orig_port); + dest_port = GET_BE_U_4(ap->dest_port); if (hsize <= 6) { ND_PRINT("TIPC v%u.0 %u.%u.%u:%u > %u, headerlength %u bytes, MessageSize %u bytes, %s, messageType %s", TIPC_VER(w0), @@ -190,8 +190,8 @@ print_payload(netdissect_options *ndo, const struct payload_tipc_pkthdr *ap) tok2str(tipcmtype_values, "Unknown", mtype)); } else { ND_TCHECK_4(ap->dest_node); - orig_node = EXTRACT_BE_U_4(ap->orig_node); - dest_node = EXTRACT_BE_U_4(ap->dest_node); + orig_node = GET_BE_U_4(ap->orig_node); + dest_node = GET_BE_U_4(ap->dest_node); ND_PRINT("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), @@ -204,7 +204,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_U_4(ap->w2); + w2 = GET_BE_U_4(ap->w2); link_ack = TIPC_LINK_ACK(w2); link_seq = TIPC_LINK_SEQ(w2); ND_PRINT("\n\tPrevious Node %u.%u.%u, Broadcast Ack %u, Link Ack %u, Link Sequence %u", @@ -241,14 +241,14 @@ print_internal(netdissect_options *ndo, const struct internal_tipc_pkthdr *ap) u_int link_tol; ND_TCHECK_4(ap->dest_node); - w0 = EXTRACT_BE_U_4(ap->w0); + w0 = GET_BE_U_4(ap->w0); user = TIPC_USER(w0); hsize = TIPC_HSIZE(w0); msize = TIPC_MSIZE(w0); - w1 = EXTRACT_BE_U_4(ap->w1); + w1 = GET_BE_U_4(ap->w1); mtype = TIPC_MTYPE(w1); - orig_node = EXTRACT_BE_U_4(ap->orig_node); - dest_node = EXTRACT_BE_U_4(ap->dest_node); + orig_node = GET_BE_U_4(ap->orig_node); + dest_node = GET_BE_U_4(ap->dest_node); ND_PRINT("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), @@ -261,17 +261,17 @@ print_internal(netdissect_options *ndo, const struct internal_tipc_pkthdr *ap) ND_TCHECK_SIZE(ap); seq_gap = TIPC_SEQ_GAP(w1); broadcast_ack = TIPC_BROADCAST_ACK(w1); - w2 = EXTRACT_BE_U_4(ap->w2); + w2 = GET_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_U_4(ap->prev_node); - w4 = EXTRACT_BE_U_4(ap->w4); + prev_node = GET_BE_U_4(ap->prev_node); + w4 = GET_BE_U_4(ap->w4); last_sent_frag = TIPC_LAST_SENT_FRAG(w4); next_sent_frag = TIPC_NEXT_SENT_FRAG(w4); - w5 = EXTRACT_BE_U_4(ap->w5); + w5 = GET_BE_U_4(ap->w5); sess_no = TIPC_SESS_NO(w5); - trans_seq = EXTRACT_BE_U_4(ap->trans_seq); - w9 = EXTRACT_BE_U_4(ap->w9); + trans_seq = GET_BE_U_4(ap->trans_seq); + w9 = GET_BE_U_4(ap->w9); msg_cnt = TIPC_MSG_CNT(w9); link_tol = TIPC_LINK_TOL(w9); ND_PRINT("\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", @@ -301,14 +301,14 @@ print_link_conf(netdissect_options *ndo, const struct link_conf_tipc_pkthdr *ap) u_int media_id; ND_TCHECK_4(ap->prev_node); - w0 = EXTRACT_BE_U_4(ap->w0); + w0 = GET_BE_U_4(ap->w0); user = TIPC_USER(w0); hsize = TIPC_HSIZE(w0); msize = TIPC_MSIZE(w0); - w1 = EXTRACT_BE_U_4(ap->w1); + w1 = GET_BE_U_4(ap->w1); mtype = TIPC_MTYPE(w1); - dest_domain = EXTRACT_BE_U_4(ap->dest_domain); - prev_node = EXTRACT_BE_U_4(ap->prev_node); + dest_domain = GET_BE_U_4(ap->dest_domain); + prev_node = GET_BE_U_4(ap->prev_node); ND_PRINT("TIPC v%u.0 %u.%u.%u > %u.%u.%u, headerlength %u bytes, MessageSize %u bytes, %s, messageType %s", TIPC_VER(w0), @@ -320,8 +320,8 @@ print_link_conf(netdissect_options *ndo, const struct link_conf_tipc_pkthdr *ap) if (ndo->ndo_vflag) { ND_TCHECK_4(ap->w5); node_sig = TIPC_NODE_SIG(w1); - ntwrk_id = EXTRACT_BE_U_4(ap->ntwrk_id); - w5 = EXTRACT_BE_U_4(ap->w5); + ntwrk_id = GET_BE_U_4(ap->ntwrk_id); + w5 = GET_BE_U_4(ap->w5); media_id = TIPC_MEDIA_ID(w5); ND_PRINT("\n\tNodeSignature %u, network_id %u, media_id %u", node_sig, ntwrk_id, media_id); @@ -343,7 +343,7 @@ tipc_print(netdissect_options *ndo, const u_char *bp, u_int length _U_, ndo->ndo_protocol = "tipc"; ap = (const struct tipc_pkthdr *)bp; ND_TCHECK_4(ap->w0); - w0 = EXTRACT_BE_U_4(ap->w0); + w0 = GET_BE_U_4(ap->w0); user = TIPC_USER(w0); switch (user) diff --git a/print-token.c b/print-token.c index 1f298d4d..6a323308 100644 --- a/print-token.c +++ b/print-token.c @@ -69,15 +69,15 @@ #define TOKEN_HDRLEN 14 #define ROUTING_SEGMENT_MAX 16 #define IS_SOURCE_ROUTED(trp) ((trp)->token_shost[0] & 0x80) -#define FRAME_TYPE(trp) ((EXTRACT_U_1((trp)->token_fc) & 0xC0) >> 6) +#define FRAME_TYPE(trp) ((GET_U_1((trp)->token_fc) & 0xC0) >> 6) #define TOKEN_FC_LLC 1 -#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 BROADCAST(trp) ((GET_BE_U_2((trp)->token_rcf) & 0xE000) >> 13) +#define RIF_LENGTH(trp) ((GET_BE_U_2((trp)->token_rcf) & 0x1f00) >> 8) +#define DIRECTION(trp) ((GET_BE_U_2((trp)->token_rcf) & 0x0080) >> 7) +#define LARGEST_FRAME(trp) ((GET_BE_U_2((trp)->token_rcf) & 0x0070) >> 4) +#define RING_NUMBER(trp, x) ((GET_BE_U_2((trp)->token_rseg[x]) & 0xfff0) >> 4) +#define BRIDGE_NUMBER(trp, x) (GET_BE_U_2((trp)->token_rseg[x]) & 0x000f) #define SEGMENT_COUNT(trp) ((int)((RIF_LENGTH(trp) - 2) / 2)) struct token_header { @@ -113,8 +113,8 @@ token_hdr_print(netdissect_options *ndo, if (!ndo->ndo_qflag) ND_PRINT("%02x %02x ", - EXTRACT_U_1(trp->token_ac), - EXTRACT_U_1(trp->token_fc)); + GET_U_1(trp->token_ac), + GET_U_1(trp->token_fc)); ND_PRINT("%s > %s, length %u: ", srcname, dstname, length); @@ -191,10 +191,11 @@ token_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen ND_PRINT(" [%u:%u]", RING_NUMBER(trp, seg), BRIDGE_NUMBER(trp, seg)); } else { - ND_PRINT("rt = %x", EXTRACT_BE_U_2(trp->token_rcf)); + ND_PRINT("rt = %x", GET_BE_U_2(trp->token_rcf)); for (seg = 0; seg < SEGMENT_COUNT(trp); seg++) - ND_PRINT(":%x", EXTRACT_BE_U_2(trp->token_rseg[seg])); + ND_PRINT(":%x", + GET_BE_U_2(trp->token_rseg[seg])); } ND_PRINT(" (%s) ", largest_frame[LARGEST_FRAME(trp)]); } else { diff --git a/print-udld.c b/print-udld.c index e17e7128..543e6582 100644 --- a/print-udld.c +++ b/print-udld.c @@ -106,14 +106,14 @@ udld_print(netdissect_options *ndo, const u_char *pptr, u_int length) ND_TCHECK_LEN(tptr, UDLD_HEADER_LEN); - code = UDLD_EXTRACT_OPCODE(EXTRACT_U_1(tptr)); + code = UDLD_EXTRACT_OPCODE(GET_U_1(tptr)); ND_PRINT("UDLDv%u, Code %s (%x), Flags [%s] (0x%02x), length %u", - UDLD_EXTRACT_VERSION(EXTRACT_U_1(tptr)), + UDLD_EXTRACT_VERSION(GET_U_1(tptr)), tok2str(udld_code_values, "Reserved", code), code, - bittok2str(udld_flags_values, "none", EXTRACT_U_1((tptr + 1))), - EXTRACT_U_1((tptr + 1)), + bittok2str(udld_flags_values, "none", GET_U_1((tptr + 1))), + GET_U_1((tptr + 1)), length); /* @@ -123,15 +123,15 @@ udld_print(netdissect_options *ndo, const u_char *pptr, u_int length) return; } - ND_PRINT("\n\tChecksum 0x%04x (unverified)", EXTRACT_BE_U_2(tptr + 2)); + ND_PRINT("\n\tChecksum 0x%04x (unverified)", GET_BE_U_2(tptr + 2)); tptr += UDLD_HEADER_LEN; while (tptr < (pptr+length)) { ND_TCHECK_4(tptr); - type = EXTRACT_BE_U_2(tptr); - len = EXTRACT_BE_U_2(tptr + 2); + type = GET_BE_U_2(tptr); + len = GET_BE_U_2(tptr + 2); ND_PRINT("\n\t%s (0x%04x) TLV, length %u", tok2str(udld_tlv_values, "Unknown", type), @@ -166,13 +166,13 @@ udld_print(netdissect_options *ndo, const u_char *pptr, u_int length) case UDLD_TIMEOUT_INTERVAL_TLV: if (len != 1) goto invalid; - ND_PRINT(", %us", (EXTRACT_U_1(tptr))); + ND_PRINT(", %us", (GET_U_1(tptr))); break; case UDLD_SEQ_NUMBER_TLV: if (len != 4) goto invalid; - ND_PRINT(", %u", EXTRACT_BE_U_4(tptr)); + ND_PRINT(", %u", GET_BE_U_4(tptr)); break; default: diff --git a/print-udp.c b/print-udp.c index 5e1bb749..e27882dc 100644 --- a/print-udp.c +++ b/print-udp.c @@ -104,7 +104,7 @@ vat_print(netdissect_options *ndo, const void *hdr, u_int length) return; } ND_TCHECK_2((const u_int *)hdr); - ts = EXTRACT_BE_U_2(hdr); + ts = GET_BE_U_2(hdr); if ((ts & 0xf060) != 0) { /* probably vt */ ND_PRINT("udp/vt %u %u / %u", @@ -119,9 +119,9 @@ vat_print(netdissect_options *ndo, const void *hdr, u_int length) return; } ND_TCHECK_4(&((const u_int *)hdr)[0]); - i0 = EXTRACT_BE_U_4(&((const u_int *)hdr)[0]); + i0 = GET_BE_U_4(&((const u_int *)hdr)[0]); ND_TCHECK_4(&((const u_int *)hdr)[1]); - i1 = EXTRACT_BE_U_4(&((const u_int *)hdr)[1]); + i1 = GET_BE_U_4(&((const u_int *)hdr)[1]); ND_PRINT("udp/vat %u c%u %u%s", length - 8, i0 & 0xffff, @@ -153,9 +153,9 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len) return; } ND_TCHECK_4(&((const u_int *)hdr)[0]); - i0 = EXTRACT_BE_U_4(&((const u_int *)hdr)[0]); + i0 = GET_BE_U_4(&((const u_int *)hdr)[0]); ND_TCHECK_4(&((const u_int *)hdr)[1]); - i1 = EXTRACT_BE_U_4(&((const u_int *)hdr)[1]); + i1 = GET_BE_U_4(&((const u_int *)hdr)[1]); dlen = len - 8; ip += 2; len >>= 2; @@ -192,12 +192,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(" %u", EXTRACT_BE_U_4(&((const u_int *)hdr)[2])); + ND_PRINT(" %u", GET_BE_U_4(&((const u_int *)hdr)[2])); if (hasopt) { u_int i2, optlen; do { ND_TCHECK_4(ip); - i2 = EXTRACT_BE_U_4(ip); + i2 = GET_BE_U_4(ip); optlen = (i2 >> 16) & 0xff; if (optlen == 0 || optlen > len) { ND_PRINT(" !opt"); @@ -210,7 +210,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_U_4(ip); + i2 = GET_BE_U_4(ip); extlen = (i2 & 0xffff) + 1; if (extlen > len) { ND_PRINT(" !ext"); @@ -220,7 +220,7 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len) } ND_TCHECK_4(ip); if (contype == 0x1f) /*XXX H.261 */ - ND_PRINT(" 0x%04x", EXTRACT_BE_U_4(ip) >> 16); + ND_PRINT(" 0x%04x", GET_BE_U_4(ip) >> 16); } return; @@ -244,8 +244,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_SIZE(rh); - len = (EXTRACT_BE_U_2(rh->rh_len) + 1) * 4; - flags = EXTRACT_BE_U_2(rh->rh_flags); + len = (GET_BE_U_2(rh->rh_len) + 1) * 4; + flags = GET_BE_U_2(rh->rh_flags); cnt = (flags >> 8) & 0x1f; switch (flags & 0xff) { case RTCP_PT_SR: @@ -254,15 +254,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(" [%u]", len); if (ndo->ndo_vflag) - ND_PRINT(" %u", EXTRACT_BE_U_4(rh->rh_ssrc)); + ND_PRINT(" %u", GET_BE_U_4(rh->rh_ssrc)); if ((const u_char *)(sr + 1) > ep) goto trunc; ND_TCHECK_SIZE(sr); - ts = (double)(EXTRACT_BE_U_4(sr->sr_ntp.upper)) + - ((double)(EXTRACT_BE_U_4(sr->sr_ntp.lower)) / + ts = (double)(GET_BE_U_4(sr->sr_ntp.upper)) + + ((double)(GET_BE_U_4(sr->sr_ntp.lower)) / 4294967296.0); - ND_PRINT(" @%.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)); + ND_PRINT(" @%.2f %u %up %ub", ts, GET_BE_U_4(sr->sr_ts), + GET_BE_U_4(sr->sr_np), GET_BE_U_4(sr->sr_nb)); rr = (const struct rtcp_rr *)(sr + 1); break; case RTCP_PT_RR: @@ -271,18 +271,18 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep) ND_PRINT(" [%u]", len); rr = (const struct rtcp_rr *)(rh + 1); if (ndo->ndo_vflag) - ND_PRINT(" %u", EXTRACT_BE_U_4(rh->rh_ssrc)); + ND_PRINT(" %u", GET_BE_U_4(rh->rh_ssrc)); break; case RTCP_PT_SDES: ND_PRINT(" sdes %u", len); if (ndo->ndo_vflag) - ND_PRINT(" %u", EXTRACT_BE_U_4(rh->rh_ssrc)); + ND_PRINT(" %u", GET_BE_U_4(rh->rh_ssrc)); cnt = 0; break; case RTCP_PT_BYE: ND_PRINT(" bye %u", len); if (ndo->ndo_vflag) - ND_PRINT(" %u", EXTRACT_BE_U_4(rh->rh_ssrc)); + ND_PRINT(" %u", GET_BE_U_4(rh->rh_ssrc)); cnt = 0; break; default: @@ -297,13 +297,13 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep) goto trunc; ND_TCHECK_SIZE(rr); if (ndo->ndo_vflag) - ND_PRINT(" %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(" %u", GET_BE_U_4(rr->rr_srcid)); + ts = (double)(GET_BE_U_4(rr->rr_lsr)) / 65536.; + dts = (double)(GET_BE_U_4(rr->rr_dlsr)) / 65536.; ND_PRINT(" %ul %us %uj @%.2f+%.2f", - EXTRACT_BE_U_4(rr->rr_nl) & 0x00ffffff, - EXTRACT_BE_U_4(rr->rr_ls), - EXTRACT_BE_U_4(rr->rr_dv), ts, dts); + GET_BE_U_4(rr->rr_nl) & 0x00ffffff, + GET_BE_U_4(rr->rr_ls), + GET_BE_U_4(rr->rr_dv), ts, dts); cnt--; } return (hdr + len); @@ -339,7 +339,7 @@ udpipaddr_print(netdissect_options *ndo, const struct ip *ip, int sport, int dpo ip6 = NULL; if (ip6) { - if (EXTRACT_U_1(ip6->ip6_nxt) == IPPROTO_UDP) { + if (GET_U_1(ip6->ip6_nxt) == IPPROTO_UDP) { if (sport == -1) { ND_PRINT("%s > %s: ", ip6addr_string(ndo, ip6->ip6_src), @@ -359,7 +359,7 @@ udpipaddr_print(netdissect_options *ndo, const struct ip *ip, int sport, int dpo } } } else { - if (EXTRACT_U_1(ip->ip_p) == IPPROTO_UDP) { + if (GET_U_1(ip->ip_p) == IPPROTO_UDP) { if (sport == -1) { ND_PRINT("%s > %s: ", ipaddr_string(ndo, ip->ip_src), @@ -404,8 +404,8 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, goto trunc; } - sport = EXTRACT_BE_U_2(up->uh_sport); - dport = EXTRACT_BE_U_2(up->uh_dport); + sport = GET_BE_U_2(up->uh_sport); + dport = GET_BE_U_2(up->uh_dport); if (length < sizeof(struct udphdr)) { udpipaddr_print(ndo, ip, sport, dport); @@ -416,7 +416,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, udpipaddr_print(ndo, ip, sport, dport); goto trunc; } - ulen = EXTRACT_BE_U_2(up->uh_ulen); + ulen = GET_BE_U_2(up->uh_ulen); if (ulen < sizeof(struct udphdr)) { udpipaddr_print(ndo, ip, sport, dport); ND_PRINT("truncated-udplength %u", ulen); @@ -452,7 +452,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, case PT_RPC: rp = (const struct sunrpc_msg *)(up + 1); ND_TCHECK_4(rp->rm_direction); - direction = (enum sunrpc_msg_type) EXTRACT_BE_U_4(rp->rm_direction); + direction = (enum sunrpc_msg_type) GET_BE_U_4(rp->rm_direction); if (direction == SUNRPC_CALL) sunrpc_print(ndo, (const u_char *)rp, length, (const u_char *)ip); @@ -523,17 +523,17 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, rp = (const struct sunrpc_msg *)(up + 1); if (ND_TTEST_4(rp->rm_direction)) { - direction = (enum sunrpc_msg_type) EXTRACT_BE_U_4(rp->rm_direction); + direction = (enum sunrpc_msg_type) GET_BE_U_4(rp->rm_direction); if (dport == NFS_PORT && direction == SUNRPC_CALL) { ND_PRINT("NFS request xid %u ", - EXTRACT_BE_U_4(rp->rm_xid)); + GET_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("NFS reply xid %u ", - EXTRACT_BE_U_4(rp->rm_xid)); + GET_BE_U_4(rp->rm_xid)); nfsreply_noaddr_print(ndo, (const u_char *)rp, length, (const u_char *)ip); return; @@ -557,7 +557,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, */ if (IP_V(ip) == 4 && (ndo->ndo_vflag > 1)) { ND_TCHECK_2(up->uh_sum); - udp_sum = EXTRACT_BE_U_2(up->uh_sum); + udp_sum = GET_BE_U_2(up->uh_sum); if (udp_sum == 0) { ND_PRINT("[no cksum] "); } else if (ND_TTEST_LEN(cp, length)) { @@ -576,7 +576,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, if (ND_TTEST_LEN(cp, length)) { sum = udp6_cksum(ndo, ip6, up, length + sizeof(struct udphdr)); ND_TCHECK_2(up->uh_sum); - udp_sum = EXTRACT_BE_U_2(up->uh_sum); + udp_sum = GET_BE_U_2(up->uh_sum); if (sum != 0) { ND_PRINT("[bad udp cksum 0x%04x -> 0x%04x!] ", @@ -703,7 +703,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, else if (IS_SRC_OR_DST_PORT(ZEP_PORT)) zep_print(ndo, (const u_char *)(up + 1), length); else if (ND_TTEST_1(((const struct LAP *)cp)->type) && - EXTRACT_U_1(((const struct LAP *)cp)->type) == lapDDP && + GET_U_1(((const struct LAP *)cp)->type) == lapDDP && (atalk_port(sport) || atalk_port(dport))) { if (ndo->ndo_vflag) ND_PRINT("kip "); diff --git a/print-usb.c b/print-usb.c index 56e6dd46..d0ae440e 100644 --- a/print-usb.c +++ b/print-usb.c @@ -187,7 +187,7 @@ usb_header_print(netdissect_options *ndo, const pcap_usb_header *uh) int direction; uint8_t transfer_type, event_type; - transfer_type = EXTRACT_U_1(uh->transfer_type); + transfer_type = GET_U_1(uh->transfer_type); switch(transfer_type) { case URB_ISOCHRONOUS: @@ -206,7 +206,7 @@ usb_header_print(netdissect_options *ndo, const pcap_usb_header *uh) ND_PRINT(" ?"); } - event_type = EXTRACT_U_1(uh->event_type); + event_type = GET_U_1(uh->event_type); switch(event_type) { case URB_SUBMIT: @@ -227,7 +227,9 @@ usb_header_print(netdissect_options *ndo, const pcap_usb_header *uh) ND_PRINT(" from"); else if(direction == 2) ND_PRINT(" to"); - ND_PRINT(" %u:%u:%u", EXTRACT_HE_U_2(uh->bus_id), EXTRACT_U_1(uh->device_address), EXTRACT_U_1(uh->endpoint_number) & 0x7f); + ND_PRINT(" %u:%u:%u", GET_HE_U_2(uh->bus_id), + GET_U_1(uh->device_address), + GET_U_1(uh->endpoint_number) & 0x7f); } /* diff --git a/print-vjc.c b/print-vjc.c index 44bdb1fc..28e4c8e9 100644 --- a/print-vjc.c +++ b/print-vjc.c @@ -90,7 +90,7 @@ vjc_print(netdissect_options *ndo, const u_char *bp, u_short proto _U_) ndo->ndo_protocol = "vjc"; ND_TCHECK_1(bp); - switch (EXTRACT_U_1(bp) & 0xf0) { + switch (GET_U_1(bp) & 0xf0) { case TYPE_IP: if (ndo->ndo_eflag) ND_PRINT("(vjc type=IP) "); @@ -104,13 +104,13 @@ vjc_print(netdissect_options *ndo, const u_char *bp, u_short proto _U_) ND_PRINT("(vjc type=compressed TCP) "); for (i = 0; i < 8; i++) { ND_TCHECK_1(bp + 1); - if (EXTRACT_U_1(bp + 1) & (0x80 >> i)) + if (GET_U_1(bp + 1) & (0x80 >> i)) ND_PRINT("%c", "?CI?SAWU"[i]); } - if (EXTRACT_U_1(bp + 1)) + if (GET_U_1(bp + 1)) ND_PRINT(" "); ND_TCHECK_1(bp + 2); - ND_PRINT("C=0x%02x ", EXTRACT_U_1(bp + 2)); + ND_PRINT("C=0x%02x ", GET_U_1(bp + 2)); ND_TCHECK_2(bp + 3); ND_PRINT("sum=0x%04x ", *(const u_short *)(bp + 3)); return -1; @@ -120,7 +120,7 @@ vjc_print(netdissect_options *ndo, const u_char *bp, u_short proto _U_) return -1; default: if (ndo->ndo_eflag) - ND_PRINT("(vjc type=0x%02x) ", EXTRACT_U_1(bp) & 0xf0); + ND_PRINT("(vjc type=0x%02x) ", GET_U_1(bp) & 0xf0); return -1; } diff --git a/print-vqp.c b/print-vqp.c index 0c481452..b0fba902 100644 --- a/print-vqp.c +++ b/print-vqp.c @@ -115,7 +115,7 @@ vqp_print(netdissect_options *ndo, const u_char *pptr, u_int len) ND_TCHECK_SIZE(vqp_common_header); if (sizeof(struct vqp_common_header_t) > tlen) goto trunc; - version = EXTRACT_U_1(vqp_common_header->version); + version = GET_U_1(vqp_common_header->version); /* * Sanity checking of the header. @@ -130,22 +130,22 @@ vqp_print(netdissect_options *ndo, const u_char *pptr, u_int len) if (ndo->ndo_vflag < 1) { ND_PRINT("VQPv%u %s Message, error-code %s (%u), length %u", version, - tok2str(vqp_msg_type_values, "unknown (%u)",EXTRACT_U_1(vqp_common_header->msg_type)), - tok2str(vqp_error_code_values, "unknown (%u)",EXTRACT_U_1(vqp_common_header->error_code)), - EXTRACT_U_1(vqp_common_header->error_code), + tok2str(vqp_msg_type_values, "unknown (%u)",GET_U_1(vqp_common_header->msg_type)), + tok2str(vqp_error_code_values, "unknown (%u)",GET_U_1(vqp_common_header->error_code)), + GET_U_1(vqp_common_header->error_code), len); return; } /* ok they seem to want to know everything - lets fully decode it */ - nitems = EXTRACT_U_1(vqp_common_header->nitems); + nitems = GET_U_1(vqp_common_header->nitems); ND_PRINT("\n\tVQPv%u, %s Message, error-code %s (%u), seq 0x%08x, items %u, length %u", version, - tok2str(vqp_msg_type_values, "unknown (%u)",EXTRACT_U_1(vqp_common_header->msg_type)), - tok2str(vqp_error_code_values, "unknown (%u)",EXTRACT_U_1(vqp_common_header->error_code)), - EXTRACT_U_1(vqp_common_header->error_code), - EXTRACT_BE_U_4(vqp_common_header->sequence), - nitems, + tok2str(vqp_msg_type_values, "unknown (%u)",GET_U_1(vqp_common_header->msg_type)), + tok2str(vqp_error_code_values, "unknown (%u)",GET_U_1(vqp_common_header->error_code)), + GET_U_1(vqp_common_header->error_code), + GET_BE_U_4(vqp_common_header->sequence), + nitems, len); /* skip VQP Common header */ @@ -158,8 +158,8 @@ vqp_print(netdissect_options *ndo, const u_char *pptr, u_int len) ND_TCHECK_SIZE(vqp_obj_tlv); if (sizeof(struct vqp_obj_tlv_t) > tlen) goto trunc; - vqp_obj_type = EXTRACT_BE_U_4(vqp_obj_tlv->obj_type); - vqp_obj_len = EXTRACT_BE_U_2(vqp_obj_tlv->obj_length); + vqp_obj_type = GET_BE_U_4(vqp_obj_tlv->obj_type); + vqp_obj_len = GET_BE_U_2(vqp_obj_tlv->obj_length); tptr+=sizeof(struct vqp_obj_tlv_t); tlen-=sizeof(struct vqp_obj_tlv_t); @@ -181,7 +181,8 @@ vqp_print(netdissect_options *ndo, const u_char *pptr, u_int len) case VQP_OBJ_IP_ADDRESS: if (vqp_obj_len != 4) goto trunc; - ND_PRINT("%s (0x%08x)", ipaddr_string(ndo, tptr), EXTRACT_BE_U_4(tptr)); + ND_PRINT("%s (0x%08x)", ipaddr_string(ndo, tptr), + GET_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 71f70f0c..400dc714 100644 --- a/print-vrrp.c +++ b/print-vrrp.c @@ -112,8 +112,8 @@ vrrp_print(netdissect_options *ndo, ndo->ndo_protocol = "vrrp"; ND_TCHECK_1(bp); - version = (EXTRACT_U_1(bp) & 0xf0) >> 4; - type = EXTRACT_U_1(bp) & 0x0f; + version = (GET_U_1(bp) & 0xf0) >> 4; + type = GET_U_1(bp) & 0x0f; type_s = tok2str(type2str, "unknown type (%u)", type); ND_PRINT("VRRPv%u, %s", version, type_s); if (ttl != 255) @@ -121,20 +121,20 @@ vrrp_print(netdissect_options *ndo, if (version < 2 || version > 3 || type != VRRP_TYPE_ADVERTISEMENT) return; ND_TCHECK_1(bp + 2); - ND_PRINT(", vrid %u, prio %u", EXTRACT_U_1(bp + 1), EXTRACT_U_1(bp + 2)); + ND_PRINT(", vrid %u, prio %u", GET_U_1(bp + 1), GET_U_1(bp + 2)); ND_TCHECK_1(bp + 5); if (version == 2) { - auth_type = EXTRACT_U_1(bp + 4); + auth_type = GET_U_1(bp + 4); ND_PRINT(", authtype %s", tok2str(auth2str, NULL, auth_type)); - ND_PRINT(", intvl %us, length %u", EXTRACT_U_1(bp + 5), len); + ND_PRINT(", intvl %us, length %u", GET_U_1(bp + 5), len); } else { /* version == 3 */ - uint16_t intvl = (EXTRACT_U_1(bp + 4) & 0x0f) << 8 | EXTRACT_U_1(bp + 5); + uint16_t intvl = (GET_U_1(bp + 4) & 0x0f) << 8 | GET_U_1(bp + 5); ND_PRINT(", intvl %ucs, length %u", intvl, len); } if (ndo->ndo_vflag) { - u_int naddrs = EXTRACT_U_1(bp + 3); + u_int naddrs = GET_U_1(bp + 3); u_int i; char c; @@ -145,7 +145,7 @@ vrrp_print(netdissect_options *ndo, vec[0].len = len; if (in_cksum(vec, 1)) ND_PRINT(", (bad vrrp cksum %x)", - EXTRACT_BE_U_2(bp + 6)); + GET_BE_U_2(bp + 6)); } if (version == 3 && ND_TTEST_LEN(bp, len)) { @@ -153,7 +153,7 @@ vrrp_print(netdissect_options *ndo, len, len, IPPROTO_VRRP); if (cksum) ND_PRINT(", (bad vrrp cksum %x)", - EXTRACT_BE_U_2(bp + 6)); + GET_BE_U_2(bp + 6)); } ND_PRINT(", addrs"); diff --git a/print-vtp.c b/print-vtp.c index 2718d2ac..e2b1f9ff 100644 --- a/print-vtp.c +++ b/print-vtp.c @@ -131,9 +131,9 @@ vtp_print(netdissect_options *ndo, ND_TCHECK_LEN(tptr, VTP_HEADER_LEN); - type = EXTRACT_U_1(tptr + 1); + type = GET_U_1(tptr + 1); ND_PRINT("VTPv%u, Message %s (0x%02x), length %u", - EXTRACT_U_1(tptr), + GET_U_1(tptr), tok2str(vtp_message_type_values,"Unknown message type", type), type, length); @@ -145,7 +145,7 @@ vtp_print(netdissect_options *ndo, /* verbose mode print all fields */ ND_PRINT("\n\tDomain name: "); - mgmtd_len = EXTRACT_U_1(tptr + 3); + mgmtd_len = GET_U_1(tptr + 3); if (mgmtd_len < 1 || mgmtd_len > 32) { ND_PRINT(" [invalid MgmtD Len %u]", mgmtd_len); return; @@ -153,7 +153,7 @@ vtp_print(netdissect_options *ndo, nd_printzp(ndo, tptr + 4, mgmtd_len, NULL); ND_PRINT(", %s: %u", tok2str(vtp_header_values, "Unknown", type), - EXTRACT_U_1(tptr + 2)); + GET_U_1(tptr + 2)); tptr += VTP_HEADER_LEN; @@ -183,21 +183,21 @@ vtp_print(netdissect_options *ndo, ND_TCHECK_8(tptr); ND_PRINT("\n\t Config Rev %x, Updater %s", - EXTRACT_BE_U_4(tptr), + GET_BE_U_4(tptr), ipaddr_string(ndo, tptr+4)); tptr += 8; ND_TCHECK_LEN(tptr, VTP_UPDATE_TIMESTAMP_LEN); ND_PRINT(", Timestamp 0x%08x 0x%08x 0x%08x", - EXTRACT_BE_U_4(tptr), - EXTRACT_BE_U_4(tptr + 4), - EXTRACT_BE_U_4(tptr + 8)); + GET_BE_U_4(tptr), + GET_BE_U_4(tptr + 4), + GET_BE_U_4(tptr + 8)); tptr += VTP_UPDATE_TIMESTAMP_LEN; ND_TCHECK_LEN(tptr, VTP_MD5_DIGEST_LEN); ND_PRINT(", MD5 digest: %08x%08x%08x%08x", - EXTRACT_BE_U_4(tptr), - EXTRACT_BE_U_4(tptr + 4), - EXTRACT_BE_U_4(tptr + 8), - EXTRACT_BE_U_4(tptr + 12)); + GET_BE_U_4(tptr), + GET_BE_U_4(tptr + 4), + GET_BE_U_4(tptr + 8), + GET_BE_U_4(tptr + 12)); tptr += VTP_MD5_DIGEST_LEN; break; @@ -224,7 +224,7 @@ vtp_print(netdissect_options *ndo, */ ND_TCHECK_4(tptr); - ND_PRINT(", Config Rev %x", EXTRACT_BE_U_4(tptr)); + ND_PRINT(", Config Rev %x", GET_BE_U_4(tptr)); /* * VLAN INFORMATION @@ -245,7 +245,7 @@ vtp_print(netdissect_options *ndo, while (tptr < (pptr+length)) { ND_TCHECK_1(tptr); - len = EXTRACT_U_1(tptr); + len = GET_U_1(tptr); if (len == 0) break; @@ -256,14 +256,14 @@ vtp_print(netdissect_options *ndo, goto trunc; ND_TCHECK_SIZE(vtp_vlan); ND_PRINT("\n\tVLAN info status %s, type %s, VLAN-id %u, MTU %u, SAID 0x%08x, Name ", - tok2str(vtp_vlan_status,"Unknown",EXTRACT_U_1(vtp_vlan->status)), - tok2str(vtp_vlan_type_values,"Unknown",EXTRACT_U_1(vtp_vlan->type)), - EXTRACT_BE_U_2(vtp_vlan->vlanid), - EXTRACT_BE_U_2(vtp_vlan->mtu), - EXTRACT_BE_U_4(vtp_vlan->index)); + tok2str(vtp_vlan_status,"Unknown",GET_U_1(vtp_vlan->status)), + tok2str(vtp_vlan_type_values,"Unknown",GET_U_1(vtp_vlan->type)), + GET_BE_U_2(vtp_vlan->vlanid), + GET_BE_U_2(vtp_vlan->mtu), + GET_BE_U_4(vtp_vlan->index)); len -= VTP_VLAN_INFO_FIXED_PART_LEN; tptr += VTP_VLAN_INFO_FIXED_PART_LEN; - name_len = EXTRACT_U_1(vtp_vlan->name_len); + name_len = GET_U_1(vtp_vlan->name_len); if (len < 4*((name_len + 3)/4)) goto trunc; ND_TCHECK_LEN(tptr, name_len); @@ -289,8 +289,8 @@ vtp_print(netdissect_options *ndo, if (len < 2) goto trunc; ND_TCHECK_2(tptr); - type = EXTRACT_U_1(tptr); - tlv_len = EXTRACT_U_1(tptr + 1); + type = GET_U_1(tptr); + tlv_len = GET_U_1(tptr + 1); ND_PRINT("\n\t\t%s (0x%04x) TLV", tok2str(vtp_vlan_tlv_values, "Unknown", type), @@ -310,7 +310,7 @@ vtp_print(netdissect_options *ndo, ND_PRINT(" (invalid TLV length %u != 1)", tlv_len); return; } else { - tlv_value = EXTRACT_BE_U_2(tptr + 2); + tlv_value = GET_BE_U_2(tptr + 2); switch (type) { case VTP_VLAN_STE_HOP_COUNT: @@ -379,7 +379,7 @@ vtp_print(netdissect_options *ndo, */ ND_TCHECK_4(tptr); - ND_PRINT("\n\tStart value: %u", EXTRACT_BE_U_4(tptr)); + ND_PRINT("\n\tStart value: %u", GET_BE_U_4(tptr)); break; case VTP_JOIN_MESSAGE: diff --git a/print-vxlan-gpe.c b/print-vxlan-gpe.c index 7a022598..1364534e 100644 --- a/print-vxlan-gpe.c +++ b/print-vxlan-gpe.c @@ -69,13 +69,13 @@ vxlan_gpe_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_TCHECK_LEN(bp, VXLAN_GPE_HDR_LEN); - flags = EXTRACT_U_1(bp); + flags = GET_U_1(bp); bp += 3; - next_protocol = EXTRACT_U_1(bp); + next_protocol = GET_U_1(bp); bp += 1; - vni = EXTRACT_BE_U_3(bp); + vni = GET_BE_U_3(bp); bp += 4; ND_PRINT("VXLAN-GPE, "); diff --git a/print-vxlan.c b/print-vxlan.c index 73875a11..a27b1d71 100644 --- a/print-vxlan.c +++ b/print-vxlan.c @@ -55,10 +55,10 @@ vxlan_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_TCHECK_LEN(bp, VXLAN_HDR_LEN); - flags = EXTRACT_U_1(bp); + flags = GET_U_1(bp); bp += 4; - vni = EXTRACT_BE_U_3(bp); + vni = GET_BE_U_3(bp); bp += 4; ND_PRINT("VXLAN, "); @@ -49,7 +49,7 @@ #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_U_2((d)->dh_len) + sizeof(*(d))))) + DOP_ROUNDUP(GET_BE_U_2((d)->dh_len) + sizeof(*(d))))) /* * Format of the whiteboard packet header. @@ -191,14 +191,14 @@ wb_id(netdissect_options *ndo, len -= sizeof(*id); ND_PRINT(" %u/%s:%u (max %u/%s:%u) ", - EXTRACT_BE_U_4(id->pi_ps.slot), + GET_BE_U_4(id->pi_ps.slot), ipaddr_string(ndo, id->pi_ps.page.p_sid), - EXTRACT_BE_U_4(id->pi_ps.page.p_uid), - EXTRACT_BE_U_4(id->pi_mslot), + GET_BE_U_4(id->pi_ps.page.p_uid), + GET_BE_U_4(id->pi_mslot), ipaddr_string(ndo, id->pi_mpage.p_sid), - EXTRACT_BE_U_4(id->pi_mpage.p_uid)); + GET_BE_U_4(id->pi_mpage.p_uid)); - nid = EXTRACT_BE_U_2(id->pi_ps.nid); + nid = GET_BE_U_2(id->pi_ps.nid); len -= sizeof(*io) * nid; io = (const struct id_off *)(id + 1); cp = (const char *)(io + nid); @@ -211,7 +211,7 @@ wb_id(netdissect_options *ndo, c = '<'; for (i = 0; i < nid && ND_TTEST_SIZE(io); ++io, ++i) { ND_PRINT("%c%s:%u", - c, ipaddr_string(ndo, io->id), EXTRACT_BE_U_4(io->off)); + c, ipaddr_string(ndo, io->id), GET_BE_U_4(io->off)); c = ','; } if (i >= nid) { @@ -232,9 +232,9 @@ wb_rreq(netdissect_options *ndo, ND_PRINT(" please repair %s %s:%u<%u:%u>", ipaddr_string(ndo, rreq->pr_id), ipaddr_string(ndo, rreq->pr_page.p_sid), - EXTRACT_BE_U_4(rreq->pr_page.p_uid), - EXTRACT_BE_U_4(rreq->pr_sseq), - EXTRACT_BE_U_4(rreq->pr_eseq)); + GET_BE_U_4(rreq->pr_page.p_uid), + GET_BE_U_4(rreq->pr_sseq), + GET_BE_U_4(rreq->pr_eseq)); return (0); } @@ -247,9 +247,9 @@ wb_preq(netdissect_options *ndo, return (-1); ND_PRINT(" need %u/%s:%u", - EXTRACT_BE_U_4(preq->pp_low), + GET_BE_U_4(preq->pp_low), ipaddr_string(ndo, preq->pp_page.p_sid), - EXTRACT_BE_U_4(preq->pp_page.p_uid)); + GET_BE_U_4(preq->pp_page.p_uid)); return (0); } @@ -264,20 +264,20 @@ wb_prep(netdissect_options *ndo, ND_PRINT(" wb-prep:"); if (len < sizeof(*prep) || !ND_TTEST_SIZE(prep)) return (-1); - n = EXTRACT_BE_U_4(prep->pp_n); + n = GET_BE_U_4(prep->pp_n); ps = (const struct pgstate *)(prep + 1); while (n != 0 && ND_TTEST_SIZE(ps)) { const struct id_off *io, *ie; char c = '<'; ND_PRINT(" %u/%s:%u", - EXTRACT_BE_U_4(ps->slot), + GET_BE_U_4(ps->slot), ipaddr_string(ndo, ps->page.p_sid), - EXTRACT_BE_U_4(ps->page.p_uid)); + GET_BE_U_4(ps->page.p_uid)); io = (const struct id_off *)(ps + 1); - for (ie = io + EXTRACT_U_1(ps->nid); io < ie && ND_TTEST_SIZE(io); ++io) { + for (ie = io + GET_U_1(ps->nid); io < ie && ND_TTEST_SIZE(io); ++io) { ND_PRINT("%c%s:%u", c, ipaddr_string(ndo, io->id), - EXTRACT_BE_U_4(io->off)); + GET_BE_U_4(io->off)); c = ','; } ND_PRINT(">"); @@ -321,14 +321,14 @@ wb_dops(netdissect_options *ndo, const struct pkt_dop *dop, nd_print_trunc(ndo); break; } - t = EXTRACT_U_1(dh->dh_type); + t = GET_U_1(dh->dh_type); if (t > DT_MAXTYPE) ND_PRINT(" dop-%u!", t); else { ND_PRINT(" %s", dopstr[t]); if (t == DT_SKIP || t == DT_HOLE) { - uint32_t ts = EXTRACT_BE_U_4(dh->dh_ts); + uint32_t ts = GET_BE_U_4(dh->dh_ts); ND_PRINT("%u", ts - ss + 1); if (ss > ts || ts > es) { ND_PRINT("[|]"); @@ -358,14 +358,14 @@ wb_rrep(netdissect_options *ndo, ND_PRINT(" for %s %s:%u<%u:%u>", ipaddr_string(ndo, rrep->pr_id), ipaddr_string(ndo, dop->pd_page.p_sid), - EXTRACT_BE_U_4(dop->pd_page.p_uid), - EXTRACT_BE_U_4(dop->pd_sseq), - EXTRACT_BE_U_4(dop->pd_eseq)); + GET_BE_U_4(dop->pd_page.p_uid), + GET_BE_U_4(dop->pd_sseq), + GET_BE_U_4(dop->pd_eseq)); if (ndo->ndo_vflag) return (wb_dops(ndo, dop, - EXTRACT_BE_U_4(dop->pd_sseq), - EXTRACT_BE_U_4(dop->pd_eseq))); + GET_BE_U_4(dop->pd_sseq), + GET_BE_U_4(dop->pd_eseq))); return (0); } @@ -380,14 +380,14 @@ wb_drawop(netdissect_options *ndo, ND_PRINT(" %s:%u<%u:%u>", ipaddr_string(ndo, dop->pd_page.p_sid), - EXTRACT_BE_U_4(dop->pd_page.p_uid), - EXTRACT_BE_U_4(dop->pd_sseq), - EXTRACT_BE_U_4(dop->pd_eseq)); + GET_BE_U_4(dop->pd_page.p_uid), + GET_BE_U_4(dop->pd_sseq), + GET_BE_U_4(dop->pd_eseq)); if (ndo->ndo_vflag) return (wb_dops(ndo, dop, - EXTRACT_BE_U_4(dop->pd_sseq), - EXTRACT_BE_U_4(dop->pd_eseq))); + GET_BE_U_4(dop->pd_sseq), + GET_BE_U_4(dop->pd_eseq))); return (0); } @@ -409,9 +409,9 @@ wb_print(netdissect_options *ndo, } len -= sizeof(*ph); - if (EXTRACT_U_1(ph->ph_flags)) + if (GET_U_1(ph->ph_flags)) ND_PRINT("*"); - type = EXTRACT_U_1(ph->ph_type); + type = GET_U_1(ph->ph_type); switch (type) { case PT_KILL: diff --git a/print-zep.c b/print-zep.c index afb6fd7d..263068fc 100644 --- a/print-zep.c +++ b/print-zep.c @@ -68,8 +68,8 @@ static void zep_print_ts(netdissect_options *ndo, const u_char *p) uint32_t f; float ff; - i = EXTRACT_BE_U_4(p); - uf = EXTRACT_BE_U_4(p + 4); + i = GET_BE_U_4(p); + uf = GET_BE_U_4(p + 4); ff = (float) uf; if (ff < 0.0) /* some compilers are buggy */ ff += FMAXINT; @@ -111,31 +111,31 @@ zep_print(netdissect_options *ndo, ND_TCHECK_LEN(bp, 8); - if (EXTRACT_U_1(bp) != 'E' || EXTRACT_U_1(bp + 1) != 'X') + if (GET_U_1(bp) != 'E' || GET_U_1(bp + 1) != 'X') goto trunc; - version = EXTRACT_U_1(bp + 2); + version = GET_U_1(bp + 2); ND_PRINT("v%d ", version); if (version == 1) { /* ZEP v1 packet. */ ND_TCHECK_LEN(bp, 16); ND_PRINT("Channel ID %d, Device ID 0x%04x, ", - EXTRACT_U_1(bp + 3), EXTRACT_BE_U_2(bp + 4)); - if (EXTRACT_U_1(bp + 6)) + GET_U_1(bp + 3), GET_BE_U_2(bp + 4)); + if (GET_U_1(bp + 6)) ND_PRINT("CRC, "); else - ND_PRINT("LQI %d, ", EXTRACT_U_1(bp + 7)); - inner_len = EXTRACT_U_1(bp + 15); + ND_PRINT("LQI %d, ", GET_U_1(bp + 7)); + inner_len = GET_U_1(bp + 15); ND_PRINT("inner len = %d", inner_len); bp += 16; len -= 16; } else { /* ZEP v2 packet. */ - if (EXTRACT_U_1(bp + 3) == 2) { + if (GET_U_1(bp + 3) == 2) { /* ZEP v2 ack. */ - seq_no = EXTRACT_BE_U_4(bp + 4); + seq_no = GET_BE_U_4(bp + 4); ND_PRINT("ACK, seq# = %d", seq_no); inner_len = 0; bp += 8; @@ -145,16 +145,16 @@ zep_print(netdissect_options *ndo, ND_TCHECK_LEN(bp, 32); ND_PRINT("Type %d, Channel ID %d, Device ID 0x%04x, ", - EXTRACT_U_1(bp + 3), EXTRACT_U_1(bp + 4), - EXTRACT_BE_U_2(bp + 5)); - if (EXTRACT_U_1(bp + 7)) + GET_U_1(bp + 3), GET_U_1(bp + 4), + GET_BE_U_2(bp + 5)); + if (GET_U_1(bp + 7)) ND_PRINT("CRC, "); else - ND_PRINT("LQI %d, ", EXTRACT_U_1(bp + 8)); + ND_PRINT("LQI %d, ", GET_U_1(bp + 8)); zep_print_ts(ndo, bp + 9); - seq_no = EXTRACT_BE_U_4(bp + 17); - inner_len = EXTRACT_U_1(bp + 31); + seq_no = GET_BE_U_4(bp + 17); + inner_len = GET_U_1(bp + 31); ND_PRINT(", seq# = %d, inner len = %d", seq_no, inner_len); bp += 32; diff --git a/print-zeromq.c b/print-zeromq.c index 6e5e9dc8..59f86b7f 100644 --- a/print-zeromq.c +++ b/print-zeromq.c @@ -81,21 +81,21 @@ zmtp1_print_frame(netdissect_options *ndo, const u_char *cp, const u_char *ep) ND_PRINT("\n\t"); ND_TCHECK_1(cp); /* length/0xFF */ - if (EXTRACT_U_1(cp) != 0xFF) { + if (GET_U_1(cp) != 0xFF) { header_len = 1; /* length */ - body_len_declared = EXTRACT_U_1(cp); + body_len_declared = GET_U_1(cp); ND_PRINT(" frame flags+body (8-bit) length %" PRIu64, body_len_declared); } else { header_len = 1 + 8; /* 0xFF, length */ ND_PRINT(" frame flags+body (64-bit) length"); ND_TCHECK_LEN(cp, header_len); /* 0xFF, length */ - body_len_declared = EXTRACT_BE_U_8(cp + 1); + body_len_declared = GET_BE_U_8(cp + 1); ND_PRINT(" %" PRIu64, body_len_declared); } if (body_len_declared == 0) return cp + header_len; /* skip to the next frame */ ND_TCHECK_LEN(cp, header_len + 1); /* ..., flags */ - flags = EXTRACT_U_1(cp + header_len); + flags = GET_U_1(cp + header_len); body_len_captured = ep - cp - header_len; if (body_len_declared > body_len_captured) @@ -173,7 +173,7 @@ zmtp1_print_intermediate_part(netdissect_options *ndo, const u_char *cp, const u uint64_t remaining_len; ND_TCHECK_2(cp); - frame_offset = EXTRACT_BE_U_2(cp); + frame_offset = GET_BE_U_2(cp); ND_PRINT("\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(netdissect_options *ndo, const u_char *date_ptr) { uint32_t dos_date = 0; - dos_date = EXTRACT_LE_U_4(date_ptr); + dos_date = GET_LE_U_4(date_ptr); return int_unix_date(dos_date); } @@ -87,7 +87,7 @@ make_unix_date2(netdissect_options *ndo, const u_char *date_ptr) { uint32_t x, x2; - x = EXTRACT_LE_U_4(date_ptr); + x = GET_LE_U_4(date_ptr); x2 = ((x & 0xFFFF) << 16) | ((x & 0xFFFF0000) >> 16); return int_unix_date(x2); } @@ -103,7 +103,7 @@ interpret_long_date(netdissect_options *ndo, const u_char *p) time_t ret; /* this gives us seconds since jan 1st 1601 (approx) */ - d = (EXTRACT_LE_U_4(p + 4) * 256.0 + EXTRACT_U_1(p + 3)) * (1.0e-7 * (1 << 24)); + d = (GET_LE_U_4(p + 4) * 256.0 + GET_U_1(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_TCHECK_1(in); - len = EXTRACT_U_1(in) / 2; + len = GET_U_1(in) / 2; in++; *out=0; @@ -145,12 +145,12 @@ name_interpret(netdissect_options *ndo, ND_TCHECK_2(in); if (in + 1 >= maxbuf) return(-1); /* name goes past the end of the buffer */ - if (EXTRACT_U_1(in) < 'A' || EXTRACT_U_1(in) > 'P' || - EXTRACT_U_1(in + 1) < 'A' || EXTRACT_U_1(in + 1) > 'P') { + if (GET_U_1(in) < 'A' || GET_U_1(in) > 'P' || + GET_U_1(in + 1) < 'A' || GET_U_1(in + 1) > 'P') { *out = 0; return(0); } - *out = ((EXTRACT_U_1(in) - 'A') << 4) + (EXTRACT_U_1(in + 1) - 'A'); + *out = ((GET_U_1(in) - 'A') << 4) + (GET_U_1(in + 1) - 'A'); in += 2; out++; len--; @@ -179,7 +179,7 @@ name_ptr(netdissect_options *ndo, return(NULL); /* name goes past the end of the buffer */ ND_TCHECK_1(p); - c = EXTRACT_U_1(p); + c = GET_U_1(p); /* XXX - this should use the same code that the DNS dissector does */ if ((c & 0xC0) == 0xC0) { @@ -188,7 +188,7 @@ name_ptr(netdissect_options *ndo, ND_TCHECK_2(p); if ((p + 1) >= maxbuf) return(NULL); /* name goes past the end of the buffer */ - l = EXTRACT_BE_U_2(p) & 0x3FFF; + l = GET_BE_U_2(p) & 0x3FFF; if (l == 0) { /* We have a pointer that points to itself. */ return(NULL); @@ -232,14 +232,14 @@ name_len(netdissect_options *ndo, if (s >= maxbuf) return(-1); /* name goes past the end of the buffer */ ND_TCHECK_1(s); - c = EXTRACT_U_1(s); + c = GET_U_1(s); if ((c & 0xC0) == 0xC0) return(2); - while (EXTRACT_U_1(s)) { + while (GET_U_1(s)) { if (s >= maxbuf) return(-1); /* name goes past the end of the buffer */ ND_TCHECK_1(s); - s += EXTRACT_U_1(s) + 1; + s += GET_U_1(s) + 1; ND_TCHECK_1(s); } return(PTR_DIFF(s, s0) + 1); @@ -254,7 +254,7 @@ print_asc(netdissect_options *ndo, { u_int i; for (i = 0; i < len; i++) - fn_print_char(ndo, EXTRACT_U_1(buf + i)); + fn_print_char(ndo, GET_U_1(buf + i)); } static const char * @@ -284,7 +284,7 @@ smb_data_print(netdissect_options *ndo, const u_char *buf, u_int len) ND_PRINT("[%03X] ", i); for (i = 0; i < len; /*nothing*/) { ND_TCHECK_1(buf + i); - ND_PRINT("%02X ", EXTRACT_U_1(buf + i) & 0xff); + ND_PRINT("%02X ", GET_U_1(buf + i) & 0xff); i++; if (i%8 == 0) ND_PRINT(" "); @@ -368,7 +368,7 @@ unistr(netdissect_options *ndo, for (;;) { ND_TCHECK_1(sp); *len += 1; - if (EXTRACT_U_1(sp) == 0) + if (GET_U_1(sp) == 0) break; sp++; } @@ -377,7 +377,7 @@ unistr(netdissect_options *ndo, for (;;) { ND_TCHECK_2(sp); *len += 2; - if (EXTRACT_U_1(sp) == 0 && EXTRACT_U_1(sp + 1) == 0) + if (GET_U_1(sp) == 0 && GET_U_1(sp + 1) == 0) break; sp += 2; } @@ -394,10 +394,10 @@ unistr(netdissect_options *ndo, ND_TCHECK_1(s); if (l >= MAX_UNISTR_SIZE) break; - if (ND_ISPRINT(EXTRACT_U_1(s))) - buf[l] = EXTRACT_U_1(s); + if (ND_ISPRINT(GET_U_1(s))) + buf[l] = GET_U_1(s); else { - if (EXTRACT_U_1(s) == 0) + if (GET_U_1(s) == 0) break; buf[l] = '.'; } @@ -410,12 +410,12 @@ unistr(netdissect_options *ndo, ND_TCHECK_2(s); if (l >= MAX_UNISTR_SIZE) break; - if (EXTRACT_U_1(s + 1) == 0 && ND_ISPRINT(EXTRACT_U_1(s))) { + if (GET_U_1(s + 1) == 0 && ND_ISPRINT(GET_U_1(s))) { /* It's a printable ASCII character */ - buf[l] = EXTRACT_U_1(s); + buf[l] = GET_U_1(s); } else { /* It's a non-ASCII character or a non-printable ASCII character */ - if (EXTRACT_U_1(s) == 0 && EXTRACT_U_1(s + 1) == 0) + if (GET_U_1(s) == 0 && GET_U_1(s + 1) == 0) break; buf[l] = '.'; } @@ -445,14 +445,14 @@ smb_fdata1(netdissect_options *ndo, switch (*fmt) { case 'a': ND_TCHECK_1(buf); - write_bits(ndo, EXTRACT_U_1(buf), attrib_fmt); + write_bits(ndo, GET_U_1(buf), attrib_fmt); buf++; fmt++; break; case 'A': ND_TCHECK_2(buf); - write_bits(ndo, EXTRACT_LE_U_2(buf), attrib_fmt); + write_bits(ndo, GET_LE_U_2(buf), attrib_fmt); buf += 2; fmt++; break; @@ -473,7 +473,7 @@ smb_fdata1(netdissect_options *ndo, bitfmt[l] = '\0'; fmt = p + 1; ND_TCHECK_1(buf); - write_bits(ndo, EXTRACT_U_1(buf), bitfmt); + write_bits(ndo, GET_U_1(buf), bitfmt); buf++; break; } @@ -496,7 +496,7 @@ smb_fdata1(netdissect_options *ndo, { unsigned int x; ND_TCHECK_1(buf); - x = EXTRACT_U_1(buf); + x = GET_U_1(buf); ND_PRINT("%u (0x%x)", x, x); buf += 1; fmt++; @@ -506,8 +506,8 @@ smb_fdata1(netdissect_options *ndo, { int x; ND_TCHECK_2(buf); - x = reverse ? EXTRACT_BE_S_2(buf) : - EXTRACT_LE_S_2(buf); + x = reverse ? GET_BE_S_2(buf) : + GET_LE_S_2(buf); ND_PRINT("%d (0x%x)", x, x); buf += 2; fmt++; @@ -517,8 +517,8 @@ smb_fdata1(netdissect_options *ndo, { int x; ND_TCHECK_4(buf); - x = reverse ? EXTRACT_BE_S_4(buf) : - EXTRACT_LE_S_4(buf); + x = reverse ? GET_BE_S_4(buf) : + GET_LE_S_4(buf); ND_PRINT("%d (0x%x)", x, x); buf += 4; fmt++; @@ -528,8 +528,8 @@ smb_fdata1(netdissect_options *ndo, { uint64_t x; ND_TCHECK_8(buf); - x = reverse ? EXTRACT_BE_U_8(buf) : - EXTRACT_LE_U_8(buf); + x = reverse ? GET_BE_U_8(buf) : + GET_LE_U_8(buf); ND_PRINT("%" PRIu64 " (0x%" PRIx64 ")", x, x); buf += 8; fmt++; @@ -539,8 +539,8 @@ smb_fdata1(netdissect_options *ndo, { unsigned int x; ND_TCHECK_2(buf); - x = reverse ? EXTRACT_BE_U_2(buf) : - EXTRACT_LE_U_2(buf); + x = reverse ? GET_BE_U_2(buf) : + GET_LE_U_2(buf); ND_PRINT("%u (0x%x)", x, x); buf += 2; fmt++; @@ -550,8 +550,8 @@ smb_fdata1(netdissect_options *ndo, { unsigned int x; ND_TCHECK_4(buf); - x = reverse ? EXTRACT_BE_U_4(buf) : - EXTRACT_LE_U_4(buf); + x = reverse ? GET_BE_U_4(buf) : + GET_LE_U_4(buf); ND_PRINT("%u (0x%x)", x, x); buf += 4; fmt++; @@ -563,10 +563,10 @@ smb_fdata1(netdissect_options *ndo, uint32_t x1, x2; uint64_t x; ND_TCHECK_8(buf); - 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); + x1 = reverse ? GET_BE_U_4(buf) : + GET_LE_U_4(buf); + x2 = reverse ? GET_BE_U_4(buf + 4) : + GET_LE_U_4(buf + 4); x = (((uint64_t)x1) << 32) | x2; ND_PRINT("%" PRIu64 " (0x%" PRIx64 ")", x, x); buf += 8; @@ -577,7 +577,7 @@ smb_fdata1(netdissect_options *ndo, { unsigned int x; ND_TCHECK_1(buf); - x = EXTRACT_U_1(buf); + x = GET_U_1(buf); ND_PRINT("0x%X", x); buf += 1; fmt++; @@ -587,8 +587,8 @@ smb_fdata1(netdissect_options *ndo, { unsigned int x; ND_TCHECK_2(buf); - x = reverse ? EXTRACT_BE_U_2(buf) : - EXTRACT_LE_U_2(buf); + x = reverse ? GET_BE_U_2(buf) : + GET_LE_U_2(buf); ND_PRINT("0x%X", x); buf += 2; fmt++; @@ -598,8 +598,8 @@ smb_fdata1(netdissect_options *ndo, { unsigned int x; ND_TCHECK_4(buf); - x = reverse ? EXTRACT_BE_U_4(buf) : - EXTRACT_LE_U_4(buf); + x = reverse ? GET_BE_U_4(buf) : + GET_LE_U_4(buf); ND_PRINT("0x%X", x); buf += 4; fmt++; @@ -612,7 +612,7 @@ smb_fdata1(netdissect_options *ndo, case 'b': ND_TCHECK_1(buf); - stringlen = EXTRACT_U_1(buf); + stringlen = GET_U_1(buf); ND_PRINT("%u", stringlen); buf += 1; break; @@ -620,8 +620,8 @@ smb_fdata1(netdissect_options *ndo, case 'd': case 'u': ND_TCHECK_2(buf); - stringlen = reverse ? EXTRACT_BE_U_2(buf) : - EXTRACT_LE_U_2(buf); + stringlen = reverse ? GET_BE_U_2(buf) : + GET_LE_U_2(buf); ND_PRINT("%u", stringlen); buf += 2; break; @@ -629,8 +629,8 @@ smb_fdata1(netdissect_options *ndo, case 'D': case 'U': ND_TCHECK_4(buf); - stringlen = reverse ? EXTRACT_BE_U_4(buf) : - EXTRACT_LE_U_4(buf); + stringlen = reverse ? GET_BE_U_4(buf) : + GET_LE_U_4(buf); ND_PRINT("%u", stringlen); buf += 4; break; @@ -661,8 +661,8 @@ smb_fdata1(netdissect_options *ndo, uint32_t len; ND_TCHECK_1(buf); - if (EXTRACT_U_1(buf) != 4 && EXTRACT_U_1(buf) != 2) { - ND_PRINT("Error! ASCIIZ buffer of type %u", EXTRACT_U_1(buf)); + if (GET_U_1(buf) != 4 && GET_U_1(buf) != 2) { + ND_PRINT("Error! ASCIIZ buffer of type %u", GET_U_1(buf)); return maxbuf; /* give up */ } len = 0; @@ -711,7 +711,7 @@ smb_fdata1(netdissect_options *ndo, int l = atoi(fmt + 1); ND_TCHECK_LEN(buf, l); while (l--) { - ND_PRINT("%02x", EXTRACT_U_1(buf)); + ND_PRINT("%02x", GET_U_1(buf)); buf++; } fmt++; @@ -741,7 +741,7 @@ smb_fdata1(netdissect_options *ndo, break; case 2: ND_TCHECK_1(buf + 15); - name_type = EXTRACT_U_1(buf + 15); + name_type = GET_U_1(buf + 15); ND_PRINT("%-15.15s NameType=0x%02X (%s)", buf, name_type, name_type_str(name_type)); buf += 16; @@ -762,7 +762,7 @@ smb_fdata1(netdissect_options *ndo, switch (atoi(fmt + 1)) { case 1: ND_TCHECK_4(buf); - x = EXTRACT_LE_U_4(buf); + x = GET_LE_U_4(buf); if (x == 0 || x == 0xFFFFFFFF) t = 0; else @@ -771,7 +771,7 @@ smb_fdata1(netdissect_options *ndo, break; case 2: ND_TCHECK_4(buf); - x = EXTRACT_LE_U_4(buf); + x = GET_LE_U_4(buf); if (x == 0 || x == 0xFFFFFFFF) t = 0; else @@ -49,7 +49,7 @@ struct tcphdr { nd_uint16_t th_urp; /* urgent pointer */ }; -#define TH_OFF(th) ((EXTRACT_U_1((th)->th_offx2) & 0xf0) >> 4) +#define TH_OFF(th) ((GET_U_1((th)->th_offx2) & 0xf0) >> 4) /* TCP flags */ #define TH_FIN 0x01 diff --git a/util-print.c b/util-print.c index 5d9056a1..6296821e 100644 --- a/util-print.c +++ b/util-print.c @@ -109,7 +109,7 @@ nd_print(netdissect_options *ndo, ret = 1; /* assume truncated */ while (ep == NULL || s < ep) { - c = EXTRACT_U_1(s); + c = GET_U_1(s); s++; if (c == '\0') { ret = 0; @@ -162,7 +162,7 @@ nd_printztn(netdissect_options *ndo, break; } - c = EXTRACT_U_1(s); + c = GET_U_1(s); s++; bytes++; n--; @@ -190,7 +190,7 @@ nd_printn(netdissect_options *ndo, while (n > 0 && (ep == NULL || s < ep)) { n--; - c = EXTRACT_U_1(s); + c = GET_U_1(s); s++; fn_print_char(ndo, c); } @@ -216,7 +216,7 @@ nd_printzp(netdissect_options *ndo, ret = 1; /* assume truncated */ while (n > 0 && (ep == NULL || s < ep)) { n--; - c = EXTRACT_U_1(s); + c = GET_U_1(s); s++; if (c == '\0') { ret = 0; @@ -701,15 +701,15 @@ fetch_token(netdissect_options *ndo, const u_char *pptr, u_int idx, u_int len, /* ran past end of captured data */ return (0); } - if (!isascii(EXTRACT_U_1(pptr + idx))) { + if (!isascii(GET_U_1(pptr + idx))) { /* not an ASCII character */ return (0); } - if (isspace(EXTRACT_U_1(pptr + idx))) { + if (isspace(GET_U_1(pptr + idx))) { /* end of token */ break; } - if (!isprint(EXTRACT_U_1(pptr + idx))) { + if (!isprint(GET_U_1(pptr + idx))) { /* not part of a command token or response code */ return (0); } @@ -717,7 +717,7 @@ fetch_token(netdissect_options *ndo, const u_char *pptr, u_int idx, u_int len, /* no room for this character and terminating '\0' */ return (0); } - tbuf[toklen] = EXTRACT_U_1(pptr + idx); + tbuf[toklen] = GET_U_1(pptr + idx); toklen++; } if (toklen == 0) { @@ -735,15 +735,15 @@ fetch_token(netdissect_options *ndo, const u_char *pptr, u_int idx, u_int len, /* ran past end of captured data */ break; } - if (EXTRACT_U_1(pptr + idx) == '\r' || EXTRACT_U_1(pptr + idx) == '\n') { + if (GET_U_1(pptr + idx) == '\r' || GET_U_1(pptr + idx) == '\n') { /* end of line */ break; } - if (!isascii(EXTRACT_U_1(pptr + idx)) || !isprint(EXTRACT_U_1(pptr + idx))) { + if (!isascii(GET_U_1(pptr + idx)) || !isprint(GET_U_1(pptr + idx))) { /* not a printable ASCII character */ break; } - if (!isspace(EXTRACT_U_1(pptr + idx))) { + if (!isspace(GET_U_1(pptr + idx))) { /* beginning of next token */ break; } @@ -767,7 +767,7 @@ print_txt_line(netdissect_options *ndo, const char *prefix, startidx = idx; while (idx < len) { ND_TCHECK_1(pptr + idx); - if (EXTRACT_U_1(pptr + idx) == '\n') { + if (GET_U_1(pptr + idx) == '\n') { /* * LF without CR; end of line. * Skip the LF and print the line, with the @@ -776,14 +776,14 @@ print_txt_line(netdissect_options *ndo, const char *prefix, linelen = idx - startidx; idx++; goto print; - } else if (EXTRACT_U_1(pptr + idx) == '\r') { + } else if (GET_U_1(pptr + idx) == '\r') { /* CR - any LF? */ if ((idx+1) >= len) { /* not in this packet */ return (0); } ND_TCHECK_1(pptr + idx + 1); - if (EXTRACT_U_1(pptr + idx + 1) == '\n') { + if (GET_U_1(pptr + idx + 1) == '\n') { /* * CR-LF; end of line. * Skip the CR-LF and print the line, with @@ -800,9 +800,9 @@ print_txt_line(netdissect_options *ndo, const char *prefix, * it. */ return (0); - } else if (!isascii(EXTRACT_U_1(pptr + idx)) || - (!isprint(EXTRACT_U_1(pptr + idx)) && - EXTRACT_U_1(pptr + idx) != '\t')) { + } else if (!isascii(GET_U_1(pptr + idx)) || + (!isprint(GET_U_1(pptr + idx)) && + GET_U_1(pptr + idx) != '\t')) { /* * Not a printable ASCII character and not a tab; * treat this as if it were binary data, and |