Now all the macros have a name meaning a count in bytes.
With _S_: signed, _U_: unsigned
e.g.:
EXTRACT_BE_32BITS -> EXTRACT_BE_U_4
EXTRACT_LE_32BITS -> EXTRACT_LE_U_4
...
EXTRACT_BE_INT32 -> EXTRACT_BE_S_4
and have:
EXTRACT_8BITS -> EXTRACT_U_1
EXTRACT_INT8 -> EXTRACT_S_1
}
#endif
cp = buf;
- oui = EXTRACT_BE_24BITS(ep);
+ oui = EXTRACT_BE_U_3(ep);
*cp++ = hex[*ep >> 4 ];
*cp++ = hex[*ep++ & 0xf];
for (i = 5; --i >= 0;) {
if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
return -1;
- *u = EXTRACT_LE_64BITS(next);
+ *u = EXTRACT_LE_U_8(next);
/* Move pointer past the uint64_t. */
cs->c_next = next + sizeof(*u);
if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
return -1;
- *u = EXTRACT_LE_32BITS(next);
+ *u = EXTRACT_LE_U_4(next);
/* Move pointer past the uint32_t. */
cs->c_next = next + sizeof(*u);
if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
return -1;
- *u = EXTRACT_LE_16BITS(next);
+ *u = EXTRACT_LE_U_2(next);
/* Move pointer past the uint16_t. */
cs->c_next = next + sizeof(*u);
* For 8-bit values; needed to fetch a one-byte value. Byte order
* isn't relevant, and alignment isn't an issue.
*/
-#define EXTRACT_8BITS(p) (*(p))
-#define EXTRACT_INT8(p) ((int8_t)(*(p)))
+#define EXTRACT_U_1(p) (*(p))
+#define EXTRACT_S_1(p) ((int8_t)(*(p)))
/*
* Inline functions or macros to extract possibly-unaligned big-endian
* architectures in all cases?
*/
static inline uint16_t UNALIGNED_OK
-EXTRACT_BE_16BITS(const void *p)
+EXTRACT_BE_U_2(const void *p)
{
return ((uint16_t)ntohs(*(const uint16_t *)(p)));
}
static inline int16_t UNALIGNED_OK
-EXTRACT_BE_INT16(const void *p)
+EXTRACT_BE_S_2(const void *p)
{
return ((int16_t)ntohs(*(const int16_t *)(p)));
}
static inline uint32_t UNALIGNED_OK
-EXTRACT_BE_32BITS(const void *p)
+EXTRACT_BE_U_4(const void *p)
{
return ((uint32_t)ntohl(*(const uint32_t *)(p)));
}
static inline int32_t UNALIGNED_OK
-EXTRACT_BE_INT32(const void *p)
+EXTRACT_BE_S_4(const void *p)
{
return ((int32_t)ntohl(*(const int32_t *)(p)));
}
static inline uint64_t UNALIGNED_OK
-EXTRACT_BE_64BITS(const void *p)
+EXTRACT_BE_U_8(const void *p)
{
return ((uint64_t)(((uint64_t)ntohl(*((const uint32_t *)(p) + 0))) << 32 |
((uint64_t)ntohl(*((const uint32_t *)(p) + 1))) << 0));
}
static inline int64_t UNALIGNED_OK
-EXTRACT_BE_INT64(const void *p)
+EXTRACT_BE_S_8(const void *p)
{
return ((int64_t)(((int64_t)ntohl(*((const uint32_t *)(p) + 0))) << 32 |
((uint64_t)ntohl(*((const uint32_t *)(p) + 1))) << 0));
} __attribute__((packed)) unaligned_int32_t;
UNALIGNED_OK static inline uint16_t
-EXTRACT_BE_16BITS(const void *p)
+EXTRACT_BE_U_2(const void *p)
{
return ((uint16_t)ntohs(((const unaligned_uint16_t *)(p))->val));
}
UNALIGNED_OK static inline int16_t
-EXTRACT_BE_INT16(const void *p)
+EXTRACT_BE_S_2(const void *p)
{
return ((int16_t)ntohs(((const unaligned_int16_t *)(p))->val));
}
UNALIGNED_OK static inline uint32_t
-EXTRACT_BE_32BITS(const void *p)
+EXTRACT_BE_U_4(const void *p)
{
return ((uint32_t)ntohl(((const unaligned_uint32_t *)(p))->val));
}
UNALIGNED_OK static inline int32_t
-EXTRACT_BE_INT32(const void *p)
+EXTRACT_BE_S_4(const void *p)
{
return ((int32_t)ntohl(((const unaligned_int32_t *)(p))->val));
}
UNALIGNED_OK static inline uint64_t
-EXTRACT_BE_64BITS(const void *p)
+EXTRACT_BE_U_8(const void *p)
{
return ((uint64_t)(((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 0)->val)) << 32 |
((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 1)->val)) << 0));
}
UNALIGNED_OK static inline int64_t
-EXTRACT_BE_INT64(const void *p)
+EXTRACT_BE_S_8(const void *p)
{
return ((int64_t)(((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 0)->val)) << 32 |
((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 1)->val)) << 0));
* quantities the hard way - fetch the bytes one at a time and
* assemble them.
*/
-#define EXTRACT_BE_16BITS(p) \
+#define EXTRACT_BE_U_2(p) \
((uint16_t)(((uint16_t)(*((const uint8_t *)(p) + 0)) << 8) | \
((uint16_t)(*((const uint8_t *)(p) + 1)) << 0)))
-#define EXTRACT_BE_INT16(p) \
+#define EXTRACT_BE_S_2(p) \
((int16_t)(((uint16_t)(*((const uint8_t *)(p) + 0)) << 8) | \
((uint16_t)(*((const uint8_t *)(p) + 1)) << 0)))
-#define EXTRACT_BE_32BITS(p) \
+#define EXTRACT_BE_U_4(p) \
((uint32_t)(((uint32_t)(*((const uint8_t *)(p) + 0)) << 24) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 2)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 3)) << 0)))
-#define EXTRACT_BE_INT32(p) \
+#define EXTRACT_BE_S_4(p) \
((int32_t)(((uint32_t)(*((const uint8_t *)(p) + 0)) << 24) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 2)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 3)) << 0)))
-#define EXTRACT_BE_64BITS(p) \
+#define EXTRACT_BE_U_8(p) \
((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 56) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 48) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 6)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 7)) << 0)))
-#define EXTRACT_BE_INT64(p) \
+#define EXTRACT_BE_S_8(p) \
((int64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 56) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 48) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 7)) << 0)))
#endif /* unaligned access checks */
-#define EXTRACT_BE_24BITS(p) \
+#define EXTRACT_BE_U_3(p) \
((uint32_t)(((uint32_t)(*((const uint8_t *)(p) + 0)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 2)) << 0)))
-#define EXTRACT_BE_INT24(p) \
+#define EXTRACT_BE_S_3(p) \
(((*((const uint8_t *)(p) + 0)) & 0x80) ? \
((int32_t)(((uint32_t)(*((const uint8_t *)(p) + 0)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 2)) << 0))))
-#define EXTRACT_BE_40BITS(p) \
+#define EXTRACT_BE_U_5(p) \
((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 0)))
-#define EXTRACT_BE_INT40(p) \
+#define EXTRACT_BE_S_5(p) \
(((*((const uint8_t *)(p) + 0)) & 0x80) ? \
((int64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 0))))
-#define EXTRACT_BE_48BITS(p) \
+#define EXTRACT_BE_U_6(p) \
((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 0)))
-#define EXTRACT_BE_INT48(p) \
+#define EXTRACT_BE_S_6(p) \
(((*((const uint8_t *)(p) + 0)) & 0x80) ? \
((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 0))))
-#define EXTRACT_BE_56BITS(p) \
+#define EXTRACT_BE_U_7(p) \
((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 48) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 6)) << 0)))
-#define EXTRACT_BE_INT56(p) \
+#define EXTRACT_BE_S_7(p) \
(((*((const uint8_t *)(p) + 0)) & 0x80) ? \
((int64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 48) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 40) | \
* Macros to extract possibly-unaligned little-endian integral values.
* XXX - do loads on little-endian machines that support unaligned loads?
*/
-#define EXTRACT_LE_16BITS(p) \
+#define EXTRACT_LE_U_2(p) \
((uint16_t)(((uint16_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint16_t)(*((const uint8_t *)(p) + 0)) << 0)))
-#define EXTRACT_LE_32BITS(p) \
+#define EXTRACT_LE_U_4(p) \
((uint32_t)(((uint32_t)(*((const uint8_t *)(p) + 3)) << 24) | \
((uint32_t)(*((const uint8_t *)(p) + 2)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 0)) << 0)))
-#define EXTRACT_LE_24BITS(p) \
+#define EXTRACT_LE_U_3(p) \
((uint32_t)(((uint32_t)(*((const uint8_t *)(p) + 2)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 0)) << 0)))
-#define EXTRACT_LE_64BITS(p) \
+#define EXTRACT_LE_U_8(p) \
((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 7)) << 56) | \
((uint64_t)(*((const uint8_t *)(p) + 6)) << 48) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 40) | \
* Use this for IPv4 addresses. It's defined as an array of octets, so
* that it's not aligned on its "natural" boundary, and it's defined as
* a structure in the hopes that this makes it harder to naively use
- * EXTRACT_BE_32BITS() to extract the value - in many cases you just want
+ * EXTRACT_BE_U_4() to extract the value - in many cases you just want
* to use UNALIGNED_MEMCPY() to copy its value, so that it remains in
* network byte order.
*
* (Among other things, we don't want somebody thinking "IPv4 addresses,
- * they're in network byte order, so we want EXTRACT_BE_32BITS(), right?"
+ * they're in network byte order, so we want EXTRACT_BE_U_4(), right?"
* and then handing the result to system APIs that expect network-order
* IPv4 addresses, such as inet_ntop(), on their little-endian PCs, getting
* the wrong behavior, and concluding "oh, it must be in *little*-endian
- * order" and "fixing" it to use EXTRACT_LE_32BITS(). Yes, people do this;
+ * order" and "fixing" it to use EXTRACT_LE_U_4(). Yes, people do this;
* that's why Wireshark has tvb_get_ipv4(), to extract an IPv4 address from
* a packet data buffer; it was introduced in reaction to somebody who
* *had* done that.)
if (!ND_TTEST2(*p, IEEE802_11_IV_LEN + IEEE802_11_KID_LEN))
return 0;
- iv = EXTRACT_LE_32BITS(p);
+ iv = EXTRACT_LE_U_4(p);
ND_PRINT((ndo, " IV:%3x Pad %x KeyID %x", IV_IV(iv), IV_PAD(iv),
IV_KEYID(iv)));
return 0;
if (length < 2)
return 0;
- elementlen = EXTRACT_8BITS(p + offset + 1);
+ elementlen = EXTRACT_U_1(p + offset + 1);
/* Make sure we have the entire element. */
if (!ND_TTEST2(*(p + offset + 2), elementlen))
length -= ds.length;
break;
}
- ds.channel = EXTRACT_8BITS(p + offset);
+ ds.channel = EXTRACT_U_1(p + offset);
offset += 1;
length -= 1;
/*
memcpy(&pbody.timestamp, p, IEEE802_11_TSTAMP_LEN);
offset += IEEE802_11_TSTAMP_LEN;
length -= IEEE802_11_TSTAMP_LEN;
- pbody.beacon_interval = EXTRACT_LE_16BITS(p+offset);
+ pbody.beacon_interval = EXTRACT_LE_U_2(p + offset);
offset += IEEE802_11_BCNINT_LEN;
length -= IEEE802_11_BCNINT_LEN;
- pbody.capability_info = EXTRACT_LE_16BITS(p+offset);
+ pbody.capability_info = EXTRACT_LE_U_2(p + offset);
offset += IEEE802_11_CAPINFO_LEN;
length -= IEEE802_11_CAPINFO_LEN;
return 0;
if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN)
return 0;
- pbody.capability_info = EXTRACT_LE_16BITS(p);
+ pbody.capability_info = EXTRACT_LE_U_2(p);
offset += IEEE802_11_CAPINFO_LEN;
length -= IEEE802_11_CAPINFO_LEN;
- pbody.listen_interval = EXTRACT_LE_16BITS(p+offset);
+ pbody.listen_interval = EXTRACT_LE_U_2(p + offset);
offset += IEEE802_11_LISTENINT_LEN;
length -= IEEE802_11_LISTENINT_LEN;
if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_STATUS_LEN +
IEEE802_11_AID_LEN)
return 0;
- pbody.capability_info = EXTRACT_LE_16BITS(p);
+ pbody.capability_info = EXTRACT_LE_U_2(p);
offset += IEEE802_11_CAPINFO_LEN;
length -= IEEE802_11_CAPINFO_LEN;
- pbody.status_code = EXTRACT_LE_16BITS(p+offset);
+ pbody.status_code = EXTRACT_LE_U_2(p + offset);
offset += IEEE802_11_STATUS_LEN;
length -= IEEE802_11_STATUS_LEN;
- pbody.aid = EXTRACT_LE_16BITS(p+offset);
+ pbody.aid = EXTRACT_LE_U_2(p + offset);
offset += IEEE802_11_AID_LEN;
length -= IEEE802_11_AID_LEN;
if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN +
IEEE802_11_AP_LEN)
return 0;
- pbody.capability_info = EXTRACT_LE_16BITS(p);
+ pbody.capability_info = EXTRACT_LE_U_2(p);
offset += IEEE802_11_CAPINFO_LEN;
length -= IEEE802_11_CAPINFO_LEN;
- pbody.listen_interval = EXTRACT_LE_16BITS(p+offset);
+ pbody.listen_interval = EXTRACT_LE_U_2(p + offset);
offset += IEEE802_11_LISTENINT_LEN;
length -= IEEE802_11_LISTENINT_LEN;
memcpy(&pbody.ap, p+offset, IEEE802_11_AP_LEN);
memcpy(&pbody.timestamp, p, IEEE802_11_TSTAMP_LEN);
offset += IEEE802_11_TSTAMP_LEN;
length -= IEEE802_11_TSTAMP_LEN;
- pbody.beacon_interval = EXTRACT_LE_16BITS(p+offset);
+ pbody.beacon_interval = EXTRACT_LE_U_2(p + offset);
offset += IEEE802_11_BCNINT_LEN;
length -= IEEE802_11_BCNINT_LEN;
- pbody.capability_info = EXTRACT_LE_16BITS(p+offset);
+ pbody.capability_info = EXTRACT_LE_U_2(p + offset);
offset += IEEE802_11_CAPINFO_LEN;
length -= IEEE802_11_CAPINFO_LEN;
return 0;
if (length < IEEE802_11_REASON_LEN)
return 0;
- pbody.reason_code = EXTRACT_LE_16BITS(p);
+ pbody.reason_code = EXTRACT_LE_U_2(p);
ND_PRINT((ndo, ": %s",
(pbody.reason_code < NUM_REASONS)
return 0;
if (length < 6)
return 0;
- pbody.auth_alg = EXTRACT_LE_16BITS(p);
+ pbody.auth_alg = EXTRACT_LE_U_2(p);
offset += 2;
length -= 2;
- pbody.auth_trans_seq_num = EXTRACT_LE_16BITS(p + offset);
+ pbody.auth_trans_seq_num = EXTRACT_LE_U_2(p + offset);
offset += 2;
length -= 2;
- pbody.status_code = EXTRACT_LE_16BITS(p + offset);
+ pbody.status_code = EXTRACT_LE_U_2(p + offset);
offset += 2;
length -= 2;
return 0;
if (length < IEEE802_11_REASON_LEN)
return 0;
- pbody.reason_code = EXTRACT_LE_16BITS(p);
+ pbody.reason_code = EXTRACT_LE_U_2(p);
reason = (pbody.reason_code < NUM_REASONS)
? reason_text[pbody.reason_code]
ND_PRINT((ndo, " RA:%s TA:%s CTL(%x) SEQ(%u) ",
etheraddr_string(ndo, ((const struct ctrl_bar_hdr_t *)p)->ra),
etheraddr_string(ndo, ((const struct ctrl_bar_hdr_t *)p)->ta),
- EXTRACT_LE_16BITS(&(((const struct ctrl_bar_hdr_t *)p)->ctl)),
- EXTRACT_LE_16BITS(&(((const struct ctrl_bar_hdr_t *)p)->seq))));
+ EXTRACT_LE_U_2(&(((const struct ctrl_bar_hdr_t *)p)->ctl)),
+ EXTRACT_LE_U_2(&(((const struct ctrl_bar_hdr_t *)p)->seq))));
break;
case CTRL_BA:
if (!ND_TTEST2(*p, CTRL_BA_HDRLEN))
if (!ND_TTEST2(*p, CTRL_PS_POLL_HDRLEN))
return 0;
ND_PRINT((ndo, " AID(%x)",
- EXTRACT_LE_16BITS(&(((const struct ctrl_ps_poll_hdr_t *)p)->aid))));
+ EXTRACT_LE_U_2(&(((const struct ctrl_ps_poll_hdr_t *)p)->aid))));
break;
case CTRL_RTS:
if (!ND_TTEST2(*p, CTRL_RTS_HDRLEN))
ND_PRINT((ndo, " RA:%s TA:%s CTL(%x) SEQ(%u) ",
etheraddr_string(ndo, ((const struct ctrl_bar_hdr_t *)p)->ra),
etheraddr_string(ndo, ((const struct ctrl_bar_hdr_t *)p)->ta),
- EXTRACT_LE_16BITS(&(((const struct ctrl_bar_hdr_t *)p)->ctl)),
- EXTRACT_LE_16BITS(&(((const struct ctrl_bar_hdr_t *)p)->seq))));
+ EXTRACT_LE_U_2(&(((const struct ctrl_bar_hdr_t *)p)->ctl)),
+ EXTRACT_LE_U_2(&(((const struct ctrl_bar_hdr_t *)p)->seq))));
break;
case CTRL_BA:
ND_PRINT((ndo, "RA:%s ",
ND_PRINT((ndo, "Protected "));
if (FC_TYPE(fc) != T_CTRL || FC_SUBTYPE(fc) != CTRL_PS_POLL)
ND_PRINT((ndo, "%dus ",
- EXTRACT_LE_16BITS(
- &((const struct mgmt_header_t *)p)->duration)));
+ EXTRACT_LE_U_2(&((const struct mgmt_header_t *)p)->duration)));
}
if (meshdrlen != 0) {
const struct meshcntl_t *mc =
int ae = mc->flags & 3;
ND_PRINT((ndo, "MeshData (AE %d TTL %u seq %u", ae, mc->ttl,
- EXTRACT_LE_32BITS(mc->seq)));
+ EXTRACT_LE_U_4(mc->seq)));
if (ae > 0)
ND_PRINT((ndo, " A4:%s", etheraddr_string(ndo, mc->addr4)));
if (ae > 1)
return orig_caplen;
}
- fc = EXTRACT_LE_16BITS(p);
+ fc = EXTRACT_LE_U_2(p);
hdrlen = extract_header_length(ndo, fc);
if (hdrlen == 0) {
/* Unknown frame type or control frame subtype; quit. */
{
#define BIT(n) (1U << n)
#define IS_EXTENDED(__p) \
- (EXTRACT_LE_32BITS(__p) & BIT(IEEE80211_RADIOTAP_EXT)) != 0
+ (EXTRACT_LE_U_4(__p) & BIT(IEEE80211_RADIOTAP_EXT)) != 0
struct cpack_state cpacker;
const struct ieee80211_radiotap_header *hdr;
hdr = (const struct ieee80211_radiotap_header *)p;
- len = EXTRACT_LE_16BITS(&hdr->it_len);
+ len = EXTRACT_LE_U_2(&hdr->it_len);
/*
* If we don't have the entire radiotap header, just give up.
fcslen = 0;
for (presentp = &hdr->it_present; presentp <= last_presentp;
presentp++) {
- presentflags = EXTRACT_LE_32BITS(presentp);
+ presentflags = EXTRACT_LE_U_4(presentp);
/*
* If this is a vendor namespace, we don't handle it.
return caplen;
}
- caphdr_len = EXTRACT_BE_32BITS(p + 4);
+ caphdr_len = EXTRACT_BE_U_4(p + 4);
if (caphdr_len < 8) {
/*
* Yow! The capture header length is claimed not
return caplen;
}
- msgcode = EXTRACT_BE_32BITS(p);
+ msgcode = EXTRACT_BE_U_4(p);
if (msgcode == WLANCAP_MAGIC_COOKIE_V1 ||
msgcode == WLANCAP_MAGIC_COOKIE_V2)
return ieee802_11_avs_radio_print(ndo, p, length, caplen);
}
hdrlen = 3;
- fc = EXTRACT_LE_16BITS(p);
- seq = EXTRACT_8BITS(p + 2);
+ fc = EXTRACT_LE_U_2(p);
+ seq = EXTRACT_U_1(p + 2);
p += 3;
caplen -= 3;
ND_PRINT((ndo, "[|802.15.4]"));
return hdrlen;
}
- panid = EXTRACT_LE_16BITS(p);
+ panid = EXTRACT_LE_U_2(p);
p += 2;
caplen -= 2;
hdrlen += 2;
return hdrlen;
}
if (ndo->ndo_vflag)
- ND_PRINT((ndo,"%04x:%04x ", panid, EXTRACT_LE_16BITS(p)));
+ ND_PRINT((ndo,"%04x:%04x ", panid, EXTRACT_LE_U_2(p)));
p += 2;
caplen -= 2;
hdrlen += 2;
ND_PRINT((ndo, "[|802.15.4]"));
return hdrlen;
}
- panid = EXTRACT_LE_16BITS(p);
+ panid = EXTRACT_LE_U_2(p);
p += 2;
caplen -= 2;
hdrlen += 2;
ND_PRINT((ndo, "[|802.15.4]"));
return hdrlen;
}
- panid = EXTRACT_LE_16BITS(p);
+ panid = EXTRACT_LE_U_2(p);
p += 2;
caplen -= 2;
hdrlen += 2;
return hdrlen;
}
if (ndo->ndo_vflag)
- ND_PRINT((ndo,"%04x:%04x ", panid, EXTRACT_LE_16BITS(p)));
+ ND_PRINT((ndo,"%04x:%04x ", panid, EXTRACT_LE_U_2(p)));
p += 2;
caplen -= 2;
hdrlen += 2;
ND_PRINT((ndo, "[|802.15.4]"));
return hdrlen;
}
- panid = EXTRACT_LE_16BITS(p);
+ panid = EXTRACT_LE_U_2(p);
p += 2;
caplen -= 2;
hdrlen += 2;
sumlen = ah->ah_len << 2;
- ND_PRINT((ndo, "AH(spi=0x%08x", EXTRACT_BE_32BITS(&ah->ah_spi)));
+ ND_PRINT((ndo, "AH(spi=0x%08x", EXTRACT_BE_U_4(&ah->ah_spi)));
if (ndo->ndo_vflag)
ND_PRINT((ndo, ",sumlen=%d", sumlen));
ND_TCHECK_4(ah + 1);
- ND_PRINT((ndo, ",seq=0x%x", EXTRACT_BE_32BITS(ah + 1)));
+ ND_PRINT((ndo, ",seq=0x%x", EXTRACT_BE_U_4(ah + 1)));
if (!ND_TTEST2(*bp, sizeof(struct ah) + sumlen)) {
ND_PRINT((ndo, "[truncated]):"));
return -1;
if (cp + 4 != ep)
goto invalid;
ND_TCHECK2(*cp, 4);
- t = EXTRACT_BE_32BITS(cp);
+ t = EXTRACT_BE_U_4(cp);
if (NULL == (tm = gmtime(&t)))
ND_PRINT((ndo, ": gmtime() error"));
else if (0 == strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm))
if (cp + 4 != ep)
goto invalid;
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ": %us", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ": %us", EXTRACT_BE_U_4(cp)));
return 0;
invalid:
cp += 1;
/* Length */
ND_TCHECK2(*cp, 2);
- body_len = EXTRACT_BE_16BITS(cp);
+ body_len = EXTRACT_BE_U_2(cp);
cp += 2;
if (ndo->ndo_vflag) {
cp += 1;
/* Nonce */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", Nonce 0x%08x", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ", Nonce 0x%08x", EXTRACT_BE_U_4(cp)));
cp += 4;
/* Source Id */
ND_TCHECK2(*cp, 8);
break;
}
ND_PRINT((ndo, "\n\text HELLO %ld ms",
- (unsigned long) EXTRACT_BE_32BITS(&ah->interval)));
+ (unsigned long) EXTRACT_BE_U_4(&ah->interval)));
break;
default:
ap->rreq_type & RREQ_DEST ? "[D]" : "",
ap->rreq_type & RREQ_UNKNOWN ? "[U] " : " ",
ap->rreq_hops,
- (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_id),
+ (unsigned long) EXTRACT_BE_U_4(&ap->rreq_id),
ipaddr_string(ndo, &ap->rreq_da),
- (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_ds),
+ (unsigned long) EXTRACT_BE_U_4(&ap->rreq_ds),
ipaddr_string(ndo, &ap->rreq_oa),
- (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_os)));
+ (unsigned long) EXTRACT_BE_U_4(&ap->rreq_os)));
i = length - sizeof(*ap);
if (i >= sizeof(struct aodv_ext))
aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i);
ap->rrep_ps & RREP_PREFIX_MASK,
ap->rrep_hops,
ipaddr_string(ndo, &ap->rrep_da),
- (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_ds),
+ (unsigned long) EXTRACT_BE_U_4(&ap->rrep_ds),
ipaddr_string(ndo, &ap->rrep_oa),
- (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_life)));
+ (unsigned long) EXTRACT_BE_U_4(&ap->rrep_life)));
i = length - sizeof(*ap);
if (i >= sizeof(struct aodv_ext))
aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i);
if (i < sizeof(*dp))
goto trunc;
ND_PRINT((ndo, " {%s}(%ld)", ipaddr_string(ndo, &dp->u_da),
- (unsigned long) EXTRACT_BE_32BITS(&dp->u_ds)));
+ (unsigned long) EXTRACT_BE_U_4(&dp->u_ds)));
dp++;
i -= sizeof(*dp);
}
ap->rreq_type & RREQ_DEST ? "[D]" : "",
ap->rreq_type & RREQ_UNKNOWN ? "[U] " : " ",
ap->rreq_hops,
- (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_id),
+ (unsigned long) EXTRACT_BE_U_4(&ap->rreq_id),
ip6addr_string(ndo, &ap->rreq_da),
- (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_ds),
+ (unsigned long) EXTRACT_BE_U_4(&ap->rreq_ds),
ip6addr_string(ndo, &ap->rreq_oa),
- (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_os)));
+ (unsigned long) EXTRACT_BE_U_4(&ap->rreq_os)));
i = length - sizeof(*ap);
if (i >= sizeof(struct aodv_ext))
aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i);
ap->rrep_ps & RREP_PREFIX_MASK,
ap->rrep_hops,
ip6addr_string(ndo, &ap->rrep_da),
- (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_ds),
+ (unsigned long) EXTRACT_BE_U_4(&ap->rrep_ds),
ip6addr_string(ndo, &ap->rrep_oa),
- (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_life)));
+ (unsigned long) EXTRACT_BE_U_4(&ap->rrep_life)));
i = length - sizeof(*ap);
if (i >= sizeof(struct aodv_ext))
aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i);
if (i < sizeof(*dp6))
goto trunc;
ND_PRINT((ndo, " {%s}(%ld)", ip6addr_string(ndo, &dp6->u_da),
- (unsigned long) EXTRACT_BE_32BITS(&dp6->u_ds)));
+ (unsigned long) EXTRACT_BE_U_4(&dp6->u_ds)));
dp6++;
i -= sizeof(*dp6);
}
ap->rreq_type & RREQ_DEST ? "[D]" : "",
ap->rreq_type & RREQ_UNKNOWN ? "[U] " : " ",
ap->rreq_hops,
- (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_id),
+ (unsigned long) EXTRACT_BE_U_4(&ap->rreq_id),
ip6addr_string(ndo, &ap->rreq_da),
- (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_ds),
+ (unsigned long) EXTRACT_BE_U_4(&ap->rreq_ds),
ip6addr_string(ndo, &ap->rreq_oa),
- (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_os)));
+ (unsigned long) EXTRACT_BE_U_4(&ap->rreq_os)));
i = length - sizeof(*ap);
if (i >= sizeof(struct aodv_ext))
aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i);
ap->rrep_ps & RREP_PREFIX_MASK,
ap->rrep_hops,
ip6addr_string(ndo, &ap->rrep_da),
- (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_ds),
+ (unsigned long) EXTRACT_BE_U_4(&ap->rrep_ds),
ip6addr_string(ndo, &ap->rrep_oa),
- (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_life)));
+ (unsigned long) EXTRACT_BE_U_4(&ap->rrep_life)));
i = length - sizeof(*ap);
if (i >= sizeof(struct aodv_ext))
aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i);
if (i < sizeof(*dp6))
goto trunc;
ND_PRINT((ndo, " {%s}(%ld)", ip6addr_string(ndo, &dp6->u_da),
- (unsigned long) EXTRACT_BE_32BITS(&dp6->u_ds)));
+ (unsigned long) EXTRACT_BE_U_4(&dp6->u_ds)));
dp6++;
i -= sizeof(*dp6);
}
goto invalid;
/* AFlags */
ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, "\n\tAFlags: [%s]", bittok2str(aoev1_aflag_str, "none", EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, "\n\tAFlags: [%s]", bittok2str(aoev1_aflag_str, "none", EXTRACT_U_1(cp))));
cp += 1;
/* Err/Feature */
ND_TCHECK2(*cp, 1);
goto invalid;
/* Buffer Count */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\tBuffer Count: %u", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, "\n\tBuffer Count: %u", EXTRACT_BE_U_2(cp)));
cp += 2;
/* Firmware Version */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", Firmware Version: %u", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, ", Firmware Version: %u", EXTRACT_BE_U_2(cp)));
cp += 2;
/* Sector Count */
ND_TCHECK2(*cp, 1);
cp += 1;
/* AoE/CCmd */
ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, ", AoE: %u, CCmd: %s", (EXTRACT_8BITS(cp) & 0xF0) >> 4,
- tok2str(aoev1_ccmd_str, "Unknown (0x02x)", EXTRACT_8BITS(cp) & 0x0F)));
+ ND_PRINT((ndo, ", AoE: %u, CCmd: %s", (EXTRACT_U_1(cp) & 0xF0) >> 4,
+ tok2str(aoev1_ccmd_str, "Unknown (0x02x)", EXTRACT_U_1(cp) & 0x0F)));
cp += 1;
/* Config String Length */
ND_TCHECK2(*cp, 2);
- cslen = EXTRACT_BE_16BITS(cp);
+ cslen = EXTRACT_BE_U_2(cp);
cp += 2;
if (cslen > AOEV1_MAX_CONFSTR_LEN || AOEV1_QUERY_ARG_LEN + cslen > len)
goto invalid;
cp += 1;
/* MCmd */
ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, "\n\tMCmd: %s", tok2str(aoev1_mcmd_str, "Unknown (0x%02x)", EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, "\n\tMCmd: %s", tok2str(aoev1_mcmd_str, "Unknown (0x%02x)", EXTRACT_U_1(cp))));
cp += 1;
/* MError */
ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, ", MError: %s", tok2str(aoev1_merror_str, "Unknown (0x%02x)", EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, ", MError: %s", tok2str(aoev1_merror_str, "Unknown (0x%02x)", EXTRACT_U_1(cp))));
cp += 1;
/* Dir Count */
ND_TCHECK2(*cp, 1);
cp += 1;
/* DCmd */
ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, "\n\t DCmd: %s", tok2str(aoev1_dcmd_str, "Unknown (0x%02x)", EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, "\n\t DCmd: %s", tok2str(aoev1_dcmd_str, "Unknown (0x%02x)", EXTRACT_U_1(cp))));
cp += 1;
/* Ethernet Address */
ND_TCHECK2(*cp, ETHER_ADDR_LEN);
goto invalid;
/* RCmd */
ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, "\n\tRCmd: %s", tok2str(aoev1_rcmd_str, "Unknown (0x%02x)", EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, "\n\tRCmd: %s", tok2str(aoev1_rcmd_str, "Unknown (0x%02x)", EXTRACT_U_1(cp))));
cp += 1;
/* NMacs (correlated with the length) */
ND_TCHECK2(*cp, 1);
if (len < AOEV1_COMMON_HDR_LEN)
goto invalid;
/* Flags */
- flags = EXTRACT_8BITS(cp) & 0x0F;
+ flags = EXTRACT_U_1(cp) & 0x0F;
ND_PRINT((ndo, ", Flags: [%s]", bittok2str(aoev1_flag_str, "none", flags)));
cp += 1;
if (! ndo->ndo_vflag)
/* Error */
ND_TCHECK2(*cp, 1);
if (flags & AOEV1_FLAG_E)
- ND_PRINT((ndo, "\n\tError: %s", tok2str(aoev1_errcode_str, "Invalid (%u)", EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, "\n\tError: %s", tok2str(aoev1_errcode_str, "Invalid (%u)", EXTRACT_U_1(cp))));
cp += 1;
/* Major */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\tMajor: 0x%04x", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, "\n\tMajor: 0x%04x", EXTRACT_BE_U_2(cp)));
cp += 2;
/* Minor */
ND_TCHECK2(*cp, 1);
ND_PRINT((ndo, ", Command: %s", tok2str(cmdcode_str, "Unknown (0x%02x)", command)));
/* Tag */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", Tag: 0x%08x", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ", Tag: 0x%08x", EXTRACT_BE_U_4(cp)));
cp += 4;
/* Arg */
cmd_decoder =
goto invalid;
/* Ver/Flags */
ND_TCHECK2(*cp, 1);
- ver = (EXTRACT_8BITS(cp) & 0xF0) >> 4;
+ ver = (EXTRACT_U_1(cp) & 0xF0) >> 4;
/* Don't advance cp yet: low order 4 bits are version-specific. */
ND_PRINT((ndo, ", Ver %u", ver));
fwaddr_string(ndo, fp->firewire_shost),
fwaddr_string(ndo, fp->firewire_dhost)));
- firewire_type = EXTRACT_BE_16BITS(&fp->firewire_type);
+ firewire_type = EXTRACT_BE_U_2(&fp->firewire_type);
if (!ndo->ndo_qflag) {
ND_PRINT((ndo, ", ethertype %s (0x%04x)",
tok2str(ethertype_values,"Unknown", firewire_type),
fp = (const struct firewire_header *)p;
p += FIREWIRE_HDRLEN;
- ether_type = EXTRACT_BE_16BITS(&fp->firewire_type);
+ ether_type = EXTRACT_BE_U_2(&fp->firewire_type);
src.addr = fp->firewire_shost;
src.addr_string = fwaddr_string;
dst.addr = fp->firewire_dhost;
return (caplen);
}
flag = ap->arc_flag2;
- seqid = EXTRACT_BE_16BITS(&ap->arc_seqid2);
+ seqid = EXTRACT_BE_U_2(&ap->arc_seqid2);
archdrlen = ARC_HDRNEWLEN_EXC;
} else {
flag = ap->arc_flag;
- seqid = EXTRACT_BE_16BITS(&ap->arc_seqid);
+ seqid = EXTRACT_BE_U_2(&ap->arc_seqid);
archdrlen = ARC_HDRNEWLEN;
}
}
#define ARP_HDRLEN 8
-#define HRD(ap) EXTRACT_BE_16BITS(&(ap)->ar_hrd)
+#define HRD(ap) EXTRACT_BE_U_2(&(ap)->ar_hrd)
#define HRD_LEN(ap) ((ap)->ar_hln)
#define PROTO_LEN(ap) ((ap)->ar_pln)
-#define OP(ap) EXTRACT_BE_16BITS(&(ap)->ar_op)
-#define PRO(ap) EXTRACT_BE_16BITS(&(ap)->ar_pro)
+#define OP(ap) EXTRACT_BE_U_2(&(ap)->ar_op)
+#define PRO(ap) EXTRACT_BE_U_2(&(ap)->ar_pro)
#define SHA(ap) (ar_sha(ap))
#define SPA(ap) (ar_spa(ap))
#define THA(ap) (ar_tha(ap))
u_char aar_tpa[]; /* target protocol address */
#endif
-#define ATMHRD(ap) EXTRACT_BE_16BITS(&(ap)->aar_hrd)
+#define ATMHRD(ap) EXTRACT_BE_U_2(&(ap)->aar_hrd)
#define ATMSHRD_LEN(ap) ((ap)->aar_shtl & ATMARP_LEN_MASK)
#define ATMSSLN(ap) ((ap)->aar_sstl & ATMARP_LEN_MASK)
#define ATMSPROTO_LEN(ap) ((ap)->aar_spln)
-#define ATMOP(ap) EXTRACT_BE_16BITS(&(ap)->aar_op)
-#define ATMPRO(ap) EXTRACT_BE_16BITS(&(ap)->aar_pro)
+#define ATMOP(ap) EXTRACT_BE_U_2(&(ap)->aar_op)
+#define ATMPRO(ap) EXTRACT_BE_U_2(&(ap)->aar_pro)
#define ATMTHRD_LEN(ap) ((ap)->aar_thtl & ATMARP_LEN_MASK)
#define ATMTSLN(ap) ((ap)->aar_tstl & ATMARP_LEN_MASK)
#define ATMTPROTO_LEN(ap) ((ap)->aar_tpln)
return (0); /* cut short by the snapshot length */
}
dp = (const struct atDDP *)bp;
- snet = EXTRACT_BE_16BITS(&dp->srcNet);
+ snet = EXTRACT_BE_U_2(&dp->srcNet);
ND_PRINT((ndo, "%s.%s", ataddr_string(ndo, snet, dp->srcNode),
ddpskt_string(ndo, dp->srcSkt)));
ND_PRINT((ndo, " > %s.%s:",
- ataddr_string(ndo, EXTRACT_BE_16BITS(&dp->dstNet), dp->dstNode),
+ ataddr_string(ndo, EXTRACT_BE_U_2(&dp->dstNet), dp->dstNode),
ddpskt_string(ndo, dp->dstSkt)));
bp += ddpSize;
length -= ddpSize;
return;
}
dp = (const struct atDDP *)bp;
- snet = EXTRACT_BE_16BITS(&dp->srcNet);
+ snet = EXTRACT_BE_U_2(&dp->srcNet);
ND_PRINT((ndo, "%s.%s", ataddr_string(ndo, snet, dp->srcNode),
ddpskt_string(ndo, dp->srcSkt)));
ND_PRINT((ndo, " > %s.%s: ",
- ataddr_string(ndo, EXTRACT_BE_16BITS(&dp->dstNet), dp->dstNode),
+ ataddr_string(ndo, EXTRACT_BE_U_2(&dp->dstNet), dp->dstNode),
ddpskt_string(ndo, dp->dstSkt)));
bp += ddpSize;
length -= ddpSize;
ND_PRINT((ndo, " [|aarp %u]", length));
return;
}
- if (EXTRACT_BE_16BITS(&ap->htype) == 1 &&
- EXTRACT_BE_16BITS(&ap->ptype) == ETHERTYPE_ATALK &&
+ if (EXTRACT_BE_U_2(&ap->htype) == 1 &&
+ EXTRACT_BE_U_2(&ap->ptype) == ETHERTYPE_ATALK &&
ap->halen == 6 && ap->palen == 4 )
- switch (EXTRACT_BE_16BITS(&ap->op)) {
+ switch (EXTRACT_BE_U_2(&ap->op)) {
case 1: /* request */
ND_PRINT((ndo, "who-has %s tell %s", AT(pdaddr), AT(psaddr)));
return;
}
ND_PRINT((ndo, "len %u op %u htype %u ptype %#x halen %u palen %u",
- length, EXTRACT_BE_16BITS(&ap->op), EXTRACT_BE_16BITS(&ap->htype),
- EXTRACT_BE_16BITS(&ap->ptype), ap->halen, ap->palen));
+ length, EXTRACT_BE_U_2(&ap->op), EXTRACT_BE_U_2(&ap->htype),
+ EXTRACT_BE_U_2(&ap->ptype), ap->halen, ap->palen));
}
/*
case atpReqCode:
ND_PRINT((ndo, " atp-req%s %d",
ap->control & atpXO? " " : "*",
- EXTRACT_BE_16BITS(&ap->transID)));
+ EXTRACT_BE_U_2(&ap->transID)));
atp_bitmap_print(ndo, ap->bitmap);
case atpRspCode:
ND_PRINT((ndo, " atp-resp%s%d:%d (%u)",
ap->control & atpEOM? "*" : " ",
- EXTRACT_BE_16BITS(&ap->transID), ap->bitmap, length));
+ EXTRACT_BE_U_2(&ap->transID), ap->bitmap, length));
switch (ap->control & (atpXO|atpSTS)) {
case atpXO:
ND_PRINT((ndo, " [XO]"));
break;
case atpRelCode:
- ND_PRINT((ndo, " atp-rel %d", EXTRACT_BE_16BITS(&ap->transID)));
+ ND_PRINT((ndo, " atp-rel %d", EXTRACT_BE_U_2(&ap->transID)));
atp_bitmap_print(ndo, ap->bitmap);
default:
ND_PRINT((ndo, " atp-0x%x %d (%u)", ap->control,
- EXTRACT_BE_16BITS(&ap->transID), length));
+ EXTRACT_BE_U_2(&ap->transID), length));
break;
}
- data = EXTRACT_BE_32BITS(&ap->userData);
+ data = EXTRACT_BE_U_4(&ap->userData);
if (data != 0)
ND_PRINT((ndo, " 0x%x", data));
}
ND_PRINT((ndo, " [ntup=%d]", np->control & 0xf));
if (tp->enumerator)
ND_PRINT((ndo, " [enum=%d]", tp->enumerator));
- if (EXTRACT_BE_16BITS(&tp->net) != snet ||
+ if (EXTRACT_BE_U_2(&tp->net) != snet ||
tp->node != snode || tp->skt != skt)
ND_PRINT((ndo, " [addr=%s.%d]",
- ataddr_string(ndo, EXTRACT_BE_16BITS(&tp->net),
+ ataddr_string(ndo, EXTRACT_BE_U_2(&tp->net),
tp->node), tp->skt));
break;
ND_PRINT((ndo, " %d", tp->skt));
/* if the address doesn't match the src address, it's an anomaly */
- if (EXTRACT_BE_16BITS(&tp->net) != snet || tp->node != snode)
+ if (EXTRACT_BE_U_2(&tp->net) != snet || tp->node != snode)
ND_PRINT((ndo, " [addr=%s]",
- ataddr_string(ndo, EXTRACT_BE_16BITS(&tp->net), tp->node)));
+ ataddr_string(ndo, EXTRACT_BE_U_2(&tp->net), tp->node)));
return (tpn);
}
* packet nor an RFC 2684 routed NLPID-formatted PDU nor
* an 802.2-but-no-SNAP IP packet.
*/
- llchdr = EXTRACT_BE_24BITS(p);
+ llchdr = EXTRACT_BE_U_3(p);
if (llchdr != LLC_UI_HDR(LLCSAP_SNAP) &&
llchdr != LLC_UI_HDR(LLCSAP_ISONS) &&
llchdr != LLC_UI_HDR(LLCSAP_IP)) {
}
if (ndo->ndo_eflag)
ND_PRINT((ndo, "%08x%08x %08x%08x ",
- EXTRACT_BE_32BITS(p),
- EXTRACT_BE_32BITS(p + 4),
- EXTRACT_BE_32BITS(p + 8),
- EXTRACT_BE_32BITS(p + 12)));
+ EXTRACT_BE_U_4(p),
+ EXTRACT_BE_U_4(p + 4),
+ EXTRACT_BE_U_4(p + 8),
+ EXTRACT_BE_U_4(p + 12)));
p += 20;
length -= 20;
caplen -= 20;
* do from the caplen test above, we also know we have
* the call reference.
*/
- call_ref = EXTRACT_BE_24BITS(p + CALL_REF_POS);
+ call_ref = EXTRACT_BE_U_3(p + CALL_REF_POS);
ND_PRINT((ndo, "CALL_REF:0x%06x", call_ref));
} else {
/* SSCOP with some unknown protocol atop it */
ND_TCHECK(*(p+ATM_HDR_LEN_NOHEC+hec));
- cell_header = EXTRACT_BE_32BITS(p + hec);
- cell_type = (EXTRACT_8BITS((p + ATM_HDR_LEN_NOHEC + hec)) >> 4) & 0x0f;
- func_type = EXTRACT_8BITS((p + ATM_HDR_LEN_NOHEC + hec)) & 0x0f;
+ cell_header = EXTRACT_BE_U_4(p + hec);
+ cell_type = (EXTRACT_U_1((p + ATM_HDR_LEN_NOHEC + hec)) >> 4) & 0x0f;
+ func_type = EXTRACT_U_1((p + ATM_HDR_LEN_NOHEC + hec)) & 0x0f;
vpi = (cell_header>>20)&0xff;
vci = (cell_header>>4)&0xffff;
tok2str(oam_fm_loopback_indicator_values,
"Unknown",
oam_ptr.oam_fm_loopback->loopback_indicator & OAM_FM_LOOPBACK_INDICATOR_MASK),
- EXTRACT_BE_32BITS(&oam_ptr.oam_fm_loopback->correlation_tag)));
+ EXTRACT_BE_U_4(&oam_ptr.oam_fm_loopback->correlation_tag)));
ND_PRINT((ndo, "\n\tLocation-ID "));
for (idx = 0; idx < sizeof(oam_ptr.oam_fm_loopback->loopback_id); idx++) {
if (idx % 2) {
- ND_PRINT((ndo, "%04x ", EXTRACT_BE_16BITS(&oam_ptr.oam_fm_loopback->loopback_id[idx])));
+ ND_PRINT((ndo, "%04x ", EXTRACT_BE_U_2(&oam_ptr.oam_fm_loopback->loopback_id[idx])));
}
}
ND_PRINT((ndo, "\n\tSource-ID "));
for (idx = 0; idx < sizeof(oam_ptr.oam_fm_loopback->source_id); idx++) {
if (idx % 2) {
- ND_PRINT((ndo, "%04x ", EXTRACT_BE_16BITS(&oam_ptr.oam_fm_loopback->source_id[idx])));
+ ND_PRINT((ndo, "%04x ", EXTRACT_BE_U_2(&oam_ptr.oam_fm_loopback->source_id[idx])));
}
}
break;
ND_PRINT((ndo, "\n\tLocation-ID "));
for (idx = 0; idx < sizeof(oam_ptr.oam_fm_ais_rdi->failure_location); idx++) {
if (idx % 2) {
- ND_PRINT((ndo, "%04x ", EXTRACT_BE_16BITS(&oam_ptr.oam_fm_ais_rdi->failure_location[idx])));
+ ND_PRINT((ndo, "%04x ", EXTRACT_BE_U_2(&oam_ptr.oam_fm_ais_rdi->failure_location[idx])));
}
}
break;
/* crc10 checksum verification */
ND_TCHECK2(*(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN), 2);
- cksum = EXTRACT_BE_16BITS(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN)
+ cksum = EXTRACT_BE_U_2(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN)
& OAM_CRC10_MASK;
cksum_shouldbe = verify_crc10_cksum(0, p, OAM_PAYLOAD_LEN);
uint32_t t1, t2;
while (cp < ep) {
- subtype = EXTRACT_8BITS(cp);
+ subtype = EXTRACT_U_1(cp);
cp++;
if(subtype == MESSAGE_SUB_PAD1) {
ND_PRINT((ndo, " sub-pad1"));
}
if(cp == ep)
goto invalid;
- sublen = EXTRACT_8BITS(cp);
+ sublen = EXTRACT_U_1(cp);
cp++;
if(cp + sublen > ep)
goto invalid;
}
sep = " ";
while(sublen--) {
- ND_PRINT((ndo, "%s%s", sep, tok2str(diversity_str, "%u", EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, "%s%s", sep, tok2str(diversity_str, "%u", EXTRACT_U_1(cp))));
cp++;
sep = "-";
}
if(tlv_type == MESSAGE_HELLO) {
if(sublen < 4)
goto invalid;
- t1 = EXTRACT_BE_32BITS(cp);
+ t1 = EXTRACT_BE_U_4(cp);
ND_PRINT((ndo, " %s", format_timestamp(t1)));
} else if(tlv_type == MESSAGE_IHU) {
if(sublen < 8)
goto invalid;
- t1 = EXTRACT_BE_32BITS(cp);
+ t1 = EXTRACT_BE_U_4(cp);
ND_PRINT((ndo, " %s", format_timestamp(t1)));
- t2 = EXTRACT_BE_32BITS(cp + 4);
+ t2 = EXTRACT_BE_U_4(cp + 4);
ND_PRINT((ndo, "|%s", format_timestamp(t2)));
} else
ND_PRINT((ndo, " (bogus)"));
ND_TCHECK2(*cp, 4);
if (length < 4)
goto invalid;
- bodylen = EXTRACT_BE_16BITS(cp + 2);
+ bodylen = EXTRACT_BE_U_2(cp + 2);
ND_PRINT((ndo, " (%u)", bodylen));
/* Process the TLVs in the body */
else {
ND_PRINT((ndo, "\n\tAcknowledgment Request "));
if(len < 6) goto invalid;
- nonce = EXTRACT_BE_16BITS(message + 4);
- interval = EXTRACT_BE_16BITS(message + 6);
+ nonce = EXTRACT_BE_U_2(message + 4);
+ interval = EXTRACT_BE_U_2(message + 6);
ND_PRINT((ndo, "%04x %s", nonce, format_interval(interval)));
}
}
else {
ND_PRINT((ndo, "\n\tAcknowledgment "));
if(len < 2) goto invalid;
- nonce = EXTRACT_BE_16BITS(message + 2);
+ nonce = EXTRACT_BE_U_2(message + 2);
ND_PRINT((ndo, "%04x", nonce));
}
}
else {
ND_PRINT((ndo, "\n\tHello "));
if(len < 6) goto invalid;
- seqno = EXTRACT_BE_16BITS(message + 4);
- interval = EXTRACT_BE_16BITS(message + 6);
+ seqno = EXTRACT_BE_U_2(message + 4);
+ interval = EXTRACT_BE_U_2(message + 6);
ND_PRINT((ndo, "seqno %u interval %s", seqno, format_interval(interval)));
/* Extra data. */
if(len > 6)
int rc;
ND_PRINT((ndo, "\n\tIHU "));
if(len < 6) goto invalid;
- txcost = EXTRACT_BE_16BITS(message + 4);
- interval = EXTRACT_BE_16BITS(message + 6);
+ txcost = EXTRACT_BE_U_2(message + 4);
+ interval = EXTRACT_BE_U_2(message + 6);
rc = network_address(message[2], message + 8, len - 6, address);
if(rc < 0) { ND_PRINT((ndo, "%s", tstr)); break; }
ND_PRINT((ndo, "%s txcost %u interval %s",
message[2] == 1 ? v4_prefix : v6_prefix,
len - 10, prefix);
if(rc < 0) goto invalid;
- interval = EXTRACT_BE_16BITS(message + 6);
- seqno = EXTRACT_BE_16BITS(message + 8);
- metric = EXTRACT_BE_16BITS(message + 10);
+ interval = EXTRACT_BE_U_2(message + 6);
+ seqno = EXTRACT_BE_U_2(message + 8);
+ metric = EXTRACT_BE_U_2(message + 10);
ND_PRINT((ndo, "%s%s%s %s metric %u seqno %u interval %s",
(message[3] & 0x80) ? "/prefix": "",
(message[3] & 0x40) ? "/id" : "",
u_char prefix[16], plen;
ND_PRINT((ndo, "\n\tMH-Request "));
if(len < 14) goto invalid;
- seqno = EXTRACT_BE_16BITS(message + 4);
+ seqno = EXTRACT_BE_U_2(message + 4);
rc = network_prefix(message[2], message[3], 0,
message + 16, NULL, len - 14, prefix);
if(rc < 0) goto invalid;
else {
ND_PRINT((ndo, "\n\tTS/PC "));
if(len < 6) goto invalid;
- ND_PRINT((ndo, "timestamp %u packetcounter %u", EXTRACT_BE_32BITS(message + 4),
- EXTRACT_BE_16BITS(message + 2)));
+ ND_PRINT((ndo, "timestamp %u packetcounter %u", EXTRACT_BE_U_4(message + 4),
+ EXTRACT_BE_U_2(message + 2)));
}
break;
case MESSAGE_HMAC : {
unsigned j;
ND_PRINT((ndo, "\n\tHMAC "));
if(len < 18) goto invalid;
- ND_PRINT((ndo, "key-id %u digest-%u ", EXTRACT_BE_16BITS(message + 2), len - 2));
+ ND_PRINT((ndo, "key-id %u digest-%u ", EXTRACT_BE_U_2(message + 2), len - 2));
for (j = 0; j < len - 2; j++)
ND_PRINT((ndo, "%02X", message[4 + j]));
}
src_plen = message[3];
plen = message[4];
omitted = message[5];
- interval = EXTRACT_BE_16BITS(message + 6);
- seqno = EXTRACT_BE_16BITS(message + 8);
- metric = EXTRACT_BE_16BITS(message + 10);
+ interval = EXTRACT_BE_U_2(message + 6);
+ seqno = EXTRACT_BE_U_2(message + 8);
+ metric = EXTRACT_BE_U_2(message + 10);
rc = network_prefix(ae, plen, omitted, message + 2 + parsed_len,
ae == 1 ? v4_prefix : v6_prefix,
len - parsed_len, prefix);
if(len < 14) goto invalid;
ae = message[2];
plen = message[3];
- seqno = EXTRACT_BE_16BITS(message + 4);
+ seqno = EXTRACT_BE_U_2(message + 4);
hopc = message[6];
src_plen = message[7];
router_id = message + 8;
}
pptr += 2;
ND_TCHECK2(*pptr, 4);
- ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_BE_32BITS(pptr)));
+ ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_BE_U_4(pptr)));
pptr += 4;
ND_TCHECK2(*pptr, AUTH_MD5_HASH_LEN);
ND_PRINT((ndo, "\n\t Digest: "));
}
pptr += 2;
ND_TCHECK2(*pptr, 4);
- ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_BE_32BITS(pptr)));
+ ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_BE_U_4(pptr)));
pptr += 4;
ND_TCHECK2(*pptr, AUTH_SHA1_HASH_LEN);
ND_PRINT((ndo, "\n\t Hash: "));
ND_PRINT((ndo, "\n\tDetection Timer Multiplier: %u (%u ms Detection time), BFD Length: %u",
bfd_header->detect_time_multiplier,
- bfd_header->detect_time_multiplier * EXTRACT_BE_32BITS(bfd_header->desired_min_tx_interval)/1000,
+ bfd_header->detect_time_multiplier * EXTRACT_BE_U_4(bfd_header->desired_min_tx_interval)/1000,
bfd_header->length));
- ND_PRINT((ndo, "\n\tMy Discriminator: 0x%08x", EXTRACT_BE_32BITS(bfd_header->my_discriminator)));
- ND_PRINT((ndo, ", Your Discriminator: 0x%08x", EXTRACT_BE_32BITS(bfd_header->your_discriminator)));
- ND_PRINT((ndo, "\n\t Desired min Tx Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->desired_min_tx_interval)/1000));
- ND_PRINT((ndo, "\n\t Required min Rx Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->required_min_rx_interval)/1000));
- ND_PRINT((ndo, "\n\t Required min Echo Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->required_min_echo_interval)/1000));
+ ND_PRINT((ndo, "\n\tMy Discriminator: 0x%08x", EXTRACT_BE_U_4(bfd_header->my_discriminator)));
+ ND_PRINT((ndo, ", Your Discriminator: 0x%08x", EXTRACT_BE_U_4(bfd_header->your_discriminator)));
+ ND_PRINT((ndo, "\n\t Desired min Tx Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->desired_min_tx_interval)/1000));
+ ND_PRINT((ndo, "\n\t Required min Rx Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->required_min_rx_interval)/1000));
+ ND_PRINT((ndo, "\n\t Required min Echo Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->required_min_echo_interval)/1000));
break;
/* BFDv1 */
ND_PRINT((ndo, "\n\tDetection Timer Multiplier: %u (%u ms Detection time), BFD Length: %u",
bfd_header->detect_time_multiplier,
- bfd_header->detect_time_multiplier * EXTRACT_BE_32BITS(bfd_header->desired_min_tx_interval)/1000,
+ bfd_header->detect_time_multiplier * EXTRACT_BE_U_4(bfd_header->desired_min_tx_interval)/1000,
bfd_header->length));
- ND_PRINT((ndo, "\n\tMy Discriminator: 0x%08x", EXTRACT_BE_32BITS(bfd_header->my_discriminator)));
- ND_PRINT((ndo, ", Your Discriminator: 0x%08x", EXTRACT_BE_32BITS(bfd_header->your_discriminator)));
- ND_PRINT((ndo, "\n\t Desired min Tx Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->desired_min_tx_interval)/1000));
- ND_PRINT((ndo, "\n\t Required min Rx Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->required_min_rx_interval)/1000));
- ND_PRINT((ndo, "\n\t Required min Echo Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->required_min_echo_interval)/1000));
+ ND_PRINT((ndo, "\n\tMy Discriminator: 0x%08x", EXTRACT_BE_U_4(bfd_header->my_discriminator)));
+ ND_PRINT((ndo, ", Your Discriminator: 0x%08x", EXTRACT_BE_U_4(bfd_header->your_discriminator)));
+ ND_PRINT((ndo, "\n\t Desired min Tx Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->desired_min_tx_interval)/1000));
+ ND_PRINT((ndo, "\n\t Required min Rx Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->required_min_rx_interval)/1000));
+ ND_PRINT((ndo, "\n\t Required min Echo Interval: %4u ms", EXTRACT_BE_U_4(bfd_header->required_min_echo_interval)/1000));
if (bfd_header->flags & BFD_FLAG_AUTH) {
if (auth_print(ndo, pptr))
uint8_t afi[2]; /* the compiler messes this structure up */
uint8_t res; /* when doing misaligned sequences of int8 and int16 */
uint8_t safi; /* afi should be int16 - so we have to access it using */
-}; /* EXTRACT_16BITS(&bgp_route_refresh->afi) (sigh) */
+}; /* EXTRACT_BE_U_2(&bgp_route_refresh->afi) (sigh) */
#define BGP_ROUTE_REFRESH_SIZE 23
#define bgp_attr_lenlen(flags, p) \
(((flags) & 0x10) ? 2 : 1)
#define bgp_attr_len(flags, p) \
- (((flags) & 0x10) ? EXTRACT_BE_16BITS(p) : *(p))
+ (((flags) & 0x10) ? EXTRACT_BE_U_2(p) : *(p))
#define BGPTYPE_ORIGIN 1
#define BGPTYPE_AS_PATH 2
snprintf(buf, buflen, "%s/%d, label:%u %s",
ipaddr_string(ndo, &addr),
plen,
- EXTRACT_BE_24BITS(pptr + 1)>>4,
+ EXTRACT_BE_U_3(pptr + 1)>>4,
((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
return 4 + plenbytes;
/* Source address length, encoded in bits */
ND_TCHECK_1(pptr);
- addr_length = EXTRACT_8BITS(pptr);
+ addr_length = EXTRACT_U_1(pptr);
pptr++;
/* Source address */
/* Group address length, encoded in bits */
ND_TCHECK_1(pptr);
- addr_length = EXTRACT_8BITS(pptr);
+ addr_length = EXTRACT_U_1(pptr);
pptr++;
/* Group address */
char *pos = rd;
/* ok lets load the RD format */
- switch (EXTRACT_BE_16BITS(pptr)) {
+ switch (EXTRACT_BE_U_2(pptr)) {
/* 2-byte-AS:number fmt*/
case 0:
snprintf(pos, sizeof(rd) - (pos - rd), "%u:%u (= %u.%u.%u.%u)",
- EXTRACT_BE_16BITS(pptr + 2),
- EXTRACT_BE_32BITS(pptr + 4),
+ EXTRACT_BE_U_2(pptr + 2),
+ EXTRACT_BE_U_4(pptr + 4),
*(pptr+4), *(pptr+5), *(pptr+6), *(pptr+7));
break;
/* IP-address:AS fmt*/
case 1:
snprintf(pos, sizeof(rd) - (pos - rd), "%u.%u.%u.%u:%u",
*(pptr+2), *(pptr+3), *(pptr+4), *(pptr+5),
- EXTRACT_BE_16BITS(pptr + 6));
+ EXTRACT_BE_U_2(pptr + 6));
break;
/* 4-byte-AS:number fmt*/
case 2:
snprintf(pos, sizeof(rd) - (pos - rd), "%s:%u (%u.%u.%u.%u:%u)",
- as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_32BITS(pptr + 2)),
- EXTRACT_BE_16BITS(pptr + 6), *(pptr+2), *(pptr+3), *(pptr+4),
- *(pptr+5), EXTRACT_BE_16BITS(pptr + 6));
+ as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_U_4(pptr + 2)),
+ EXTRACT_BE_U_2(pptr + 6), *(pptr+2), *(pptr+3), *(pptr+4),
+ *(pptr+5), EXTRACT_BE_U_2(pptr + 6));
break;
default:
snprintf(pos, sizeof(rd) - (pos - rd), "unknown RD format");
/* With at least "origin AS", possibly with "route target". */
ND_TCHECK_4(pptr + 1);
- as_printf(ndo, asbuf, sizeof(asbuf), EXTRACT_BE_32BITS(pptr + 1));
+ as_printf(ndo, asbuf, sizeof(asbuf), EXTRACT_BE_U_4(pptr + 1));
plen-=32; /* adjust prefix length */
bgp_vpn_rd_print(ndo, pptr+4),
ipaddr_string(ndo, &addr),
plen,
- EXTRACT_BE_24BITS(pptr + 1)>>4,
+ EXTRACT_BE_U_3(pptr + 1)>>4,
((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
return 12 + (plen + 7) / 8;
ND_TCHECK(pptr[0]);
/* if the NLRI is not predefined length, quit.*/
- if (EXTRACT_8BITS(pptr) != MDT_VPN_NLRI_LEN * 8)
+ if (EXTRACT_U_1(pptr) != MDT_VPN_NLRI_LEN * 8)
return -1;
pptr++;
u_int offset;
ND_TCHECK2(pptr[0], 2);
- route_type = EXTRACT_8BITS(pptr);
+ route_type = EXTRACT_U_1(pptr);
pptr++;
- route_length = EXTRACT_8BITS(pptr);
+ route_length = EXTRACT_U_1(pptr);
pptr++;
snprintf(buf, buflen, "Route-Type: %s (%u), length: %u",
snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s",
bgp_vpn_rd_print(ndo, pptr),
as_printf(ndo, astostr, sizeof(astostr),
- EXTRACT_BE_32BITS(pptr + BGP_VPN_RD_LEN)));
+ EXTRACT_BE_U_4(pptr + BGP_VPN_RD_LEN)));
break;
case BGP_MULTICAST_VPN_ROUTE_TYPE_S_PMSI:
snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s",
bgp_vpn_rd_print(ndo, pptr),
as_printf(ndo, astostr, sizeof(astostr),
- EXTRACT_BE_32BITS(pptr + BGP_VPN_RD_LEN)));
+ EXTRACT_BE_U_4(pptr + BGP_VPN_RD_LEN)));
pptr += BGP_VPN_RD_LEN + 4;
bgp_vpn_sg_print(ndo, pptr, buf, buflen);
int plen,tlen,stringlen,tlv_type,tlv_len,ttlv_len;
ND_TCHECK_2(pptr);
- plen=EXTRACT_BE_16BITS(pptr);
+ plen=EXTRACT_BE_U_2(pptr);
tlen=plen;
pptr+=2;
/* Old and new L2VPN NLRI share AFI/SAFI
buf[0]='\0';
stringlen=snprintf(buf, buflen, "RD: %s, CE-ID: %u, Label-Block Offset: %u, Label Base %u",
bgp_vpn_rd_print(ndo, pptr),
- EXTRACT_BE_16BITS(pptr + 8),
- EXTRACT_BE_16BITS(pptr + 10),
- EXTRACT_BE_24BITS(pptr + 12)>>4); /* the label is offsetted by 4 bits so lets shift it right */
+ EXTRACT_BE_U_2(pptr + 8),
+ EXTRACT_BE_U_2(pptr + 10),
+ EXTRACT_BE_U_3(pptr + 12)>>4); /* the label is offsetted by 4 bits so lets shift it right */
UPDATE_BUF_BUFLEN(buf, buflen, stringlen);
pptr+=15;
tlen-=15;
if (tlen < 3)
return -1;
ND_TCHECK2(pptr[0], 3);
- tlv_type=EXTRACT_8BITS(pptr);
+ tlv_type=EXTRACT_U_1(pptr);
pptr++;
- tlv_len=EXTRACT_BE_16BITS(pptr);
+ tlv_len=EXTRACT_BE_U_2(pptr);
ttlv_len=tlv_len;
pptr+=2;
while (ttlv_len>0) {
ND_TCHECK(pptr[0]);
if (buflen!=0) {
- stringlen=snprintf(buf,buflen, "%02x",EXTRACT_8BITS(pptr));
+ stringlen=snprintf(buf,buflen, "%02x",
+ EXTRACT_U_1(pptr));
pptr++;
UPDATE_BUF_BUFLEN(buf, buflen, stringlen);
}
snprintf(buf, buflen, "%s/%d, label:%u %s",
ip6addr_string(ndo, &addr),
plen,
- EXTRACT_BE_24BITS(pptr + 1)>>4,
+ EXTRACT_BE_U_3(pptr + 1)>>4,
((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
return 4 + plenbytes;
bgp_vpn_rd_print(ndo, pptr+4),
ip6addr_string(ndo, &addr),
plen,
- EXTRACT_BE_24BITS(pptr + 1)>>4,
+ EXTRACT_BE_U_3(pptr + 1)>>4,
((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
return 12 + (plen + 7) / 8;
bgp_vpn_rd_print(ndo, pptr+4),
isonsap_string(ndo, addr,(plen + 7) / 8),
plen,
- EXTRACT_BE_24BITS(pptr + 1)>>4,
+ EXTRACT_BE_U_3(pptr + 1)>>4,
((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
return 12 + (plen + 7) / 8;
ND_PRINT((ndo, "%s ",
as_printf(ndo, astostr, sizeof(astostr),
as_size == 2 ?
- EXTRACT_BE_16BITS(tptr + i + 2) :
- EXTRACT_BE_32BITS(tptr + i + 2))));
+ EXTRACT_BE_U_2(tptr + i + 2) :
+ EXTRACT_BE_U_4(tptr + i + 2))));
}
ND_TCHECK(tptr[0]);
ND_PRINT((ndo, "%s", tok2str(bgp_as_path_segment_close_values,
ND_PRINT((ndo, "invalid len"));
else {
ND_TCHECK_4(tptr);
- ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_U_4(tptr)));
}
break;
case BGPTYPE_ATOMIC_AGGREGATE:
ND_TCHECK2(tptr[0], len);
if (len == 6) {
ND_PRINT((ndo, " AS #%s, origin %s",
- as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_16BITS(tptr)),
+ as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_U_2(tptr)),
ipaddr_string(ndo, tptr + 2)));
} else {
ND_PRINT((ndo, " AS #%s, origin %s",
as_printf(ndo, astostr, sizeof(astostr),
- EXTRACT_BE_32BITS(tptr)), ipaddr_string(ndo, tptr + 4)));
+ EXTRACT_BE_U_4(tptr)), ipaddr_string(ndo, tptr + 4)));
}
break;
case BGPTYPE_AGGREGATOR4:
}
ND_TCHECK2(tptr[0], 8);
ND_PRINT((ndo, " AS #%s, origin %s",
- as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_32BITS(tptr)),
+ as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_U_4(tptr)),
ipaddr_string(ndo, tptr + 4)));
break;
case BGPTYPE_COMMUNITIES:
while (tlen>0) {
uint32_t comm;
ND_TCHECK_4(tptr);
- comm = EXTRACT_BE_32BITS(tptr);
+ comm = EXTRACT_BE_U_4(tptr);
switch (comm) {
case BGP_COMMUNITY_NO_EXPORT:
ND_PRINT((ndo, " NO_EXPORT"));
break;
case BGPTYPE_MP_REACH_NLRI:
ND_TCHECK2(tptr[0], 3);
- af = EXTRACT_BE_16BITS(tptr);
- safi = EXTRACT_8BITS(tptr + 2);
+ af = EXTRACT_BE_U_2(tptr);
+ safi = EXTRACT_U_1(tptr + 2);
ND_PRINT((ndo, "\n\t AFI: %s (%u), %sSAFI: %s (%u)",
tok2str(af_values, "Unknown AFI", af),
bgp_vpn_rd_print(ndo, tptr),
isonsap_string(ndo, tptr+BGP_VPN_RD_LEN,tlen-BGP_VPN_RD_LEN)));
/* rfc986 mapped IPv4 address ? */
- if (EXTRACT_BE_32BITS(tptr + BGP_VPN_RD_LEN) == 0x47000601)
+ if (EXTRACT_BE_U_4(tptr + BGP_VPN_RD_LEN) == 0x47000601)
ND_PRINT((ndo, " = %s", ipaddr_string(ndo, tptr+BGP_VPN_RD_LEN+4)));
/* rfc1888 mapped IPv6 address ? */
- else if (EXTRACT_BE_24BITS(tptr + BGP_VPN_RD_LEN) == 0x350000)
+ else if (EXTRACT_BE_U_3(tptr + BGP_VPN_RD_LEN) == 0x350000)
ND_PRINT((ndo, " = %s", ip6addr_string(ndo, tptr+BGP_VPN_RD_LEN+3)));
tptr += tlen;
tlen = 0;
case BGPTYPE_MP_UNREACH_NLRI:
ND_TCHECK2(tptr[0], BGP_MP_NLRI_MINSIZE);
- af = EXTRACT_BE_16BITS(tptr);
+ af = EXTRACT_BE_U_2(tptr);
safi = tptr[2];
ND_PRINT((ndo, "\n\t AFI: %s (%u), %sSAFI: %s (%u)",
uint16_t extd_comm;
ND_TCHECK_2(tptr);
- extd_comm=EXTRACT_BE_16BITS(tptr);
+ extd_comm=EXTRACT_BE_U_2(tptr);
ND_PRINT((ndo, "\n\t %s (0x%04x), Flags [%s]",
tok2str(bgp_extd_comm_subtype_values,
case BGP_EXT_COM_RO_0:
case BGP_EXT_COM_L2VPN_RT_0:
ND_PRINT((ndo, ": %u:%u (= %s)",
- EXTRACT_BE_16BITS(tptr + 2),
- EXTRACT_BE_32BITS(tptr + 4),
+ EXTRACT_BE_U_2(tptr + 2),
+ EXTRACT_BE_U_4(tptr + 4),
ipaddr_string(ndo, tptr+4)));
break;
case BGP_EXT_COM_RT_1:
case BGP_EXT_COM_VRF_RT_IMP:
ND_PRINT((ndo, ": %s:%u",
ipaddr_string(ndo, tptr+2),
- EXTRACT_BE_16BITS(tptr + 6)));
+ EXTRACT_BE_U_2(tptr + 6)));
break;
case BGP_EXT_COM_RT_2:
case BGP_EXT_COM_RO_2:
ND_PRINT((ndo, ": %s:%u",
as_printf(ndo, astostr, sizeof(astostr),
- EXTRACT_BE_32BITS(tptr + 2)), EXTRACT_BE_16BITS(tptr + 6)));
+ EXTRACT_BE_U_4(tptr + 2)), EXTRACT_BE_U_2(tptr + 6)));
break;
case BGP_EXT_COM_LINKBAND:
- bw.i = EXTRACT_BE_32BITS(tptr + 2);
+ bw.i = EXTRACT_BE_U_4(tptr + 2);
ND_PRINT((ndo, ": bandwidth: %.3f Mbps",
bw.f*8/1000000));
break;
ipaddr_string(ndo, tptr+2),
tok2str(bgp_extd_comm_ospf_rtype_values,
"unknown (0x%02x)",
- EXTRACT_8BITS((tptr + 6))),
+ EXTRACT_U_1((tptr + 6))),
(*(tptr+7) & BGP_OSPF_RTYPE_METRIC_TYPE) ? "E2" : "",
((*(tptr+6) == BGP_OSPF_RTYPE_EXT) || (*(tptr+6) == BGP_OSPF_RTYPE_NSSA)) ? "E1" : ""));
break;
ND_PRINT((ndo, ": %s Control Flags [0x%02x]:MTU %u",
tok2str(l2vpn_encaps_values,
"unknown encaps",
- EXTRACT_8BITS((tptr + 2))),
- EXTRACT_8BITS((tptr + 3)),
- EXTRACT_BE_16BITS(tptr + 4)));
+ EXTRACT_U_1((tptr + 2))),
+ EXTRACT_U_1((tptr + 3)),
+ EXTRACT_BE_U_2(tptr + 4)));
break;
case BGP_EXT_COM_SOURCE_AS:
- ND_PRINT((ndo, ": AS %u", EXTRACT_BE_16BITS(tptr + 2)));
+ ND_PRINT((ndo, ": AS %u", EXTRACT_BE_U_2(tptr + 2)));
break;
default:
ND_TCHECK2(*tptr,8);
uint8_t tunnel_type, flags;
ND_TCHECK2(tptr[0], 5);
- flags = EXTRACT_8BITS(tptr);
- tunnel_type = EXTRACT_8BITS(tptr+1);
+ flags = EXTRACT_U_1(tptr);
+ tunnel_type = EXTRACT_U_1(tptr + 1);
tlen = len;
ND_PRINT((ndo, "\n\t Tunnel-type %s (%u), Flags [%s], MPLS Label %u",
tok2str(bgp_pmsi_tunnel_values, "Unknown", tunnel_type),
tunnel_type,
bittok2str(bgp_pmsi_flag_values, "none", flags),
- EXTRACT_BE_24BITS(tptr + 2)>>4));
+ EXTRACT_BE_U_3(tptr + 2)>>4));
tptr +=5;
tlen -= 5;
ND_TCHECK2(tptr[0], 8);
ND_PRINT((ndo, "\n\t Root-Node %s, LSP-ID 0x%08x",
ipaddr_string(ndo, tptr),
- EXTRACT_BE_32BITS(tptr + 4)));
+ EXTRACT_BE_U_4(tptr + 4)));
break;
case BGP_PMSI_TUNNEL_RSVP_P2MP:
ND_TCHECK2(tptr[0], 8);
ND_PRINT((ndo, "\n\t Extended-Tunnel-ID %s, P2MP-ID 0x%08x",
ipaddr_string(ndo, tptr),
- EXTRACT_BE_32BITS(tptr + 4)));
+ EXTRACT_BE_U_4(tptr + 4)));
break;
default:
if (ndo->ndo_vflag <= 1) {
ND_TCHECK2(tptr[0], 3);
- type = EXTRACT_8BITS(tptr);
- length = EXTRACT_BE_16BITS(tptr + 1);
+ type = EXTRACT_U_1(tptr);
+ length = EXTRACT_BE_U_2(tptr + 1);
tptr += 3;
tlen -= 3;
if (length < 8)
goto trunc;
ND_PRINT((ndo, ", metric %" PRIu64,
- EXTRACT_BE_64BITS(tptr)));
+ EXTRACT_BE_U_8(tptr)));
break;
default:
if (len < 4)
goto trunc;
ND_PRINT((ndo, "\n\t Origin AS: %s",
- as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_32BITS(tptr))));
+ as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_U_4(tptr))));
tptr+=4;
len -=4;
ND_TCHECK2(tptr[0], 2);
if (len < 2)
goto trunc;
- aflags = EXTRACT_8BITS(tptr);
- atype = EXTRACT_8BITS(tptr + 1);
+ aflags = EXTRACT_U_1(tptr);
+ atype = EXTRACT_U_1(tptr + 1);
tptr += 2;
len -= 2;
alenlen = bgp_attr_lenlen(aflags, tptr);
while (len > 0) {
ND_TCHECK2(*tptr, 12);
ND_PRINT((ndo, "%u:%u:%u%s",
- EXTRACT_BE_32BITS(tptr),
- EXTRACT_BE_32BITS(tptr + 4),
- EXTRACT_BE_32BITS(tptr + 8),
+ EXTRACT_BE_U_4(tptr),
+ EXTRACT_BE_U_4(tptr + 4),
+ EXTRACT_BE_U_4(tptr + 8),
(len > 12) ? ", " : ""));
tptr += 12;
len -= 12;
case BGP_CAPCODE_MP:
ND_PRINT((ndo, "\n\t\tAFI %s (%u), SAFI %s (%u)",
tok2str(af_values, "Unknown",
- EXTRACT_BE_16BITS(opt + i + 2)),
- EXTRACT_BE_16BITS(opt + i + 2),
+ EXTRACT_BE_U_2(opt + i + 2)),
+ EXTRACT_BE_U_2(opt + i + 2),
tok2str(bgp_safi_values, "Unknown",
opt[i+5]),
opt[i+5]));
case BGP_CAPCODE_RESTART:
ND_PRINT((ndo, "\n\t\tRestart Flags: [%s], Restart Time %us",
((opt[i+2])&0x80) ? "R" : "none",
- EXTRACT_BE_16BITS(opt + i + 2)&0xfff));
+ EXTRACT_BE_U_2(opt + i + 2)&0xfff));
tcap_len-=2;
cap_offset=4;
while(tcap_len>=4) {
ND_PRINT((ndo, "\n\t\t AFI %s (%u), SAFI %s (%u), Forwarding state preserved: %s",
tok2str(af_values,"Unknown",
- EXTRACT_BE_16BITS(opt + i + cap_offset)),
- EXTRACT_BE_16BITS(opt + i + cap_offset),
+ EXTRACT_BE_U_2(opt + i + cap_offset)),
+ EXTRACT_BE_U_2(opt + i + cap_offset),
tok2str(bgp_safi_values,"Unknown",
opt[i+cap_offset+2]),
opt[i+cap_offset+2],
if (cap_len == 4) {
ND_PRINT((ndo, "\n\t\t 4 Byte AS %s",
as_printf(ndo, astostr, sizeof(astostr),
- EXTRACT_BE_32BITS(opt + i + 2))));
+ EXTRACT_BE_U_4(opt + i + 2))));
}
break;
case BGP_CAPCODE_ADD_PATH:
break;
}
ND_PRINT((ndo, "\n\t\tAFI %s (%u), SAFI %s (%u), Send/Receive: %s",
- tok2str(af_values,"Unknown",EXTRACT_BE_16BITS(opt + i + cap_offset)),
- EXTRACT_BE_16BITS(opt + i + cap_offset),
+ tok2str(af_values,"Unknown",EXTRACT_BE_U_2(opt + i + cap_offset)),
+ EXTRACT_BE_U_2(opt + i + cap_offset),
tok2str(bgp_safi_values,"Unknown",opt[i+cap_offset+2]),
opt[i+cap_offset+2],
tok2str(bgp_add_path_recvsend,"Bogus (0x%02x)",opt[i+cap_offset+3])
ND_TCHECK_2(p);
if (length < 2)
goto trunc;
- withdrawn_routes_len = EXTRACT_BE_16BITS(p);
+ withdrawn_routes_len = EXTRACT_BE_U_2(p);
p += 2;
length -= 2;
if (withdrawn_routes_len) {
ND_TCHECK_2(p);
if (length < 2)
goto trunc;
- len = EXTRACT_BE_16BITS(p);
+ len = EXTRACT_BE_U_2(p);
p += 2;
length -= 2;
goto trunc;
if (length < 2)
goto trunc;
- aflags = EXTRACT_8BITS(p);
- atype = EXTRACT_8BITS(p + 1);
+ aflags = EXTRACT_U_1(p);
+ atype = EXTRACT_U_1(p + 1);
p += 2;
len -= 2;
length -= 2;
ND_TCHECK2(*tptr, 7);
ND_PRINT((ndo, ", AFI %s (%u), SAFI %s (%u), Max Prefixes: %u",
tok2str(af_values, "Unknown",
- EXTRACT_BE_16BITS(tptr)),
- EXTRACT_BE_16BITS(tptr),
- tok2str(bgp_safi_values, "Unknown", EXTRACT_8BITS((tptr + 2))),
- EXTRACT_8BITS((tptr + 2)),
- EXTRACT_BE_32BITS(tptr + 3)));
+ EXTRACT_BE_U_2(tptr)),
+ EXTRACT_BE_U_2(tptr),
+ tok2str(bgp_safi_values, "Unknown", EXTRACT_U_1((tptr + 2))),
+ EXTRACT_U_1((tptr + 2)),
+ EXTRACT_BE_U_4(tptr + 3)));
}
/*
* draft-ietf-idr-shutdown describes a method to send a communication
length >= BGP_NOTIFICATION_SIZE + 1) {
tptr = dat + BGP_NOTIFICATION_SIZE;
ND_TCHECK_1(tptr);
- shutdown_comm_length = EXTRACT_8BITS(tptr);
+ shutdown_comm_length = EXTRACT_U_1(tptr);
remainder_offset = 0;
/* garbage, hexdump it all */
if (shutdown_comm_length > BGP_NOTIFY_MINOR_CEASE_ADMIN_SHUTDOWN_LEN ||
tok2str(af_values,"Unknown",
/* this stinks but the compiler pads the structure
* weird */
- EXTRACT_BE_16BITS(&bgp_route_refresh_header->afi)),
- EXTRACT_BE_16BITS(&bgp_route_refresh_header->afi),
+ EXTRACT_BE_U_2(&bgp_route_refresh_header->afi)),
+ EXTRACT_BE_U_2(&bgp_route_refresh_header->afi),
tok2str(bgp_safi_values,"Unknown",
bgp_route_refresh_header->safi),
bgp_route_refresh_header->safi));
/* Only print interesting fields */
if (bp->bp_hops)
ND_PRINT((ndo, ", hops %d", bp->bp_hops));
- if (EXTRACT_BE_32BITS(&bp->bp_xid))
- ND_PRINT((ndo, ", xid 0x%x", EXTRACT_BE_32BITS(&bp->bp_xid)));
- if (EXTRACT_BE_16BITS(&bp->bp_secs))
- ND_PRINT((ndo, ", secs %d", EXTRACT_BE_16BITS(&bp->bp_secs)));
+ if (EXTRACT_BE_U_4(&bp->bp_xid))
+ ND_PRINT((ndo, ", xid 0x%x", EXTRACT_BE_U_4(&bp->bp_xid)));
+ if (EXTRACT_BE_U_2(&bp->bp_secs))
+ ND_PRINT((ndo, ", secs %d", EXTRACT_BE_U_2(&bp->bp_secs)));
ND_TCHECK(bp->bp_flags);
ND_PRINT((ndo, ", Flags [%s]",
- bittok2str(bootp_flag_values, "none", EXTRACT_BE_16BITS(&bp->bp_flags))));
+ bittok2str(bootp_flag_values, "none", EXTRACT_BE_U_2(&bp->bp_flags))));
if (ndo->ndo_vflag > 1)
- ND_PRINT((ndo, " (0x%04x)", EXTRACT_BE_16BITS(&bp->bp_flags)));
+ ND_PRINT((ndo, " (0x%04x)", EXTRACT_BE_U_2(&bp->bp_flags)));
/* Client's ip address */
ND_TCHECK(bp->bp_ciaddr);
- if (EXTRACT_BE_32BITS(&bp->bp_ciaddr.s_addr))
+ if (EXTRACT_BE_U_4(&bp->bp_ciaddr.s_addr))
ND_PRINT((ndo, "\n\t Client-IP %s", ipaddr_string(ndo, &bp->bp_ciaddr)));
/* 'your' ip address (bootp client) */
ND_TCHECK(bp->bp_yiaddr);
- if (EXTRACT_BE_32BITS(&bp->bp_yiaddr.s_addr))
+ if (EXTRACT_BE_U_4(&bp->bp_yiaddr.s_addr))
ND_PRINT((ndo, "\n\t Your-IP %s", ipaddr_string(ndo, &bp->bp_yiaddr)));
/* Server's ip address */
ND_TCHECK(bp->bp_siaddr);
- if (EXTRACT_BE_32BITS(&bp->bp_siaddr.s_addr))
+ if (EXTRACT_BE_U_4(&bp->bp_siaddr.s_addr))
ND_PRINT((ndo, "\n\t Server-IP %s", ipaddr_string(ndo, &bp->bp_siaddr)));
/* Gateway's ip address */
ND_TCHECK(bp->bp_giaddr);
- if (EXTRACT_BE_32BITS(&bp->bp_giaddr.s_addr))
+ if (EXTRACT_BE_U_4(&bp->bp_giaddr.s_addr))
ND_PRINT((ndo, "\n\t Gateway-IP %s", ipaddr_string(ndo, &bp->bp_giaddr)));
/* Client's Ethernet address */
}
ND_TCHECK_1(bp->bp_sname); /* check first char only */
- if (EXTRACT_8BITS(bp->bp_sname)) {
+ if (EXTRACT_U_1(bp->bp_sname)) {
ND_PRINT((ndo, "\n\t sname \""));
if (fn_printztn(ndo, bp->bp_sname, (u_int)sizeof bp->bp_sname,
ndo->ndo_snapend)) {
ND_PRINT((ndo, "\""));
}
ND_TCHECK_1(bp->bp_file); /* check first char only */
- if (EXTRACT_8BITS(bp->bp_file)) {
+ if (EXTRACT_U_1(bp->bp_file)) {
ND_PRINT((ndo, "\n\t file \""));
if (fn_printztn(ndo, bp->bp_file, (u_int)sizeof bp->bp_file,
ndo->ndo_snapend)) {
else {
uint32_t ul;
- ul = EXTRACT_BE_32BITS(&bp->bp_vend);
+ ul = EXTRACT_BE_U_4(&bp->bp_vend);
if (ul != 0)
ND_PRINT((ndo, "\n\t Vendor-#0x%x", ul));
}
ND_PRINT((ndo, "\n\t Vendor-rfc1048 Extensions"));
/* Step over magic cookie */
- ND_PRINT((ndo, "\n\t Magic Cookie 0x%08x", EXTRACT_BE_32BITS(bp)));
+ ND_PRINT((ndo, "\n\t Magic Cookie 0x%08x", EXTRACT_BE_U_4(bp)));
bp += sizeof(int32_t);
/* Loop while we there is a tag left in the buffer */
while (ND_TTEST_1(bp)) {
- tag = EXTRACT_8BITS(bp);
+ tag = EXTRACT_U_1(bp);
bp++;
if (tag == TAG_PAD && ndo->ndo_vflag < 3)
continue;
return;
if (tag == TAG_EXTENDED_OPTION) {
ND_TCHECK_2(bp + 1);
- tag = EXTRACT_BE_16BITS(bp + 1);
+ tag = EXTRACT_BE_U_2(bp + 1);
/* XXX we don't know yet if the IANA will
* preclude overlap of 1-byte and 2-byte spaces.
* If not, we need to offset tag after this step.
else {
/* Get the length; check for truncation */
ND_TCHECK_1(bp);
- len = EXTRACT_8BITS(bp);
+ len = EXTRACT_U_1(bp);
bp++;
}
if (tag == TAG_PAD && ndo->ndo_vflag > 2) {
u_int ntag = 1;
while (ND_TTEST_1(bp) &&
- EXTRACT_8BITS(bp) == TAG_PAD) {
+ EXTRACT_U_1(bp) == TAG_PAD) {
bp++;
ntag++;
}
}
if (tag == TAG_DHCP_MESSAGE && len == 1) {
- uc = EXTRACT_8BITS(bp);
+ uc = EXTRACT_U_1(bp);
bp++;
ND_PRINT((ndo, "%s", tok2str(dhcp_msg_values, "Unknown (%u)", uc)));
continue;
if (tag == TAG_PARM_REQUEST) {
idx = 0;
while (len-- > 0) {
- uc = EXTRACT_8BITS(bp);
+ uc = EXTRACT_U_1(bp);
bp++;
cp = tok2str(tag2str, "?Option %u", uc);
if (idx % 4 == 0)
first = 1;
while (len > 1) {
len -= 2;
- us = EXTRACT_BE_16BITS(bp);
+ us = EXTRACT_BE_U_2(bp);
bp += 2;
cp = tok2str(xtag2str, "?xT%u", us);
if (!first)
while (len >= sizeof(ul)) {
if (!first)
ND_PRINT((ndo, ","));
- ul = EXTRACT_BE_32BITS(bp);
+ ul = EXTRACT_BE_U_4(bp);
if (c == 'i') {
ul = htonl(ul);
ND_PRINT((ndo, "%s", ipaddr_string(ndo, &ul)));
while (len >= sizeof(us)) {
if (!first)
ND_PRINT((ndo, ","));
- us = EXTRACT_BE_16BITS(bp);
+ us = EXTRACT_BE_U_2(bp);
ND_PRINT((ndo, "%u", us));
bp += sizeof(us);
len -= sizeof(us);
uint8_t bool_value;
if (!first)
ND_PRINT((ndo, ","));
- bool_value = EXTRACT_8BITS(bp);
+ bool_value = EXTRACT_U_1(bp);
switch (bool_value) {
case 0:
ND_PRINT((ndo, "N"));
uint8_t byte_value;
if (!first)
ND_PRINT((ndo, c == 'x' ? ":" : "."));
- byte_value = EXTRACT_8BITS(bp);
+ byte_value = EXTRACT_U_1(bp);
if (c == 'x')
ND_PRINT((ndo, "%02x", byte_value));
else
ND_PRINT((ndo, "ERROR: length < 1 bytes"));
break;
}
- tag = EXTRACT_8BITS(bp);
+ tag = EXTRACT_U_1(bp);
++bp;
--len;
ND_PRINT((ndo, "%s", tok2str(nbo2str, NULL, tag)));
ND_PRINT((ndo, "ERROR: length < 1 bytes"));
break;
}
- tag = EXTRACT_8BITS(bp);
+ tag = EXTRACT_U_1(bp);
++bp;
--len;
ND_PRINT((ndo, "%s", tok2str(oo2str, NULL, tag)));
len = 0;
break;
}
- if (EXTRACT_8BITS(bp))
- ND_PRINT((ndo, "[%s] ", client_fqdn_flags(EXTRACT_8BITS(bp))));
+ if (EXTRACT_U_1(bp))
+ ND_PRINT((ndo, "[%s] ", client_fqdn_flags(EXTRACT_U_1(bp))));
bp++;
- if (EXTRACT_8BITS(bp) || EXTRACT_8BITS(bp+1))
- ND_PRINT((ndo, "%u/%u ", EXTRACT_8BITS(bp), EXTRACT_8BITS(bp+1)));
+ if (EXTRACT_U_1(bp) || EXTRACT_U_1(bp + 1))
+ ND_PRINT((ndo, "%u/%u ", EXTRACT_U_1(bp), EXTRACT_U_1(bp + 1)));
bp += 2;
ND_PRINT((ndo, "\""));
if (fn_printn(ndo, bp, len - 3, ndo->ndo_snapend)) {
ND_PRINT((ndo, "ERROR: length < 1 bytes"));
break;
}
- type = EXTRACT_8BITS(bp);
+ type = EXTRACT_U_1(bp);
bp++;
len--;
if (type == 0) {
while (len > 0) {
if (!first)
ND_PRINT((ndo, ":"));
- ND_PRINT((ndo, "%02x", EXTRACT_8BITS(bp)));
+ ND_PRINT((ndo, "%02x", EXTRACT_U_1(bp)));
++bp;
--len;
first = 0;
case TAG_AGENT_CIRCUIT:
while (len >= 2) {
- subopt = EXTRACT_8BITS(bp);
- suboptlen = EXTRACT_8BITS(bp+1);
+ subopt = EXTRACT_U_1(bp);
+ suboptlen = EXTRACT_U_1(bp + 1);
bp += 2;
len -= 2;
if (suboptlen > len) {
while (len > 0) {
if (!first)
ND_PRINT((ndo, ","));
- mask_width = EXTRACT_8BITS(bp);
+ mask_width = EXTRACT_U_1(bp);
bp++;
len--;
/* mask_width <= 32 */
for (i = 0; i < significant_octets ; i++) {
if (i > 0)
ND_PRINT((ndo, "."));
- ND_PRINT((ndo, "%d", EXTRACT_8BITS(bp)));
+ ND_PRINT((ndo, "%d", EXTRACT_U_1(bp)));
bp++;
}
for (i = significant_octets ; i < 4 ; i++)
break;
}
while (len > 0) {
- suboptlen = EXTRACT_8BITS(bp);
+ suboptlen = EXTRACT_U_1(bp);
bp++;
len--;
ND_PRINT((ndo, "\n\t "));
length -= BT_HDRLEN;
p += BT_HDRLEN;
if (ndo->ndo_eflag)
- ND_PRINT((ndo, "hci length %d, direction %s, ", length, (EXTRACT_BE_32BITS(&hdr->direction)&0x1)?"in":"out"));
+ ND_PRINT((ndo, "hci length %d, direction %s, ", length, (EXTRACT_BE_U_4(&hdr->direction)&0x1)?"in":"out"));
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
vec[0].len = len;
if (ND_TTEST2(bp[0], len) && in_cksum(vec, 1))
ND_PRINT((ndo, " (bad carp cksum %x!)",
- EXTRACT_BE_16BITS(bp + 6)));
+ EXTRACT_BE_U_2(bp + 6)));
}
- ND_PRINT((ndo, "counter=%" PRIu64, EXTRACT_BE_64BITS(bp + 8)));
+ ND_PRINT((ndo, "counter=%" PRIu64, EXTRACT_BE_U_8(bp + 8)));
return;
trunc:
tptr = pptr; /* temporary pointer */
ND_TCHECK2(*tptr, CDP_HEADER_LEN);
- ND_PRINT((ndo, "CDPv%u, ttl: %us", EXTRACT_8BITS((tptr + CDP_HEADER_VERSION_OFFSET)),
+ ND_PRINT((ndo, "CDPv%u, ttl: %us", EXTRACT_U_1((tptr + CDP_HEADER_VERSION_OFFSET)),
*(tptr + CDP_HEADER_TTL_OFFSET)));
if (ndo->ndo_vflag)
- ND_PRINT((ndo, ", checksum: 0x%04x (unverified), length %u", EXTRACT_BE_16BITS(tptr + CDP_HEADER_CHECKSUM_OFFSET), length));
+ ND_PRINT((ndo, ", checksum: 0x%04x (unverified), length %u", EXTRACT_BE_U_2(tptr + CDP_HEADER_CHECKSUM_OFFSET), length));
tptr += CDP_HEADER_LEN;
while (tptr < (pptr+length)) {
ND_TCHECK2(*tptr, CDP_TLV_HEADER_LEN); /* read out Type and Length */
- type = EXTRACT_BE_16BITS(tptr + CDP_TLV_TYPE_OFFSET);
- len = EXTRACT_BE_16BITS(tptr + CDP_TLV_LEN_OFFSET); /* object length includes the 4 bytes header length */
+ type = EXTRACT_BE_U_2(tptr + CDP_TLV_TYPE_OFFSET);
+ len = EXTRACT_BE_U_2(tptr + CDP_TLV_LEN_OFFSET); /* object length includes the 4 bytes header length */
if (len < CDP_TLV_HEADER_LEN) {
if (ndo->ndo_vflag)
ND_PRINT((ndo, "\n\t%s (0x%02x), TLV length: %u byte%s (too short)",
if (len < 4)
goto trunc;
ND_PRINT((ndo, "(0x%08x): %s",
- EXTRACT_BE_32BITS(tptr),
- bittok2str(cdp_capability_values, "none", EXTRACT_BE_32BITS(tptr))));
+ EXTRACT_BE_U_4(tptr),
+ bittok2str(cdp_capability_values, "none", EXTRACT_BE_U_4(tptr))));
break;
case 0x05: /* Version */
ND_PRINT((ndo, "\n\t "));
for (i=0;i<len;i++) {
- j = EXTRACT_8BITS(tptr + i);
+ j = EXTRACT_U_1(tptr + i);
if (j == '\n') /* lets rework the version string to
get a nice indentation */
ND_PRINT((ndo, "\n\t "));
case 0x0a: /* Native VLAN ID - CDPv2 */
if (len < 2)
goto trunc;
- ND_PRINT((ndo, "%d", EXTRACT_BE_16BITS(tptr)));
+ ND_PRINT((ndo, "%d", EXTRACT_BE_U_2(tptr)));
break;
case 0x0b: /* Duplex - CDPv2 */
if (len < 1)
case 0x0e: /* ATA-186 VoIP VLAN request - incomplete doc. */
if (len < 3)
goto trunc;
- ND_PRINT((ndo, "app %d, vlan %d", EXTRACT_8BITS((tptr)), EXTRACT_BE_16BITS(tptr + 1)));
+ ND_PRINT((ndo, "app %d, vlan %d", EXTRACT_U_1((tptr)), EXTRACT_BE_U_2(tptr + 1)));
break;
case 0x10: /* ATA-186 VoIP VLAN assignment - incomplete doc. */
ND_PRINT((ndo, "%1.2fW", cdp_get_number(tptr, len) / 1000.0));
case 0x11: /* MTU - not documented */
if (len < 4)
goto trunc;
- ND_PRINT((ndo, "%u bytes", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "%u bytes", EXTRACT_BE_U_4(tptr)));
break;
case 0x12: /* AVVID trust bitmap - not documented */
if (len < 1)
ND_TCHECK2(*p, 4);
if (p + 4 > endp)
goto trunc;
- num = EXTRACT_BE_32BITS(p);
+ num = EXTRACT_BE_U_4(p);
p += 4;
while (p < endp && num >= 0) {
ND_TCHECK2(p[pl], 2);
if (p + pl + 2 > endp)
goto trunc;
- al = EXTRACT_BE_16BITS(p + pl); /* address length */
+ al = EXTRACT_BE_U_2(p + pl); /* address length */
if (pt == PT_NLPID && pl == 1 && *p == NLPID_IP && al == 4) {
/*
ND_TCHECK2(*p, pl);
if (p + pl > endp)
goto trunc;
- ND_PRINT((ndo, "pt=0x%02x, pl=%d, pb=", EXTRACT_8BITS((p - 2)), pl));
+ ND_PRINT((ndo, "pt=0x%02x, pl=%d, pb=", EXTRACT_U_1((p - 2)), pl));
while (pl-- > 0) {
- ND_PRINT((ndo, " %02x", EXTRACT_8BITS(p)));
+ ND_PRINT((ndo, " %02x", EXTRACT_U_1(p)));
p++;
}
ND_TCHECK2(*p, 2);
if (p + al > endp)
goto trunc;
while (al-- > 0) {
- ND_PRINT((ndo, " %02x", EXTRACT_8BITS(p)));
+ ND_PRINT((ndo, " %02x", EXTRACT_U_1(p)));
p++;
}
}
unsigned long res=0;
while( l>0 )
{
- res = (res<<8) + EXTRACT_8BITS(p);
+ res = (res<<8) + EXTRACT_U_1(p);
p++; l--;
}
return res;
return hexdump;
}
/* The calling function must make any due ND_TCHECK calls. */
- network_addr_type = EXTRACT_8BITS(tptr);
+ network_addr_type = EXTRACT_U_1(tptr);
ND_PRINT((ndo, "\n\t Network Address Type %s (%u)",
tok2str(af_values, "Unknown", network_addr_type),
network_addr_type));
}
ND_PRINT((ndo, "\n\t Sequence Number 0x%08x, MA-End-Point-ID 0x%04x",
- EXTRACT_BE_32BITS(msg_ptr.cfm_ccm->sequence),
- EXTRACT_BE_16BITS(msg_ptr.cfm_ccm->ma_epi)));
+ EXTRACT_BE_U_4(msg_ptr.cfm_ccm->sequence),
+ EXTRACT_BE_U_2(msg_ptr.cfm_ccm->ma_epi)));
namesp = msg_ptr.cfm_ccm->names;
names_data_remaining = sizeof(msg_ptr.cfm_ccm->names);
bittok2str(cfm_ltm_flag_values, "none", cfm_common_header->flags)));
ND_PRINT((ndo, "\n\t Transaction-ID 0x%08x, ttl %u",
- EXTRACT_BE_32BITS(msg_ptr.cfm_ltm->transaction_id),
+ EXTRACT_BE_U_4(msg_ptr.cfm_ltm->transaction_id),
msg_ptr.cfm_ltm->ttl));
ND_PRINT((ndo, "\n\t Original-MAC %s, Target-MAC %s",
bittok2str(cfm_ltr_flag_values, "none", cfm_common_header->flags)));
ND_PRINT((ndo, "\n\t Transaction-ID 0x%08x, ttl %u",
- EXTRACT_BE_32BITS(msg_ptr.cfm_ltr->transaction_id),
+ EXTRACT_BE_U_4(msg_ptr.cfm_ltr->transaction_id),
msg_ptr.cfm_ltr->ttl));
ND_PRINT((ndo, "\n\t Replay-Action %s (%u)",
if (tlen < sizeof(struct cfm_tlv_header_t))
goto tooshort;
ND_TCHECK2(*tptr, sizeof(struct cfm_tlv_header_t));
- cfm_tlv_len=EXTRACT_BE_16BITS(&cfm_tlv_header->length);
+ cfm_tlv_len=EXTRACT_BE_U_2(&cfm_tlv_header->length);
ND_PRINT((ndo, ", length %u", cfm_tlv_len));
return;
}
ND_PRINT((ndo, ", Status: %s (%u)",
- tok2str(cfm_tlv_port_status_values, "Unknown", EXTRACT_8BITS(tptr)),
- EXTRACT_8BITS(tptr)));
+ tok2str(cfm_tlv_port_status_values, "Unknown", EXTRACT_U_1(tptr)),
+ EXTRACT_U_1(tptr)));
break;
case CFM_TLV_INTERFACE_STATUS:
return;
}
ND_PRINT((ndo, ", Status: %s (%u)",
- tok2str(cfm_tlv_interface_status_values, "Unknown", EXTRACT_8BITS(tptr)),
- EXTRACT_8BITS(tptr)));
+ tok2str(cfm_tlv_interface_status_values, "Unknown", EXTRACT_U_1(tptr)),
+ EXTRACT_U_1(tptr)));
break;
case CFM_TLV_PRIVATE:
return;
}
ND_PRINT((ndo, ", Vendor: %s (%u), Sub-Type %u",
- tok2str(oui_values,"Unknown", EXTRACT_BE_24BITS(tptr)),
- EXTRACT_BE_24BITS(tptr),
+ tok2str(oui_values,"Unknown", EXTRACT_BE_U_3(tptr)),
+ EXTRACT_BE_U_3(tptr),
*(tptr + 3)));
hexdump = TRUE;
break;
* Get the Chassis ID length and check it.
* IEEE 802.1Q-2014 Section 21.5.3.1
*/
- chassis_id_length = EXTRACT_8BITS(tptr);
+ chassis_id_length = EXTRACT_U_1(tptr);
tptr++;
tlen--;
cfm_tlv_len--;
ND_PRINT((ndo, "\n\t (TLV too short)"));
goto next_tlv;
}
- chassis_id_type = EXTRACT_8BITS(tptr);
+ chassis_id_type = EXTRACT_U_1(tptr);
cfm_tlv_len--;
ND_PRINT((ndo, "\n\t Chassis-ID Type %s (%u), Chassis-ID length %u",
tok2str(cfm_tlv_senderid_chassisid_values,
}
/* Here mgmt_addr_length stands for the management domain length. */
- mgmt_addr_length = EXTRACT_8BITS(tptr);
+ mgmt_addr_length = EXTRACT_U_1(tptr);
tptr++;
tlen--;
cfm_tlv_len--;
}
/* Here mgmt_addr_length stands for the management address length. */
- mgmt_addr_length = EXTRACT_8BITS(tptr);
+ mgmt_addr_length = EXTRACT_U_1(tptr);
tptr++;
tlen--;
cfm_tlv_len--;
if (length < CHDLC_HDRLEN)
goto trunc;
ND_TCHECK2(*p, CHDLC_HDRLEN);
- proto = EXTRACT_BE_16BITS(p + 2);
+ proto = EXTRACT_BE_U_2(p + 2);
if (ndo->ndo_eflag) {
ND_PRINT((ndo, "%s, ethertype %s (0x%04x), length %u: ",
tok2str(chdlc_cast_values, "0x%02x", p[0]),
slarp = (const struct cisco_slarp *)cp;
ND_TCHECK2(*slarp, SLARP_MIN_LEN);
- switch (EXTRACT_BE_32BITS(&slarp->code)) {
+ switch (EXTRACT_BE_U_4(&slarp->code)) {
case SLARP_REQUEST:
ND_PRINT((ndo, "request"));
/*
break;
case SLARP_KEEPALIVE:
ND_PRINT((ndo, "keepalive: mineseen=0x%08x, yourseen=0x%08x, reliability=0x%04x",
- EXTRACT_BE_32BITS(&slarp->un.keep.myseq),
- EXTRACT_BE_32BITS(&slarp->un.keep.yourseq),
- EXTRACT_BE_16BITS(&slarp->un.keep.rel)));
+ EXTRACT_BE_U_4(&slarp->un.keep.myseq),
+ EXTRACT_BE_U_4(&slarp->un.keep.yourseq),
+ EXTRACT_BE_U_2(&slarp->un.keep.rel)));
if (length >= SLARP_MAX_LEN) { /* uptime-stamp is optional */
cp += SLARP_MIN_LEN;
ND_TCHECK2(*cp, 4);
- sec = EXTRACT_BE_32BITS(cp) / 1000;
+ sec = EXTRACT_BE_U_4(cp) / 1000;
min = sec / 60; sec -= min * 60;
hrs = min / 60; min -= hrs * 60;
days = hrs / 24; hrs -= days * 24;
}
break;
default:
- ND_PRINT((ndo, "0x%02x unknown", EXTRACT_BE_32BITS(&slarp->code)));
+ ND_PRINT((ndo, "0x%02x unknown", EXTRACT_BE_U_4(&slarp->code)));
if (ndo->ndo_vflag <= 1)
print_unknown_data(ndo,cp+4,"\n\t",length-4);
break;
nh = (const struct nfhdr_v1 *)cp;
ND_TCHECK(*nh);
- ver = EXTRACT_BE_16BITS(&nh->version);
- nrecs = EXTRACT_BE_32BITS(&nh->count);
+ ver = EXTRACT_BE_U_2(&nh->version);
+ nrecs = EXTRACT_BE_U_4(&nh->count);
#if 0
/*
* This is seconds since the UN*X epoch, and is followed by
* nanoseconds. XXX - format it, rather than just dumping the
* raw seconds-since-the-Epoch.
*/
- t = EXTRACT_32BITS(&nh->utc_sec);
+ t = EXTRACT_BE_U_4(&nh->utc_sec);
#endif
ND_PRINT((ndo, "NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver,
- EXTRACT_BE_32BITS(&nh->msys_uptime)/1000,
- EXTRACT_BE_32BITS(&nh->msys_uptime)%1000,
- EXTRACT_BE_32BITS(&nh->utc_sec), EXTRACT_BE_32BITS(&nh->utc_nsec)));
+ EXTRACT_BE_U_4(&nh->msys_uptime)/1000,
+ EXTRACT_BE_U_4(&nh->msys_uptime)%1000,
+ EXTRACT_BE_U_4(&nh->utc_sec), EXTRACT_BE_U_4(&nh->utc_nsec)));
nr = (const struct nfrec_v1 *)&nh[1];
*/
ND_TCHECK(*nr);
ND_PRINT((ndo, "\n started %u.%03u, last %u.%03u",
- EXTRACT_BE_32BITS(&nr->start_time)/1000,
- EXTRACT_BE_32BITS(&nr->start_time)%1000,
- EXTRACT_BE_32BITS(&nr->last_time)/1000,
- EXTRACT_BE_32BITS(&nr->last_time)%1000));
+ EXTRACT_BE_U_4(&nr->start_time)/1000,
+ EXTRACT_BE_U_4(&nr->start_time)%1000,
+ EXTRACT_BE_U_4(&nr->last_time)/1000,
+ EXTRACT_BE_U_4(&nr->last_time)%1000));
asbuf[0] = buf[0] = '\0';
ND_PRINT((ndo, "\n %s%s%s:%u ", intoa(nr->src_ina.s_addr), buf, asbuf,
- EXTRACT_BE_16BITS(&nr->srcport)));
+ EXTRACT_BE_U_2(&nr->srcport)));
ND_PRINT((ndo, "> %s%s%s:%u ", intoa(nr->dst_ina.s_addr), buf, asbuf,
- EXTRACT_BE_16BITS(&nr->dstport)));
+ EXTRACT_BE_U_2(&nr->dstport)));
ND_PRINT((ndo, ">> %s\n ", intoa(nr->nhop_ina.s_addr)));
buf[0]='\0';
ND_PRINT((ndo, "tos %u, %u (%u octets) %s",
nr->tos,
- EXTRACT_BE_32BITS(&nr->packets),
- EXTRACT_BE_32BITS(&nr->octets), buf));
+ EXTRACT_BE_U_4(&nr->packets),
+ EXTRACT_BE_U_4(&nr->octets), buf));
}
return;
nh = (const struct nfhdr_v5 *)cp;
ND_TCHECK(*nh);
- ver = EXTRACT_BE_16BITS(&nh->version);
- nrecs = EXTRACT_BE_32BITS(&nh->count);
+ ver = EXTRACT_BE_U_2(&nh->version);
+ nrecs = EXTRACT_BE_U_4(&nh->count);
#if 0
/*
* This is seconds since the UN*X epoch, and is followed by
* nanoseconds. XXX - format it, rather than just dumping the
* raw seconds-since-the-Epoch.
*/
- t = EXTRACT_32BITS(&nh->utc_sec);
+ t = EXTRACT_BE_U_4(&nh->utc_sec);
#endif
ND_PRINT((ndo, "NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver,
- EXTRACT_BE_32BITS(&nh->msys_uptime)/1000,
- EXTRACT_BE_32BITS(&nh->msys_uptime)%1000,
- EXTRACT_BE_32BITS(&nh->utc_sec), EXTRACT_BE_32BITS(&nh->utc_nsec)));
+ EXTRACT_BE_U_4(&nh->msys_uptime)/1000,
+ EXTRACT_BE_U_4(&nh->msys_uptime)%1000,
+ EXTRACT_BE_U_4(&nh->utc_sec), EXTRACT_BE_U_4(&nh->utc_nsec)));
- ND_PRINT((ndo, "#%u, ", EXTRACT_BE_32BITS(&nh->sequence)));
+ ND_PRINT((ndo, "#%u, ", EXTRACT_BE_U_4(&nh->sequence)));
nr = (const struct nfrec_v5 *)&nh[1];
ND_PRINT((ndo, "%2u recs", nrecs));
*/
ND_TCHECK(*nr);
ND_PRINT((ndo, "\n started %u.%03u, last %u.%03u",
- EXTRACT_BE_32BITS(&nr->start_time)/1000,
- EXTRACT_BE_32BITS(&nr->start_time)%1000,
- EXTRACT_BE_32BITS(&nr->last_time)/1000,
- EXTRACT_BE_32BITS(&nr->last_time)%1000));
+ EXTRACT_BE_U_4(&nr->start_time)/1000,
+ EXTRACT_BE_U_4(&nr->start_time)%1000,
+ EXTRACT_BE_U_4(&nr->last_time)/1000,
+ EXTRACT_BE_U_4(&nr->last_time)%1000));
asbuf[0] = buf[0] = '\0';
snprintf(buf, sizeof(buf), "/%u", nr->src_mask);
snprintf(asbuf, sizeof(asbuf), ":%u",
- EXTRACT_BE_16BITS(&nr->src_as));
+ EXTRACT_BE_U_2(&nr->src_as));
ND_PRINT((ndo, "\n %s%s%s:%u ", intoa(nr->src_ina.s_addr), buf, asbuf,
- EXTRACT_BE_16BITS(&nr->srcport)));
+ EXTRACT_BE_U_2(&nr->srcport)));
snprintf(buf, sizeof(buf), "/%d", nr->dst_mask);
snprintf(asbuf, sizeof(asbuf), ":%u",
- EXTRACT_BE_16BITS(&nr->dst_as));
+ EXTRACT_BE_U_2(&nr->dst_as));
ND_PRINT((ndo, "> %s%s%s:%u ", intoa(nr->dst_ina.s_addr), buf, asbuf,
- EXTRACT_BE_16BITS(&nr->dstport)));
+ EXTRACT_BE_U_2(&nr->dstport)));
ND_PRINT((ndo, ">> %s\n ", intoa(nr->nhop_ina.s_addr)));
buf[0]='\0';
ND_PRINT((ndo, "tos %u, %u (%u octets) %s",
nr->tos,
- EXTRACT_BE_32BITS(&nr->packets),
- EXTRACT_BE_32BITS(&nr->octets), buf));
+ EXTRACT_BE_U_4(&nr->packets),
+ EXTRACT_BE_U_4(&nr->octets), buf));
}
return;
nh = (const struct nfhdr_v6 *)cp;
ND_TCHECK(*nh);
- ver = EXTRACT_BE_16BITS(&nh->version);
- nrecs = EXTRACT_BE_32BITS(&nh->count);
+ ver = EXTRACT_BE_U_2(&nh->version);
+ nrecs = EXTRACT_BE_U_4(&nh->count);
#if 0
/*
* This is seconds since the UN*X epoch, and is followed by
* nanoseconds. XXX - format it, rather than just dumping the
* raw seconds-since-the-Epoch.
*/
- t = EXTRACT_32BITS(&nh->utc_sec);
+ t = EXTRACT_BE_U_4(&nh->utc_sec);
#endif
ND_PRINT((ndo, "NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver,
- EXTRACT_BE_32BITS(&nh->msys_uptime)/1000,
- EXTRACT_BE_32BITS(&nh->msys_uptime)%1000,
- EXTRACT_BE_32BITS(&nh->utc_sec), EXTRACT_BE_32BITS(&nh->utc_nsec)));
+ EXTRACT_BE_U_4(&nh->msys_uptime)/1000,
+ EXTRACT_BE_U_4(&nh->msys_uptime)%1000,
+ EXTRACT_BE_U_4(&nh->utc_sec), EXTRACT_BE_U_4(&nh->utc_nsec)));
- ND_PRINT((ndo, "#%u, ", EXTRACT_BE_32BITS(&nh->sequence)));
+ ND_PRINT((ndo, "#%u, ", EXTRACT_BE_U_4(&nh->sequence)));
nr = (const struct nfrec_v6 *)&nh[1];
ND_PRINT((ndo, "%2u recs", nrecs));
*/
ND_TCHECK(*nr);
ND_PRINT((ndo, "\n started %u.%03u, last %u.%03u",
- EXTRACT_BE_32BITS(&nr->start_time)/1000,
- EXTRACT_BE_32BITS(&nr->start_time)%1000,
- EXTRACT_BE_32BITS(&nr->last_time)/1000,
- EXTRACT_BE_32BITS(&nr->last_time)%1000));
+ EXTRACT_BE_U_4(&nr->start_time)/1000,
+ EXTRACT_BE_U_4(&nr->start_time)%1000,
+ EXTRACT_BE_U_4(&nr->last_time)/1000,
+ EXTRACT_BE_U_4(&nr->last_time)%1000));
asbuf[0] = buf[0] = '\0';
snprintf(buf, sizeof(buf), "/%u", nr->src_mask);
snprintf(asbuf, sizeof(asbuf), ":%u",
- EXTRACT_BE_16BITS(&nr->src_as));
+ EXTRACT_BE_U_2(&nr->src_as));
ND_PRINT((ndo, "\n %s%s%s:%u ", intoa(nr->src_ina.s_addr), buf, asbuf,
- EXTRACT_BE_16BITS(&nr->srcport)));
+ EXTRACT_BE_U_2(&nr->srcport)));
snprintf(buf, sizeof(buf), "/%d", nr->dst_mask);
snprintf(asbuf, sizeof(asbuf), ":%u",
- EXTRACT_BE_16BITS(&nr->dst_as));
+ EXTRACT_BE_U_2(&nr->dst_as));
ND_PRINT((ndo, "> %s%s%s:%u ", intoa(nr->dst_ina.s_addr), buf, asbuf,
- EXTRACT_BE_16BITS(&nr->dstport)));
+ EXTRACT_BE_U_2(&nr->dstport)));
ND_PRINT((ndo, ">> %s\n ", intoa(nr->nhop_ina.s_addr)));
buf[0]='\0';
snprintf(buf, sizeof(buf), "(%u<>%u encaps)",
- (EXTRACT_BE_16BITS(&nr->flags) >> 8) & 0xff,
- (EXTRACT_BE_16BITS(&nr->flags)) & 0xff);
+ (EXTRACT_BE_U_2(&nr->flags) >> 8) & 0xff,
+ (EXTRACT_BE_U_2(&nr->flags)) & 0xff);
ND_PRINT((ndo, "tos %u, %u (%u octets) %s",
nr->tos,
- EXTRACT_BE_32BITS(&nr->packets),
- EXTRACT_BE_32BITS(&nr->octets), buf));
+ EXTRACT_BE_U_4(&nr->packets),
+ EXTRACT_BE_U_4(&nr->octets), buf));
}
return;
* First 2 bytes are the version number.
*/
ND_TCHECK2(*cp, 2);
- ver = EXTRACT_BE_16BITS(cp);
+ ver = EXTRACT_BE_U_2(cp);
switch (ver) {
case 1:
if (DCCPH_X(dh) != 0) {
const struct dccp_hdr_ext *dhx = (const struct dccp_hdr_ext *)bp;
- seqno = EXTRACT_BE_48BITS(dhx->dccph_seq);
+ seqno = EXTRACT_BE_U_6(dhx->dccph_seq);
} else {
- seqno = EXTRACT_BE_24BITS(dh->dccph_seq);
+ seqno = EXTRACT_BE_U_3(dh->dccph_seq);
}
return seqno;
if (DCCPH_X(dh) != 0) {
ND_TCHECK2(*ackp, 8);
- ackno = EXTRACT_BE_48BITS(ackp + 2);
+ ackno = EXTRACT_BE_U_6(ackp + 2);
} else {
ND_TCHECK2(*ackp, 4);
- ackno = EXTRACT_BE_24BITS(ackp + 1);
+ ackno = EXTRACT_BE_U_3(ackp + 1);
}
ND_PRINT((ndo, "(ack=%" PRIu64 ") ", ackno));
}
ND_TCHECK2(*dh, fixed_hdrlen);
- sport = EXTRACT_BE_16BITS(&dh->dccph_sport);
- dport = EXTRACT_BE_16BITS(&dh->dccph_dport);
+ sport = EXTRACT_BE_U_2(&dh->dccph_sport);
+ dport = EXTRACT_BE_U_2(&dh->dccph_dport);
hlen = dh->dccph_doff * 4;
if (ip6) {
if (ndo->ndo_vflag && ND_TTEST2(bp[0], len)) {
uint16_t sum = 0, dccp_sum;
- dccp_sum = EXTRACT_BE_16BITS(&dh->dccph_checksum);
+ dccp_sum = EXTRACT_BE_U_2(&dh->dccph_checksum);
ND_PRINT((ndo, "cksum 0x%04x ", dccp_sum));
if (IP_V(ip) == 4)
sum = dccp_cksum(ndo, ip, dh, len);
ND_TCHECK(*dhr);
ND_PRINT((ndo, "%s (service=%d) ",
tok2str(dccp_pkt_type_str, "", dccph_type),
- EXTRACT_BE_32BITS(&dhr->dccph_req_service)));
+ EXTRACT_BE_U_4(&dhr->dccph_req_service)));
break;
}
case DCCP_PKT_RESPONSE: {
ND_TCHECK(*dhr);
ND_PRINT((ndo, "%s (service=%d) ",
tok2str(dccp_pkt_type_str, "", dccph_type),
- EXTRACT_BE_32BITS(&dhr->dccph_resp_service)));
+ EXTRACT_BE_U_4(&dhr->dccph_resp_service)));
break;
}
case DCCP_PKT_DATA:
if (*option >= 32) {
ND_TCHECK(*(option+1));
- optlen = EXTRACT_8BITS(option + 1);
+ optlen = EXTRACT_U_1(option + 1);
if (optlen < 2) {
if (*option >= 128)
ND_PRINT((ndo, "CCID option %u optlen too short", *option));
else
ND_PRINT((ndo, "%s optlen too short",
- tok2str(dccp_option_values, "Option %u", EXTRACT_8BITS(option))));
+ tok2str(dccp_option_values, "Option %u", EXTRACT_U_1(option))));
return 0;
}
} else
*option));
else
ND_PRINT((ndo, "%s optlen goes past header length",
- tok2str(dccp_option_values, "Option %u", EXTRACT_8BITS(option))));
+ tok2str(dccp_option_values, "Option %u", EXTRACT_U_1(option))));
return 0;
}
ND_TCHECK2(*option, optlen);
ND_PRINT((ndo, "CCID option %d", *option));
switch (optlen) {
case 4:
- ND_PRINT((ndo, " %u", EXTRACT_BE_16BITS(option + 2)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_2(option + 2)));
break;
case 6:
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(option + 2)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(option + 2)));
break;
default:
break;
}
} else {
- ND_PRINT((ndo, "%s", tok2str(dccp_option_values, "Option %u", EXTRACT_8BITS(option))));
+ ND_PRINT((ndo, "%s", tok2str(dccp_option_values, "Option %u", EXTRACT_U_1(option))));
switch (*option) {
case 32:
case 33:
break;
case 41:
if (optlen == 4)
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(option + 2)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(option + 2)));
else
ND_PRINT((ndo, " optlen != 4"));
break;
case 42:
if (optlen == 4)
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(option + 2)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(option + 2)));
else
ND_PRINT((ndo, " optlen != 4"));
break;
case 43:
if (optlen == 6)
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(option + 2)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(option + 2)));
else if (optlen == 4)
- ND_PRINT((ndo, " %u", EXTRACT_BE_16BITS(option + 2)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_2(option + 2)));
else
ND_PRINT((ndo, " optlen != 4 or 6"));
break;
}
ND_TCHECK2(*ap, sizeof(short));
- pktlen = EXTRACT_LE_16BITS(ap);
+ pktlen = EXTRACT_LE_U_2(ap);
if (pktlen < sizeof(struct shorthdr)) {
ND_PRINT((ndo, "%s", tstr));
return;
rhp = (const union routehdr *)&(ap[sizeof(short)]);
ND_TCHECK(rhp->rh_short.sh_flags);
- mflags = EXTRACT_8BITS(rhp->rh_short.sh_flags);
+ mflags = EXTRACT_U_1(rhp->rh_short.sh_flags);
if (mflags & RMF_PAD) {
/* pad bytes of some sort in front of message */
caplen -= padlen;
rhp = (const union routehdr *)&(ap[sizeof(short)]);
ND_TCHECK(rhp->rh_short.sh_flags);
- mflags = EXTRACT_8BITS(rhp->rh_short.sh_flags);
+ mflags = EXTRACT_U_1(rhp->rh_short.sh_flags);
}
if (mflags & RMF_FVER) {
}
ND_TCHECK(rhp->rh_long);
dst =
- EXTRACT_LE_16BITS(rhp->rh_long.lg_dst.dne_remote.dne_nodeaddr);
+ EXTRACT_LE_U_2(rhp->rh_long.lg_dst.dne_remote.dne_nodeaddr);
src =
- EXTRACT_LE_16BITS(rhp->rh_long.lg_src.dne_remote.dne_nodeaddr);
- hops = EXTRACT_8BITS(rhp->rh_long.lg_visits);
+ EXTRACT_LE_U_2(rhp->rh_long.lg_src.dne_remote.dne_nodeaddr);
+ hops = EXTRACT_U_1(rhp->rh_long.lg_visits);
nspp = &(ap[sizeof(short) + sizeof(struct longhdr)]);
nsplen = length - sizeof(struct longhdr);
break;
case RMF_SHORT:
ND_TCHECK(rhp->rh_short);
- dst = EXTRACT_LE_16BITS(rhp->rh_short.sh_dst);
- src = EXTRACT_LE_16BITS(rhp->rh_short.sh_src);
- hops = (EXTRACT_8BITS(rhp->rh_short.sh_visits) & VIS_MASK)+1;
+ dst = EXTRACT_LE_U_2(rhp->rh_short.sh_dst);
+ src = EXTRACT_LE_U_2(rhp->rh_short.sh_src);
+ hops = (EXTRACT_U_1(rhp->rh_short.sh_visits) & VIS_MASK)+1;
nspp = &(ap[sizeof(short) + sizeof(struct shorthdr)]);
nsplen = length - sizeof(struct shorthdr);
break;
u_int caplen)
{
/* Our caller has already checked for mflags */
- int mflags = EXTRACT_8BITS(rhp->rh_short.sh_flags);
+ int mflags = EXTRACT_U_1(rhp->rh_short.sh_flags);
register const union controlmsg *cmp = (const union controlmsg *)rhp;
int src, dst, info, blksize, eco, ueco, hello, other, vers;
etheraddr srcea, rtea;
if (length < sizeof(struct initmsg))
goto trunc;
ND_TCHECK(cmp->cm_init);
- src = EXTRACT_LE_16BITS(cmp->cm_init.in_src);
- info = EXTRACT_8BITS(cmp->cm_init.in_info);
- blksize = EXTRACT_LE_16BITS(cmp->cm_init.in_blksize);
- vers = EXTRACT_8BITS(cmp->cm_init.in_vers);
- eco = EXTRACT_8BITS(cmp->cm_init.in_eco);
- ueco = EXTRACT_8BITS(cmp->cm_init.in_ueco);
- hello = EXTRACT_LE_16BITS(cmp->cm_init.in_hello);
+ src = EXTRACT_LE_U_2(cmp->cm_init.in_src);
+ info = EXTRACT_U_1(cmp->cm_init.in_info);
+ blksize = EXTRACT_LE_U_2(cmp->cm_init.in_blksize);
+ vers = EXTRACT_U_1(cmp->cm_init.in_vers);
+ eco = EXTRACT_U_1(cmp->cm_init.in_eco);
+ ueco = EXTRACT_U_1(cmp->cm_init.in_ueco);
+ hello = EXTRACT_LE_U_2(cmp->cm_init.in_hello);
print_t_info(ndo, info);
ND_PRINT((ndo,
"src %sblksize %d vers %d eco %d ueco %d hello %d",
if (length < sizeof(struct verifmsg))
goto trunc;
ND_TCHECK(cmp->cm_ver);
- src = EXTRACT_LE_16BITS(cmp->cm_ver.ve_src);
- other = EXTRACT_8BITS(cmp->cm_ver.ve_fcnval);
+ src = EXTRACT_LE_U_2(cmp->cm_ver.ve_src);
+ other = EXTRACT_U_1(cmp->cm_ver.ve_fcnval);
ND_PRINT((ndo, "src %s fcnval %o", dnaddr_string(ndo, src), other));
ret = 1;
break;
if (length < sizeof(struct testmsg))
goto trunc;
ND_TCHECK(cmp->cm_test);
- src = EXTRACT_LE_16BITS(cmp->cm_test.te_src);
- other = EXTRACT_8BITS(cmp->cm_test.te_data);
+ src = EXTRACT_LE_U_2(cmp->cm_test.te_src);
+ other = EXTRACT_U_1(cmp->cm_test.te_data);
ND_PRINT((ndo, "src %s data %o", dnaddr_string(ndo, src), other));
ret = 1;
break;
if (length < sizeof(struct l1rout))
goto trunc;
ND_TCHECK(cmp->cm_l1rou);
- src = EXTRACT_LE_16BITS(cmp->cm_l1rou.r1_src);
+ src = EXTRACT_LE_U_2(cmp->cm_l1rou.r1_src);
ND_PRINT((ndo, "src %s ", dnaddr_string(ndo, src)));
ret = print_l1_routes(ndo, &(rhpx[sizeof(struct l1rout)]),
length - sizeof(struct l1rout));
if (length < sizeof(struct l2rout))
goto trunc;
ND_TCHECK(cmp->cm_l2rout);
- src = EXTRACT_LE_16BITS(cmp->cm_l2rout.r2_src);
+ src = EXTRACT_LE_U_2(cmp->cm_l2rout.r2_src);
ND_PRINT((ndo, "src %s ", dnaddr_string(ndo, src)));
ret = print_l2_routes(ndo, &(rhpx[sizeof(struct l2rout)]),
length - sizeof(struct l2rout));
if (length < sizeof(struct rhellomsg))
goto trunc;
ND_TCHECK(cmp->cm_rhello);
- vers = EXTRACT_8BITS(cmp->cm_rhello.rh_vers);
- eco = EXTRACT_8BITS(cmp->cm_rhello.rh_eco);
- ueco = EXTRACT_8BITS(cmp->cm_rhello.rh_ueco);
+ vers = EXTRACT_U_1(cmp->cm_rhello.rh_vers);
+ eco = EXTRACT_U_1(cmp->cm_rhello.rh_eco);
+ ueco = EXTRACT_U_1(cmp->cm_rhello.rh_ueco);
memcpy((char *)&srcea, (const char *)&(cmp->cm_rhello.rh_src),
sizeof(srcea));
- src = EXTRACT_LE_16BITS(srcea.dne_remote.dne_nodeaddr);
- info = EXTRACT_8BITS(cmp->cm_rhello.rh_info);
- blksize = EXTRACT_LE_16BITS(cmp->cm_rhello.rh_blksize);
- priority = EXTRACT_8BITS(cmp->cm_rhello.rh_priority);
- hello = EXTRACT_LE_16BITS(cmp->cm_rhello.rh_hello);
+ src = EXTRACT_LE_U_2(srcea.dne_remote.dne_nodeaddr);
+ info = EXTRACT_U_1(cmp->cm_rhello.rh_info);
+ blksize = EXTRACT_LE_U_2(cmp->cm_rhello.rh_blksize);
+ priority = EXTRACT_U_1(cmp->cm_rhello.rh_priority);
+ hello = EXTRACT_LE_U_2(cmp->cm_rhello.rh_hello);
print_i_info(ndo, info);
ND_PRINT((ndo,
"vers %d eco %d ueco %d src %s blksize %d pri %d hello %d",
if (length < sizeof(struct ehellomsg))
goto trunc;
ND_TCHECK(cmp->cm_ehello);
- vers = EXTRACT_8BITS(cmp->cm_ehello.eh_vers);
- eco = EXTRACT_8BITS(cmp->cm_ehello.eh_eco);
- ueco = EXTRACT_8BITS(cmp->cm_ehello.eh_ueco);
+ vers = EXTRACT_U_1(cmp->cm_ehello.eh_vers);
+ eco = EXTRACT_U_1(cmp->cm_ehello.eh_eco);
+ ueco = EXTRACT_U_1(cmp->cm_ehello.eh_ueco);
memcpy((char *)&srcea, (const char *)&(cmp->cm_ehello.eh_src),
sizeof(srcea));
- src = EXTRACT_LE_16BITS(srcea.dne_remote.dne_nodeaddr);
- info = EXTRACT_8BITS(cmp->cm_ehello.eh_info);
- blksize = EXTRACT_LE_16BITS(cmp->cm_ehello.eh_blksize);
+ src = EXTRACT_LE_U_2(srcea.dne_remote.dne_nodeaddr);
+ info = EXTRACT_U_1(cmp->cm_ehello.eh_info);
+ blksize = EXTRACT_LE_U_2(cmp->cm_ehello.eh_blksize);
/*seed*/
memcpy((char *)&rtea, (const char *)&(cmp->cm_ehello.eh_router),
sizeof(rtea));
- dst = EXTRACT_LE_16BITS(rtea.dne_remote.dne_nodeaddr);
- hello = EXTRACT_LE_16BITS(cmp->cm_ehello.eh_hello);
- other = EXTRACT_8BITS(cmp->cm_ehello.eh_data);
+ dst = EXTRACT_LE_U_2(rtea.dne_remote.dne_nodeaddr);
+ hello = EXTRACT_LE_U_2(cmp->cm_ehello.eh_hello);
+ other = EXTRACT_U_1(cmp->cm_ehello.eh_data);
print_i_info(ndo, info);
ND_PRINT((ndo,
"vers %d eco %d ueco %d src %s blksize %d rtr %s hello %d data %o",
/* The last short is a checksum */
while (len > (3 * sizeof(short))) {
ND_TCHECK2(*rp, 3 * sizeof(short));
- count = EXTRACT_LE_16BITS(rp);
+ count = EXTRACT_LE_U_2(rp);
if (count > 1024)
return (1); /* seems to be bogus from here on */
rp += sizeof(short);
len -= sizeof(short);
- id = EXTRACT_LE_16BITS(rp);
+ id = EXTRACT_LE_U_2(rp);
rp += sizeof(short);
len -= sizeof(short);
- info = EXTRACT_LE_16BITS(rp);
+ info = EXTRACT_LE_U_2(rp);
rp += sizeof(short);
len -= sizeof(short);
ND_PRINT((ndo, "{ids %d-%d cost %d hops %d} ", id, id + count,
/* The last short is a checksum */
while (len > (3 * sizeof(short))) {
ND_TCHECK2(*rp, 3 * sizeof(short));
- count = EXTRACT_LE_16BITS(rp);
+ count = EXTRACT_LE_U_2(rp);
if (count > 1024)
return (1); /* seems to be bogus from here on */
rp += sizeof(short);
len -= sizeof(short);
- area = EXTRACT_LE_16BITS(rp);
+ area = EXTRACT_LE_U_2(rp);
rp += sizeof(short);
len -= sizeof(short);
- info = EXTRACT_LE_16BITS(rp);
+ info = EXTRACT_LE_U_2(rp);
rp += sizeof(short);
len -= sizeof(short);
ND_PRINT((ndo, "{areas %d-%d cost %d hops %d} ", area, area + count,
if (nsplen < sizeof(struct nsphdr))
goto trunc;
ND_TCHECK(*nsphp);
- flags = EXTRACT_8BITS(nsphp->nh_flags);
- dst = EXTRACT_LE_16BITS(nsphp->nh_dst);
- src = EXTRACT_LE_16BITS(nsphp->nh_src);
+ flags = EXTRACT_U_1(nsphp->nh_flags);
+ dst = EXTRACT_LE_U_2(nsphp->nh_dst);
+ src = EXTRACT_LE_U_2(nsphp->nh_src);
switch (flags & NSP_TYPEMASK) {
case MFT_DATA:
if (nsplen < data_off)
goto trunc;
ND_TCHECK(shp->sh_seq[0]);
- ack = EXTRACT_LE_16BITS(shp->sh_seq[0]);
+ ack = EXTRACT_LE_U_2(shp->sh_seq[0]);
if (ack & SGQ_ACK) { /* acknum field */
if ((ack & SGQ_NAK) == SGQ_NAK)
ND_PRINT((ndo, "nak %d ", ack & SGQ_MASK));
if (nsplen < data_off)
goto trunc;
ND_TCHECK(shp->sh_seq[1]);
- ack = EXTRACT_LE_16BITS(shp->sh_seq[1]);
+ ack = EXTRACT_LE_U_2(shp->sh_seq[1]);
if (ack & SGQ_OACK) { /* ackoth field */
if ((ack & SGQ_ONAK) == SGQ_ONAK)
ND_PRINT((ndo, "onak %d ", ack & SGQ_MASK));
if (nsplen < data_off)
goto trunc;
ND_TCHECK(shp->sh_seq[2]);
- ack = EXTRACT_LE_16BITS(shp->sh_seq[2]);
+ ack = EXTRACT_LE_U_2(shp->sh_seq[2]);
}
}
ND_PRINT((ndo, "seg %d ", ack & SGQ_MASK));
if (nsplen < data_off)
goto trunc;
ND_TCHECK(shp->sh_seq[0]);
- ack = EXTRACT_LE_16BITS(shp->sh_seq[0]);
+ ack = EXTRACT_LE_U_2(shp->sh_seq[0]);
if (ack & SGQ_ACK) { /* acknum field */
if ((ack & SGQ_NAK) == SGQ_NAK)
ND_PRINT((ndo, "nak %d ", ack & SGQ_MASK));
if (nsplen < data_off)
goto trunc;
ND_TCHECK(shp->sh_seq[1]);
- ack = EXTRACT_LE_16BITS(shp->sh_seq[1]);
+ ack = EXTRACT_LE_U_2(shp->sh_seq[1]);
if (ack & SGQ_OACK) { /* ackdat field */
if ((ack & SGQ_ONAK) == SGQ_ONAK)
ND_PRINT((ndo, "nakdat %d ", ack & SGQ_MASK));
if (nsplen < data_off)
goto trunc;
ND_TCHECK(shp->sh_seq[2]);
- ack = EXTRACT_LE_16BITS(shp->sh_seq[2]);
+ ack = EXTRACT_LE_U_2(shp->sh_seq[2]);
}
}
ND_PRINT((ndo, "seg %d ", ack & SGQ_MASK));
if (nsplen < sizeof(struct seghdr) + sizeof(struct lsmsg))
goto trunc;
ND_TCHECK(shp->sh_seq[0]);
- ack = EXTRACT_LE_16BITS(shp->sh_seq[0]);
+ ack = EXTRACT_LE_U_2(shp->sh_seq[0]);
if (ack & SGQ_ACK) { /* acknum field */
if ((ack & SGQ_NAK) == SGQ_NAK)
ND_PRINT((ndo, "nak %d ", ack & SGQ_MASK));
else
ND_PRINT((ndo, "ack %d ", ack & SGQ_MASK));
ND_TCHECK(shp->sh_seq[1]);
- ack = EXTRACT_LE_16BITS(shp->sh_seq[1]);
+ ack = EXTRACT_LE_U_2(shp->sh_seq[1]);
if (ack & SGQ_OACK) { /* ackdat field */
if ((ack & SGQ_ONAK) == SGQ_ONAK)
ND_PRINT((ndo, "nakdat %d ", ack & SGQ_MASK));
else
ND_PRINT((ndo, "ackdat %d ", ack & SGQ_MASK));
ND_TCHECK(shp->sh_seq[2]);
- ack = EXTRACT_LE_16BITS(shp->sh_seq[2]);
+ ack = EXTRACT_LE_U_2(shp->sh_seq[2]);
}
}
ND_PRINT((ndo, "seg %d ", ack & SGQ_MASK));
ND_TCHECK(*lsmp);
- lsflags = EXTRACT_8BITS(lsmp->ls_lsflags);
- fcval = EXTRACT_8BITS(lsmp->ls_fcval);
+ lsflags = EXTRACT_U_1(lsmp->ls_lsflags);
+ fcval = EXTRACT_U_1(lsmp->ls_fcval);
switch (lsflags & LSI_MASK) {
case LSI_DATA:
ND_PRINT((ndo, "dat seg count %d ", fcval));
if (nsplen < sizeof(struct ackmsg))
goto trunc;
ND_TCHECK(*amp);
- ack = EXTRACT_LE_16BITS(amp->ak_acknum[0]);
+ ack = EXTRACT_LE_U_2(amp->ak_acknum[0]);
if (ack & SGQ_ACK) { /* acknum field */
if ((ack & SGQ_NAK) == SGQ_NAK)
ND_PRINT((ndo, "nak %d ", ack & SGQ_MASK));
else
ND_PRINT((ndo, "ack %d ", ack & SGQ_MASK));
- ack = EXTRACT_LE_16BITS(amp->ak_acknum[1]);
+ ack = EXTRACT_LE_U_2(amp->ak_acknum[1]);
if (ack & SGQ_OACK) { /* ackoth field */
if ((ack & SGQ_ONAK) == SGQ_ONAK)
ND_PRINT((ndo, "onak %d ", ack & SGQ_MASK));
if (nsplen < sizeof(struct ackmsg))
goto trunc;
ND_TCHECK(*amp);
- ack = EXTRACT_LE_16BITS(amp->ak_acknum[0]);
+ ack = EXTRACT_LE_U_2(amp->ak_acknum[0]);
if (ack & SGQ_ACK) { /* acknum field */
if ((ack & SGQ_NAK) == SGQ_NAK)
ND_PRINT((ndo, "nak %d ", ack & SGQ_MASK));
else
ND_PRINT((ndo, "ack %d ", ack & SGQ_MASK));
ND_TCHECK(amp->ak_acknum[1]);
- ack = EXTRACT_LE_16BITS(amp->ak_acknum[1]);
+ ack = EXTRACT_LE_U_2(amp->ak_acknum[1]);
if (ack & SGQ_OACK) { /* ackdat field */
if ((ack & SGQ_ONAK) == SGQ_ONAK)
ND_PRINT((ndo, "nakdat %d ", ack & SGQ_MASK));
if (nsplen < sizeof(struct cimsg))
goto trunc;
ND_TCHECK(*cimp);
- services = EXTRACT_8BITS(cimp->ci_services);
- info = EXTRACT_8BITS(cimp->ci_info);
- segsize = EXTRACT_LE_16BITS(cimp->ci_segsize);
+ services = EXTRACT_U_1(cimp->ci_services);
+ info = EXTRACT_U_1(cimp->ci_info);
+ segsize = EXTRACT_LE_U_2(cimp->ci_segsize);
switch (services & COS_MASK) {
case COS_NONE:
if (nsplen < sizeof(struct ccmsg))
goto trunc;
ND_TCHECK(*ccmp);
- services = EXTRACT_8BITS(ccmp->cc_services);
- info = EXTRACT_8BITS(ccmp->cc_info);
- segsize = EXTRACT_LE_16BITS(ccmp->cc_segsize);
- optlen = EXTRACT_8BITS(ccmp->cc_optlen);
+ services = EXTRACT_U_1(ccmp->cc_services);
+ info = EXTRACT_U_1(ccmp->cc_info);
+ segsize = EXTRACT_LE_U_2(ccmp->cc_segsize);
+ optlen = EXTRACT_U_1(ccmp->cc_optlen);
switch (services & COS_MASK) {
case COS_NONE:
if (nsplen < sizeof(struct dimsg))
goto trunc;
ND_TCHECK(*dimp);
- reason = EXTRACT_LE_16BITS(dimp->di_reason);
- optlen = EXTRACT_8BITS(dimp->di_optlen);
+ reason = EXTRACT_LE_U_2(dimp->di_reason);
+ optlen = EXTRACT_U_1(dimp->di_optlen);
print_reason(ndo, reason);
if (optlen) {
int reason;
ND_TCHECK(*dcmp);
- reason = EXTRACT_LE_16BITS(dcmp->dc_reason);
+ reason = EXTRACT_LE_U_2(dcmp->dc_reason);
print_reason(ndo, reason);
}
goto trunc;
dh6o = (const struct dhcp6opt *)cp;
ND_TCHECK(*dh6o);
- optlen = EXTRACT_BE_16BITS(&dh6o->dh6opt_len);
+ optlen = EXTRACT_BE_U_2(&dh6o->dh6opt_len);
if (ep < cp + sizeof(*dh6o) + optlen)
goto trunc;
- opttype = EXTRACT_BE_16BITS(&dh6o->dh6opt_type);
+ opttype = EXTRACT_BE_U_2(&dh6o->dh6opt_type);
ND_PRINT((ndo, " (%s", tok2str(dh6opt_str, "opt_%u", opttype)));
ND_TCHECK2(*(cp + sizeof(*dh6o)), optlen);
switch (opttype) {
break;
}
tp = (const u_char *)(dh6o + 1);
- switch (EXTRACT_BE_16BITS(tp)) {
+ switch (EXTRACT_BE_U_2(tp)) {
case 1:
if (optlen >= 2 + 6) {
ND_PRINT((ndo, " hwaddr/time type %u time %u ",
- EXTRACT_BE_16BITS(tp + 2),
- EXTRACT_BE_32BITS(tp + 4)));
+ EXTRACT_BE_U_2(tp + 2),
+ EXTRACT_BE_U_4(tp + 4)));
for (i = 8; i < optlen; i++)
ND_PRINT((ndo, "%02x", tp[i]));
/*(*/
case 3:
if (optlen >= 2 + 2) {
ND_PRINT((ndo, " hwaddr type %u ",
- EXTRACT_BE_16BITS(tp + 2)));
+ EXTRACT_BE_U_2(tp + 2)));
for (i = 4; i < optlen; i++)
ND_PRINT((ndo, "%02x", tp[i]));
/*(*/
}
break;
default:
- ND_PRINT((ndo, " type %d)", EXTRACT_BE_16BITS(tp)));
+ ND_PRINT((ndo, " type %d)", EXTRACT_BE_U_2(tp)));
break;
}
break;
tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " %s", ip6addr_string(ndo, &tp[0])));
ND_PRINT((ndo, " pltime:%u vltime:%u",
- EXTRACT_BE_32BITS(tp + 16),
- EXTRACT_BE_32BITS(tp + 20)));
+ EXTRACT_BE_U_4(tp + 16),
+ EXTRACT_BE_U_4(tp + 20)));
if (optlen > 24) {
/* there are sub-options */
dhcp6opt_print(ndo, tp + 24, tp + optlen);
tp = (const u_char *)(dh6o + 1);
for (i = 0; i < optlen; i += 2) {
ND_PRINT((ndo, " %s",
- tok2str(dh6opt_str, "opt_%u", EXTRACT_BE_16BITS(tp + i))));
+ tok2str(dh6opt_str, "opt_%u", EXTRACT_BE_U_2(tp + i))));
}
ND_PRINT((ndo, ")"));
break;
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT((ndo, " %d)", EXTRACT_8BITS(tp)));
+ ND_PRINT((ndo, " %d)", EXTRACT_U_1(tp)));
break;
case DH6OPT_ELAPSED_TIME:
if (optlen != 2) {
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT((ndo, " %d)", EXTRACT_BE_16BITS(tp)));
+ ND_PRINT((ndo, " %d)", EXTRACT_BE_U_2(tp)));
break;
case DH6OPT_RELAY_MSG:
ND_PRINT((ndo, " ("));
break;
}
tp = (const u_char *)(dh6o + 1);
- auth_proto = EXTRACT_8BITS(tp);
+ auth_proto = EXTRACT_U_1(tp);
switch (auth_proto) {
case DH6OPT_AUTHPROTO_DELAYED:
ND_PRINT((ndo, " proto: delayed"));
break;
}
tp++;
- auth_alg = EXTRACT_8BITS(tp);
+ auth_alg = EXTRACT_U_1(tp);
switch (auth_alg) {
case DH6OPT_AUTHALG_HMACMD5:
/* XXX: may depend on the protocol */
break;
}
tp++;
- auth_rdm = EXTRACT_8BITS(tp);
+ auth_rdm = EXTRACT_U_1(tp);
switch (auth_rdm) {
case DH6OPT_AUTHRDM_MONOCOUNTER:
ND_PRINT((ndo, ", RDM: mono"));
tp++;
ND_PRINT((ndo, ", RD:"));
for (i = 0; i < 4; i++, tp += 2)
- ND_PRINT((ndo, " %04x", EXTRACT_BE_16BITS(tp)));
+ ND_PRINT((ndo, " %04x", EXTRACT_BE_U_2(tp)));
/* protocol dependent part */
authinfolen = optlen - 11;
ND_PRINT((ndo, ", realm: "));
}
for (i = 0; i < authrealmlen; i++, tp++)
- ND_PRINT((ndo, "%02x", EXTRACT_8BITS(tp)));
- ND_PRINT((ndo, ", key ID: %08x", EXTRACT_BE_32BITS(tp)));
+ ND_PRINT((ndo, "%02x", EXTRACT_U_1(tp)));
+ ND_PRINT((ndo, ", key ID: %08x", EXTRACT_BE_U_4(tp)));
tp += 4;
ND_PRINT((ndo, ", HMAC-MD5:"));
for (i = 0; i < 4; i++, tp+= 4)
- ND_PRINT((ndo, " %08x", EXTRACT_BE_32BITS(tp)));
+ ND_PRINT((ndo, " %08x", EXTRACT_BE_U_4(tp)));
break;
case DH6OPT_AUTHPROTO_RECONFIG:
if (authinfolen != 17) {
ND_PRINT((ndo, " ??"));
break;
}
- switch (EXTRACT_8BITS(tp)) {
+ switch (EXTRACT_U_1(tp)) {
case DH6OPT_AUTHRECONFIG_KEY:
ND_PRINT((ndo, " reconfig-key"));
break;
tp++;
ND_PRINT((ndo, " value:"));
for (i = 0; i < 4; i++, tp+= 4)
- ND_PRINT((ndo, " %08x", EXTRACT_BE_32BITS(tp)));
+ ND_PRINT((ndo, " %08x", EXTRACT_BE_U_4(tp)));
break;
default:
ND_PRINT((ndo, " ??"));
break;
}
tp = (const u_char *)(dh6o + 1);
- dh6_reconf_type = EXTRACT_8BITS(tp);
+ dh6_reconf_type = EXTRACT_U_1(tp);
switch (dh6_reconf_type) {
case DH6_RENEW:
ND_PRINT((ndo, " for renew)"));
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT((ndo, " %s)", dhcp6stcode(EXTRACT_BE_16BITS(tp))));
+ ND_PRINT((ndo, " %s)", dhcp6stcode(EXTRACT_BE_U_2(tp))));
break;
case DH6OPT_IA_NA:
case DH6OPT_IA_PD:
}
tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " IAID:%u T1:%u T2:%u",
- EXTRACT_BE_32BITS(tp),
- EXTRACT_BE_32BITS(tp + 4),
- EXTRACT_BE_32BITS(tp + 8)));
+ EXTRACT_BE_U_4(tp),
+ EXTRACT_BE_U_4(tp + 4),
+ EXTRACT_BE_U_4(tp + 8)));
if (optlen > 12) {
/* there are sub-options */
dhcp6opt_print(ndo, tp + 12, tp + optlen);
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT((ndo, " IAID:%u", EXTRACT_BE_32BITS(tp)));
+ ND_PRINT((ndo, " IAID:%u", EXTRACT_BE_U_4(tp)));
if (optlen > 4) {
/* there are sub-options */
dhcp6opt_print(ndo, tp + 4, tp + optlen);
tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " %s/%d", ip6addr_string(ndo, &tp[9]), tp[8]));
ND_PRINT((ndo, " pltime:%u vltime:%u",
- EXTRACT_BE_32BITS(tp),
- EXTRACT_BE_32BITS(tp + 4)));
+ EXTRACT_BE_U_4(tp),
+ EXTRACT_BE_U_4(tp + 4)));
if (optlen > 25) {
/* there are sub-options */
dhcp6opt_print(ndo, tp + 25, tp + optlen);
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT((ndo, " %d)", EXTRACT_BE_32BITS(tp)));
+ ND_PRINT((ndo, " %d)", EXTRACT_BE_U_4(tp)));
break;
case DH6OPT_REMOTE_ID:
if (optlen < 4) {
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT((ndo, " %d ", EXTRACT_BE_32BITS(tp)));
+ ND_PRINT((ndo, " %d ", EXTRACT_BE_U_4(tp)));
/*
* Print hex dump first 10 characters.
*/
break;
}
tp = (const u_char *)(dh6o + 1);
- dh6_lq_query_type = EXTRACT_8BITS(tp);
+ dh6_lq_query_type = EXTRACT_U_1(tp);
switch (dh6_lq_query_type) {
case 1:
ND_PRINT((ndo, " by-address"));
}
tp = (const u_char *)(dh6o + 1);
while (tp < cp + sizeof(*dh6o) + optlen - 4) {
- subopt_code = EXTRACT_BE_16BITS(tp);
+ subopt_code = EXTRACT_BE_U_2(tp);
tp += 2;
- subopt_len = EXTRACT_BE_16BITS(tp);
+ subopt_len = EXTRACT_BE_U_2(tp);
tp += 2;
if (tp + subopt_len > cp + sizeof(*dh6o) + optlen)
goto trunc;
remain_len = optlen;
ND_PRINT((ndo, " "));
/* Encoding is described in section 3.1 of RFC 1035 */
- while (remain_len && EXTRACT_8BITS(tp)) {
- label_len = EXTRACT_8BITS(tp);
+ while (remain_len && EXTRACT_U_1(tp)) {
+ label_len = EXTRACT_U_1(tp);
tp++;
if (label_len < remain_len - 1) {
(void)fn_printn(ndo, tp, label_len, NULL);
tp += label_len;
remain_len -= (label_len + 1);
- if(EXTRACT_8BITS(tp)) ND_PRINT((ndo, "."));
+ if(EXTRACT_U_1(tp)) ND_PRINT((ndo, "."));
} else {
ND_PRINT((ndo, " ?"));
break;
ND_PRINT((ndo, " %s (", name)); /*)*/
if (dh6->dh6_msgtype != DH6_RELAY_FORW &&
dh6->dh6_msgtype != DH6_RELAY_REPLY) {
- ND_PRINT((ndo, "xid=%x", EXTRACT_BE_32BITS(&dh6->dh6_xid) & DH6_XIDMASK));
+ ND_PRINT((ndo, "xid=%x", EXTRACT_BE_U_4(&dh6->dh6_xid) & DH6_XIDMASK));
extp = (const u_char *)(dh6 + 1);
dhcp6opt_print(ndo, extp, ep);
} else { /* relay messages */
if (!ND_TTEST_1(cp))
return (NULL);
- i = EXTRACT_8BITS(cp);
+ i = EXTRACT_U_1(cp);
cp++;
while (i) {
if ((i & INDIR_MASK) == INDIR_MASK)
return(NULL); /* unknown ELT */
if (!ND_TTEST_1(cp))
return (NULL);
- if ((bitlen = EXTRACT_8BITS(cp)) == 0)
+ if ((bitlen = EXTRACT_U_1(cp)) == 0)
bitlen = 256;
cp++;
bytelen = (bitlen + 7) / 8;
cp += i;
if (!ND_TTEST_1(cp))
return (NULL);
- i = EXTRACT_8BITS(cp);
+ i = EXTRACT_U_1(cp);
cp++;
}
return (cp);
if (!ND_TTEST_1(cp))
return(NULL);
- if ((bitlen = EXTRACT_8BITS(cp)) == 0)
+ if ((bitlen = EXTRACT_U_1(cp)) == 0)
bitlen = 256;
slen = (bitlen + 3) / 4;
lim = cp + 1 + slen;
}
if (b > 4) {
ND_TCHECK(*bitp);
- tc = EXTRACT_8BITS(bitp);
+ tc = EXTRACT_U_1(bitp);
bitp++;
ND_PRINT((ndo, "%02x", tc & (0xff << (8 - b))));
} else if (b > 0) {
ND_TCHECK(*bitp);
- tc = EXTRACT_8BITS(bitp);
+ tc = EXTRACT_U_1(bitp);
bitp++;
ND_PRINT((ndo, "%1x", ((tc >> 4) & 0x0f) & (0x0f << (4 - b))));
}
if (!ND_TTEST_1(cp))
return(-1);
- i = EXTRACT_8BITS(cp);
+ i = EXTRACT_U_1(cp);
if ((i & INDIR_MASK) == EDNS0_MASK) {
int bitlen, elt;
if ((elt = (i & ~INDIR_MASK)) != EDNS0_ELT_BITLABEL) {
}
if (!ND_TTEST_1(cp + 1))
return(-1);
- if ((bitlen = EXTRACT_8BITS(cp + 1)) == 0)
+ if ((bitlen = EXTRACT_U_1(cp + 1)) == 0)
bitlen = 256;
return(((bitlen + 7) / 8) + 1);
} else
if (!ND_TTEST_1(cp))
return(NULL);
max_offset = (u_int)(cp - bp);
- i = EXTRACT_8BITS(cp);
+ i = EXTRACT_U_1(cp);
cp++;
if ((i & INDIR_MASK) != INDIR_MASK) {
compress = 0;
}
if (!ND_TTEST_1(cp))
return(NULL);
- offset = (((i << 8) | EXTRACT_8BITS(cp)) & 0x3fff);
+ offset = (((i << 8) | EXTRACT_U_1(cp)) & 0x3fff);
/*
* This must move backwards in the packet.
* No RFC explicitly says that, but BIND's
return(NULL);
if (!ND_TTEST_1(cp))
return(NULL);
- i = EXTRACT_8BITS(cp);
+ i = EXTRACT_U_1(cp);
cp++;
continue;
}
return(NULL);
if (!ND_TTEST_1(cp))
return(NULL);
- i = EXTRACT_8BITS(cp);
+ i = EXTRACT_U_1(cp);
cp++;
if (!compress)
rp += l + 1;
if (!ND_TTEST_1(cp))
return (NULL);
- i = EXTRACT_8BITS(cp);
+ i = EXTRACT_U_1(cp);
cp++;
if (fn_printn(ndo, cp, i, ndo->ndo_snapend))
return (NULL);
return(NULL);
/* print the qtype */
- i = EXTRACT_BE_16BITS(cp);
+ i = EXTRACT_BE_U_2(cp);
cp += 2;
ND_PRINT((ndo, " %s", tok2str(ns_type2str, "Type%d", i)));
/* print the qclass (if it's not IN) */
- i = EXTRACT_BE_16BITS(cp);
+ i = EXTRACT_BE_U_2(cp);
cp += 2;
if (is_mdns)
class = (i & ~C_QU);
return (ndo->ndo_snapend);
/* print the type/qtype */
- typ = EXTRACT_BE_16BITS(cp);
+ typ = EXTRACT_BE_U_2(cp);
cp += 2;
/* print the class (if it's not IN and the type isn't OPT) */
- i = EXTRACT_BE_16BITS(cp);
+ i = EXTRACT_BE_U_2(cp);
cp += 2;
if (is_mdns)
class = (i & ~C_CACHE_FLUSH);
if (typ == T_OPT) {
/* get opt flags */
cp += 2;
- opt_flags = EXTRACT_BE_16BITS(cp);
+ opt_flags = EXTRACT_BE_U_2(cp);
/* ignore rest of ttl field */
cp += 2;
} else if (ndo->ndo_vflag > 2) {
/* print ttl */
ND_PRINT((ndo, " ["));
- unsigned_relts_print(ndo, EXTRACT_BE_32BITS(cp));
+ unsigned_relts_print(ndo, EXTRACT_BE_U_4(cp));
ND_PRINT((ndo, "]"));
cp += 4;
} else {
cp += 4;
}
- len = EXTRACT_BE_16BITS(cp);
+ len = EXTRACT_BE_U_2(cp);
cp += 2;
rp = cp + len;
case T_A:
if (!ND_TTEST2(*cp, sizeof(struct in_addr)))
return(NULL);
- ND_PRINT((ndo, " %s", intoa(htonl(EXTRACT_BE_32BITS(cp)))));
+ ND_PRINT((ndo, " %s", intoa(htonl(EXTRACT_BE_U_4(cp)))));
break;
case T_NS:
return(NULL);
if (!ND_TTEST2(*cp, 5 * 4))
return(NULL);
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(cp)));
cp += 4;
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(cp)));
cp += 4;
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(cp)));
cp += 4;
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(cp)));
cp += 4;
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(cp)));
cp += 4;
break;
case T_MX:
return(NULL);
if (ns_nprint(ndo, cp + 2, bp) == NULL)
return(NULL);
- ND_PRINT((ndo, " %d", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, " %d", EXTRACT_BE_U_2(cp)));
break;
case T_TXT:
return(NULL);
if (ns_nprint(ndo, cp + 6, bp) == NULL)
return(NULL);
- ND_PRINT((ndo, ":%d %d %d", EXTRACT_BE_16BITS(cp + 4),
- EXTRACT_BE_16BITS(cp), EXTRACT_BE_16BITS(cp + 2)));
+ ND_PRINT((ndo, ":%d %d %d", EXTRACT_BE_U_2(cp + 4),
+ EXTRACT_BE_U_2(cp), EXTRACT_BE_U_2(cp + 2)));
break;
case T_AAAA:
if (!ND_TTEST_1(cp))
return(NULL);
- pbit = EXTRACT_8BITS(cp);
+ pbit = EXTRACT_U_1(cp);
pbyte = (pbit & ~7) / 8;
if (pbit > 128) {
ND_PRINT((ndo, " %u(bad plen)", pbit));
cp += 6;
if (!ND_TTEST_2(cp))
return(NULL);
- ND_PRINT((ndo, " fudge=%u", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, " fudge=%u", EXTRACT_BE_U_2(cp)));
cp += 2;
if (!ND_TTEST_2(cp))
return(NULL);
- ND_PRINT((ndo, " maclen=%u", EXTRACT_BE_16BITS(cp)));
- cp += 2 + EXTRACT_BE_16BITS(cp);
+ ND_PRINT((ndo, " maclen=%u", EXTRACT_BE_U_2(cp)));
+ cp += 2 + EXTRACT_BE_U_2(cp);
if (!ND_TTEST_2(cp))
return(NULL);
- ND_PRINT((ndo, " origid=%u", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, " origid=%u", EXTRACT_BE_U_2(cp)));
cp += 2;
if (!ND_TTEST_2(cp))
return(NULL);
- ND_PRINT((ndo, " error=%u", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, " error=%u", EXTRACT_BE_U_2(cp)));
cp += 2;
if (!ND_TTEST_2(cp))
return(NULL);
- ND_PRINT((ndo, " otherlen=%u", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, " otherlen=%u", EXTRACT_BE_U_2(cp)));
cp += 2;
}
}
np = (const HEADER *)bp;
ND_TCHECK(*np);
/* get the byte-order right */
- qdcount = EXTRACT_BE_16BITS(&np->qdcount);
- ancount = EXTRACT_BE_16BITS(&np->ancount);
- nscount = EXTRACT_BE_16BITS(&np->nscount);
- arcount = EXTRACT_BE_16BITS(&np->arcount);
+ qdcount = EXTRACT_BE_U_2(&np->qdcount);
+ ancount = EXTRACT_BE_U_2(&np->ancount);
+ nscount = EXTRACT_BE_U_2(&np->nscount);
+ arcount = EXTRACT_BE_U_2(&np->arcount);
if (DNS_QR(np)) {
/* this is a response */
ND_PRINT((ndo, "%d%s%s%s%s%s%s",
- EXTRACT_BE_16BITS(&np->id),
+ EXTRACT_BE_U_2(&np->id),
ns_ops[DNS_OPCODE(np)],
ns_resp[DNS_RCODE(np)],
DNS_AA(np)? "*" : "",
/* Print QUESTION section on -vv */
cp = (const u_char *)(np + 1);
while (qdcount--) {
- if (qdcount < EXTRACT_BE_16BITS(&np->qdcount) - 1)
+ if (qdcount < EXTRACT_BE_U_2(&np->qdcount) - 1)
ND_PRINT((ndo, ","));
if (ndo->ndo_vflag > 1) {
ND_PRINT((ndo, " q:"));
}
else {
/* this is a request */
- ND_PRINT((ndo, "%d%s%s%s", EXTRACT_BE_16BITS(&np->id), ns_ops[DNS_OPCODE(np)],
+ ND_PRINT((ndo, "%d%s%s%s", EXTRACT_BE_U_2(&np->id), ns_ops[DNS_OPCODE(np)],
DNS_RD(np) ? "+" : "",
DNS_CD(np) ? "%" : ""));
/* any weirdness? */
- b2 = EXTRACT_BE_16BITS(((const u_short *)np) + 1);
+ b2 = EXTRACT_BE_U_2(((const u_short *)np) + 1);
if (b2 & 0x6cf)
ND_PRINT((ndo, " [b2&3=0x%x]", b2));
ND_TCHECK2(*tptr, DTP_HEADER_LEN);
ND_PRINT((ndo, "DTPv%u, length %u",
- EXTRACT_8BITS(tptr),
+ EXTRACT_U_1(tptr),
length));
/*
while (tptr < (pptr+length)) {
ND_TCHECK2(*tptr, 4);
- type = EXTRACT_BE_16BITS(tptr);
- len = EXTRACT_BE_16BITS(tptr + 2);
+ type = EXTRACT_BE_U_2(tptr);
+ len = EXTRACT_BE_U_2(tptr + 2);
/* XXX: should not be but sometimes it is, see the test captures */
if (type == 0)
return;
return;
ND_TCHECK_1(bp + 1);
- type = EXTRACT_8BITS(bp + 1);
+ type = EXTRACT_U_1(bp + 1);
/* Skip IGMP header */
bp += 8;
*/
bp -= 4;
ND_TCHECK2(bp[0], 4);
- major_version = EXTRACT_8BITS(bp + 3);
- minor_version = EXTRACT_8BITS(bp + 2);
+ major_version = EXTRACT_U_1(bp + 3);
+ minor_version = EXTRACT_U_1(bp + 2);
bp += 4;
if (print_neighbors2(ndo, bp, ep, len, major_version,
minor_version) < 0)
origin = 0;
for (i = 0; i < width; ++i) {
ND_TCHECK_1(bp);
- origin = origin << 8 | EXTRACT_8BITS(bp);
+ origin = origin << 8 | EXTRACT_U_1(bp);
bp++;
}
for ( ; i < 4; ++i)
origin <<= 8;
ND_TCHECK_1(bp);
- metric = EXTRACT_8BITS(bp);
+ metric = EXTRACT_U_1(bp);
bp++;
done = metric & 0x80;
metric &= 0x7f;
ND_TCHECK2(bp[0], 7);
laddr = bp;
bp += 4;
- metric = EXTRACT_8BITS(bp);
+ metric = EXTRACT_U_1(bp);
bp++;
- thresh = EXTRACT_8BITS(bp);
+ thresh = EXTRACT_U_1(bp);
bp++;
- ncount = EXTRACT_8BITS(bp);
+ ncount = EXTRACT_U_1(bp);
bp++;
len -= 7;
while (--ncount >= 0) {
ND_TCHECK2(bp[0], 8);
laddr = bp;
bp += 4;
- metric = EXTRACT_8BITS(bp);
+ metric = EXTRACT_U_1(bp);
bp++;
- thresh = EXTRACT_8BITS(bp);
+ thresh = EXTRACT_U_1(bp);
bp++;
- flags = EXTRACT_8BITS(bp);
+ flags = EXTRACT_U_1(bp);
bp++;
- ncount = EXTRACT_8BITS(bp);
+ ncount = EXTRACT_U_1(bp);
bp++;
len -= 8;
while (--ncount >= 0 && (len >= 4) && (bp + 4) <= ep) {
ND_PRINT((ndo, " src %s grp %s", ipaddr_string(ndo, bp), ipaddr_string(ndo, bp + 4)));
bp += 8;
ND_PRINT((ndo, " timer "));
- unsigned_relts_print(ndo, EXTRACT_BE_32BITS(bp));
+ unsigned_relts_print(ndo, EXTRACT_BE_U_4(bp));
return (0);
trunc:
return (-1);
tok2str(eap_frame_type_values, "unknown", eap->type),
eap->type,
eap->version,
- EXTRACT_BE_16BITS(eap->length)));
+ EXTRACT_BE_U_2(eap->length)));
return;
}
tok2str(eap_frame_type_values, "unknown", eap->type),
eap->type,
eap->version,
- EXTRACT_BE_16BITS(eap->length)));
+ EXTRACT_BE_U_2(eap->length)));
tptr += sizeof(struct eap_frame_t);
tlen -= sizeof(struct eap_frame_t);
ND_TCHECK_1(tptr);
type = *(tptr);
ND_TCHECK_2(tptr + 2);
- len = EXTRACT_BE_16BITS(tptr + 2);
+ len = EXTRACT_BE_U_2(tptr + 2);
ND_PRINT((ndo, ", %s (%u), id %u, len %u",
tok2str(eap_code_values, "unknown", type),
type,
- EXTRACT_8BITS((tptr + 1)),
+ EXTRACT_U_1((tptr + 1)),
len));
ND_TCHECK2(*tptr, len);
if (type <= 2) { /* For EAP_REQUEST and EAP_RESPONSE only */
ND_TCHECK_1(tptr + 4);
- subtype = EXTRACT_8BITS(tptr + 4);
+ subtype = EXTRACT_U_1(tptr + 4);
ND_PRINT((ndo, "\n\t\t Type %s (%u)",
tok2str(eap_type_values, "unknown", subtype),
subtype));
while (count < len) {
ND_TCHECK_1(tptr + count);
ND_PRINT((ndo, " %s (%u),",
- tok2str(eap_type_values, "unknown", EXTRACT_8BITS((tptr + count))),
+ tok2str(eap_type_values, "unknown", EXTRACT_U_1((tptr + count))),
*(tptr + count)));
count++;
}
ND_TCHECK_1(tptr + 5);
if (subtype == EAP_TYPE_TTLS)
ND_PRINT((ndo, " TTLSv%u",
- EAP_TTLS_VERSION(EXTRACT_8BITS((tptr + 5)))));
+ EAP_TTLS_VERSION(EXTRACT_U_1((tptr + 5)))));
ND_PRINT((ndo, " flags [%s] 0x%02x,",
- bittok2str(eap_tls_flags_values, "none", EXTRACT_8BITS((tptr + 5))),
+ bittok2str(eap_tls_flags_values, "none", EXTRACT_U_1((tptr + 5))),
*(tptr + 5)));
if (EAP_TLS_EXTRACT_BIT_L(*(tptr+5))) {
ND_TCHECK_4(tptr + 6);
- ND_PRINT((ndo, " len %u", EXTRACT_BE_32BITS(tptr + 6)));
+ ND_PRINT((ndo, " len %u", EXTRACT_BE_U_4(tptr + 6)));
}
break;
case EAP_TYPE_FAST:
ND_TCHECK_1(tptr + 5);
ND_PRINT((ndo, " FASTv%u",
- EAP_TTLS_VERSION(EXTRACT_8BITS((tptr + 5)))));
+ EAP_TTLS_VERSION(EXTRACT_U_1((tptr + 5)))));
ND_PRINT((ndo, " flags [%s] 0x%02x,",
- bittok2str(eap_tls_flags_values, "none", EXTRACT_8BITS((tptr + 5))),
+ bittok2str(eap_tls_flags_values, "none", EXTRACT_U_1((tptr + 5))),
*(tptr + 5)));
if (EAP_TLS_EXTRACT_BIT_L(*(tptr+5))) {
ND_TCHECK_4(tptr + 6);
- ND_PRINT((ndo, " len %u", EXTRACT_BE_32BITS(tptr + 6)));
+ ND_PRINT((ndo, " len %u", EXTRACT_BE_U_4(tptr + 6)));
}
/* FIXME - TLV attributes follow */
case EAP_TYPE_SIM:
ND_TCHECK_1(tptr + 5);
ND_PRINT((ndo, " subtype [%s] 0x%02x,",
- tok2str(eap_aka_subtype_values, "unknown", EXTRACT_8BITS((tptr + 5))),
+ tok2str(eap_aka_subtype_values, "unknown", EXTRACT_U_1((tptr + 5))),
*(tptr + 5)));
/* FIXME - TLV attributes follow */
switch (netlen) {
case 1:
- addr = EXTRACT_8BITS(cp);
+ addr = EXTRACT_U_1(cp);
cp++;
/* fall through */
case 2:
- addr = (addr << 8) | EXTRACT_8BITS(cp);
+ addr = (addr << 8) | EXTRACT_U_1(cp);
cp++;
/* fall through */
case 3:
- addr = (addr << 8) | EXTRACT_8BITS(cp);
+ addr = (addr << 8) | EXTRACT_U_1(cp);
cp++;
break;
}
if (length < 1)
goto trunc;
ND_TCHECK2(cp[0], 1);
- distances = EXTRACT_8BITS(cp);
+ distances = EXTRACT_U_1(cp);
cp++;
length--;
ND_PRINT((ndo, " %s %s ",
if (length < 2)
goto trunc;
ND_TCHECK2(cp[0], 2);
- ND_PRINT((ndo, "%sd%d:", comma, EXTRACT_8BITS(cp)));
+ ND_PRINT((ndo, "%sd%d:", comma, EXTRACT_U_1(cp)));
cp++;
comma = ", ";
- networks = EXTRACT_8BITS(cp);
+ networks = EXTRACT_U_1(cp);
cp++;
length -= 2;
while (networks != 0) {
if (length < 1)
goto trunc;
ND_TCHECK2(cp[0], 1);
- addr = ((uint32_t)EXTRACT_8BITS(cp)) << 24;
+ addr = ((uint32_t) EXTRACT_U_1(cp)) << 24;
cp++;
length--;
if (IN_CLASSB(addr)) {
if (length < 1)
goto trunc;
ND_TCHECK2(cp[0], 1);
- addr |= ((uint32_t)EXTRACT_8BITS(cp)) << 16;
+ addr |= ((uint32_t) EXTRACT_U_1(cp)) << 16;
cp++;
length--;
} else if (!IN_CLASSA(addr)) {
if (length < 2)
goto trunc;
ND_TCHECK2(cp[0], 2);
- addr |= ((uint32_t)EXTRACT_8BITS(cp)) << 16;
+ addr |= ((uint32_t) EXTRACT_U_1(cp)) << 16;
cp++;
- addr |= ((uint32_t)EXTRACT_8BITS(cp)) << 8;
+ addr |= ((uint32_t) EXTRACT_U_1(cp)) << 8;
cp++;
length -= 2;
}
if (!ndo->ndo_vflag) {
ND_PRINT((ndo, "EGPv%u, AS %u, seq %u, length %u",
egp->egp_version,
- EXTRACT_BE_16BITS(&egp->egp_as),
- EXTRACT_BE_16BITS(&egp->egp_sequence),
+ EXTRACT_BE_U_2(&egp->egp_as),
+ EXTRACT_BE_U_2(&egp->egp_sequence),
length));
return;
} else
break;
}
ND_PRINT((ndo, " hello:%d poll:%d",
- EXTRACT_BE_16BITS(&egp->egp_hello),
- EXTRACT_BE_16BITS(&egp->egp_poll)));
+ EXTRACT_BE_U_2(&egp->egp_hello),
+ EXTRACT_BE_U_2(&egp->egp_poll)));
break;
case EGPC_REFUSE:
else
ND_PRINT((ndo, " [status %d]", status));
- if (EXTRACT_BE_16BITS(&egp->egp_reason) <= EGPR_UVERSION)
- ND_PRINT((ndo, " %s", egp_reasons[EXTRACT_BE_16BITS(&egp->egp_reason)]));
+ if (EXTRACT_BE_U_2(&egp->egp_reason) <= EGPR_UVERSION)
+ ND_PRINT((ndo, " %s", egp_reasons[EXTRACT_BE_U_2(&egp->egp_reason)]));
else
- ND_PRINT((ndo, " [reason %d]", EXTRACT_BE_16BITS(&egp->egp_reason)));
+ ND_PRINT((ndo, " [reason %d]", EXTRACT_BE_U_2(&egp->egp_reason)));
break;
default:
eigrp_com_header->version,
tok2str(eigrp_opcode_values, "unknown, type: %u",eigrp_com_header->opcode),
eigrp_com_header->opcode,
- EXTRACT_BE_16BITS(&eigrp_com_header->checksum),
+ EXTRACT_BE_U_2(&eigrp_com_header->checksum),
tok2str(eigrp_common_header_flag_values,
"none",
- EXTRACT_BE_32BITS(&eigrp_com_header->flags)),
- EXTRACT_BE_32BITS(&eigrp_com_header->seq),
- EXTRACT_BE_32BITS(&eigrp_com_header->ack),
- EXTRACT_BE_32BITS(&eigrp_com_header->asn),
+ EXTRACT_BE_U_4(&eigrp_com_header->flags)),
+ EXTRACT_BE_U_4(&eigrp_com_header->seq),
+ EXTRACT_BE_U_4(&eigrp_com_header->ack),
+ EXTRACT_BE_U_4(&eigrp_com_header->asn),
tlen));
tptr+=sizeof(struct eigrp_common_header);
ND_TCHECK2(*tptr, sizeof(struct eigrp_tlv_header));
eigrp_tlv_header = (const struct eigrp_tlv_header *)tptr;
- eigrp_tlv_len=EXTRACT_BE_16BITS(&eigrp_tlv_header->length);
- eigrp_tlv_type=EXTRACT_BE_16BITS(&eigrp_tlv_header->type);
+ eigrp_tlv_len=EXTRACT_BE_U_2(&eigrp_tlv_header->length);
+ eigrp_tlv_type=EXTRACT_BE_U_2(&eigrp_tlv_header->type);
if (eigrp_tlv_len < sizeof(struct eigrp_tlv_header) ||
}
ND_PRINT((ndo, "\n\t holdtime: %us, k1 %u, k2 %u, k3 %u, k4 %u, k5 %u",
- EXTRACT_BE_16BITS(tlv_ptr.eigrp_tlv_general_parm->holdtime),
+ EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_general_parm->holdtime),
tlv_ptr.eigrp_tlv_general_parm->k1,
tlv_ptr.eigrp_tlv_general_parm->k2,
tlv_ptr.eigrp_tlv_general_parm->k3,
ND_PRINT((ndo, "\n\t IPv4 prefix: %15s/%u, nexthop: ",
ipaddr_string(ndo, prefix),
bit_length));
- if (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0)
+ if (EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0)
ND_PRINT((ndo, "self"));
else
ND_PRINT((ndo, "%s",ipaddr_string(ndo, &tlv_ptr.eigrp_tlv_ip_int->nexthop)));
ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
- (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_int->delay)/100),
- EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_int->bandwidth),
- EXTRACT_BE_24BITS(&tlv_ptr.eigrp_tlv_ip_int->mtu),
+ (EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_ip_int->delay)/100),
+ EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_ip_int->bandwidth),
+ EXTRACT_BE_U_3(&tlv_ptr.eigrp_tlv_ip_int->mtu),
tlv_ptr.eigrp_tlv_ip_int->hopcount,
tlv_ptr.eigrp_tlv_ip_int->reliability,
tlv_ptr.eigrp_tlv_ip_int->load));
ND_PRINT((ndo, "\n\t IPv4 prefix: %15s/%u, nexthop: ",
ipaddr_string(ndo, prefix),
bit_length));
- if (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0)
+ if (EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0)
ND_PRINT((ndo, "self"));
else
ND_PRINT((ndo, "%s",ipaddr_string(ndo, &tlv_ptr.eigrp_tlv_ip_ext->nexthop)));
ND_PRINT((ndo, "\n\t origin-router %s, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u",
ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_ext->origin_router),
- EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_ip_ext->origin_as),
+ EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->origin_as),
tok2str(eigrp_ext_proto_id_values,"unknown",tlv_ptr.eigrp_tlv_ip_ext->proto_id),
tlv_ptr.eigrp_tlv_ip_ext->flags,
- EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_ip_ext->tag),
- EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_ip_ext->metric)));
+ EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->tag),
+ EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->metric)));
ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
- (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->delay)/100),
- EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->bandwidth),
- EXTRACT_BE_24BITS(&tlv_ptr.eigrp_tlv_ip_ext->mtu),
+ (EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_ip_ext->delay)/100),
+ EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_ip_ext->bandwidth),
+ EXTRACT_BE_U_3(&tlv_ptr.eigrp_tlv_ip_ext->mtu),
tlv_ptr.eigrp_tlv_ip_ext->hopcount,
tlv_ptr.eigrp_tlv_ip_ext->reliability,
tlv_ptr.eigrp_tlv_ip_ext->load));
}
ND_PRINT((ndo, "\n\t Cable-range: %u-%u, Router-ID %u",
- EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_start),
- EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_end),
- EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->router_id)));
+ EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_start),
+ EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_end),
+ EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_at_cable_setup->router_id)));
break;
case EIGRP_TLV_AT_INT:
}
ND_PRINT((ndo, "\n\t Cable-Range: %u-%u, nexthop: ",
- EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_start),
- EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_end)));
+ EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_int->cable_start),
+ EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_int->cable_end)));
- if (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop) == 0)
+ if (EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_at_int->nexthop) == 0)
ND_PRINT((ndo, "self"));
else
ND_PRINT((ndo, "%u.%u",
- EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop),
- EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop[2])));
+ EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_int->nexthop),
+ EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_int->nexthop[2])));
ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
- (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_int->delay)/100),
- EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_int->bandwidth),
- EXTRACT_BE_24BITS(&tlv_ptr.eigrp_tlv_at_int->mtu),
+ (EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_at_int->delay)/100),
+ EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_at_int->bandwidth),
+ EXTRACT_BE_U_3(&tlv_ptr.eigrp_tlv_at_int->mtu),
tlv_ptr.eigrp_tlv_at_int->hopcount,
tlv_ptr.eigrp_tlv_at_int->reliability,
tlv_ptr.eigrp_tlv_at_int->load));
}
ND_PRINT((ndo, "\n\t Cable-Range: %u-%u, nexthop: ",
- EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_start),
- EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_end)));
+ EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_ext->cable_start),
+ EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_ext->cable_end)));
- if (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop) == 0)
+ if (EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_at_ext->nexthop) == 0)
ND_PRINT((ndo, "self"));
else
ND_PRINT((ndo, "%u.%u",
- EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop),
- EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop[2])));
+ EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_ext->nexthop),
+ EXTRACT_BE_U_2(&tlv_ptr.eigrp_tlv_at_ext->nexthop[2])));
ND_PRINT((ndo, "\n\t origin-router %u, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u",
- EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_router),
- EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_as),
+ EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->origin_router),
+ EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->origin_as),
tok2str(eigrp_ext_proto_id_values,"unknown",tlv_ptr.eigrp_tlv_at_ext->proto_id),
tlv_ptr.eigrp_tlv_at_ext->flags,
- EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_at_ext->tag),
- EXTRACT_BE_16BITS(tlv_ptr.eigrp_tlv_at_ext->metric)));
+ EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_at_ext->tag),
+ EXTRACT_BE_U_2(tlv_ptr.eigrp_tlv_at_ext->metric)));
ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
- (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_ext->delay)/100),
- EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_ext->bandwidth),
- EXTRACT_BE_24BITS(&tlv_ptr.eigrp_tlv_at_ext->mtu),
+ (EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_at_ext->delay)/100),
+ EXTRACT_BE_U_4(&tlv_ptr.eigrp_tlv_at_ext->bandwidth),
+ EXTRACT_BE_U_3(&tlv_ptr.eigrp_tlv_at_ext->mtu),
tlv_ptr.eigrp_tlv_at_ext->hopcount,
tlv_ptr.eigrp_tlv_at_ext->reliability,
tlv_ptr.eigrp_tlv_at_ext->load));
ENC_PRINT_TYPE(flags, M_AUTH, "authentic");
ENC_PRINT_TYPE(flags, M_CONF, "confidential");
/* ENC_PRINT_TYPE(flags, M_TUNNEL, "tunnel"); */
- ND_PRINT((ndo, "SPI 0x%08x: ", EXTRACT_BE_32BITS(&hdr->spi)));
+ ND_PRINT((ndo, "SPI 0x%08x: ", EXTRACT_BE_U_4(&hdr->spi)));
length -= ENC_HDRLEN;
caplen -= ENC_HDRLEN;
ND_PRINT((ndo, "[|ESP]"));
goto fail;
}
- ND_PRINT((ndo, "ESP(spi=0x%08x", EXTRACT_BE_32BITS(&esp->esp_spi)));
- ND_PRINT((ndo, ",seq=0x%x)", EXTRACT_BE_32BITS(&esp->esp_seq)));
+ ND_PRINT((ndo, "ESP(spi=0x%08x", EXTRACT_BE_U_4(&esp->esp_spi)));
+ ND_PRINT((ndo, ",seq=0x%x)", EXTRACT_BE_U_4(&esp->esp_seq)));
ND_PRINT((ndo, ", length %u", length));
#ifndef HAVE_LIBCRYPTO
case 6:
ip6 = (const struct ip6_hdr *)bp2;
/* we do not attempt to decrypt jumbograms */
- if (!EXTRACT_BE_16BITS(&ip6->ip6_plen))
+ if (!EXTRACT_BE_U_2(&ip6->ip6_plen))
goto fail;
/* if we can't get nexthdr, we do not need to decrypt it */
- len = sizeof(struct ip6_hdr) + EXTRACT_BE_16BITS(&ip6->ip6_plen);
+ len = sizeof(struct ip6_hdr) + EXTRACT_BE_U_2(&ip6->ip6_plen);
/* see if we can find the SA, and if so, decode it */
for (sa = ndo->ndo_sa_list_head; sa != NULL; sa = sa->next) {
- if (sa->spi == EXTRACT_BE_32BITS(&esp->esp_spi) &&
+ if (sa->spi == EXTRACT_BE_U_4(&esp->esp_spi) &&
sa->daddr_version == 6 &&
UNALIGNED_MEMCMP(&sa->daddr.in6, &ip6->ip6_dst,
sizeof(struct in6_addr)) == 0) {
break;
case 4:
/* nexthdr & padding are in the last fragment */
- if (EXTRACT_BE_16BITS(&ip->ip_off) & IP_MF)
+ if (EXTRACT_BE_U_2(&ip->ip_off) & IP_MF)
goto fail;
- len = EXTRACT_BE_16BITS(&ip->ip_len);
+ len = EXTRACT_BE_U_2(&ip->ip_len);
/* see if we can find the SA, and if so, decode it */
for (sa = ndo->ndo_sa_list_head; sa != NULL; sa = sa->next) {
- if (sa->spi == EXTRACT_BE_32BITS(&esp->esp_spi) &&
+ if (sa->spi == EXTRACT_BE_U_4(&esp->esp_spi) &&
sa->daddr_version == 4 &&
UNALIGNED_MEMCMP(&sa->daddr.in4, &ip->ip_dst,
sizeof(struct in_addr)) == 0) {
advance = sizeof(struct newesp);
/* sanity check for pad length */
- if (ep - bp < EXTRACT_8BITS(ep - 2))
+ if (ep - bp < EXTRACT_U_1(ep - 2))
goto fail;
if (padlen)
- *padlen = EXTRACT_8BITS(ep - 2) + 2;
+ *padlen = EXTRACT_U_1(ep - 2) + 2;
if (nhdr)
- *nhdr = EXTRACT_8BITS(ep - 1);
+ *nhdr = EXTRACT_U_1(ep - 1);
ND_PRINT((ndo, ": "));
return advance;
etheraddr_string(ndo, ESRC(ep)),
etheraddr_string(ndo, EDST(ep))));
- length_type = EXTRACT_BE_16BITS(&ep->ether_length_type);
+ length_type = EXTRACT_BE_U_2(&ep->ether_length_type);
if (!ndo->ndo_qflag) {
if (length_type <= ETHERMTU) {
ND_PRINT((ndo, ", 802.3"));
src.addr_string = etheraddr_string;
dst.addr = EDST(ep);
dst.addr_string = etheraddr_string;
- length_type = EXTRACT_BE_16BITS(&ep->ether_length_type);
+ length_type = EXTRACT_BE_U_2(&ep->ether_length_type);
recurse:
/*
return (hdrlen + length);
}
if (ndo->ndo_eflag) {
- uint16_t tag = EXTRACT_BE_16BITS(p);
+ uint16_t tag = EXTRACT_BE_U_2(p);
ND_PRINT((ndo, "%s, ", ieee8021q_tci_string(tag)));
}
- length_type = EXTRACT_BE_16BITS(p + 2);
+ length_type = EXTRACT_BE_U_2(p + 2);
if (ndo->ndo_eflag && length_type > ETHERMTU)
ND_PRINT((ndo, "ethertype %s, ", tok2str(ethertype_values,"0x%04x", length_type)));
p += 4;
#define ForCES_V(forcesh) ((forcesh)->fm_vrsvd >> 4)
nd_uint8_t fm_tom; /* type of message */
nd_uint16_t fm_len; /* total length * 4 bytes */
-#define ForCES_BLN(forcesh) ((uint32_t)(EXTRACT_BE_16BITS(&(forcesh)->fm_len) << 2))
+#define ForCES_BLN(forcesh) ((uint32_t)(EXTRACT_BE_U_2(&(forcesh)->fm_len) << 2))
nd_uint32_t fm_sid; /* Source ID */
-#define ForCES_SID(forcesh) EXTRACT_BE_32BITS(&(forcesh)->fm_sid)
+#define ForCES_SID(forcesh) EXTRACT_BE_U_4(&(forcesh)->fm_sid)
nd_uint32_t fm_did; /* Destination ID */
-#define ForCES_DID(forcesh) EXTRACT_BE_32BITS(&(forcesh)->fm_did)
+#define ForCES_DID(forcesh) EXTRACT_BE_U_4(&(forcesh)->fm_did)
nd_uint8_t fm_cor[8]; /* correlator */
nd_uint32_t fm_flags; /* flags */
-#define ForCES_ACK(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0xC0000000) >> 30)
-#define ForCES_PRI(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x38000000) >> 27)
-#define ForCES_RS1(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x07000000) >> 24)
-#define ForCES_EM(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x00C00000) >> 22)
-#define ForCES_AT(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x00200000) >> 21)
-#define ForCES_TP(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x00180000) >> 19)
-#define ForCES_RS2(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x0007FFFF) >> 0)
+#define ForCES_ACK(forcesh) ((EXTRACT_BE_U_4(&(forcesh)->fm_flags)&0xC0000000) >> 30)
+#define ForCES_PRI(forcesh) ((EXTRACT_BE_U_4(&(forcesh)->fm_flags)&0x38000000) >> 27)
+#define ForCES_RS1(forcesh) ((EXTRACT_BE_U_4(&(forcesh)->fm_flags)&0x07000000) >> 24)
+#define ForCES_EM(forcesh) ((EXTRACT_BE_U_4(&(forcesh)->fm_flags)&0x00C00000) >> 22)
+#define ForCES_AT(forcesh) ((EXTRACT_BE_U_4(&(forcesh)->fm_flags)&0x00200000) >> 21)
+#define ForCES_TP(forcesh) ((EXTRACT_BE_U_4(&(forcesh)->fm_flags)&0x00180000) >> 19)
+#define ForCES_RS2(forcesh) ((EXTRACT_BE_U_4(&(forcesh)->fm_flags)&0x0007FFFF) >> 0)
};
#define ForCES_HLN_VALID(fhl,tlen) ((tlen) >= ForCES_HDRL && \
#define GET_TOP_TLV(fhdr) ((const struct forces_tlv *)((fhdr) + sizeof (struct forcesh)))
#define TLV_SET_LEN(len) (F_ALN_LEN(TLV_HDRL) + (len))
#define TLV_ALN_LEN(len) F_ALN_LEN(TLV_SET_LEN(len))
-#define TLV_RDAT_LEN(tlv) (EXTRACT_16BITS(&(tlv)->length) - TLV_SET_LEN(0)
+#define TLV_RDAT_LEN(tlv) (EXTRACT_BE_U_2(&(tlv)->length) - TLV_SET_LEN(0)
#define TLV_DATA(tlvp) ((const void*)(((const char*)(tlvp)) + TLV_SET_LEN(0)))
-#define GO_NXT_TLV(tlv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_BE_16BITS(&(tlv)->length)), \
+#define GO_NXT_TLV(tlv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_BE_U_2(&(tlv)->length)), \
(const struct forces_tlv*)(((const char*)(tlv)) \
- + F_ALN_LEN(EXTRACT_BE_16BITS(&(tlv)->length))))
+ + F_ALN_LEN(EXTRACT_BE_U_2(&(tlv)->length))))
#define ILV_SET_LEN(len) (F_ALN_LEN(ILV_HDRL) + (len))
#define ILV_ALN_LEN(len) F_ALN_LEN(ILV_SET_LEN(len))
-#define ILV_RDAT_LEN(ilv) (EXTRACT_BE_32BITS(&(ilv)->length)) - ILV_SET_LEN(0)
+#define ILV_RDAT_LEN(ilv) (EXTRACT_BE_U_4(&(ilv)->length)) - ILV_SET_LEN(0)
#define ILV_DATA(ilvp) ((const void*)(((const char*)(ilvp)) + ILV_SET_LEN(0)))
-#define GO_NXT_ILV(ilv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_BE_32BITS(&(ilv)->length)), \
+#define GO_NXT_ILV(ilv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_BE_U_4(&(ilv)->length)), \
(const struct forces_ilv *)(((const char*)(ilv)) \
- + F_ALN_LEN(EXTRACT_BE_32BITS(&(ilv)->length))))
+ + F_ALN_LEN(EXTRACT_BE_U_4(&(ilv)->length))))
#define INVALID_RLEN 1
#define INVALID_STLN 2
#define INVALID_LTLN 3
{
if (rlen < TLV_HDRL)
return INVALID_RLEN;
- if (EXTRACT_BE_16BITS(&tlv->length) < TLV_HDRL)
+ if (EXTRACT_BE_U_2(&tlv->length) < TLV_HDRL)
return INVALID_STLN;
- if (EXTRACT_BE_16BITS(&tlv->length) > rlen)
+ if (EXTRACT_BE_U_2(&tlv->length) > rlen)
return INVALID_LTLN;
- if (rlen < F_ALN_LEN(EXTRACT_BE_16BITS(&tlv->length)))
+ if (rlen < F_ALN_LEN(EXTRACT_BE_U_2(&tlv->length)))
return INVALID_ALEN;
return 0;
{
if (rlen < ILV_HDRL)
return INVALID_RLEN;
- if (EXTRACT_BE_32BITS(&ilv->length) < ILV_HDRL)
+ if (EXTRACT_BE_U_4(&ilv->length) < ILV_HDRL)
return INVALID_STLN;
- if (EXTRACT_BE_32BITS(&ilv->length) > rlen)
+ if (EXTRACT_BE_U_4(&ilv->length) > rlen)
return INVALID_LTLN;
- if (rlen < F_ALN_LEN(EXTRACT_BE_32BITS(&ilv->length)))
+ if (rlen < F_ALN_LEN(EXTRACT_BE_U_4(&ilv->length)))
return INVALID_ALEN;
return 0;
*/
rlen = len - TLV_HDRL;
ND_TCHECK(*tlv);
- type = EXTRACT_BE_16BITS(&tlv->type);
+ type = EXTRACT_BE_U_2(&tlv->type);
if (type != F_TLV_FULD) {
ND_PRINT((ndo, "Error: expecting FULLDATA!\n"));
return -1;
return -1;
}
if (ndo->ndo_vflag >= 3) {
- int ilvl = EXTRACT_BE_32BITS(&ilv->length);
+ int ilvl = EXTRACT_BE_U_4(&ilv->length);
ND_PRINT((ndo, "\n%s ILV: type %x length %d\n", &ib[1],
- EXTRACT_BE_32BITS(&ilv->type), ilvl));
+ EXTRACT_BE_U_4(&ilv->type), ilvl));
hex_print_with_offset(ndo, "\t\t[", tdp, ilvl-ILV_HDRL, 0);
}
*/
rlen = len - TLV_HDRL;
ND_TCHECK(*tlv);
- type = EXTRACT_BE_16BITS(&tlv->type);
+ type = EXTRACT_BE_U_2(&tlv->type);
if (type != F_TLV_SPAD) {
ND_PRINT((ndo, "Error: expecting SPARSEDATA!\n"));
return -1;
u_int invtlv;
ND_TCHECK(*tdp);
- id = EXTRACT_BE_32BITS(tdp);
+ id = EXTRACT_BE_U_4(tdp);
ND_PRINT((ndo, "%sKeyinfo: Key 0x%x\n", ib, id));
ND_TCHECK(*kdtlv);
- type = EXTRACT_BE_16BITS(&kdtlv->type);
+ type = EXTRACT_BE_U_2(&kdtlv->type);
invtlv = tlv_valid(kdtlv, len);
if (invtlv) {
ND_PRINT((ndo, "%s TLV type 0x%x len %d\n",
tok2str(ForCES_TLV_err, NULL, invtlv), type,
- EXTRACT_BE_16BITS(&kdtlv->length)));
+ EXTRACT_BE_U_2(&kdtlv->length)));
return -1;
}
/*
* length is large enough but not too large (it doesn't
* go past the end of the containing TLV).
*/
- tll = EXTRACT_BE_16BITS(&kdtlv->length);
+ tll = EXTRACT_BE_U_2(&kdtlv->length);
dp = (const u_char *) TLV_DATA(kdtlv);
return fdatatlv_print(ndo, dp, tll, op_msk, indent);
ND_TCHECK2(*pptr, 4);
if (len < 4)
goto trunc;
- id = EXTRACT_BE_32BITS(pptr);
+ id = EXTRACT_BE_U_4(pptr);
if (ndo->ndo_vflag >= 3)
ND_PRINT((ndo, "%sID#%02u: %d\n", ib, i + 1, id));
len -= 4;
pptr += sizeof(struct forces_tlv);
len -= sizeof(struct forces_tlv);
- starti = EXTRACT_BE_32BITS(pptr);
+ starti = EXTRACT_BE_U_4(pptr);
pptr += 4;
len -= 4;
- endi = EXTRACT_BE_32BITS(pptr);
+ endi = EXTRACT_BE_U_4(pptr);
pptr += 4;
len -= 4;
pptr += sizeof(struct forces_tlv);
len -= sizeof(struct forces_tlv);
/* skip key content */
- tll = EXTRACT_BE_16BITS(&keytlv->length);
+ tll = EXTRACT_BE_U_2(&keytlv->length);
if (tll < TLV_HDRL) {
ND_PRINT((ndo, "key content length %u < %u\n",
tll, TLV_HDRL));
u_int invtlv;
ND_TCHECK(*pdtlv);
- type = EXTRACT_BE_16BITS(&pdtlv->type);
+ type = EXTRACT_BE_U_2(&pdtlv->type);
invtlv = tlv_valid(pdtlv, len);
if (invtlv) {
ND_PRINT((ndo, "%s Outstanding bytes %d for TLV type 0x%x TLV len %d\n",
tok2str(ForCES_TLV_err, NULL, invtlv), len, type,
- EXTRACT_BE_16BITS(&pdtlv->length)));
+ EXTRACT_BE_U_2(&pdtlv->length)));
goto pd_err;
}
/*
* length is large enough but not too large (it doesn't
* go past the end of the containing TLV).
*/
- tll = EXTRACT_BE_16BITS(&pdtlv->length) - TLV_HDRL;
- aln = F_ALN_LEN(EXTRACT_BE_16BITS(&pdtlv->length));
- if (aln > EXTRACT_BE_16BITS(&pdtlv->length)) {
+ tll = EXTRACT_BE_U_2(&pdtlv->length) - TLV_HDRL;
+ aln = F_ALN_LEN(EXTRACT_BE_U_2(&pdtlv->length));
+ if (aln > EXTRACT_BE_U_2(&pdtlv->length)) {
if (aln > len) {
ND_PRINT((ndo,
"Invalid padded pathdata TLV type 0x%x len %d missing %d pad bytes\n",
- type, EXTRACT_BE_16BITS(&pdtlv->length), aln - len));
+ type, EXTRACT_BE_U_2(&pdtlv->length), aln - len));
} else {
- pad = aln - EXTRACT_BE_16BITS(&pdtlv->length);
+ pad = aln - EXTRACT_BE_U_2(&pdtlv->length);
}
}
if (pd_valid(type)) {
if (ndo->ndo_vflag >= 3 && ops->v != F_TLV_PDAT) {
if (pad)
ND_PRINT((ndo, "%s %s (Length %d DataLen %d pad %d Bytes)\n",
- ib, ops->s, EXTRACT_BE_16BITS(&pdtlv->length), tll, pad));
+ ib, ops->s, EXTRACT_BE_U_2(&pdtlv->length), tll, pad));
else
ND_PRINT((ndo, "%s %s (Length %d DataLen %d Bytes)\n",
- ib, ops->s, EXTRACT_BE_16BITS(&pdtlv->length), tll));
+ ib, ops->s, EXTRACT_BE_U_2(&pdtlv->length), tll));
}
chk_op_type(ndo, type, op_msk, ops->op_msk);
len -= (TLV_HDRL + pad + tll);
} else {
ND_PRINT((ndo, "Invalid path data content type 0x%x len %d\n",
- type, EXTRACT_BE_16BITS(&pdtlv->length)));
+ type, EXTRACT_BE_U_2(&pdtlv->length)));
pd_err:
- if (EXTRACT_BE_16BITS(&pdtlv->length)) {
+ if (EXTRACT_BE_U_2(&pdtlv->length)) {
hex_print_with_offset(ndo, "Bad Data val\n\t [",
pptr, len, 0);
ND_PRINT((ndo, "]\n"));
goto trunc;
if (ndo->ndo_vflag >= 3) {
ND_PRINT((ndo, "\n%sPathdata: Flags 0x%x ID count %d\n",
- ib, EXTRACT_BE_16BITS(&pdh->pflags), EXTRACT_BE_16BITS(&pdh->pIDcnt)));
+ ib, EXTRACT_BE_U_2(&pdh->pflags), EXTRACT_BE_U_2(&pdh->pIDcnt)));
}
- if (EXTRACT_BE_16BITS(&pdh->pflags) & F_SELKEY) {
+ if (EXTRACT_BE_U_2(&pdh->pflags) & F_SELKEY) {
op_msk |= B_KEYIN;
}
/* Table GET Range operation */
- if (EXTRACT_BE_16BITS(&pdh->pflags) & F_SELTABRANGE) {
+ if (EXTRACT_BE_U_2(&pdh->pflags) & F_SELTABRANGE) {
op_msk |= B_TRNG;
}
/* Table SET append operation */
- if (EXTRACT_BE_16BITS(&pdh->pflags) & F_TABAPPEND) {
+ if (EXTRACT_BE_U_2(&pdh->pflags) & F_TABAPPEND) {
op_msk |= B_APPND;
}
pptr += sizeof(struct pathdata_h);
len -= sizeof(struct pathdata_h);
- idcnt = EXTRACT_BE_16BITS(&pdh->pIDcnt);
+ idcnt = EXTRACT_BE_U_2(&pdh->pIDcnt);
minsize = idcnt * 4;
if (len < minsize) {
ND_PRINT((ndo, "\t\t\ttruncated IDs expected %uB got %uB\n", minsize,
char *ib = indent_pr(indent, 0);
ND_TCHECK(*pdtlv);
- type = EXTRACT_BE_16BITS(&pdtlv->type);
- tll = EXTRACT_BE_16BITS(&pdtlv->length) - TLV_HDRL;
+ type = EXTRACT_BE_U_2(&pdtlv->type);
+ tll = EXTRACT_BE_U_2(&pdtlv->length) - TLV_HDRL;
invtlv = tlv_valid(pdtlv, len);
ND_PRINT((ndo, "genoptlvprint - %s TLV type 0x%x len %d\n",
- tok2str(ForCES_TLV, NULL, type), type, EXTRACT_BE_16BITS(&pdtlv->length)));
+ tok2str(ForCES_TLV, NULL, type), type, EXTRACT_BE_U_2(&pdtlv->length)));
if (!invtlv) {
/*
* At this point, tlv_valid() has ensured that the TLV
if (!ttlv_valid(type)) {
ND_PRINT((ndo, "%s TLV type 0x%x len %d\n",
tok2str(ForCES_TLV_err, NULL, invtlv), type,
- EXTRACT_BE_16BITS(&pdtlv->length)));
+ EXTRACT_BE_U_2(&pdtlv->length)));
return -1;
}
if (ndo->ndo_vflag >= 3)
ND_PRINT((ndo, "%s%s, length %d (data length %d Bytes)",
ib, tok2str(ForCES_TLV, NULL, type),
- EXTRACT_BE_16BITS(&pdtlv->length), tll));
+ EXTRACT_BE_U_2(&pdtlv->length), tll));
return pdata_print(ndo, dp, tll, op_msk, indent + 1);
} else {
* go past the end of the containing TLV).
*/
ib = indent_pr(indent, 0);
- type = EXTRACT_BE_16BITS(&pdtlv->type);
+ type = EXTRACT_BE_U_2(&pdtlv->type);
dp = (const u_char *) TLV_DATA(pdtlv);
- tll = EXTRACT_BE_16BITS(&pdtlv->length) - TLV_HDRL;
+ tll = EXTRACT_BE_U_2(&pdtlv->length) - TLV_HDRL;
if (ndo->ndo_vflag >= 3)
ND_PRINT((ndo, "%s%s, length %d (data encapsulated %d Bytes)",
ib, tok2str(ForCES_TLV, NULL, type),
- EXTRACT_BE_16BITS(&pdtlv->length),
- EXTRACT_BE_16BITS(&pdtlv->length) - TLV_HDRL));
+ EXTRACT_BE_U_2(&pdtlv->length),
+ EXTRACT_BE_U_2(&pdtlv->length) - TLV_HDRL));
if (pdata_print(ndo, dp, tll, op_msk, indent + 1) == -1)
return -1;
if (len) {
ND_PRINT((ndo,
"\n\t\tMessy PATHDATA TLV header, type (0x%x)\n\t\texcess of %d Bytes ",
- EXTRACT_BE_16BITS(&pdtlv->type), len - EXTRACT_BE_16BITS(&pdtlv->length)));
+ EXTRACT_BE_U_2(&pdtlv->type), len - EXTRACT_BE_U_2(&pdtlv->length)));
return -1;
}
const struct optlv_h *ops;
/*
- * lfbselect_print() has ensured that EXTRACT_16BITS(&otlv->length)
+ * lfbselect_print() has ensured that EXTRACT_BE_U_2(&otlv->length)
* >= TLV_HDRL.
*/
ND_TCHECK(*otlv);
- type = EXTRACT_BE_16BITS(&otlv->type);
- tll = EXTRACT_BE_16BITS(&otlv->length) - TLV_HDRL;
+ type = EXTRACT_BE_U_2(&otlv->type);
+ tll = EXTRACT_BE_U_2(&otlv->length) - TLV_HDRL;
ops = get_forces_optlv_h(type);
if (ndo->ndo_vflag >= 3) {
ND_PRINT((ndo, "%sOper TLV %s(0x%x) length %d\n", ib, ops->s, type,
- EXTRACT_BE_16BITS(&otlv->length)));
+ EXTRACT_BE_U_2(&otlv->length)));
}
/* rest of ops must at least have 12B {pathinfo} */
if (tll < OP_MIN_SIZ) {
ND_PRINT((ndo, "\t\tOper TLV %s(0x%x) length %d\n", ops->s, type,
- EXTRACT_BE_16BITS(&otlv->length)));
+ EXTRACT_BE_U_2(&otlv->length)));
ND_PRINT((ndo, "\t\tTruncated data size %d minimum required %d\n", tll,
OP_MIN_SIZ));
return invoptlv_print(ndo, dp, tll, ops->op_msk, indent);
return -1;
}
ND_TCHECK2(*pptr, 4);
- rescode = EXTRACT_BE_32BITS(pptr);
+ rescode = EXTRACT_BE_U_4(pptr);
if (rescode > ASTMCD) {
ND_PRINT((ndo, "illegal ASTresult result code: %d!\n", rescode));
return -1;
return -1;
}
ND_TCHECK2(*pptr, 4);
- rescode = EXTRACT_BE_32BITS(pptr);
+ rescode = EXTRACT_BE_U_4(pptr);
if (rescode > ASRMCD) {
ND_PRINT((ndo, "illegal ASRresult result code: %d!\n", rescode));
* print_metatlv() has ensured that len (what remains in the
* ILV) >= ILV_HDRL.
*/
- rlen = EXTRACT_BE_32BITS(&ilv->length) - ILV_HDRL;
+ rlen = EXTRACT_BE_U_4(&ilv->length) - ILV_HDRL;
ND_TCHECK(*ilv);
- ND_PRINT((ndo, "%sMetaID 0x%x length %d\n", ib, EXTRACT_BE_32BITS(&ilv->type),
- EXTRACT_BE_32BITS(&ilv->length)));
+ ND_PRINT((ndo, "%sMetaID 0x%x length %d\n", ib, EXTRACT_BE_U_4(&ilv->type),
+ EXTRACT_BE_U_4(&ilv->length)));
if (ndo->ndo_vflag >= 3) {
hex_print_with_offset(ndo, "\t\t[", ILV_DATA(ilv), rlen, 0);
ND_PRINT((ndo, " ]\n"));
* length is large enough but not too large (it doesn't
* go past the end of the containing TLV).
*/
- if (EXTRACT_BE_16BITS(&tlv->type) == F_TLV_METD) {
+ if (EXTRACT_BE_U_2(&tlv->type) == F_TLV_METD) {
print_metatlv(ndo, (const u_char *) TLV_DATA(tlv),
- EXTRACT_BE_16BITS(&tlv->length), 0,
+ EXTRACT_BE_U_2(&tlv->length), 0,
indent);
- } else if ((EXTRACT_BE_16BITS(&tlv->type) == F_TLV_REDD)) {
+ } else if ((EXTRACT_BE_U_2(&tlv->type) == F_TLV_REDD)) {
print_reddata(ndo, (const u_char *) TLV_DATA(tlv),
- EXTRACT_BE_16BITS(&tlv->length), 0,
+ EXTRACT_BE_U_2(&tlv->length), 0,
indent);
} else {
ND_PRINT((ndo, "Unknown REDIRECT TLV 0x%x len %d\n",
- EXTRACT_BE_16BITS(&tlv->type),
- EXTRACT_BE_16BITS(&tlv->length)));
+ EXTRACT_BE_U_2(&tlv->type),
+ EXTRACT_BE_U_2(&tlv->length)));
}
tlv = GO_NXT_TLV(tlv, rlen);
if (rlen) {
ND_PRINT((ndo,
"\n\t\tMessy Redirect TLV header, type (0x%x)\n\t\texcess of %d Bytes ",
- EXTRACT_BE_16BITS(&tlv->type),
- rlen - EXTRACT_BE_16BITS(&tlv->length)));
+ EXTRACT_BE_U_2(&tlv->type),
+ rlen - EXTRACT_BE_U_2(&tlv->length)));
return -1;
}
ND_TCHECK(*lfbs);
if (ndo->ndo_vflag >= 3) {
ND_PRINT((ndo, "\n%s%s(Classid %x) instance %x\n",
- ib, tok2str(ForCES_LFBs, NULL, EXTRACT_BE_32BITS(&lfbs->class)),
- EXTRACT_BE_32BITS(&lfbs->class),
- EXTRACT_BE_32BITS(&lfbs->instance)));
+ ib, tok2str(ForCES_LFBs, NULL, EXTRACT_BE_U_4(&lfbs->class)),
+ EXTRACT_BE_U_4(&lfbs->class),
+ EXTRACT_BE_U_4(&lfbs->instance)));
}
otlv = (const struct forces_tlv *)(lfbs + 1);
* length is large enough but not too large (it doesn't
* go past the end of the containing TLV).
*/
- if (op_valid(EXTRACT_BE_16BITS(&otlv->type), op_msk)) {
+ if (op_valid(EXTRACT_BE_U_2(&otlv->type), op_msk)) {
otlv_print(ndo, otlv, 0, indent);
} else {
if (ndo->ndo_vflag < 3)
ND_PRINT((ndo, "\n"));
ND_PRINT((ndo,
"\t\tINValid oper-TLV type 0x%x length %d for this ForCES message\n",
- EXTRACT_BE_16BITS(&otlv->type), EXTRACT_BE_16BITS(&otlv->length)));
+ EXTRACT_BE_U_2(&otlv->type), EXTRACT_BE_U_2(&otlv->length)));
invoptlv_print(ndo, (const u_char *)otlv, rlen, 0, indent);
}
otlv = GO_NXT_TLV(otlv, rlen);
if (rlen) {
ND_PRINT((ndo,
"\n\t\tMessy oper TLV header, type (0x%x)\n\t\texcess of %d Bytes ",
- EXTRACT_BE_16BITS(&otlv->type), rlen - EXTRACT_BE_16BITS(&otlv->length)));
+ EXTRACT_BE_U_2(&otlv->type), rlen - EXTRACT_BE_U_2(&otlv->length)));
return -1;
}
* length is large enough but not too large (it doesn't
* go past the end of the packet).
*/
- if (!ttlv_valid(EXTRACT_BE_16BITS(&tltlv->type))) {
+ if (!ttlv_valid(EXTRACT_BE_U_2(&tltlv->type))) {
ND_PRINT((ndo, "\n\tInvalid ForCES Top TLV type=0x%x",
- EXTRACT_BE_16BITS(&tltlv->type)));
+ EXTRACT_BE_U_2(&tltlv->type)));
return -1;
}
if (ndo->ndo_vflag >= 3)
ND_PRINT((ndo, "\t%s, length %d (data length %d Bytes)",
- tok2str(ForCES_TLV, NULL, EXTRACT_BE_16BITS(&tltlv->type)),
- EXTRACT_BE_16BITS(&tltlv->length),
- EXTRACT_BE_16BITS(&tltlv->length) - TLV_HDRL));
+ tok2str(ForCES_TLV, NULL, EXTRACT_BE_U_2(&tltlv->type)),
+ EXTRACT_BE_U_2(&tltlv->length),
+ EXTRACT_BE_U_2(&tltlv->length) - TLV_HDRL));
rc = tops->print(ndo, (const u_char *) TLV_DATA(tltlv),
- EXTRACT_BE_16BITS(&tltlv->length),
+ EXTRACT_BE_U_2(&tltlv->length),
tops->op_msk, 9);
if (rc < 0) {
return -1;
*/
if (rlen) {
ND_PRINT((ndo, "\tMess TopTLV header: min %u, total %d advertised %d ",
- TLV_HDRL, rlen, EXTRACT_BE_16BITS(&tltlv->length)));
+ TLV_HDRL, rlen, EXTRACT_BE_U_2(&tltlv->length)));
return -1;
}
}
ND_TCHECK2(*(pptr + 20), 4);
- flg_raw = EXTRACT_BE_32BITS(pptr + 20);
+ flg_raw = EXTRACT_BE_U_4(pptr + 20);
if (ndo->ndo_vflag >= 1) {
ND_PRINT((ndo, "\n\tForCES Version %d len %uB flags 0x%08x ",
ForCES_V(fhdr), mlen, flg_raw));
"\n\tSrcID 0x%x(%s) DstID 0x%x(%s) Correlator 0x%" PRIx64,
ForCES_SID(fhdr), ForCES_node(ForCES_SID(fhdr)),
ForCES_DID(fhdr), ForCES_node(ForCES_DID(fhdr)),
- EXTRACT_BE_64BITS(fhdr->fm_cor)));
+ EXTRACT_BE_U_8(fhdr->fm_cor)));
}
if (ndo->ndo_vflag >= 2) {
{
if (!ND_TTEST_1(p) || length < 1)
return -1;
- if ((EXTRACT_8BITS(p) & FR_EA_BIT))
+ if ((EXTRACT_U_1(p) & FR_EA_BIT))
return 0;
if (!ND_TTEST_1(p + 1) || length < 2)
return -1;
*addr_len = 2;
- *dlci = ((EXTRACT_8BITS(p) & 0xFC) << 2) | ((EXTRACT_8BITS(p+1) & 0xF0) >> 4);
+ *dlci = ((EXTRACT_U_1(p) & 0xFC) << 2) | ((EXTRACT_U_1(p + 1) & 0xF0) >> 4);
- flags[0] = EXTRACT_8BITS(p) & 0x02; /* populate the first flag fields */
- flags[1] = EXTRACT_8BITS(p+1) & 0x0c;
+ flags[0] = EXTRACT_U_1(p) & 0x02; /* populate the first flag fields */
+ flags[1] = EXTRACT_U_1(p + 1) & 0x0c;
flags[2] = 0; /* clear the rest of the flags */
flags[3] = 0;
- if (EXTRACT_8BITS(p+1) & FR_EA_BIT)
+ if (EXTRACT_U_1(p + 1) & FR_EA_BIT)
return 1; /* 2-byte Q.922 address */
p += 2;
if (!ND_TTEST_1(p) || length < 1)
return -1;
(*addr_len)++; /* 3- or 4-byte Q.922 address */
- if ((EXTRACT_8BITS(p) & FR_EA_BIT) == 0) {
- *dlci = (*dlci << 7) | (EXTRACT_8BITS(p) >> 1);
+ if ((EXTRACT_U_1(p) & FR_EA_BIT) == 0) {
+ *dlci = (*dlci << 7) | (EXTRACT_U_1(p) >> 1);
(*addr_len)++; /* 4-byte Q.922 address */
p++;
length--;
if (!ND_TTEST_1(p) || length < 1)
return -1;
- if ((EXTRACT_8BITS(p) & FR_EA_BIT) == 0)
+ if ((EXTRACT_U_1(p) & FR_EA_BIT) == 0)
return 0; /* more than 4 bytes of Q.922 address? */
- flags[3] = EXTRACT_8BITS(p) & 0x02;
+ flags[3] = EXTRACT_U_1(p) & 0x02;
- *dlci = (*dlci << 6) | (EXTRACT_8BITS(p) >> 2);
+ *dlci = (*dlci << 6) | (EXTRACT_U_1(p) >> 2);
return 1;
}
ND_PRINT((ndo, "Q.922, hdr-len %u, DLCI %u, Flags [%s], NLPID %s (0x%02x), length %u: ",
addr_len,
dlci,
- bittok2str(fr_header_flag_values, "none", EXTRACT_BE_32BITS(flags)),
+ bittok2str(fr_header_flag_values, "none", EXTRACT_BE_U_4(flags)),
tok2str(nlpid_values,"unknown", nlpid),
nlpid,
length));
ND_PRINT((ndo, "Q.922, hdr-len %u, DLCI %u, Flags [%s], cisco-ethertype %s (0x%04x), length %u: ",
addr_len,
dlci,
- bittok2str(fr_header_flag_values, "none", EXTRACT_BE_32BITS(flags)),
+ bittok2str(fr_header_flag_values, "none", EXTRACT_BE_U_4(flags)),
tok2str(ethertype_values, "unknown", nlpid),
nlpid,
length));
if (length < addr_len + 1)
goto trunc;
- if (EXTRACT_8BITS(p + addr_len) != LLC_UI && dlci != 0) {
+ if (EXTRACT_U_1(p + addr_len) != LLC_UI && dlci != 0) {
/*
* Let's figure out if we have Cisco-style encapsulation,
* with an Ethernet type (Cisco HDLC type?) following the
*/
if (!ND_TTEST_2(p + addr_len) || length < addr_len + 2) {
/* no Ethertype */
- ND_PRINT((ndo, "UI %02x! ", EXTRACT_8BITS(p + addr_len)));
+ ND_PRINT((ndo, "UI %02x! ", EXTRACT_U_1(p + addr_len)));
} else {
- extracted_ethertype = EXTRACT_BE_16BITS(p + addr_len);
+ extracted_ethertype = EXTRACT_BE_U_2(p + addr_len);
if (ndo->ndo_eflag)
fr_hdr_print(ndo, length, addr_len, dlci,
ndo->ndo_snapend-p-addr_len-ETHERTYPE_LEN,
NULL, NULL) == 0)
/* ether_type not known, probably it wasn't one */
- ND_PRINT((ndo, "UI %02x! ", EXTRACT_8BITS(p + addr_len)));
+ ND_PRINT((ndo, "UI %02x! ", EXTRACT_U_1(p + addr_len)));
else
return addr_len + 2;
}
if (length < addr_len + 2)
goto trunc;
- if (EXTRACT_8BITS(p + addr_len + 1) == 0) {
+ if (EXTRACT_U_1(p + addr_len + 1) == 0) {
/*
* Assume a pad byte after the control (UI) byte.
* A pad byte should only be used with 3-byte Q.922.
ND_TCHECK_1(p + hdr_len - 1);
if (length < hdr_len)
goto trunc;
- nlpid = EXTRACT_8BITS(p + hdr_len - 1);
+ nlpid = EXTRACT_U_1(p + hdr_len - 1);
if (ndo->ndo_eflag)
fr_hdr_print(ndo, length, addr_len, dlci, flags, nlpid);
ND_TCHECK2(*p, 4); /* minimum frame header length */
- if ((EXTRACT_8BITS(p) & MFR_BEC_MASK) == MFR_CTRL_FRAME && EXTRACT_8BITS(p+1) == 0) {
+ if ((EXTRACT_U_1(p) & MFR_BEC_MASK) == MFR_CTRL_FRAME && EXTRACT_U_1(p + 1) == 0) {
ND_PRINT((ndo, "FRF.16 Control, Flags [%s], %s, length %u",
- bittok2str(frf_flag_values,"none",(EXTRACT_8BITS(p) & MFR_BEC_MASK)),
- tok2str(mfr_ctrl_msg_values,"Unknown Message (0x%02x)",EXTRACT_8BITS(p+2)),
+ bittok2str(frf_flag_values,"none",(EXTRACT_U_1(p) & MFR_BEC_MASK)),
+ tok2str(mfr_ctrl_msg_values,"Unknown Message (0x%02x)",EXTRACT_U_1(p + 2)),
length));
tptr = p + 3;
tlen = length -3;
switch (ie_type) {
case MFR_CTRL_IE_MAGIC_NUM:
- ND_PRINT((ndo, "0x%08x", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "0x%08x", EXTRACT_BE_U_4(tptr)));
break;
case MFR_CTRL_IE_BUNDLE_ID: /* same message format */
* +----+----+----+----+----+----+----+----+
*/
- sequence_num = (EXTRACT_8BITS(p)&0x1e)<<7 | EXTRACT_8BITS(p+1);
+ sequence_num = (EXTRACT_U_1(p)&0x1e)<<7 | EXTRACT_U_1(p + 1);
/* whole packet or first fragment ? */
- if ((EXTRACT_8BITS(p) & MFR_BEC_MASK) == MFR_FRAG_FRAME ||
- (EXTRACT_8BITS(p) & MFR_BEC_MASK) == MFR_B_BIT) {
+ if ((EXTRACT_U_1(p) & MFR_BEC_MASK) == MFR_FRAG_FRAME ||
+ (EXTRACT_U_1(p) & MFR_BEC_MASK) == MFR_B_BIT) {
ND_PRINT((ndo, "FRF.16 Frag, seq %u, Flags [%s], ",
sequence_num,
- bittok2str(frf_flag_values,"none",(EXTRACT_8BITS(p) & MFR_BEC_MASK))));
+ bittok2str(frf_flag_values,"none",(EXTRACT_U_1(p) & MFR_BEC_MASK))));
hdr_len = 2;
fr_print(ndo, p+hdr_len,length-hdr_len);
return hdr_len;
/* must be a middle or the last fragment */
ND_PRINT((ndo, "FRF.16 Frag, seq %u, Flags [%s]",
sequence_num,
- bittok2str(frf_flag_values,"none",(EXTRACT_8BITS(p) & MFR_BEC_MASK))));
+ bittok2str(frf_flag_values,"none",(EXTRACT_U_1(p) & MFR_BEC_MASK))));
print_unknown_data(ndo, p, "\n\t", length);
return hdr_len;
goto trunc;
ND_TCHECK2(*p, 2);
- flags = EXTRACT_8BITS(p)&MFR_BEC_MASK;
- sequence_num = (EXTRACT_8BITS(p)&0x1e)<<7 | EXTRACT_8BITS(p+1);
+ flags = EXTRACT_U_1(p)&MFR_BEC_MASK;
+ sequence_num = (EXTRACT_U_1(p)&0x1e)<<7 | EXTRACT_U_1(p + 1);
ND_PRINT((ndo, "FRF.15, seq 0x%03x, Flags [%s],%s Fragmentation, length %u",
sequence_num,
bittok2str(frf_flag_values,"none",flags),
- EXTRACT_8BITS(p)&FR_FRF15_FRAGTYPE ? "Interface" : "End-to-End",
+ EXTRACT_U_1(p)&FR_FRF15_FRAGTYPE ? "Interface" : "End-to-End",
length));
/* TODO:
* Get the length of the call reference value.
*/
olen = length; /* preserve the original length for display */
- call_ref_length = EXTRACT_8BITS(p) & 0x0f;
+ call_ref_length = EXTRACT_U_1(p) & 0x0f;
p++;
length--;
ND_PRINT((ndo, "length %u", olen));
goto trunc;
}
- call_ref[i] = EXTRACT_8BITS(p);
+ call_ref[i] = EXTRACT_U_1(p);
p++;
length--;
}
ND_PRINT((ndo, "length %u", olen));
goto trunc;
}
- msgtype = EXTRACT_8BITS(p);
+ msgtype = EXTRACT_U_1(p);
p++;
length--;
ND_PRINT((ndo, "length %u", olen));
goto trunc;
}
- iecode = EXTRACT_8BITS(p);
+ iecode = EXTRACT_U_1(p);
if (IE_IS_SHIFT(iecode)) {
/*
* It's a shift. Skip over it.
if (call_ref_length != 0) {
ND_TCHECK_1(p);
- if (call_ref_length > 1 || EXTRACT_8BITS(p) != 0) {
+ if (call_ref_length > 1 || EXTRACT_U_1(p) != 0) {
/*
* Not a dummy call reference.
*/
}
goto trunc;
}
- iecode = EXTRACT_8BITS(p);
+ iecode = EXTRACT_U_1(p);
p++;
length--;
}
goto trunc;
}
- ielength = EXTRACT_8BITS(p);
+ ielength = EXTRACT_U_1(p);
p++;
length--;
}
if (ndo->ndo_vflag) {
ND_PRINT((ndo, "%s (%u)",
- tok2str(fr_lmi_report_type_ie_values,"unknown",EXTRACT_8BITS(p)),
- EXTRACT_8BITS(p)));
+ tok2str(fr_lmi_report_type_ie_values,"unknown",EXTRACT_U_1(p)),
+ EXTRACT_U_1(p)));
}
return 1;
ND_PRINT((ndo, "Invalid LINK VERIFY IE"));
return 1;
}
- ND_PRINT((ndo, "TX Seq: %3d, RX Seq: %3d", EXTRACT_8BITS(p), EXTRACT_8BITS(p+1)));
+ ND_PRINT((ndo, "TX Seq: %3d, RX Seq: %3d", EXTRACT_U_1(p), EXTRACT_U_1(p + 1)));
return 1;
case FR_LMI_ANSI_PVC_STATUS_IE: /* fall through */
}
/* now parse the DLCI information element. */
if ((ielength < 3) ||
- (EXTRACT_8BITS(p) & 0x80) ||
- ((ielength == 3) && !(EXTRACT_8BITS(p+1) & 0x80)) ||
+ (EXTRACT_U_1(p) & 0x80) ||
+ ((ielength == 3) && !(EXTRACT_U_1(p + 1) & 0x80)) ||
((ielength == 4) &&
- ((EXTRACT_8BITS(p+1) & 0x80) || !(EXTRACT_8BITS(p+2) & 0x80))) ||
+ ((EXTRACT_U_1(p + 1) & 0x80) || !(EXTRACT_U_1(p + 2) & 0x80))) ||
((ielength == 5) &&
- ((EXTRACT_8BITS(p+1) & 0x80) || (EXTRACT_8BITS(p+2) & 0x80) ||
- !(EXTRACT_8BITS(p+3) & 0x80))) ||
+ ((EXTRACT_U_1(p + 1) & 0x80) || (EXTRACT_U_1(p + 2) & 0x80) ||
+ !(EXTRACT_U_1(p + 3) & 0x80))) ||
(ielength > 5) ||
- !(EXTRACT_8BITS(p + ielength - 1) & 0x80)) {
+ !(EXTRACT_U_1(p + ielength - 1) & 0x80)) {
ND_PRINT((ndo, "Invalid DLCI in PVC STATUS IE"));
return 1;
}
- dlci = ((EXTRACT_8BITS(p) & 0x3F) << 4) | ((EXTRACT_8BITS(p+1) & 0x78) >> 3);
+ dlci = ((EXTRACT_U_1(p) & 0x3F) << 4) | ((EXTRACT_U_1(p + 1) & 0x78) >> 3);
if (ielength == 4) {
- dlci = (dlci << 6) | ((EXTRACT_8BITS(p+2) & 0x7E) >> 1);
+ dlci = (dlci << 6) | ((EXTRACT_U_1(p + 2) & 0x7E) >> 1);
}
else if (ielength == 5) {
- dlci = (dlci << 13) | (EXTRACT_8BITS(p+2) & 0x7F) | ((EXTRACT_8BITS(p+3) & 0x7E) >> 1);
+ dlci = (dlci << 13) | (EXTRACT_U_1(p + 2) & 0x7F) | ((EXTRACT_U_1(p + 3) & 0x7E) >> 1);
}
ND_PRINT((ndo, "DLCI %u: status %s%s", dlci,
- EXTRACT_8BITS(p + ielength - 1) & 0x8 ? "New, " : "",
- EXTRACT_8BITS(p + ielength - 1) & 0x2 ? "Active" : "Inactive"));
+ EXTRACT_U_1(p + ielength - 1) & 0x8 ? "New, " : "",
+ EXTRACT_U_1(p + ielength - 1) & 0x2 ? "Active" : "Inactive"));
return 1;
}
if (ndo->ndo_vflag) {
ND_PRINT((ndo, "frag (0x%08x:%d|%ld)",
- EXTRACT_BE_32BITS(&dp->ip6f_ident),
- EXTRACT_BE_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,
- sizeof(struct ip6_hdr) + EXTRACT_BE_16BITS(&ip6->ip6_plen) -
+ EXTRACT_BE_U_4(&dp->ip6f_ident),
+ EXTRACT_BE_U_2(&dp->ip6f_offlg) & IP6F_OFF_MASK,
+ sizeof(struct ip6_hdr) + EXTRACT_BE_U_2(&ip6->ip6_plen) -
(long)(bp - bp2) - sizeof(struct ip6_frag)));
} else {
ND_PRINT((ndo, "frag (%d|%ld)",
- EXTRACT_BE_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,
- sizeof(struct ip6_hdr) + EXTRACT_BE_16BITS(&ip6->ip6_plen) -
+ EXTRACT_BE_U_2(&dp->ip6f_offlg) & IP6F_OFF_MASK,
+ sizeof(struct ip6_hdr) + EXTRACT_BE_U_2(&ip6->ip6_plen) -
(long)(bp - bp2) - sizeof(struct ip6_frag)));
}
/* it is meaningless to decode non-first fragment */
- if ((EXTRACT_BE_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK) != 0)
+ if ((EXTRACT_BE_U_2(&dp->ip6f_offlg) & IP6F_OFF_MASK) != 0)
return -1;
else
{
ND_PRINT((ndo, "%s", sep));
sep = ", ";
- opt_class = EXTRACT_BE_16BITS(bp);
- opt_type = EXTRACT_8BITS(bp + 2);
+ opt_class = EXTRACT_BE_U_2(bp);
+ opt_type = EXTRACT_U_1(bp + 2);
opt_len = 4 + ((*(bp + 3) & OPT_LEN_MASK) * 4);
ND_PRINT((ndo, "class %s (0x%x) type 0x%x%s len %u",
ND_PRINT((ndo, " data"));
for (i = 4; i < opt_len; i += 4) {
- ND_PRINT((ndo, " %08x", EXTRACT_BE_32BITS(data)));
+ ND_PRINT((ndo, " %08x", EXTRACT_BE_U_4(data)));
data++;
}
}
ND_TCHECK2(*bp, 8);
- ver_opt = EXTRACT_8BITS(bp);
+ ver_opt = EXTRACT_U_1(bp);
bp += 1;
len -= 1;
return;
}
- flags = EXTRACT_8BITS(bp);
+ flags = EXTRACT_U_1(bp);
bp += 1;
len -= 1;
- prot = EXTRACT_BE_16BITS(bp);
+ prot = EXTRACT_BE_U_2(bp);
bp += 2;
len -= 2;
- vni = EXTRACT_BE_24BITS(bp);
+ vni = EXTRACT_BE_U_3(bp);
bp += 3;
len -= 3;
- reserved = EXTRACT_8BITS(bp);
+ reserved = EXTRACT_U_1(bp);
bp += 1;
len -= 1;
print_btp(netdissect_options *ndo,
const u_char *bp)
{
- uint16_t dest = EXTRACT_BE_16BITS(bp + 0);
- uint16_t src = EXTRACT_BE_16BITS(bp + 2);
+ uint16_t dest = EXTRACT_BE_U_2(bp + 0);
+ uint16_t src = EXTRACT_BE_U_2(bp + 2);
ND_PRINT((ndo, "; BTP Dst:%u Src:%u", dest, src));
}
if (!ND_TTEST2(*(bp+12), 8))
return (-1);
- lat = EXTRACT_BE_32BITS(bp + 12);
+ lat = EXTRACT_BE_U_4(bp + 12);
ND_PRINT((ndo, "lat:%d ", lat));
- lon = EXTRACT_BE_32BITS(bp + 16);
+ lon = EXTRACT_BE_U_4(bp + 16);
ND_PRINT((ndo, "lon:%d", lon));
return (0);
}
next_hdr = bp[0] & 0x0f;
hdr_type = bp[1] >> 4;
hdr_subtype = bp[1] & 0x0f;
- payload_length = EXTRACT_BE_16BITS(bp + 4);
+ payload_length = EXTRACT_BE_U_2(bp + 4);
hop_limit = bp[7];
switch (next_hdr) {
ND_TCHECK2(*bp, 2);
if (len < 2)
goto trunc;
- vers = EXTRACT_BE_16BITS(bp) & GRE_VERS_MASK;
+ vers = EXTRACT_BE_U_2(bp) & GRE_VERS_MASK;
ND_PRINT((ndo, "GREv%u",vers));
switch(vers) {
uint16_t flags, prot;
/* 16 bits ND_TCHECKed in gre_print() */
- flags = EXTRACT_BE_16BITS(bp);
+ flags = EXTRACT_BE_U_2(bp);
if (ndo->ndo_vflag)
ND_PRINT((ndo, ", Flags [%s]",
bittok2str(gre_flag_values,"none",flags)));
ND_TCHECK2(*bp, 2);
if (len < 2)
goto trunc;
- prot = EXTRACT_BE_16BITS(bp);
+ prot = EXTRACT_BE_U_2(bp);
len -= 2;
bp += 2;
if (len < 2)
goto trunc;
if (ndo->ndo_vflag)
- ND_PRINT((ndo, ", sum 0x%x", EXTRACT_BE_16BITS(bp)));
+ ND_PRINT((ndo, ", sum 0x%x", EXTRACT_BE_U_2(bp)));
bp += 2;
len -= 2;
ND_TCHECK2(*bp, 2);
if (len < 2)
goto trunc;
- ND_PRINT((ndo, ", off 0x%x", EXTRACT_BE_16BITS(bp)));
+ ND_PRINT((ndo, ", off 0x%x", EXTRACT_BE_U_2(bp)));
bp += 2;
len -= 2;
}
ND_TCHECK2(*bp, 4);
if (len < 4)
goto trunc;
- ND_PRINT((ndo, ", key=0x%x", EXTRACT_BE_32BITS(bp)));
+ ND_PRINT((ndo, ", key=0x%x", EXTRACT_BE_U_4(bp)));
bp += 4;
len -= 4;
}
ND_TCHECK2(*bp, 4);
if (len < 4)
goto trunc;
- ND_PRINT((ndo, ", seq %u", EXTRACT_BE_32BITS(bp)));
+ ND_PRINT((ndo, ", seq %u", EXTRACT_BE_U_4(bp)));
bp += 4;
len -= 4;
}
ND_TCHECK2(*bp, 4);
if (len < 4)
goto trunc;
- af = EXTRACT_BE_16BITS(bp);
- sreoff = EXTRACT_8BITS(bp + 2);
- srelen = EXTRACT_8BITS(bp + 3);
+ af = EXTRACT_BE_U_2(bp);
+ sreoff = EXTRACT_U_1(bp + 2);
+ srelen = EXTRACT_U_1(bp + 3);
bp += 4;
len -= 4;
uint16_t flags, prot;
/* 16 bits ND_TCHECKed in gre_print() */
- flags = EXTRACT_BE_16BITS(bp);
+ flags = EXTRACT_BE_U_2(bp);
len -= 2;
bp += 2;
ND_TCHECK2(*bp, 2);
if (len < 2)
goto trunc;
- prot = EXTRACT_BE_16BITS(bp);
+ prot = EXTRACT_BE_U_2(bp);
len -= 2;
bp += 2;
ND_TCHECK2(*bp, 4);
if (len < 4)
goto trunc;
- k = EXTRACT_BE_32BITS(bp);
+ k = EXTRACT_BE_U_4(bp);
ND_PRINT((ndo, ", call %d", k & 0xffff));
len -= 4;
bp += 4;
ND_TCHECK2(*bp, 4);
if (len < 4)
goto trunc;
- ND_PRINT((ndo, ", seq %u", EXTRACT_BE_32BITS(bp)));
+ ND_PRINT((ndo, ", seq %u", EXTRACT_BE_U_4(bp)));
bp += 4;
len -= 4;
}
ND_TCHECK2(*bp, 4);
if (len < 4)
goto trunc;
- ND_PRINT((ndo, ", ack %u", EXTRACT_BE_32BITS(bp)));
+ ND_PRINT((ndo, ", ack %u", EXTRACT_BE_U_4(bp)));
bp += 4;
len -= 4;
}
ND_PRINT((ndo, " %s%x",
((bp - up) == sreoff) ? "*" : "",
- EXTRACT_BE_16BITS(bp)));
+ EXTRACT_BE_U_2(bp)));
bp += 2;
len -= 2;
static int i = 0;
i = (i + 1) % 4;
snprintf(buf[i], sizeof(buf[i]), "%016" PRIx64 "%016" PRIx64 "%016" PRIx64 "%016" PRIx64,
- EXTRACT_BE_64BITS(data),
- EXTRACT_BE_64BITS(data + 8),
- EXTRACT_BE_64BITS(data + 16),
- EXTRACT_BE_64BITS(data + 24)
+ EXTRACT_BE_U_8(data),
+ EXTRACT_BE_U_8(data + 8),
+ EXTRACT_BE_U_8(data + 16),
+ EXTRACT_BE_U_8(data + 24)
);
return buf[i];
}
if (i + 4 > length)
return -1;
tlv = cp + i;
- type = EXTRACT_BE_16BITS(tlv);
- optlen = EXTRACT_BE_16BITS(tlv + 2);
+ type = EXTRACT_BE_U_2(tlv);
+ optlen = EXTRACT_BE_U_2(tlv + 2);
value = tlv + 4;
ND_PRINT((ndo, "\n"));
if (i + 4 > length)
goto invalid;
- type = EXTRACT_BE_16BITS(tlv);
- bodylen = EXTRACT_BE_16BITS(tlv + 2);
+ type = EXTRACT_BE_U_2(tlv);
+ bodylen = EXTRACT_BE_U_2(tlv + 2);
value = tlv + 4;
ND_TCHECK2(*value, bodylen);
if (i + bodylen + 4 > length)
break;
}
node_identifier = format_nid(value);
- endpoint_identifier = EXTRACT_BE_32BITS(value + 4);
+ endpoint_identifier = EXTRACT_BE_U_4(value + 4);
ND_PRINT((ndo, " NID: %s EPID: %08x",
node_identifier,
endpoint_identifier
ND_PRINT((ndo, " %s", istr));
break;
}
- hash = EXTRACT_BE_64BITS(value);
+ hash = EXTRACT_BE_U_8(value);
ND_PRINT((ndo, " hash: %016" PRIx64, hash));
}
break;
break;
}
node_identifier = format_nid(value);
- sequence_number = EXTRACT_BE_32BITS(value + 4);
- interval = format_interval(EXTRACT_BE_32BITS(value + 8));
- hash = EXTRACT_BE_64BITS(value + 12);
+ sequence_number = EXTRACT_BE_U_4(value + 4);
+ interval = format_interval(EXTRACT_BE_U_4(value + 8));
+ hash = EXTRACT_BE_U_8(value + 12);
ND_PRINT((ndo, " NID: %s seqno: %u %s hash: %016" PRIx64,
node_identifier,
sequence_number,
break;
}
peer_node_identifier = format_nid(value);
- peer_endpoint_identifier = EXTRACT_BE_32BITS(value + 4);
- endpoint_identifier = EXTRACT_BE_32BITS(value + 8);
+ peer_endpoint_identifier = EXTRACT_BE_U_4(value + 4);
+ endpoint_identifier = EXTRACT_BE_U_4(value + 8);
ND_PRINT((ndo, " Peer-NID: %s Peer-EPID: %08x Local-EPID: %08x",
peer_node_identifier,
peer_endpoint_identifier,
ND_PRINT((ndo, " %s", istr));
break;
}
- endpoint_identifier = EXTRACT_BE_32BITS(value);
- interval = format_interval(EXTRACT_BE_32BITS(value + 4));
+ endpoint_identifier = EXTRACT_BE_U_4(value);
+ interval = format_interval(EXTRACT_BE_U_4(value + 4));
ND_PRINT((ndo, " EPID: %08x Interval: %s",
endpoint_identifier,
interval
break;
}
ND_PRINT((ndo, " Verdict: %u Fingerprint: %s Common Name: ",
- EXTRACT_8BITS(value),
+ EXTRACT_U_1(value),
format_256(value + 4)));
safeputs(ndo, value + 36, bodylen - 36);
}
ND_PRINT((ndo, " %s", istr));
break;
}
- capabilities = EXTRACT_BE_16BITS(value + 2);
+ capabilities = EXTRACT_BE_U_2(value + 2);
M = (uint8_t)((capabilities >> 12) & 0xf);
P = (uint8_t)((capabilities >> 8) & 0xf);
H = (uint8_t)((capabilities >> 4) & 0xf);
break;
}
ND_PRINT((ndo, " VLSO: %s PLSO: %s Prefix: ",
- format_interval(EXTRACT_BE_32BITS(value)),
- format_interval(EXTRACT_BE_32BITS(value + 4))
+ format_interval(EXTRACT_BE_U_4(value)),
+ format_interval(EXTRACT_BE_U_4(value + 4))
));
l = print_prefix(ndo, value + 8, bodylen - 8);
if (l == -1) {
}
prty = value[4] & 0xf;
ND_PRINT((ndo, " EPID: %08x Prty: %u",
- EXTRACT_BE_32BITS(value),
+ EXTRACT_BE_U_4(value),
prty
));
ND_PRINT((ndo, " Prefix: "));
ND_PRINT((ndo, " %s", istr));
break;
}
- endpoint_identifier = EXTRACT_BE_32BITS(value);
+ endpoint_identifier = EXTRACT_BE_U_4(value);
ip_address = format_ip6addr(ndo, value + 4);
ND_PRINT((ndo, " EPID: %08x IP Address: %s",
endpoint_identifier,
(void)snprintf(buf, sizeof(buf), "echo %s, id %u, seq %u",
dp->icmp_type == ICMP_ECHO ?
"request" : "reply",
- EXTRACT_BE_16BITS(&dp->icmp_id),
- EXTRACT_BE_16BITS(&dp->icmp_seq));
+ EXTRACT_BE_U_2(&dp->icmp_id),
+ EXTRACT_BE_U_2(&dp->icmp_seq));
break;
case ICMP_UNREACH:
hlen = IP_HL(oip) * 4;
ouh = (const struct udphdr *)(((const u_char *)oip) + hlen);
ND_TCHECK(ouh->uh_dport);
- dport = EXTRACT_BE_16BITS(&ouh->uh_dport);
+ dport = EXTRACT_BE_U_2(&ouh->uh_dport);
switch (oip->ip_p) {
case IPPROTO_TCP:
{
register const struct mtu_discovery *mp;
mp = (const struct mtu_discovery *)(const u_char *)&dp->icmp_void;
- mtu = EXTRACT_BE_16BITS(&mp->nexthopmtu);
+ mtu = EXTRACT_BE_U_2(&mp->nexthopmtu);
if (mtu) {
(void)snprintf(buf, sizeof(buf),
"%s unreachable - need to frag (mtu %d)",
ND_TCHECK(*ihp);
(void)strncpy(cp, " lifetime ", sizeof(buf) - (cp - buf));
cp = buf + strlen(buf);
- lifetime = EXTRACT_BE_16BITS(&ihp->ird_lifetime);
+ lifetime = EXTRACT_BE_U_2(&ihp->ird_lifetime);
if (lifetime < 60) {
(void)snprintf(cp, sizeof(buf) - (cp - buf), "%u",
lifetime);
ND_TCHECK(*idp);
(void)snprintf(cp, sizeof(buf) - (cp - buf), " {%s %u}",
ipaddr_string(ndo, &idp->ird_addr),
- EXTRACT_BE_32BITS(&idp->ird_pref));
+ EXTRACT_BE_U_4(&idp->ird_pref));
cp = buf + strlen(buf);
++idp;
}
case ICMP_MASKREPLY:
ND_TCHECK(dp->icmp_mask);
(void)snprintf(buf, sizeof(buf), "address mask is 0x%08x",
- EXTRACT_BE_32BITS(&dp->icmp_mask));
+ EXTRACT_BE_U_4(&dp->icmp_mask));
break;
case ICMP_TSTAMP:
ND_TCHECK(dp->icmp_seq);
(void)snprintf(buf, sizeof(buf),
"time stamp query id %u seq %u",
- EXTRACT_BE_16BITS(&dp->icmp_id),
- EXTRACT_BE_16BITS(&dp->icmp_seq));
+ EXTRACT_BE_U_2(&dp->icmp_id),
+ EXTRACT_BE_U_2(&dp->icmp_seq));
break;
case ICMP_TSTAMPREPLY:
ND_TCHECK(dp->icmp_ttime);
(void)snprintf(buf, sizeof(buf),
"time stamp reply id %u seq %u: org %s",
- EXTRACT_BE_16BITS(&dp->icmp_id),
- EXTRACT_BE_16BITS(&dp->icmp_seq),
- icmp_tstamp_print(EXTRACT_BE_32BITS(&dp->icmp_otime)));
+ EXTRACT_BE_U_2(&dp->icmp_id),
+ EXTRACT_BE_U_2(&dp->icmp_seq),
+ icmp_tstamp_print(EXTRACT_BE_U_4(&dp->icmp_otime)));
(void)snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", recv %s",
- icmp_tstamp_print(EXTRACT_BE_32BITS(&dp->icmp_rtime)));
+ icmp_tstamp_print(EXTRACT_BE_U_4(&dp->icmp_rtime)));
(void)snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", xmit %s",
- icmp_tstamp_print(EXTRACT_BE_32BITS(&dp->icmp_ttime)));
+ icmp_tstamp_print(EXTRACT_BE_U_4(&dp->icmp_ttime)));
break;
default:
vec[0].len = plen;
sum = in_cksum(vec, 1);
if (sum != 0) {
- uint16_t icmp_sum = EXTRACT_BE_16BITS(&dp->icmp_cksum);
+ uint16_t icmp_sum = EXTRACT_BE_U_2(&dp->icmp_cksum);
ND_PRINT((ndo, " (wrong icmp cksum %x (->%x)!)",
icmp_sum,
in_cksum_shouldbe(icmp_sum, sum)));
ip = (const struct ip *)bp;
snapend_save = ndo->ndo_snapend;
ND_TCHECK_2(&ip->ip_len);
- ip_print(ndo, bp, EXTRACT_BE_16BITS(&ip->ip_len));
+ ip_print(ndo, bp, EXTRACT_BE_U_2(&ip->ip_len));
ndo->ndo_snapend = snapend_save;
}
vec[0].ptr = (const uint8_t *)(const void *)&ext_dp->icmp_ext_version_res;
vec[0].len = hlen;
ND_PRINT((ndo, ", checksum 0x%04x (%scorrect), length %u",
- EXTRACT_BE_16BITS(ext_dp->icmp_ext_checksum),
+ EXTRACT_BE_U_2(ext_dp->icmp_ext_checksum),
in_cksum(vec, 1) ? "in" : "",
hlen));
}
icmp_mpls_ext_object_header = (const struct icmp_mpls_ext_object_header_t *)obj_tptr;
ND_TCHECK(*icmp_mpls_ext_object_header);
- obj_tlen = EXTRACT_BE_16BITS(icmp_mpls_ext_object_header->length);
+ obj_tlen = EXTRACT_BE_U_2(icmp_mpls_ext_object_header->length);
obj_class_num = icmp_mpls_ext_object_header->class_num;
obj_ctype = icmp_mpls_ext_object_header->ctype;
obj_tptr += sizeof(struct icmp_mpls_ext_object_header_t);
switch(obj_ctype) {
case 1:
ND_TCHECK2(*obj_tptr, 4);
- raw_label = EXTRACT_BE_32BITS(obj_tptr);
+ raw_label = EXTRACT_BE_U_4(obj_tptr);
ND_PRINT((ndo, "\n\t label %u, exp %u", MPLS_LABEL(raw_label), MPLS_EXP(raw_label)));
if (MPLS_STACK(raw_label))
ND_PRINT((ndo, ", [S]"));
while (l > 0 && q < ep) {
if (q > p)
ND_PRINT((ndo,":"));
- ND_PRINT((ndo,"%02x", EXTRACT_8BITS(q)));
+ ND_PRINT((ndo,"%02x", EXTRACT_U_1(q)));
q++;
l--;
}
dagid_str,
dio->rpl_dtsn,
dio->rpl_instanceid,
- EXTRACT_BE_16BITS(&dio->rpl_dagrank),
+ EXTRACT_BE_U_2(&dio->rpl_dagrank),
RPL_DIO_GROUNDED(dio->rpl_mopprf) ? "grounded,":"",
tok2str(rpl_mop_values, "mop%u", RPL_DIO_MOP(dio->rpl_mopprf)),
RPL_DIO_PRF(dio->rpl_mopprf)));
uint16_t sum, udp_sum;
if (ND_TTEST2(bp[0], length)) {
- udp_sum = EXTRACT_BE_16BITS(&dp->icmp6_cksum);
+ udp_sum = EXTRACT_BE_U_2(&dp->icmp6_cksum);
sum = icmp6_cksum(ndo, ip, dp, length);
if (sum != 0)
ND_PRINT((ndo,"[bad icmp6 cksum 0x%04x -> 0x%04x!] ",
== NULL)
goto trunc;
- dport = EXTRACT_BE_16BITS(&ouh->uh_dport);
+ dport = EXTRACT_BE_U_2(&ouh->uh_dport);
switch (prot) {
case IPPROTO_TCP:
ND_PRINT((ndo,", %s tcp port %s",
break;
case ICMP6_PACKET_TOO_BIG:
ND_TCHECK(dp->icmp6_mtu);
- ND_PRINT((ndo,", mtu %u", EXTRACT_BE_32BITS(&dp->icmp6_mtu)));
+ ND_PRINT((ndo,", mtu %u", EXTRACT_BE_U_4(&dp->icmp6_mtu)));
break;
case ICMP6_TIME_EXCEEDED:
ND_TCHECK(oip->ip6_dst);
ND_TCHECK(oip->ip6_dst);
switch (dp->icmp6_code) {
case ICMP6_PARAMPROB_HEADER:
- ND_PRINT((ndo,", erroneous - octet %u", EXTRACT_BE_32BITS(&dp->icmp6_pptr)));
+ ND_PRINT((ndo,", erroneous - octet %u", EXTRACT_BE_U_4(&dp->icmp6_pptr)));
break;
case ICMP6_PARAMPROB_NEXTHEADER:
- ND_PRINT((ndo,", next header - octet %u", EXTRACT_BE_32BITS(&dp->icmp6_pptr)));
+ ND_PRINT((ndo,", next header - octet %u", EXTRACT_BE_U_4(&dp->icmp6_pptr)));
break;
case ICMP6_PARAMPROB_OPTION:
- ND_PRINT((ndo,", option - octet %u", EXTRACT_BE_32BITS(&dp->icmp6_pptr)));
+ ND_PRINT((ndo,", option - octet %u", EXTRACT_BE_U_4(&dp->icmp6_pptr)));
break;
default:
ND_PRINT((ndo,", code-#%d",
case ICMP6_ECHO_REQUEST:
case ICMP6_ECHO_REPLY:
ND_TCHECK(dp->icmp6_seq);
- ND_PRINT((ndo,", seq %u", EXTRACT_BE_16BITS(&dp->icmp6_seq)));
+ ND_PRINT((ndo,", seq %u", EXTRACT_BE_U_2(&dp->icmp6_seq)));
break;
case ICMP6_MEMBERSHIP_QUERY:
if (length == MLD_MINLEN) {
(u_int)p->nd_ra_curhoplimit,
bittok2str(icmp6_opt_ra_flag_values,"none",(p->nd_ra_flags_reserved)),
get_rtpref(p->nd_ra_flags_reserved),
- EXTRACT_BE_16BITS(&p->nd_ra_router_lifetime),
- EXTRACT_BE_32BITS(&p->nd_ra_reachable),
- EXTRACT_BE_32BITS(&p->nd_ra_retransmit)));
+ EXTRACT_BE_U_2(&p->nd_ra_router_lifetime),
+ EXTRACT_BE_U_4(&p->nd_ra_reachable),
+ EXTRACT_BE_U_4(&p->nd_ra_retransmit)));
icmp6_opt_print(ndo, (const u_char *)dp + RTADVLEN,
length - RTADVLEN);
ND_PRINT((ndo,", Flags [%s]",
bittok2str(icmp6_nd_na_flag_values,
"none",
- EXTRACT_BE_32BITS(&p->nd_na_flags_reserved))));
+ EXTRACT_BE_U_4(&p->nd_na_flags_reserved))));
#define NDADVLEN 24
icmp6_opt_print(ndo, (const u_char *)dp + NDADVLEN,
length - NDADVLEN);
case ICMP6_MOBILEPREFIX_SOLICIT: /* fall through */
case ICMP6_HADISCOV_REQUEST:
ND_TCHECK(dp->icmp6_data16[0]);
- ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_16BITS(&dp->icmp6_data16[0])));
+ ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_U_2(&dp->icmp6_data16[0])));
break;
case ICMP6_HADISCOV_REPLY:
if (ndo->ndo_vflag) {
const u_char *cp;
ND_TCHECK(dp->icmp6_data16[0]);
- ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_16BITS(&dp->icmp6_data16[0])));
+ ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_U_2(&dp->icmp6_data16[0])));
cp = (const u_char *)dp + length;
in6 = (const struct in6_addr *)(dp + 1);
for (; (const u_char *)in6 < cp; in6++) {
case ICMP6_MOBILEPREFIX_ADVERT:
if (ndo->ndo_vflag) {
ND_TCHECK(dp->icmp6_data16[0]);
- ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_16BITS(&dp->icmp6_data16[0])));
+ ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_U_2(&dp->icmp6_data16[0])));
ND_TCHECK(dp->icmp6_data16[1]);
if (dp->icmp6_data16[1] & 0xc0)
ND_PRINT((ndo," "));
if (!ND_TTEST(fragh->ip6f_offlg))
return(NULL);
/* fragments with non-zero offset are meaningless */
- if ((EXTRACT_BE_16BITS(&fragh->ip6f_offlg) & IP6F_OFF_MASK) != 0)
+ if ((EXTRACT_BE_U_2(&fragh->ip6f_offlg) & IP6F_OFF_MASK) != 0)
return(NULL);
nh = fragh->ip6f_nxt;
hlen = sizeof(struct ip6_frag);
opp->nd_opt_pi_prefix_len,
(op->nd_opt_len != 4) ? "badlen" : "",
bittok2str(icmp6_opt_pi_flag_values, "none", opp->nd_opt_pi_flags_reserved),
- get_lifetime(EXTRACT_BE_32BITS(&opp->nd_opt_pi_valid_time))));
- ND_PRINT((ndo,", pref. time %s", get_lifetime(EXTRACT_BE_32BITS(&opp->nd_opt_pi_preferred_time))));
+ get_lifetime(EXTRACT_BE_U_4(&opp->nd_opt_pi_valid_time))));
+ ND_PRINT((ndo,", pref. time %s", get_lifetime(EXTRACT_BE_U_4(&opp->nd_opt_pi_preferred_time))));
break;
case ND_OPT_REDIRECTED_HEADER:
print_unknown_data(ndo, bp,"\n\t ",op->nd_opt_len<<3);
opm = (const struct nd_opt_mtu *)op;
ND_TCHECK(opm->nd_opt_mtu_mtu);
ND_PRINT((ndo," %u%s",
- EXTRACT_BE_32BITS(&opm->nd_opt_mtu_mtu),
+ EXTRACT_BE_U_4(&opm->nd_opt_mtu_mtu),
(op->nd_opt_len != 1) ? "bad option length" : "" ));
break;
case ND_OPT_RDNSS:
oprd = (const struct nd_opt_rdnss *)op;
l = (op->nd_opt_len - 1) / 2;
ND_PRINT((ndo," lifetime %us,",
- EXTRACT_BE_32BITS(&oprd->nd_opt_rdnss_lifetime)));
+ EXTRACT_BE_U_4(&oprd->nd_opt_rdnss_lifetime)));
for (i = 0; i < l; i++) {
ND_TCHECK(oprd->nd_opt_rdnss_addr[i]);
ND_PRINT((ndo," addr: %s",
case ND_OPT_DNSSL:
opds = (const struct nd_opt_dnssl *)op;
ND_PRINT((ndo," lifetime %us, domain(s):",
- EXTRACT_BE_32BITS(&opds->nd_opt_dnssl_lifetime)));
+ EXTRACT_BE_U_4(&opds->nd_opt_dnssl_lifetime)));
domp = cp + 8; /* domain names, variable-sized, RFC1035-encoded */
while (domp < cp + (op->nd_opt_len << 3) && *domp != '\0')
{
case ND_OPT_ADVINTERVAL:
opa = (const struct nd_opt_advinterval *)op;
ND_TCHECK(opa->nd_opt_adv_interval);
- ND_PRINT((ndo," %ums", EXTRACT_BE_32BITS(&opa->nd_opt_adv_interval)));
+ ND_PRINT((ndo," %ums", EXTRACT_BE_U_4(&opa->nd_opt_adv_interval)));
break;
case ND_OPT_HOMEAGENT_INFO:
oph = (const struct nd_opt_homeagent_info *)op;
ND_TCHECK(oph->nd_opt_hai_lifetime);
ND_PRINT((ndo," preference %u, lifetime %u",
- EXTRACT_BE_16BITS(&oph->nd_opt_hai_preference),
- EXTRACT_BE_16BITS(&oph->nd_opt_hai_lifetime)));
+ EXTRACT_BE_U_2(&oph->nd_opt_hai_preference),
+ EXTRACT_BE_U_2(&oph->nd_opt_hai_lifetime)));
break;
case ND_OPT_ROUTE_INFO:
opri = (const struct nd_opt_route_info *)op;
opri->nd_opt_rti_prefixlen));
ND_PRINT((ndo,", pref=%s", get_rtpref(opri->nd_opt_rti_flags)));
ND_PRINT((ndo,", lifetime=%s",
- get_lifetime(EXTRACT_BE_32BITS(&opri->nd_opt_rti_lifetime))));
+ get_lifetime(EXTRACT_BE_U_4(&opri->nd_opt_rti_lifetime))));
break;
default:
if (ndo->ndo_vflag <= 1) {
if ((const u_char *)mp + sizeof(*mp) > ep)
return;
- ND_PRINT((ndo,"max resp delay: %d ", EXTRACT_BE_16BITS(&mp->mld6_maxdelay)));
+ ND_PRINT((ndo,"max resp delay: %d ", EXTRACT_BE_U_2(&mp->mld6_maxdelay)));
ND_PRINT((ndo,"addr: %s", ip6addr_string(ndo, &mp->mld6_addr)));
}
}
ND_TCHECK(icp->icmp6_data16[1]);
- ngroups = EXTRACT_BE_16BITS(&icp->icmp6_data16[1]);
+ ngroups = EXTRACT_BE_U_2(&icp->icmp6_data16[1]);
ND_PRINT((ndo,", %d group record(s)", ngroups));
if (ndo->ndo_vflag > 0) {
/* Print the group records */
return;
}
ND_TCHECK(icp->icmp6_data16[0]);
- mrc = EXTRACT_BE_16BITS(&icp->icmp6_data16[0]);
+ mrc = EXTRACT_BE_U_2(&icp->icmp6_data16[0]);
if (mrc < 32768) {
mrt = mrc;
} else {
}
ND_TCHECK2(bp[26], 2);
- nsrcs = EXTRACT_BE_16BITS(bp + 26);
+ nsrcs = EXTRACT_BE_U_2(bp + 26);
if (nsrcs > 0) {
if (len < 28 + nsrcs * sizeof(struct in6_addr))
ND_PRINT((ndo," [invalid number of sources]"));
/* DNS name decoding - no decompression */
ND_PRINT((ndo,", \""));
while (cp < ep) {
- i = EXTRACT_8BITS(cp);
+ i = EXTRACT_U_1(cp);
cp++;
if (i) {
if (i > ep - cp) {
safeputchar(ndo, *cp);
cp++;
}
- if (cp + 1 < ep && EXTRACT_8BITS(cp))
+ if (cp + 1 < ep && EXTRACT_U_1(cp))
ND_PRINT((ndo,"."));
} else {
if (cp == ep) {
ND_TCHECK2(*dp, sizeof(*ni6));
ni6 = (const struct icmp6_nodeinfo *)dp;
ND_PRINT((ndo," (")); /*)*/
- switch (EXTRACT_BE_16BITS(&ni6->ni_qtype)) {
+ switch (EXTRACT_BE_U_2(&ni6->ni_qtype)) {
case NI_QTYPE_NOOP:
ND_PRINT((ndo,"noop"));
break;
case NI_QTYPE_SUPTYPES:
ND_PRINT((ndo,"supported qtypes"));
- i = EXTRACT_BE_16BITS(&ni6->ni_flags);
+ i = EXTRACT_BE_U_2(&ni6->ni_flags);
if (i)
ND_PRINT((ndo," [%s]", (i & 0x01) ? "C" : ""));
break;
break;
}
- switch (EXTRACT_BE_16BITS(&ni6->ni_qtype)) {
+ switch (EXTRACT_BE_U_2(&ni6->ni_qtype)) {
case NI_QTYPE_NOOP:
if (needcomma)
ND_PRINT((ndo,", "));
if (needcomma)
ND_PRINT((ndo,", "));
ND_PRINT((ndo,"supported qtypes"));
- i = EXTRACT_BE_16BITS(&ni6->ni_flags);
+ i = EXTRACT_BE_U_2(&ni6->ni_flags);
if (i)
ND_PRINT((ndo," [%s]", (i & 0x01) ? "C" : ""));
break;
ND_PRINT((ndo,"\""));
} else
dnsname_print(ndo, cp, ep);
- if ((EXTRACT_BE_16BITS(&ni6->ni_flags) & 0x01) != 0)
- ND_PRINT((ndo," [TTL=%u]", EXTRACT_BE_32BITS(ni6 + 1)));
+ if ((EXTRACT_BE_U_2(&ni6->ni_flags) & 0x01) != 0)
+ ND_PRINT((ndo," [TTL=%u]", EXTRACT_BE_U_4(ni6 + 1)));
break;
case NI_QTYPE_NODEADDR:
if (needcomma)
break;
ND_PRINT((ndo," %s", ip6addr_string(ndo, bp + i)));
i += sizeof(struct in6_addr);
- ND_PRINT((ndo,"(%d)", (int32_t) EXTRACT_BE_32BITS(bp + i)));
+ ND_PRINT((ndo,"(%d)", (int32_t) EXTRACT_BE_U_4(bp + i)));
i += sizeof(int32_t);
}
i = ni6->ni_flags;
break;
}
- ND_PRINT((ndo,", seq=%u", EXTRACT_BE_32BITS(&rr6->rr_seqnum)));
+ ND_PRINT((ndo,", seq=%u", EXTRACT_BE_U_4(&rr6->rr_seqnum)));
if (ndo->ndo_vflag) {
#define F(x, y) ((rr6->rr_flags) & (x) ? (y) : "")
F(ICMP6_RR_FLAGS_PREVDONE, "P")));
}
ND_PRINT((ndo,"seg=%u,", rr6->rr_segnum));
- ND_PRINT((ndo,"maxdelay=%u", EXTRACT_BE_16BITS(&rr6->rr_maxdelay)));
+ ND_PRINT((ndo,"maxdelay=%u", EXTRACT_BE_U_2(&rr6->rr_maxdelay)));
if (rr6->rr_reserved)
- ND_PRINT((ndo,"rsvd=0x%x", EXTRACT_BE_32BITS(&rr6->rr_reserved)));
+ ND_PRINT((ndo,"rsvd=0x%x", EXTRACT_BE_U_4(&rr6->rr_reserved)));
/*[*/
ND_PRINT((ndo,"]"));
#undef F
ND_PRINT((ndo,"vltime=infty,"));
else
ND_PRINT((ndo,"vltime=%u,",
- EXTRACT_BE_32BITS(&use->rpu_vltime)));
+ EXTRACT_BE_U_4(&use->rpu_vltime)));
if (~use->rpu_pltime == 0)
ND_PRINT((ndo,"pltime=infty,"));
else
ND_PRINT((ndo,"pltime=%u,",
- EXTRACT_BE_32BITS(&use->rpu_pltime)));
+ EXTRACT_BE_U_4(&use->rpu_pltime)));
}
if (addrtostr6(&use->rpu_prefix, hbuf, sizeof(hbuf)))
ND_PRINT((ndo,"%s/%u/%u", hbuf, use->rpu_uselen,
return;
}
ND_PRINT((ndo, "mtrace %u: %s to %s reply-to %s",
- TR_GETQID(EXTRACT_BE_32BITS(&tr->tr_rttlqid)),
+ TR_GETQID(EXTRACT_BE_U_4(&tr->tr_rttlqid)),
ipaddr_string(ndo, &tr->tr_src), ipaddr_string(ndo, &tr->tr_dst),
ipaddr_string(ndo, &tr->tr_raddr)));
- if (IN_CLASSD(EXTRACT_BE_32BITS(&tr->tr_raddr)))
- ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_BE_32BITS(&tr->tr_rttlqid))));
+ if (IN_CLASSD(EXTRACT_BE_U_4(&tr->tr_raddr)))
+ ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_BE_U_4(&tr->tr_rttlqid))));
return;
trunc:
ND_PRINT((ndo, "%s", tstr));
return;
}
ND_PRINT((ndo, "mresp %lu: %s to %s reply-to %s",
- (u_long)TR_GETQID(EXTRACT_BE_32BITS(&tr->tr_rttlqid)),
+ (u_long)TR_GETQID(EXTRACT_BE_U_4(&tr->tr_rttlqid)),
ipaddr_string(ndo, &tr->tr_src), ipaddr_string(ndo, &tr->tr_dst),
ipaddr_string(ndo, &tr->tr_raddr)));
- if (IN_CLASSD(EXTRACT_BE_32BITS(&tr->tr_raddr)))
- ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_BE_32BITS(&tr->tr_rttlqid))));
+ if (IN_CLASSD(EXTRACT_BE_U_4(&tr->tr_raddr)))
+ ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_BE_U_4(&tr->tr_rttlqid))));
return;
trunc:
ND_PRINT((ndo, "%s", tstr));
return;
}
ND_TCHECK_2(bp + 6);
- ngroups = EXTRACT_BE_16BITS(bp + 6);
+ ngroups = EXTRACT_BE_U_2(bp + 6);
ND_PRINT((ndo, ", %d group record(s)", ngroups));
if (ndo->ndo_vflag > 0) {
/* Print the group records */
ND_PRINT((ndo, " [gaddr %s", ipaddr_string(ndo, &bp[group+4])));
ND_PRINT((ndo, " %s", tok2str(igmpv3report2str, " [v3-report-#%d]",
bp[group])));
- nsrcs = EXTRACT_BE_16BITS(bp + group + 2);
+ nsrcs = EXTRACT_BE_U_2(bp + group + 2);
/* Check the number of sources and print them */
if (len < group+8+(nsrcs<<2)) {
ND_PRINT((ndo, " [invalid number of sources %d]", nsrcs));
return;
}
ND_TCHECK_1(bp + 1);
- mrc = EXTRACT_8BITS(bp + 1);
+ mrc = EXTRACT_U_1(bp + 1);
if (mrc < 128) {
mrt = mrc;
} else {
ND_PRINT((ndo, "]"));
}
ND_TCHECK_4(bp + 4);
- if (EXTRACT_BE_32BITS(bp + 4) == 0)
+ if (EXTRACT_BE_U_4(bp + 4) == 0)
return;
ND_PRINT((ndo, " [gaddr %s", ipaddr_string(ndo, &bp[4])));
ND_TCHECK_2(bp + 10);
- nsrcs = EXTRACT_BE_16BITS(bp + 10);
+ nsrcs = EXTRACT_BE_U_2(bp + 10);
if (nsrcs > 0) {
if (len < 12 + (nsrcs << 2))
ND_PRINT((ndo, " [invalid number of sources]"));
}
ND_TCHECK_1(bp);
- switch (EXTRACT_8BITS(bp)) {
+ switch (EXTRACT_U_1(bp)) {
case 0x11:
ND_PRINT((ndo, "igmp query"));
if (len >= 12)
print_igmpv3_query(ndo, bp, len);
else {
ND_TCHECK_1(bp + 1);
- if (EXTRACT_8BITS(bp + 1)) {
+ if (EXTRACT_U_1(bp + 1)) {
ND_PRINT((ndo, " v2"));
- if (EXTRACT_8BITS(bp + 1) != 100)
- ND_PRINT((ndo, " [max resp time %u]", EXTRACT_8BITS(bp + 1)));
+ if (EXTRACT_U_1(bp + 1) != 100)
+ ND_PRINT((ndo, " [max resp time %u]", EXTRACT_U_1(bp + 1)));
} else
ND_PRINT((ndo, " v1"));
ND_TCHECK_4(bp + 4);
- if (EXTRACT_BE_32BITS(bp + 4))
+ if (EXTRACT_BE_U_4(bp + 4))
ND_PRINT((ndo, " [gaddr %s]", ipaddr_string(ndo, &bp[4])));
if (len != 8)
ND_PRINT((ndo, " [len %d]", len));
print_mtrace(ndo, bp, len);
break;
default:
- ND_PRINT((ndo, "igmp-%d", EXTRACT_8BITS(bp)));
+ ND_PRINT((ndo, "igmp-%d", EXTRACT_U_1(bp)));
break;
}
vec[0].ptr = bp;
vec[0].len = len;
if (in_cksum(vec, 1))
- ND_PRINT((ndo, " bad igmp cksum %x!", EXTRACT_BE_16BITS(bp + 2)));
+ ND_PRINT((ndo, " bad igmp cksum %x!", EXTRACT_BE_U_2(bp + 2)));
}
return;
trunc:
ND_PRINT((ndo, " %d.%d.%d.0", igr->igr_net[0],
igr->igr_net[1], igr->igr_net[2]));
- delay = EXTRACT_BE_24BITS(igr->igr_dly);
- bandwidth = EXTRACT_BE_24BITS(igr->igr_bw);
+ delay = EXTRACT_BE_U_3(igr->igr_dly);
+ bandwidth = EXTRACT_BE_U_3(igr->igr_bw);
metric = bandwidth + delay;
if (metric > 0xffffff)
metric = 0xffffff;
- mtu = EXTRACT_BE_16BITS(igr->igr_mtu);
+ mtu = EXTRACT_BE_U_2(igr->igr_mtu);
ND_PRINT((ndo, " d=%d b=%d r=%d l=%d M=%d mtu=%d in %d hops",
10 * delay, bandwidth == 0 ? 0 : 10000000 / bandwidth,
/* Header */
ND_TCHECK(*hdr);
- nint = EXTRACT_BE_16BITS(&hdr->ig_ni);
- nsys = EXTRACT_BE_16BITS(&hdr->ig_ns);
- next = EXTRACT_BE_16BITS(&hdr->ig_nx);
+ nint = EXTRACT_BE_U_2(&hdr->ig_ni);
+ nsys = EXTRACT_BE_U_2(&hdr->ig_ns);
+ next = EXTRACT_BE_U_2(&hdr->ig_nx);
ND_PRINT((ndo, " %s V%d edit=%d AS=%d (%d/%d/%d)",
tok2str(op2str, "op-#%d", IGRP_OP(hdr->ig_vop)),
IGRP_V(hdr->ig_vop),
hdr->ig_ed,
- EXTRACT_BE_16BITS(&hdr->ig_as),
+ EXTRACT_BE_U_2(&hdr->ig_as),
nint,
nsys,
next));
if (ptr == len)
type = " ^ ";
ND_TCHECK2(cp[len], hoplen);
- ND_PRINT((ndo, "%s%d@%s", type, EXTRACT_BE_32BITS(cp + len + hoplen - 4),
+ ND_PRINT((ndo, "%s%d@%s", type, EXTRACT_BE_U_4(cp + len + hoplen - 4),
hoplen!=8 ? "" : ipaddr_string(ndo, &cp[len])));
type = " ";
}
break;
}
ND_TCHECK(cp[3]);
- if (EXTRACT_BE_16BITS(cp + 2) != 0)
- ND_PRINT((ndo, " value %u", EXTRACT_BE_16BITS(cp + 2)));
+ if (EXTRACT_BE_U_2(cp + 2) != 0)
+ ND_PRINT((ndo, " value %u", EXTRACT_BE_U_2(cp + 2)));
break;
case IPOPT_NOP: /* nothing to print - fall through */
return;
}
- ipds->len = EXTRACT_BE_16BITS(&ipds->ip->ip_len);
+ ipds->len = EXTRACT_BE_U_2(&ipds->ip->ip_len);
if (length < ipds->len)
ND_PRINT((ndo, "truncated-ip - %u bytes missing! ",
ipds->len - length));
ipds->len -= hlen;
- ipds->off = EXTRACT_BE_16BITS(&ipds->ip->ip_off);
+ ipds->off = EXTRACT_BE_U_2(&ipds->ip->ip_off);
if (ndo->ndo_vflag) {
ND_PRINT((ndo, "(tos 0x%x", ipds->ip->ip_tos));
*/
ND_PRINT((ndo, ", id %u, offset %u, flags [%s], proto %s (%u)",
- EXTRACT_BE_16BITS(&ipds->ip->ip_id),
+ EXTRACT_BE_U_2(&ipds->ip->ip_id),
(ipds->off & 0x1fff) * 8,
bittok2str(ip_frag_values, "none", ipds->off&0xe000),
tok2str(ipproto_values,"unknown",ipds->ip->ip_p),
ipds->ip->ip_p));
- ND_PRINT((ndo, ", length %u", EXTRACT_BE_16BITS(&ipds->ip->ip_len)));
+ ND_PRINT((ndo, ", length %u", EXTRACT_BE_U_2(&ipds->ip->ip_len)));
if ((hlen - sizeof(struct ip)) > 0) {
ND_PRINT((ndo, ", options ("));
vec[0].len = hlen;
sum = in_cksum(vec, 1);
if (sum != 0) {
- ip_sum = EXTRACT_BE_16BITS(&ipds->ip->ip_sum);
+ ip_sum = EXTRACT_BE_U_2(&ipds->ip->ip_sum);
ND_PRINT((ndo, ", bad cksum %x (->%x)!", ip_sum,
in_cksum_shouldbe(ip_sum, sum)));
}
* the first 8 octets.
*/
ND_TCHECK2(*cp, 2);
- advance = (EXTRACT_8BITS(cp + 1) + 1) << 3;
+ advance = (EXTRACT_U_1(cp + 1) + 1) << 3;
nh = *cp;
break;
return;
}
- payload_len = EXTRACT_BE_16BITS(&ip6->ip6_plen);
+ payload_len = EXTRACT_BE_U_2(&ip6->ip6_plen);
len = payload_len + sizeof(struct ip6_hdr);
if (length < len)
ND_PRINT((ndo, "truncated-ip6 - %u bytes missing!",
len - length));
if (ndo->ndo_vflag) {
- flow = EXTRACT_BE_32BITS(&ip6->ip6_flow);
+ flow = EXTRACT_BE_U_4(&ip6->ip6_flow);
ND_PRINT((ndo, "("));
#if 0
/* rfc1883 */
advance = hbhopt_print(ndo, cp);
if (advance < 0)
return;
- nh = EXTRACT_8BITS(cp);
+ nh = EXTRACT_U_1(cp);
break;
case IPPROTO_DSTOPTS:
advance = dstopt_print(ndo, cp);
if (advance < 0)
return;
- nh = EXTRACT_8BITS(cp);
+ nh = EXTRACT_U_1(cp);
break;
case IPPROTO_FRAGMENT:
advance = frag6_print(ndo, cp, (const u_char *)ip6);
if (advance < 0 || ndo->ndo_snapend <= cp + advance)
return;
- nh = EXTRACT_8BITS(cp);
+ nh = EXTRACT_U_1(cp);
fragmented = 1;
break;
advance = mobility_print(ndo, cp, (const u_char *)ip6);
if (advance < 0)
return;
- nh = EXTRACT_8BITS(cp);
+ nh = EXTRACT_U_1(cp);
return;
case IPPROTO_ROUTING:
ND_TCHECK(*cp);
advance = rt6_print(ndo, cp, (const u_char *)ip6);
if (advance < 0)
return;
- nh = EXTRACT_8BITS(cp);
+ nh = EXTRACT_U_1(cp);
break;
case IPPROTO_SCTP:
sctp_print(ndo, cp, (const u_char *)ip6, len);
advance = ah_print(ndo, cp);
if (advance < 0)
return;
- nh = EXTRACT_8BITS(cp);
+ nh = EXTRACT_U_1(cp);
break;
case IPPROTO_ESP:
{
ND_PRINT((ndo, "(rtalert: invalid len %d)", bp[i + 1]));
goto trunc;
}
- ND_PRINT((ndo, "(rtalert: 0x%04x) ", EXTRACT_BE_16BITS(bp + i + 2)));
+ ND_PRINT((ndo, "(rtalert: 0x%04x) ", EXTRACT_BE_U_2(bp + i + 2)));
break;
case IP6OPT_JUMBO:
if (len - i < IP6OPT_JUMBO_LEN) {
ND_PRINT((ndo, "(jumbo: invalid len %d)", bp[i + 1]));
goto trunc;
}
- ND_PRINT((ndo, "(jumbo: %u) ", EXTRACT_BE_32BITS(bp + i + 2)));
+ ND_PRINT((ndo, "(jumbo: %u) ", EXTRACT_BE_U_4(bp + i + 2)));
break;
case IP6OPT_HOME_ADDRESS:
if (len - i < IP6OPT_HOMEADDR_MINLEN) {
ipcomp = (const struct ipcomp *)bp;
ND_TCHECK(*ipcomp);
- cpi = EXTRACT_BE_16BITS(&ipcomp->comp_cpi);
+ cpi = EXTRACT_BE_U_2(&ipcomp->comp_cpi);
ND_PRINT((ndo, "IPComp(cpi=0x%04x)", cpi));
ND_TCHECK(ipx->srcSkt);
ND_PRINT((ndo, "%s.%04x > ",
- ipxaddr_string(EXTRACT_BE_32BITS(ipx->srcNet), ipx->srcNode),
- EXTRACT_BE_16BITS(&ipx->srcSkt)));
+ ipxaddr_string(EXTRACT_BE_U_4(ipx->srcNet), ipx->srcNode),
+ EXTRACT_BE_U_2(&ipx->srcSkt)));
ND_PRINT((ndo, "%s.%04x: ",
- ipxaddr_string(EXTRACT_BE_32BITS(ipx->dstNet), ipx->dstNode),
- EXTRACT_BE_16BITS(&ipx->dstSkt)));
+ ipxaddr_string(EXTRACT_BE_U_4(ipx->dstNet), ipx->dstNode),
+ EXTRACT_BE_U_2(&ipx->dstSkt)));
/* take length from ipx header */
ND_TCHECK(ipx->length);
- length = EXTRACT_BE_16BITS(&ipx->length);
+ length = EXTRACT_BE_U_2(&ipx->length);
ipx_decode(ndo, ipx, p + ipxSize, length - ipxSize);
return;
{
register u_short dstSkt;
- dstSkt = EXTRACT_BE_16BITS(&ipx->dstSkt);
+ dstSkt = EXTRACT_BE_U_2(&ipx->dstSkt);
switch (dstSkt) {
case IPX_SKT_NCP:
ND_PRINT((ndo, "ipx-ncp %d", length));
int command, i;
ND_TCHECK(ipx[0]);
- command = EXTRACT_BE_16BITS(ipx);
+ command = EXTRACT_BE_U_2(ipx);
ipx++;
length -= 2;
ND_PRINT((ndo, "ipx-sap-nearest-req"));
ND_TCHECK(ipx[0]);
- ND_PRINT((ndo, " %s", ipxsap_string(ndo, htons(EXTRACT_BE_16BITS(ipx)))));
+ ND_PRINT((ndo, " %s", ipxsap_string(ndo, htons(EXTRACT_BE_U_2(ipx)))));
break;
case 2:
for (i = 0; i < 8 && length > 0; i++) {
ND_TCHECK(ipx[0]);
- ND_PRINT((ndo, " %s '", ipxsap_string(ndo, htons(EXTRACT_BE_16BITS(ipx)))));
+ ND_PRINT((ndo, " %s '", ipxsap_string(ndo, htons(EXTRACT_BE_U_2(ipx)))));
if (fn_printzp(ndo, (const u_char *)&ipx[1], 48, ndo->ndo_snapend)) {
ND_PRINT((ndo, "'"));
goto trunc;
}
ND_TCHECK2(ipx[25], 10);
ND_PRINT((ndo, "' addr %s",
- ipxaddr_string(EXTRACT_BE_32BITS(ipx + 25), (const u_char *)&ipx[27])));
+ ipxaddr_string(EXTRACT_BE_U_4(ipx + 25), (const u_char *)&ipx[27])));
ipx += 32;
length -= 64;
}
int command, i;
ND_TCHECK(ipx[0]);
- command = EXTRACT_BE_16BITS(ipx);
+ command = EXTRACT_BE_U_2(ipx);
ipx++;
length -= 2;
ND_PRINT((ndo, "ipx-rip-req"));
if (length > 0) {
ND_TCHECK(ipx[3]);
- ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_32BITS(ipx),
- EXTRACT_BE_16BITS(ipx + 2), EXTRACT_BE_16BITS(ipx + 3)));
+ ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_U_4(ipx),
+ EXTRACT_BE_U_2(ipx + 2), EXTRACT_BE_U_2(ipx + 3)));
}
break;
case 2:
ND_PRINT((ndo, "ipx-rip-resp"));
for (i = 0; i < 50 && length > 0; i++) {
ND_TCHECK(ipx[3]);
- ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_32BITS(ipx),
- EXTRACT_BE_16BITS(ipx + 2), EXTRACT_BE_16BITS(ipx + 3)));
+ ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_U_4(ipx),
+ EXTRACT_BE_U_2(ipx + 2), EXTRACT_BE_U_2(ipx + 3)));
ipx += 4;
length -= 8;
totlen = 4;
else {
ND_TCHECK_2(&p[2]);
- totlen = 4 + EXTRACT_BE_16BITS(p + 2);
+ totlen = 4 + EXTRACT_BE_U_2(p + 2);
}
if (ep2 < p + totlen) {
ND_PRINT((ndo,"[|attr]"));
ND_TCHECK_2(&p[0]);
ND_PRINT((ndo,"("));
- t = EXTRACT_BE_16BITS(p) & 0x7fff;
+ t = EXTRACT_BE_U_2(p) & 0x7fff;
if (map && t < nmap && map[t].type)
ND_PRINT((ndo,"type=%s ", map[t].type));
else
if (p[0] & 0x80) {
ND_PRINT((ndo,"value="));
ND_TCHECK_2(&p[2]);
- v = EXTRACT_BE_16BITS(p + 2);
+ v = EXTRACT_BE_U_2(p + 2);
if (map && t < nmap && v < map[t].nvalue && map[t].value[v])
ND_PRINT((ndo,"%s", map[t].value[v]));
else {
totlen = 4;
else {
ND_TCHECK_2(&p[2]);
- totlen = 4 + EXTRACT_BE_16BITS(p + 2);
+ totlen = 4 + EXTRACT_BE_U_2(p + 2);
}
if (ep2 < p + totlen) {
ND_PRINT((ndo,"[|attr]"));
ND_TCHECK_2(&p[0]);
ND_PRINT((ndo,"("));
- t = EXTRACT_BE_16BITS(p) & 0x7fff;
+ t = EXTRACT_BE_U_2(p) & 0x7fff;
ND_PRINT((ndo,"type=#%d ", t));
if (p[0] & 0x80) {
ND_PRINT((ndo,"value="));
case IPSECDOI_NTYPE_REPLAY_STATUS:
ND_PRINT((ndo," status=("));
ND_PRINT((ndo,"replay detection %sabled",
- EXTRACT_BE_32BITS(cp) ? "en" : "dis"));
+ EXTRACT_BE_U_4(cp) ? "en" : "dis"));
ND_PRINT((ndo,")"));
break;
default:
p = (const struct isakmp *)bp;
ep = ndo->ndo_snapend;
- phase = (EXTRACT_BE_32BITS(base->msgid) == 0) ? 1 : 2;
+ phase = (EXTRACT_BE_U_4(base->msgid) == 0) ? 1 : 2;
if (phase == 1)
ND_PRINT((ndo," phase %d", phase));
else
p = (const struct isakmp *)bp;
ep = ndo->ndo_snapend;
- phase = (EXTRACT_BE_32BITS(base->msgid) == 0) ? 1 : 2;
+ phase = (EXTRACT_BE_U_4(base->msgid) == 0) ? 1 : 2;
if (phase == 1)
ND_PRINT((ndo, " parent_sa"));
else
}
if (ndo->ndo_eflag)
- ND_PRINT((ndo, "OSI NLPID %s (0x%02x): ", tok2str(nlpid_values, "Unknown", EXTRACT_8BITS(p)), *p));
+ ND_PRINT((ndo, "OSI NLPID %s (0x%02x): ", tok2str(nlpid_values, "Unknown", EXTRACT_U_1(p)), *p));
switch (*p) {
if (li < sizeof(struct clnp_header_t)) {
ND_PRINT((ndo, " length indicator %u < min PDU size:", li));
while (pptr < ndo->ndo_snapend) {
- ND_PRINT((ndo, "%02X", EXTRACT_8BITS(pptr)));
+ ND_PRINT((ndo, "%02X", EXTRACT_U_1(pptr)));
pptr++;
}
return (0);
return (0);
}
ND_TCHECK(*pptr);
- dest_address_length = EXTRACT_8BITS(pptr);
+ dest_address_length = EXTRACT_U_1(pptr);
pptr += 1;
li -= 1;
if (li < dest_address_length) {
return (0);
}
ND_TCHECK(*pptr);
- source_address_length = EXTRACT_8BITS(pptr);
+ source_address_length = EXTRACT_U_1(pptr);
pptr += 1;
li -= 1;
if (li < source_address_length) {
clnp_header->version,
clnp_header->lifetime/2,
(clnp_header->lifetime%2)*5,
- EXTRACT_BE_16BITS(clnp_header->segment_length),
- EXTRACT_BE_16BITS(clnp_header->cksum)));
+ EXTRACT_BE_U_2(clnp_header->segment_length),
+ EXTRACT_BE_U_2(clnp_header->cksum)));
- osi_print_cksum(ndo, optr, EXTRACT_BE_16BITS(clnp_header->cksum), 7,
+ osi_print_cksum(ndo, optr, EXTRACT_BE_U_2(clnp_header->cksum), 7,
clnp_header->length_indicator);
ND_PRINT((ndo, "\n\tFlags [%s]",
clnp_segment_header = (const struct clnp_segment_header_t *) pptr;
ND_TCHECK(*clnp_segment_header);
ND_PRINT((ndo, "\n\tData Unit ID: 0x%04x, Segment Offset: %u, Total PDU Length: %u",
- EXTRACT_BE_16BITS(clnp_segment_header->data_unit_id),
- EXTRACT_BE_16BITS(clnp_segment_header->segment_offset),
- EXTRACT_BE_16BITS(clnp_segment_header->total_length)));
+ EXTRACT_BE_U_2(clnp_segment_header->data_unit_id),
+ EXTRACT_BE_U_2(clnp_segment_header->segment_offset),
+ EXTRACT_BE_U_2(clnp_segment_header->total_length)));
pptr+=sizeof(struct clnp_segment_header_t);
li-=sizeof(struct clnp_segment_header_t);
}
return (0);
}
ND_TCHECK2(*pptr, 2);
- op = EXTRACT_8BITS(pptr);
- opli = EXTRACT_8BITS(pptr + 1);
+ op = EXTRACT_U_1(pptr);
+ opli = EXTRACT_U_1(pptr + 1);
pptr += 2;
li -= 2;
if (opli > li) {
return (0);
}
ND_PRINT((ndo, "%s %s",
- tok2str(clnp_option_sr_rr_values,"Unknown",EXTRACT_8BITS(tptr)),
+ tok2str(clnp_option_sr_rr_values,"Unknown",EXTRACT_U_1(tptr)),
tok2str(clnp_option_sr_rr_string_values, "Unknown Option %u", op)));
- nsap_offset=EXTRACT_8BITS(tptr+1);
+ nsap_offset=EXTRACT_U_1(tptr + 1);
if (nsap_offset == 0) {
ND_PRINT((ndo, " Bad NSAP offset (0)"));
break;
tptr+=nsap_offset;
tlen-=nsap_offset;
while (tlen > 0) {
- source_address_length=EXTRACT_8BITS(tptr);
+ source_address_length=EXTRACT_U_1(tptr);
if (tlen < source_address_length+1) {
ND_PRINT((ndo, "\n\t NSAP address goes past end of option"));
break;
ND_PRINT((ndo, ", bad opt len"));
return (0);
}
- ND_PRINT((ndo, "0x%1x", EXTRACT_8BITS(tptr)&0x0f));
+ ND_PRINT((ndo, "0x%1x", EXTRACT_U_1(tptr)&0x0f));
break;
case CLNP_OPTION_QOS_MAINTENANCE:
return (0);
}
ND_PRINT((ndo, "\n\t Format Code: %s",
- tok2str(clnp_option_scope_values, "Reserved", EXTRACT_8BITS(tptr) & CLNP_OPTION_SCOPE_MASK)));
+ tok2str(clnp_option_scope_values, "Reserved", EXTRACT_U_1(tptr) & CLNP_OPTION_SCOPE_MASK)));
- if ((EXTRACT_8BITS(tptr)&CLNP_OPTION_SCOPE_MASK) == CLNP_OPTION_SCOPE_GLOBAL)
+ if ((EXTRACT_U_1(tptr)&CLNP_OPTION_SCOPE_MASK) == CLNP_OPTION_SCOPE_GLOBAL)
ND_PRINT((ndo, "\n\t QoS Flags [%s]",
bittok2str(clnp_option_qos_global_values,
"none",
- EXTRACT_8BITS(tptr)&CLNP_OPTION_OPTION_QOS_MASK)));
+ EXTRACT_U_1(tptr)&CLNP_OPTION_OPTION_QOS_MASK)));
break;
case CLNP_OPTION_SECURITY:
return (0);
}
ND_PRINT((ndo, "\n\t Format Code: %s, Security-Level %u",
- tok2str(clnp_option_scope_values,"Reserved",EXTRACT_8BITS(tptr)&CLNP_OPTION_SCOPE_MASK),
- EXTRACT_8BITS(tptr+1)));
+ tok2str(clnp_option_scope_values,"Reserved",EXTRACT_U_1(tptr)&CLNP_OPTION_SCOPE_MASK),
+ EXTRACT_U_1(tptr + 1)));
break;
case CLNP_OPTION_DISCARD_REASON:
ND_PRINT((ndo, ", bad opt len"));
return (0);
}
- rfd_error = EXTRACT_8BITS(tptr);
+ rfd_error = EXTRACT_U_1(tptr);
rfd_error_major = (rfd_error&0xf0) >> 4;
rfd_error_minor = rfd_error&0x0f;
ND_PRINT((ndo, "\n\t Class: %s Error (0x%01x), %s (0x%01x)",
case CLNP_PDU_ER: /* fall through */
case CLNP_PDU_ERP:
ND_TCHECK(*pptr);
- if (EXTRACT_8BITS(pptr) == NLPID_CLNP) {
+ if (EXTRACT_U_1(pptr) == NLPID_CLNP) {
ND_PRINT((ndo, "\n\t-----original packet-----\n\t"));
/* FIXME recursion protection */
clnp_print(ndo, pptr, length - clnp_header->length_indicator);
if (li < sizeof(struct esis_header_t) + 2) {
ND_PRINT((ndo, " length indicator %u < min PDU size:", li));
while (pptr < ndo->ndo_snapend) {
- ND_PRINT((ndo, "%02X", EXTRACT_8BITS(pptr)));
+ ND_PRINT((ndo, "%02X", EXTRACT_U_1(pptr)));
pptr++;
}
return;
esis_pdu_type));
ND_PRINT((ndo, ", v: %u%s", esis_header->version, esis_header->version == ESIS_VERSION ? "" : "unsupported" ));
- ND_PRINT((ndo, ", checksum: 0x%04x", EXTRACT_BE_16BITS(esis_header->cksum)));
+ ND_PRINT((ndo, ", checksum: 0x%04x", EXTRACT_BE_U_2(esis_header->cksum)));
- osi_print_cksum(ndo, pptr, EXTRACT_BE_16BITS(esis_header->cksum), 7,
+ osi_print_cksum(ndo, pptr, EXTRACT_BE_U_2(esis_header->cksum), 7,
li);
ND_PRINT((ndo, ", holding time: %us, length indicator: %u",
- EXTRACT_BE_16BITS(esis_header->holdtime), li));
+ EXTRACT_BE_U_2(esis_header->holdtime), li));
if (ndo->ndo_vflag > 1)
print_unknown_data(ndo, optr, "\n\t", sizeof(struct esis_header_t));
ND_PRINT((ndo, ", bad redirect/li"));
return;
}
- dstl = EXTRACT_8BITS(pptr);
+ dstl = EXTRACT_U_1(pptr);
pptr++;
li--;
ND_TCHECK2(*pptr, dstl);
ND_PRINT((ndo, ", bad redirect/li"));
return;
}
- snpal = EXTRACT_8BITS(pptr);
+ snpal = EXTRACT_U_1(pptr);
pptr++;
li--;
ND_TCHECK2(*pptr, snpal);
ND_PRINT((ndo, ", bad redirect/li"));
return;
}
- netal = EXTRACT_8BITS(pptr);
+ netal = EXTRACT_U_1(pptr);
pptr++;
ND_TCHECK2(*pptr, netal);
if (li < netal) {
ND_PRINT((ndo, ", bad esh/li"));
return;
}
- source_address_number = EXTRACT_8BITS(pptr);
+ source_address_number = EXTRACT_U_1(pptr);
pptr++;
li--;
ND_PRINT((ndo, ", bad esh/li"));
return;
}
- source_address_length = EXTRACT_8BITS(pptr);
+ source_address_length = EXTRACT_U_1(pptr);
pptr++;
li--;
ND_PRINT((ndo, ", bad ish/li"));
return;
}
- source_address_length = EXTRACT_8BITS(pptr);
+ source_address_length = EXTRACT_U_1(pptr);
pptr++;
li--;
ND_TCHECK2(*pptr, source_address_length);
return;
}
ND_TCHECK2(*pptr, 2);
- op = EXTRACT_8BITS(pptr);
- opli = EXTRACT_8BITS(pptr + 1);
+ op = EXTRACT_U_1(pptr);
+ opli = EXTRACT_U_1(pptr + 1);
pptr += 2;
li -= 2;
if (opli > li) {
case ESIS_OPTION_ES_CONF_TIME:
if (opli == 2) {
ND_TCHECK2(*pptr, 2);
- ND_PRINT((ndo, "%us", EXTRACT_BE_16BITS(tptr)));
+ ND_PRINT((ndo, "%us", EXTRACT_BE_U_2(tptr)));
} else
ND_PRINT((ndo, "(bad length)"));
break;
ND_PRINT((ndo, "%s (0x%02x)",
tok2str(nlpid_values,
"unknown",
- EXTRACT_8BITS(tptr)),
- EXTRACT_8BITS(tptr)));
+ EXTRACT_U_1(tptr)),
+ EXTRACT_U_1(tptr)));
if (opli>1) /* further NPLIDs ? - put comma */
ND_PRINT((ndo, ", "));
tptr++;
if (fn_printzp(ndo, mcid->name, 32, ndo->ndo_snapend))
goto trunc;
- ND_PRINT((ndo, "\n\t Lvl: %d", EXTRACT_BE_16BITS(mcid->revision_lvl)));
+ ND_PRINT((ndo, "\n\t Lvl: %d", EXTRACT_BE_U_2(mcid->revision_lvl)));
ND_PRINT((ndo, ", Digest: "));
while (len > 2)
{
ND_TCHECK2(*tptr, 2);
- stlv_type = EXTRACT_8BITS(tptr);
- stlv_len = EXTRACT_8BITS(tptr + 1);
+ stlv_type = EXTRACT_U_1(tptr);
+ stlv_len = EXTRACT_U_1(tptr + 1);
/* first lets see if we know the subTLVs name*/
ND_PRINT((ndo, "\n\t %s subTLV #%u, length: %u",
goto trunc;
ND_PRINT((ndo, "\n\t RES: %d V: %d A: %d D: %d",
- (EXTRACT_8BITS(tptr) >> 5),
- ((EXTRACT_8BITS(tptr) >> 4) & 0x01),
- ((EXTRACT_8BITS(tptr) >> 2) & 0x03),
- (EXTRACT_8BITS(tptr) & 0x03)));
+ (EXTRACT_U_1(tptr) >> 5),
+ ((EXTRACT_U_1(tptr) >> 4) & 0x01),
+ ((EXTRACT_U_1(tptr) >> 2) & 0x03),
+ (EXTRACT_U_1(tptr) & 0x03)));
tptr++;
for(i=1;i<=8; i++)
{
- ND_PRINT((ndo, "%08x ", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "%08x ", EXTRACT_BE_U_4(tptr)));
if (i%4 == 0 && i != 8)
ND_PRINT((ndo, "\n\t "));
tptr = tptr + 4;
while (stlv_len >= ISIS_SUBTLV_SPB_BVID_MIN_LEN)
{
ND_PRINT((ndo, "\n\t ECT: %08x",
- EXTRACT_BE_32BITS(tptr)));
+ EXTRACT_BE_U_4(tptr)));
tptr = tptr+4;
ND_PRINT((ndo, " BVID: %d, U:%01x M:%01x ",
- (EXTRACT_BE_16BITS(tptr) >> 4) ,
- (EXTRACT_BE_16BITS(tptr) >> 3) & 0x01,
- (EXTRACT_BE_16BITS(tptr) >> 2) & 0x01));
+ (EXTRACT_BE_U_2(tptr) >> 4) ,
+ (EXTRACT_BE_U_2(tptr) >> 3) & 0x01,
+ (EXTRACT_BE_U_2(tptr) >> 2) & 0x01));
tptr = tptr + 2;
len = len - ISIS_SUBTLV_SPB_BVID_MIN_LEN;
while (len > 2)
{
ND_TCHECK2(*tptr, 2);
- stlv_type = EXTRACT_8BITS(tptr);
- stlv_len = EXTRACT_8BITS(tptr + 1);
+ stlv_type = EXTRACT_U_1(tptr);
+ stlv_len = EXTRACT_U_1(tptr + 1);
tptr = tptr + 2;
len = len - 2;
if (stlv_len < ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN)
goto trunc;
- ND_PRINT((ndo, "\n\t CIST Root-ID: %08x", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t CIST Root-ID: %08x", EXTRACT_BE_U_4(tptr)));
tptr = tptr+4;
- ND_PRINT((ndo, " %08x", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, " %08x", EXTRACT_BE_U_4(tptr)));
tptr = tptr+4;
- ND_PRINT((ndo, ", Path Cost: %08x", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, ", Path Cost: %08x", EXTRACT_BE_U_4(tptr)));
tptr = tptr+4;
- ND_PRINT((ndo, ", Prio: %d", EXTRACT_BE_16BITS(tptr)));
+ ND_PRINT((ndo, ", Prio: %d", EXTRACT_BE_U_2(tptr)));
tptr = tptr + 2;
ND_PRINT((ndo, "\n\t RES: %d",
- EXTRACT_BE_16BITS(tptr) >> 5));
+ EXTRACT_BE_U_2(tptr) >> 5));
ND_PRINT((ndo, ", V: %d",
- (EXTRACT_BE_16BITS(tptr) >> 4) & 0x0001));
+ (EXTRACT_BE_U_2(tptr) >> 4) & 0x0001));
ND_PRINT((ndo, ", SPSource-ID: %d",
- (EXTRACT_BE_32BITS(tptr) & 0x000fffff)));
+ (EXTRACT_BE_U_4(tptr) & 0x000fffff)));
tptr = tptr+4;
- ND_PRINT((ndo, ", No of Trees: %x", EXTRACT_8BITS(tptr)));
+ ND_PRINT((ndo, ", No of Trees: %x", EXTRACT_U_1(tptr)));
- tmp = EXTRACT_8BITS(tptr);
+ tmp = EXTRACT_U_1(tptr);
tptr++;
len = len - ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN;
goto trunc;
ND_PRINT((ndo, "\n\t U:%d, M:%d, A:%d, RES:%d",
- EXTRACT_8BITS(tptr) >> 7,
- (EXTRACT_8BITS(tptr) >> 6) & 0x01,
- (EXTRACT_8BITS(tptr) >> 5) & 0x01,
- (EXTRACT_8BITS(tptr) & 0x1f)));
+ EXTRACT_U_1(tptr) >> 7,
+ (EXTRACT_U_1(tptr) >> 6) & 0x01,
+ (EXTRACT_U_1(tptr) >> 5) & 0x01,
+ (EXTRACT_U_1(tptr) & 0x1f)));
tptr++;
- ND_PRINT((ndo, ", ECT: %08x", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, ", ECT: %08x", EXTRACT_BE_U_4(tptr)));
tptr = tptr + 4;
ND_PRINT((ndo, ", BVID: %d, SPVID: %d",
- (EXTRACT_BE_24BITS(tptr) >> 12) & 0x000fff,
- EXTRACT_BE_24BITS(tptr) & 0x000fff));
+ (EXTRACT_BE_U_3(tptr) >> 12) & 0x000fff,
+ EXTRACT_BE_U_3(tptr) & 0x000fff));
tptr = tptr + 3;
len = len - ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN;
if (stlv_len < 8)
goto trunc;
- ND_PRINT((ndo, "\n\t BMAC: %08x", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t BMAC: %08x", EXTRACT_BE_U_4(tptr)));
tptr = tptr+4;
- ND_PRINT((ndo, "%04x", EXTRACT_BE_16BITS(tptr)));
+ ND_PRINT((ndo, "%04x", EXTRACT_BE_U_2(tptr)));
tptr = tptr+2;
- ND_PRINT((ndo, ", RES: %d, VID: %d", EXTRACT_BE_16BITS(tptr) >> 12,
- (EXTRACT_BE_16BITS(tptr)) & 0x0fff));
+ ND_PRINT((ndo, ", RES: %d, VID: %d", EXTRACT_BE_U_2(tptr) >> 12,
+ (EXTRACT_BE_U_2(tptr)) & 0x0fff));
tptr = tptr+2;
len = len - 8;
while (stlv_len >= 4) {
ND_TCHECK_4(tptr);
ND_PRINT((ndo, "\n\t T: %d, R: %d, RES: %d, ISID: %d",
- (EXTRACT_BE_32BITS(tptr) >> 31),
- (EXTRACT_BE_32BITS(tptr) >> 30) & 0x01,
- (EXTRACT_BE_32BITS(tptr) >> 24) & 0x03f,
- (EXTRACT_BE_32BITS(tptr)) & 0x0ffffff));
+ (EXTRACT_BE_U_4(tptr) >> 31),
+ (EXTRACT_BE_U_4(tptr) >> 30) & 0x01,
+ (EXTRACT_BE_U_4(tptr) >> 24) & 0x03f,
+ (EXTRACT_BE_U_4(tptr)) & 0x0ffffff));
tptr = tptr + 4;
len = len - 4;
if (!ND_TTEST(*tlv_ip_reach))
return (0);
- prefix_len = mask2plen(EXTRACT_BE_32BITS(tlv_ip_reach->mask));
+ prefix_len = mask2plen(EXTRACT_BE_U_4(tlv_ip_reach->mask));
if (prefix_len == -1)
ND_PRINT((ndo, "%sIPv4 prefix: %s mask %s",
case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32:
while (subl >= 4) {
ND_PRINT((ndo, ", 0x%08x (=%u)",
- EXTRACT_BE_32BITS(tptr),
- EXTRACT_BE_32BITS(tptr)));
+ EXTRACT_BE_U_4(tptr),
+ EXTRACT_BE_U_4(tptr)));
tptr+=4;
subl-=4;
}
case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64:
while (subl >= 8) {
ND_PRINT((ndo, ", 0x%08x%08x",
- EXTRACT_BE_32BITS(tptr),
- EXTRACT_BE_32BITS(tptr + 4)));
+ EXTRACT_BE_U_4(tptr),
+ EXTRACT_BE_U_4(tptr + 4)));
tptr+=8;
subl-=8;
}
case ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID:
case ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID:
if (subl >= 4) {
- ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_U_4(tptr)));
if (subl == 8) /* rfc4205 */
- ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_32BITS(tptr + 4)));
+ ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_U_4(tptr + 4)));
}
break;
case ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR:
case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW :
case ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW:
if (subl >= 4) {
- bw.i = EXTRACT_BE_32BITS(tptr);
+ bw.i = EXTRACT_BE_U_4(tptr);
ND_PRINT((ndo, ", %.3f Mbps", bw.f * 8 / 1000000));
}
break;
case ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW :
if (subl >= 32) {
for (te_class = 0; te_class < 8; te_class++) {
- bw.i = EXTRACT_BE_32BITS(tptr);
+ bw.i = EXTRACT_BE_U_4(tptr);
ND_PRINT((ndo, "%s TE-Class %u: %.3f Mbps",
ident,
te_class,
break;
ND_PRINT((ndo, "%sBandwidth Constraints Model ID: %s (%u)",
ident,
- tok2str(diffserv_te_bc_values, "unknown", EXTRACT_8BITS(tptr)),
- EXTRACT_8BITS(tptr)));
+ tok2str(diffserv_te_bc_values, "unknown", EXTRACT_U_1(tptr)),
+ EXTRACT_U_1(tptr)));
tptr++;
/* decode BCs until the subTLV ends */
for (te_class = 0; te_class < (subl-1)/4; te_class++) {
- bw.i = EXTRACT_BE_32BITS(tptr);
+ bw.i = EXTRACT_BE_U_4(tptr);
ND_PRINT((ndo, "%s Bandwidth constraint CT%u: %.3f Mbps",
ident,
te_class,
break;
case ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC:
if (subl >= 3)
- ND_PRINT((ndo, ", %u", EXTRACT_BE_24BITS(tptr)));
+ ND_PRINT((ndo, ", %u", EXTRACT_BE_U_3(tptr)));
break;
case ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE:
if (subl == 2) {
ND_PRINT((ndo, ", [ %s ] (0x%04x)",
bittok2str(isis_subtlv_link_attribute_values,
"Unknown",
- EXTRACT_BE_16BITS(tptr)),
- EXTRACT_BE_16BITS(tptr)));
+ EXTRACT_BE_U_2(tptr)),
+ EXTRACT_BE_U_2(tptr)));
}
break;
case ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE:
if (subl >= 2) {
ND_PRINT((ndo, ", %s, Priority %u",
- bittok2str(gmpls_link_prot_values, "none", EXTRACT_8BITS(tptr)),
- EXTRACT_8BITS(tptr+1)));
+ bittok2str(gmpls_link_prot_values, "none", EXTRACT_U_1(tptr)),
+ EXTRACT_U_1(tptr + 1)));
}
break;
case ISIS_SUBTLV_SPB_METRIC:
if (subl >= 6) {
- ND_PRINT((ndo, ", LM: %u", EXTRACT_BE_24BITS(tptr)));
+ ND_PRINT((ndo, ", LM: %u", EXTRACT_BE_U_3(tptr)));
tptr=tptr+3;
- ND_PRINT((ndo, ", P: %u", EXTRACT_8BITS(tptr)));
+ ND_PRINT((ndo, ", P: %u", EXTRACT_U_1(tptr)));
tptr++;
- ND_PRINT((ndo, ", P-ID: %u", EXTRACT_BE_16BITS(tptr)));
+ ND_PRINT((ndo, ", P-ID: %u", EXTRACT_BE_U_2(tptr)));
}
break;
case ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR:
if (subl >= 36) {
- gmpls_switch_cap = EXTRACT_8BITS(tptr);
+ gmpls_switch_cap = EXTRACT_U_1(tptr);
ND_PRINT((ndo, "%s Interface Switching Capability:%s",
ident,
tok2str(gmpls_switch_cap_values, "Unknown", gmpls_switch_cap)));
ND_PRINT((ndo, ", LSP Encoding: %s",
- tok2str(gmpls_encoding_values, "Unknown", EXTRACT_8BITS((tptr + 1)))));
+ tok2str(gmpls_encoding_values, "Unknown", EXTRACT_U_1((tptr + 1)))));
tptr+=4;
ND_PRINT((ndo, "%s Max LSP Bandwidth:", ident));
for (priority_level = 0; priority_level < 8; priority_level++) {
- bw.i = EXTRACT_BE_32BITS(tptr);
+ bw.i = EXTRACT_BE_U_4(tptr);
ND_PRINT((ndo, "%s priority level %d: %.3f Mbps",
ident,
priority_level,
case GMPLS_PSC4:
if (subl < 6)
break;
- bw.i = EXTRACT_BE_32BITS(tptr);
+ bw.i = EXTRACT_BE_U_4(tptr);
ND_PRINT((ndo, "%s Min LSP Bandwidth: %.3f Mbps", ident, bw.f * 8 / 1000000));
- ND_PRINT((ndo, "%s Interface MTU: %u", ident, EXTRACT_BE_16BITS(tptr + 4)));
+ ND_PRINT((ndo, "%s Interface MTU: %u", ident, EXTRACT_BE_U_2(tptr + 4)));
break;
case GMPLS_TSC:
if (subl < 8)
break;
- bw.i = EXTRACT_BE_32BITS(tptr);
+ bw.i = EXTRACT_BE_U_4(tptr);
ND_PRINT((ndo, "%s Min LSP Bandwidth: %.3f Mbps", ident, bw.f * 8 / 1000000));
ND_PRINT((ndo, "%s Indication %s", ident,
- tok2str(gmpls_switch_cap_tsc_indication_values, "Unknown (%u)", EXTRACT_8BITS((tptr + 4)))));
+ tok2str(gmpls_switch_cap_tsc_indication_values, "Unknown (%u)", EXTRACT_U_1((tptr + 4)))));
break;
default:
/* there is some optional stuff left to decode but this is as of yet
if (tlv_type != ISIS_TLV_IS_ALIAS_ID) { /* the Alias TLV Metric field is implicit 0 */
if (!ND_TTEST_3(tptr)) /* and is therefore skipped */
return(0);
- ND_PRINT((ndo, ", Metric: %d", EXTRACT_BE_24BITS(tptr)));
+ ND_PRINT((ndo, ", Metric: %d", EXTRACT_BE_U_3(tptr)));
tptr+=3;
}
if (!ND_TTEST_1(tptr))
return(0);
- subtlv_sum_len=EXTRACT_8BITS(tptr); /* read out subTLV length */
+ subtlv_sum_len=EXTRACT_U_1(tptr); /* read out subTLV length */
tptr++;
proc_bytes=NODE_ID_LEN+3+1;
ND_PRINT((ndo, ", %ssub-TLVs present",subtlv_sum_len ? "" : "no "));
while (subtlv_sum_len>0) {
if (!ND_TTEST2(*tptr,2))
return(0);
- subtlv_type=EXTRACT_8BITS(tptr);
- subtlv_len=EXTRACT_8BITS(tptr+1);
+ subtlv_type=EXTRACT_U_1(tptr);
+ subtlv_len=EXTRACT_U_1(tptr + 1);
tptr+=2;
/* prepend the indent string */
snprintf(ident_buffer, sizeof(ident_buffer), "%s ",ident);
ident,
tok2str(isis_mt_values,
"Reserved for IETF Consensus",
- ISIS_MASK_MTID(EXTRACT_BE_16BITS(tptr)))));
+ ISIS_MASK_MTID(EXTRACT_BE_U_2(tptr)))));
ND_PRINT((ndo, " Topology (0x%03x), Flags: [%s]",
- ISIS_MASK_MTID(EXTRACT_BE_16BITS(tptr)),
- bittok2str(isis_mt_flag_values, "none",ISIS_MASK_MTFLAGS(EXTRACT_BE_16BITS(tptr)))));
+ ISIS_MASK_MTID(EXTRACT_BE_U_2(tptr)),
+ bittok2str(isis_mt_flag_values, "none",ISIS_MASK_MTFLAGS(EXTRACT_BE_U_2(tptr)))));
return(2);
}
if (!ND_TTEST_4(tptr))
return (0);
- metric = EXTRACT_BE_32BITS(tptr);
+ metric = EXTRACT_BE_U_4(tptr);
processed=4;
tptr+=4;
if (afi == AF_INET) {
if (!ND_TTEST_1(tptr)) /* fetch status byte */
return (0);
- status_byte=EXTRACT_8BITS(tptr);
+ status_byte=EXTRACT_U_1(tptr);
tptr++;
bit_length = status_byte&0x3f;
if (bit_length > 32) {
} else if (afi == AF_INET6) {
if (!ND_TTEST2(*tptr, 2)) /* fetch status & prefix_len byte */
return (0);
- status_byte=EXTRACT_8BITS(tptr);
- bit_length=EXTRACT_8BITS(tptr+1);
+ status_byte=EXTRACT_U_1(tptr);
+ bit_length=EXTRACT_U_1(tptr + 1);
if (bit_length > 128) {
ND_PRINT((ndo, "%sIPv6 prefix: bad bit length %u",
ident,
*/
if (!ND_TTEST_1(tptr))
return (0);
- sublen=EXTRACT_8BITS(tptr);
+ sublen=EXTRACT_U_1(tptr);
tptr++;
processed+=sublen+1;
ND_PRINT((ndo, " (%u)", sublen)); /* print out subTLV length */
while (sublen>0) {
if (!ND_TTEST2(*tptr,2))
return (0);
- subtlvtype=EXTRACT_8BITS(tptr);
- subtlvlen=EXTRACT_8BITS(tptr+1);
+ subtlvtype=EXTRACT_U_1(tptr);
+ subtlvlen=EXTRACT_U_1(tptr + 1);
tptr+=2;
/* prepend the indent string */
snprintf(ident_buffer, sizeof(ident_buffer), "%s ",ident);
ND_PRINT((ndo, ", length %u", length));
return (1);
}
- pdu_len=EXTRACT_BE_16BITS(header_iih_lan->pdu_len);
+ pdu_len=EXTRACT_BE_U_2(header_iih_lan->pdu_len);
if (packet_len>pdu_len) {
packet_len=pdu_len; /* do TLV decoding as long as it makes sense */
length=pdu_len;
ND_PRINT((ndo, "\n\t source-id: %s, holding time: %us, Flags: [%s]",
isis_print_id(header_iih_lan->source_id,SYSTEM_ID_LEN),
- EXTRACT_BE_16BITS(header_iih_lan->holding_time),
+ EXTRACT_BE_U_2(header_iih_lan->holding_time),
tok2str(isis_iih_circuit_type_values,
"unknown circuit type 0x%02x",
header_iih_lan->circuit_type)));
ND_PRINT((ndo, ", length %u", length));
return (1);
}
- pdu_len=EXTRACT_BE_16BITS(header_iih_ptp->pdu_len);
+ pdu_len=EXTRACT_BE_U_2(header_iih_ptp->pdu_len);
if (packet_len>pdu_len) {
packet_len=pdu_len; /* do TLV decoding as long as it makes sense */
length=pdu_len;
ND_PRINT((ndo, "\n\t source-id: %s, holding time: %us, Flags: [%s]",
isis_print_id(header_iih_ptp->source_id,SYSTEM_ID_LEN),
- EXTRACT_BE_16BITS(header_iih_ptp->holding_time),
+ EXTRACT_BE_U_2(header_iih_ptp->holding_time),
tok2str(isis_iih_circuit_type_values,
"unknown circuit type 0x%02x",
header_iih_ptp->circuit_type)));
if (ndo->ndo_vflag == 0) {
ND_PRINT((ndo, ", lsp-id %s, seq 0x%08x, lifetime %5us",
isis_print_id(header_lsp->lsp_id, LSP_ID_LEN),
- EXTRACT_BE_32BITS(header_lsp->sequence_number),
- EXTRACT_BE_16BITS(header_lsp->remaining_lifetime)));
+ EXTRACT_BE_U_4(header_lsp->sequence_number),
+ EXTRACT_BE_U_2(header_lsp->remaining_lifetime)));
ND_PRINT((ndo, ", length %u", length));
return (1);
}
- pdu_len=EXTRACT_BE_16BITS(header_lsp->pdu_len);
+ pdu_len=EXTRACT_BE_U_2(header_lsp->pdu_len);
if (packet_len>pdu_len) {
packet_len=pdu_len; /* do TLV decoding as long as it makes sense */
length=pdu_len;
ND_PRINT((ndo, "\n\t lsp-id: %s, seq: 0x%08x, lifetime: %5us\n\t chksum: 0x%04x",
isis_print_id(header_lsp->lsp_id, LSP_ID_LEN),
- EXTRACT_BE_32BITS(header_lsp->sequence_number),
- EXTRACT_BE_16BITS(header_lsp->remaining_lifetime),
- EXTRACT_BE_16BITS(header_lsp->checksum)));
+ EXTRACT_BE_U_4(header_lsp->sequence_number),
+ EXTRACT_BE_U_2(header_lsp->remaining_lifetime),
+ EXTRACT_BE_U_2(header_lsp->checksum)));
osi_print_cksum(ndo, (const uint8_t *)header_lsp->lsp_id,
- EXTRACT_BE_16BITS(header_lsp->checksum),
+ EXTRACT_BE_U_2(header_lsp->checksum),
12, length-12);
ND_PRINT((ndo, ", PDU length: %u, Flags: [ %s",
ND_PRINT((ndo, ", length %u", length));
return (1);
}
- pdu_len=EXTRACT_BE_16BITS(header_csnp->pdu_len);
+ pdu_len=EXTRACT_BE_U_2(header_csnp->pdu_len);
if (packet_len>pdu_len) {
packet_len=pdu_len; /* do TLV decoding as long as it makes sense */
length=pdu_len;
ND_PRINT((ndo, ", length %u", length));
return (1);
}
- pdu_len=EXTRACT_BE_16BITS(header_psnp->pdu_len);
+ pdu_len=EXTRACT_BE_U_2(header_psnp->pdu_len);
if (packet_len>pdu_len) {
packet_len=pdu_len; /* do TLV decoding as long as it makes sense */
length=pdu_len;
ND_TCHECK2(*pptr, 2);
if (packet_len < 2)
goto trunc;
- tlv_type = EXTRACT_8BITS(pptr);
- tlv_len = EXTRACT_8BITS(pptr + 1);
+ tlv_type = EXTRACT_U_1(pptr);
+ tlv_len = EXTRACT_U_1(pptr + 1);
pptr += 2;
packet_len -= 2;
tmp =tlv_len; /* copy temporary len & pointer to packet data */
switch (tlv_type) {
case ISIS_TLV_AREA_ADDR:
ND_TCHECK_1(tptr);
- alen = EXTRACT_8BITS(tptr);
+ alen = EXTRACT_U_1(tptr);
tptr++;
while (tmp && alen < tmp) {
ND_TCHECK2(*tptr, alen);
if (tmp==0) /* if this is the last area address do not attemt a boundary check */
break;
ND_TCHECK_1(tptr);
- alen = EXTRACT_8BITS(tptr);
+ alen = EXTRACT_U_1(tptr);
tptr++;
}
break;
case ISIS_TLV_ISNEIGH_VARLEN:
if (!ND_TTEST_1(tptr) || tmp < 3) /* min. TLV length */
goto trunctlv;
- lan_alen = EXTRACT_8BITS(tptr); /* LAN address length */
+ lan_alen = EXTRACT_U_1(tptr); /* LAN address length */
tptr++;
if (lan_alen == 0) {
ND_PRINT((ndo, "\n\t LAN address length 0 bytes (invalid)"));
ND_PRINT((ndo, "\n\t %s",
tok2str(isis_is_reach_virtual_values,
"bogus virtual flag 0x%02x",
- EXTRACT_8BITS(tptr))));
+ EXTRACT_U_1(tptr))));
tptr++;
tlv_is_reach = (const struct isis_tlv_is_reach *)tptr;
while (tmp >= sizeof(struct isis_tlv_is_reach)) {
ND_PRINT((ndo, "\n\t %s: ",
tok2str(isis_subtlv_auth_values,
"unknown Authentication type 0x%02x",
- EXTRACT_8BITS(tptr))));
+ EXTRACT_U_1(tptr))));
- switch (EXTRACT_8BITS(tptr)) {
+ switch (EXTRACT_U_1(tptr)) {
case ISIS_SUBTLV_AUTH_SIMPLE:
if (fn_printzp(ndo, tptr + 1, tlv_len - 1, ndo->ndo_snapend))
goto trunctlv;
case ISIS_SUBTLV_AUTH_MD5:
for(i=1;i<tlv_len;i++) {
ND_TCHECK_1(tptr + i);
- ND_PRINT((ndo, "%02x", EXTRACT_8BITS(tptr + i)));
+ ND_PRINT((ndo, "%02x", EXTRACT_U_1(tptr + i)));
}
if (tlv_len != ISIS_SUBTLV_AUTH_MD5_LEN+1)
ND_PRINT((ndo, ", (invalid subTLV) "));
break;
case ISIS_SUBTLV_AUTH_GENERIC:
ND_TCHECK_2(tptr + 1);
- key_id = EXTRACT_BE_16BITS(tptr + 1);
+ key_id = EXTRACT_BE_U_2(tptr + 1);
ND_PRINT((ndo, "%u, password: ", key_id));
for(i=1 + sizeof(uint16_t);i<tlv_len;i++) {
ND_TCHECK_1(tptr + i);
- ND_PRINT((ndo, "%02x", EXTRACT_8BITS(tptr + i)));
+ ND_PRINT((ndo, "%02x", EXTRACT_U_1(tptr + i)));
}
break;
case ISIS_SUBTLV_AUTH_PRIVATE:
if(tmp>=1) {
ND_TCHECK_1(tptr);
ND_PRINT((ndo, "\n\t Adjacency State: %s (%u)",
- tok2str(isis_ptp_adjancey_values, "unknown", EXTRACT_8BITS(tptr)),
- EXTRACT_8BITS(tptr)));
+ tok2str(isis_ptp_adjancey_values, "unknown", EXTRACT_U_1(tptr)),
+ EXTRACT_U_1(tptr)));
tmp--;
}
if(tmp>sizeof(tlv_ptp_adj->extd_local_circuit_id)) {
ND_TCHECK(tlv_ptp_adj->extd_local_circuit_id);
ND_PRINT((ndo, "\n\t Extended Local circuit-ID: 0x%08x",
- EXTRACT_BE_32BITS(tlv_ptp_adj->extd_local_circuit_id)));
+ EXTRACT_BE_U_4(tlv_ptp_adj->extd_local_circuit_id)));
tmp-=sizeof(tlv_ptp_adj->extd_local_circuit_id);
}
if(tmp>=SYSTEM_ID_LEN) {
if(tmp>=sizeof(tlv_ptp_adj->neighbor_extd_local_circuit_id)) {
ND_TCHECK(tlv_ptp_adj->neighbor_extd_local_circuit_id);
ND_PRINT((ndo, "\n\t Neighbor Extended Local circuit-ID: 0x%08x",
- EXTRACT_BE_32BITS(tlv_ptp_adj->neighbor_extd_local_circuit_id)));
+ EXTRACT_BE_U_4(tlv_ptp_adj->neighbor_extd_local_circuit_id)));
}
break;
ND_PRINT((ndo, "%s (0x%02x)",
tok2str(nlpid_values,
"unknown",
- EXTRACT_8BITS(tptr)),
- EXTRACT_8BITS(tptr)));
+ EXTRACT_U_1(tptr)),
+ EXTRACT_U_1(tptr)));
if (tmp>1) /* further NPLIDs ? - put comma */
ND_PRINT((ndo, ", "));
tptr++;
ND_TCHECK_2(tptr);
ND_PRINT((ndo, "\n\t RES: %d, MTID(s): %d",
- (EXTRACT_BE_16BITS(tptr) >> 12),
- (EXTRACT_BE_16BITS(tptr) & 0x0fff)));
+ (EXTRACT_BE_U_2(tptr) >> 12),
+ (EXTRACT_BE_U_2(tptr) & 0x0fff)));
tmp = tmp-2;
tptr = tptr+2;
ND_TCHECK_2(tptr);
ND_PRINT((ndo, "\n\t O: %d, RES: %d, MTID(s): %d",
- (EXTRACT_BE_16BITS(tptr) >> 15) & 0x01,
- (EXTRACT_BE_16BITS(tptr) >> 12) & 0x07,
- EXTRACT_BE_16BITS(tptr) & 0x0fff));
+ (EXTRACT_BE_U_2(tptr) >> 15) & 0x01,
+ (EXTRACT_BE_U_2(tptr) >> 12) & 0x07,
+ EXTRACT_BE_U_2(tptr) & 0x0fff));
tmp = tmp-2;
tptr = tptr+2;
if (tmp < 1)
break;
ND_TCHECK_1(tptr);
- ND_PRINT((ndo, ", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(EXTRACT_8BITS(tptr)) ? "numbered" : "unnumbered"));
+ ND_PRINT((ndo, ", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(EXTRACT_U_1(tptr)) ? "numbered" : "unnumbered"));
tptr++;
tmp--;
while (tmp>=4) {
ND_TCHECK_4(tptr);
- ND_PRINT((ndo, "\n\t Link-ID: 0x%08x", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Link-ID: 0x%08x", EXTRACT_BE_U_4(tptr)));
tptr+=4;
tmp-=4;
}
ND_PRINT((ndo, "\n\t lsp-id: %s",
isis_print_id(tlv_lsp->lsp_id, LSP_ID_LEN)));
ND_TCHECK2(tlv_lsp->sequence_number, 4);
- ND_PRINT((ndo, ", seq: 0x%08x", EXTRACT_BE_32BITS(tlv_lsp->sequence_number)));
+ ND_PRINT((ndo, ", seq: 0x%08x", EXTRACT_BE_U_4(tlv_lsp->sequence_number)));
ND_TCHECK2(tlv_lsp->remaining_lifetime, 2);
- ND_PRINT((ndo, ", lifetime: %5ds", EXTRACT_BE_16BITS(tlv_lsp->remaining_lifetime)));
+ ND_PRINT((ndo, ", lifetime: %5ds", EXTRACT_BE_U_2(tlv_lsp->remaining_lifetime)));
ND_TCHECK2(tlv_lsp->checksum, 2);
- ND_PRINT((ndo, ", chksum: 0x%04x", EXTRACT_BE_16BITS(tlv_lsp->checksum)));
+ ND_PRINT((ndo, ", chksum: 0x%04x", EXTRACT_BE_U_2(tlv_lsp->checksum)));
tmp-=sizeof(struct isis_tlv_lsp);
tlv_lsp++;
}
if (tmp < ISIS_TLV_CHECKSUM_MINLEN)
break;
ND_TCHECK2(*tptr, ISIS_TLV_CHECKSUM_MINLEN);
- ND_PRINT((ndo, "\n\t checksum: 0x%04x ", EXTRACT_BE_16BITS(tptr)));
+ ND_PRINT((ndo, "\n\t checksum: 0x%04x ", EXTRACT_BE_U_2(tptr)));
/* do not attempt to verify the checksum if it is zero
* most likely a HMAC-MD5 TLV is also present and
* to avoid conflicts the checksum TLV is zeroed.
* see rfc3358 for details
*/
- osi_print_cksum(ndo, optr, EXTRACT_BE_16BITS(tptr), tptr-optr,
+ osi_print_cksum(ndo, optr, EXTRACT_BE_U_2(tptr), tptr-optr,
length);
break;
break;
ND_TCHECK2(*tptr, ISIS_TLV_RESTART_SIGNALING_FLAGLEN);
ND_PRINT((ndo, "\n\t Flags [%s]",
- bittok2str(isis_restart_flag_values, "none", EXTRACT_8BITS(tptr))));
+ bittok2str(isis_restart_flag_values, "none", EXTRACT_U_1(tptr))));
tptr+=ISIS_TLV_RESTART_SIGNALING_FLAGLEN;
tmp-=ISIS_TLV_RESTART_SIGNALING_FLAGLEN;
break;
ND_TCHECK2(*tptr, ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN);
- ND_PRINT((ndo, ", Remaining holding time %us", EXTRACT_BE_16BITS(tptr)));
+ ND_PRINT((ndo, ", Remaining holding time %us", EXTRACT_BE_U_2(tptr)));
tptr+=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN;
tmp-=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN;
ND_PRINT((ndo, "\n\t Inter-Domain Information Type: %s",
tok2str(isis_subtlv_idrp_values,
"Unknown (0x%02x)",
- EXTRACT_8BITS(tptr))));
- isis_subtlv_idrp = EXTRACT_8BITS(tptr);
+ EXTRACT_U_1(tptr))));
+ isis_subtlv_idrp = EXTRACT_U_1(tptr);
tptr++;
switch (isis_subtlv_idrp) {
case ISIS_SUBTLV_IDRP_ASN:
ND_TCHECK_2(tptr); /* fetch AS number */
- ND_PRINT((ndo, "AS Number: %u", EXTRACT_BE_16BITS(tptr)));
+ ND_PRINT((ndo, "AS Number: %u", EXTRACT_BE_U_2(tptr)));
break;
case ISIS_SUBTLV_IDRP_LOCAL:
case ISIS_SUBTLV_IDRP_RES:
if (tmp < ISIS_TLV_LSP_BUFFERSIZE_MINLEN)
break;
ND_TCHECK2(*tptr, ISIS_TLV_LSP_BUFFERSIZE_MINLEN);
- ND_PRINT((ndo, "\n\t LSP Buffersize: %u", EXTRACT_BE_16BITS(tptr)));
+ ND_PRINT((ndo, "\n\t LSP Buffersize: %u", EXTRACT_BE_U_2(tptr)));
break;
case ISIS_TLV_PART_DIS:
while(tmp>0) {
ND_TCHECK_1(tptr);
- prefix_len=EXTRACT_8BITS(tptr); /* read out prefix length in semioctets*/
+ prefix_len=EXTRACT_U_1(tptr); /* read out prefix length in semioctets*/
tptr++;
if (prefix_len < 2) {
ND_PRINT((ndo, "\n\t\tAddress: prefix length %u < 2", prefix_len));
if (tmp < ISIS_TLV_IIH_SEQNR_MINLEN)
break;
ND_TCHECK2(*tptr, ISIS_TLV_IIH_SEQNR_MINLEN); /* check if four bytes are on the wire */
- ND_PRINT((ndo, "\n\t Sequence number: %u", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Sequence number: %u", EXTRACT_BE_U_4(tptr)));
break;
case ISIS_TLV_VENDOR_PRIVATE:
if (tmp < ISIS_TLV_VENDOR_PRIVATE_MINLEN)
break;
ND_TCHECK2(*tptr, ISIS_TLV_VENDOR_PRIVATE_MINLEN); /* check if enough byte for a full oui */
- vendor_id = EXTRACT_BE_24BITS(tptr);
+ vendor_id = EXTRACT_BE_U_3(tptr);
ND_PRINT((ndo, "\n\t Vendor: %s (%u)",
tok2str(oui_values, "Unknown", vendor_id),
vendor_id));
ND_PRINT((ndo, "proto %s (%u), vlan %u: ",
tok2str(juniper_protocol_values,"Unknown",gh->proto),
gh->proto,
- EXTRACT_BE_16BITS(&gh->vlan_id[0])));
+ EXTRACT_BE_U_2(&gh->vlan_id[0])));
}
switch (gh->proto) {
if (ndo->ndo_eflag) {
if (!es_type_bundle) {
ND_PRINT((ndo, "ES SA, index %u, ttl %u type %s (%u), spi %u, Tunnel %s > %s, length %u\n",
- EXTRACT_BE_16BITS(&ih->sa_index),
+ EXTRACT_BE_U_2(&ih->sa_index),
ih->ttl,
tok2str(juniper_ipsec_type_values,"Unknown",ih->type),
ih->type,
- EXTRACT_BE_32BITS(&ih->spi),
+ EXTRACT_BE_U_4(&ih->spi),
ipaddr_string(ndo, &ih->src_ip),
ipaddr_string(ndo, &ih->dst_ip),
l2info.length));
} else {
ND_PRINT((ndo, "ES SA, index %u, ttl %u type %s (%u), length %u\n",
- EXTRACT_BE_16BITS(&ih->sa_index),
+ EXTRACT_BE_U_2(&ih->sa_index),
ih->ttl,
tok2str(juniper_ipsec_type_values,"Unknown",ih->type),
ih->type,
ND_TCHECK(*mh);
if (ndo->ndo_eflag)
ND_PRINT((ndo, "service-id %u, iif %u, pkt-type %u: ",
- EXTRACT_BE_32BITS(&mh->service_id),
- EXTRACT_BE_16BITS(&mh->iif),
+ EXTRACT_BE_U_4(&mh->service_id),
+ EXTRACT_BE_U_2(&mh->iif),
mh->pkt_type));
/* no proto field - lets guess by first byte of IP header*/
ND_PRINT((ndo, "service-id %u flags 0x%02x service-set-id 0x%04x iif %u: ",
sh->svc_id,
sh->flags_len,
- EXTRACT_BE_16BITS(&sh->svc_set_id),
- EXTRACT_BE_24BITS(&sh->dir_iif[1])));
+ EXTRACT_BE_U_2(&sh->svc_set_id),
+ EXTRACT_BE_U_3(&sh->dir_iif[1])));
/* no proto field - lets guess by first byte of IP header*/
ip_heuristic_guess (ndo, p, l2info.length);
p+=l2info.header_len;
ND_TCHECK2(p[0], 2);
- extracted_ethertype = EXTRACT_BE_16BITS(p);
+ extracted_ethertype = EXTRACT_BE_U_2(p);
/* this DLT contains nothing but raw PPPoE frames,
* prepended with a type field*/
if (ethertype_print(ndo, extracted_ethertype,
/* suppress Bundle-ID if frame was captured on a child-link
* best indicator if the cookie looks like a proto */
if (ndo->ndo_eflag &&
- EXTRACT_BE_16BITS(&l2info.cookie) != PPP_OSI &&
- EXTRACT_BE_16BITS(&l2info.cookie) != (PPP_ADDRESS << 8 | PPP_CONTROL))
+ EXTRACT_BE_U_2(&l2info.cookie) != PPP_OSI &&
+ EXTRACT_BE_U_2(&l2info.cookie) != (PPP_ADDRESS << 8 | PPP_CONTROL))
ND_PRINT((ndo, "Bundle-ID %u: ", l2info.bundle));
p+=l2info.header_len;
}
/* zero length cookie ? */
- switch (EXTRACT_BE_16BITS(&l2info.cookie)) {
+ switch (EXTRACT_BE_U_2(&l2info.cookie)) {
case PPP_OSI:
ppp_print(ndo, p - 2, l2info.length + 2);
break;
}
/* suppress Bundle-ID if frame was captured on a child-link */
- if (ndo->ndo_eflag && EXTRACT_BE_32BITS(l2info.cookie) != 1)
+ if (ndo->ndo_eflag && EXTRACT_BE_U_4(l2info.cookie) != 1)
ND_PRINT((ndo, "Bundle-ID %u, ", l2info.bundle));
switch (l2info.proto) {
case (LLCSAP_ISONS<<8 | LLCSAP_ISONS):
p+=l2info.header_len;
/* suppress Bundle-ID if frame was captured on a child-link */
- if (ndo->ndo_eflag && EXTRACT_BE_32BITS(l2info.cookie) != 1)
+ if (ndo->ndo_eflag && EXTRACT_BE_U_4(l2info.cookie) != 1)
ND_PRINT((ndo, "Bundle-ID %u, ", l2info.bundle));
switch (l2info.proto) {
case (LLC_UI):
}
ND_TCHECK2(p[0], 3);
- if (EXTRACT_BE_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */
- EXTRACT_BE_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */
+ if (EXTRACT_BE_U_3(p) == 0xfefe03 || /* NLPID encaps ? */
+ EXTRACT_BE_U_3(p) == 0xaaaa03) { /* SNAP encaps ? */
llc_hdrlen = llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
if (llc_hdrlen > 0)
}
ND_TCHECK2(p[0], 3);
- if (EXTRACT_BE_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */
- EXTRACT_BE_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */
+ if (EXTRACT_BE_U_3(p) == 0xfefe03 || /* NLPID encaps ? */
+ EXTRACT_BE_U_3(p) == 0xaaaa03) { /* SNAP encaps ? */
llc_hdrlen = llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
if (llc_hdrlen > 0)
}
if (l2info.direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */
- (EXTRACT_BE_32BITS(l2info.cookie) & ATM2_GAP_COUNT_MASK)) {
+ (EXTRACT_BE_U_4(l2info.cookie) & ATM2_GAP_COUNT_MASK)) {
ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
return l2info.header_len;
}
juniper_ppp_heuristic_guess(netdissect_options *ndo,
register const u_char *p, u_int length)
{
- switch(EXTRACT_BE_16BITS(p)) {
+ switch(EXTRACT_BE_U_2(p)) {
case PPP_IP :
case PPP_OSI :
case PPP_MPLS_UCAST :
tlv_value = *p;
break;
case 2:
- tlv_value = EXTRACT_LE_16BITS(p);
+ tlv_value = EXTRACT_LE_U_2(p);
break;
case 3:
- tlv_value = EXTRACT_LE_24BITS(p);
+ tlv_value = EXTRACT_LE_U_3(p);
break;
case 4:
- tlv_value = EXTRACT_LE_32BITS(p);
+ tlv_value = EXTRACT_LE_U_4(p);
break;
default:
tlv_value = -1;
tlv_value = *p;
break;
case 2:
- tlv_value = EXTRACT_BE_16BITS(p);
+ tlv_value = EXTRACT_BE_U_2(p);
break;
case 3:
- tlv_value = EXTRACT_BE_24BITS(p);
+ tlv_value = EXTRACT_BE_U_3(p);
break;
case 4:
- tlv_value = EXTRACT_BE_32BITS(p);
+ tlv_value = EXTRACT_BE_U_4(p);
break;
default:
tlv_value = -1;
l2info->flags = p[3];
l2info->direction = p[3]&JUNIPER_BPF_PKT_IN;
- if (EXTRACT_BE_24BITS(p) != JUNIPER_MGC_NUMBER) { /* magic number found ? */
+ if (EXTRACT_BE_U_3(p) != JUNIPER_MGC_NUMBER) { /* magic number found ? */
ND_PRINT((ndo, "no magic-number found!"));
return 0;
}
/* ok to read extension length ? */
ND_TCHECK2(tptr[0], 2);
- jnx_ext_len = EXTRACT_BE_16BITS(tptr);
+ jnx_ext_len = EXTRACT_BE_U_2(tptr);
jnx_header_len += 2;
tptr +=2;
ND_TCHECK2(tptr[0], jnx_ext_len);
while (jnx_ext_len > JUNIPER_EXT_TLV_OVERHEAD) {
- tlv_type = EXTRACT_8BITS(tptr);
+ tlv_type = EXTRACT_U_1(tptr);
tptr++;
- tlv_len = EXTRACT_8BITS(tptr);
+ tlv_len = EXTRACT_U_1(tptr);
tptr++;
tlv_value = 0;
ND_TCHECK_2(p + l2info->cookie_len);
- l2info->proto = EXTRACT_BE_16BITS(p + l2info->cookie_len);
+ l2info->proto = EXTRACT_BE_U_2(p + l2info->cookie_len);
break;
}
++lp;
l2info->bundle = l2info->cookie[1];
break;
case AS_COOKIE_ID:
- l2info->bundle = (EXTRACT_BE_16BITS(&l2info->cookie[6])>>3)&0xfff;
+ l2info->bundle = (EXTRACT_BE_U_2(&l2info->cookie[6])>>3)&0xfff;
l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK;
break;
default:
case LS_COOKIE_ID:
ND_TCHECK2(p[0], 2);
l2info->bundle = l2info->cookie[1];
- l2info->proto = EXTRACT_BE_16BITS(p);
+ l2info->proto = EXTRACT_BE_U_2(p);
l2info->header_len += 2;
l2info->length -= 2;
l2info->caplen -= 2;
break;
case AS_COOKIE_ID:
- l2info->bundle = (EXTRACT_BE_16BITS(&l2info->cookie[6])>>3)&0xfff;
+ l2info->bundle = (EXTRACT_BE_U_2(&l2info->cookie[6])>>3)&0xfff;
l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK;
break;
default:
case LS_COOKIE_ID:
ND_TCHECK2(p[0], 2);
l2info->bundle = l2info->cookie[1];
- l2info->proto = EXTRACT_BE_16BITS(p);
+ l2info->proto = EXTRACT_BE_U_2(p);
l2info->header_len += 2;
l2info->length -= 2;
l2info->caplen -= 2;
break;
case AS_COOKIE_ID:
- l2info->bundle = (EXTRACT_BE_16BITS(&l2info->cookie[6])>>3)&0xfff;
+ l2info->bundle = (EXTRACT_BE_U_2(&l2info->cookie[6])>>3)&0xfff;
l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK;
break;
default:
ND_TCHECK2(p[0], 4);
/* ATM cell relay control word present ? */
if (l2info->cookie[7] & ATM2_PKT_TYPE_MASK) {
- control_word = EXTRACT_BE_32BITS(p);
+ control_word = EXTRACT_BE_U_4(p);
/* some control word heuristics */
switch(control_word) {
case 0: /* zero control word */
flag = 1;
while (s < ep) {
- c = EXTRACT_8BITS(s);
+ c = EXTRACT_U_1(s);
s++;
if (c == '\0') {
flag = 0;
#define PRINT if ((cp = c_print(ndo, cp, ndo->ndo_snapend)) == NULL) goto trunc
/* True if struct krb is little endian */
#define IS_LENDIAN(kp) (((kp)->type & 0x01) != 0)
-#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? EXTRACT_LE_16BITS(cp) : EXTRACT_BE_16BITS(cp))
+#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? EXTRACT_LE_U_2(cp) : EXTRACT_BE_U_2(cp))
kp = (const struct krb *)cp;
case AUTH_MSG_APPL_REQUEST:
cp += 2;
ND_TCHECK(*cp);
- ND_PRINT((ndo, "v%d ", EXTRACT_8BITS(cp)));
+ ND_PRINT((ndo, "v%d ", EXTRACT_U_1(cp)));
cp++;
PRINT;
ND_TCHECK(*cp);
- ND_PRINT((ndo, " (%d)", EXTRACT_8BITS(cp)));
+ ND_PRINT((ndo, " (%d)", EXTRACT_U_1(cp)));
cp++;
ND_TCHECK(*cp);
ND_PRINT((ndo, " (%d)", *cp));
{
u_int i;
for (i=0; i<length; i++) {
- ND_PRINT((ndo, "%c", EXTRACT_8BITS(dat)));
+ ND_PRINT((ndo, "%c", EXTRACT_U_1(dat)));
dat++;
}
}
{
u_int i;
for (i=0; i<length; i++) {
- ND_PRINT((ndo, "%02x", EXTRACT_8BITS(dat)));
+ ND_PRINT((ndo, "%02x", EXTRACT_U_1(dat)));
dat++;
}
}
static void
print_16bits_val(netdissect_options *ndo, const uint16_t *dat)
{
- ND_PRINT((ndo, "%u", EXTRACT_BE_16BITS(dat)));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_U_2(dat)));
}
static void
print_32bits_val(netdissect_options *ndo, const uint32_t *dat)
{
- ND_PRINT((ndo, "%lu", (u_long) EXTRACT_BE_32BITS(dat)));
+ ND_PRINT((ndo, "%lu", (u_long) EXTRACT_BE_U_4(dat)));
}
/***********************************/
return;
}
ND_PRINT((ndo, "%s", tok2str(l2tp_msgtype2str, "MSGTYPE-#%u",
- EXTRACT_BE_16BITS(ptr))));
+ EXTRACT_BE_U_2(ptr))));
}
static void
ND_PRINT((ndo, "AVP too short"));
return;
}
- ND_PRINT((ndo, "%u", EXTRACT_BE_16BITS(ptr)));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_U_2(ptr)));
ptr++;
length -= 2;
ND_PRINT((ndo, " AVP too short"));
return;
}
- ND_PRINT((ndo, "/%u", EXTRACT_BE_16BITS(ptr)));
+ ND_PRINT((ndo, "/%u", EXTRACT_BE_U_2(ptr)));
ptr++;
length -= 2;
ND_PRINT((ndo, "AVP too short"));
return;
}
- ND_PRINT((ndo, "%u.%u", (EXTRACT_BE_16BITS(dat) >> 8),
- (EXTRACT_BE_16BITS(dat) & 0xff)));
+ ND_PRINT((ndo, "%u.%u", (EXTRACT_BE_U_2(dat) >> 8),
+ (EXTRACT_BE_U_2(dat) & 0xff)));
}
static void
ND_PRINT((ndo, "AVP too short"));
return;
}
- if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_CAP_ASYNC_MASK) {
+ if (EXTRACT_BE_U_4(ptr) & L2TP_FRAMING_CAP_ASYNC_MASK) {
ND_PRINT((ndo, "A"));
}
- if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_CAP_SYNC_MASK) {
+ if (EXTRACT_BE_U_4(ptr) & L2TP_FRAMING_CAP_SYNC_MASK) {
ND_PRINT((ndo, "S"));
}
}
ND_PRINT((ndo, "AVP too short"));
return;
}
- if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_CAP_ANALOG_MASK) {
+ if (EXTRACT_BE_U_4(ptr) & L2TP_BEARER_CAP_ANALOG_MASK) {
ND_PRINT((ndo, "A"));
}
- if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_CAP_DIGITAL_MASK) {
+ if (EXTRACT_BE_U_4(ptr) & L2TP_BEARER_CAP_DIGITAL_MASK) {
ND_PRINT((ndo, "D"));
}
}
ND_PRINT((ndo, "AVP too short"));
return;
}
- if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) {
+ if (EXTRACT_BE_U_4(ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) {
ND_PRINT((ndo, "A"));
}
- if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) {
+ if (EXTRACT_BE_U_4(ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) {
ND_PRINT((ndo, "D"));
}
}
ND_PRINT((ndo, "AVP too short"));
return;
}
- if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_TYPE_ASYNC_MASK) {
+ if (EXTRACT_BE_U_4(ptr) & L2TP_FRAMING_TYPE_ASYNC_MASK) {
ND_PRINT((ndo, "A"));
}
- if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_TYPE_SYNC_MASK) {
+ if (EXTRACT_BE_U_4(ptr) & L2TP_FRAMING_TYPE_SYNC_MASK) {
ND_PRINT((ndo, "S"));
}
}
return;
}
ND_PRINT((ndo, "%s", tok2str(l2tp_authentype2str,
- "AuthType-#%u", EXTRACT_BE_16BITS(ptr))));
+ "AuthType-#%u", EXTRACT_BE_U_2(ptr))));
}
static void
ND_PRINT((ndo, "AVP too short"));
return;
}
- ND_PRINT((ndo, "%u", EXTRACT_BE_16BITS(ptr) & L2TP_PROXY_AUTH_ID_MASK));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_U_2(ptr) & L2TP_PROXY_AUTH_ID_MASK));
}
static void
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
- val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
+ val_h = EXTRACT_BE_U_2(ptr); ptr++; length -= 2;
+ val_l = EXTRACT_BE_U_2(ptr); ptr++; length -= 2;
ND_PRINT((ndo, "CRCErr=%u ", (val_h<<16) + val_l));
if (length < 4) {
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
- val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
+ val_h = EXTRACT_BE_U_2(ptr); ptr++; length -= 2;
+ val_l = EXTRACT_BE_U_2(ptr); ptr++; length -= 2;
ND_PRINT((ndo, "FrameErr=%u ", (val_h<<16) + val_l));
if (length < 4) {
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
- val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
+ val_h = EXTRACT_BE_U_2(ptr); ptr++; length -= 2;
+ val_l = EXTRACT_BE_U_2(ptr); ptr++; length -= 2;
ND_PRINT((ndo, "HardOver=%u ", (val_h<<16) + val_l));
if (length < 4) {
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
- val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
+ val_h = EXTRACT_BE_U_2(ptr); ptr++; length -= 2;
+ val_l = EXTRACT_BE_U_2(ptr); ptr++; length -= 2;
ND_PRINT((ndo, "BufOver=%u ", (val_h<<16) + val_l));
if (length < 4) {
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
- val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
+ val_h = EXTRACT_BE_U_2(ptr); ptr++; length -= 2;
+ val_l = EXTRACT_BE_U_2(ptr); ptr++; length -= 2;
ND_PRINT((ndo, "Timeout=%u ", (val_h<<16) + val_l));
if (length < 4) {
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_BE_16BITS(ptr); ptr++;
- val_l = EXTRACT_BE_16BITS(ptr); ptr++;
+ val_h = EXTRACT_BE_U_2(ptr); ptr++;
+ val_l = EXTRACT_BE_U_2(ptr); ptr++;
ND_PRINT((ndo, "AlignErr=%u ", (val_h<<16) + val_l));
}
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
- val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
+ val_h = EXTRACT_BE_U_2(ptr); ptr++; length -= 2;
+ val_l = EXTRACT_BE_U_2(ptr); ptr++; length -= 2;
ND_PRINT((ndo, "send=%08x ", (val_h<<16) + val_l));
if (length < 4) {
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_BE_16BITS(ptr); ptr++;
- val_l = EXTRACT_BE_16BITS(ptr); ptr++;
+ val_h = EXTRACT_BE_U_2(ptr); ptr++;
+ val_l = EXTRACT_BE_U_2(ptr); ptr++;
ND_PRINT((ndo, "recv=%08x ", (val_h<<16) + val_l));
}
return;
}
/* Disconnect Code */
- ND_PRINT((ndo, "%04x, ", EXTRACT_BE_16BITS(dat)));
+ ND_PRINT((ndo, "%04x, ", EXTRACT_BE_U_2(dat)));
dat += 2;
length -= 2;
/* Control Protocol Number */
- ND_PRINT((ndo, "%04x ", EXTRACT_BE_16BITS(dat)));
+ ND_PRINT((ndo, "%04x ", EXTRACT_BE_U_2(dat)));
dat += 2;
length -= 2;
/* Direction */
ND_PRINT((ndo, "%s", tok2str(l2tp_cc_direction2str,
- "Direction-#%u", EXTRACT_8BITS(ptr))));
+ "Direction-#%u", EXTRACT_U_1(ptr))));
ptr++;
length--;
ND_PRINT((ndo, " "));
ND_TCHECK(*ptr); /* Flags & Length */
- len = EXTRACT_BE_16BITS(ptr) & L2TP_AVP_HDR_LEN_MASK;
+ len = EXTRACT_BE_U_2(ptr) & L2TP_AVP_HDR_LEN_MASK;
/* If it is not long enough to contain the header, we'll give up. */
if (len < 6)
* check whether we go past the end of the AVP.
*/
- if (EXTRACT_BE_16BITS(ptr) & L2TP_AVP_HDR_FLAG_MANDATORY) {
+ if (EXTRACT_BE_U_2(ptr) & L2TP_AVP_HDR_FLAG_MANDATORY) {
ND_PRINT((ndo, "*"));
}
- if (EXTRACT_BE_16BITS(ptr) & L2TP_AVP_HDR_FLAG_HIDDEN) {
+ if (EXTRACT_BE_U_2(ptr) & L2TP_AVP_HDR_FLAG_HIDDEN) {
hidden = TRUE;
ND_PRINT((ndo, "?"));
}
ptr++;
- if (EXTRACT_BE_16BITS(ptr)) {
+ if (EXTRACT_BE_U_2(ptr)) {
/* Vendor Specific Attribute */
- ND_PRINT((ndo, "VENDOR%04x:", EXTRACT_BE_16BITS(ptr))); ptr++;
- ND_PRINT((ndo, "ATTR%04x", EXTRACT_BE_16BITS(ptr))); ptr++;
+ ND_PRINT((ndo, "VENDOR%04x:", EXTRACT_BE_U_2(ptr))); ptr++;
+ ND_PRINT((ndo, "ATTR%04x", EXTRACT_BE_U_2(ptr))); ptr++;
ND_PRINT((ndo, "("));
print_octets(ndo, (const u_char *)ptr, len-6);
ND_PRINT((ndo, ")"));
} else {
/* IETF-defined Attributes */
ptr++;
- attr_type = EXTRACT_BE_16BITS(ptr); ptr++;
+ attr_type = EXTRACT_BE_U_2(ptr); ptr++;
ND_PRINT((ndo, "%s", tok2str(l2tp_avp2str, "AVP-#%u", attr_type)));
ND_PRINT((ndo, "("));
if (hidden) {
flag_t = flag_l = flag_s = flag_o = FALSE;
ND_TCHECK2(*ptr, 2); /* Flags & Version */
- if ((EXTRACT_BE_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) {
+ if ((EXTRACT_BE_U_2(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) {
ND_PRINT((ndo, " l2tp:"));
- } else if ((EXTRACT_BE_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2F) {
+ } else if ((EXTRACT_BE_U_2(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2F) {
ND_PRINT((ndo, " l2f:"));
return; /* nothing to do */
} else {
}
ND_PRINT((ndo, "["));
- if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_TYPE) {
+ if (EXTRACT_BE_U_2(ptr) & L2TP_FLAG_TYPE) {
flag_t = TRUE;
ND_PRINT((ndo, "T"));
}
- if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_LENGTH) {
+ if (EXTRACT_BE_U_2(ptr) & L2TP_FLAG_LENGTH) {
flag_l = TRUE;
ND_PRINT((ndo, "L"));
}
- if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_SEQUENCE) {
+ if (EXTRACT_BE_U_2(ptr) & L2TP_FLAG_SEQUENCE) {
flag_s = TRUE;
ND_PRINT((ndo, "S"));
}
- if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_OFFSET) {
+ if (EXTRACT_BE_U_2(ptr) & L2TP_FLAG_OFFSET) {
flag_o = TRUE;
ND_PRINT((ndo, "O"));
}
- if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_PRIORITY)
+ if (EXTRACT_BE_U_2(ptr) & L2TP_FLAG_PRIORITY)
ND_PRINT((ndo, "P"));
ND_PRINT((ndo, "]"));
if (flag_l) {
ND_TCHECK2(*ptr, 2); /* Length */
- l2tp_len = EXTRACT_BE_16BITS(ptr);
+ l2tp_len = EXTRACT_BE_U_2(ptr);
ptr += 2;
cnt += 2;
} else {
}
ND_TCHECK2(*ptr, 2); /* Tunnel ID */
- ND_PRINT((ndo, "(%u/", EXTRACT_BE_16BITS(ptr)));
+ ND_PRINT((ndo, "(%u/", EXTRACT_BE_U_2(ptr)));
ptr += 2;
cnt += 2;
ND_TCHECK2(*ptr, 2); /* Session ID */
- ND_PRINT((ndo, "%u)", EXTRACT_BE_16BITS(ptr)));
+ ND_PRINT((ndo, "%u)", EXTRACT_BE_U_2(ptr)));
ptr += 2;
cnt += 2;
if (flag_s) {
ND_TCHECK2(*ptr, 2); /* Ns */
- ND_PRINT((ndo, "Ns=%u,", EXTRACT_BE_16BITS(ptr)));
+ ND_PRINT((ndo, "Ns=%u,", EXTRACT_BE_U_2(ptr)));
ptr += 2;
cnt += 2;
ND_TCHECK2(*ptr, 2); /* Nr */
- ND_PRINT((ndo, "Nr=%u", EXTRACT_BE_16BITS(ptr)));
+ ND_PRINT((ndo, "Nr=%u", EXTRACT_BE_U_2(ptr)));
ptr += 2;
cnt += 2;
}
if (flag_o) {
ND_TCHECK2(*ptr, 2); /* Offset Size */
- pad = EXTRACT_BE_16BITS(ptr);
+ pad = EXTRACT_BE_U_2(ptr);
ptr += (2 + pad);
cnt += (2 + pad);
}
static void
lane_hdr_print(netdissect_options *ndo, const u_char *bp)
{
- ND_PRINT((ndo, "lecid:%x ", EXTRACT_BE_16BITS(bp)));
+ ND_PRINT((ndo, "lecid:%x ", EXTRACT_BE_U_2(bp)));
}
/*
}
lec = (const struct lane_controlhdr *)p;
- if (EXTRACT_BE_16BITS(&lec->lec_header) == 0xff00) {
+ if (EXTRACT_BE_U_2(&lec->lec_header) == 0xff00) {
/*
* LE Control.
*/
ND_PRINT((ndo, "lec: proto %x vers %x %s",
lec->lec_proto, lec->lec_vers,
- tok2str(lecop2str, "opcode-#%u", EXTRACT_BE_16BITS(&lec->lec_opcode))));
+ tok2str(lecop2str, "opcode-#%u", EXTRACT_BE_U_2(&lec->lec_opcode))));
return;
}
ldp_tlv_header = (const struct ldp_tlv_header *)tptr;
ND_TCHECK(*ldp_tlv_header);
- tlv_len=EXTRACT_BE_16BITS(ldp_tlv_header->length);
+ tlv_len=EXTRACT_BE_U_2(ldp_tlv_header->length);
if (tlv_len + 4 > msg_tlen) {
ND_PRINT((ndo, "\n\t\t TLV contents go past end of message"));
return 0;
}
tlv_tlen=tlv_len;
- tlv_type=LDP_MASK_TLV_TYPE(EXTRACT_BE_16BITS(ldp_tlv_header->type));
+ tlv_type=LDP_MASK_TLV_TYPE(EXTRACT_BE_U_2(ldp_tlv_header->type));
/* FIXME vendor private / experimental check */
ND_PRINT((ndo, "\n\t %s TLV (0x%04x), length: %u, Flags: [%s and %s forward if unknown]",
tlv_type),
tlv_type,
tlv_len,
- LDP_MASK_U_BIT(EXTRACT_BE_16BITS(&ldp_tlv_header->type)) ? "continue processing" : "ignore",
- LDP_MASK_F_BIT(EXTRACT_BE_16BITS(&ldp_tlv_header->type)) ? "do" : "don't"));
+ LDP_MASK_U_BIT(EXTRACT_BE_U_2(&ldp_tlv_header->type)) ? "continue processing" : "ignore",
+ LDP_MASK_F_BIT(EXTRACT_BE_U_2(&ldp_tlv_header->type)) ? "do" : "don't"));
tptr+=sizeof(struct ldp_tlv_header);
case LDP_TLV_COMMON_HELLO:
TLV_TCHECK(4);
ND_PRINT((ndo, "\n\t Hold Time: %us, Flags: [%s Hello%s]",
- EXTRACT_BE_16BITS(tptr),
- (EXTRACT_BE_16BITS(tptr + 2)&0x8000) ? "Targeted" : "Link",
- (EXTRACT_BE_16BITS(tptr + 2)&0x4000) ? ", Request for targeted Hellos" : ""));
+ EXTRACT_BE_U_2(tptr),
+ (EXTRACT_BE_U_2(tptr + 2)&0x8000) ? "Targeted" : "Link",
+ (EXTRACT_BE_U_2(tptr + 2)&0x4000) ? ", Request for targeted Hellos" : ""));
break;
case LDP_TLV_IPV4_TRANSPORT_ADDR:
break;
case LDP_TLV_CONFIG_SEQ_NUMBER:
TLV_TCHECK(4);
- ND_PRINT((ndo, "\n\t Sequence Number: %u", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Sequence Number: %u", EXTRACT_BE_U_4(tptr)));
break;
case LDP_TLV_ADDRESS_LIST:
TLV_TCHECK(LDP_TLV_ADDRESS_LIST_AFNUM_LEN);
- af = EXTRACT_BE_16BITS(tptr);
+ af = EXTRACT_BE_U_2(tptr);
tptr+=LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
tlv_tlen -= LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
ND_PRINT((ndo, "\n\t Address Family: %s, addresses",
case LDP_TLV_COMMON_SESSION:
TLV_TCHECK(8);
ND_PRINT((ndo, "\n\t Version: %u, Keepalive: %us, Flags: [Downstream %s, Loop Detection %s]",
- EXTRACT_BE_16BITS(tptr), EXTRACT_BE_16BITS(tptr + 2),
- (EXTRACT_BE_16BITS(tptr + 6)&0x8000) ? "On Demand" : "Unsolicited",
- (EXTRACT_BE_16BITS(tptr + 6)&0x4000) ? "Enabled" : "Disabled"
+ EXTRACT_BE_U_2(tptr), EXTRACT_BE_U_2(tptr + 2),
+ (EXTRACT_BE_U_2(tptr + 6)&0x8000) ? "On Demand" : "Unsolicited",
+ (EXTRACT_BE_U_2(tptr + 6)&0x4000) ? "Enabled" : "Disabled"
));
break;
break;
case LDP_FEC_PREFIX:
TLV_TCHECK(2);
- af = EXTRACT_BE_16BITS(tptr);
+ af = EXTRACT_BE_U_2(tptr);
tptr+=LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
tlv_tlen-=LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
if (af == AFNUM_INET) {
* Pseudowire Types.
*/
TLV_TCHECK(7);
- vc_info_len = EXTRACT_8BITS(tptr + 2);
+ vc_info_len = EXTRACT_U_1(tptr + 2);
/*
* According to RFC 4908, the VC info Length field can be zero,
*/
if (vc_info_len == 0) {
ND_PRINT((ndo, ": %s, %scontrol word, group-ID %u, VC-info-length: %u",
- tok2str(mpls_pw_types_values, "Unknown", EXTRACT_BE_16BITS(tptr)&0x7fff),
- EXTRACT_BE_16BITS(tptr)&0x8000 ? "" : "no ",
- EXTRACT_BE_32BITS(tptr + 3),
+ tok2str(mpls_pw_types_values, "Unknown", EXTRACT_BE_U_2(tptr)&0x7fff),
+ EXTRACT_BE_U_2(tptr)&0x8000 ? "" : "no ",
+ EXTRACT_BE_U_4(tptr + 3),
vc_info_len));
break;
}
/* Make sure we have the VC ID as well */
TLV_TCHECK(11);
ND_PRINT((ndo, ": %s, %scontrol word, group-ID %u, VC-ID %u, VC-info-length: %u",
- tok2str(mpls_pw_types_values, "Unknown", EXTRACT_BE_16BITS(tptr)&0x7fff),
- EXTRACT_BE_16BITS(tptr)&0x8000 ? "" : "no ",
- EXTRACT_BE_32BITS(tptr + 3),
- EXTRACT_BE_32BITS(tptr + 7),
+ tok2str(mpls_pw_types_values, "Unknown", EXTRACT_BE_U_2(tptr)&0x7fff),
+ EXTRACT_BE_U_2(tptr)&0x8000 ? "" : "no ",
+ EXTRACT_BE_U_4(tptr + 3),
+ EXTRACT_BE_U_4(tptr + 7),
vc_info_len));
if (vc_info_len < 4) {
/* minimum 4, for the VC ID */
while (vc_info_len > 2) {
vc_info_tlv_type = *tptr;
- vc_info_tlv_len = EXTRACT_8BITS(tptr + 1);
+ vc_info_tlv_len = EXTRACT_U_1(tptr + 1);
if (vc_info_tlv_len < 2)
break;
if (vc_info_len < vc_info_tlv_len)
switch(vc_info_tlv_type) {
case LDP_FEC_MARTINI_IFPARM_MTU:
- ND_PRINT((ndo, ": %u", EXTRACT_BE_16BITS(tptr + 2)));
+ ND_PRINT((ndo, ": %u", EXTRACT_BE_U_2(tptr + 2)));
break;
case LDP_FEC_MARTINI_IFPARM_DESC:
case LDP_FEC_MARTINI_IFPARM_VCCV:
ND_PRINT((ndo, "\n\t\t Control Channels (0x%02x) = [%s]",
- EXTRACT_8BITS((tptr + 2)),
- bittok2str(ldp_fec_martini_ifparm_vccv_cc_values, "none", EXTRACT_8BITS((tptr + 2)))));
+ EXTRACT_U_1((tptr + 2)),
+ bittok2str(ldp_fec_martini_ifparm_vccv_cc_values, "none", EXTRACT_U_1((tptr + 2)))));
ND_PRINT((ndo, "\n\t\t CV Types (0x%02x) = [%s]",
- EXTRACT_8BITS((tptr + 3)),
- bittok2str(ldp_fec_martini_ifparm_vccv_cv_values, "none", EXTRACT_8BITS((tptr + 3)))));
+ EXTRACT_U_1((tptr + 3)),
+ bittok2str(ldp_fec_martini_ifparm_vccv_cv_values, "none", EXTRACT_U_1((tptr + 3)))));
break;
default:
case LDP_TLV_GENERIC_LABEL:
TLV_TCHECK(4);
- ND_PRINT((ndo, "\n\t Label: %u", EXTRACT_BE_32BITS(tptr) & 0xfffff));
+ ND_PRINT((ndo, "\n\t Label: %u", EXTRACT_BE_U_4(tptr) & 0xfffff));
break;
case LDP_TLV_STATUS:
TLV_TCHECK(8);
- ui = EXTRACT_BE_32BITS(tptr);
+ ui = EXTRACT_BE_U_4(tptr);
tptr+=4;
ND_PRINT((ndo, "\n\t Status: 0x%02x, Flags: [%s and %s forward]",
ui&0x3fffffff,
ui&0x80000000 ? "Fatal error" : "Advisory Notification",
ui&0x40000000 ? "do" : "don't"));
- ui = EXTRACT_BE_32BITS(tptr);
+ ui = EXTRACT_BE_U_4(tptr);
tptr+=4;
if (ui)
ND_PRINT((ndo, ", causing Message ID: 0x%08x", ui));
case LDP_TLV_FT_SESSION:
TLV_TCHECK(8);
- ft_flags = EXTRACT_BE_16BITS(tptr);
+ ft_flags = EXTRACT_BE_U_2(tptr);
ND_PRINT((ndo, "\n\t Flags: [%sReconnect, %sSave State, %sAll-Label Protection, %s Checkpoint, %sRe-Learn State]",
ft_flags&0x8000 ? "" : "No ",
ft_flags&0x8 ? "" : "Don't ",
ft_flags&0x2 ? "Sequence Numbered Label" : "All Labels",
ft_flags&0x1 ? "" : "Don't "));
tptr+=4;
- ui = EXTRACT_BE_32BITS(tptr);
+ ui = EXTRACT_BE_U_4(tptr);
if (ui)
ND_PRINT((ndo, ", Reconnect Timeout: %ums", ui));
tptr+=4;
- ui = EXTRACT_BE_32BITS(tptr);
+ ui = EXTRACT_BE_U_4(tptr);
if (ui)
ND_PRINT((ndo, ", Recovery Time: %ums", ui));
break;
case LDP_TLV_MTU:
TLV_TCHECK(2);
- ND_PRINT((ndo, "\n\t MTU: %u", EXTRACT_BE_16BITS(tptr)));
+ ND_PRINT((ndo, "\n\t MTU: %u", EXTRACT_BE_U_2(tptr)));
break;
/*
* Sanity checking of the header.
*/
- if (EXTRACT_BE_16BITS(&ldp_com_header->version) != LDP_VERSION) {
+ if (EXTRACT_BE_U_2(&ldp_com_header->version) != LDP_VERSION) {
ND_PRINT((ndo, "%sLDP version %u packet not supported",
(ndo->ndo_vflag < 1) ? "" : "\n\t",
- EXTRACT_BE_16BITS(&ldp_com_header->version)));
+ EXTRACT_BE_U_2(&ldp_com_header->version)));
return 0;
}
- pdu_len = EXTRACT_BE_16BITS(&ldp_com_header->pdu_length);
+ pdu_len = EXTRACT_BE_U_2(&ldp_com_header->pdu_length);
if (pdu_len < sizeof(struct ldp_common_header)-4) {
/* length too short */
ND_PRINT((ndo, "%sLDP, pdu-length: %u (too short, < %u)",
ND_PRINT((ndo, "%sLDP, Label-Space-ID: %s:%u, pdu-length: %u",
(ndo->ndo_vflag < 1) ? "" : "\n\t",
ipaddr_string(ndo, &ldp_com_header->lsr_id),
- EXTRACT_BE_16BITS(&ldp_com_header->label_space),
+ EXTRACT_BE_U_2(&ldp_com_header->label_space),
pdu_len));
/* bail out if non-verbose */
ND_TCHECK2(*tptr, sizeof(struct ldp_msg_header));
ldp_msg_header = (const struct ldp_msg_header *)tptr;
- msg_len=EXTRACT_BE_16BITS(ldp_msg_header->length);
- msg_type=LDP_MASK_MSG_TYPE(EXTRACT_BE_16BITS(ldp_msg_header->type));
+ msg_len=EXTRACT_BE_U_2(ldp_msg_header->length);
+ msg_type=LDP_MASK_MSG_TYPE(EXTRACT_BE_U_2(ldp_msg_header->type));
if (msg_len < sizeof(struct ldp_msg_header)-4) {
/* length too short */
msg_type),
msg_type,
msg_len,
- EXTRACT_BE_32BITS(&ldp_msg_header->id),
- LDP_MASK_U_BIT(EXTRACT_BE_16BITS(&ldp_msg_header->type)) ? "continue processing" : "ignore"));
+ EXTRACT_BE_U_4(&ldp_msg_header->id),
+ LDP_MASK_U_BIT(EXTRACT_BE_U_2(&ldp_msg_header->type)) ? "continue processing" : "ignore"));
msg_tptr=tptr+sizeof(struct ldp_msg_header);
msg_tlen=msg_len-(sizeof(struct ldp_msg_header)-4); /* Type & Length fields not included */
xtr_present = is_xtr_data_present(type, lisp_hdr->type_and_flag);
/* Extract the number of EID records present */
- auth_data_len = EXTRACT_BE_16BITS(&lisp_hdr->auth_data_len);
+ auth_data_len = EXTRACT_BE_U_2(&lisp_hdr->auth_data_len);
packet_iterator = (const u_char *)(lisp_hdr);
packet_offset = MAP_REGISTER_HDR_LEN;
record_count = lisp_hdr->record_count;
if (ndo->ndo_vflag) {
- key_id = EXTRACT_BE_16BITS(&lisp_hdr->key_id);
+ key_id = EXTRACT_BE_U_2(&lisp_hdr->key_id);
ND_PRINT((ndo, "\n %u record(s), ", record_count));
ND_PRINT((ndo, "Authentication %s,",
tok2str(auth_type, "unknown-type", key_id)));
((const u_char *)lisp_hdr + packet_offset);
packet_offset += MAP_REGISTER_EID_LEN;
mask_len = lisp_eid->eid_prefix_mask_length;
- eid_afi = EXTRACT_BE_16BITS(&lisp_eid->eid_prefix_afi);
+ eid_afi = EXTRACT_BE_U_2(&lisp_eid->eid_prefix_afi);
loc_count = lisp_eid->locator_count;
if (ndo->ndo_vflag) {
- ttl = EXTRACT_BE_32BITS(&lisp_eid->ttl);
+ ttl = EXTRACT_BE_U_4(&lisp_eid->ttl);
ND_PRINT((ndo, " Record TTL %u,", ttl));
action_flag(ndo, lisp_eid->act_auth_inc_res);
map_version = (((lisp_eid->reserved_version_hi) & 15 ) * 255) +
lisp_loc = (const lisp_map_register_loc *) (packet_iterator + packet_offset);
loc_ip_pointer = (const u_char *) (lisp_loc + 1);
packet_offset += MAP_REGISTER_LOC_LEN;
- loc_afi = EXTRACT_BE_16BITS(&lisp_loc->locator_afi);
+ loc_afi = EXTRACT_BE_U_2(&lisp_loc->locator_afi);
if (ndo->ndo_vflag)
ND_PRINT((ndo, "\n "));
lisp_loc->priority, lisp_loc->weight,
lisp_loc->m_priority, lisp_loc->m_weight));
loc_hdr_flag(ndo,
- EXTRACT_BE_16BITS(&lisp_loc->unused_and_flag));
+ EXTRACT_BE_U_2(&lisp_loc->unused_and_flag));
}
}
}
goto invalid;
hex_print_with_offset(ndo, "\n xTR-ID: ", packet_iterator + packet_offset, 16, 0);
ND_PRINT((ndo, "\n SITE-ID: %" PRIu64,
- EXTRACT_BE_64BITS(packet_iterator + packet_offset + 16)));
+ EXTRACT_BE_U_8(packet_iterator + packet_offset + 16)));
} else {
/* Check if packet isn't over yet */
if (packet_iterator + packet_offset < ndo->ndo_snapend) {
if (type == LISP_MAP_REGISTER) {
ND_PRINT((ndo, " flags [%s],", bittok2str(map_register_hdr_flag,
- "none", EXTRACT_BE_32BITS(lisp_hdr))));
+ "none", EXTRACT_BE_U_4(lisp_hdr))));
} else if (type == LISP_MAP_NOTIFY) {
ND_PRINT((ndo, " flags [%s],", bittok2str(map_notify_hdr_flag,
- "none", EXTRACT_BE_32BITS(lisp_hdr))));
+ "none", EXTRACT_BE_U_4(lisp_hdr))));
}
return;
}
dsap_field = *p;
- ssap_field = EXTRACT_8BITS(p + 1);
+ ssap_field = EXTRACT_U_1(p + 1);
/*
* OK, what type of LLC frame is this? The length
* have a two-byte control field, and U frames have
* a one-byte control field.
*/
- control = EXTRACT_8BITS(p + 2);
+ control = EXTRACT_U_1(p + 2);
if ((control & LLC_U_FMT) == LLC_U_FMT) {
/*
* U frame.
/*
* ...and is little-endian.
*/
- control = EXTRACT_LE_16BITS(p + 2);
+ control = EXTRACT_LE_U_2(p + 2);
is_u = 0;
hdrlen = 4; /* DSAP, SSAP, 2-byte control field */
}
ND_TCHECK2(*p, 5);
if (caplen < 5 || length < 5)
goto trunc;
- orgcode = EXTRACT_BE_24BITS(p);
- et = EXTRACT_BE_16BITS(p + 3);
+ orgcode = EXTRACT_BE_U_3(p);
+ et = EXTRACT_BE_U_2(p + 3);
if (ndo->ndo_eflag) {
/*
if (tlv_len < 4) {
return hexdump;
}
- subtype = EXTRACT_8BITS(tptr + 3);
+ subtype = EXTRACT_U_1(tptr + 3);
ND_PRINT((ndo, "\n\t %s Subtype (%u)",
tok2str(lldp_8021_subtype_values, "unknown", subtype),
return hexdump;
}
ND_PRINT((ndo, "\n\t port vlan id (PVID): %u",
- EXTRACT_BE_16BITS(tptr + 4)));
+ EXTRACT_BE_U_2(tptr + 4)));
break;
case LLDP_PRIVATE_8021_SUBTYPE_PROTOCOL_VLAN_ID:
if (tlv_len < 7) {
return hexdump;
}
ND_PRINT((ndo, "\n\t port and protocol vlan id (PPVID): %u, flags [%s] (0x%02x)",
- EXTRACT_BE_16BITS(tptr + 5),
- bittok2str(lldp_8021_port_protocol_id_values, "none", EXTRACT_8BITS((tptr + 4))),
+ EXTRACT_BE_U_2(tptr + 5),
+ bittok2str(lldp_8021_port_protocol_id_values, "none", EXTRACT_U_1((tptr + 4))),
*(tptr + 4)));
break;
case LLDP_PRIVATE_8021_SUBTYPE_VLAN_NAME:
if (tlv_len < 6) {
return hexdump;
}
- ND_PRINT((ndo, "\n\t vlan id (VID): %u", EXTRACT_BE_16BITS(tptr + 4)));
+ ND_PRINT((ndo, "\n\t vlan id (VID): %u", EXTRACT_BE_U_2(tptr + 4)));
if (tlv_len < 7) {
return hexdump;
}
- sublen = EXTRACT_8BITS(tptr + 6);
+ sublen = EXTRACT_U_1(tptr + 6);
if (tlv_len < 7+sublen) {
return hexdump;
}
if (tlv_len < 5) {
return hexdump;
}
- sublen = EXTRACT_8BITS(tptr + 4);
+ sublen = EXTRACT_U_1(tptr + 4);
if (tlv_len < 5+sublen) {
return hexdump;
}
if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_CONGESTION_NOTIFICATION_LENGTH){
return hexdump;
}
- tval=EXTRACT_8BITS(tptr + 4);
+ tval=EXTRACT_U_1(tptr + 4);
ND_PRINT((ndo, "\n\t Pre-Priority CNPV Indicator"));
ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7"));
ND_PRINT((ndo, "\n\t Value : "));
for(i=0;i<NO_OF_BITS;i++)
ND_PRINT((ndo, "%-2d ", (tval >> i) & 0x01));
- tval=EXTRACT_8BITS(tptr + 5);
+ tval=EXTRACT_U_1(tptr + 5);
ND_PRINT((ndo, "\n\t Pre-Priority Ready Indicator"));
ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7"));
ND_PRINT((ndo, "\n\t Value : "));
if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_ETS_CONFIGURATION_LENGTH) {
return hexdump;
}
- tval=EXTRACT_8BITS(tptr + 4);
+ tval=EXTRACT_U_1(tptr + 4);
ND_PRINT((ndo, "\n\t Willing:%d, CBS:%d, RES:%d, Max TCs:%d",
tval >> 7, (tval >> 6) & 0x02, (tval >> 3) & 0x07, tval & 0x07));
if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_PFC_CONFIGURATION_LENGTH) {
return hexdump;
}
- tval=EXTRACT_8BITS(tptr + 4);
+ tval=EXTRACT_U_1(tptr + 4);
ND_PRINT((ndo, "\n\t Willing: %d, MBC: %d, RES: %d, PFC cap:%d ",
tval >> 7, (tval >> 6) & 0x01, (tval >> 4) & 0x03, (tval & 0x0f)));
ND_PRINT((ndo, "\n\t PFC Enable"));
- tval=EXTRACT_8BITS(tptr + 5);
+ tval=EXTRACT_U_1(tptr + 5);
ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7"));
ND_PRINT((ndo, "\n\t Value : "));
for(i=0;i<NO_OF_BITS;i++)
i=0;
ND_PRINT((ndo, "\n\t Application Priority Table"));
while(i<sublen) {
- tval=EXTRACT_8BITS(tptr + i + 5);
+ tval=EXTRACT_U_1(tptr + i + 5);
ND_PRINT((ndo, "\n\t Priority: %u, RES: %u, Sel: %u, Protocol ID: %u",
tval >> 5, (tval >> 3) & 0x03, (tval & 0x07),
- EXTRACT_BE_16BITS(tptr + i + 5)));
+ EXTRACT_BE_U_2(tptr + i + 5)));
i=i+3;
}
break;
return hexdump;
}
ND_PRINT((ndo, "\n\t EVB Bridge Status"));
- tval=EXTRACT_8BITS(tptr + 4);
+ tval=EXTRACT_U_1(tptr + 4);
ND_PRINT((ndo, "\n\t RES: %d, BGID: %d, RRCAP: %d, RRCTR: %d",
tval >> 3, (tval >> 2) & 0x01, (tval >> 1) & 0x01, tval & 0x01));
ND_PRINT((ndo, "\n\t EVB Station Status"));
- tval=EXTRACT_8BITS(tptr + 5);
+ tval=EXTRACT_U_1(tptr + 5);
ND_PRINT((ndo, "\n\t RES: %d, SGID: %d, RRREQ: %d,RRSTAT: %d",
tval >> 4, (tval >> 3) & 0x01, (tval >> 2) & 0x01, tval & 0x03));
- tval=EXTRACT_8BITS(tptr + 6);
+ tval=EXTRACT_U_1(tptr + 6);
ND_PRINT((ndo, "\n\t R: %d, RTE: %d, ",tval >> 5, tval & 0x1f));
- tval=EXTRACT_8BITS(tptr + 7);
+ tval=EXTRACT_U_1(tptr + 7);
ND_PRINT((ndo, "EVB Mode: %s [%d]",
tok2str(lldp_evb_mode_values, "unknown", tval >> 6), tval >> 6));
ND_PRINT((ndo, "\n\t ROL: %d, RWD: %d, ", (tval >> 5) & 0x01, tval & 0x1f));
- tval=EXTRACT_8BITS(tptr + 8);
+ tval=EXTRACT_U_1(tptr + 8);
ND_PRINT((ndo, "RES: %d, ROL: %d, RKA: %d", tval >> 6, (tval >> 5) & 0x01, tval & 0x1f));
break;
if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_CDCP_MIN_LENGTH){
return hexdump;
}
- tval=EXTRACT_8BITS(tptr + 4);
+ tval=EXTRACT_U_1(tptr + 4);
ND_PRINT((ndo, "\n\t Role: %d, RES: %d, Scomp: %d ",
tval >> 7, (tval >> 4) & 0x07, (tval >> 3) & 0x01));
- ND_PRINT((ndo, "ChnCap: %d", EXTRACT_BE_16BITS(tptr + 6) & 0x0fff));
+ ND_PRINT((ndo, "ChnCap: %d", EXTRACT_BE_U_2(tptr + 6) & 0x0fff));
sublen=tlv_len-8;
if(sublen%3!=0) {
return hexdump;
}
i=0;
while(i<sublen) {
- tval=EXTRACT_BE_24BITS(tptr + i + 8);
+ tval=EXTRACT_BE_U_3(tptr + i + 8);
ND_PRINT((ndo, "\n\t SCID: %d, SVID: %d",
tval >> 12, tval & 0x000fff));
i=i+3;
if (tlv_len < 4) {
return hexdump;
}
- subtype = EXTRACT_8BITS(tptr + 3);
+ subtype = EXTRACT_U_1(tptr + 3);
ND_PRINT((ndo, "\n\t %s Subtype (%u)",
tok2str(lldp_8023_subtype_values, "unknown", subtype),
return hexdump;
}
ND_PRINT((ndo, "\n\t autonegotiation [%s] (0x%02x)",
- bittok2str(lldp_8023_autonegotiation_values, "none", EXTRACT_8BITS((tptr + 4))),
+ bittok2str(lldp_8023_autonegotiation_values, "none", EXTRACT_U_1((tptr + 4))),
*(tptr + 4)));
ND_PRINT((ndo, "\n\t PMD autoneg capability [%s] (0x%04x)",
- bittok2str(lldp_pmd_capability_values,"unknown", EXTRACT_BE_16BITS(tptr + 5)),
- EXTRACT_BE_16BITS(tptr + 5)));
+ bittok2str(lldp_pmd_capability_values,"unknown", EXTRACT_BE_U_2(tptr + 5)),
+ EXTRACT_BE_U_2(tptr + 5)));
ND_PRINT((ndo, "\n\t MAU type %s (0x%04x)",
- tok2str(lldp_mau_types_values, "unknown", EXTRACT_BE_16BITS(tptr + 7)),
- EXTRACT_BE_16BITS(tptr + 7)));
+ tok2str(lldp_mau_types_values, "unknown", EXTRACT_BE_U_2(tptr + 7)),
+ EXTRACT_BE_U_2(tptr + 7)));
break;
case LLDP_PRIVATE_8023_SUBTYPE_MDIPOWER:
return hexdump;
}
ND_PRINT((ndo, "\n\t MDI power support [%s], power pair %s, power class %s",
- bittok2str(lldp_mdi_values, "none", EXTRACT_8BITS((tptr + 4))),
- tok2str(lldp_mdi_power_pairs_values, "unknown", EXTRACT_8BITS((tptr + 5))),
- tok2str(lldp_mdi_power_class_values, "unknown", EXTRACT_8BITS((tptr + 6)))));
+ bittok2str(lldp_mdi_values, "none", EXTRACT_U_1((tptr + 4))),
+ tok2str(lldp_mdi_power_pairs_values, "unknown", EXTRACT_U_1((tptr + 5))),
+ tok2str(lldp_mdi_power_class_values, "unknown", EXTRACT_U_1((tptr + 6)))));
break;
case LLDP_PRIVATE_8023_SUBTYPE_LINKAGGR:
return hexdump;
}
ND_PRINT((ndo, "\n\t aggregation status [%s], aggregation port ID %u",
- bittok2str(lldp_aggregation_values, "none", EXTRACT_8BITS((tptr + 4))),
- EXTRACT_BE_32BITS(tptr + 5)));
+ bittok2str(lldp_aggregation_values, "none", EXTRACT_U_1((tptr + 4))),
+ EXTRACT_BE_U_4(tptr + 5)));
break;
case LLDP_PRIVATE_8023_SUBTYPE_MTU:
if (tlv_len < 6) {
return hexdump;
}
- ND_PRINT((ndo, "\n\t MTU size %u", EXTRACT_BE_16BITS(tptr + 4)));
+ ND_PRINT((ndo, "\n\t MTU size %u", EXTRACT_BE_U_2(tptr + 4)));
break;
default:
{
uint64_t latlon;
- latlon = EXTRACT_8BITS(tptr) & 0x3;
- latlon = (latlon << 32) | EXTRACT_BE_32BITS(tptr + 1);
+ latlon = EXTRACT_U_1(tptr) & 0x3;
+ latlon = (latlon << 32) | EXTRACT_BE_U_4(tptr + 1);
return latlon;
}
if (tlv_len < 8) {
return hexdump;
}
- subtype = EXTRACT_8BITS(tptr + 3);
+ subtype = EXTRACT_U_1(tptr + 3);
ND_PRINT((ndo, "\n\t %s Subtype (%u)",
tok2str(lldp_iana_subtype_values, "unknown", subtype),
if (tlv_len < 4) {
return hexdump;
}
- subtype = EXTRACT_8BITS(tptr + 3);
+ subtype = EXTRACT_U_1(tptr + 3);
ND_PRINT((ndo, "\n\t %s Subtype (%u)",
tok2str(lldp_tia_subtype_values, "unknown", subtype),
}
ND_PRINT((ndo, "\n\t Media capabilities [%s] (0x%04x)",
bittok2str(lldp_tia_capabilities_values, "none",
- EXTRACT_BE_16BITS(tptr + 4)), EXTRACT_BE_16BITS(tptr + 4)));
+ EXTRACT_BE_U_2(tptr + 4)), EXTRACT_BE_U_2(tptr + 4)));
ND_PRINT((ndo, "\n\t Device type [%s] (0x%02x)",
- tok2str(lldp_tia_device_type_values, "unknown", EXTRACT_8BITS((tptr + 6))),
+ tok2str(lldp_tia_device_type_values, "unknown", EXTRACT_U_1((tptr + 6))),
*(tptr + 6)));
break;
return hexdump;
}
ND_PRINT((ndo, "\n\t Application type [%s] (0x%02x)",
- tok2str(lldp_tia_application_type_values, "none", EXTRACT_8BITS((tptr + 4))),
+ tok2str(lldp_tia_application_type_values, "none", EXTRACT_U_1((tptr + 4))),
*(tptr + 4)));
ND_PRINT((ndo, ", Flags [%s]", bittok2str(
- lldp_tia_network_policy_bits_values, "none", EXTRACT_8BITS((tptr + 5)))));
+ lldp_tia_network_policy_bits_values, "none", EXTRACT_U_1((tptr + 5)))));
ND_PRINT((ndo, "\n\t Vlan id %u",
- LLDP_EXTRACT_NETWORK_POLICY_VLAN(EXTRACT_BE_16BITS(tptr + 5))));
+ LLDP_EXTRACT_NETWORK_POLICY_VLAN(EXTRACT_BE_U_2(tptr + 5))));
ND_PRINT((ndo, ", L2 priority %u",
- LLDP_EXTRACT_NETWORK_POLICY_L2_PRIORITY(EXTRACT_BE_16BITS(tptr + 6))));
+ LLDP_EXTRACT_NETWORK_POLICY_L2_PRIORITY(EXTRACT_BE_U_2(tptr + 6))));
ND_PRINT((ndo, ", DSCP value %u",
- LLDP_EXTRACT_NETWORK_POLICY_DSCP(EXTRACT_BE_16BITS(tptr + 6))));
+ LLDP_EXTRACT_NETWORK_POLICY_DSCP(EXTRACT_BE_U_2(tptr + 6))));
break;
case LLDP_PRIVATE_TIA_SUBTYPE_LOCAL_ID:
if (tlv_len < 5) {
return hexdump;
}
- location_format = EXTRACT_8BITS(tptr + 4);
+ location_format = EXTRACT_U_1(tptr + 4);
ND_PRINT((ndo, "\n\t Location data format %s (0x%02x)",
tok2str(lldp_tia_location_data_format_values, "unknown", location_format),
location_format));
ND_PRINT((ndo, "\n\t Longitude resolution %u, longitude value %" PRIu64,
(*(tptr + 10) >> 2), lldp_extract_latlon(tptr + 10)));
ND_PRINT((ndo, "\n\t Altitude type %s (%u)",
- tok2str(lldp_tia_location_altitude_type_values, "unknown",EXTRACT_8BITS((tptr + 15)) >> 4),
+ tok2str(lldp_tia_location_altitude_type_values, "unknown",EXTRACT_U_1((tptr + 15)) >> 4),
(*(tptr + 15) >> 4)));
ND_PRINT((ndo, "\n\t Altitude resolution %u, altitude value 0x%x",
- (EXTRACT_BE_16BITS(tptr + 15)>>6)&0x3f,
- ((EXTRACT_BE_32BITS(tptr + 16) & 0x3fffffff))));
+ (EXTRACT_BE_U_2(tptr + 15)>>6)&0x3f,
+ ((EXTRACT_BE_U_4(tptr + 16) & 0x3fffffff))));
ND_PRINT((ndo, "\n\t Datum %s (0x%02x)",
- tok2str(lldp_tia_location_datum_type_values, "unknown", EXTRACT_8BITS((tptr + 20))),
+ tok2str(lldp_tia_location_datum_type_values, "unknown", EXTRACT_U_1((tptr + 20))),
*(tptr + 20)));
break;
if (tlv_len < 6) {
return hexdump;
}
- lci_len = EXTRACT_8BITS(tptr + 5);
+ lci_len = EXTRACT_U_1(tptr + 5);
if (lci_len < 3) {
return hexdump;
}
}
ND_PRINT((ndo, "\n\t LCI length %u, LCI what %s (0x%02x), Country-code ",
lci_len,
- tok2str(lldp_tia_location_lci_what_values, "unknown", EXTRACT_8BITS((tptr + 6))),
+ tok2str(lldp_tia_location_lci_what_values, "unknown", EXTRACT_U_1((tptr + 6))),
*(tptr + 6)));
/* Country code */
return hexdump;
}
ca_type = *(tptr);
- ca_len = EXTRACT_8BITS(tptr + 1);
+ ca_len = EXTRACT_U_1(tptr + 1);
tptr += 2;
lci_len -= 2;
ND_PRINT((ndo, "\n\t Power type [%s]",
(*(tptr + 4) & 0xC0 >> 6) ? "PD device" : "PSE device"));
ND_PRINT((ndo, ", Power source [%s]",
- tok2str(lldp_tia_power_source_values, "none", (EXTRACT_8BITS((tptr + 4)) & 0x30) >> 4)));
+ tok2str(lldp_tia_power_source_values, "none", (EXTRACT_U_1((tptr + 4)) & 0x30) >> 4)));
ND_PRINT((ndo, "\n\t Power priority [%s] (0x%02x)",
- tok2str(lldp_tia_power_priority_values, "none", EXTRACT_8BITS((tptr + 4)) & 0x0f),
+ tok2str(lldp_tia_power_priority_values, "none", EXTRACT_U_1((tptr + 4)) & 0x0f),
*(tptr + 4) & 0x0f));
- power_val = EXTRACT_BE_16BITS(tptr + 5);
+ power_val = EXTRACT_BE_U_2(tptr + 5);
if (power_val < LLDP_TIA_POWER_VAL_MAX) {
ND_PRINT((ndo, ", Power %.1f Watts", ((float)power_val) / 10));
} else {
if (len < 4) {
return hexdump;
}
- subtype = EXTRACT_8BITS(pptr + 3);
+ subtype = EXTRACT_U_1(pptr + 3);
ND_PRINT((ndo, "\n\t %s Subtype (%u)",
tok2str(lldp_dcbx_subtype_values, "unknown", subtype),
ND_TCHECK2(*tptr, sizeof(tlv));
- tlv = EXTRACT_BE_16BITS(tptr);
+ tlv = EXTRACT_BE_U_2(tptr);
tlv_type = LLDP_EXTRACT_TYPE(tlv);
tlv_len = LLDP_EXTRACT_LEN(tlv);
LLDP_DCBX_CONTROL_TLV, tlv_len));
ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr));
ND_PRINT((ndo, "\n\t Max_Version: %d", *(tptr + 1)));
- ND_PRINT((ndo, "\n\t Sequence Number: %d", EXTRACT_BE_32BITS(tptr + 2)));
+ ND_PRINT((ndo, "\n\t Sequence Number: %d", EXTRACT_BE_U_4(tptr + 2)));
ND_PRINT((ndo, "\n\t Acknowledgement Number: %d",
- EXTRACT_BE_32BITS(tptr + 6)));
+ EXTRACT_BE_U_4(tptr + 6)));
break;
case LLDP_DCBX_PRIORITY_GROUPS_TLV:
if (tlv_len < 17) {
ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr));
ND_PRINT((ndo, "\n\t Max_Version: %d", *(tptr + 1)));
ND_PRINT((ndo, "\n\t Info block(0x%02X): ", *(tptr + 2)));
- tval = EXTRACT_8BITS(tptr + 2);
+ tval = EXTRACT_U_1(tptr + 2);
ND_PRINT((ndo, "Enable bit: %d, Willing bit: %d, Error Bit: %d",
(tval & 0x80) ? 1 : 0, (tval & 0x40) ? 1 : 0,
(tval & 0x20) ? 1 : 0));
* Array of 8 4-bit priority group ID values; we fetch all
* 32 bits and extract each nibble.
*/
- pgval = EXTRACT_BE_32BITS(tptr + 4);
+ pgval = EXTRACT_BE_U_4(tptr + 4);
for (i = 0; i <= 7; i++) {
ND_PRINT((ndo, "\n\t PgId_%d: %d",
i, (pgval >> (28 - 4 * i)) & 0xF));
ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr));
ND_PRINT((ndo, "\n\t Max_Version: %d", *(tptr + 1)));
ND_PRINT((ndo, "\n\t Info block(0x%02X): ", *(tptr + 2)));
- tval = EXTRACT_8BITS(tptr + 2);
+ tval = EXTRACT_U_1(tptr + 2);
ND_PRINT((ndo, "Enable bit: %d, Willing bit: %d, Error Bit: %d",
(tval & 0x80) ? 1 : 0, (tval & 0x40) ? 1 : 0,
(tval & 0x20) ? 1 : 0));
ND_PRINT((ndo, "\n\t SubType: %d", *(tptr + 3)));
- tval = EXTRACT_8BITS(tptr + 4);
+ tval = EXTRACT_U_1(tptr + 4);
ND_PRINT((ndo, "\n\t PFC Config (0x%02X)", *(tptr + 4)));
for (i = 0; i <= 7; i++)
ND_PRINT((ndo, "\n\t Priority Bit %d: %s",
ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr));
ND_PRINT((ndo, "\n\t Max_Version: %d", *(tptr + 1)));
ND_PRINT((ndo, "\n\t Info block(0x%02X): ", *(tptr + 2)));
- tval = EXTRACT_8BITS(tptr + 2);
+ tval = EXTRACT_U_1(tptr + 2);
ND_PRINT((ndo, "Enable bit: %d, Willing bit: %d, Error Bit: %d",
(tval & 0x80) ? 1 : 0, (tval & 0x40) ? 1 : 0,
(tval & 0x20) ? 1 : 0));
while (tval >= 6) {
ND_PRINT((ndo, "\n\t Application Value"));
ND_PRINT((ndo, "\n\t Application Protocol ID: 0x%04x",
- EXTRACT_BE_16BITS(mptr)));
- uval = EXTRACT_BE_24BITS(mptr + 2);
+ EXTRACT_BE_U_2(mptr)));
+ uval = EXTRACT_BE_U_3(mptr + 2);
ND_PRINT((ndo, "\n\t SF (0x%x) Application Protocol ID is %s",
(uval >> 22),
(uval >> 22) ? "Socket Number" : "L2 EtherType"));
if (tlen < 1) {
return 0;
}
- mgmt_addr_len = EXTRACT_8BITS(tptr);
+ mgmt_addr_len = EXTRACT_U_1(tptr);
tptr++;
tlen--;
ND_PRINT((ndo, "\n\t %s Interface Numbering (%u): %u",
tok2str(lldp_intf_numb_subtype_values, "Unknown", intf_num_subtype),
intf_num_subtype,
- EXTRACT_BE_32BITS(tptr + 1)));
+ EXTRACT_BE_U_4(tptr + 1)));
tptr += LLDP_INTF_NUM_LEN;
tlen -= LLDP_INTF_NUM_LEN;
ND_TCHECK2(*tptr, sizeof(tlv));
- tlv = EXTRACT_BE_16BITS(tptr);
+ tlv = EXTRACT_BE_U_2(tptr);
tlv_type = LLDP_EXTRACT_TYPE(tlv);
tlv_len = LLDP_EXTRACT_LEN(tlv);
if (tlv_len < 2) {
goto trunc;
}
- ND_PRINT((ndo, ": TTL %us", EXTRACT_BE_16BITS(tptr)));
+ ND_PRINT((ndo, ": TTL %us", EXTRACT_BE_U_2(tptr)));
}
break;
if (tlv_len < 4) {
goto trunc;
}
- cap = EXTRACT_BE_16BITS(tptr);
- ena_cap = EXTRACT_BE_16BITS(tptr + 2);
+ cap = EXTRACT_BE_U_2(tptr);
+ ena_cap = EXTRACT_BE_U_2(tptr + 2);
ND_PRINT((ndo, "\n\t System Capabilities [%s] (0x%04x)",
bittok2str(lldp_cap_values, "none", cap), cap));
ND_PRINT((ndo, "\n\t Enabled Capabilities [%s] (0x%04x)",
if (tlv_len < 3) {
goto trunc;
}
- oui = EXTRACT_BE_24BITS(tptr);
+ oui = EXTRACT_BE_U_3(tptr);
ND_PRINT((ndo, ": OUI %s (0x%06x)", tok2str(oui_values, "Unknown", oui), oui));
switch (oui) {
} bw;
while (total_subobj_len > 0 && hexdump == FALSE ) {
- subobj_type = EXTRACT_8BITS(obj_tptr + offset);
- subobj_len = EXTRACT_8BITS(obj_tptr + offset + 1);
+ subobj_type = EXTRACT_U_1(obj_tptr + offset);
+ subobj_len = EXTRACT_U_1(obj_tptr + offset + 1);
ND_PRINT((ndo, "\n\t Subobject, Type: %s (%u), Length: %u",
tok2str(lmp_data_link_subobj,
"Unknown",
ND_PRINT((ndo, "\n\t Switching Type: %s (%u)",
tok2str(gmpls_switch_cap_values,
"Unknown",
- EXTRACT_8BITS(obj_tptr + offset + 2)),
- EXTRACT_8BITS(obj_tptr + offset + 2)));
+ EXTRACT_U_1(obj_tptr + offset + 2)),
+ EXTRACT_U_1(obj_tptr + offset + 2)));
ND_PRINT((ndo, "\n\t Encoding Type: %s (%u)",
tok2str(gmpls_encoding_values,
"Unknown",
- EXTRACT_8BITS(obj_tptr + offset + 3)),
- EXTRACT_8BITS(obj_tptr + offset + 3)));
- bw.i = EXTRACT_BE_32BITS(obj_tptr + offset + 4);
+ EXTRACT_U_1(obj_tptr + offset + 3)),
+ EXTRACT_U_1(obj_tptr + offset + 3)));
+ bw.i = EXTRACT_BE_U_4(obj_tptr + offset + 4);
ND_PRINT((ndo, "\n\t Min Reservable Bandwidth: %.3f Mbps",
bw.f*8/1000000));
- bw.i = EXTRACT_BE_32BITS(obj_tptr + offset + 8);
+ bw.i = EXTRACT_BE_U_4(obj_tptr + offset + 8);
ND_PRINT((ndo, "\n\t Max Reservable Bandwidth: %.3f Mbps",
bw.f*8/1000000));
break;
case WAVELENGTH_SUBOBJ:
ND_PRINT((ndo, "\n\t Wavelength: %u",
- EXTRACT_BE_32BITS(obj_tptr + offset + 4)));
+ EXTRACT_BE_U_4(obj_tptr + offset + 4)));
break;
default:
/* Any Unknown Subobject ==> Exit loop */
/* ok they seem to want to know everything - lets fully decode it */
- tlen=EXTRACT_BE_16BITS(lmp_com_header->length);
+ tlen=EXTRACT_BE_U_2(lmp_com_header->length);
ND_PRINT((ndo, "\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u",
LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
ND_TCHECK2(*tptr, sizeof(struct lmp_object_header));
lmp_obj_header = (const struct lmp_object_header *)tptr;
- lmp_obj_len=EXTRACT_BE_16BITS(lmp_obj_header->length);
+ lmp_obj_len=EXTRACT_BE_U_2(lmp_obj_header->length);
lmp_obj_ctype=(lmp_obj_header->ctype)&0x7f;
ND_PRINT((ndo, "\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u",
break;
}
ND_PRINT((ndo, "\n\t Control Channel ID: %u (0x%08x)",
- EXTRACT_BE_32BITS(obj_tptr),
- EXTRACT_BE_32BITS(obj_tptr)));
+ EXTRACT_BE_U_4(obj_tptr),
+ EXTRACT_BE_U_4(obj_tptr)));
break;
default:
}
ND_PRINT((ndo, "\n\t IPv4 Link ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr),
- EXTRACT_BE_32BITS(obj_tptr)));
+ EXTRACT_BE_U_4(obj_tptr)));
break;
case LMP_CTYPE_IPV6_LOC:
case LMP_CTYPE_IPV6_RMT:
}
ND_PRINT((ndo, "\n\t IPv6 Link ID: %s (0x%08x)",
ip6addr_string(ndo, obj_tptr),
- EXTRACT_BE_32BITS(obj_tptr)));
+ EXTRACT_BE_U_4(obj_tptr)));
break;
case LMP_CTYPE_UNMD_LOC:
case LMP_CTYPE_UNMD_RMT:
break;
}
ND_PRINT((ndo, "\n\t Link ID: %u (0x%08x)",
- EXTRACT_BE_32BITS(obj_tptr),
- EXTRACT_BE_32BITS(obj_tptr)));
+ EXTRACT_BE_U_4(obj_tptr),
+ EXTRACT_BE_U_4(obj_tptr)));
break;
default:
hexdump=TRUE;
break;
}
ND_PRINT((ndo, "\n\t Message ID: %u (0x%08x)",
- EXTRACT_BE_32BITS(obj_tptr),
- EXTRACT_BE_32BITS(obj_tptr)));
+ EXTRACT_BE_U_4(obj_tptr),
+ EXTRACT_BE_U_4(obj_tptr)));
break;
case LMP_CTYPE_2:
if (obj_tlen != 4) {
break;
}
ND_PRINT((ndo, "\n\t Message ID Ack: %u (0x%08x)",
- EXTRACT_BE_32BITS(obj_tptr),
- EXTRACT_BE_32BITS(obj_tptr)));
+ EXTRACT_BE_U_4(obj_tptr),
+ EXTRACT_BE_U_4(obj_tptr)));
break;
default:
hexdump=TRUE;
}
ND_PRINT((ndo, "\n\t Node ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr),
- EXTRACT_BE_32BITS(obj_tptr)));
+ EXTRACT_BE_U_4(obj_tptr)));
break;
default:
break;
}
ND_PRINT((ndo, "\n\t Hello Interval: %u\n\t Hello Dead Interval: %u",
- EXTRACT_BE_16BITS(obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 2)));
+ EXTRACT_BE_U_2(obj_tptr),
+ EXTRACT_BE_U_2(obj_tptr + 2)));
break;
default:
break;
}
ND_PRINT((ndo, "\n\t Tx Seq: %u, Rx Seq: %u",
- EXTRACT_BE_32BITS(obj_tptr),
- EXTRACT_BE_32BITS(obj_tptr + 4)));
+ EXTRACT_BE_U_4(obj_tptr),
+ EXTRACT_BE_U_4(obj_tptr + 4)));
break;
default:
ND_PRINT((ndo, "\n\t Flags: [%s]",
bittok2str(lmp_obj_te_link_flag_values,
"none",
- EXTRACT_8BITS(obj_tptr))));
+ EXTRACT_U_1(obj_tptr))));
ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)"
"\n\t Remote Link-ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr+4),
- EXTRACT_BE_32BITS(obj_tptr + 4),
+ EXTRACT_BE_U_4(obj_tptr + 4),
ipaddr_string(ndo, obj_tptr+8),
- EXTRACT_BE_32BITS(obj_tptr + 8)));
+ EXTRACT_BE_U_4(obj_tptr + 8)));
break;
case LMP_CTYPE_IPV6:
ND_PRINT((ndo, "\n\t Flags: [%s]",
bittok2str(lmp_obj_te_link_flag_values,
"none",
- EXTRACT_8BITS(obj_tptr))));
+ EXTRACT_U_1(obj_tptr))));
ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)"
"\n\t Remote Link-ID: %s (0x%08x)",
ip6addr_string(ndo, obj_tptr+4),
- EXTRACT_BE_32BITS(obj_tptr + 4),
+ EXTRACT_BE_U_4(obj_tptr + 4),
ip6addr_string(ndo, obj_tptr+20),
- EXTRACT_BE_32BITS(obj_tptr + 20)));
+ EXTRACT_BE_U_4(obj_tptr + 20)));
break;
case LMP_CTYPE_UNMD:
ND_PRINT((ndo, "\n\t Flags: [%s]",
bittok2str(lmp_obj_te_link_flag_values,
"none",
- EXTRACT_8BITS(obj_tptr))));
+ EXTRACT_U_1(obj_tptr))));
ND_PRINT((ndo, "\n\t Local Link-ID: %u (0x%08x)"
"\n\t Remote Link-ID: %u (0x%08x)",
- EXTRACT_BE_32BITS(obj_tptr + 4),
- EXTRACT_BE_32BITS(obj_tptr + 4),
- EXTRACT_BE_32BITS(obj_tptr + 8),
- EXTRACT_BE_32BITS(obj_tptr + 8)));
+ EXTRACT_BE_U_4(obj_tptr + 4),
+ EXTRACT_BE_U_4(obj_tptr + 4),
+ EXTRACT_BE_U_4(obj_tptr + 8),
+ EXTRACT_BE_U_4(obj_tptr + 8)));
break;
default:
ND_PRINT((ndo, "\n\t Flags: [%s]",
bittok2str(lmp_obj_data_link_flag_values,
"none",
- EXTRACT_8BITS(obj_tptr))));
+ EXTRACT_U_1(obj_tptr))));
ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)"
"\n\t Remote Interface ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr+4),
- EXTRACT_BE_32BITS(obj_tptr + 4),
+ EXTRACT_BE_U_4(obj_tptr + 4),
ipaddr_string(ndo, obj_tptr+8),
- EXTRACT_BE_32BITS(obj_tptr + 8)));
+ EXTRACT_BE_U_4(obj_tptr + 8)));
if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12))
hexdump=TRUE;
ND_PRINT((ndo, "\n\t Flags: [%s]",
bittok2str(lmp_obj_data_link_flag_values,
"none",
- EXTRACT_8BITS(obj_tptr))));
+ EXTRACT_U_1(obj_tptr))));
ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)"
"\n\t Remote Interface ID: %s (0x%08x)",
ip6addr_string(ndo, obj_tptr+4),
- EXTRACT_BE_32BITS(obj_tptr + 4),
+ EXTRACT_BE_U_4(obj_tptr + 4),
ip6addr_string(ndo, obj_tptr+20),
- EXTRACT_BE_32BITS(obj_tptr + 20)));
+ EXTRACT_BE_U_4(obj_tptr + 20)));
if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 36, 36))
hexdump=TRUE;
ND_PRINT((ndo, "\n\t Flags: [%s]",
bittok2str(lmp_obj_data_link_flag_values,
"none",
- EXTRACT_8BITS(obj_tptr))));
+ EXTRACT_U_1(obj_tptr))));
ND_PRINT((ndo, "\n\t Local Interface ID: %u (0x%08x)"
"\n\t Remote Interface ID: %u (0x%08x)",
- EXTRACT_BE_32BITS(obj_tptr + 4),
- EXTRACT_BE_32BITS(obj_tptr + 4),
- EXTRACT_BE_32BITS(obj_tptr + 8),
- EXTRACT_BE_32BITS(obj_tptr + 8)));
+ EXTRACT_BE_U_4(obj_tptr + 4),
+ EXTRACT_BE_U_4(obj_tptr + 4),
+ EXTRACT_BE_U_4(obj_tptr + 8),
+ EXTRACT_BE_U_4(obj_tptr + 8)));
if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12))
hexdump=TRUE;
ND_PRINT((ndo, "\n\t Flags: %s",
bittok2str(lmp_obj_begin_verify_flag_values,
"none",
- EXTRACT_BE_16BITS(obj_tptr))));
+ EXTRACT_BE_U_2(obj_tptr))));
ND_PRINT((ndo, "\n\t Verify Interval: %u",
- EXTRACT_BE_16BITS(obj_tptr + 2)));
+ EXTRACT_BE_U_2(obj_tptr + 2)));
ND_PRINT((ndo, "\n\t Data links: %u",
- EXTRACT_BE_32BITS(obj_tptr + 4)));
+ EXTRACT_BE_U_4(obj_tptr + 4)));
ND_PRINT((ndo, "\n\t Encoding type: %s",
- tok2str(gmpls_encoding_values, "Unknown", EXTRACT_8BITS((obj_tptr + 8)))));
+ tok2str(gmpls_encoding_values, "Unknown", EXTRACT_U_1((obj_tptr + 8)))));
ND_PRINT((ndo, "\n\t Verify Transport Mechanism: %u (0x%x)%s",
- EXTRACT_BE_16BITS(obj_tptr + 10),
- EXTRACT_BE_16BITS(obj_tptr + 10),
- EXTRACT_BE_16BITS(obj_tptr + 10)&8000 ? " (Payload test messages capable)" : ""));
- bw.i = EXTRACT_BE_32BITS(obj_tptr + 12);
+ EXTRACT_BE_U_2(obj_tptr + 10),
+ EXTRACT_BE_U_2(obj_tptr + 10),
+ EXTRACT_BE_U_2(obj_tptr + 10)&8000 ? " (Payload test messages capable)" : ""));
+ bw.i = EXTRACT_BE_U_4(obj_tptr + 12);
ND_PRINT((ndo, "\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000));
ND_PRINT((ndo, "\n\t Wavelength: %u",
- EXTRACT_BE_32BITS(obj_tptr + 16)));
+ EXTRACT_BE_U_4(obj_tptr + 16)));
break;
default:
}
ND_PRINT((ndo, "\n\t Verify Dead Interval: %u"
"\n\t Verify Transport Response: %u",
- EXTRACT_BE_16BITS(obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 2)));
+ EXTRACT_BE_U_2(obj_tptr),
+ EXTRACT_BE_U_2(obj_tptr + 2)));
break;
default:
break;
}
ND_PRINT((ndo, "\n\t Verify ID: %u",
- EXTRACT_BE_32BITS(obj_tptr)));
+ EXTRACT_BE_U_4(obj_tptr)));
break;
default:
while (offset+8 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr+offset),
- EXTRACT_BE_32BITS(obj_tptr + offset)));
+ EXTRACT_BE_U_4(obj_tptr + offset)));
ND_PRINT((ndo, "\n\t\t Active: %s (%u)",
- (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31) ?
+ (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31) ?
"Allocated" : "Non-allocated",
- (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31)));
+ (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31)));
ND_PRINT((ndo, "\n\t\t Direction: %s (%u)",
- (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1 ?
+ (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ?
"Transmit" : "Receive",
- (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1));
+ (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1));
ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)",
tok2str(lmp_obj_channel_status_values,
"Unknown",
- EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF),
- EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF));
+ EXTRACT_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF),
+ EXTRACT_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF));
offset+=8;
}
break;
while (offset+20 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
ip6addr_string(ndo, obj_tptr+offset),
- EXTRACT_BE_32BITS(obj_tptr + offset)));
+ EXTRACT_BE_U_4(obj_tptr + offset)));
ND_PRINT((ndo, "\n\t\t Active: %s (%u)",
- (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>31) ?
+ (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>31) ?
"Allocated" : "Non-allocated",
- (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>31)));
+ (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>31)));
ND_PRINT((ndo, "\n\t\t Direction: %s (%u)",
- (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>30)&0x1 ?
+ (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>30)&0x1 ?
"Transmit" : "Receive",
- (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>30)&0x1));
+ (EXTRACT_BE_U_4(obj_tptr + offset + 16)>>30)&0x1));
ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)",
tok2str(lmp_obj_channel_status_values,
"Unknown",
- EXTRACT_BE_32BITS(obj_tptr + offset + 16)&0x3FFFFFF),
- EXTRACT_BE_32BITS(obj_tptr + offset + 16)&0x3FFFFFF));
+ EXTRACT_BE_U_4(obj_tptr + offset + 16)&0x3FFFFFF),
+ EXTRACT_BE_U_4(obj_tptr + offset + 16)&0x3FFFFFF));
offset+=20;
}
break;
/* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
while (offset+8 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)",
- EXTRACT_BE_32BITS(obj_tptr + offset),
- EXTRACT_BE_32BITS(obj_tptr + offset)));
+ EXTRACT_BE_U_4(obj_tptr + offset),
+ EXTRACT_BE_U_4(obj_tptr + offset)));
ND_PRINT((ndo, "\n\t\t Active: %s (%u)",
- (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31) ?
+ (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31) ?
"Allocated" : "Non-allocated",
- (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31)));
+ (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>31)));
ND_PRINT((ndo, "\n\t\t Direction: %s (%u)",
- (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1 ?
+ (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ?
"Transmit" : "Receive",
- (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1));
+ (EXTRACT_BE_U_4(obj_tptr + offset + 4)>>30)&0x1));
ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)",
tok2str(lmp_obj_channel_status_values,
"Unknown",
- EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF),
- EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF));
+ EXTRACT_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF),
+ EXTRACT_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF));
offset+=8;
}
break;
while (offset+4 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr+offset),
- EXTRACT_BE_32BITS(obj_tptr + offset)));
+ EXTRACT_BE_U_4(obj_tptr + offset)));
offset+=4;
}
break;
while (offset+16 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
ip6addr_string(ndo, obj_tptr+offset),
- EXTRACT_BE_32BITS(obj_tptr + offset)));
+ EXTRACT_BE_U_4(obj_tptr + offset)));
offset+=16;
}
break;
offset = 0;
while (offset+4 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)",
- EXTRACT_BE_32BITS(obj_tptr + offset),
- EXTRACT_BE_32BITS(obj_tptr + offset)));
+ EXTRACT_BE_U_4(obj_tptr + offset),
+ EXTRACT_BE_U_4(obj_tptr + offset)));
offset+=4;
}
break;
ND_PRINT((ndo, "\n\t Error Code: %s",
bittok2str(lmp_obj_begin_verify_error_values,
"none",
- EXTRACT_BE_32BITS(obj_tptr))));
+ EXTRACT_BE_U_4(obj_tptr))));
break;
case LMP_CTYPE_LINK_SUMMARY_ERROR:
ND_PRINT((ndo, "\n\t Error Code: %s",
bittok2str(lmp_obj_link_summary_error_values,
"none",
- EXTRACT_BE_32BITS(obj_tptr))));
+ EXTRACT_BE_U_4(obj_tptr))));
break;
default:
hexdump=TRUE;
ND_PRINT((ndo, "\n\t Flags: %s",
bittok2str(lmp_obj_service_config_sp_flag_values,
"none",
- EXTRACT_8BITS(obj_tptr))));
+ EXTRACT_U_1(obj_tptr))));
ND_PRINT((ndo, "\n\t UNI Version: %u",
- EXTRACT_8BITS(obj_tptr + 1)));
+ EXTRACT_U_1(obj_tptr + 1)));
break;
break;
}
- link_type = EXTRACT_8BITS(obj_tptr);
+ link_type = EXTRACT_U_1(obj_tptr);
ND_PRINT((ndo, "\n\t Link Type: %s (%u)",
tok2str(lmp_sd_service_config_cpsa_link_type_values,
ND_PRINT((ndo, "\n\t Signal Type: %s (%u)",
tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values,
"Unknown",
- EXTRACT_8BITS(obj_tptr + 1)),
- EXTRACT_8BITS(obj_tptr + 1)));
+ EXTRACT_U_1(obj_tptr + 1)),
+ EXTRACT_U_1(obj_tptr + 1)));
break;
case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET:
ND_PRINT((ndo, "\n\t Signal Type: %s (%u)",
tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values,
"Unknown",
- EXTRACT_8BITS(obj_tptr + 1)),
- EXTRACT_8BITS(obj_tptr + 1)));
+ EXTRACT_U_1(obj_tptr + 1)),
+ EXTRACT_U_1(obj_tptr + 1)));
break;
}
ND_PRINT((ndo, "\n\t Transparency: %s",
bittok2str(lmp_obj_service_config_cpsa_tp_flag_values,
"none",
- EXTRACT_8BITS(obj_tptr + 2))));
+ EXTRACT_U_1(obj_tptr + 2))));
ND_PRINT((ndo, "\n\t Contiguous Concatenation Types: %s",
bittok2str(lmp_obj_service_config_cpsa_cct_flag_values,
"none",
- EXTRACT_8BITS(obj_tptr + 3))));
+ EXTRACT_U_1(obj_tptr + 3))));
ND_PRINT((ndo, "\n\t Minimum NCC: %u",
- EXTRACT_BE_16BITS(obj_tptr + 4)));
+ EXTRACT_BE_U_2(obj_tptr + 4)));
ND_PRINT((ndo, "\n\t Maximum NCC: %u",
- EXTRACT_BE_16BITS(obj_tptr + 6)));
+ EXTRACT_BE_U_2(obj_tptr + 6)));
ND_PRINT((ndo, "\n\t Minimum NVC:%u",
- EXTRACT_BE_16BITS(obj_tptr + 8)));
+ EXTRACT_BE_U_2(obj_tptr + 8)));
ND_PRINT((ndo, "\n\t Maximum NVC:%u",
- EXTRACT_BE_16BITS(obj_tptr + 10)));
+ EXTRACT_BE_U_2(obj_tptr + 10)));
ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr+12),
- EXTRACT_BE_32BITS(obj_tptr + 12)));
+ EXTRACT_BE_U_4(obj_tptr + 12)));
break;
bittok2str(
lmp_obj_service_config_nsa_transparency_flag_values,
"none",
- EXTRACT_BE_32BITS(obj_tptr))));
+ EXTRACT_BE_U_4(obj_tptr))));
ND_PRINT((ndo, "\n\t TCM Monitoring Flags: %s",
bittok2str(
lmp_obj_service_config_nsa_tcm_flag_values,
"none",
- EXTRACT_8BITS(obj_tptr + 7))));
+ EXTRACT_U_1(obj_tptr + 7))));
break;
bittok2str(
lmp_obj_service_config_nsa_network_diversity_flag_values,
"none",
- EXTRACT_8BITS(obj_tptr + 3))));
+ EXTRACT_U_1(obj_tptr + 3))));
break;
default:
goto invalid;
/* function */
ND_TCHECK2(*cp, 2);
- function = EXTRACT_LE_16BITS(cp);
+ function = EXTRACT_LE_U_2(cp);
cp += 2;
ND_PRINT((ndo, ", %s", tok2str(fcode_str, " invalid (%u)", function)));
goto invalid;
/* receipt number */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", receipt number %u", EXTRACT_LE_16BITS(cp)));
+ ND_PRINT((ndo, ", receipt number %u", EXTRACT_LE_U_2(cp)));
cp += 2;
/* data */
ND_PRINT((ndo, ", data (%u octets)", len - 4));
goto invalid;
/* skipCount */
ND_TCHECK2(*cp, 2);
- skipCount = EXTRACT_LE_16BITS(cp);
+ skipCount = EXTRACT_LE_U_2(cp);
cp += 2;
ND_PRINT((ndo, ", skipCount %u", skipCount));
if (skipCount % 8)
/*
* Sanity checking of the header.
*/
- if (EXTRACT_BE_16BITS(&lspping_com_header->version[0]) != LSPPING_VERSION) {
+ if (EXTRACT_BE_U_2(&lspping_com_header->version[0]) != LSPPING_VERSION) {
ND_PRINT((ndo, "LSP-PING version %u packet not supported",
- EXTRACT_BE_16BITS(&lspping_com_header->version[0])));
+ EXTRACT_BE_U_2(&lspping_com_header->version[0])));
return;
}
/* in non-verbose mode just lets print the basic Message Type*/
if (ndo->ndo_vflag < 1) {
ND_PRINT((ndo, "LSP-PINGv%u, %s, seq %u, length: %u",
- EXTRACT_BE_16BITS(&lspping_com_header->version[0]),
+ EXTRACT_BE_U_2(&lspping_com_header->version[0]),
tok2str(lspping_msg_type_values, "unknown (%u)",lspping_com_header->msg_type),
- EXTRACT_BE_32BITS(lspping_com_header->seq_number),
+ EXTRACT_BE_U_4(lspping_com_header->seq_number),
len));
return;
}
tlen=len;
ND_PRINT((ndo, "\n\tLSP-PINGv%u, msg-type: %s (%u), length: %u\n\t reply-mode: %s (%u)",
- EXTRACT_BE_16BITS(&lspping_com_header->version[0]),
+ EXTRACT_BE_U_2(&lspping_com_header->version[0]),
tok2str(lspping_msg_type_values, "unknown",lspping_com_header->msg_type),
lspping_com_header->msg_type,
len,
lspping_com_header->return_subcode));
ND_PRINT((ndo, "\n\t Sender Handle: 0x%08x, Sequence: %u",
- EXTRACT_BE_32BITS(lspping_com_header->sender_handle),
- EXTRACT_BE_32BITS(lspping_com_header->seq_number)));
+ EXTRACT_BE_U_4(lspping_com_header->sender_handle),
+ EXTRACT_BE_U_4(lspping_com_header->seq_number)));
- timestamp.tv_sec=EXTRACT_BE_32BITS(lspping_com_header->ts_sent_sec);
- timestamp.tv_usec=EXTRACT_BE_32BITS(lspping_com_header->ts_sent_usec);
+ timestamp.tv_sec=EXTRACT_BE_U_4(lspping_com_header->ts_sent_sec);
+ timestamp.tv_usec=EXTRACT_BE_U_4(lspping_com_header->ts_sent_usec);
ND_PRINT((ndo, "\n\t Sender Timestamp: "));
ts_print(ndo, ×tamp);
- timestamp.tv_sec=EXTRACT_BE_32BITS(lspping_com_header->ts_rcvd_sec);
- timestamp.tv_usec=EXTRACT_BE_32BITS(lspping_com_header->ts_rcvd_usec);
+ timestamp.tv_sec=EXTRACT_BE_U_4(lspping_com_header->ts_rcvd_sec);
+ timestamp.tv_usec=EXTRACT_BE_U_4(lspping_com_header->ts_rcvd_usec);
ND_PRINT((ndo, "Receiver Timestamp: "));
if ((timestamp.tv_sec != 0) && (timestamp.tv_usec != 0))
ts_print(ndo, ×tamp);
ND_TCHECK2(*tptr, sizeof(struct lspping_tlv_header));
lspping_tlv_header = (const struct lspping_tlv_header *)tptr;
- lspping_tlv_type=EXTRACT_BE_16BITS(lspping_tlv_header->type);
- lspping_tlv_len=EXTRACT_BE_16BITS(lspping_tlv_header->length);
+ lspping_tlv_type=EXTRACT_BE_U_2(lspping_tlv_header->type);
+ lspping_tlv_len=EXTRACT_BE_U_2(lspping_tlv_header->length);
ND_PRINT((ndo, "\n\t %s TLV (%u), length: %u",
tok2str(lspping_tlv_values,
subtlv_hexdump=FALSE;
lspping_subtlv_header = (const struct lspping_tlv_header *)tlv_tptr;
- lspping_subtlv_type=EXTRACT_BE_16BITS(lspping_subtlv_header->type);
- lspping_subtlv_len=EXTRACT_BE_16BITS(lspping_subtlv_header->length);
+ lspping_subtlv_type=EXTRACT_BE_U_2(lspping_subtlv_header->type);
+ lspping_subtlv_len=EXTRACT_BE_U_2(lspping_subtlv_header->length);
subtlv_tptr=tlv_tptr+sizeof(struct lspping_tlv_header);
/* Does the subTLV go past the end of the TLV? */
"\n\t tunnel-id 0x%04x, extended tunnel-id %s",
ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_endpoint),
ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_sender),
- EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->lsp_id),
- EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_id),
+ EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->lsp_id),
+ EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_id),
ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->extended_tunnel_id)));
}
break;
"\n\t tunnel-id 0x%04x, extended tunnel-id %s",
ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_endpoint),
ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_sender),
- EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->lsp_id),
- EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_id),
+ EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->lsp_id),
+ EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_id),
ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->extended_tunnel_id)));
}
break;
ND_PRINT((ndo, "\n\t RD: %s, Sender VE ID: %u, Receiver VE ID: %u" \
"\n\t Encapsulation Type: %s (%u)",
bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->rd),
- EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->sender_ve_id),
- EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->receiver_ve_id),
+ EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->sender_ve_id),
+ EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->receiver_ve_id),
tok2str(mpls_pw_types_values,
"unknown",
- EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)),
- EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)));
+ EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)),
+ EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)));
}
break;
ND_PRINT((ndo, "\n\t Remote PE: %s" \
"\n\t PW ID: 0x%08x, PW Type: %s (%u)",
ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->remote_pe_address),
- EXTRACT_BE_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_id),
+ EXTRACT_BE_U_4(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_id),
tok2str(mpls_pw_types_values,
"unknown",
- EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type)),
- EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type)));
+ EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type)),
+ EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type)));
}
break;
"\n\t PW ID: 0x%08x, PW Type: %s (%u)",
ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->sender_pe_address),
ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->remote_pe_address),
- EXTRACT_BE_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_id),
+ EXTRACT_BE_U_4(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_id),
tok2str(mpls_pw_types_values,
"unknown",
- EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type)),
- EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type)));
+ EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type)),
+ EXTRACT_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type)));
}
break;
* we find the address-type, we recast the tlv_tptr and move on. */
ND_PRINT((ndo, "\n\t MTU: %u, Address-Type: %s (%u)",
- EXTRACT_BE_16BITS(tlv_ptr.lspping_tlv_downstream_map->mtu),
+ EXTRACT_BE_U_2(tlv_ptr.lspping_tlv_downstream_map->mtu),
tok2str(lspping_tlv_downstream_addr_values,
"unknown",
tlv_ptr.lspping_tlv_downstream_map->address_type),
ND_PRINT((ndo, "\n\t Downstream IP: %s" \
"\n\t Downstream Interface Index: 0x%08x",
ipaddr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv4_unmb->downstream_ip),
- EXTRACT_BE_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4_unmb->downstream_interface)));
+ EXTRACT_BE_U_4(tlv_ptr.lspping_tlv_downstream_map_ipv4_unmb->downstream_interface)));
tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv4_unmb_t);
tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv4_unmb_t);
break;
ND_PRINT((ndo, "\n\t Downstream IP: %s" \
"\n\t Downstream Interface Index: 0x%08x",
ip6addr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv6_unmb->downstream_ip),
- EXTRACT_BE_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv6_unmb->downstream_interface)));
+ EXTRACT_BE_U_4(tlv_ptr.lspping_tlv_downstream_map_ipv6_unmb->downstream_interface)));
tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv6_unmb_t);
tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv6_unmb_t);
break;
goto tlv_tooshort;
} else {
ND_TCHECK2(*tptr, LSPPING_TLV_BFD_DISCRIMINATOR_LEN);
- ND_PRINT((ndo, "\n\t BFD Discriminator 0x%08x", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t BFD Discriminator 0x%08x", EXTRACT_BE_U_4(tptr)));
}
break;
goto tlv_tooshort;
} else {
ND_TCHECK2(*tptr, LSPPING_TLV_VENDOR_ENTERPRISE_LEN);
- vendor_id = EXTRACT_BE_32BITS(tlv_tptr);
+ vendor_id = EXTRACT_BE_U_4(tlv_tptr);
ND_PRINT((ndo, "\n\t Vendor: %s (0x%04x)",
tok2str(smi_values, "Unknown", vendor_id),
vendor_id));
}
/* ok they seem to want to know everything - lets fully decode it */
- tlen=EXTRACT_BE_16BITS(lwapp_trans_header->length);
+ tlen=EXTRACT_BE_U_2(lwapp_trans_header->length);
ND_PRINT((ndo, "LWAPPv%u, %s frame, Radio-id %u, Flags [%s], Frag-id %u, length %u",
LWAPP_EXTRACT_VERSION(lwapp_trans_header->version),
ND_TCHECK2(*tptr, sizeof(struct lwapp_control_header));
lwapp_control_header = (const struct lwapp_control_header *)tptr;
- msg_tlen = EXTRACT_BE_16BITS(lwapp_control_header->len);
+ msg_tlen = EXTRACT_BE_U_2(lwapp_control_header->len);
/* print message header */
ND_PRINT((ndo, "\n\t Msg type: %s (%u), Seqnum: %u, Msg len: %d, Session: 0x%08x",
lwapp_control_header->msg_type,
lwapp_control_header->seq_num,
msg_tlen,
- EXTRACT_BE_32BITS(lwapp_control_header->session_id)));
+ EXTRACT_BE_U_4(lwapp_control_header->session_id)));
/* did we capture enough for fully decoding the message */
ND_TCHECK2(*tptr, msg_tlen);
}
/* ok they seem to want to know everything - lets fully decode it */
- tlen=EXTRACT_BE_16BITS(lwapp_trans_header->length);
+ tlen=EXTRACT_BE_U_2(lwapp_trans_header->length);
ND_PRINT((ndo, "LWAPPv%u, %s frame, Radio-id %u, Flags [%s], Frag-id %u, length %u",
LWAPP_EXTRACT_VERSION(lwapp_trans_header->version),
if (p + 2 > (const char *)ndo->ndo_snapend)
goto trunc;
- l = EXTRACT_BE_16BITS(p);
+ l = EXTRACT_BE_U_2(p);
advance = lwres_printname(ndo, l, p + 2);
if (advance < 0)
goto trunc;
p = p0;
if (p + 2 > (const char *)ndo->ndo_snapend)
goto trunc;
- l = EXTRACT_BE_16BITS(p);
+ l = EXTRACT_BE_U_2(p);
if (p + 2 + l > (const char *)ndo->ndo_snapend)
goto trunc;
p += 2;
int i;
ND_TCHECK(ap->length);
- l = EXTRACT_BE_16BITS(&ap->length);
+ l = EXTRACT_BE_U_2(&ap->length);
/* XXX ap points to packed struct */
p = (const char *)&ap->length + sizeof(ap->length);
ND_TCHECK2(*p, l);
- switch (EXTRACT_BE_32BITS(&ap->family)) {
+ switch (EXTRACT_BE_U_4(&ap->family)) {
case 1: /* IPv4 */
if (l < 4)
return -1;
p += sizeof(struct in6_addr);
break;
default:
- ND_PRINT((ndo, " %u/", EXTRACT_BE_32BITS(&ap->family)));
+ ND_PRINT((ndo, " %u/", EXTRACT_BE_U_4(&ap->family)));
for (i = 0; i < l; i++)
ND_PRINT((ndo, "%02x", *p++));
}
ND_TCHECK(np->authlength);
ND_PRINT((ndo, " lwres"));
- v = EXTRACT_BE_16BITS(&np->version);
+ v = EXTRACT_BE_U_2(&np->version);
if (ndo->ndo_vflag || v != LWRES_LWPACKETVERSION_0)
ND_PRINT((ndo, " v%u", v));
if (v != LWRES_LWPACKETVERSION_0) {
- s = (const char *)np + EXTRACT_BE_32BITS(&np->length);
+ s = (const char *)np + EXTRACT_BE_U_4(&np->length);
goto tail;
}
- response = EXTRACT_BE_16BITS(&np->pktflags) & LWRES_LWPACKETFLAG_RESPONSE;
+ response = EXTRACT_BE_U_2(&np->pktflags) & LWRES_LWPACKETFLAG_RESPONSE;
/* opcode and pktflags */
- v = EXTRACT_BE_32BITS(&np->opcode);
+ v = EXTRACT_BE_U_4(&np->opcode);
s = tok2str(opcode, "#0x%x", v);
ND_PRINT((ndo, " %s%s", s, response ? "" : "?"));
/* pktflags */
- v = EXTRACT_BE_16BITS(&np->pktflags);
+ v = EXTRACT_BE_U_2(&np->pktflags);
if (v & ~LWRES_LWPACKETFLAG_RESPONSE)
ND_PRINT((ndo, "[0x%x]", v));
if (ndo->ndo_vflag > 1) {
ND_PRINT((ndo, " (")); /*)*/
- ND_PRINT((ndo, "serial:0x%x", EXTRACT_BE_32BITS(&np->serial)));
- ND_PRINT((ndo, " result:0x%x", EXTRACT_BE_32BITS(&np->result)));
- ND_PRINT((ndo, " recvlen:%u", EXTRACT_BE_32BITS(&np->recvlength)));
+ ND_PRINT((ndo, "serial:0x%x", EXTRACT_BE_U_4(&np->serial)));
+ ND_PRINT((ndo, " result:0x%x", EXTRACT_BE_U_4(&np->result)));
+ ND_PRINT((ndo, " recvlen:%u", EXTRACT_BE_U_4(&np->recvlength)));
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
- ND_PRINT((ndo, " authtype:0x%x", EXTRACT_BE_16BITS(&np->authtype)));
- ND_PRINT((ndo, " authlen:%u", EXTRACT_BE_16BITS(&np->authlength)));
+ ND_PRINT((ndo, " authtype:0x%x", EXTRACT_BE_U_2(&np->authtype)));
+ ND_PRINT((ndo, " authlen:%u", EXTRACT_BE_U_2(&np->authlength)));
}
/*(*/
ND_PRINT((ndo, ")"));
gnba = NULL;
grbn = NULL;
- switch (EXTRACT_BE_32BITS(&np->opcode)) {
+ switch (EXTRACT_BE_U_4(&np->opcode)) {
case LWRES_OPCODE_NOOP:
break;
case LWRES_OPCODE_GETADDRSBYNAME:
/* XXX gabn points to packed struct */
s = (const char *)&gabn->namelen +
sizeof(gabn->namelen);
- l = EXTRACT_BE_16BITS(&gabn->namelen);
+ l = EXTRACT_BE_U_2(&gabn->namelen);
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT((ndo, " flags:0x%x",
- EXTRACT_BE_32BITS(&gabn->flags)));
+ EXTRACT_BE_U_4(&gabn->flags)));
}
- v = EXTRACT_BE_32BITS(&gabn->addrtypes);
+ v = EXTRACT_BE_U_4(&gabn->addrtypes);
switch (v & (LWRES_ADDRTYPE_V4 | LWRES_ADDRTYPE_V6)) {
case LWRES_ADDRTYPE_V4:
ND_PRINT((ndo, " IPv4"));
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT((ndo, " flags:0x%x",
- EXTRACT_BE_32BITS(&gnba->flags)));
+ EXTRACT_BE_U_4(&gnba->flags)));
}
s = (const char *)&gnba->addr;
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT((ndo, " flags:0x%x",
- EXTRACT_BE_32BITS(&grbn->flags)));
+ EXTRACT_BE_U_4(&grbn->flags)));
}
ND_PRINT((ndo, " %s", tok2str(ns_type2str, "Type%d",
- EXTRACT_BE_16BITS(&grbn->rdtype))));
- if (EXTRACT_BE_16BITS(&grbn->rdclass) != C_IN) {
+ EXTRACT_BE_U_2(&grbn->rdtype))));
+ if (EXTRACT_BE_U_2(&grbn->rdclass) != C_IN) {
ND_PRINT((ndo, " %s", tok2str(ns_class2str, "Class%d",
- EXTRACT_BE_16BITS(&grbn->rdclass))));
+ EXTRACT_BE_U_2(&grbn->rdclass))));
}
/* XXX grbn points to packed struct */
s = (const char *)&grbn->namelen +
sizeof(grbn->namelen);
- l = EXTRACT_BE_16BITS(&grbn->namelen);
+ l = EXTRACT_BE_U_2(&grbn->namelen);
advance = lwres_printname(ndo, l, s);
if (advance < 0)
gnba = NULL;
grbn = NULL;
- switch (EXTRACT_BE_32BITS(&np->opcode)) {
+ switch (EXTRACT_BE_U_4(&np->opcode)) {
case LWRES_OPCODE_NOOP:
break;
case LWRES_OPCODE_GETADDRSBYNAME:
/* XXX gabn points to packed struct */
s = (const char *)&gabn->realnamelen +
sizeof(gabn->realnamelen);
- l = EXTRACT_BE_16BITS(&gabn->realnamelen);
+ l = EXTRACT_BE_U_2(&gabn->realnamelen);
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT((ndo, " flags:0x%x",
- EXTRACT_BE_32BITS(&gabn->flags)));
+ EXTRACT_BE_U_4(&gabn->flags)));
}
- ND_PRINT((ndo, " %u/%u", EXTRACT_BE_16BITS(&gabn->naliases),
- EXTRACT_BE_16BITS(&gabn->naddrs)));
+ ND_PRINT((ndo, " %u/%u", EXTRACT_BE_U_2(&gabn->naliases),
+ EXTRACT_BE_U_2(&gabn->naddrs)));
advance = lwres_printname(ndo, l, s);
if (advance < 0)
s += advance;
/* aliases */
- na = EXTRACT_BE_16BITS(&gabn->naliases);
+ na = EXTRACT_BE_U_2(&gabn->naliases);
for (i = 0; i < na; i++) {
advance = lwres_printnamelen(ndo, s);
if (advance < 0)
}
/* addrs */
- na = EXTRACT_BE_16BITS(&gabn->naddrs);
+ na = EXTRACT_BE_U_2(&gabn->naddrs);
for (i = 0; i < na; i++) {
advance = lwres_printaddr(ndo, (const lwres_addr_t *)s);
if (advance < 0)
/* XXX gnba points to packed struct */
s = (const char *)&gnba->realnamelen +
sizeof(gnba->realnamelen);
- l = EXTRACT_BE_16BITS(&gnba->realnamelen);
+ l = EXTRACT_BE_U_2(&gnba->realnamelen);
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT((ndo, " flags:0x%x",
- EXTRACT_BE_32BITS(&gnba->flags)));
+ EXTRACT_BE_U_4(&gnba->flags)));
}
- ND_PRINT((ndo, " %u", EXTRACT_BE_16BITS(&gnba->naliases)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_2(&gnba->naliases)));
advance = lwres_printname(ndo, l, s);
if (advance < 0)
s += advance;
/* aliases */
- na = EXTRACT_BE_16BITS(&gnba->naliases);
+ na = EXTRACT_BE_U_2(&gnba->naliases);
for (i = 0; i < na; i++) {
advance = lwres_printnamelen(ndo, s);
if (advance < 0)
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT((ndo, " flags:0x%x",
- EXTRACT_BE_32BITS(&grbn->flags)));
+ EXTRACT_BE_U_4(&grbn->flags)));
}
ND_PRINT((ndo, " %s", tok2str(ns_type2str, "Type%d",
- EXTRACT_BE_16BITS(&grbn->rdtype))));
- if (EXTRACT_BE_16BITS(&grbn->rdclass) != C_IN) {
+ EXTRACT_BE_U_2(&grbn->rdtype))));
+ if (EXTRACT_BE_U_2(&grbn->rdclass) != C_IN) {
ND_PRINT((ndo, " %s", tok2str(ns_class2str, "Class%d",
- EXTRACT_BE_16BITS(&grbn->rdclass))));
+ EXTRACT_BE_U_2(&grbn->rdclass))));
}
ND_PRINT((ndo, " TTL "));
unsigned_relts_print(ndo,
- EXTRACT_BE_32BITS(&grbn->ttl));
- ND_PRINT((ndo, " %u/%u", EXTRACT_BE_16BITS(&grbn->nrdatas),
- EXTRACT_BE_16BITS(&grbn->nsigs)));
+ EXTRACT_BE_U_4(&grbn->ttl));
+ ND_PRINT((ndo, " %u/%u", EXTRACT_BE_U_2(&grbn->nrdatas),
+ EXTRACT_BE_U_2(&grbn->nsigs)));
/* XXX grbn points to packed struct */
s = (const char *)&grbn->nsigs+ sizeof(grbn->nsigs);
s += advance;
/* rdatas */
- na = EXTRACT_BE_16BITS(&grbn->nrdatas);
+ na = EXTRACT_BE_U_2(&grbn->nrdatas);
for (i = 0; i < na; i++) {
/* XXX should decode resource data */
advance = lwres_printbinlen(ndo, s);
}
/* sigs */
- na = EXTRACT_BE_16BITS(&grbn->nsigs);
+ na = EXTRACT_BE_U_2(&grbn->nsigs);
for (i = 0; i < na; i++) {
/* XXX how should we print it? */
advance = lwres_printbinlen(ndo, s);
tail:
/* length mismatch */
- if (EXTRACT_BE_32BITS(&np->length) != length) {
- ND_PRINT((ndo, " [len: %u != %u]", EXTRACT_BE_32BITS(&np->length),
+ if (EXTRACT_BE_U_4(&np->length) != length) {
+ ND_PRINT((ndo, " [len: %u != %u]", EXTRACT_BE_U_4(&np->length),
length));
}
- if (!unsupported && s < (const char *)np + EXTRACT_BE_32BITS(&np->length))
+ if (!unsupported && s < (const char *)np + EXTRACT_BE_U_4(&np->length))
ND_PRINT((ndo, "[extra]"));
return;
if (size < 4)
goto invalid;
ND_TCHECK2(*buf, size);
- ND_PRINT((ndo, "0x%08x", EXTRACT_BE_32BITS(buf)));
+ ND_PRINT((ndo, "0x%08x", EXTRACT_BE_U_4(buf)));
break;
/* ... */
default:
goto invalid;
ND_TCHECK2(*p, sizeof(struct m3ua_param_header));
/* Parameter Tag */
- hdr_tag = EXTRACT_BE_16BITS(p);
+ hdr_tag = EXTRACT_BE_U_2(p);
ND_PRINT((ndo, "\n\t\t\t%s: ", tok2str(ParamName, "Unknown Parameter (0x%04x)", hdr_tag)));
/* Parameter Length */
- hdr_len = EXTRACT_BE_16BITS(p + 2);
+ hdr_len = EXTRACT_BE_U_2(p + 2);
if (hdr_len < sizeof(struct m3ua_param_header))
goto invalid;
/* Parameter Value */
if (dict != NULL)
ND_PRINT((ndo, " %s Message", tok2str(dict, "Unknown (0x%02x)", hdr->msg_type)));
- if (size != EXTRACT_BE_32BITS(&hdr->len))
- ND_PRINT((ndo, "\n\t\t\t@@@@@@ Corrupted length %u of message @@@@@@", EXTRACT_BE_32BITS(&hdr->len)));
+ if (size != EXTRACT_BE_U_4(&hdr->len))
+ ND_PRINT((ndo, "\n\t\t\t@@@@@@ Corrupted length %u of message @@@@@@", EXTRACT_BE_U_4(&hdr->len)));
else
m3ua_tags_print(ndo, buf + sizeof(struct m3ua_common_header),
- EXTRACT_BE_32BITS(&hdr->len) - sizeof(struct m3ua_common_header));
+ EXTRACT_BE_U_4(&hdr->len) - sizeof(struct m3ua_common_header));
return;
invalid:
length -= 8;
caplen -= 8;
- ether_type = EXTRACT_BE_16BITS(&medsa->ether_type);
+ ether_type = EXTRACT_BE_U_2(&medsa->ether_type);
if (ether_type <= ETHERMTU) {
/* Try to print the LLC-layer header & higher layers */
if (llc_print(ndo, bp, length, caplen, src, dst) < 0) {
}
ND_PRINT((ndo, "mobile: "));
- proto = EXTRACT_BE_16BITS(&mob->proto);
- crc = EXTRACT_BE_16BITS(&mob->hcheck);
+ proto = EXTRACT_BE_U_2(&mob->proto);
+ crc = EXTRACT_BE_U_2(&mob->hcheck);
if (proto & OSRC_PRES) {
osp=1;
}
/* units of 4 secs */
ND_TCHECK_2(&bp[i + 2]);
ND_PRINT((ndo, "(refresh: %u)",
- EXTRACT_BE_16BITS(bp + i + 2) << 2));
+ EXTRACT_BE_U_2(bp + i + 2) << 2));
break;
case IP6MOPT_ALTCOA:
if (len - i < IP6MOPT_ALTCOA_MINLEN) {
ND_TCHECK_2(&bp[i + 2]);
ND_TCHECK_2(&bp[i + 4]);
ND_PRINT((ndo, "(ni: ho=0x%04x co=0x%04x)",
- EXTRACT_BE_16BITS(bp + i + 2),
- EXTRACT_BE_16BITS(bp + i + 4)));
+ EXTRACT_BE_U_2(bp + i + 2),
+ EXTRACT_BE_U_2(bp + i + 4)));
break;
case IP6MOPT_AUTH:
if (len - i < IP6MOPT_AUTH_MINLEN) {
ND_TCHECK_4(&bp[hlen + 4]);
ND_PRINT((ndo, " %s Init Cookie=%08x:%08x",
type == IP6M_HOME_TEST_INIT ? "Home" : "Care-of",
- EXTRACT_BE_32BITS(bp + hlen),
- EXTRACT_BE_32BITS(bp + hlen + 4)));
+ EXTRACT_BE_U_4(bp + hlen),
+ EXTRACT_BE_U_4(bp + hlen + 4)));
}
hlen += 8;
break;
case IP6M_HOME_TEST:
case IP6M_CAREOF_TEST:
ND_TCHECK(mh->ip6m_data16[0]);
- ND_PRINT((ndo, " nonce id=0x%x", EXTRACT_BE_16BITS(&mh->ip6m_data16[0])));
+ ND_PRINT((ndo, " nonce id=0x%x", EXTRACT_BE_U_2(&mh->ip6m_data16[0])));
hlen = IP6M_MINLEN;
if (ndo->ndo_vflag) {
ND_TCHECK_4(&bp[hlen + 4]);
ND_PRINT((ndo, " %s Init Cookie=%08x:%08x",
type == IP6M_HOME_TEST ? "Home" : "Care-of",
- EXTRACT_BE_32BITS(bp + hlen),
- EXTRACT_BE_32BITS(bp + hlen + 4)));
+ EXTRACT_BE_U_4(bp + hlen),
+ EXTRACT_BE_U_4(bp + hlen + 4)));
}
hlen += 8;
if (ndo->ndo_vflag) {
ND_TCHECK_4(&bp[hlen + 4]);
ND_PRINT((ndo, " %s Keygen Token=%08x:%08x",
type == IP6M_HOME_TEST ? "Home" : "Care-of",
- EXTRACT_BE_32BITS(bp + hlen),
- EXTRACT_BE_32BITS(bp + hlen + 4)));
+ EXTRACT_BE_U_4(bp + hlen),
+ EXTRACT_BE_U_4(bp + hlen + 4)));
}
hlen += 8;
break;
case IP6M_BINDING_UPDATE:
ND_TCHECK(mh->ip6m_data16[0]);
- ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_16BITS(&mh->ip6m_data16[0])));
+ ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_U_2(&mh->ip6m_data16[0])));
hlen = IP6M_MINLEN;
ND_TCHECK_2(&bp[hlen]);
if (bp[hlen] & 0xf0) {
hlen += 1;
ND_TCHECK_2(&bp[hlen]);
/* units of 4 secs */
- ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_16BITS(bp + hlen) << 2));
+ ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_U_2(bp + hlen) << 2));
hlen += 2;
break;
case IP6M_BINDING_ACK:
/* Reserved (7bits) */
hlen = IP6M_MINLEN;
ND_TCHECK_2(&bp[hlen]);
- ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_16BITS(bp + hlen)));
+ ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_U_2(bp + hlen)));
hlen += 2;
ND_TCHECK_2(&bp[hlen]);
/* units of 4 secs */
- ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_16BITS(bp + hlen) << 2));
+ ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_U_2(bp + hlen) << 2));
hlen += 2;
break;
case IP6M_BINDING_ERROR:
mpcp.common_header = (const struct mpcp_common_header_t *)pptr;
ND_TCHECK2(*tptr, sizeof(struct mpcp_common_header_t));
- opcode = EXTRACT_BE_16BITS(mpcp.common_header->opcode);
+ opcode = EXTRACT_BE_U_2(mpcp.common_header->opcode);
ND_PRINT((ndo, "MPCP, Opcode %s", tok2str(mpcp_opcode_values, "Unknown (%u)", opcode)));
if (opcode != MPCP_OPCODE_PAUSE) {
- ND_PRINT((ndo, ", Timestamp %u ticks", EXTRACT_BE_32BITS(mpcp.common_header->timestamp)));
+ ND_PRINT((ndo, ", Timestamp %u ticks", EXTRACT_BE_U_4(mpcp.common_header->timestamp)));
}
ND_PRINT((ndo, ", length %u", length));
case MPCP_OPCODE_GATE:
ND_TCHECK2(*tptr, MPCP_GRANT_NUMBER_LEN);
- grant_numbers = EXTRACT_8BITS(tptr) & MPCP_GRANT_NUMBER_MASK;
+ grant_numbers = EXTRACT_U_1(tptr) & MPCP_GRANT_NUMBER_MASK;
ND_PRINT((ndo, "\n\tGrant Numbers %u, Flags [ %s ]",
grant_numbers,
bittok2str(mpcp_grant_flag_values,
"?",
- EXTRACT_8BITS(tptr) & ~MPCP_GRANT_NUMBER_MASK)));
+ EXTRACT_U_1(tptr) & ~MPCP_GRANT_NUMBER_MASK)));
tptr++;
for (grant = 1; grant <= grant_numbers; grant++) {
mpcp.grant = (const struct mpcp_grant_t *)tptr;
ND_PRINT((ndo, "\n\tGrant #%u, Start-Time %u ticks, duration %u ticks",
grant,
- EXTRACT_BE_32BITS(mpcp.grant->starttime),
- EXTRACT_BE_16BITS(mpcp.grant->duration)));
+ EXTRACT_BE_U_4(mpcp.grant->starttime),
+ EXTRACT_BE_U_2(mpcp.grant->duration)));
tptr += sizeof(struct mpcp_grant_t);
}
ND_TCHECK2(*tptr, MPCP_TIMESTAMP_DURATION_LEN);
- ND_PRINT((ndo, "\n\tSync-Time %u ticks", EXTRACT_BE_16BITS(tptr)));
+ ND_PRINT((ndo, "\n\tSync-Time %u ticks", EXTRACT_BE_U_2(tptr)));
break;
ND_TCHECK2(*tptr, MPCP_TIMESTAMP_DURATION_LEN);
ND_PRINT((ndo, "\n\t Q%u Report, Duration %u ticks",
report,
- EXTRACT_BE_16BITS(tptr)));
+ EXTRACT_BE_U_2(tptr)));
tptr+=MPCP_TIMESTAMP_DURATION_LEN;
}
report++;
mpcp.reg = (const struct mpcp_reg_t *)tptr;
ND_PRINT((ndo, "\n\tAssigned-Port %u, Flags [ %s ]" \
"\n\tSync-Time %u ticks, Echoed-Pending-Grants %u",
- EXTRACT_BE_16BITS(mpcp.reg->assigned_port),
+ EXTRACT_BE_U_2(mpcp.reg->assigned_port),
bittok2str(mpcp_reg_flag_values, "Reserved", mpcp.reg->flags),
- EXTRACT_BE_16BITS(mpcp.reg->sync_time),
+ EXTRACT_BE_U_2(mpcp.reg->sync_time),
mpcp.reg->echoed_pending_grants));
break;
mpcp.reg_ack = (const struct mpcp_reg_ack_t *)tptr;
ND_PRINT((ndo, "\n\tEchoed-Assigned-Port %u, Flags [ %s ]" \
"\n\tEchoed-Sync-Time %u ticks",
- EXTRACT_BE_16BITS(mpcp.reg_ack->echoed_assigned_port),
+ EXTRACT_BE_U_2(mpcp.reg_ack->echoed_assigned_port),
bittok2str(mpcp_reg_ack_flag_values, "Reserved", mpcp.reg_ack->flags),
- EXTRACT_BE_16BITS(mpcp.reg_ack->echoed_sync_time)));
+ EXTRACT_BE_U_2(mpcp.reg_ack->echoed_sync_time)));
break;
default:
ND_PRINT((ndo, "[|MPLS], length %u", length));
return;
}
- label_entry = EXTRACT_BE_32BITS(p);
+ label_entry = EXTRACT_BE_U_4(p);
ND_PRINT((ndo, "%s(label %u",
(label_stack_depth && ndo->ndo_vflag) ? "\n\t" : " ",
MPLS_LABEL(label_entry)));
if (mpc->flags & MP_CAPABLE_C)
ND_PRINT((ndo, " csum"));
- ND_PRINT((ndo, " {0x%" PRIx64, EXTRACT_BE_64BITS(mpc->sender_key)));
+ ND_PRINT((ndo, " {0x%" PRIx64, EXTRACT_BE_U_8(mpc->sender_key)));
if (opt_len == 20) /* ACK */
- ND_PRINT((ndo, ",0x%" PRIx64, EXTRACT_BE_64BITS(mpc->receiver_key)));
+ ND_PRINT((ndo, ",0x%" PRIx64, EXTRACT_BE_U_8(mpc->receiver_key)));
ND_PRINT((ndo, "}"));
return 1;
}
switch (opt_len) {
case 12: /* SYN */
ND_PRINT((ndo, " token 0x%x" " nonce 0x%x",
- EXTRACT_BE_32BITS(mpj->u.syn.token),
- EXTRACT_BE_32BITS(mpj->u.syn.nonce)));
+ EXTRACT_BE_U_4(mpj->u.syn.token),
+ EXTRACT_BE_U_4(mpj->u.syn.nonce)));
break;
case 16: /* SYN/ACK */
ND_PRINT((ndo, " hmac 0x%" PRIx64 " nonce 0x%x",
- EXTRACT_BE_64BITS(mpj->u.synack.mac),
- EXTRACT_BE_32BITS(mpj->u.synack.nonce)));
+ EXTRACT_BE_U_8(mpj->u.synack.mac),
+ EXTRACT_BE_U_4(mpj->u.synack.nonce)));
break;
case 24: {/* ACK */
size_t i;
if (mdss->flags & MP_DSS_a) {
if (opt_len < 8)
return 0;
- ND_PRINT((ndo, "%" PRIu64, EXTRACT_BE_64BITS(opt)));
+ ND_PRINT((ndo, "%" PRIu64, EXTRACT_BE_U_8(opt)));
opt += 8;
opt_len -= 8;
} else {
if (opt_len < 4)
return 0;
- ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(opt)));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_U_4(opt)));
opt += 4;
opt_len -= 4;
}
if (mdss->flags & MP_DSS_m) {
if (opt_len < 8)
return 0;
- ND_PRINT((ndo, "%" PRIu64, EXTRACT_BE_64BITS(opt)));
+ ND_PRINT((ndo, "%" PRIu64, EXTRACT_BE_U_8(opt)));
opt += 8;
opt_len -= 8;
} else {
if (opt_len < 4)
return 0;
- ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(opt)));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_U_4(opt)));
opt += 4;
opt_len -= 4;
}
if (opt_len < 4)
return 0;
- ND_PRINT((ndo, " subseq %u", EXTRACT_BE_32BITS(opt)));
+ ND_PRINT((ndo, " subseq %u", EXTRACT_BE_U_4(opt)));
opt += 4;
opt_len -= 4;
if (opt_len < 2)
return 0;
- ND_PRINT((ndo, " len %u", EXTRACT_BE_16BITS(opt)));
+ ND_PRINT((ndo, " len %u", EXTRACT_BE_U_2(opt)));
opt += 2;
opt_len -= 2;
* bytes as the Checksum.
*/
if (opt_len >= 2) {
- ND_PRINT((ndo, " csum 0x%x", EXTRACT_BE_16BITS(opt)));
+ ND_PRINT((ndo, " csum 0x%x", EXTRACT_BE_U_2(opt)));
opt_len -= 2;
}
}
case 4:
ND_PRINT((ndo, " %s", ipaddr_string(ndo, add_addr->u.v4.addr)));
if (opt_len == 10)
- ND_PRINT((ndo, ":%u", EXTRACT_BE_16BITS(add_addr->u.v4.port)));
+ ND_PRINT((ndo, ":%u", EXTRACT_BE_U_2(add_addr->u.v4.port)));
break;
case 6:
ND_PRINT((ndo, " %s", ip6addr_string(ndo, add_addr->u.v6.addr)));
if (opt_len == 22)
- ND_PRINT((ndo, ":%u", EXTRACT_BE_16BITS(add_addr->u.v6.port)));
+ ND_PRINT((ndo, ":%u", EXTRACT_BE_U_2(add_addr->u.v6.port)));
break;
default:
return 0;
opt_len -= 3;
ND_PRINT((ndo, " id"));
while (opt_len--) {
- ND_PRINT((ndo, " %u", EXTRACT_8BITS(addr_id)));
+ ND_PRINT((ndo, " %u", EXTRACT_U_1(addr_id)));
addr_id++;
}
return 1;
if (opt_len != 12)
return 0;
- ND_PRINT((ndo, " seq %" PRIu64, EXTRACT_BE_64BITS(opt + 4)));
+ ND_PRINT((ndo, " seq %" PRIu64, EXTRACT_BE_U_8(opt + 4)));
return 1;
}
if (opt_len != 12)
return 0;
- ND_PRINT((ndo, " key 0x%" PRIx64, EXTRACT_BE_64BITS(opt + 4)));
+ ND_PRINT((ndo, " key 0x%" PRIx64, EXTRACT_BE_U_8(opt + 4)));
return 1;
}
ND_TCHECK2(*sp, 3);
/* See if we think we're at the beginning of a compound packet */
type = *sp;
- len = EXTRACT_BE_16BITS(sp + 1);
+ len = EXTRACT_BE_U_2(sp + 1);
if (len > 1500 || len < 3 || type == 0 || type > MSDP_TYPE_MAX)
goto trunc; /* not really truncated, but still not decodable */
ND_PRINT((ndo, " msdp:"));
while (length > 0) {
ND_TCHECK2(*sp, 3);
type = *sp;
- len = EXTRACT_BE_16BITS(sp + 1);
+ len = EXTRACT_BE_U_2(sp + 1);
if (len > 1400 || ndo->ndo_vflag)
ND_PRINT((ndo, " [len %u]", len));
if (len < 3)
ND_TCHECK(*hb);
ND_PRINT((ndo, "MS NLB heartbeat, host priority: %u,",
- EXTRACT_LE_32BITS(&(hb->host_prio))));
+ EXTRACT_LE_U_4(&(hb->host_prio))));
ND_PRINT((ndo, " cluster IP: %s,", ipaddr_string(ndo, &(hb->virtual_ip))));
ND_PRINT((ndo, " host IP: %s", ipaddr_string(ndo, &(hb->host_ip))));
return;
const uint32_t *dp, struct nfsv3_sattr *sa3)
{
ND_TCHECK(dp[0]);
- sa3->sa_modeset = EXTRACT_BE_32BITS(dp);
+ sa3->sa_modeset = EXTRACT_BE_U_4(dp);
dp++;
if (sa3->sa_modeset) {
ND_TCHECK(dp[0]);
- sa3->sa_mode = EXTRACT_BE_32BITS(dp);
+ sa3->sa_mode = EXTRACT_BE_U_4(dp);
dp++;
}
ND_TCHECK(dp[0]);
- sa3->sa_uidset = EXTRACT_BE_32BITS(dp);
+ sa3->sa_uidset = EXTRACT_BE_U_4(dp);
dp++;
if (sa3->sa_uidset) {
ND_TCHECK(dp[0]);
- sa3->sa_uid = EXTRACT_BE_32BITS(dp);
+ sa3->sa_uid = EXTRACT_BE_U_4(dp);
dp++;
}
ND_TCHECK(dp[0]);
- sa3->sa_gidset = EXTRACT_BE_32BITS(dp);
+ sa3->sa_gidset = EXTRACT_BE_U_4(dp);
dp++;
if (sa3->sa_gidset) {
ND_TCHECK(dp[0]);
- sa3->sa_gid = EXTRACT_BE_32BITS(dp);
+ sa3->sa_gid = EXTRACT_BE_U_4(dp);
dp++;
}
ND_TCHECK(dp[0]);
- sa3->sa_sizeset = EXTRACT_BE_32BITS(dp);
+ sa3->sa_sizeset = EXTRACT_BE_U_4(dp);
dp++;
if (sa3->sa_sizeset) {
ND_TCHECK(dp[0]);
- sa3->sa_size = EXTRACT_BE_32BITS(dp);
+ sa3->sa_size = EXTRACT_BE_U_4(dp);
dp++;
}
ND_TCHECK(dp[0]);
- sa3->sa_atimetype = EXTRACT_BE_32BITS(dp);
+ sa3->sa_atimetype = EXTRACT_BE_U_4(dp);
dp++;
if (sa3->sa_atimetype == NFSV3SATTRTIME_TOCLIENT) {
ND_TCHECK(dp[1]);
- sa3->sa_atime.nfsv3_sec = EXTRACT_BE_32BITS(dp);
+ sa3->sa_atime.nfsv3_sec = EXTRACT_BE_U_4(dp);
dp++;
- sa3->sa_atime.nfsv3_nsec = EXTRACT_BE_32BITS(dp);
+ sa3->sa_atime.nfsv3_nsec = EXTRACT_BE_U_4(dp);
dp++;
}
ND_TCHECK(dp[0]);
- sa3->sa_mtimetype = EXTRACT_BE_32BITS(dp);
+ sa3->sa_mtimetype = EXTRACT_BE_U_4(dp);
dp++;
if (sa3->sa_mtimetype == NFSV3SATTRTIME_TOCLIENT) {
ND_TCHECK(dp[1]);
- sa3->sa_mtime.nfsv3_sec = EXTRACT_BE_32BITS(dp);
+ sa3->sa_mtime.nfsv3_sec = EXTRACT_BE_U_4(dp);
dp++;
- sa3->sa_mtime.nfsv3_nsec = EXTRACT_BE_32BITS(dp);
+ sa3->sa_mtime.nfsv3_nsec = EXTRACT_BE_U_4(dp);
dp++;
}
if (!ndo->ndo_nflag) {
strlcpy(srcid, "nfs", sizeof(srcid));
snprintf(dstid, sizeof(dstid), "%u",
- EXTRACT_BE_32BITS(&rp->rm_xid));
+ EXTRACT_BE_U_4(&rp->rm_xid));
} else {
snprintf(srcid, sizeof(srcid), "%u", NFS_PORT);
snprintf(dstid, sizeof(dstid), "%u",
- EXTRACT_BE_32BITS(&rp->rm_xid));
+ EXTRACT_BE_U_4(&rp->rm_xid));
}
print_nfsaddr(ndo, bp2, srcid, dstid);
rp = (const struct sunrpc_msg *)bp;
ND_TCHECK(rp->rm_reply.rp_stat);
- reply_stat = EXTRACT_BE_32BITS(&rp->rm_reply.rp_stat);
+ reply_stat = EXTRACT_BE_U_4(&rp->rm_reply.rp_stat);
switch (reply_stat) {
case SUNRPC_MSG_ACCEPTED:
case SUNRPC_MSG_DENIED:
ND_PRINT((ndo, "reply ERR %u: ", length));
ND_TCHECK(rp->rm_reply.rp_reject.rj_stat);
- rstat = EXTRACT_BE_32BITS(&rp->rm_reply.rp_reject.rj_stat);
+ rstat = EXTRACT_BE_U_4(&rp->rm_reply.rp_reject.rj_stat);
switch (rstat) {
case SUNRPC_RPC_MISMATCH:
ND_TCHECK(rp->rm_reply.rp_reject.rj_vers.high);
- rlow = EXTRACT_BE_32BITS(&rp->rm_reply.rp_reject.rj_vers.low);
- rhigh = EXTRACT_BE_32BITS(&rp->rm_reply.rp_reject.rj_vers.high);
+ rlow = EXTRACT_BE_U_4(&rp->rm_reply.rp_reject.rj_vers.low);
+ rhigh = EXTRACT_BE_U_4(&rp->rm_reply.rp_reject.rj_vers.high);
ND_PRINT((ndo, "RPC Version mismatch (%u-%u)", rlow, rhigh));
break;
case SUNRPC_AUTH_ERROR:
ND_TCHECK(rp->rm_reply.rp_reject.rj_why);
- rwhy = EXTRACT_BE_32BITS(&rp->rm_reply.rp_reject.rj_why);
+ rwhy = EXTRACT_BE_U_4(&rp->rm_reply.rp_reject.rj_why);
ND_PRINT((ndo, "Auth %s", tok2str(sunrpc_auth_str, "Invalid failure code %u", rwhy)));
break;
*/
dp = (const uint32_t *)&rp->rm_call.cb_cred;
ND_TCHECK(dp[1]);
- len = EXTRACT_BE_32BITS(dp + 1);
+ len = EXTRACT_BE_U_4(dp + 1);
if (len < length) {
dp += (len + (2 * sizeof(*dp) + 3)) / sizeof(*dp);
ND_TCHECK(dp[1]);
- len = EXTRACT_BE_32BITS(dp + 1);
+ len = EXTRACT_BE_U_4(dp + 1);
if (len < length) {
dp += (len + (2 * sizeof(*dp) + 3)) / sizeof(*dp);
ND_TCHECK2(dp[0], 0);
if (v3) {
ND_TCHECK(dp[0]);
- len = EXTRACT_BE_32BITS(dp) / 4;
+ len = EXTRACT_BE_U_4(dp) / 4;
dp++;
} else
len = NFSX_V2FH / 4;
if (!xid_map_enter(ndo, rp, bp2)) /* record proc number for later on */
goto trunc;
- v3 = (EXTRACT_BE_32BITS(&rp->rm_call.cb_vers) == NFS_VER3);
- proc = EXTRACT_BE_32BITS(&rp->rm_call.cb_proc);
+ v3 = (EXTRACT_BE_U_4(&rp->rm_call.cb_vers) == NFS_VER3);
+ proc = EXTRACT_BE_U_4(&rp->rm_call.cb_proc);
if (!v3 && proc < NFS_NPROCS)
proc = nfsv3_procid[proc];
if ((dp = parsereq(ndo, rp, length)) != NULL &&
(dp = parsefh(ndo, dp, v3)) != NULL) {
ND_TCHECK(dp[0]);
- access_flags = EXTRACT_BE_32BITS(dp);
+ access_flags = EXTRACT_BE_U_4(dp);
if (access_flags & ~NFSV3ACCESS_FULL) {
/* NFSV3ACCESS definitions aren't up to date */
ND_PRINT((ndo, " %04x", access_flags));
if (v3) {
ND_TCHECK(dp[2]);
ND_PRINT((ndo, " %u bytes @ %" PRIu64,
- EXTRACT_BE_32BITS(dp + 2),
- EXTRACT_BE_64BITS(dp)));
+ EXTRACT_BE_U_4(dp + 2),
+ EXTRACT_BE_U_8(dp)));
} else {
ND_TCHECK(dp[1]);
ND_PRINT((ndo, " %u bytes @ %u",
- EXTRACT_BE_32BITS(dp + 1),
- EXTRACT_BE_32BITS(dp)));
+ EXTRACT_BE_U_4(dp + 1),
+ EXTRACT_BE_U_4(dp)));
}
return;
}
if (v3) {
ND_TCHECK(dp[4]);
ND_PRINT((ndo, " %u (%u) bytes @ %" PRIu64,
- EXTRACT_BE_32BITS(dp + 4),
- EXTRACT_BE_32BITS(dp + 2),
- EXTRACT_BE_64BITS(dp)));
+ EXTRACT_BE_U_4(dp + 4),
+ EXTRACT_BE_U_4(dp + 2),
+ EXTRACT_BE_U_8(dp)));
if (ndo->ndo_vflag) {
ND_PRINT((ndo, " <%s>",
tok2str(nfsv3_writemodes,
- NULL, EXTRACT_BE_32BITS(dp + 3))));
+ NULL, EXTRACT_BE_U_4(dp + 3))));
}
} else {
ND_TCHECK(dp[3]);
ND_PRINT((ndo, " %u (%u) bytes @ %u (%u)",
- EXTRACT_BE_32BITS(dp + 3),
- EXTRACT_BE_32BITS(dp + 2),
- EXTRACT_BE_32BITS(dp + 1),
- EXTRACT_BE_32BITS(dp)));
+ EXTRACT_BE_U_4(dp + 3),
+ EXTRACT_BE_U_4(dp + 2),
+ EXTRACT_BE_U_4(dp + 1),
+ EXTRACT_BE_U_4(dp)));
}
return;
}
if ((dp = parsereq(ndo, rp, length)) != NULL &&
(dp = parsefhn(ndo, dp, v3)) != NULL) {
ND_TCHECK(*dp);
- type = (nfs_type) EXTRACT_BE_32BITS(dp);
+ type = (nfs_type) EXTRACT_BE_U_4(dp);
dp++;
if ((dp = parse_sattr3(ndo, dp, &sa3)) == NULL)
break;
if (ndo->ndo_vflag && (type == NFCHR || type == NFBLK)) {
ND_TCHECK(dp[1]);
ND_PRINT((ndo, " %u/%u",
- EXTRACT_BE_32BITS(dp),
- EXTRACT_BE_32BITS(dp + 1)));
+ EXTRACT_BE_U_4(dp),
+ EXTRACT_BE_U_4(dp + 1)));
dp += 2;
}
if (ndo->ndo_vflag)
* offset cookie here.
*/
ND_PRINT((ndo, " %u bytes @ %" PRId64,
- EXTRACT_BE_32BITS(dp + 4),
- EXTRACT_BE_64BITS(dp)));
+ EXTRACT_BE_U_4(dp + 4),
+ EXTRACT_BE_U_8(dp)));
if (ndo->ndo_vflag)
ND_PRINT((ndo, " verf %08x%08x", dp[2], dp[3]));
} else {
* common, but offsets > 2^31 aren't.
*/
ND_PRINT((ndo, " %u bytes @ %d",
- EXTRACT_BE_32BITS(dp + 1),
- EXTRACT_BE_32BITS(dp)));
+ EXTRACT_BE_U_4(dp + 1),
+ EXTRACT_BE_U_4(dp)));
}
return;
}
* cookie here.
*/
ND_PRINT((ndo, " %u bytes @ %" PRId64,
- EXTRACT_BE_32BITS(dp + 4),
- EXTRACT_BE_64BITS(dp)));
+ EXTRACT_BE_U_4(dp + 4),
+ EXTRACT_BE_U_8(dp)));
if (ndo->ndo_vflag) {
ND_TCHECK(dp[5]);
ND_PRINT((ndo, " max %u verf %08x%08x",
- EXTRACT_BE_32BITS(dp + 5), dp[2], dp[3]));
+ EXTRACT_BE_U_4(dp + 5), dp[2], dp[3]));
}
return;
}
(dp = parsefh(ndo, dp, v3)) != NULL) {
ND_TCHECK(dp[2]);
ND_PRINT((ndo, " %u bytes @ %" PRIu64,
- EXTRACT_BE_32BITS(dp + 2),
- EXTRACT_BE_64BITS(dp)));
+ EXTRACT_BE_U_4(dp + 2),
+ EXTRACT_BE_U_8(dp)));
return;
}
break;
UNALIGNED_MEMCPY(&xmep->client, &ip6->ip6_src, sizeof(ip6->ip6_src));
UNALIGNED_MEMCPY(&xmep->server, &ip6->ip6_dst, sizeof(ip6->ip6_dst));
}
- xmep->proc = EXTRACT_BE_32BITS(&rp->rm_call.cb_proc);
- xmep->vers = EXTRACT_BE_32BITS(&rp->rm_call.cb_vers);
+ xmep->proc = EXTRACT_BE_U_4(&rp->rm_call.cb_proc);
+ xmep->vers = EXTRACT_BE_U_4(&rp->rm_call.cb_vers);
return (1);
}
*/
dp = ((const uint32_t *)&rp->rm_reply) + 1;
ND_TCHECK(dp[1]);
- len = EXTRACT_BE_32BITS(dp + 1);
+ len = EXTRACT_BE_U_4(dp + 1);
if (len >= length)
return (NULL);
/*
* now we can check the ar_stat field
*/
ND_TCHECK(dp[0]);
- astat = (enum sunrpc_accept_stat) EXTRACT_BE_32BITS(dp);
+ astat = (enum sunrpc_accept_stat) EXTRACT_BE_U_4(dp);
if (astat != SUNRPC_SUCCESS) {
ND_PRINT((ndo, " %s", tok2str(sunrpc_str, "ar_stat %d", astat)));
nfserr = 1; /* suppress trunc string */
ND_TCHECK(dp[0]);
- errnum = EXTRACT_BE_32BITS(dp);
+ errnum = EXTRACT_BE_U_4(dp);
if (er)
*er = errnum;
if (errnum != 0) {
if (verbose) {
ND_PRINT((ndo, " %s %o ids %d/%d",
tok2str(type2str, "unk-ft %d ",
- EXTRACT_BE_32BITS(&fap->fa_type)),
- EXTRACT_BE_32BITS(&fap->fa_mode),
- EXTRACT_BE_32BITS(&fap->fa_uid),
- EXTRACT_BE_32BITS(&fap->fa_gid)));
+ EXTRACT_BE_U_4(&fap->fa_type)),
+ EXTRACT_BE_U_4(&fap->fa_mode),
+ EXTRACT_BE_U_4(&fap->fa_uid),
+ EXTRACT_BE_U_4(&fap->fa_gid)));
if (v3) {
ND_TCHECK(fap->fa3_size);
ND_PRINT((ndo, " sz %" PRIu64,
- EXTRACT_BE_64BITS((const uint32_t *)&fap->fa3_size)));
+ EXTRACT_BE_U_8((const uint32_t *)&fap->fa3_size)));
} else {
ND_TCHECK(fap->fa2_size);
- ND_PRINT((ndo, " sz %d", EXTRACT_BE_32BITS(&fap->fa2_size)));
+ ND_PRINT((ndo, " sz %d", EXTRACT_BE_U_4(&fap->fa2_size)));
}
}
/* print lots more stuff */
if (v3) {
ND_TCHECK(fap->fa3_ctime);
ND_PRINT((ndo, " nlink %d rdev %d/%d",
- EXTRACT_BE_32BITS(&fap->fa_nlink),
- EXTRACT_BE_32BITS(&fap->fa3_rdev.specdata1),
- EXTRACT_BE_32BITS(&fap->fa3_rdev.specdata2)));
+ EXTRACT_BE_U_4(&fap->fa_nlink),
+ EXTRACT_BE_U_4(&fap->fa3_rdev.specdata1),
+ EXTRACT_BE_U_4(&fap->fa3_rdev.specdata2)));
ND_PRINT((ndo, " fsid %" PRIx64,
- EXTRACT_BE_64BITS((const uint32_t *)&fap->fa3_fsid)));
+ EXTRACT_BE_U_8((const uint32_t *)&fap->fa3_fsid)));
ND_PRINT((ndo, " fileid %" PRIx64,
- EXTRACT_BE_64BITS((const uint32_t *)&fap->fa3_fileid)));
+ EXTRACT_BE_U_8((const uint32_t *)&fap->fa3_fileid)));
ND_PRINT((ndo, " a/m/ctime %u.%06u",
- EXTRACT_BE_32BITS(&fap->fa3_atime.nfsv3_sec),
- EXTRACT_BE_32BITS(&fap->fa3_atime.nfsv3_nsec)));
+ EXTRACT_BE_U_4(&fap->fa3_atime.nfsv3_sec),
+ EXTRACT_BE_U_4(&fap->fa3_atime.nfsv3_nsec)));
ND_PRINT((ndo, " %u.%06u",
- EXTRACT_BE_32BITS(&fap->fa3_mtime.nfsv3_sec),
- EXTRACT_BE_32BITS(&fap->fa3_mtime.nfsv3_nsec)));
+ EXTRACT_BE_U_4(&fap->fa3_mtime.nfsv3_sec),
+ EXTRACT_BE_U_4(&fap->fa3_mtime.nfsv3_nsec)));
ND_PRINT((ndo, " %u.%06u",
- EXTRACT_BE_32BITS(&fap->fa3_ctime.nfsv3_sec),
- EXTRACT_BE_32BITS(&fap->fa3_ctime.nfsv3_nsec)));
+ EXTRACT_BE_U_4(&fap->fa3_ctime.nfsv3_sec),
+ EXTRACT_BE_U_4(&fap->fa3_ctime.nfsv3_nsec)));
} else {
ND_TCHECK(fap->fa2_ctime);
ND_PRINT((ndo, " nlink %d rdev 0x%x fsid 0x%x nodeid 0x%x a/m/ctime",
- EXTRACT_BE_32BITS(&fap->fa_nlink),
- EXTRACT_BE_32BITS(&fap->fa2_rdev),
- EXTRACT_BE_32BITS(&fap->fa2_fsid),
- EXTRACT_BE_32BITS(&fap->fa2_fileid)));
+ EXTRACT_BE_U_4(&fap->fa_nlink),
+ EXTRACT_BE_U_4(&fap->fa2_rdev),
+ EXTRACT_BE_U_4(&fap->fa2_fsid),
+ EXTRACT_BE_U_4(&fap->fa2_fileid)));
ND_PRINT((ndo, " %u.%06u",
- EXTRACT_BE_32BITS(&fap->fa2_atime.nfsv2_sec),
- EXTRACT_BE_32BITS(&fap->fa2_atime.nfsv2_usec)));
+ EXTRACT_BE_U_4(&fap->fa2_atime.nfsv2_sec),
+ EXTRACT_BE_U_4(&fap->fa2_atime.nfsv2_usec)));
ND_PRINT((ndo, " %u.%06u",
- EXTRACT_BE_32BITS(&fap->fa2_mtime.nfsv2_sec),
- EXTRACT_BE_32BITS(&fap->fa2_mtime.nfsv2_usec)));
+ EXTRACT_BE_U_4(&fap->fa2_mtime.nfsv2_sec),
+ EXTRACT_BE_U_4(&fap->fa2_mtime.nfsv2_usec)));
ND_PRINT((ndo, " %u.%06u",
- EXTRACT_BE_32BITS(&fap->fa2_ctime.nfsv2_sec),
- EXTRACT_BE_32BITS(&fap->fa2_ctime.nfsv2_usec)));
+ EXTRACT_BE_U_4(&fap->fa2_ctime.nfsv2_sec),
+ EXTRACT_BE_U_4(&fap->fa2_ctime.nfsv2_usec)));
}
}
return ((const uint32_t *)((const unsigned char *)dp +
if (v3) {
ND_PRINT((ndo, " tbytes %" PRIu64 " fbytes %" PRIu64 " abytes %" PRIu64,
- EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_tbytes),
- EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_fbytes),
- EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_abytes)));
+ EXTRACT_BE_U_8((const uint32_t *)&sfsp->sf_tbytes),
+ EXTRACT_BE_U_8((const uint32_t *)&sfsp->sf_fbytes),
+ EXTRACT_BE_U_8((const uint32_t *)&sfsp->sf_abytes)));
if (ndo->ndo_vflag) {
ND_PRINT((ndo, " tfiles %" PRIu64 " ffiles %" PRIu64 " afiles %" PRIu64 " invar %u",
- EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_tfiles),
- EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_ffiles),
- EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_afiles),
- EXTRACT_BE_32BITS(&sfsp->sf_invarsec)));
+ EXTRACT_BE_U_8((const uint32_t *)&sfsp->sf_tfiles),
+ EXTRACT_BE_U_8((const uint32_t *)&sfsp->sf_ffiles),
+ EXTRACT_BE_U_8((const uint32_t *)&sfsp->sf_afiles),
+ EXTRACT_BE_U_4(&sfsp->sf_invarsec)));
}
} else {
ND_PRINT((ndo, " tsize %d bsize %d blocks %d bfree %d bavail %d",
- EXTRACT_BE_32BITS(&sfsp->sf_tsize),
- EXTRACT_BE_32BITS(&sfsp->sf_bsize),
- EXTRACT_BE_32BITS(&sfsp->sf_blocks),
- EXTRACT_BE_32BITS(&sfsp->sf_bfree),
- EXTRACT_BE_32BITS(&sfsp->sf_bavail)));
+ EXTRACT_BE_U_4(&sfsp->sf_tsize),
+ EXTRACT_BE_U_4(&sfsp->sf_bsize),
+ EXTRACT_BE_U_4(&sfsp->sf_blocks),
+ EXTRACT_BE_U_4(&sfsp->sf_bfree),
+ EXTRACT_BE_U_4(&sfsp->sf_bavail)));
}
return (1);
ND_TCHECK(dp[2]);
ND_PRINT((ndo, " offset 0x%x size %d ",
- EXTRACT_BE_32BITS(dp), EXTRACT_BE_32BITS(dp + 1)));
+ EXTRACT_BE_U_4(dp), EXTRACT_BE_U_4(dp + 1)));
if (dp[2] != 0)
ND_PRINT((ndo, " eof"));
const uint32_t *dp)
{
/* Our caller has already checked this */
- ND_PRINT((ndo, " sz %" PRIu64, EXTRACT_BE_64BITS(dp)));
+ ND_PRINT((ndo, " sz %" PRIu64, EXTRACT_BE_U_8(dp)));
ND_PRINT((ndo, " mtime %u.%06u ctime %u.%06u",
- EXTRACT_BE_32BITS(dp + 2), EXTRACT_BE_32BITS(dp + 3),
- EXTRACT_BE_32BITS(dp + 4), EXTRACT_BE_32BITS(dp + 5)));
+ EXTRACT_BE_U_4(dp + 2), EXTRACT_BE_U_4(dp + 3),
+ EXTRACT_BE_U_4(dp + 4), EXTRACT_BE_U_4(dp + 5)));
return (dp + 6);
}
const uint32_t *dp, int verbose)
{
ND_TCHECK(dp[0]);
- if (!EXTRACT_BE_32BITS(dp))
+ if (!EXTRACT_BE_U_4(dp))
return (dp + 1);
dp++;
ND_TCHECK2(*dp, 24);
const uint32_t *dp, int verbose)
{
ND_TCHECK(dp[0]);
- if (!EXTRACT_BE_32BITS(dp))
+ if (!EXTRACT_BE_U_4(dp))
return (dp + 1);
dp++;
if (verbose) {
dp = parse_wcc_data(ndo, dp, verbose);
else {
ND_TCHECK(dp[0]);
- if (!EXTRACT_BE_32BITS(dp))
+ if (!EXTRACT_BE_U_4(dp))
return (dp + 1);
dp++;
if (!(dp = parsefh(ndo, dp, 1)))
sfp = (const struct nfsv3_fsinfo *)dp;
ND_TCHECK(*sfp);
ND_PRINT((ndo, " rtmax %u rtpref %u wtmax %u wtpref %u dtpref %u",
- EXTRACT_BE_32BITS(&sfp->fs_rtmax),
- EXTRACT_BE_32BITS(&sfp->fs_rtpref),
- EXTRACT_BE_32BITS(&sfp->fs_wtmax),
- EXTRACT_BE_32BITS(&sfp->fs_wtpref),
- EXTRACT_BE_32BITS(&sfp->fs_dtpref)));
+ EXTRACT_BE_U_4(&sfp->fs_rtmax),
+ EXTRACT_BE_U_4(&sfp->fs_rtpref),
+ EXTRACT_BE_U_4(&sfp->fs_wtmax),
+ EXTRACT_BE_U_4(&sfp->fs_wtpref),
+ EXTRACT_BE_U_4(&sfp->fs_dtpref)));
if (ndo->ndo_vflag) {
ND_PRINT((ndo, " rtmult %u wtmult %u maxfsz %" PRIu64,
- EXTRACT_BE_32BITS(&sfp->fs_rtmult),
- EXTRACT_BE_32BITS(&sfp->fs_wtmult),
- EXTRACT_BE_64BITS((const uint32_t *)&sfp->fs_maxfilesize)));
+ EXTRACT_BE_U_4(&sfp->fs_rtmult),
+ EXTRACT_BE_U_4(&sfp->fs_wtmult),
+ EXTRACT_BE_U_8((const uint32_t *)&sfp->fs_maxfilesize)));
ND_PRINT((ndo, " delta %u.%06u ",
- EXTRACT_BE_32BITS(&sfp->fs_timedelta.nfsv3_sec),
- EXTRACT_BE_32BITS(&sfp->fs_timedelta.nfsv3_nsec)));
+ EXTRACT_BE_U_4(&sfp->fs_timedelta.nfsv3_sec),
+ EXTRACT_BE_U_4(&sfp->fs_timedelta.nfsv3_nsec)));
}
return (1);
trunc:
ND_TCHECK(*spp);
ND_PRINT((ndo, " linkmax %u namemax %u %s %s %s %s",
- EXTRACT_BE_32BITS(&spp->pc_linkmax),
- EXTRACT_BE_32BITS(&spp->pc_namemax),
- EXTRACT_BE_32BITS(&spp->pc_notrunc) ? "notrunc" : "",
- EXTRACT_BE_32BITS(&spp->pc_chownrestricted) ? "chownres" : "",
- EXTRACT_BE_32BITS(&spp->pc_caseinsensitive) ? "igncase" : "",
- EXTRACT_BE_32BITS(&spp->pc_casepreserving) ? "keepcase" : ""));
+ EXTRACT_BE_U_4(&spp->pc_linkmax),
+ EXTRACT_BE_U_4(&spp->pc_namemax),
+ EXTRACT_BE_U_4(&spp->pc_notrunc) ? "notrunc" : "",
+ EXTRACT_BE_U_4(&spp->pc_chownrestricted) ? "chownres" : "",
+ EXTRACT_BE_U_4(&spp->pc_caseinsensitive) ? "igncase" : "",
+ EXTRACT_BE_U_4(&spp->pc_casepreserving) ? "keepcase" : ""));
return (1);
trunc:
return (0);
break;
if (!er) {
ND_TCHECK(dp[0]);
- ND_PRINT((ndo, " c %04x", EXTRACT_BE_32BITS(dp)));
+ ND_PRINT((ndo, " c %04x", EXTRACT_BE_U_4(dp)));
}
return;
return;
if (ndo->ndo_vflag) {
ND_TCHECK(dp[1]);
- ND_PRINT((ndo, " %u bytes", EXTRACT_BE_32BITS(dp)));
- if (EXTRACT_BE_32BITS(dp + 1))
+ ND_PRINT((ndo, " %u bytes", EXTRACT_BE_U_4(dp)));
+ if (EXTRACT_BE_U_4(dp + 1))
ND_PRINT((ndo, " EOF"));
}
return;
return;
if (ndo->ndo_vflag) {
ND_TCHECK(dp[0]);
- ND_PRINT((ndo, " %u bytes", EXTRACT_BE_32BITS(dp)));
+ ND_PRINT((ndo, " %u bytes", EXTRACT_BE_U_4(dp)));
if (ndo->ndo_vflag > 1) {
ND_TCHECK(dp[1]);
ND_PRINT((ndo, " <%s>",
tok2str(nfsv3_writemodes,
- NULL, EXTRACT_BE_32BITS(dp + 1))));
+ NULL, EXTRACT_BE_U_4(dp + 1))));
}
return;
}
bp += 1;
next_protocol = *bp;
bp += 1;
- service_path_id = EXTRACT_BE_24BITS(bp);
+ service_path_id = EXTRACT_BE_U_3(bp);
bp += 3;
service_index = *bp;
bp += 1;
if (ndo->ndo_vflag > 2) {
if (md_type == 0x01) {
for (n = 0; n < length - 2; n++) {
- ctx = EXTRACT_BE_32BITS(bp);
+ ctx = EXTRACT_BE_U_4(bp);
bp += NSH_HDR_WORD_SIZE;
ND_PRINT((ndo, "\n Context[%02d]: 0x%08x", n, ctx));
}
else if (md_type == 0x02) {
n = 0;
while (n < length - 2) {
- tlv_class = EXTRACT_BE_16BITS(bp);
+ tlv_class = EXTRACT_BE_U_2(bp);
bp += 2;
tlv_type = *bp;
bp += 1;
}
for (vn = 0; vn < tlv_len; vn++) {
- ctx = EXTRACT_BE_32BITS(bp);
+ ctx = EXTRACT_BE_U_4(bp);
bp += NSH_HDR_WORD_SIZE;
ND_PRINT((ndo, "\n Value[%02d]: 0x%08x", vn, ctx));
}
default:
/* In NTPv4 (RFC 5905) refid is an IPv4 address or first 32 bits of
MD5 sum of IPv6 address */
- ND_PRINT((ndo, "0x%08x", EXTRACT_BE_32BITS(&bp->refid)));
+ ND_PRINT((ndo, "0x%08x", EXTRACT_BE_U_4(&bp->refid)));
break;
}
/* FIXME: this code is not aware of any extension fields */
if (length == NTP_TIMEMSG_MINLEN + 4) { /* Optional: key-id (crypto-NAK) */
ND_TCHECK(bp->key_id);
- ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_32BITS(&bp->key_id)));
+ ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_U_4(&bp->key_id)));
} else if (length == NTP_TIMEMSG_MINLEN + 4 + 16) { /* Optional: key-id + 128-bit digest */
ND_TCHECK(bp->key_id);
- ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_32BITS(&bp->key_id)));
+ ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_U_4(&bp->key_id)));
ND_TCHECK2(bp->message_digest, 16);
ND_PRINT((ndo, "\n\tAuthentication: %08x%08x%08x%08x",
- EXTRACT_BE_32BITS(bp->message_digest),
- EXTRACT_BE_32BITS(bp->message_digest + 4),
- EXTRACT_BE_32BITS(bp->message_digest + 8),
- EXTRACT_BE_32BITS(bp->message_digest + 12)));
+ EXTRACT_BE_U_4(bp->message_digest),
+ EXTRACT_BE_U_4(bp->message_digest + 4),
+ EXTRACT_BE_U_4(bp->message_digest + 8),
+ EXTRACT_BE_U_4(bp->message_digest + 12)));
} else if (length == NTP_TIMEMSG_MINLEN + 4 + 20) { /* Optional: key-id + 160-bit digest */
ND_TCHECK(bp->key_id);
- ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_32BITS(&bp->key_id)));
+ ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_U_4(&bp->key_id)));
ND_TCHECK2(bp->message_digest, 20);
ND_PRINT((ndo, "\n\tAuthentication: %08x%08x%08x%08x%08x",
- EXTRACT_BE_32BITS(bp->message_digest),
- EXTRACT_BE_32BITS(bp->message_digest + 4),
- EXTRACT_BE_32BITS(bp->message_digest + 8),
- EXTRACT_BE_32BITS(bp->message_digest + 12),
- EXTRACT_BE_32BITS(bp->message_digest + 16)));
+ EXTRACT_BE_U_4(bp->message_digest),
+ EXTRACT_BE_U_4(bp->message_digest + 4),
+ EXTRACT_BE_U_4(bp->message_digest + 8),
+ EXTRACT_BE_U_4(bp->message_digest + 12),
+ EXTRACT_BE_U_4(bp->message_digest + 16)));
} else if (length > NTP_TIMEMSG_MINLEN) {
ND_PRINT((ndo, "\n\t(%u more bytes after the header)", length - NTP_TIMEMSG_MINLEN));
}
M ? "More" : "Last", (unsigned)opcode));
ND_TCHECK(cd->sequence);
- sequence = EXTRACT_BE_16BITS(&cd->sequence);
+ sequence = EXTRACT_BE_U_2(&cd->sequence);
ND_PRINT((ndo, "\tSequence=%hu", sequence));
ND_TCHECK(cd->status);
- status = EXTRACT_BE_16BITS(&cd->status);
+ status = EXTRACT_BE_U_2(&cd->status);
ND_PRINT((ndo, ", Status=%#hx", status));
ND_TCHECK(cd->assoc);
- assoc = EXTRACT_BE_16BITS(&cd->assoc);
+ assoc = EXTRACT_BE_U_2(&cd->assoc);
ND_PRINT((ndo, ", Assoc.=%hu", assoc));
ND_TCHECK(cd->offset);
- offset = EXTRACT_BE_16BITS(&cd->offset);
+ offset = EXTRACT_BE_U_2(&cd->offset);
ND_PRINT((ndo, ", Offset=%hu", offset));
ND_TCHECK(cd->count);
- count = EXTRACT_BE_16BITS(&cd->count);
+ count = EXTRACT_BE_U_2(&cd->count);
ND_PRINT((ndo, ", Count=%hu", count));
if (NTP_CTRLMSG_MINLEN + count > length)
register int f;
register double ff;
- i = EXTRACT_BE_16BITS(&sfp->int_part);
- f = EXTRACT_BE_16BITS(&sfp->fraction);
+ i = EXTRACT_BE_U_2(&sfp->int_part);
+ f = EXTRACT_BE_U_2(&sfp->fraction);
ff = f / 65536.0; /* shift radix point by 16 bits */
f = (int)(ff * 1000000.0); /* Treat fraction as parts per million */
ND_PRINT((ndo, "%d.%06d", i, f));
register uint32_t f;
register double ff;
- i = EXTRACT_BE_32BITS(&lfp->int_part);
- uf = EXTRACT_BE_32BITS(&lfp->fraction);
+ i = EXTRACT_BE_U_4(&lfp->int_part);
+ uf = EXTRACT_BE_U_4(&lfp->fraction);
ff = uf;
if (ff < 0.0) /* some compilers are buggy */
ff += FMAXINT;
register double ff;
int signbit;
- u = EXTRACT_BE_32BITS(&lfp->int_part);
- ou = EXTRACT_BE_32BITS(&olfp->int_part);
- uf = EXTRACT_BE_32BITS(&lfp->fraction);
- ouf = EXTRACT_BE_32BITS(&olfp->fraction);
+ u = EXTRACT_BE_U_4(&lfp->int_part);
+ ou = EXTRACT_BE_U_4(&olfp->int_part);
+ uf = EXTRACT_BE_U_4(&lfp->fraction);
+ ouf = EXTRACT_BE_U_4(&olfp->fraction);
if (ou == 0 && ouf == 0) {
p_ntp_time(ndo, lfp);
return;
ND_TCHECK2(*tptr, sizeof(struct olsr_common));
ptr.common = (const struct olsr_common *)tptr;
- length = min(length, EXTRACT_BE_16BITS(ptr.common->packet_len));
+ length = min(length, EXTRACT_BE_U_2(ptr.common->packet_len));
ND_PRINT((ndo, "OLSRv%i, seq 0x%04x, length %u",
(is_ipv6 == 0) ? 4 : 6,
- EXTRACT_BE_16BITS(ptr.common->packet_seq),
+ EXTRACT_BE_U_2(ptr.common->packet_seq),
length));
tptr += sizeof(struct olsr_common);
ND_TCHECK2(*tptr, sizeof(struct olsr_msg6));
msgptr.v6 = (const struct olsr_msg6 *) tptr;
msg_type = msgptr.v6->msg_type;
- msg_len = EXTRACT_BE_16BITS(msgptr.v6->msg_len);
+ msg_len = EXTRACT_BE_U_2(msgptr.v6->msg_len);
if ((msg_len >= sizeof (struct olsr_msg6))
&& (msg_len <= length))
msg_len_valid = 1;
msgptr.v6->ttl,
msgptr.v6->hopcount,
ME_TO_DOUBLE(msgptr.v6->vtime),
- EXTRACT_BE_16BITS(msgptr.v6->msg_seq),
+ EXTRACT_BE_U_2(msgptr.v6->msg_seq),
msg_len, (msg_len_valid == 0) ? " (invalid)" : ""));
if (!msg_len_valid) {
return;
ND_TCHECK2(*tptr, sizeof(struct olsr_msg4));
msgptr.v4 = (const struct olsr_msg4 *) tptr;
msg_type = msgptr.v4->msg_type;
- msg_len = EXTRACT_BE_16BITS(msgptr.v4->msg_len);
+ msg_len = EXTRACT_BE_U_2(msgptr.v4->msg_len);
if ((msg_len >= sizeof (struct olsr_msg4))
&& (msg_len <= length))
msg_len_valid = 1;
msgptr.v4->ttl,
msgptr.v4->hopcount,
ME_TO_DOUBLE(msgptr.v4->vtime),
- EXTRACT_BE_16BITS(msgptr.v4->msg_seq),
+ EXTRACT_BE_U_2(msgptr.v4->msg_seq),
msg_len, (msg_len_valid == 0) ? " (invalid)" : ""));
if (!msg_len_valid) {
return;
ptr.hello_link = (const struct olsr_hello_link *)msg_data;
- hello_len = EXTRACT_BE_16BITS(ptr.hello_link->len);
+ hello_len = EXTRACT_BE_U_2(ptr.hello_link->len);
link_type = OLSR_EXTRACT_LINK_TYPE(ptr.hello_link->link_code);
neighbor_type = OLSR_EXTRACT_NEIGHBOR_TYPE(ptr.hello_link->link_code);
ptr.tc = (const struct olsr_tc *)msg_data;
ND_PRINT((ndo, "\n\t advertised neighbor seq 0x%04x",
- EXTRACT_BE_16BITS(ptr.tc->ans_seq)));
+ EXTRACT_BE_U_2(ptr.tc->ans_seq)));
msg_data += sizeof(struct olsr_tc);
msg_tlen -= sizeof(struct olsr_tc);
ND_PRINT((ndo, "%s%s/%u",
col == 0 ? "\n\t " : ", ",
ipaddr_string(ndo, ptr.hna->network),
- mask2plen(EXTRACT_BE_32BITS(ptr.hna->mask))));
+ mask2plen(EXTRACT_BE_U_4(ptr.hna->mask))));
}
msg_data += sizeof(struct olsr_hna4);
goto trunc;
ND_TCHECK2(*msg_data, 4);
- name_entries = EXTRACT_BE_16BITS(msg_data + 2);
+ name_entries = EXTRACT_BE_U_2(msg_data + 2);
addr_size = 4;
if (is_ipv6)
addr_size = 16;
name_entries_valid = 1;
ND_PRINT((ndo, "\n\t Version %u, Entries %u%s",
- EXTRACT_BE_16BITS(msg_data),
+ EXTRACT_BE_U_2(msg_data),
name_entries, (name_entries_valid == 0) ? " (invalid)" : ""));
if (name_entries_valid == 0)
break;
ND_TCHECK2(*msg_data, 4);
- name_entry_type = EXTRACT_BE_16BITS(msg_data);
- name_entry_len = EXTRACT_BE_16BITS(msg_data + 2);
+ name_entry_type = EXTRACT_BE_U_2(msg_data);
+ name_entry_len = EXTRACT_BE_U_2(msg_data + 2);
msg_data += 4;
msg_tlen -= 4;
goto invalid;
/* subtype */
ND_TCHECK2(*cp, 4);
- subtype = EXTRACT_BE_32BITS(cp);
+ subtype = EXTRACT_BE_U_4(cp);
cp += 4;
ND_PRINT((ndo, "\n\t subtype %s", tok2str(bsn_subtype_str, "unknown (0x%08x)", subtype)));
switch (subtype) {
goto invalid;
/* report_mirror_ports */
ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, ", report_mirror_ports %s", tok2str(bsn_onoff_str, "bogus (%u)", EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, ", report_mirror_ports %s", tok2str(bsn_onoff_str, "bogus (%u)", EXTRACT_U_1(cp))));
cp += 1;
/* pad */
ND_TCHECK2(*cp, 3);
goto invalid;
/* vport_no */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", vport_no %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ", vport_no %u", EXTRACT_BE_U_4(cp)));
cp += 4;
break;
case BSN_SHELL_COMMAND:
goto invalid;
/* service */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", service %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ", service %u", EXTRACT_BE_U_4(cp)));
cp += 4;
/* data */
ND_PRINT((ndo, ", data '"));
goto invalid;
/* status */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", status 0x%08x", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ", status 0x%08x", EXTRACT_BE_U_4(cp)));
cp += 4;
break;
default:
goto invalid;
/* subtype */
ND_TCHECK2(*cp, 4);
- subtype = EXTRACT_BE_32BITS(cp);
+ subtype = EXTRACT_BE_U_4(cp);
cp += 4;
ND_PRINT((ndo, "\n\t subtype %s", tok2str(bsn_action_subtype_str, "unknown (0x%08x)", subtype)));
switch (subtype) {
goto invalid;
/* dest_port */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", dest_port %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ", dest_port %u", EXTRACT_BE_U_4(cp)));
cp += 4;
/* vlan_tag */
ND_TCHECK2(*cp, 4);
- vlan_tag = EXTRACT_BE_32BITS(cp);
+ vlan_tag = EXTRACT_BE_U_4(cp);
cp += 4;
switch (vlan_tag >> 16) {
case 0:
}
/* copy_stage */
ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, ", copy_stage %s", tok2str(bsn_mirror_copy_stage_str, "unknown (%u)", EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, ", copy_stage %s", tok2str(bsn_mirror_copy_stage_str, "unknown (%u)", EXTRACT_U_1(cp))));
cp += 1;
/* pad */
ND_TCHECK2(*cp, 3);
goto invalid;
/* vendor */
ND_TCHECK2(*cp, 4);
- vendor = EXTRACT_BE_32BITS(cp);
+ vendor = EXTRACT_BE_U_4(cp);
cp += 4;
ND_PRINT((ndo, ", vendor 0x%08x (%s)", vendor, of_vendor_name(vendor)));
/* data */
goto invalid;
/* vendor */
ND_TCHECK2(*cp, 4);
- vendor = EXTRACT_BE_32BITS(cp);
+ vendor = EXTRACT_BE_U_4(cp);
cp += 4;
ND_PRINT((ndo, ", vendor 0x%08x (%s)", vendor, of_vendor_name(vendor)));
/* data */
goto invalid;
/* vendor */
ND_TCHECK2(*cp, 4);
- vendor = EXTRACT_BE_32BITS(cp);
+ vendor = EXTRACT_BE_U_4(cp);
cp += 4;
ND_PRINT((ndo, ", vendor 0x%08x (%s)", vendor, of_vendor_name(vendor)));
/* data */
goto invalid;
/* port_no */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
cp += 2;
/* hw_addr */
ND_TCHECK2(*cp, ETHER_ADDR_LEN);
}
/* config */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t config 0x%08x", EXTRACT_BE_32BITS(cp)));
- of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_32BITS(cp),
+ ND_PRINT((ndo, "\n\t config 0x%08x", EXTRACT_BE_U_4(cp)));
+ of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_U_4(cp),
OFPPC_U);
cp += 4;
/* state */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t state 0x%08x", EXTRACT_BE_32BITS(cp)));
- of10_bitmap_print(ndo, ofpps_bm, EXTRACT_BE_32BITS(cp),
+ ND_PRINT((ndo, "\n\t state 0x%08x", EXTRACT_BE_U_4(cp)));
+ of10_bitmap_print(ndo, ofpps_bm, EXTRACT_BE_U_4(cp),
OFPPS_U);
cp += 4;
/* curr */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t curr 0x%08x", EXTRACT_BE_32BITS(cp)));
- of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp),
+ ND_PRINT((ndo, "\n\t curr 0x%08x", EXTRACT_BE_U_4(cp)));
+ of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_U_4(cp),
OFPPF_U);
cp += 4;
/* advertised */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t advertised 0x%08x", EXTRACT_BE_32BITS(cp)));
- of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp),
+ ND_PRINT((ndo, "\n\t advertised 0x%08x", EXTRACT_BE_U_4(cp)));
+ of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_U_4(cp),
OFPPF_U);
cp += 4;
/* supported */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t supported 0x%08x", EXTRACT_BE_32BITS(cp)));
- of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp),
+ ND_PRINT((ndo, "\n\t supported 0x%08x", EXTRACT_BE_U_4(cp)));
+ of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_U_4(cp),
OFPPF_U);
cp += 4;
/* peer */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t peer 0x%08x", EXTRACT_BE_32BITS(cp)));
- of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp),
+ ND_PRINT((ndo, "\n\t peer 0x%08x", EXTRACT_BE_U_4(cp)));
+ of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_U_4(cp),
OFPPF_U);
cp += 4;
next_port:
goto invalid;
/* property */
ND_TCHECK2(*cp, 2);
- property = EXTRACT_BE_16BITS(cp);
+ property = EXTRACT_BE_U_2(cp);
cp += 2;
ND_PRINT((ndo, "\n\t property %s", tok2str(ofpqt_str, "invalid (0x%04x)", property)));
/* len */
ND_TCHECK2(*cp, 2);
- plen = EXTRACT_BE_16BITS(cp);
+ plen = EXTRACT_BE_U_2(cp);
cp += 2;
ND_PRINT((ndo, ", len %u", plen));
if (plen < OF_QUEUE_PROP_HEADER_LEN || plen > len)
if (property == OFPQT_MIN_RATE) { /* the only case of property decoding */
/* rate */
ND_TCHECK2(*cp, 2);
- rate = EXTRACT_BE_16BITS(cp);
+ rate = EXTRACT_BE_U_2(cp);
cp += 2;
if (rate > 1000)
ND_PRINT((ndo, ", rate disabled"));
goto invalid;
/* queue_id */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t queue_id %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, "\n\t queue_id %u", EXTRACT_BE_U_4(cp)));
cp += 4;
/* len */
ND_TCHECK2(*cp, 2);
- desclen = EXTRACT_BE_16BITS(cp);
+ desclen = EXTRACT_BE_U_2(cp);
cp += 2;
ND_PRINT((ndo, ", len %u", desclen));
if (desclen < OF_PACKET_QUEUE_LEN || desclen > len)
/* wildcards */
ND_TCHECK2(*cp, 4);
- wildcards = EXTRACT_BE_32BITS(cp);
+ wildcards = EXTRACT_BE_U_4(cp);
if (wildcards & OFPFW_U)
ND_PRINT((ndo, "%swildcards 0x%08x (bogus)", pfx, wildcards));
cp += 4;
/* in_port */
ND_TCHECK2(*cp, 2);
if (! (wildcards & OFPFW_IN_PORT))
- ND_PRINT((ndo, "%smatch in_port %s", pfx, tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, "%smatch in_port %s", pfx, tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
cp += 2;
/* dl_src */
ND_TCHECK2(*cp, ETHER_ADDR_LEN);
/* dl_vlan */
ND_TCHECK2(*cp, 2);
if (! (wildcards & OFPFW_DL_VLAN))
- ND_PRINT((ndo, "%smatch dl_vlan %s", pfx, vlan_str(EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, "%smatch dl_vlan %s", pfx, vlan_str(EXTRACT_BE_U_2(cp))));
cp += 2;
/* dl_vlan_pcp */
ND_TCHECK2(*cp, 1);
if (! (wildcards & OFPFW_DL_VLAN_PCP))
- ND_PRINT((ndo, "%smatch dl_vlan_pcp %s", pfx, pcp_str(EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, "%smatch dl_vlan_pcp %s", pfx, pcp_str(EXTRACT_U_1(cp))));
cp += 1;
/* pad1 */
ND_TCHECK2(*cp, 1);
cp += 1;
/* dl_type */
ND_TCHECK2(*cp, 2);
- dl_type = EXTRACT_BE_16BITS(cp);
+ dl_type = EXTRACT_BE_U_2(cp);
cp += 2;
if (! (wildcards & OFPFW_DL_TYPE))
ND_PRINT((ndo, "%smatch dl_type 0x%04x", pfx, dl_type));
field_name = ! (wildcards & OFPFW_DL_TYPE) && dl_type == ETHERTYPE_IP
&& ! (wildcards & OFPFW_NW_PROTO) && nw_proto == IPPROTO_ICMP
? "icmp_type" : "tp_src";
- ND_PRINT((ndo, "%smatch %s %u", pfx, field_name, EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, "%smatch %s %u", pfx, field_name, EXTRACT_BE_U_2(cp)));
}
cp += 2;
/* tp_dst */
field_name = ! (wildcards & OFPFW_DL_TYPE) && dl_type == ETHERTYPE_IP
&& ! (wildcards & OFPFW_NW_PROTO) && nw_proto == IPPROTO_ICMP
? "icmp_code" : "tp_dst";
- ND_PRINT((ndo, "%smatch %s %u", pfx, field_name, EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, "%smatch %s %u", pfx, field_name, EXTRACT_BE_U_2(cp)));
}
return cp + 2;
goto invalid;
/* type */
ND_TCHECK2(*cp, 2);
- type = EXTRACT_BE_16BITS(cp);
+ type = EXTRACT_BE_U_2(cp);
cp += 2;
ND_PRINT((ndo, "%saction type %s", pfx, tok2str(ofpat_str, "invalid (0x%04x)", type)));
/* length */
ND_TCHECK2(*cp, 2);
- alen = EXTRACT_BE_16BITS(cp);
+ alen = EXTRACT_BE_U_2(cp);
cp += 2;
ND_PRINT((ndo, ", len %u", alen));
/* On action size underrun/overrun skip the rest of the action list. */
case OFPAT_OUTPUT:
/* port */
ND_TCHECK2(*cp, 2);
- output_port = EXTRACT_BE_16BITS(cp);
+ output_port = EXTRACT_BE_U_2(cp);
cp += 2;
ND_PRINT((ndo, ", port %s", tok2str(ofpp_str, "%u", output_port)));
/* max_len */
ND_TCHECK2(*cp, 2);
if (output_port == OFPP_CONTROLLER)
- ND_PRINT((ndo, ", max_len %u", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, ", max_len %u", EXTRACT_BE_U_2(cp)));
cp += 2;
break;
case OFPAT_SET_VLAN_VID:
/* vlan_vid */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", vlan_vid %s", vlan_str(EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, ", vlan_vid %s", vlan_str(EXTRACT_BE_U_2(cp))));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 2);
case OFPAT_SET_VLAN_PCP:
/* vlan_pcp */
ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, ", vlan_pcp %s", pcp_str(EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, ", vlan_pcp %s", pcp_str(EXTRACT_U_1(cp))));
cp += 1;
/* pad */
ND_TCHECK2(*cp, 3);
case OFPAT_SET_TP_DST:
/* nw_tos */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", tp_port %u", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, ", tp_port %u", EXTRACT_BE_U_2(cp)));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 2);
case OFPAT_ENQUEUE:
/* port */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, ", port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 6);
cp += 6;
/* queue_id */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_BE_32BITS(cp))));
+ ND_PRINT((ndo, ", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_BE_U_4(cp))));
cp += 4;
break;
case OFPAT_VENDOR:
{
/* datapath_id */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, "\n\t dpid 0x%016" PRIx64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, "\n\t dpid 0x%016" PRIx64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* n_buffers */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", n_buffers %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ", n_buffers %u", EXTRACT_BE_U_4(cp)));
cp += 4;
/* n_tables */
ND_TCHECK2(*cp, 1);
cp += 3;
/* capabilities */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t capabilities 0x%08x", EXTRACT_BE_32BITS(cp)));
- of10_bitmap_print(ndo, ofp_capabilities_bm, EXTRACT_BE_32BITS(cp),
+ ND_PRINT((ndo, "\n\t capabilities 0x%08x", EXTRACT_BE_U_4(cp)));
+ of10_bitmap_print(ndo, ofp_capabilities_bm, EXTRACT_BE_U_4(cp),
OFPCAP_U);
cp += 4;
/* actions */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t actions 0x%08x", EXTRACT_BE_32BITS(cp)));
- of10_bitmap_print(ndo, ofpat_bm, EXTRACT_BE_32BITS(cp), OFPAT_U);
+ ND_PRINT((ndo, "\n\t actions 0x%08x", EXTRACT_BE_U_4(cp)));
+ of10_bitmap_print(ndo, ofpat_bm, EXTRACT_BE_U_4(cp), OFPAT_U);
cp += 4;
/* ports */
return of10_phy_ports_print(ndo, cp, ep, len - OF_SWITCH_FEATURES_LEN);
return ep; /* end of snapshot */
/* cookie */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, "\n\t cookie 0x%016" PRIx64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, "\n\t cookie 0x%016" PRIx64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* command */
ND_TCHECK2(*cp, 2);
- command = EXTRACT_BE_16BITS(cp);
+ command = EXTRACT_BE_U_2(cp);
ND_PRINT((ndo, ", command %s", tok2str(ofpfc_str, "invalid (0x%04x)", command)));
cp += 2;
/* idle_timeout */
ND_TCHECK2(*cp, 2);
- if (EXTRACT_BE_16BITS(cp))
- ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_16BITS(cp)));
+ if (EXTRACT_BE_U_2(cp))
+ ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_U_2(cp)));
cp += 2;
/* hard_timeout */
ND_TCHECK2(*cp, 2);
- if (EXTRACT_BE_16BITS(cp))
- ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_BE_16BITS(cp)));
+ if (EXTRACT_BE_U_2(cp))
+ ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_BE_U_2(cp)));
cp += 2;
/* priority */
ND_TCHECK2(*cp, 2);
- if (EXTRACT_BE_16BITS(cp))
- ND_PRINT((ndo, ", priority %u", EXTRACT_BE_16BITS(cp)));
+ if (EXTRACT_BE_U_2(cp))
+ ND_PRINT((ndo, ", priority %u", EXTRACT_BE_U_2(cp)));
cp += 2;
/* buffer_id */
ND_TCHECK2(*cp, 4);
if (command == OFPFC_ADD || command == OFPFC_MODIFY ||
command == OFPFC_MODIFY_STRICT)
- ND_PRINT((ndo, ", buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_BE_32BITS(cp))));
+ ND_PRINT((ndo, ", buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_BE_U_4(cp))));
cp += 4;
/* out_port */
ND_TCHECK2(*cp, 2);
if (command == OFPFC_DELETE || command == OFPFC_DELETE_STRICT)
- ND_PRINT((ndo, ", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, ", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
cp += 2;
/* flags */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_16BITS(cp)));
- of10_bitmap_print(ndo, ofpff_bm, EXTRACT_BE_16BITS(cp), OFPFF_U);
+ ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_U_2(cp)));
+ of10_bitmap_print(ndo, ofpff_bm, EXTRACT_BE_U_2(cp), OFPFF_U);
cp += 2;
/* actions */
return of10_actions_print(ndo, "\n\t ", cp, ep, len - OF_FLOW_MOD_LEN);
{
/* port_no */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
cp += 2;
/* hw_addr */
ND_TCHECK2(*cp, ETHER_ADDR_LEN);
cp += ETHER_ADDR_LEN;
/* config */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t config 0x%08x", EXTRACT_BE_32BITS(cp)));
- of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_32BITS(cp), OFPPC_U);
+ ND_PRINT((ndo, "\n\t config 0x%08x", EXTRACT_BE_U_4(cp)));
+ of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_U_4(cp), OFPPC_U);
cp += 4;
/* mask */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t mask 0x%08x", EXTRACT_BE_32BITS(cp)));
- of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_32BITS(cp), OFPPC_U);
+ ND_PRINT((ndo, "\n\t mask 0x%08x", EXTRACT_BE_U_4(cp)));
+ of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_U_4(cp), OFPPC_U);
cp += 4;
/* advertise */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t advertise 0x%08x", EXTRACT_BE_32BITS(cp)));
- of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp), OFPPF_U);
+ ND_PRINT((ndo, "\n\t advertise 0x%08x", EXTRACT_BE_U_4(cp)));
+ of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_U_4(cp), OFPPF_U);
cp += 4;
/* pad */
ND_TCHECK2(*cp, 4);
/* type */
ND_TCHECK2(*cp, 2);
- type = EXTRACT_BE_16BITS(cp);
+ type = EXTRACT_BE_U_2(cp);
cp += 2;
ND_PRINT((ndo, "\n\t type %s", tok2str(ofpst_str, "invalid (0x%04x)", type)));
/* flags */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_16BITS(cp)));
- if (EXTRACT_BE_16BITS(cp))
+ ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_U_2(cp)));
+ if (EXTRACT_BE_U_2(cp))
ND_PRINT((ndo, " (bogus)"));
cp += 2;
/* type-specific body of one of fixed lengths */
return ep; /* end of snapshot */
/* table_id */
ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, "\n\t table_id %s", tok2str(tableid_str, "%u", EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, "\n\t table_id %s", tok2str(tableid_str, "%u", EXTRACT_U_1(cp))));
cp += 1;
/* pad */
ND_TCHECK2(*cp, 1);
cp += 1;
/* out_port */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, ", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
return cp + 2;
case OFPST_PORT:
if (len != OF_PORT_STATS_REQUEST_LEN)
goto invalid;
/* port_no */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 6);
goto invalid;
/* port_no */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 2);
cp += 2;
/* queue_id */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_BE_32BITS(cp))));
+ ND_PRINT((ndo, ", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_BE_U_4(cp))));
return cp + 4;
case OFPST_VENDOR:
return of10_vendor_data_print(ndo, cp, ep, len);
goto invalid;
/* length */
ND_TCHECK2(*cp, 2);
- entry_len = EXTRACT_BE_16BITS(cp);
+ entry_len = EXTRACT_BE_U_2(cp);
ND_PRINT((ndo, "\n\t length %u", entry_len));
if (entry_len < OF_FLOW_STATS_LEN || entry_len > len)
goto invalid;
cp += 2;
/* table_id */
ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, ", table_id %s", tok2str(tableid_str, "%u", EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, ", table_id %s", tok2str(tableid_str, "%u", EXTRACT_U_1(cp))));
cp += 1;
/* pad */
ND_TCHECK2(*cp, 1);
return ep; /* end of snapshot */
/* duration_sec */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t duration_sec %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, "\n\t duration_sec %u", EXTRACT_BE_U_4(cp)));
cp += 4;
/* duration_nsec */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_BE_U_4(cp)));
cp += 4;
/* priority */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", priority %u", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, ", priority %u", EXTRACT_BE_U_2(cp)));
cp += 2;
/* idle_timeout */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_U_2(cp)));
cp += 2;
/* hard_timeout */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_BE_U_2(cp)));
cp += 2;
/* pad2 */
ND_TCHECK2(*cp, 6);
cp += 6;
/* cookie */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", cookie 0x%016" PRIx64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", cookie 0x%016" PRIx64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* packet_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* byte_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* actions */
if (ep == (cp = of10_actions_print(ndo, "\n\t ", cp, ep, entry_len - OF_FLOW_STATS_LEN)))
goto invalid;
/* packet_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, "\n\t packet_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, "\n\t packet_count %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* byte_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* flow_count */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", flow_count %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ", flow_count %u", EXTRACT_BE_U_4(cp)));
cp += 4;
/* pad */
ND_TCHECK2(*cp, 4);
goto invalid;
/* table_id */
ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, "\n\t table_id %s", tok2str(tableid_str, "%u", EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, "\n\t table_id %s", tok2str(tableid_str, "%u", EXTRACT_U_1(cp))));
cp += 1;
/* pad */
ND_TCHECK2(*cp, 3);
cp += OFP_MAX_TABLE_NAME_LEN;
/* wildcards */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t wildcards 0x%08x", EXTRACT_BE_32BITS(cp)));
- of10_bitmap_print(ndo, ofpfw_bm, EXTRACT_BE_32BITS(cp),
+ ND_PRINT((ndo, "\n\t wildcards 0x%08x", EXTRACT_BE_U_4(cp)));
+ of10_bitmap_print(ndo, ofpfw_bm, EXTRACT_BE_U_4(cp),
OFPFW_U);
cp += 4;
/* max_entries */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t max_entries %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, "\n\t max_entries %u", EXTRACT_BE_U_4(cp)));
cp += 4;
/* active_count */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", active_count %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ", active_count %u", EXTRACT_BE_U_4(cp)));
cp += 4;
/* lookup_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", lookup_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", lookup_count %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* matched_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", matched_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", matched_count %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
len -= OF_TABLE_STATS_LEN;
goto invalid;
/* port_no */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
cp += 2;
if (ndo->ndo_vflag < 2) {
ND_TCHECK2(*cp, OF_PORT_STATS_LEN - 2);
cp += 6;
/* rx_packets */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", rx_packets %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", rx_packets %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* tx_packets */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* rx_bytes */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", rx_bytes %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", rx_bytes %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* tx_bytes */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* rx_dropped */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", rx_dropped %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", rx_dropped %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* tx_dropped */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", tx_dropped %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", tx_dropped %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* rx_errors */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", rx_errors %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", rx_errors %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* tx_errors */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* rx_frame_err */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", rx_frame_err %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", rx_frame_err %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* rx_over_err */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", rx_over_err %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", rx_over_err %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* rx_crc_err */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", rx_crc_err %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", rx_crc_err %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* collisions */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", collisions %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", collisions %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
next_port:
len -= OF_PORT_STATS_LEN;
goto invalid;
/* port_no */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 2);
cp += 2;
/* queue_id */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", queue_id %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ", queue_id %u", EXTRACT_BE_U_4(cp)));
cp += 4;
/* tx_bytes */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* tx_packets */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* tx_errors */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
len -= OF_QUEUE_STATS_LEN;
/* type */
ND_TCHECK2(*cp, 2);
- type = EXTRACT_BE_16BITS(cp);
+ type = EXTRACT_BE_U_2(cp);
ND_PRINT((ndo, "\n\t type %s", tok2str(ofpst_str, "invalid (0x%04x)", type)));
cp += 2;
/* flags */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_16BITS(cp)));
- of10_bitmap_print(ndo, ofpsf_reply_bm, EXTRACT_BE_16BITS(cp),
+ ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_U_2(cp)));
+ of10_bitmap_print(ndo, ofpsf_reply_bm, EXTRACT_BE_U_2(cp),
OFPSF_REPLY_U);
cp += 2;
/* buffer_id */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t buffer_id 0x%08x", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, "\n\t buffer_id 0x%08x", EXTRACT_BE_U_4(cp)));
cp += 4;
/* in_port */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
cp += 2;
/* actions_len */
ND_TCHECK2(*cp, 2);
- actions_len = EXTRACT_BE_16BITS(cp);
+ actions_len = EXTRACT_BE_U_2(cp);
cp += 2;
if (actions_len > len - OF_PACKET_OUT_LEN)
goto invalid;
{
/* buffer_id */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_BE_32BITS(cp))));
+ ND_PRINT((ndo, "\n\t buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_BE_U_4(cp))));
cp += 4;
/* total_len */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", total_len %u", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, ", total_len %u", EXTRACT_BE_U_2(cp)));
cp += 2;
/* in_port */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
cp += 2;
/* reason */
ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, ", reason %s", tok2str(ofpr_str, "invalid (0x%02x)", EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, ", reason %s", tok2str(ofpr_str, "invalid (0x%02x)", EXTRACT_U_1(cp))));
cp += 1;
/* pad */
ND_TCHECK2(*cp, 1);
return ep; /* end of snapshot */
/* cookie */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, "\n\t cookie 0x%016" PRIx64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, "\n\t cookie 0x%016" PRIx64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* priority */
ND_TCHECK2(*cp, 2);
- if (EXTRACT_BE_16BITS(cp))
- ND_PRINT((ndo, ", priority %u", EXTRACT_BE_16BITS(cp)));
+ if (EXTRACT_BE_U_2(cp))
+ ND_PRINT((ndo, ", priority %u", EXTRACT_BE_U_2(cp)));
cp += 2;
/* reason */
ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, ", reason %s", tok2str(ofprr_str, "unknown (0x%02x)", EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, ", reason %s", tok2str(ofprr_str, "unknown (0x%02x)", EXTRACT_U_1(cp))));
cp += 1;
/* pad */
ND_TCHECK2(*cp, 1);
cp += 1;
/* duration_sec */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", duration_sec %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ", duration_sec %u", EXTRACT_BE_U_4(cp)));
cp += 4;
/* duration_nsec */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_BE_U_4(cp)));
cp += 4;
/* idle_timeout */
ND_TCHECK2(*cp, 2);
- if (EXTRACT_BE_16BITS(cp))
- ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_16BITS(cp)));
+ if (EXTRACT_BE_U_2(cp))
+ ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_U_2(cp)));
cp += 2;
/* pad2 */
ND_TCHECK2(*cp, 2);
cp += 2;
/* packet_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_BE_U_8(cp)));
cp += 8;
/* byte_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
+ ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_U_8(cp)));
return cp + 8;
trunc:
/* type */
ND_TCHECK2(*cp, 2);
- type = EXTRACT_BE_16BITS(cp);
+ type = EXTRACT_BE_U_2(cp);
cp += 2;
ND_PRINT((ndo, "\n\t type %s", tok2str(ofpet_str, "invalid (0x%04x)", type)));
/* code */
type == OFPET_PORT_MOD_FAILED ? ofppmfc_str :
type == OFPET_QUEUE_OP_FAILED ? ofpqofc_str :
empty_str;
- ND_PRINT((ndo, ", code %s", tok2str(code_str, "invalid (0x%04x)", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, ", code %s", tok2str(code_str, "invalid (0x%04x)", EXTRACT_BE_U_2(cp))));
cp += 2;
/* data */
return of10_data_print(ndo, cp, ep, len - OF_ERROR_MSG_LEN);
goto next_message;
/* flags */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t flags %s", tok2str(ofp_config_str, "invalid (0x%04x)", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t flags %s", tok2str(ofp_config_str, "invalid (0x%04x)", EXTRACT_BE_U_2(cp))));
cp += 2;
/* miss_send_len */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", miss_send_len %u", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, ", miss_send_len %u", EXTRACT_BE_U_2(cp)));
return cp + 2;
case OFPT_PORT_MOD:
if (len != OF_PORT_MOD_LEN)
goto next_message;
/* port */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 2);
goto next_message;
/* reason */
ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, "\n\t reason %s", tok2str(ofppr_str, "invalid (0x%02x)", EXTRACT_8BITS(cp))));
+ ND_PRINT((ndo, "\n\t reason %s", tok2str(ofppr_str, "invalid (0x%02x)", EXTRACT_U_1(cp))));
cp += 1;
/* pad */
ND_TCHECK2(*cp, 7);
goto next_message;
/* port */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 6);
cp += 1;
/* length */
ND_TCHECK2(*cp, 2);
- length = EXTRACT_BE_16BITS(cp);
+ length = EXTRACT_BE_U_2(cp);
cp += 2;
/* xid */
ND_TCHECK2(*cp, 4);
- xid = EXTRACT_BE_32BITS(cp);
+ xid = EXTRACT_BE_U_4(cp);
cp += 4;
/* Message length includes the header length and a message always includes
* the basic header. A message length underrun fails decoding of the rest of
ND_PRINT((ndo, "\n\t Remaining LS length %u < 4", ls_length));
return -1;
}
- tlv_type = EXTRACT_BE_16BITS(tptr);
- tlv_length = EXTRACT_BE_16BITS(tptr + 2);
+ tlv_type = EXTRACT_BE_U_2(tptr);
+ tlv_length = EXTRACT_BE_U_2(tptr + 2);
tptr+=4;
ls_length-=4;
ND_PRINT((ndo, "\n\t Bogus length %u != 4", tlv_length));
return -1;
}
- ND_PRINT((ndo, "%us", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "%us", EXTRACT_BE_U_4(tptr)));
break;
case LS_OPAQUE_GRACE_TLV_REASON:
return -1;
}
ND_PRINT((ndo, "%s (%u)",
- tok2str(lsa_opaque_grace_tlv_reason_values, "Unknown", EXTRACT_8BITS(tptr)),
+ tok2str(lsa_opaque_grace_tlv_reason_values, "Unknown", EXTRACT_U_1(tptr)),
*tptr));
break;
ND_PRINT((ndo, "\n\t Remaining LS length %u < 4", ls_length));
return -1;
}
- tlv_type = EXTRACT_BE_16BITS(tptr);
- tlv_length = EXTRACT_BE_16BITS(tptr + 2);
+ tlv_type = EXTRACT_BE_U_2(tptr);
+ tlv_length = EXTRACT_BE_U_2(tptr + 2);
tptr+=4;
ls_length-=4;
return -1;
}
ND_TCHECK2(*tptr, 4);
- subtlv_type = EXTRACT_BE_16BITS(tptr);
- subtlv_length = EXTRACT_BE_16BITS(tptr + 2);
+ subtlv_type = EXTRACT_BE_U_2(tptr);
+ subtlv_length = EXTRACT_BE_U_2(tptr + 2);
tptr+=4;
tlv_length-=4;
ND_PRINT((ndo, " != 4"));
goto invalid;
}
- ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_U_4(tptr)));
break;
case LS_OPAQUE_TE_LINK_SUBTLV_LINK_ID:
case LS_OPAQUE_TE_LINK_SUBTLV_LINK_LOCAL_REMOTE_ID:
}
ND_PRINT((ndo, ", %s (0x%08x)",
ipaddr_string(ndo, tptr),
- EXTRACT_BE_32BITS(tptr)));
+ EXTRACT_BE_U_4(tptr)));
if (subtlv_length == 8) /* rfc4203 */
ND_PRINT((ndo, ", %s (0x%08x)",
ipaddr_string(ndo, tptr+4),
- EXTRACT_BE_32BITS(tptr + 4)));
+ EXTRACT_BE_U_4(tptr + 4)));
break;
case LS_OPAQUE_TE_LINK_SUBTLV_LOCAL_IP:
case LS_OPAQUE_TE_LINK_SUBTLV_REMOTE_IP:
ND_PRINT((ndo, " != 4"));
goto invalid;
}
- bw.i = EXTRACT_BE_32BITS(tptr);
+ bw.i = EXTRACT_BE_U_4(tptr);
ND_PRINT((ndo, ", %.3f Mbps", bw.f * 8 / 1000000));
break;
case LS_OPAQUE_TE_LINK_SUBTLV_UNRES_BW:
goto invalid;
}
for (te_class = 0; te_class < 8; te_class++) {
- bw.i = EXTRACT_BE_32BITS(tptr + te_class * 4);
+ bw.i = EXTRACT_BE_U_4(tptr + te_class * 4);
ND_PRINT((ndo, "\n\t\tTE-Class %u: %.3f Mbps",
te_class,
bw.f * 8 / 1000000));
}
/* BC Model Id (1 octet) + Reserved (3 octets) */
ND_PRINT((ndo, "\n\t\tBandwidth Constraints Model ID: %s (%u)",
- tok2str(diffserv_te_bc_values, "unknown", EXTRACT_8BITS(tptr)),
+ tok2str(diffserv_te_bc_values, "unknown", EXTRACT_U_1(tptr)),
*tptr));
if (subtlv_length % 4 != 0) {
ND_PRINT((ndo, "\n\t\tlength %u != N x 4", subtlv_length));
}
/* decode BCs until the subTLV ends */
for (te_class = 0; te_class < (subtlv_length-4)/4; te_class++) {
- bw.i = EXTRACT_BE_32BITS(tptr + 4 + te_class * 4);
+ bw.i = EXTRACT_BE_U_4(tptr + 4 + te_class * 4);
ND_PRINT((ndo, "\n\t\t Bandwidth constraint CT%u: %.3f Mbps",
te_class,
bw.f * 8 / 1000000));
ND_PRINT((ndo, " != 4"));
goto invalid;
}
- ND_PRINT((ndo, ", Metric %u", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, ", Metric %u", EXTRACT_BE_U_4(tptr)));
break;
case LS_OPAQUE_TE_LINK_SUBTLV_LINK_PROTECTION_TYPE:
/* Protection Cap (1 octet) + Reserved ((3 octets) */
goto invalid;
}
ND_PRINT((ndo, ", %s",
- bittok2str(gmpls_link_prot_values, "none", EXTRACT_8BITS(tptr))));
+ bittok2str(gmpls_link_prot_values, "none", EXTRACT_U_1(tptr))));
break;
case LS_OPAQUE_TE_LINK_SUBTLV_INTF_SW_CAP_DESCR:
if (subtlv_length < 36) {
}
/* Switching Cap (1 octet) + Encoding (1) + Reserved (2) */
ND_PRINT((ndo, "\n\t\tInterface Switching Capability: %s",
- tok2str(gmpls_switch_cap_values, "Unknown", EXTRACT_8BITS((tptr)))));
+ tok2str(gmpls_switch_cap_values, "Unknown", EXTRACT_U_1((tptr)))));
ND_PRINT((ndo, "\n\t\tLSP Encoding: %s\n\t\tMax LSP Bandwidth:",
- tok2str(gmpls_encoding_values, "Unknown", EXTRACT_8BITS((tptr + 1)))));
+ tok2str(gmpls_encoding_values, "Unknown", EXTRACT_U_1((tptr + 1)))));
for (priority_level = 0; priority_level < 8; priority_level++) {
- bw.i = EXTRACT_BE_32BITS(tptr + 4 + (priority_level * 4));
+ bw.i = EXTRACT_BE_U_4(tptr + 4 + (priority_level * 4));
ND_PRINT((ndo, "\n\t\t priority level %d: %.3f Mbps",
priority_level,
bw.f * 8 / 1000000));
goto invalid;
}
ND_PRINT((ndo, ", %s (%u)",
- tok2str(lsa_opaque_te_tlv_link_type_sub_tlv_values,"unknown",EXTRACT_8BITS(tptr)),
+ tok2str(lsa_opaque_te_tlv_link_type_sub_tlv_values,"unknown",EXTRACT_U_1(tptr)),
*tptr));
break;
if (count_srlg != 0)
ND_PRINT((ndo, "\n\t\t Shared risk group: "));
while (count_srlg > 0) {
- bw.i = EXTRACT_BE_32BITS(tptr);
+ bw.i = EXTRACT_BE_U_4(tptr);
ND_PRINT((ndo, "%d", bw.i));
tptr+=4;
count_srlg--;
u_int ls_length;
ND_TCHECK(lshp->ls_length);
- ls_length = EXTRACT_BE_16BITS(&lshp->ls_length);
+ ls_length = EXTRACT_BE_U_2(&lshp->ls_length);
if (ls_length < sizeof(struct lsa_hdr)) {
ND_PRINT((ndo, "\n\t Bogus length %u < header (%lu)", ls_length,
(unsigned long)sizeof(struct lsa_hdr)));
ND_TCHECK(lshp->ls_seq); /* XXX - ls_length check checked this */
ND_PRINT((ndo, "\n\t Advertising Router %s, seq 0x%08x, age %us, length %u",
ipaddr_string(ndo, &lshp->ls_router),
- EXTRACT_BE_32BITS(&lshp->ls_seq),
- EXTRACT_BE_16BITS(&lshp->ls_age),
+ EXTRACT_BE_U_4(&lshp->ls_seq),
+ EXTRACT_BE_U_2(&lshp->ls_age),
ls_length - (u_int)sizeof(struct lsa_hdr)));
ND_TCHECK(lshp->ls_type); /* XXX - ls_length check checked this */
"unknown",
*(&lshp->un_lsa_id.opaque_field.opaque_type)),
*(&lshp->un_lsa_id.opaque_field.opaque_type),
- EXTRACT_BE_24BITS(&lshp->un_lsa_id.opaque_field.opaque_id)
+ EXTRACT_BE_U_3(&lshp->un_lsa_id.opaque_field.opaque_id)
));
break;
tok2str(ospf_topology_values, "Unknown",
metric_count ? tos->metrics.tos_type : 0),
metric_count ? tos->metrics.tos_type : 0,
- EXTRACT_BE_16BITS(&tos->metrics.tos_metric)));
+ EXTRACT_BE_U_2(&tos->metrics.tos_metric)));
metric_count++;
tos++;
toscount--;
bittok2str(ospf_rla_flag_values, "none", lsap->lsa_un.un_rla.rla_flags)));
ND_TCHECK(lsap->lsa_un.un_rla.rla_count);
- j = EXTRACT_BE_16BITS(&lsap->lsa_un.un_rla.rla_count);
+ j = EXTRACT_BE_U_2(&lsap->lsa_un.un_rla.rla_count);
ND_TCHECK(lsap->lsa_un.un_rla.rla_link);
rlp = lsap->lsa_un.un_rla.rla_link;
while (j--) {
register uint32_t ul;
ND_TCHECK(*lp);
- ul = EXTRACT_BE_32BITS(lp);
+ ul = EXTRACT_BE_U_4(lp);
topology = (ul & SLA_MASK_TOS) >> SLA_SHIFT_TOS;
ND_PRINT((ndo, "\n\t\ttopology %s (%u) metric %d",
tok2str(ospf_topology_values, "Unknown", topology),
register uint32_t ul;
ND_TCHECK(*lp);
- ul = EXTRACT_BE_32BITS(lp);
+ ul = EXTRACT_BE_U_4(lp);
topology = (ul & SLA_MASK_TOS) >> SLA_SHIFT_TOS;
ND_PRINT((ndo, "\n\t\ttopology %s (%u) metric %d",
tok2str(ospf_topology_values, "Unknown", topology),
register uint32_t ul;
ND_TCHECK(almp->asla_tosmetric);
- ul = EXTRACT_BE_32BITS(&almp->asla_tosmetric);
+ ul = EXTRACT_BE_U_4(&almp->asla_tosmetric);
topology = ((ul & ASLA_MASK_TOS) >> ASLA_SHIFT_TOS);
ND_PRINT((ndo, "\n\t\ttopology %s (%u), type %d, metric",
tok2str(ospf_topology_values, "Unknown", topology),
mcp = lsap->lsa_un.un_mcla;
while ((const u_char *)mcp < ls_end) {
ND_TCHECK(mcp->mcla_vid);
- switch (EXTRACT_BE_32BITS(&mcp->mcla_vtype)) {
+ switch (EXTRACT_BE_U_4(&mcp->mcla_vtype)) {
case MCLA_VERTEX_ROUTER:
ND_PRINT((ndo, "\n\t Router Router-ID %s",
default:
ND_PRINT((ndo, "\n\t unknown VertexType (%u)",
- EXTRACT_BE_32BITS(&mcp->mcla_vtype)));
+ EXTRACT_BE_U_4(&mcp->mcla_vtype)));
break;
}
++mcp;
ND_PRINT((ndo, "\n\t Remaining LS length %u < 4", ls_length));
return(ls_end);
}
- tlv_type = EXTRACT_BE_16BITS(tptr);
- tlv_length = EXTRACT_BE_16BITS(tptr + 2);
+ tlv_type = EXTRACT_BE_U_2(tptr);
+ tlv_length = EXTRACT_BE_U_2(tptr + 2);
tptr+=4;
ls_length-=4;
return(ls_end);
}
ND_PRINT((ndo, "Capabilities: %s",
- bittok2str(lsa_opaque_ri_tlv_cap_values, "Unknown", EXTRACT_BE_32BITS(tptr))));
+ bittok2str(lsa_opaque_ri_tlv_cap_values, "Unknown", EXTRACT_BE_U_4(tptr))));
break;
default:
if (ndo->ndo_vflag <= 1) {
}
/* dig deeper if LLS data is available; see RFC4813 */
- length2 = EXTRACT_BE_16BITS(&op->ospf_len);
+ length2 = EXTRACT_BE_U_2(&op->ospf_len);
dptr = (const u_char *)op + length2;
dataend = (const u_char *)op + length;
- if (EXTRACT_BE_16BITS(&op->ospf_authtype) == OSPF_AUTH_MD5) {
+ if (EXTRACT_BE_U_2(&op->ospf_authtype) == OSPF_AUTH_MD5) {
dptr = dptr + op->ospf_authdata[3];
length2 += op->ospf_authdata[3];
}
return (1);
}
ND_TCHECK2(*dptr, 2);
- ND_PRINT((ndo, "\n\t LLS: checksum: 0x%04x", (u_int) EXTRACT_BE_16BITS(dptr)));
+ ND_PRINT((ndo, "\n\t LLS: checksum: 0x%04x", (u_int) EXTRACT_BE_U_2(dptr)));
dptr += 2;
ND_TCHECK2(*dptr, 2);
- length2 = EXTRACT_BE_16BITS(dptr);
+ length2 = EXTRACT_BE_U_2(dptr);
ND_PRINT((ndo, ", length: %u", length2));
dptr += 2;
ND_TCHECK(*dptr);
while (dptr < dataend) {
ND_TCHECK2(*dptr, 2);
- lls_type = EXTRACT_BE_16BITS(dptr);
+ lls_type = EXTRACT_BE_U_2(dptr);
ND_PRINT((ndo, "\n\t %s (%u)",
tok2str(ospf_lls_tlv_values,"Unknown TLV",lls_type),
lls_type));
dptr += 2;
ND_TCHECK2(*dptr, 2);
- lls_len = EXTRACT_BE_16BITS(dptr);
+ lls_len = EXTRACT_BE_U_2(dptr);
ND_PRINT((ndo, ", length: %u", lls_len));
dptr += 2;
switch (lls_type) {
lls_len = 4;
}
ND_TCHECK2(*dptr, 4);
- lls_flags = EXTRACT_BE_32BITS(dptr);
+ lls_flags = EXTRACT_BE_U_4(dptr);
ND_PRINT((ndo, "\n\t Options: 0x%08x [%s]", lls_flags,
bittok2str(ospf_lls_eo_options, "?", lls_flags)));
lls_len = 20;
}
ND_TCHECK2(*dptr, 4);
- ND_PRINT((ndo, "\n\t Sequence number: 0x%08x", EXTRACT_BE_32BITS(dptr)));
+ ND_PRINT((ndo, "\n\t Sequence number: 0x%08x", EXTRACT_BE_U_4(dptr)));
break;
}
ND_TCHECK(op->ospf_hello.hello_deadint);
ND_PRINT((ndo, "\n\t Hello Timer %us, Dead Timer %us, Mask %s, Priority %u",
- EXTRACT_BE_16BITS(&op->ospf_hello.hello_helloint),
- EXTRACT_BE_32BITS(&op->ospf_hello.hello_deadint),
+ EXTRACT_BE_U_2(&op->ospf_hello.hello_helloint),
+ EXTRACT_BE_U_4(&op->ospf_hello.hello_deadint),
ipaddr_string(ndo, &op->ospf_hello.hello_mask),
op->ospf_hello.hello_priority));
bittok2str(ospf_dd_flag_values, "none", op->ospf_db.db_flags)));
ND_TCHECK(op->ospf_db.db_ifmtu);
if (op->ospf_db.db_ifmtu) {
- ND_PRINT((ndo, ", MTU: %u", EXTRACT_BE_16BITS(&op->ospf_db.db_ifmtu)));
+ ND_PRINT((ndo, ", MTU: %u", EXTRACT_BE_U_2(&op->ospf_db.db_ifmtu)));
}
ND_TCHECK(op->ospf_db.db_seq);
- ND_PRINT((ndo, ", Sequence: 0x%08x", EXTRACT_BE_32BITS(&op->ospf_db.db_seq)));
+ ND_PRINT((ndo, ", Sequence: 0x%08x", EXTRACT_BE_U_4(&op->ospf_db.db_seq)));
/* Print all the LS adv's */
lshp = op->ospf_db.db_lshdr;
ND_PRINT((ndo, "\n\t Advertising Router: %s, %s LSA (%u)",
ipaddr_string(ndo, &lsrp->ls_router),
- tok2str(lsa_values,"unknown",EXTRACT_BE_32BITS(lsrp->ls_type)),
- EXTRACT_BE_32BITS(&lsrp->ls_type)));
+ tok2str(lsa_values,"unknown",EXTRACT_BE_U_4(lsrp->ls_type)),
+ EXTRACT_BE_U_4(&lsrp->ls_type)));
- switch (EXTRACT_BE_32BITS(lsrp->ls_type)) {
+ switch (EXTRACT_BE_U_4(lsrp->ls_type)) {
/* the LSA header for opaque LSAs was slightly changed */
case LS_TYPE_OPAQUE_LL:
case LS_TYPE_OPAQUE_AL:
ND_PRINT((ndo, ", Opaque-Type: %s LSA (%u), Opaque-ID: %u",
tok2str(lsa_opaque_values, "unknown",lsrp->un_ls_stateid.opaque_field.opaque_type),
lsrp->un_ls_stateid.opaque_field.opaque_type,
- EXTRACT_BE_24BITS(&lsrp->un_ls_stateid.opaque_field.opaque_id)));
+ EXTRACT_BE_U_3(&lsrp->un_ls_stateid.opaque_field.opaque_id)));
break;
default:
ND_PRINT((ndo, ", LSA-ID: %s",
case OSPF_TYPE_LS_UPDATE:
lsap = op->ospf_lsu.lsu_lsa;
ND_TCHECK(op->ospf_lsu.lsu_count);
- lsa_count_max = EXTRACT_BE_32BITS(&op->ospf_lsu.lsu_count);
+ lsa_count_max = EXTRACT_BE_U_4(&op->ospf_lsu.lsu_count);
ND_PRINT((ndo, ", %d LSA%s", lsa_count_max, PLURAL_SUFFIX(lsa_count_max)));
for (lsa_count=1;lsa_count <= lsa_count_max;lsa_count++) {
ND_PRINT((ndo, "\n\t LSA #%u", lsa_count));
/* XXX Before we do anything else, strip off the MD5 trailer */
ND_TCHECK(op->ospf_authtype);
- if (EXTRACT_BE_16BITS(&op->ospf_authtype) == OSPF_AUTH_MD5) {
+ if (EXTRACT_BE_U_2(&op->ospf_authtype) == OSPF_AUTH_MD5) {
length -= OSPF_AUTH_MD5_LEN;
ndo->ndo_snapend -= OSPF_AUTH_MD5_LEN;
}
}
ND_TCHECK(op->ospf_len);
- if (length != EXTRACT_BE_16BITS(&op->ospf_len)) {
- ND_PRINT((ndo, " [len %d]", EXTRACT_BE_16BITS(&op->ospf_len)));
+ if (length != EXTRACT_BE_U_2(&op->ospf_len)) {
+ ND_PRINT((ndo, " [len %d]", EXTRACT_BE_U_2(&op->ospf_len)));
}
- if (length > EXTRACT_BE_16BITS(&op->ospf_len)) {
- dataend = bp + EXTRACT_BE_16BITS(&op->ospf_len);
+ if (length > EXTRACT_BE_U_2(&op->ospf_len)) {
+ dataend = bp + EXTRACT_BE_U_2(&op->ospf_len);
} else {
dataend = bp + length;
}
ND_TCHECK2(op->ospf_authdata[0], sizeof(op->ospf_authdata));
ND_PRINT((ndo, ", Authentication Type: %s (%u)",
- tok2str(ospf_authtype_values, "unknown", EXTRACT_BE_16BITS(&op->ospf_authtype)),
- EXTRACT_BE_16BITS(&op->ospf_authtype)));
+ tok2str(ospf_authtype_values, "unknown", EXTRACT_BE_U_2(&op->ospf_authtype)),
+ EXTRACT_BE_U_2(&op->ospf_authtype)));
- switch (EXTRACT_BE_16BITS(&op->ospf_authtype)) {
+ switch (EXTRACT_BE_U_2(&op->ospf_authtype)) {
case OSPF_AUTH_NONE:
break;
ND_PRINT((ndo, "\n\tKey-ID: %u, Auth-Length: %u, Crypto Sequence Number: 0x%08x",
*((op->ospf_authdata) + 2),
*((op->ospf_authdata) + 3),
- EXTRACT_BE_32BITS((op->ospf_authdata) + 4)));
+ EXTRACT_BE_U_4((op->ospf_authdata) + 4)));
break;
default:
/* ospf version 2 */
if (ospf_decode_v2(ndo, op, dataend))
goto trunc;
- if (length > EXTRACT_BE_16BITS(&op->ospf_len)) {
+ if (length > EXTRACT_BE_U_2(&op->ospf_len)) {
if (ospf_decode_lls(ndo, op, length))
goto trunc;
}
ND_PRINT((ndo, "\n\t Advertising Router %s, seq 0x%08x, age %us, length %u",
ipaddr_string(ndo, &lshp->ls_router),
- EXTRACT_BE_32BITS(&lshp->ls_seq),
- EXTRACT_BE_16BITS(&lshp->ls_age),
- EXTRACT_BE_16BITS(&lshp->ls_length)-(u_int)sizeof(struct lsa6_hdr)));
+ EXTRACT_BE_U_4(&lshp->ls_seq),
+ EXTRACT_BE_U_2(&lshp->ls_age),
+ EXTRACT_BE_U_2(&lshp->ls_length)-(u_int)sizeof(struct lsa6_hdr)));
- ospf6_print_ls_type(ndo, EXTRACT_BE_16BITS(&lshp->ls_type),
+ ospf6_print_ls_type(ndo, EXTRACT_BE_U_2(&lshp->ls_type),
&lshp->ls_stateid);
return (0);
bittok2str(ospf6_lsa_prefix_option_values,
"none", lsapp->lsa_p_opt)));
}
- ND_PRINT((ndo, ", metric %u", EXTRACT_BE_16BITS(&lsapp->lsa_p_metric)));
+ ND_PRINT((ndo, ", metric %u", EXTRACT_BE_U_2(&lsapp->lsa_p_metric)));
return sizeof(*lsapp) - IPV6_ADDR_LEN_BYTES + wordlen * 4;
trunc:
if (ospf6_print_lshdr(ndo, &lsap->ls_hdr, dataend))
return (1);
ND_TCHECK(lsap->ls_hdr.ls_length);
- length = EXTRACT_BE_16BITS(&lsap->ls_hdr.ls_length);
+ length = EXTRACT_BE_U_2(&lsap->ls_hdr.ls_length);
/*
* The LSA length includes the length of the header;
lsa_length = length - sizeof(struct lsa6_hdr);
tptr = (const uint8_t *)lsap+sizeof(struct lsa6_hdr);
- switch (EXTRACT_BE_16BITS(&lsap->ls_hdr.ls_type)) {
+ switch (EXTRACT_BE_U_2(&lsap->ls_hdr.ls_type)) {
case LS_TYPE_ROUTER | LS_SCOPE_AREA:
if (lsa_length < sizeof (lsap->lsa_un.un_rla.rla_options))
return (1);
ND_TCHECK(lsap->lsa_un.un_rla.rla_options);
ND_PRINT((ndo, "\n\t Options [%s]",
bittok2str(ospf6_option_values, "none",
- EXTRACT_BE_32BITS(&lsap->lsa_un.un_rla.rla_options))));
+ EXTRACT_BE_U_4(&lsap->lsa_un.un_rla.rla_options))));
ND_PRINT((ndo, ", RLA-Flags [%s]",
bittok2str(ospf6_rla_flag_values, "none",
lsap->lsa_un.un_rla.rla_flags)));
rlp->link_type));
return (0);
}
- ND_PRINT((ndo, ", metric %d", EXTRACT_BE_16BITS(&rlp->link_metric)));
+ ND_PRINT((ndo, ", metric %d", EXTRACT_BE_U_2(&rlp->link_metric)));
rlp++;
}
break;
ND_TCHECK(lsap->lsa_un.un_nla.nla_options);
ND_PRINT((ndo, "\n\t Options [%s]",
bittok2str(ospf6_option_values, "none",
- EXTRACT_BE_32BITS(&lsap->lsa_un.un_nla.nla_options))));
+ EXTRACT_BE_U_4(&lsap->lsa_un.un_nla.nla_options))));
ND_PRINT((ndo, "\n\t Connected Routers:"));
ap = lsap->lsa_un.un_nla.nla_router;
lsa_length -= sizeof (lsap->lsa_un.un_inter_ap.inter_ap_metric);
ND_TCHECK(lsap->lsa_un.un_inter_ap.inter_ap_metric);
ND_PRINT((ndo, ", metric %u",
- EXTRACT_BE_32BITS(&lsap->lsa_un.un_inter_ap.inter_ap_metric) & SLA_MASK_METRIC));
+ EXTRACT_BE_U_4(&lsap->lsa_un.un_inter_ap.inter_ap_metric) & SLA_MASK_METRIC));
tptr = (const uint8_t *)lsap->lsa_un.un_inter_ap.inter_ap_prefix;
while (lsa_length != 0) {
return (1);
lsa_length -= sizeof (lsap->lsa_un.un_asla.asla_metric);
ND_TCHECK(lsap->lsa_un.un_asla.asla_metric);
- flags32 = EXTRACT_BE_32BITS(&lsap->lsa_un.un_asla.asla_metric);
+ flags32 = EXTRACT_BE_U_4(&lsap->lsa_un.un_asla.asla_metric);
ND_PRINT((ndo, "\n\t Flags [%s]",
bittok2str(ospf6_asla_flag_values, "none", flags32)));
ND_PRINT((ndo, " metric %u",
- EXTRACT_BE_32BITS(&lsap->lsa_un.un_asla.asla_metric) &
+ EXTRACT_BE_U_4(&lsap->lsa_un.un_asla.asla_metric) &
ASLA_MASK_METRIC));
tptr = (const uint8_t *)lsap->lsa_un.un_asla.asla_prefix;
ND_TCHECK(llsap->llsa_priandopt);
ND_PRINT((ndo, "\n\t Options [%s]",
bittok2str(ospf6_option_values, "none",
- EXTRACT_BE_32BITS(&llsap->llsa_options))));
+ EXTRACT_BE_U_4(&llsap->llsa_options))));
if (lsa_length < sizeof (llsap->llsa_lladdr) + sizeof (llsap->llsa_nprefix))
return (1);
lsa_length -= sizeof (llsap->llsa_lladdr) + sizeof (llsap->llsa_nprefix);
ND_TCHECK(llsap->llsa_nprefix);
- prefixes = EXTRACT_BE_32BITS(&llsap->llsa_nprefix);
+ prefixes = EXTRACT_BE_U_4(&llsap->llsa_nprefix);
ND_PRINT((ndo, "\n\t Priority %d, Link-local address %s, Prefixes %d:",
llsap->llsa_priority,
ip6addr_string(ndo, &llsap->llsa_lladdr),
lsa_length -= sizeof (lsap->lsa_un.un_intra_ap.intra_ap_rtid);
ND_TCHECK(lsap->lsa_un.un_intra_ap.intra_ap_rtid);
ospf6_print_ls_type(ndo,
- EXTRACT_BE_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_lstype),
+ EXTRACT_BE_U_2(&lsap->lsa_un.un_intra_ap.intra_ap_lstype),
&lsap->lsa_un.un_intra_ap.intra_ap_lsid);
if (lsa_length < sizeof (lsap->lsa_un.un_intra_ap.intra_ap_nprefix))
return (1);
lsa_length -= sizeof (lsap->lsa_un.un_intra_ap.intra_ap_nprefix);
ND_TCHECK(lsap->lsa_un.un_intra_ap.intra_ap_nprefix);
- prefixes = EXTRACT_BE_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_nprefix);
+ prefixes = EXTRACT_BE_U_2(&lsap->lsa_un.un_intra_ap.intra_ap_nprefix);
ND_PRINT((ndo, "\n\t Prefixes %d:", prefixes));
tptr = (const uint8_t *)lsap->lsa_un.un_intra_ap.intra_ap_prefix;
ND_TCHECK_4(&hellop->hello_options);
ND_PRINT((ndo, "\n\tOptions [%s]",
bittok2str(ospf6_option_values, "none",
- EXTRACT_BE_32BITS(&hellop->hello_options))));
+ EXTRACT_BE_U_4(&hellop->hello_options))));
ND_TCHECK(hellop->hello_deadint);
ND_PRINT((ndo, "\n\t Hello Timer %us, Dead Timer %us, Interface-ID %s, Priority %u",
- EXTRACT_BE_16BITS(&hellop->hello_helloint),
- EXTRACT_BE_16BITS(&hellop->hello_deadint),
+ EXTRACT_BE_U_2(&hellop->hello_helloint),
+ EXTRACT_BE_U_2(&hellop->hello_deadint),
ipaddr_string(ndo, &hellop->hello_ifid),
hellop->hello_priority));
ND_TCHECK(hellop->hello_dr);
- if (EXTRACT_BE_32BITS(&hellop->hello_dr) != 0)
+ if (EXTRACT_BE_U_4(&hellop->hello_dr) != 0)
ND_PRINT((ndo, "\n\t Designated Router %s",
ipaddr_string(ndo, &hellop->hello_dr)));
ND_TCHECK(hellop->hello_bdr);
- if (EXTRACT_BE_32BITS(&hellop->hello_bdr) != 0)
+ if (EXTRACT_BE_U_4(&hellop->hello_bdr) != 0)
ND_PRINT((ndo, ", Backup Designated Router %s",
ipaddr_string(ndo, &hellop->hello_bdr)));
if (ndo->ndo_vflag > 1) {
ND_TCHECK(ddp->db_options);
ND_PRINT((ndo, "\n\tOptions [%s]",
bittok2str(ospf6_option_values, "none",
- EXTRACT_BE_32BITS(&ddp->db_options))));
+ EXTRACT_BE_U_4(&ddp->db_options))));
ND_TCHECK(ddp->db_flags);
ND_PRINT((ndo, ", DD Flags [%s]",
bittok2str(ospf6_dd_flag_values,"none",ddp->db_flags)));
ND_TCHECK(ddp->db_seq);
ND_PRINT((ndo, ", MTU %u, DD-Sequence 0x%08x",
- EXTRACT_BE_16BITS(&ddp->db_mtu),
- EXTRACT_BE_32BITS(&ddp->db_seq)));
+ EXTRACT_BE_U_2(&ddp->db_mtu),
+ EXTRACT_BE_U_4(&ddp->db_seq)));
if (ndo->ndo_vflag > 1) {
/* Print all the LS adv's */
lshp = ddp->db_lshdr;
ND_PRINT((ndo, "\n\t Advertising Router %s",
ipaddr_string(ndo, &lsrp->ls_router)));
ospf6_print_ls_type(ndo,
- EXTRACT_BE_16BITS(&lsrp->ls_type),
+ EXTRACT_BE_U_2(&lsrp->ls_type),
&lsrp->ls_stateid);
++lsrp;
}
register const struct lsu6 *lsup = (const struct lsu6 *)((const uint8_t *)op + OSPF6HDR_LEN);
ND_TCHECK(lsup->lsu_count);
- i = EXTRACT_BE_32BITS(&lsup->lsu_count);
+ i = EXTRACT_BE_U_4(&lsup->lsu_count);
lsap = lsup->lsu_lsa;
while ((const u_char *)lsap < dataend && i--) {
if (ospf6_print_lsa(ndo, lsap, dataend))
goto trunc;
lsap = (const struct lsa6 *)((const u_char *)lsap +
- EXTRACT_BE_16BITS(&lsap->ls_hdr.ls_length));
+ EXTRACT_BE_U_2(&lsap->ls_hdr.ls_length));
}
}
break;
goto trunc;
/* Checksum */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\tLLS Checksum 0x%04x", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, "\n\tLLS Checksum 0x%04x", EXTRACT_BE_U_2(cp)));
cp += 2;
/* LLS Data Length */
ND_TCHECK2(*cp, 2);
- llsdatalen = EXTRACT_BE_16BITS(cp);
+ llsdatalen = EXTRACT_BE_U_2(cp);
ND_PRINT((ndo, ", Data Length %u", llsdatalen));
if (llsdatalen < OSPF_LLS_HDRLEN || llsdatalen > len)
goto trunc;
goto trunc;
/* Authentication Type */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\tAuthentication Type %s", tok2str(ospf6_auth_type_str, "unknown (0x%04x)", EXTRACT_BE_16BITS(cp))));
+ ND_PRINT((ndo, "\n\tAuthentication Type %s", tok2str(ospf6_auth_type_str, "unknown (0x%04x)", EXTRACT_BE_U_2(cp))));
cp += 2;
/* Auth Data Len */
ND_TCHECK2(*cp, 2);
- authdatalen = EXTRACT_BE_16BITS(cp);
+ authdatalen = EXTRACT_BE_U_2(cp);
ND_PRINT((ndo, ", Length %u", authdatalen));
if (authdatalen < OSPF6_AT_HDRLEN || authdatalen > len)
goto trunc;
cp += 2;
/* Security Association ID */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", SAID %u", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, ", SAID %u", EXTRACT_BE_U_2(cp)));
cp += 2;
/* Cryptographic Sequence Number (High-Order 32 Bits) */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", CSN 0x%08x", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ", CSN 0x%08x", EXTRACT_BE_U_4(cp)));
cp += 4;
/* Cryptographic Sequence Number (Low-Order 32 Bits) */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ":%08x", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, ":%08x", EXTRACT_BE_U_4(cp)));
cp += 4;
/* Authentication Data */
ND_TCHECK2(*cp, authdatalen - OSPF6_AT_HDRLEN);
if (op->ospf6_type == OSPF_TYPE_HELLO) {
const struct hello6 *hellop = (const struct hello6 *)((const uint8_t *)op + OSPF6HDR_LEN);
ND_TCHECK(hellop->hello_options);
- if (EXTRACT_BE_32BITS(&hellop->hello_options) & OSPF6_OPTION_L)
+ if (EXTRACT_BE_U_4(&hellop->hello_options) & OSPF6_OPTION_L)
lls_hello = 1;
} else if (op->ospf6_type == OSPF_TYPE_DD) {
const struct dd6 *ddp = (const struct dd6 *)((const uint8_t *)op + OSPF6HDR_LEN);
ND_TCHECK(ddp->db_options);
- if (EXTRACT_BE_32BITS(&ddp->db_options) & OSPF6_OPTION_L)
+ if (EXTRACT_BE_U_4(&ddp->db_options) & OSPF6_OPTION_L)
lls_dd = 1;
}
if ((lls_hello || lls_dd) && (llslen = ospf6_print_lls(ndo, cp, len)) < 0)
/* OSPFv3 data always comes first and optional trailing data may follow. */
ND_TCHECK(op->ospf6_len);
- datalen = EXTRACT_BE_16BITS(&op->ospf6_len);
+ datalen = EXTRACT_BE_U_2(&op->ospf6_len);
if (datalen > length) {
ND_PRINT((ndo, " [len %d]", datalen));
return;
ND_PRINT((ndo, "\n\tRouter-ID %s", ipaddr_string(ndo, &op->ospf6_routerid)));
ND_TCHECK(op->ospf6_areaid);
- if (EXTRACT_BE_32BITS(&op->ospf6_areaid) != 0)
+ if (EXTRACT_BE_U_4(&op->ospf6_areaid) != 0)
ND_PRINT((ndo, ", Area %s", ipaddr_string(ndo, &op->ospf6_areaid)));
else
ND_PRINT((ndo, ", Backbone Area"));
bp += 1;
ND_TCHECK2(*bp, 3);
- ND_PRINT((ndo, "overlay %u, ", EXTRACT_BE_24BITS(bp)));
+ ND_PRINT((ndo, "overlay %u, ", EXTRACT_BE_U_3(bp)));
bp += 3;
ND_TCHECK2(*bp, 3);
- ND_PRINT((ndo, "instance %u\n", EXTRACT_BE_24BITS(bp)));
+ ND_PRINT((ndo, "instance %u\n", EXTRACT_BE_U_3(bp)));
bp += 3;
/* Reserved */
{
uint32_t rulenr, subrulenr;
- rulenr = EXTRACT_BE_32BITS(&hdr->rulenr);
- subrulenr = EXTRACT_BE_32BITS(&hdr->subrulenr);
+ rulenr = EXTRACT_BE_U_4(&hdr->rulenr);
+ subrulenr = EXTRACT_BE_U_4(&hdr->subrulenr);
if (subrulenr == (uint32_t)-1)
ND_PRINT((ndo, "rule %u/", rulenr));
else
return;
}
- sport = EXTRACT_BE_16BITS(&pgm->pgm_sport);
- dport = EXTRACT_BE_16BITS(&pgm->pgm_dport);
+ sport = EXTRACT_BE_U_2(&pgm->pgm_sport);
+ dport = EXTRACT_BE_U_2(&pgm->pgm_dport);
if (ip6) {
if (ip6->ip6_nxt == IPPROTO_PGM) {
ND_TCHECK(*pgm);
- ND_PRINT((ndo, "PGM, length %u", EXTRACT_BE_16BITS(&pgm->pgm_length)));
+ ND_PRINT((ndo, "PGM, length %u", EXTRACT_BE_U_2(&pgm->pgm_length)));
if (!ndo->ndo_vflag)
return;
ND_TCHECK(*spm);
bp = (const u_char *) (spm + 1);
- switch (EXTRACT_BE_16BITS(&spm->pgms_nla_afi)) {
+ switch (EXTRACT_BE_U_2(&spm->pgms_nla_afi)) {
case AFNUM_INET:
ND_TCHECK2(*bp, sizeof(struct in_addr));
addrtostr(bp, nla_buf, sizeof(nla_buf));
}
ND_PRINT((ndo, "SPM seq %u trail %u lead %u nla %s",
- EXTRACT_BE_32BITS(&spm->pgms_seq),
- EXTRACT_BE_32BITS(&spm->pgms_trailseq),
- EXTRACT_BE_32BITS(&spm->pgms_leadseq),
+ EXTRACT_BE_U_4(&spm->pgms_seq),
+ EXTRACT_BE_U_4(&spm->pgms_trailseq),
+ EXTRACT_BE_U_4(&spm->pgms_leadseq),
nla_buf));
break;
}
poll_msg = (const struct pgm_poll *)(pgm + 1);
ND_TCHECK(*poll_msg);
ND_PRINT((ndo, "POLL seq %u round %u",
- EXTRACT_BE_32BITS(&poll_msg->pgmp_seq),
- EXTRACT_BE_16BITS(&poll_msg->pgmp_round)));
+ EXTRACT_BE_U_4(&poll_msg->pgmp_seq),
+ EXTRACT_BE_U_2(&poll_msg->pgmp_round)));
bp = (const u_char *) (poll_msg + 1);
break;
}
ND_TCHECK(*polr);
bp = (const u_char *) (polr + 1);
- switch (EXTRACT_BE_16BITS(&polr->pgmp_nla_afi)) {
+ switch (EXTRACT_BE_U_2(&polr->pgmp_nla_afi)) {
case AFNUM_INET:
ND_TCHECK2(*bp, sizeof(struct in_addr));
addrtostr(bp, nla_buf, sizeof(nla_buf));
}
ND_TCHECK2(*bp, sizeof(uint32_t));
- ivl = EXTRACT_BE_32BITS(bp);
+ ivl = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
ND_TCHECK2(*bp, sizeof(uint32_t));
- rnd = EXTRACT_BE_32BITS(bp);
+ rnd = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
ND_TCHECK2(*bp, sizeof(uint32_t));
- mask = EXTRACT_BE_32BITS(bp);
+ mask = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
ND_PRINT((ndo, "POLR seq %u round %u nla %s ivl %u rnd 0x%08x "
- "mask 0x%08x", EXTRACT_BE_32BITS(&polr->pgmp_seq),
- EXTRACT_BE_16BITS(&polr->pgmp_round), nla_buf, ivl, rnd, mask));
+ "mask 0x%08x", EXTRACT_BE_U_4(&polr->pgmp_seq),
+ EXTRACT_BE_U_2(&polr->pgmp_round), nla_buf, ivl, rnd, mask));
break;
}
case PGM_ODATA: {
odata = (const struct pgm_data *)(pgm + 1);
ND_TCHECK(*odata);
ND_PRINT((ndo, "ODATA trail %u seq %u",
- EXTRACT_BE_32BITS(&odata->pgmd_trailseq),
- EXTRACT_BE_32BITS(&odata->pgmd_seq)));
+ EXTRACT_BE_U_4(&odata->pgmd_trailseq),
+ EXTRACT_BE_U_4(&odata->pgmd_seq)));
bp = (const u_char *) (odata + 1);
break;
}
rdata = (const struct pgm_data *)(pgm + 1);
ND_TCHECK(*rdata);
ND_PRINT((ndo, "RDATA trail %u seq %u",
- EXTRACT_BE_32BITS(&rdata->pgmd_trailseq),
- EXTRACT_BE_32BITS(&rdata->pgmd_seq)));
+ EXTRACT_BE_U_4(&rdata->pgmd_trailseq),
+ EXTRACT_BE_U_4(&rdata->pgmd_seq)));
bp = (const u_char *) (rdata + 1);
break;
}
* Skip past the source, saving info along the way
* and stopping if we don't have enough.
*/
- switch (EXTRACT_BE_16BITS(&nak->pgmn_source_afi)) {
+ switch (EXTRACT_BE_U_2(&nak->pgmn_source_afi)) {
case AFNUM_INET:
ND_TCHECK2(*bp, sizeof(struct in_addr));
addrtostr(bp, source_buf, sizeof(source_buf));
*/
bp += (2 * sizeof(uint16_t));
ND_TCHECK_2(bp);
- switch (EXTRACT_BE_16BITS(bp)) {
+ switch (EXTRACT_BE_U_2(bp)) {
case AFNUM_INET:
ND_TCHECK2(*bp, sizeof(struct in_addr));
addrtostr(bp, group_buf, sizeof(group_buf));
break;
}
ND_PRINT((ndo, "(%s -> %s), seq %u",
- source_buf, group_buf, EXTRACT_BE_32BITS(&nak->pgmn_seq)));
+ source_buf, group_buf, EXTRACT_BE_U_4(&nak->pgmn_seq)));
break;
}
ack = (const struct pgm_ack *)(pgm + 1);
ND_TCHECK(*ack);
ND_PRINT((ndo, "ACK seq %u",
- EXTRACT_BE_32BITS(&ack->pgma_rx_max_seq)));
+ EXTRACT_BE_U_4(&ack->pgma_rx_max_seq)));
bp = (const u_char *) (ack + 1);
break;
}
* That option header MUST be an OPT_LENGTH option
* (see the first paragraph of section 9.1 in RFC 3208).
*/
- opt_type = EXTRACT_8BITS(bp);
+ opt_type = EXTRACT_U_1(bp);
bp++;
if ((opt_type & PGM_OPT_MASK) != PGM_OPT_LENGTH) {
ND_PRINT((ndo, "[First option bad, should be PGM_OPT_LENGTH, is %u]", opt_type & PGM_OPT_MASK));
return;
}
- opt_len = EXTRACT_8BITS(bp);
+ opt_len = EXTRACT_U_1(bp);
bp++;
if (opt_len != 4) {
ND_PRINT((ndo, "[Bad OPT_LENGTH option, length %u != 4]", opt_len));
return;
}
- opts_len = EXTRACT_BE_16BITS(bp);
+ opts_len = EXTRACT_BE_U_2(bp);
if (opts_len < 4) {
ND_PRINT((ndo, "[Bad total option length %u < 4]", opts_len));
return;
ND_PRINT((ndo, " [|OPT]"));
return;
}
- opt_type = EXTRACT_8BITS(bp);
+ opt_type = EXTRACT_U_1(bp);
bp++;
- opt_len = EXTRACT_8BITS(bp);
+ opt_len = EXTRACT_U_1(bp);
bp++;
if (opt_len < PGM_MIN_OPT_LEN) {
ND_PRINT((ndo, "[Bad option, length %u < %u]", opt_len,
opt_len, PGM_OPT_LENGTH_LEN));
return;
}
- ND_PRINT((ndo, " OPTS LEN (extra?) %d", EXTRACT_BE_16BITS(bp)));
+ ND_PRINT((ndo, " OPTS LEN (extra?) %d", EXTRACT_BE_U_2(bp)));
bp += 2;
opts_len -= PGM_OPT_LENGTH_LEN;
break;
return;
}
bp += 2;
- seq = EXTRACT_BE_32BITS(bp);
+ seq = EXTRACT_BE_U_4(bp);
bp += 4;
- offset = EXTRACT_BE_32BITS(bp);
+ offset = EXTRACT_BE_U_4(bp);
bp += 4;
- len = EXTRACT_BE_32BITS(bp);
+ len = EXTRACT_BE_U_4(bp);
bp += 4;
ND_PRINT((ndo, " FRAG seq %u off %u len %u", seq, offset, len));
opts_len -= PGM_OPT_FRAGMENT_LEN;
return;
}
ND_TCHECK2(*bp, 4);
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(bp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(bp)));
bp += 4;
opt_len -= 4;
opts_len -= 4;
return;
}
bp += 2;
- seq = EXTRACT_BE_32BITS(bp);
+ seq = EXTRACT_BE_U_4(bp);
bp += 4;
ND_PRINT((ndo, " JOIN %u", seq));
opts_len -= PGM_OPT_JOIN_LEN;
return;
}
bp += 2;
- offset = EXTRACT_BE_32BITS(bp);
+ offset = EXTRACT_BE_U_4(bp);
bp += 4;
- seq = EXTRACT_BE_32BITS(bp);
+ seq = EXTRACT_BE_U_4(bp);
bp += 4;
ND_PRINT((ndo, " BACKOFF ivl %u ivlseq %u", offset, seq));
opts_len -= PGM_OPT_NAK_BO_IVL_LEN;
return;
}
bp += 2;
- offset = EXTRACT_BE_32BITS(bp);
+ offset = EXTRACT_BE_U_4(bp);
bp += 4;
- seq = EXTRACT_BE_32BITS(bp);
+ seq = EXTRACT_BE_U_4(bp);
bp += 4;
ND_PRINT((ndo, " BACKOFF max %u min %u", offset, seq));
opts_len -= PGM_OPT_NAK_BO_RNG_LEN;
return;
}
bp += 2;
- nla_afnum = EXTRACT_BE_16BITS(bp);
+ nla_afnum = EXTRACT_BE_U_2(bp);
bp += 2+2;
switch (nla_afnum) {
case AFNUM_INET:
return;
}
bp += 2;
- len = EXTRACT_BE_32BITS(bp);
+ len = EXTRACT_BE_U_4(bp);
bp += 4;
ND_PRINT((ndo, " PARITY MAXTGS %u", len));
opts_len -= PGM_OPT_PARITY_PRM_LEN;
return;
}
bp += 2;
- seq = EXTRACT_BE_32BITS(bp);
+ seq = EXTRACT_BE_U_4(bp);
bp += 4;
ND_PRINT((ndo, " PARITY GROUP %u", seq));
opts_len -= PGM_OPT_PARITY_GRP_LEN;
return;
}
bp += 2;
- len = EXTRACT_BE_32BITS(bp);
+ len = EXTRACT_BE_U_4(bp);
bp += 4;
ND_PRINT((ndo, " PARITY ATGS %u", len));
opts_len -= PGM_OPT_CURR_TGSIZE_LEN;
return;
}
bp += 2;
- offset = EXTRACT_BE_32BITS(bp);
+ offset = EXTRACT_BE_U_4(bp);
bp += 4;
- nla_afnum = EXTRACT_BE_16BITS(bp);
+ nla_afnum = EXTRACT_BE_U_2(bp);
bp += 2+2;
switch (nla_afnum) {
case AFNUM_INET:
return;
}
bp += 2;
- offset = EXTRACT_BE_32BITS(bp);
+ offset = EXTRACT_BE_U_4(bp);
bp += 4;
- nla_afnum = EXTRACT_BE_16BITS(bp);
+ nla_afnum = EXTRACT_BE_U_2(bp);
bp += 2+2;
switch (nla_afnum) {
case AFNUM_INET:
if (ndo->ndo_packettype == PT_PGM_ZMTP1 &&
(pgm->pgm_type == PGM_ODATA || pgm->pgm_type == PGM_RDATA))
zmtp1_datagram_print(ndo, bp,
- EXTRACT_BE_16BITS(&pgm->pgm_length));
+ EXTRACT_BE_U_2(&pgm->pgm_length));
return;
/* If it's a single group and a single source, use 1-line output. */
if (ND_TTEST2(bp[0], 30) && bp[11] == 1 &&
- ((njoin = EXTRACT_BE_16BITS(bp + 20)) + EXTRACT_BE_16BITS(bp + 22)) == 1) {
+ ((njoin = EXTRACT_BE_U_2(bp + 20)) + EXTRACT_BE_U_2(bp + 22)) == 1) {
int hold;
ND_PRINT((ndo, " RPF %s ", ipaddr_string(ndo, bp)));
- hold = EXTRACT_BE_16BITS(bp + 6);
+ hold = EXTRACT_BE_U_2(bp + 6);
if (hold != 180) {
ND_PRINT((ndo, "Hold "));
unsigned_relts_print(ndo, hold);
ND_PRINT((ndo, "%s (%s/%d, %s", njoin ? "Join" : "Prune",
ipaddr_string(ndo, &bp[26]), bp[25] & 0x3f,
ipaddr_string(ndo, &bp[12])));
- if (EXTRACT_BE_32BITS(bp + 16) != 0xffffffff)
+ if (EXTRACT_BE_U_4(bp + 16) != 0xffffffff)
ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[16])));
ND_PRINT((ndo, ") %s%s %s",
(bp[24] & 0x01) ? "Sparse" : "Dense",
if (ndo->ndo_vflag > 1)
ND_PRINT((ndo, "\n"));
ND_PRINT((ndo, " Hold time: "));
- unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp + 2));
+ unsigned_relts_print(ndo, EXTRACT_BE_U_2(bp + 2));
if (ndo->ndo_vflag < 2)
return;
bp += 4;
if (len < 4)
goto trunc;
ND_TCHECK2(bp[0], sizeof(struct in_addr));
- if (EXTRACT_BE_32BITS(bp) != 0xffffffff)
+ if (EXTRACT_BE_U_4(bp) != 0xffffffff)
ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[0])));
bp += 4;
len -= 4;
if (len < 4)
goto trunc;
ND_TCHECK2(bp[0], 4);
- njoin = EXTRACT_BE_16BITS(bp);
- nprune = EXTRACT_BE_16BITS(bp + 2);
+ njoin = EXTRACT_BE_U_2(bp);
+ nprune = EXTRACT_BE_U_2(bp + 2);
ND_PRINT((ndo, " joined: %d pruned: %d", njoin, nprune));
bp += 4;
len -= 4;
if (ndo->ndo_vflag) {
ND_TCHECK2(bp[10],2);
ND_PRINT((ndo, " (Hold-time "));
- unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp + 10));
+ unsigned_relts_print(ndo, EXTRACT_BE_U_2(bp + 10));
ND_PRINT((ndo, ")"));
}
break;
if (ndo->ndo_vflag) {
ND_TCHECK2(bp[22], 2);
ND_PRINT((ndo, " group %s", ipaddr_string(ndo, &bp[8])));
- if (EXTRACT_BE_32BITS(bp + 12) != 0xffffffff)
+ if (EXTRACT_BE_U_4(bp + 12) != 0xffffffff)
ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12])));
ND_PRINT((ndo, " RP %s hold ", ipaddr_string(ndo, &bp[16])));
- unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp + 22));
+ unsigned_relts_print(ndo, EXTRACT_BE_U_2(bp + 22));
}
break;
case PIMV1_TYPE_ASSERT:
ND_TCHECK2(bp[16], sizeof(struct in_addr));
ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[16]),
ipaddr_string(ndo, &bp[8])));
- if (EXTRACT_BE_32BITS(bp + 12) != 0xffffffff)
+ if (EXTRACT_BE_U_4(bp + 12) != 0xffffffff)
ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12])));
ND_TCHECK2(bp[24], 4);
ND_PRINT((ndo, " %s pref %d metric %d",
(bp[20] & 0x80) ? "RP-tree" : "SPT",
- EXTRACT_BE_32BITS(bp + 20) & 0x7fffffff,
- EXTRACT_BE_32BITS(bp + 24)));
+ EXTRACT_BE_U_4(bp + 20) & 0x7fffffff,
+ EXTRACT_BE_U_4(bp + 24)));
break;
case PIMV1_TYPE_JOIN_PRUNE:
case PIMV1_TYPE_GRAFT:
ND_TCHECK2(bp[2], 2);
ND_PRINT((ndo, " Hold "));
- hold = EXTRACT_BE_16BITS(bp + 2);
+ hold = EXTRACT_BE_U_2(bp + 2);
if (hold)
- unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp + 2));
+ unsigned_relts_print(ndo, EXTRACT_BE_U_2(bp + 2));
else
ND_PRINT((ndo, "FOREVER"));
if (len < 4)
goto trunc;
ND_TCHECK(pim->pim_cksum);
- ND_PRINT((ndo, ", cksum 0x%04x ", EXTRACT_BE_16BITS(&pim->pim_cksum)));
- if (EXTRACT_BE_16BITS(&pim->pim_cksum) == 0) {
+ ND_PRINT((ndo, ", cksum 0x%04x ", EXTRACT_BE_U_2(&pim->pim_cksum)));
+ if (EXTRACT_BE_U_2(&pim->pim_cksum) == 0) {
ND_PRINT((ndo, "(unverified)"));
} else {
if (PIM_TYPE(pim->pim_typever) == PIMV2_TYPE_REGISTER) {
if (len < 4)
goto trunc;
ND_TCHECK2(bp[0], 4);
- otype = EXTRACT_BE_16BITS(bp);
- olen = EXTRACT_BE_16BITS(bp + 2);
+ otype = EXTRACT_BE_U_2(bp);
+ olen = EXTRACT_BE_U_2(bp + 2);
ND_PRINT((ndo, "\n\t %s Option (%u), length %u, Value: ",
tok2str(pimv2_hello_option_values, "Unknown", otype),
otype,
ND_PRINT((ndo, "ERROR: Option Length != 2 Bytes (%u)", olen));
} else {
unsigned_relts_print(ndo,
- EXTRACT_BE_16BITS(bp));
+ EXTRACT_BE_U_2(bp));
}
break;
} else {
char t_bit;
uint16_t lan_delay, override_interval;
- lan_delay = EXTRACT_BE_16BITS(bp);
- override_interval = EXTRACT_BE_16BITS(bp + 2);
+ lan_delay = EXTRACT_BE_U_2(bp);
+ override_interval = EXTRACT_BE_U_2(bp + 2);
t_bit = (lan_delay & 0x8000)? 1 : 0;
lan_delay &= ~0x8000;
ND_PRINT((ndo, "\n\t T-bit=%d, LAN delay %dms, Override interval %dms",
ND_PRINT((ndo, "Bi-Directional Capability (Old)"));
break;
case 4:
- ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(bp)));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_U_4(bp)));
break;
default:
ND_PRINT((ndo, "ERROR: Option Length != 4 Bytes (%u)", olen));
if (olen != 4) {
ND_PRINT((ndo, "ERROR: Option Length != 4 Bytes (%u)", olen));
} else {
- ND_PRINT((ndo, "0x%08x", EXTRACT_BE_32BITS(bp)));
+ ND_PRINT((ndo, "0x%08x", EXTRACT_BE_U_4(bp)));
}
break;
ND_PRINT((ndo, ", interval "));
unsigned_relts_print(ndo, *(bp+1));
}
- if (EXTRACT_BE_16BITS(bp + 2) != 0) {
- ND_PRINT((ndo, " ?0x%04x?", EXTRACT_BE_16BITS(bp + 2)));
+ if (EXTRACT_BE_U_2(bp + 2) != 0) {
+ ND_PRINT((ndo, " ?0x%04x?", EXTRACT_BE_U_2(bp + 2)));
}
}
break;
ND_PRINT((ndo, ", Flags [ %s ]\n\t",
tok2str(pimv2_register_flag_values,
"none",
- EXTRACT_BE_32BITS(bp))));
+ EXTRACT_BE_U_4(bp))));
bp += 4; len -= 4;
/* encapsulated multicast packet */
goto trunc;
ND_TCHECK2(*bp, 4);
ngroup = bp[1];
- holdtime = EXTRACT_BE_16BITS(bp + 2);
+ holdtime = EXTRACT_BE_U_2(bp + 2);
ND_PRINT((ndo, "\n\t %u group(s)", ngroup));
if (PIM_TYPE(pim->pim_typever) != 7) { /*not for Graft-ACK*/
ND_PRINT((ndo, ", holdtime: "));
if (len < 4)
goto trunc;
ND_TCHECK2(*bp, 4);
- njoin = EXTRACT_BE_16BITS(bp);
- nprune = EXTRACT_BE_16BITS(bp + 2);
+ njoin = EXTRACT_BE_U_2(bp);
+ nprune = EXTRACT_BE_U_2(bp + 2);
ND_PRINT((ndo, ", joined sources: %u, pruned sources: %u", njoin, nprune));
bp += 4; len -= 4;
for (j = 0; j < njoin; j++) {
if (len < 2)
goto trunc;
ND_TCHECK_2(bp);
- ND_PRINT((ndo, " tag=%x", EXTRACT_BE_16BITS(bp)));
+ ND_PRINT((ndo, " tag=%x", EXTRACT_BE_U_2(bp)));
bp += 2;
len -= 2;
if (len < 1)
ND_TCHECK_2(bp);
ND_PRINT((ndo, ",holdtime="));
unsigned_relts_print(ndo,
- EXTRACT_BE_16BITS(bp));
+ EXTRACT_BE_U_2(bp));
if (len < 3)
goto trunc;
ND_TCHECK(bp[2]);
ND_TCHECK2(*bp, 8);
if (bp[0] & 0x80)
ND_PRINT((ndo, " RPT"));
- ND_PRINT((ndo, " pref=%u", EXTRACT_BE_32BITS(bp) & 0x7fffffff));
- ND_PRINT((ndo, " metric=%u", EXTRACT_BE_32BITS(bp + 4)));
+ ND_PRINT((ndo, " pref=%u", EXTRACT_BE_U_4(bp) & 0x7fffffff));
+ ND_PRINT((ndo, " metric=%u", EXTRACT_BE_U_4(bp + 4)));
break;
case PIMV2_TYPE_CANDIDATE_RP:
goto trunc;
ND_TCHECK_2(&bp[2]);
ND_PRINT((ndo, " holdtime="));
- unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp + 2));
+ unsigned_relts_print(ndo, EXTRACT_BE_U_2(bp + 2));
bp += 4;
len -= 4;
goto trunc;
ND_TCHECK_2(bp);
ND_PRINT((ndo, " TUNR "));
- unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp));
+ unsigned_relts_print(ndo, EXTRACT_BE_U_2(bp));
break;
hdr = (const pktap_header_t *)bp;
- dlt = EXTRACT_LE_32BITS(&hdr->pkt_dlt);
- hdrlen = EXTRACT_LE_32BITS(&hdr->pkt_len);
+ dlt = EXTRACT_LE_U_4(&hdr->pkt_dlt);
+ hdrlen = EXTRACT_LE_U_4(&hdr->pkt_len);
dltname = pcap_datalink_val_to_name(dlt);
if (!ndo->ndo_qflag) {
ND_PRINT((ndo,"DLT %s (%d) len %d",
return (0);
}
hdr = (const pktap_header_t *)p;
- dlt = EXTRACT_LE_32BITS(&hdr->pkt_dlt);
- hdrlen = EXTRACT_LE_32BITS(&hdr->pkt_len);
+ dlt = EXTRACT_LE_U_4(&hdr->pkt_dlt);
+ hdrlen = EXTRACT_LE_U_4(&hdr->pkt_len);
if (hdrlen < sizeof(pktap_header_t)) {
/*
* Claimed header length < structure length.
caplen -= hdrlen;
p += hdrlen;
- rectype = EXTRACT_LE_32BITS(&hdr->pkt_rectype);
+ rectype = EXTRACT_LE_U_4(&hdr->pkt_rectype);
switch (rectype) {
case PKT_REC_NONE:
hdr = (const ppi_header_t *)bp;
- len = EXTRACT_LE_16BITS(&hdr->ppi_len);
- dlt = EXTRACT_LE_32BITS(&hdr->ppi_dlt);
+ len = EXTRACT_LE_U_2(&hdr->ppi_len);
+ dlt = EXTRACT_LE_U_4(&hdr->ppi_dlt);
dltname = pcap_datalink_val_to_name(dlt);
if (!ndo->ndo_qflag) {
}
hdr = (const ppi_header_t *)p;
- len = EXTRACT_LE_16BITS(&hdr->ppi_len);
+ len = EXTRACT_LE_U_2(&hdr->ppi_len);
if (caplen < len) {
/*
* If we don't have the entire PPI header, don't
ND_PRINT((ndo, "[|ppi]"));
return (len);
}
- dlt = EXTRACT_LE_32BITS(&hdr->ppi_dlt);
+ dlt = EXTRACT_LE_U_4(&hdr->ppi_dlt);
if (ndo->ndo_eflag)
ppi_header_print(ndo, p, length);
goto trunc;
ND_TCHECK2(*tptr, 2);
- code = EXTRACT_8BITS(tptr);
+ code = EXTRACT_U_1(tptr);
tptr++;
ND_PRINT((ndo, "%s (0x%02x), id %u, length %u",
tok2str(cpcodes, "Unknown Opcode",code),
code,
- EXTRACT_8BITS(tptr), /* ID */
+ EXTRACT_U_1(tptr), /* ID */
length + 2));
tptr++;
return; /* there may be a NULL confreq etc. */
ND_TCHECK2(*tptr, 2);
- len = EXTRACT_BE_16BITS(tptr);
+ len = EXTRACT_BE_U_2(tptr);
tptr += 2;
ND_PRINT((ndo, "\n\tencoded length %u (=Option(s) length %u)", len, len - 4));
if (length < 11)
break;
ND_TCHECK2(*tptr, 4);
- ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr)));
tptr += 4;
ND_TCHECK2(*tptr, 3);
ND_PRINT((ndo, " Vendor: %s (%u)",
- tok2str(oui_values,"Unknown",EXTRACT_BE_24BITS(tptr)),
- EXTRACT_BE_24BITS(tptr)));
+ tok2str(oui_values,"Unknown",EXTRACT_BE_U_3(tptr)),
+ EXTRACT_BE_U_3(tptr)));
/* XXX: need to decode Kind and Value(s)? */
break;
case CPCODES_CONF_REQ:
break;
ND_TCHECK2(*tptr, 2);
ND_PRINT((ndo, "\n\t Rejected %s Protocol (0x%04x)",
- tok2str(ppptype2str,"unknown", EXTRACT_BE_16BITS(tptr)),
- EXTRACT_BE_16BITS(tptr)));
+ tok2str(ppptype2str,"unknown", EXTRACT_BE_U_2(tptr)),
+ EXTRACT_BE_U_2(tptr)));
/* XXX: need to decode Rejected-Information? - hexdump for now */
if (len > 6) {
ND_PRINT((ndo, "\n\t Rejected Packet"));
if (length < 8)
break;
ND_TCHECK2(*tptr, 4);
- ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr)));
/* XXX: need to decode Data? - hexdump for now */
if (len > 8) {
ND_PRINT((ndo, "\n\t -----trailing data-----"));
if (length < 8)
break;
ND_TCHECK2(*tptr, 4);
- ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr)));
/* RFC 1661 says this is intended to be human readable */
if (len > 8) {
ND_PRINT((ndo, "\n\t Message\n\t "));
if (length < 12)
break;
ND_TCHECK2(*tptr, 4);
- ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_U_4(tptr)));
ND_TCHECK2(*(tptr + 4), 4);
- ND_PRINT((ndo, ", Seconds-Remaining %us", EXTRACT_BE_32BITS(tptr + 4)));
+ ND_PRINT((ndo, ", Seconds-Remaining %us", EXTRACT_BE_U_4(tptr + 4)));
/* XXX: need to decode Message? */
break;
default:
}
ND_TCHECK_3(p + 2);
ND_PRINT((ndo, ": Vendor: %s (%u)",
- tok2str(oui_values,"Unknown",EXTRACT_BE_24BITS(p + 2)),
- EXTRACT_BE_24BITS(p + 2)));
+ tok2str(oui_values,"Unknown",EXTRACT_BE_U_3(p + 2)),
+ EXTRACT_BE_U_3(p + 2)));
#if 0
ND_TCHECK(p[5]);
ND_PRINT((ndo, ", kind: 0x%02x", p[5]));
return len;
}
ND_TCHECK_2(p + 2);
- ND_PRINT((ndo, ": %u", EXTRACT_BE_16BITS(p + 2)));
+ ND_PRINT((ndo, ": %u", EXTRACT_BE_U_2(p + 2)));
break;
case LCPOPT_ACCM:
if (len != 6) {
return len;
}
ND_TCHECK_4(p + 2);
- ND_PRINT((ndo, ": 0x%08x", EXTRACT_BE_32BITS(p + 2)));
+ ND_PRINT((ndo, ": 0x%08x", EXTRACT_BE_U_4(p + 2)));
break;
case LCPOPT_AP:
if (len < 4) {
return len;
}
ND_TCHECK_2(p + 2);
- ND_PRINT((ndo, ": %s", tok2str(ppptype2str, "Unknown Auth Proto (0x04x)", EXTRACT_BE_16BITS(p + 2))));
+ ND_PRINT((ndo, ": %s", tok2str(ppptype2str, "Unknown Auth Proto (0x04x)", EXTRACT_BE_U_2(p + 2))));
- switch (EXTRACT_BE_16BITS(p + 2)) {
+ switch (EXTRACT_BE_U_2(p + 2)) {
case PPP_CHAP:
ND_TCHECK(p[4]);
ND_PRINT((ndo, ", %s", tok2str(authalg_values, "Unknown Auth Alg %u", p[4])));
return 0;
}
ND_TCHECK_2(p + 2);
- if (EXTRACT_BE_16BITS(p + 2) == PPP_LQM)
+ if (EXTRACT_BE_U_2(p + 2) == PPP_LQM)
ND_PRINT((ndo, ": LQR"));
else
ND_PRINT((ndo, ": unknown"));
return 0;
}
ND_TCHECK_4(p + 2);
- ND_PRINT((ndo, ": 0x%08x", EXTRACT_BE_32BITS(p + 2)));
+ ND_PRINT((ndo, ": 0x%08x", EXTRACT_BE_U_4(p + 2)));
break;
case LCPOPT_PFC:
break;
return 0;
}
ND_TCHECK_2(p + 2);
- ND_PRINT((ndo, ": 0x%04x", EXTRACT_BE_16BITS(p + 2)));
+ ND_PRINT((ndo, ": 0x%04x", EXTRACT_BE_U_2(p + 2)));
break;
case LCPOPT_CBACK:
if (len < 3) {
return 0;
}
ND_TCHECK_2(p + 2);
- ND_PRINT((ndo, ": %u", EXTRACT_BE_16BITS(p + 2)));
+ ND_PRINT((ndo, ": %u", EXTRACT_BE_U_2(p + 2)));
break;
case LCPOPT_MLED:
if (len < 3) {
}
ND_PRINT((ndo, "seq 0x%03x, Flags [%s], length %u",
- (EXTRACT_BE_16BITS(p))&0x0fff, /* only support 12-Bit sequence space for now */
- bittok2str(ppp_ml_flag_values, "none", EXTRACT_8BITS(p) & 0xc0),
+ (EXTRACT_BE_U_2(p))&0x0fff, /* only support 12-Bit sequence space for now */
+ bittok2str(ppp_ml_flag_values, "none", EXTRACT_U_1(p) & 0xc0),
length));
}
p++;
ND_TCHECK2(*p, 2);
- len = EXTRACT_BE_16BITS(p);
+ len = EXTRACT_BE_U_2(p);
p += 2;
/*
ND_PRINT((ndo, ", Value "));
for (i = 0; i < val_size; i++) {
ND_TCHECK(*p);
- ND_PRINT((ndo, "%02x", EXTRACT_8BITS(p)));
+ ND_PRINT((ndo, "%02x", EXTRACT_U_1(p)));
p++;
}
name_size = len - (p - p0);
ND_PRINT((ndo, ", Name "));
for (i = 0; i < name_size; i++) {
ND_TCHECK(*p);
- safeputchar(ndo, EXTRACT_8BITS(p));
+ safeputchar(ndo, EXTRACT_U_1(p));
p++;
}
break;
ND_PRINT((ndo, ", Msg "));
for (i = 0; i< msg_size; i++) {
ND_TCHECK(*p);
- safeputchar(ndo, EXTRACT_8BITS(p));
+ safeputchar(ndo, EXTRACT_U_1(p));
p++;
}
break;
p++;
ND_TCHECK2(*p, 2);
- len = EXTRACT_BE_16BITS(p);
+ len = EXTRACT_BE_U_2(p);
p += 2;
if ((int)len > length) {
ND_PRINT((ndo, ", Peer "));
for (i = 0; i < peerid_len; i++) {
ND_TCHECK(*p);
- safeputchar(ndo, EXTRACT_8BITS(p));
+ safeputchar(ndo, EXTRACT_U_1(p));
p++;
}
ND_PRINT((ndo, ", Name "));
for (i = 0; i < passwd_len; i++) {
ND_TCHECK(*p);
- safeputchar(ndo, EXTRACT_8BITS(p));
+ safeputchar(ndo, EXTRACT_U_1(p));
p++;
}
break;
ND_PRINT((ndo, ", Msg "));
for (i = 0; i< msg_len; i++) {
ND_TCHECK(*p);
- safeputchar(ndo, EXTRACT_8BITS(p));
+ safeputchar(ndo, EXTRACT_U_1(p));
p++;
}
break;
return 0;
}
ND_TCHECK_2(p + 2);
- compproto = EXTRACT_BE_16BITS(p + 2);
+ compproto = EXTRACT_BE_U_2(p + 2);
ND_PRINT((ndo, ": %s (0x%02x):",
tok2str(ipcpopt_compproto_values, "Unknown", compproto),
ND_TCHECK2(*(p + 2), IPCPOPT_IPCOMP_MINLEN);
ND_PRINT((ndo, "\n\t TCP Space %u, non-TCP Space %u" \
", maxPeriod %u, maxTime %u, maxHdr %u",
- EXTRACT_BE_16BITS(p + 4),
- EXTRACT_BE_16BITS(p + 6),
- EXTRACT_BE_16BITS(p + 8),
- EXTRACT_BE_16BITS(p + 10),
- EXTRACT_BE_16BITS(p + 12)));
+ EXTRACT_BE_U_2(p + 4),
+ EXTRACT_BE_U_2(p + 6),
+ EXTRACT_BE_U_2(p + 8),
+ EXTRACT_BE_U_2(p + 10),
+ EXTRACT_BE_U_2(p + 12)));
/* suboptions present ? */
if (len > IPCPOPT_IPCOMP_MINLEN) {
while (ipcomp_subopttotallen >= 2) {
ND_TCHECK2(*p, 2);
ipcomp_subopt = *p;
- ipcomp_suboptlen = EXTRACT_8BITS(p + 1);
+ ipcomp_suboptlen = EXTRACT_U_1(p + 1);
/* sanity check */
if (ipcomp_subopt == 0 ||
}
ND_TCHECK2(*(p + 2), 8);
ND_PRINT((ndo, ": %04x:%04x:%04x:%04x",
- EXTRACT_BE_16BITS(p + 2),
- EXTRACT_BE_16BITS(p + 4),
- EXTRACT_BE_16BITS(p + 6),
- EXTRACT_BE_16BITS(p + 8)));
+ EXTRACT_BE_U_2(p + 2),
+ EXTRACT_BE_U_2(p + 4),
+ EXTRACT_BE_U_2(p + 6),
+ EXTRACT_BE_U_2(p + 8)));
break;
default:
/*
return len;
}
ND_TCHECK_4(p + 2);
- ND_PRINT((ndo, ": Magic-Num 0x%08x", EXTRACT_BE_32BITS(p + 2)));
+ ND_PRINT((ndo, ": Magic-Num 0x%08x", EXTRACT_BE_U_4(p + 2)));
break;
default:
/*
* contents.
*/
for (s = p, t = b, i = length; i > 0 && ND_TTEST(*s); i--) {
- c = EXTRACT_8BITS(s);
+ c = EXTRACT_U_1(s);
s++;
if (c == 0x7d) {
if (i <= 1 || !ND_TTEST(*s))
break;
i--;
- c = EXTRACT_8BITS(s) ^ 0x20;
+ c = EXTRACT_U_1(s) ^ 0x20;
s++;
}
*t++ = c;
if (length < 2)
goto trunc;
- proto = EXTRACT_BE_16BITS(b); /* next guess - load two octets */
+ proto = EXTRACT_BE_U_2(b); /* next guess - load two octets */
switch (proto) {
case (PPP_ADDRESS << 8 | PPP_CONTROL): /* looks like a PPP frame */
if (length < 4)
goto trunc;
- proto = EXTRACT_BE_16BITS(b + 2); /* load the PPP proto-id */
+ proto = EXTRACT_BE_U_2(b + 2); /* load the PPP proto-id */
handle_ppp(ndo, proto, b + 4, length - 4);
break;
default: /* last guess - proto must be a PPP proto-id */
if (length < 2)
goto trunc;
ND_TCHECK2(*p, 2);
- ppp_header = EXTRACT_BE_16BITS(p);
+ ppp_header = EXTRACT_BE_U_2(p);
switch(ppp_header) {
case (PPP_WITHDIRECTION_IN << 8 | PPP_CONTROL):
hdr_len++;
} else {
ND_TCHECK2(*p, 2);
- proto = EXTRACT_BE_16BITS(p);
+ proto = EXTRACT_BE_U_2(p);
p += 2;
length -= 2;
hdr_len += 2;
length -= 2;
hdrlen += 2;
- proto = EXTRACT_BE_16BITS(p);
+ proto = EXTRACT_BE_U_2(p);
p += 2;
length -= 2;
hdrlen += 2;
hdrlength += 1;
} else {
/* Un-compressed protocol field */
- ptype = EXTRACT_16BITS(p);
+ ptype = EXTRACT_BE_U_2(p);
if (ndo->ndo_eflag)
ND_PRINT((ndo, "%04x ", ptype));
p += 2;
&& ph->phdr_ctl == PPP_CONTROL) {
if (ndo->ndo_eflag)
ND_PRINT((ndo, "%02x %02x ", q[0], q[1]));
- ptype = EXTRACT_16BITS(&ph->phdr_type);
+ ptype = EXTRACT_BE_U_2(&ph->phdr_type);
if (ndo->ndo_eflag && (ptype == PPP_VJC || ptype == PPP_VJNC)) {
ND_PRINT((ndo, "%s ", tok2str(ppptype2str,
"proto-#%d", ptype)));
pppoe_ver = (pppoe_packet[0] & 0xF0) >> 4;
pppoe_type = (pppoe_packet[0] & 0x0F);
pppoe_code = pppoe_packet[1];
- pppoe_sessionid = EXTRACT_BE_16BITS(pppoe_packet + 2);
- pppoe_length = EXTRACT_BE_16BITS(pppoe_packet + 4);
+ pppoe_sessionid = EXTRACT_BE_U_2(pppoe_packet + 2);
+ pppoe_length = EXTRACT_BE_U_2(pppoe_packet + 4);
pppoe_payload = pppoe_packet + PPPOE_HDRLEN;
if (pppoe_ver != 1) {
*/
while (tag_type && p < pppoe_payload + pppoe_length) {
ND_TCHECK2(*p, 4);
- tag_type = EXTRACT_BE_16BITS(p);
- tag_len = EXTRACT_BE_16BITS(p + 2);
+ tag_type = EXTRACT_BE_U_2(p);
+ tag_len = EXTRACT_BE_U_2(p + 2);
p += 4;
/* p points to tag_value */
const uint32_t *bearer_cap)
{
ND_PRINT((ndo, " BEARER_CAP(%s%s)",
- EXTRACT_BE_32BITS(bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK ? "D" : "",
- EXTRACT_BE_32BITS(bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK ? "A" : ""));
+ EXTRACT_BE_U_4(bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK ? "D" : "",
+ EXTRACT_BE_U_4(bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK ? "A" : ""));
}
static const struct tok pptp_btype_str[] = {
const uint32_t *bearer_type)
{
ND_PRINT((ndo, " BEARER_TYPE(%s)",
- tok2str(pptp_btype_str, "?", EXTRACT_BE_32BITS(bearer_type))));
+ tok2str(pptp_btype_str, "?", EXTRACT_BE_U_4(bearer_type))));
}
static void
pptp_call_id_print(netdissect_options *ndo,
const uint16_t *call_id)
{
- ND_PRINT((ndo, " CALL_ID(%u)", EXTRACT_BE_16BITS(call_id)));
+ ND_PRINT((ndo, " CALL_ID(%u)", EXTRACT_BE_U_2(call_id)));
}
static void
pptp_call_ser_print(netdissect_options *ndo,
const uint16_t *call_ser)
{
- ND_PRINT((ndo, " CALL_SER_NUM(%u)", EXTRACT_BE_16BITS(call_ser)));
+ ND_PRINT((ndo, " CALL_SER_NUM(%u)", EXTRACT_BE_U_2(call_ser)));
}
static void
pptp_cause_code_print(netdissect_options *ndo,
const uint16_t *cause_code)
{
- ND_PRINT((ndo, " CAUSE_CODE(%u)", EXTRACT_BE_16BITS(cause_code)));
+ ND_PRINT((ndo, " CAUSE_CODE(%u)", EXTRACT_BE_U_2(cause_code)));
}
static void
pptp_conn_speed_print(netdissect_options *ndo,
const uint32_t *conn_speed)
{
- ND_PRINT((ndo, " CONN_SPEED(%u)", EXTRACT_BE_32BITS(conn_speed)));
+ ND_PRINT((ndo, " CONN_SPEED(%u)", EXTRACT_BE_U_4(conn_speed)));
}
static const struct tok pptp_errcode_str[] = {
{
ND_PRINT((ndo, " ERR_CODE(%u", *err_code));
if (ndo->ndo_vflag) {
- ND_PRINT((ndo, ":%s", tok2str(pptp_errcode_str, "?", EXTRACT_8BITS(err_code))));
+ ND_PRINT((ndo, ":%s", tok2str(pptp_errcode_str, "?", EXTRACT_U_1(err_code))));
}
ND_PRINT((ndo, ")"));
}
pptp_firm_rev_print(netdissect_options *ndo,
const uint16_t *firm_rev)
{
- ND_PRINT((ndo, " FIRM_REV(%u)", EXTRACT_BE_16BITS(firm_rev)));
+ ND_PRINT((ndo, " FIRM_REV(%u)", EXTRACT_BE_U_2(firm_rev)));
}
static void
const uint32_t *framing_cap)
{
ND_PRINT((ndo, " FRAME_CAP("));
- if (EXTRACT_BE_32BITS(framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) {
+ if (EXTRACT_BE_U_4(framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) {
ND_PRINT((ndo, "A")); /* Async */
}
- if (EXTRACT_BE_32BITS(framing_cap) & PPTP_FRAMING_CAP_SYNC_MASK) {
+ if (EXTRACT_BE_U_4(framing_cap) & PPTP_FRAMING_CAP_SYNC_MASK) {
ND_PRINT((ndo, "S")); /* Sync */
}
ND_PRINT((ndo, ")"));
const uint32_t *framing_type)
{
ND_PRINT((ndo, " FRAME_TYPE(%s)",
- tok2str(pptp_ftype_str, "?", EXTRACT_BE_32BITS(framing_type))));
+ tok2str(pptp_ftype_str, "?", EXTRACT_BE_U_4(framing_type))));
}
static void
pptp_id_print(netdissect_options *ndo,
const uint32_t *id)
{
- ND_PRINT((ndo, " ID(%u)", EXTRACT_BE_32BITS(id)));
+ ND_PRINT((ndo, " ID(%u)", EXTRACT_BE_U_4(id)));
}
static void
pptp_max_channel_print(netdissect_options *ndo,
const uint16_t *max_channel)
{
- ND_PRINT((ndo, " MAX_CHAN(%u)", EXTRACT_BE_16BITS(max_channel)));
+ ND_PRINT((ndo, " MAX_CHAN(%u)", EXTRACT_BE_U_2(max_channel)));
}
static void
pptp_peer_call_id_print(netdissect_options *ndo,
const uint16_t *peer_call_id)
{
- ND_PRINT((ndo, " PEER_CALL_ID(%u)", EXTRACT_BE_16BITS(peer_call_id)));
+ ND_PRINT((ndo, " PEER_CALL_ID(%u)", EXTRACT_BE_U_2(peer_call_id)));
}
static void
pptp_phy_chan_id_print(netdissect_options *ndo,
const uint32_t *phy_chan_id)
{
- ND_PRINT((ndo, " PHY_CHAN_ID(%u)", EXTRACT_BE_32BITS(phy_chan_id)));
+ ND_PRINT((ndo, " PHY_CHAN_ID(%u)", EXTRACT_BE_U_4(phy_chan_id)));
}
static void
pptp_pkt_proc_delay_print(netdissect_options *ndo,
const uint16_t *pkt_proc_delay)
{
- ND_PRINT((ndo, " PROC_DELAY(%u)", EXTRACT_BE_16BITS(pkt_proc_delay)));
+ ND_PRINT((ndo, " PROC_DELAY(%u)", EXTRACT_BE_U_2(pkt_proc_delay)));
}
static void
const uint16_t *proto_ver)
{
ND_PRINT((ndo, " PROTO_VER(%u.%u)", /* Version.Revision */
- EXTRACT_BE_16BITS(proto_ver) >> 8,
- EXTRACT_BE_16BITS(proto_ver) & 0xff));
+ EXTRACT_BE_U_2(proto_ver) >> 8,
+ EXTRACT_BE_U_2(proto_ver) & 0xff));
}
static void
pptp_recv_winsiz_print(netdissect_options *ndo,
const uint16_t *recv_winsiz)
{
- ND_PRINT((ndo, " RECV_WIN(%u)", EXTRACT_BE_16BITS(recv_winsiz)));
+ ND_PRINT((ndo, " RECV_WIN(%u)", EXTRACT_BE_U_2(recv_winsiz)));
}
static const struct tok pptp_scrrp_str[] = {
ctrl_msg_type == PPTP_CTRL_MSG_TYPE_CDN ? pptp_cdn_str :
NULL; /* assertion error */
if (dict != NULL)
- ND_PRINT((ndo, ":%s", tok2str(dict, "?", EXTRACT_8BITS(result_code))));
+ ND_PRINT((ndo, ":%s", tok2str(dict, "?", EXTRACT_U_1(result_code))));
}
ND_PRINT((ndo, ")"));
}
ND_TCHECK(ptr->call_ser);
pptp_call_ser_print(ndo, &ptr->call_ser);
ND_TCHECK(ptr->min_bps);
- ND_PRINT((ndo, " MIN_BPS(%u)", EXTRACT_BE_32BITS(&ptr->min_bps)));
+ ND_PRINT((ndo, " MIN_BPS(%u)", EXTRACT_BE_U_4(&ptr->min_bps)));
ND_TCHECK(ptr->max_bps);
- ND_PRINT((ndo, " MAX_BPS(%u)", EXTRACT_BE_32BITS(&ptr->max_bps)));
+ ND_PRINT((ndo, " MAX_BPS(%u)", EXTRACT_BE_U_4(&ptr->max_bps)));
ND_TCHECK(ptr->bearer_type);
pptp_bearer_type_print(ndo, &ptr->bearer_type);
ND_TCHECK(ptr->framing_type);
ND_TCHECK(ptr->pkt_proc_delay);
pptp_pkt_proc_delay_print(ndo, &ptr->pkt_proc_delay);
ND_TCHECK(ptr->phone_no_len);
- ND_PRINT((ndo, " PHONE_NO_LEN(%u)", EXTRACT_BE_16BITS(&ptr->phone_no_len)));
+ ND_PRINT((ndo, " PHONE_NO_LEN(%u)", EXTRACT_BE_U_2(&ptr->phone_no_len)));
ND_TCHECK(ptr->reserved1);
ND_TCHECK(ptr->phone_no);
ND_PRINT((ndo, " PHONE_NO(%.64s)", ptr->phone_no));
ND_TCHECK(ptr->phy_chan_id);
pptp_phy_chan_id_print(ndo, &ptr->phy_chan_id);
ND_TCHECK(ptr->dialed_no_len);
- ND_PRINT((ndo, " DIALED_NO_LEN(%u)", EXTRACT_BE_16BITS(&ptr->dialed_no_len)));
+ ND_PRINT((ndo, " DIALED_NO_LEN(%u)", EXTRACT_BE_U_2(&ptr->dialed_no_len)));
ND_TCHECK(ptr->dialing_no_len);
- ND_PRINT((ndo, " DIALING_NO_LEN(%u)", EXTRACT_BE_16BITS(&ptr->dialing_no_len)));
+ ND_PRINT((ndo, " DIALING_NO_LEN(%u)", EXTRACT_BE_U_2(&ptr->dialing_no_len)));
ND_TCHECK(ptr->dialed_no);
ND_PRINT((ndo, " DIALED_NO(%.64s)", ptr->dialed_no));
ND_TCHECK(ptr->dialing_no);
pptp_peer_call_id_print(ndo, &ptr->peer_call_id);
ND_TCHECK(ptr->reserved1);
ND_TCHECK(ptr->crc_err);
- ND_PRINT((ndo, " CRC_ERR(%u)", EXTRACT_BE_32BITS(&ptr->crc_err)));
+ ND_PRINT((ndo, " CRC_ERR(%u)", EXTRACT_BE_U_4(&ptr->crc_err)));
ND_TCHECK(ptr->framing_err);
- ND_PRINT((ndo, " FRAMING_ERR(%u)", EXTRACT_BE_32BITS(&ptr->framing_err)));
+ ND_PRINT((ndo, " FRAMING_ERR(%u)", EXTRACT_BE_U_4(&ptr->framing_err)));
ND_TCHECK(ptr->hardware_overrun);
- ND_PRINT((ndo, " HARDWARE_OVERRUN(%u)", EXTRACT_BE_32BITS(&ptr->hardware_overrun)));
+ ND_PRINT((ndo, " HARDWARE_OVERRUN(%u)", EXTRACT_BE_U_4(&ptr->hardware_overrun)));
ND_TCHECK(ptr->buffer_overrun);
- ND_PRINT((ndo, " BUFFER_OVERRUN(%u)", EXTRACT_BE_32BITS(&ptr->buffer_overrun)));
+ ND_PRINT((ndo, " BUFFER_OVERRUN(%u)", EXTRACT_BE_U_4(&ptr->buffer_overrun)));
ND_TCHECK(ptr->timeout_err);
- ND_PRINT((ndo, " TIMEOUT_ERR(%u)", EXTRACT_BE_32BITS(&ptr->timeout_err)));
+ ND_PRINT((ndo, " TIMEOUT_ERR(%u)", EXTRACT_BE_U_4(&ptr->timeout_err)));
ND_TCHECK(ptr->align_err);
- ND_PRINT((ndo, " ALIGN_ERR(%u)", EXTRACT_BE_32BITS(&ptr->align_err)));
+ ND_PRINT((ndo, " ALIGN_ERR(%u)", EXTRACT_BE_U_4(&ptr->align_err)));
return;
pptp_peer_call_id_print(ndo, &ptr->peer_call_id);
ND_TCHECK(ptr->reserved1);
ND_TCHECK(ptr->send_accm);
- ND_PRINT((ndo, " SEND_ACCM(0x%08x)", EXTRACT_BE_32BITS(&ptr->send_accm)));
+ ND_PRINT((ndo, " SEND_ACCM(0x%08x)", EXTRACT_BE_U_4(&ptr->send_accm)));
ND_TCHECK(ptr->recv_accm);
- ND_PRINT((ndo, " RECV_ACCM(0x%08x)", EXTRACT_BE_32BITS(&ptr->recv_accm)));
+ ND_PRINT((ndo, " RECV_ACCM(0x%08x)", EXTRACT_BE_U_4(&ptr->recv_accm)));
return;
ND_TCHECK(hdr->length);
if (ndo->ndo_vflag) {
- ND_PRINT((ndo, " Length=%u", EXTRACT_BE_16BITS(&hdr->length)));
+ ND_PRINT((ndo, " Length=%u", EXTRACT_BE_U_2(&hdr->length)));
}
ND_TCHECK(hdr->msg_type);
if (ndo->ndo_vflag) {
- switch(EXTRACT_BE_16BITS(&hdr->msg_type)) {
+ switch(EXTRACT_BE_U_2(&hdr->msg_type)) {
case PPTP_MSG_TYPE_CTRL:
ND_PRINT((ndo, " CTRL-MSG"));
break;
}
ND_TCHECK(hdr->magic_cookie);
- mc = EXTRACT_BE_32BITS(&hdr->magic_cookie);
+ mc = EXTRACT_BE_U_4(&hdr->magic_cookie);
if (mc != PPTP_MAGIC_COOKIE) {
ND_PRINT((ndo, " UNEXPECTED Magic-Cookie!!(%08x)", mc));
}
ND_PRINT((ndo, " Magic-Cookie=%08x", mc));
}
ND_TCHECK(hdr->ctrl_msg_type);
- ctrl_msg_type = EXTRACT_BE_16BITS(&hdr->ctrl_msg_type);
+ ctrl_msg_type = EXTRACT_BE_U_2(&hdr->ctrl_msg_type);
if (ctrl_msg_type < PPTP_MAX_MSGTYPE_INDEX) {
ND_PRINT((ndo, " CTRL_MSGTYPE=%s",
pptp_message_type_string[ctrl_msg_type]));
ND_PRINT((ndo, "Tag[Unused] "));
data++;
length--;
- ND_PRINT((ndo, "Salt %u ", EXTRACT_BE_16BITS(data)));
+ ND_PRINT((ndo, "Salt %u ", EXTRACT_BE_U_2(data)));
data+=2;
length-=2;
break;
if (length < 1)
goto trunc;
ND_PRINT((ndo, "%s (0x%02x) ",
- tok2str(rfc4675_tagged,"Unknown tag",EXTRACT_8BITS(data)),
+ tok2str(rfc4675_tagged,"Unknown tag",EXTRACT_U_1(data)),
*data));
data++;
length--;
break;
}
- for (i=0; i < length && EXTRACT_8BITS(data); i++, data++)
+ for (i=0; i < length && EXTRACT_U_1(data); i++, data++)
ND_PRINT((ndo, "%c", (*data < 32 || *data > 126) ? '.' : *data));
return;
if (length < 4)
goto trunc;
ND_TCHECK2(*data, 4);
- vendor_id = EXTRACT_BE_32BITS(data);
+ vendor_id = EXTRACT_BE_U_4(data);
data+=4;
length-=4;
ND_TCHECK2(*data, 2);
vendor_type = *(data);
- vendor_length = EXTRACT_8BITS(data + 1);
+ vendor_length = EXTRACT_U_1(data + 1);
if (vendor_length < 2)
{
else
ND_PRINT((ndo, "Tag[%d] ", *data));
data++;
- data_value = EXTRACT_BE_24BITS(data);
+ data_value = EXTRACT_BE_U_3(data);
}
else
{
- data_value = EXTRACT_BE_32BITS(data);
+ data_value = EXTRACT_BE_U_4(data);
}
if ( data_value <= (uint32_t)(attr_type[attr_code].siz_subtypes - 1 +
attr_type[attr_code].first_subtype) &&
switch(attr_code) /* Be aware of special cases... */
{
case FRM_IPX:
- if (EXTRACT_BE_32BITS(data) == 0xFFFFFFFE )
+ if (EXTRACT_BE_U_4(data) == 0xFFFFFFFE )
ND_PRINT((ndo, "NAS Select"));
else
- ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data)));
+ ND_PRINT((ndo, "%d", EXTRACT_BE_U_4(data)));
break;
case SESSION_TIMEOUT:
case ACCT_DELAY:
case ACCT_SESSION_TIME:
case ACCT_INT_INTERVAL:
- timeout = EXTRACT_BE_32BITS(data);
+ timeout = EXTRACT_BE_U_4(data);
if ( timeout < 60 )
ND_PRINT((ndo, "%02d secs", timeout));
else
break;
case FRM_ATALK_LINK:
- if (EXTRACT_BE_32BITS(data))
- ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data)));
+ if (EXTRACT_BE_U_4(data))
+ ND_PRINT((ndo, "%d", EXTRACT_BE_U_4(data)));
else
ND_PRINT((ndo, "Unnumbered"));
break;
case FRM_ATALK_NETWORK:
- if (EXTRACT_BE_32BITS(data))
- ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data)));
+ if (EXTRACT_BE_U_4(data))
+ ND_PRINT((ndo, "%d", EXTRACT_BE_U_4(data)));
else
ND_PRINT((ndo, "NAS assigned"));
break;
else
ND_PRINT((ndo, "Tag[Unused] "));
data++;
- ND_PRINT((ndo, "%d", EXTRACT_BE_24BITS(data)));
+ ND_PRINT((ndo, "%d", EXTRACT_BE_U_3(data)));
break;
case EGRESS_VLAN_ID:
ND_PRINT((ndo, "%s (0x%02x) ",
- tok2str(rfc4675_tagged,"Unknown tag",EXTRACT_8BITS(data)),
+ tok2str(rfc4675_tagged,"Unknown tag",EXTRACT_U_1(data)),
*data));
data++;
- ND_PRINT((ndo, "%d", EXTRACT_BE_24BITS(data)));
+ ND_PRINT((ndo, "%d", EXTRACT_BE_U_3(data)));
break;
default:
- ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data)));
+ ND_PRINT((ndo, "%d", EXTRACT_BE_U_4(data)));
break;
} /* switch */
{
case FRM_IPADDR:
case LOG_IPHOST:
- if (EXTRACT_BE_32BITS(data) == 0xFFFFFFFF )
+ if (EXTRACT_BE_U_4(data) == 0xFFFFFFFF )
ND_PRINT((ndo, "User Selected"));
else
- if (EXTRACT_BE_32BITS(data) == 0xFFFFFFFE )
+ if (EXTRACT_BE_U_4(data) == 0xFFFFFFFE )
ND_PRINT((ndo, "NAS Select"));
else
ND_PRINT((ndo, "%s",ipaddr_string(ndo, data)));
ND_TCHECK2(data[0],4);
- attr_time = EXTRACT_BE_32BITS(data);
+ attr_time = EXTRACT_BE_U_4(data);
strlcpy(string, ctime(&attr_time), sizeof(string));
/* Get rid of the newline */
string[24] = '\0';
}
ND_TCHECK2(data[0],4);
- error_cause_value = EXTRACT_BE_32BITS(data);
+ error_cause_value = EXTRACT_BE_U_4(data);
ND_PRINT((ndo, "Error cause %u: %s", error_cause_value, tok2str(errorcausetype, "Error-Cause %u not known", error_cause_value)));
break;
}
ND_TCHECK2(*dat, MIN_RADIUS_LEN);
rad = (const struct radius_hdr *)dat;
- len = EXTRACT_BE_16BITS(&rad->len);
+ len = EXTRACT_BE_U_2(&rad->len);
if (len < MIN_RADIUS_LEN)
{
register u_short family;
/* RFC 1058 */
- family = EXTRACT_BE_16BITS(&ni->rip_family);
+ family = EXTRACT_BE_U_2(&ni->rip_family);
if (family != BSD_AFNUM_INET && family != 0) {
ND_PRINT((ndo, "\n\t AFI %s, ", tok2str(bsd_af_values, "Unknown (%u)", family)));
print_unknown_data(ndo, (const uint8_t *)&ni->rip_family, "\n\t ", RIP_ROUTELEN);
return;
}
- if (EXTRACT_BE_16BITS(&ni->rip_tag) ||
- EXTRACT_BE_32BITS(&ni->rip_dest_mask) ||
- EXTRACT_BE_32BITS(&ni->rip_router)) {
+ if (EXTRACT_BE_U_2(&ni->rip_tag) ||
+ EXTRACT_BE_U_4(&ni->rip_dest_mask) ||
+ EXTRACT_BE_U_4(&ni->rip_router)) {
/* MBZ fields not zero */
print_unknown_data(ndo, (const uint8_t *)&ni->rip_family, "\n\t ", RIP_ROUTELEN);
return;
if (family == 0) {
ND_PRINT((ndo, "\n\t AFI 0, %s, metric: %u",
ipaddr_string(ndo, &ni->rip_dest),
- EXTRACT_BE_32BITS(&ni->rip_metric)));
+ EXTRACT_BE_U_4(&ni->rip_metric)));
return;
} /* BSD_AFNUM_INET */
ND_PRINT((ndo, "\n\t %s, metric: %u",
ipaddr_string(ndo, &ni->rip_dest),
- EXTRACT_BE_32BITS(&ni->rip_metric)));
+ EXTRACT_BE_U_4(&ni->rip_metric)));
}
static unsigned
{
register u_short family;
- family = EXTRACT_BE_16BITS(&ni->rip_family);
+ family = EXTRACT_BE_U_2(&ni->rip_family);
if (family == 0xFFFF) { /* variable-sized authentication structures */
- uint16_t auth_type = EXTRACT_BE_16BITS(&ni->rip_tag);
+ uint16_t auth_type = EXTRACT_BE_U_2(&ni->rip_tag);
if (auth_type == 2) {
register const u_char *p = (const u_char *)&ni->rip_dest;
u_int i = 0;
ND_PRINT((ndo, "%c", ND_ISPRINT(*p) ? *p : '.'));
} else if (auth_type == 3) {
ND_PRINT((ndo, "\n\t Auth header:"));
- ND_PRINT((ndo, " Packet Len %u,", EXTRACT_BE_16BITS((const uint8_t *)ni + 4)));
+ ND_PRINT((ndo, " Packet Len %u,", EXTRACT_BE_U_2((const uint8_t *)ni + 4)));
ND_PRINT((ndo, " Key-ID %u,", *((const uint8_t *)ni + 6)));
ND_PRINT((ndo, " Auth Data Len %u,", *((const uint8_t *)ni + 7)));
- ND_PRINT((ndo, " SeqNo %u,", EXTRACT_BE_32BITS(&ni->rip_dest_mask)));
- ND_PRINT((ndo, " MBZ %u,", EXTRACT_BE_32BITS(&ni->rip_router)));
- ND_PRINT((ndo, " MBZ %u", EXTRACT_BE_32BITS(&ni->rip_metric)));
+ ND_PRINT((ndo, " SeqNo %u,", EXTRACT_BE_U_4(&ni->rip_dest_mask)));
+ ND_PRINT((ndo, " MBZ %u,", EXTRACT_BE_U_4(&ni->rip_router)));
+ ND_PRINT((ndo, " MBZ %u", EXTRACT_BE_U_4(&ni->rip_metric)));
} else if (auth_type == 1) {
ND_PRINT((ndo, "\n\t Auth trailer:"));
print_unknown_data(ndo, (const uint8_t *)&ni->rip_dest, "\n\t ", remaining);
return remaining; /* AT spans till the packet end */
} else {
ND_PRINT((ndo, "\n\t Unknown (%u) Authentication data:",
- EXTRACT_BE_16BITS(&ni->rip_tag)));
+ EXTRACT_BE_U_2(&ni->rip_tag)));
print_unknown_data(ndo, (const uint8_t *)&ni->rip_dest, "\n\t ", remaining);
}
} else if (family != BSD_AFNUM_INET && family != 0) {
ND_PRINT((ndo, "\n\t AFI %s, %15s/%-2d, tag 0x%04x, metric: %u, next-hop: ",
tok2str(bsd_af_values, "%u", family),
ipaddr_string(ndo, &ni->rip_dest),
- mask2plen(EXTRACT_BE_32BITS(&ni->rip_dest_mask)),
- EXTRACT_BE_16BITS(&ni->rip_tag),
- EXTRACT_BE_32BITS(&ni->rip_metric)));
- if (EXTRACT_BE_32BITS(&ni->rip_router))
+ mask2plen(EXTRACT_BE_U_4(&ni->rip_dest_mask)),
+ EXTRACT_BE_U_2(&ni->rip_tag),
+ EXTRACT_BE_U_4(&ni->rip_metric)));
+ if (EXTRACT_BE_U_4(&ni->rip_router))
ND_PRINT((ndo, "%s", ipaddr_string(ndo, &ni->rip_router)));
else
ND_PRINT((ndo, "self"));
int l;
l = ND_PRINT((ndo, "%s/%d", ip6addr_string(ndo, &ni->rip6_dest), ni->rip6_plen));
if (ni->rip6_tag)
- l += ND_PRINT((ndo, " [%d]", EXTRACT_BE_16BITS(&ni->rip6_tag)));
+ l += ND_PRINT((ndo, " [%d]", EXTRACT_BE_U_2(&ni->rip6_tag)));
if (metric)
l += ND_PRINT((ndo, " (%d)", ni->rip6_metric));
return l;
ND_TCHECK2(*tptr, sizeof(rpki_rtr_pdu));
pdu_header = (const rpki_rtr_pdu *)tptr;
pdu_type = pdu_header->pdu_type;
- pdu_len = EXTRACT_BE_32BITS(pdu_header->length);
+ pdu_len = EXTRACT_BE_U_4(pdu_header->length);
/* Do not check bounds with pdu_len yet, do it in the case blocks
* below to make it possible to decode at least the beginning of
* a truncated Error Report PDU or a truncated encapsulated PDU.
msg = (const u_char *)(pdu_header + 1);
ND_PRINT((ndo, "%sSession ID: 0x%04x, Serial: %u",
indent_string(indent+2),
- EXTRACT_BE_16BITS(pdu_header->u.session_id),
- EXTRACT_BE_32BITS(msg)));
+ EXTRACT_BE_U_2(pdu_header->u.session_id),
+ EXTRACT_BE_U_4(msg)));
break;
/*
/* no additional boundary to check */
ND_PRINT((ndo, "%sSession ID: 0x%04x",
indent_string(indent+2),
- EXTRACT_BE_16BITS(pdu_header->u.session_id)));
+ EXTRACT_BE_U_2(pdu_header->u.session_id)));
break;
case RPKI_RTR_IPV4_PREFIX_PDU:
indent_string(indent+2),
ipaddr_string(ndo, pdu->prefix),
pdu->prefix_length, pdu->max_length,
- EXTRACT_BE_32BITS(pdu->as), pdu->flags));
+ EXTRACT_BE_U_4(pdu->as), pdu->flags));
}
break;
indent_string(indent+2),
ip6addr_string(ndo, pdu->prefix),
pdu->prefix_length, pdu->max_length,
- EXTRACT_BE_32BITS(pdu->as), pdu->flags));
+ EXTRACT_BE_U_4(pdu->as), pdu->flags));
}
break;
* data element, more data elements may be present.
*/
pdu = (const rpki_rtr_pdu_error_report *)tptr;
- encapsulated_pdu_length = EXTRACT_BE_32BITS(pdu->encapsulated_pdu_length);
+ encapsulated_pdu_length = EXTRACT_BE_U_4(pdu->encapsulated_pdu_length);
tlen += 4;
- error_code = EXTRACT_BE_16BITS(pdu->pdu_header.u.error_code);
+ error_code = EXTRACT_BE_U_2(pdu->pdu_header.u.error_code);
ND_PRINT((ndo, "%sError code: %s (%u), Encapsulated PDU length: %u",
indent_string(indent+2),
tok2str(rpki_rtr_error_codes, "Unknown", error_code),
/*
* Extract, trail-zero and print the Error message.
*/
- text_length = EXTRACT_BE_32BITS(tptr + tlen);
+ text_length = EXTRACT_BE_U_4(tptr + tlen);
tlen += 4;
if (text_length) {
uint8_t rrcp_opcode;
ND_TCHECK(*(cp + RRCP_PROTO_OFFSET));
- rrcp_proto = EXTRACT_8BITS(cp + RRCP_PROTO_OFFSET);
+ rrcp_proto = EXTRACT_U_1(cp + RRCP_PROTO_OFFSET);
ND_TCHECK(*(cp + RRCP_OPCODE_ISREPLY_OFFSET));
- rrcp_opcode = EXTRACT_8BITS((cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_OPCODE_MASK;
+ rrcp_opcode = EXTRACT_U_1((cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_OPCODE_MASK;
if (src != NULL && dst != NULL) {
ND_PRINT((ndo, "%s > %s, ",
(src->addr_string)(ndo, src->addr),
if (rrcp_opcode==1 || rrcp_opcode==2){
ND_TCHECK2(*(cp + RRCP_REG_ADDR_OFFSET), 6);
ND_PRINT((ndo, " addr=0x%04x, data=0x%08x",
- EXTRACT_LE_16BITS(cp + RRCP_REG_ADDR_OFFSET),
- EXTRACT_LE_32BITS(cp + RRCP_REG_DATA_OFFSET)));
+ EXTRACT_LE_U_2(cp + RRCP_REG_ADDR_OFFSET),
+ EXTRACT_LE_U_4(cp + RRCP_REG_DATA_OFFSET)));
}
if (rrcp_proto==1){
ND_TCHECK2(*(cp + RRCP_AUTHKEY_OFFSET), 2);
ND_PRINT((ndo, ", auth=0x%04x",
- EXTRACT_BE_16BITS(cp + RRCP_AUTHKEY_OFFSET)));
+ EXTRACT_BE_U_2(cp + RRCP_AUTHKEY_OFFSET)));
}
if (rrcp_proto==1 && rrcp_opcode==0 &&
((*(cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_ISREPLY)){
*(cp + RRCP_DOWNLINK_PORT_OFFSET),
*(cp + RRCP_UPLINK_PORT_OFFSET),
etheraddr_string(ndo, cp + RRCP_UPLINK_MAC_OFFSET),
- EXTRACT_BE_32BITS(cp + RRCP_VENDOR_ID_OFFSET),
- EXTRACT_BE_16BITS(cp + RRCP_CHIP_ID_OFFSET)));
+ EXTRACT_BE_U_4(cp + RRCP_VENDOR_ID_OFFSET),
+ EXTRACT_BE_U_2(cp + RRCP_CHIP_ID_OFFSET)));
}else if (rrcp_opcode==1 || rrcp_opcode==2 || rrcp_proto==2){
ND_TCHECK2(*(cp + RRCP_COOKIE2_OFFSET), 4);
ND_PRINT((ndo, ", cookie=0x%08x%08x ",
- EXTRACT_BE_32BITS(cp + RRCP_COOKIE2_OFFSET),
- EXTRACT_BE_32BITS(cp + RRCP_COOKIE1_OFFSET)));
+ EXTRACT_BE_U_4(cp + RRCP_COOKIE2_OFFSET),
+ EXTRACT_BE_U_4(cp + RRCP_COOKIE1_OFFSET)));
}
return;
return 0;
parameter_id = *(tptr);
ND_TCHECK2(*(tptr + 2), 2);
- parameter_length = EXTRACT_BE_16BITS(tptr + 2)<<2; /* convert wordcount to bytecount */
+ parameter_length = EXTRACT_BE_U_2(tptr + 2)<<2; /* convert wordcount to bytecount */
ND_PRINT((ndo, "\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
tok2str(rsvp_intserv_parameter_id_values,"unknown",parameter_id),
*/
if (parameter_length == 4) {
ND_TCHECK2(*(tptr + 4), 4);
- ND_PRINT((ndo, "\n\t\tIS hop count: %u", EXTRACT_BE_32BITS(tptr + 4)));
+ ND_PRINT((ndo, "\n\t\tIS hop count: %u", EXTRACT_BE_U_4(tptr + 4)));
}
break;
*/
if (parameter_length == 4) {
ND_TCHECK2(*(tptr + 4), 4);
- bw.i = EXTRACT_BE_32BITS(tptr + 4);
+ bw.i = EXTRACT_BE_U_4(tptr + 4);
ND_PRINT((ndo, "\n\t\tPath b/w estimate: %.10g Mbps", bw.f / 125000));
}
break;
if (parameter_length == 4) {
ND_TCHECK2(*(tptr + 4), 4);
ND_PRINT((ndo, "\n\t\tMinimum path latency: "));
- if (EXTRACT_BE_32BITS(tptr + 4) == 0xffffffff)
+ if (EXTRACT_BE_U_4(tptr + 4) == 0xffffffff)
ND_PRINT((ndo, "don't care"));
else
- ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(tptr + 4)));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_U_4(tptr + 4)));
}
break;
*/
if (parameter_length == 4) {
ND_TCHECK2(*(tptr + 4), 4);
- ND_PRINT((ndo, "\n\t\tComposed MTU: %u bytes", EXTRACT_BE_32BITS(tptr + 4)));
+ ND_PRINT((ndo, "\n\t\tComposed MTU: %u bytes", EXTRACT_BE_U_4(tptr + 4)));
}
break;
case 127:
if (parameter_length == 20) {
ND_TCHECK2(*(tptr + 4), 20);
- bw.i = EXTRACT_BE_32BITS(tptr + 4);
+ bw.i = EXTRACT_BE_U_4(tptr + 4);
ND_PRINT((ndo, "\n\t\tToken Bucket Rate: %.10g Mbps", bw.f / 125000));
- bw.i = EXTRACT_BE_32BITS(tptr + 8);
+ bw.i = EXTRACT_BE_U_4(tptr + 8);
ND_PRINT((ndo, "\n\t\tToken Bucket Size: %.10g bytes", bw.f));
- bw.i = EXTRACT_BE_32BITS(tptr + 12);
+ bw.i = EXTRACT_BE_U_4(tptr + 12);
ND_PRINT((ndo, "\n\t\tPeak Data Rate: %.10g Mbps", bw.f / 125000));
- ND_PRINT((ndo, "\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_BE_32BITS(tptr + 16)));
- ND_PRINT((ndo, "\n\t\tMaximum Packet Size: %u bytes", EXTRACT_BE_32BITS(tptr + 20)));
+ ND_PRINT((ndo, "\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_BE_U_4(tptr + 16)));
+ ND_PRINT((ndo, "\n\t\tMaximum Packet Size: %u bytes", EXTRACT_BE_U_4(tptr + 20)));
}
break;
if (parameter_length == 8) {
ND_TCHECK2(*(tptr + 4), 8);
- bw.i = EXTRACT_BE_32BITS(tptr + 4);
+ bw.i = EXTRACT_BE_U_4(tptr + 4);
ND_PRINT((ndo, "\n\t\tRate: %.10g Mbps", bw.f / 125000));
- ND_PRINT((ndo, "\n\t\tSlack Term: %u", EXTRACT_BE_32BITS(tptr + 8)));
+ ND_PRINT((ndo, "\n\t\tSlack Term: %u", EXTRACT_BE_U_4(tptr + 8)));
}
break;
case 136:
if (parameter_length == 4) {
ND_TCHECK2(*(tptr + 4), 4);
- ND_PRINT((ndo, "\n\t\tValue: %u", EXTRACT_BE_32BITS(tptr + 4)));
+ ND_PRINT((ndo, "\n\t\tValue: %u", EXTRACT_BE_U_4(tptr + 4)));
}
break;
ND_TCHECK2(*tptr, sizeof(struct rsvp_object_header));
rsvp_obj_header = (const struct rsvp_object_header *)tptr;
- rsvp_obj_len=EXTRACT_BE_16BITS(rsvp_obj_header->length);
+ rsvp_obj_len=EXTRACT_BE_U_2(rsvp_obj_header->length);
rsvp_obj_ctype=rsvp_obj_header->ctype;
if(rsvp_obj_len % 4) {
ND_PRINT((ndo, "%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_8BITS(obj_tptr + sizeof(struct in_addr))));
+ EXTRACT_U_1(obj_tptr + sizeof(struct in_addr))));
ND_PRINT((ndo, "%s Flags: [0x%02x], DestPort %u",
indent,
- EXTRACT_8BITS((obj_tptr + 5)),
- EXTRACT_BE_16BITS(obj_tptr + 6)));
+ EXTRACT_U_1((obj_tptr + 5)),
+ EXTRACT_BE_U_2(obj_tptr + 6)));
obj_tlen-=8;
obj_tptr+=8;
break;
ND_PRINT((ndo, "%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
indent,
ip6addr_string(ndo, obj_tptr),
- EXTRACT_8BITS(obj_tptr + sizeof(struct in6_addr))));
+ EXTRACT_U_1(obj_tptr + sizeof(struct in6_addr))));
ND_PRINT((ndo, "%s Flags: [0x%02x], DestPort %u",
indent,
- EXTRACT_8BITS((obj_tptr + sizeof(struct in6_addr) + 1)),
- EXTRACT_BE_16BITS(obj_tptr + sizeof(struct in6_addr) + 2)));
+ EXTRACT_U_1((obj_tptr + sizeof(struct in6_addr) + 1)),
+ EXTRACT_BE_U_2(obj_tptr + sizeof(struct in6_addr) + 2)));
obj_tlen-=20;
obj_tptr+=20;
break;
ND_PRINT((ndo, "%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
indent,
ip6addr_string(ndo, obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 18),
+ EXTRACT_BE_U_2(obj_tptr + 18),
ip6addr_string(ndo, obj_tptr + 20)));
obj_tlen-=36;
obj_tptr+=36;
return -1;
ND_PRINT((ndo, "%s IPv6 P2MP LSP ID: 0x%08x, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
indent,
- EXTRACT_BE_32BITS(obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 6),
+ EXTRACT_BE_U_4(obj_tptr),
+ EXTRACT_BE_U_2(obj_tptr + 6),
ip6addr_string(ndo, obj_tptr + 8)));
obj_tlen-=26;
obj_tptr+=26;
ND_PRINT((ndo, "%s IPv4 P2MP LSP ID: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 6),
+ EXTRACT_BE_U_2(obj_tptr + 6),
ipaddr_string(ndo, obj_tptr + 8)));
obj_tlen-=12;
obj_tptr+=12;
ND_PRINT((ndo, "%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 6),
+ EXTRACT_BE_U_2(obj_tptr + 6),
ipaddr_string(ndo, obj_tptr + 8)));
obj_tlen-=12;
obj_tptr+=12;
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_1:
while(obj_tlen >= 4 ) {
- ND_PRINT((ndo, "%s Label: %u", indent, EXTRACT_BE_32BITS(obj_tptr)));
+ ND_PRINT((ndo, "%s Label: %u", indent, EXTRACT_BE_U_4(obj_tptr)));
obj_tlen-=4;
obj_tptr+=4;
}
return-1;
ND_PRINT((ndo, "%s Generalized Label: %u",
indent,
- EXTRACT_BE_32BITS(obj_tptr)));
+ EXTRACT_BE_U_4(obj_tptr)));
obj_tlen-=4;
obj_tptr+=4;
break;
return-1;
ND_PRINT((ndo, "%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
indent,
- EXTRACT_BE_32BITS(obj_tptr),
+ EXTRACT_BE_U_4(obj_tptr),
indent,
- EXTRACT_BE_32BITS(obj_tptr + 4),
- EXTRACT_BE_32BITS(obj_tptr + 8)));
+ EXTRACT_BE_U_4(obj_tptr + 4),
+ EXTRACT_BE_U_4(obj_tptr + 8)));
obj_tlen-=12;
obj_tptr+=12;
break;
indent,
tok2str(rsvp_resstyle_values,
"Unknown",
- EXTRACT_BE_24BITS(obj_tptr + 1)),
- EXTRACT_8BITS(obj_tptr)));
+ EXTRACT_BE_U_3(obj_tptr + 1)),
+ EXTRACT_U_1(obj_tptr)));
obj_tlen-=4;
obj_tptr+=4;
break;
ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 6)));
+ EXTRACT_BE_U_2(obj_tptr + 6)));
obj_tlen-=8;
obj_tptr+=8;
break;
ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u",
indent,
ip6addr_string(ndo, obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 18)));
+ EXTRACT_BE_U_2(obj_tptr + 18)));
obj_tlen-=20;
obj_tptr+=20;
break;
"%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
indent,
ip6addr_string(ndo, obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 18),
+ EXTRACT_BE_U_2(obj_tptr + 18),
indent,
ip6addr_string(ndo, obj_tptr+20),
- EXTRACT_BE_16BITS(obj_tptr + 38)));
+ EXTRACT_BE_U_2(obj_tptr + 38)));
obj_tlen-=40;
obj_tptr+=40;
break;
ND_PRINT((ndo, "%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 6)));
+ EXTRACT_BE_U_2(obj_tptr + 6)));
obj_tlen-=8;
obj_tptr+=8;
break;
"%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 6),
+ EXTRACT_BE_U_2(obj_tptr + 6),
indent,
ipaddr_string(ndo, obj_tptr+8),
- EXTRACT_BE_16BITS(obj_tptr + 12)));
+ EXTRACT_BE_U_2(obj_tptr + 12)));
obj_tlen-=16;
obj_tptr+=16;
break;
indent,
tok2str(ethertype_values,
"Unknown Protocol (0x%04x)",
- EXTRACT_BE_16BITS(obj_tptr + 2))));
+ EXTRACT_BE_U_2(obj_tptr + 2))));
obj_tlen-=4;
obj_tptr+=4;
}
indent,
tok2str(ethertype_values,
"Unknown Protocol (0x%04x)",
- EXTRACT_BE_16BITS(obj_tptr + 2))));
- ND_PRINT((ndo, ",%s merge capability",((EXTRACT_8BITS(obj_tptr + 4)) & 0x80) ? "no" : "" ));
+ EXTRACT_BE_U_2(obj_tptr + 2))));
+ ND_PRINT((ndo, ",%s merge capability",((EXTRACT_U_1(obj_tptr + 4)) & 0x80) ? "no" : "" ));
ND_PRINT((ndo, "%s Minimum VPI/VCI: %u/%u",
indent,
- (EXTRACT_BE_16BITS(obj_tptr + 4))&0xfff,
- (EXTRACT_BE_16BITS(obj_tptr + 6)) & 0xfff));
+ (EXTRACT_BE_U_2(obj_tptr + 4))&0xfff,
+ (EXTRACT_BE_U_2(obj_tptr + 6)) & 0xfff));
ND_PRINT((ndo, "%s Maximum VPI/VCI: %u/%u",
indent,
- (EXTRACT_BE_16BITS(obj_tptr + 8))&0xfff,
- (EXTRACT_BE_16BITS(obj_tptr + 10)) & 0xfff));
+ (EXTRACT_BE_U_2(obj_tptr + 8))&0xfff,
+ (EXTRACT_BE_U_2(obj_tptr + 10)) & 0xfff));
obj_tlen-=12;
obj_tptr+=12;
break;
indent,
tok2str(ethertype_values,
"Unknown Protocol (0x%04x)",
- EXTRACT_BE_16BITS(obj_tptr + 2))));
+ EXTRACT_BE_U_2(obj_tptr + 2))));
ND_PRINT((ndo, "%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
indent,
- (EXTRACT_BE_32BITS(obj_tptr + 4))&0x7fffff,
- (EXTRACT_BE_32BITS(obj_tptr + 8))&0x7fffff,
- (((EXTRACT_BE_16BITS(obj_tptr + 4)>>7)&3) == 0 ) ? "10" : "",
- (((EXTRACT_BE_16BITS(obj_tptr + 4) >> 7) & 3) == 2 ) ? "23" : ""));
+ (EXTRACT_BE_U_4(obj_tptr + 4))&0x7fffff,
+ (EXTRACT_BE_U_4(obj_tptr + 8))&0x7fffff,
+ (((EXTRACT_BE_U_2(obj_tptr + 4)>>7)&3) == 0 ) ? "10" : "",
+ (((EXTRACT_BE_U_2(obj_tptr + 4) >> 7) & 3) == 2 ) ? "23" : ""));
obj_tlen-=12;
obj_tptr+=12;
break;
indent,
tok2str(gmpls_encoding_values,
"Unknown",
- EXTRACT_8BITS(obj_tptr)),
- EXTRACT_8BITS(obj_tptr)));
+ EXTRACT_U_1(obj_tptr)),
+ EXTRACT_U_1(obj_tptr)));
ND_PRINT((ndo, "%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
indent,
tok2str(gmpls_switch_cap_values,
"Unknown",
- EXTRACT_8BITS((obj_tptr + 1))),
- EXTRACT_8BITS(obj_tptr+1),
+ EXTRACT_U_1((obj_tptr + 1))),
+ EXTRACT_U_1(obj_tptr + 1),
tok2str(gmpls_payload_values,
"Unknown",
- EXTRACT_BE_16BITS(obj_tptr + 2)),
- EXTRACT_BE_16BITS(obj_tptr + 2)));
+ EXTRACT_BE_U_2(obj_tptr + 2)),
+ EXTRACT_BE_U_2(obj_tptr + 2)));
obj_tlen-=4;
obj_tptr+=4;
break;
u_char length;
ND_TCHECK2(*obj_tptr, 4);
- length = EXTRACT_8BITS(obj_tptr + 1);
+ length = EXTRACT_U_1(obj_tptr + 1);
ND_PRINT((ndo, "%s Subobject Type: %s, length %u",
indent,
tok2str(rsvp_obj_xro_values,
"Unknown %u",
- RSVP_OBJ_XRO_MASK_SUBOBJ(EXTRACT_8BITS(obj_tptr))),
+ RSVP_OBJ_XRO_MASK_SUBOBJ(EXTRACT_U_1(obj_tptr))),
length));
if (length == 0) { /* prevent infinite loops */
break;
}
- switch(RSVP_OBJ_XRO_MASK_SUBOBJ(EXTRACT_8BITS(obj_tptr))) {
+ switch(RSVP_OBJ_XRO_MASK_SUBOBJ(EXTRACT_U_1(obj_tptr))) {
u_char prefix_length;
case RSVP_OBJ_XRO_IPV4:
goto invalid;
}
ND_TCHECK2(*obj_tptr, 8);
- prefix_length = EXTRACT_8BITS(obj_tptr + 6);
+ prefix_length = EXTRACT_U_1(obj_tptr + 6);
if (prefix_length != 32) {
ND_PRINT((ndo, " ERROR: Prefix length %u != 32",
prefix_length));
goto invalid;
}
ND_PRINT((ndo, ", %s, %s/%u, Flags: [%s]",
- RSVP_OBJ_XRO_MASK_LOOSE(EXTRACT_8BITS(obj_tptr)) ? "Loose" : "Strict",
+ RSVP_OBJ_XRO_MASK_LOOSE(EXTRACT_U_1(obj_tptr)) ? "Loose" : "Strict",
ipaddr_string(ndo, obj_tptr+2),
- EXTRACT_8BITS((obj_tptr + 6)),
+ EXTRACT_U_1((obj_tptr + 6)),
bittok2str(rsvp_obj_rro_flag_values,
"none",
- EXTRACT_8BITS((obj_tptr + 7))))); /* rfc3209 says that this field is rsvd. */
+ EXTRACT_U_1((obj_tptr + 7))))); /* rfc3209 says that this field is rsvd. */
break;
case RSVP_OBJ_XRO_LABEL:
if (length != 8) {
ND_PRINT((ndo, ", Flags: [%s] (%#x), Class-Type: %s (%u), %u",
bittok2str(rsvp_obj_rro_label_flag_values,
"none",
- EXTRACT_8BITS((obj_tptr + 2))),
- EXTRACT_8BITS(obj_tptr+2),
+ EXTRACT_U_1((obj_tptr + 2))),
+ EXTRACT_U_1(obj_tptr + 2),
tok2str(rsvp_ctype_values,
"Unknown",
- EXTRACT_8BITS((obj_tptr + 3)) + (256 * RSVP_OBJ_RRO)),
- EXTRACT_8BITS((obj_tptr + 3)),
- EXTRACT_BE_32BITS(obj_tptr + 4)));
+ EXTRACT_U_1((obj_tptr + 3)) + (256 * RSVP_OBJ_RRO)),
+ EXTRACT_U_1((obj_tptr + 3)),
+ EXTRACT_BE_U_4(obj_tptr + 4)));
}
- obj_tlen-=EXTRACT_8BITS(obj_tptr + 1);
- obj_tptr+=EXTRACT_8BITS(obj_tptr + 1);
+ obj_tlen-=EXTRACT_U_1(obj_tptr + 1);
+ obj_tptr+=EXTRACT_U_1(obj_tptr + 1);
}
break;
default:
return-1;
ND_PRINT((ndo, "%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
indent,
- EXTRACT_BE_32BITS(obj_tptr),
- EXTRACT_BE_32BITS(obj_tptr + 4)));
+ EXTRACT_BE_U_4(obj_tptr),
+ EXTRACT_BE_U_4(obj_tptr + 4)));
obj_tlen-=8;
obj_tptr+=8;
break;
return-1;
ND_PRINT((ndo, "%s Restart Time: %ums, Recovery Time: %ums",
indent,
- EXTRACT_BE_32BITS(obj_tptr),
- EXTRACT_BE_32BITS(obj_tptr + 4)));
+ EXTRACT_BE_U_4(obj_tptr),
+ EXTRACT_BE_U_4(obj_tptr + 4)));
obj_tlen-=8;
obj_tptr+=8;
break;
case RSVP_CTYPE_TUNNEL_IPV4:
if (obj_tlen < 4)
return-1;
- namelen = EXTRACT_8BITS(obj_tptr + 3);
+ namelen = EXTRACT_U_1(obj_tptr + 3);
if (obj_tlen < 4+namelen)
return-1;
ND_PRINT((ndo, "%s Session Name: ", indent));
for (i = 0; i < namelen; i++)
- safeputchar(ndo, EXTRACT_8BITS(obj_tptr + 4 + i));
+ safeputchar(ndo, EXTRACT_U_1(obj_tptr + 4 + i));
ND_PRINT((ndo, "%s Setup Priority: %u, Holding Priority: %u, Flags: [%s] (%#x)",
indent,
- EXTRACT_8BITS(obj_tptr),
- EXTRACT_8BITS(obj_tptr+1),
+ EXTRACT_U_1(obj_tptr),
+ EXTRACT_U_1(obj_tptr + 1),
bittok2str(rsvp_session_attribute_flag_values,
"none",
- EXTRACT_8BITS((obj_tptr + 2))),
- EXTRACT_8BITS(obj_tptr + 2)));
- obj_tlen-=4+EXTRACT_8BITS((obj_tptr + 3));
- obj_tptr+=4+EXTRACT_8BITS((obj_tptr + 3));
+ EXTRACT_U_1((obj_tptr + 2))),
+ EXTRACT_U_1(obj_tptr + 2)));
+ obj_tlen-=4+EXTRACT_U_1((obj_tptr + 3));
+ obj_tptr+=4+EXTRACT_U_1((obj_tptr + 3));
break;
default:
hexdump=TRUE;
*/
if (total_subobj_len < 4)
goto invalid;
- subobj_len = EXTRACT_BE_16BITS(obj_tptr);
- subobj_type = (EXTRACT_BE_16BITS(obj_tptr + 2))>>8;
- af = (EXTRACT_BE_16BITS(obj_tptr + 2))&0x00FF;
+ subobj_len = EXTRACT_BE_U_2(obj_tptr);
+ subobj_type = (EXTRACT_BE_U_2(obj_tptr + 2))>>8;
+ af = (EXTRACT_BE_U_2(obj_tptr + 2))&0x00FF;
ND_PRINT((ndo, "%s Subobject Type: %s (%u), AF: %s (%u), length: %u",
indent,
ND_PRINT((ndo, "%s U-bit: %x, Label type: %u, Logical port id: %u, Label: %u",
indent,
- ((EXTRACT_BE_32BITS(obj_tptr + 4))>>31),
- ((EXTRACT_BE_32BITS(obj_tptr + 4))&0xFF),
- EXTRACT_BE_32BITS(obj_tptr + 8),
- EXTRACT_BE_32BITS(obj_tptr + 12)));
+ ((EXTRACT_BE_U_4(obj_tptr + 4))>>31),
+ ((EXTRACT_BE_U_4(obj_tptr + 4))&0xFF),
+ EXTRACT_BE_U_4(obj_tptr + 8),
+ EXTRACT_BE_U_4(obj_tptr + 12)));
break;
case RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL:
}
ND_PRINT((ndo, "%s Service level: %u",
- indent, (EXTRACT_BE_32BITS(obj_tptr + 4)) >> 24));
+ indent, (EXTRACT_BE_U_4(obj_tptr + 4)) >> 24));
break;
default:
ND_PRINT((ndo, "%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_BE_32BITS(obj_tptr + 4)));
+ EXTRACT_BE_U_4(obj_tptr + 4)));
obj_tlen-=8;
obj_tptr+=8;
if (obj_tlen)
ND_PRINT((ndo, "%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
indent,
ip6addr_string(ndo, obj_tptr),
- EXTRACT_BE_32BITS(obj_tptr + 16)));
+ EXTRACT_BE_U_4(obj_tptr + 16)));
obj_tlen-=20;
obj_tptr+=20;
hexdump=TRUE; /* unless we have a TLV parser lets just hexdump */
return-1;
ND_PRINT((ndo, "%s Refresh Period: %ums",
indent,
- EXTRACT_BE_32BITS(obj_tptr)));
+ EXTRACT_BE_U_4(obj_tptr)));
obj_tlen-=4;
obj_tptr+=4;
break;
return-1;
ND_PRINT((ndo, "%s Msg-Version: %u, length: %u",
indent,
- (EXTRACT_8BITS(obj_tptr) & 0xf0) >> 4,
- EXTRACT_BE_16BITS(obj_tptr + 2) << 2));
+ (EXTRACT_U_1(obj_tptr) & 0xf0) >> 4,
+ EXTRACT_BE_U_2(obj_tptr + 2) << 2));
obj_tptr+=4; /* get to the start of the service header */
obj_tlen-=4;
while (obj_tlen >= 4) {
- intserv_serv_tlen=EXTRACT_BE_16BITS(obj_tptr + 2)<<2;
+ intserv_serv_tlen=EXTRACT_BE_U_2(obj_tptr + 2)<<2;
ND_PRINT((ndo, "%s Service Type: %s (%u), break bit %s set, Service length: %u",
indent,
- tok2str(rsvp_intserv_service_type_values,"unknown",EXTRACT_8BITS((obj_tptr))),
- EXTRACT_8BITS(obj_tptr),
- (EXTRACT_8BITS(obj_tptr+1)&0x80) ? "" : "not",
+ tok2str(rsvp_intserv_service_type_values,"unknown",EXTRACT_U_1((obj_tptr))),
+ EXTRACT_U_1(obj_tptr),
+ (EXTRACT_U_1(obj_tptr + 1)&0x80) ? "" : "not",
intserv_serv_tlen));
obj_tptr+=4; /* get to the start of the parameter list */
ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 6)));
+ EXTRACT_BE_U_2(obj_tptr + 6)));
obj_tlen-=8;
obj_tptr+=8;
break;
ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u",
indent,
ip6addr_string(ndo, obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 18)));
+ EXTRACT_BE_U_2(obj_tptr + 18)));
obj_tlen-=20;
obj_tptr+=20;
break;
ND_PRINT((ndo, "%s Source Address: %s, Flow Label: %u",
indent,
ip6addr_string(ndo, obj_tptr),
- EXTRACT_BE_24BITS(obj_tptr + 17)));
+ EXTRACT_BE_U_3(obj_tptr + 17)));
obj_tlen-=20;
obj_tptr+=20;
break;
ND_PRINT((ndo, "%s Source Address: %s, LSP-ID: 0x%04x",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 18)));
+ EXTRACT_BE_U_2(obj_tptr + 18)));
obj_tlen-=20;
obj_tptr+=20;
break;
"%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
indent,
ip6addr_string(ndo, obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 18),
+ EXTRACT_BE_U_2(obj_tptr + 18),
indent,
ip6addr_string(ndo, obj_tptr+20),
- EXTRACT_BE_16BITS(obj_tptr + 38)));
+ EXTRACT_BE_U_2(obj_tptr + 38)));
obj_tlen-=40;
obj_tptr+=40;
break;
ND_PRINT((ndo, "%s Source Address: %s, LSP-ID: 0x%04x",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 6)));
+ EXTRACT_BE_U_2(obj_tptr + 6)));
obj_tlen-=8;
obj_tptr+=8;
break;
"%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_BE_16BITS(obj_tptr + 6),
+ EXTRACT_BE_U_2(obj_tptr + 6),
indent,
ipaddr_string(ndo, obj_tptr+8),
- EXTRACT_BE_16BITS(obj_tptr + 12)));
+ EXTRACT_BE_U_2(obj_tptr + 12)));
obj_tlen-=16;
obj_tptr+=16;
break;
case RSVP_CTYPE_1: /* new style */
if (obj_tlen < sizeof(struct rsvp_obj_frr_t))
return-1;
- bw.i = EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->bandwidth);
+ bw.i = EXTRACT_BE_U_4(obj_ptr.rsvp_obj_frr->bandwidth);
ND_PRINT((ndo, "%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
indent,
obj_ptr.rsvp_obj_frr->setup_prio,
bw.f * 8 / 1000000));
ND_PRINT((ndo, "%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
indent,
- EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->include_any),
- EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->exclude_any),
- EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->include_all)));
+ EXTRACT_BE_U_4(obj_ptr.rsvp_obj_frr->include_any),
+ EXTRACT_BE_U_4(obj_ptr.rsvp_obj_frr->exclude_any),
+ EXTRACT_BE_U_4(obj_ptr.rsvp_obj_frr->include_all)));
obj_tlen-=sizeof(struct rsvp_obj_frr_t);
obj_tptr+=sizeof(struct rsvp_obj_frr_t);
break;
case RSVP_CTYPE_TUNNEL_IPV4: /* old style */
if (obj_tlen < 16)
return-1;
- bw.i = EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->bandwidth);
+ bw.i = EXTRACT_BE_U_4(obj_ptr.rsvp_obj_frr->bandwidth);
ND_PRINT((ndo, "%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
indent,
obj_ptr.rsvp_obj_frr->setup_prio,
bw.f * 8 / 1000000));
ND_PRINT((ndo, "%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
indent,
- EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->include_any),
- EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->exclude_any)));
+ EXTRACT_BE_U_4(obj_ptr.rsvp_obj_frr->include_any),
+ EXTRACT_BE_U_4(obj_ptr.rsvp_obj_frr->exclude_any)));
obj_tlen-=16;
obj_tptr+=16;
break;
case RSVP_CTYPE_1:
ND_PRINT((ndo, "%s CT: %u",
indent,
- EXTRACT_BE_32BITS(obj_tptr) & 0x7));
+ EXTRACT_BE_U_4(obj_tptr) & 0x7));
obj_tlen-=4;
obj_tptr+=4;
break;
case RSVP_CTYPE_IPV4:
if (obj_tlen < 8)
return-1;
- error_code=EXTRACT_8BITS(obj_tptr + 5);
- error_value=EXTRACT_BE_16BITS(obj_tptr + 6);
+ error_code=EXTRACT_U_1(obj_tptr + 5);
+ error_value=EXTRACT_BE_U_2(obj_tptr + 6);
ND_PRINT((ndo, "%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_8BITS(obj_tptr+4),
+ EXTRACT_U_1(obj_tptr + 4),
indent,
tok2str(rsvp_obj_error_code_values,"unknown",error_code),
error_code));
case RSVP_CTYPE_IPV6:
if (obj_tlen < 20)
return-1;
- error_code=EXTRACT_8BITS(obj_tptr + 17);
- error_value=EXTRACT_BE_16BITS(obj_tptr + 18);
+ error_code=EXTRACT_U_1(obj_tptr + 17);
+ error_value=EXTRACT_BE_U_2(obj_tptr + 18);
ND_PRINT((ndo, "%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
indent,
ip6addr_string(ndo, obj_tptr),
- EXTRACT_8BITS(obj_tptr+16),
+ EXTRACT_U_1(obj_tptr + 16),
indent,
tok2str(rsvp_obj_error_code_values,"unknown",error_code),
error_code));
case RSVP_CTYPE_1:
if (obj_tlen < 4)
return-1;
- padbytes = EXTRACT_BE_16BITS(obj_tptr + 2);
+ padbytes = EXTRACT_BE_U_2(obj_tptr + 2);
ND_PRINT((ndo, "%s TLV count: %u, padding bytes: %u",
indent,
- EXTRACT_BE_16BITS(obj_tptr),
+ EXTRACT_BE_U_2(obj_tptr),
padbytes));
obj_tlen-=4;
obj_tptr+=4;
while(obj_tlen >= 2 + padbytes) {
ND_PRINT((ndo, "%s %s TLV (0x%02x), length: %u", /* length includes header */
indent,
- tok2str(rsvp_obj_prop_tlv_values,"unknown",EXTRACT_8BITS(obj_tptr)),
- EXTRACT_8BITS(obj_tptr),
- EXTRACT_8BITS(obj_tptr + 1)));
- if (obj_tlen < EXTRACT_8BITS((obj_tptr + 1)))
+ tok2str(rsvp_obj_prop_tlv_values,"unknown",EXTRACT_U_1(obj_tptr)),
+ EXTRACT_U_1(obj_tptr),
+ EXTRACT_U_1(obj_tptr + 1)));
+ if (obj_tlen < EXTRACT_U_1((obj_tptr + 1)))
return-1;
- if (EXTRACT_8BITS(obj_tptr+1) < 2)
+ if (EXTRACT_U_1(obj_tptr + 1) < 2)
return -1;
- print_unknown_data(ndo, obj_tptr + 2, "\n\t\t", EXTRACT_8BITS(obj_tptr + 1) - 2);
- obj_tlen-=EXTRACT_8BITS(obj_tptr + 1);
- obj_tptr+=EXTRACT_8BITS(obj_tptr + 1);
+ print_unknown_data(ndo, obj_tptr + 2, "\n\t\t",
+ EXTRACT_U_1(obj_tptr + 1) - 2);
+ obj_tlen-=EXTRACT_U_1(obj_tptr + 1);
+ obj_tptr+=EXTRACT_U_1(obj_tptr + 1);
}
break;
default:
return-1;
ND_PRINT((ndo, "%s Flags [0x%02x], epoch: %u",
indent,
- EXTRACT_8BITS(obj_tptr),
- EXTRACT_BE_24BITS(obj_tptr + 1)));
+ EXTRACT_U_1(obj_tptr),
+ EXTRACT_BE_U_3(obj_tptr + 1)));
obj_tlen-=4;
obj_tptr+=4;
/* loop through as long there are no messages left */
while(obj_tlen >= 4) {
ND_PRINT((ndo, "%s Message-ID 0x%08x (%u)",
indent,
- EXTRACT_BE_32BITS(obj_tptr),
- EXTRACT_BE_32BITS(obj_tptr)));
+ EXTRACT_BE_U_4(obj_tptr),
+ EXTRACT_BE_U_4(obj_tptr)));
obj_tlen-=4;
obj_tptr+=4;
}
obj_ptr.rsvp_obj_integrity = (const struct rsvp_obj_integrity_t *)obj_tptr;
ND_PRINT((ndo, "%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]",
indent,
- EXTRACT_BE_16BITS(obj_ptr.rsvp_obj_integrity->key_id),
- EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->key_id + 2),
- EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->sequence),
- EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->sequence + 4),
+ EXTRACT_BE_U_2(obj_ptr.rsvp_obj_integrity->key_id),
+ EXTRACT_BE_U_4(obj_ptr.rsvp_obj_integrity->key_id + 2),
+ EXTRACT_BE_U_4(obj_ptr.rsvp_obj_integrity->sequence),
+ EXTRACT_BE_U_4(obj_ptr.rsvp_obj_integrity->sequence + 4),
bittok2str(rsvp_obj_integrity_flag_values,
"none",
obj_ptr.rsvp_obj_integrity->flags)));
ND_PRINT((ndo, "%s MD5-sum 0x%08x%08x%08x%08x ",
indent,
- EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->digest),
- EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->digest + 4),
- EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->digest + 8),
- EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->digest + 12)));
+ EXTRACT_BE_U_4(obj_ptr.rsvp_obj_integrity->digest),
+ EXTRACT_BE_U_4(obj_ptr.rsvp_obj_integrity->digest + 4),
+ EXTRACT_BE_U_4(obj_ptr.rsvp_obj_integrity->digest + 8),
+ EXTRACT_BE_U_4(obj_ptr.rsvp_obj_integrity->digest + 12)));
sigcheck = signature_verify(ndo, pptr, plen,
obj_ptr.rsvp_obj_integrity->digest,
return-1;
ND_PRINT((ndo, "%s Flags [%s]", indent,
bittok2str(rsvp_obj_admin_status_flag_values, "none",
- EXTRACT_BE_32BITS(obj_tptr))));
+ EXTRACT_BE_U_4(obj_tptr))));
obj_tlen-=4;
obj_tptr+=4;
break;
case RSVP_CTYPE_1:
if (obj_tlen < 4)
return-1;
- action = (EXTRACT_BE_16BITS(obj_tptr)>>8);
+ action = (EXTRACT_BE_U_2(obj_tptr)>>8);
ND_PRINT((ndo, "%s Action: %s (%u), Label type: %u", indent,
tok2str(rsvp_obj_label_set_action_values, "Unknown", action),
- action, ((EXTRACT_BE_32BITS(obj_tptr) & 0x7F))));
+ action, ((EXTRACT_BE_U_4(obj_tptr) & 0x7F))));
switch (action) {
case LABEL_SET_INCLUSIVE_RANGE:
if (obj_tlen < 12)
return -1;
ND_PRINT((ndo, "%s Start range: %u, End range: %u", indent,
- EXTRACT_BE_32BITS(obj_tptr + 4),
- EXTRACT_BE_32BITS(obj_tptr + 8)));
+ EXTRACT_BE_U_4(obj_tptr + 4),
+ EXTRACT_BE_U_4(obj_tptr + 8)));
obj_tlen-=12;
obj_tptr+=12;
break;
subchannel = 1;
while(obj_tlen >= 4 ) {
ND_PRINT((ndo, "%s Subchannel #%u: %u", indent, subchannel,
- EXTRACT_BE_32BITS(obj_tptr)));
+ EXTRACT_BE_U_4(obj_tptr)));
obj_tptr+=4;
obj_tlen-=4;
subchannel++;
/* ok they seem to want to know everything - lets fully decode it */
- plen = tlen = EXTRACT_BE_16BITS(rsvp_com_header->length);
+ plen = tlen = EXTRACT_BE_U_2(rsvp_com_header->length);
ND_PRINT((ndo, "\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags),
bittok2str(rsvp_header_flag_values,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header->version_flags)),
tlen,
rsvp_com_header->ttl,
- EXTRACT_BE_16BITS(rsvp_com_header->checksum)));
+ EXTRACT_BE_U_2(rsvp_com_header->checksum)));
if (tlen < sizeof(struct rsvp_common_header)) {
ND_PRINT((ndo, "ERROR: common header too short %u < %lu", tlen,
return;
}
- subplen = subtlen = EXTRACT_BE_16BITS(rsvp_com_header->length);
+ subplen = subtlen = EXTRACT_BE_U_2(rsvp_com_header->length);
ND_PRINT((ndo, "\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags),
bittok2str(rsvp_header_flag_values,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header->version_flags)),
subtlen,
rsvp_com_header->ttl,
- EXTRACT_BE_16BITS(rsvp_com_header->checksum)));
+ EXTRACT_BE_U_2(rsvp_com_header->checksum)));
if (subtlen < sizeof(struct rsvp_common_header)) {
ND_PRINT((ndo, "ERROR: common header too short %u < %lu", subtlen,
dp0 = (const struct ip6_rthdr0 *)dp;
ND_TCHECK(dp0->ip6r0_reserved);
- if (EXTRACT_BE_32BITS(dp0->ip6r0_reserved) || ndo->ndo_vflag) {
+ if (EXTRACT_BE_U_4(dp0->ip6r0_reserved) || ndo->ndo_vflag) {
ND_PRINT((ndo, ", rsv=0x%0x",
- EXTRACT_BE_32BITS(&dp0->ip6r0_reserved)));
+ EXTRACT_BE_U_4(&dp0->ip6r0_reserved)));
}
if (len % 2 == 1)
if (ndo->ndo_vflag > 1)
ND_PRINT((ndo, " cid %08x call# %u",
- EXTRACT_BE_32BITS(&rxh->cid),
- EXTRACT_BE_32BITS(&rxh->callNumber)));
+ EXTRACT_BE_U_4(&rxh->cid),
+ EXTRACT_BE_U_4(&rxh->callNumber)));
ND_PRINT((ndo, " seq %u ser %u",
- EXTRACT_BE_32BITS(&rxh->seq),
- EXTRACT_BE_32BITS(&rxh->serial)));
+ EXTRACT_BE_U_4(&rxh->seq),
+ EXTRACT_BE_U_4(&rxh->serial)));
if (ndo->ndo_vflag > 2)
ND_PRINT((ndo, " secindex %u serviceid %hu",
rxh->securityIndex,
- EXTRACT_BE_16BITS(&rxh->serviceId)));
+ EXTRACT_BE_U_2(&rxh->serviceId)));
if (ndo->ndo_vflag > 1)
for (i = 0; i < NUM_RX_FLAGS; i++) {
*/
if (rxh->type == RX_PACKET_TYPE_DATA &&
- EXTRACT_BE_32BITS(&rxh->seq) == 1 &&
+ EXTRACT_BE_U_4(&rxh->seq) == 1 &&
rxh->flags & RX_CLIENT_INITIATED) {
/*
*/
} else if (((rxh->type == RX_PACKET_TYPE_DATA &&
- EXTRACT_BE_32BITS(&rxh->seq) == 1) ||
+ EXTRACT_BE_U_4(&rxh->seq) == 1) ||
rxh->type == RX_PACKET_TYPE_ABORT) &&
(rxh->flags & RX_CLIENT_INITIATED) == 0 &&
rx_cache_find(rxh, (const struct ip *) bp2,
if (++rx_cache_next >= RX_CACHE_SIZE)
rx_cache_next = 0;
- rxent->callnum = EXTRACT_BE_32BITS(&rxh->callNumber);
+ rxent->callnum = EXTRACT_BE_U_4(&rxh->callNumber);
UNALIGNED_MEMCPY(&rxent->client, &ip->ip_src, sizeof(uint32_t));
UNALIGNED_MEMCPY(&rxent->server, &ip->ip_dst, sizeof(uint32_t));
rxent->dport = dport;
- rxent->serviceId = EXTRACT_BE_32BITS(&rxh->serviceId);
- rxent->opcode = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
+ rxent->serviceId = EXTRACT_BE_U_4(&rxh->serviceId);
+ rxent->opcode = EXTRACT_BE_U_4(bp + sizeof(struct rx_header));
}
/*
i = rx_cache_hint;
do {
rxent = &rx_cache[i];
- if (rxent->callnum == EXTRACT_BE_32BITS(&rxh->callNumber) &&
+ if (rxent->callnum == EXTRACT_BE_U_4(&rxh->callNumber) &&
rxent->client.s_addr == clip &&
rxent->server.s_addr == sip &&
- rxent->serviceId == EXTRACT_BE_32BITS(&rxh->serviceId) &&
+ rxent->serviceId == EXTRACT_BE_U_4(&rxh->serviceId) &&
rxent->dport == sport) {
/* We got a match! */
#define FIDOUT() { uint32_t n1, n2, n3; \
ND_TCHECK2(bp[0], sizeof(uint32_t) * 3); \
- n1 = EXTRACT_BE_32BITS(bp); \
+ n1 = EXTRACT_BE_U_4(bp); \
bp += sizeof(uint32_t); \
- n2 = EXTRACT_BE_32BITS(bp); \
+ n2 = EXTRACT_BE_U_4(bp); \
bp += sizeof(uint32_t); \
- n3 = EXTRACT_BE_32BITS(bp); \
+ n3 = EXTRACT_BE_U_4(bp); \
bp += sizeof(uint32_t); \
ND_PRINT((ndo, " fid %u/%u/%u", n1, n2, n3)); \
}
#define STROUT(MAX) { uint32_t _i; \
ND_TCHECK2(bp[0], sizeof(uint32_t)); \
- _i = EXTRACT_BE_32BITS(bp); \
+ _i = EXTRACT_BE_U_4(bp); \
if (_i > (MAX)) \
goto trunc; \
bp += sizeof(uint32_t); \
#define INTOUT() { int32_t _i; \
ND_TCHECK_4(bp); \
- _i = EXTRACT_BE_INT32(bp); \
+ _i = EXTRACT_BE_S_4(bp); \
bp += sizeof(int32_t); \
ND_PRINT((ndo, " %d", _i)); \
}
#define UINTOUT() { uint32_t _i; \
ND_TCHECK_4(bp); \
- _i = EXTRACT_BE_32BITS(bp); \
+ _i = EXTRACT_BE_U_4(bp); \
bp += sizeof(uint32_t); \
ND_PRINT((ndo, " %u", _i)); \
}
#define UINT64OUT() { uint64_t _i; \
ND_TCHECK2(bp[0], sizeof(uint64_t)); \
- _i = EXTRACT_BE_64BITS(bp); \
+ _i = EXTRACT_BE_U_8(bp); \
bp += sizeof(uint64_t); \
ND_PRINT((ndo, " %" PRIu64, _i)); \
}
#define DATEOUT() { time_t _t; struct tm *tm; char str[256]; \
ND_TCHECK_4(bp); \
- _t = (time_t) EXTRACT_BE_INT32(bp); \
+ _t = (time_t) EXTRACT_BE_S_4(bp); \
bp += sizeof(int32_t); \
tm = localtime(&_t); \
strftime(str, 256, "%Y/%m/%d %H:%M:%S", tm); \
#define STOREATTROUT() { uint32_t mask, _i; \
ND_TCHECK2(bp[0], (sizeof(uint32_t)*6)); \
- mask = EXTRACT_BE_32BITS(bp); bp += sizeof(uint32_t); \
+ mask = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \
if (mask) ND_PRINT((ndo, " StoreStatus")); \
if (mask & 1) { ND_PRINT((ndo, " date")); DATEOUT(); } \
else bp += sizeof(uint32_t); \
- _i = EXTRACT_BE_32BITS(bp); bp += sizeof(uint32_t); \
+ _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \
if (mask & 2) ND_PRINT((ndo, " owner %u", _i)); \
- _i = EXTRACT_BE_32BITS(bp); bp += sizeof(uint32_t); \
+ _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \
if (mask & 4) ND_PRINT((ndo, " group %u", _i)); \
- _i = EXTRACT_BE_32BITS(bp); bp += sizeof(uint32_t); \
+ _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \
if (mask & 8) ND_PRINT((ndo, " mode %o", _i & 07777)); \
- _i = EXTRACT_BE_32BITS(bp); bp += sizeof(uint32_t); \
+ _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \
if (mask & 16) ND_PRINT((ndo, " segsize %u", _i)); \
/* undocumented in 3.3 docu */ \
if (mask & 1024) ND_PRINT((ndo, " fsync")); \
#define UBIK_VERSIONOUT() {uint32_t epoch; uint32_t counter; \
ND_TCHECK2(bp[0], sizeof(uint32_t) * 2); \
- epoch = EXTRACT_BE_32BITS(bp); \
+ epoch = EXTRACT_BE_U_4(bp); \
bp += sizeof(uint32_t); \
- counter = EXTRACT_BE_32BITS(bp); \
+ counter = EXTRACT_BE_U_4(bp); \
bp += sizeof(uint32_t); \
ND_PRINT((ndo, " %u.%u", epoch, counter)); \
}
#define AFSUUIDOUT() {uint32_t temp; int _i; \
ND_TCHECK2(bp[0], 11*sizeof(uint32_t)); \
- temp = EXTRACT_BE_32BITS(bp); \
+ temp = EXTRACT_BE_U_4(bp); \
bp += sizeof(uint32_t); \
ND_PRINT((ndo, " %08x", temp)); \
- temp = EXTRACT_BE_32BITS(bp); \
+ temp = EXTRACT_BE_U_4(bp); \
bp += sizeof(uint32_t); \
ND_PRINT((ndo, "%04x", temp)); \
- temp = EXTRACT_BE_32BITS(bp); \
+ temp = EXTRACT_BE_U_4(bp); \
bp += sizeof(uint32_t); \
ND_PRINT((ndo, "%04x", temp)); \
for (_i = 0; _i < 8; _i++) { \
- temp = EXTRACT_BE_32BITS(bp); \
+ temp = EXTRACT_BE_U_4(bp); \
bp += sizeof(uint32_t); \
ND_PRINT((ndo, "%02x", (unsigned char) temp)); \
} \
ND_TCHECK2(bp[0], (MAX) * sizeof(uint32_t)); \
sp = s; \
for (k = 0; k < (MAX); k++) { \
- *sp++ = (u_char) EXTRACT_BE_32BITS(bp); \
+ *sp++ = (u_char) EXTRACT_BE_U_4(bp); \
bp += sizeof(uint32_t); \
} \
s[(MAX)] = '\0'; \
#define DESTSERVEROUT() { uint32_t n1, n2, n3; \
ND_TCHECK2(bp[0], sizeof(uint32_t) * 3); \
- n1 = EXTRACT_BE_32BITS(bp); \
+ n1 = EXTRACT_BE_U_4(bp); \
bp += sizeof(uint32_t); \
- n2 = EXTRACT_BE_32BITS(bp); \
+ n2 = EXTRACT_BE_U_4(bp); \
bp += sizeof(uint32_t); \
- n3 = EXTRACT_BE_32BITS(bp); \
+ n3 = EXTRACT_BE_U_4(bp); \
bp += sizeof(uint32_t); \
ND_PRINT((ndo, " server %u:%u:%u", n1, n2, n3)); \
}
*/
ND_TCHECK_4(bp + sizeof(struct rx_header));
- fs_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
+ fs_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " fs call %s", tok2str(fs_req, "op#%u", fs_op)));
char a[AFSOPAQUEMAX+1];
FIDOUT();
ND_TCHECK2(bp[0], 4);
- i = EXTRACT_BE_32BITS(bp);
+ i = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
ND_TCHECK2(bp[0], i);
i = min(AFSOPAQUEMAX, i);
{
uint32_t j;
ND_TCHECK_4(bp);
- j = EXTRACT_BE_32BITS(bp);
+ j = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
for (i = 0; i < j; i++) {
{
char a[AFSOPAQUEMAX+1];
ND_TCHECK_4(bp);
- i = EXTRACT_BE_32BITS(bp);
+ i = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
ND_TCHECK2(bp[0], i);
i = min(AFSOPAQUEMAX, i);
int32_t errcode;
ND_TCHECK_4(bp);
- errcode = EXTRACT_BE_INT32(bp);
+ errcode = EXTRACT_BE_S_4(bp);
bp += sizeof(int32_t);
ND_PRINT((ndo, " error %s", tok2str(afs_fs_errors, "#%d", errcode)));
*/
ND_TCHECK_4(bp + sizeof(struct rx_header));
- cb_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
+ cb_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " cb call %s", tok2str(cb_req, "op#%u", cb_op)));
{
uint32_t j, t;
ND_TCHECK_4(bp);
- j = EXTRACT_BE_32BITS(bp);
+ j = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
for (i = 0; i < j; i++) {
ND_PRINT((ndo, " <none!>"));
ND_TCHECK_4(bp);
- j = EXTRACT_BE_32BITS(bp);
+ j = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
if (j != 0)
ND_PRINT((ndo, " expires"));
DATEOUT();
ND_TCHECK_4(bp);
- t = EXTRACT_BE_32BITS(bp);
+ t = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
tok2str(cb_types, "type %u", t);
}
*/
ND_TCHECK_4(bp + sizeof(struct rx_header));
- pt_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
+ pt_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " pt"));
{
uint32_t j;
ND_TCHECK_4(bp);
- j = EXTRACT_BE_32BITS(bp);
+ j = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
/*
uint32_t j;
ND_PRINT((ndo, " ids:"));
ND_TCHECK_4(bp);
- i = EXTRACT_BE_32BITS(bp);
+ i = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
for (j = 0; j < i; j++)
INTOUT();
uint32_t j;
ND_PRINT((ndo, " ids:"));
ND_TCHECK_4(bp);
- i = EXTRACT_BE_32BITS(bp);
+ i = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
for (j = 0; j < i; j++)
INTOUT();
{
uint32_t j;
ND_TCHECK_4(bp);
- j = EXTRACT_BE_32BITS(bp);
+ j = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
/*
{
uint32_t j;
ND_TCHECK_4(bp);
- j = EXTRACT_BE_32BITS(bp);
+ j = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
for (i = 0; i < j; i++) {
INTOUT();
*/
ND_TCHECK_4(bp + sizeof(struct rx_header));
- vldb_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
+ vldb_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " vldb"));
ND_PRINT((ndo, " volid"));
INTOUT();
ND_TCHECK_4(bp);
- i = EXTRACT_BE_32BITS(bp);
+ i = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
if (i <= 2)
ND_PRINT((ndo, " type %s", voltype[i]));
ND_PRINT((ndo, " volid"));
INTOUT();
ND_TCHECK_4(bp);
- i = EXTRACT_BE_32BITS(bp);
+ i = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
if (i <= 2)
ND_PRINT((ndo, " type %s", voltype[i]));
bp += sizeof(uint32_t);
ND_PRINT((ndo, " numservers"));
ND_TCHECK_4(bp);
- nservers = EXTRACT_BE_32BITS(bp);
+ nservers = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
ND_PRINT((ndo, " %u", nservers));
ND_PRINT((ndo, " servers"));
ND_PRINT((ndo, " partitions"));
for (i = 0; i < 8; i++) {
ND_TCHECK_4(bp);
- j = EXTRACT_BE_32BITS(bp);
+ j = EXTRACT_BE_U_4(bp);
if (i < nservers && j <= 26)
ND_PRINT((ndo, " %c", 'a' + j));
else if (i < nservers)
VECOUT(VLNAMEMAX);
ND_PRINT((ndo, " numservers"));
ND_TCHECK_4(bp);
- nservers = EXTRACT_BE_32BITS(bp);
+ nservers = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
ND_PRINT((ndo, " %u", nservers));
ND_PRINT((ndo, " servers"));
ND_PRINT((ndo, " partitions"));
for (i = 0; i < 13; i++) {
ND_TCHECK_4(bp);
- j = EXTRACT_BE_32BITS(bp);
+ j = EXTRACT_BE_U_4(bp);
if (i < nservers && j <= 26)
ND_PRINT((ndo, " %c", 'a' + j));
else if (i < nservers)
VECOUT(VLNAMEMAX);
ND_PRINT((ndo, " numservers"));
ND_TCHECK_4(bp);
- nservers = EXTRACT_BE_32BITS(bp);
+ nservers = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
ND_PRINT((ndo, " %u", nservers));
ND_PRINT((ndo, " servers"));
ND_PRINT((ndo, " partitions"));
for (i = 0; i < 13; i++) {
ND_TCHECK_4(bp);
- j = EXTRACT_BE_32BITS(bp);
+ j = EXTRACT_BE_U_4(bp);
if (i < nservers && j <= 26)
ND_PRINT((ndo, " %c", 'a' + j));
else if (i < nservers)
*/
ND_TCHECK_4(bp + sizeof(struct rx_header));
- kauth_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
+ kauth_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " kauth"));
ND_PRINT((ndo, " domain"));
STROUT(KANAMEMAX);
ND_TCHECK_4(bp);
- i = EXTRACT_BE_32BITS(bp);
+ i = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
ND_TCHECK2(bp[0], i);
bp += i;
*/
ND_TCHECK_4(bp + sizeof(struct rx_header));
- vol_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
+ vol_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " vol call %s", tok2str(vol_req, "op#%u", vol_op)));
{
uint32_t i, j;
ND_TCHECK_4(bp);
- j = EXTRACT_BE_32BITS(bp);
+ j = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
for (i = 0; i < j; i++) {
DESTSERVEROUT();
{
uint32_t i, j;
ND_TCHECK_4(bp);
- j = EXTRACT_BE_32BITS(bp);
+ j = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
for (i = 0; i < j; i++) {
ND_PRINT((ndo, " name"));
*/
ND_TCHECK_4(bp + sizeof(struct rx_header));
- bos_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
+ bos_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " bos call %s", tok2str(bos_req, "op#%u", bos_op)));
* for (sizeof(rx_header) + 4) bytes, so long as it remains this way
* the line below will not over-read.
*/
- ubik_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
+ ubik_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " ubik call %s", tok2str(ubik_req, "op#%u", ubik_op)));
switch (ubik_op) {
case 10000: /* Beacon */
ND_TCHECK_4(bp);
- temp = EXTRACT_BE_32BITS(bp);
+ temp = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
ND_PRINT((ndo, " syncsite %s", temp ? "yes" : "no"));
ND_PRINT((ndo, " votestart"));
ND_PRINT((ndo, " length"));
INTOUT();
ND_TCHECK_4(bp);
- temp = EXTRACT_BE_32BITS(bp);
+ temp = EXTRACT_BE_U_4(bp);
bp += sizeof(uint32_t);
tok2str(ubik_lock_types, "type %u", temp);
break;
if (ndo->ndo_vflag > 2)
ND_PRINT((ndo, " bufspace %u maxskew %d",
- EXTRACT_BE_16BITS(&rxa->bufferSpace),
- EXTRACT_BE_16BITS(&rxa->maxSkew)));
+ EXTRACT_BE_U_2(&rxa->bufferSpace),
+ EXTRACT_BE_U_2(&rxa->maxSkew)));
- firstPacket = EXTRACT_BE_32BITS(&rxa->firstPacket);
+ firstPacket = EXTRACT_BE_U_4(&rxa->firstPacket);
ND_PRINT((ndo, " first %u serial %u reason %s",
- firstPacket, EXTRACT_BE_32BITS(&rxa->serial),
+ firstPacket, EXTRACT_BE_U_4(&rxa->serial),
tok2str(rx_ack_reasons, "#%u", rxa->reason)));
/*
ND_TCHECK(*sctpPktHdr);
sctpPacketLengthRemaining = sctpPacketLength;
- sourcePort = EXTRACT_BE_16BITS(&sctpPktHdr->source);
- destPort = EXTRACT_BE_16BITS(&sctpPktHdr->destination);
+ sourcePort = EXTRACT_BE_U_2(&sctpPktHdr->source);
+ destPort = EXTRACT_BE_U_2(&sctpPktHdr->destination);
ip = (const struct ip *)bp2;
if (IP_V(ip) == 6)
break;
}
ND_TCHECK(*chunkDescPtr);
- chunkLength = EXTRACT_BE_16BITS(&chunkDescPtr->chunkLength);
+ chunkLength = EXTRACT_BE_U_2(&chunkDescPtr->chunkLength);
if (chunkLength < sizeof(*chunkDescPtr)) {
ND_PRINT((ndo, "%s%d) [Bad chunk length %u, < size of chunk descriptor]", sep, chunkCount+1, chunkLength));
break;
}
dataHdrPtr=(const struct sctpDataPart*)bp;
- ppid = EXTRACT_BE_32BITS(&dataHdrPtr->payloadtype);
- ND_PRINT((ndo, "[TSN: %u] ", EXTRACT_BE_32BITS(&dataHdrPtr->TSN)));
- ND_PRINT((ndo, "[SID: %u] ", EXTRACT_BE_16BITS(&dataHdrPtr->streamId)));
- ND_PRINT((ndo, "[SSEQ %u] ", EXTRACT_BE_16BITS(&dataHdrPtr->sequence)));
+ ppid = EXTRACT_BE_U_4(&dataHdrPtr->payloadtype);
+ ND_PRINT((ndo, "[TSN: %u] ", EXTRACT_BE_U_4(&dataHdrPtr->TSN)));
+ ND_PRINT((ndo, "[SID: %u] ", EXTRACT_BE_U_2(&dataHdrPtr->streamId)));
+ ND_PRINT((ndo, "[SSEQ %u] ", EXTRACT_BE_U_2(&dataHdrPtr->sequence)));
ND_PRINT((ndo, "[PPID %s] ",
tok2str(PayloadProto_idents, "0x%x", ppid)));
return;
}
init=(const struct sctpInitiation*)bp;
- ND_PRINT((ndo, "[init tag: %u] ", EXTRACT_BE_32BITS(&init->initTag)));
- ND_PRINT((ndo, "[rwnd: %u] ", EXTRACT_BE_32BITS(&init->rcvWindowCredit)));
- ND_PRINT((ndo, "[OS: %u] ", EXTRACT_BE_16BITS(&init->NumPreopenStreams)));
- ND_PRINT((ndo, "[MIS: %u] ", EXTRACT_BE_16BITS(&init->MaxInboundStreams)));
- ND_PRINT((ndo, "[init TSN: %u] ", EXTRACT_BE_32BITS(&init->initialTSN)));
+ ND_PRINT((ndo, "[init tag: %u] ", EXTRACT_BE_U_4(&init->initTag)));
+ ND_PRINT((ndo, "[rwnd: %u] ", EXTRACT_BE_U_4(&init->rcvWindowCredit)));
+ ND_PRINT((ndo, "[OS: %u] ", EXTRACT_BE_U_2(&init->NumPreopenStreams)));
+ ND_PRINT((ndo, "[MIS: %u] ", EXTRACT_BE_U_2(&init->MaxInboundStreams)));
+ ND_PRINT((ndo, "[init TSN: %u] ", EXTRACT_BE_U_4(&init->initialTSN)));
bp += sizeof(*init);
sctpPacketLengthRemaining -= sizeof(*init);
chunkLengthRemaining -= sizeof(*init);
return;
}
init=(const struct sctpInitiation*)bp;
- ND_PRINT((ndo, "[init tag: %u] ", EXTRACT_BE_32BITS(&init->initTag)));
- ND_PRINT((ndo, "[rwnd: %u] ", EXTRACT_BE_32BITS(&init->rcvWindowCredit)));
- ND_PRINT((ndo, "[OS: %u] ", EXTRACT_BE_16BITS(&init->NumPreopenStreams)));
- ND_PRINT((ndo, "[MIS: %u] ", EXTRACT_BE_16BITS(&init->MaxInboundStreams)));
- ND_PRINT((ndo, "[init TSN: %u] ", EXTRACT_BE_32BITS(&init->initialTSN)));
+ ND_PRINT((ndo, "[init tag: %u] ", EXTRACT_BE_U_4(&init->initTag)));
+ ND_PRINT((ndo, "[rwnd: %u] ", EXTRACT_BE_U_4(&init->rcvWindowCredit)));
+ ND_PRINT((ndo, "[OS: %u] ", EXTRACT_BE_U_2(&init->NumPreopenStreams)));
+ ND_PRINT((ndo, "[MIS: %u] ", EXTRACT_BE_U_2(&init->MaxInboundStreams)));
+ ND_PRINT((ndo, "[init TSN: %u] ", EXTRACT_BE_U_4(&init->initialTSN)));
bp += sizeof(*init);
sctpPacketLengthRemaining -= sizeof(*init);
chunkLengthRemaining -= sizeof(*init);
return;
}
sack=(const struct sctpSelectiveAck*)bp;
- ND_PRINT((ndo, "[cum ack %u] ", EXTRACT_BE_32BITS(&sack->highestConseqTSN)));
- ND_PRINT((ndo, "[a_rwnd %u] ", EXTRACT_BE_32BITS(&sack->updatedRwnd)));
- ND_PRINT((ndo, "[#gap acks %u] ", EXTRACT_BE_16BITS(&sack->numberOfdesc)));
- ND_PRINT((ndo, "[#dup tsns %u] ", EXTRACT_BE_16BITS(&sack->numDupTsns)));
+ ND_PRINT((ndo, "[cum ack %u] ", EXTRACT_BE_U_4(&sack->highestConseqTSN)));
+ ND_PRINT((ndo, "[a_rwnd %u] ", EXTRACT_BE_U_4(&sack->updatedRwnd)));
+ ND_PRINT((ndo, "[#gap acks %u] ", EXTRACT_BE_U_2(&sack->numberOfdesc)));
+ ND_PRINT((ndo, "[#dup tsns %u] ", EXTRACT_BE_U_2(&sack->numDupTsns)));
bp += sizeof(*sack);
sctpPacketLengthRemaining -= sizeof(*sack);
chunkLengthRemaining -= sizeof(*sack);
/* print gaps */
for (fragNo=0;
- chunkLengthRemaining != 0 && fragNo < EXTRACT_BE_16BITS(&sack->numberOfdesc);
+ chunkLengthRemaining != 0 && fragNo < EXTRACT_BE_U_2(&sack->numberOfdesc);
bp += sizeof(*frag), sctpPacketLengthRemaining -= sizeof(*frag), chunkLengthRemaining -= sizeof(*frag), fragNo++) {
if (chunkLengthRemaining < sizeof(*frag)) {
ND_PRINT((ndo, "bogus chunk length %u]", chunkLength));
frag = (const struct sctpSelectiveFrag *)bp;
ND_PRINT((ndo, "\n\t\t[gap ack block #%d: start = %u, end = %u] ",
fragNo+1,
- EXTRACT_BE_32BITS(&sack->highestConseqTSN) + EXTRACT_BE_16BITS(&frag->fragmentStart),
- EXTRACT_BE_32BITS(&sack->highestConseqTSN) + EXTRACT_BE_16BITS(&frag->fragmentEnd)));
+ EXTRACT_BE_U_4(&sack->highestConseqTSN) + EXTRACT_BE_U_2(&frag->fragmentStart),
+ EXTRACT_BE_U_4(&sack->highestConseqTSN) + EXTRACT_BE_U_2(&frag->fragmentEnd)));
}
/* print duplicate TSNs */
for (tsnNo=0;
- chunkLengthRemaining != 0 && tsnNo<EXTRACT_BE_16BITS(&sack->numDupTsns);
+ chunkLengthRemaining != 0 && tsnNo<EXTRACT_BE_U_2(&sack->numDupTsns);
bp += 4, sctpPacketLengthRemaining -= 4, chunkLengthRemaining -= 4, tsnNo++) {
if (chunkLengthRemaining < 4) {
ND_PRINT((ndo, "bogus chunk length %u]", chunkLength));
}
dupTSN = (const u_char *)bp;
ND_PRINT((ndo, "\n\t\t[dup TSN #%u: %u] ", tsnNo+1,
- EXTRACT_BE_32BITS(dupTSN)));
+ EXTRACT_BE_U_4(dupTSN)));
}
break;
}
sflow_gen_counter = (const struct sflow_generic_counter_t *)pointer;
ND_TCHECK(*sflow_gen_counter);
ND_PRINT((ndo, "\n\t ifindex %u, iftype %u, ifspeed %" PRIu64 ", ifdirection %u (%s)",
- EXTRACT_BE_32BITS(sflow_gen_counter->ifindex),
- EXTRACT_BE_32BITS(sflow_gen_counter->iftype),
- EXTRACT_BE_64BITS(sflow_gen_counter->ifspeed),
- EXTRACT_BE_32BITS(sflow_gen_counter->ifdirection),
+ EXTRACT_BE_U_4(sflow_gen_counter->ifindex),
+ EXTRACT_BE_U_4(sflow_gen_counter->iftype),
+ EXTRACT_BE_U_8(sflow_gen_counter->ifspeed),
+ EXTRACT_BE_U_4(sflow_gen_counter->ifdirection),
tok2str(sflow_iface_direction_values, "Unknown",
- EXTRACT_BE_32BITS(sflow_gen_counter->ifdirection))));
+ EXTRACT_BE_U_4(sflow_gen_counter->ifdirection))));
ND_PRINT((ndo, "\n\t ifstatus %u, adminstatus: %s, operstatus: %s",
- EXTRACT_BE_32BITS(sflow_gen_counter->ifstatus),
- EXTRACT_BE_32BITS(sflow_gen_counter->ifstatus)&1 ? "up" : "down",
- (EXTRACT_BE_32BITS(sflow_gen_counter->ifstatus)>>1)&1 ? "up" : "down"));
+ EXTRACT_BE_U_4(sflow_gen_counter->ifstatus),
+ EXTRACT_BE_U_4(sflow_gen_counter->ifstatus)&1 ? "up" : "down",
+ (EXTRACT_BE_U_4(sflow_gen_counter->ifstatus)>>1)&1 ? "up" : "down"));
ND_PRINT((ndo, "\n\t In octets %" PRIu64
", unicast pkts %u, multicast pkts %u, broadcast pkts %u, discards %u",
- EXTRACT_BE_64BITS(sflow_gen_counter->ifinoctets),
- EXTRACT_BE_32BITS(sflow_gen_counter->ifinunicastpkts),
- EXTRACT_BE_32BITS(sflow_gen_counter->ifinmulticastpkts),
- EXTRACT_BE_32BITS(sflow_gen_counter->ifinbroadcastpkts),
- EXTRACT_BE_32BITS(sflow_gen_counter->ifindiscards)));
+ EXTRACT_BE_U_8(sflow_gen_counter->ifinoctets),
+ EXTRACT_BE_U_4(sflow_gen_counter->ifinunicastpkts),
+ EXTRACT_BE_U_4(sflow_gen_counter->ifinmulticastpkts),
+ EXTRACT_BE_U_4(sflow_gen_counter->ifinbroadcastpkts),
+ EXTRACT_BE_U_4(sflow_gen_counter->ifindiscards)));
ND_PRINT((ndo, "\n\t In errors %u, unknown protos %u",
- EXTRACT_BE_32BITS(sflow_gen_counter->ifinerrors),
- EXTRACT_BE_32BITS(sflow_gen_counter->ifinunkownprotos)));
+ EXTRACT_BE_U_4(sflow_gen_counter->ifinerrors),
+ EXTRACT_BE_U_4(sflow_gen_counter->ifinunkownprotos)));
ND_PRINT((ndo, "\n\t Out octets %" PRIu64
", unicast pkts %u, multicast pkts %u, broadcast pkts %u, discards %u",
- EXTRACT_BE_64BITS(sflow_gen_counter->ifoutoctets),
- EXTRACT_BE_32BITS(sflow_gen_counter->ifoutunicastpkts),
- EXTRACT_BE_32BITS(sflow_gen_counter->ifoutmulticastpkts),
- EXTRACT_BE_32BITS(sflow_gen_counter->ifoutbroadcastpkts),
- EXTRACT_BE_32BITS(sflow_gen_counter->ifoutdiscards)));
+ EXTRACT_BE_U_8(sflow_gen_counter->ifoutoctets),
+ EXTRACT_BE_U_4(sflow_gen_counter->ifoutunicastpkts),
+ EXTRACT_BE_U_4(sflow_gen_counter->ifoutmulticastpkts),
+ EXTRACT_BE_U_4(sflow_gen_counter->ifoutbroadcastpkts),
+ EXTRACT_BE_U_4(sflow_gen_counter->ifoutdiscards)));
ND_PRINT((ndo, "\n\t Out errors %u, promisc mode %u",
- EXTRACT_BE_32BITS(sflow_gen_counter->ifouterrors),
- EXTRACT_BE_32BITS(sflow_gen_counter->ifpromiscmode)));
+ EXTRACT_BE_U_4(sflow_gen_counter->ifouterrors),
+ EXTRACT_BE_U_4(sflow_gen_counter->ifpromiscmode)));
return 0;
sflow_eth_counter = (const struct sflow_ethernet_counter_t *)pointer;
ND_TCHECK(*sflow_eth_counter);
ND_PRINT((ndo, "\n\t align errors %u, fcs errors %u, single collision %u, multiple collision %u, test error %u",
- EXTRACT_BE_32BITS(sflow_eth_counter->alignerrors),
- EXTRACT_BE_32BITS(sflow_eth_counter->fcserrors),
- EXTRACT_BE_32BITS(sflow_eth_counter->single_collision_frames),
- EXTRACT_BE_32BITS(sflow_eth_counter->multiple_collision_frames),
- EXTRACT_BE_32BITS(sflow_eth_counter->test_errors)));
+ EXTRACT_BE_U_4(sflow_eth_counter->alignerrors),
+ EXTRACT_BE_U_4(sflow_eth_counter->fcserrors),
+ EXTRACT_BE_U_4(sflow_eth_counter->single_collision_frames),
+ EXTRACT_BE_U_4(sflow_eth_counter->multiple_collision_frames),
+ EXTRACT_BE_U_4(sflow_eth_counter->test_errors)));
ND_PRINT((ndo, "\n\t deferred %u, late collision %u, excessive collision %u, mac trans error %u",
- EXTRACT_BE_32BITS(sflow_eth_counter->deferred_transmissions),
- EXTRACT_BE_32BITS(sflow_eth_counter->late_collisions),
- EXTRACT_BE_32BITS(sflow_eth_counter->excessive_collisions),
- EXTRACT_BE_32BITS(sflow_eth_counter->mac_transmit_errors)));
+ EXTRACT_BE_U_4(sflow_eth_counter->deferred_transmissions),
+ EXTRACT_BE_U_4(sflow_eth_counter->late_collisions),
+ EXTRACT_BE_U_4(sflow_eth_counter->excessive_collisions),
+ EXTRACT_BE_U_4(sflow_eth_counter->mac_transmit_errors)));
ND_PRINT((ndo, "\n\t carrier error %u, frames too long %u, mac receive errors %u, symbol errors %u",
- EXTRACT_BE_32BITS(sflow_eth_counter->carrier_sense_errors),
- EXTRACT_BE_32BITS(sflow_eth_counter->frame_too_longs),
- EXTRACT_BE_32BITS(sflow_eth_counter->mac_receive_errors),
- EXTRACT_BE_32BITS(sflow_eth_counter->symbol_errors)));
+ EXTRACT_BE_U_4(sflow_eth_counter->carrier_sense_errors),
+ EXTRACT_BE_U_4(sflow_eth_counter->frame_too_longs),
+ EXTRACT_BE_U_4(sflow_eth_counter->mac_receive_errors),
+ EXTRACT_BE_U_4(sflow_eth_counter->symbol_errors)));
return 0;
sflow_100basevg_counter = (const struct sflow_100basevg_counter_t *)pointer;
ND_TCHECK(*sflow_100basevg_counter);
ND_PRINT((ndo, "\n\t in high prio frames %u, in high prio octets %" PRIu64,
- EXTRACT_BE_32BITS(sflow_100basevg_counter->in_highpriority_frames),
- EXTRACT_BE_64BITS(sflow_100basevg_counter->in_highpriority_octets)));
+ EXTRACT_BE_U_4(sflow_100basevg_counter->in_highpriority_frames),
+ EXTRACT_BE_U_8(sflow_100basevg_counter->in_highpriority_octets)));
ND_PRINT((ndo, "\n\t in norm prio frames %u, in norm prio octets %" PRIu64,
- EXTRACT_BE_32BITS(sflow_100basevg_counter->in_normpriority_frames),
- EXTRACT_BE_64BITS(sflow_100basevg_counter->in_normpriority_octets)));
+ EXTRACT_BE_U_4(sflow_100basevg_counter->in_normpriority_frames),
+ EXTRACT_BE_U_8(sflow_100basevg_counter->in_normpriority_octets)));
ND_PRINT((ndo, "\n\t in ipm errors %u, oversized %u, in data errors %u, null addressed frames %u",
- EXTRACT_BE_32BITS(sflow_100basevg_counter->in_ipmerrors),
- EXTRACT_BE_32BITS(sflow_100basevg_counter->in_oversized),
- EXTRACT_BE_32BITS(sflow_100basevg_counter->in_data_errors),
- EXTRACT_BE_32BITS(sflow_100basevg_counter->in_null_addressed_frames)));
+ EXTRACT_BE_U_4(sflow_100basevg_counter->in_ipmerrors),
+ EXTRACT_BE_U_4(sflow_100basevg_counter->in_oversized),
+ EXTRACT_BE_U_4(sflow_100basevg_counter->in_data_errors),
+ EXTRACT_BE_U_4(sflow_100basevg_counter->in_null_addressed_frames)));
ND_PRINT((ndo, "\n\t out high prio frames %u, out high prio octets %" PRIu64
", trans into frames %u",
- EXTRACT_BE_32BITS(sflow_100basevg_counter->out_highpriority_frames),
- EXTRACT_BE_64BITS(sflow_100basevg_counter->out_highpriority_octets),
- EXTRACT_BE_32BITS(sflow_100basevg_counter->transitioninto_frames)));
+ EXTRACT_BE_U_4(sflow_100basevg_counter->out_highpriority_frames),
+ EXTRACT_BE_U_8(sflow_100basevg_counter->out_highpriority_octets),
+ EXTRACT_BE_U_4(sflow_100basevg_counter->transitioninto_frames)));
ND_PRINT((ndo, "\n\t in hc high prio octets %" PRIu64
", in hc norm prio octets %" PRIu64
", out hc high prio octets %" PRIu64,
- EXTRACT_BE_64BITS(sflow_100basevg_counter->hc_in_highpriority_octets),
- EXTRACT_BE_64BITS(sflow_100basevg_counter->hc_in_normpriority_octets),
- EXTRACT_BE_64BITS(sflow_100basevg_counter->hc_out_highpriority_octets)));
+ EXTRACT_BE_U_8(sflow_100basevg_counter->hc_in_highpriority_octets),
+ EXTRACT_BE_U_8(sflow_100basevg_counter->hc_in_normpriority_octets),
+ EXTRACT_BE_U_8(sflow_100basevg_counter->hc_out_highpriority_octets)));
return 0;
ND_TCHECK(*sflow_vlan_counter);
ND_PRINT((ndo, "\n\t vlan_id %u, octets %" PRIu64
", unicast_pkt %u, multicast_pkt %u, broadcast_pkt %u, discards %u",
- EXTRACT_BE_32BITS(sflow_vlan_counter->vlan_id),
- EXTRACT_BE_64BITS(sflow_vlan_counter->octets),
- EXTRACT_BE_32BITS(sflow_vlan_counter->unicast_pkt),
- EXTRACT_BE_32BITS(sflow_vlan_counter->multicast_pkt),
- EXTRACT_BE_32BITS(sflow_vlan_counter->broadcast_pkt),
- EXTRACT_BE_32BITS(sflow_vlan_counter->discards)));
+ EXTRACT_BE_U_4(sflow_vlan_counter->vlan_id),
+ EXTRACT_BE_U_8(sflow_vlan_counter->octets),
+ EXTRACT_BE_U_4(sflow_vlan_counter->unicast_pkt),
+ EXTRACT_BE_U_4(sflow_vlan_counter->multicast_pkt),
+ EXTRACT_BE_U_4(sflow_vlan_counter->broadcast_pkt),
+ EXTRACT_BE_U_4(sflow_vlan_counter->discards)));
return 0;
ND_TCHECK(*sflow_processor_counter);
ND_PRINT((ndo, "\n\t 5sec %u, 1min %u, 5min %u, total_mem %" PRIu64
", total_mem %" PRIu64,
- EXTRACT_BE_32BITS(sflow_processor_counter->five_sec_util),
- EXTRACT_BE_32BITS(sflow_processor_counter->one_min_util),
- EXTRACT_BE_32BITS(sflow_processor_counter->five_min_util),
- EXTRACT_BE_64BITS(sflow_processor_counter->total_memory),
- EXTRACT_BE_64BITS(sflow_processor_counter->free_memory)));
+ EXTRACT_BE_U_4(sflow_processor_counter->five_sec_util),
+ EXTRACT_BE_U_4(sflow_processor_counter->one_min_util),
+ EXTRACT_BE_U_4(sflow_processor_counter->five_min_util),
+ EXTRACT_BE_U_8(sflow_processor_counter->total_memory),
+ EXTRACT_BE_U_8(sflow_processor_counter->free_memory)));
return 0;
sflow_counter_record = (const struct sflow_counter_record_t *)tptr;
ND_TCHECK(*sflow_counter_record);
- enterprise = EXTRACT_BE_32BITS(sflow_counter_record->format);
+ enterprise = EXTRACT_BE_U_4(sflow_counter_record->format);
counter_type = enterprise & 0x0FFF;
enterprise = enterprise >> 20;
- counter_len = EXTRACT_BE_32BITS(sflow_counter_record->length);
+ counter_len = EXTRACT_BE_U_4(sflow_counter_record->length);
ND_PRINT((ndo, "\n\t enterprise %u, %s (%u) length %u",
enterprise,
(enterprise == 0) ? tok2str(sflow_counter_type_values,"Unknown",counter_type) : "Unknown",
sflow_counter_sample = (const struct sflow_counter_sample_t *)pointer;
ND_TCHECK(*sflow_counter_sample);
- typesource = EXTRACT_BE_32BITS(sflow_counter_sample->typesource);
- nrecords = EXTRACT_BE_32BITS(sflow_counter_sample->records);
+ typesource = EXTRACT_BE_U_4(sflow_counter_sample->typesource);
+ nrecords = EXTRACT_BE_U_4(sflow_counter_sample->records);
type = typesource >> 24;
index = typesource & 0x0FFF;
ND_PRINT((ndo, " seqnum %u, type %u, idx %u, records %u",
- EXTRACT_BE_32BITS(sflow_counter_sample->seqnum),
+ EXTRACT_BE_U_4(sflow_counter_sample->seqnum),
type,
index,
nrecords));
sflow_expanded_counter_sample = (const struct sflow_expanded_counter_sample_t *)pointer;
ND_TCHECK(*sflow_expanded_counter_sample);
- nrecords = EXTRACT_BE_32BITS(sflow_expanded_counter_sample->records);
+ nrecords = EXTRACT_BE_U_4(sflow_expanded_counter_sample->records);
ND_PRINT((ndo, " seqnum %u, type %u, idx %u, records %u",
- EXTRACT_BE_32BITS(sflow_expanded_counter_sample->seqnum),
- EXTRACT_BE_32BITS(sflow_expanded_counter_sample->type),
- EXTRACT_BE_32BITS(sflow_expanded_counter_sample->index),
+ EXTRACT_BE_U_4(sflow_expanded_counter_sample->seqnum),
+ EXTRACT_BE_U_4(sflow_expanded_counter_sample->type),
+ EXTRACT_BE_U_4(sflow_expanded_counter_sample->index),
nrecords));
return sflow_print_counter_records(ndo, pointer + sizeof(struct sflow_expanded_counter_sample_t),
sflow_flow_raw = (const struct sflow_expanded_flow_raw_t *)pointer;
ND_TCHECK(*sflow_flow_raw);
ND_PRINT((ndo, "\n\t protocol %s (%u), length %u, stripped bytes %u, header_size %u",
- tok2str(sflow_flow_raw_protocol_values,"Unknown",EXTRACT_BE_32BITS(sflow_flow_raw->protocol)),
- EXTRACT_BE_32BITS(sflow_flow_raw->protocol),
- EXTRACT_BE_32BITS(sflow_flow_raw->length),
- EXTRACT_BE_32BITS(sflow_flow_raw->stripped_bytes),
- EXTRACT_BE_32BITS(sflow_flow_raw->header_size)));
+ tok2str(sflow_flow_raw_protocol_values,"Unknown",EXTRACT_BE_U_4(sflow_flow_raw->protocol)),
+ EXTRACT_BE_U_4(sflow_flow_raw->protocol),
+ EXTRACT_BE_U_4(sflow_flow_raw->length),
+ EXTRACT_BE_U_4(sflow_flow_raw->stripped_bytes),
+ EXTRACT_BE_U_4(sflow_flow_raw->header_size)));
/* QUESTION - should we attempt to print the raw header itself?
assuming of course there is wnough data present to do so... */
ND_TCHECK(*sflow_ethernet_frame);
ND_PRINT((ndo, "\n\t frame len %u, type %u",
- EXTRACT_BE_32BITS(sflow_ethernet_frame->length),
- EXTRACT_BE_32BITS(sflow_ethernet_frame->type)));
+ EXTRACT_BE_U_4(sflow_ethernet_frame->length),
+ EXTRACT_BE_U_4(sflow_ethernet_frame->type)));
return 0;
sflow_extended_sw_data = (const struct sflow_extended_switch_data_t *)pointer;
ND_TCHECK(*sflow_extended_sw_data);
ND_PRINT((ndo, "\n\t src vlan %u, src pri %u, dst vlan %u, dst pri %u",
- EXTRACT_BE_32BITS(sflow_extended_sw_data->src_vlan),
- EXTRACT_BE_32BITS(sflow_extended_sw_data->src_pri),
- EXTRACT_BE_32BITS(sflow_extended_sw_data->dst_vlan),
- EXTRACT_BE_32BITS(sflow_extended_sw_data->dst_pri)));
+ EXTRACT_BE_U_4(sflow_extended_sw_data->src_vlan),
+ EXTRACT_BE_U_4(sflow_extended_sw_data->src_pri),
+ EXTRACT_BE_U_4(sflow_extended_sw_data->dst_vlan),
+ EXTRACT_BE_U_4(sflow_extended_sw_data->dst_pri)));
return 0;
/* so, the funky encoding means we cannot blythly mask-off
bits, we must also check the enterprise. */
- enterprise = EXTRACT_BE_32BITS(sflow_flow_record->format);
+ enterprise = EXTRACT_BE_U_4(sflow_flow_record->format);
flow_type = enterprise & 0x0FFF;
enterprise = enterprise >> 12;
- flow_len = EXTRACT_BE_32BITS(sflow_flow_record->length);
+ flow_len = EXTRACT_BE_U_4(sflow_flow_record->length);
ND_PRINT((ndo, "\n\t enterprise %u %s (%u) length %u",
enterprise,
(enterprise == 0) ? tok2str(sflow_flow_type_values,"Unknown",flow_type) : "Unknown",
sflow_flow_sample = (const struct sflow_flow_sample_t *)pointer;
ND_TCHECK(*sflow_flow_sample);
- typesource = EXTRACT_BE_32BITS(sflow_flow_sample->typesource);
- nrecords = EXTRACT_BE_32BITS(sflow_flow_sample->records);
+ typesource = EXTRACT_BE_U_4(sflow_flow_sample->typesource);
+ nrecords = EXTRACT_BE_U_4(sflow_flow_sample->records);
type = typesource >> 24;
index = typesource & 0x0FFF;
ND_PRINT((ndo, " seqnum %u, type %u, idx %u, rate %u, pool %u, drops %u, input %u output %u records %u",
- EXTRACT_BE_32BITS(sflow_flow_sample->seqnum),
+ EXTRACT_BE_U_4(sflow_flow_sample->seqnum),
type,
index,
- EXTRACT_BE_32BITS(sflow_flow_sample->rate),
- EXTRACT_BE_32BITS(sflow_flow_sample->pool),
- EXTRACT_BE_32BITS(sflow_flow_sample->drops),
- EXTRACT_BE_32BITS(sflow_flow_sample->in_interface),
- EXTRACT_BE_32BITS(sflow_flow_sample->out_interface),
+ EXTRACT_BE_U_4(sflow_flow_sample->rate),
+ EXTRACT_BE_U_4(sflow_flow_sample->pool),
+ EXTRACT_BE_U_4(sflow_flow_sample->drops),
+ EXTRACT_BE_U_4(sflow_flow_sample->in_interface),
+ EXTRACT_BE_U_4(sflow_flow_sample->out_interface),
nrecords));
return sflow_print_flow_records(ndo, pointer + sizeof(struct sflow_flow_sample_t),
sflow_expanded_flow_sample = (const struct sflow_expanded_flow_sample_t *)pointer;
ND_TCHECK(*sflow_expanded_flow_sample);
- nrecords = EXTRACT_BE_32BITS(sflow_expanded_flow_sample->records);
+ nrecords = EXTRACT_BE_U_4(sflow_expanded_flow_sample->records);
ND_PRINT((ndo, " seqnum %u, type %u, idx %u, rate %u, pool %u, drops %u, records %u",
- EXTRACT_BE_32BITS(sflow_expanded_flow_sample->seqnum),
- EXTRACT_BE_32BITS(sflow_expanded_flow_sample->type),
- EXTRACT_BE_32BITS(sflow_expanded_flow_sample->index),
- EXTRACT_BE_32BITS(sflow_expanded_flow_sample->rate),
- EXTRACT_BE_32BITS(sflow_expanded_flow_sample->pool),
- EXTRACT_BE_32BITS(sflow_expanded_flow_sample->drops),
- EXTRACT_BE_32BITS(sflow_expanded_flow_sample->records)));
+ EXTRACT_BE_U_4(sflow_expanded_flow_sample->seqnum),
+ EXTRACT_BE_U_4(sflow_expanded_flow_sample->type),
+ EXTRACT_BE_U_4(sflow_expanded_flow_sample->index),
+ EXTRACT_BE_U_4(sflow_expanded_flow_sample->rate),
+ EXTRACT_BE_U_4(sflow_expanded_flow_sample->pool),
+ EXTRACT_BE_U_4(sflow_expanded_flow_sample->drops),
+ EXTRACT_BE_U_4(sflow_expanded_flow_sample->records)));
return sflow_print_flow_records(ndo, pointer + sizeof(struct sflow_expanded_flow_sample_t),
len - sizeof(struct sflow_expanded_flow_sample_t),
/*
* Sanity checking of the header.
*/
- if (EXTRACT_BE_32BITS(sflow_datagram->version) != 5) {
+ if (EXTRACT_BE_U_4(sflow_datagram->version) != 5) {
ND_PRINT((ndo, "sFlow version %u packet not supported",
- EXTRACT_BE_32BITS(sflow_datagram->version)));
+ EXTRACT_BE_U_4(sflow_datagram->version)));
return;
}
if (ndo->ndo_vflag < 1) {
ND_PRINT((ndo, "sFlowv%u, %s agent %s, agent-id %u, length %u",
- EXTRACT_BE_32BITS(sflow_datagram->version),
- EXTRACT_BE_32BITS(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6",
+ EXTRACT_BE_U_4(sflow_datagram->version),
+ EXTRACT_BE_U_4(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6",
ipaddr_string(ndo, sflow_datagram->agent),
- EXTRACT_BE_32BITS(sflow_datagram->agent_id),
+ EXTRACT_BE_U_4(sflow_datagram->agent_id),
len));
return;
}
/* ok they seem to want to know everything - lets fully decode it */
- nsamples=EXTRACT_BE_32BITS(sflow_datagram->samples);
+ nsamples=EXTRACT_BE_U_4(sflow_datagram->samples);
ND_PRINT((ndo, "sFlowv%u, %s agent %s, agent-id %u, seqnum %u, uptime %u, samples %u, length %u",
- EXTRACT_BE_32BITS(sflow_datagram->version),
- EXTRACT_BE_32BITS(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6",
+ EXTRACT_BE_U_4(sflow_datagram->version),
+ EXTRACT_BE_U_4(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6",
ipaddr_string(ndo, sflow_datagram->agent),
- EXTRACT_BE_32BITS(sflow_datagram->agent_id),
- EXTRACT_BE_32BITS(sflow_datagram->seqnum),
- EXTRACT_BE_32BITS(sflow_datagram->uptime),
+ EXTRACT_BE_U_4(sflow_datagram->agent_id),
+ EXTRACT_BE_U_4(sflow_datagram->seqnum),
+ EXTRACT_BE_U_4(sflow_datagram->uptime),
nsamples,
len));
sflow_sample = (const struct sflow_sample_header *)tptr;
ND_TCHECK(*sflow_sample);
- sflow_sample_type = (EXTRACT_BE_32BITS(sflow_sample->format)&0x0FFF);
- sflow_sample_len = EXTRACT_BE_32BITS(sflow_sample->len);
+ sflow_sample_type = (EXTRACT_BE_U_4(sflow_sample->format)&0x0FFF);
+ sflow_sample_len = EXTRACT_BE_U_4(sflow_sample->len);
if (tlen < sizeof(struct sflow_sample_header))
goto trunc;
register u_int i;
if ((i = *cp++) == 0) {
- i = EXTRACT_BE_16BITS(cp);
+ i = EXTRACT_BE_U_2(cp);
cp += 2;
}
ND_PRINT((ndo, " %s%d", str, i));
register short i;
if ((i = *cp++) == 0) {
- i = EXTRACT_BE_16BITS(cp);
+ i = EXTRACT_BE_U_2(cp);
cp += 2;
}
if (i >= 0)
register const u_char *cp = chdr;
register u_int flags, hlen;
- flags = EXTRACT_8BITS(cp);
+ flags = EXTRACT_U_1(cp);
cp++;
if (flags & NEW_C) {
- lastconn = EXTRACT_8BITS(cp);
+ lastconn = EXTRACT_U_1(cp);
cp++;
ND_PRINT((ndo, "ctcp %d", lastconn));
} else
{
u_short ether_type;
- ND_PRINT((ndo, "%3s ",tok2str(sll_pkttype_values,"?",EXTRACT_BE_16BITS(&sllp->sll_pkttype))));
+ ND_PRINT((ndo, "%3s ",tok2str(sll_pkttype_values,"?",EXTRACT_BE_U_2(&sllp->sll_pkttype))));
/*
* XXX - check the link-layer address type value?
* For now, we just assume 6 means Ethernet.
* XXX - print others as strings of hex?
*/
- if (EXTRACT_BE_16BITS(&sllp->sll_halen) == 6)
+ if (EXTRACT_BE_U_2(&sllp->sll_halen) == 6)
ND_PRINT((ndo, "%s ", etheraddr_string(ndo, sllp->sll_addr)));
if (!ndo->ndo_qflag) {
- ether_type = EXTRACT_BE_16BITS(&sllp->sll_protocol);
+ ether_type = EXTRACT_BE_U_2(&sllp->sll_protocol);
if (ether_type <= ETHERMTU) {
/*
p += SLL_HDR_LEN;
hdrlen = SLL_HDR_LEN;
- ether_type = EXTRACT_BE_16BITS(&sllp->sll_protocol);
+ ether_type = EXTRACT_BE_U_2(&sllp->sll_protocol);
recurse:
/*
return (hdrlen + length);
}
if (ndo->ndo_eflag) {
- uint16_t tag = EXTRACT_BE_16BITS(p);
+ uint16_t tag = EXTRACT_BE_U_2(p);
ND_PRINT((ndo, "%s, ", ieee8021q_tci_string(tag)));
}
- ether_type = EXTRACT_BE_16BITS(p + 2);
+ ether_type = EXTRACT_BE_U_2(p + 2);
if (ether_type <= ETHERMTU)
ether_type = LINUX_SLL_P_802_2;
if (!ndo->ndo_qflag) {
if (print_version == 1) {
ND_PRINT((ndo, "%sv%u, length %u",
tok2str(slow_proto_values, "unknown (%u)", subtype),
- EXTRACT_8BITS((pptr + 1)),
+ EXTRACT_U_1((pptr + 1)),
len));
} else {
/* some slow protos don't have a version number in the header */
ND_PRINT((ndo, "\n\t System %s, System Priority %u, Key %u" \
", Port %u, Port Priority %u\n\t State Flags [%s]",
etheraddr_string(ndo, tlv_ptr.lacp_tlv_actor_partner_info->sys),
- EXTRACT_BE_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->sys_pri),
- EXTRACT_BE_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->key),
- EXTRACT_BE_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->port),
- EXTRACT_BE_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->port_pri),
+ EXTRACT_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->sys_pri),
+ EXTRACT_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->key),
+ EXTRACT_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->port),
+ EXTRACT_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->port_pri),
bittok2str(lacp_tlv_actor_partner_info_state_values,
"none",
tlv_ptr.lacp_tlv_actor_partner_info->state)));
tlv_ptr.lacp_tlv_collector_info = (const struct lacp_tlv_collector_info_t *)tlv_tptr;
ND_PRINT((ndo, "\n\t Max Delay %u",
- EXTRACT_BE_16BITS(tlv_ptr.lacp_tlv_collector_info->max_delay)));
+ EXTRACT_BE_U_2(tlv_ptr.lacp_tlv_collector_info->max_delay)));
break;
ND_PRINT((ndo, "\n\t Request System %s, Request Port %u, Request Transaction ID 0x%08x",
etheraddr_string(ndo, tlv_ptr.marker_tlv_marker_info->req_sys),
- EXTRACT_BE_16BITS(tlv_ptr.marker_tlv_marker_info->req_port),
- EXTRACT_BE_32BITS(tlv_ptr.marker_tlv_marker_info->req_trans_id)));
+ EXTRACT_BE_U_2(tlv_ptr.marker_tlv_marker_info->req_port),
+ EXTRACT_BE_U_4(tlv_ptr.marker_tlv_marker_info->req_trans_id)));
break;
tok2str(slow_oam_code_values, "Unknown (%u)", ptr.slow_oam_common_header->code),
bittok2str(slow_oam_flag_values,
"none",
- EXTRACT_BE_16BITS(&ptr.slow_oam_common_header->flags))));
+ EXTRACT_BE_U_2(&ptr.slow_oam_common_header->flags))));
switch (ptr.slow_oam_common_header->code) {
case SLOW_OAM_CODE_INFO:
ND_PRINT((ndo, "\n\t OAM-Version %u, Revision %u",
tlv.slow_oam_info->oam_version,
- EXTRACT_BE_16BITS(&tlv.slow_oam_info->revision)));
+ EXTRACT_BE_U_2(&tlv.slow_oam_info->revision)));
ND_PRINT((ndo, "\n\t State-Parser-Action %s, State-MUX-Action %s",
tok2str(slow_oam_info_type_state_parser_values, "Reserved",
ND_PRINT((ndo, "\n\t OAM-Config Flags [%s], OAM-PDU-Config max-PDU size %u",
bittok2str(slow_oam_info_type_oam_config_values, "none",
tlv.slow_oam_info->oam_config),
- EXTRACT_BE_16BITS(&tlv.slow_oam_info->oam_pdu_config) &
+ EXTRACT_BE_U_2(&tlv.slow_oam_info->oam_pdu_config) &
OAM_INFO_TYPE_PDU_SIZE_MASK));
ND_PRINT((ndo, "\n\t OUI %s (0x%06x), Vendor-Private 0x%08x",
tok2str(oui_values, "Unknown",
- EXTRACT_BE_24BITS(&tlv.slow_oam_info->oui)),
- EXTRACT_BE_24BITS(&tlv.slow_oam_info->oui),
- EXTRACT_BE_32BITS(&tlv.slow_oam_info->vendor_private)));
+ EXTRACT_BE_U_3(&tlv.slow_oam_info->oui)),
+ EXTRACT_BE_U_3(&tlv.slow_oam_info->oui),
+ EXTRACT_BE_U_4(&tlv.slow_oam_info->vendor_private)));
break;
case SLOW_OAM_INFO_TYPE_ORG_SPECIFIC:
if (tlen < 2)
goto tooshort;
ND_TCHECK2(*tptr, 2);
- ND_PRINT((ndo, "\n\t Sequence Number %u", EXTRACT_BE_16BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Sequence Number %u", EXTRACT_BE_U_2(tptr)));
tlen -= 2;
tptr += 2;
"\n\t Errors %" PRIu64
"\n\t Error Running Total %" PRIu64
"\n\t Event Running Total %u",
- EXTRACT_BE_16BITS(&tlv.slow_oam_link_event->time_stamp)*100,
- EXTRACT_BE_64BITS(&tlv.slow_oam_link_event->window),
- EXTRACT_BE_64BITS(&tlv.slow_oam_link_event->threshold),
- EXTRACT_BE_64BITS(&tlv.slow_oam_link_event->errors),
- EXTRACT_BE_64BITS(&tlv.slow_oam_link_event->errors_running_total),
- EXTRACT_BE_32BITS(&tlv.slow_oam_link_event->event_running_total)));
+ EXTRACT_BE_U_2(&tlv.slow_oam_link_event->time_stamp)*100,
+ EXTRACT_BE_U_8(&tlv.slow_oam_link_event->window),
+ EXTRACT_BE_U_8(&tlv.slow_oam_link_event->threshold),
+ EXTRACT_BE_U_8(&tlv.slow_oam_link_event->errors),
+ EXTRACT_BE_U_8(&tlv.slow_oam_link_event->errors_running_total),
+ EXTRACT_BE_U_4(&tlv.slow_oam_link_event->event_running_total)));
break;
case SLOW_OAM_LINK_EVENT_ORG_SPECIFIC:
if (request) {
ND_TCHECK2(*param, 2);
- level = EXTRACT_LE_16BITS(param);
+ level = EXTRACT_LE_U_2(param);
fmt = "InfoLevel=[d]\n";
smb_fdata(ndo, param, fmt, param + pcnt, unicodestr);
} else {
ND_TCHECK(words[0]);
if (request) {
ND_TCHECK2(w[14 * 2], 2);
- pcnt = EXTRACT_LE_16BITS(w + 9 * 2);
- param = buf + EXTRACT_LE_16BITS(w + 10 * 2);
- dcnt = EXTRACT_LE_16BITS(w + 11 * 2);
- data = buf + EXTRACT_LE_16BITS(w + 12 * 2);
- fn = smbfindint(EXTRACT_LE_16BITS(w + 14 * 2), trans2_fns);
+ pcnt = EXTRACT_LE_U_2(w + 9 * 2);
+ param = buf + EXTRACT_LE_U_2(w + 10 * 2);
+ dcnt = EXTRACT_LE_U_2(w + 11 * 2);
+ data = buf + EXTRACT_LE_U_2(w + 12 * 2);
+ fn = smbfindint(EXTRACT_LE_U_2(w + 14 * 2), trans2_fns);
} else {
if (words[0] == 0) {
ND_PRINT((ndo, "%s\n", fn->name));
return;
}
ND_TCHECK2(w[7 * 2], 2);
- pcnt = EXTRACT_LE_16BITS(w + 3 * 2);
- param = buf + EXTRACT_LE_16BITS(w + 4 * 2);
- dcnt = EXTRACT_LE_16BITS(w + 6 * 2);
- data = buf + EXTRACT_LE_16BITS(w + 7 * 2);
+ pcnt = EXTRACT_LE_U_2(w + 3 * 2);
+ param = buf + EXTRACT_LE_U_2(w + 4 * 2);
+ dcnt = EXTRACT_LE_U_2(w + 6 * 2);
+ data = buf + EXTRACT_LE_U_2(w + 7 * 2);
}
ND_PRINT((ndo, "%s param_length=%d data_length=%d\n", fn->name, pcnt, dcnt));
}
ND_TCHECK2(*dat, 2);
- bcc = EXTRACT_LE_16BITS(dat);
+ bcc = EXTRACT_LE_U_2(dat);
ND_PRINT((ndo, "smb_bcc=%u\n", bcc));
if (fn->descript.fn)
(*fn->descript.fn)(ndo, param, data, pcnt, dcnt);
if (request) {
ND_TCHECK2(w[12 * 2], 2);
- paramlen = EXTRACT_LE_16BITS(w + 9 * 2);
- param = buf + EXTRACT_LE_16BITS(w + 10 * 2);
- datalen = EXTRACT_LE_16BITS(w + 11 * 2);
- data = buf + EXTRACT_LE_16BITS(w + 12 * 2);
+ paramlen = EXTRACT_LE_U_2(w + 9 * 2);
+ param = buf + EXTRACT_LE_U_2(w + 10 * 2);
+ datalen = EXTRACT_LE_U_2(w + 11 * 2);
+ data = buf + EXTRACT_LE_U_2(w + 12 * 2);
f1 = "TotParamCnt=[d] \nTotDataCnt=[d] \nMaxParmCnt=[d] \nMaxDataCnt=[d]\nMaxSCnt=[d] \nTransFlags=[w] \nRes1=[w] \nRes2=[w] \nRes3=[w]\nParamCnt=[d] \nParamOff=[d] \nDataCnt=[d] \nDataOff=[d] \nSUCnt=[d]\n";
f2 = "|Name=[S]\n";
f3 = "|Param ";
f4 = "|Data ";
} else {
ND_TCHECK2(w[7 * 2], 2);
- paramlen = EXTRACT_LE_16BITS(w + 3 * 2);
- param = buf + EXTRACT_LE_16BITS(w + 4 * 2);
- datalen = EXTRACT_LE_16BITS(w + 6 * 2);
- data = buf + EXTRACT_LE_16BITS(w + 7 * 2);
+ paramlen = EXTRACT_LE_U_2(w + 3 * 2);
+ param = buf + EXTRACT_LE_U_2(w + 4 * 2);
+ datalen = EXTRACT_LE_U_2(w + 6 * 2);
+ data = buf + EXTRACT_LE_U_2(w + 7 * 2);
f1 = "TotParamCnt=[d] \nTotDataCnt=[d] \nRes1=[d]\nParamCnt=[d] \nParamOff=[d] \nRes2=[d] \nDataCnt=[d] \nDataOff=[d] \nRes3=[d]\nLsetup=[d]\n";
f2 = "|Unknown ";
f3 = "|Param ";
unicodestr);
ND_TCHECK2(*data1, 2);
- bcc = EXTRACT_LE_16BITS(data1);
+ bcc = EXTRACT_LE_U_2(data1);
ND_PRINT((ndo, "smb_bcc=%u\n", bcc));
if (bcc > 0) {
smb_fdata(ndo, data1 + 2, f2, maxbuf - (paramlen + datalen), unicodestr);
smb_print_data(ndo, words + 1, min(wct * 2, PTR_DIFF(maxbuf, words + 1)));
ND_TCHECK2(*data, 2);
- bcc = EXTRACT_LE_16BITS(data);
+ bcc = EXTRACT_LE_U_2(data);
ND_PRINT((ndo, "smb_bcc=%u\n", bcc));
if (bcc > 0) {
if (f2)
- smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_16BITS(data),
- maxbuf), unicodestr);
+ smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_U_2(data),
+ maxbuf), unicodestr);
else
- smb_print_data(ndo, data + 2, min(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2)));
+ smb_print_data(ndo, data + 2,
+ min(EXTRACT_LE_U_2(data), PTR_DIFF(maxbuf, data + 2)));
}
return;
trunc:
smb_print_data(ndo, words + 1, min(wct * 2, PTR_DIFF(maxbuf, words + 1)));
ND_TCHECK2(*data, 2);
- bcc = EXTRACT_LE_16BITS(data);
+ bcc = EXTRACT_LE_U_2(data);
ND_PRINT((ndo, "smb_bcc=%u\n", bcc));
if (bcc > 0) {
if (f2)
- smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_16BITS(data),
- maxbuf), unicodestr);
+ smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_U_2(data),
+ maxbuf), unicodestr);
else
- smb_print_data(ndo, data + 2, min(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2)));
+ smb_print_data(ndo, data + 2,
+ min(EXTRACT_LE_U_2(data), PTR_DIFF(maxbuf, data + 2)));
}
return;
trunc:
smb_fdata(ndo, words + 1, f1, maxwords, unicodestr);
ND_TCHECK2(*data, 2);
- bcc = EXTRACT_LE_16BITS(data);
+ bcc = EXTRACT_LE_U_2(data);
ND_PRINT((ndo, "smb_bcc=%u\n", bcc));
if (bcc > 0) {
if (f2)
- smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_16BITS(data),
- maxbuf), unicodestr);
+ smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_U_2(data),
+ maxbuf), unicodestr);
else
- smb_print_data(ndo, data + 2, min(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2)));
+ smb_print_data(ndo, data + 2,
+ min(EXTRACT_LE_U_2(data), PTR_DIFF(maxbuf, data + 2)));
}
return;
trunc:
return;
ND_TCHECK_2(&buf[10]);
- flags2 = EXTRACT_LE_16BITS(buf + 10);
+ flags2 = EXTRACT_LE_U_2(buf + 10);
unicodestr = flags2 & 0x8000;
nterrcodes = flags2 & 0x4000;
smb_fdata(ndo, buf, fmt_smbheader, buf + 33, unicodestr);
if (nterrcodes) {
- nterror = EXTRACT_LE_32BITS(buf + 5);
+ nterror = EXTRACT_LE_U_4(buf + 5);
if (nterror)
ND_PRINT((ndo, "NTError = %s\n", nt_errstr(nterror)));
} else {
if (buf[5])
- ND_PRINT((ndo, "SMBError = %s\n", smb_errstr(buf[5], EXTRACT_LE_16BITS(buf + 7))));
+ ND_PRINT((ndo, "SMBError = %s\n", smb_errstr(buf[5], EXTRACT_LE_U_2(buf + 7))));
}
smboffset = 32;
for (i = 0; &words[1 + 2 * i] < maxwords; i++) {
ND_TCHECK2(words[1 + 2 * i], 2);
- v = EXTRACT_LE_16BITS(words + 1 + 2 * i);
+ v = EXTRACT_LE_U_2(words + 1 + 2 * i);
ND_PRINT((ndo, "smb_vwv[%d]=%d (0x%X)\n", i, v, v));
}
}
}
ND_TCHECK2(*data, 2);
- bcc = EXTRACT_LE_16BITS(data);
+ bcc = EXTRACT_LE_U_2(data);
ND_PRINT((ndo, "smb_bcc=%u\n", bcc));
if (f2) {
if (bcc > 0)
if (command == 0xFF)
break;
ND_TCHECK2(words[3], 2);
- newsmboffset = EXTRACT_LE_16BITS(words + 3);
+ newsmboffset = EXTRACT_LE_U_2(words + 3);
fn = smbfind(command, smb_fns);
goto trunc;
maxbuf = data + caplen;
type = data[0];
- nbt_len = EXTRACT_BE_16BITS(data + 2);
+ nbt_len = EXTRACT_BE_U_2(data + 2);
length -= 4;
caplen -= 4;
int total, i;
ND_TCHECK2(data[10], 2);
- name_trn_id = EXTRACT_BE_16BITS(data);
+ name_trn_id = EXTRACT_BE_U_2(data);
response = (data[2] >> 7);
opcode = (data[2] >> 3) & 0xF;
nm_flags = ((data[2] & 0x7) << 4) + (data[3] >> 4);
rcode = data[3] & 0xF;
- qdcount = EXTRACT_BE_16BITS(data + 4);
- ancount = EXTRACT_BE_16BITS(data + 6);
- nscount = EXTRACT_BE_16BITS(data + 8);
- arcount = EXTRACT_BE_16BITS(data + 10);
+ qdcount = EXTRACT_BE_U_2(data + 4);
+ ancount = EXTRACT_BE_U_2(data + 6);
+ nscount = EXTRACT_BE_U_2(data + 8);
+ arcount = EXTRACT_BE_U_2(data + 10);
startbuf = data;
if (maxbuf <= data)
if (p == NULL)
goto out;
ND_TCHECK_2(p);
- restype = EXTRACT_BE_16BITS(p);
+ restype = EXTRACT_BE_U_2(p);
p = smb_fdata(ndo, p, "ResType=[rw]\nResClass=[rw]\nTTL=[rD]\n", p + 8, 0);
if (p == NULL)
goto out;
ND_TCHECK_2(p);
- rdlen = EXTRACT_BE_16BITS(p);
+ rdlen = EXTRACT_BE_U_2(p);
ND_PRINT((ndo, "ResourceLength=%d\nResourceData=\n", rdlen));
p += 2;
if (rdlen == 6) {
if (caplen < 4)
goto trunc;
maxbuf = data + caplen;
- smb_len = EXTRACT_BE_24BITS(data + 1);
+ smb_len = EXTRACT_BE_U_3(data + 1);
length -= 4;
caplen -= 4;
if (maxbuf > ndo->ndo_snapend)
maxbuf = ndo->ndo_snapend;
ND_TCHECK(data[4]);
- len = EXTRACT_LE_16BITS(data);
+ len = EXTRACT_LE_U_2(data);
command = data[4];
data2 = data + len;
if (data2 >= maxbuf) {
* +---+---+---+---+---+---+---+---+
* 7 6 5 4 3 2 1 0
*/
- id = EXTRACT_8BITS(p) & ASN_ID_BITS; /* lower 5 bits, range 00-1f */
+ id = EXTRACT_U_1(p) & ASN_ID_BITS; /* lower 5 bits, range 00-1f */
#ifdef notdef
- form = (EXTRACT_8BITS(p) & 0xe0) >> 5; /* move upper 3 bits to lower 3 */
+ form = (EXTRACT_U_1(p) & 0xe0) >> 5; /* move upper 3 bits to lower 3 */
class = form >> 1; /* bits 7&6 -> bits 1&0, range 0-3 */
form &= 0x1; /* bit 5 -> bit 0, range 0-1 */
#else
return -1;
}
ND_TCHECK(*p);
- elem->id = id = (id << 7) | EXTRACT_8BITS(p);
+ elem->id = id = (id << 7) | EXTRACT_U_1(p);
--len;
++hdr;
++p;
}
ND_TCHECK2(*p, noct);
for (; noct-- > 0; len--, hdr++) {
- elem->asnlen = (elem->asnlen << ASN_SHIFT8) | EXTRACT_8BITS(p);
+ elem->asnlen = (elem->asnlen << ASN_SHIFT8) | EXTRACT_U_1(p);
p++;
}
}
if (*p & ASN_BIT8) /* negative */
data = -1;
for (i = elem->asnlen; i-- > 0; p++)
- data = (data << ASN_SHIFT8) | EXTRACT_8BITS(p);
+ data = (data << ASN_SHIFT8) | EXTRACT_U_1(p);
elem->data.integer = data;
break;
}
elem->type = BE_UNS;
data = 0;
for (i = elem->asnlen; i-- > 0; p++)
- data = (data << 8) + EXTRACT_8BITS(p);
+ data = (data << 8) + EXTRACT_U_1(p);
elem->data.uns = data;
break;
}
elem->type = BE_UNS64;
data64 = 0;
for (i = elem->asnlen; i-- > 0; p++)
- data64 = (data64 << 8) + EXTRACT_8BITS(p);
+ data64 = (data64 << 8) + EXTRACT_U_1(p);
elem->data.uns64 = data64;
break;
}
ND_TCHECK(stp_bpdu->port_id);
ND_PRINT((ndo, ", bridge-id %s.%04x, length %u",
stp_print_bridge_id((const u_char *)&stp_bpdu->bridge_id),
- EXTRACT_BE_16BITS(&stp_bpdu->port_id), length));
+ EXTRACT_BE_U_2(&stp_bpdu->port_id), length));
/* in non-verbose mode just print the bridge-id */
if (!ndo->ndo_vflag) {
ND_TCHECK(stp_bpdu->forward_delay);
ND_PRINT((ndo, "\n\tmessage-age %.2fs, max-age %.2fs"
", hello-time %.2fs, forwarding-delay %.2fs",
- (float) EXTRACT_BE_16BITS(&stp_bpdu->message_age) / STP_TIME_BASE,
- (float) EXTRACT_BE_16BITS(&stp_bpdu->max_age) / STP_TIME_BASE,
- (float) EXTRACT_BE_16BITS(&stp_bpdu->hello_time) / STP_TIME_BASE,
- (float) EXTRACT_BE_16BITS(&stp_bpdu->forward_delay) / STP_TIME_BASE));
+ (float) EXTRACT_BE_U_2(&stp_bpdu->message_age) / STP_TIME_BASE,
+ (float) EXTRACT_BE_U_2(&stp_bpdu->max_age) / STP_TIME_BASE,
+ (float) EXTRACT_BE_U_2(&stp_bpdu->hello_time) / STP_TIME_BASE,
+ (float) EXTRACT_BE_U_2(&stp_bpdu->forward_delay) / STP_TIME_BASE));
ND_PRINT((ndo, "\n\troot-id %s, root-pathcost %u",
stp_print_bridge_id((const u_char *)&stp_bpdu->root_id),
- EXTRACT_BE_32BITS(&stp_bpdu->root_path_cost)));
+ EXTRACT_BE_U_4(&stp_bpdu->root_path_cost)));
/* Port role is only valid for 802.1w */
if (stp_bpdu->protocol_version == STP_PROTO_RAPID) {
ND_TCHECK(stp_bpdu->root_path_cost);
ND_PRINT((ndo, "CIST root-id %s, CIST ext-pathcost %u",
stp_print_bridge_id((const u_char *)&stp_bpdu->root_id),
- EXTRACT_BE_32BITS(&stp_bpdu->root_path_cost)));
+ EXTRACT_BE_U_4(&stp_bpdu->root_path_cost)));
ND_TCHECK(stp_bpdu->bridge_id);
ND_PRINT((ndo, "\n\tCIST regional-root-id %s, ",
stp_print_bridge_id((const u_char *)&stp_bpdu->bridge_id)));
ND_TCHECK(stp_bpdu->port_id);
- ND_PRINT((ndo, "CIST port-id %04x,", EXTRACT_BE_16BITS(&stp_bpdu->port_id)));
+ ND_PRINT((ndo, "CIST port-id %04x,", EXTRACT_BE_U_2(&stp_bpdu->port_id)));
ND_TCHECK(stp_bpdu->forward_delay);
ND_PRINT((ndo, "\n\tmessage-age %.2fs, max-age %.2fs"
", hello-time %.2fs, forwarding-delay %.2fs",
- (float) EXTRACT_BE_16BITS(&stp_bpdu->message_age) / STP_TIME_BASE,
- (float) EXTRACT_BE_16BITS(&stp_bpdu->max_age) / STP_TIME_BASE,
- (float) EXTRACT_BE_16BITS(&stp_bpdu->hello_time) / STP_TIME_BASE,
- (float) EXTRACT_BE_16BITS(&stp_bpdu->forward_delay) / STP_TIME_BASE));
+ (float) EXTRACT_BE_U_2(&stp_bpdu->message_age) / STP_TIME_BASE,
+ (float) EXTRACT_BE_U_2(&stp_bpdu->max_age) / STP_TIME_BASE,
+ (float) EXTRACT_BE_U_2(&stp_bpdu->hello_time) / STP_TIME_BASE,
+ (float) EXTRACT_BE_U_2(&stp_bpdu->forward_delay) / STP_TIME_BASE));
ND_TCHECK_2(ptr + MST_BPDU_VER3_LEN_OFFSET);
- ND_PRINT((ndo, "\n\tv3len %d, ", EXTRACT_BE_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET)));
+ ND_PRINT((ndo, "\n\tv3len %d, ", EXTRACT_BE_U_2(ptr + MST_BPDU_VER3_LEN_OFFSET)));
ND_TCHECK_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12);
ND_PRINT((ndo, "MCID Name "));
if (fn_printzp(ndo, ptr + MST_BPDU_CONFIG_NAME_OFFSET, 32, ndo->ndo_snapend))
goto trunc;
ND_PRINT((ndo, ", rev %u,"
"\n\t\tdigest %08x%08x%08x%08x, ",
- EXTRACT_BE_16BITS(ptr + MST_BPDU_CONFIG_NAME_OFFSET + 32),
- EXTRACT_BE_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET),
- EXTRACT_BE_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 4),
- EXTRACT_BE_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 8),
- EXTRACT_BE_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12)));
+ EXTRACT_BE_U_2(ptr + MST_BPDU_CONFIG_NAME_OFFSET + 32),
+ EXTRACT_BE_U_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET),
+ EXTRACT_BE_U_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 4),
+ EXTRACT_BE_U_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 8),
+ EXTRACT_BE_U_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12)));
ND_TCHECK_4(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET);
ND_PRINT((ndo, "CIST int-root-pathcost %u,",
- EXTRACT_BE_32BITS(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET)));
+ EXTRACT_BE_U_4(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET)));
ND_TCHECK_BRIDGE_ID(ptr + MST_BPDU_CIST_BRIDGE_ID_OFFSET);
ND_PRINT((ndo, "\n\tCIST bridge-id %s, ",
/* Dump all MSTI's */
ND_TCHECK_2(ptr + MST_BPDU_VER3_LEN_OFFSET);
- v3len = EXTRACT_BE_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET);
+ v3len = EXTRACT_BE_U_2(ptr + MST_BPDU_VER3_LEN_OFFSET);
if (v3len > MST_BPDU_CONFIG_INFO_LENGTH) {
len = v3len - MST_BPDU_CONFIG_INFO_LENGTH;
offset = MST_BPDU_MSTI_OFFSET;
while (len >= MST_BPDU_MSTI_LENGTH) {
ND_TCHECK2(*(ptr + offset), MST_BPDU_MSTI_LENGTH);
- msti = EXTRACT_BE_16BITS(ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET);
+ msti = EXTRACT_BE_U_2(ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET);
msti = msti & 0x0FFF;
ND_PRINT((ndo, "\n\tMSTI %d, Flags [%s], port-role %s",
ND_PRINT((ndo, "\n\t\tMSTI regional-root-id %s, pathcost %u",
stp_print_bridge_id(ptr + offset +
MST_BPDU_MSTI_ROOT_PRIO_OFFSET),
- EXTRACT_BE_32BITS(ptr + offset + MST_BPDU_MSTI_ROOT_PATH_COST_OFFSET)));
+ EXTRACT_BE_U_4(ptr + offset + MST_BPDU_MSTI_ROOT_PATH_COST_OFFSET)));
ND_PRINT((ndo, "\n\t\tMSTI bridge-prio %d, port-prio %d, hops %d",
ptr[offset + MST_BPDU_MSTI_BRIDGE_PRIO_OFFSET] >> 4,
ptr[offset + MST_BPDU_MSTI_PORT_PRIO_OFFSET] >> 4,
ptr = (const u_char *)stp_bpdu;
ND_TCHECK_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 16);
- ND_PRINT((ndo, "\n\tv4len %d, ", EXTRACT_BE_16BITS(ptr + offset)));
+ ND_PRINT((ndo, "\n\tv4len %d, ", EXTRACT_BE_U_2(ptr + offset)));
ND_PRINT((ndo, "AUXMCID Name "));
if (fn_printzp(ndo, ptr + offset + SPB_BPDU_CONFIG_NAME_OFFSET, 32,
ndo->ndo_snapend))
goto trunc;
ND_PRINT((ndo, ", Rev %u,\n\t\tdigest %08x%08x%08x%08x",
- EXTRACT_BE_16BITS(ptr + offset + SPB_BPDU_CONFIG_REV_OFFSET),
- EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET),
- EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 4),
- EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 8),
- EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 12)));
+ EXTRACT_BE_U_2(ptr + offset + SPB_BPDU_CONFIG_REV_OFFSET),
+ EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET),
+ EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 4),
+ EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 8),
+ EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 12)));
ND_PRINT((ndo, "\n\tAgreement num %d, Discarded Agreement num %d, Agreement valid-"
"flag %d,\n\tRestricted role-flag: %d, Format id %d cap %d, "
ptr[offset + SPB_BPDU_AGREEMENT_FORMAT_OFFSET]&0x00ff,
ptr[offset + SPB_BPDU_AGREEMENT_CON_OFFSET]>>4,
ptr[offset + SPB_BPDU_AGREEMENT_CON_OFFSET]&0x00ff,
- EXTRACT_BE_16BITS(ptr + offset + SPB_BPDU_AGREEMENT_EDGE_OFFSET),
- EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET),
- EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 4),
- EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 8),
- EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 12),
- EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 16)));
+ EXTRACT_BE_U_2(ptr + offset + SPB_BPDU_AGREEMENT_EDGE_OFFSET),
+ EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET),
+ EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 4),
+ EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 8),
+ EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 12),
+ EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 16)));
return 1;
trunc:
goto trunc;
ND_TCHECK(stp_bpdu->protocol_id);
- if (EXTRACT_BE_16BITS(&stp_bpdu->protocol_id)) {
+ if (EXTRACT_BE_U_2(&stp_bpdu->protocol_id)) {
ND_PRINT((ndo, "unknown STP version, length %u", length));
return;
}
/* Validate v3 length */
ND_TCHECK_2(p + MST_BPDU_VER3_LEN_OFFSET);
- mstp_len = EXTRACT_BE_16BITS(p + MST_BPDU_VER3_LEN_OFFSET);
+ mstp_len = EXTRACT_BE_U_2(p + MST_BPDU_VER3_LEN_OFFSET);
mstp_len += 2; /* length encoding itself is 2 bytes */
if (length < (sizeof(struct stp_bpdu_) + mstp_len)) {
goto trunc;
{
/* Validate v4 length */
ND_TCHECK_2(p + MST_BPDU_VER3_LEN_OFFSET + mstp_len);
- spb_len = EXTRACT_BE_16BITS(p + MST_BPDU_VER3_LEN_OFFSET + mstp_len);
+ spb_len = EXTRACT_BE_U_2(p + MST_BPDU_VER3_LEN_OFFSET + mstp_len);
spb_len += 2;
if (length < (sizeof(struct stp_bpdu_) + mstp_len + spb_len) ||
spb_len < SPB_BPDU_MIN_LEN) {
break;
}
- vci = EXTRACT_BE_16BITS(p + VCI_POS);
+ vci = EXTRACT_BE_U_2(p + VCI_POS);
vpi = p[VPI_POS];
p += PKT_BEGIN_POS;
if (!ndo->ndo_nflag) {
snprintf(srcid, sizeof(srcid), "0x%x",
- EXTRACT_BE_32BITS(&rp->rm_xid));
+ EXTRACT_BE_U_4(&rp->rm_xid));
strlcpy(dstid, "sunrpc", sizeof(dstid));
} else {
snprintf(srcid, sizeof(srcid), "0x%x",
- EXTRACT_BE_32BITS(&rp->rm_xid));
+ EXTRACT_BE_U_4(&rp->rm_xid));
snprintf(dstid, sizeof(dstid), "0x%x", SUNRPC_PMAPPORT);
}
}
ND_PRINT((ndo, " %s", tok2str(proc2str, " proc #%u",
- EXTRACT_BE_32BITS(&rp->rm_call.cb_proc))));
- x = EXTRACT_BE_32BITS(&rp->rm_call.cb_rpcvers);
+ EXTRACT_BE_U_4(&rp->rm_call.cb_proc))));
+ x = EXTRACT_BE_U_4(&rp->rm_call.cb_rpcvers);
if (x != 2)
ND_PRINT((ndo, " [rpcver %u]", x));
- switch (EXTRACT_BE_32BITS(&rp->rm_call.cb_proc)) {
+ switch (EXTRACT_BE_U_4(&rp->rm_call.cb_proc)) {
case SUNRPC_PMAPPROC_SET:
case SUNRPC_PMAPPROC_UNSET:
case SUNRPC_PMAPPROC_GETPORT:
case SUNRPC_PMAPPROC_CALLIT:
- x = EXTRACT_BE_32BITS(&rp->rm_call.cb_prog);
+ x = EXTRACT_BE_U_4(&rp->rm_call.cb_prog);
if (!ndo->ndo_nflag)
ND_PRINT((ndo, " %s", progstr(x)));
else
ND_PRINT((ndo, " %u", x));
- ND_PRINT((ndo, ".%u", EXTRACT_BE_32BITS(&rp->rm_call.cb_vers)));
+ ND_PRINT((ndo, ".%u", EXTRACT_BE_U_4(&rp->rm_call.cb_vers)));
break;
}
}
sp = (const struct symantec_header *)bp;
- etype = EXTRACT_BE_16BITS(&sp->ether_type);
+ etype = EXTRACT_BE_U_2(&sp->ether_type);
if (!ndo->ndo_qflag) {
if (etype <= ETHERMTU)
ND_PRINT((ndo, "invalid ethertype %u", etype));
sp = (const struct symantec_header *)p;
p += sizeof (struct symantec_header);
- ether_type = EXTRACT_BE_16BITS(&sp->ether_type);
+ ether_type = EXTRACT_BE_U_2(&sp->ether_type);
if (ether_type <= ETHERMTU) {
/* ether_type not known, print raw packet */
return;
}
- sport = EXTRACT_BE_16BITS(&tp->th_sport);
- dport = EXTRACT_BE_16BITS(&tp->th_dport);
+ sport = EXTRACT_BE_U_2(&tp->th_sport);
+ dport = EXTRACT_BE_U_2(&tp->th_dport);
if (ip6) {
if (ip6->ip6_nxt == IPPROTO_TCP) {
return;
}
- seq = EXTRACT_BE_32BITS(&tp->th_seq);
- ack = EXTRACT_BE_32BITS(&tp->th_ack);
- win = EXTRACT_BE_16BITS(&tp->th_win);
- urp = EXTRACT_BE_16BITS(&tp->th_urp);
+ seq = EXTRACT_BE_U_4(&tp->th_seq);
+ ack = EXTRACT_BE_U_4(&tp->th_ack);
+ win = EXTRACT_BE_U_2(&tp->th_win);
+ urp = EXTRACT_BE_U_2(&tp->th_urp);
if (ndo->ndo_qflag) {
ND_PRINT((ndo, "tcp %d", length - hlen));
if (IP_V(ip) == 4) {
if (ND_TTEST2(tp->th_sport, length)) {
sum = tcp_cksum(ndo, ip, tp, length);
- tcp_sum = EXTRACT_BE_16BITS(&tp->th_sum);
+ tcp_sum = EXTRACT_BE_U_2(&tp->th_sum);
ND_PRINT((ndo, ", cksum 0x%04x", tcp_sum));
if (sum != 0)
} else if (IP_V(ip) == 6 && ip6->ip6_plen) {
if (ND_TTEST2(tp->th_sport, length)) {
sum = tcp6_cksum(ndo, ip6, tp, length);
- tcp_sum = EXTRACT_BE_16BITS(&tp->th_sum);
+ tcp_sum = EXTRACT_BE_U_2(&tp->th_sum);
ND_PRINT((ndo, ", cksum 0x%04x", tcp_sum));
if (sum != 0)
if (ch != '\0')
ND_PRINT((ndo, "%c", ch));
ND_TCHECK(*cp);
- opt = EXTRACT_8BITS(cp);
+ opt = EXTRACT_U_1(cp);
cp++;
if (ZEROLENOPT(opt))
len = 1;
else {
ND_TCHECK(*cp);
- len = EXTRACT_8BITS(cp);
+ len = EXTRACT_U_1(cp);
cp++; /* total including type, len */
if (len < 2 || len > hlen)
goto bad;
case TCPOPT_MAXSEG:
datalen = 2;
LENCHECK(datalen);
- ND_PRINT((ndo, " %u", EXTRACT_BE_16BITS(cp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_2(cp)));
break;
case TCPOPT_WSCALE:
ND_PRINT((ndo, " %d ", datalen / 8));
for (i = 0; i < datalen; i += 8) {
LENCHECK(i + 4);
- s = EXTRACT_BE_32BITS(cp + i);
+ s = EXTRACT_BE_U_4(cp + i);
LENCHECK(i + 8);
- e = EXTRACT_BE_32BITS(cp + i + 4);
+ e = EXTRACT_BE_U_4(cp + i + 4);
if (rev) {
s -= thseq;
e -= thseq;
*/
datalen = 4;
LENCHECK(datalen);
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(cp)));
break;
case TCPOPT_TIMESTAMP:
datalen = 8;
LENCHECK(datalen);
ND_PRINT((ndo, " val %u ecr %u",
- EXTRACT_BE_32BITS(cp),
- EXTRACT_BE_32BITS(cp + 4)));
+ EXTRACT_BE_U_4(cp),
+ EXTRACT_BE_U_4(cp + 4)));
break;
case TCPOPT_SIGNATURE:
case TCPOPT_UTO:
datalen = 2;
LENCHECK(datalen);
- utoval = EXTRACT_BE_16BITS(cp);
+ utoval = EXTRACT_BE_U_2(cp);
ND_PRINT((ndo, " 0x%x", utoval));
if (utoval & 0x0001)
utoval = (utoval >> 1) * 60;
if (datalen < 2)
goto bad;
/* RFC6994 */
- magic = EXTRACT_BE_16BITS(cp);
+ magic = EXTRACT_BE_U_2(cp);
ND_PRINT((ndo, "-"));
switch(magic) {
register const struct sunrpc_msg *rp;
enum sunrpc_msg_type direction;
- fraglen = EXTRACT_BE_32BITS(bp) & 0x7FFFFFFF;
+ fraglen = EXTRACT_BE_U_4(bp) & 0x7FFFFFFF;
if (fraglen > (length) - 4)
fraglen = (length) - 4;
rp = (const struct sunrpc_msg *)(bp + 4);
if (ND_TTEST(rp->rm_direction)) {
- direction = (enum sunrpc_msg_type) EXTRACT_BE_32BITS(&rp->rm_direction);
+ direction = (enum sunrpc_msg_type) EXTRACT_BE_U_4(&rp->rm_direction);
if (dport == NFS_PORT && direction == SUNRPC_CALL) {
- ND_PRINT((ndo, ": NFS request xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid)));
+ ND_PRINT((ndo, ": NFS request xid %u ", EXTRACT_BE_U_4(&rp->rm_xid)));
nfsreq_noaddr_print(ndo, (const u_char *)rp, fraglen, (const u_char *)ip);
return;
}
if (sport == NFS_PORT && direction == SUNRPC_REPLY) {
- ND_PRINT((ndo, ": NFS reply xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid)));
+ ND_PRINT((ndo, ": NFS reply xid %u ", EXTRACT_BE_U_4(&rp->rm_xid)));
nfsreply_noaddr_print(ndo, (const u_char *)rp, fraglen, (const u_char *)ip);
return;
}
}
ND_PRINT((ndo, " "));
while (length-- && sp < ndo->ndo_snapend) {
- c = EXTRACT_8BITS(sp);
+ c = EXTRACT_U_1(sp);
sp++;
safeputchar(ndo, c);
}
MD5_Update(&ctx, (const char *)&ip->ip_dst, sizeof(ip->ip_dst));
MD5_Update(&ctx, (const char *)&zero_proto, sizeof(zero_proto));
MD5_Update(&ctx, (const char *)&ip->ip_p, sizeof(ip->ip_p));
- tlen = EXTRACT_BE_16BITS(&ip->ip_len) - IP_HL(ip) * 4;
+ tlen = EXTRACT_BE_U_2(&ip->ip_len) - IP_HL(ip) * 4;
tlen = htons(tlen);
MD5_Update(&ctx, (const char *)&tlen, sizeof(tlen));
} else if (IP_V(ip) == 6) {
ip6 = (const struct ip6_hdr *)ip;
MD5_Update(&ctx, (const char *)&ip6->ip6_src, sizeof(ip6->ip6_src));
MD5_Update(&ctx, (const char *)&ip6->ip6_dst, sizeof(ip6->ip6_dst));
- len32 = htonl(EXTRACT_BE_16BITS(&ip6->ip6_plen));
+ len32 = htonl(EXTRACT_BE_U_2(&ip6->ip6_plen));
MD5_Update(&ctx, (const char *)&len32, sizeof(len32));
nxt = 0;
MD5_Update(&ctx, (const char *)&nxt, sizeof(nxt));
if (length < 2)
goto trunc;
ND_TCHECK_2(bp);
- opcode = EXTRACT_BE_16BITS(bp);
+ opcode = EXTRACT_BE_U_2(bp);
cp = tok2str(op2str, "tftp-#%d", opcode);
ND_PRINT((ndo, " %s", cp));
/* Bail if bogus opcode */
if (length < 2)
goto trunc; /* no block number */
ND_TCHECK_2(bp);
- ND_PRINT((ndo, " block %d", EXTRACT_BE_16BITS(bp)));
+ ND_PRINT((ndo, " block %d", EXTRACT_BE_U_2(bp)));
break;
case TFTP_ERROR:
goto trunc; /* no error code */
ND_TCHECK_2(bp);
ND_PRINT((ndo, " %s", tok2str(err2str, "tftp-err-#%d \"",
- EXTRACT_BE_16BITS(bp))));
+ EXTRACT_BE_U_2(bp))));
bp += 2;
length -= 2;
/* Print error message string */
case TSP_SETDATE:
case TSP_SETDATEREQ:
ND_TCHECK(tsp->tsp_time);
- sec = EXTRACT_BE_32BITS(&tsp->tsp_time.tv_sec);
- usec = EXTRACT_BE_32BITS(&tsp->tsp_time.tv_usec);
+ sec = EXTRACT_BE_U_4(&tsp->tsp_time.tv_sec);
+ usec = EXTRACT_BE_U_4(&tsp->tsp_time.tv_usec);
/* XXX The comparison below is always false? */
if (usec < 0)
/* invalid, skip the rest of the packet */
u_int dest_node;
ND_TCHECK(ap->dest_port);
- w0 = EXTRACT_BE_32BITS(&ap->w0);
+ w0 = EXTRACT_BE_U_4(&ap->w0);
user = TIPC_USER(w0);
hsize = TIPC_HSIZE(w0);
msize = TIPC_MSIZE(w0);
- w1 = EXTRACT_BE_32BITS(&ap->w1);
+ w1 = EXTRACT_BE_U_4(&ap->w1);
mtype = TIPC_MTYPE(w1);
- prev_node = EXTRACT_BE_32BITS(&ap->prev_node);
- orig_port = EXTRACT_BE_32BITS(&ap->orig_port);
- dest_port = EXTRACT_BE_32BITS(&ap->dest_port);
+ prev_node = EXTRACT_BE_U_4(&ap->prev_node);
+ orig_port = EXTRACT_BE_U_4(&ap->orig_port);
+ dest_port = EXTRACT_BE_U_4(&ap->dest_port);
if (hsize <= 6) {
ND_PRINT((ndo, "TIPC v%u.0 %u.%u.%u:%u > %u, headerlength %u bytes, MessageSize %u bytes, %s, messageType %s",
TIPC_VER(w0),
tok2str(tipcmtype_values, "Unknown", mtype)));
} else {
ND_TCHECK(ap->dest_node);
- orig_node = EXTRACT_BE_32BITS(&ap->orig_node);
- dest_node = EXTRACT_BE_32BITS(&ap->dest_node);
+ orig_node = EXTRACT_BE_U_4(&ap->orig_node);
+ dest_node = EXTRACT_BE_U_4(&ap->dest_node);
ND_PRINT((ndo, "TIPC v%u.0 %u.%u.%u:%u > %u.%u.%u:%u, headerlength %u bytes, MessageSize %u bytes, %s, messageType %s",
TIPC_VER(w0),
TIPC_ZONE(orig_node), TIPC_CLUSTER(orig_node), TIPC_NODE(orig_node),
if (ndo->ndo_vflag) {
broadcast_ack = TIPC_BROADCAST_ACK(w1);
- w2 = EXTRACT_BE_32BITS(&ap->w2);
+ w2 = EXTRACT_BE_U_4(&ap->w2);
link_ack = TIPC_LINK_ACK(w2);
link_seq = TIPC_LINK_SEQ(w2);
ND_PRINT((ndo, "\n\tPrevious Node %u.%u.%u, Broadcast Ack %u, Link Ack %u, Link Sequence %u",
u_int link_tol;
ND_TCHECK(ap->dest_node);
- w0 = EXTRACT_BE_32BITS(&ap->w0);
+ w0 = EXTRACT_BE_U_4(&ap->w0);
user = TIPC_USER(w0);
hsize = TIPC_HSIZE(w0);
msize = TIPC_MSIZE(w0);
- w1 = EXTRACT_BE_32BITS(&ap->w1);
+ w1 = EXTRACT_BE_U_4(&ap->w1);
mtype = TIPC_MTYPE(w1);
- orig_node = EXTRACT_BE_32BITS(&ap->orig_node);
- dest_node = EXTRACT_BE_32BITS(&ap->dest_node);
+ orig_node = EXTRACT_BE_U_4(&ap->orig_node);
+ dest_node = EXTRACT_BE_U_4(&ap->dest_node);
ND_PRINT((ndo, "TIPC v%u.0 %u.%u.%u > %u.%u.%u, headerlength %u bytes, MessageSize %u bytes, %s, messageType %s (0x%08x)",
TIPC_VER(w0),
TIPC_ZONE(orig_node), TIPC_CLUSTER(orig_node), TIPC_NODE(orig_node),
ND_TCHECK(*ap);
seq_gap = TIPC_SEQ_GAP(w1);
broadcast_ack = TIPC_BROADCAST_ACK(w1);
- w2 = EXTRACT_BE_32BITS(&ap->w2);
+ w2 = EXTRACT_BE_U_4(&ap->w2);
bc_gap_after = TIPC_BC_GAP_AFTER(w2);
bc_gap_to = TIPC_BC_GAP_TO(w2);
- prev_node = EXTRACT_BE_32BITS(&ap->prev_node);
- w4 = EXTRACT_BE_32BITS(&ap->w4);
+ prev_node = EXTRACT_BE_U_4(&ap->prev_node);
+ w4 = EXTRACT_BE_U_4(&ap->w4);
last_sent_frag = TIPC_LAST_SENT_FRAG(w4);
next_sent_frag = TIPC_NEXT_SENT_FRAG(w4);
- w5 = EXTRACT_BE_32BITS(&ap->w5);
+ w5 = EXTRACT_BE_U_4(&ap->w5);
sess_no = TIPC_SESS_NO(w5);
- trans_seq = EXTRACT_BE_32BITS(&ap->trans_seq);
- w9 = EXTRACT_BE_32BITS(&ap->w9);
+ trans_seq = EXTRACT_BE_U_4(&ap->trans_seq);
+ w9 = EXTRACT_BE_U_4(&ap->w9);
msg_cnt = TIPC_MSG_CNT(w9);
link_tol = TIPC_LINK_TOL(w9);
ND_PRINT((ndo, "\n\tPrevious Node %u.%u.%u, Session No. %u, Broadcast Ack %u, Sequence Gap %u, Broadcast Gap After %u, Broadcast Gap To %u, Last Sent Packet No. %u, Next sent Packet No. %u, Transport Sequence %u, msg_count %u, Link Tolerance %u",
u_int media_id;
ND_TCHECK(ap->prev_node);
- w0 = EXTRACT_BE_32BITS(&ap->w0);
+ w0 = EXTRACT_BE_U_4(&ap->w0);
user = TIPC_USER(w0);
hsize = TIPC_HSIZE(w0);
msize = TIPC_MSIZE(w0);
- w1 = EXTRACT_BE_32BITS(&ap->w1);
+ w1 = EXTRACT_BE_U_4(&ap->w1);
mtype = TIPC_MTYPE(w1);
- dest_domain = EXTRACT_BE_32BITS(&ap->dest_domain);
- prev_node = EXTRACT_BE_32BITS(&ap->prev_node);
+ dest_domain = EXTRACT_BE_U_4(&ap->dest_domain);
+ prev_node = EXTRACT_BE_U_4(&ap->prev_node);
ND_PRINT((ndo, "TIPC v%u.0 %u.%u.%u > %u.%u.%u, headerlength %u bytes, MessageSize %u bytes, %s, messageType %s",
TIPC_VER(w0),
if (ndo->ndo_vflag) {
ND_TCHECK(ap->w5);
node_sig = TIPC_NODE_SIG(w1);
- ntwrk_id = EXTRACT_BE_32BITS(&ap->ntwrk_id);
- w5 = EXTRACT_BE_32BITS(&ap->w5);
+ ntwrk_id = EXTRACT_BE_U_4(&ap->ntwrk_id);
+ w5 = EXTRACT_BE_U_4(&ap->w5);
media_id = TIPC_MEDIA_ID(w5);
ND_PRINT((ndo, "\n\tNodeSignature %u, network_id %u, media_id %u",
node_sig, ntwrk_id, media_id));
ap = (const struct tipc_pkthdr *)bp;
ND_TCHECK(ap->w0);
- w0 = EXTRACT_BE_32BITS(&ap->w0);
+ w0 = EXTRACT_BE_U_4(&ap->w0);
user = TIPC_USER(w0);
switch (user)
#define FRAME_TYPE(trp) (((trp)->token_fc & 0xC0) >> 6)
#define TOKEN_FC_LLC 1
-#define BROADCAST(trp) ((EXTRACT_BE_16BITS(&(trp)->token_rcf) & 0xE000) >> 13)
-#define RIF_LENGTH(trp) ((EXTRACT_BE_16BITS(&(trp)->token_rcf) & 0x1f00) >> 8)
-#define DIRECTION(trp) ((EXTRACT_BE_16BITS(&(trp)->token_rcf) & 0x0080) >> 7)
-#define LARGEST_FRAME(trp) ((EXTRACT_BE_16BITS(&(trp)->token_rcf) & 0x0070) >> 4)
-#define RING_NUMBER(trp, x) ((EXTRACT_BE_16BITS(&(trp)->token_rseg[x]) & 0xfff0) >> 4)
-#define BRIDGE_NUMBER(trp, x) ((EXTRACT_BE_16BITS(&(trp)->token_rseg[x]) & 0x000f))
+#define BROADCAST(trp) ((EXTRACT_BE_U_2(&(trp)->token_rcf) & 0xE000) >> 13)
+#define RIF_LENGTH(trp) ((EXTRACT_BE_U_2(&(trp)->token_rcf) & 0x1f00) >> 8)
+#define DIRECTION(trp) ((EXTRACT_BE_U_2(&(trp)->token_rcf) & 0x0080) >> 7)
+#define LARGEST_FRAME(trp) ((EXTRACT_BE_U_2(&(trp)->token_rcf) & 0x0070) >> 4)
+#define RING_NUMBER(trp, x) ((EXTRACT_BE_U_2(&(trp)->token_rseg[x]) & 0xfff0) >> 4)
+#define BRIDGE_NUMBER(trp, x) ((EXTRACT_BE_U_2(&(trp)->token_rseg[x]) & 0x000f))
#define SEGMENT_COUNT(trp) ((int)((RIF_LENGTH(trp) - 2) / 2))
struct token_header {
ND_PRINT((ndo, " [%d:%d]", RING_NUMBER(trp, seg),
BRIDGE_NUMBER(trp, seg)));
} else {
- ND_PRINT((ndo, "rt = %x", EXTRACT_BE_16BITS(&trp->token_rcf)));
+ ND_PRINT((ndo, "rt = %x", EXTRACT_BE_U_2(&trp->token_rcf)));
for (seg = 0; seg < SEGMENT_COUNT(trp); seg++)
- ND_PRINT((ndo, ":%x", EXTRACT_BE_16BITS(&trp->token_rseg[seg])));
+ ND_PRINT((ndo, ":%x", EXTRACT_BE_U_2(&trp->token_rseg[seg])));
}
ND_PRINT((ndo, " (%s) ", largest_frame[LARGEST_FRAME(trp)]));
} else {
UDLD_EXTRACT_VERSION(*tptr),
tok2str(udld_code_values, "Reserved", code),
code,
- bittok2str(udld_flags_values, "none", EXTRACT_8BITS((tptr + 1))),
- EXTRACT_8BITS((tptr + 1)),
+ bittok2str(udld_flags_values, "none", EXTRACT_U_1((tptr + 1))),
+ EXTRACT_U_1((tptr + 1)),
length));
/*
return;
}
- ND_PRINT((ndo, "\n\tChecksum 0x%04x (unverified)", EXTRACT_BE_16BITS(tptr + 2)));
+ ND_PRINT((ndo, "\n\tChecksum 0x%04x (unverified)", EXTRACT_BE_U_2(tptr + 2)));
tptr += UDLD_HEADER_LEN;
while (tptr < (pptr+length)) {
ND_TCHECK2(*tptr, 4);
- type = EXTRACT_BE_16BITS(tptr);
- len = EXTRACT_BE_16BITS(tptr + 2);
+ type = EXTRACT_BE_U_2(tptr);
+ len = EXTRACT_BE_U_2(tptr + 2);
ND_PRINT((ndo, "\n\t%s (0x%04x) TLV, length %u",
tok2str(udld_tlv_values, "Unknown", type),
case UDLD_SEQ_NUMBER_TLV:
if (len != 4)
goto invalid;
- ND_PRINT((ndo, ", %u", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, ", %u", EXTRACT_BE_U_4(tptr)));
break;
default:
u_int ts;
ND_TCHECK_2((const u_int *)hdr);
- ts = EXTRACT_BE_16BITS(hdr);
+ ts = EXTRACT_BE_U_2(hdr);
if ((ts & 0xf060) != 0) {
/* probably vt */
ND_TCHECK_2(&up->uh_ulen);
ND_PRINT((ndo, "udp/vt %u %d / %d",
- (uint32_t)(EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up)),
+ (uint32_t)(EXTRACT_BE_U_2(&up->uh_ulen) - sizeof(*up)),
ts & 0x3ff, ts >> 10));
} else {
/* probably vat */
uint32_t i0, i1;
ND_TCHECK_4(&((const u_int *)hdr)[0]);
- i0 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[0]);
+ i0 = EXTRACT_BE_U_4(&((const u_int *)hdr)[0]);
ND_TCHECK_4(&((const u_int *)hdr)[1]);
- i1 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[1]);
+ i1 = EXTRACT_BE_U_4(&((const u_int *)hdr)[1]);
ND_TCHECK_2(&up->uh_ulen);
ND_PRINT((ndo, "udp/vat %u c%d %u%s",
- (uint32_t)(EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up) - 8),
+ (uint32_t)(EXTRACT_BE_U_2(&up->uh_ulen) - sizeof(*up) - 8),
i0 & 0xffff,
i1, i0 & 0x800000? "*" : ""));
/* audio format */
const char * ptype;
ND_TCHECK_4(&((const u_int *)hdr)[0]);
- i0 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[0]);
+ i0 = EXTRACT_BE_U_4(&((const u_int *)hdr)[0]);
ND_TCHECK_4(&((const u_int *)hdr)[1]);
- i1 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[1]);
+ i1 = EXTRACT_BE_U_4(&((const u_int *)hdr)[1]);
ND_TCHECK_2(&up->uh_ulen);
- dlen = EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up) - 8;
+ dlen = EXTRACT_BE_U_2(&up->uh_ulen) - sizeof(*up) - 8;
ip += 2;
len >>= 2;
len -= 2;
i1));
if (ndo->ndo_vflag) {
ND_TCHECK_4(&((const u_int *)hdr)[2]);
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&((const u_int *)hdr)[2])));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(&((const u_int *)hdr)[2])));
if (hasopt) {
u_int i2, optlen;
do {
ND_TCHECK_4(ip);
- i2 = EXTRACT_BE_32BITS(ip);
+ i2 = EXTRACT_BE_U_4(ip);
optlen = (i2 >> 16) & 0xff;
if (optlen == 0 || optlen > len) {
ND_PRINT((ndo, " !opt"));
if (hasext) {
u_int i2, extlen;
ND_TCHECK_4(ip);
- i2 = EXTRACT_BE_32BITS(ip);
+ i2 = EXTRACT_BE_U_4(ip);
extlen = (i2 & 0xffff) + 1;
if (extlen > len) {
ND_PRINT((ndo, " !ext"));
}
ND_TCHECK_4(ip);
if (contype == 0x1f) /*XXX H.261 */
- ND_PRINT((ndo, " 0x%04x", EXTRACT_BE_32BITS(ip) >> 16));
+ ND_PRINT((ndo, " 0x%04x", EXTRACT_BE_U_4(ip) >> 16));
}
trunc:
if ((const u_char *)(rh + 1) > ep)
goto trunc;
ND_TCHECK(*rh);
- len = (EXTRACT_BE_16BITS(&rh->rh_len) + 1) * 4;
- flags = EXTRACT_BE_16BITS(&rh->rh_flags);
+ len = (EXTRACT_BE_U_2(&rh->rh_len) + 1) * 4;
+ flags = EXTRACT_BE_U_2(&rh->rh_flags);
cnt = (flags >> 8) & 0x1f;
switch (flags & 0xff) {
case RTCP_PT_SR:
if (len != cnt * sizeof(*rr) + sizeof(*sr) + sizeof(*rh))
ND_PRINT((ndo, " [%d]", len));
if (ndo->ndo_vflag)
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(&rh->rh_ssrc)));
if ((const u_char *)(sr + 1) > ep)
goto trunc;
ND_TCHECK(*sr);
- ts = (double)(EXTRACT_BE_32BITS(&sr->sr_ntp.upper)) +
- ((double)(EXTRACT_BE_32BITS(&sr->sr_ntp.lower)) /
+ ts = (double)(EXTRACT_BE_U_4(&sr->sr_ntp.upper)) +
+ ((double)(EXTRACT_BE_U_4(&sr->sr_ntp.lower)) /
4294967296.0);
- ND_PRINT((ndo, " @%.2f %u %up %ub", ts, EXTRACT_BE_32BITS(&sr->sr_ts),
- EXTRACT_BE_32BITS(&sr->sr_np), EXTRACT_BE_32BITS(&sr->sr_nb)));
+ ND_PRINT((ndo, " @%.2f %u %up %ub", ts, EXTRACT_BE_U_4(&sr->sr_ts),
+ EXTRACT_BE_U_4(&sr->sr_np), EXTRACT_BE_U_4(&sr->sr_nb)));
rr = (const struct rtcp_rr *)(sr + 1);
break;
case RTCP_PT_RR:
ND_PRINT((ndo, " [%d]", len));
rr = (const struct rtcp_rr *)(rh + 1);
if (ndo->ndo_vflag)
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(&rh->rh_ssrc)));
break;
case RTCP_PT_SDES:
ND_PRINT((ndo, " sdes %d", len));
if (ndo->ndo_vflag)
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(&rh->rh_ssrc)));
cnt = 0;
break;
case RTCP_PT_BYE:
ND_PRINT((ndo, " bye %d", len));
if (ndo->ndo_vflag)
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(&rh->rh_ssrc)));
cnt = 0;
break;
default:
goto trunc;
ND_TCHECK(*rr);
if (ndo->ndo_vflag)
- ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rr->rr_srcid)));
- ts = (double)(EXTRACT_BE_32BITS(&rr->rr_lsr)) / 65536.;
- dts = (double)(EXTRACT_BE_32BITS(&rr->rr_dlsr)) / 65536.;
+ ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(&rr->rr_srcid)));
+ ts = (double)(EXTRACT_BE_U_4(&rr->rr_lsr)) / 65536.;
+ dts = (double)(EXTRACT_BE_U_4(&rr->rr_dlsr)) / 65536.;
ND_PRINT((ndo, " %ul %us %uj @%.2f+%.2f",
- EXTRACT_BE_32BITS(&rr->rr_nl) & 0x00ffffff,
- EXTRACT_BE_32BITS(&rr->rr_ls),
- EXTRACT_BE_32BITS(&rr->rr_dv), ts, dts));
+ EXTRACT_BE_U_4(&rr->rr_nl) & 0x00ffffff,
+ EXTRACT_BE_U_4(&rr->rr_ls),
+ EXTRACT_BE_U_4(&rr->rr_dv), ts, dts));
}
return (hdr + len);
goto trunc;
}
- sport = EXTRACT_BE_16BITS(&up->uh_sport);
- dport = EXTRACT_BE_16BITS(&up->uh_dport);
+ sport = EXTRACT_BE_U_2(&up->uh_sport);
+ dport = EXTRACT_BE_U_2(&up->uh_dport);
if (length < sizeof(struct udphdr)) {
udpipaddr_print(ndo, ip, sport, dport);
udpipaddr_print(ndo, ip, sport, dport);
goto trunc;
}
- ulen = EXTRACT_BE_16BITS(&up->uh_ulen);
+ ulen = EXTRACT_BE_U_2(&up->uh_ulen);
if (ulen < sizeof(struct udphdr)) {
udpipaddr_print(ndo, ip, sport, dport);
ND_PRINT((ndo, "truncated-udplength %d", ulen));
case PT_RPC:
rp = (const struct sunrpc_msg *)(up + 1);
- direction = (enum sunrpc_msg_type) EXTRACT_BE_32BITS(&rp->rm_direction);
+ direction = (enum sunrpc_msg_type) EXTRACT_BE_U_4(&rp->rm_direction);
if (direction == SUNRPC_CALL)
sunrpc_print(ndo, (const u_char *)rp, length,
(const u_char *)ip);
rp = (const struct sunrpc_msg *)(up + 1);
if (ND_TTEST(rp->rm_direction)) {
- direction = (enum sunrpc_msg_type) EXTRACT_BE_32BITS(&rp->rm_direction);
+ direction = (enum sunrpc_msg_type) EXTRACT_BE_U_4(&rp->rm_direction);
if (dport == NFS_PORT && direction == SUNRPC_CALL) {
- ND_PRINT((ndo, "NFS request xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid)));
+ ND_PRINT((ndo, "NFS request xid %u ", EXTRACT_BE_U_4(&rp->rm_xid)));
nfsreq_noaddr_print(ndo, (const u_char *)rp, length,
(const u_char *)ip);
return;
}
if (sport == NFS_PORT && direction == SUNRPC_REPLY) {
- ND_PRINT((ndo, "NFS reply xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid)));
+ ND_PRINT((ndo, "NFS reply xid %u ", EXTRACT_BE_U_4(&rp->rm_xid)));
nfsreply_noaddr_print(ndo, (const u_char *)rp, length,
(const u_char *)ip);
return;
* TCP does, and we do so for UDP-over-IPv6.
*/
if (IP_V(ip) == 4 && (ndo->ndo_vflag > 1)) {
- udp_sum = EXTRACT_BE_16BITS(&up->uh_sum);
+ udp_sum = EXTRACT_BE_U_2(&up->uh_sum);
if (udp_sum == 0) {
ND_PRINT((ndo, "[no cksum] "));
} else if (ND_TTEST2(cp[0], length)) {
/* for IPv6, UDP checksum is mandatory */
if (ND_TTEST2(cp[0], length)) {
sum = udp6_cksum(ndo, ip6, up, length + sizeof(struct udphdr));
- udp_sum = EXTRACT_BE_16BITS(&up->uh_sum);
+ udp_sum = EXTRACT_BE_U_2(&up->uh_sum);
if (sum != 0) {
ND_PRINT((ndo, "[bad udp cksum 0x%04x -> 0x%04x!] ",
* unused argument remind us that we should fix this some day.
*
* XXX - also, it fetches the TCP checksum field in COMPRESSED_TCP
- * packets directly, rather than with EXTRACT_16BITS(); RFC 1144 says
+ * packets directly, rather than with EXTRACT_BE_U_2(); RFC 1144 says
* it's "the unmodified TCP checksum", which would imply that it's
* big-endian, but perhaps, on the platform where this was developed,
* the packets were munged by the networking stack before being handed
tok2str(vqp_msg_type_values, "unknown (%u)",vqp_common_header->msg_type),
tok2str(vqp_error_code_values, "unknown (%u)",vqp_common_header->error_code),
vqp_common_header->error_code,
- EXTRACT_BE_32BITS(&vqp_common_header->sequence),
+ EXTRACT_BE_U_4(&vqp_common_header->sequence),
nitems,
len));
ND_TCHECK(*vqp_obj_tlv);
if (sizeof(struct vqp_obj_tlv_t) > tlen)
goto trunc;
- vqp_obj_type = EXTRACT_BE_32BITS(vqp_obj_tlv->obj_type);
- vqp_obj_len = EXTRACT_BE_16BITS(vqp_obj_tlv->obj_length);
+ vqp_obj_type = EXTRACT_BE_U_4(vqp_obj_tlv->obj_type);
+ vqp_obj_len = EXTRACT_BE_U_2(vqp_obj_tlv->obj_length);
tptr+=sizeof(struct vqp_obj_tlv_t);
tlen-=sizeof(struct vqp_obj_tlv_t);
case VQP_OBJ_IP_ADDRESS:
if (vqp_obj_len != 4)
goto trunc;
- ND_PRINT((ndo, "%s (0x%08x)", ipaddr_string(ndo, tptr), EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "%s (0x%08x)", ipaddr_string(ndo, tptr), EXTRACT_BE_U_4(tptr)));
break;
/* those objects have similar semantics - fall through */
case VQP_OBJ_PORT_NAME:
vec[0].len = len;
if (in_cksum(vec, 1))
ND_PRINT((ndo, ", (bad vrrp cksum %x)",
- EXTRACT_BE_16BITS(bp + 6)));
+ EXTRACT_BE_U_2(bp + 6)));
}
if (version == 3 && ND_TTEST2(bp[0], len)) {
len, len, IPPROTO_VRRP);
if (cksum)
ND_PRINT((ndo, ", (bad vrrp cksum %x)",
- EXTRACT_BE_16BITS(bp + 6)));
+ EXTRACT_BE_U_2(bp + 6)));
}
ND_PRINT((ndo, ", addrs"));
ND_TCHECK2(*tptr, VTP_HEADER_LEN);
- type = EXTRACT_8BITS(tptr + 1);
+ type = EXTRACT_U_1(tptr + 1);
ND_PRINT((ndo, "VTPv%u, Message %s (0x%02x), length %u",
*tptr,
tok2str(vtp_message_type_values,"Unknown message type", type),
/* verbose mode print all fields */
ND_PRINT((ndo, "\n\tDomain name: "));
- mgmtd_len = EXTRACT_8BITS(tptr + 3);
+ mgmtd_len = EXTRACT_U_1(tptr + 3);
if (mgmtd_len < 1 || mgmtd_len > 32) {
ND_PRINT((ndo, " [invalid MgmtD Len %d]", mgmtd_len));
return;
ND_TCHECK2(*tptr, 8);
ND_PRINT((ndo, "\n\t Config Rev %x, Updater %s",
- EXTRACT_BE_32BITS(tptr),
+ EXTRACT_BE_U_4(tptr),
ipaddr_string(ndo, tptr+4)));
tptr += 8;
ND_TCHECK2(*tptr, VTP_UPDATE_TIMESTAMP_LEN);
ND_PRINT((ndo, ", Timestamp 0x%08x 0x%08x 0x%08x",
- EXTRACT_BE_32BITS(tptr),
- EXTRACT_BE_32BITS(tptr + 4),
- EXTRACT_BE_32BITS(tptr + 8)));
+ EXTRACT_BE_U_4(tptr),
+ EXTRACT_BE_U_4(tptr + 4),
+ EXTRACT_BE_U_4(tptr + 8)));
tptr += VTP_UPDATE_TIMESTAMP_LEN;
ND_TCHECK2(*tptr, VTP_MD5_DIGEST_LEN);
ND_PRINT((ndo, ", MD5 digest: %08x%08x%08x%08x",
- EXTRACT_BE_32BITS(tptr),
- EXTRACT_BE_32BITS(tptr + 4),
- EXTRACT_BE_32BITS(tptr + 8),
- EXTRACT_BE_32BITS(tptr + 12)));
+ EXTRACT_BE_U_4(tptr),
+ EXTRACT_BE_U_4(tptr + 4),
+ EXTRACT_BE_U_4(tptr + 8),
+ EXTRACT_BE_U_4(tptr + 12)));
tptr += VTP_MD5_DIGEST_LEN;
break;
*/
ND_TCHECK_4(tptr);
- ND_PRINT((ndo, ", Config Rev %x", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, ", Config Rev %x", EXTRACT_BE_U_4(tptr)));
/*
* VLAN INFORMATION
ND_PRINT((ndo, "\n\tVLAN info status %s, type %s, VLAN-id %u, MTU %u, SAID 0x%08x, Name ",
tok2str(vtp_vlan_status,"Unknown",vtp_vlan->status),
tok2str(vtp_vlan_type_values,"Unknown",vtp_vlan->type),
- EXTRACT_BE_16BITS(&vtp_vlan->vlanid),
- EXTRACT_BE_16BITS(&vtp_vlan->mtu),
- EXTRACT_BE_32BITS(&vtp_vlan->index)));
+ EXTRACT_BE_U_2(&vtp_vlan->vlanid),
+ EXTRACT_BE_U_2(&vtp_vlan->mtu),
+ EXTRACT_BE_U_4(&vtp_vlan->index)));
len -= VTP_VLAN_INFO_FIXED_PART_LEN;
tptr += VTP_VLAN_INFO_FIXED_PART_LEN;
if (len < 4*((vtp_vlan->name_len + 3)/4))
goto trunc;
ND_TCHECK2(*tptr, 2);
type = *tptr;
- tlv_len = EXTRACT_8BITS(tptr + 1);
+ tlv_len = EXTRACT_U_1(tptr + 1);
ND_PRINT((ndo, "\n\t\t%s (0x%04x) TLV",
tok2str(vtp_vlan_tlv_values, "Unknown", type),
ND_PRINT((ndo, " (invalid TLV length %u != 1)", tlv_len));
return;
} else {
- tlv_value = EXTRACT_BE_16BITS(tptr + 2);
+ tlv_value = EXTRACT_BE_U_2(tptr + 2);
switch (type) {
case VTP_VLAN_STE_HOP_COUNT:
*/
ND_TCHECK2(*tptr, 4);
- ND_PRINT((ndo, "\n\tStart value: %u", EXTRACT_BE_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\tStart value: %u", EXTRACT_BE_U_4(tptr)));
break;
case VTP_JOIN_MESSAGE:
next_protocol = *bp;
bp += 1;
- vni = EXTRACT_BE_24BITS(bp);
+ vni = EXTRACT_BE_U_3(bp);
bp += 4;
ND_PRINT((ndo, "VXLAN-GPE, "));
flags = *bp;
bp += 4;
- vni = EXTRACT_BE_24BITS(bp);
+ vni = EXTRACT_BE_U_3(bp);
bp += 4;
ND_PRINT((ndo, "VXLAN, "));
#define DOP_ROUNDUP(x) ((((int)(x)) + (DOP_ALIGN - 1)) & ~(DOP_ALIGN - 1))
#define DOP_NEXT(d)\
((const struct dophdr *)((const u_char *)(d) + \
- DOP_ROUNDUP(EXTRACT_BE_16BITS(&(d)->dh_len) + sizeof(*(d)))))
+ DOP_ROUNDUP(EXTRACT_BE_U_2(&(d)->dh_len) + sizeof(*(d)))))
/*
* Format of the whiteboard packet header.
len -= sizeof(*id);
ND_PRINT((ndo, " %u/%s:%u (max %u/%s:%u) ",
- EXTRACT_BE_32BITS(&id->pi_ps.slot),
+ EXTRACT_BE_U_4(&id->pi_ps.slot),
ipaddr_string(ndo, &id->pi_ps.page.p_sid),
- EXTRACT_BE_32BITS(&id->pi_ps.page.p_uid),
- EXTRACT_BE_32BITS(&id->pi_mslot),
+ EXTRACT_BE_U_4(&id->pi_ps.page.p_uid),
+ EXTRACT_BE_U_4(&id->pi_mslot),
ipaddr_string(ndo, &id->pi_mpage.p_sid),
- EXTRACT_BE_32BITS(&id->pi_mpage.p_uid)));
+ EXTRACT_BE_U_4(&id->pi_mpage.p_uid)));
- nid = EXTRACT_BE_16BITS(&id->pi_ps.nid);
+ nid = EXTRACT_BE_U_2(&id->pi_ps.nid);
len -= sizeof(*io) * nid;
io = (const struct id_off *)(id + 1);
cp = (const char *)(io + nid);
c = '<';
for (i = 0; i < nid && ND_TTEST(*io); ++io, ++i) {
ND_PRINT((ndo, "%c%s:%u",
- c, ipaddr_string(ndo, &io->id), EXTRACT_BE_32BITS(&io->off)));
+ c, ipaddr_string(ndo, &io->id), EXTRACT_BE_U_4(&io->off)));
c = ',';
}
if (i >= nid) {
ND_PRINT((ndo, " please repair %s %s:%u<%u:%u>",
ipaddr_string(ndo, &rreq->pr_id),
ipaddr_string(ndo, &rreq->pr_page.p_sid),
- EXTRACT_BE_32BITS(&rreq->pr_page.p_uid),
- EXTRACT_BE_32BITS(&rreq->pr_sseq),
- EXTRACT_BE_32BITS(&rreq->pr_eseq)));
+ EXTRACT_BE_U_4(&rreq->pr_page.p_uid),
+ EXTRACT_BE_U_4(&rreq->pr_sseq),
+ EXTRACT_BE_U_4(&rreq->pr_eseq)));
return (0);
}
return (-1);
ND_PRINT((ndo, " need %u/%s:%u",
- EXTRACT_BE_32BITS(&preq->pp_low),
+ EXTRACT_BE_U_4(&preq->pp_low),
ipaddr_string(ndo, &preq->pp_page.p_sid),
- EXTRACT_BE_32BITS(&preq->pp_page.p_uid)));
+ EXTRACT_BE_U_4(&preq->pp_page.p_uid)));
return (0);
}
ND_PRINT((ndo, " wb-prep:"));
if (len < sizeof(*prep) || !ND_TTEST(*prep))
return (-1);
- n = EXTRACT_BE_32BITS(&prep->pp_n);
+ n = EXTRACT_BE_U_4(&prep->pp_n);
ps = (const struct pgstate *)(prep + 1);
while (--n >= 0 && ND_TTEST(*ps)) {
const struct id_off *io, *ie;
char c = '<';
ND_PRINT((ndo, " %u/%s:%u",
- EXTRACT_BE_32BITS(&ps->slot),
+ EXTRACT_BE_U_4(&ps->slot),
ipaddr_string(ndo, &ps->page.p_sid),
- EXTRACT_BE_32BITS(&ps->page.p_uid)));
+ EXTRACT_BE_U_4(&ps->page.p_uid)));
io = (const struct id_off *)(ps + 1);
for (ie = io + ps->nid; io < ie && ND_TTEST(*io); ++io) {
ND_PRINT((ndo, "%c%s:%u", c, ipaddr_string(ndo, &io->id),
- EXTRACT_BE_32BITS(&io->off)));
+ EXTRACT_BE_U_4(&io->off)));
c = ',';
}
ND_PRINT((ndo, ">"));
else {
ND_PRINT((ndo, " %s", dopstr[t]));
if (t == DT_SKIP || t == DT_HOLE) {
- uint32_t ts = EXTRACT_BE_32BITS(&dh->dh_ts);
+ uint32_t ts = EXTRACT_BE_U_4(&dh->dh_ts);
ND_PRINT((ndo, "%d", ts - ss + 1));
if (ss > ts || ts > es) {
ND_PRINT((ndo, "[|]"));
ND_PRINT((ndo, " for %s %s:%u<%u:%u>",
ipaddr_string(ndo, &rrep->pr_id),
ipaddr_string(ndo, &dop->pd_page.p_sid),
- EXTRACT_BE_32BITS(&dop->pd_page.p_uid),
- EXTRACT_BE_32BITS(&dop->pd_sseq),
- EXTRACT_BE_32BITS(&dop->pd_eseq)));
+ EXTRACT_BE_U_4(&dop->pd_page.p_uid),
+ EXTRACT_BE_U_4(&dop->pd_sseq),
+ EXTRACT_BE_U_4(&dop->pd_eseq)));
if (ndo->ndo_vflag)
return (wb_dops(ndo, dop,
- EXTRACT_BE_32BITS(&dop->pd_sseq),
- EXTRACT_BE_32BITS(&dop->pd_eseq)));
+ EXTRACT_BE_U_4(&dop->pd_sseq),
+ EXTRACT_BE_U_4(&dop->pd_eseq)));
return (0);
}
ND_PRINT((ndo, " %s:%u<%u:%u>",
ipaddr_string(ndo, &dop->pd_page.p_sid),
- EXTRACT_BE_32BITS(&dop->pd_page.p_uid),
- EXTRACT_BE_32BITS(&dop->pd_sseq),
- EXTRACT_BE_32BITS(&dop->pd_eseq)));
+ EXTRACT_BE_U_4(&dop->pd_page.p_uid),
+ EXTRACT_BE_U_4(&dop->pd_sseq),
+ EXTRACT_BE_U_4(&dop->pd_eseq)));
if (ndo->ndo_vflag)
return (wb_dops(ndo, dop,
- EXTRACT_BE_32BITS(&dop->pd_sseq),
- EXTRACT_BE_32BITS(&dop->pd_eseq)));
+ EXTRACT_BE_U_4(&dop->pd_sseq),
+ EXTRACT_BE_U_4(&dop->pd_eseq)));
return (0);
}
header_len = 1 + 8; /* 0xFF, length */
ND_PRINT((ndo, " frame flags+body (64-bit) length"));
ND_TCHECK2(*cp, header_len); /* 0xFF, length */
- body_len_declared = EXTRACT_BE_64BITS(cp + 1);
+ body_len_declared = EXTRACT_BE_U_8(cp + 1);
ND_PRINT((ndo, " %" PRIu64, body_len_declared));
}
if (body_len_declared == 0)
uint64_t remaining_len;
ND_TCHECK2(*cp, 2);
- frame_offset = EXTRACT_BE_16BITS(cp);
+ frame_offset = EXTRACT_BE_U_2(cp);
ND_PRINT((ndo, "\n\t frame offset 0x%04x", frame_offset));
cp += 2;
remaining_len = ndo->ndo_snapend - cp; /* without the frame length */
{
uint32_t dos_date = 0;
- dos_date = EXTRACT_LE_32BITS(date_ptr);
+ dos_date = EXTRACT_LE_U_4(date_ptr);
return int_unix_date(dos_date);
}
{
uint32_t x, x2;
- x = EXTRACT_LE_32BITS(date_ptr);
+ x = EXTRACT_LE_U_4(date_ptr);
x2 = ((x & 0xFFFF) << 16) | ((x & 0xFFFF0000) >> 16);
return int_unix_date(x2);
}
time_t ret;
/* this gives us seconds since jan 1st 1601 (approx) */
- d = (EXTRACT_LE_32BITS(p + 4) * 256.0 + p[3]) * (1.0e-7 * (1 << 24));
+ d = (EXTRACT_LE_U_4(p + 4) * 256.0 + p[3]) * (1.0e-7 * (1 << 24));
/* now adjust by 369 years to make the secs since 1970 */
d -= 369.0 * 365.25 * 24 * 60 * 60;
if (in >= maxbuf)
return(-1); /* name goes past the end of the buffer */
ND_TCHECK2(*in, 1);
- len = EXTRACT_8BITS(in) / 2;
+ len = EXTRACT_U_1(in) / 2;
in++;
*out=0;
ND_TCHECK2(*p, 2);
if ((p + 1) >= maxbuf)
return(NULL); /* name goes past the end of the buffer */
- l = EXTRACT_BE_16BITS(p) & 0x3FFF;
+ l = EXTRACT_BE_U_2(p) & 0x3FFF;
if (l == 0) {
/* We have a pointer that points to itself. */
return(NULL);
case 'A':
ND_TCHECK2(buf[0], 2);
- write_bits(ndo, EXTRACT_LE_16BITS(buf), attrib_fmt);
+ write_bits(ndo, EXTRACT_LE_U_2(buf), attrib_fmt);
buf += 2;
fmt++;
break;
{
unsigned int x;
ND_TCHECK2(buf[0], 2);
- x = reverse ? EXTRACT_BE_16BITS(buf) :
- EXTRACT_LE_16BITS(buf);
+ x = reverse ? EXTRACT_BE_U_2(buf) :
+ EXTRACT_LE_U_2(buf);
ND_PRINT((ndo, "%d (0x%x)", x, x));
buf += 2;
fmt++;
{
unsigned int x;
ND_TCHECK2(buf[0], 4);
- x = reverse ? EXTRACT_BE_32BITS(buf) :
- EXTRACT_LE_32BITS(buf);
+ x = reverse ? EXTRACT_BE_U_4(buf) :
+ EXTRACT_LE_U_4(buf);
ND_PRINT((ndo, "%d (0x%x)", x, x));
buf += 4;
fmt++;
{
uint64_t x;
ND_TCHECK2(buf[0], 8);
- x = reverse ? EXTRACT_BE_64BITS(buf) :
- EXTRACT_LE_64BITS(buf);
+ x = reverse ? EXTRACT_BE_U_8(buf) :
+ EXTRACT_LE_U_8(buf);
ND_PRINT((ndo, "%" PRIu64 " (0x%" PRIx64 ")", x, x));
buf += 8;
fmt++;
uint32_t x1, x2;
uint64_t x;
ND_TCHECK2(buf[0], 8);
- x1 = reverse ? EXTRACT_BE_32BITS(buf) :
- EXTRACT_LE_32BITS(buf);
- x2 = reverse ? EXTRACT_BE_32BITS(buf + 4) :
- EXTRACT_LE_32BITS(buf + 4);
+ x1 = reverse ? EXTRACT_BE_U_4(buf) :
+ EXTRACT_LE_U_4(buf);
+ x2 = reverse ? EXTRACT_BE_U_4(buf + 4) :
+ EXTRACT_LE_U_4(buf + 4);
x = (((uint64_t)x1) << 32) | x2;
ND_PRINT((ndo, "%" PRIu64 " (0x%" PRIx64 ")", x, x));
buf += 8;
{
unsigned int x;
ND_TCHECK2(buf[0], 2);
- x = reverse ? EXTRACT_BE_16BITS(buf) :
- EXTRACT_LE_16BITS(buf);
+ x = reverse ? EXTRACT_BE_U_2(buf) :
+ EXTRACT_LE_U_2(buf);
ND_PRINT((ndo, "0x%X", x));
buf += 2;
fmt++;
{
unsigned int x;
ND_TCHECK2(buf[0], 4);
- x = reverse ? EXTRACT_BE_32BITS(buf) :
- EXTRACT_LE_32BITS(buf);
+ x = reverse ? EXTRACT_BE_U_4(buf) :
+ EXTRACT_LE_U_4(buf);
ND_PRINT((ndo, "0x%X", x));
buf += 4;
fmt++;
case 'd':
ND_TCHECK2(buf[0], 2);
- stringlen = reverse ? EXTRACT_BE_16BITS(buf) :
- EXTRACT_LE_16BITS(buf);
+ stringlen = reverse ? EXTRACT_BE_U_2(buf) :
+ EXTRACT_LE_U_2(buf);
ND_PRINT((ndo, "%u", stringlen));
buf += 2;
break;
case 'D':
ND_TCHECK2(buf[0], 4);
- stringlen = reverse ? EXTRACT_BE_32BITS(buf) :
- EXTRACT_LE_32BITS(buf);
+ stringlen = reverse ? EXTRACT_BE_U_4(buf) :
+ EXTRACT_LE_U_4(buf);
ND_PRINT((ndo, "%u", stringlen));
buf += 4;
break;
int l = atoi(fmt + 1);
ND_TCHECK2(*buf, l);
while (l--) {
- ND_PRINT((ndo, "%02x", EXTRACT_8BITS(buf)));
+ ND_PRINT((ndo, "%02x", EXTRACT_U_1(buf)));
buf++;
}
fmt++;
switch (atoi(fmt + 1)) {
case 1:
ND_TCHECK2(buf[0], 4);
- x = EXTRACT_LE_32BITS(buf);
+ x = EXTRACT_LE_U_4(buf);
if (x == 0 || x == 0xFFFFFFFF)
t = 0;
else
break;
case 2:
ND_TCHECK2(buf[0], 4);
- x = EXTRACT_LE_32BITS(buf);
+ x = EXTRACT_LE_U_4(buf);
if (x == 0 || x == 0xFFFFFFFF)
t = 0;
else