}
#endif
cp = buf;
- oui = EXTRACT_24BITS(ep);
+ oui = EXTRACT_BE_24BITS(ep);
*cp++ = hex[*ep >> 4 ];
*cp++ = hex[*ep++ & 0xf];
for (i = 5; --i >= 0;) {
* architectures in all cases?
*/
static inline uint16_t UNALIGNED_OK
-EXTRACT_16BITS(const void *p)
+EXTRACT_BE_16BITS(const void *p)
{
return ((uint16_t)ntohs(*(const uint16_t *)(p)));
}
static inline uint32_t UNALIGNED_OK
-EXTRACT_32BITS(const void *p)
+EXTRACT_BE_32BITS(const void *p)
{
return ((uint32_t)ntohl(*(const uint32_t *)(p)));
}
static inline uint64_t UNALIGNED_OK
-EXTRACT_64BITS(const void *p)
+EXTRACT_BE_64BITS(const void *p)
{
return ((uint64_t)(((uint64_t)ntohl(*((const uint32_t *)(p) + 0))) << 32 |
((uint64_t)ntohl(*((const uint32_t *)(p) + 1))) << 0));
} __attribute__((packed)) unaligned_uint32_t;
UNALIGNED_OK static inline uint16_t
-EXTRACT_16BITS(const void *p)
+EXTRACT_BE_16BITS(const void *p)
{
return ((uint16_t)ntohs(((const unaligned_uint16_t *)(p))->val));
}
UNALIGNED_OK static inline uint32_t
-EXTRACT_32BITS(const void *p)
+EXTRACT_BE_32BITS(const void *p)
{
return ((uint32_t)ntohl(((const unaligned_uint32_t *)(p))->val));
}
UNALIGNED_OK static inline uint64_t
-EXTRACT_64BITS(const void *p)
+EXTRACT_BE_64BITS(const void *p)
{
return ((uint64_t)(((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 0)->val)) << 32 |
((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 1)->val)) << 0));
* quantities the hard way - fetch the bytes one at a time and
* assemble them.
*/
-#define EXTRACT_16BITS(p) \
+#define EXTRACT_BE_16BITS(p) \
((uint16_t)(((uint16_t)(*((const uint8_t *)(p) + 0)) << 8) | \
((uint16_t)(*((const uint8_t *)(p) + 1)) << 0)))
-#define EXTRACT_32BITS(p) \
+#define EXTRACT_BE_32BITS(p) \
((uint32_t)(((uint32_t)(*((const uint8_t *)(p) + 0)) << 24) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 2)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 3)) << 0)))
-#define EXTRACT_64BITS(p) \
+#define EXTRACT_BE_64BITS(p) \
((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 56) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 48) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 7)) << 0)))
#endif /* unaligned access checks */
-#define EXTRACT_24BITS(p) \
+#define EXTRACT_BE_24BITS(p) \
((uint32_t)(((uint32_t)(*((const uint8_t *)(p) + 0)) << 16) | \
((uint32_t)(*((const uint8_t *)(p) + 1)) << 8) | \
((uint32_t)(*((const uint8_t *)(p) + 2)) << 0)))
-#define EXTRACT_40BITS(p) \
+#define EXTRACT_BE_40BITS(p) \
((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 16) | \
((uint64_t)(*((const uint8_t *)(p) + 3)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 0)))
-#define EXTRACT_48BITS(p) \
+#define EXTRACT_BE_48BITS(p) \
((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 32) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 24) | \
((uint64_t)(*((const uint8_t *)(p) + 4)) << 8) | \
((uint64_t)(*((const uint8_t *)(p) + 5)) << 0)))
-#define EXTRACT_56BITS(p) \
+#define EXTRACT_BE_56BITS(p) \
((uint64_t)(((uint64_t)(*((const uint8_t *)(p) + 0)) << 48) | \
((uint64_t)(*((const uint8_t *)(p) + 1)) << 40) | \
((uint64_t)(*((const uint8_t *)(p) + 2)) << 32) | \
return caplen;
}
- caphdr_len = EXTRACT_32BITS(p + 4);
+ caphdr_len = EXTRACT_BE_32BITS(p + 4);
if (caphdr_len < 8) {
/*
* Yow! The capture header length is claimed not
return caplen;
}
- msgcode = EXTRACT_32BITS(p);
+ msgcode = EXTRACT_BE_32BITS(p);
if (msgcode == WLANCAP_MAGIC_COOKIE_V1 ||
msgcode == WLANCAP_MAGIC_COOKIE_V2)
return ieee802_11_avs_radio_print(ndo, p, length, caplen);
sumlen = ah->ah_len << 2;
- ND_PRINT((ndo, "AH(spi=0x%08x", EXTRACT_32BITS(&ah->ah_spi)));
+ ND_PRINT((ndo, "AH(spi=0x%08x", EXTRACT_BE_32BITS(&ah->ah_spi)));
if (ndo->ndo_vflag)
ND_PRINT((ndo, ",sumlen=%d", sumlen));
ND_TCHECK_32BITS(ah + 1);
- ND_PRINT((ndo, ",seq=0x%x", EXTRACT_32BITS(ah + 1)));
+ ND_PRINT((ndo, ",seq=0x%x", EXTRACT_BE_32BITS(ah + 1)));
if (!ND_TTEST2(*bp, sizeof(struct ah) + sumlen)) {
ND_PRINT((ndo, "[truncated]):"));
return -1;
if (cp + 4 != ep)
goto invalid;
ND_TCHECK2(*cp, 4);
- t = EXTRACT_32BITS(cp);
+ t = EXTRACT_BE_32BITS(cp);
if (NULL == (tm = gmtime(&t)))
ND_PRINT((ndo, ": gmtime() error"));
else if (0 == strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm))
if (cp + 4 != ep)
goto invalid;
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ": %us", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ": %us", EXTRACT_BE_32BITS(cp)));
return 0;
invalid:
cp += 1;
/* Length */
ND_TCHECK2(*cp, 2);
- body_len = EXTRACT_16BITS(cp);
+ body_len = EXTRACT_BE_16BITS(cp);
cp += 2;
if (ndo->ndo_vflag) {
cp += 1;
/* Nonce */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", Nonce 0x%08x", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ", Nonce 0x%08x", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* Source Id */
ND_TCHECK2(*cp, 8);
break;
}
ND_PRINT((ndo, "\n\text HELLO %ld ms",
- (unsigned long)EXTRACT_32BITS(&ah->interval)));
+ (unsigned long) EXTRACT_BE_32BITS(&ah->interval)));
break;
default:
ap->rreq_type & RREQ_DEST ? "[D]" : "",
ap->rreq_type & RREQ_UNKNOWN ? "[U] " : " ",
ap->rreq_hops,
- (unsigned long)EXTRACT_32BITS(&ap->rreq_id),
+ (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_id),
ipaddr_string(ndo, &ap->rreq_da),
- (unsigned long)EXTRACT_32BITS(&ap->rreq_ds),
+ (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_ds),
ipaddr_string(ndo, &ap->rreq_oa),
- (unsigned long)EXTRACT_32BITS(&ap->rreq_os)));
+ (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_os)));
i = length - sizeof(*ap);
if (i >= sizeof(struct aodv_ext))
aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i);
ap->rrep_ps & RREP_PREFIX_MASK,
ap->rrep_hops,
ipaddr_string(ndo, &ap->rrep_da),
- (unsigned long)EXTRACT_32BITS(&ap->rrep_ds),
+ (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_ds),
ipaddr_string(ndo, &ap->rrep_oa),
- (unsigned long)EXTRACT_32BITS(&ap->rrep_life)));
+ (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_life)));
i = length - sizeof(*ap);
if (i >= sizeof(struct aodv_ext))
aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i);
if (i < sizeof(*dp))
goto trunc;
ND_PRINT((ndo, " {%s}(%ld)", ipaddr_string(ndo, &dp->u_da),
- (unsigned long)EXTRACT_32BITS(&dp->u_ds)));
+ (unsigned long) EXTRACT_BE_32BITS(&dp->u_ds)));
dp++;
i -= sizeof(*dp);
}
ap->rreq_type & RREQ_DEST ? "[D]" : "",
ap->rreq_type & RREQ_UNKNOWN ? "[U] " : " ",
ap->rreq_hops,
- (unsigned long)EXTRACT_32BITS(&ap->rreq_id),
+ (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_id),
ip6addr_string(ndo, &ap->rreq_da),
- (unsigned long)EXTRACT_32BITS(&ap->rreq_ds),
+ (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_ds),
ip6addr_string(ndo, &ap->rreq_oa),
- (unsigned long)EXTRACT_32BITS(&ap->rreq_os)));
+ (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_os)));
i = length - sizeof(*ap);
if (i >= sizeof(struct aodv_ext))
aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i);
ap->rrep_ps & RREP_PREFIX_MASK,
ap->rrep_hops,
ip6addr_string(ndo, &ap->rrep_da),
- (unsigned long)EXTRACT_32BITS(&ap->rrep_ds),
+ (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_ds),
ip6addr_string(ndo, &ap->rrep_oa),
- (unsigned long)EXTRACT_32BITS(&ap->rrep_life)));
+ (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_life)));
i = length - sizeof(*ap);
if (i >= sizeof(struct aodv_ext))
aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i);
if (i < sizeof(*dp6))
goto trunc;
ND_PRINT((ndo, " {%s}(%ld)", ip6addr_string(ndo, &dp6->u_da),
- (unsigned long)EXTRACT_32BITS(&dp6->u_ds)));
+ (unsigned long) EXTRACT_BE_32BITS(&dp6->u_ds)));
dp6++;
i -= sizeof(*dp6);
}
ap->rreq_type & RREQ_DEST ? "[D]" : "",
ap->rreq_type & RREQ_UNKNOWN ? "[U] " : " ",
ap->rreq_hops,
- (unsigned long)EXTRACT_32BITS(&ap->rreq_id),
+ (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_id),
ip6addr_string(ndo, &ap->rreq_da),
- (unsigned long)EXTRACT_32BITS(&ap->rreq_ds),
+ (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_ds),
ip6addr_string(ndo, &ap->rreq_oa),
- (unsigned long)EXTRACT_32BITS(&ap->rreq_os)));
+ (unsigned long) EXTRACT_BE_32BITS(&ap->rreq_os)));
i = length - sizeof(*ap);
if (i >= sizeof(struct aodv_ext))
aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i);
ap->rrep_ps & RREP_PREFIX_MASK,
ap->rrep_hops,
ip6addr_string(ndo, &ap->rrep_da),
- (unsigned long)EXTRACT_32BITS(&ap->rrep_ds),
+ (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_ds),
ip6addr_string(ndo, &ap->rrep_oa),
- (unsigned long)EXTRACT_32BITS(&ap->rrep_life)));
+ (unsigned long) EXTRACT_BE_32BITS(&ap->rrep_life)));
i = length - sizeof(*ap);
if (i >= sizeof(struct aodv_ext))
aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i);
if (i < sizeof(*dp6))
goto trunc;
ND_PRINT((ndo, " {%s}(%ld)", ip6addr_string(ndo, &dp6->u_da),
- (unsigned long)EXTRACT_32BITS(&dp6->u_ds)));
+ (unsigned long) EXTRACT_BE_32BITS(&dp6->u_ds)));
dp6++;
i -= sizeof(*dp6);
}
goto invalid;
/* Buffer Count */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\tBuffer Count: %u", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, "\n\tBuffer Count: %u", EXTRACT_BE_16BITS(cp)));
cp += 2;
/* Firmware Version */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", Firmware Version: %u", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, ", Firmware Version: %u", EXTRACT_BE_16BITS(cp)));
cp += 2;
/* Sector Count */
ND_TCHECK2(*cp, 1);
cp += 1;
/* Config String Length */
ND_TCHECK2(*cp, 2);
- cslen = EXTRACT_16BITS(cp);
+ cslen = EXTRACT_BE_16BITS(cp);
cp += 2;
if (cslen > AOEV1_MAX_CONFSTR_LEN || AOEV1_QUERY_ARG_LEN + cslen > len)
goto invalid;
cp += 1;
/* Major */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\tMajor: 0x%04x", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, "\n\tMajor: 0x%04x", EXTRACT_BE_16BITS(cp)));
cp += 2;
/* Minor */
ND_TCHECK2(*cp, 1);
ND_PRINT((ndo, ", Command: %s", tok2str(cmdcode_str, "Unknown (0x%02x)", command)));
/* Tag */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", Tag: 0x%08x", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ", Tag: 0x%08x", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* Arg */
cmd_decoder =
fwaddr_string(ndo, fp->firewire_shost),
fwaddr_string(ndo, fp->firewire_dhost)));
- firewire_type = EXTRACT_16BITS(&fp->firewire_type);
+ firewire_type = EXTRACT_BE_16BITS(&fp->firewire_type);
if (!ndo->ndo_qflag) {
ND_PRINT((ndo, ", ethertype %s (0x%04x)",
tok2str(ethertype_values,"Unknown", firewire_type),
fp = (const struct firewire_header *)p;
p += FIREWIRE_HDRLEN;
- ether_type = EXTRACT_16BITS(&fp->firewire_type);
+ ether_type = EXTRACT_BE_16BITS(&fp->firewire_type);
src.addr = fp->firewire_shost;
src.addr_string = fwaddr_string;
dst.addr = fp->firewire_dhost;
return (caplen);
}
flag = ap->arc_flag2;
- seqid = EXTRACT_16BITS(&ap->arc_seqid2);
+ seqid = EXTRACT_BE_16BITS(&ap->arc_seqid2);
archdrlen = ARC_HDRNEWLEN_EXC;
} else {
flag = ap->arc_flag;
- seqid = EXTRACT_16BITS(&ap->arc_seqid);
+ seqid = EXTRACT_BE_16BITS(&ap->arc_seqid);
archdrlen = ARC_HDRNEWLEN;
}
}
#define ARP_HDRLEN 8
-#define HRD(ap) EXTRACT_16BITS(&(ap)->ar_hrd)
+#define HRD(ap) EXTRACT_BE_16BITS(&(ap)->ar_hrd)
#define HRD_LEN(ap) ((ap)->ar_hln)
#define PROTO_LEN(ap) ((ap)->ar_pln)
-#define OP(ap) EXTRACT_16BITS(&(ap)->ar_op)
-#define PRO(ap) EXTRACT_16BITS(&(ap)->ar_pro)
+#define OP(ap) EXTRACT_BE_16BITS(&(ap)->ar_op)
+#define PRO(ap) EXTRACT_BE_16BITS(&(ap)->ar_pro)
#define SHA(ap) (ar_sha(ap))
#define SPA(ap) (ar_spa(ap))
#define THA(ap) (ar_tha(ap))
u_char aar_tpa[]; /* target protocol address */
#endif
-#define ATMHRD(ap) EXTRACT_16BITS(&(ap)->aar_hrd)
+#define ATMHRD(ap) EXTRACT_BE_16BITS(&(ap)->aar_hrd)
#define ATMSHRD_LEN(ap) ((ap)->aar_shtl & ATMARP_LEN_MASK)
#define ATMSSLN(ap) ((ap)->aar_sstl & ATMARP_LEN_MASK)
#define ATMSPROTO_LEN(ap) ((ap)->aar_spln)
-#define ATMOP(ap) EXTRACT_16BITS(&(ap)->aar_op)
-#define ATMPRO(ap) EXTRACT_16BITS(&(ap)->aar_pro)
+#define ATMOP(ap) EXTRACT_BE_16BITS(&(ap)->aar_op)
+#define ATMPRO(ap) EXTRACT_BE_16BITS(&(ap)->aar_pro)
#define ATMTHRD_LEN(ap) ((ap)->aar_thtl & ATMARP_LEN_MASK)
#define ATMTSLN(ap) ((ap)->aar_tstl & ATMARP_LEN_MASK)
#define ATMTPROTO_LEN(ap) ((ap)->aar_tpln)
return (0); /* cut short by the snapshot length */
}
dp = (const struct atDDP *)bp;
- snet = EXTRACT_16BITS(&dp->srcNet);
+ snet = EXTRACT_BE_16BITS(&dp->srcNet);
ND_PRINT((ndo, "%s.%s", ataddr_string(ndo, snet, dp->srcNode),
ddpskt_string(ndo, dp->srcSkt)));
ND_PRINT((ndo, " > %s.%s:",
- ataddr_string(ndo, EXTRACT_16BITS(&dp->dstNet), dp->dstNode),
+ ataddr_string(ndo, EXTRACT_BE_16BITS(&dp->dstNet), dp->dstNode),
ddpskt_string(ndo, dp->dstSkt)));
bp += ddpSize;
length -= ddpSize;
return;
}
dp = (const struct atDDP *)bp;
- snet = EXTRACT_16BITS(&dp->srcNet);
+ snet = EXTRACT_BE_16BITS(&dp->srcNet);
ND_PRINT((ndo, "%s.%s", ataddr_string(ndo, snet, dp->srcNode),
ddpskt_string(ndo, dp->srcSkt)));
ND_PRINT((ndo, " > %s.%s: ",
- ataddr_string(ndo, EXTRACT_16BITS(&dp->dstNet), dp->dstNode),
+ ataddr_string(ndo, EXTRACT_BE_16BITS(&dp->dstNet), dp->dstNode),
ddpskt_string(ndo, dp->dstSkt)));
bp += ddpSize;
length -= ddpSize;
ND_PRINT((ndo, " [|aarp %u]", length));
return;
}
- if (EXTRACT_16BITS(&ap->htype) == 1 &&
- EXTRACT_16BITS(&ap->ptype) == ETHERTYPE_ATALK &&
+ if (EXTRACT_BE_16BITS(&ap->htype) == 1 &&
+ EXTRACT_BE_16BITS(&ap->ptype) == ETHERTYPE_ATALK &&
ap->halen == 6 && ap->palen == 4 )
- switch (EXTRACT_16BITS(&ap->op)) {
+ switch (EXTRACT_BE_16BITS(&ap->op)) {
case 1: /* request */
ND_PRINT((ndo, "who-has %s tell %s", AT(pdaddr), AT(psaddr)));
return;
}
ND_PRINT((ndo, "len %u op %u htype %u ptype %#x halen %u palen %u",
- length, EXTRACT_16BITS(&ap->op), EXTRACT_16BITS(&ap->htype),
- EXTRACT_16BITS(&ap->ptype), ap->halen, ap->palen));
+ length, EXTRACT_BE_16BITS(&ap->op), EXTRACT_BE_16BITS(&ap->htype),
+ EXTRACT_BE_16BITS(&ap->ptype), ap->halen, ap->palen));
}
/*
case atpReqCode:
ND_PRINT((ndo, " atp-req%s %d",
ap->control & atpXO? " " : "*",
- EXTRACT_16BITS(&ap->transID)));
+ EXTRACT_BE_16BITS(&ap->transID)));
atp_bitmap_print(ndo, ap->bitmap);
case atpRspCode:
ND_PRINT((ndo, " atp-resp%s%d:%d (%u)",
ap->control & atpEOM? "*" : " ",
- EXTRACT_16BITS(&ap->transID), ap->bitmap, length));
+ EXTRACT_BE_16BITS(&ap->transID), ap->bitmap, length));
switch (ap->control & (atpXO|atpSTS)) {
case atpXO:
ND_PRINT((ndo, " [XO]"));
break;
case atpRelCode:
- ND_PRINT((ndo, " atp-rel %d", EXTRACT_16BITS(&ap->transID)));
+ ND_PRINT((ndo, " atp-rel %d", EXTRACT_BE_16BITS(&ap->transID)));
atp_bitmap_print(ndo, ap->bitmap);
default:
ND_PRINT((ndo, " atp-0x%x %d (%u)", ap->control,
- EXTRACT_16BITS(&ap->transID), length));
+ EXTRACT_BE_16BITS(&ap->transID), length));
break;
}
- data = EXTRACT_32BITS(&ap->userData);
+ data = EXTRACT_BE_32BITS(&ap->userData);
if (data != 0)
ND_PRINT((ndo, " 0x%x", data));
}
ND_PRINT((ndo, " [ntup=%d]", np->control & 0xf));
if (tp->enumerator)
ND_PRINT((ndo, " [enum=%d]", tp->enumerator));
- if (EXTRACT_16BITS(&tp->net) != snet ||
+ if (EXTRACT_BE_16BITS(&tp->net) != snet ||
tp->node != snode || tp->skt != skt)
ND_PRINT((ndo, " [addr=%s.%d]",
- ataddr_string(ndo, EXTRACT_16BITS(&tp->net),
- tp->node), tp->skt));
+ ataddr_string(ndo, EXTRACT_BE_16BITS(&tp->net),
+ tp->node), tp->skt));
break;
case nbpLkUpReply:
ND_PRINT((ndo, " %d", tp->skt));
/* if the address doesn't match the src address, it's an anomaly */
- if (EXTRACT_16BITS(&tp->net) != snet || tp->node != snode)
+ if (EXTRACT_BE_16BITS(&tp->net) != snet || tp->node != snode)
ND_PRINT((ndo, " [addr=%s]",
- ataddr_string(ndo, EXTRACT_16BITS(&tp->net), tp->node)));
+ ataddr_string(ndo, EXTRACT_BE_16BITS(&tp->net), tp->node)));
return (tpn);
}
* packet nor an RFC 2684 routed NLPID-formatted PDU nor
* an 802.2-but-no-SNAP IP packet.
*/
- llchdr = EXTRACT_24BITS(p);
+ llchdr = EXTRACT_BE_24BITS(p);
if (llchdr != LLC_UI_HDR(LLCSAP_SNAP) &&
llchdr != LLC_UI_HDR(LLCSAP_ISONS) &&
llchdr != LLC_UI_HDR(LLCSAP_IP)) {
}
if (ndo->ndo_eflag)
ND_PRINT((ndo, "%08x%08x %08x%08x ",
- EXTRACT_32BITS(p),
- EXTRACT_32BITS(p+4),
- EXTRACT_32BITS(p+8),
- EXTRACT_32BITS(p+12)));
+ EXTRACT_BE_32BITS(p),
+ EXTRACT_BE_32BITS(p + 4),
+ EXTRACT_BE_32BITS(p + 8),
+ EXTRACT_BE_32BITS(p + 12)));
p += 20;
length -= 20;
caplen -= 20;
* do from the caplen test above, we also know we have
* the call reference.
*/
- call_ref = EXTRACT_24BITS(&p[CALL_REF_POS]);
+ call_ref = EXTRACT_BE_24BITS(&p[CALL_REF_POS]);
ND_PRINT((ndo, "CALL_REF:0x%06x", call_ref));
} else {
/* SSCOP with some unknown protocol atop it */
ND_TCHECK(*(p+ATM_HDR_LEN_NOHEC+hec));
- cell_header = EXTRACT_32BITS(p+hec);
+ cell_header = EXTRACT_BE_32BITS(p + hec);
cell_type = ((*(p+ATM_HDR_LEN_NOHEC+hec))>>4) & 0x0f;
func_type = (*(p+ATM_HDR_LEN_NOHEC+hec)) & 0x0f;
tok2str(oam_fm_loopback_indicator_values,
"Unknown",
oam_ptr.oam_fm_loopback->loopback_indicator & OAM_FM_LOOPBACK_INDICATOR_MASK),
- EXTRACT_32BITS(&oam_ptr.oam_fm_loopback->correlation_tag)));
+ EXTRACT_BE_32BITS(&oam_ptr.oam_fm_loopback->correlation_tag)));
ND_PRINT((ndo, "\n\tLocation-ID "));
for (idx = 0; idx < sizeof(oam_ptr.oam_fm_loopback->loopback_id); idx++) {
if (idx % 2) {
- ND_PRINT((ndo, "%04x ", EXTRACT_16BITS(&oam_ptr.oam_fm_loopback->loopback_id[idx])));
+ ND_PRINT((ndo, "%04x ", EXTRACT_BE_16BITS(&oam_ptr.oam_fm_loopback->loopback_id[idx])));
}
}
ND_PRINT((ndo, "\n\tSource-ID "));
for (idx = 0; idx < sizeof(oam_ptr.oam_fm_loopback->source_id); idx++) {
if (idx % 2) {
- ND_PRINT((ndo, "%04x ", EXTRACT_16BITS(&oam_ptr.oam_fm_loopback->source_id[idx])));
+ ND_PRINT((ndo, "%04x ", EXTRACT_BE_16BITS(&oam_ptr.oam_fm_loopback->source_id[idx])));
}
}
break;
ND_PRINT((ndo, "\n\tLocation-ID "));
for (idx = 0; idx < sizeof(oam_ptr.oam_fm_ais_rdi->failure_location); idx++) {
if (idx % 2) {
- ND_PRINT((ndo, "%04x ", EXTRACT_16BITS(&oam_ptr.oam_fm_ais_rdi->failure_location[idx])));
+ ND_PRINT((ndo, "%04x ", EXTRACT_BE_16BITS(&oam_ptr.oam_fm_ais_rdi->failure_location[idx])));
}
}
break;
/* crc10 checksum verification */
ND_TCHECK2(*(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN), 2);
- cksum = EXTRACT_16BITS(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN)
+ cksum = EXTRACT_BE_16BITS(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN)
& OAM_CRC10_MASK;
cksum_shouldbe = verify_crc10_cksum(0, p, OAM_PAYLOAD_LEN);
if(tlv_type == MESSAGE_HELLO) {
if(sublen < 4)
goto invalid;
- t1 = EXTRACT_32BITS(cp);
+ t1 = EXTRACT_BE_32BITS(cp);
ND_PRINT((ndo, " %s", format_timestamp(t1)));
} else if(tlv_type == MESSAGE_IHU) {
if(sublen < 8)
goto invalid;
- t1 = EXTRACT_32BITS(cp);
+ t1 = EXTRACT_BE_32BITS(cp);
ND_PRINT((ndo, " %s", format_timestamp(t1)));
- t2 = EXTRACT_32BITS(cp + 4);
+ t2 = EXTRACT_BE_32BITS(cp + 4);
ND_PRINT((ndo, "|%s", format_timestamp(t2)));
} else
ND_PRINT((ndo, " (bogus)"));
ND_TCHECK2(*cp, 4);
if (length < 4)
goto invalid;
- bodylen = EXTRACT_16BITS(cp + 2);
+ bodylen = EXTRACT_BE_16BITS(cp + 2);
ND_PRINT((ndo, " (%u)", bodylen));
/* Process the TLVs in the body */
else {
ND_PRINT((ndo, "\n\tAcknowledgment Request "));
if(len < 6) goto invalid;
- nonce = EXTRACT_16BITS(message + 4);
- interval = EXTRACT_16BITS(message + 6);
+ nonce = EXTRACT_BE_16BITS(message + 4);
+ interval = EXTRACT_BE_16BITS(message + 6);
ND_PRINT((ndo, "%04x %s", nonce, format_interval(interval)));
}
}
else {
ND_PRINT((ndo, "\n\tAcknowledgment "));
if(len < 2) goto invalid;
- nonce = EXTRACT_16BITS(message + 2);
+ nonce = EXTRACT_BE_16BITS(message + 2);
ND_PRINT((ndo, "%04x", nonce));
}
}
else {
ND_PRINT((ndo, "\n\tHello "));
if(len < 6) goto invalid;
- seqno = EXTRACT_16BITS(message + 4);
- interval = EXTRACT_16BITS(message + 6);
+ seqno = EXTRACT_BE_16BITS(message + 4);
+ interval = EXTRACT_BE_16BITS(message + 6);
ND_PRINT((ndo, "seqno %u interval %s", seqno, format_interval(interval)));
/* Extra data. */
if(len > 6)
int rc;
ND_PRINT((ndo, "\n\tIHU "));
if(len < 6) goto invalid;
- txcost = EXTRACT_16BITS(message + 4);
- interval = EXTRACT_16BITS(message + 6);
+ txcost = EXTRACT_BE_16BITS(message + 4);
+ interval = EXTRACT_BE_16BITS(message + 6);
rc = network_address(message[2], message + 8, len - 6, address);
if(rc < 0) { ND_PRINT((ndo, "%s", tstr)); break; }
ND_PRINT((ndo, "%s txcost %u interval %s",
message[2] == 1 ? v4_prefix : v6_prefix,
len - 10, prefix);
if(rc < 0) goto invalid;
- interval = EXTRACT_16BITS(message + 6);
- seqno = EXTRACT_16BITS(message + 8);
- metric = EXTRACT_16BITS(message + 10);
+ interval = EXTRACT_BE_16BITS(message + 6);
+ seqno = EXTRACT_BE_16BITS(message + 8);
+ metric = EXTRACT_BE_16BITS(message + 10);
ND_PRINT((ndo, "%s%s%s %s metric %u seqno %u interval %s",
(message[3] & 0x80) ? "/prefix": "",
(message[3] & 0x40) ? "/id" : "",
u_char prefix[16], plen;
ND_PRINT((ndo, "\n\tMH-Request "));
if(len < 14) goto invalid;
- seqno = EXTRACT_16BITS(message + 4);
+ seqno = EXTRACT_BE_16BITS(message + 4);
rc = network_prefix(message[2], message[3], 0,
message + 16, NULL, len - 14, prefix);
if(rc < 0) goto invalid;
else {
ND_PRINT((ndo, "\n\tTS/PC "));
if(len < 6) goto invalid;
- ND_PRINT((ndo, "timestamp %u packetcounter %u", EXTRACT_32BITS (message + 4),
- EXTRACT_16BITS(message + 2)));
+ ND_PRINT((ndo, "timestamp %u packetcounter %u", EXTRACT_BE_32BITS(message + 4),
+ EXTRACT_BE_16BITS(message + 2)));
}
break;
case MESSAGE_HMAC : {
unsigned j;
ND_PRINT((ndo, "\n\tHMAC "));
if(len < 18) goto invalid;
- ND_PRINT((ndo, "key-id %u digest-%u ", EXTRACT_16BITS(message + 2), len - 2));
+ ND_PRINT((ndo, "key-id %u digest-%u ", EXTRACT_BE_16BITS(message + 2), len - 2));
for (j = 0; j < len - 2; j++)
ND_PRINT((ndo, "%02X", message[4 + j]));
}
src_plen = message[3];
plen = message[4];
omitted = message[5];
- interval = EXTRACT_16BITS(message + 6);
- seqno = EXTRACT_16BITS(message + 8);
- metric = EXTRACT_16BITS(message + 10);
+ interval = EXTRACT_BE_16BITS(message + 6);
+ seqno = EXTRACT_BE_16BITS(message + 8);
+ metric = EXTRACT_BE_16BITS(message + 10);
rc = network_prefix(ae, plen, omitted, message + 2 + parsed_len,
ae == 1 ? v4_prefix : v6_prefix,
len - parsed_len, prefix);
if(len < 14) goto invalid;
ae = message[2];
plen = message[3];
- seqno = EXTRACT_16BITS(message + 4);
+ seqno = EXTRACT_BE_16BITS(message + 4);
hopc = message[6];
src_plen = message[7];
router_id = message + 8;
}
pptr += 2;
ND_TCHECK2(*pptr, 4);
- ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_32BITS(pptr)));
+ ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_BE_32BITS(pptr)));
pptr += 4;
ND_TCHECK2(*pptr, AUTH_MD5_HASH_LEN);
ND_PRINT((ndo, "\n\t Digest: "));
}
pptr += 2;
ND_TCHECK2(*pptr, 4);
- ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_32BITS(pptr)));
+ ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_BE_32BITS(pptr)));
pptr += 4;
ND_TCHECK2(*pptr, AUTH_SHA1_HASH_LEN);
ND_PRINT((ndo, "\n\t Hash: "));
ND_PRINT((ndo, "\n\tDetection Timer Multiplier: %u (%u ms Detection time), BFD Length: %u",
bfd_header->detect_time_multiplier,
- bfd_header->detect_time_multiplier * EXTRACT_32BITS(bfd_header->desired_min_tx_interval)/1000,
+ bfd_header->detect_time_multiplier * EXTRACT_BE_32BITS(bfd_header->desired_min_tx_interval)/1000,
bfd_header->length));
- ND_PRINT((ndo, "\n\tMy Discriminator: 0x%08x", EXTRACT_32BITS(bfd_header->my_discriminator)));
- ND_PRINT((ndo, ", Your Discriminator: 0x%08x", EXTRACT_32BITS(bfd_header->your_discriminator)));
- ND_PRINT((ndo, "\n\t Desired min Tx Interval: %4u ms", EXTRACT_32BITS(bfd_header->desired_min_tx_interval)/1000));
- ND_PRINT((ndo, "\n\t Required min Rx Interval: %4u ms", EXTRACT_32BITS(bfd_header->required_min_rx_interval)/1000));
- ND_PRINT((ndo, "\n\t Required min Echo Interval: %4u ms", EXTRACT_32BITS(bfd_header->required_min_echo_interval)/1000));
+ ND_PRINT((ndo, "\n\tMy Discriminator: 0x%08x", EXTRACT_BE_32BITS(bfd_header->my_discriminator)));
+ ND_PRINT((ndo, ", Your Discriminator: 0x%08x", EXTRACT_BE_32BITS(bfd_header->your_discriminator)));
+ ND_PRINT((ndo, "\n\t Desired min Tx Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->desired_min_tx_interval)/1000));
+ ND_PRINT((ndo, "\n\t Required min Rx Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->required_min_rx_interval)/1000));
+ ND_PRINT((ndo, "\n\t Required min Echo Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->required_min_echo_interval)/1000));
break;
/* BFDv1 */
ND_PRINT((ndo, "\n\tDetection Timer Multiplier: %u (%u ms Detection time), BFD Length: %u",
bfd_header->detect_time_multiplier,
- bfd_header->detect_time_multiplier * EXTRACT_32BITS(bfd_header->desired_min_tx_interval)/1000,
+ bfd_header->detect_time_multiplier * EXTRACT_BE_32BITS(bfd_header->desired_min_tx_interval)/1000,
bfd_header->length));
- ND_PRINT((ndo, "\n\tMy Discriminator: 0x%08x", EXTRACT_32BITS(bfd_header->my_discriminator)));
- ND_PRINT((ndo, ", Your Discriminator: 0x%08x", EXTRACT_32BITS(bfd_header->your_discriminator)));
- ND_PRINT((ndo, "\n\t Desired min Tx Interval: %4u ms", EXTRACT_32BITS(bfd_header->desired_min_tx_interval)/1000));
- ND_PRINT((ndo, "\n\t Required min Rx Interval: %4u ms", EXTRACT_32BITS(bfd_header->required_min_rx_interval)/1000));
- ND_PRINT((ndo, "\n\t Required min Echo Interval: %4u ms", EXTRACT_32BITS(bfd_header->required_min_echo_interval)/1000));
+ ND_PRINT((ndo, "\n\tMy Discriminator: 0x%08x", EXTRACT_BE_32BITS(bfd_header->my_discriminator)));
+ ND_PRINT((ndo, ", Your Discriminator: 0x%08x", EXTRACT_BE_32BITS(bfd_header->your_discriminator)));
+ ND_PRINT((ndo, "\n\t Desired min Tx Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->desired_min_tx_interval)/1000));
+ ND_PRINT((ndo, "\n\t Required min Rx Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->required_min_rx_interval)/1000));
+ ND_PRINT((ndo, "\n\t Required min Echo Interval: %4u ms", EXTRACT_BE_32BITS(bfd_header->required_min_echo_interval)/1000));
if (bfd_header->flags & BFD_FLAG_AUTH) {
if (auth_print(ndo, pptr))
#define bgp_attr_lenlen(flags, p) \
(((flags) & 0x10) ? 2 : 1)
#define bgp_attr_len(flags, p) \
- (((flags) & 0x10) ? EXTRACT_16BITS(p) : *(p))
+ (((flags) & 0x10) ? EXTRACT_BE_16BITS(p) : *(p))
#define BGPTYPE_ORIGIN 1
#define BGPTYPE_AS_PATH 2
snprintf(buf, buflen, "%s/%d, label:%u %s",
ipaddr_string(ndo, &addr),
plen,
- EXTRACT_24BITS(pptr+1)>>4,
+ EXTRACT_BE_24BITS(pptr + 1)>>4,
((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
return 4 + plenbytes;
char *pos = rd;
/* ok lets load the RD format */
- switch (EXTRACT_16BITS(pptr)) {
+ switch (EXTRACT_BE_16BITS(pptr)) {
/* 2-byte-AS:number fmt*/
case 0:
snprintf(pos, sizeof(rd) - (pos - rd), "%u:%u (= %u.%u.%u.%u)",
- EXTRACT_16BITS(pptr+2),
- EXTRACT_32BITS(pptr+4),
+ EXTRACT_BE_16BITS(pptr + 2),
+ EXTRACT_BE_32BITS(pptr + 4),
*(pptr+4), *(pptr+5), *(pptr+6), *(pptr+7));
break;
/* IP-address:AS fmt*/
case 1:
snprintf(pos, sizeof(rd) - (pos - rd), "%u.%u.%u.%u:%u",
- *(pptr+2), *(pptr+3), *(pptr+4), *(pptr+5), EXTRACT_16BITS(pptr+6));
+ *(pptr+2), *(pptr+3), *(pptr+4), *(pptr+5),
+ EXTRACT_BE_16BITS(pptr + 6));
break;
/* 4-byte-AS:number fmt*/
case 2:
snprintf(pos, sizeof(rd) - (pos - rd), "%s:%u (%u.%u.%u.%u:%u)",
- as_printf(ndo, astostr, sizeof(astostr), EXTRACT_32BITS(pptr+2)),
- EXTRACT_16BITS(pptr+6), *(pptr+2), *(pptr+3), *(pptr+4),
- *(pptr+5), EXTRACT_16BITS(pptr+6));
+ as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_32BITS(pptr + 2)),
+ EXTRACT_BE_16BITS(pptr + 6), *(pptr+2), *(pptr+3), *(pptr+4),
+ *(pptr+5), EXTRACT_BE_16BITS(pptr + 6));
break;
default:
snprintf(pos, sizeof(rd) - (pos - rd), "unknown RD format");
/* With at least "origin AS", possibly with "route target". */
ND_TCHECK_32BITS(pptr + 1);
- as_printf(ndo, asbuf, sizeof(asbuf), EXTRACT_32BITS(pptr + 1));
+ as_printf(ndo, asbuf, sizeof(asbuf), EXTRACT_BE_32BITS(pptr + 1));
plen-=32; /* adjust prefix length */
bgp_vpn_rd_print(ndo, pptr+4),
ipaddr_string(ndo, &addr),
plen,
- EXTRACT_24BITS(pptr+1)>>4,
+ EXTRACT_BE_24BITS(pptr + 1)>>4,
((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
return 12 + (plen + 7) / 8;
snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s",
bgp_vpn_rd_print(ndo, pptr),
as_printf(ndo, astostr, sizeof(astostr),
- EXTRACT_32BITS(pptr + BGP_VPN_RD_LEN)));
+ EXTRACT_BE_32BITS(pptr + BGP_VPN_RD_LEN)));
break;
case BGP_MULTICAST_VPN_ROUTE_TYPE_S_PMSI:
snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s",
bgp_vpn_rd_print(ndo, pptr),
as_printf(ndo, astostr, sizeof(astostr),
- EXTRACT_32BITS(pptr + BGP_VPN_RD_LEN)));
+ EXTRACT_BE_32BITS(pptr + BGP_VPN_RD_LEN)));
pptr += BGP_VPN_RD_LEN + 4;
bgp_vpn_sg_print(ndo, pptr, buf, buflen);
int plen,tlen,stringlen,tlv_type,tlv_len,ttlv_len;
ND_TCHECK2(pptr[0], 2);
- plen=EXTRACT_16BITS(pptr);
+ plen=EXTRACT_BE_16BITS(pptr);
tlen=plen;
pptr+=2;
/* Old and new L2VPN NLRI share AFI/SAFI
buf[0]='\0';
stringlen=snprintf(buf, buflen, "RD: %s, CE-ID: %u, Label-Block Offset: %u, Label Base %u",
bgp_vpn_rd_print(ndo, pptr),
- EXTRACT_16BITS(pptr+8),
- EXTRACT_16BITS(pptr+10),
- EXTRACT_24BITS(pptr+12)>>4); /* the label is offsetted by 4 bits so lets shift it right */
+ EXTRACT_BE_16BITS(pptr + 8),
+ EXTRACT_BE_16BITS(pptr + 10),
+ EXTRACT_BE_24BITS(pptr + 12)>>4); /* the label is offsetted by 4 bits so lets shift it right */
UPDATE_BUF_BUFLEN(buf, buflen, stringlen);
pptr+=15;
tlen-=15;
return -1;
ND_TCHECK2(pptr[0], 3);
tlv_type=*pptr++;
- tlv_len=EXTRACT_16BITS(pptr);
+ tlv_len=EXTRACT_BE_16BITS(pptr);
ttlv_len=tlv_len;
pptr+=2;
snprintf(buf, buflen, "%s/%d, label:%u %s",
ip6addr_string(ndo, &addr),
plen,
- EXTRACT_24BITS(pptr+1)>>4,
+ EXTRACT_BE_24BITS(pptr + 1)>>4,
((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
return 4 + plenbytes;
bgp_vpn_rd_print(ndo, pptr+4),
ip6addr_string(ndo, &addr),
plen,
- EXTRACT_24BITS(pptr+1)>>4,
+ EXTRACT_BE_24BITS(pptr + 1)>>4,
((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
return 12 + (plen + 7) / 8;
bgp_vpn_rd_print(ndo, pptr+4),
isonsap_string(ndo, addr,(plen + 7) / 8),
plen,
- EXTRACT_24BITS(pptr+1)>>4,
+ EXTRACT_BE_24BITS(pptr + 1)>>4,
((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
return 12 + (plen + 7) / 8;
ND_PRINT((ndo, "%s ",
as_printf(ndo, astostr, sizeof(astostr),
as_size == 2 ?
- EXTRACT_16BITS(&tptr[2 + i]) :
- EXTRACT_32BITS(&tptr[2 + i]))));
+ EXTRACT_BE_16BITS(&tptr[2 + i]) :
+ EXTRACT_BE_32BITS(&tptr[2 + i]))));
}
ND_TCHECK(tptr[0]);
ND_PRINT((ndo, "%s", tok2str(bgp_as_path_segment_close_values,
ND_PRINT((ndo, "invalid len"));
else {
ND_TCHECK2(tptr[0], 4);
- ND_PRINT((ndo, "%u", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(tptr)));
}
break;
case BGPTYPE_ATOMIC_AGGREGATE:
ND_TCHECK2(tptr[0], len);
if (len == 6) {
ND_PRINT((ndo, " AS #%s, origin %s",
- as_printf(ndo, astostr, sizeof(astostr), EXTRACT_16BITS(tptr)),
+ as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_16BITS(tptr)),
ipaddr_string(ndo, tptr + 2)));
} else {
ND_PRINT((ndo, " AS #%s, origin %s",
as_printf(ndo, astostr, sizeof(astostr),
- EXTRACT_32BITS(tptr)), ipaddr_string(ndo, tptr + 4)));
+ EXTRACT_BE_32BITS(tptr)), ipaddr_string(ndo, tptr + 4)));
}
break;
case BGPTYPE_AGGREGATOR4:
}
ND_TCHECK2(tptr[0], 8);
ND_PRINT((ndo, " AS #%s, origin %s",
- as_printf(ndo, astostr, sizeof(astostr), EXTRACT_32BITS(tptr)),
- ipaddr_string(ndo, tptr + 4)));
+ as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_32BITS(tptr)),
+ ipaddr_string(ndo, tptr + 4)));
break;
case BGPTYPE_COMMUNITIES:
if (len % 4) {
while (tlen>0) {
uint32_t comm;
ND_TCHECK2(tptr[0], 4);
- comm = EXTRACT_32BITS(tptr);
+ comm = EXTRACT_BE_32BITS(tptr);
switch (comm) {
case BGP_COMMUNITY_NO_EXPORT:
ND_PRINT((ndo, " NO_EXPORT"));
break;
case BGPTYPE_MP_REACH_NLRI:
ND_TCHECK2(tptr[0], 3);
- af = EXTRACT_16BITS(tptr);
+ af = EXTRACT_BE_16BITS(tptr);
safi = tptr[2];
ND_PRINT((ndo, "\n\t AFI: %s (%u), %sSAFI: %s (%u)",
bgp_vpn_rd_print(ndo, tptr),
isonsap_string(ndo, tptr+BGP_VPN_RD_LEN,tlen-BGP_VPN_RD_LEN)));
/* rfc986 mapped IPv4 address ? */
- if (EXTRACT_32BITS(tptr+BGP_VPN_RD_LEN) == 0x47000601)
+ if (EXTRACT_BE_32BITS(tptr + BGP_VPN_RD_LEN) == 0x47000601)
ND_PRINT((ndo, " = %s", ipaddr_string(ndo, tptr+BGP_VPN_RD_LEN+4)));
/* rfc1888 mapped IPv6 address ? */
- else if (EXTRACT_24BITS(tptr+BGP_VPN_RD_LEN) == 0x350000)
+ else if (EXTRACT_BE_24BITS(tptr + BGP_VPN_RD_LEN) == 0x350000)
ND_PRINT((ndo, " = %s", ip6addr_string(ndo, tptr+BGP_VPN_RD_LEN+3)));
tptr += tlen;
tlen = 0;
case BGPTYPE_MP_UNREACH_NLRI:
ND_TCHECK2(tptr[0], BGP_MP_NLRI_MINSIZE);
- af = EXTRACT_16BITS(tptr);
+ af = EXTRACT_BE_16BITS(tptr);
safi = tptr[2];
ND_PRINT((ndo, "\n\t AFI: %s (%u), %sSAFI: %s (%u)",
uint16_t extd_comm;
ND_TCHECK2(tptr[0], 2);
- extd_comm=EXTRACT_16BITS(tptr);
+ extd_comm=EXTRACT_BE_16BITS(tptr);
ND_PRINT((ndo, "\n\t %s (0x%04x), Flags [%s]",
tok2str(bgp_extd_comm_subtype_values,
case BGP_EXT_COM_RO_0:
case BGP_EXT_COM_L2VPN_RT_0:
ND_PRINT((ndo, ": %u:%u (= %s)",
- EXTRACT_16BITS(tptr+2),
- EXTRACT_32BITS(tptr+4),
+ EXTRACT_BE_16BITS(tptr + 2),
+ EXTRACT_BE_32BITS(tptr + 4),
ipaddr_string(ndo, tptr+4)));
break;
case BGP_EXT_COM_RT_1:
case BGP_EXT_COM_VRF_RT_IMP:
ND_PRINT((ndo, ": %s:%u",
ipaddr_string(ndo, tptr+2),
- EXTRACT_16BITS(tptr+6)));
+ EXTRACT_BE_16BITS(tptr + 6)));
break;
case BGP_EXT_COM_RT_2:
case BGP_EXT_COM_RO_2:
ND_PRINT((ndo, ": %s:%u",
as_printf(ndo, astostr, sizeof(astostr),
- EXTRACT_32BITS(tptr+2)), EXTRACT_16BITS(tptr+6)));
+ EXTRACT_BE_32BITS(tptr + 2)), EXTRACT_BE_16BITS(tptr + 6)));
break;
case BGP_EXT_COM_LINKBAND:
- bw.i = EXTRACT_32BITS(tptr+2);
+ bw.i = EXTRACT_BE_32BITS(tptr + 2);
ND_PRINT((ndo, ": bandwidth: %.3f Mbps",
bw.f*8/1000000));
break;
"unknown encaps",
*(tptr+2)),
*(tptr+3),
- EXTRACT_16BITS(tptr+4)));
+ EXTRACT_BE_16BITS(tptr + 4)));
break;
case BGP_EXT_COM_SOURCE_AS:
- ND_PRINT((ndo, ": AS %u", EXTRACT_16BITS(tptr+2)));
+ ND_PRINT((ndo, ": AS %u", EXTRACT_BE_16BITS(tptr + 2)));
break;
default:
ND_TCHECK2(*tptr,8);
tok2str(bgp_pmsi_tunnel_values, "Unknown", tunnel_type),
tunnel_type,
bittok2str(bgp_pmsi_flag_values, "none", flags),
- EXTRACT_24BITS(tptr+2)>>4));
+ EXTRACT_BE_24BITS(tptr + 2)>>4));
tptr +=5;
tlen -= 5;
ND_TCHECK2(tptr[0], 8);
ND_PRINT((ndo, "\n\t Root-Node %s, LSP-ID 0x%08x",
ipaddr_string(ndo, tptr),
- EXTRACT_32BITS(tptr+4)));
+ EXTRACT_BE_32BITS(tptr + 4)));
break;
case BGP_PMSI_TUNNEL_RSVP_P2MP:
ND_TCHECK2(tptr[0], 8);
ND_PRINT((ndo, "\n\t Extended-Tunnel-ID %s, P2MP-ID 0x%08x",
ipaddr_string(ndo, tptr),
- EXTRACT_32BITS(tptr+4)));
+ EXTRACT_BE_32BITS(tptr + 4)));
break;
default:
if (ndo->ndo_vflag <= 1) {
ND_TCHECK2(tptr[0], 3);
type = *tptr;
- length = EXTRACT_16BITS(tptr+1);
+ length = EXTRACT_BE_16BITS(tptr + 1);
tptr += 3;
tlen -= 3;
if (length < 8)
goto trunc;
ND_PRINT((ndo, ", metric %" PRIu64,
- EXTRACT_64BITS(tptr)));
+ EXTRACT_BE_64BITS(tptr)));
break;
default:
if (len < 4)
goto trunc;
ND_PRINT((ndo, "\n\t Origin AS: %s",
- as_printf(ndo, astostr, sizeof(astostr), EXTRACT_32BITS(tptr))));
+ as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_32BITS(tptr))));
tptr+=4;
len -=4;
while (len > 0) {
ND_TCHECK2(*tptr, 12);
ND_PRINT((ndo, "%u:%u:%u%s",
- EXTRACT_32BITS(tptr),
- EXTRACT_32BITS(tptr + 4),
- EXTRACT_32BITS(tptr + 8),
+ EXTRACT_BE_32BITS(tptr),
+ EXTRACT_BE_32BITS(tptr + 4),
+ EXTRACT_BE_32BITS(tptr + 8),
(len > 12) ? ", " : ""));
tptr += 12;
len -= 12;
case BGP_CAPCODE_MP:
ND_PRINT((ndo, "\n\t\tAFI %s (%u), SAFI %s (%u)",
tok2str(af_values, "Unknown",
- EXTRACT_16BITS(opt+i+2)),
- EXTRACT_16BITS(opt+i+2),
+ EXTRACT_BE_16BITS(opt + i + 2)),
+ EXTRACT_BE_16BITS(opt + i + 2),
tok2str(bgp_safi_values, "Unknown",
opt[i+5]),
opt[i+5]));
case BGP_CAPCODE_RESTART:
ND_PRINT((ndo, "\n\t\tRestart Flags: [%s], Restart Time %us",
((opt[i+2])&0x80) ? "R" : "none",
- EXTRACT_16BITS(opt+i+2)&0xfff));
+ EXTRACT_BE_16BITS(opt + i + 2)&0xfff));
tcap_len-=2;
cap_offset=4;
while(tcap_len>=4) {
ND_PRINT((ndo, "\n\t\t AFI %s (%u), SAFI %s (%u), Forwarding state preserved: %s",
tok2str(af_values,"Unknown",
- EXTRACT_16BITS(opt+i+cap_offset)),
- EXTRACT_16BITS(opt+i+cap_offset),
+ EXTRACT_BE_16BITS(opt + i + cap_offset)),
+ EXTRACT_BE_16BITS(opt + i + cap_offset),
tok2str(bgp_safi_values,"Unknown",
opt[i+cap_offset+2]),
opt[i+cap_offset+2],
if (cap_len == 4) {
ND_PRINT((ndo, "\n\t\t 4 Byte AS %s",
as_printf(ndo, astostr, sizeof(astostr),
- EXTRACT_32BITS(opt + i + 2))));
+ EXTRACT_BE_32BITS(opt + i + 2))));
}
break;
case BGP_CAPCODE_ADD_PATH:
break;
}
ND_PRINT((ndo, "\n\t\tAFI %s (%u), SAFI %s (%u), Send/Receive: %s",
- tok2str(af_values,"Unknown",EXTRACT_16BITS(opt+i+cap_offset)),
- EXTRACT_16BITS(opt+i+cap_offset),
+ tok2str(af_values,"Unknown",EXTRACT_BE_16BITS(opt + i + cap_offset)),
+ EXTRACT_BE_16BITS(opt + i + cap_offset),
tok2str(bgp_safi_values,"Unknown",opt[i+cap_offset+2]),
opt[i+cap_offset+2],
tok2str(bgp_add_path_recvsend,"Bogus (0x%02x)",opt[i+cap_offset+3])
ND_TCHECK2(p[0], 2);
if (length < 2)
goto trunc;
- withdrawn_routes_len = EXTRACT_16BITS(p);
+ withdrawn_routes_len = EXTRACT_BE_16BITS(p);
p += 2;
length -= 2;
if (withdrawn_routes_len) {
ND_TCHECK2(p[0], 2);
if (length < 2)
goto trunc;
- len = EXTRACT_16BITS(p);
+ len = EXTRACT_BE_16BITS(p);
p += 2;
length -= 2;
ND_TCHECK2(*tptr, 7);
ND_PRINT((ndo, ", AFI %s (%u), SAFI %s (%u), Max Prefixes: %u",
tok2str(af_values, "Unknown",
- EXTRACT_16BITS(tptr)),
- EXTRACT_16BITS(tptr),
+ EXTRACT_BE_16BITS(tptr)),
+ EXTRACT_BE_16BITS(tptr),
tok2str(bgp_safi_values, "Unknown", *(tptr+2)),
*(tptr+2),
- EXTRACT_32BITS(tptr+3)));
+ EXTRACT_BE_32BITS(tptr + 3)));
}
/*
* draft-ietf-idr-shutdown describes a method to send a communication
tok2str(af_values,"Unknown",
/* this stinks but the compiler pads the structure
* weird */
- EXTRACT_16BITS(&bgp_route_refresh_header->afi)),
- EXTRACT_16BITS(&bgp_route_refresh_header->afi),
+ EXTRACT_BE_16BITS(&bgp_route_refresh_header->afi)),
+ EXTRACT_BE_16BITS(&bgp_route_refresh_header->afi),
tok2str(bgp_safi_values,"Unknown",
bgp_route_refresh_header->safi),
bgp_route_refresh_header->safi));
/* Only print interesting fields */
if (bp->bp_hops)
ND_PRINT((ndo, ", hops %d", bp->bp_hops));
- if (EXTRACT_32BITS(&bp->bp_xid))
- ND_PRINT((ndo, ", xid 0x%x", EXTRACT_32BITS(&bp->bp_xid)));
- if (EXTRACT_16BITS(&bp->bp_secs))
- ND_PRINT((ndo, ", secs %d", EXTRACT_16BITS(&bp->bp_secs)));
+ if (EXTRACT_BE_32BITS(&bp->bp_xid))
+ ND_PRINT((ndo, ", xid 0x%x", EXTRACT_BE_32BITS(&bp->bp_xid)));
+ if (EXTRACT_BE_16BITS(&bp->bp_secs))
+ ND_PRINT((ndo, ", secs %d", EXTRACT_BE_16BITS(&bp->bp_secs)));
ND_TCHECK(bp->bp_flags);
ND_PRINT((ndo, ", Flags [%s]",
- bittok2str(bootp_flag_values, "none", EXTRACT_16BITS(&bp->bp_flags))));
+ bittok2str(bootp_flag_values, "none", EXTRACT_BE_16BITS(&bp->bp_flags))));
if (ndo->ndo_vflag > 1)
- ND_PRINT((ndo, " (0x%04x)", EXTRACT_16BITS(&bp->bp_flags)));
+ ND_PRINT((ndo, " (0x%04x)", EXTRACT_BE_16BITS(&bp->bp_flags)));
/* Client's ip address */
ND_TCHECK(bp->bp_ciaddr);
- if (EXTRACT_32BITS(&bp->bp_ciaddr.s_addr))
+ if (EXTRACT_BE_32BITS(&bp->bp_ciaddr.s_addr))
ND_PRINT((ndo, "\n\t Client-IP %s", ipaddr_string(ndo, &bp->bp_ciaddr)));
/* 'your' ip address (bootp client) */
ND_TCHECK(bp->bp_yiaddr);
- if (EXTRACT_32BITS(&bp->bp_yiaddr.s_addr))
+ if (EXTRACT_BE_32BITS(&bp->bp_yiaddr.s_addr))
ND_PRINT((ndo, "\n\t Your-IP %s", ipaddr_string(ndo, &bp->bp_yiaddr)));
/* Server's ip address */
ND_TCHECK(bp->bp_siaddr);
- if (EXTRACT_32BITS(&bp->bp_siaddr.s_addr))
+ if (EXTRACT_BE_32BITS(&bp->bp_siaddr.s_addr))
ND_PRINT((ndo, "\n\t Server-IP %s", ipaddr_string(ndo, &bp->bp_siaddr)));
/* Gateway's ip address */
ND_TCHECK(bp->bp_giaddr);
- if (EXTRACT_32BITS(&bp->bp_giaddr.s_addr))
+ if (EXTRACT_BE_32BITS(&bp->bp_giaddr.s_addr))
ND_PRINT((ndo, "\n\t Gateway-IP %s", ipaddr_string(ndo, &bp->bp_giaddr)));
/* Client's Ethernet address */
else {
uint32_t ul;
- ul = EXTRACT_32BITS(&bp->bp_vend);
+ ul = EXTRACT_BE_32BITS(&bp->bp_vend);
if (ul != 0)
ND_PRINT((ndo, "\n\t Vendor-#0x%x", ul));
}
ND_PRINT((ndo, "\n\t Vendor-rfc1048 Extensions"));
/* Step over magic cookie */
- ND_PRINT((ndo, "\n\t Magic Cookie 0x%08x", EXTRACT_32BITS(bp)));
+ ND_PRINT((ndo, "\n\t Magic Cookie 0x%08x", EXTRACT_BE_32BITS(bp)));
bp += sizeof(int32_t);
/* Loop while we there is a tag left in the buffer */
return;
if (tag == TAG_EXTENDED_OPTION) {
ND_TCHECK2(*(bp + 1), 2);
- tag = EXTRACT_16BITS(bp + 1);
+ tag = EXTRACT_BE_16BITS(bp + 1);
/* XXX we don't know yet if the IANA will
* preclude overlap of 1-byte and 2-byte spaces.
* If not, we need to offset tag after this step.
first = 1;
while (len > 1) {
len -= 2;
- us = EXTRACT_16BITS(bp);
+ us = EXTRACT_BE_16BITS(bp);
bp += 2;
cp = tok2str(xtag2str, "?xT%u", us);
if (!first)
while (len >= sizeof(ul)) {
if (!first)
ND_PRINT((ndo, ","));
- ul = EXTRACT_32BITS(bp);
+ ul = EXTRACT_BE_32BITS(bp);
if (c == 'i') {
ul = htonl(ul);
ND_PRINT((ndo, "%s", ipaddr_string(ndo, &ul)));
while (len >= sizeof(us)) {
if (!first)
ND_PRINT((ndo, ","));
- us = EXTRACT_16BITS(bp);
+ us = EXTRACT_BE_16BITS(bp);
ND_PRINT((ndo, "%u", us));
bp += sizeof(us);
len -= sizeof(us);
length -= BT_HDRLEN;
p += BT_HDRLEN;
if (ndo->ndo_eflag)
- ND_PRINT((ndo, "hci length %d, direction %s, ", length, (EXTRACT_32BITS(&hdr->direction)&0x1)?"in":"out"));
+ ND_PRINT((ndo, "hci length %d, direction %s, ", length, (EXTRACT_BE_32BITS(&hdr->direction)&0x1)?"in":"out"));
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
vec[0].len = len;
if (ND_TTEST2(bp[0], len) && in_cksum(vec, 1))
ND_PRINT((ndo, " (bad carp cksum %x!)",
- EXTRACT_16BITS(&bp[6])));
+ EXTRACT_BE_16BITS(&bp[6])));
}
- ND_PRINT((ndo, "counter=%" PRIu64, EXTRACT_64BITS(&bp[8])));
+ ND_PRINT((ndo, "counter=%" PRIu64, EXTRACT_BE_64BITS(&bp[8])));
return;
trunc:
ND_PRINT((ndo, "CDPv%u, ttl: %us", *(tptr + CDP_HEADER_VERSION_OFFSET),
*(tptr + CDP_HEADER_TTL_OFFSET)));
if (ndo->ndo_vflag)
- ND_PRINT((ndo, ", checksum: 0x%04x (unverified), length %u", EXTRACT_16BITS(tptr+CDP_HEADER_CHECKSUM_OFFSET), length));
+ ND_PRINT((ndo, ", checksum: 0x%04x (unverified), length %u", EXTRACT_BE_16BITS(tptr + CDP_HEADER_CHECKSUM_OFFSET), length));
tptr += CDP_HEADER_LEN;
while (tptr < (pptr+length)) {
ND_TCHECK2(*tptr, CDP_TLV_HEADER_LEN); /* read out Type and Length */
- type = EXTRACT_16BITS(tptr+CDP_TLV_TYPE_OFFSET);
- len = EXTRACT_16BITS(tptr+CDP_TLV_LEN_OFFSET); /* object length includes the 4 bytes header length */
+ type = EXTRACT_BE_16BITS(tptr + CDP_TLV_TYPE_OFFSET);
+ len = EXTRACT_BE_16BITS(tptr + CDP_TLV_LEN_OFFSET); /* object length includes the 4 bytes header length */
if (len < CDP_TLV_HEADER_LEN) {
if (ndo->ndo_vflag)
ND_PRINT((ndo, "\n\t%s (0x%02x), TLV length: %u byte%s (too short)",
if (len < 4)
goto trunc;
ND_PRINT((ndo, "(0x%08x): %s",
- EXTRACT_32BITS(tptr),
- bittok2str(cdp_capability_values, "none", EXTRACT_32BITS(tptr))));
+ EXTRACT_BE_32BITS(tptr),
+ bittok2str(cdp_capability_values, "none", EXTRACT_BE_32BITS(tptr))));
break;
case 0x05: /* Version */
ND_PRINT((ndo, "\n\t "));
case 0x0a: /* Native VLAN ID - CDPv2 */
if (len < 2)
goto trunc;
- ND_PRINT((ndo, "%d", EXTRACT_16BITS(tptr)));
+ ND_PRINT((ndo, "%d", EXTRACT_BE_16BITS(tptr)));
break;
case 0x0b: /* Duplex - CDPv2 */
if (len < 1)
case 0x0e: /* ATA-186 VoIP VLAN request - incomplete doc. */
if (len < 3)
goto trunc;
- ND_PRINT((ndo, "app %d, vlan %d", *(tptr), EXTRACT_16BITS(tptr + 1)));
+ ND_PRINT((ndo, "app %d, vlan %d", *(tptr), EXTRACT_BE_16BITS(tptr + 1)));
break;
case 0x10: /* ATA-186 VoIP VLAN assignment - incomplete doc. */
ND_PRINT((ndo, "%1.2fW", cdp_get_number(tptr, len) / 1000.0));
case 0x11: /* MTU - not documented */
if (len < 4)
goto trunc;
- ND_PRINT((ndo, "%u bytes", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "%u bytes", EXTRACT_BE_32BITS(tptr)));
break;
case 0x12: /* AVVID trust bitmap - not documented */
if (len < 1)
ND_TCHECK2(*p, 4);
if (p + 4 > endp)
goto trunc;
- num = EXTRACT_32BITS(p);
+ num = EXTRACT_BE_32BITS(p);
p += 4;
while (p < endp && num >= 0) {
ND_TCHECK2(p[pl], 2);
if (p + pl + 2 > endp)
goto trunc;
- al = EXTRACT_16BITS(&p[pl]); /* address length */
+ al = EXTRACT_BE_16BITS(&p[pl]); /* address length */
if (pt == PT_NLPID && pl == 1 && *p == NLPID_IP && al == 4) {
/*
}
ND_PRINT((ndo, "\n\t Sequence Number 0x%08x, MA-End-Point-ID 0x%04x",
- EXTRACT_32BITS(msg_ptr.cfm_ccm->sequence),
- EXTRACT_16BITS(msg_ptr.cfm_ccm->ma_epi)));
+ EXTRACT_BE_32BITS(msg_ptr.cfm_ccm->sequence),
+ EXTRACT_BE_16BITS(msg_ptr.cfm_ccm->ma_epi)));
namesp = msg_ptr.cfm_ccm->names;
names_data_remaining = sizeof(msg_ptr.cfm_ccm->names);
bittok2str(cfm_ltm_flag_values, "none", cfm_common_header->flags)));
ND_PRINT((ndo, "\n\t Transaction-ID 0x%08x, ttl %u",
- EXTRACT_32BITS(msg_ptr.cfm_ltm->transaction_id),
+ EXTRACT_BE_32BITS(msg_ptr.cfm_ltm->transaction_id),
msg_ptr.cfm_ltm->ttl));
ND_PRINT((ndo, "\n\t Original-MAC %s, Target-MAC %s",
bittok2str(cfm_ltr_flag_values, "none", cfm_common_header->flags)));
ND_PRINT((ndo, "\n\t Transaction-ID 0x%08x, ttl %u",
- EXTRACT_32BITS(msg_ptr.cfm_ltr->transaction_id),
+ EXTRACT_BE_32BITS(msg_ptr.cfm_ltr->transaction_id),
msg_ptr.cfm_ltr->ttl));
ND_PRINT((ndo, "\n\t Replay-Action %s (%u)",
if (tlen < sizeof(struct cfm_tlv_header_t))
goto tooshort;
ND_TCHECK2(*tptr, sizeof(struct cfm_tlv_header_t));
- cfm_tlv_len=EXTRACT_16BITS(&cfm_tlv_header->length);
+ cfm_tlv_len=EXTRACT_BE_16BITS(&cfm_tlv_header->length);
ND_PRINT((ndo, ", length %u", cfm_tlv_len));
return;
}
ND_PRINT((ndo, ", Vendor: %s (%u), Sub-Type %u",
- tok2str(oui_values,"Unknown", EXTRACT_24BITS(tptr)),
- EXTRACT_24BITS(tptr),
+ tok2str(oui_values,"Unknown", EXTRACT_BE_24BITS(tptr)),
+ EXTRACT_BE_24BITS(tptr),
*(tptr + 3)));
hexdump = TRUE;
break;
if (length < CHDLC_HDRLEN)
goto trunc;
ND_TCHECK2(*p, CHDLC_HDRLEN);
- proto = EXTRACT_16BITS(&p[2]);
+ proto = EXTRACT_BE_16BITS(&p[2]);
if (ndo->ndo_eflag) {
ND_PRINT((ndo, "%s, ethertype %s (0x%04x), length %u: ",
tok2str(chdlc_cast_values, "0x%02x", p[0]),
slarp = (const struct cisco_slarp *)cp;
ND_TCHECK2(*slarp, SLARP_MIN_LEN);
- switch (EXTRACT_32BITS(&slarp->code)) {
+ switch (EXTRACT_BE_32BITS(&slarp->code)) {
case SLARP_REQUEST:
ND_PRINT((ndo, "request"));
/*
break;
case SLARP_KEEPALIVE:
ND_PRINT((ndo, "keepalive: mineseen=0x%08x, yourseen=0x%08x, reliability=0x%04x",
- EXTRACT_32BITS(&slarp->un.keep.myseq),
- EXTRACT_32BITS(&slarp->un.keep.yourseq),
- EXTRACT_16BITS(&slarp->un.keep.rel)));
+ EXTRACT_BE_32BITS(&slarp->un.keep.myseq),
+ EXTRACT_BE_32BITS(&slarp->un.keep.yourseq),
+ EXTRACT_BE_16BITS(&slarp->un.keep.rel)));
if (length >= SLARP_MAX_LEN) { /* uptime-stamp is optional */
cp += SLARP_MIN_LEN;
ND_TCHECK2(*cp, 4);
- sec = EXTRACT_32BITS(cp) / 1000;
+ sec = EXTRACT_BE_32BITS(cp) / 1000;
min = sec / 60; sec -= min * 60;
hrs = min / 60; min -= hrs * 60;
days = hrs / 24; hrs -= days * 24;
}
break;
default:
- ND_PRINT((ndo, "0x%02x unknown", EXTRACT_32BITS(&slarp->code)));
+ ND_PRINT((ndo, "0x%02x unknown", EXTRACT_BE_32BITS(&slarp->code)));
if (ndo->ndo_vflag <= 1)
print_unknown_data(ndo,cp+4,"\n\t",length-4);
break;
nh = (const struct nfhdr_v1 *)cp;
ND_TCHECK(*nh);
- ver = EXTRACT_16BITS(&nh->version);
- nrecs = EXTRACT_32BITS(&nh->count);
+ ver = EXTRACT_BE_16BITS(&nh->version);
+ nrecs = EXTRACT_BE_32BITS(&nh->count);
#if 0
/*
* This is seconds since the UN*X epoch, and is followed by
#endif
ND_PRINT((ndo, "NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver,
- EXTRACT_32BITS(&nh->msys_uptime)/1000,
- EXTRACT_32BITS(&nh->msys_uptime)%1000,
- EXTRACT_32BITS(&nh->utc_sec), EXTRACT_32BITS(&nh->utc_nsec)));
+ EXTRACT_BE_32BITS(&nh->msys_uptime)/1000,
+ EXTRACT_BE_32BITS(&nh->msys_uptime)%1000,
+ EXTRACT_BE_32BITS(&nh->utc_sec), EXTRACT_BE_32BITS(&nh->utc_nsec)));
nr = (const struct nfrec_v1 *)&nh[1];
*/
ND_TCHECK(*nr);
ND_PRINT((ndo, "\n started %u.%03u, last %u.%03u",
- EXTRACT_32BITS(&nr->start_time)/1000,
- EXTRACT_32BITS(&nr->start_time)%1000,
- EXTRACT_32BITS(&nr->last_time)/1000,
- EXTRACT_32BITS(&nr->last_time)%1000));
+ EXTRACT_BE_32BITS(&nr->start_time)/1000,
+ EXTRACT_BE_32BITS(&nr->start_time)%1000,
+ EXTRACT_BE_32BITS(&nr->last_time)/1000,
+ EXTRACT_BE_32BITS(&nr->last_time)%1000));
asbuf[0] = buf[0] = '\0';
ND_PRINT((ndo, "\n %s%s%s:%u ", intoa(nr->src_ina.s_addr), buf, asbuf,
- EXTRACT_16BITS(&nr->srcport)));
+ EXTRACT_BE_16BITS(&nr->srcport)));
ND_PRINT((ndo, "> %s%s%s:%u ", intoa(nr->dst_ina.s_addr), buf, asbuf,
- EXTRACT_16BITS(&nr->dstport)));
+ EXTRACT_BE_16BITS(&nr->dstport)));
ND_PRINT((ndo, ">> %s\n ", intoa(nr->nhop_ina.s_addr)));
buf[0]='\0';
ND_PRINT((ndo, "tos %u, %u (%u octets) %s",
nr->tos,
- EXTRACT_32BITS(&nr->packets),
- EXTRACT_32BITS(&nr->octets), buf));
+ EXTRACT_BE_32BITS(&nr->packets),
+ EXTRACT_BE_32BITS(&nr->octets), buf));
}
return;
nh = (const struct nfhdr_v5 *)cp;
ND_TCHECK(*nh);
- ver = EXTRACT_16BITS(&nh->version);
- nrecs = EXTRACT_32BITS(&nh->count);
+ ver = EXTRACT_BE_16BITS(&nh->version);
+ nrecs = EXTRACT_BE_32BITS(&nh->count);
#if 0
/*
* This is seconds since the UN*X epoch, and is followed by
#endif
ND_PRINT((ndo, "NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver,
- EXTRACT_32BITS(&nh->msys_uptime)/1000,
- EXTRACT_32BITS(&nh->msys_uptime)%1000,
- EXTRACT_32BITS(&nh->utc_sec), EXTRACT_32BITS(&nh->utc_nsec)));
+ EXTRACT_BE_32BITS(&nh->msys_uptime)/1000,
+ EXTRACT_BE_32BITS(&nh->msys_uptime)%1000,
+ EXTRACT_BE_32BITS(&nh->utc_sec), EXTRACT_BE_32BITS(&nh->utc_nsec)));
- ND_PRINT((ndo, "#%u, ", EXTRACT_32BITS(&nh->sequence)));
+ ND_PRINT((ndo, "#%u, ", EXTRACT_BE_32BITS(&nh->sequence)));
nr = (const struct nfrec_v5 *)&nh[1];
ND_PRINT((ndo, "%2u recs", nrecs));
*/
ND_TCHECK(*nr);
ND_PRINT((ndo, "\n started %u.%03u, last %u.%03u",
- EXTRACT_32BITS(&nr->start_time)/1000,
- EXTRACT_32BITS(&nr->start_time)%1000,
- EXTRACT_32BITS(&nr->last_time)/1000,
- EXTRACT_32BITS(&nr->last_time)%1000));
+ EXTRACT_BE_32BITS(&nr->start_time)/1000,
+ EXTRACT_BE_32BITS(&nr->start_time)%1000,
+ EXTRACT_BE_32BITS(&nr->last_time)/1000,
+ EXTRACT_BE_32BITS(&nr->last_time)%1000));
asbuf[0] = buf[0] = '\0';
snprintf(buf, sizeof(buf), "/%u", nr->src_mask);
snprintf(asbuf, sizeof(asbuf), ":%u",
- EXTRACT_16BITS(&nr->src_as));
+ EXTRACT_BE_16BITS(&nr->src_as));
ND_PRINT((ndo, "\n %s%s%s:%u ", intoa(nr->src_ina.s_addr), buf, asbuf,
- EXTRACT_16BITS(&nr->srcport)));
+ EXTRACT_BE_16BITS(&nr->srcport)));
snprintf(buf, sizeof(buf), "/%d", nr->dst_mask);
snprintf(asbuf, sizeof(asbuf), ":%u",
- EXTRACT_16BITS(&nr->dst_as));
+ EXTRACT_BE_16BITS(&nr->dst_as));
ND_PRINT((ndo, "> %s%s%s:%u ", intoa(nr->dst_ina.s_addr), buf, asbuf,
- EXTRACT_16BITS(&nr->dstport)));
+ EXTRACT_BE_16BITS(&nr->dstport)));
ND_PRINT((ndo, ">> %s\n ", intoa(nr->nhop_ina.s_addr)));
buf[0]='\0';
ND_PRINT((ndo, "tos %u, %u (%u octets) %s",
nr->tos,
- EXTRACT_32BITS(&nr->packets),
- EXTRACT_32BITS(&nr->octets), buf));
+ EXTRACT_BE_32BITS(&nr->packets),
+ EXTRACT_BE_32BITS(&nr->octets), buf));
}
return;
nh = (const struct nfhdr_v6 *)cp;
ND_TCHECK(*nh);
- ver = EXTRACT_16BITS(&nh->version);
- nrecs = EXTRACT_32BITS(&nh->count);
+ ver = EXTRACT_BE_16BITS(&nh->version);
+ nrecs = EXTRACT_BE_32BITS(&nh->count);
#if 0
/*
* This is seconds since the UN*X epoch, and is followed by
#endif
ND_PRINT((ndo, "NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver,
- EXTRACT_32BITS(&nh->msys_uptime)/1000,
- EXTRACT_32BITS(&nh->msys_uptime)%1000,
- EXTRACT_32BITS(&nh->utc_sec), EXTRACT_32BITS(&nh->utc_nsec)));
+ EXTRACT_BE_32BITS(&nh->msys_uptime)/1000,
+ EXTRACT_BE_32BITS(&nh->msys_uptime)%1000,
+ EXTRACT_BE_32BITS(&nh->utc_sec), EXTRACT_BE_32BITS(&nh->utc_nsec)));
- ND_PRINT((ndo, "#%u, ", EXTRACT_32BITS(&nh->sequence)));
+ ND_PRINT((ndo, "#%u, ", EXTRACT_BE_32BITS(&nh->sequence)));
nr = (const struct nfrec_v6 *)&nh[1];
ND_PRINT((ndo, "%2u recs", nrecs));
*/
ND_TCHECK(*nr);
ND_PRINT((ndo, "\n started %u.%03u, last %u.%03u",
- EXTRACT_32BITS(&nr->start_time)/1000,
- EXTRACT_32BITS(&nr->start_time)%1000,
- EXTRACT_32BITS(&nr->last_time)/1000,
- EXTRACT_32BITS(&nr->last_time)%1000));
+ EXTRACT_BE_32BITS(&nr->start_time)/1000,
+ EXTRACT_BE_32BITS(&nr->start_time)%1000,
+ EXTRACT_BE_32BITS(&nr->last_time)/1000,
+ EXTRACT_BE_32BITS(&nr->last_time)%1000));
asbuf[0] = buf[0] = '\0';
snprintf(buf, sizeof(buf), "/%u", nr->src_mask);
snprintf(asbuf, sizeof(asbuf), ":%u",
- EXTRACT_16BITS(&nr->src_as));
+ EXTRACT_BE_16BITS(&nr->src_as));
ND_PRINT((ndo, "\n %s%s%s:%u ", intoa(nr->src_ina.s_addr), buf, asbuf,
- EXTRACT_16BITS(&nr->srcport)));
+ EXTRACT_BE_16BITS(&nr->srcport)));
snprintf(buf, sizeof(buf), "/%d", nr->dst_mask);
snprintf(asbuf, sizeof(asbuf), ":%u",
- EXTRACT_16BITS(&nr->dst_as));
+ EXTRACT_BE_16BITS(&nr->dst_as));
ND_PRINT((ndo, "> %s%s%s:%u ", intoa(nr->dst_ina.s_addr), buf, asbuf,
- EXTRACT_16BITS(&nr->dstport)));
+ EXTRACT_BE_16BITS(&nr->dstport)));
ND_PRINT((ndo, ">> %s\n ", intoa(nr->nhop_ina.s_addr)));
buf[0]='\0';
snprintf(buf, sizeof(buf), "(%u<>%u encaps)",
- (EXTRACT_16BITS(&nr->flags) >> 8) & 0xff,
- (EXTRACT_16BITS(&nr->flags)) & 0xff);
+ (EXTRACT_BE_16BITS(&nr->flags) >> 8) & 0xff,
+ (EXTRACT_BE_16BITS(&nr->flags)) & 0xff);
ND_PRINT((ndo, "tos %u, %u (%u octets) %s",
nr->tos,
- EXTRACT_32BITS(&nr->packets),
- EXTRACT_32BITS(&nr->octets), buf));
+ EXTRACT_BE_32BITS(&nr->packets),
+ EXTRACT_BE_32BITS(&nr->octets), buf));
}
return;
* First 2 bytes are the version number.
*/
ND_TCHECK2(*cp, 2);
- ver = EXTRACT_16BITS(cp);
+ ver = EXTRACT_BE_16BITS(cp);
switch (ver) {
case 1:
if (DCCPH_X(dh) != 0) {
const struct dccp_hdr_ext *dhx = (const struct dccp_hdr_ext *)bp;
- seqno = EXTRACT_48BITS(dhx->dccph_seq);
+ seqno = EXTRACT_BE_48BITS(dhx->dccph_seq);
} else {
- seqno = EXTRACT_24BITS(dh->dccph_seq);
+ seqno = EXTRACT_BE_24BITS(dh->dccph_seq);
}
return seqno;
if (DCCPH_X(dh) != 0) {
ND_TCHECK2(*ackp, 8);
- ackno = EXTRACT_48BITS(ackp + 2);
+ ackno = EXTRACT_BE_48BITS(ackp + 2);
} else {
ND_TCHECK2(*ackp, 4);
- ackno = EXTRACT_24BITS(ackp + 1);
+ ackno = EXTRACT_BE_24BITS(ackp + 1);
}
ND_PRINT((ndo, "(ack=%" PRIu64 ") ", ackno));
}
ND_TCHECK2(*dh, fixed_hdrlen);
- sport = EXTRACT_16BITS(&dh->dccph_sport);
- dport = EXTRACT_16BITS(&dh->dccph_dport);
+ sport = EXTRACT_BE_16BITS(&dh->dccph_sport);
+ dport = EXTRACT_BE_16BITS(&dh->dccph_dport);
hlen = dh->dccph_doff * 4;
if (ip6) {
if (ndo->ndo_vflag && ND_TTEST2(bp[0], len)) {
uint16_t sum = 0, dccp_sum;
- dccp_sum = EXTRACT_16BITS(&dh->dccph_checksum);
+ dccp_sum = EXTRACT_BE_16BITS(&dh->dccph_checksum);
ND_PRINT((ndo, "cksum 0x%04x ", dccp_sum));
if (IP_V(ip) == 4)
sum = dccp_cksum(ndo, ip, dh, len);
ND_TCHECK(*dhr);
ND_PRINT((ndo, "%s (service=%d) ",
tok2str(dccp_pkt_type_str, "", dccph_type),
- EXTRACT_32BITS(&dhr->dccph_req_service)));
+ EXTRACT_BE_32BITS(&dhr->dccph_req_service)));
break;
}
case DCCP_PKT_RESPONSE: {
ND_TCHECK(*dhr);
ND_PRINT((ndo, "%s (service=%d) ",
tok2str(dccp_pkt_type_str, "", dccph_type),
- EXTRACT_32BITS(&dhr->dccph_resp_service)));
+ EXTRACT_BE_32BITS(&dhr->dccph_resp_service)));
break;
}
case DCCP_PKT_DATA:
ND_PRINT((ndo, "CCID option %d", *option));
switch (optlen) {
case 4:
- ND_PRINT((ndo, " %u", EXTRACT_16BITS(option + 2)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_16BITS(option + 2)));
break;
case 6:
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(option + 2)));
break;
default:
break;
break;
case 41:
if (optlen == 4)
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(option + 2)));
else
ND_PRINT((ndo, " optlen != 4"));
break;
case 42:
if (optlen == 4)
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(option + 2)));
else
ND_PRINT((ndo, " optlen != 4"));
break;
case 43:
if (optlen == 6)
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(option + 2)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(option + 2)));
else if (optlen == 4)
- ND_PRINT((ndo, " %u", EXTRACT_16BITS(option + 2)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_16BITS(option + 2)));
else
ND_PRINT((ndo, " optlen != 4 or 6"));
break;
goto trunc;
dh6o = (const struct dhcp6opt *)cp;
ND_TCHECK(*dh6o);
- optlen = EXTRACT_16BITS(&dh6o->dh6opt_len);
+ optlen = EXTRACT_BE_16BITS(&dh6o->dh6opt_len);
if (ep < cp + sizeof(*dh6o) + optlen)
goto trunc;
- opttype = EXTRACT_16BITS(&dh6o->dh6opt_type);
+ opttype = EXTRACT_BE_16BITS(&dh6o->dh6opt_type);
ND_PRINT((ndo, " (%s", tok2str(dh6opt_str, "opt_%u", opttype)));
ND_TCHECK2(*(cp + sizeof(*dh6o)), optlen);
switch (opttype) {
break;
}
tp = (const u_char *)(dh6o + 1);
- switch (EXTRACT_16BITS(tp)) {
+ switch (EXTRACT_BE_16BITS(tp)) {
case 1:
if (optlen >= 2 + 6) {
ND_PRINT((ndo, " hwaddr/time type %u time %u ",
- EXTRACT_16BITS(&tp[2]),
- EXTRACT_32BITS(&tp[4])));
+ EXTRACT_BE_16BITS(&tp[2]),
+ EXTRACT_BE_32BITS(&tp[4])));
for (i = 8; i < optlen; i++)
ND_PRINT((ndo, "%02x", tp[i]));
/*(*/
case 3:
if (optlen >= 2 + 2) {
ND_PRINT((ndo, " hwaddr type %u ",
- EXTRACT_16BITS(&tp[2])));
+ EXTRACT_BE_16BITS(&tp[2])));
for (i = 4; i < optlen; i++)
ND_PRINT((ndo, "%02x", tp[i]));
/*(*/
}
break;
default:
- ND_PRINT((ndo, " type %d)", EXTRACT_16BITS(tp)));
+ ND_PRINT((ndo, " type %d)", EXTRACT_BE_16BITS(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_32BITS(&tp[16]),
- EXTRACT_32BITS(&tp[20])));
+ EXTRACT_BE_32BITS(&tp[16]),
+ EXTRACT_BE_32BITS(&tp[20])));
if (optlen > 24) {
/* there are sub-options */
dhcp6opt_print(ndo, tp + 24, tp + optlen);
tp = (const u_char *)(dh6o + 1);
for (i = 0; i < optlen; i += 2) {
ND_PRINT((ndo, " %s",
- tok2str(dh6opt_str, "opt_%u", EXTRACT_16BITS(&tp[i]))));
+ tok2str(dh6opt_str, "opt_%u", EXTRACT_BE_16BITS(&tp[i]))));
}
ND_PRINT((ndo, ")"));
break;
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT((ndo, " %d)", EXTRACT_16BITS(tp)));
+ ND_PRINT((ndo, " %d)", EXTRACT_BE_16BITS(tp)));
break;
case DH6OPT_RELAY_MSG:
ND_PRINT((ndo, " ("));
tp++;
ND_PRINT((ndo, ", RD:"));
for (i = 0; i < 4; i++, tp += 2)
- ND_PRINT((ndo, " %04x", EXTRACT_16BITS(tp)));
+ ND_PRINT((ndo, " %04x", EXTRACT_BE_16BITS(tp)));
/* protocol dependent part */
authinfolen = optlen - 11;
}
for (i = 0; i < authrealmlen; i++, tp++)
ND_PRINT((ndo, "%02x", *tp));
- ND_PRINT((ndo, ", key ID: %08x", EXTRACT_32BITS(tp)));
+ ND_PRINT((ndo, ", key ID: %08x", EXTRACT_BE_32BITS(tp)));
tp += 4;
ND_PRINT((ndo, ", HMAC-MD5:"));
for (i = 0; i < 4; i++, tp+= 4)
- ND_PRINT((ndo, " %08x", EXTRACT_32BITS(tp)));
+ ND_PRINT((ndo, " %08x", EXTRACT_BE_32BITS(tp)));
break;
case DH6OPT_AUTHPROTO_RECONFIG:
if (authinfolen != 17) {
}
ND_PRINT((ndo, " value:"));
for (i = 0; i < 4; i++, tp+= 4)
- ND_PRINT((ndo, " %08x", EXTRACT_32BITS(tp)));
+ ND_PRINT((ndo, " %08x", EXTRACT_BE_32BITS(tp)));
break;
default:
ND_PRINT((ndo, " ??"));
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT((ndo, " %s)", dhcp6stcode(EXTRACT_16BITS(&tp[0]))));
+ ND_PRINT((ndo, " %s)", dhcp6stcode(EXTRACT_BE_16BITS(&tp[0]))));
break;
case DH6OPT_IA_NA:
case DH6OPT_IA_PD:
}
tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " IAID:%u T1:%u T2:%u",
- EXTRACT_32BITS(&tp[0]),
- EXTRACT_32BITS(&tp[4]),
- EXTRACT_32BITS(&tp[8])));
+ EXTRACT_BE_32BITS(&tp[0]),
+ EXTRACT_BE_32BITS(&tp[4]),
+ EXTRACT_BE_32BITS(&tp[8])));
if (optlen > 12) {
/* there are sub-options */
dhcp6opt_print(ndo, tp + 12, tp + optlen);
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT((ndo, " IAID:%u", EXTRACT_32BITS(tp)));
+ ND_PRINT((ndo, " IAID:%u", EXTRACT_BE_32BITS(tp)));
if (optlen > 4) {
/* there are sub-options */
dhcp6opt_print(ndo, tp + 4, tp + optlen);
tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " %s/%d", ip6addr_string(ndo, &tp[9]), tp[8]));
ND_PRINT((ndo, " pltime:%u vltime:%u",
- EXTRACT_32BITS(&tp[0]),
- EXTRACT_32BITS(&tp[4])));
+ EXTRACT_BE_32BITS(&tp[0]),
+ EXTRACT_BE_32BITS(&tp[4])));
if (optlen > 25) {
/* there are sub-options */
dhcp6opt_print(ndo, tp + 25, tp + optlen);
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT((ndo, " %d)", EXTRACT_32BITS(tp)));
+ ND_PRINT((ndo, " %d)", EXTRACT_BE_32BITS(tp)));
break;
case DH6OPT_REMOTE_ID:
if (optlen < 4) {
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT((ndo, " %d ", EXTRACT_32BITS(tp)));
+ ND_PRINT((ndo, " %d ", EXTRACT_BE_32BITS(tp)));
/*
* Print hex dump first 10 characters.
*/
}
tp = (const u_char *)(dh6o + 1);
while (tp < cp + sizeof(*dh6o) + optlen - 4) {
- subopt_code = EXTRACT_16BITS(tp);
+ subopt_code = EXTRACT_BE_16BITS(tp);
tp += 2;
- subopt_len = EXTRACT_16BITS(tp);
+ subopt_len = EXTRACT_BE_16BITS(tp);
tp += 2;
if (tp + subopt_len > cp + sizeof(*dh6o) + optlen)
goto trunc;
ND_PRINT((ndo, " %s (", name)); /*)*/
if (dh6->dh6_msgtype != DH6_RELAY_FORW &&
dh6->dh6_msgtype != DH6_RELAY_REPLY) {
- ND_PRINT((ndo, "xid=%x", EXTRACT_32BITS(&dh6->dh6_xid) & DH6_XIDMASK));
+ ND_PRINT((ndo, "xid=%x", EXTRACT_BE_32BITS(&dh6->dh6_xid) & DH6_XIDMASK));
extp = (const u_char *)(dh6 + 1);
dhcp6opt_print(ndo, extp, ep);
} else { /* relay messages */
return(NULL);
/* print the qtype */
- i = EXTRACT_16BITS(cp);
+ i = EXTRACT_BE_16BITS(cp);
cp += 2;
ND_PRINT((ndo, " %s", tok2str(ns_type2str, "Type%d", i)));
/* print the qclass (if it's not IN) */
- i = EXTRACT_16BITS(cp);
+ i = EXTRACT_BE_16BITS(cp);
cp += 2;
if (is_mdns)
class = (i & ~C_QU);
return (ndo->ndo_snapend);
/* print the type/qtype */
- typ = EXTRACT_16BITS(cp);
+ typ = EXTRACT_BE_16BITS(cp);
cp += 2;
/* print the class (if it's not IN and the type isn't OPT) */
- i = EXTRACT_16BITS(cp);
+ i = EXTRACT_BE_16BITS(cp);
cp += 2;
if (is_mdns)
class = (i & ~C_CACHE_FLUSH);
if (typ == T_OPT) {
/* get opt flags */
cp += 2;
- opt_flags = EXTRACT_16BITS(cp);
+ opt_flags = EXTRACT_BE_16BITS(cp);
/* ignore rest of ttl field */
cp += 2;
} else if (ndo->ndo_vflag > 2) {
/* print ttl */
ND_PRINT((ndo, " ["));
- unsigned_relts_print(ndo, EXTRACT_32BITS(cp));
+ unsigned_relts_print(ndo, EXTRACT_BE_32BITS(cp));
ND_PRINT((ndo, "]"));
cp += 4;
} else {
cp += 4;
}
- len = EXTRACT_16BITS(cp);
+ len = EXTRACT_BE_16BITS(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_32BITS(cp)))));
+ ND_PRINT((ndo, " %s", intoa(htonl(EXTRACT_BE_32BITS(cp)))));
break;
case T_NS:
return(NULL);
if (!ND_TTEST2(*cp, 5 * 4))
return(NULL);
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
break;
case T_MX:
return(NULL);
if (ns_nprint(ndo, cp + 2, bp) == NULL)
return(NULL);
- ND_PRINT((ndo, " %d", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, " %d", EXTRACT_BE_16BITS(cp)));
break;
case T_TXT:
return(NULL);
if (ns_nprint(ndo, cp + 6, bp) == NULL)
return(NULL);
- ND_PRINT((ndo, ":%d %d %d", EXTRACT_16BITS(cp + 4),
- EXTRACT_16BITS(cp), EXTRACT_16BITS(cp + 2)));
+ ND_PRINT((ndo, ":%d %d %d", EXTRACT_BE_16BITS(cp + 4),
+ EXTRACT_BE_16BITS(cp), EXTRACT_BE_16BITS(cp + 2)));
break;
case T_AAAA:
cp += 6;
if (!ND_TTEST2(*cp, 2))
return(NULL);
- ND_PRINT((ndo, " fudge=%u", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, " fudge=%u", EXTRACT_BE_16BITS(cp)));
cp += 2;
if (!ND_TTEST2(*cp, 2))
return(NULL);
- ND_PRINT((ndo, " maclen=%u", EXTRACT_16BITS(cp)));
- cp += 2 + EXTRACT_16BITS(cp);
+ ND_PRINT((ndo, " maclen=%u", EXTRACT_BE_16BITS(cp)));
+ cp += 2 + EXTRACT_BE_16BITS(cp);
if (!ND_TTEST2(*cp, 2))
return(NULL);
- ND_PRINT((ndo, " origid=%u", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, " origid=%u", EXTRACT_BE_16BITS(cp)));
cp += 2;
if (!ND_TTEST2(*cp, 2))
return(NULL);
- ND_PRINT((ndo, " error=%u", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, " error=%u", EXTRACT_BE_16BITS(cp)));
cp += 2;
if (!ND_TTEST2(*cp, 2))
return(NULL);
- ND_PRINT((ndo, " otherlen=%u", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, " otherlen=%u", EXTRACT_BE_16BITS(cp)));
cp += 2;
}
}
np = (const HEADER *)bp;
ND_TCHECK(*np);
/* get the byte-order right */
- qdcount = EXTRACT_16BITS(&np->qdcount);
- ancount = EXTRACT_16BITS(&np->ancount);
- nscount = EXTRACT_16BITS(&np->nscount);
- arcount = EXTRACT_16BITS(&np->arcount);
+ qdcount = EXTRACT_BE_16BITS(&np->qdcount);
+ ancount = EXTRACT_BE_16BITS(&np->ancount);
+ nscount = EXTRACT_BE_16BITS(&np->nscount);
+ arcount = EXTRACT_BE_16BITS(&np->arcount);
if (DNS_QR(np)) {
/* this is a response */
ND_PRINT((ndo, "%d%s%s%s%s%s%s",
- EXTRACT_16BITS(&np->id),
+ EXTRACT_BE_16BITS(&np->id),
ns_ops[DNS_OPCODE(np)],
ns_resp[DNS_RCODE(np)],
DNS_AA(np)? "*" : "",
/* Print QUESTION section on -vv */
cp = (const u_char *)(np + 1);
while (qdcount--) {
- if (qdcount < EXTRACT_16BITS(&np->qdcount) - 1)
+ if (qdcount < EXTRACT_BE_16BITS(&np->qdcount) - 1)
ND_PRINT((ndo, ","));
if (ndo->ndo_vflag > 1) {
ND_PRINT((ndo, " q:"));
}
else {
/* this is a request */
- ND_PRINT((ndo, "%d%s%s%s", EXTRACT_16BITS(&np->id), ns_ops[DNS_OPCODE(np)],
- DNS_RD(np) ? "+" : "",
- DNS_CD(np) ? "%" : ""));
+ ND_PRINT((ndo, "%d%s%s%s", EXTRACT_BE_16BITS(&np->id), ns_ops[DNS_OPCODE(np)],
+ DNS_RD(np) ? "+" : "",
+ DNS_CD(np) ? "%" : ""));
/* any weirdness? */
- b2 = EXTRACT_16BITS(((const u_short *)np)+1);
+ b2 = EXTRACT_BE_16BITS(((const u_short *)np) + 1);
if (b2 & 0x6cf)
ND_PRINT((ndo, " [b2&3=0x%x]", b2));
while (tptr < (pptr+length)) {
ND_TCHECK2(*tptr, 4);
- type = EXTRACT_16BITS(tptr);
- len = EXTRACT_16BITS(tptr+2);
+ type = EXTRACT_BE_16BITS(tptr);
+ len = EXTRACT_BE_16BITS(tptr + 2);
/* XXX: should not be but sometimes it is, see the test captures */
if (type == 0)
return;
ND_PRINT((ndo, " src %s grp %s", ipaddr_string(ndo, bp), ipaddr_string(ndo, bp + 4)));
bp += 8;
ND_PRINT((ndo, " timer "));
- unsigned_relts_print(ndo, EXTRACT_32BITS(bp));
+ unsigned_relts_print(ndo, EXTRACT_BE_32BITS(bp));
return (0);
trunc:
return (-1);
tok2str(eap_frame_type_values, "unknown", eap->type),
eap->type,
eap->version,
- EXTRACT_16BITS(eap->length)));
+ EXTRACT_BE_16BITS(eap->length)));
return;
}
tok2str(eap_frame_type_values, "unknown", eap->type),
eap->type,
eap->version,
- EXTRACT_16BITS(eap->length)));
+ EXTRACT_BE_16BITS(eap->length)));
tptr += sizeof(struct eap_frame_t);
tlen -= sizeof(struct eap_frame_t);
ND_TCHECK_8BITS(tptr);
type = *(tptr);
ND_TCHECK_16BITS(tptr+2);
- len = EXTRACT_16BITS(tptr+2);
+ len = EXTRACT_BE_16BITS(tptr + 2);
ND_PRINT((ndo, ", %s (%u), id %u, len %u",
tok2str(eap_code_values, "unknown", type),
type,
if (EAP_TLS_EXTRACT_BIT_L(*(tptr+5))) {
ND_TCHECK_32BITS(tptr + 6);
- ND_PRINT((ndo, " len %u", EXTRACT_32BITS(tptr + 6)));
+ ND_PRINT((ndo, " len %u", EXTRACT_BE_32BITS(tptr + 6)));
}
break;
if (EAP_TLS_EXTRACT_BIT_L(*(tptr+5))) {
ND_TCHECK_32BITS(tptr + 6);
- ND_PRINT((ndo, " len %u", EXTRACT_32BITS(tptr + 6)));
+ ND_PRINT((ndo, " len %u", EXTRACT_BE_32BITS(tptr + 6)));
}
/* FIXME - TLV attributes follow */
if (!ndo->ndo_vflag) {
ND_PRINT((ndo, "EGPv%u, AS %u, seq %u, length %u",
egp->egp_version,
- EXTRACT_16BITS(&egp->egp_as),
- EXTRACT_16BITS(&egp->egp_sequence),
+ EXTRACT_BE_16BITS(&egp->egp_as),
+ EXTRACT_BE_16BITS(&egp->egp_sequence),
length));
return;
} else
break;
}
ND_PRINT((ndo, " hello:%d poll:%d",
- EXTRACT_16BITS(&egp->egp_hello),
- EXTRACT_16BITS(&egp->egp_poll)));
+ EXTRACT_BE_16BITS(&egp->egp_hello),
+ EXTRACT_BE_16BITS(&egp->egp_poll)));
break;
case EGPC_REFUSE:
else
ND_PRINT((ndo, " [status %d]", status));
- if (EXTRACT_16BITS(&egp->egp_reason) <= EGPR_UVERSION)
- ND_PRINT((ndo, " %s", egp_reasons[EXTRACT_16BITS(&egp->egp_reason)]));
+ if (EXTRACT_BE_16BITS(&egp->egp_reason) <= EGPR_UVERSION)
+ ND_PRINT((ndo, " %s", egp_reasons[EXTRACT_BE_16BITS(&egp->egp_reason)]));
else
- ND_PRINT((ndo, " [reason %d]", EXTRACT_16BITS(&egp->egp_reason)));
+ ND_PRINT((ndo, " [reason %d]", EXTRACT_BE_16BITS(&egp->egp_reason)));
break;
default:
eigrp_com_header->version,
tok2str(eigrp_opcode_values, "unknown, type: %u",eigrp_com_header->opcode),
eigrp_com_header->opcode,
- EXTRACT_16BITS(&eigrp_com_header->checksum),
+ EXTRACT_BE_16BITS(&eigrp_com_header->checksum),
tok2str(eigrp_common_header_flag_values,
"none",
- EXTRACT_32BITS(&eigrp_com_header->flags)),
- EXTRACT_32BITS(&eigrp_com_header->seq),
- EXTRACT_32BITS(&eigrp_com_header->ack),
- EXTRACT_32BITS(&eigrp_com_header->asn),
+ EXTRACT_BE_32BITS(&eigrp_com_header->flags)),
+ EXTRACT_BE_32BITS(&eigrp_com_header->seq),
+ EXTRACT_BE_32BITS(&eigrp_com_header->ack),
+ EXTRACT_BE_32BITS(&eigrp_com_header->asn),
tlen));
tptr+=sizeof(struct eigrp_common_header);
ND_TCHECK2(*tptr, sizeof(struct eigrp_tlv_header));
eigrp_tlv_header = (const struct eigrp_tlv_header *)tptr;
- eigrp_tlv_len=EXTRACT_16BITS(&eigrp_tlv_header->length);
- eigrp_tlv_type=EXTRACT_16BITS(&eigrp_tlv_header->type);
+ eigrp_tlv_len=EXTRACT_BE_16BITS(&eigrp_tlv_header->length);
+ eigrp_tlv_type=EXTRACT_BE_16BITS(&eigrp_tlv_header->type);
if (eigrp_tlv_len < sizeof(struct eigrp_tlv_header) ||
}
ND_PRINT((ndo, "\n\t holdtime: %us, k1 %u, k2 %u, k3 %u, k4 %u, k5 %u",
- EXTRACT_16BITS(tlv_ptr.eigrp_tlv_general_parm->holdtime),
+ EXTRACT_BE_16BITS(tlv_ptr.eigrp_tlv_general_parm->holdtime),
tlv_ptr.eigrp_tlv_general_parm->k1,
tlv_ptr.eigrp_tlv_general_parm->k2,
tlv_ptr.eigrp_tlv_general_parm->k3,
ND_PRINT((ndo, "\n\t IPv4 prefix: %15s/%u, nexthop: ",
ipaddr_string(ndo, prefix),
bit_length));
- if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0)
+ if (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0)
ND_PRINT((ndo, "self"));
else
ND_PRINT((ndo, "%s",ipaddr_string(ndo, &tlv_ptr.eigrp_tlv_ip_int->nexthop)));
ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
- (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->delay)/100),
- EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->bandwidth),
- EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_ip_int->mtu),
+ (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_int->delay)/100),
+ EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_int->bandwidth),
+ EXTRACT_BE_24BITS(&tlv_ptr.eigrp_tlv_ip_int->mtu),
tlv_ptr.eigrp_tlv_ip_int->hopcount,
tlv_ptr.eigrp_tlv_ip_int->reliability,
tlv_ptr.eigrp_tlv_ip_int->load));
ND_PRINT((ndo, "\n\t IPv4 prefix: %15s/%u, nexthop: ",
ipaddr_string(ndo, prefix),
bit_length));
- if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0)
+ if (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0)
ND_PRINT((ndo, "self"));
else
ND_PRINT((ndo, "%s",ipaddr_string(ndo, &tlv_ptr.eigrp_tlv_ip_ext->nexthop)));
ND_PRINT((ndo, "\n\t origin-router %s, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u",
ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_ext->origin_router),
- EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->origin_as),
+ EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_ip_ext->origin_as),
tok2str(eigrp_ext_proto_id_values,"unknown",tlv_ptr.eigrp_tlv_ip_ext->proto_id),
tlv_ptr.eigrp_tlv_ip_ext->flags,
- EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->tag),
- EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->metric)));
+ EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_ip_ext->tag),
+ EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_ip_ext->metric)));
ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
- (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->delay)/100),
- EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->bandwidth),
- EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_ip_ext->mtu),
+ (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->delay)/100),
+ EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->bandwidth),
+ EXTRACT_BE_24BITS(&tlv_ptr.eigrp_tlv_ip_ext->mtu),
tlv_ptr.eigrp_tlv_ip_ext->hopcount,
tlv_ptr.eigrp_tlv_ip_ext->reliability,
tlv_ptr.eigrp_tlv_ip_ext->load));
}
ND_PRINT((ndo, "\n\t Cable-range: %u-%u, Router-ID %u",
- EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_start),
- EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_end),
- EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->router_id)));
+ EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_start),
+ EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_end),
+ EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->router_id)));
break;
case EIGRP_TLV_AT_INT:
}
ND_PRINT((ndo, "\n\t Cable-Range: %u-%u, nexthop: ",
- EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_start),
- EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_end)));
+ EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_start),
+ EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_end)));
- if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop) == 0)
+ if (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop) == 0)
ND_PRINT((ndo, "self"));
else
ND_PRINT((ndo, "%u.%u",
- EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop),
- EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop[2])));
+ EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop),
+ EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop[2])));
ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
- (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_int->delay)/100),
- EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_int->bandwidth),
- EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_at_int->mtu),
+ (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_int->delay)/100),
+ EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_int->bandwidth),
+ EXTRACT_BE_24BITS(&tlv_ptr.eigrp_tlv_at_int->mtu),
tlv_ptr.eigrp_tlv_at_int->hopcount,
tlv_ptr.eigrp_tlv_at_int->reliability,
tlv_ptr.eigrp_tlv_at_int->load));
}
ND_PRINT((ndo, "\n\t Cable-Range: %u-%u, nexthop: ",
- EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_start),
- EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_end)));
+ EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_start),
+ EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_end)));
- if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop) == 0)
+ if (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop) == 0)
ND_PRINT((ndo, "self"));
else
ND_PRINT((ndo, "%u.%u",
- EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop),
- EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop[2])));
+ EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop),
+ EXTRACT_BE_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop[2])));
ND_PRINT((ndo, "\n\t origin-router %u, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u",
- EXTRACT_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_router),
- EXTRACT_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_as),
+ EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_router),
+ EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_as),
tok2str(eigrp_ext_proto_id_values,"unknown",tlv_ptr.eigrp_tlv_at_ext->proto_id),
tlv_ptr.eigrp_tlv_at_ext->flags,
- EXTRACT_32BITS(tlv_ptr.eigrp_tlv_at_ext->tag),
- EXTRACT_16BITS(tlv_ptr.eigrp_tlv_at_ext->metric)));
+ EXTRACT_BE_32BITS(tlv_ptr.eigrp_tlv_at_ext->tag),
+ EXTRACT_BE_16BITS(tlv_ptr.eigrp_tlv_at_ext->metric)));
ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
- (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_ext->delay)/100),
- EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_ext->bandwidth),
- EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_at_ext->mtu),
+ (EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_ext->delay)/100),
+ EXTRACT_BE_32BITS(&tlv_ptr.eigrp_tlv_at_ext->bandwidth),
+ EXTRACT_BE_24BITS(&tlv_ptr.eigrp_tlv_at_ext->mtu),
tlv_ptr.eigrp_tlv_at_ext->hopcount,
tlv_ptr.eigrp_tlv_at_ext->reliability,
tlv_ptr.eigrp_tlv_at_ext->load));
ENC_PRINT_TYPE(flags, M_AUTH, "authentic");
ENC_PRINT_TYPE(flags, M_CONF, "confidential");
/* ENC_PRINT_TYPE(flags, M_TUNNEL, "tunnel"); */
- ND_PRINT((ndo, "SPI 0x%08x: ", EXTRACT_32BITS(&hdr->spi)));
+ ND_PRINT((ndo, "SPI 0x%08x: ", EXTRACT_BE_32BITS(&hdr->spi)));
length -= ENC_HDRLEN;
caplen -= ENC_HDRLEN;
ND_PRINT((ndo, "[|ESP]"));
goto fail;
}
- ND_PRINT((ndo, "ESP(spi=0x%08x", EXTRACT_32BITS(&esp->esp_spi)));
- ND_PRINT((ndo, ",seq=0x%x)", EXTRACT_32BITS(&esp->esp_seq)));
+ ND_PRINT((ndo, "ESP(spi=0x%08x", EXTRACT_BE_32BITS(&esp->esp_spi)));
+ ND_PRINT((ndo, ",seq=0x%x)", EXTRACT_BE_32BITS(&esp->esp_seq)));
ND_PRINT((ndo, ", length %u", length));
#ifndef HAVE_LIBCRYPTO
case 6:
ip6 = (const struct ip6_hdr *)bp2;
/* we do not attempt to decrypt jumbograms */
- if (!EXTRACT_16BITS(&ip6->ip6_plen))
+ if (!EXTRACT_BE_16BITS(&ip6->ip6_plen))
goto fail;
/* if we can't get nexthdr, we do not need to decrypt it */
- len = sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen);
+ len = sizeof(struct ip6_hdr) + EXTRACT_BE_16BITS(&ip6->ip6_plen);
/* see if we can find the SA, and if so, decode it */
for (sa = ndo->ndo_sa_list_head; sa != NULL; sa = sa->next) {
- if (sa->spi == EXTRACT_32BITS(&esp->esp_spi) &&
+ if (sa->spi == EXTRACT_BE_32BITS(&esp->esp_spi) &&
sa->daddr_version == 6 &&
UNALIGNED_MEMCMP(&sa->daddr.in6, &ip6->ip6_dst,
sizeof(struct in6_addr)) == 0) {
break;
case 4:
/* nexthdr & padding are in the last fragment */
- if (EXTRACT_16BITS(&ip->ip_off) & IP_MF)
+ if (EXTRACT_BE_16BITS(&ip->ip_off) & IP_MF)
goto fail;
- len = EXTRACT_16BITS(&ip->ip_len);
+ len = EXTRACT_BE_16BITS(&ip->ip_len);
/* see if we can find the SA, and if so, decode it */
for (sa = ndo->ndo_sa_list_head; sa != NULL; sa = sa->next) {
- if (sa->spi == EXTRACT_32BITS(&esp->esp_spi) &&
+ if (sa->spi == EXTRACT_BE_32BITS(&esp->esp_spi) &&
sa->daddr_version == 4 &&
UNALIGNED_MEMCMP(&sa->daddr.in4, &ip->ip_dst,
sizeof(struct in_addr)) == 0) {
etheraddr_string(ndo, ESRC(ep)),
etheraddr_string(ndo, EDST(ep))));
- length_type = EXTRACT_16BITS(&ep->ether_length_type);
+ length_type = EXTRACT_BE_16BITS(&ep->ether_length_type);
if (!ndo->ndo_qflag) {
if (length_type <= ETHERMTU) {
ND_PRINT((ndo, ", 802.3"));
src.addr_string = etheraddr_string;
dst.addr = EDST(ep);
dst.addr_string = etheraddr_string;
- length_type = EXTRACT_16BITS(&ep->ether_length_type);
+ length_type = EXTRACT_BE_16BITS(&ep->ether_length_type);
recurse:
/*
return (hdrlen + length);
}
if (ndo->ndo_eflag) {
- uint16_t tag = EXTRACT_16BITS(p);
+ uint16_t tag = EXTRACT_BE_16BITS(p);
ND_PRINT((ndo, "%s, ", ieee8021q_tci_string(tag)));
}
- length_type = EXTRACT_16BITS(p + 2);
+ length_type = EXTRACT_BE_16BITS(p + 2);
if (ndo->ndo_eflag && length_type > ETHERMTU)
ND_PRINT((ndo, "ethertype %s, ", tok2str(ethertype_values,"0x%04x", length_type)));
p += 4;
#define ForCES_V(forcesh) ((forcesh)->fm_vrsvd >> 4)
nd_uint8_t fm_tom; /* type of message */
nd_uint16_t fm_len; /* total length * 4 bytes */
-#define ForCES_BLN(forcesh) ((uint32_t)(EXTRACT_16BITS(&(forcesh)->fm_len) << 2))
+#define ForCES_BLN(forcesh) ((uint32_t)(EXTRACT_BE_16BITS(&(forcesh)->fm_len) << 2))
nd_uint32_t fm_sid; /* Source ID */
-#define ForCES_SID(forcesh) EXTRACT_32BITS(&(forcesh)->fm_sid)
+#define ForCES_SID(forcesh) EXTRACT_BE_32BITS(&(forcesh)->fm_sid)
nd_uint32_t fm_did; /* Destination ID */
-#define ForCES_DID(forcesh) EXTRACT_32BITS(&(forcesh)->fm_did)
+#define ForCES_DID(forcesh) EXTRACT_BE_32BITS(&(forcesh)->fm_did)
nd_uint8_t fm_cor[8]; /* correlator */
nd_uint32_t fm_flags; /* flags */
-#define ForCES_ACK(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0xC0000000) >> 30)
-#define ForCES_PRI(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x38000000) >> 27)
-#define ForCES_RS1(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x07000000) >> 24)
-#define ForCES_EM(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x00C00000) >> 22)
-#define ForCES_AT(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x00200000) >> 21)
-#define ForCES_TP(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x00180000) >> 19)
-#define ForCES_RS2(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x0007FFFF) >> 0)
+#define ForCES_ACK(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0xC0000000) >> 30)
+#define ForCES_PRI(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x38000000) >> 27)
+#define ForCES_RS1(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x07000000) >> 24)
+#define ForCES_EM(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x00C00000) >> 22)
+#define ForCES_AT(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x00200000) >> 21)
+#define ForCES_TP(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x00180000) >> 19)
+#define ForCES_RS2(forcesh) ((EXTRACT_BE_32BITS(&(forcesh)->fm_flags)&0x0007FFFF) >> 0)
};
#define ForCES_HLN_VALID(fhl,tlen) ((tlen) >= ForCES_HDRL && \
#define TLV_ALN_LEN(len) F_ALN_LEN(TLV_SET_LEN(len))
#define TLV_RDAT_LEN(tlv) ((int)(EXTRACT_16BITS(&(tlv)->length) - TLV_SET_LEN(0))
#define TLV_DATA(tlvp) ((const void*)(((const char*)(tlvp)) + TLV_SET_LEN(0)))
-#define GO_NXT_TLV(tlv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_16BITS(&(tlv)->length)), \
+#define GO_NXT_TLV(tlv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_BE_16BITS(&(tlv)->length)), \
(const struct forces_tlv*)(((const char*)(tlv)) \
- + F_ALN_LEN(EXTRACT_16BITS(&(tlv)->length))))
+ + F_ALN_LEN(EXTRACT_BE_16BITS(&(tlv)->length))))
#define ILV_SET_LEN(len) (F_ALN_LEN(ILV_HDRL) + (len))
#define ILV_ALN_LEN(len) F_ALN_LEN(ILV_SET_LEN(len))
-#define ILV_RDAT_LEN(ilv) ((int)(EXTRACT_32BITS(&(ilv)->length)) - ILV_SET_LEN(0))
+#define ILV_RDAT_LEN(ilv) ((int)(EXTRACT_BE_32BITS(&(ilv)->length)) - ILV_SET_LEN(0))
#define ILV_DATA(ilvp) ((const void*)(((const char*)(ilvp)) + ILV_SET_LEN(0)))
-#define GO_NXT_ILV(ilv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_32BITS(&(ilv)->length)), \
+#define GO_NXT_ILV(ilv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_BE_32BITS(&(ilv)->length)), \
(const struct forces_ilv *)(((const char*)(ilv)) \
- + F_ALN_LEN(EXTRACT_32BITS(&(ilv)->length))))
+ + F_ALN_LEN(EXTRACT_BE_32BITS(&(ilv)->length))))
#define INVALID_RLEN 1
#define INVALID_STLN 2
#define INVALID_LTLN 3
{
if (rlen < TLV_HDRL)
return INVALID_RLEN;
- if (EXTRACT_16BITS(&tlv->length) < TLV_HDRL)
+ if (EXTRACT_BE_16BITS(&tlv->length) < TLV_HDRL)
return INVALID_STLN;
- if (EXTRACT_16BITS(&tlv->length) > rlen)
+ if (EXTRACT_BE_16BITS(&tlv->length) > rlen)
return INVALID_LTLN;
- if (rlen < F_ALN_LEN(EXTRACT_16BITS(&tlv->length)))
+ if (rlen < F_ALN_LEN(EXTRACT_BE_16BITS(&tlv->length)))
return INVALID_ALEN;
return 0;
{
if (rlen < ILV_HDRL)
return INVALID_RLEN;
- if (EXTRACT_32BITS(&ilv->length) < ILV_HDRL)
+ if (EXTRACT_BE_32BITS(&ilv->length) < ILV_HDRL)
return INVALID_STLN;
- if (EXTRACT_32BITS(&ilv->length) > rlen)
+ if (EXTRACT_BE_32BITS(&ilv->length) > rlen)
return INVALID_LTLN;
- if (rlen < F_ALN_LEN(EXTRACT_32BITS(&ilv->length)))
+ if (rlen < F_ALN_LEN(EXTRACT_BE_32BITS(&ilv->length)))
return INVALID_ALEN;
return 0;
*/
rlen = len - TLV_HDRL;
ND_TCHECK(*tlv);
- type = EXTRACT_16BITS(&tlv->type);
+ type = EXTRACT_BE_16BITS(&tlv->type);
if (type != F_TLV_FULD) {
ND_PRINT((ndo, "Error: expecting FULLDATA!\n"));
return -1;
return -1;
}
if (ndo->ndo_vflag >= 3) {
- int ilvl = EXTRACT_32BITS(&ilv->length);
+ int ilvl = EXTRACT_BE_32BITS(&ilv->length);
ND_PRINT((ndo, "\n%s ILV: type %x length %d\n", &ib[1],
- EXTRACT_32BITS(&ilv->type), ilvl));
+ EXTRACT_BE_32BITS(&ilv->type), ilvl));
hex_print_with_offset(ndo, "\t\t[", tdp, ilvl-ILV_HDRL, 0);
}
*/
rlen = len - TLV_HDRL;
ND_TCHECK(*tlv);
- type = EXTRACT_16BITS(&tlv->type);
+ type = EXTRACT_BE_16BITS(&tlv->type);
if (type != F_TLV_SPAD) {
ND_PRINT((ndo, "Error: expecting SPARSEDATA!\n"));
return -1;
u_int invtlv;
ND_TCHECK(*tdp);
- id = EXTRACT_32BITS(tdp);
+ id = EXTRACT_BE_32BITS(tdp);
ND_PRINT((ndo, "%sKeyinfo: Key 0x%x\n", ib, id));
ND_TCHECK(*kdtlv);
- type = EXTRACT_16BITS(&kdtlv->type);
+ type = EXTRACT_BE_16BITS(&kdtlv->type);
invtlv = tlv_valid(kdtlv, len);
if (invtlv) {
ND_PRINT((ndo, "%s TLV type 0x%x len %d\n",
tok2str(ForCES_TLV_err, NULL, invtlv), type,
- EXTRACT_16BITS(&kdtlv->length)));
+ EXTRACT_BE_16BITS(&kdtlv->length)));
return -1;
}
/*
* length is large enough but not too large (it doesn't
* go past the end of the containing TLV).
*/
- tll = EXTRACT_16BITS(&kdtlv->length);
+ tll = EXTRACT_BE_16BITS(&kdtlv->length);
dp = (const u_char *) TLV_DATA(kdtlv);
return fdatatlv_print(ndo, dp, tll, op_msk, indent);
ND_TCHECK2(*pptr, 4);
if (len < 4)
goto trunc;
- id = EXTRACT_32BITS(pptr);
+ id = EXTRACT_BE_32BITS(pptr);
if (ndo->ndo_vflag >= 3)
ND_PRINT((ndo, "%sID#%02u: %d\n", ib, i + 1, id));
len -= 4;
pptr += sizeof(struct forces_tlv);
len -= sizeof(struct forces_tlv);
- starti = EXTRACT_32BITS(pptr);
+ starti = EXTRACT_BE_32BITS(pptr);
pptr += 4;
len -= 4;
- endi = EXTRACT_32BITS(pptr);
+ endi = EXTRACT_BE_32BITS(pptr);
pptr += 4;
len -= 4;
pptr += sizeof(struct forces_tlv);
len -= sizeof(struct forces_tlv);
/* skip key content */
- tll = EXTRACT_16BITS(&keytlv->length);
+ tll = EXTRACT_BE_16BITS(&keytlv->length);
if (tll < TLV_HDRL) {
ND_PRINT((ndo, "key content length %u < %u\n",
tll, TLV_HDRL));
u_int invtlv;
ND_TCHECK(*pdtlv);
- type = EXTRACT_16BITS(&pdtlv->type);
+ type = EXTRACT_BE_16BITS(&pdtlv->type);
invtlv = tlv_valid(pdtlv, len);
if (invtlv) {
ND_PRINT((ndo, "%s Outstanding bytes %d for TLV type 0x%x TLV len %d\n",
tok2str(ForCES_TLV_err, NULL, invtlv), len, type,
- EXTRACT_16BITS(&pdtlv->length)));
+ EXTRACT_BE_16BITS(&pdtlv->length)));
goto pd_err;
}
/*
* length is large enough but not too large (it doesn't
* go past the end of the containing TLV).
*/
- tll = EXTRACT_16BITS(&pdtlv->length) - TLV_HDRL;
- aln = F_ALN_LEN(EXTRACT_16BITS(&pdtlv->length));
- if (aln > EXTRACT_16BITS(&pdtlv->length)) {
+ tll = EXTRACT_BE_16BITS(&pdtlv->length) - TLV_HDRL;
+ aln = F_ALN_LEN(EXTRACT_BE_16BITS(&pdtlv->length));
+ if (aln > EXTRACT_BE_16BITS(&pdtlv->length)) {
if (aln > len) {
ND_PRINT((ndo,
"Invalid padded pathdata TLV type 0x%x len %d missing %d pad bytes\n",
- type, EXTRACT_16BITS(&pdtlv->length), aln - len));
+ type, EXTRACT_BE_16BITS(&pdtlv->length), aln - len));
} else {
- pad = aln - EXTRACT_16BITS(&pdtlv->length);
+ pad = aln - EXTRACT_BE_16BITS(&pdtlv->length);
}
}
if (pd_valid(type)) {
if (ndo->ndo_vflag >= 3 && ops->v != F_TLV_PDAT) {
if (pad)
ND_PRINT((ndo, "%s %s (Length %d DataLen %d pad %d Bytes)\n",
- ib, ops->s, EXTRACT_16BITS(&pdtlv->length), tll, pad));
+ ib, ops->s, EXTRACT_BE_16BITS(&pdtlv->length), tll, pad));
else
ND_PRINT((ndo, "%s %s (Length %d DataLen %d Bytes)\n",
- ib, ops->s, EXTRACT_16BITS(&pdtlv->length), tll));
+ ib, ops->s, EXTRACT_BE_16BITS(&pdtlv->length), tll));
}
chk_op_type(ndo, type, op_msk, ops->op_msk);
len -= (TLV_HDRL + pad + tll);
} else {
ND_PRINT((ndo, "Invalid path data content type 0x%x len %d\n",
- type, EXTRACT_16BITS(&pdtlv->length)));
+ type, EXTRACT_BE_16BITS(&pdtlv->length)));
pd_err:
- if (EXTRACT_16BITS(&pdtlv->length)) {
+ if (EXTRACT_BE_16BITS(&pdtlv->length)) {
hex_print_with_offset(ndo, "Bad Data val\n\t [",
pptr, len, 0);
ND_PRINT((ndo, "]\n"));
goto trunc;
if (ndo->ndo_vflag >= 3) {
ND_PRINT((ndo, "\n%sPathdata: Flags 0x%x ID count %d\n",
- ib, EXTRACT_16BITS(&pdh->pflags), EXTRACT_16BITS(&pdh->pIDcnt)));
+ ib, EXTRACT_BE_16BITS(&pdh->pflags), EXTRACT_BE_16BITS(&pdh->pIDcnt)));
}
- if (EXTRACT_16BITS(&pdh->pflags) & F_SELKEY) {
+ if (EXTRACT_BE_16BITS(&pdh->pflags) & F_SELKEY) {
op_msk |= B_KEYIN;
}
/* Table GET Range operation */
- if (EXTRACT_16BITS(&pdh->pflags) & F_SELTABRANGE) {
+ if (EXTRACT_BE_16BITS(&pdh->pflags) & F_SELTABRANGE) {
op_msk |= B_TRNG;
}
/* Table SET append operation */
- if (EXTRACT_16BITS(&pdh->pflags) & F_TABAPPEND) {
+ if (EXTRACT_BE_16BITS(&pdh->pflags) & F_TABAPPEND) {
op_msk |= B_APPND;
}
pptr += sizeof(struct pathdata_h);
len -= sizeof(struct pathdata_h);
- idcnt = EXTRACT_16BITS(&pdh->pIDcnt);
+ idcnt = EXTRACT_BE_16BITS(&pdh->pIDcnt);
minsize = idcnt * 4;
if (len < minsize) {
ND_PRINT((ndo, "\t\t\ttruncated IDs expected %uB got %uB\n", minsize,
char *ib = indent_pr(indent, 0);
ND_TCHECK(*pdtlv);
- type = EXTRACT_16BITS(&pdtlv->type);
- tll = EXTRACT_16BITS(&pdtlv->length) - TLV_HDRL;
+ type = EXTRACT_BE_16BITS(&pdtlv->type);
+ tll = EXTRACT_BE_16BITS(&pdtlv->length) - TLV_HDRL;
invtlv = tlv_valid(pdtlv, len);
ND_PRINT((ndo, "genoptlvprint - %s TLV type 0x%x len %d\n",
- tok2str(ForCES_TLV, NULL, type), type, EXTRACT_16BITS(&pdtlv->length)));
+ tok2str(ForCES_TLV, NULL, type), type, EXTRACT_BE_16BITS(&pdtlv->length)));
if (!invtlv) {
/*
* At this point, tlv_valid() has ensured that the TLV
if (!ttlv_valid(type)) {
ND_PRINT((ndo, "%s TLV type 0x%x len %d\n",
tok2str(ForCES_TLV_err, NULL, invtlv), type,
- EXTRACT_16BITS(&pdtlv->length)));
+ EXTRACT_BE_16BITS(&pdtlv->length)));
return -1;
}
if (ndo->ndo_vflag >= 3)
ND_PRINT((ndo, "%s%s, length %d (data length %d Bytes)",
ib, tok2str(ForCES_TLV, NULL, type),
- EXTRACT_16BITS(&pdtlv->length), tll));
+ EXTRACT_BE_16BITS(&pdtlv->length), tll));
return pdata_print(ndo, dp, tll, op_msk, indent + 1);
} else {
* go past the end of the containing TLV).
*/
ib = indent_pr(indent, 0);
- type = EXTRACT_16BITS(&pdtlv->type);
+ type = EXTRACT_BE_16BITS(&pdtlv->type);
dp = (const u_char *) TLV_DATA(pdtlv);
- tll = EXTRACT_16BITS(&pdtlv->length) - TLV_HDRL;
+ tll = EXTRACT_BE_16BITS(&pdtlv->length) - TLV_HDRL;
if (ndo->ndo_vflag >= 3)
ND_PRINT((ndo, "%s%s, length %d (data encapsulated %d Bytes)",
ib, tok2str(ForCES_TLV, NULL, type),
- EXTRACT_16BITS(&pdtlv->length),
- EXTRACT_16BITS(&pdtlv->length) - TLV_HDRL));
+ EXTRACT_BE_16BITS(&pdtlv->length),
+ EXTRACT_BE_16BITS(&pdtlv->length) - TLV_HDRL));
if (pdata_print(ndo, dp, tll, op_msk, indent + 1) == -1)
return -1;
if (len) {
ND_PRINT((ndo,
"\n\t\tMessy PATHDATA TLV header, type (0x%x)\n\t\texcess of %d Bytes ",
- EXTRACT_16BITS(&pdtlv->type), len - EXTRACT_16BITS(&pdtlv->length)));
+ EXTRACT_BE_16BITS(&pdtlv->type), len - EXTRACT_BE_16BITS(&pdtlv->length)));
return -1;
}
* >= TLV_HDRL.
*/
ND_TCHECK(*otlv);
- type = EXTRACT_16BITS(&otlv->type);
- tll = EXTRACT_16BITS(&otlv->length) - TLV_HDRL;
+ type = EXTRACT_BE_16BITS(&otlv->type);
+ tll = EXTRACT_BE_16BITS(&otlv->length) - TLV_HDRL;
ops = get_forces_optlv_h(type);
if (ndo->ndo_vflag >= 3) {
ND_PRINT((ndo, "%sOper TLV %s(0x%x) length %d\n", ib, ops->s, type,
- EXTRACT_16BITS(&otlv->length)));
+ EXTRACT_BE_16BITS(&otlv->length)));
}
/* rest of ops must at least have 12B {pathinfo} */
if (tll < OP_MIN_SIZ) {
ND_PRINT((ndo, "\t\tOper TLV %s(0x%x) length %d\n", ops->s, type,
- EXTRACT_16BITS(&otlv->length)));
+ EXTRACT_BE_16BITS(&otlv->length)));
ND_PRINT((ndo, "\t\tTruncated data size %d minimum required %d\n", tll,
OP_MIN_SIZ));
return invoptlv_print(ndo, dp, tll, ops->op_msk, indent);
return -1;
}
ND_TCHECK2(*pptr, 4);
- rescode = EXTRACT_32BITS(pptr);
+ rescode = EXTRACT_BE_32BITS(pptr);
if (rescode > ASTMCD) {
ND_PRINT((ndo, "illegal ASTresult result code: %d!\n", rescode));
return -1;
return -1;
}
ND_TCHECK2(*pptr, 4);
- rescode = EXTRACT_32BITS(pptr);
+ rescode = EXTRACT_BE_32BITS(pptr);
if (rescode > ASRMCD) {
ND_PRINT((ndo, "illegal ASRresult result code: %d!\n", rescode));
* print_metatlv() has ensured that len (what remains in the
* ILV) >= ILV_HDRL.
*/
- rlen = EXTRACT_32BITS(&ilv->length) - ILV_HDRL;
+ rlen = EXTRACT_BE_32BITS(&ilv->length) - ILV_HDRL;
ND_TCHECK(*ilv);
- ND_PRINT((ndo, "%sMetaID 0x%x length %d\n", ib, EXTRACT_32BITS(&ilv->type),
- EXTRACT_32BITS(&ilv->length)));
+ ND_PRINT((ndo, "%sMetaID 0x%x length %d\n", ib, EXTRACT_BE_32BITS(&ilv->type),
+ EXTRACT_BE_32BITS(&ilv->length)));
if (ndo->ndo_vflag >= 3) {
hex_print_with_offset(ndo, "\t\t[", ILV_DATA(ilv), rlen, 0);
ND_PRINT((ndo, " ]\n"));
* length is large enough but not too large (it doesn't
* go past the end of the containing TLV).
*/
- if (EXTRACT_16BITS(&tlv->type) == F_TLV_METD) {
+ if (EXTRACT_BE_16BITS(&tlv->type) == F_TLV_METD) {
print_metatlv(ndo, (const u_char *) TLV_DATA(tlv),
- EXTRACT_16BITS(&tlv->length), 0, indent);
- } else if ((EXTRACT_16BITS(&tlv->type) == F_TLV_REDD)) {
+ EXTRACT_BE_16BITS(&tlv->length), 0,
+ indent);
+ } else if ((EXTRACT_BE_16BITS(&tlv->type) == F_TLV_REDD)) {
print_reddata(ndo, (const u_char *) TLV_DATA(tlv),
- EXTRACT_16BITS(&tlv->length), 0, indent);
+ EXTRACT_BE_16BITS(&tlv->length), 0,
+ indent);
} else {
ND_PRINT((ndo, "Unknown REDIRECT TLV 0x%x len %d\n",
- EXTRACT_16BITS(&tlv->type),
- EXTRACT_16BITS(&tlv->length)));
+ EXTRACT_BE_16BITS(&tlv->type),
+ EXTRACT_BE_16BITS(&tlv->length)));
}
tlv = GO_NXT_TLV(tlv, rlen);
if (rlen) {
ND_PRINT((ndo,
"\n\t\tMessy Redirect TLV header, type (0x%x)\n\t\texcess of %d Bytes ",
- EXTRACT_16BITS(&tlv->type),
- rlen - EXTRACT_16BITS(&tlv->length)));
+ EXTRACT_BE_16BITS(&tlv->type),
+ rlen - EXTRACT_BE_16BITS(&tlv->length)));
return -1;
}
ND_TCHECK(*lfbs);
if (ndo->ndo_vflag >= 3) {
ND_PRINT((ndo, "\n%s%s(Classid %x) instance %x\n",
- ib, tok2str(ForCES_LFBs, NULL, EXTRACT_32BITS(&lfbs->class)),
- EXTRACT_32BITS(&lfbs->class),
- EXTRACT_32BITS(&lfbs->instance)));
+ ib, tok2str(ForCES_LFBs, NULL, EXTRACT_BE_32BITS(&lfbs->class)),
+ EXTRACT_BE_32BITS(&lfbs->class),
+ EXTRACT_BE_32BITS(&lfbs->instance)));
}
otlv = (const struct forces_tlv *)(lfbs + 1);
* length is large enough but not too large (it doesn't
* go past the end of the containing TLV).
*/
- if (op_valid(EXTRACT_16BITS(&otlv->type), op_msk)) {
+ if (op_valid(EXTRACT_BE_16BITS(&otlv->type), op_msk)) {
otlv_print(ndo, otlv, 0, indent);
} else {
if (ndo->ndo_vflag < 3)
ND_PRINT((ndo, "\n"));
ND_PRINT((ndo,
"\t\tINValid oper-TLV type 0x%x length %d for this ForCES message\n",
- EXTRACT_16BITS(&otlv->type), EXTRACT_16BITS(&otlv->length)));
+ EXTRACT_BE_16BITS(&otlv->type), EXTRACT_BE_16BITS(&otlv->length)));
invoptlv_print(ndo, (const u_char *)otlv, rlen, 0, indent);
}
otlv = GO_NXT_TLV(otlv, rlen);
if (rlen) {
ND_PRINT((ndo,
"\n\t\tMessy oper TLV header, type (0x%x)\n\t\texcess of %d Bytes ",
- EXTRACT_16BITS(&otlv->type), rlen - EXTRACT_16BITS(&otlv->length)));
+ EXTRACT_BE_16BITS(&otlv->type), rlen - EXTRACT_BE_16BITS(&otlv->length)));
return -1;
}
* length is large enough but not too large (it doesn't
* go past the end of the packet).
*/
- if (!ttlv_valid(EXTRACT_16BITS(&tltlv->type))) {
+ if (!ttlv_valid(EXTRACT_BE_16BITS(&tltlv->type))) {
ND_PRINT((ndo, "\n\tInvalid ForCES Top TLV type=0x%x",
- EXTRACT_16BITS(&tltlv->type)));
+ EXTRACT_BE_16BITS(&tltlv->type)));
return -1;
}
if (ndo->ndo_vflag >= 3)
ND_PRINT((ndo, "\t%s, length %d (data length %d Bytes)",
- tok2str(ForCES_TLV, NULL, EXTRACT_16BITS(&tltlv->type)),
- EXTRACT_16BITS(&tltlv->length),
- EXTRACT_16BITS(&tltlv->length) - TLV_HDRL));
+ tok2str(ForCES_TLV, NULL, EXTRACT_BE_16BITS(&tltlv->type)),
+ EXTRACT_BE_16BITS(&tltlv->length),
+ EXTRACT_BE_16BITS(&tltlv->length) - TLV_HDRL));
rc = tops->print(ndo, (const u_char *) TLV_DATA(tltlv),
- EXTRACT_16BITS(&tltlv->length), tops->op_msk, 9);
+ EXTRACT_BE_16BITS(&tltlv->length),
+ tops->op_msk, 9);
if (rc < 0) {
return -1;
}
*/
if (rlen) {
ND_PRINT((ndo, "\tMess TopTLV header: min %u, total %d advertised %d ",
- TLV_HDRL, rlen, EXTRACT_16BITS(&tltlv->length)));
+ TLV_HDRL, rlen, EXTRACT_BE_16BITS(&tltlv->length)));
return -1;
}
}
ND_TCHECK2(*(pptr + 20), 4);
- flg_raw = EXTRACT_32BITS(pptr + 20);
+ flg_raw = EXTRACT_BE_32BITS(pptr + 20);
if (ndo->ndo_vflag >= 1) {
ND_PRINT((ndo, "\n\tForCES Version %d len %uB flags 0x%08x ",
ForCES_V(fhdr), mlen, flg_raw));
"\n\tSrcID 0x%x(%s) DstID 0x%x(%s) Correlator 0x%" PRIx64,
ForCES_SID(fhdr), ForCES_node(ForCES_SID(fhdr)),
ForCES_DID(fhdr), ForCES_node(ForCES_DID(fhdr)),
- EXTRACT_64BITS(fhdr->fm_cor)));
+ EXTRACT_BE_64BITS(fhdr->fm_cor)));
}
if (ndo->ndo_vflag >= 2) {
ND_PRINT((ndo, "Q.922, hdr-len %u, DLCI %u, Flags [%s], NLPID %s (0x%02x), length %u: ",
addr_len,
dlci,
- bittok2str(fr_header_flag_values, "none", EXTRACT_32BITS(flags)),
+ bittok2str(fr_header_flag_values, "none", EXTRACT_BE_32BITS(flags)),
tok2str(nlpid_values,"unknown", nlpid),
nlpid,
length));
ND_PRINT((ndo, "Q.922, hdr-len %u, DLCI %u, Flags [%s], cisco-ethertype %s (0x%04x), length %u: ",
addr_len,
dlci,
- bittok2str(fr_header_flag_values, "none", EXTRACT_32BITS(flags)),
+ bittok2str(fr_header_flag_values, "none", EXTRACT_BE_32BITS(flags)),
tok2str(ethertype_values, "unknown", nlpid),
nlpid,
length));
/* no Ethertype */
ND_PRINT((ndo, "UI %02x! ", p[addr_len]));
} else {
- extracted_ethertype = EXTRACT_16BITS(p+addr_len);
+ extracted_ethertype = EXTRACT_BE_16BITS(p + addr_len);
if (ndo->ndo_eflag)
fr_hdr_print(ndo, length, addr_len, dlci,
switch (ie_type) {
case MFR_CTRL_IE_MAGIC_NUM:
- ND_PRINT((ndo, "0x%08x", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "0x%08x", EXTRACT_BE_32BITS(tptr)));
break;
case MFR_CTRL_IE_BUNDLE_ID: /* same message format */
if (ndo->ndo_vflag) {
ND_PRINT((ndo, "frag (0x%08x:%d|%ld)",
- EXTRACT_32BITS(&dp->ip6f_ident),
- EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,
- sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen) -
- (long)(bp - bp2) - sizeof(struct ip6_frag)));
+ EXTRACT_BE_32BITS(&dp->ip6f_ident),
+ EXTRACT_BE_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,
+ sizeof(struct ip6_hdr) + EXTRACT_BE_16BITS(&ip6->ip6_plen) -
+ (long)(bp - bp2) - sizeof(struct ip6_frag)));
} else {
ND_PRINT((ndo, "frag (%d|%ld)",
- EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,
- sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen) -
- (long)(bp - bp2) - sizeof(struct ip6_frag)));
+ EXTRACT_BE_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,
+ sizeof(struct ip6_hdr) + EXTRACT_BE_16BITS(&ip6->ip6_plen) -
+ (long)(bp - bp2) - sizeof(struct ip6_frag)));
}
/* it is meaningless to decode non-first fragment */
- if ((EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK) != 0)
+ if ((EXTRACT_BE_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK) != 0)
return -1;
else
{
ND_PRINT((ndo, "%s", sep));
sep = ", ";
- opt_class = EXTRACT_16BITS(bp);
+ opt_class = EXTRACT_BE_16BITS(bp);
opt_type = *(bp + 2);
opt_len = 4 + ((*(bp + 3) & OPT_LEN_MASK) * 4);
ND_PRINT((ndo, " data"));
for (i = 4; i < opt_len; i += 4) {
- ND_PRINT((ndo, " %08x", EXTRACT_32BITS(data)));
+ ND_PRINT((ndo, " %08x", EXTRACT_BE_32BITS(data)));
data++;
}
}
bp += 1;
len -= 1;
- prot = EXTRACT_16BITS(bp);
+ prot = EXTRACT_BE_16BITS(bp);
bp += 2;
len -= 2;
- vni = EXTRACT_24BITS(bp);
+ vni = EXTRACT_BE_24BITS(bp);
bp += 3;
len -= 3;
print_btp(netdissect_options *ndo,
const u_char *bp)
{
- uint16_t dest = EXTRACT_16BITS(bp+0);
- uint16_t src = EXTRACT_16BITS(bp+2);
+ uint16_t dest = EXTRACT_BE_16BITS(bp + 0);
+ uint16_t src = EXTRACT_BE_16BITS(bp + 2);
ND_PRINT((ndo, "; BTP Dst:%u Src:%u", dest, src));
}
if (!ND_TTEST2(*(bp+12), 8))
return (-1);
- lat = EXTRACT_32BITS(bp+12);
+ lat = EXTRACT_BE_32BITS(bp + 12);
ND_PRINT((ndo, "lat:%d ", lat));
- lon = EXTRACT_32BITS(bp+16);
+ lon = EXTRACT_BE_32BITS(bp + 16);
ND_PRINT((ndo, "lon:%d", lon));
return (0);
}
next_hdr = bp[0] & 0x0f;
hdr_type = bp[1] >> 4;
hdr_subtype = bp[1] & 0x0f;
- payload_length = EXTRACT_16BITS(bp+4);
+ payload_length = EXTRACT_BE_16BITS(bp + 4);
hop_limit = bp[7];
switch (next_hdr) {
ND_TCHECK2(*bp, 2);
if (len < 2)
goto trunc;
- vers = EXTRACT_16BITS(bp) & GRE_VERS_MASK;
+ vers = EXTRACT_BE_16BITS(bp) & GRE_VERS_MASK;
ND_PRINT((ndo, "GREv%u",vers));
switch(vers) {
uint16_t flags, prot;
/* 16 bits ND_TCHECKed in gre_print() */
- flags = EXTRACT_16BITS(bp);
+ flags = EXTRACT_BE_16BITS(bp);
if (ndo->ndo_vflag)
ND_PRINT((ndo, ", Flags [%s]",
bittok2str(gre_flag_values,"none",flags)));
ND_TCHECK2(*bp, 2);
if (len < 2)
goto trunc;
- prot = EXTRACT_16BITS(bp);
+ prot = EXTRACT_BE_16BITS(bp);
len -= 2;
bp += 2;
if (len < 2)
goto trunc;
if (ndo->ndo_vflag)
- ND_PRINT((ndo, ", sum 0x%x", EXTRACT_16BITS(bp)));
+ ND_PRINT((ndo, ", sum 0x%x", EXTRACT_BE_16BITS(bp)));
bp += 2;
len -= 2;
ND_TCHECK2(*bp, 2);
if (len < 2)
goto trunc;
- ND_PRINT((ndo, ", off 0x%x", EXTRACT_16BITS(bp)));
+ ND_PRINT((ndo, ", off 0x%x", EXTRACT_BE_16BITS(bp)));
bp += 2;
len -= 2;
}
ND_TCHECK2(*bp, 4);
if (len < 4)
goto trunc;
- ND_PRINT((ndo, ", key=0x%x", EXTRACT_32BITS(bp)));
+ ND_PRINT((ndo, ", key=0x%x", EXTRACT_BE_32BITS(bp)));
bp += 4;
len -= 4;
}
ND_TCHECK2(*bp, 4);
if (len < 4)
goto trunc;
- ND_PRINT((ndo, ", seq %u", EXTRACT_32BITS(bp)));
+ ND_PRINT((ndo, ", seq %u", EXTRACT_BE_32BITS(bp)));
bp += 4;
len -= 4;
}
ND_TCHECK2(*bp, 4);
if (len < 4)
goto trunc;
- af = EXTRACT_16BITS(bp);
+ af = EXTRACT_BE_16BITS(bp);
sreoff = *(bp + 2);
srelen = *(bp + 3);
bp += 4;
uint16_t flags, prot;
/* 16 bits ND_TCHECKed in gre_print() */
- flags = EXTRACT_16BITS(bp);
+ flags = EXTRACT_BE_16BITS(bp);
len -= 2;
bp += 2;
ND_TCHECK2(*bp, 2);
if (len < 2)
goto trunc;
- prot = EXTRACT_16BITS(bp);
+ prot = EXTRACT_BE_16BITS(bp);
len -= 2;
bp += 2;
ND_TCHECK2(*bp, 4);
if (len < 4)
goto trunc;
- k = EXTRACT_32BITS(bp);
+ k = EXTRACT_BE_32BITS(bp);
ND_PRINT((ndo, ", call %d", k & 0xffff));
len -= 4;
bp += 4;
ND_TCHECK2(*bp, 4);
if (len < 4)
goto trunc;
- ND_PRINT((ndo, ", seq %u", EXTRACT_32BITS(bp)));
+ ND_PRINT((ndo, ", seq %u", EXTRACT_BE_32BITS(bp)));
bp += 4;
len -= 4;
}
ND_TCHECK2(*bp, 4);
if (len < 4)
goto trunc;
- ND_PRINT((ndo, ", ack %u", EXTRACT_32BITS(bp)));
+ ND_PRINT((ndo, ", ack %u", EXTRACT_BE_32BITS(bp)));
bp += 4;
len -= 4;
}
ND_PRINT((ndo, " %s%x",
((bp - up) == sreoff) ? "*" : "",
- EXTRACT_16BITS(bp)));
+ EXTRACT_BE_16BITS(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_64BITS(data),
- EXTRACT_64BITS(data + 8),
- EXTRACT_64BITS(data + 16),
- EXTRACT_64BITS(data + 24)
+ EXTRACT_BE_64BITS(data),
+ EXTRACT_BE_64BITS(data + 8),
+ EXTRACT_BE_64BITS(data + 16),
+ EXTRACT_BE_64BITS(data + 24)
);
return buf[i];
}
if (i + 4 > length)
return -1;
tlv = cp + i;
- type = EXTRACT_16BITS(tlv);
- optlen = EXTRACT_16BITS(tlv + 2);
+ type = EXTRACT_BE_16BITS(tlv);
+ optlen = EXTRACT_BE_16BITS(tlv + 2);
value = tlv + 4;
ND_PRINT((ndo, "\n"));
if (i + 4 > length)
goto invalid;
- type = EXTRACT_16BITS(tlv);
- bodylen = EXTRACT_16BITS(tlv + 2);
+ type = EXTRACT_BE_16BITS(tlv);
+ bodylen = EXTRACT_BE_16BITS(tlv + 2);
value = tlv + 4;
ND_TCHECK2(*value, bodylen);
if (i + bodylen + 4 > length)
break;
}
node_identifier = format_nid(value);
- endpoint_identifier = EXTRACT_32BITS(value + 4);
+ endpoint_identifier = EXTRACT_BE_32BITS(value + 4);
ND_PRINT((ndo, " NID: %s EPID: %08x",
node_identifier,
endpoint_identifier
ND_PRINT((ndo, " %s", istr));
break;
}
- hash = EXTRACT_64BITS(value);
+ hash = EXTRACT_BE_64BITS(value);
ND_PRINT((ndo, " hash: %016" PRIx64, hash));
}
break;
break;
}
node_identifier = format_nid(value);
- sequence_number = EXTRACT_32BITS(value + 4);
- interval = format_interval(EXTRACT_32BITS(value + 8));
- hash = EXTRACT_64BITS(value + 12);
+ sequence_number = EXTRACT_BE_32BITS(value + 4);
+ interval = format_interval(EXTRACT_BE_32BITS(value + 8));
+ hash = EXTRACT_BE_64BITS(value + 12);
ND_PRINT((ndo, " NID: %s seqno: %u %s hash: %016" PRIx64,
node_identifier,
sequence_number,
break;
}
peer_node_identifier = format_nid(value);
- peer_endpoint_identifier = EXTRACT_32BITS(value + 4);
- endpoint_identifier = EXTRACT_32BITS(value + 8);
+ peer_endpoint_identifier = EXTRACT_BE_32BITS(value + 4);
+ endpoint_identifier = EXTRACT_BE_32BITS(value + 8);
ND_PRINT((ndo, " Peer-NID: %s Peer-EPID: %08x Local-EPID: %08x",
peer_node_identifier,
peer_endpoint_identifier,
ND_PRINT((ndo, " %s", istr));
break;
}
- endpoint_identifier = EXTRACT_32BITS(value);
- interval = format_interval(EXTRACT_32BITS(value + 4));
+ endpoint_identifier = EXTRACT_BE_32BITS(value);
+ interval = format_interval(EXTRACT_BE_32BITS(value + 4));
ND_PRINT((ndo, " EPID: %08x Interval: %s",
endpoint_identifier,
interval
ND_PRINT((ndo, " %s", istr));
break;
}
- capabilities = EXTRACT_16BITS(value + 2);
+ capabilities = EXTRACT_BE_16BITS(value + 2);
M = (uint8_t)((capabilities >> 12) & 0xf);
P = (uint8_t)((capabilities >> 8) & 0xf);
H = (uint8_t)((capabilities >> 4) & 0xf);
break;
}
ND_PRINT((ndo, " VLSO: %s PLSO: %s Prefix: ",
- format_interval(EXTRACT_32BITS(value)),
- format_interval(EXTRACT_32BITS(value + 4))
+ format_interval(EXTRACT_BE_32BITS(value)),
+ format_interval(EXTRACT_BE_32BITS(value + 4))
));
l = print_prefix(ndo, value + 8, bodylen - 8);
if (l == -1) {
}
prty = value[4] & 0xf;
ND_PRINT((ndo, " EPID: %08x Prty: %u",
- EXTRACT_32BITS(value),
+ EXTRACT_BE_32BITS(value),
prty
));
ND_PRINT((ndo, " Prefix: "));
ND_PRINT((ndo, " %s", istr));
break;
}
- endpoint_identifier = EXTRACT_32BITS(value);
+ endpoint_identifier = EXTRACT_BE_32BITS(value);
ip_address = format_ip6addr(ndo, value + 4);
ND_PRINT((ndo, " EPID: %08x IP Address: %s",
endpoint_identifier,
(void)snprintf(buf, sizeof(buf), "echo %s, id %u, seq %u",
dp->icmp_type == ICMP_ECHO ?
"request" : "reply",
- EXTRACT_16BITS(&dp->icmp_id),
- EXTRACT_16BITS(&dp->icmp_seq));
+ EXTRACT_BE_16BITS(&dp->icmp_id),
+ EXTRACT_BE_16BITS(&dp->icmp_seq));
break;
case ICMP_UNREACH:
hlen = IP_HL(oip) * 4;
ouh = (const struct udphdr *)(((const u_char *)oip) + hlen);
ND_TCHECK(ouh->uh_dport);
- dport = EXTRACT_16BITS(&ouh->uh_dport);
+ dport = EXTRACT_BE_16BITS(&ouh->uh_dport);
switch (oip->ip_p) {
case IPPROTO_TCP:
{
register const struct mtu_discovery *mp;
mp = (const struct mtu_discovery *)(const u_char *)&dp->icmp_void;
- mtu = EXTRACT_16BITS(&mp->nexthopmtu);
+ mtu = EXTRACT_BE_16BITS(&mp->nexthopmtu);
if (mtu) {
(void)snprintf(buf, sizeof(buf),
"%s unreachable - need to frag (mtu %d)",
ND_TCHECK(*ihp);
(void)strncpy(cp, " lifetime ", sizeof(buf) - (cp - buf));
cp = buf + strlen(buf);
- lifetime = EXTRACT_16BITS(&ihp->ird_lifetime);
+ lifetime = EXTRACT_BE_16BITS(&ihp->ird_lifetime);
if (lifetime < 60) {
(void)snprintf(cp, sizeof(buf) - (cp - buf), "%u",
lifetime);
ND_TCHECK(*idp);
(void)snprintf(cp, sizeof(buf) - (cp - buf), " {%s %u}",
ipaddr_string(ndo, &idp->ird_addr),
- EXTRACT_32BITS(&idp->ird_pref));
+ EXTRACT_BE_32BITS(&idp->ird_pref));
cp = buf + strlen(buf);
++idp;
}
case ICMP_MASKREPLY:
ND_TCHECK(dp->icmp_mask);
(void)snprintf(buf, sizeof(buf), "address mask is 0x%08x",
- EXTRACT_32BITS(&dp->icmp_mask));
+ EXTRACT_BE_32BITS(&dp->icmp_mask));
break;
case ICMP_TSTAMP:
ND_TCHECK(dp->icmp_seq);
(void)snprintf(buf, sizeof(buf),
"time stamp query id %u seq %u",
- EXTRACT_16BITS(&dp->icmp_id),
- EXTRACT_16BITS(&dp->icmp_seq));
+ EXTRACT_BE_16BITS(&dp->icmp_id),
+ EXTRACT_BE_16BITS(&dp->icmp_seq));
break;
case ICMP_TSTAMPREPLY:
ND_TCHECK(dp->icmp_ttime);
(void)snprintf(buf, sizeof(buf),
"time stamp reply id %u seq %u: org %s",
- EXTRACT_16BITS(&dp->icmp_id),
- EXTRACT_16BITS(&dp->icmp_seq),
- icmp_tstamp_print(EXTRACT_32BITS(&dp->icmp_otime)));
+ EXTRACT_BE_16BITS(&dp->icmp_id),
+ EXTRACT_BE_16BITS(&dp->icmp_seq),
+ icmp_tstamp_print(EXTRACT_BE_32BITS(&dp->icmp_otime)));
(void)snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", recv %s",
- icmp_tstamp_print(EXTRACT_32BITS(&dp->icmp_rtime)));
+ icmp_tstamp_print(EXTRACT_BE_32BITS(&dp->icmp_rtime)));
(void)snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", xmit %s",
- icmp_tstamp_print(EXTRACT_32BITS(&dp->icmp_ttime)));
+ icmp_tstamp_print(EXTRACT_BE_32BITS(&dp->icmp_ttime)));
break;
default:
vec[0].len = plen;
sum = in_cksum(vec, 1);
if (sum != 0) {
- uint16_t icmp_sum = EXTRACT_16BITS(&dp->icmp_cksum);
+ uint16_t icmp_sum = EXTRACT_BE_16BITS(&dp->icmp_cksum);
ND_PRINT((ndo, " (wrong icmp cksum %x (->%x)!)",
icmp_sum,
in_cksum_shouldbe(icmp_sum, sum)));
ip = (const struct ip *)bp;
snapend_save = ndo->ndo_snapend;
ND_TCHECK_16BITS(&ip->ip_len);
- ip_print(ndo, bp, EXTRACT_16BITS(&ip->ip_len));
+ ip_print(ndo, bp, EXTRACT_BE_16BITS(&ip->ip_len));
ndo->ndo_snapend = snapend_save;
}
vec[0].ptr = (const uint8_t *)(const void *)&ext_dp->icmp_ext_version_res;
vec[0].len = hlen;
ND_PRINT((ndo, ", checksum 0x%04x (%scorrect), length %u",
- EXTRACT_16BITS(ext_dp->icmp_ext_checksum),
+ EXTRACT_BE_16BITS(ext_dp->icmp_ext_checksum),
in_cksum(vec, 1) ? "in" : "",
hlen));
}
icmp_mpls_ext_object_header = (const struct icmp_mpls_ext_object_header_t *)obj_tptr;
ND_TCHECK(*icmp_mpls_ext_object_header);
- obj_tlen = EXTRACT_16BITS(icmp_mpls_ext_object_header->length);
+ obj_tlen = EXTRACT_BE_16BITS(icmp_mpls_ext_object_header->length);
obj_class_num = icmp_mpls_ext_object_header->class_num;
obj_ctype = icmp_mpls_ext_object_header->ctype;
obj_tptr += sizeof(struct icmp_mpls_ext_object_header_t);
switch(obj_ctype) {
case 1:
ND_TCHECK2(*obj_tptr, 4);
- raw_label = EXTRACT_32BITS(obj_tptr);
+ raw_label = EXTRACT_BE_32BITS(obj_tptr);
ND_PRINT((ndo, "\n\t label %u, exp %u", MPLS_LABEL(raw_label), MPLS_EXP(raw_label)));
if (MPLS_STACK(raw_label))
ND_PRINT((ndo, ", [S]"));
dagid_str,
dio->rpl_dtsn,
dio->rpl_instanceid,
- EXTRACT_16BITS(&dio->rpl_dagrank),
+ EXTRACT_BE_16BITS(&dio->rpl_dagrank),
RPL_DIO_GROUNDED(dio->rpl_mopprf) ? "grounded,":"",
tok2str(rpl_mop_values, "mop%u", RPL_DIO_MOP(dio->rpl_mopprf)),
RPL_DIO_PRF(dio->rpl_mopprf)));
uint16_t sum, udp_sum;
if (ND_TTEST2(bp[0], length)) {
- udp_sum = EXTRACT_16BITS(&dp->icmp6_cksum);
+ udp_sum = EXTRACT_BE_16BITS(&dp->icmp6_cksum);
sum = icmp6_cksum(ndo, ip, dp, length);
if (sum != 0)
ND_PRINT((ndo,"[bad icmp6 cksum 0x%04x -> 0x%04x!] ",
== NULL)
goto trunc;
- dport = EXTRACT_16BITS(&ouh->uh_dport);
+ dport = EXTRACT_BE_16BITS(&ouh->uh_dport);
switch (prot) {
case IPPROTO_TCP:
ND_PRINT((ndo,", %s tcp port %s",
break;
case ICMP6_PACKET_TOO_BIG:
ND_TCHECK(dp->icmp6_mtu);
- ND_PRINT((ndo,", mtu %u", EXTRACT_32BITS(&dp->icmp6_mtu)));
+ ND_PRINT((ndo,", mtu %u", EXTRACT_BE_32BITS(&dp->icmp6_mtu)));
break;
case ICMP6_TIME_EXCEEDED:
ND_TCHECK(oip->ip6_dst);
ND_TCHECK(oip->ip6_dst);
switch (dp->icmp6_code) {
case ICMP6_PARAMPROB_HEADER:
- ND_PRINT((ndo,", erroneous - octet %u", EXTRACT_32BITS(&dp->icmp6_pptr)));
+ ND_PRINT((ndo,", erroneous - octet %u", EXTRACT_BE_32BITS(&dp->icmp6_pptr)));
break;
case ICMP6_PARAMPROB_NEXTHEADER:
- ND_PRINT((ndo,", next header - octet %u", EXTRACT_32BITS(&dp->icmp6_pptr)));
+ ND_PRINT((ndo,", next header - octet %u", EXTRACT_BE_32BITS(&dp->icmp6_pptr)));
break;
case ICMP6_PARAMPROB_OPTION:
- ND_PRINT((ndo,", option - octet %u", EXTRACT_32BITS(&dp->icmp6_pptr)));
+ ND_PRINT((ndo,", option - octet %u", EXTRACT_BE_32BITS(&dp->icmp6_pptr)));
break;
default:
ND_PRINT((ndo,", code-#%d",
case ICMP6_ECHO_REQUEST:
case ICMP6_ECHO_REPLY:
ND_TCHECK(dp->icmp6_seq);
- ND_PRINT((ndo,", seq %u", EXTRACT_16BITS(&dp->icmp6_seq)));
+ ND_PRINT((ndo,", seq %u", EXTRACT_BE_16BITS(&dp->icmp6_seq)));
break;
case ICMP6_MEMBERSHIP_QUERY:
if (length == MLD_MINLEN) {
(u_int)p->nd_ra_curhoplimit,
bittok2str(icmp6_opt_ra_flag_values,"none",(p->nd_ra_flags_reserved)),
get_rtpref(p->nd_ra_flags_reserved),
- EXTRACT_16BITS(&p->nd_ra_router_lifetime),
- EXTRACT_32BITS(&p->nd_ra_reachable),
- EXTRACT_32BITS(&p->nd_ra_retransmit)));
+ EXTRACT_BE_16BITS(&p->nd_ra_router_lifetime),
+ EXTRACT_BE_32BITS(&p->nd_ra_reachable),
+ EXTRACT_BE_32BITS(&p->nd_ra_retransmit)));
icmp6_opt_print(ndo, (const u_char *)dp + RTADVLEN,
length - RTADVLEN);
ND_PRINT((ndo,", Flags [%s]",
bittok2str(icmp6_nd_na_flag_values,
"none",
- EXTRACT_32BITS(&p->nd_na_flags_reserved))));
+ EXTRACT_BE_32BITS(&p->nd_na_flags_reserved))));
#define NDADVLEN 24
icmp6_opt_print(ndo, (const u_char *)dp + NDADVLEN,
length - NDADVLEN);
case ICMP6_MOBILEPREFIX_SOLICIT: /* fall through */
case ICMP6_HADISCOV_REQUEST:
ND_TCHECK(dp->icmp6_data16[0]);
- ND_PRINT((ndo,", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0])));
+ ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_16BITS(&dp->icmp6_data16[0])));
break;
case ICMP6_HADISCOV_REPLY:
if (ndo->ndo_vflag) {
const u_char *cp;
ND_TCHECK(dp->icmp6_data16[0]);
- ND_PRINT((ndo,", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0])));
+ ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_16BITS(&dp->icmp6_data16[0])));
cp = (const u_char *)dp + length;
in6 = (const struct in6_addr *)(dp + 1);
for (; (const u_char *)in6 < cp; in6++) {
case ICMP6_MOBILEPREFIX_ADVERT:
if (ndo->ndo_vflag) {
ND_TCHECK(dp->icmp6_data16[0]);
- ND_PRINT((ndo,", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0])));
+ ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_16BITS(&dp->icmp6_data16[0])));
ND_TCHECK(dp->icmp6_data16[1]);
if (dp->icmp6_data16[1] & 0xc0)
ND_PRINT((ndo," "));
if (!ND_TTEST(fragh->ip6f_offlg))
return(NULL);
/* fragments with non-zero offset are meaningless */
- if ((EXTRACT_16BITS(&fragh->ip6f_offlg) & IP6F_OFF_MASK) != 0)
+ if ((EXTRACT_BE_16BITS(&fragh->ip6f_offlg) & IP6F_OFF_MASK) != 0)
return(NULL);
nh = fragh->ip6f_nxt;
hlen = sizeof(struct ip6_frag);
opp->nd_opt_pi_prefix_len,
(op->nd_opt_len != 4) ? "badlen" : "",
bittok2str(icmp6_opt_pi_flag_values, "none", opp->nd_opt_pi_flags_reserved),
- get_lifetime(EXTRACT_32BITS(&opp->nd_opt_pi_valid_time))));
- ND_PRINT((ndo,", pref. time %s", get_lifetime(EXTRACT_32BITS(&opp->nd_opt_pi_preferred_time))));
+ get_lifetime(EXTRACT_BE_32BITS(&opp->nd_opt_pi_valid_time))));
+ ND_PRINT((ndo,", pref. time %s", get_lifetime(EXTRACT_BE_32BITS(&opp->nd_opt_pi_preferred_time))));
break;
case ND_OPT_REDIRECTED_HEADER:
print_unknown_data(ndo, bp,"\n\t ",op->nd_opt_len<<3);
opm = (const struct nd_opt_mtu *)op;
ND_TCHECK(opm->nd_opt_mtu_mtu);
ND_PRINT((ndo," %u%s",
- EXTRACT_32BITS(&opm->nd_opt_mtu_mtu),
- (op->nd_opt_len != 1) ? "bad option length" : "" ));
+ EXTRACT_BE_32BITS(&opm->nd_opt_mtu_mtu),
+ (op->nd_opt_len != 1) ? "bad option length" : "" ));
break;
case ND_OPT_RDNSS:
oprd = (const struct nd_opt_rdnss *)op;
l = (op->nd_opt_len - 1) / 2;
ND_PRINT((ndo," lifetime %us,",
- EXTRACT_32BITS(&oprd->nd_opt_rdnss_lifetime)));
+ EXTRACT_BE_32BITS(&oprd->nd_opt_rdnss_lifetime)));
for (i = 0; i < l; i++) {
ND_TCHECK(oprd->nd_opt_rdnss_addr[i]);
ND_PRINT((ndo," addr: %s",
case ND_OPT_DNSSL:
opds = (const struct nd_opt_dnssl *)op;
ND_PRINT((ndo," lifetime %us, domain(s):",
- EXTRACT_32BITS(&opds->nd_opt_dnssl_lifetime)));
+ EXTRACT_BE_32BITS(&opds->nd_opt_dnssl_lifetime)));
domp = cp + 8; /* domain names, variable-sized, RFC1035-encoded */
while (domp < cp + (op->nd_opt_len << 3) && *domp != '\0')
{
case ND_OPT_ADVINTERVAL:
opa = (const struct nd_opt_advinterval *)op;
ND_TCHECK(opa->nd_opt_adv_interval);
- ND_PRINT((ndo," %ums", EXTRACT_32BITS(&opa->nd_opt_adv_interval)));
+ ND_PRINT((ndo," %ums", EXTRACT_BE_32BITS(&opa->nd_opt_adv_interval)));
break;
case ND_OPT_HOMEAGENT_INFO:
oph = (const struct nd_opt_homeagent_info *)op;
ND_TCHECK(oph->nd_opt_hai_lifetime);
ND_PRINT((ndo," preference %u, lifetime %u",
- EXTRACT_16BITS(&oph->nd_opt_hai_preference),
- EXTRACT_16BITS(&oph->nd_opt_hai_lifetime)));
+ EXTRACT_BE_16BITS(&oph->nd_opt_hai_preference),
+ EXTRACT_BE_16BITS(&oph->nd_opt_hai_lifetime)));
break;
case ND_OPT_ROUTE_INFO:
opri = (const struct nd_opt_route_info *)op;
opri->nd_opt_rti_prefixlen));
ND_PRINT((ndo,", pref=%s", get_rtpref(opri->nd_opt_rti_flags)));
ND_PRINT((ndo,", lifetime=%s",
- get_lifetime(EXTRACT_32BITS(&opri->nd_opt_rti_lifetime))));
+ get_lifetime(EXTRACT_BE_32BITS(&opri->nd_opt_rti_lifetime))));
break;
default:
if (ndo->ndo_vflag <= 1) {
if ((const u_char *)mp + sizeof(*mp) > ep)
return;
- ND_PRINT((ndo,"max resp delay: %d ", EXTRACT_16BITS(&mp->mld6_maxdelay)));
+ ND_PRINT((ndo,"max resp delay: %d ", EXTRACT_BE_16BITS(&mp->mld6_maxdelay)));
ND_PRINT((ndo,"addr: %s", ip6addr_string(ndo, &mp->mld6_addr)));
}
}
ND_TCHECK(icp->icmp6_data16[1]);
- ngroups = EXTRACT_16BITS(&icp->icmp6_data16[1]);
+ ngroups = EXTRACT_BE_16BITS(&icp->icmp6_data16[1]);
ND_PRINT((ndo,", %d group record(s)", ngroups));
if (ndo->ndo_vflag > 0) {
/* Print the group records */
return;
}
ND_TCHECK(icp->icmp6_data16[0]);
- mrc = EXTRACT_16BITS(&icp->icmp6_data16[0]);
+ mrc = EXTRACT_BE_16BITS(&icp->icmp6_data16[0]);
if (mrc < 32768) {
mrt = mrc;
} else {
}
ND_TCHECK2(bp[26], 2);
- nsrcs = EXTRACT_16BITS(&bp[26]);
+ nsrcs = EXTRACT_BE_16BITS(&bp[26]);
if (nsrcs > 0) {
if (len < 28 + nsrcs * sizeof(struct in6_addr))
ND_PRINT((ndo," [invalid number of sources]"));
ND_TCHECK2(*dp, sizeof(*ni6));
ni6 = (const struct icmp6_nodeinfo *)dp;
ND_PRINT((ndo," (")); /*)*/
- switch (EXTRACT_16BITS(&ni6->ni_qtype)) {
+ switch (EXTRACT_BE_16BITS(&ni6->ni_qtype)) {
case NI_QTYPE_NOOP:
ND_PRINT((ndo,"noop"));
break;
case NI_QTYPE_SUPTYPES:
ND_PRINT((ndo,"supported qtypes"));
- i = EXTRACT_16BITS(&ni6->ni_flags);
+ i = EXTRACT_BE_16BITS(&ni6->ni_flags);
if (i)
ND_PRINT((ndo," [%s]", (i & 0x01) ? "C" : ""));
break;
break;
}
- switch (EXTRACT_16BITS(&ni6->ni_qtype)) {
+ switch (EXTRACT_BE_16BITS(&ni6->ni_qtype)) {
case NI_QTYPE_NOOP:
if (needcomma)
ND_PRINT((ndo,", "));
if (needcomma)
ND_PRINT((ndo,", "));
ND_PRINT((ndo,"supported qtypes"));
- i = EXTRACT_16BITS(&ni6->ni_flags);
+ i = EXTRACT_BE_16BITS(&ni6->ni_flags);
if (i)
ND_PRINT((ndo," [%s]", (i & 0x01) ? "C" : ""));
break;
ND_PRINT((ndo,"\""));
} else
dnsname_print(ndo, cp, ep);
- if ((EXTRACT_16BITS(&ni6->ni_flags) & 0x01) != 0)
- ND_PRINT((ndo," [TTL=%u]", EXTRACT_32BITS(ni6 + 1)));
+ if ((EXTRACT_BE_16BITS(&ni6->ni_flags) & 0x01) != 0)
+ ND_PRINT((ndo," [TTL=%u]", EXTRACT_BE_32BITS(ni6 + 1)));
break;
case NI_QTYPE_NODEADDR:
if (needcomma)
break;
ND_PRINT((ndo," %s", ip6addr_string(ndo, bp + i)));
i += sizeof(struct in6_addr);
- ND_PRINT((ndo,"(%d)", (int32_t)EXTRACT_32BITS(bp + i)));
+ ND_PRINT((ndo,"(%d)", (int32_t) EXTRACT_BE_32BITS(bp + i)));
i += sizeof(int32_t);
}
i = ni6->ni_flags;
break;
}
- ND_PRINT((ndo,", seq=%u", EXTRACT_32BITS(&rr6->rr_seqnum)));
+ ND_PRINT((ndo,", seq=%u", EXTRACT_BE_32BITS(&rr6->rr_seqnum)));
if (ndo->ndo_vflag) {
#define F(x, y) ((rr6->rr_flags) & (x) ? (y) : "")
F(ICMP6_RR_FLAGS_PREVDONE, "P")));
}
ND_PRINT((ndo,"seg=%u,", rr6->rr_segnum));
- ND_PRINT((ndo,"maxdelay=%u", EXTRACT_16BITS(&rr6->rr_maxdelay)));
+ ND_PRINT((ndo,"maxdelay=%u", EXTRACT_BE_16BITS(&rr6->rr_maxdelay)));
if (rr6->rr_reserved)
- ND_PRINT((ndo,"rsvd=0x%x", EXTRACT_32BITS(&rr6->rr_reserved)));
+ ND_PRINT((ndo,"rsvd=0x%x", EXTRACT_BE_32BITS(&rr6->rr_reserved)));
/*[*/
ND_PRINT((ndo,"]"));
#undef F
ND_PRINT((ndo,"vltime=infty,"));
else
ND_PRINT((ndo,"vltime=%u,",
- EXTRACT_32BITS(&use->rpu_vltime)));
+ EXTRACT_BE_32BITS(&use->rpu_vltime)));
if (~use->rpu_pltime == 0)
ND_PRINT((ndo,"pltime=infty,"));
else
ND_PRINT((ndo,"pltime=%u,",
- EXTRACT_32BITS(&use->rpu_pltime)));
+ EXTRACT_BE_32BITS(&use->rpu_pltime)));
}
if (addrtostr6(&use->rpu_prefix, hbuf, sizeof(hbuf)))
ND_PRINT((ndo,"%s/%u/%u", hbuf, use->rpu_uselen,
return;
}
ND_PRINT((ndo, "mtrace %u: %s to %s reply-to %s",
- TR_GETQID(EXTRACT_32BITS(&tr->tr_rttlqid)),
+ TR_GETQID(EXTRACT_BE_32BITS(&tr->tr_rttlqid)),
ipaddr_string(ndo, &tr->tr_src), ipaddr_string(ndo, &tr->tr_dst),
ipaddr_string(ndo, &tr->tr_raddr)));
- if (IN_CLASSD(EXTRACT_32BITS(&tr->tr_raddr)))
- ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_32BITS(&tr->tr_rttlqid))));
+ if (IN_CLASSD(EXTRACT_BE_32BITS(&tr->tr_raddr)))
+ ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_BE_32BITS(&tr->tr_rttlqid))));
return;
trunc:
ND_PRINT((ndo, "%s", tstr));
return;
}
ND_PRINT((ndo, "mresp %lu: %s to %s reply-to %s",
- (u_long)TR_GETQID(EXTRACT_32BITS(&tr->tr_rttlqid)),
+ (u_long)TR_GETQID(EXTRACT_BE_32BITS(&tr->tr_rttlqid)),
ipaddr_string(ndo, &tr->tr_src), ipaddr_string(ndo, &tr->tr_dst),
ipaddr_string(ndo, &tr->tr_raddr)));
- if (IN_CLASSD(EXTRACT_32BITS(&tr->tr_raddr)))
- ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_32BITS(&tr->tr_rttlqid))));
+ if (IN_CLASSD(EXTRACT_BE_32BITS(&tr->tr_raddr)))
+ ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_BE_32BITS(&tr->tr_rttlqid))));
return;
trunc:
ND_PRINT((ndo, "%s", tstr));
return;
}
ND_TCHECK2(bp[6], 2);
- ngroups = EXTRACT_16BITS(&bp[6]);
+ ngroups = EXTRACT_BE_16BITS(&bp[6]);
ND_PRINT((ndo, ", %d group record(s)", ngroups));
if (ndo->ndo_vflag > 0) {
/* Print the group records */
ND_PRINT((ndo, " [gaddr %s", ipaddr_string(ndo, &bp[group+4])));
ND_PRINT((ndo, " %s", tok2str(igmpv3report2str, " [v3-report-#%d]",
bp[group])));
- nsrcs = EXTRACT_16BITS(&bp[group+2]);
+ nsrcs = EXTRACT_BE_16BITS(&bp[group + 2]);
/* Check the number of sources and print them */
if (len < group+8+(nsrcs<<2)) {
ND_PRINT((ndo, " [invalid number of sources %d]", nsrcs));
ND_PRINT((ndo, "]"));
}
ND_TCHECK2(bp[4], 4);
- if (EXTRACT_32BITS(&bp[4]) == 0)
+ if (EXTRACT_BE_32BITS(&bp[4]) == 0)
return;
ND_PRINT((ndo, " [gaddr %s", ipaddr_string(ndo, &bp[4])));
ND_TCHECK2(bp[10], 2);
- nsrcs = EXTRACT_16BITS(&bp[10]);
+ nsrcs = EXTRACT_BE_16BITS(&bp[10]);
if (nsrcs > 0) {
if (len < 12 + (nsrcs << 2))
ND_PRINT((ndo, " [invalid number of sources]"));
} else
ND_PRINT((ndo, " v1"));
ND_TCHECK2(bp[4], 4);
- if (EXTRACT_32BITS(&bp[4]))
+ if (EXTRACT_BE_32BITS(&bp[4]))
ND_PRINT((ndo, " [gaddr %s]", ipaddr_string(ndo, &bp[4])));
if (len != 8)
ND_PRINT((ndo, " [len %d]", len));
vec[0].ptr = bp;
vec[0].len = len;
if (in_cksum(vec, 1))
- ND_PRINT((ndo, " bad igmp cksum %x!", EXTRACT_16BITS(&bp[2])));
+ ND_PRINT((ndo, " bad igmp cksum %x!", EXTRACT_BE_16BITS(&bp[2])));
}
return;
trunc:
ND_PRINT((ndo, " %d.%d.%d.0", igr->igr_net[0],
igr->igr_net[1], igr->igr_net[2]));
- delay = EXTRACT_24BITS(igr->igr_dly);
- bandwidth = EXTRACT_24BITS(igr->igr_bw);
+ delay = EXTRACT_BE_24BITS(igr->igr_dly);
+ bandwidth = EXTRACT_BE_24BITS(igr->igr_bw);
metric = bandwidth + delay;
if (metric > 0xffffff)
metric = 0xffffff;
- mtu = EXTRACT_16BITS(igr->igr_mtu);
+ mtu = EXTRACT_BE_16BITS(igr->igr_mtu);
ND_PRINT((ndo, " d=%d b=%d r=%d l=%d M=%d mtu=%d in %d hops",
10 * delay, bandwidth == 0 ? 0 : 10000000 / bandwidth,
/* Header */
ND_TCHECK(*hdr);
- nint = EXTRACT_16BITS(&hdr->ig_ni);
- nsys = EXTRACT_16BITS(&hdr->ig_ns);
- next = EXTRACT_16BITS(&hdr->ig_nx);
+ nint = EXTRACT_BE_16BITS(&hdr->ig_ni);
+ nsys = EXTRACT_BE_16BITS(&hdr->ig_ns);
+ next = EXTRACT_BE_16BITS(&hdr->ig_nx);
ND_PRINT((ndo, " %s V%d edit=%d AS=%d (%d/%d/%d)",
tok2str(op2str, "op-#%d", IGRP_OP(hdr->ig_vop)),
IGRP_V(hdr->ig_vop),
hdr->ig_ed,
- EXTRACT_16BITS(&hdr->ig_as),
+ EXTRACT_BE_16BITS(&hdr->ig_as),
nint,
nsys,
next));
if (ptr == len)
type = " ^ ";
ND_TCHECK2(cp[len], hoplen);
- ND_PRINT((ndo, "%s%d@%s", type, EXTRACT_32BITS(&cp[len+hoplen-4]),
- hoplen!=8 ? "" : ipaddr_string(ndo, &cp[len])));
+ ND_PRINT((ndo, "%s%d@%s", type, EXTRACT_BE_32BITS(&cp[len + hoplen - 4]),
+ hoplen!=8 ? "" : ipaddr_string(ndo, &cp[len])));
type = " ";
}
break;
}
ND_TCHECK(cp[3]);
- if (EXTRACT_16BITS(&cp[2]) != 0)
- ND_PRINT((ndo, " value %u", EXTRACT_16BITS(&cp[2])));
+ if (EXTRACT_BE_16BITS(&cp[2]) != 0)
+ ND_PRINT((ndo, " value %u", EXTRACT_BE_16BITS(&cp[2])));
break;
case IPOPT_NOP: /* nothing to print - fall through */
return;
}
- ipds->len = EXTRACT_16BITS(&ipds->ip->ip_len);
+ ipds->len = EXTRACT_BE_16BITS(&ipds->ip->ip_len);
if (length < ipds->len)
ND_PRINT((ndo, "truncated-ip - %u bytes missing! ",
ipds->len - length));
ipds->len -= hlen;
- ipds->off = EXTRACT_16BITS(&ipds->ip->ip_off);
+ ipds->off = EXTRACT_BE_16BITS(&ipds->ip->ip_off);
if (ndo->ndo_vflag) {
ND_PRINT((ndo, "(tos 0x%x", (int)ipds->ip->ip_tos));
*/
ND_PRINT((ndo, ", id %u, offset %u, flags [%s], proto %s (%u)",
- EXTRACT_16BITS(&ipds->ip->ip_id),
+ EXTRACT_BE_16BITS(&ipds->ip->ip_id),
(ipds->off & 0x1fff) * 8,
bittok2str(ip_frag_values, "none", ipds->off&0xe000),
tok2str(ipproto_values,"unknown",ipds->ip->ip_p),
ipds->ip->ip_p));
- ND_PRINT((ndo, ", length %u", EXTRACT_16BITS(&ipds->ip->ip_len)));
+ ND_PRINT((ndo, ", length %u", EXTRACT_BE_16BITS(&ipds->ip->ip_len)));
if ((hlen - sizeof(struct ip)) > 0) {
ND_PRINT((ndo, ", options ("));
vec[0].len = hlen;
sum = in_cksum(vec, 1);
if (sum != 0) {
- ip_sum = EXTRACT_16BITS(&ipds->ip->ip_sum);
+ ip_sum = EXTRACT_BE_16BITS(&ipds->ip->ip_sum);
ND_PRINT((ndo, ", bad cksum %x (->%x)!", ip_sum,
in_cksum_shouldbe(ip_sum, sum)));
}
return;
}
- payload_len = EXTRACT_16BITS(&ip6->ip6_plen);
+ payload_len = EXTRACT_BE_16BITS(&ip6->ip6_plen);
len = payload_len + sizeof(struct ip6_hdr);
if (length < len)
ND_PRINT((ndo, "truncated-ip6 - %u bytes missing!",
len - length));
if (ndo->ndo_vflag) {
- flow = EXTRACT_32BITS(&ip6->ip6_flow);
+ flow = EXTRACT_BE_32BITS(&ip6->ip6_flow);
ND_PRINT((ndo, "("));
#if 0
/* rfc1883 */
ND_PRINT((ndo, "(rtalert: invalid len %d)", bp[i + 1]));
goto trunc;
}
- ND_PRINT((ndo, "(rtalert: 0x%04x) ", EXTRACT_16BITS(&bp[i + 2])));
+ ND_PRINT((ndo, "(rtalert: 0x%04x) ", EXTRACT_BE_16BITS(&bp[i + 2])));
break;
case IP6OPT_JUMBO:
if (len - i < IP6OPT_JUMBO_LEN) {
ND_PRINT((ndo, "(jumbo: invalid len %d)", bp[i + 1]));
goto trunc;
}
- ND_PRINT((ndo, "(jumbo: %u) ", EXTRACT_32BITS(&bp[i + 2])));
+ ND_PRINT((ndo, "(jumbo: %u) ", EXTRACT_BE_32BITS(&bp[i + 2])));
break;
case IP6OPT_HOME_ADDRESS:
if (len - i < IP6OPT_HOMEADDR_MINLEN) {
ipcomp = (const struct ipcomp *)bp;
ND_TCHECK(*ipcomp);
- cpi = EXTRACT_16BITS(&ipcomp->comp_cpi);
+ cpi = EXTRACT_BE_16BITS(&ipcomp->comp_cpi);
ND_PRINT((ndo, "IPComp(cpi=0x%04x)", cpi));
ND_TCHECK(ipx->srcSkt);
ND_PRINT((ndo, "%s.%04x > ",
- ipxaddr_string(EXTRACT_32BITS(ipx->srcNet), ipx->srcNode),
- EXTRACT_16BITS(&ipx->srcSkt)));
+ ipxaddr_string(EXTRACT_BE_32BITS(ipx->srcNet), ipx->srcNode),
+ EXTRACT_BE_16BITS(&ipx->srcSkt)));
ND_PRINT((ndo, "%s.%04x: ",
- ipxaddr_string(EXTRACT_32BITS(ipx->dstNet), ipx->dstNode),
- EXTRACT_16BITS(&ipx->dstSkt)));
+ ipxaddr_string(EXTRACT_BE_32BITS(ipx->dstNet), ipx->dstNode),
+ EXTRACT_BE_16BITS(&ipx->dstSkt)));
/* take length from ipx header */
ND_TCHECK(ipx->length);
- length = EXTRACT_16BITS(&ipx->length);
+ length = EXTRACT_BE_16BITS(&ipx->length);
ipx_decode(ndo, ipx, p + ipxSize, length - ipxSize);
return;
{
register u_short dstSkt;
- dstSkt = EXTRACT_16BITS(&ipx->dstSkt);
+ dstSkt = EXTRACT_BE_16BITS(&ipx->dstSkt);
switch (dstSkt) {
case IPX_SKT_NCP:
ND_PRINT((ndo, "ipx-ncp %d", length));
int command, i;
ND_TCHECK(ipx[0]);
- command = EXTRACT_16BITS(ipx);
+ command = EXTRACT_BE_16BITS(ipx);
ipx++;
length -= 2;
ND_PRINT((ndo, "ipx-sap-nearest-req"));
ND_TCHECK(ipx[0]);
- ND_PRINT((ndo, " %s", ipxsap_string(ndo, htons(EXTRACT_16BITS(&ipx[0])))));
+ ND_PRINT((ndo, " %s", ipxsap_string(ndo, htons(EXTRACT_BE_16BITS(&ipx[0])))));
break;
case 2:
for (i = 0; i < 8 && length > 0; i++) {
ND_TCHECK(ipx[0]);
- ND_PRINT((ndo, " %s '", ipxsap_string(ndo, htons(EXTRACT_16BITS(&ipx[0])))));
+ ND_PRINT((ndo, " %s '", ipxsap_string(ndo, htons(EXTRACT_BE_16BITS(&ipx[0])))));
if (fn_printzp(ndo, (const u_char *)&ipx[1], 48, ndo->ndo_snapend)) {
ND_PRINT((ndo, "'"));
goto trunc;
}
ND_TCHECK2(ipx[25], 10);
ND_PRINT((ndo, "' addr %s",
- ipxaddr_string(EXTRACT_32BITS(&ipx[25]), (const u_char *)&ipx[27])));
+ ipxaddr_string(EXTRACT_BE_32BITS(&ipx[25]), (const u_char *)&ipx[27])));
ipx += 32;
length -= 64;
}
int command, i;
ND_TCHECK(ipx[0]);
- command = EXTRACT_16BITS(ipx);
+ command = EXTRACT_BE_16BITS(ipx);
ipx++;
length -= 2;
ND_PRINT((ndo, "ipx-rip-req"));
if (length > 0) {
ND_TCHECK(ipx[3]);
- ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_32BITS(&ipx[0]),
- EXTRACT_16BITS(&ipx[2]), EXTRACT_16BITS(&ipx[3])));
+ ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_32BITS(&ipx[0]),
+ EXTRACT_BE_16BITS(&ipx[2]), EXTRACT_BE_16BITS(&ipx[3])));
}
break;
case 2:
ND_PRINT((ndo, "ipx-rip-resp"));
for (i = 0; i < 50 && length > 0; i++) {
ND_TCHECK(ipx[3]);
- ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_32BITS(&ipx[0]),
- EXTRACT_16BITS(&ipx[2]), EXTRACT_16BITS(&ipx[3])));
+ ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_32BITS(&ipx[0]),
+ EXTRACT_BE_16BITS(&ipx[2]), EXTRACT_BE_16BITS(&ipx[3])));
ipx += 4;
length -= 8;
totlen = 4;
else {
ND_TCHECK_16BITS(&p[2]);
- totlen = 4 + EXTRACT_16BITS(&p[2]);
+ totlen = 4 + EXTRACT_BE_16BITS(&p[2]);
}
if (ep2 < p + totlen) {
ND_PRINT((ndo,"[|attr]"));
ND_TCHECK_16BITS(&p[0]);
ND_PRINT((ndo,"("));
- t = EXTRACT_16BITS(&p[0]) & 0x7fff;
+ t = EXTRACT_BE_16BITS(&p[0]) & 0x7fff;
if (map && t < nmap && map[t].type)
ND_PRINT((ndo,"type=%s ", map[t].type));
else
if (p[0] & 0x80) {
ND_PRINT((ndo,"value="));
ND_TCHECK_16BITS(&p[2]);
- v = EXTRACT_16BITS(&p[2]);
+ v = EXTRACT_BE_16BITS(&p[2]);
if (map && t < nmap && v < map[t].nvalue && map[t].value[v])
ND_PRINT((ndo,"%s", map[t].value[v]));
else {
totlen = 4;
else {
ND_TCHECK_16BITS(&p[2]);
- totlen = 4 + EXTRACT_16BITS(&p[2]);
+ totlen = 4 + EXTRACT_BE_16BITS(&p[2]);
}
if (ep2 < p + totlen) {
ND_PRINT((ndo,"[|attr]"));
ND_TCHECK_16BITS(&p[0]);
ND_PRINT((ndo,"("));
- t = EXTRACT_16BITS(&p[0]) & 0x7fff;
+ t = EXTRACT_BE_16BITS(&p[0]) & 0x7fff;
ND_PRINT((ndo,"type=#%d ", t));
if (p[0] & 0x80) {
ND_PRINT((ndo,"value="));
case IPSECDOI_NTYPE_REPLAY_STATUS:
ND_PRINT((ndo," status=("));
ND_PRINT((ndo,"replay detection %sabled",
- EXTRACT_32BITS(cp) ? "en" : "dis"));
+ EXTRACT_BE_32BITS(cp) ? "en" : "dis"));
ND_PRINT((ndo,")"));
break;
default:
p = (const struct isakmp *)bp;
ep = ndo->ndo_snapend;
- phase = (EXTRACT_32BITS(base->msgid) == 0) ? 1 : 2;
+ phase = (EXTRACT_BE_32BITS(base->msgid) == 0) ? 1 : 2;
if (phase == 1)
ND_PRINT((ndo," phase %d", phase));
else
p = (const struct isakmp *)bp;
ep = ndo->ndo_snapend;
- phase = (EXTRACT_32BITS(base->msgid) == 0) ? 1 : 2;
+ phase = (EXTRACT_BE_32BITS(base->msgid) == 0) ? 1 : 2;
if (phase == 1)
ND_PRINT((ndo, " parent_sa"));
else
clnp_header->version,
clnp_header->lifetime/2,
(clnp_header->lifetime%2)*5,
- EXTRACT_16BITS(clnp_header->segment_length),
- EXTRACT_16BITS(clnp_header->cksum)));
+ EXTRACT_BE_16BITS(clnp_header->segment_length),
+ EXTRACT_BE_16BITS(clnp_header->cksum)));
- osi_print_cksum(ndo, optr, EXTRACT_16BITS(clnp_header->cksum), 7,
+ osi_print_cksum(ndo, optr, EXTRACT_BE_16BITS(clnp_header->cksum), 7,
clnp_header->length_indicator);
ND_PRINT((ndo, "\n\tFlags [%s]",
clnp_segment_header = (const struct clnp_segment_header_t *) pptr;
ND_TCHECK(*clnp_segment_header);
ND_PRINT((ndo, "\n\tData Unit ID: 0x%04x, Segment Offset: %u, Total PDU Length: %u",
- EXTRACT_16BITS(clnp_segment_header->data_unit_id),
- EXTRACT_16BITS(clnp_segment_header->segment_offset),
- EXTRACT_16BITS(clnp_segment_header->total_length)));
+ EXTRACT_BE_16BITS(clnp_segment_header->data_unit_id),
+ EXTRACT_BE_16BITS(clnp_segment_header->segment_offset),
+ EXTRACT_BE_16BITS(clnp_segment_header->total_length)));
pptr+=sizeof(struct clnp_segment_header_t);
li-=sizeof(struct clnp_segment_header_t);
}
esis_pdu_type));
ND_PRINT((ndo, ", v: %u%s", esis_header->version, esis_header->version == ESIS_VERSION ? "" : "unsupported" ));
- ND_PRINT((ndo, ", checksum: 0x%04x", EXTRACT_16BITS(esis_header->cksum)));
+ ND_PRINT((ndo, ", checksum: 0x%04x", EXTRACT_BE_16BITS(esis_header->cksum)));
- osi_print_cksum(ndo, pptr, EXTRACT_16BITS(esis_header->cksum), 7, li);
+ osi_print_cksum(ndo, pptr, EXTRACT_BE_16BITS(esis_header->cksum), 7,
+ li);
ND_PRINT((ndo, ", holding time: %us, length indicator: %u",
- EXTRACT_16BITS(esis_header->holdtime), li));
+ EXTRACT_BE_16BITS(esis_header->holdtime), li));
if (ndo->ndo_vflag > 1)
print_unknown_data(ndo, optr, "\n\t", sizeof(struct esis_header_t));
case ESIS_OPTION_ES_CONF_TIME:
if (opli == 2) {
ND_TCHECK2(*pptr, 2);
- ND_PRINT((ndo, "%us", EXTRACT_16BITS(tptr)));
+ ND_PRINT((ndo, "%us", EXTRACT_BE_16BITS(tptr)));
} else
ND_PRINT((ndo, "(bad length)"));
break;
if (fn_printzp(ndo, mcid->name, 32, ndo->ndo_snapend))
goto trunc;
- ND_PRINT((ndo, "\n\t Lvl: %d", EXTRACT_16BITS(mcid->revision_lvl)));
+ ND_PRINT((ndo, "\n\t Lvl: %d", EXTRACT_BE_16BITS(mcid->revision_lvl)));
ND_PRINT((ndo, ", Digest: "));
for(i=1;i<=8; i++)
{
- ND_PRINT((ndo, "%08x ", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "%08x ", EXTRACT_BE_32BITS(tptr)));
if (i%4 == 0 && i != 8)
ND_PRINT((ndo, "\n\t "));
tptr = tptr + 4;
while (stlv_len >= ISIS_SUBTLV_SPB_BVID_MIN_LEN)
{
ND_PRINT((ndo, "\n\t ECT: %08x",
- EXTRACT_32BITS(tptr)));
+ EXTRACT_BE_32BITS(tptr)));
tptr = tptr+4;
ND_PRINT((ndo, " BVID: %d, U:%01x M:%01x ",
- (EXTRACT_16BITS (tptr) >> 4) ,
- (EXTRACT_16BITS (tptr) >> 3) & 0x01,
- (EXTRACT_16BITS (tptr) >> 2) & 0x01));
+ (EXTRACT_BE_16BITS(tptr) >> 4) ,
+ (EXTRACT_BE_16BITS(tptr) >> 3) & 0x01,
+ (EXTRACT_BE_16BITS(tptr) >> 2) & 0x01));
tptr = tptr + 2;
len = len - ISIS_SUBTLV_SPB_BVID_MIN_LEN;
if (stlv_len < ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN)
goto trunc;
- ND_PRINT((ndo, "\n\t CIST Root-ID: %08x", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t CIST Root-ID: %08x", EXTRACT_BE_32BITS(tptr)));
tptr = tptr+4;
- ND_PRINT((ndo, " %08x", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, " %08x", EXTRACT_BE_32BITS(tptr)));
tptr = tptr+4;
- ND_PRINT((ndo, ", Path Cost: %08x", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, ", Path Cost: %08x", EXTRACT_BE_32BITS(tptr)));
tptr = tptr+4;
- ND_PRINT((ndo, ", Prio: %d", EXTRACT_16BITS(tptr)));
+ ND_PRINT((ndo, ", Prio: %d", EXTRACT_BE_16BITS(tptr)));
tptr = tptr + 2;
ND_PRINT((ndo, "\n\t RES: %d",
- EXTRACT_16BITS(tptr) >> 5));
+ EXTRACT_BE_16BITS(tptr) >> 5));
ND_PRINT((ndo, ", V: %d",
- (EXTRACT_16BITS(tptr) >> 4) & 0x0001));
+ (EXTRACT_BE_16BITS(tptr) >> 4) & 0x0001));
ND_PRINT((ndo, ", SPSource-ID: %d",
- (EXTRACT_32BITS(tptr) & 0x000fffff)));
+ (EXTRACT_BE_32BITS(tptr) & 0x000fffff)));
tptr = tptr+4;
ND_PRINT((ndo, ", No of Trees: %x", *(tptr)));
tptr++;
- ND_PRINT((ndo, ", ECT: %08x", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, ", ECT: %08x", EXTRACT_BE_32BITS(tptr)));
tptr = tptr + 4;
ND_PRINT((ndo, ", BVID: %d, SPVID: %d",
- (EXTRACT_24BITS(tptr) >> 12) & 0x000fff,
- EXTRACT_24BITS(tptr) & 0x000fff));
+ (EXTRACT_BE_24BITS(tptr) >> 12) & 0x000fff,
+ EXTRACT_BE_24BITS(tptr) & 0x000fff));
tptr = tptr + 3;
len = len - ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN;
if (stlv_len < 8)
goto trunc;
- ND_PRINT((ndo, "\n\t BMAC: %08x", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t BMAC: %08x", EXTRACT_BE_32BITS(tptr)));
tptr = tptr+4;
- ND_PRINT((ndo, "%04x", EXTRACT_16BITS(tptr)));
+ ND_PRINT((ndo, "%04x", EXTRACT_BE_16BITS(tptr)));
tptr = tptr+2;
- ND_PRINT((ndo, ", RES: %d, VID: %d", EXTRACT_16BITS(tptr) >> 12,
- (EXTRACT_16BITS(tptr)) & 0x0fff));
+ ND_PRINT((ndo, ", RES: %d, VID: %d", EXTRACT_BE_16BITS(tptr) >> 12,
+ (EXTRACT_BE_16BITS(tptr)) & 0x0fff));
tptr = tptr+2;
len = len - 8;
while (stlv_len >= 4) {
ND_TCHECK2(*tptr, 4);
ND_PRINT((ndo, "\n\t T: %d, R: %d, RES: %d, ISID: %d",
- (EXTRACT_32BITS(tptr) >> 31),
- (EXTRACT_32BITS(tptr) >> 30) & 0x01,
- (EXTRACT_32BITS(tptr) >> 24) & 0x03f,
- (EXTRACT_32BITS(tptr)) & 0x0ffffff));
+ (EXTRACT_BE_32BITS(tptr) >> 31),
+ (EXTRACT_BE_32BITS(tptr) >> 30) & 0x01,
+ (EXTRACT_BE_32BITS(tptr) >> 24) & 0x03f,
+ (EXTRACT_BE_32BITS(tptr)) & 0x0ffffff));
tptr = tptr + 4;
len = len - 4;
if (!ND_TTEST(*tlv_ip_reach))
return (0);
- prefix_len = mask2plen(EXTRACT_32BITS(tlv_ip_reach->mask));
+ prefix_len = mask2plen(EXTRACT_BE_32BITS(tlv_ip_reach->mask));
if (prefix_len == -1)
ND_PRINT((ndo, "%sIPv4 prefix: %s mask %s",
case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32:
while (subl >= 4) {
ND_PRINT((ndo, ", 0x%08x (=%u)",
- EXTRACT_32BITS(tptr),
- EXTRACT_32BITS(tptr)));
+ EXTRACT_BE_32BITS(tptr),
+ EXTRACT_BE_32BITS(tptr)));
tptr+=4;
subl-=4;
}
case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64:
while (subl >= 8) {
ND_PRINT((ndo, ", 0x%08x%08x",
- EXTRACT_32BITS(tptr),
- EXTRACT_32BITS(tptr+4)));
+ EXTRACT_BE_32BITS(tptr),
+ EXTRACT_BE_32BITS(tptr + 4)));
tptr+=8;
subl-=8;
}
case ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID:
case ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID:
if (subl >= 4) {
- ND_PRINT((ndo, ", 0x%08x", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_32BITS(tptr)));
if (subl == 8) /* rfc4205 */
- ND_PRINT((ndo, ", 0x%08x", EXTRACT_32BITS(tptr+4)));
+ ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_32BITS(tptr + 4)));
}
break;
case ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR:
case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW :
case ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW:
if (subl >= 4) {
- bw.i = EXTRACT_32BITS(tptr);
+ bw.i = EXTRACT_BE_32BITS(tptr);
ND_PRINT((ndo, ", %.3f Mbps", bw.f * 8 / 1000000));
}
break;
case ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW :
if (subl >= 32) {
for (te_class = 0; te_class < 8; te_class++) {
- bw.i = EXTRACT_32BITS(tptr);
+ bw.i = EXTRACT_BE_32BITS(tptr);
ND_PRINT((ndo, "%s TE-Class %u: %.3f Mbps",
ident,
te_class,
tptr++;
/* decode BCs until the subTLV ends */
for (te_class = 0; te_class < (subl-1)/4; te_class++) {
- bw.i = EXTRACT_32BITS(tptr);
+ bw.i = EXTRACT_BE_32BITS(tptr);
ND_PRINT((ndo, "%s Bandwidth constraint CT%u: %.3f Mbps",
ident,
te_class,
break;
case ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC:
if (subl >= 3)
- ND_PRINT((ndo, ", %u", EXTRACT_24BITS(tptr)));
+ ND_PRINT((ndo, ", %u", EXTRACT_BE_24BITS(tptr)));
break;
case ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE:
if (subl == 2) {
ND_PRINT((ndo, ", [ %s ] (0x%04x)",
bittok2str(isis_subtlv_link_attribute_values,
"Unknown",
- EXTRACT_16BITS(tptr)),
- EXTRACT_16BITS(tptr)));
+ EXTRACT_BE_16BITS(tptr)),
+ EXTRACT_BE_16BITS(tptr)));
}
break;
case ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE:
break;
case ISIS_SUBTLV_SPB_METRIC:
if (subl >= 6) {
- ND_PRINT((ndo, ", LM: %u", EXTRACT_24BITS(tptr)));
+ ND_PRINT((ndo, ", LM: %u", EXTRACT_BE_24BITS(tptr)));
tptr=tptr+3;
ND_PRINT((ndo, ", P: %u", *(tptr)));
tptr++;
- ND_PRINT((ndo, ", P-ID: %u", EXTRACT_16BITS(tptr)));
+ ND_PRINT((ndo, ", P-ID: %u", EXTRACT_BE_16BITS(tptr)));
}
break;
case ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR:
tptr+=4;
ND_PRINT((ndo, "%s Max LSP Bandwidth:", ident));
for (priority_level = 0; priority_level < 8; priority_level++) {
- bw.i = EXTRACT_32BITS(tptr);
+ bw.i = EXTRACT_BE_32BITS(tptr);
ND_PRINT((ndo, "%s priority level %d: %.3f Mbps",
ident,
priority_level,
case GMPLS_PSC4:
if (subl < 6)
break;
- bw.i = EXTRACT_32BITS(tptr);
+ bw.i = EXTRACT_BE_32BITS(tptr);
ND_PRINT((ndo, "%s Min LSP Bandwidth: %.3f Mbps", ident, bw.f * 8 / 1000000));
- ND_PRINT((ndo, "%s Interface MTU: %u", ident, EXTRACT_16BITS(tptr + 4)));
+ ND_PRINT((ndo, "%s Interface MTU: %u", ident, EXTRACT_BE_16BITS(tptr + 4)));
break;
case GMPLS_TSC:
if (subl < 8)
break;
- bw.i = EXTRACT_32BITS(tptr);
+ bw.i = EXTRACT_BE_32BITS(tptr);
ND_PRINT((ndo, "%s Min LSP Bandwidth: %.3f Mbps", ident, bw.f * 8 / 1000000));
ND_PRINT((ndo, "%s Indication %s", ident,
tok2str(gmpls_switch_cap_tsc_indication_values, "Unknown (%u)", *(tptr + 4))));
if (tlv_type != ISIS_TLV_IS_ALIAS_ID) { /* the Alias TLV Metric field is implicit 0 */
if (!ND_TTEST2(*tptr, 3)) /* and is therefore skipped */
return(0);
- ND_PRINT((ndo, ", Metric: %d", EXTRACT_24BITS(tptr)));
+ ND_PRINT((ndo, ", Metric: %d", EXTRACT_BE_24BITS(tptr)));
tptr+=3;
}
ident,
tok2str(isis_mt_values,
"Reserved for IETF Consensus",
- ISIS_MASK_MTID(EXTRACT_16BITS(tptr)))));
+ ISIS_MASK_MTID(EXTRACT_BE_16BITS(tptr)))));
ND_PRINT((ndo, " Topology (0x%03x), Flags: [%s]",
- ISIS_MASK_MTID(EXTRACT_16BITS(tptr)),
- bittok2str(isis_mt_flag_values, "none",ISIS_MASK_MTFLAGS(EXTRACT_16BITS(tptr)))));
+ ISIS_MASK_MTID(EXTRACT_BE_16BITS(tptr)),
+ bittok2str(isis_mt_flag_values, "none",ISIS_MASK_MTFLAGS(EXTRACT_BE_16BITS(tptr)))));
return(2);
}
if (!ND_TTEST2(*tptr, 4))
return (0);
- metric = EXTRACT_32BITS(tptr);
+ metric = EXTRACT_BE_32BITS(tptr);
processed=4;
tptr+=4;
ND_PRINT((ndo, ", length %u", length));
return (1);
}
- pdu_len=EXTRACT_16BITS(header_iih_lan->pdu_len);
+ pdu_len=EXTRACT_BE_16BITS(header_iih_lan->pdu_len);
if (packet_len>pdu_len) {
packet_len=pdu_len; /* do TLV decoding as long as it makes sense */
length=pdu_len;
ND_PRINT((ndo, "\n\t source-id: %s, holding time: %us, Flags: [%s]",
isis_print_id(header_iih_lan->source_id,SYSTEM_ID_LEN),
- EXTRACT_16BITS(header_iih_lan->holding_time),
+ EXTRACT_BE_16BITS(header_iih_lan->holding_time),
tok2str(isis_iih_circuit_type_values,
"unknown circuit type 0x%02x",
header_iih_lan->circuit_type)));
ND_PRINT((ndo, ", length %u", length));
return (1);
}
- pdu_len=EXTRACT_16BITS(header_iih_ptp->pdu_len);
+ pdu_len=EXTRACT_BE_16BITS(header_iih_ptp->pdu_len);
if (packet_len>pdu_len) {
packet_len=pdu_len; /* do TLV decoding as long as it makes sense */
length=pdu_len;
ND_PRINT((ndo, "\n\t source-id: %s, holding time: %us, Flags: [%s]",
isis_print_id(header_iih_ptp->source_id,SYSTEM_ID_LEN),
- EXTRACT_16BITS(header_iih_ptp->holding_time),
+ EXTRACT_BE_16BITS(header_iih_ptp->holding_time),
tok2str(isis_iih_circuit_type_values,
"unknown circuit type 0x%02x",
header_iih_ptp->circuit_type)));
if (ndo->ndo_vflag == 0) {
ND_PRINT((ndo, ", lsp-id %s, seq 0x%08x, lifetime %5us",
isis_print_id(header_lsp->lsp_id, LSP_ID_LEN),
- EXTRACT_32BITS(header_lsp->sequence_number),
- EXTRACT_16BITS(header_lsp->remaining_lifetime)));
+ EXTRACT_BE_32BITS(header_lsp->sequence_number),
+ EXTRACT_BE_16BITS(header_lsp->remaining_lifetime)));
ND_PRINT((ndo, ", length %u", length));
return (1);
}
- pdu_len=EXTRACT_16BITS(header_lsp->pdu_len);
+ pdu_len=EXTRACT_BE_16BITS(header_lsp->pdu_len);
if (packet_len>pdu_len) {
packet_len=pdu_len; /* do TLV decoding as long as it makes sense */
length=pdu_len;
ND_PRINT((ndo, "\n\t lsp-id: %s, seq: 0x%08x, lifetime: %5us\n\t chksum: 0x%04x",
isis_print_id(header_lsp->lsp_id, LSP_ID_LEN),
- EXTRACT_32BITS(header_lsp->sequence_number),
- EXTRACT_16BITS(header_lsp->remaining_lifetime),
- EXTRACT_16BITS(header_lsp->checksum)));
+ EXTRACT_BE_32BITS(header_lsp->sequence_number),
+ EXTRACT_BE_16BITS(header_lsp->remaining_lifetime),
+ EXTRACT_BE_16BITS(header_lsp->checksum)));
osi_print_cksum(ndo, (const uint8_t *)header_lsp->lsp_id,
- EXTRACT_16BITS(header_lsp->checksum),
+ EXTRACT_BE_16BITS(header_lsp->checksum),
12, length-12);
ND_PRINT((ndo, ", PDU length: %u, Flags: [ %s",
ND_PRINT((ndo, ", length %u", length));
return (1);
}
- pdu_len=EXTRACT_16BITS(header_csnp->pdu_len);
+ pdu_len=EXTRACT_BE_16BITS(header_csnp->pdu_len);
if (packet_len>pdu_len) {
packet_len=pdu_len; /* do TLV decoding as long as it makes sense */
length=pdu_len;
ND_PRINT((ndo, ", length %u", length));
return (1);
}
- pdu_len=EXTRACT_16BITS(header_psnp->pdu_len);
+ pdu_len=EXTRACT_BE_16BITS(header_psnp->pdu_len);
if (packet_len>pdu_len) {
packet_len=pdu_len; /* do TLV decoding as long as it makes sense */
length=pdu_len;
break;
case ISIS_SUBTLV_AUTH_GENERIC:
ND_TCHECK2(*(tptr + 1), 2);
- key_id = EXTRACT_16BITS((tptr+1));
+ key_id = EXTRACT_BE_16BITS((tptr + 1));
ND_PRINT((ndo, "%u, password: ", key_id));
for(i=1 + sizeof(uint16_t);i<tlv_len;i++) {
ND_TCHECK2(*(tptr + i), 1);
if(tmp>sizeof(tlv_ptp_adj->extd_local_circuit_id)) {
ND_TCHECK(tlv_ptp_adj->extd_local_circuit_id);
ND_PRINT((ndo, "\n\t Extended Local circuit-ID: 0x%08x",
- EXTRACT_32BITS(tlv_ptp_adj->extd_local_circuit_id)));
+ EXTRACT_BE_32BITS(tlv_ptp_adj->extd_local_circuit_id)));
tmp-=sizeof(tlv_ptp_adj->extd_local_circuit_id);
}
if(tmp>=SYSTEM_ID_LEN) {
if(tmp>=sizeof(tlv_ptp_adj->neighbor_extd_local_circuit_id)) {
ND_TCHECK(tlv_ptp_adj->neighbor_extd_local_circuit_id);
ND_PRINT((ndo, "\n\t Neighbor Extended Local circuit-ID: 0x%08x",
- EXTRACT_32BITS(tlv_ptp_adj->neighbor_extd_local_circuit_id)));
+ EXTRACT_BE_32BITS(tlv_ptp_adj->neighbor_extd_local_circuit_id)));
}
break;
ND_TCHECK2(*(tptr), 2);
ND_PRINT((ndo, "\n\t RES: %d, MTID(s): %d",
- (EXTRACT_16BITS (tptr) >> 12),
- (EXTRACT_16BITS (tptr) & 0x0fff)));
+ (EXTRACT_BE_16BITS(tptr) >> 12),
+ (EXTRACT_BE_16BITS(tptr) & 0x0fff)));
tmp = tmp-2;
tptr = tptr+2;
ND_TCHECK2(*(tptr), 2);
ND_PRINT((ndo, "\n\t O: %d, RES: %d, MTID(s): %d",
- (EXTRACT_16BITS(tptr) >> 15) & 0x01,
- (EXTRACT_16BITS(tptr) >> 12) & 0x07,
- EXTRACT_16BITS(tptr) & 0x0fff));
+ (EXTRACT_BE_16BITS(tptr) >> 15) & 0x01,
+ (EXTRACT_BE_16BITS(tptr) >> 12) & 0x07,
+ EXTRACT_BE_16BITS(tptr) & 0x0fff));
tmp = tmp-2;
tptr = tptr+2;
while (tmp>=4) {
ND_TCHECK2(*tptr, 4);
- ND_PRINT((ndo, "\n\t Link-ID: 0x%08x", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Link-ID: 0x%08x", EXTRACT_BE_32BITS(tptr)));
tptr+=4;
tmp-=4;
}
ND_PRINT((ndo, "\n\t lsp-id: %s",
isis_print_id(tlv_lsp->lsp_id, LSP_ID_LEN)));
ND_TCHECK2(tlv_lsp->sequence_number, 4);
- ND_PRINT((ndo, ", seq: 0x%08x", EXTRACT_32BITS(tlv_lsp->sequence_number)));
+ ND_PRINT((ndo, ", seq: 0x%08x", EXTRACT_BE_32BITS(tlv_lsp->sequence_number)));
ND_TCHECK2(tlv_lsp->remaining_lifetime, 2);
- ND_PRINT((ndo, ", lifetime: %5ds", EXTRACT_16BITS(tlv_lsp->remaining_lifetime)));
+ ND_PRINT((ndo, ", lifetime: %5ds", EXTRACT_BE_16BITS(tlv_lsp->remaining_lifetime)));
ND_TCHECK2(tlv_lsp->checksum, 2);
- ND_PRINT((ndo, ", chksum: 0x%04x", EXTRACT_16BITS(tlv_lsp->checksum)));
+ ND_PRINT((ndo, ", chksum: 0x%04x", EXTRACT_BE_16BITS(tlv_lsp->checksum)));
tmp-=sizeof(struct isis_tlv_lsp);
tlv_lsp++;
}
if (tmp < ISIS_TLV_CHECKSUM_MINLEN)
break;
ND_TCHECK2(*tptr, ISIS_TLV_CHECKSUM_MINLEN);
- ND_PRINT((ndo, "\n\t checksum: 0x%04x ", EXTRACT_16BITS(tptr)));
+ ND_PRINT((ndo, "\n\t checksum: 0x%04x ", EXTRACT_BE_16BITS(tptr)));
/* do not attempt to verify the checksum if it is zero
* most likely a HMAC-MD5 TLV is also present and
* to avoid conflicts the checksum TLV is zeroed.
* see rfc3358 for details
*/
- osi_print_cksum(ndo, optr, EXTRACT_16BITS(tptr), tptr-optr,
- length);
+ osi_print_cksum(ndo, optr, EXTRACT_BE_16BITS(tptr), tptr-optr,
+ length);
break;
case ISIS_TLV_POI:
break;
ND_TCHECK2(*tptr, ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN);
- ND_PRINT((ndo, ", Remaining holding time %us", EXTRACT_16BITS(tptr)));
+ ND_PRINT((ndo, ", Remaining holding time %us", EXTRACT_BE_16BITS(tptr)));
tptr+=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN;
tmp-=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN;
switch (*tptr++) {
case ISIS_SUBTLV_IDRP_ASN:
ND_TCHECK2(*tptr, 2); /* fetch AS number */
- ND_PRINT((ndo, "AS Number: %u", EXTRACT_16BITS(tptr)));
+ ND_PRINT((ndo, "AS Number: %u", EXTRACT_BE_16BITS(tptr)));
break;
case ISIS_SUBTLV_IDRP_LOCAL:
case ISIS_SUBTLV_IDRP_RES:
if (tmp < ISIS_TLV_LSP_BUFFERSIZE_MINLEN)
break;
ND_TCHECK2(*tptr, ISIS_TLV_LSP_BUFFERSIZE_MINLEN);
- ND_PRINT((ndo, "\n\t LSP Buffersize: %u", EXTRACT_16BITS(tptr)));
+ ND_PRINT((ndo, "\n\t LSP Buffersize: %u", EXTRACT_BE_16BITS(tptr)));
break;
case ISIS_TLV_PART_DIS:
if (tmp < ISIS_TLV_IIH_SEQNR_MINLEN)
break;
ND_TCHECK2(*tptr, ISIS_TLV_IIH_SEQNR_MINLEN); /* check if four bytes are on the wire */
- ND_PRINT((ndo, "\n\t Sequence number: %u", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Sequence number: %u", EXTRACT_BE_32BITS(tptr)));
break;
case ISIS_TLV_VENDOR_PRIVATE:
if (tmp < ISIS_TLV_VENDOR_PRIVATE_MINLEN)
break;
ND_TCHECK2(*tptr, ISIS_TLV_VENDOR_PRIVATE_MINLEN); /* check if enough byte for a full oui */
- vendor_id = EXTRACT_24BITS(tptr);
+ vendor_id = EXTRACT_BE_24BITS(tptr);
ND_PRINT((ndo, "\n\t Vendor: %s (%u)",
tok2str(oui_values, "Unknown", vendor_id),
vendor_id));
ND_PRINT((ndo, "proto %s (%u), vlan %u: ",
tok2str(juniper_protocol_values,"Unknown",gh->proto),
gh->proto,
- EXTRACT_16BITS(&gh->vlan_id[0])));
+ EXTRACT_BE_16BITS(&gh->vlan_id[0])));
}
switch (gh->proto) {
if (ndo->ndo_eflag) {
if (!es_type_bundle) {
ND_PRINT((ndo, "ES SA, index %u, ttl %u type %s (%u), spi %u, Tunnel %s > %s, length %u\n",
- EXTRACT_16BITS(&ih->sa_index),
+ EXTRACT_BE_16BITS(&ih->sa_index),
ih->ttl,
tok2str(juniper_ipsec_type_values,"Unknown",ih->type),
ih->type,
- EXTRACT_32BITS(&ih->spi),
+ EXTRACT_BE_32BITS(&ih->spi),
ipaddr_string(ndo, &ih->src_ip),
ipaddr_string(ndo, &ih->dst_ip),
l2info.length));
} else {
ND_PRINT((ndo, "ES SA, index %u, ttl %u type %s (%u), length %u\n",
- EXTRACT_16BITS(&ih->sa_index),
+ EXTRACT_BE_16BITS(&ih->sa_index),
ih->ttl,
tok2str(juniper_ipsec_type_values,"Unknown",ih->type),
ih->type,
ND_TCHECK(*mh);
if (ndo->ndo_eflag)
ND_PRINT((ndo, "service-id %u, iif %u, pkt-type %u: ",
- EXTRACT_32BITS(&mh->service_id),
- EXTRACT_16BITS(&mh->iif),
+ EXTRACT_BE_32BITS(&mh->service_id),
+ EXTRACT_BE_16BITS(&mh->iif),
mh->pkt_type));
/* no proto field - lets guess by first byte of IP header*/
ND_PRINT((ndo, "service-id %u flags 0x%02x service-set-id 0x%04x iif %u: ",
sh->svc_id,
sh->flags_len,
- EXTRACT_16BITS(&sh->svc_set_id),
- EXTRACT_24BITS(&sh->dir_iif[1])));
+ EXTRACT_BE_16BITS(&sh->svc_set_id),
+ EXTRACT_BE_24BITS(&sh->dir_iif[1])));
/* no proto field - lets guess by first byte of IP header*/
ip_heuristic_guess (ndo, p, l2info.length);
p+=l2info.header_len;
ND_TCHECK2(p[0], 2);
- extracted_ethertype = EXTRACT_16BITS(p);
+ extracted_ethertype = EXTRACT_BE_16BITS(p);
/* this DLT contains nothing but raw PPPoE frames,
* prepended with a type field*/
if (ethertype_print(ndo, extracted_ethertype,
/* suppress Bundle-ID if frame was captured on a child-link
* best indicator if the cookie looks like a proto */
if (ndo->ndo_eflag &&
- EXTRACT_16BITS(&l2info.cookie) != PPP_OSI &&
- EXTRACT_16BITS(&l2info.cookie) != (PPP_ADDRESS << 8 | PPP_CONTROL))
+ EXTRACT_BE_16BITS(&l2info.cookie) != PPP_OSI &&
+ EXTRACT_BE_16BITS(&l2info.cookie) != (PPP_ADDRESS << 8 | PPP_CONTROL))
ND_PRINT((ndo, "Bundle-ID %u: ", l2info.bundle));
p+=l2info.header_len;
}
/* zero length cookie ? */
- switch (EXTRACT_16BITS(&l2info.cookie)) {
+ switch (EXTRACT_BE_16BITS(&l2info.cookie)) {
case PPP_OSI:
ppp_print(ndo, p - 2, l2info.length + 2);
break;
}
/* suppress Bundle-ID if frame was captured on a child-link */
- if (ndo->ndo_eflag && EXTRACT_32BITS(l2info.cookie) != 1)
+ if (ndo->ndo_eflag && EXTRACT_BE_32BITS(l2info.cookie) != 1)
ND_PRINT((ndo, "Bundle-ID %u, ", l2info.bundle));
switch (l2info.proto) {
case (LLCSAP_ISONS<<8 | LLCSAP_ISONS):
p+=l2info.header_len;
/* suppress Bundle-ID if frame was captured on a child-link */
- if (ndo->ndo_eflag && EXTRACT_32BITS(l2info.cookie) != 1)
+ if (ndo->ndo_eflag && EXTRACT_BE_32BITS(l2info.cookie) != 1)
ND_PRINT((ndo, "Bundle-ID %u, ", l2info.bundle));
switch (l2info.proto) {
case (LLC_UI):
}
ND_TCHECK2(p[0], 3);
- if (EXTRACT_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */
- EXTRACT_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */
+ if (EXTRACT_BE_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */
+ EXTRACT_BE_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */
llc_hdrlen = llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
if (llc_hdrlen > 0)
}
ND_TCHECK2(p[0], 3);
- if (EXTRACT_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */
- EXTRACT_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */
+ if (EXTRACT_BE_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */
+ EXTRACT_BE_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */
llc_hdrlen = llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
if (llc_hdrlen > 0)
}
if (l2info.direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */
- (EXTRACT_32BITS(l2info.cookie) & ATM2_GAP_COUNT_MASK)) {
+ (EXTRACT_BE_32BITS(l2info.cookie) & ATM2_GAP_COUNT_MASK)) {
ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
return l2info.header_len;
}
juniper_ppp_heuristic_guess(netdissect_options *ndo,
register const u_char *p, u_int length)
{
- switch(EXTRACT_16BITS(p)) {
+ switch(EXTRACT_BE_16BITS(p)) {
case PPP_IP :
case PPP_OSI :
case PPP_MPLS_UCAST :
tlv_value = *p;
break;
case 2:
- tlv_value = EXTRACT_16BITS(p);
+ tlv_value = EXTRACT_BE_16BITS(p);
break;
case 3:
- tlv_value = EXTRACT_24BITS(p);
+ tlv_value = EXTRACT_BE_24BITS(p);
break;
case 4:
- tlv_value = EXTRACT_32BITS(p);
+ tlv_value = EXTRACT_BE_32BITS(p);
break;
default:
tlv_value = -1;
l2info->flags = p[3];
l2info->direction = p[3]&JUNIPER_BPF_PKT_IN;
- if (EXTRACT_24BITS(p) != JUNIPER_MGC_NUMBER) { /* magic number found ? */
+ if (EXTRACT_BE_24BITS(p) != JUNIPER_MGC_NUMBER) { /* magic number found ? */
ND_PRINT((ndo, "no magic-number found!"));
return 0;
}
/* ok to read extension length ? */
ND_TCHECK2(tptr[0], 2);
- jnx_ext_len = EXTRACT_16BITS(tptr);
+ jnx_ext_len = EXTRACT_BE_16BITS(tptr);
jnx_header_len += 2;
tptr +=2;
ND_TCHECK_16BITS(p+l2info->cookie_len);
- l2info->proto = EXTRACT_16BITS(p+l2info->cookie_len);
+ l2info->proto = EXTRACT_BE_16BITS(p + l2info->cookie_len);
break;
}
++lp;
l2info->bundle = l2info->cookie[1];
break;
case AS_COOKIE_ID:
- l2info->bundle = (EXTRACT_16BITS(&l2info->cookie[6])>>3)&0xfff;
+ l2info->bundle = (EXTRACT_BE_16BITS(&l2info->cookie[6])>>3)&0xfff;
l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK;
break;
default:
case LS_COOKIE_ID:
ND_TCHECK2(p[0], 2);
l2info->bundle = l2info->cookie[1];
- l2info->proto = EXTRACT_16BITS(p);
+ l2info->proto = EXTRACT_BE_16BITS(p);
l2info->header_len += 2;
l2info->length -= 2;
l2info->caplen -= 2;
break;
case AS_COOKIE_ID:
- l2info->bundle = (EXTRACT_16BITS(&l2info->cookie[6])>>3)&0xfff;
+ l2info->bundle = (EXTRACT_BE_16BITS(&l2info->cookie[6])>>3)&0xfff;
l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK;
break;
default:
case LS_COOKIE_ID:
ND_TCHECK2(p[0], 2);
l2info->bundle = l2info->cookie[1];
- l2info->proto = EXTRACT_16BITS(p);
+ l2info->proto = EXTRACT_BE_16BITS(p);
l2info->header_len += 2;
l2info->length -= 2;
l2info->caplen -= 2;
break;
case AS_COOKIE_ID:
- l2info->bundle = (EXTRACT_16BITS(&l2info->cookie[6])>>3)&0xfff;
+ l2info->bundle = (EXTRACT_BE_16BITS(&l2info->cookie[6])>>3)&0xfff;
l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK;
break;
default:
ND_TCHECK2(p[0], 4);
/* ATM cell relay control word present ? */
if (l2info->cookie[7] & ATM2_PKT_TYPE_MASK) {
- control_word = EXTRACT_32BITS(p);
+ control_word = EXTRACT_BE_32BITS(p);
/* some control word heuristics */
switch(control_word) {
case 0: /* zero control word */
#define PRINT if ((cp = c_print(ndo, cp, ndo->ndo_snapend)) == NULL) goto trunc
/* True if struct krb is little endian */
#define IS_LENDIAN(kp) (((kp)->type & 0x01) != 0)
-#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? EXTRACT_LE_16BITS(cp) : EXTRACT_16BITS(cp))
+#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? EXTRACT_LE_16BITS(cp) : EXTRACT_BE_16BITS(cp))
kp = (const struct krb *)cp;
static void
print_16bits_val(netdissect_options *ndo, const uint16_t *dat)
{
- ND_PRINT((ndo, "%u", EXTRACT_16BITS(dat)));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_16BITS(dat)));
}
static void
print_32bits_val(netdissect_options *ndo, const uint32_t *dat)
{
- ND_PRINT((ndo, "%lu", (u_long)EXTRACT_32BITS(dat)));
+ ND_PRINT((ndo, "%lu", (u_long) EXTRACT_BE_32BITS(dat)));
}
/***********************************/
return;
}
ND_PRINT((ndo, "%s", tok2str(l2tp_msgtype2str, "MSGTYPE-#%u",
- EXTRACT_16BITS(ptr))));
+ EXTRACT_BE_16BITS(ptr))));
}
static void
ND_PRINT((ndo, "AVP too short"));
return;
}
- ND_PRINT((ndo, "%u", EXTRACT_16BITS(ptr)));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_16BITS(ptr)));
ptr++;
length -= 2;
ND_PRINT((ndo, " AVP too short"));
return;
}
- ND_PRINT((ndo, "/%u", EXTRACT_16BITS(ptr)));
+ ND_PRINT((ndo, "/%u", EXTRACT_BE_16BITS(ptr)));
ptr++;
length -= 2;
ND_PRINT((ndo, "AVP too short"));
return;
}
- ND_PRINT((ndo, "%u.%u", (EXTRACT_16BITS(dat) >> 8),
- (EXTRACT_16BITS(dat) & 0xff)));
+ ND_PRINT((ndo, "%u.%u", (EXTRACT_BE_16BITS(dat) >> 8),
+ (EXTRACT_BE_16BITS(dat) & 0xff)));
}
static void
ND_PRINT((ndo, "AVP too short"));
return;
}
- if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_CAP_ASYNC_MASK) {
+ if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_CAP_ASYNC_MASK) {
ND_PRINT((ndo, "A"));
}
- if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_CAP_SYNC_MASK) {
+ if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_CAP_SYNC_MASK) {
ND_PRINT((ndo, "S"));
}
}
ND_PRINT((ndo, "AVP too short"));
return;
}
- if (EXTRACT_32BITS(ptr) & L2TP_BEARER_CAP_ANALOG_MASK) {
+ if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_CAP_ANALOG_MASK) {
ND_PRINT((ndo, "A"));
}
- if (EXTRACT_32BITS(ptr) & L2TP_BEARER_CAP_DIGITAL_MASK) {
+ if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_CAP_DIGITAL_MASK) {
ND_PRINT((ndo, "D"));
}
}
ND_PRINT((ndo, "AVP too short"));
return;
}
- if (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) {
+ if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) {
ND_PRINT((ndo, "A"));
}
- if (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) {
+ if (EXTRACT_BE_32BITS(ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) {
ND_PRINT((ndo, "D"));
}
}
ND_PRINT((ndo, "AVP too short"));
return;
}
- if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_TYPE_ASYNC_MASK) {
+ if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_TYPE_ASYNC_MASK) {
ND_PRINT((ndo, "A"));
}
- if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_TYPE_SYNC_MASK) {
+ if (EXTRACT_BE_32BITS(ptr) & L2TP_FRAMING_TYPE_SYNC_MASK) {
ND_PRINT((ndo, "S"));
}
}
return;
}
ND_PRINT((ndo, "%s", tok2str(l2tp_authentype2str,
- "AuthType-#%u", EXTRACT_16BITS(ptr))));
+ "AuthType-#%u", EXTRACT_BE_16BITS(ptr))));
}
static void
ND_PRINT((ndo, "AVP too short"));
return;
}
- ND_PRINT((ndo, "%u", EXTRACT_16BITS(ptr) & L2TP_PROXY_AUTH_ID_MASK));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_16BITS(ptr) & L2TP_PROXY_AUTH_ID_MASK));
}
static void
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_16BITS(ptr); ptr++; length -= 2;
- val_l = EXTRACT_16BITS(ptr); ptr++; length -= 2;
+ val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
+ val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
ND_PRINT((ndo, "CRCErr=%u ", (val_h<<16) + val_l));
if (length < 4) {
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_16BITS(ptr); ptr++; length -= 2;
- val_l = EXTRACT_16BITS(ptr); ptr++; length -= 2;
+ val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
+ val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
ND_PRINT((ndo, "FrameErr=%u ", (val_h<<16) + val_l));
if (length < 4) {
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_16BITS(ptr); ptr++; length -= 2;
- val_l = EXTRACT_16BITS(ptr); ptr++; length -= 2;
+ val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
+ val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
ND_PRINT((ndo, "HardOver=%u ", (val_h<<16) + val_l));
if (length < 4) {
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_16BITS(ptr); ptr++; length -= 2;
- val_l = EXTRACT_16BITS(ptr); ptr++; length -= 2;
+ val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
+ val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
ND_PRINT((ndo, "BufOver=%u ", (val_h<<16) + val_l));
if (length < 4) {
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_16BITS(ptr); ptr++; length -= 2;
- val_l = EXTRACT_16BITS(ptr); ptr++; length -= 2;
+ val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
+ val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
ND_PRINT((ndo, "Timeout=%u ", (val_h<<16) + val_l));
if (length < 4) {
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_16BITS(ptr); ptr++;
- val_l = EXTRACT_16BITS(ptr); ptr++;
+ val_h = EXTRACT_BE_16BITS(ptr); ptr++;
+ val_l = EXTRACT_BE_16BITS(ptr); ptr++;
ND_PRINT((ndo, "AlignErr=%u ", (val_h<<16) + val_l));
}
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_16BITS(ptr); ptr++; length -= 2;
- val_l = EXTRACT_16BITS(ptr); ptr++; length -= 2;
+ val_h = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
+ val_l = EXTRACT_BE_16BITS(ptr); ptr++; length -= 2;
ND_PRINT((ndo, "send=%08x ", (val_h<<16) + val_l));
if (length < 4) {
ND_PRINT((ndo, "AVP too short"));
return;
}
- val_h = EXTRACT_16BITS(ptr); ptr++;
- val_l = EXTRACT_16BITS(ptr); ptr++;
+ val_h = EXTRACT_BE_16BITS(ptr); ptr++;
+ val_l = EXTRACT_BE_16BITS(ptr); ptr++;
ND_PRINT((ndo, "recv=%08x ", (val_h<<16) + val_l));
}
return;
}
/* Disconnect Code */
- ND_PRINT((ndo, "%04x, ", EXTRACT_16BITS(dat)));
+ ND_PRINT((ndo, "%04x, ", EXTRACT_BE_16BITS(dat)));
dat += 2;
length -= 2;
/* Control Protocol Number */
- ND_PRINT((ndo, "%04x ", EXTRACT_16BITS(dat)));
+ ND_PRINT((ndo, "%04x ", EXTRACT_BE_16BITS(dat)));
dat += 2;
length -= 2;
/* Direction */
ND_PRINT((ndo, " "));
ND_TCHECK(*ptr); /* Flags & Length */
- len = EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_LEN_MASK;
+ len = EXTRACT_BE_16BITS(ptr) & L2TP_AVP_HDR_LEN_MASK;
/* If it is not long enough to contain the header, we'll give up. */
if (len < 6)
* check whether we go past the end of the AVP.
*/
- if (EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_FLAG_MANDATORY) {
+ if (EXTRACT_BE_16BITS(ptr) & L2TP_AVP_HDR_FLAG_MANDATORY) {
ND_PRINT((ndo, "*"));
}
- if (EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_FLAG_HIDDEN) {
+ if (EXTRACT_BE_16BITS(ptr) & L2TP_AVP_HDR_FLAG_HIDDEN) {
hidden = TRUE;
ND_PRINT((ndo, "?"));
}
ptr++;
- if (EXTRACT_16BITS(ptr)) {
+ if (EXTRACT_BE_16BITS(ptr)) {
/* Vendor Specific Attribute */
- ND_PRINT((ndo, "VENDOR%04x:", EXTRACT_16BITS(ptr))); ptr++;
- ND_PRINT((ndo, "ATTR%04x", EXTRACT_16BITS(ptr))); ptr++;
+ ND_PRINT((ndo, "VENDOR%04x:", EXTRACT_BE_16BITS(ptr))); ptr++;
+ ND_PRINT((ndo, "ATTR%04x", EXTRACT_BE_16BITS(ptr))); ptr++;
ND_PRINT((ndo, "("));
print_octets(ndo, (const u_char *)ptr, len-6);
ND_PRINT((ndo, ")"));
} else {
/* IETF-defined Attributes */
ptr++;
- attr_type = EXTRACT_16BITS(ptr); ptr++;
+ attr_type = EXTRACT_BE_16BITS(ptr); ptr++;
ND_PRINT((ndo, "%s", tok2str(l2tp_avp2str, "AVP-#%u", attr_type)));
ND_PRINT((ndo, "("));
if (hidden) {
flag_t = flag_l = flag_s = flag_o = FALSE;
ND_TCHECK2(*ptr, 2); /* Flags & Version */
- if ((EXTRACT_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) {
+ if ((EXTRACT_BE_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) {
ND_PRINT((ndo, " l2tp:"));
- } else if ((EXTRACT_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2F) {
+ } else if ((EXTRACT_BE_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2F) {
ND_PRINT((ndo, " l2f:"));
return; /* nothing to do */
} else {
}
ND_PRINT((ndo, "["));
- if (EXTRACT_16BITS(ptr) & L2TP_FLAG_TYPE) {
+ if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_TYPE) {
flag_t = TRUE;
ND_PRINT((ndo, "T"));
}
- if (EXTRACT_16BITS(ptr) & L2TP_FLAG_LENGTH) {
+ if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_LENGTH) {
flag_l = TRUE;
ND_PRINT((ndo, "L"));
}
- if (EXTRACT_16BITS(ptr) & L2TP_FLAG_SEQUENCE) {
+ if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_SEQUENCE) {
flag_s = TRUE;
ND_PRINT((ndo, "S"));
}
- if (EXTRACT_16BITS(ptr) & L2TP_FLAG_OFFSET) {
+ if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_OFFSET) {
flag_o = TRUE;
ND_PRINT((ndo, "O"));
}
- if (EXTRACT_16BITS(ptr) & L2TP_FLAG_PRIORITY)
+ if (EXTRACT_BE_16BITS(ptr) & L2TP_FLAG_PRIORITY)
ND_PRINT((ndo, "P"));
ND_PRINT((ndo, "]"));
if (flag_l) {
ND_TCHECK2(*ptr, 2); /* Length */
- l2tp_len = EXTRACT_16BITS(ptr);
+ l2tp_len = EXTRACT_BE_16BITS(ptr);
ptr += 2;
cnt += 2;
} else {
}
ND_TCHECK2(*ptr, 2); /* Tunnel ID */
- ND_PRINT((ndo, "(%u/", EXTRACT_16BITS(ptr)));
+ ND_PRINT((ndo, "(%u/", EXTRACT_BE_16BITS(ptr)));
ptr += 2;
cnt += 2;
ND_TCHECK2(*ptr, 2); /* Session ID */
- ND_PRINT((ndo, "%u)", EXTRACT_16BITS(ptr)));
+ ND_PRINT((ndo, "%u)", EXTRACT_BE_16BITS(ptr)));
ptr += 2;
cnt += 2;
if (flag_s) {
ND_TCHECK2(*ptr, 2); /* Ns */
- ND_PRINT((ndo, "Ns=%u,", EXTRACT_16BITS(ptr)));
+ ND_PRINT((ndo, "Ns=%u,", EXTRACT_BE_16BITS(ptr)));
ptr += 2;
cnt += 2;
ND_TCHECK2(*ptr, 2); /* Nr */
- ND_PRINT((ndo, "Nr=%u", EXTRACT_16BITS(ptr)));
+ ND_PRINT((ndo, "Nr=%u", EXTRACT_BE_16BITS(ptr)));
ptr += 2;
cnt += 2;
}
if (flag_o) {
ND_TCHECK2(*ptr, 2); /* Offset Size */
- pad = EXTRACT_16BITS(ptr);
+ pad = EXTRACT_BE_16BITS(ptr);
ptr += (2 + pad);
cnt += (2 + pad);
}
static void
lane_hdr_print(netdissect_options *ndo, const u_char *bp)
{
- ND_PRINT((ndo, "lecid:%x ", EXTRACT_16BITS(bp)));
+ ND_PRINT((ndo, "lecid:%x ", EXTRACT_BE_16BITS(bp)));
}
/*
}
lec = (const struct lane_controlhdr *)p;
- if (EXTRACT_16BITS(&lec->lec_header) == 0xff00) {
+ if (EXTRACT_BE_16BITS(&lec->lec_header) == 0xff00) {
/*
* LE Control.
*/
ND_PRINT((ndo, "lec: proto %x vers %x %s",
lec->lec_proto, lec->lec_vers,
- tok2str(lecop2str, "opcode-#%u", EXTRACT_16BITS(&lec->lec_opcode))));
+ tok2str(lecop2str, "opcode-#%u", EXTRACT_BE_16BITS(&lec->lec_opcode))));
return;
}
ldp_tlv_header = (const struct ldp_tlv_header *)tptr;
ND_TCHECK(*ldp_tlv_header);
- tlv_len=EXTRACT_16BITS(ldp_tlv_header->length);
+ tlv_len=EXTRACT_BE_16BITS(ldp_tlv_header->length);
if (tlv_len + 4 > msg_tlen) {
ND_PRINT((ndo, "\n\t\t TLV contents go past end of message"));
return 0;
}
tlv_tlen=tlv_len;
- tlv_type=LDP_MASK_TLV_TYPE(EXTRACT_16BITS(ldp_tlv_header->type));
+ tlv_type=LDP_MASK_TLV_TYPE(EXTRACT_BE_16BITS(ldp_tlv_header->type));
/* FIXME vendor private / experimental check */
ND_PRINT((ndo, "\n\t %s TLV (0x%04x), length: %u, Flags: [%s and %s forward if unknown]",
tlv_type),
tlv_type,
tlv_len,
- LDP_MASK_U_BIT(EXTRACT_16BITS(&ldp_tlv_header->type)) ? "continue processing" : "ignore",
- LDP_MASK_F_BIT(EXTRACT_16BITS(&ldp_tlv_header->type)) ? "do" : "don't"));
+ LDP_MASK_U_BIT(EXTRACT_BE_16BITS(&ldp_tlv_header->type)) ? "continue processing" : "ignore",
+ LDP_MASK_F_BIT(EXTRACT_BE_16BITS(&ldp_tlv_header->type)) ? "do" : "don't"));
tptr+=sizeof(struct ldp_tlv_header);
case LDP_TLV_COMMON_HELLO:
TLV_TCHECK(4);
ND_PRINT((ndo, "\n\t Hold Time: %us, Flags: [%s Hello%s]",
- EXTRACT_16BITS(tptr),
- (EXTRACT_16BITS(tptr+2)&0x8000) ? "Targeted" : "Link",
- (EXTRACT_16BITS(tptr+2)&0x4000) ? ", Request for targeted Hellos" : ""));
+ EXTRACT_BE_16BITS(tptr),
+ (EXTRACT_BE_16BITS(tptr + 2)&0x8000) ? "Targeted" : "Link",
+ (EXTRACT_BE_16BITS(tptr + 2)&0x4000) ? ", Request for targeted Hellos" : ""));
break;
case LDP_TLV_IPV4_TRANSPORT_ADDR:
break;
case LDP_TLV_CONFIG_SEQ_NUMBER:
TLV_TCHECK(4);
- ND_PRINT((ndo, "\n\t Sequence Number: %u", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Sequence Number: %u", EXTRACT_BE_32BITS(tptr)));
break;
case LDP_TLV_ADDRESS_LIST:
TLV_TCHECK(LDP_TLV_ADDRESS_LIST_AFNUM_LEN);
- af = EXTRACT_16BITS(tptr);
+ af = EXTRACT_BE_16BITS(tptr);
tptr+=LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
tlv_tlen -= LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
ND_PRINT((ndo, "\n\t Address Family: %s, addresses",
case LDP_TLV_COMMON_SESSION:
TLV_TCHECK(8);
ND_PRINT((ndo, "\n\t Version: %u, Keepalive: %us, Flags: [Downstream %s, Loop Detection %s]",
- EXTRACT_16BITS(tptr), EXTRACT_16BITS(tptr+2),
- (EXTRACT_16BITS(tptr+6)&0x8000) ? "On Demand" : "Unsolicited",
- (EXTRACT_16BITS(tptr+6)&0x4000) ? "Enabled" : "Disabled"
+ EXTRACT_BE_16BITS(tptr), EXTRACT_BE_16BITS(tptr + 2),
+ (EXTRACT_BE_16BITS(tptr + 6)&0x8000) ? "On Demand" : "Unsolicited",
+ (EXTRACT_BE_16BITS(tptr + 6)&0x4000) ? "Enabled" : "Disabled"
));
break;
break;
case LDP_FEC_PREFIX:
TLV_TCHECK(2);
- af = EXTRACT_16BITS(tptr);
+ af = EXTRACT_BE_16BITS(tptr);
tptr+=LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
tlv_tlen-=LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
if (af == AFNUM_INET) {
*/
if (vc_info_len == 0) {
ND_PRINT((ndo, ": %s, %scontrol word, group-ID %u, VC-info-length: %u",
- tok2str(mpls_pw_types_values, "Unknown", EXTRACT_16BITS(tptr)&0x7fff),
- EXTRACT_16BITS(tptr)&0x8000 ? "" : "no ",
- EXTRACT_32BITS(tptr+3),
+ tok2str(mpls_pw_types_values, "Unknown", EXTRACT_BE_16BITS(tptr)&0x7fff),
+ EXTRACT_BE_16BITS(tptr)&0x8000 ? "" : "no ",
+ EXTRACT_BE_32BITS(tptr + 3),
vc_info_len));
break;
}
/* Make sure we have the VC ID as well */
TLV_TCHECK(11);
ND_PRINT((ndo, ": %s, %scontrol word, group-ID %u, VC-ID %u, VC-info-length: %u",
- tok2str(mpls_pw_types_values, "Unknown", EXTRACT_16BITS(tptr)&0x7fff),
- EXTRACT_16BITS(tptr)&0x8000 ? "" : "no ",
- EXTRACT_32BITS(tptr+3),
- EXTRACT_32BITS(tptr+7),
- vc_info_len));
+ tok2str(mpls_pw_types_values, "Unknown", EXTRACT_BE_16BITS(tptr)&0x7fff),
+ EXTRACT_BE_16BITS(tptr)&0x8000 ? "" : "no ",
+ EXTRACT_BE_32BITS(tptr + 3),
+ EXTRACT_BE_32BITS(tptr + 7),
+ vc_info_len));
if (vc_info_len < 4) {
/* minimum 4, for the VC ID */
ND_PRINT((ndo, " (invalid, < 4"));
switch(vc_info_tlv_type) {
case LDP_FEC_MARTINI_IFPARM_MTU:
- ND_PRINT((ndo, ": %u", EXTRACT_16BITS(tptr+2)));
+ ND_PRINT((ndo, ": %u", EXTRACT_BE_16BITS(tptr + 2)));
break;
case LDP_FEC_MARTINI_IFPARM_DESC:
case LDP_TLV_GENERIC_LABEL:
TLV_TCHECK(4);
- ND_PRINT((ndo, "\n\t Label: %u", EXTRACT_32BITS(tptr) & 0xfffff));
+ ND_PRINT((ndo, "\n\t Label: %u", EXTRACT_BE_32BITS(tptr) & 0xfffff));
break;
case LDP_TLV_STATUS:
TLV_TCHECK(8);
- ui = EXTRACT_32BITS(tptr);
+ ui = EXTRACT_BE_32BITS(tptr);
tptr+=4;
ND_PRINT((ndo, "\n\t Status: 0x%02x, Flags: [%s and %s forward]",
ui&0x3fffffff,
ui&0x80000000 ? "Fatal error" : "Advisory Notification",
ui&0x40000000 ? "do" : "don't"));
- ui = EXTRACT_32BITS(tptr);
+ ui = EXTRACT_BE_32BITS(tptr);
tptr+=4;
if (ui)
ND_PRINT((ndo, ", causing Message ID: 0x%08x", ui));
case LDP_TLV_FT_SESSION:
TLV_TCHECK(8);
- ft_flags = EXTRACT_16BITS(tptr);
+ ft_flags = EXTRACT_BE_16BITS(tptr);
ND_PRINT((ndo, "\n\t Flags: [%sReconnect, %sSave State, %sAll-Label Protection, %s Checkpoint, %sRe-Learn State]",
ft_flags&0x8000 ? "" : "No ",
ft_flags&0x8 ? "" : "Don't ",
ft_flags&0x2 ? "Sequence Numbered Label" : "All Labels",
ft_flags&0x1 ? "" : "Don't "));
tptr+=4;
- ui = EXTRACT_32BITS(tptr);
+ ui = EXTRACT_BE_32BITS(tptr);
if (ui)
ND_PRINT((ndo, ", Reconnect Timeout: %ums", ui));
tptr+=4;
- ui = EXTRACT_32BITS(tptr);
+ ui = EXTRACT_BE_32BITS(tptr);
if (ui)
ND_PRINT((ndo, ", Recovery Time: %ums", ui));
break;
case LDP_TLV_MTU:
TLV_TCHECK(2);
- ND_PRINT((ndo, "\n\t MTU: %u", EXTRACT_16BITS(tptr)));
+ ND_PRINT((ndo, "\n\t MTU: %u", EXTRACT_BE_16BITS(tptr)));
break;
/*
* Sanity checking of the header.
*/
- if (EXTRACT_16BITS(&ldp_com_header->version) != LDP_VERSION) {
+ if (EXTRACT_BE_16BITS(&ldp_com_header->version) != LDP_VERSION) {
ND_PRINT((ndo, "%sLDP version %u packet not supported",
(ndo->ndo_vflag < 1) ? "" : "\n\t",
- EXTRACT_16BITS(&ldp_com_header->version)));
+ EXTRACT_BE_16BITS(&ldp_com_header->version)));
return 0;
}
- pdu_len = EXTRACT_16BITS(&ldp_com_header->pdu_length);
+ pdu_len = EXTRACT_BE_16BITS(&ldp_com_header->pdu_length);
if (pdu_len < sizeof(struct ldp_common_header)-4) {
/* length too short */
ND_PRINT((ndo, "%sLDP, pdu-length: %u (too short, < %u)",
ND_PRINT((ndo, "%sLDP, Label-Space-ID: %s:%u, pdu-length: %u",
(ndo->ndo_vflag < 1) ? "" : "\n\t",
ipaddr_string(ndo, &ldp_com_header->lsr_id),
- EXTRACT_16BITS(&ldp_com_header->label_space),
+ EXTRACT_BE_16BITS(&ldp_com_header->label_space),
pdu_len));
/* bail out if non-verbose */
ND_TCHECK2(*tptr, sizeof(struct ldp_msg_header));
ldp_msg_header = (const struct ldp_msg_header *)tptr;
- msg_len=EXTRACT_16BITS(ldp_msg_header->length);
- msg_type=LDP_MASK_MSG_TYPE(EXTRACT_16BITS(ldp_msg_header->type));
+ msg_len=EXTRACT_BE_16BITS(ldp_msg_header->length);
+ msg_type=LDP_MASK_MSG_TYPE(EXTRACT_BE_16BITS(ldp_msg_header->type));
if (msg_len < sizeof(struct ldp_msg_header)-4) {
/* length too short */
msg_type),
msg_type,
msg_len,
- EXTRACT_32BITS(&ldp_msg_header->id),
- LDP_MASK_U_BIT(EXTRACT_16BITS(&ldp_msg_header->type)) ? "continue processing" : "ignore"));
+ EXTRACT_BE_32BITS(&ldp_msg_header->id),
+ LDP_MASK_U_BIT(EXTRACT_BE_16BITS(&ldp_msg_header->type)) ? "continue processing" : "ignore"));
msg_tptr=tptr+sizeof(struct ldp_msg_header);
msg_tlen=msg_len-(sizeof(struct ldp_msg_header)-4); /* Type & Length fields not included */
xtr_present = is_xtr_data_present(type, lisp_hdr->type_and_flag);
/* Extract the number of EID records present */
- auth_data_len = EXTRACT_16BITS(&lisp_hdr->auth_data_len);
+ auth_data_len = EXTRACT_BE_16BITS(&lisp_hdr->auth_data_len);
packet_iterator = (const u_char *)(lisp_hdr);
packet_offset = MAP_REGISTER_HDR_LEN;
record_count = lisp_hdr->record_count;
if (ndo->ndo_vflag) {
- key_id = EXTRACT_16BITS(&lisp_hdr->key_id);
+ key_id = EXTRACT_BE_16BITS(&lisp_hdr->key_id);
ND_PRINT((ndo, "\n %u record(s), ", record_count));
ND_PRINT((ndo, "Authentication %s,",
tok2str(auth_type, "unknown-type", key_id)));
((const u_char *)lisp_hdr + packet_offset);
packet_offset += MAP_REGISTER_EID_LEN;
mask_len = lisp_eid->eid_prefix_mask_length;
- eid_afi = EXTRACT_16BITS(&lisp_eid->eid_prefix_afi);
+ eid_afi = EXTRACT_BE_16BITS(&lisp_eid->eid_prefix_afi);
loc_count = lisp_eid->locator_count;
if (ndo->ndo_vflag) {
- ttl = EXTRACT_32BITS(&lisp_eid->ttl);
+ ttl = EXTRACT_BE_32BITS(&lisp_eid->ttl);
ND_PRINT((ndo, " Record TTL %u,", ttl));
action_flag(ndo, lisp_eid->act_auth_inc_res);
map_version = (((lisp_eid->reserved_version_hi) & 15 ) * 255) +
lisp_loc = (const lisp_map_register_loc *) (packet_iterator + packet_offset);
loc_ip_pointer = (const u_char *) (lisp_loc + 1);
packet_offset += MAP_REGISTER_LOC_LEN;
- loc_afi = EXTRACT_16BITS(&lisp_loc->locator_afi);
+ loc_afi = EXTRACT_BE_16BITS(&lisp_loc->locator_afi);
if (ndo->ndo_vflag)
ND_PRINT((ndo, "\n "));
" Multicast Priority/Weight %u/%u,",
lisp_loc->priority, lisp_loc->weight,
lisp_loc->m_priority, lisp_loc->m_weight));
- loc_hdr_flag(ndo, EXTRACT_16BITS(&lisp_loc->unused_and_flag));
+ loc_hdr_flag(ndo,
+ EXTRACT_BE_16BITS(&lisp_loc->unused_and_flag));
}
}
}
goto invalid;
hex_print_with_offset(ndo, "\n xTR-ID: ", packet_iterator + packet_offset, 16, 0);
ND_PRINT((ndo, "\n SITE-ID: %" PRIu64,
- EXTRACT_64BITS(packet_iterator + packet_offset + 16)));
+ EXTRACT_BE_64BITS(packet_iterator + packet_offset + 16)));
} else {
/* Check if packet isn't over yet */
if (packet_iterator + packet_offset < ndo->ndo_snapend) {
if (type == LISP_MAP_REGISTER) {
ND_PRINT((ndo, " flags [%s],", bittok2str(map_register_hdr_flag,
- "none", EXTRACT_32BITS(lisp_hdr))));
+ "none", EXTRACT_BE_32BITS(lisp_hdr))));
} else if (type == LISP_MAP_NOTIFY) {
ND_PRINT((ndo, " flags [%s],", bittok2str(map_notify_hdr_flag,
- "none", EXTRACT_32BITS(lisp_hdr))));
+ "none", EXTRACT_BE_32BITS(lisp_hdr))));
}
return;
ND_TCHECK2(*p, 5);
if (caplen < 5 || length < 5)
goto trunc;
- orgcode = EXTRACT_24BITS(p);
- et = EXTRACT_16BITS(p + 3);
+ orgcode = EXTRACT_BE_24BITS(p);
+ et = EXTRACT_BE_16BITS(p + 3);
if (ndo->ndo_eflag) {
/*
return hexdump;
}
ND_PRINT((ndo, "\n\t port vlan id (PVID): %u",
- EXTRACT_16BITS(tptr + 4)));
+ EXTRACT_BE_16BITS(tptr + 4)));
break;
case LLDP_PRIVATE_8021_SUBTYPE_PROTOCOL_VLAN_ID:
if (tlv_len < 7) {
return hexdump;
}
ND_PRINT((ndo, "\n\t port and protocol vlan id (PPVID): %u, flags [%s] (0x%02x)",
- EXTRACT_16BITS(tptr+5),
- bittok2str(lldp_8021_port_protocol_id_values, "none", *(tptr+4)),
+ EXTRACT_BE_16BITS(tptr + 5),
+ bittok2str(lldp_8021_port_protocol_id_values, "none", *(tptr+4)),
*(tptr + 4)));
break;
case LLDP_PRIVATE_8021_SUBTYPE_VLAN_NAME:
if (tlv_len < 6) {
return hexdump;
}
- ND_PRINT((ndo, "\n\t vlan id (VID): %u", EXTRACT_16BITS(tptr + 4)));
+ ND_PRINT((ndo, "\n\t vlan id (VID): %u", EXTRACT_BE_16BITS(tptr + 4)));
if (tlv_len < 7) {
return hexdump;
}
tval=*(tptr+i+5);
ND_PRINT((ndo, "\n\t Priority: %u, RES: %u, Sel: %u, Protocol ID: %u",
tval >> 5, (tval >> 3) & 0x03, (tval & 0x07),
- EXTRACT_16BITS(tptr + i + 5)));
+ EXTRACT_BE_16BITS(tptr + i + 5)));
i=i+3;
}
break;
tval=*(tptr+4);
ND_PRINT((ndo, "\n\t Role: %d, RES: %d, Scomp: %d ",
tval >> 7, (tval >> 4) & 0x07, (tval >> 3) & 0x01));
- ND_PRINT((ndo, "ChnCap: %d", EXTRACT_16BITS(tptr + 6) & 0x0fff));
+ ND_PRINT((ndo, "ChnCap: %d", EXTRACT_BE_16BITS(tptr + 6) & 0x0fff));
sublen=tlv_len-8;
if(sublen%3!=0) {
return hexdump;
}
i=0;
while(i<sublen) {
- tval=EXTRACT_24BITS(tptr+i+8);
+ tval=EXTRACT_BE_24BITS(tptr + i + 8);
ND_PRINT((ndo, "\n\t SCID: %d, SVID: %d",
tval >> 12, tval & 0x000fff));
i=i+3;
bittok2str(lldp_8023_autonegotiation_values, "none", *(tptr+4)),
*(tptr + 4)));
ND_PRINT((ndo, "\n\t PMD autoneg capability [%s] (0x%04x)",
- bittok2str(lldp_pmd_capability_values,"unknown", EXTRACT_16BITS(tptr+5)),
- EXTRACT_16BITS(tptr + 5)));
+ bittok2str(lldp_pmd_capability_values,"unknown", EXTRACT_BE_16BITS(tptr + 5)),
+ EXTRACT_BE_16BITS(tptr + 5)));
ND_PRINT((ndo, "\n\t MAU type %s (0x%04x)",
- tok2str(lldp_mau_types_values, "unknown", EXTRACT_16BITS(tptr+7)),
- EXTRACT_16BITS(tptr + 7)));
+ tok2str(lldp_mau_types_values, "unknown", EXTRACT_BE_16BITS(tptr + 7)),
+ EXTRACT_BE_16BITS(tptr + 7)));
break;
case LLDP_PRIVATE_8023_SUBTYPE_MDIPOWER:
}
ND_PRINT((ndo, "\n\t aggregation status [%s], aggregation port ID %u",
bittok2str(lldp_aggregation_values, "none", *(tptr+4)),
- EXTRACT_32BITS(tptr + 5)));
+ EXTRACT_BE_32BITS(tptr + 5)));
break;
case LLDP_PRIVATE_8023_SUBTYPE_MTU:
if (tlv_len < 6) {
return hexdump;
}
- ND_PRINT((ndo, "\n\t MTU size %u", EXTRACT_16BITS(tptr + 4)));
+ ND_PRINT((ndo, "\n\t MTU size %u", EXTRACT_BE_16BITS(tptr + 4)));
break;
default:
uint64_t latlon;
latlon = *tptr & 0x3;
- latlon = (latlon << 32) | EXTRACT_32BITS(tptr+1);
+ latlon = (latlon << 32) | EXTRACT_BE_32BITS(tptr + 1);
return latlon;
}
}
ND_PRINT((ndo, "\n\t Media capabilities [%s] (0x%04x)",
bittok2str(lldp_tia_capabilities_values, "none",
- EXTRACT_16BITS(tptr + 4)), EXTRACT_16BITS(tptr + 4)));
+ EXTRACT_BE_16BITS(tptr + 4)), EXTRACT_BE_16BITS(tptr + 4)));
ND_PRINT((ndo, "\n\t Device type [%s] (0x%02x)",
tok2str(lldp_tia_device_type_values, "unknown", *(tptr+6)),
*(tptr + 6)));
ND_PRINT((ndo, ", Flags [%s]", bittok2str(
lldp_tia_network_policy_bits_values, "none", *(tptr + 5))));
ND_PRINT((ndo, "\n\t Vlan id %u",
- LLDP_EXTRACT_NETWORK_POLICY_VLAN(EXTRACT_16BITS(tptr + 5))));
+ LLDP_EXTRACT_NETWORK_POLICY_VLAN(EXTRACT_BE_16BITS(tptr + 5))));
ND_PRINT((ndo, ", L2 priority %u",
- LLDP_EXTRACT_NETWORK_POLICY_L2_PRIORITY(EXTRACT_16BITS(tptr + 6))));
+ LLDP_EXTRACT_NETWORK_POLICY_L2_PRIORITY(EXTRACT_BE_16BITS(tptr + 6))));
ND_PRINT((ndo, ", DSCP value %u",
- LLDP_EXTRACT_NETWORK_POLICY_DSCP(EXTRACT_16BITS(tptr + 6))));
+ LLDP_EXTRACT_NETWORK_POLICY_DSCP(EXTRACT_BE_16BITS(tptr + 6))));
break;
case LLDP_PRIVATE_TIA_SUBTYPE_LOCAL_ID:
tok2str(lldp_tia_location_altitude_type_values, "unknown",(*(tptr+15)>>4)),
(*(tptr + 15) >> 4)));
ND_PRINT((ndo, "\n\t Altitude resolution %u, altitude value 0x%x",
- (EXTRACT_16BITS(tptr+15)>>6)&0x3f,
- ((EXTRACT_32BITS(tptr + 16) & 0x3fffffff))));
+ (EXTRACT_BE_16BITS(tptr + 15)>>6)&0x3f,
+ ((EXTRACT_BE_32BITS(tptr + 16) & 0x3fffffff))));
ND_PRINT((ndo, "\n\t Datum %s (0x%02x)",
tok2str(lldp_tia_location_datum_type_values, "unknown", *(tptr+20)),
*(tptr + 20)));
ND_PRINT((ndo, "\n\t Power priority [%s] (0x%02x)",
tok2str(lldp_tia_power_priority_values, "none", *(tptr+4)&0x0f),
*(tptr + 4) & 0x0f));
- power_val = EXTRACT_16BITS(tptr+5);
+ power_val = EXTRACT_BE_16BITS(tptr + 5);
if (power_val < LLDP_TIA_POWER_VAL_MAX) {
ND_PRINT((ndo, ", Power %.1f Watts", ((float)power_val) / 10));
} else {
ND_TCHECK2(*tptr, sizeof(tlv));
- tlv = EXTRACT_16BITS(tptr);
+ tlv = EXTRACT_BE_16BITS(tptr);
tlv_type = LLDP_EXTRACT_TYPE(tlv);
tlv_len = LLDP_EXTRACT_LEN(tlv);
LLDP_DCBX_CONTROL_TLV, tlv_len));
ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr));
ND_PRINT((ndo, "\n\t Max_Version: %d", *(tptr + 1)));
- ND_PRINT((ndo, "\n\t Sequence Number: %d", EXTRACT_32BITS(tptr + 2)));
+ ND_PRINT((ndo, "\n\t Sequence Number: %d", EXTRACT_BE_32BITS(tptr + 2)));
ND_PRINT((ndo, "\n\t Acknowledgement Number: %d",
- EXTRACT_32BITS(tptr + 6)));
+ EXTRACT_BE_32BITS(tptr + 6)));
break;
case LLDP_DCBX_PRIORITY_GROUPS_TLV:
if (tlv_len < 17) {
* Array of 8 4-bit priority group ID values; we fetch all
* 32 bits and extract each nibble.
*/
- pgval = EXTRACT_32BITS(tptr+4);
+ pgval = EXTRACT_BE_32BITS(tptr + 4);
for (i = 0; i <= 7; i++) {
ND_PRINT((ndo, "\n\t PgId_%d: %d",
i, (pgval >> (28 - 4 * i)) & 0xF));
while (tval >= 6) {
ND_PRINT((ndo, "\n\t Application Value"));
ND_PRINT((ndo, "\n\t Application Protocol ID: 0x%04x",
- EXTRACT_16BITS(mptr)));
- uval = EXTRACT_24BITS(mptr+2);
+ EXTRACT_BE_16BITS(mptr)));
+ uval = EXTRACT_BE_24BITS(mptr + 2);
ND_PRINT((ndo, "\n\t SF (0x%x) Application Protocol ID is %s",
(uval >> 22),
(uval >> 22) ? "Socket Number" : "L2 EtherType"));
ND_PRINT((ndo, "\n\t %s Interface Numbering (%u): %u",
tok2str(lldp_intf_numb_subtype_values, "Unknown", intf_num_subtype),
intf_num_subtype,
- EXTRACT_32BITS(tptr + 1)));
+ EXTRACT_BE_32BITS(tptr + 1)));
tptr += LLDP_INTF_NUM_LEN;
tlen -= LLDP_INTF_NUM_LEN;
ND_TCHECK2(*tptr, sizeof(tlv));
- tlv = EXTRACT_16BITS(tptr);
+ tlv = EXTRACT_BE_16BITS(tptr);
tlv_type = LLDP_EXTRACT_TYPE(tlv);
tlv_len = LLDP_EXTRACT_LEN(tlv);
if (tlv_len < 2) {
goto trunc;
}
- ND_PRINT((ndo, ": TTL %us", EXTRACT_16BITS(tptr)));
+ ND_PRINT((ndo, ": TTL %us", EXTRACT_BE_16BITS(tptr)));
}
break;
if (tlv_len < 4) {
goto trunc;
}
- cap = EXTRACT_16BITS(tptr);
- ena_cap = EXTRACT_16BITS(tptr+2);
+ cap = EXTRACT_BE_16BITS(tptr);
+ ena_cap = EXTRACT_BE_16BITS(tptr + 2);
ND_PRINT((ndo, "\n\t System Capabilities [%s] (0x%04x)",
bittok2str(lldp_cap_values, "none", cap), cap));
ND_PRINT((ndo, "\n\t Enabled Capabilities [%s] (0x%04x)",
if (tlv_len < 3) {
goto trunc;
}
- oui = EXTRACT_24BITS(tptr);
+ oui = EXTRACT_BE_24BITS(tptr);
ND_PRINT((ndo, ": OUI %s (0x%06x)", tok2str(oui_values, "Unknown", oui), oui));
switch (oui) {
"Unknown",
EXTRACT_8BITS(obj_tptr + offset + 3)),
EXTRACT_8BITS(obj_tptr + offset + 3)));
- bw.i = EXTRACT_32BITS(obj_tptr+offset+4);
+ bw.i = EXTRACT_BE_32BITS(obj_tptr + offset + 4);
ND_PRINT((ndo, "\n\t Min Reservable Bandwidth: %.3f Mbps",
bw.f*8/1000000));
- bw.i = EXTRACT_32BITS(obj_tptr+offset+8);
+ bw.i = EXTRACT_BE_32BITS(obj_tptr + offset + 8);
ND_PRINT((ndo, "\n\t Max Reservable Bandwidth: %.3f Mbps",
bw.f*8/1000000));
break;
case WAVELENGTH_SUBOBJ:
ND_PRINT((ndo, "\n\t Wavelength: %u",
- EXTRACT_32BITS(obj_tptr+offset+4)));
+ EXTRACT_BE_32BITS(obj_tptr + offset + 4)));
break;
default:
/* Any Unknown Subobject ==> Exit loop */
/* ok they seem to want to know everything - lets fully decode it */
- tlen=EXTRACT_16BITS(lmp_com_header->length);
+ tlen=EXTRACT_BE_16BITS(lmp_com_header->length);
ND_PRINT((ndo, "\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u",
LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
ND_TCHECK2(*tptr, sizeof(struct lmp_object_header));
lmp_obj_header = (const struct lmp_object_header *)tptr;
- lmp_obj_len=EXTRACT_16BITS(lmp_obj_header->length);
+ lmp_obj_len=EXTRACT_BE_16BITS(lmp_obj_header->length);
lmp_obj_ctype=(lmp_obj_header->ctype)&0x7f;
ND_PRINT((ndo, "\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u",
break;
}
ND_PRINT((ndo, "\n\t Control Channel ID: %u (0x%08x)",
- EXTRACT_32BITS(obj_tptr),
- EXTRACT_32BITS(obj_tptr)));
+ EXTRACT_BE_32BITS(obj_tptr),
+ EXTRACT_BE_32BITS(obj_tptr)));
break;
default:
}
ND_PRINT((ndo, "\n\t IPv4 Link ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr),
- EXTRACT_32BITS(obj_tptr)));
+ EXTRACT_BE_32BITS(obj_tptr)));
break;
case LMP_CTYPE_IPV6_LOC:
case LMP_CTYPE_IPV6_RMT:
}
ND_PRINT((ndo, "\n\t IPv6 Link ID: %s (0x%08x)",
ip6addr_string(ndo, obj_tptr),
- EXTRACT_32BITS(obj_tptr)));
+ EXTRACT_BE_32BITS(obj_tptr)));
break;
case LMP_CTYPE_UNMD_LOC:
case LMP_CTYPE_UNMD_RMT:
break;
}
ND_PRINT((ndo, "\n\t Link ID: %u (0x%08x)",
- EXTRACT_32BITS(obj_tptr),
- EXTRACT_32BITS(obj_tptr)));
+ EXTRACT_BE_32BITS(obj_tptr),
+ EXTRACT_BE_32BITS(obj_tptr)));
break;
default:
hexdump=TRUE;
break;
}
ND_PRINT((ndo, "\n\t Message ID: %u (0x%08x)",
- EXTRACT_32BITS(obj_tptr),
- EXTRACT_32BITS(obj_tptr)));
+ EXTRACT_BE_32BITS(obj_tptr),
+ EXTRACT_BE_32BITS(obj_tptr)));
break;
case LMP_CTYPE_2:
if (obj_tlen != 4) {
break;
}
ND_PRINT((ndo, "\n\t Message ID Ack: %u (0x%08x)",
- EXTRACT_32BITS(obj_tptr),
- EXTRACT_32BITS(obj_tptr)));
+ EXTRACT_BE_32BITS(obj_tptr),
+ EXTRACT_BE_32BITS(obj_tptr)));
break;
default:
hexdump=TRUE;
}
ND_PRINT((ndo, "\n\t Node ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr),
- EXTRACT_32BITS(obj_tptr)));
+ EXTRACT_BE_32BITS(obj_tptr)));
break;
default:
break;
}
ND_PRINT((ndo, "\n\t Hello Interval: %u\n\t Hello Dead Interval: %u",
- EXTRACT_16BITS(obj_tptr),
- EXTRACT_16BITS(obj_tptr+2)));
+ EXTRACT_BE_16BITS(obj_tptr),
+ EXTRACT_BE_16BITS(obj_tptr + 2)));
break;
default:
break;
}
ND_PRINT((ndo, "\n\t Tx Seq: %u, Rx Seq: %u",
- EXTRACT_32BITS(obj_tptr),
- EXTRACT_32BITS(obj_tptr+4)));
+ EXTRACT_BE_32BITS(obj_tptr),
+ EXTRACT_BE_32BITS(obj_tptr + 4)));
break;
default:
ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)"
"\n\t Remote Link-ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr+4),
- EXTRACT_32BITS(obj_tptr+4),
+ EXTRACT_BE_32BITS(obj_tptr + 4),
ipaddr_string(ndo, obj_tptr+8),
- EXTRACT_32BITS(obj_tptr+8)));
+ EXTRACT_BE_32BITS(obj_tptr + 8)));
break;
case LMP_CTYPE_IPV6:
ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)"
"\n\t Remote Link-ID: %s (0x%08x)",
ip6addr_string(ndo, obj_tptr+4),
- EXTRACT_32BITS(obj_tptr+4),
+ EXTRACT_BE_32BITS(obj_tptr + 4),
ip6addr_string(ndo, obj_tptr+20),
- EXTRACT_32BITS(obj_tptr+20)));
+ EXTRACT_BE_32BITS(obj_tptr + 20)));
break;
case LMP_CTYPE_UNMD:
ND_PRINT((ndo, "\n\t Local Link-ID: %u (0x%08x)"
"\n\t Remote Link-ID: %u (0x%08x)",
- EXTRACT_32BITS(obj_tptr+4),
- EXTRACT_32BITS(obj_tptr+4),
- EXTRACT_32BITS(obj_tptr+8),
- EXTRACT_32BITS(obj_tptr+8)));
+ EXTRACT_BE_32BITS(obj_tptr + 4),
+ EXTRACT_BE_32BITS(obj_tptr + 4),
+ EXTRACT_BE_32BITS(obj_tptr + 8),
+ EXTRACT_BE_32BITS(obj_tptr + 8)));
break;
default:
ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)"
"\n\t Remote Interface ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr+4),
- EXTRACT_32BITS(obj_tptr+4),
+ EXTRACT_BE_32BITS(obj_tptr + 4),
ipaddr_string(ndo, obj_tptr+8),
- EXTRACT_32BITS(obj_tptr+8)));
+ EXTRACT_BE_32BITS(obj_tptr + 8)));
if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12))
hexdump=TRUE;
ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)"
"\n\t Remote Interface ID: %s (0x%08x)",
ip6addr_string(ndo, obj_tptr+4),
- EXTRACT_32BITS(obj_tptr+4),
+ EXTRACT_BE_32BITS(obj_tptr + 4),
ip6addr_string(ndo, obj_tptr+20),
- EXTRACT_32BITS(obj_tptr+20)));
+ EXTRACT_BE_32BITS(obj_tptr + 20)));
if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 36, 36))
hexdump=TRUE;
EXTRACT_8BITS(obj_tptr))));
ND_PRINT((ndo, "\n\t Local Interface ID: %u (0x%08x)"
"\n\t Remote Interface ID: %u (0x%08x)",
- EXTRACT_32BITS(obj_tptr+4),
- EXTRACT_32BITS(obj_tptr+4),
- EXTRACT_32BITS(obj_tptr+8),
- EXTRACT_32BITS(obj_tptr+8)));
+ EXTRACT_BE_32BITS(obj_tptr + 4),
+ EXTRACT_BE_32BITS(obj_tptr + 4),
+ EXTRACT_BE_32BITS(obj_tptr + 8),
+ EXTRACT_BE_32BITS(obj_tptr + 8)));
if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12))
hexdump=TRUE;
ND_PRINT((ndo, "\n\t Flags: %s",
bittok2str(lmp_obj_begin_verify_flag_values,
"none",
- EXTRACT_16BITS(obj_tptr))));
+ EXTRACT_BE_16BITS(obj_tptr))));
ND_PRINT((ndo, "\n\t Verify Interval: %u",
- EXTRACT_16BITS(obj_tptr+2)));
+ EXTRACT_BE_16BITS(obj_tptr + 2)));
ND_PRINT((ndo, "\n\t Data links: %u",
- EXTRACT_32BITS(obj_tptr+4)));
+ EXTRACT_BE_32BITS(obj_tptr + 4)));
ND_PRINT((ndo, "\n\t Encoding type: %s",
tok2str(gmpls_encoding_values, "Unknown", *(obj_tptr+8))));
ND_PRINT((ndo, "\n\t Verify Transport Mechanism: %u (0x%x)%s",
- EXTRACT_16BITS(obj_tptr+10),
- EXTRACT_16BITS(obj_tptr+10),
- EXTRACT_16BITS(obj_tptr+10)&8000 ? " (Payload test messages capable)" : ""));
- bw.i = EXTRACT_32BITS(obj_tptr+12);
+ EXTRACT_BE_16BITS(obj_tptr + 10),
+ EXTRACT_BE_16BITS(obj_tptr + 10),
+ EXTRACT_BE_16BITS(obj_tptr + 10)&8000 ? " (Payload test messages capable)" : ""));
+ bw.i = EXTRACT_BE_32BITS(obj_tptr + 12);
ND_PRINT((ndo, "\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000));
ND_PRINT((ndo, "\n\t Wavelength: %u",
- EXTRACT_32BITS(obj_tptr+16)));
+ EXTRACT_BE_32BITS(obj_tptr + 16)));
break;
default:
}
ND_PRINT((ndo, "\n\t Verify Dead Interval: %u"
"\n\t Verify Transport Response: %u",
- EXTRACT_16BITS(obj_tptr),
- EXTRACT_16BITS(obj_tptr+2)));
+ EXTRACT_BE_16BITS(obj_tptr),
+ EXTRACT_BE_16BITS(obj_tptr + 2)));
break;
default:
break;
}
ND_PRINT((ndo, "\n\t Verify ID: %u",
- EXTRACT_32BITS(obj_tptr)));
+ EXTRACT_BE_32BITS(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_32BITS(obj_tptr+offset)));
+ EXTRACT_BE_32BITS(obj_tptr + offset)));
ND_PRINT((ndo, "\n\t\t Active: %s (%u)",
- (EXTRACT_32BITS(obj_tptr+offset+4)>>31) ?
- "Allocated" : "Non-allocated",
- (EXTRACT_32BITS(obj_tptr+offset+4)>>31)));
+ (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31) ?
+ "Allocated" : "Non-allocated",
+ (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31)));
ND_PRINT((ndo, "\n\t\t Direction: %s (%u)",
- (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ?
- "Transmit" : "Receive",
- (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1));
+ (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1 ?
+ "Transmit" : "Receive",
+ (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1));
ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)",
tok2str(lmp_obj_channel_status_values,
"Unknown",
- EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF),
- EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF));
+ EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF),
+ EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF));
offset+=8;
}
break;
while (offset+20 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
ip6addr_string(ndo, obj_tptr+offset),
- EXTRACT_32BITS(obj_tptr+offset)));
+ EXTRACT_BE_32BITS(obj_tptr + offset)));
ND_PRINT((ndo, "\n\t\t Active: %s (%u)",
- (EXTRACT_32BITS(obj_tptr+offset+16)>>31) ?
- "Allocated" : "Non-allocated",
- (EXTRACT_32BITS(obj_tptr+offset+16)>>31)));
+ (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>31) ?
+ "Allocated" : "Non-allocated",
+ (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>31)));
ND_PRINT((ndo, "\n\t\t Direction: %s (%u)",
- (EXTRACT_32BITS(obj_tptr+offset+16)>>30)&0x1 ?
- "Transmit" : "Receive",
- (EXTRACT_32BITS(obj_tptr+offset+16)>>30)&0x1));
+ (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>30)&0x1 ?
+ "Transmit" : "Receive",
+ (EXTRACT_BE_32BITS(obj_tptr + offset + 16)>>30)&0x1));
ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)",
tok2str(lmp_obj_channel_status_values,
"Unknown",
- EXTRACT_32BITS(obj_tptr+offset+16)&0x3FFFFFF),
- EXTRACT_32BITS(obj_tptr+offset+16)&0x3FFFFFF));
+ EXTRACT_BE_32BITS(obj_tptr + offset + 16)&0x3FFFFFF),
+ EXTRACT_BE_32BITS(obj_tptr + offset + 16)&0x3FFFFFF));
offset+=20;
}
break;
/* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
while (offset+8 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)",
- EXTRACT_32BITS(obj_tptr+offset),
- EXTRACT_32BITS(obj_tptr+offset)));
+ EXTRACT_BE_32BITS(obj_tptr + offset),
+ EXTRACT_BE_32BITS(obj_tptr + offset)));
ND_PRINT((ndo, "\n\t\t Active: %s (%u)",
- (EXTRACT_32BITS(obj_tptr+offset+4)>>31) ?
- "Allocated" : "Non-allocated",
- (EXTRACT_32BITS(obj_tptr+offset+4)>>31)));
+ (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31) ?
+ "Allocated" : "Non-allocated",
+ (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>31)));
ND_PRINT((ndo, "\n\t\t Direction: %s (%u)",
- (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ?
- "Transmit" : "Receive",
- (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1));
+ (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1 ?
+ "Transmit" : "Receive",
+ (EXTRACT_BE_32BITS(obj_tptr + offset + 4)>>30)&0x1));
ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)",
tok2str(lmp_obj_channel_status_values,
"Unknown",
- EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF),
- EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF));
+ EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF),
+ EXTRACT_BE_32BITS(obj_tptr + offset + 4)&0x3FFFFFF));
offset+=8;
}
break;
while (offset+4 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr+offset),
- EXTRACT_32BITS(obj_tptr+offset)));
+ EXTRACT_BE_32BITS(obj_tptr + offset)));
offset+=4;
}
break;
while (offset+16 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
ip6addr_string(ndo, obj_tptr+offset),
- EXTRACT_32BITS(obj_tptr+offset)));
+ EXTRACT_BE_32BITS(obj_tptr + offset)));
offset+=16;
}
break;
offset = 0;
while (offset+4 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)",
- EXTRACT_32BITS(obj_tptr+offset),
- EXTRACT_32BITS(obj_tptr+offset)));
+ EXTRACT_BE_32BITS(obj_tptr + offset),
+ EXTRACT_BE_32BITS(obj_tptr + offset)));
offset+=4;
}
break;
ND_PRINT((ndo, "\n\t Error Code: %s",
bittok2str(lmp_obj_begin_verify_error_values,
"none",
- EXTRACT_32BITS(obj_tptr))));
+ EXTRACT_BE_32BITS(obj_tptr))));
break;
case LMP_CTYPE_LINK_SUMMARY_ERROR:
ND_PRINT((ndo, "\n\t Error Code: %s",
bittok2str(lmp_obj_link_summary_error_values,
"none",
- EXTRACT_32BITS(obj_tptr))));
+ EXTRACT_BE_32BITS(obj_tptr))));
break;
default:
hexdump=TRUE;
EXTRACT_8BITS(obj_tptr + 3))));
ND_PRINT((ndo, "\n\t Minimum NCC: %u",
- EXTRACT_16BITS(obj_tptr+4)));
+ EXTRACT_BE_16BITS(obj_tptr + 4)));
ND_PRINT((ndo, "\n\t Maximum NCC: %u",
- EXTRACT_16BITS(obj_tptr+6)));
+ EXTRACT_BE_16BITS(obj_tptr + 6)));
ND_PRINT((ndo, "\n\t Minimum NVC:%u",
- EXTRACT_16BITS(obj_tptr+8)));
+ EXTRACT_BE_16BITS(obj_tptr + 8)));
ND_PRINT((ndo, "\n\t Maximum NVC:%u",
- EXTRACT_16BITS(obj_tptr+10)));
+ EXTRACT_BE_16BITS(obj_tptr + 10)));
ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr+12),
- EXTRACT_32BITS(obj_tptr+12)));
+ EXTRACT_BE_32BITS(obj_tptr + 12)));
break;
bittok2str(
lmp_obj_service_config_nsa_transparency_flag_values,
"none",
- EXTRACT_32BITS(obj_tptr))));
+ EXTRACT_BE_32BITS(obj_tptr))));
ND_PRINT((ndo, "\n\t TCM Monitoring Flags: %s",
bittok2str(
/*
* Sanity checking of the header.
*/
- if (EXTRACT_16BITS(&lspping_com_header->version[0]) != LSPPING_VERSION) {
+ if (EXTRACT_BE_16BITS(&lspping_com_header->version[0]) != LSPPING_VERSION) {
ND_PRINT((ndo, "LSP-PING version %u packet not supported",
- EXTRACT_16BITS(&lspping_com_header->version[0])));
+ EXTRACT_BE_16BITS(&lspping_com_header->version[0])));
return;
}
/* in non-verbose mode just lets print the basic Message Type*/
if (ndo->ndo_vflag < 1) {
ND_PRINT((ndo, "LSP-PINGv%u, %s, seq %u, length: %u",
- EXTRACT_16BITS(&lspping_com_header->version[0]),
+ EXTRACT_BE_16BITS(&lspping_com_header->version[0]),
tok2str(lspping_msg_type_values, "unknown (%u)",lspping_com_header->msg_type),
- EXTRACT_32BITS(lspping_com_header->seq_number),
+ EXTRACT_BE_32BITS(lspping_com_header->seq_number),
len));
return;
}
tlen=len;
ND_PRINT((ndo, "\n\tLSP-PINGv%u, msg-type: %s (%u), length: %u\n\t reply-mode: %s (%u)",
- EXTRACT_16BITS(&lspping_com_header->version[0]),
+ EXTRACT_BE_16BITS(&lspping_com_header->version[0]),
tok2str(lspping_msg_type_values, "unknown",lspping_com_header->msg_type),
lspping_com_header->msg_type,
len,
lspping_com_header->return_subcode));
ND_PRINT((ndo, "\n\t Sender Handle: 0x%08x, Sequence: %u",
- EXTRACT_32BITS(lspping_com_header->sender_handle),
- EXTRACT_32BITS(lspping_com_header->seq_number)));
+ EXTRACT_BE_32BITS(lspping_com_header->sender_handle),
+ EXTRACT_BE_32BITS(lspping_com_header->seq_number)));
- timestamp.tv_sec=EXTRACT_32BITS(lspping_com_header->ts_sent_sec);
- timestamp.tv_usec=EXTRACT_32BITS(lspping_com_header->ts_sent_usec);
+ timestamp.tv_sec=EXTRACT_BE_32BITS(lspping_com_header->ts_sent_sec);
+ timestamp.tv_usec=EXTRACT_BE_32BITS(lspping_com_header->ts_sent_usec);
ND_PRINT((ndo, "\n\t Sender Timestamp: "));
ts_print(ndo, ×tamp);
- timestamp.tv_sec=EXTRACT_32BITS(lspping_com_header->ts_rcvd_sec);
- timestamp.tv_usec=EXTRACT_32BITS(lspping_com_header->ts_rcvd_usec);
+ timestamp.tv_sec=EXTRACT_BE_32BITS(lspping_com_header->ts_rcvd_sec);
+ timestamp.tv_usec=EXTRACT_BE_32BITS(lspping_com_header->ts_rcvd_usec);
ND_PRINT((ndo, "Receiver Timestamp: "));
if ((timestamp.tv_sec != 0) && (timestamp.tv_usec != 0))
ts_print(ndo, ×tamp);
ND_TCHECK2(*tptr, sizeof(struct lspping_tlv_header));
lspping_tlv_header = (const struct lspping_tlv_header *)tptr;
- lspping_tlv_type=EXTRACT_16BITS(lspping_tlv_header->type);
- lspping_tlv_len=EXTRACT_16BITS(lspping_tlv_header->length);
+ lspping_tlv_type=EXTRACT_BE_16BITS(lspping_tlv_header->type);
+ lspping_tlv_len=EXTRACT_BE_16BITS(lspping_tlv_header->length);
ND_PRINT((ndo, "\n\t %s TLV (%u), length: %u",
tok2str(lspping_tlv_values,
subtlv_hexdump=FALSE;
lspping_subtlv_header = (const struct lspping_tlv_header *)tlv_tptr;
- lspping_subtlv_type=EXTRACT_16BITS(lspping_subtlv_header->type);
- lspping_subtlv_len=EXTRACT_16BITS(lspping_subtlv_header->length);
+ lspping_subtlv_type=EXTRACT_BE_16BITS(lspping_subtlv_header->type);
+ lspping_subtlv_len=EXTRACT_BE_16BITS(lspping_subtlv_header->length);
subtlv_tptr=tlv_tptr+sizeof(struct lspping_tlv_header);
/* Does the subTLV go past the end of the TLV? */
"\n\t tunnel-id 0x%04x, extended tunnel-id %s",
ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_endpoint),
ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_sender),
- EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->lsp_id),
- EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_id),
+ EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->lsp_id),
+ EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_id),
ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->extended_tunnel_id)));
}
break;
"\n\t tunnel-id 0x%04x, extended tunnel-id %s",
ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_endpoint),
ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_sender),
- EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->lsp_id),
- EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_id),
+ EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->lsp_id),
+ EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_id),
ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->extended_tunnel_id)));
}
break;
ND_PRINT((ndo, "\n\t RD: %s, Sender VE ID: %u, Receiver VE ID: %u" \
"\n\t Encapsulation Type: %s (%u)",
bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->rd),
- EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->sender_ve_id),
- EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->receiver_ve_id),
+ EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->sender_ve_id),
+ EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->receiver_ve_id),
tok2str(mpls_pw_types_values,
"unknown",
- EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)),
- EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)));
+ EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)),
+ EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)));
}
break;
ND_PRINT((ndo, "\n\t Remote PE: %s" \
"\n\t PW ID: 0x%08x, PW Type: %s (%u)",
ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->remote_pe_address),
- EXTRACT_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_id),
+ EXTRACT_BE_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_id),
tok2str(mpls_pw_types_values,
"unknown",
- EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type)),
- EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type)));
+ EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type)),
+ EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type)));
}
break;
"\n\t PW ID: 0x%08x, PW Type: %s (%u)",
ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->sender_pe_address),
ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->remote_pe_address),
- EXTRACT_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_id),
+ EXTRACT_BE_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_id),
tok2str(mpls_pw_types_values,
"unknown",
- EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type)),
- EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type)));
+ EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type)),
+ EXTRACT_BE_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type)));
}
break;
* we find the address-type, we recast the tlv_tptr and move on. */
ND_PRINT((ndo, "\n\t MTU: %u, Address-Type: %s (%u)",
- EXTRACT_16BITS(tlv_ptr.lspping_tlv_downstream_map->mtu),
+ EXTRACT_BE_16BITS(tlv_ptr.lspping_tlv_downstream_map->mtu),
tok2str(lspping_tlv_downstream_addr_values,
"unknown",
tlv_ptr.lspping_tlv_downstream_map->address_type),
ND_PRINT((ndo, "\n\t Downstream IP: %s" \
"\n\t Downstream Interface Index: 0x%08x",
ipaddr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv4_unmb->downstream_ip),
- EXTRACT_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4_unmb->downstream_interface)));
+ EXTRACT_BE_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4_unmb->downstream_interface)));
tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv4_unmb_t);
tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv4_unmb_t);
break;
ND_PRINT((ndo, "\n\t Downstream IP: %s" \
"\n\t Downstream Interface Index: 0x%08x",
ip6addr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv6_unmb->downstream_ip),
- EXTRACT_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv6_unmb->downstream_interface)));
+ EXTRACT_BE_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv6_unmb->downstream_interface)));
tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv6_unmb_t);
tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv6_unmb_t);
break;
goto tlv_tooshort;
} else {
ND_TCHECK2(*tptr, LSPPING_TLV_BFD_DISCRIMINATOR_LEN);
- ND_PRINT((ndo, "\n\t BFD Discriminator 0x%08x", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t BFD Discriminator 0x%08x", EXTRACT_BE_32BITS(tptr)));
}
break;
goto tlv_tooshort;
} else {
ND_TCHECK2(*tptr, LSPPING_TLV_VENDOR_ENTERPRISE_LEN);
- vendor_id = EXTRACT_32BITS(tlv_tptr);
+ vendor_id = EXTRACT_BE_32BITS(tlv_tptr);
ND_PRINT((ndo, "\n\t Vendor: %s (0x%04x)",
tok2str(smi_values, "Unknown", vendor_id),
vendor_id));
}
/* ok they seem to want to know everything - lets fully decode it */
- tlen=EXTRACT_16BITS(lwapp_trans_header->length);
+ tlen=EXTRACT_BE_16BITS(lwapp_trans_header->length);
ND_PRINT((ndo, "LWAPPv%u, %s frame, Radio-id %u, Flags [%s], Frag-id %u, length %u",
LWAPP_EXTRACT_VERSION(lwapp_trans_header->version),
ND_TCHECK2(*tptr, sizeof(struct lwapp_control_header));
lwapp_control_header = (const struct lwapp_control_header *)tptr;
- msg_tlen = EXTRACT_16BITS(lwapp_control_header->len);
+ msg_tlen = EXTRACT_BE_16BITS(lwapp_control_header->len);
/* print message header */
ND_PRINT((ndo, "\n\t Msg type: %s (%u), Seqnum: %u, Msg len: %d, Session: 0x%08x",
lwapp_control_header->msg_type,
lwapp_control_header->seq_num,
msg_tlen,
- EXTRACT_32BITS(lwapp_control_header->session_id)));
+ EXTRACT_BE_32BITS(lwapp_control_header->session_id)));
/* did we capture enough for fully decoding the message */
ND_TCHECK2(*tptr, msg_tlen);
}
/* ok they seem to want to know everything - lets fully decode it */
- tlen=EXTRACT_16BITS(lwapp_trans_header->length);
+ tlen=EXTRACT_BE_16BITS(lwapp_trans_header->length);
ND_PRINT((ndo, "LWAPPv%u, %s frame, Radio-id %u, Flags [%s], Frag-id %u, length %u",
LWAPP_EXTRACT_VERSION(lwapp_trans_header->version),
if (p + 2 > (const char *)ndo->ndo_snapend)
goto trunc;
- l = EXTRACT_16BITS(p);
+ l = EXTRACT_BE_16BITS(p);
advance = lwres_printname(ndo, l, p + 2);
if (advance < 0)
goto trunc;
p = p0;
if (p + 2 > (const char *)ndo->ndo_snapend)
goto trunc;
- l = EXTRACT_16BITS(p);
+ l = EXTRACT_BE_16BITS(p);
if (p + 2 + l > (const char *)ndo->ndo_snapend)
goto trunc;
p += 2;
int i;
ND_TCHECK(ap->length);
- l = EXTRACT_16BITS(&ap->length);
+ l = EXTRACT_BE_16BITS(&ap->length);
/* XXX ap points to packed struct */
p = (const char *)&ap->length + sizeof(ap->length);
ND_TCHECK2(*p, l);
- switch (EXTRACT_32BITS(&ap->family)) {
+ switch (EXTRACT_BE_32BITS(&ap->family)) {
case 1: /* IPv4 */
if (l < 4)
return -1;
p += sizeof(struct in6_addr);
break;
default:
- ND_PRINT((ndo, " %u/", EXTRACT_32BITS(&ap->family)));
+ ND_PRINT((ndo, " %u/", EXTRACT_BE_32BITS(&ap->family)));
for (i = 0; i < l; i++)
ND_PRINT((ndo, "%02x", *p++));
}
ND_TCHECK(np->authlength);
ND_PRINT((ndo, " lwres"));
- v = EXTRACT_16BITS(&np->version);
+ v = EXTRACT_BE_16BITS(&np->version);
if (ndo->ndo_vflag || v != LWRES_LWPACKETVERSION_0)
ND_PRINT((ndo, " v%u", v));
if (v != LWRES_LWPACKETVERSION_0) {
- s = (const char *)np + EXTRACT_32BITS(&np->length);
+ s = (const char *)np + EXTRACT_BE_32BITS(&np->length);
goto tail;
}
- response = EXTRACT_16BITS(&np->pktflags) & LWRES_LWPACKETFLAG_RESPONSE;
+ response = EXTRACT_BE_16BITS(&np->pktflags) & LWRES_LWPACKETFLAG_RESPONSE;
/* opcode and pktflags */
- v = EXTRACT_32BITS(&np->opcode);
+ v = EXTRACT_BE_32BITS(&np->opcode);
s = tok2str(opcode, "#0x%x", v);
ND_PRINT((ndo, " %s%s", s, response ? "" : "?"));
/* pktflags */
- v = EXTRACT_16BITS(&np->pktflags);
+ v = EXTRACT_BE_16BITS(&np->pktflags);
if (v & ~LWRES_LWPACKETFLAG_RESPONSE)
ND_PRINT((ndo, "[0x%x]", v));
if (ndo->ndo_vflag > 1) {
ND_PRINT((ndo, " (")); /*)*/
- ND_PRINT((ndo, "serial:0x%x", EXTRACT_32BITS(&np->serial)));
- ND_PRINT((ndo, " result:0x%x", EXTRACT_32BITS(&np->result)));
- ND_PRINT((ndo, " recvlen:%u", EXTRACT_32BITS(&np->recvlength)));
+ ND_PRINT((ndo, "serial:0x%x", EXTRACT_BE_32BITS(&np->serial)));
+ ND_PRINT((ndo, " result:0x%x", EXTRACT_BE_32BITS(&np->result)));
+ ND_PRINT((ndo, " recvlen:%u", EXTRACT_BE_32BITS(&np->recvlength)));
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
- ND_PRINT((ndo, " authtype:0x%x", EXTRACT_16BITS(&np->authtype)));
- ND_PRINT((ndo, " authlen:%u", EXTRACT_16BITS(&np->authlength)));
+ ND_PRINT((ndo, " authtype:0x%x", EXTRACT_BE_16BITS(&np->authtype)));
+ ND_PRINT((ndo, " authlen:%u", EXTRACT_BE_16BITS(&np->authlength)));
}
/*(*/
ND_PRINT((ndo, ")"));
gnba = NULL;
grbn = NULL;
- switch (EXTRACT_32BITS(&np->opcode)) {
+ switch (EXTRACT_BE_32BITS(&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_16BITS(&gabn->namelen);
+ l = EXTRACT_BE_16BITS(&gabn->namelen);
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT((ndo, " flags:0x%x",
- EXTRACT_32BITS(&gabn->flags)));
+ EXTRACT_BE_32BITS(&gabn->flags)));
}
- v = EXTRACT_32BITS(&gabn->addrtypes);
+ v = EXTRACT_BE_32BITS(&gabn->addrtypes);
switch (v & (LWRES_ADDRTYPE_V4 | LWRES_ADDRTYPE_V6)) {
case LWRES_ADDRTYPE_V4:
ND_PRINT((ndo, " IPv4"));
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT((ndo, " flags:0x%x",
- EXTRACT_32BITS(&gnba->flags)));
+ EXTRACT_BE_32BITS(&gnba->flags)));
}
s = (const char *)&gnba->addr;
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT((ndo, " flags:0x%x",
- EXTRACT_32BITS(&grbn->flags)));
+ EXTRACT_BE_32BITS(&grbn->flags)));
}
ND_PRINT((ndo, " %s", tok2str(ns_type2str, "Type%d",
- EXTRACT_16BITS(&grbn->rdtype))));
- if (EXTRACT_16BITS(&grbn->rdclass) != C_IN) {
+ EXTRACT_BE_16BITS(&grbn->rdtype))));
+ if (EXTRACT_BE_16BITS(&grbn->rdclass) != C_IN) {
ND_PRINT((ndo, " %s", tok2str(ns_class2str, "Class%d",
- EXTRACT_16BITS(&grbn->rdclass))));
+ EXTRACT_BE_16BITS(&grbn->rdclass))));
}
/* XXX grbn points to packed struct */
s = (const char *)&grbn->namelen +
sizeof(grbn->namelen);
- l = EXTRACT_16BITS(&grbn->namelen);
+ l = EXTRACT_BE_16BITS(&grbn->namelen);
advance = lwres_printname(ndo, l, s);
if (advance < 0)
gnba = NULL;
grbn = NULL;
- switch (EXTRACT_32BITS(&np->opcode)) {
+ switch (EXTRACT_BE_32BITS(&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_16BITS(&gabn->realnamelen);
+ l = EXTRACT_BE_16BITS(&gabn->realnamelen);
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT((ndo, " flags:0x%x",
- EXTRACT_32BITS(&gabn->flags)));
+ EXTRACT_BE_32BITS(&gabn->flags)));
}
- ND_PRINT((ndo, " %u/%u", EXTRACT_16BITS(&gabn->naliases),
- EXTRACT_16BITS(&gabn->naddrs)));
+ ND_PRINT((ndo, " %u/%u", EXTRACT_BE_16BITS(&gabn->naliases),
+ EXTRACT_BE_16BITS(&gabn->naddrs)));
advance = lwres_printname(ndo, l, s);
if (advance < 0)
s += advance;
/* aliases */
- na = EXTRACT_16BITS(&gabn->naliases);
+ na = EXTRACT_BE_16BITS(&gabn->naliases);
for (i = 0; i < na; i++) {
advance = lwres_printnamelen(ndo, s);
if (advance < 0)
}
/* addrs */
- na = EXTRACT_16BITS(&gabn->naddrs);
+ na = EXTRACT_BE_16BITS(&gabn->naddrs);
for (i = 0; i < na; i++) {
advance = lwres_printaddr(ndo, (const lwres_addr_t *)s);
if (advance < 0)
/* XXX gnba points to packed struct */
s = (const char *)&gnba->realnamelen +
sizeof(gnba->realnamelen);
- l = EXTRACT_16BITS(&gnba->realnamelen);
+ l = EXTRACT_BE_16BITS(&gnba->realnamelen);
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT((ndo, " flags:0x%x",
- EXTRACT_32BITS(&gnba->flags)));
+ EXTRACT_BE_32BITS(&gnba->flags)));
}
- ND_PRINT((ndo, " %u", EXTRACT_16BITS(&gnba->naliases)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_16BITS(&gnba->naliases)));
advance = lwres_printname(ndo, l, s);
if (advance < 0)
s += advance;
/* aliases */
- na = EXTRACT_16BITS(&gnba->naliases);
+ na = EXTRACT_BE_16BITS(&gnba->naliases);
for (i = 0; i < na; i++) {
advance = lwres_printnamelen(ndo, s);
if (advance < 0)
/* BIND910: not used */
if (ndo->ndo_vflag > 2) {
ND_PRINT((ndo, " flags:0x%x",
- EXTRACT_32BITS(&grbn->flags)));
+ EXTRACT_BE_32BITS(&grbn->flags)));
}
ND_PRINT((ndo, " %s", tok2str(ns_type2str, "Type%d",
- EXTRACT_16BITS(&grbn->rdtype))));
- if (EXTRACT_16BITS(&grbn->rdclass) != C_IN) {
+ EXTRACT_BE_16BITS(&grbn->rdtype))));
+ if (EXTRACT_BE_16BITS(&grbn->rdclass) != C_IN) {
ND_PRINT((ndo, " %s", tok2str(ns_class2str, "Class%d",
- EXTRACT_16BITS(&grbn->rdclass))));
+ EXTRACT_BE_16BITS(&grbn->rdclass))));
}
ND_PRINT((ndo, " TTL "));
- unsigned_relts_print(ndo, EXTRACT_32BITS(&grbn->ttl));
- ND_PRINT((ndo, " %u/%u", EXTRACT_16BITS(&grbn->nrdatas),
- EXTRACT_16BITS(&grbn->nsigs)));
+ unsigned_relts_print(ndo,
+ EXTRACT_BE_32BITS(&grbn->ttl));
+ ND_PRINT((ndo, " %u/%u", EXTRACT_BE_16BITS(&grbn->nrdatas),
+ EXTRACT_BE_16BITS(&grbn->nsigs)));
/* XXX grbn points to packed struct */
s = (const char *)&grbn->nsigs+ sizeof(grbn->nsigs);
s += advance;
/* rdatas */
- na = EXTRACT_16BITS(&grbn->nrdatas);
+ na = EXTRACT_BE_16BITS(&grbn->nrdatas);
for (i = 0; i < na; i++) {
/* XXX should decode resource data */
advance = lwres_printbinlen(ndo, s);
}
/* sigs */
- na = EXTRACT_16BITS(&grbn->nsigs);
+ na = EXTRACT_BE_16BITS(&grbn->nsigs);
for (i = 0; i < na; i++) {
/* XXX how should we print it? */
advance = lwres_printbinlen(ndo, s);
tail:
/* length mismatch */
- if (EXTRACT_32BITS(&np->length) != length) {
- ND_PRINT((ndo, " [len: %u != %u]", EXTRACT_32BITS(&np->length),
- length));
+ if (EXTRACT_BE_32BITS(&np->length) != length) {
+ ND_PRINT((ndo, " [len: %u != %u]", EXTRACT_BE_32BITS(&np->length),
+ length));
}
- if (!unsupported && s < (const char *)np + EXTRACT_32BITS(&np->length))
+ if (!unsupported && s < (const char *)np + EXTRACT_BE_32BITS(&np->length))
ND_PRINT((ndo, "[extra]"));
return;
if (size < 4)
goto invalid;
ND_TCHECK2(*buf, size);
- ND_PRINT((ndo, "0x%08x", EXTRACT_32BITS(buf)));
+ ND_PRINT((ndo, "0x%08x", EXTRACT_BE_32BITS(buf)));
break;
/* ... */
default:
goto invalid;
ND_TCHECK2(*p, sizeof(struct m3ua_param_header));
/* Parameter Tag */
- hdr_tag = EXTRACT_16BITS(p);
+ hdr_tag = EXTRACT_BE_16BITS(p);
ND_PRINT((ndo, "\n\t\t\t%s: ", tok2str(ParamName, "Unknown Parameter (0x%04x)", hdr_tag)));
/* Parameter Length */
- hdr_len = EXTRACT_16BITS(p + 2);
+ hdr_len = EXTRACT_BE_16BITS(p + 2);
if (hdr_len < sizeof(struct m3ua_param_header))
goto invalid;
/* Parameter Value */
if (dict != NULL)
ND_PRINT((ndo, " %s Message", tok2str(dict, "Unknown (0x%02x)", hdr->msg_type)));
- if (size != EXTRACT_32BITS(&hdr->len))
- ND_PRINT((ndo, "\n\t\t\t@@@@@@ Corrupted length %u of message @@@@@@", EXTRACT_32BITS(&hdr->len)));
+ if (size != EXTRACT_BE_32BITS(&hdr->len))
+ ND_PRINT((ndo, "\n\t\t\t@@@@@@ Corrupted length %u of message @@@@@@", EXTRACT_BE_32BITS(&hdr->len)));
else
- m3ua_tags_print(ndo, buf + sizeof(struct m3ua_common_header), EXTRACT_32BITS(&hdr->len) - sizeof(struct m3ua_common_header));
+ m3ua_tags_print(ndo, buf + sizeof(struct m3ua_common_header),
+ EXTRACT_BE_32BITS(&hdr->len) - sizeof(struct m3ua_common_header));
return;
invalid:
length -= 8;
caplen -= 8;
- ether_type = EXTRACT_16BITS(&medsa->ether_type);
+ ether_type = EXTRACT_BE_16BITS(&medsa->ether_type);
if (ether_type <= ETHERMTU) {
/* Try to print the LLC-layer header & higher layers */
if (llc_print(ndo, bp, length, caplen, src, dst) < 0) {
}
ND_PRINT((ndo, "mobile: "));
- proto = EXTRACT_16BITS(&mob->proto);
- crc = EXTRACT_16BITS(&mob->hcheck);
+ proto = EXTRACT_BE_16BITS(&mob->proto);
+ crc = EXTRACT_BE_16BITS(&mob->hcheck);
if (proto & OSRC_PRES) {
osp=1;
}
/* units of 4 secs */
ND_TCHECK_16BITS(&bp[i+2]);
ND_PRINT((ndo, "(refresh: %u)",
- EXTRACT_16BITS(&bp[i+2]) << 2));
+ EXTRACT_BE_16BITS(&bp[i + 2]) << 2));
break;
case IP6MOPT_ALTCOA:
if (len - i < IP6MOPT_ALTCOA_MINLEN) {
ND_TCHECK_16BITS(&bp[i+2]);
ND_TCHECK_16BITS(&bp[i+4]);
ND_PRINT((ndo, "(ni: ho=0x%04x co=0x%04x)",
- EXTRACT_16BITS(&bp[i+2]),
- EXTRACT_16BITS(&bp[i+4])));
+ EXTRACT_BE_16BITS(&bp[i + 2]),
+ EXTRACT_BE_16BITS(&bp[i + 4])));
break;
case IP6MOPT_AUTH:
if (len - i < IP6MOPT_AUTH_MINLEN) {
ND_TCHECK_32BITS(&bp[hlen + 4]);
ND_PRINT((ndo, " %s Init Cookie=%08x:%08x",
type == IP6M_HOME_TEST_INIT ? "Home" : "Care-of",
- EXTRACT_32BITS(&bp[hlen]),
- EXTRACT_32BITS(&bp[hlen + 4])));
+ EXTRACT_BE_32BITS(&bp[hlen]),
+ EXTRACT_BE_32BITS(&bp[hlen + 4])));
}
hlen += 8;
break;
case IP6M_HOME_TEST:
case IP6M_CAREOF_TEST:
ND_TCHECK(mh->ip6m_data16[0]);
- ND_PRINT((ndo, " nonce id=0x%x", EXTRACT_16BITS(&mh->ip6m_data16[0])));
+ ND_PRINT((ndo, " nonce id=0x%x", EXTRACT_BE_16BITS(&mh->ip6m_data16[0])));
hlen = IP6M_MINLEN;
if (ndo->ndo_vflag) {
ND_TCHECK_32BITS(&bp[hlen + 4]);
ND_PRINT((ndo, " %s Init Cookie=%08x:%08x",
type == IP6M_HOME_TEST ? "Home" : "Care-of",
- EXTRACT_32BITS(&bp[hlen]),
- EXTRACT_32BITS(&bp[hlen + 4])));
+ EXTRACT_BE_32BITS(&bp[hlen]),
+ EXTRACT_BE_32BITS(&bp[hlen + 4])));
}
hlen += 8;
if (ndo->ndo_vflag) {
ND_TCHECK_32BITS(&bp[hlen + 4]);
ND_PRINT((ndo, " %s Keygen Token=%08x:%08x",
type == IP6M_HOME_TEST ? "Home" : "Care-of",
- EXTRACT_32BITS(&bp[hlen]),
- EXTRACT_32BITS(&bp[hlen + 4])));
+ EXTRACT_BE_32BITS(&bp[hlen]),
+ EXTRACT_BE_32BITS(&bp[hlen + 4])));
}
hlen += 8;
break;
case IP6M_BINDING_UPDATE:
ND_TCHECK(mh->ip6m_data16[0]);
- ND_PRINT((ndo, " seq#=%u", EXTRACT_16BITS(&mh->ip6m_data16[0])));
+ ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_16BITS(&mh->ip6m_data16[0])));
hlen = IP6M_MINLEN;
ND_TCHECK_16BITS(&bp[hlen]);
if (bp[hlen] & 0xf0) {
hlen += 1;
ND_TCHECK_16BITS(&bp[hlen]);
/* units of 4 secs */
- ND_PRINT((ndo, " lifetime=%u", EXTRACT_16BITS(&bp[hlen]) << 2));
+ ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_16BITS(&bp[hlen]) << 2));
hlen += 2;
break;
case IP6M_BINDING_ACK:
/* Reserved (7bits) */
hlen = IP6M_MINLEN;
ND_TCHECK_16BITS(&bp[hlen]);
- ND_PRINT((ndo, " seq#=%u", EXTRACT_16BITS(&bp[hlen])));
+ ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_16BITS(&bp[hlen])));
hlen += 2;
ND_TCHECK_16BITS(&bp[hlen]);
/* units of 4 secs */
- ND_PRINT((ndo, " lifetime=%u", EXTRACT_16BITS(&bp[hlen]) << 2));
+ ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_16BITS(&bp[hlen]) << 2));
hlen += 2;
break;
case IP6M_BINDING_ERROR:
mpcp.common_header = (const struct mpcp_common_header_t *)pptr;
ND_TCHECK2(*tptr, sizeof(struct mpcp_common_header_t));
- opcode = EXTRACT_16BITS(mpcp.common_header->opcode);
+ opcode = EXTRACT_BE_16BITS(mpcp.common_header->opcode);
ND_PRINT((ndo, "MPCP, Opcode %s", tok2str(mpcp_opcode_values, "Unknown (%u)", opcode)));
if (opcode != MPCP_OPCODE_PAUSE) {
- ND_PRINT((ndo, ", Timestamp %u ticks", EXTRACT_32BITS(mpcp.common_header->timestamp)));
+ ND_PRINT((ndo, ", Timestamp %u ticks", EXTRACT_BE_32BITS(mpcp.common_header->timestamp)));
}
ND_PRINT((ndo, ", length %u", length));
mpcp.grant = (const struct mpcp_grant_t *)tptr;
ND_PRINT((ndo, "\n\tGrant #%u, Start-Time %u ticks, duration %u ticks",
grant,
- EXTRACT_32BITS(mpcp.grant->starttime),
- EXTRACT_16BITS(mpcp.grant->duration)));
+ EXTRACT_BE_32BITS(mpcp.grant->starttime),
+ EXTRACT_BE_16BITS(mpcp.grant->duration)));
tptr += sizeof(struct mpcp_grant_t);
}
ND_TCHECK2(*tptr, MPCP_TIMESTAMP_DURATION_LEN);
- ND_PRINT((ndo, "\n\tSync-Time %u ticks", EXTRACT_16BITS(tptr)));
+ ND_PRINT((ndo, "\n\tSync-Time %u ticks", EXTRACT_BE_16BITS(tptr)));
break;
ND_TCHECK2(*tptr, MPCP_TIMESTAMP_DURATION_LEN);
ND_PRINT((ndo, "\n\t Q%u Report, Duration %u ticks",
report,
- EXTRACT_16BITS(tptr)));
+ EXTRACT_BE_16BITS(tptr)));
tptr+=MPCP_TIMESTAMP_DURATION_LEN;
}
report++;
mpcp.reg = (const struct mpcp_reg_t *)tptr;
ND_PRINT((ndo, "\n\tAssigned-Port %u, Flags [ %s ]" \
"\n\tSync-Time %u ticks, Echoed-Pending-Grants %u",
- EXTRACT_16BITS(mpcp.reg->assigned_port),
+ EXTRACT_BE_16BITS(mpcp.reg->assigned_port),
bittok2str(mpcp_reg_flag_values, "Reserved", mpcp.reg->flags),
- EXTRACT_16BITS(mpcp.reg->sync_time),
+ EXTRACT_BE_16BITS(mpcp.reg->sync_time),
mpcp.reg->echoed_pending_grants));
break;
mpcp.reg_ack = (const struct mpcp_reg_ack_t *)tptr;
ND_PRINT((ndo, "\n\tEchoed-Assigned-Port %u, Flags [ %s ]" \
"\n\tEchoed-Sync-Time %u ticks",
- EXTRACT_16BITS(mpcp.reg_ack->echoed_assigned_port),
+ EXTRACT_BE_16BITS(mpcp.reg_ack->echoed_assigned_port),
bittok2str(mpcp_reg_ack_flag_values, "Reserved", mpcp.reg_ack->flags),
- EXTRACT_16BITS(mpcp.reg_ack->echoed_sync_time)));
+ EXTRACT_BE_16BITS(mpcp.reg_ack->echoed_sync_time)));
break;
default:
ND_PRINT((ndo, "[|MPLS], length %u", length));
return;
}
- label_entry = EXTRACT_32BITS(p);
+ label_entry = EXTRACT_BE_32BITS(p);
ND_PRINT((ndo, "%s(label %u",
(label_stack_depth && ndo->ndo_vflag) ? "\n\t" : " ",
MPLS_LABEL(label_entry)));
if (mpc->flags & MP_CAPABLE_C)
ND_PRINT((ndo, " csum"));
- ND_PRINT((ndo, " {0x%" PRIx64, EXTRACT_64BITS(mpc->sender_key)));
+ ND_PRINT((ndo, " {0x%" PRIx64, EXTRACT_BE_64BITS(mpc->sender_key)));
if (opt_len == 20) /* ACK */
- ND_PRINT((ndo, ",0x%" PRIx64, EXTRACT_64BITS(mpc->receiver_key)));
+ ND_PRINT((ndo, ",0x%" PRIx64, EXTRACT_BE_64BITS(mpc->receiver_key)));
ND_PRINT((ndo, "}"));
return 1;
}
switch (opt_len) {
case 12: /* SYN */
ND_PRINT((ndo, " token 0x%x" " nonce 0x%x",
- EXTRACT_32BITS(mpj->u.syn.token),
- EXTRACT_32BITS(mpj->u.syn.nonce)));
+ EXTRACT_BE_32BITS(mpj->u.syn.token),
+ EXTRACT_BE_32BITS(mpj->u.syn.nonce)));
break;
case 16: /* SYN/ACK */
ND_PRINT((ndo, " hmac 0x%" PRIx64 " nonce 0x%x",
- EXTRACT_64BITS(mpj->u.synack.mac),
- EXTRACT_32BITS(mpj->u.synack.nonce)));
+ EXTRACT_BE_64BITS(mpj->u.synack.mac),
+ EXTRACT_BE_32BITS(mpj->u.synack.nonce)));
break;
case 24: {/* ACK */
size_t i;
if (mdss->flags & MP_DSS_a) {
if (opt_len < 8)
return 0;
- ND_PRINT((ndo, "%" PRIu64, EXTRACT_64BITS(opt)));
+ ND_PRINT((ndo, "%" PRIu64, EXTRACT_BE_64BITS(opt)));
opt += 8;
opt_len -= 8;
} else {
if (opt_len < 4)
return 0;
- ND_PRINT((ndo, "%u", EXTRACT_32BITS(opt)));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(opt)));
opt += 4;
opt_len -= 4;
}
if (mdss->flags & MP_DSS_m) {
if (opt_len < 8)
return 0;
- ND_PRINT((ndo, "%" PRIu64, EXTRACT_64BITS(opt)));
+ ND_PRINT((ndo, "%" PRIu64, EXTRACT_BE_64BITS(opt)));
opt += 8;
opt_len -= 8;
} else {
if (opt_len < 4)
return 0;
- ND_PRINT((ndo, "%u", EXTRACT_32BITS(opt)));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(opt)));
opt += 4;
opt_len -= 4;
}
if (opt_len < 4)
return 0;
- ND_PRINT((ndo, " subseq %u", EXTRACT_32BITS(opt)));
+ ND_PRINT((ndo, " subseq %u", EXTRACT_BE_32BITS(opt)));
opt += 4;
opt_len -= 4;
if (opt_len < 2)
return 0;
- ND_PRINT((ndo, " len %u", EXTRACT_16BITS(opt)));
+ ND_PRINT((ndo, " len %u", EXTRACT_BE_16BITS(opt)));
opt += 2;
opt_len -= 2;
* bytes as the Checksum.
*/
if (opt_len >= 2) {
- ND_PRINT((ndo, " csum 0x%x", EXTRACT_16BITS(opt)));
+ ND_PRINT((ndo, " csum 0x%x", EXTRACT_BE_16BITS(opt)));
opt_len -= 2;
}
}
case 4:
ND_PRINT((ndo, " %s", ipaddr_string(ndo, add_addr->u.v4.addr)));
if (opt_len == 10)
- ND_PRINT((ndo, ":%u", EXTRACT_16BITS(add_addr->u.v4.port)));
+ ND_PRINT((ndo, ":%u", EXTRACT_BE_16BITS(add_addr->u.v4.port)));
break;
case 6:
ND_PRINT((ndo, " %s", ip6addr_string(ndo, add_addr->u.v6.addr)));
if (opt_len == 22)
- ND_PRINT((ndo, ":%u", EXTRACT_16BITS(add_addr->u.v6.port)));
+ ND_PRINT((ndo, ":%u", EXTRACT_BE_16BITS(add_addr->u.v6.port)));
break;
default:
return 0;
if (opt_len != 12)
return 0;
- ND_PRINT((ndo, " seq %" PRIu64, EXTRACT_64BITS(opt + 4)));
+ ND_PRINT((ndo, " seq %" PRIu64, EXTRACT_BE_64BITS(opt + 4)));
return 1;
}
if (opt_len != 12)
return 0;
- ND_PRINT((ndo, " key 0x%" PRIx64, EXTRACT_64BITS(opt + 4)));
+ ND_PRINT((ndo, " key 0x%" PRIx64, EXTRACT_BE_64BITS(opt + 4)));
return 1;
}
ND_TCHECK2(*sp, 3);
/* See if we think we're at the beginning of a compound packet */
type = *sp;
- len = EXTRACT_16BITS(sp + 1);
+ len = EXTRACT_BE_16BITS(sp + 1);
if (len > 1500 || len < 3 || type == 0 || type > MSDP_TYPE_MAX)
goto trunc; /* not really truncated, but still not decodable */
ND_PRINT((ndo, " msdp:"));
while (length > 0) {
ND_TCHECK2(*sp, 3);
type = *sp;
- len = EXTRACT_16BITS(sp + 1);
+ len = EXTRACT_BE_16BITS(sp + 1);
if (len > 1400 || ndo->ndo_vflag)
ND_PRINT((ndo, " [len %u]", len));
if (len < 3)
const uint32_t *dp, struct nfsv3_sattr *sa3)
{
ND_TCHECK(dp[0]);
- sa3->sa_modeset = EXTRACT_32BITS(dp);
+ sa3->sa_modeset = EXTRACT_BE_32BITS(dp);
dp++;
if (sa3->sa_modeset) {
ND_TCHECK(dp[0]);
- sa3->sa_mode = EXTRACT_32BITS(dp);
+ sa3->sa_mode = EXTRACT_BE_32BITS(dp);
dp++;
}
ND_TCHECK(dp[0]);
- sa3->sa_uidset = EXTRACT_32BITS(dp);
+ sa3->sa_uidset = EXTRACT_BE_32BITS(dp);
dp++;
if (sa3->sa_uidset) {
ND_TCHECK(dp[0]);
- sa3->sa_uid = EXTRACT_32BITS(dp);
+ sa3->sa_uid = EXTRACT_BE_32BITS(dp);
dp++;
}
ND_TCHECK(dp[0]);
- sa3->sa_gidset = EXTRACT_32BITS(dp);
+ sa3->sa_gidset = EXTRACT_BE_32BITS(dp);
dp++;
if (sa3->sa_gidset) {
ND_TCHECK(dp[0]);
- sa3->sa_gid = EXTRACT_32BITS(dp);
+ sa3->sa_gid = EXTRACT_BE_32BITS(dp);
dp++;
}
ND_TCHECK(dp[0]);
- sa3->sa_sizeset = EXTRACT_32BITS(dp);
+ sa3->sa_sizeset = EXTRACT_BE_32BITS(dp);
dp++;
if (sa3->sa_sizeset) {
ND_TCHECK(dp[0]);
- sa3->sa_size = EXTRACT_32BITS(dp);
+ sa3->sa_size = EXTRACT_BE_32BITS(dp);
dp++;
}
ND_TCHECK(dp[0]);
- sa3->sa_atimetype = EXTRACT_32BITS(dp);
+ sa3->sa_atimetype = EXTRACT_BE_32BITS(dp);
dp++;
if (sa3->sa_atimetype == NFSV3SATTRTIME_TOCLIENT) {
ND_TCHECK(dp[1]);
- sa3->sa_atime.nfsv3_sec = EXTRACT_32BITS(dp);
+ sa3->sa_atime.nfsv3_sec = EXTRACT_BE_32BITS(dp);
dp++;
- sa3->sa_atime.nfsv3_nsec = EXTRACT_32BITS(dp);
+ sa3->sa_atime.nfsv3_nsec = EXTRACT_BE_32BITS(dp);
dp++;
}
ND_TCHECK(dp[0]);
- sa3->sa_mtimetype = EXTRACT_32BITS(dp);
+ sa3->sa_mtimetype = EXTRACT_BE_32BITS(dp);
dp++;
if (sa3->sa_mtimetype == NFSV3SATTRTIME_TOCLIENT) {
ND_TCHECK(dp[1]);
- sa3->sa_mtime.nfsv3_sec = EXTRACT_32BITS(dp);
+ sa3->sa_mtime.nfsv3_sec = EXTRACT_BE_32BITS(dp);
dp++;
- sa3->sa_mtime.nfsv3_nsec = EXTRACT_32BITS(dp);
+ sa3->sa_mtime.nfsv3_nsec = EXTRACT_BE_32BITS(dp);
dp++;
}
if (!ndo->ndo_nflag) {
strlcpy(srcid, "nfs", sizeof(srcid));
snprintf(dstid, sizeof(dstid), "%u",
- EXTRACT_32BITS(&rp->rm_xid));
+ EXTRACT_BE_32BITS(&rp->rm_xid));
} else {
snprintf(srcid, sizeof(srcid), "%u", NFS_PORT);
snprintf(dstid, sizeof(dstid), "%u",
- EXTRACT_32BITS(&rp->rm_xid));
+ EXTRACT_BE_32BITS(&rp->rm_xid));
}
print_nfsaddr(ndo, bp2, srcid, dstid);
rp = (const struct sunrpc_msg *)bp;
ND_TCHECK(rp->rm_reply.rp_stat);
- reply_stat = EXTRACT_32BITS(&rp->rm_reply.rp_stat);
+ reply_stat = EXTRACT_BE_32BITS(&rp->rm_reply.rp_stat);
switch (reply_stat) {
case SUNRPC_MSG_ACCEPTED:
case SUNRPC_MSG_DENIED:
ND_PRINT((ndo, "reply ERR %u: ", length));
ND_TCHECK(rp->rm_reply.rp_reject.rj_stat);
- rstat = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_stat);
+ rstat = EXTRACT_BE_32BITS(&rp->rm_reply.rp_reject.rj_stat);
switch (rstat) {
case SUNRPC_RPC_MISMATCH:
ND_TCHECK(rp->rm_reply.rp_reject.rj_vers.high);
- rlow = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_vers.low);
- rhigh = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_vers.high);
+ rlow = EXTRACT_BE_32BITS(&rp->rm_reply.rp_reject.rj_vers.low);
+ rhigh = EXTRACT_BE_32BITS(&rp->rm_reply.rp_reject.rj_vers.high);
ND_PRINT((ndo, "RPC Version mismatch (%u-%u)", rlow, rhigh));
break;
case SUNRPC_AUTH_ERROR:
ND_TCHECK(rp->rm_reply.rp_reject.rj_why);
- rwhy = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_why);
+ rwhy = EXTRACT_BE_32BITS(&rp->rm_reply.rp_reject.rj_why);
ND_PRINT((ndo, "Auth %s", tok2str(sunrpc_auth_str, "Invalid failure code %u", rwhy)));
break;
*/
dp = (const uint32_t *)&rp->rm_call.cb_cred;
ND_TCHECK(dp[1]);
- len = EXTRACT_32BITS(&dp[1]);
+ len = EXTRACT_BE_32BITS(&dp[1]);
if (len < length) {
dp += (len + (2 * sizeof(*dp) + 3)) / sizeof(*dp);
ND_TCHECK(dp[1]);
- len = EXTRACT_32BITS(&dp[1]);
+ len = EXTRACT_BE_32BITS(&dp[1]);
if (len < length) {
dp += (len + (2 * sizeof(*dp) + 3)) / sizeof(*dp);
ND_TCHECK2(dp[0], 0);
if (v3) {
ND_TCHECK(dp[0]);
- len = EXTRACT_32BITS(dp) / 4;
+ len = EXTRACT_BE_32BITS(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_32BITS(&rp->rm_call.cb_vers) == NFS_VER3);
- proc = EXTRACT_32BITS(&rp->rm_call.cb_proc);
+ v3 = (EXTRACT_BE_32BITS(&rp->rm_call.cb_vers) == NFS_VER3);
+ proc = EXTRACT_BE_32BITS(&rp->rm_call.cb_proc);
if (!v3 && proc < NFS_NPROCS)
proc = nfsv3_procid[proc];
if ((dp = parsereq(ndo, rp, length)) != NULL &&
(dp = parsefh(ndo, dp, v3)) != NULL) {
ND_TCHECK(dp[0]);
- access_flags = EXTRACT_32BITS(&dp[0]);
+ access_flags = EXTRACT_BE_32BITS(&dp[0]);
if (access_flags & ~NFSV3ACCESS_FULL) {
/* NFSV3ACCESS definitions aren't up to date */
ND_PRINT((ndo, " %04x", access_flags));
if (v3) {
ND_TCHECK(dp[2]);
ND_PRINT((ndo, " %u bytes @ %" PRIu64,
- EXTRACT_32BITS(&dp[2]),
- EXTRACT_64BITS(&dp[0])));
+ EXTRACT_BE_32BITS(&dp[2]),
+ EXTRACT_BE_64BITS(&dp[0])));
} else {
ND_TCHECK(dp[1]);
ND_PRINT((ndo, " %u bytes @ %u",
- EXTRACT_32BITS(&dp[1]),
- EXTRACT_32BITS(&dp[0])));
+ EXTRACT_BE_32BITS(&dp[1]),
+ EXTRACT_BE_32BITS(&dp[0])));
}
return;
}
if (v3) {
ND_TCHECK(dp[4]);
ND_PRINT((ndo, " %u (%u) bytes @ %" PRIu64,
- EXTRACT_32BITS(&dp[4]),
- EXTRACT_32BITS(&dp[2]),
- EXTRACT_64BITS(&dp[0])));
+ EXTRACT_BE_32BITS(&dp[4]),
+ EXTRACT_BE_32BITS(&dp[2]),
+ EXTRACT_BE_64BITS(&dp[0])));
if (ndo->ndo_vflag) {
ND_PRINT((ndo, " <%s>",
tok2str(nfsv3_writemodes,
- NULL, EXTRACT_32BITS(&dp[3]))));
+ NULL, EXTRACT_BE_32BITS(&dp[3]))));
}
} else {
ND_TCHECK(dp[3]);
ND_PRINT((ndo, " %u (%u) bytes @ %u (%u)",
- EXTRACT_32BITS(&dp[3]),
- EXTRACT_32BITS(&dp[2]),
- EXTRACT_32BITS(&dp[1]),
- EXTRACT_32BITS(&dp[0])));
+ EXTRACT_BE_32BITS(&dp[3]),
+ EXTRACT_BE_32BITS(&dp[2]),
+ EXTRACT_BE_32BITS(&dp[1]),
+ EXTRACT_BE_32BITS(&dp[0])));
}
return;
}
if ((dp = parsereq(ndo, rp, length)) != NULL &&
(dp = parsefhn(ndo, dp, v3)) != NULL) {
ND_TCHECK(*dp);
- type = (nfs_type)EXTRACT_32BITS(dp);
+ type = (nfs_type) EXTRACT_BE_32BITS(dp);
dp++;
if ((dp = parse_sattr3(ndo, dp, &sa3)) == NULL)
break;
if (ndo->ndo_vflag && (type == NFCHR || type == NFBLK)) {
ND_TCHECK(dp[1]);
ND_PRINT((ndo, " %u/%u",
- EXTRACT_32BITS(&dp[0]),
- EXTRACT_32BITS(&dp[1])));
+ EXTRACT_BE_32BITS(&dp[0]),
+ EXTRACT_BE_32BITS(&dp[1])));
dp += 2;
}
if (ndo->ndo_vflag)
* offset cookie here.
*/
ND_PRINT((ndo, " %u bytes @ %" PRId64,
- EXTRACT_32BITS(&dp[4]),
- EXTRACT_64BITS(&dp[0])));
+ EXTRACT_BE_32BITS(&dp[4]),
+ EXTRACT_BE_64BITS(&dp[0])));
if (ndo->ndo_vflag)
ND_PRINT((ndo, " verf %08x%08x", dp[2], dp[3]));
} else {
* common, but offsets > 2^31 aren't.
*/
ND_PRINT((ndo, " %u bytes @ %d",
- EXTRACT_32BITS(&dp[1]),
- EXTRACT_32BITS(&dp[0])));
+ EXTRACT_BE_32BITS(&dp[1]),
+ EXTRACT_BE_32BITS(&dp[0])));
}
return;
}
* cookie here.
*/
ND_PRINT((ndo, " %u bytes @ %" PRId64,
- EXTRACT_32BITS(&dp[4]),
- EXTRACT_64BITS(&dp[0])));
+ EXTRACT_BE_32BITS(&dp[4]),
+ EXTRACT_BE_64BITS(&dp[0])));
if (ndo->ndo_vflag) {
ND_TCHECK(dp[5]);
ND_PRINT((ndo, " max %u verf %08x%08x",
- EXTRACT_32BITS(&dp[5]), dp[2], dp[3]));
+ EXTRACT_BE_32BITS(&dp[5]), dp[2], dp[3]));
}
return;
}
(dp = parsefh(ndo, dp, v3)) != NULL) {
ND_TCHECK(dp[2]);
ND_PRINT((ndo, " %u bytes @ %" PRIu64,
- EXTRACT_32BITS(&dp[2]),
- EXTRACT_64BITS(&dp[0])));
+ EXTRACT_BE_32BITS(&dp[2]),
+ EXTRACT_BE_64BITS(&dp[0])));
return;
}
break;
UNALIGNED_MEMCPY(&xmep->client, &ip6->ip6_src, sizeof(ip6->ip6_src));
UNALIGNED_MEMCPY(&xmep->server, &ip6->ip6_dst, sizeof(ip6->ip6_dst));
}
- xmep->proc = EXTRACT_32BITS(&rp->rm_call.cb_proc);
- xmep->vers = EXTRACT_32BITS(&rp->rm_call.cb_vers);
+ xmep->proc = EXTRACT_BE_32BITS(&rp->rm_call.cb_proc);
+ xmep->vers = EXTRACT_BE_32BITS(&rp->rm_call.cb_vers);
return (1);
}
*/
dp = ((const uint32_t *)&rp->rm_reply) + 1;
ND_TCHECK(dp[1]);
- len = EXTRACT_32BITS(&dp[1]);
+ len = EXTRACT_BE_32BITS(&dp[1]);
if (len >= length)
return (NULL);
/*
* now we can check the ar_stat field
*/
ND_TCHECK(dp[0]);
- astat = (enum sunrpc_accept_stat) EXTRACT_32BITS(dp);
+ astat = (enum sunrpc_accept_stat) EXTRACT_BE_32BITS(dp);
if (astat != SUNRPC_SUCCESS) {
ND_PRINT((ndo, " %s", tok2str(sunrpc_str, "ar_stat %d", astat)));
nfserr = 1; /* suppress trunc string */
ND_TCHECK(dp[0]);
- errnum = EXTRACT_32BITS(&dp[0]);
+ errnum = EXTRACT_BE_32BITS(&dp[0]);
if (er)
*er = errnum;
if (errnum != 0) {
if (verbose) {
ND_PRINT((ndo, " %s %o ids %d/%d",
tok2str(type2str, "unk-ft %d ",
- EXTRACT_32BITS(&fap->fa_type)),
- EXTRACT_32BITS(&fap->fa_mode),
- EXTRACT_32BITS(&fap->fa_uid),
- EXTRACT_32BITS(&fap->fa_gid)));
+ EXTRACT_BE_32BITS(&fap->fa_type)),
+ EXTRACT_BE_32BITS(&fap->fa_mode),
+ EXTRACT_BE_32BITS(&fap->fa_uid),
+ EXTRACT_BE_32BITS(&fap->fa_gid)));
if (v3) {
ND_TCHECK(fap->fa3_size);
ND_PRINT((ndo, " sz %" PRIu64,
- EXTRACT_64BITS((const uint32_t *)&fap->fa3_size)));
+ EXTRACT_BE_64BITS((const uint32_t *)&fap->fa3_size)));
} else {
ND_TCHECK(fap->fa2_size);
- ND_PRINT((ndo, " sz %d", EXTRACT_32BITS(&fap->fa2_size)));
+ ND_PRINT((ndo, " sz %d", EXTRACT_BE_32BITS(&fap->fa2_size)));
}
}
/* print lots more stuff */
if (v3) {
ND_TCHECK(fap->fa3_ctime);
ND_PRINT((ndo, " nlink %d rdev %d/%d",
- EXTRACT_32BITS(&fap->fa_nlink),
- EXTRACT_32BITS(&fap->fa3_rdev.specdata1),
- EXTRACT_32BITS(&fap->fa3_rdev.specdata2)));
+ EXTRACT_BE_32BITS(&fap->fa_nlink),
+ EXTRACT_BE_32BITS(&fap->fa3_rdev.specdata1),
+ EXTRACT_BE_32BITS(&fap->fa3_rdev.specdata2)));
ND_PRINT((ndo, " fsid %" PRIx64,
- EXTRACT_64BITS((const uint32_t *)&fap->fa3_fsid)));
+ EXTRACT_BE_64BITS((const uint32_t *)&fap->fa3_fsid)));
ND_PRINT((ndo, " fileid %" PRIx64,
- EXTRACT_64BITS((const uint32_t *)&fap->fa3_fileid)));
+ EXTRACT_BE_64BITS((const uint32_t *)&fap->fa3_fileid)));
ND_PRINT((ndo, " a/m/ctime %u.%06u",
- EXTRACT_32BITS(&fap->fa3_atime.nfsv3_sec),
- EXTRACT_32BITS(&fap->fa3_atime.nfsv3_nsec)));
+ EXTRACT_BE_32BITS(&fap->fa3_atime.nfsv3_sec),
+ EXTRACT_BE_32BITS(&fap->fa3_atime.nfsv3_nsec)));
ND_PRINT((ndo, " %u.%06u",
- EXTRACT_32BITS(&fap->fa3_mtime.nfsv3_sec),
- EXTRACT_32BITS(&fap->fa3_mtime.nfsv3_nsec)));
+ EXTRACT_BE_32BITS(&fap->fa3_mtime.nfsv3_sec),
+ EXTRACT_BE_32BITS(&fap->fa3_mtime.nfsv3_nsec)));
ND_PRINT((ndo, " %u.%06u",
- EXTRACT_32BITS(&fap->fa3_ctime.nfsv3_sec),
- EXTRACT_32BITS(&fap->fa3_ctime.nfsv3_nsec)));
+ EXTRACT_BE_32BITS(&fap->fa3_ctime.nfsv3_sec),
+ EXTRACT_BE_32BITS(&fap->fa3_ctime.nfsv3_nsec)));
} else {
ND_TCHECK(fap->fa2_ctime);
ND_PRINT((ndo, " nlink %d rdev 0x%x fsid 0x%x nodeid 0x%x a/m/ctime",
- EXTRACT_32BITS(&fap->fa_nlink),
- EXTRACT_32BITS(&fap->fa2_rdev),
- EXTRACT_32BITS(&fap->fa2_fsid),
- EXTRACT_32BITS(&fap->fa2_fileid)));
+ EXTRACT_BE_32BITS(&fap->fa_nlink),
+ EXTRACT_BE_32BITS(&fap->fa2_rdev),
+ EXTRACT_BE_32BITS(&fap->fa2_fsid),
+ EXTRACT_BE_32BITS(&fap->fa2_fileid)));
ND_PRINT((ndo, " %u.%06u",
- EXTRACT_32BITS(&fap->fa2_atime.nfsv2_sec),
- EXTRACT_32BITS(&fap->fa2_atime.nfsv2_usec)));
+ EXTRACT_BE_32BITS(&fap->fa2_atime.nfsv2_sec),
+ EXTRACT_BE_32BITS(&fap->fa2_atime.nfsv2_usec)));
ND_PRINT((ndo, " %u.%06u",
- EXTRACT_32BITS(&fap->fa2_mtime.nfsv2_sec),
- EXTRACT_32BITS(&fap->fa2_mtime.nfsv2_usec)));
+ EXTRACT_BE_32BITS(&fap->fa2_mtime.nfsv2_sec),
+ EXTRACT_BE_32BITS(&fap->fa2_mtime.nfsv2_usec)));
ND_PRINT((ndo, " %u.%06u",
- EXTRACT_32BITS(&fap->fa2_ctime.nfsv2_sec),
- EXTRACT_32BITS(&fap->fa2_ctime.nfsv2_usec)));
+ EXTRACT_BE_32BITS(&fap->fa2_ctime.nfsv2_sec),
+ EXTRACT_BE_32BITS(&fap->fa2_ctime.nfsv2_usec)));
}
}
return ((const uint32_t *)((const unsigned char *)dp +
if (v3) {
ND_PRINT((ndo, " tbytes %" PRIu64 " fbytes %" PRIu64 " abytes %" PRIu64,
- EXTRACT_64BITS((const uint32_t *)&sfsp->sf_tbytes),
- EXTRACT_64BITS((const uint32_t *)&sfsp->sf_fbytes),
- EXTRACT_64BITS((const uint32_t *)&sfsp->sf_abytes)));
+ EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_tbytes),
+ EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_fbytes),
+ EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_abytes)));
if (ndo->ndo_vflag) {
ND_PRINT((ndo, " tfiles %" PRIu64 " ffiles %" PRIu64 " afiles %" PRIu64 " invar %u",
- EXTRACT_64BITS((const uint32_t *)&sfsp->sf_tfiles),
- EXTRACT_64BITS((const uint32_t *)&sfsp->sf_ffiles),
- EXTRACT_64BITS((const uint32_t *)&sfsp->sf_afiles),
- EXTRACT_32BITS(&sfsp->sf_invarsec)));
+ EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_tfiles),
+ EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_ffiles),
+ EXTRACT_BE_64BITS((const uint32_t *)&sfsp->sf_afiles),
+ EXTRACT_BE_32BITS(&sfsp->sf_invarsec)));
}
} else {
ND_PRINT((ndo, " tsize %d bsize %d blocks %d bfree %d bavail %d",
- EXTRACT_32BITS(&sfsp->sf_tsize),
- EXTRACT_32BITS(&sfsp->sf_bsize),
- EXTRACT_32BITS(&sfsp->sf_blocks),
- EXTRACT_32BITS(&sfsp->sf_bfree),
- EXTRACT_32BITS(&sfsp->sf_bavail)));
+ EXTRACT_BE_32BITS(&sfsp->sf_tsize),
+ EXTRACT_BE_32BITS(&sfsp->sf_bsize),
+ EXTRACT_BE_32BITS(&sfsp->sf_blocks),
+ EXTRACT_BE_32BITS(&sfsp->sf_bfree),
+ EXTRACT_BE_32BITS(&sfsp->sf_bavail)));
}
return (1);
ND_TCHECK(dp[2]);
ND_PRINT((ndo, " offset 0x%x size %d ",
- EXTRACT_32BITS(&dp[0]), EXTRACT_32BITS(&dp[1])));
+ EXTRACT_BE_32BITS(&dp[0]), EXTRACT_BE_32BITS(&dp[1])));
if (dp[2] != 0)
ND_PRINT((ndo, " eof"));
const uint32_t *dp)
{
/* Our caller has already checked this */
- ND_PRINT((ndo, " sz %" PRIu64, EXTRACT_64BITS(&dp[0])));
+ ND_PRINT((ndo, " sz %" PRIu64, EXTRACT_BE_64BITS(&dp[0])));
ND_PRINT((ndo, " mtime %u.%06u ctime %u.%06u",
- EXTRACT_32BITS(&dp[2]), EXTRACT_32BITS(&dp[3]),
- EXTRACT_32BITS(&dp[4]), EXTRACT_32BITS(&dp[5])));
+ EXTRACT_BE_32BITS(&dp[2]), EXTRACT_BE_32BITS(&dp[3]),
+ EXTRACT_BE_32BITS(&dp[4]), EXTRACT_BE_32BITS(&dp[5])));
return (dp + 6);
}
const uint32_t *dp, int verbose)
{
ND_TCHECK(dp[0]);
- if (!EXTRACT_32BITS(&dp[0]))
+ if (!EXTRACT_BE_32BITS(&dp[0]))
return (dp + 1);
dp++;
ND_TCHECK2(*dp, 24);
const uint32_t *dp, int verbose)
{
ND_TCHECK(dp[0]);
- if (!EXTRACT_32BITS(&dp[0]))
+ if (!EXTRACT_BE_32BITS(&dp[0]))
return (dp + 1);
dp++;
if (verbose) {
dp = parse_wcc_data(ndo, dp, verbose);
else {
ND_TCHECK(dp[0]);
- if (!EXTRACT_32BITS(&dp[0]))
+ if (!EXTRACT_BE_32BITS(&dp[0]))
return (dp + 1);
dp++;
if (!(dp = parsefh(ndo, dp, 1)))
sfp = (const struct nfsv3_fsinfo *)dp;
ND_TCHECK(*sfp);
ND_PRINT((ndo, " rtmax %u rtpref %u wtmax %u wtpref %u dtpref %u",
- EXTRACT_32BITS(&sfp->fs_rtmax),
- EXTRACT_32BITS(&sfp->fs_rtpref),
- EXTRACT_32BITS(&sfp->fs_wtmax),
- EXTRACT_32BITS(&sfp->fs_wtpref),
- EXTRACT_32BITS(&sfp->fs_dtpref)));
+ EXTRACT_BE_32BITS(&sfp->fs_rtmax),
+ EXTRACT_BE_32BITS(&sfp->fs_rtpref),
+ EXTRACT_BE_32BITS(&sfp->fs_wtmax),
+ EXTRACT_BE_32BITS(&sfp->fs_wtpref),
+ EXTRACT_BE_32BITS(&sfp->fs_dtpref)));
if (ndo->ndo_vflag) {
ND_PRINT((ndo, " rtmult %u wtmult %u maxfsz %" PRIu64,
- EXTRACT_32BITS(&sfp->fs_rtmult),
- EXTRACT_32BITS(&sfp->fs_wtmult),
- EXTRACT_64BITS((const uint32_t *)&sfp->fs_maxfilesize)));
+ EXTRACT_BE_32BITS(&sfp->fs_rtmult),
+ EXTRACT_BE_32BITS(&sfp->fs_wtmult),
+ EXTRACT_BE_64BITS((const uint32_t *)&sfp->fs_maxfilesize)));
ND_PRINT((ndo, " delta %u.%06u ",
- EXTRACT_32BITS(&sfp->fs_timedelta.nfsv3_sec),
- EXTRACT_32BITS(&sfp->fs_timedelta.nfsv3_nsec)));
+ EXTRACT_BE_32BITS(&sfp->fs_timedelta.nfsv3_sec),
+ EXTRACT_BE_32BITS(&sfp->fs_timedelta.nfsv3_nsec)));
}
return (1);
trunc:
ND_TCHECK(*spp);
ND_PRINT((ndo, " linkmax %u namemax %u %s %s %s %s",
- EXTRACT_32BITS(&spp->pc_linkmax),
- EXTRACT_32BITS(&spp->pc_namemax),
- EXTRACT_32BITS(&spp->pc_notrunc) ? "notrunc" : "",
- EXTRACT_32BITS(&spp->pc_chownrestricted) ? "chownres" : "",
- EXTRACT_32BITS(&spp->pc_caseinsensitive) ? "igncase" : "",
- EXTRACT_32BITS(&spp->pc_casepreserving) ? "keepcase" : ""));
+ EXTRACT_BE_32BITS(&spp->pc_linkmax),
+ EXTRACT_BE_32BITS(&spp->pc_namemax),
+ EXTRACT_BE_32BITS(&spp->pc_notrunc) ? "notrunc" : "",
+ EXTRACT_BE_32BITS(&spp->pc_chownrestricted) ? "chownres" : "",
+ EXTRACT_BE_32BITS(&spp->pc_caseinsensitive) ? "igncase" : "",
+ EXTRACT_BE_32BITS(&spp->pc_casepreserving) ? "keepcase" : ""));
return (1);
trunc:
return (0);
break;
if (!er) {
ND_TCHECK(dp[0]);
- ND_PRINT((ndo, " c %04x", EXTRACT_32BITS(&dp[0])));
+ ND_PRINT((ndo, " c %04x", EXTRACT_BE_32BITS(&dp[0])));
}
return;
return;
if (ndo->ndo_vflag) {
ND_TCHECK(dp[1]);
- ND_PRINT((ndo, " %u bytes", EXTRACT_32BITS(&dp[0])));
- if (EXTRACT_32BITS(&dp[1]))
+ ND_PRINT((ndo, " %u bytes", EXTRACT_BE_32BITS(&dp[0])));
+ if (EXTRACT_BE_32BITS(&dp[1]))
ND_PRINT((ndo, " EOF"));
}
return;
return;
if (ndo->ndo_vflag) {
ND_TCHECK(dp[0]);
- ND_PRINT((ndo, " %u bytes", EXTRACT_32BITS(&dp[0])));
+ ND_PRINT((ndo, " %u bytes", EXTRACT_BE_32BITS(&dp[0])));
if (ndo->ndo_vflag > 1) {
ND_TCHECK(dp[1]);
ND_PRINT((ndo, " <%s>",
tok2str(nfsv3_writemodes,
- NULL, EXTRACT_32BITS(&dp[1]))));
+ NULL, EXTRACT_BE_32BITS(&dp[1]))));
}
return;
}
bp += 1;
next_protocol = *bp;
bp += 1;
- service_path_id = EXTRACT_24BITS(bp);
+ service_path_id = EXTRACT_BE_24BITS(bp);
bp += 3;
service_index = *bp;
bp += 1;
if (ndo->ndo_vflag > 2) {
if (md_type == 0x01) {
for (n = 0; n < length - 2; n++) {
- ctx = EXTRACT_32BITS(bp);
+ ctx = EXTRACT_BE_32BITS(bp);
bp += NSH_HDR_WORD_SIZE;
ND_PRINT((ndo, "\n Context[%02d]: 0x%08x", n, ctx));
}
else if (md_type == 0x02) {
n = 0;
while (n < length - 2) {
- tlv_class = EXTRACT_16BITS(bp);
+ tlv_class = EXTRACT_BE_16BITS(bp);
bp += 2;
tlv_type = *bp;
bp += 1;
}
for (vn = 0; vn < tlv_len; vn++) {
- ctx = EXTRACT_32BITS(bp);
+ ctx = EXTRACT_BE_32BITS(bp);
bp += NSH_HDR_WORD_SIZE;
ND_PRINT((ndo, "\n Value[%02d]: 0x%08x", vn, ctx));
}
default:
/* In NTPv4 (RFC 5905) refid is an IPv4 address or first 32 bits of
MD5 sum of IPv6 address */
- ND_PRINT((ndo, "0x%08x", EXTRACT_32BITS(&bp->refid)));
+ ND_PRINT((ndo, "0x%08x", EXTRACT_BE_32BITS(&bp->refid)));
break;
}
/* FIXME: this code is not aware of any extension fields */
if (length == NTP_TIMEMSG_MINLEN + 4) { /* Optional: key-id (crypto-NAK) */
ND_TCHECK(bp->key_id);
- ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_32BITS(&bp->key_id)));
+ ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_32BITS(&bp->key_id)));
} else if (length == NTP_TIMEMSG_MINLEN + 4 + 16) { /* Optional: key-id + 128-bit digest */
ND_TCHECK(bp->key_id);
- ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_32BITS(&bp->key_id)));
+ ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_32BITS(&bp->key_id)));
ND_TCHECK2(bp->message_digest, 16);
ND_PRINT((ndo, "\n\tAuthentication: %08x%08x%08x%08x",
- EXTRACT_32BITS(bp->message_digest),
- EXTRACT_32BITS(bp->message_digest + 4),
- EXTRACT_32BITS(bp->message_digest + 8),
- EXTRACT_32BITS(bp->message_digest + 12)));
+ EXTRACT_BE_32BITS(bp->message_digest),
+ EXTRACT_BE_32BITS(bp->message_digest + 4),
+ EXTRACT_BE_32BITS(bp->message_digest + 8),
+ EXTRACT_BE_32BITS(bp->message_digest + 12)));
} else if (length == NTP_TIMEMSG_MINLEN + 4 + 20) { /* Optional: key-id + 160-bit digest */
ND_TCHECK(bp->key_id);
- ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_32BITS(&bp->key_id)));
+ ND_PRINT((ndo, "\n\tKey id: %u", EXTRACT_BE_32BITS(&bp->key_id)));
ND_TCHECK2(bp->message_digest, 20);
ND_PRINT((ndo, "\n\tAuthentication: %08x%08x%08x%08x%08x",
- EXTRACT_32BITS(bp->message_digest),
- EXTRACT_32BITS(bp->message_digest + 4),
- EXTRACT_32BITS(bp->message_digest + 8),
- EXTRACT_32BITS(bp->message_digest + 12),
- EXTRACT_32BITS(bp->message_digest + 16)));
+ EXTRACT_BE_32BITS(bp->message_digest),
+ EXTRACT_BE_32BITS(bp->message_digest + 4),
+ EXTRACT_BE_32BITS(bp->message_digest + 8),
+ EXTRACT_BE_32BITS(bp->message_digest + 12),
+ EXTRACT_BE_32BITS(bp->message_digest + 16)));
} else if (length > NTP_TIMEMSG_MINLEN) {
ND_PRINT((ndo, "\n\t(%u more bytes after the header)", length - NTP_TIMEMSG_MINLEN));
}
M ? "More" : "Last", (unsigned)opcode));
ND_TCHECK(cd->sequence);
- sequence = EXTRACT_16BITS(&cd->sequence);
+ sequence = EXTRACT_BE_16BITS(&cd->sequence);
ND_PRINT((ndo, "\tSequence=%hu", sequence));
ND_TCHECK(cd->status);
- status = EXTRACT_16BITS(&cd->status);
+ status = EXTRACT_BE_16BITS(&cd->status);
ND_PRINT((ndo, ", Status=%#hx", status));
ND_TCHECK(cd->assoc);
- assoc = EXTRACT_16BITS(&cd->assoc);
+ assoc = EXTRACT_BE_16BITS(&cd->assoc);
ND_PRINT((ndo, ", Assoc.=%hu", assoc));
ND_TCHECK(cd->offset);
- offset = EXTRACT_16BITS(&cd->offset);
+ offset = EXTRACT_BE_16BITS(&cd->offset);
ND_PRINT((ndo, ", Offset=%hu", offset));
ND_TCHECK(cd->count);
- count = EXTRACT_16BITS(&cd->count);
+ count = EXTRACT_BE_16BITS(&cd->count);
ND_PRINT((ndo, ", Count=%hu", count));
if (NTP_CTRLMSG_MINLEN + count > length)
register int f;
register double ff;
- i = EXTRACT_16BITS(&sfp->int_part);
- f = EXTRACT_16BITS(&sfp->fraction);
+ i = EXTRACT_BE_16BITS(&sfp->int_part);
+ f = EXTRACT_BE_16BITS(&sfp->fraction);
ff = f / 65536.0; /* shift radix point by 16 bits */
f = (int)(ff * 1000000.0); /* Treat fraction as parts per million */
ND_PRINT((ndo, "%d.%06d", i, f));
register uint32_t f;
register double ff;
- i = EXTRACT_32BITS(&lfp->int_part);
- uf = EXTRACT_32BITS(&lfp->fraction);
+ i = EXTRACT_BE_32BITS(&lfp->int_part);
+ uf = EXTRACT_BE_32BITS(&lfp->fraction);
ff = uf;
if (ff < 0.0) /* some compilers are buggy */
ff += FMAXINT;
register double ff;
int signbit;
- u = EXTRACT_32BITS(&lfp->int_part);
- ou = EXTRACT_32BITS(&olfp->int_part);
- uf = EXTRACT_32BITS(&lfp->fraction);
- ouf = EXTRACT_32BITS(&olfp->fraction);
+ u = EXTRACT_BE_32BITS(&lfp->int_part);
+ ou = EXTRACT_BE_32BITS(&olfp->int_part);
+ uf = EXTRACT_BE_32BITS(&lfp->fraction);
+ ouf = EXTRACT_BE_32BITS(&olfp->fraction);
if (ou == 0 && ouf == 0) {
p_ntp_time(ndo, lfp);
return;
ND_TCHECK2(*tptr, sizeof(struct olsr_common));
ptr.common = (const struct olsr_common *)tptr;
- length = min(length, EXTRACT_16BITS(ptr.common->packet_len));
+ length = min(length, EXTRACT_BE_16BITS(ptr.common->packet_len));
ND_PRINT((ndo, "OLSRv%i, seq 0x%04x, length %u",
(is_ipv6 == 0) ? 4 : 6,
- EXTRACT_16BITS(ptr.common->packet_seq),
+ EXTRACT_BE_16BITS(ptr.common->packet_seq),
length));
tptr += sizeof(struct olsr_common);
ND_TCHECK2(*tptr, sizeof(struct olsr_msg6));
msgptr.v6 = (const struct olsr_msg6 *) tptr;
msg_type = msgptr.v6->msg_type;
- msg_len = EXTRACT_16BITS(msgptr.v6->msg_len);
+ msg_len = EXTRACT_BE_16BITS(msgptr.v6->msg_len);
if ((msg_len >= sizeof (struct olsr_msg6))
&& (msg_len <= length))
msg_len_valid = 1;
msgptr.v6->ttl,
msgptr.v6->hopcount,
ME_TO_DOUBLE(msgptr.v6->vtime),
- EXTRACT_16BITS(msgptr.v6->msg_seq),
+ EXTRACT_BE_16BITS(msgptr.v6->msg_seq),
msg_len, (msg_len_valid == 0) ? " (invalid)" : ""));
if (!msg_len_valid) {
return;
ND_TCHECK2(*tptr, sizeof(struct olsr_msg4));
msgptr.v4 = (const struct olsr_msg4 *) tptr;
msg_type = msgptr.v4->msg_type;
- msg_len = EXTRACT_16BITS(msgptr.v4->msg_len);
+ msg_len = EXTRACT_BE_16BITS(msgptr.v4->msg_len);
if ((msg_len >= sizeof (struct olsr_msg4))
&& (msg_len <= length))
msg_len_valid = 1;
msgptr.v4->ttl,
msgptr.v4->hopcount,
ME_TO_DOUBLE(msgptr.v4->vtime),
- EXTRACT_16BITS(msgptr.v4->msg_seq),
+ EXTRACT_BE_16BITS(msgptr.v4->msg_seq),
msg_len, (msg_len_valid == 0) ? " (invalid)" : ""));
if (!msg_len_valid) {
return;
ptr.hello_link = (const struct olsr_hello_link *)msg_data;
- hello_len = EXTRACT_16BITS(ptr.hello_link->len);
+ hello_len = EXTRACT_BE_16BITS(ptr.hello_link->len);
link_type = OLSR_EXTRACT_LINK_TYPE(ptr.hello_link->link_code);
neighbor_type = OLSR_EXTRACT_NEIGHBOR_TYPE(ptr.hello_link->link_code);
ptr.tc = (const struct olsr_tc *)msg_data;
ND_PRINT((ndo, "\n\t advertised neighbor seq 0x%04x",
- EXTRACT_16BITS(ptr.tc->ans_seq)));
+ EXTRACT_BE_16BITS(ptr.tc->ans_seq)));
msg_data += sizeof(struct olsr_tc);
msg_tlen -= sizeof(struct olsr_tc);
ND_PRINT((ndo, "%s%s/%u",
col == 0 ? "\n\t " : ", ",
ipaddr_string(ndo, ptr.hna->network),
- mask2plen(EXTRACT_32BITS(ptr.hna->mask))));
+ mask2plen(EXTRACT_BE_32BITS(ptr.hna->mask))));
}
msg_data += sizeof(struct olsr_hna4);
goto trunc;
ND_TCHECK2(*msg_data, 4);
- name_entries = EXTRACT_16BITS(msg_data+2);
+ name_entries = EXTRACT_BE_16BITS(msg_data + 2);
addr_size = 4;
if (is_ipv6)
addr_size = 16;
name_entries_valid = 1;
ND_PRINT((ndo, "\n\t Version %u, Entries %u%s",
- EXTRACT_16BITS(msg_data),
+ EXTRACT_BE_16BITS(msg_data),
name_entries, (name_entries_valid == 0) ? " (invalid)" : ""));
if (name_entries_valid == 0)
break;
ND_TCHECK2(*msg_data, 4);
- name_entry_type = EXTRACT_16BITS(msg_data);
- name_entry_len = EXTRACT_16BITS(msg_data+2);
+ name_entry_type = EXTRACT_BE_16BITS(msg_data);
+ name_entry_len = EXTRACT_BE_16BITS(msg_data + 2);
msg_data += 4;
msg_tlen -= 4;
goto invalid;
/* subtype */
ND_TCHECK2(*cp, 4);
- subtype = EXTRACT_32BITS(cp);
+ subtype = EXTRACT_BE_32BITS(cp);
cp += 4;
ND_PRINT((ndo, "\n\t subtype %s", tok2str(bsn_subtype_str, "unknown (0x%08x)", subtype)));
switch (subtype) {
goto invalid;
/* vport_no */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", vport_no %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ", vport_no %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
break;
case BSN_SHELL_COMMAND:
goto invalid;
/* service */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", service %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ", service %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* data */
ND_PRINT((ndo, ", data '"));
goto invalid;
/* status */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", status 0x%08x", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ", status 0x%08x", EXTRACT_BE_32BITS(cp)));
cp += 4;
break;
default:
goto invalid;
/* subtype */
ND_TCHECK2(*cp, 4);
- subtype = EXTRACT_32BITS(cp);
+ subtype = EXTRACT_BE_32BITS(cp);
cp += 4;
ND_PRINT((ndo, "\n\t subtype %s", tok2str(bsn_action_subtype_str, "unknown (0x%08x)", subtype)));
switch (subtype) {
goto invalid;
/* dest_port */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", dest_port %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ", dest_port %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* vlan_tag */
ND_TCHECK2(*cp, 4);
- vlan_tag = EXTRACT_32BITS(cp);
+ vlan_tag = EXTRACT_BE_32BITS(cp);
cp += 4;
switch (vlan_tag >> 16) {
case 0:
goto invalid;
/* vendor */
ND_TCHECK2(*cp, 4);
- vendor = EXTRACT_32BITS(cp);
+ vendor = EXTRACT_BE_32BITS(cp);
cp += 4;
ND_PRINT((ndo, ", vendor 0x%08x (%s)", vendor, of_vendor_name(vendor)));
/* data */
goto invalid;
/* vendor */
ND_TCHECK2(*cp, 4);
- vendor = EXTRACT_32BITS(cp);
+ vendor = EXTRACT_BE_32BITS(cp);
cp += 4;
ND_PRINT((ndo, ", vendor 0x%08x (%s)", vendor, of_vendor_name(vendor)));
/* data */
goto invalid;
/* vendor */
ND_TCHECK2(*cp, 4);
- vendor = EXTRACT_32BITS(cp);
+ vendor = EXTRACT_BE_32BITS(cp);
cp += 4;
ND_PRINT((ndo, ", vendor 0x%08x (%s)", vendor, of_vendor_name(vendor)));
/* data */
goto invalid;
/* port_no */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
cp += 2;
/* hw_addr */
ND_TCHECK2(*cp, ETHER_ADDR_LEN);
}
/* config */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t config 0x%08x", EXTRACT_32BITS(cp)));
- of10_bitmap_print(ndo, ofppc_bm, EXTRACT_32BITS(cp), OFPPC_U);
+ ND_PRINT((ndo, "\n\t config 0x%08x", EXTRACT_BE_32BITS(cp)));
+ of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_32BITS(cp),
+ OFPPC_U);
cp += 4;
/* state */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t state 0x%08x", EXTRACT_32BITS(cp)));
- of10_bitmap_print(ndo, ofpps_bm, EXTRACT_32BITS(cp), OFPPS_U);
+ ND_PRINT((ndo, "\n\t state 0x%08x", EXTRACT_BE_32BITS(cp)));
+ of10_bitmap_print(ndo, ofpps_bm, EXTRACT_BE_32BITS(cp),
+ OFPPS_U);
cp += 4;
/* curr */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t curr 0x%08x", EXTRACT_32BITS(cp)));
- of10_bitmap_print(ndo, ofppf_bm, EXTRACT_32BITS(cp), OFPPF_U);
+ ND_PRINT((ndo, "\n\t curr 0x%08x", EXTRACT_BE_32BITS(cp)));
+ of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp),
+ OFPPF_U);
cp += 4;
/* advertised */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t advertised 0x%08x", EXTRACT_32BITS(cp)));
- of10_bitmap_print(ndo, ofppf_bm, EXTRACT_32BITS(cp), OFPPF_U);
+ ND_PRINT((ndo, "\n\t advertised 0x%08x", EXTRACT_BE_32BITS(cp)));
+ of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp),
+ OFPPF_U);
cp += 4;
/* supported */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t supported 0x%08x", EXTRACT_32BITS(cp)));
- of10_bitmap_print(ndo, ofppf_bm, EXTRACT_32BITS(cp), OFPPF_U);
+ ND_PRINT((ndo, "\n\t supported 0x%08x", EXTRACT_BE_32BITS(cp)));
+ of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp),
+ OFPPF_U);
cp += 4;
/* peer */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t peer 0x%08x", EXTRACT_32BITS(cp)));
- of10_bitmap_print(ndo, ofppf_bm, EXTRACT_32BITS(cp), OFPPF_U);
+ ND_PRINT((ndo, "\n\t peer 0x%08x", EXTRACT_BE_32BITS(cp)));
+ of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp),
+ OFPPF_U);
cp += 4;
next_port:
len -= OF_PHY_PORT_LEN;
goto invalid;
/* property */
ND_TCHECK2(*cp, 2);
- property = EXTRACT_16BITS(cp);
+ property = EXTRACT_BE_16BITS(cp);
cp += 2;
ND_PRINT((ndo, "\n\t property %s", tok2str(ofpqt_str, "invalid (0x%04x)", property)));
/* len */
ND_TCHECK2(*cp, 2);
- plen = EXTRACT_16BITS(cp);
+ plen = EXTRACT_BE_16BITS(cp);
cp += 2;
ND_PRINT((ndo, ", len %u", plen));
if (plen < OF_QUEUE_PROP_HEADER_LEN || plen > len)
if (property == OFPQT_MIN_RATE) { /* the only case of property decoding */
/* rate */
ND_TCHECK2(*cp, 2);
- rate = EXTRACT_16BITS(cp);
+ rate = EXTRACT_BE_16BITS(cp);
cp += 2;
if (rate > 1000)
ND_PRINT((ndo, ", rate disabled"));
goto invalid;
/* queue_id */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t queue_id %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, "\n\t queue_id %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* len */
ND_TCHECK2(*cp, 2);
- desclen = EXTRACT_16BITS(cp);
+ desclen = EXTRACT_BE_16BITS(cp);
cp += 2;
ND_PRINT((ndo, ", len %u", desclen));
if (desclen < OF_PACKET_QUEUE_LEN || desclen > len)
/* wildcards */
ND_TCHECK2(*cp, 4);
- wildcards = EXTRACT_32BITS(cp);
+ wildcards = EXTRACT_BE_32BITS(cp);
if (wildcards & OFPFW_U)
ND_PRINT((ndo, "%swildcards 0x%08x (bogus)", pfx, wildcards));
cp += 4;
/* in_port */
ND_TCHECK2(*cp, 2);
if (! (wildcards & OFPFW_IN_PORT))
- ND_PRINT((ndo, "%smatch in_port %s", pfx, tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, "%smatch in_port %s", pfx, tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
cp += 2;
/* dl_src */
ND_TCHECK2(*cp, ETHER_ADDR_LEN);
/* dl_vlan */
ND_TCHECK2(*cp, 2);
if (! (wildcards & OFPFW_DL_VLAN))
- ND_PRINT((ndo, "%smatch dl_vlan %s", pfx, vlan_str(EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, "%smatch dl_vlan %s", pfx, vlan_str(EXTRACT_BE_16BITS(cp))));
cp += 2;
/* dl_vlan_pcp */
ND_TCHECK2(*cp, 1);
cp += 1;
/* dl_type */
ND_TCHECK2(*cp, 2);
- dl_type = EXTRACT_16BITS(cp);
+ dl_type = EXTRACT_BE_16BITS(cp);
cp += 2;
if (! (wildcards & OFPFW_DL_TYPE))
ND_PRINT((ndo, "%smatch dl_type 0x%04x", pfx, dl_type));
field_name = ! (wildcards & OFPFW_DL_TYPE) && dl_type == ETHERTYPE_IP
&& ! (wildcards & OFPFW_NW_PROTO) && nw_proto == IPPROTO_ICMP
? "icmp_type" : "tp_src";
- ND_PRINT((ndo, "%smatch %s %u", pfx, field_name, EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, "%smatch %s %u", pfx, field_name, EXTRACT_BE_16BITS(cp)));
}
cp += 2;
/* tp_dst */
field_name = ! (wildcards & OFPFW_DL_TYPE) && dl_type == ETHERTYPE_IP
&& ! (wildcards & OFPFW_NW_PROTO) && nw_proto == IPPROTO_ICMP
? "icmp_code" : "tp_dst";
- ND_PRINT((ndo, "%smatch %s %u", pfx, field_name, EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, "%smatch %s %u", pfx, field_name, EXTRACT_BE_16BITS(cp)));
}
return cp + 2;
goto invalid;
/* type */
ND_TCHECK2(*cp, 2);
- type = EXTRACT_16BITS(cp);
+ type = EXTRACT_BE_16BITS(cp);
cp += 2;
ND_PRINT((ndo, "%saction type %s", pfx, tok2str(ofpat_str, "invalid (0x%04x)", type)));
/* length */
ND_TCHECK2(*cp, 2);
- alen = EXTRACT_16BITS(cp);
+ alen = EXTRACT_BE_16BITS(cp);
cp += 2;
ND_PRINT((ndo, ", len %u", alen));
/* On action size underrun/overrun skip the rest of the action list. */
case OFPAT_OUTPUT:
/* port */
ND_TCHECK2(*cp, 2);
- output_port = EXTRACT_16BITS(cp);
+ output_port = EXTRACT_BE_16BITS(cp);
cp += 2;
ND_PRINT((ndo, ", port %s", tok2str(ofpp_str, "%u", output_port)));
/* max_len */
ND_TCHECK2(*cp, 2);
if (output_port == OFPP_CONTROLLER)
- ND_PRINT((ndo, ", max_len %u", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, ", max_len %u", EXTRACT_BE_16BITS(cp)));
cp += 2;
break;
case OFPAT_SET_VLAN_VID:
/* vlan_vid */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", vlan_vid %s", vlan_str(EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, ", vlan_vid %s", vlan_str(EXTRACT_BE_16BITS(cp))));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 2);
case OFPAT_SET_TP_DST:
/* nw_tos */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", tp_port %u", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, ", tp_port %u", EXTRACT_BE_16BITS(cp)));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 2);
case OFPAT_ENQUEUE:
/* port */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", port %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, ", port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 6);
cp += 6;
/* queue_id */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_32BITS(cp))));
+ ND_PRINT((ndo, ", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_BE_32BITS(cp))));
cp += 4;
break;
case OFPAT_VENDOR:
{
/* datapath_id */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, "\n\t dpid 0x%016" PRIx64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, "\n\t dpid 0x%016" PRIx64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* n_buffers */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", n_buffers %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ", n_buffers %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* n_tables */
ND_TCHECK2(*cp, 1);
cp += 3;
/* capabilities */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t capabilities 0x%08x", EXTRACT_32BITS(cp)));
- of10_bitmap_print(ndo, ofp_capabilities_bm, EXTRACT_32BITS(cp), OFPCAP_U);
+ ND_PRINT((ndo, "\n\t capabilities 0x%08x", EXTRACT_BE_32BITS(cp)));
+ of10_bitmap_print(ndo, ofp_capabilities_bm, EXTRACT_BE_32BITS(cp),
+ OFPCAP_U);
cp += 4;
/* actions */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t actions 0x%08x", EXTRACT_32BITS(cp)));
- of10_bitmap_print(ndo, ofpat_bm, EXTRACT_32BITS(cp), OFPAT_U);
+ ND_PRINT((ndo, "\n\t actions 0x%08x", EXTRACT_BE_32BITS(cp)));
+ of10_bitmap_print(ndo, ofpat_bm, EXTRACT_BE_32BITS(cp), OFPAT_U);
cp += 4;
/* ports */
return of10_phy_ports_print(ndo, cp, ep, len - OF_SWITCH_FEATURES_LEN);
return ep; /* end of snapshot */
/* cookie */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, "\n\t cookie 0x%016" PRIx64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, "\n\t cookie 0x%016" PRIx64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* command */
ND_TCHECK2(*cp, 2);
- command = EXTRACT_16BITS(cp);
+ command = EXTRACT_BE_16BITS(cp);
ND_PRINT((ndo, ", command %s", tok2str(ofpfc_str, "invalid (0x%04x)", command)));
cp += 2;
/* idle_timeout */
ND_TCHECK2(*cp, 2);
- if (EXTRACT_16BITS(cp))
- ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_16BITS(cp)));
+ if (EXTRACT_BE_16BITS(cp))
+ ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_16BITS(cp)));
cp += 2;
/* hard_timeout */
ND_TCHECK2(*cp, 2);
- if (EXTRACT_16BITS(cp))
- ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_16BITS(cp)));
+ if (EXTRACT_BE_16BITS(cp))
+ ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_BE_16BITS(cp)));
cp += 2;
/* priority */
ND_TCHECK2(*cp, 2);
- if (EXTRACT_16BITS(cp))
- ND_PRINT((ndo, ", priority %u", EXTRACT_16BITS(cp)));
+ if (EXTRACT_BE_16BITS(cp))
+ ND_PRINT((ndo, ", priority %u", EXTRACT_BE_16BITS(cp)));
cp += 2;
/* buffer_id */
ND_TCHECK2(*cp, 4);
if (command == OFPFC_ADD || command == OFPFC_MODIFY ||
command == OFPFC_MODIFY_STRICT)
- ND_PRINT((ndo, ", buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_32BITS(cp))));
+ ND_PRINT((ndo, ", buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_BE_32BITS(cp))));
cp += 4;
/* out_port */
ND_TCHECK2(*cp, 2);
if (command == OFPFC_DELETE || command == OFPFC_DELETE_STRICT)
- ND_PRINT((ndo, ", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, ", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
cp += 2;
/* flags */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_16BITS(cp)));
- of10_bitmap_print(ndo, ofpff_bm, EXTRACT_16BITS(cp), OFPFF_U);
+ ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_16BITS(cp)));
+ of10_bitmap_print(ndo, ofpff_bm, EXTRACT_BE_16BITS(cp), OFPFF_U);
cp += 2;
/* actions */
return of10_actions_print(ndo, "\n\t ", cp, ep, len - OF_FLOW_MOD_LEN);
{
/* port_no */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
cp += 2;
/* hw_addr */
ND_TCHECK2(*cp, ETHER_ADDR_LEN);
cp += ETHER_ADDR_LEN;
/* config */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t config 0x%08x", EXTRACT_32BITS(cp)));
- of10_bitmap_print(ndo, ofppc_bm, EXTRACT_32BITS(cp), OFPPC_U);
+ ND_PRINT((ndo, "\n\t config 0x%08x", EXTRACT_BE_32BITS(cp)));
+ of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_32BITS(cp), OFPPC_U);
cp += 4;
/* mask */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t mask 0x%08x", EXTRACT_32BITS(cp)));
- of10_bitmap_print(ndo, ofppc_bm, EXTRACT_32BITS(cp), OFPPC_U);
+ ND_PRINT((ndo, "\n\t mask 0x%08x", EXTRACT_BE_32BITS(cp)));
+ of10_bitmap_print(ndo, ofppc_bm, EXTRACT_BE_32BITS(cp), OFPPC_U);
cp += 4;
/* advertise */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t advertise 0x%08x", EXTRACT_32BITS(cp)));
- of10_bitmap_print(ndo, ofppf_bm, EXTRACT_32BITS(cp), OFPPF_U);
+ ND_PRINT((ndo, "\n\t advertise 0x%08x", EXTRACT_BE_32BITS(cp)));
+ of10_bitmap_print(ndo, ofppf_bm, EXTRACT_BE_32BITS(cp), OFPPF_U);
cp += 4;
/* pad */
ND_TCHECK2(*cp, 4);
/* type */
ND_TCHECK2(*cp, 2);
- type = EXTRACT_16BITS(cp);
+ type = EXTRACT_BE_16BITS(cp);
cp += 2;
ND_PRINT((ndo, "\n\t type %s", tok2str(ofpst_str, "invalid (0x%04x)", type)));
/* flags */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_16BITS(cp)));
- if (EXTRACT_16BITS(cp))
+ ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_16BITS(cp)));
+ if (EXTRACT_BE_16BITS(cp))
ND_PRINT((ndo, " (bogus)"));
cp += 2;
/* type-specific body of one of fixed lengths */
cp += 1;
/* out_port */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, ", out_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
return cp + 2;
case OFPST_PORT:
if (len != OF_PORT_STATS_REQUEST_LEN)
goto invalid;
/* port_no */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 6);
goto invalid;
/* port_no */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 2);
cp += 2;
/* queue_id */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_32BITS(cp))));
+ ND_PRINT((ndo, ", queue_id %s", tok2str(ofpq_str, "%u", EXTRACT_BE_32BITS(cp))));
return cp + 4;
case OFPST_VENDOR:
return of10_vendor_data_print(ndo, cp, ep, len);
goto invalid;
/* length */
ND_TCHECK2(*cp, 2);
- entry_len = EXTRACT_16BITS(cp);
+ entry_len = EXTRACT_BE_16BITS(cp);
ND_PRINT((ndo, "\n\t length %u", entry_len));
if (entry_len < OF_FLOW_STATS_LEN || entry_len > len)
goto invalid;
return ep; /* end of snapshot */
/* duration_sec */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t duration_sec %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, "\n\t duration_sec %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* duration_nsec */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* priority */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", priority %u", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, ", priority %u", EXTRACT_BE_16BITS(cp)));
cp += 2;
/* idle_timeout */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_16BITS(cp)));
cp += 2;
/* hard_timeout */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, ", hard_timeout %u", EXTRACT_BE_16BITS(cp)));
cp += 2;
/* pad2 */
ND_TCHECK2(*cp, 6);
cp += 6;
/* cookie */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", cookie 0x%016" PRIx64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", cookie 0x%016" PRIx64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* packet_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* byte_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* actions */
if (ep == (cp = of10_actions_print(ndo, "\n\t ", cp, ep, entry_len - OF_FLOW_STATS_LEN)))
goto invalid;
/* packet_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, "\n\t packet_count %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, "\n\t packet_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* byte_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* flow_count */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", flow_count %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ", flow_count %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* pad */
ND_TCHECK2(*cp, 4);
cp += OFP_MAX_TABLE_NAME_LEN;
/* wildcards */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t wildcards 0x%08x", EXTRACT_32BITS(cp)));
- of10_bitmap_print(ndo, ofpfw_bm, EXTRACT_32BITS(cp), OFPFW_U);
+ ND_PRINT((ndo, "\n\t wildcards 0x%08x", EXTRACT_BE_32BITS(cp)));
+ of10_bitmap_print(ndo, ofpfw_bm, EXTRACT_BE_32BITS(cp),
+ OFPFW_U);
cp += 4;
/* max_entries */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t max_entries %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, "\n\t max_entries %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* active_count */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", active_count %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ", active_count %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* lookup_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", lookup_count %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", lookup_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* matched_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", matched_count %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", matched_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
len -= OF_TABLE_STATS_LEN;
goto invalid;
/* port_no */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
cp += 2;
if (ndo->ndo_vflag < 2) {
ND_TCHECK2(*cp, OF_PORT_STATS_LEN - 2);
cp += 6;
/* rx_packets */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", rx_packets %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", rx_packets %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* tx_packets */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* rx_bytes */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", rx_bytes %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", rx_bytes %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* tx_bytes */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* rx_dropped */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", rx_dropped %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", rx_dropped %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* tx_dropped */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", tx_dropped %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", tx_dropped %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* rx_errors */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", rx_errors %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", rx_errors %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* tx_errors */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* rx_frame_err */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", rx_frame_err %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", rx_frame_err %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* rx_over_err */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", rx_over_err %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", rx_over_err %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* rx_crc_err */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", rx_crc_err %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", rx_crc_err %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* collisions */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", collisions %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", collisions %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
next_port:
len -= OF_PORT_STATS_LEN;
goto invalid;
/* port_no */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 2);
cp += 2;
/* queue_id */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", queue_id %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ", queue_id %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* tx_bytes */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", tx_bytes %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* tx_packets */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", tx_packets %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* tx_errors */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", tx_errors %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
len -= OF_QUEUE_STATS_LEN;
/* type */
ND_TCHECK2(*cp, 2);
- type = EXTRACT_16BITS(cp);
+ type = EXTRACT_BE_16BITS(cp);
ND_PRINT((ndo, "\n\t type %s", tok2str(ofpst_str, "invalid (0x%04x)", type)));
cp += 2;
/* flags */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_16BITS(cp)));
- of10_bitmap_print(ndo, ofpsf_reply_bm, EXTRACT_16BITS(cp), OFPSF_REPLY_U);
+ ND_PRINT((ndo, ", flags 0x%04x", EXTRACT_BE_16BITS(cp)));
+ of10_bitmap_print(ndo, ofpsf_reply_bm, EXTRACT_BE_16BITS(cp),
+ OFPSF_REPLY_U);
cp += 2;
if (ndo->ndo_vflag > 0) {
/* buffer_id */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t buffer_id 0x%08x", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, "\n\t buffer_id 0x%08x", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* in_port */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
cp += 2;
/* actions_len */
ND_TCHECK2(*cp, 2);
- actions_len = EXTRACT_16BITS(cp);
+ actions_len = EXTRACT_BE_16BITS(cp);
cp += 2;
if (actions_len > len - OF_PACKET_OUT_LEN)
goto invalid;
{
/* buffer_id */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, "\n\t buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_32BITS(cp))));
+ ND_PRINT((ndo, "\n\t buffer_id %s", tok2str(bufferid_str, "0x%08x", EXTRACT_BE_32BITS(cp))));
cp += 4;
/* total_len */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", total_len %u", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, ", total_len %u", EXTRACT_BE_16BITS(cp)));
cp += 2;
/* in_port */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, ", in_port %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
cp += 2;
/* reason */
ND_TCHECK2(*cp, 1);
return ep; /* end of snapshot */
/* cookie */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, "\n\t cookie 0x%016" PRIx64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, "\n\t cookie 0x%016" PRIx64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* priority */
ND_TCHECK2(*cp, 2);
- if (EXTRACT_16BITS(cp))
- ND_PRINT((ndo, ", priority %u", EXTRACT_16BITS(cp)));
+ if (EXTRACT_BE_16BITS(cp))
+ ND_PRINT((ndo, ", priority %u", EXTRACT_BE_16BITS(cp)));
cp += 2;
/* reason */
ND_TCHECK2(*cp, 1);
cp += 1;
/* duration_sec */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", duration_sec %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ", duration_sec %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* duration_nsec */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ", duration_nsec %u", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* idle_timeout */
ND_TCHECK2(*cp, 2);
- if (EXTRACT_16BITS(cp))
- ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_16BITS(cp)));
+ if (EXTRACT_BE_16BITS(cp))
+ ND_PRINT((ndo, ", idle_timeout %u", EXTRACT_BE_16BITS(cp)));
cp += 2;
/* pad2 */
ND_TCHECK2(*cp, 2);
cp += 2;
/* packet_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", packet_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
cp += 8;
/* byte_count */
ND_TCHECK2(*cp, 8);
- ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_64BITS(cp)));
+ ND_PRINT((ndo, ", byte_count %" PRIu64, EXTRACT_BE_64BITS(cp)));
return cp + 8;
trunc:
/* type */
ND_TCHECK2(*cp, 2);
- type = EXTRACT_16BITS(cp);
+ type = EXTRACT_BE_16BITS(cp);
cp += 2;
ND_PRINT((ndo, "\n\t type %s", tok2str(ofpet_str, "invalid (0x%04x)", type)));
/* code */
type == OFPET_PORT_MOD_FAILED ? ofppmfc_str :
type == OFPET_QUEUE_OP_FAILED ? ofpqofc_str :
empty_str;
- ND_PRINT((ndo, ", code %s", tok2str(code_str, "invalid (0x%04x)", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, ", code %s", tok2str(code_str, "invalid (0x%04x)", EXTRACT_BE_16BITS(cp))));
cp += 2;
/* data */
return of10_data_print(ndo, cp, ep, len - OF_ERROR_MSG_LEN);
goto next_message;
/* flags */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t flags %s", tok2str(ofp_config_str, "invalid (0x%04x)", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t flags %s", tok2str(ofp_config_str, "invalid (0x%04x)", EXTRACT_BE_16BITS(cp))));
cp += 2;
/* miss_send_len */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", miss_send_len %u", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, ", miss_send_len %u", EXTRACT_BE_16BITS(cp)));
return cp + 2;
case OFPT_PORT_MOD:
if (len != OF_PORT_MOD_LEN)
goto next_message;
/* port */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 2);
goto next_message;
/* port */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_16BITS(cp))));
cp += 2;
/* pad */
ND_TCHECK2(*cp, 6);
cp += 1;
/* length */
ND_TCHECK2(*cp, 2);
- length = EXTRACT_16BITS(cp);
+ length = EXTRACT_BE_16BITS(cp);
cp += 2;
/* xid */
ND_TCHECK2(*cp, 4);
- xid = EXTRACT_32BITS(cp);
+ xid = EXTRACT_BE_32BITS(cp);
cp += 4;
/* Message length includes the header length and a message always includes
* the basic header. A message length underrun fails decoding of the rest of
ND_PRINT((ndo, "\n\t Remaining LS length %u < 4", ls_length));
return -1;
}
- tlv_type = EXTRACT_16BITS(tptr);
- tlv_length = EXTRACT_16BITS(tptr+2);
+ tlv_type = EXTRACT_BE_16BITS(tptr);
+ tlv_length = EXTRACT_BE_16BITS(tptr + 2);
tptr+=4;
ls_length-=4;
ND_PRINT((ndo, "\n\t Bogus length %u != 4", tlv_length));
return -1;
}
- ND_PRINT((ndo, "%us", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "%us", EXTRACT_BE_32BITS(tptr)));
break;
case LS_OPAQUE_GRACE_TLV_REASON:
ND_PRINT((ndo, "\n\t Remaining LS length %u < 4", ls_length));
return -1;
}
- tlv_type = EXTRACT_16BITS(tptr);
- tlv_length = EXTRACT_16BITS(tptr+2);
+ tlv_type = EXTRACT_BE_16BITS(tptr);
+ tlv_length = EXTRACT_BE_16BITS(tptr + 2);
tptr+=4;
ls_length-=4;
return -1;
}
ND_TCHECK2(*tptr, 4);
- subtlv_type = EXTRACT_16BITS(tptr);
- subtlv_length = EXTRACT_16BITS(tptr+2);
+ subtlv_type = EXTRACT_BE_16BITS(tptr);
+ subtlv_length = EXTRACT_BE_16BITS(tptr + 2);
tptr+=4;
tlv_length-=4;
ND_PRINT((ndo, " != 4"));
goto invalid;
}
- ND_PRINT((ndo, ", 0x%08x", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_32BITS(tptr)));
break;
case LS_OPAQUE_TE_LINK_SUBTLV_LINK_ID:
case LS_OPAQUE_TE_LINK_SUBTLV_LINK_LOCAL_REMOTE_ID:
}
ND_PRINT((ndo, ", %s (0x%08x)",
ipaddr_string(ndo, tptr),
- EXTRACT_32BITS(tptr)));
+ EXTRACT_BE_32BITS(tptr)));
if (subtlv_length == 8) /* rfc4203 */
ND_PRINT((ndo, ", %s (0x%08x)",
ipaddr_string(ndo, tptr+4),
- EXTRACT_32BITS(tptr + 4)));
+ EXTRACT_BE_32BITS(tptr + 4)));
break;
case LS_OPAQUE_TE_LINK_SUBTLV_LOCAL_IP:
case LS_OPAQUE_TE_LINK_SUBTLV_REMOTE_IP:
ND_PRINT((ndo, " != 4"));
goto invalid;
}
- bw.i = EXTRACT_32BITS(tptr);
+ bw.i = EXTRACT_BE_32BITS(tptr);
ND_PRINT((ndo, ", %.3f Mbps", bw.f * 8 / 1000000));
break;
case LS_OPAQUE_TE_LINK_SUBTLV_UNRES_BW:
goto invalid;
}
for (te_class = 0; te_class < 8; te_class++) {
- bw.i = EXTRACT_32BITS(tptr+te_class*4);
+ bw.i = EXTRACT_BE_32BITS(tptr + te_class * 4);
ND_PRINT((ndo, "\n\t\tTE-Class %u: %.3f Mbps",
te_class,
bw.f * 8 / 1000000));
}
/* decode BCs until the subTLV ends */
for (te_class = 0; te_class < (subtlv_length-4)/4; te_class++) {
- bw.i = EXTRACT_32BITS(tptr+4+te_class*4);
+ bw.i = EXTRACT_BE_32BITS(tptr + 4 + te_class * 4);
ND_PRINT((ndo, "\n\t\t Bandwidth constraint CT%u: %.3f Mbps",
te_class,
bw.f * 8 / 1000000));
ND_PRINT((ndo, " != 4"));
goto invalid;
}
- ND_PRINT((ndo, ", Metric %u", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, ", Metric %u", EXTRACT_BE_32BITS(tptr)));
break;
case LS_OPAQUE_TE_LINK_SUBTLV_LINK_PROTECTION_TYPE:
/* Protection Cap (1 octet) + Reserved ((3 octets) */
ND_PRINT((ndo, "\n\t\tLSP Encoding: %s\n\t\tMax LSP Bandwidth:",
tok2str(gmpls_encoding_values, "Unknown", *(tptr + 1))));
for (priority_level = 0; priority_level < 8; priority_level++) {
- bw.i = EXTRACT_32BITS(tptr+4+(priority_level*4));
+ bw.i = EXTRACT_BE_32BITS(tptr + 4 + (priority_level * 4));
ND_PRINT((ndo, "\n\t\t priority level %d: %.3f Mbps",
priority_level,
bw.f * 8 / 1000000));
if (count_srlg != 0)
ND_PRINT((ndo, "\n\t\t Shared risk group: "));
while (count_srlg > 0) {
- bw.i = EXTRACT_32BITS(tptr);
+ bw.i = EXTRACT_BE_32BITS(tptr);
ND_PRINT((ndo, "%d", bw.i));
tptr+=4;
count_srlg--;
u_int ls_length;
ND_TCHECK(lshp->ls_length);
- ls_length = EXTRACT_16BITS(&lshp->ls_length);
+ ls_length = EXTRACT_BE_16BITS(&lshp->ls_length);
if (ls_length < sizeof(struct lsa_hdr)) {
ND_PRINT((ndo, "\n\t Bogus length %u < header (%lu)", ls_length,
(unsigned long)sizeof(struct lsa_hdr)));
ND_TCHECK(lshp->ls_seq); /* XXX - ls_length check checked this */
ND_PRINT((ndo, "\n\t Advertising Router %s, seq 0x%08x, age %us, length %u",
ipaddr_string(ndo, &lshp->ls_router),
- EXTRACT_32BITS(&lshp->ls_seq),
- EXTRACT_16BITS(&lshp->ls_age),
+ EXTRACT_BE_32BITS(&lshp->ls_seq),
+ EXTRACT_BE_16BITS(&lshp->ls_age),
ls_length - (u_int)sizeof(struct lsa_hdr)));
ND_TCHECK(lshp->ls_type); /* XXX - ls_length check checked this */
"unknown",
*(&lshp->un_lsa_id.opaque_field.opaque_type)),
*(&lshp->un_lsa_id.opaque_field.opaque_type),
- EXTRACT_24BITS(&lshp->un_lsa_id.opaque_field.opaque_id)
+ EXTRACT_BE_24BITS(&lshp->un_lsa_id.opaque_field.opaque_id)
));
break;
tok2str(ospf_topology_values, "Unknown",
metric_count ? tos->metrics.tos_type : 0),
metric_count ? tos->metrics.tos_type : 0,
- EXTRACT_16BITS(&tos->metrics.tos_metric)));
+ EXTRACT_BE_16BITS(&tos->metrics.tos_metric)));
metric_count++;
tos++;
toscount--;
bittok2str(ospf_rla_flag_values, "none", lsap->lsa_un.un_rla.rla_flags)));
ND_TCHECK(lsap->lsa_un.un_rla.rla_count);
- j = EXTRACT_16BITS(&lsap->lsa_un.un_rla.rla_count);
+ j = EXTRACT_BE_16BITS(&lsap->lsa_un.un_rla.rla_count);
ND_TCHECK(lsap->lsa_un.un_rla.rla_link);
rlp = lsap->lsa_un.un_rla.rla_link;
while (j--) {
register uint32_t ul;
ND_TCHECK(*lp);
- ul = EXTRACT_32BITS(lp);
+ ul = EXTRACT_BE_32BITS(lp);
topology = (ul & SLA_MASK_TOS) >> SLA_SHIFT_TOS;
ND_PRINT((ndo, "\n\t\ttopology %s (%u) metric %d",
tok2str(ospf_topology_values, "Unknown", topology),
register uint32_t ul;
ND_TCHECK(*lp);
- ul = EXTRACT_32BITS(lp);
+ ul = EXTRACT_BE_32BITS(lp);
topology = (ul & SLA_MASK_TOS) >> SLA_SHIFT_TOS;
ND_PRINT((ndo, "\n\t\ttopology %s (%u) metric %d",
tok2str(ospf_topology_values, "Unknown", topology),
register uint32_t ul;
ND_TCHECK(almp->asla_tosmetric);
- ul = EXTRACT_32BITS(&almp->asla_tosmetric);
+ ul = EXTRACT_BE_32BITS(&almp->asla_tosmetric);
topology = ((ul & ASLA_MASK_TOS) >> ASLA_SHIFT_TOS);
ND_PRINT((ndo, "\n\t\ttopology %s (%u), type %d, metric",
tok2str(ospf_topology_values, "Unknown", topology),
mcp = lsap->lsa_un.un_mcla;
while ((const u_char *)mcp < ls_end) {
ND_TCHECK(mcp->mcla_vid);
- switch (EXTRACT_32BITS(&mcp->mcla_vtype)) {
+ switch (EXTRACT_BE_32BITS(&mcp->mcla_vtype)) {
case MCLA_VERTEX_ROUTER:
ND_PRINT((ndo, "\n\t Router Router-ID %s",
default:
ND_PRINT((ndo, "\n\t unknown VertexType (%u)",
- EXTRACT_32BITS(&mcp->mcla_vtype)));
+ EXTRACT_BE_32BITS(&mcp->mcla_vtype)));
break;
}
++mcp;
ND_PRINT((ndo, "\n\t Remaining LS length %u < 4", ls_length));
return(ls_end);
}
- tlv_type = EXTRACT_16BITS(tptr);
- tlv_length = EXTRACT_16BITS(tptr+2);
+ tlv_type = EXTRACT_BE_16BITS(tptr);
+ tlv_length = EXTRACT_BE_16BITS(tptr + 2);
tptr+=4;
ls_length-=4;
return(ls_end);
}
ND_PRINT((ndo, "Capabilities: %s",
- bittok2str(lsa_opaque_ri_tlv_cap_values, "Unknown", EXTRACT_32BITS(tptr))));
+ bittok2str(lsa_opaque_ri_tlv_cap_values, "Unknown", EXTRACT_BE_32BITS(tptr))));
break;
default:
if (ndo->ndo_vflag <= 1) {
}
/* dig deeper if LLS data is available; see RFC4813 */
- length2 = EXTRACT_16BITS(&op->ospf_len);
+ length2 = EXTRACT_BE_16BITS(&op->ospf_len);
dptr = (const u_char *)op + length2;
dataend = (const u_char *)op + length;
- if (EXTRACT_16BITS(&op->ospf_authtype) == OSPF_AUTH_MD5) {
+ if (EXTRACT_BE_16BITS(&op->ospf_authtype) == OSPF_AUTH_MD5) {
dptr = dptr + op->ospf_authdata[3];
length2 += op->ospf_authdata[3];
}
return (1);
}
ND_TCHECK2(*dptr, 2);
- ND_PRINT((ndo, "\n\t LLS: checksum: 0x%04x", (u_int)EXTRACT_16BITS(dptr)));
+ ND_PRINT((ndo, "\n\t LLS: checksum: 0x%04x", (u_int) EXTRACT_BE_16BITS(dptr)));
dptr += 2;
ND_TCHECK2(*dptr, 2);
- length2 = EXTRACT_16BITS(dptr);
+ length2 = EXTRACT_BE_16BITS(dptr);
ND_PRINT((ndo, ", length: %u", length2));
dptr += 2;
ND_TCHECK(*dptr);
while (dptr < dataend) {
ND_TCHECK2(*dptr, 2);
- lls_type = EXTRACT_16BITS(dptr);
+ lls_type = EXTRACT_BE_16BITS(dptr);
ND_PRINT((ndo, "\n\t %s (%u)",
tok2str(ospf_lls_tlv_values,"Unknown TLV",lls_type),
lls_type));
dptr += 2;
ND_TCHECK2(*dptr, 2);
- lls_len = EXTRACT_16BITS(dptr);
+ lls_len = EXTRACT_BE_16BITS(dptr);
ND_PRINT((ndo, ", length: %u", lls_len));
dptr += 2;
switch (lls_type) {
lls_len = 4;
}
ND_TCHECK2(*dptr, 4);
- lls_flags = EXTRACT_32BITS(dptr);
+ lls_flags = EXTRACT_BE_32BITS(dptr);
ND_PRINT((ndo, "\n\t Options: 0x%08x [%s]", lls_flags,
bittok2str(ospf_lls_eo_options, "?", lls_flags)));
lls_len = 20;
}
ND_TCHECK2(*dptr, 4);
- ND_PRINT((ndo, "\n\t Sequence number: 0x%08x", EXTRACT_32BITS(dptr)));
+ ND_PRINT((ndo, "\n\t Sequence number: 0x%08x", EXTRACT_BE_32BITS(dptr)));
break;
}
ND_TCHECK(op->ospf_hello.hello_deadint);
ND_PRINT((ndo, "\n\t Hello Timer %us, Dead Timer %us, Mask %s, Priority %u",
- EXTRACT_16BITS(&op->ospf_hello.hello_helloint),
- EXTRACT_32BITS(&op->ospf_hello.hello_deadint),
+ EXTRACT_BE_16BITS(&op->ospf_hello.hello_helloint),
+ EXTRACT_BE_32BITS(&op->ospf_hello.hello_deadint),
ipaddr_string(ndo, &op->ospf_hello.hello_mask),
op->ospf_hello.hello_priority));
bittok2str(ospf_dd_flag_values, "none", op->ospf_db.db_flags)));
ND_TCHECK(op->ospf_db.db_ifmtu);
if (op->ospf_db.db_ifmtu) {
- ND_PRINT((ndo, ", MTU: %u", EXTRACT_16BITS(&op->ospf_db.db_ifmtu)));
+ ND_PRINT((ndo, ", MTU: %u", EXTRACT_BE_16BITS(&op->ospf_db.db_ifmtu)));
}
ND_TCHECK(op->ospf_db.db_seq);
- ND_PRINT((ndo, ", Sequence: 0x%08x", EXTRACT_32BITS(&op->ospf_db.db_seq)));
+ ND_PRINT((ndo, ", Sequence: 0x%08x", EXTRACT_BE_32BITS(&op->ospf_db.db_seq)));
/* Print all the LS adv's */
lshp = op->ospf_db.db_lshdr;
ND_PRINT((ndo, "\n\t Advertising Router: %s, %s LSA (%u)",
ipaddr_string(ndo, &lsrp->ls_router),
- tok2str(lsa_values,"unknown",EXTRACT_32BITS(lsrp->ls_type)),
- EXTRACT_32BITS(&lsrp->ls_type)));
+ tok2str(lsa_values,"unknown",EXTRACT_BE_32BITS(lsrp->ls_type)),
+ EXTRACT_BE_32BITS(&lsrp->ls_type)));
- switch (EXTRACT_32BITS(lsrp->ls_type)) {
+ switch (EXTRACT_BE_32BITS(lsrp->ls_type)) {
/* the LSA header for opaque LSAs was slightly changed */
case LS_TYPE_OPAQUE_LL:
case LS_TYPE_OPAQUE_AL:
ND_PRINT((ndo, ", Opaque-Type: %s LSA (%u), Opaque-ID: %u",
tok2str(lsa_opaque_values, "unknown",lsrp->un_ls_stateid.opaque_field.opaque_type),
lsrp->un_ls_stateid.opaque_field.opaque_type,
- EXTRACT_24BITS(&lsrp->un_ls_stateid.opaque_field.opaque_id)));
+ EXTRACT_BE_24BITS(&lsrp->un_ls_stateid.opaque_field.opaque_id)));
break;
default:
ND_PRINT((ndo, ", LSA-ID: %s",
case OSPF_TYPE_LS_UPDATE:
lsap = op->ospf_lsu.lsu_lsa;
ND_TCHECK(op->ospf_lsu.lsu_count);
- lsa_count_max = EXTRACT_32BITS(&op->ospf_lsu.lsu_count);
+ lsa_count_max = EXTRACT_BE_32BITS(&op->ospf_lsu.lsu_count);
ND_PRINT((ndo, ", %d LSA%s", lsa_count_max, PLURAL_SUFFIX(lsa_count_max)));
for (lsa_count=1;lsa_count <= lsa_count_max;lsa_count++) {
ND_PRINT((ndo, "\n\t LSA #%u", lsa_count));
/* XXX Before we do anything else, strip off the MD5 trailer */
ND_TCHECK(op->ospf_authtype);
- if (EXTRACT_16BITS(&op->ospf_authtype) == OSPF_AUTH_MD5) {
+ if (EXTRACT_BE_16BITS(&op->ospf_authtype) == OSPF_AUTH_MD5) {
length -= OSPF_AUTH_MD5_LEN;
ndo->ndo_snapend -= OSPF_AUTH_MD5_LEN;
}
}
ND_TCHECK(op->ospf_len);
- if (length != EXTRACT_16BITS(&op->ospf_len)) {
- ND_PRINT((ndo, " [len %d]", EXTRACT_16BITS(&op->ospf_len)));
+ if (length != EXTRACT_BE_16BITS(&op->ospf_len)) {
+ ND_PRINT((ndo, " [len %d]", EXTRACT_BE_16BITS(&op->ospf_len)));
}
- if (length > EXTRACT_16BITS(&op->ospf_len)) {
- dataend = bp + EXTRACT_16BITS(&op->ospf_len);
+ if (length > EXTRACT_BE_16BITS(&op->ospf_len)) {
+ dataend = bp + EXTRACT_BE_16BITS(&op->ospf_len);
} else {
dataend = bp + length;
}
ND_TCHECK2(op->ospf_authdata[0], sizeof(op->ospf_authdata));
ND_PRINT((ndo, ", Authentication Type: %s (%u)",
- tok2str(ospf_authtype_values, "unknown", EXTRACT_16BITS(&op->ospf_authtype)),
- EXTRACT_16BITS(&op->ospf_authtype)));
+ tok2str(ospf_authtype_values, "unknown", EXTRACT_BE_16BITS(&op->ospf_authtype)),
+ EXTRACT_BE_16BITS(&op->ospf_authtype)));
- switch (EXTRACT_16BITS(&op->ospf_authtype)) {
+ switch (EXTRACT_BE_16BITS(&op->ospf_authtype)) {
case OSPF_AUTH_NONE:
break;
ND_PRINT((ndo, "\n\tKey-ID: %u, Auth-Length: %u, Crypto Sequence Number: 0x%08x",
*((op->ospf_authdata) + 2),
*((op->ospf_authdata) + 3),
- EXTRACT_32BITS((op->ospf_authdata) + 4)));
+ EXTRACT_BE_32BITS((op->ospf_authdata) + 4)));
break;
default:
/* ospf version 2 */
if (ospf_decode_v2(ndo, op, dataend))
goto trunc;
- if (length > EXTRACT_16BITS(&op->ospf_len)) {
+ if (length > EXTRACT_BE_16BITS(&op->ospf_len)) {
if (ospf_decode_lls(ndo, op, length))
goto trunc;
}
ND_PRINT((ndo, "\n\t Advertising Router %s, seq 0x%08x, age %us, length %u",
ipaddr_string(ndo, &lshp->ls_router),
- EXTRACT_32BITS(&lshp->ls_seq),
- EXTRACT_16BITS(&lshp->ls_age),
- EXTRACT_16BITS(&lshp->ls_length)-(u_int)sizeof(struct lsa6_hdr)));
+ EXTRACT_BE_32BITS(&lshp->ls_seq),
+ EXTRACT_BE_16BITS(&lshp->ls_age),
+ EXTRACT_BE_16BITS(&lshp->ls_length)-(u_int)sizeof(struct lsa6_hdr)));
- ospf6_print_ls_type(ndo, EXTRACT_16BITS(&lshp->ls_type), &lshp->ls_stateid);
+ ospf6_print_ls_type(ndo, EXTRACT_BE_16BITS(&lshp->ls_type),
+ &lshp->ls_stateid);
return (0);
trunc:
bittok2str(ospf6_lsa_prefix_option_values,
"none", lsapp->lsa_p_opt)));
}
- ND_PRINT((ndo, ", metric %u", EXTRACT_16BITS(&lsapp->lsa_p_metric)));
+ ND_PRINT((ndo, ", metric %u", EXTRACT_BE_16BITS(&lsapp->lsa_p_metric)));
return sizeof(*lsapp) - IPV6_ADDR_LEN_BYTES + wordlen * 4;
trunc:
if (ospf6_print_lshdr(ndo, &lsap->ls_hdr, dataend))
return (1);
ND_TCHECK(lsap->ls_hdr.ls_length);
- length = EXTRACT_16BITS(&lsap->ls_hdr.ls_length);
+ length = EXTRACT_BE_16BITS(&lsap->ls_hdr.ls_length);
/*
* The LSA length includes the length of the header;
lsa_length = length - sizeof(struct lsa6_hdr);
tptr = (const uint8_t *)lsap+sizeof(struct lsa6_hdr);
- switch (EXTRACT_16BITS(&lsap->ls_hdr.ls_type)) {
+ switch (EXTRACT_BE_16BITS(&lsap->ls_hdr.ls_type)) {
case LS_TYPE_ROUTER | LS_SCOPE_AREA:
if (lsa_length < sizeof (lsap->lsa_un.un_rla.rla_options))
return (1);
ND_TCHECK(lsap->lsa_un.un_rla.rla_options);
ND_PRINT((ndo, "\n\t Options [%s]",
bittok2str(ospf6_option_values, "none",
- EXTRACT_32BITS(&lsap->lsa_un.un_rla.rla_options))));
+ EXTRACT_BE_32BITS(&lsap->lsa_un.un_rla.rla_options))));
ND_PRINT((ndo, ", RLA-Flags [%s]",
bittok2str(ospf6_rla_flag_values, "none",
lsap->lsa_un.un_rla.rla_flags)));
rlp->link_type));
return (0);
}
- ND_PRINT((ndo, ", metric %d", EXTRACT_16BITS(&rlp->link_metric)));
+ ND_PRINT((ndo, ", metric %d", EXTRACT_BE_16BITS(&rlp->link_metric)));
rlp++;
}
break;
ND_TCHECK(lsap->lsa_un.un_nla.nla_options);
ND_PRINT((ndo, "\n\t Options [%s]",
bittok2str(ospf6_option_values, "none",
- EXTRACT_32BITS(&lsap->lsa_un.un_nla.nla_options))));
+ EXTRACT_BE_32BITS(&lsap->lsa_un.un_nla.nla_options))));
ND_PRINT((ndo, "\n\t Connected Routers:"));
ap = lsap->lsa_un.un_nla.nla_router;
lsa_length -= sizeof (lsap->lsa_un.un_inter_ap.inter_ap_metric);
ND_TCHECK(lsap->lsa_un.un_inter_ap.inter_ap_metric);
ND_PRINT((ndo, ", metric %u",
- EXTRACT_32BITS(&lsap->lsa_un.un_inter_ap.inter_ap_metric) & SLA_MASK_METRIC));
+ EXTRACT_BE_32BITS(&lsap->lsa_un.un_inter_ap.inter_ap_metric) & SLA_MASK_METRIC));
tptr = (const uint8_t *)lsap->lsa_un.un_inter_ap.inter_ap_prefix;
while (lsa_length != 0) {
return (1);
lsa_length -= sizeof (lsap->lsa_un.un_asla.asla_metric);
ND_TCHECK(lsap->lsa_un.un_asla.asla_metric);
- flags32 = EXTRACT_32BITS(&lsap->lsa_un.un_asla.asla_metric);
+ flags32 = EXTRACT_BE_32BITS(&lsap->lsa_un.un_asla.asla_metric);
ND_PRINT((ndo, "\n\t Flags [%s]",
bittok2str(ospf6_asla_flag_values, "none", flags32)));
ND_PRINT((ndo, " metric %u",
- EXTRACT_32BITS(&lsap->lsa_un.un_asla.asla_metric) &
+ EXTRACT_BE_32BITS(&lsap->lsa_un.un_asla.asla_metric) &
ASLA_MASK_METRIC));
tptr = (const uint8_t *)lsap->lsa_un.un_asla.asla_prefix;
ND_TCHECK(llsap->llsa_priandopt);
ND_PRINT((ndo, "\n\t Options [%s]",
bittok2str(ospf6_option_values, "none",
- EXTRACT_32BITS(&llsap->llsa_options))));
+ EXTRACT_BE_32BITS(&llsap->llsa_options))));
if (lsa_length < sizeof (llsap->llsa_lladdr) + sizeof (llsap->llsa_nprefix))
return (1);
lsa_length -= sizeof (llsap->llsa_lladdr) + sizeof (llsap->llsa_nprefix);
ND_TCHECK(llsap->llsa_nprefix);
- prefixes = EXTRACT_32BITS(&llsap->llsa_nprefix);
+ prefixes = EXTRACT_BE_32BITS(&llsap->llsa_nprefix);
ND_PRINT((ndo, "\n\t Priority %d, Link-local address %s, Prefixes %d:",
llsap->llsa_priority,
ip6addr_string(ndo, &llsap->llsa_lladdr),
lsa_length -= sizeof (lsap->lsa_un.un_intra_ap.intra_ap_rtid);
ND_TCHECK(lsap->lsa_un.un_intra_ap.intra_ap_rtid);
ospf6_print_ls_type(ndo,
- EXTRACT_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_lstype),
+ EXTRACT_BE_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_lstype),
&lsap->lsa_un.un_intra_ap.intra_ap_lsid);
if (lsa_length < sizeof (lsap->lsa_un.un_intra_ap.intra_ap_nprefix))
return (1);
lsa_length -= sizeof (lsap->lsa_un.un_intra_ap.intra_ap_nprefix);
ND_TCHECK(lsap->lsa_un.un_intra_ap.intra_ap_nprefix);
- prefixes = EXTRACT_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_nprefix);
+ prefixes = EXTRACT_BE_16BITS(&lsap->lsa_un.un_intra_ap.intra_ap_nprefix);
ND_PRINT((ndo, "\n\t Prefixes %d:", prefixes));
tptr = (const uint8_t *)lsap->lsa_un.un_intra_ap.intra_ap_prefix;
ND_TCHECK_32BITS(&hellop->hello_options);
ND_PRINT((ndo, "\n\tOptions [%s]",
bittok2str(ospf6_option_values, "none",
- EXTRACT_32BITS(&hellop->hello_options))));
+ EXTRACT_BE_32BITS(&hellop->hello_options))));
ND_TCHECK(hellop->hello_deadint);
ND_PRINT((ndo, "\n\t Hello Timer %us, Dead Timer %us, Interface-ID %s, Priority %u",
- EXTRACT_16BITS(&hellop->hello_helloint),
- EXTRACT_16BITS(&hellop->hello_deadint),
+ EXTRACT_BE_16BITS(&hellop->hello_helloint),
+ EXTRACT_BE_16BITS(&hellop->hello_deadint),
ipaddr_string(ndo, &hellop->hello_ifid),
hellop->hello_priority));
ND_TCHECK(hellop->hello_dr);
- if (EXTRACT_32BITS(&hellop->hello_dr) != 0)
+ if (EXTRACT_BE_32BITS(&hellop->hello_dr) != 0)
ND_PRINT((ndo, "\n\t Designated Router %s",
ipaddr_string(ndo, &hellop->hello_dr)));
ND_TCHECK(hellop->hello_bdr);
- if (EXTRACT_32BITS(&hellop->hello_bdr) != 0)
+ if (EXTRACT_BE_32BITS(&hellop->hello_bdr) != 0)
ND_PRINT((ndo, ", Backup Designated Router %s",
ipaddr_string(ndo, &hellop->hello_bdr)));
if (ndo->ndo_vflag > 1) {
ND_TCHECK(ddp->db_options);
ND_PRINT((ndo, "\n\tOptions [%s]",
bittok2str(ospf6_option_values, "none",
- EXTRACT_32BITS(&ddp->db_options))));
+ EXTRACT_BE_32BITS(&ddp->db_options))));
ND_TCHECK(ddp->db_flags);
ND_PRINT((ndo, ", DD Flags [%s]",
bittok2str(ospf6_dd_flag_values,"none",ddp->db_flags)));
ND_TCHECK(ddp->db_seq);
ND_PRINT((ndo, ", MTU %u, DD-Sequence 0x%08x",
- EXTRACT_16BITS(&ddp->db_mtu),
- EXTRACT_32BITS(&ddp->db_seq)));
+ EXTRACT_BE_16BITS(&ddp->db_mtu),
+ EXTRACT_BE_32BITS(&ddp->db_seq)));
if (ndo->ndo_vflag > 1) {
/* Print all the LS adv's */
lshp = ddp->db_lshdr;
ND_TCHECK(*lsrp);
ND_PRINT((ndo, "\n\t Advertising Router %s",
ipaddr_string(ndo, &lsrp->ls_router)));
- ospf6_print_ls_type(ndo, EXTRACT_16BITS(&lsrp->ls_type),
+ ospf6_print_ls_type(ndo,
+ EXTRACT_BE_16BITS(&lsrp->ls_type),
&lsrp->ls_stateid);
++lsrp;
}
register const struct lsu6 *lsup = (const struct lsu6 *)((const uint8_t *)op + OSPF6HDR_LEN);
ND_TCHECK(lsup->lsu_count);
- i = EXTRACT_32BITS(&lsup->lsu_count);
+ i = EXTRACT_BE_32BITS(&lsup->lsu_count);
lsap = lsup->lsu_lsa;
while ((const u_char *)lsap < dataend && i--) {
if (ospf6_print_lsa(ndo, lsap, dataend))
goto trunc;
lsap = (const struct lsa6 *)((const u_char *)lsap +
- EXTRACT_16BITS(&lsap->ls_hdr.ls_length));
+ EXTRACT_BE_16BITS(&lsap->ls_hdr.ls_length));
}
}
break;
goto trunc;
/* Checksum */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\tLLS Checksum 0x%04x", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, "\n\tLLS Checksum 0x%04x", EXTRACT_BE_16BITS(cp)));
cp += 2;
/* LLS Data Length */
ND_TCHECK2(*cp, 2);
- llsdatalen = EXTRACT_16BITS(cp);
+ llsdatalen = EXTRACT_BE_16BITS(cp);
ND_PRINT((ndo, ", Data Length %u", llsdatalen));
if (llsdatalen < OSPF_LLS_HDRLEN || llsdatalen > len)
goto trunc;
goto trunc;
/* Authentication Type */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\tAuthentication Type %s", tok2str(ospf6_auth_type_str, "unknown (0x%04x)", EXTRACT_16BITS(cp))));
+ ND_PRINT((ndo, "\n\tAuthentication Type %s", tok2str(ospf6_auth_type_str, "unknown (0x%04x)", EXTRACT_BE_16BITS(cp))));
cp += 2;
/* Auth Data Len */
ND_TCHECK2(*cp, 2);
- authdatalen = EXTRACT_16BITS(cp);
+ authdatalen = EXTRACT_BE_16BITS(cp);
ND_PRINT((ndo, ", Length %u", authdatalen));
if (authdatalen < OSPF6_AT_HDRLEN || authdatalen > len)
goto trunc;
cp += 2;
/* Security Association ID */
ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", SAID %u", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, ", SAID %u", EXTRACT_BE_16BITS(cp)));
cp += 2;
/* Cryptographic Sequence Number (High-Order 32 Bits) */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ", CSN 0x%08x", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ", CSN 0x%08x", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* Cryptographic Sequence Number (Low-Order 32 Bits) */
ND_TCHECK2(*cp, 4);
- ND_PRINT((ndo, ":%08x", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, ":%08x", EXTRACT_BE_32BITS(cp)));
cp += 4;
/* Authentication Data */
ND_TCHECK2(*cp, authdatalen - OSPF6_AT_HDRLEN);
if (op->ospf6_type == OSPF_TYPE_HELLO) {
const struct hello6 *hellop = (const struct hello6 *)((const uint8_t *)op + OSPF6HDR_LEN);
ND_TCHECK(hellop->hello_options);
- if (EXTRACT_32BITS(&hellop->hello_options) & OSPF6_OPTION_L)
+ if (EXTRACT_BE_32BITS(&hellop->hello_options) & OSPF6_OPTION_L)
lls_hello = 1;
} else if (op->ospf6_type == OSPF_TYPE_DD) {
const struct dd6 *ddp = (const struct dd6 *)((const uint8_t *)op + OSPF6HDR_LEN);
ND_TCHECK(ddp->db_options);
- if (EXTRACT_32BITS(&ddp->db_options) & OSPF6_OPTION_L)
+ if (EXTRACT_BE_32BITS(&ddp->db_options) & OSPF6_OPTION_L)
lls_dd = 1;
}
if ((lls_hello || lls_dd) && (llslen = ospf6_print_lls(ndo, cp, len)) < 0)
/* OSPFv3 data always comes first and optional trailing data may follow. */
ND_TCHECK(op->ospf6_len);
- datalen = EXTRACT_16BITS(&op->ospf6_len);
+ datalen = EXTRACT_BE_16BITS(&op->ospf6_len);
if (datalen > length) {
ND_PRINT((ndo, " [len %d]", datalen));
return;
ND_PRINT((ndo, "\n\tRouter-ID %s", ipaddr_string(ndo, &op->ospf6_routerid)));
ND_TCHECK(op->ospf6_areaid);
- if (EXTRACT_32BITS(&op->ospf6_areaid) != 0)
+ if (EXTRACT_BE_32BITS(&op->ospf6_areaid) != 0)
ND_PRINT((ndo, ", Area %s", ipaddr_string(ndo, &op->ospf6_areaid)));
else
ND_PRINT((ndo, ", Backbone Area"));
bp += 1;
ND_TCHECK2(*bp, 3);
- ND_PRINT((ndo, "overlay %u, ", EXTRACT_24BITS(bp)));
+ ND_PRINT((ndo, "overlay %u, ", EXTRACT_BE_24BITS(bp)));
bp += 3;
ND_TCHECK2(*bp, 3);
- ND_PRINT((ndo, "instance %u\n", EXTRACT_24BITS(bp)));
+ ND_PRINT((ndo, "instance %u\n", EXTRACT_BE_24BITS(bp)));
bp += 3;
/* Reserved */
{
uint32_t rulenr, subrulenr;
- rulenr = EXTRACT_32BITS(&hdr->rulenr);
- subrulenr = EXTRACT_32BITS(&hdr->subrulenr);
+ rulenr = EXTRACT_BE_32BITS(&hdr->rulenr);
+ subrulenr = EXTRACT_BE_32BITS(&hdr->subrulenr);
if (subrulenr == (uint32_t)-1)
ND_PRINT((ndo, "rule %u/", rulenr));
else
return;
}
- sport = EXTRACT_16BITS(&pgm->pgm_sport);
- dport = EXTRACT_16BITS(&pgm->pgm_dport);
+ sport = EXTRACT_BE_16BITS(&pgm->pgm_sport);
+ dport = EXTRACT_BE_16BITS(&pgm->pgm_dport);
if (ip6) {
if (ip6->ip6_nxt == IPPROTO_PGM) {
ND_TCHECK(*pgm);
- ND_PRINT((ndo, "PGM, length %u", EXTRACT_16BITS(&pgm->pgm_length)));
+ ND_PRINT((ndo, "PGM, length %u", EXTRACT_BE_16BITS(&pgm->pgm_length)));
if (!ndo->ndo_vflag)
return;
ND_TCHECK(*spm);
bp = (const u_char *) (spm + 1);
- switch (EXTRACT_16BITS(&spm->pgms_nla_afi)) {
+ switch (EXTRACT_BE_16BITS(&spm->pgms_nla_afi)) {
case AFNUM_INET:
ND_TCHECK2(*bp, sizeof(struct in_addr));
addrtostr(bp, nla_buf, sizeof(nla_buf));
}
ND_PRINT((ndo, "SPM seq %u trail %u lead %u nla %s",
- EXTRACT_32BITS(&spm->pgms_seq),
- EXTRACT_32BITS(&spm->pgms_trailseq),
- EXTRACT_32BITS(&spm->pgms_leadseq),
- nla_buf));
+ EXTRACT_BE_32BITS(&spm->pgms_seq),
+ EXTRACT_BE_32BITS(&spm->pgms_trailseq),
+ EXTRACT_BE_32BITS(&spm->pgms_leadseq),
+ nla_buf));
break;
}
poll_msg = (const struct pgm_poll *)(pgm + 1);
ND_TCHECK(*poll_msg);
ND_PRINT((ndo, "POLL seq %u round %u",
- EXTRACT_32BITS(&poll_msg->pgmp_seq),
- EXTRACT_16BITS(&poll_msg->pgmp_round)));
+ EXTRACT_BE_32BITS(&poll_msg->pgmp_seq),
+ EXTRACT_BE_16BITS(&poll_msg->pgmp_round)));
bp = (const u_char *) (poll_msg + 1);
break;
}
ND_TCHECK(*polr);
bp = (const u_char *) (polr + 1);
- switch (EXTRACT_16BITS(&polr->pgmp_nla_afi)) {
+ switch (EXTRACT_BE_16BITS(&polr->pgmp_nla_afi)) {
case AFNUM_INET:
ND_TCHECK2(*bp, sizeof(struct in_addr));
addrtostr(bp, nla_buf, sizeof(nla_buf));
}
ND_TCHECK2(*bp, sizeof(uint32_t));
- ivl = EXTRACT_32BITS(bp);
+ ivl = EXTRACT_BE_32BITS(bp);
bp += sizeof(uint32_t);
ND_TCHECK2(*bp, sizeof(uint32_t));
- rnd = EXTRACT_32BITS(bp);
+ rnd = EXTRACT_BE_32BITS(bp);
bp += sizeof(uint32_t);
ND_TCHECK2(*bp, sizeof(uint32_t));
- mask = EXTRACT_32BITS(bp);
+ mask = EXTRACT_BE_32BITS(bp);
bp += sizeof(uint32_t);
ND_PRINT((ndo, "POLR seq %u round %u nla %s ivl %u rnd 0x%08x "
- "mask 0x%08x", EXTRACT_32BITS(&polr->pgmp_seq),
- EXTRACT_16BITS(&polr->pgmp_round), nla_buf, ivl, rnd, mask));
+ "mask 0x%08x", EXTRACT_BE_32BITS(&polr->pgmp_seq),
+ EXTRACT_BE_16BITS(&polr->pgmp_round), nla_buf, ivl, rnd, mask));
break;
}
case PGM_ODATA: {
odata = (const struct pgm_data *)(pgm + 1);
ND_TCHECK(*odata);
ND_PRINT((ndo, "ODATA trail %u seq %u",
- EXTRACT_32BITS(&odata->pgmd_trailseq),
- EXTRACT_32BITS(&odata->pgmd_seq)));
+ EXTRACT_BE_32BITS(&odata->pgmd_trailseq),
+ EXTRACT_BE_32BITS(&odata->pgmd_seq)));
bp = (const u_char *) (odata + 1);
break;
}
rdata = (const struct pgm_data *)(pgm + 1);
ND_TCHECK(*rdata);
ND_PRINT((ndo, "RDATA trail %u seq %u",
- EXTRACT_32BITS(&rdata->pgmd_trailseq),
- EXTRACT_32BITS(&rdata->pgmd_seq)));
+ EXTRACT_BE_32BITS(&rdata->pgmd_trailseq),
+ EXTRACT_BE_32BITS(&rdata->pgmd_seq)));
bp = (const u_char *) (rdata + 1);
break;
}
* Skip past the source, saving info along the way
* and stopping if we don't have enough.
*/
- switch (EXTRACT_16BITS(&nak->pgmn_source_afi)) {
+ switch (EXTRACT_BE_16BITS(&nak->pgmn_source_afi)) {
case AFNUM_INET:
ND_TCHECK2(*bp, sizeof(struct in_addr));
addrtostr(bp, source_buf, sizeof(source_buf));
*/
bp += (2 * sizeof(uint16_t));
ND_TCHECK_16BITS(bp);
- switch (EXTRACT_16BITS(bp)) {
+ switch (EXTRACT_BE_16BITS(bp)) {
case AFNUM_INET:
ND_TCHECK2(*bp, sizeof(struct in_addr));
addrtostr(bp, group_buf, sizeof(group_buf));
break;
}
ND_PRINT((ndo, "(%s -> %s), seq %u",
- source_buf, group_buf, EXTRACT_32BITS(&nak->pgmn_seq)));
+ source_buf, group_buf, EXTRACT_BE_32BITS(&nak->pgmn_seq)));
break;
}
ack = (const struct pgm_ack *)(pgm + 1);
ND_TCHECK(*ack);
ND_PRINT((ndo, "ACK seq %u",
- EXTRACT_32BITS(&ack->pgma_rx_max_seq)));
+ EXTRACT_BE_32BITS(&ack->pgma_rx_max_seq)));
bp = (const u_char *) (ack + 1);
break;
}
ND_PRINT((ndo, "[Bad OPT_LENGTH option, length %u != 4]", opt_len));
return;
}
- opts_len = EXTRACT_16BITS(bp);
+ opts_len = EXTRACT_BE_16BITS(bp);
if (opts_len < 4) {
ND_PRINT((ndo, "[Bad total option length %u < 4]", opts_len));
return;
opt_len, PGM_OPT_LENGTH_LEN));
return;
}
- ND_PRINT((ndo, " OPTS LEN (extra?) %d", EXTRACT_16BITS(bp)));
+ ND_PRINT((ndo, " OPTS LEN (extra?) %d", EXTRACT_BE_16BITS(bp)));
bp += 2;
opts_len -= PGM_OPT_LENGTH_LEN;
break;
return;
}
bp += 2;
- seq = EXTRACT_32BITS(bp);
+ seq = EXTRACT_BE_32BITS(bp);
bp += 4;
- offset = EXTRACT_32BITS(bp);
+ offset = EXTRACT_BE_32BITS(bp);
bp += 4;
- len = EXTRACT_32BITS(bp);
+ len = EXTRACT_BE_32BITS(bp);
bp += 4;
ND_PRINT((ndo, " FRAG seq %u off %u len %u", seq, offset, len));
opts_len -= PGM_OPT_FRAGMENT_LEN;
return;
}
ND_TCHECK2(*bp, 4);
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(bp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(bp)));
bp += 4;
opt_len -= 4;
opts_len -= 4;
return;
}
bp += 2;
- seq = EXTRACT_32BITS(bp);
+ seq = EXTRACT_BE_32BITS(bp);
bp += 4;
ND_PRINT((ndo, " JOIN %u", seq));
opts_len -= PGM_OPT_JOIN_LEN;
return;
}
bp += 2;
- offset = EXTRACT_32BITS(bp);
+ offset = EXTRACT_BE_32BITS(bp);
bp += 4;
- seq = EXTRACT_32BITS(bp);
+ seq = EXTRACT_BE_32BITS(bp);
bp += 4;
ND_PRINT((ndo, " BACKOFF ivl %u ivlseq %u", offset, seq));
opts_len -= PGM_OPT_NAK_BO_IVL_LEN;
return;
}
bp += 2;
- offset = EXTRACT_32BITS(bp);
+ offset = EXTRACT_BE_32BITS(bp);
bp += 4;
- seq = EXTRACT_32BITS(bp);
+ seq = EXTRACT_BE_32BITS(bp);
bp += 4;
ND_PRINT((ndo, " BACKOFF max %u min %u", offset, seq));
opts_len -= PGM_OPT_NAK_BO_RNG_LEN;
return;
}
bp += 2;
- nla_afnum = EXTRACT_16BITS(bp);
+ nla_afnum = EXTRACT_BE_16BITS(bp);
bp += 2+2;
switch (nla_afnum) {
case AFNUM_INET:
return;
}
bp += 2;
- len = EXTRACT_32BITS(bp);
+ len = EXTRACT_BE_32BITS(bp);
bp += 4;
ND_PRINT((ndo, " PARITY MAXTGS %u", len));
opts_len -= PGM_OPT_PARITY_PRM_LEN;
return;
}
bp += 2;
- seq = EXTRACT_32BITS(bp);
+ seq = EXTRACT_BE_32BITS(bp);
bp += 4;
ND_PRINT((ndo, " PARITY GROUP %u", seq));
opts_len -= PGM_OPT_PARITY_GRP_LEN;
return;
}
bp += 2;
- len = EXTRACT_32BITS(bp);
+ len = EXTRACT_BE_32BITS(bp);
bp += 4;
ND_PRINT((ndo, " PARITY ATGS %u", len));
opts_len -= PGM_OPT_CURR_TGSIZE_LEN;
return;
}
bp += 2;
- offset = EXTRACT_32BITS(bp);
+ offset = EXTRACT_BE_32BITS(bp);
bp += 4;
- nla_afnum = EXTRACT_16BITS(bp);
+ nla_afnum = EXTRACT_BE_16BITS(bp);
bp += 2+2;
switch (nla_afnum) {
case AFNUM_INET:
return;
}
bp += 2;
- offset = EXTRACT_32BITS(bp);
+ offset = EXTRACT_BE_32BITS(bp);
bp += 4;
- nla_afnum = EXTRACT_16BITS(bp);
+ nla_afnum = EXTRACT_BE_16BITS(bp);
bp += 2+2;
switch (nla_afnum) {
case AFNUM_INET:
ND_PRINT((ndo, " [%u]", length));
if (ndo->ndo_packettype == PT_PGM_ZMTP1 &&
(pgm->pgm_type == PGM_ODATA || pgm->pgm_type == PGM_RDATA))
- zmtp1_datagram_print(ndo, bp, EXTRACT_16BITS(&pgm->pgm_length));
+ zmtp1_datagram_print(ndo, bp,
+ EXTRACT_BE_16BITS(&pgm->pgm_length));
return;
/* If it's a single group and a single source, use 1-line output. */
if (ND_TTEST2(bp[0], 30) && bp[11] == 1 &&
- ((njoin = EXTRACT_16BITS(&bp[20])) + EXTRACT_16BITS(&bp[22])) == 1) {
+ ((njoin = EXTRACT_BE_16BITS(&bp[20])) + EXTRACT_BE_16BITS(&bp[22])) == 1) {
int hold;
ND_PRINT((ndo, " RPF %s ", ipaddr_string(ndo, bp)));
- hold = EXTRACT_16BITS(&bp[6]);
+ hold = EXTRACT_BE_16BITS(&bp[6]);
if (hold != 180) {
ND_PRINT((ndo, "Hold "));
unsigned_relts_print(ndo, hold);
ND_PRINT((ndo, "%s (%s/%d, %s", njoin ? "Join" : "Prune",
ipaddr_string(ndo, &bp[26]), bp[25] & 0x3f,
ipaddr_string(ndo, &bp[12])));
- if (EXTRACT_32BITS(&bp[16]) != 0xffffffff)
+ if (EXTRACT_BE_32BITS(&bp[16]) != 0xffffffff)
ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[16])));
ND_PRINT((ndo, ") %s%s %s",
(bp[24] & 0x01) ? "Sparse" : "Dense",
if (ndo->ndo_vflag > 1)
ND_PRINT((ndo, "\n"));
ND_PRINT((ndo, " Hold time: "));
- unsigned_relts_print(ndo, EXTRACT_16BITS(&bp[2]));
+ unsigned_relts_print(ndo, EXTRACT_BE_16BITS(&bp[2]));
if (ndo->ndo_vflag < 2)
return;
bp += 4;
if (len < 4)
goto trunc;
ND_TCHECK2(bp[0], sizeof(struct in_addr));
- if (EXTRACT_32BITS(&bp[0]) != 0xffffffff)
+ if (EXTRACT_BE_32BITS(&bp[0]) != 0xffffffff)
ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[0])));
bp += 4;
len -= 4;
if (len < 4)
goto trunc;
ND_TCHECK2(bp[0], 4);
- njoin = EXTRACT_16BITS(&bp[0]);
- nprune = EXTRACT_16BITS(&bp[2]);
+ njoin = EXTRACT_BE_16BITS(&bp[0]);
+ nprune = EXTRACT_BE_16BITS(&bp[2]);
ND_PRINT((ndo, " joined: %d pruned: %d", njoin, nprune));
bp += 4;
len -= 4;
if (ndo->ndo_vflag) {
ND_TCHECK2(bp[10],2);
ND_PRINT((ndo, " (Hold-time "));
- unsigned_relts_print(ndo, EXTRACT_16BITS(&bp[10]));
+ unsigned_relts_print(ndo, EXTRACT_BE_16BITS(&bp[10]));
ND_PRINT((ndo, ")"));
}
break;
if (ndo->ndo_vflag) {
ND_TCHECK2(bp[22], 2);
ND_PRINT((ndo, " group %s", ipaddr_string(ndo, &bp[8])));
- if (EXTRACT_32BITS(&bp[12]) != 0xffffffff)
+ if (EXTRACT_BE_32BITS(&bp[12]) != 0xffffffff)
ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12])));
ND_PRINT((ndo, " RP %s hold ", ipaddr_string(ndo, &bp[16])));
- unsigned_relts_print(ndo, EXTRACT_16BITS(&bp[22]));
+ unsigned_relts_print(ndo, EXTRACT_BE_16BITS(&bp[22]));
}
break;
case PIMV1_TYPE_ASSERT:
ND_TCHECK2(bp[16], sizeof(struct in_addr));
ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[16]),
ipaddr_string(ndo, &bp[8])));
- if (EXTRACT_32BITS(&bp[12]) != 0xffffffff)
+ if (EXTRACT_BE_32BITS(&bp[12]) != 0xffffffff)
ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12])));
ND_TCHECK2(bp[24], 4);
ND_PRINT((ndo, " %s pref %d metric %d",
(bp[20] & 0x80) ? "RP-tree" : "SPT",
- EXTRACT_32BITS(&bp[20]) & 0x7fffffff,
- EXTRACT_32BITS(&bp[24])));
+ EXTRACT_BE_32BITS(&bp[20]) & 0x7fffffff,
+ EXTRACT_BE_32BITS(&bp[24])));
break;
case PIMV1_TYPE_JOIN_PRUNE:
case PIMV1_TYPE_GRAFT:
ND_TCHECK2(bp[2], 2);
ND_PRINT((ndo, " Hold "));
- hold = EXTRACT_16BITS(&bp[2]);
+ hold = EXTRACT_BE_16BITS(&bp[2]);
if (hold)
- unsigned_relts_print(ndo, EXTRACT_16BITS(&bp[2]));
+ unsigned_relts_print(ndo, EXTRACT_BE_16BITS(&bp[2]));
else
ND_PRINT((ndo, "FOREVER"));
if (len < 4)
goto trunc;
ND_TCHECK(pim->pim_cksum);
- ND_PRINT((ndo, ", cksum 0x%04x ", EXTRACT_16BITS(&pim->pim_cksum)));
- if (EXTRACT_16BITS(&pim->pim_cksum) == 0) {
+ ND_PRINT((ndo, ", cksum 0x%04x ", EXTRACT_BE_16BITS(&pim->pim_cksum)));
+ if (EXTRACT_BE_16BITS(&pim->pim_cksum) == 0) {
ND_PRINT((ndo, "(unverified)"));
} else {
if (PIM_TYPE(pim->pim_typever) == PIMV2_TYPE_REGISTER) {
if (len < 4)
goto trunc;
ND_TCHECK2(bp[0], 4);
- otype = EXTRACT_16BITS(&bp[0]);
- olen = EXTRACT_16BITS(&bp[2]);
+ otype = EXTRACT_BE_16BITS(&bp[0]);
+ olen = EXTRACT_BE_16BITS(&bp[2]);
ND_PRINT((ndo, "\n\t %s Option (%u), length %u, Value: ",
tok2str(pimv2_hello_option_values, "Unknown", otype),
otype,
if (olen != 2) {
ND_PRINT((ndo, "ERROR: Option Length != 2 Bytes (%u)", olen));
} else {
- unsigned_relts_print(ndo, EXTRACT_16BITS(bp));
+ unsigned_relts_print(ndo,
+ EXTRACT_BE_16BITS(bp));
}
break;
} else {
char t_bit;
uint16_t lan_delay, override_interval;
- lan_delay = EXTRACT_16BITS(bp);
- override_interval = EXTRACT_16BITS(bp+2);
+ lan_delay = EXTRACT_BE_16BITS(bp);
+ override_interval = EXTRACT_BE_16BITS(bp + 2);
t_bit = (lan_delay & 0x8000)? 1 : 0;
lan_delay &= ~0x8000;
ND_PRINT((ndo, "\n\t T-bit=%d, LAN delay %dms, Override interval %dms",
ND_PRINT((ndo, "Bi-Directional Capability (Old)"));
break;
case 4:
- ND_PRINT((ndo, "%u", EXTRACT_32BITS(bp)));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(bp)));
break;
default:
ND_PRINT((ndo, "ERROR: Option Length != 4 Bytes (%u)", olen));
if (olen != 4) {
ND_PRINT((ndo, "ERROR: Option Length != 4 Bytes (%u)", olen));
} else {
- ND_PRINT((ndo, "0x%08x", EXTRACT_32BITS(bp)));
+ ND_PRINT((ndo, "0x%08x", EXTRACT_BE_32BITS(bp)));
}
break;
ND_PRINT((ndo, ", interval "));
unsigned_relts_print(ndo, *(bp+1));
}
- if (EXTRACT_16BITS(bp+2) != 0) {
- ND_PRINT((ndo, " ?0x%04x?", EXTRACT_16BITS(bp+2)));
+ if (EXTRACT_BE_16BITS(bp + 2) != 0) {
+ ND_PRINT((ndo, " ?0x%04x?", EXTRACT_BE_16BITS(bp + 2)));
}
}
break;
ND_PRINT((ndo, ", Flags [ %s ]\n\t",
tok2str(pimv2_register_flag_values,
"none",
- EXTRACT_32BITS(bp))));
+ EXTRACT_BE_32BITS(bp))));
bp += 4; len -= 4;
/* encapsulated multicast packet */
goto trunc;
ND_TCHECK2(*bp, 4);
ngroup = bp[1];
- holdtime = EXTRACT_16BITS(&bp[2]);
+ holdtime = EXTRACT_BE_16BITS(&bp[2]);
ND_PRINT((ndo, "\n\t %u group(s)", ngroup));
if (PIM_TYPE(pim->pim_typever) != 7) { /*not for Graft-ACK*/
ND_PRINT((ndo, ", holdtime: "));
if (len < 4)
goto trunc;
ND_TCHECK2(*bp, 4);
- njoin = EXTRACT_16BITS(&bp[0]);
- nprune = EXTRACT_16BITS(&bp[2]);
+ njoin = EXTRACT_BE_16BITS(&bp[0]);
+ nprune = EXTRACT_BE_16BITS(&bp[2]);
ND_PRINT((ndo, ", joined sources: %u, pruned sources: %u", njoin, nprune));
bp += 4; len -= 4;
for (j = 0; j < njoin; j++) {
if (len < 2)
goto trunc;
ND_TCHECK_16BITS(bp);
- ND_PRINT((ndo, " tag=%x", EXTRACT_16BITS(bp)));
+ ND_PRINT((ndo, " tag=%x", EXTRACT_BE_16BITS(bp)));
bp += 2;
len -= 2;
if (len < 1)
goto trunc;
ND_TCHECK_16BITS(bp);
ND_PRINT((ndo, ",holdtime="));
- unsigned_relts_print(ndo, EXTRACT_16BITS(bp));
+ unsigned_relts_print(ndo,
+ EXTRACT_BE_16BITS(bp));
if (len < 3)
goto trunc;
ND_TCHECK(bp[2]);
ND_TCHECK2(*bp, 8);
if (bp[0] & 0x80)
ND_PRINT((ndo, " RPT"));
- ND_PRINT((ndo, " pref=%u", EXTRACT_32BITS(&bp[0]) & 0x7fffffff));
- ND_PRINT((ndo, " metric=%u", EXTRACT_32BITS(&bp[4])));
+ ND_PRINT((ndo, " pref=%u", EXTRACT_BE_32BITS(&bp[0]) & 0x7fffffff));
+ ND_PRINT((ndo, " metric=%u", EXTRACT_BE_32BITS(&bp[4])));
break;
case PIMV2_TYPE_CANDIDATE_RP:
goto trunc;
ND_TCHECK_16BITS(&bp[2]);
ND_PRINT((ndo, " holdtime="));
- unsigned_relts_print(ndo, EXTRACT_16BITS(&bp[2]));
+ unsigned_relts_print(ndo, EXTRACT_BE_16BITS(&bp[2]));
bp += 4;
len -= 4;
goto trunc;
ND_TCHECK_16BITS(bp);
ND_PRINT((ndo, " TUNR "));
- unsigned_relts_print(ndo, EXTRACT_16BITS(bp));
+ unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp));
break;
return; /* there may be a NULL confreq etc. */
ND_TCHECK2(*tptr, 2);
- len = EXTRACT_16BITS(tptr);
+ len = EXTRACT_BE_16BITS(tptr);
tptr += 2;
ND_PRINT((ndo, "\n\tencoded length %u (=Option(s) length %u)", len, len - 4));
if (length < 11)
break;
ND_TCHECK2(*tptr, 4);
- ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_32BITS(tptr)));
tptr += 4;
ND_TCHECK2(*tptr, 3);
ND_PRINT((ndo, " Vendor: %s (%u)",
- tok2str(oui_values,"Unknown",EXTRACT_24BITS(tptr)),
- EXTRACT_24BITS(tptr)));
+ tok2str(oui_values,"Unknown",EXTRACT_BE_24BITS(tptr)),
+ EXTRACT_BE_24BITS(tptr)));
/* XXX: need to decode Kind and Value(s)? */
break;
case CPCODES_CONF_REQ:
break;
ND_TCHECK2(*tptr, 2);
ND_PRINT((ndo, "\n\t Rejected %s Protocol (0x%04x)",
- tok2str(ppptype2str,"unknown", EXTRACT_16BITS(tptr)),
- EXTRACT_16BITS(tptr)));
+ tok2str(ppptype2str,"unknown", EXTRACT_BE_16BITS(tptr)),
+ EXTRACT_BE_16BITS(tptr)));
/* XXX: need to decode Rejected-Information? - hexdump for now */
if (len > 6) {
ND_PRINT((ndo, "\n\t Rejected Packet"));
if (length < 8)
break;
ND_TCHECK2(*tptr, 4);
- ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_32BITS(tptr)));
/* XXX: need to decode Data? - hexdump for now */
if (len > 8) {
ND_PRINT((ndo, "\n\t -----trailing data-----"));
if (length < 8)
break;
ND_TCHECK2(*tptr, 4);
- ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_32BITS(tptr)));
/* RFC 1661 says this is intended to be human readable */
if (len > 8) {
ND_PRINT((ndo, "\n\t Message\n\t "));
if (length < 12)
break;
ND_TCHECK2(*tptr, 4);
- ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Magic-Num 0x%08x", EXTRACT_BE_32BITS(tptr)));
ND_TCHECK2(*(tptr + 4), 4);
- ND_PRINT((ndo, ", Seconds-Remaining %us", EXTRACT_32BITS(tptr + 4)));
+ ND_PRINT((ndo, ", Seconds-Remaining %us", EXTRACT_BE_32BITS(tptr + 4)));
/* XXX: need to decode Message? */
break;
default:
}
ND_TCHECK_24BITS(p + 2);
ND_PRINT((ndo, ": Vendor: %s (%u)",
- tok2str(oui_values,"Unknown",EXTRACT_24BITS(p+2)),
- EXTRACT_24BITS(p + 2)));
+ tok2str(oui_values,"Unknown",EXTRACT_BE_24BITS(p + 2)),
+ EXTRACT_BE_24BITS(p + 2)));
#if 0
ND_TCHECK(p[5]);
ND_PRINT((ndo, ", kind: 0x%02x", p[5]));
return len;
}
ND_TCHECK_16BITS(p + 2);
- ND_PRINT((ndo, ": %u", EXTRACT_16BITS(p + 2)));
+ ND_PRINT((ndo, ": %u", EXTRACT_BE_16BITS(p + 2)));
break;
case LCPOPT_ACCM:
if (len != 6) {
return len;
}
ND_TCHECK_32BITS(p + 2);
- ND_PRINT((ndo, ": 0x%08x", EXTRACT_32BITS(p + 2)));
+ ND_PRINT((ndo, ": 0x%08x", EXTRACT_BE_32BITS(p + 2)));
break;
case LCPOPT_AP:
if (len < 4) {
return len;
}
ND_TCHECK_16BITS(p + 2);
- ND_PRINT((ndo, ": %s", tok2str(ppptype2str, "Unknown Auth Proto (0x04x)", EXTRACT_16BITS(p + 2))));
+ ND_PRINT((ndo, ": %s", tok2str(ppptype2str, "Unknown Auth Proto (0x04x)", EXTRACT_BE_16BITS(p + 2))));
- switch (EXTRACT_16BITS(p+2)) {
+ switch (EXTRACT_BE_16BITS(p + 2)) {
case PPP_CHAP:
ND_TCHECK(p[4]);
ND_PRINT((ndo, ", %s", tok2str(authalg_values, "Unknown Auth Alg %u", p[4])));
return 0;
}
ND_TCHECK_16BITS(p+2);
- if (EXTRACT_16BITS(p+2) == PPP_LQM)
+ if (EXTRACT_BE_16BITS(p + 2) == PPP_LQM)
ND_PRINT((ndo, ": LQR"));
else
ND_PRINT((ndo, ": unknown"));
return 0;
}
ND_TCHECK_32BITS(p + 2);
- ND_PRINT((ndo, ": 0x%08x", EXTRACT_32BITS(p + 2)));
+ ND_PRINT((ndo, ": 0x%08x", EXTRACT_BE_32BITS(p + 2)));
break;
case LCPOPT_PFC:
break;
return 0;
}
ND_TCHECK_16BITS(p + 2);
- ND_PRINT((ndo, ": 0x%04x", EXTRACT_16BITS(p + 2)));
+ ND_PRINT((ndo, ": 0x%04x", EXTRACT_BE_16BITS(p + 2)));
break;
case LCPOPT_CBACK:
if (len < 3) {
return 0;
}
ND_TCHECK_16BITS(p + 2);
- ND_PRINT((ndo, ": %u", EXTRACT_16BITS(p + 2)));
+ ND_PRINT((ndo, ": %u", EXTRACT_BE_16BITS(p + 2)));
break;
case LCPOPT_MLED:
if (len < 3) {
}
ND_PRINT((ndo, "seq 0x%03x, Flags [%s], length %u",
- (EXTRACT_16BITS(p))&0x0fff, /* only support 12-Bit sequence space for now */
+ (EXTRACT_BE_16BITS(p))&0x0fff, /* only support 12-Bit sequence space for now */
bittok2str(ppp_ml_flag_values, "none", *p & 0xc0),
length));
}
p++;
ND_TCHECK2(*p, 2);
- len = EXTRACT_16BITS(p);
+ len = EXTRACT_BE_16BITS(p);
p += 2;
/*
p++;
ND_TCHECK2(*p, 2);
- len = EXTRACT_16BITS(p);
+ len = EXTRACT_BE_16BITS(p);
p += 2;
if ((int)len > length) {
return 0;
}
ND_TCHECK_16BITS(p+2);
- compproto = EXTRACT_16BITS(p+2);
+ compproto = EXTRACT_BE_16BITS(p + 2);
ND_PRINT((ndo, ": %s (0x%02x):",
tok2str(ipcpopt_compproto_values, "Unknown", compproto),
ND_TCHECK2(*(p + 2), IPCPOPT_IPCOMP_MINLEN);
ND_PRINT((ndo, "\n\t TCP Space %u, non-TCP Space %u" \
", maxPeriod %u, maxTime %u, maxHdr %u",
- EXTRACT_16BITS(p+4),
- EXTRACT_16BITS(p+6),
- EXTRACT_16BITS(p+8),
- EXTRACT_16BITS(p+10),
- EXTRACT_16BITS(p+12)));
+ EXTRACT_BE_16BITS(p + 4),
+ EXTRACT_BE_16BITS(p + 6),
+ EXTRACT_BE_16BITS(p + 8),
+ EXTRACT_BE_16BITS(p + 10),
+ EXTRACT_BE_16BITS(p + 12)));
/* suboptions present ? */
if (len > IPCPOPT_IPCOMP_MINLEN) {
}
ND_TCHECK2(*(p + 2), 8);
ND_PRINT((ndo, ": %04x:%04x:%04x:%04x",
- EXTRACT_16BITS(p + 2),
- EXTRACT_16BITS(p + 4),
- EXTRACT_16BITS(p + 6),
- EXTRACT_16BITS(p + 8)));
+ EXTRACT_BE_16BITS(p + 2),
+ EXTRACT_BE_16BITS(p + 4),
+ EXTRACT_BE_16BITS(p + 6),
+ EXTRACT_BE_16BITS(p + 8)));
break;
default:
/*
return len;
}
ND_TCHECK_32BITS(p + 2);
- ND_PRINT((ndo, ": Magic-Num 0x%08x", EXTRACT_32BITS(p + 2)));
+ ND_PRINT((ndo, ": Magic-Num 0x%08x", EXTRACT_BE_32BITS(p + 2)));
break;
default:
/*
if (length < 2)
goto trunc;
- proto = EXTRACT_16BITS(b); /* next guess - load two octets */
+ proto = EXTRACT_BE_16BITS(b); /* next guess - load two octets */
switch (proto) {
case (PPP_ADDRESS << 8 | PPP_CONTROL): /* looks like a PPP frame */
if (length < 4)
goto trunc;
- proto = EXTRACT_16BITS(b+2); /* load the PPP proto-id */
+ proto = EXTRACT_BE_16BITS(b + 2); /* load the PPP proto-id */
handle_ppp(ndo, proto, b + 4, length - 4);
break;
default: /* last guess - proto must be a PPP proto-id */
if (length < 2)
goto trunc;
ND_TCHECK2(*p, 2);
- ppp_header = EXTRACT_16BITS(p);
+ ppp_header = EXTRACT_BE_16BITS(p);
switch(ppp_header) {
case (PPP_WITHDIRECTION_IN << 8 | PPP_CONTROL):
hdr_len++;
} else {
ND_TCHECK2(*p, 2);
- proto = EXTRACT_16BITS(p);
+ proto = EXTRACT_BE_16BITS(p);
p += 2;
length -= 2;
hdr_len += 2;
length -= 2;
hdrlen += 2;
- proto = EXTRACT_16BITS(p);
+ proto = EXTRACT_BE_16BITS(p);
p += 2;
length -= 2;
hdrlen += 2;
pppoe_ver = (pppoe_packet[0] & 0xF0) >> 4;
pppoe_type = (pppoe_packet[0] & 0x0F);
pppoe_code = pppoe_packet[1];
- pppoe_sessionid = EXTRACT_16BITS(pppoe_packet + 2);
- pppoe_length = EXTRACT_16BITS(pppoe_packet + 4);
+ pppoe_sessionid = EXTRACT_BE_16BITS(pppoe_packet + 2);
+ pppoe_length = EXTRACT_BE_16BITS(pppoe_packet + 4);
pppoe_payload = pppoe_packet + PPPOE_HDRLEN;
if (pppoe_ver != 1) {
*/
while (tag_type && p < pppoe_payload + pppoe_length) {
ND_TCHECK2(*p, 4);
- tag_type = EXTRACT_16BITS(p);
- tag_len = EXTRACT_16BITS(p + 2);
+ tag_type = EXTRACT_BE_16BITS(p);
+ tag_len = EXTRACT_BE_16BITS(p + 2);
p += 4;
/* p points to tag_value */
const uint32_t *bearer_cap)
{
ND_PRINT((ndo, " BEARER_CAP(%s%s)",
- EXTRACT_32BITS(bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK ? "D" : "",
- EXTRACT_32BITS(bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK ? "A" : ""));
+ EXTRACT_BE_32BITS(bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK ? "D" : "",
+ EXTRACT_BE_32BITS(bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK ? "A" : ""));
}
static const struct tok pptp_btype_str[] = {
const uint32_t *bearer_type)
{
ND_PRINT((ndo, " BEARER_TYPE(%s)",
- tok2str(pptp_btype_str, "?", EXTRACT_32BITS(bearer_type))));
+ tok2str(pptp_btype_str, "?", EXTRACT_BE_32BITS(bearer_type))));
}
static void
pptp_call_id_print(netdissect_options *ndo,
const uint16_t *call_id)
{
- ND_PRINT((ndo, " CALL_ID(%u)", EXTRACT_16BITS(call_id)));
+ ND_PRINT((ndo, " CALL_ID(%u)", EXTRACT_BE_16BITS(call_id)));
}
static void
pptp_call_ser_print(netdissect_options *ndo,
const uint16_t *call_ser)
{
- ND_PRINT((ndo, " CALL_SER_NUM(%u)", EXTRACT_16BITS(call_ser)));
+ ND_PRINT((ndo, " CALL_SER_NUM(%u)", EXTRACT_BE_16BITS(call_ser)));
}
static void
pptp_cause_code_print(netdissect_options *ndo,
const uint16_t *cause_code)
{
- ND_PRINT((ndo, " CAUSE_CODE(%u)", EXTRACT_16BITS(cause_code)));
+ ND_PRINT((ndo, " CAUSE_CODE(%u)", EXTRACT_BE_16BITS(cause_code)));
}
static void
pptp_conn_speed_print(netdissect_options *ndo,
const uint32_t *conn_speed)
{
- ND_PRINT((ndo, " CONN_SPEED(%u)", EXTRACT_32BITS(conn_speed)));
+ ND_PRINT((ndo, " CONN_SPEED(%u)", EXTRACT_BE_32BITS(conn_speed)));
}
static const struct tok pptp_errcode_str[] = {
pptp_firm_rev_print(netdissect_options *ndo,
const uint16_t *firm_rev)
{
- ND_PRINT((ndo, " FIRM_REV(%u)", EXTRACT_16BITS(firm_rev)));
+ ND_PRINT((ndo, " FIRM_REV(%u)", EXTRACT_BE_16BITS(firm_rev)));
}
static void
const uint32_t *framing_cap)
{
ND_PRINT((ndo, " FRAME_CAP("));
- if (EXTRACT_32BITS(framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) {
+ if (EXTRACT_BE_32BITS(framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) {
ND_PRINT((ndo, "A")); /* Async */
}
- if (EXTRACT_32BITS(framing_cap) & PPTP_FRAMING_CAP_SYNC_MASK) {
+ if (EXTRACT_BE_32BITS(framing_cap) & PPTP_FRAMING_CAP_SYNC_MASK) {
ND_PRINT((ndo, "S")); /* Sync */
}
ND_PRINT((ndo, ")"));
const uint32_t *framing_type)
{
ND_PRINT((ndo, " FRAME_TYPE(%s)",
- tok2str(pptp_ftype_str, "?", EXTRACT_32BITS(framing_type))));
+ tok2str(pptp_ftype_str, "?", EXTRACT_BE_32BITS(framing_type))));
}
static void
pptp_id_print(netdissect_options *ndo,
const uint32_t *id)
{
- ND_PRINT((ndo, " ID(%u)", EXTRACT_32BITS(id)));
+ ND_PRINT((ndo, " ID(%u)", EXTRACT_BE_32BITS(id)));
}
static void
pptp_max_channel_print(netdissect_options *ndo,
const uint16_t *max_channel)
{
- ND_PRINT((ndo, " MAX_CHAN(%u)", EXTRACT_16BITS(max_channel)));
+ ND_PRINT((ndo, " MAX_CHAN(%u)", EXTRACT_BE_16BITS(max_channel)));
}
static void
pptp_peer_call_id_print(netdissect_options *ndo,
const uint16_t *peer_call_id)
{
- ND_PRINT((ndo, " PEER_CALL_ID(%u)", EXTRACT_16BITS(peer_call_id)));
+ ND_PRINT((ndo, " PEER_CALL_ID(%u)", EXTRACT_BE_16BITS(peer_call_id)));
}
static void
pptp_phy_chan_id_print(netdissect_options *ndo,
const uint32_t *phy_chan_id)
{
- ND_PRINT((ndo, " PHY_CHAN_ID(%u)", EXTRACT_32BITS(phy_chan_id)));
+ ND_PRINT((ndo, " PHY_CHAN_ID(%u)", EXTRACT_BE_32BITS(phy_chan_id)));
}
static void
pptp_pkt_proc_delay_print(netdissect_options *ndo,
const uint16_t *pkt_proc_delay)
{
- ND_PRINT((ndo, " PROC_DELAY(%u)", EXTRACT_16BITS(pkt_proc_delay)));
+ ND_PRINT((ndo, " PROC_DELAY(%u)", EXTRACT_BE_16BITS(pkt_proc_delay)));
}
static void
const uint16_t *proto_ver)
{
ND_PRINT((ndo, " PROTO_VER(%u.%u)", /* Version.Revision */
- EXTRACT_16BITS(proto_ver) >> 8,
- EXTRACT_16BITS(proto_ver) & 0xff));
+ EXTRACT_BE_16BITS(proto_ver) >> 8,
+ EXTRACT_BE_16BITS(proto_ver) & 0xff));
}
static void
pptp_recv_winsiz_print(netdissect_options *ndo,
const uint16_t *recv_winsiz)
{
- ND_PRINT((ndo, " RECV_WIN(%u)", EXTRACT_16BITS(recv_winsiz)));
+ ND_PRINT((ndo, " RECV_WIN(%u)", EXTRACT_BE_16BITS(recv_winsiz)));
}
static const struct tok pptp_scrrp_str[] = {
ND_TCHECK(ptr->call_ser);
pptp_call_ser_print(ndo, &ptr->call_ser);
ND_TCHECK(ptr->min_bps);
- ND_PRINT((ndo, " MIN_BPS(%u)", EXTRACT_32BITS(&ptr->min_bps)));
+ ND_PRINT((ndo, " MIN_BPS(%u)", EXTRACT_BE_32BITS(&ptr->min_bps)));
ND_TCHECK(ptr->max_bps);
- ND_PRINT((ndo, " MAX_BPS(%u)", EXTRACT_32BITS(&ptr->max_bps)));
+ ND_PRINT((ndo, " MAX_BPS(%u)", EXTRACT_BE_32BITS(&ptr->max_bps)));
ND_TCHECK(ptr->bearer_type);
pptp_bearer_type_print(ndo, &ptr->bearer_type);
ND_TCHECK(ptr->framing_type);
ND_TCHECK(ptr->pkt_proc_delay);
pptp_pkt_proc_delay_print(ndo, &ptr->pkt_proc_delay);
ND_TCHECK(ptr->phone_no_len);
- ND_PRINT((ndo, " PHONE_NO_LEN(%u)", EXTRACT_16BITS(&ptr->phone_no_len)));
+ ND_PRINT((ndo, " PHONE_NO_LEN(%u)", EXTRACT_BE_16BITS(&ptr->phone_no_len)));
ND_TCHECK(ptr->reserved1);
ND_TCHECK(ptr->phone_no);
ND_PRINT((ndo, " PHONE_NO(%.64s)", ptr->phone_no));
ND_TCHECK(ptr->phy_chan_id);
pptp_phy_chan_id_print(ndo, &ptr->phy_chan_id);
ND_TCHECK(ptr->dialed_no_len);
- ND_PRINT((ndo, " DIALED_NO_LEN(%u)", EXTRACT_16BITS(&ptr->dialed_no_len)));
+ ND_PRINT((ndo, " DIALED_NO_LEN(%u)", EXTRACT_BE_16BITS(&ptr->dialed_no_len)));
ND_TCHECK(ptr->dialing_no_len);
- ND_PRINT((ndo, " DIALING_NO_LEN(%u)", EXTRACT_16BITS(&ptr->dialing_no_len)));
+ ND_PRINT((ndo, " DIALING_NO_LEN(%u)", EXTRACT_BE_16BITS(&ptr->dialing_no_len)));
ND_TCHECK(ptr->dialed_no);
ND_PRINT((ndo, " DIALED_NO(%.64s)", ptr->dialed_no));
ND_TCHECK(ptr->dialing_no);
pptp_peer_call_id_print(ndo, &ptr->peer_call_id);
ND_TCHECK(ptr->reserved1);
ND_TCHECK(ptr->crc_err);
- ND_PRINT((ndo, " CRC_ERR(%u)", EXTRACT_32BITS(&ptr->crc_err)));
+ ND_PRINT((ndo, " CRC_ERR(%u)", EXTRACT_BE_32BITS(&ptr->crc_err)));
ND_TCHECK(ptr->framing_err);
- ND_PRINT((ndo, " FRAMING_ERR(%u)", EXTRACT_32BITS(&ptr->framing_err)));
+ ND_PRINT((ndo, " FRAMING_ERR(%u)", EXTRACT_BE_32BITS(&ptr->framing_err)));
ND_TCHECK(ptr->hardware_overrun);
- ND_PRINT((ndo, " HARDWARE_OVERRUN(%u)", EXTRACT_32BITS(&ptr->hardware_overrun)));
+ ND_PRINT((ndo, " HARDWARE_OVERRUN(%u)", EXTRACT_BE_32BITS(&ptr->hardware_overrun)));
ND_TCHECK(ptr->buffer_overrun);
- ND_PRINT((ndo, " BUFFER_OVERRUN(%u)", EXTRACT_32BITS(&ptr->buffer_overrun)));
+ ND_PRINT((ndo, " BUFFER_OVERRUN(%u)", EXTRACT_BE_32BITS(&ptr->buffer_overrun)));
ND_TCHECK(ptr->timeout_err);
- ND_PRINT((ndo, " TIMEOUT_ERR(%u)", EXTRACT_32BITS(&ptr->timeout_err)));
+ ND_PRINT((ndo, " TIMEOUT_ERR(%u)", EXTRACT_BE_32BITS(&ptr->timeout_err)));
ND_TCHECK(ptr->align_err);
- ND_PRINT((ndo, " ALIGN_ERR(%u)", EXTRACT_32BITS(&ptr->align_err)));
+ ND_PRINT((ndo, " ALIGN_ERR(%u)", EXTRACT_BE_32BITS(&ptr->align_err)));
return;
pptp_peer_call_id_print(ndo, &ptr->peer_call_id);
ND_TCHECK(ptr->reserved1);
ND_TCHECK(ptr->send_accm);
- ND_PRINT((ndo, " SEND_ACCM(0x%08x)", EXTRACT_32BITS(&ptr->send_accm)));
+ ND_PRINT((ndo, " SEND_ACCM(0x%08x)", EXTRACT_BE_32BITS(&ptr->send_accm)));
ND_TCHECK(ptr->recv_accm);
- ND_PRINT((ndo, " RECV_ACCM(0x%08x)", EXTRACT_32BITS(&ptr->recv_accm)));
+ ND_PRINT((ndo, " RECV_ACCM(0x%08x)", EXTRACT_BE_32BITS(&ptr->recv_accm)));
return;
ND_TCHECK(hdr->length);
if (ndo->ndo_vflag) {
- ND_PRINT((ndo, " Length=%u", EXTRACT_16BITS(&hdr->length)));
+ ND_PRINT((ndo, " Length=%u", EXTRACT_BE_16BITS(&hdr->length)));
}
ND_TCHECK(hdr->msg_type);
if (ndo->ndo_vflag) {
- switch(EXTRACT_16BITS(&hdr->msg_type)) {
+ switch(EXTRACT_BE_16BITS(&hdr->msg_type)) {
case PPTP_MSG_TYPE_CTRL:
ND_PRINT((ndo, " CTRL-MSG"));
break;
}
ND_TCHECK(hdr->magic_cookie);
- mc = EXTRACT_32BITS(&hdr->magic_cookie);
+ mc = EXTRACT_BE_32BITS(&hdr->magic_cookie);
if (mc != PPTP_MAGIC_COOKIE) {
ND_PRINT((ndo, " UNEXPECTED Magic-Cookie!!(%08x)", mc));
}
ND_PRINT((ndo, " Magic-Cookie=%08x", mc));
}
ND_TCHECK(hdr->ctrl_msg_type);
- ctrl_msg_type = EXTRACT_16BITS(&hdr->ctrl_msg_type);
+ ctrl_msg_type = EXTRACT_BE_16BITS(&hdr->ctrl_msg_type);
if (ctrl_msg_type < PPTP_MAX_MSGTYPE_INDEX) {
ND_PRINT((ndo, " CTRL_MSGTYPE=%s",
pptp_message_type_string[ctrl_msg_type]));
ND_PRINT((ndo, "Tag[Unused] "));
data++;
length--;
- ND_PRINT((ndo, "Salt %u ", EXTRACT_16BITS(data)));
+ ND_PRINT((ndo, "Salt %u ", EXTRACT_BE_16BITS(data)));
data+=2;
length-=2;
break;
if (length < 4)
goto trunc;
ND_TCHECK2(*data, 4);
- vendor_id = EXTRACT_32BITS(data);
+ vendor_id = EXTRACT_BE_32BITS(data);
data+=4;
length-=4;
else
ND_PRINT((ndo, "Tag[%d] ", *data));
data++;
- data_value = EXTRACT_24BITS(data);
+ data_value = EXTRACT_BE_24BITS(data);
}
else
{
- data_value = EXTRACT_32BITS(data);
+ data_value = EXTRACT_BE_32BITS(data);
}
if ( data_value <= (uint32_t)(attr_type[attr_code].siz_subtypes - 1 +
attr_type[attr_code].first_subtype) &&
switch(attr_code) /* Be aware of special cases... */
{
case FRM_IPX:
- if (EXTRACT_32BITS( data) == 0xFFFFFFFE )
+ if (EXTRACT_BE_32BITS(data) == 0xFFFFFFFE )
ND_PRINT((ndo, "NAS Select"));
else
- ND_PRINT((ndo, "%d", EXTRACT_32BITS(data)));
+ ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data)));
break;
case SESSION_TIMEOUT:
case ACCT_DELAY:
case ACCT_SESSION_TIME:
case ACCT_INT_INTERVAL:
- timeout = EXTRACT_32BITS( data);
+ timeout = EXTRACT_BE_32BITS(data);
if ( timeout < 60 )
ND_PRINT((ndo, "%02d secs", timeout));
else
break;
case FRM_ATALK_LINK:
- if (EXTRACT_32BITS(data) )
- ND_PRINT((ndo, "%d", EXTRACT_32BITS(data)));
+ if (EXTRACT_BE_32BITS(data))
+ ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data)));
else
ND_PRINT((ndo, "Unnumbered"));
break;
case FRM_ATALK_NETWORK:
- if (EXTRACT_32BITS(data) )
- ND_PRINT((ndo, "%d", EXTRACT_32BITS(data)));
+ if (EXTRACT_BE_32BITS(data))
+ ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data)));
else
ND_PRINT((ndo, "NAS assigned"));
break;
else
ND_PRINT((ndo, "Tag[Unused] "));
data++;
- ND_PRINT((ndo, "%d", EXTRACT_24BITS(data)));
+ ND_PRINT((ndo, "%d", EXTRACT_BE_24BITS(data)));
break;
case EGRESS_VLAN_ID:
tok2str(rfc4675_tagged,"Unknown tag",*data),
*data));
data++;
- ND_PRINT((ndo, "%d", EXTRACT_24BITS(data)));
+ ND_PRINT((ndo, "%d", EXTRACT_BE_24BITS(data)));
break;
default:
- ND_PRINT((ndo, "%d", EXTRACT_32BITS(data)));
+ ND_PRINT((ndo, "%d", EXTRACT_BE_32BITS(data)));
break;
} /* switch */
{
case FRM_IPADDR:
case LOG_IPHOST:
- if (EXTRACT_32BITS(data) == 0xFFFFFFFF )
+ if (EXTRACT_BE_32BITS(data) == 0xFFFFFFFF )
ND_PRINT((ndo, "User Selected"));
else
- if (EXTRACT_32BITS(data) == 0xFFFFFFFE )
+ if (EXTRACT_BE_32BITS(data) == 0xFFFFFFFE )
ND_PRINT((ndo, "NAS Select"));
else
ND_PRINT((ndo, "%s",ipaddr_string(ndo, data)));
ND_TCHECK2(data[0],4);
- attr_time = EXTRACT_32BITS(data);
+ attr_time = EXTRACT_BE_32BITS(data);
strlcpy(string, ctime(&attr_time), sizeof(string));
/* Get rid of the newline */
string[24] = '\0';
}
ND_TCHECK2(data[0],4);
- error_cause_value = EXTRACT_32BITS(data);
+ error_cause_value = EXTRACT_BE_32BITS(data);
ND_PRINT((ndo, "Error cause %u: %s", error_cause_value, tok2str(errorcausetype, "Error-Cause %u not known", error_cause_value)));
break;
}
ND_TCHECK2(*dat, MIN_RADIUS_LEN);
rad = (const struct radius_hdr *)dat;
- len = EXTRACT_16BITS(&rad->len);
+ len = EXTRACT_BE_16BITS(&rad->len);
if (len < MIN_RADIUS_LEN)
{
register u_short family;
/* RFC 1058 */
- family = EXTRACT_16BITS(&ni->rip_family);
+ family = EXTRACT_BE_16BITS(&ni->rip_family);
if (family != BSD_AFNUM_INET && family != 0) {
ND_PRINT((ndo, "\n\t AFI %s, ", tok2str(bsd_af_values, "Unknown (%u)", family)));
print_unknown_data(ndo, (const uint8_t *)&ni->rip_family, "\n\t ", RIP_ROUTELEN);
return;
}
- if (EXTRACT_16BITS(&ni->rip_tag) ||
- EXTRACT_32BITS(&ni->rip_dest_mask) ||
- EXTRACT_32BITS(&ni->rip_router)) {
+ if (EXTRACT_BE_16BITS(&ni->rip_tag) ||
+ EXTRACT_BE_32BITS(&ni->rip_dest_mask) ||
+ EXTRACT_BE_32BITS(&ni->rip_router)) {
/* MBZ fields not zero */
print_unknown_data(ndo, (const uint8_t *)&ni->rip_family, "\n\t ", RIP_ROUTELEN);
return;
if (family == 0) {
ND_PRINT((ndo, "\n\t AFI 0, %s, metric: %u",
ipaddr_string(ndo, &ni->rip_dest),
- EXTRACT_32BITS(&ni->rip_metric)));
+ EXTRACT_BE_32BITS(&ni->rip_metric)));
return;
} /* BSD_AFNUM_INET */
ND_PRINT((ndo, "\n\t %s, metric: %u",
ipaddr_string(ndo, &ni->rip_dest),
- EXTRACT_32BITS(&ni->rip_metric)));
+ EXTRACT_BE_32BITS(&ni->rip_metric)));
}
static unsigned
{
register u_short family;
- family = EXTRACT_16BITS(&ni->rip_family);
+ family = EXTRACT_BE_16BITS(&ni->rip_family);
if (family == 0xFFFF) { /* variable-sized authentication structures */
- uint16_t auth_type = EXTRACT_16BITS(&ni->rip_tag);
+ uint16_t auth_type = EXTRACT_BE_16BITS(&ni->rip_tag);
if (auth_type == 2) {
register const u_char *p = (const u_char *)&ni->rip_dest;
u_int i = 0;
ND_PRINT((ndo, "%c", ND_ISPRINT(*p) ? *p : '.'));
} else if (auth_type == 3) {
ND_PRINT((ndo, "\n\t Auth header:"));
- ND_PRINT((ndo, " Packet Len %u,", EXTRACT_16BITS((const uint8_t *)ni + 4)));
+ ND_PRINT((ndo, " Packet Len %u,", EXTRACT_BE_16BITS((const uint8_t *)ni + 4)));
ND_PRINT((ndo, " Key-ID %u,", *((const uint8_t *)ni + 6)));
ND_PRINT((ndo, " Auth Data Len %u,", *((const uint8_t *)ni + 7)));
- ND_PRINT((ndo, " SeqNo %u,", EXTRACT_32BITS(&ni->rip_dest_mask)));
- ND_PRINT((ndo, " MBZ %u,", EXTRACT_32BITS(&ni->rip_router)));
- ND_PRINT((ndo, " MBZ %u", EXTRACT_32BITS(&ni->rip_metric)));
+ ND_PRINT((ndo, " SeqNo %u,", EXTRACT_BE_32BITS(&ni->rip_dest_mask)));
+ ND_PRINT((ndo, " MBZ %u,", EXTRACT_BE_32BITS(&ni->rip_router)));
+ ND_PRINT((ndo, " MBZ %u", EXTRACT_BE_32BITS(&ni->rip_metric)));
} else if (auth_type == 1) {
ND_PRINT((ndo, "\n\t Auth trailer:"));
print_unknown_data(ndo, (const uint8_t *)&ni->rip_dest, "\n\t ", remaining);
return remaining; /* AT spans till the packet end */
} else {
ND_PRINT((ndo, "\n\t Unknown (%u) Authentication data:",
- EXTRACT_16BITS(&ni->rip_tag)));
+ EXTRACT_BE_16BITS(&ni->rip_tag)));
print_unknown_data(ndo, (const uint8_t *)&ni->rip_dest, "\n\t ", remaining);
}
} else if (family != BSD_AFNUM_INET && family != 0) {
ND_PRINT((ndo, "\n\t AFI %s, %15s/%-2d, tag 0x%04x, metric: %u, next-hop: ",
tok2str(bsd_af_values, "%u", family),
ipaddr_string(ndo, &ni->rip_dest),
- mask2plen(EXTRACT_32BITS(&ni->rip_dest_mask)),
- EXTRACT_16BITS(&ni->rip_tag),
- EXTRACT_32BITS(&ni->rip_metric)));
- if (EXTRACT_32BITS(&ni->rip_router))
+ mask2plen(EXTRACT_BE_32BITS(&ni->rip_dest_mask)),
+ EXTRACT_BE_16BITS(&ni->rip_tag),
+ EXTRACT_BE_32BITS(&ni->rip_metric)));
+ if (EXTRACT_BE_32BITS(&ni->rip_router))
ND_PRINT((ndo, "%s", ipaddr_string(ndo, &ni->rip_router)));
else
ND_PRINT((ndo, "self"));
int l;
l = ND_PRINT((ndo, "%s/%d", ip6addr_string(ndo, &ni->rip6_dest), ni->rip6_plen));
if (ni->rip6_tag)
- l += ND_PRINT((ndo, " [%d]", EXTRACT_16BITS(&ni->rip6_tag)));
+ l += ND_PRINT((ndo, " [%d]", EXTRACT_BE_16BITS(&ni->rip6_tag)));
if (metric)
l += ND_PRINT((ndo, " (%d)", ni->rip6_metric));
return l;
ND_TCHECK2(*tptr, sizeof(rpki_rtr_pdu));
pdu_header = (const rpki_rtr_pdu *)tptr;
pdu_type = pdu_header->pdu_type;
- pdu_len = EXTRACT_32BITS(pdu_header->length);
+ pdu_len = EXTRACT_BE_32BITS(pdu_header->length);
/* Do not check bounds with pdu_len yet, do it in the case blocks
* below to make it possible to decode at least the beginning of
* a truncated Error Report PDU or a truncated encapsulated PDU.
msg = (const u_char *)(pdu_header + 1);
ND_PRINT((ndo, "%sSession ID: 0x%04x, Serial: %u",
indent_string(indent+2),
- EXTRACT_16BITS(pdu_header->u.session_id),
- EXTRACT_32BITS(msg)));
+ EXTRACT_BE_16BITS(pdu_header->u.session_id),
+ EXTRACT_BE_32BITS(msg)));
break;
/*
/* no additional boundary to check */
ND_PRINT((ndo, "%sSession ID: 0x%04x",
indent_string(indent+2),
- EXTRACT_16BITS(pdu_header->u.session_id)));
+ EXTRACT_BE_16BITS(pdu_header->u.session_id)));
break;
case RPKI_RTR_IPV4_PREFIX_PDU:
indent_string(indent+2),
ipaddr_string(ndo, pdu->prefix),
pdu->prefix_length, pdu->max_length,
- EXTRACT_32BITS(pdu->as), pdu->flags));
+ EXTRACT_BE_32BITS(pdu->as), pdu->flags));
}
break;
indent_string(indent+2),
ip6addr_string(ndo, pdu->prefix),
pdu->prefix_length, pdu->max_length,
- EXTRACT_32BITS(pdu->as), pdu->flags));
+ EXTRACT_BE_32BITS(pdu->as), pdu->flags));
}
break;
* data element, more data elements may be present.
*/
pdu = (const rpki_rtr_pdu_error_report *)tptr;
- encapsulated_pdu_length = EXTRACT_32BITS(pdu->encapsulated_pdu_length);
+ encapsulated_pdu_length = EXTRACT_BE_32BITS(pdu->encapsulated_pdu_length);
tlen += 4;
- error_code = EXTRACT_16BITS(pdu->pdu_header.u.error_code);
+ error_code = EXTRACT_BE_16BITS(pdu->pdu_header.u.error_code);
ND_PRINT((ndo, "%sError code: %s (%u), Encapsulated PDU length: %u",
indent_string(indent+2),
tok2str(rpki_rtr_error_codes, "Unknown", error_code),
/*
* Extract, trail-zero and print the Error message.
*/
- text_length = EXTRACT_32BITS(tptr + tlen);
+ text_length = EXTRACT_BE_32BITS(tptr + tlen);
tlen += 4;
if (text_length) {
if (rrcp_proto==1){
ND_TCHECK2(*(cp + RRCP_AUTHKEY_OFFSET), 2);
ND_PRINT((ndo, ", auth=0x%04x",
- EXTRACT_16BITS(cp + RRCP_AUTHKEY_OFFSET)));
+ EXTRACT_BE_16BITS(cp + RRCP_AUTHKEY_OFFSET)));
}
if (rrcp_proto==1 && rrcp_opcode==0 &&
((*(cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_ISREPLY)){
*(cp + RRCP_DOWNLINK_PORT_OFFSET),
*(cp + RRCP_UPLINK_PORT_OFFSET),
etheraddr_string(ndo, cp + RRCP_UPLINK_MAC_OFFSET),
- EXTRACT_32BITS(cp + RRCP_VENDOR_ID_OFFSET),
- EXTRACT_16BITS(cp + RRCP_CHIP_ID_OFFSET)));
+ EXTRACT_BE_32BITS(cp + RRCP_VENDOR_ID_OFFSET),
+ EXTRACT_BE_16BITS(cp + RRCP_CHIP_ID_OFFSET)));
}else if (rrcp_opcode==1 || rrcp_opcode==2 || rrcp_proto==2){
ND_TCHECK2(*(cp + RRCP_COOKIE2_OFFSET), 4);
ND_PRINT((ndo, ", cookie=0x%08x%08x ",
- EXTRACT_32BITS(cp + RRCP_COOKIE2_OFFSET),
- EXTRACT_32BITS(cp + RRCP_COOKIE1_OFFSET)));
+ EXTRACT_BE_32BITS(cp + RRCP_COOKIE2_OFFSET),
+ EXTRACT_BE_32BITS(cp + RRCP_COOKIE1_OFFSET)));
}
return;
return 0;
parameter_id = *(tptr);
ND_TCHECK2(*(tptr + 2), 2);
- parameter_length = EXTRACT_16BITS(tptr+2)<<2; /* convert wordcount to bytecount */
+ parameter_length = EXTRACT_BE_16BITS(tptr + 2)<<2; /* convert wordcount to bytecount */
ND_PRINT((ndo, "\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
tok2str(rsvp_intserv_parameter_id_values,"unknown",parameter_id),
*/
if (parameter_length == 4) {
ND_TCHECK2(*(tptr + 4), 4);
- ND_PRINT((ndo, "\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr + 4)));
+ ND_PRINT((ndo, "\n\t\tIS hop count: %u", EXTRACT_BE_32BITS(tptr + 4)));
}
break;
*/
if (parameter_length == 4) {
ND_TCHECK2(*(tptr + 4), 4);
- bw.i = EXTRACT_32BITS(tptr+4);
+ bw.i = EXTRACT_BE_32BITS(tptr + 4);
ND_PRINT((ndo, "\n\t\tPath b/w estimate: %.10g Mbps", bw.f / 125000));
}
break;
if (parameter_length == 4) {
ND_TCHECK2(*(tptr + 4), 4);
ND_PRINT((ndo, "\n\t\tMinimum path latency: "));
- if (EXTRACT_32BITS(tptr+4) == 0xffffffff)
+ if (EXTRACT_BE_32BITS(tptr + 4) == 0xffffffff)
ND_PRINT((ndo, "don't care"));
else
- ND_PRINT((ndo, "%u", EXTRACT_32BITS(tptr + 4)));
+ ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(tptr + 4)));
}
break;
*/
if (parameter_length == 4) {
ND_TCHECK2(*(tptr + 4), 4);
- ND_PRINT((ndo, "\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr + 4)));
+ ND_PRINT((ndo, "\n\t\tComposed MTU: %u bytes", EXTRACT_BE_32BITS(tptr + 4)));
}
break;
case 127:
if (parameter_length == 20) {
ND_TCHECK2(*(tptr + 4), 20);
- bw.i = EXTRACT_32BITS(tptr+4);
+ bw.i = EXTRACT_BE_32BITS(tptr + 4);
ND_PRINT((ndo, "\n\t\tToken Bucket Rate: %.10g Mbps", bw.f / 125000));
- bw.i = EXTRACT_32BITS(tptr+8);
+ bw.i = EXTRACT_BE_32BITS(tptr + 8);
ND_PRINT((ndo, "\n\t\tToken Bucket Size: %.10g bytes", bw.f));
- bw.i = EXTRACT_32BITS(tptr+12);
+ bw.i = EXTRACT_BE_32BITS(tptr + 12);
ND_PRINT((ndo, "\n\t\tPeak Data Rate: %.10g Mbps", bw.f / 125000));
- ND_PRINT((ndo, "\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr + 16)));
- ND_PRINT((ndo, "\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr + 20)));
+ ND_PRINT((ndo, "\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_BE_32BITS(tptr + 16)));
+ ND_PRINT((ndo, "\n\t\tMaximum Packet Size: %u bytes", EXTRACT_BE_32BITS(tptr + 20)));
}
break;
if (parameter_length == 8) {
ND_TCHECK2(*(tptr + 4), 8);
- bw.i = EXTRACT_32BITS(tptr+4);
+ bw.i = EXTRACT_BE_32BITS(tptr + 4);
ND_PRINT((ndo, "\n\t\tRate: %.10g Mbps", bw.f / 125000));
- ND_PRINT((ndo, "\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr + 8)));
+ ND_PRINT((ndo, "\n\t\tSlack Term: %u", EXTRACT_BE_32BITS(tptr + 8)));
}
break;
case 136:
if (parameter_length == 4) {
ND_TCHECK2(*(tptr + 4), 4);
- ND_PRINT((ndo, "\n\t\tValue: %u", EXTRACT_32BITS(tptr + 4)));
+ ND_PRINT((ndo, "\n\t\tValue: %u", EXTRACT_BE_32BITS(tptr + 4)));
}
break;
ND_TCHECK2(*tptr, sizeof(struct rsvp_object_header));
rsvp_obj_header = (const struct rsvp_object_header *)tptr;
- rsvp_obj_len=EXTRACT_16BITS(rsvp_obj_header->length);
+ rsvp_obj_len=EXTRACT_BE_16BITS(rsvp_obj_header->length);
rsvp_obj_ctype=rsvp_obj_header->ctype;
if(rsvp_obj_len % 4) {
ND_PRINT((ndo, "%s Flags: [0x%02x], DestPort %u",
indent,
*(obj_tptr+5),
- EXTRACT_16BITS(obj_tptr + 6)));
+ EXTRACT_BE_16BITS(obj_tptr + 6)));
obj_tlen-=8;
obj_tptr+=8;
break;
ND_PRINT((ndo, "%s Flags: [0x%02x], DestPort %u",
indent,
*(obj_tptr+sizeof(struct in6_addr)+1),
- EXTRACT_16BITS(obj_tptr + sizeof(struct in6_addr) + 2)));
+ EXTRACT_BE_16BITS(obj_tptr + sizeof(struct in6_addr) + 2)));
obj_tlen-=20;
obj_tptr+=20;
break;
ND_PRINT((ndo, "%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
indent,
ip6addr_string(ndo, obj_tptr),
- EXTRACT_16BITS(obj_tptr+18),
+ EXTRACT_BE_16BITS(obj_tptr + 18),
ip6addr_string(ndo, obj_tptr + 20)));
obj_tlen-=36;
obj_tptr+=36;
return -1;
ND_PRINT((ndo, "%s IPv6 P2MP LSP ID: 0x%08x, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
indent,
- EXTRACT_32BITS(obj_tptr),
- EXTRACT_16BITS(obj_tptr+6),
+ EXTRACT_BE_32BITS(obj_tptr),
+ EXTRACT_BE_16BITS(obj_tptr + 6),
ip6addr_string(ndo, obj_tptr + 8)));
obj_tlen-=26;
obj_tptr+=26;
ND_PRINT((ndo, "%s IPv4 P2MP LSP ID: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_16BITS(obj_tptr+6),
+ EXTRACT_BE_16BITS(obj_tptr + 6),
ipaddr_string(ndo, obj_tptr + 8)));
obj_tlen-=12;
obj_tptr+=12;
ND_PRINT((ndo, "%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_16BITS(obj_tptr+6),
+ EXTRACT_BE_16BITS(obj_tptr + 6),
ipaddr_string(ndo, obj_tptr + 8)));
obj_tlen-=12;
obj_tptr+=12;
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_1:
while(obj_tlen >= 4 ) {
- ND_PRINT((ndo, "%s Label: %u", indent, EXTRACT_32BITS(obj_tptr)));
+ ND_PRINT((ndo, "%s Label: %u", indent, EXTRACT_BE_32BITS(obj_tptr)));
obj_tlen-=4;
obj_tptr+=4;
}
return-1;
ND_PRINT((ndo, "%s Generalized Label: %u",
indent,
- EXTRACT_32BITS(obj_tptr)));
+ EXTRACT_BE_32BITS(obj_tptr)));
obj_tlen-=4;
obj_tptr+=4;
break;
return-1;
ND_PRINT((ndo, "%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
indent,
- EXTRACT_32BITS(obj_tptr),
+ EXTRACT_BE_32BITS(obj_tptr),
indent,
- EXTRACT_32BITS(obj_tptr+4),
- EXTRACT_32BITS(obj_tptr + 8)));
+ EXTRACT_BE_32BITS(obj_tptr + 4),
+ EXTRACT_BE_32BITS(obj_tptr + 8)));
obj_tlen-=12;
obj_tptr+=12;
break;
indent,
tok2str(rsvp_resstyle_values,
"Unknown",
- EXTRACT_24BITS(obj_tptr+1)),
+ EXTRACT_BE_24BITS(obj_tptr + 1)),
*(obj_tptr)));
obj_tlen-=4;
obj_tptr+=4;
ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_16BITS(obj_tptr + 6)));
+ EXTRACT_BE_16BITS(obj_tptr + 6)));
obj_tlen-=8;
obj_tptr+=8;
break;
ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u",
indent,
ip6addr_string(ndo, obj_tptr),
- EXTRACT_16BITS(obj_tptr + 18)));
+ EXTRACT_BE_16BITS(obj_tptr + 18)));
obj_tlen-=20;
obj_tptr+=20;
break;
"%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
indent,
ip6addr_string(ndo, obj_tptr),
- EXTRACT_16BITS(obj_tptr+18),
+ EXTRACT_BE_16BITS(obj_tptr + 18),
indent,
ip6addr_string(ndo, obj_tptr+20),
- EXTRACT_16BITS(obj_tptr + 38)));
+ EXTRACT_BE_16BITS(obj_tptr + 38)));
obj_tlen-=40;
obj_tptr+=40;
break;
ND_PRINT((ndo, "%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_16BITS(obj_tptr + 6)));
+ EXTRACT_BE_16BITS(obj_tptr + 6)));
obj_tlen-=8;
obj_tptr+=8;
break;
"%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_16BITS(obj_tptr+6),
+ EXTRACT_BE_16BITS(obj_tptr + 6),
indent,
ipaddr_string(ndo, obj_tptr+8),
- EXTRACT_16BITS(obj_tptr + 12)));
+ EXTRACT_BE_16BITS(obj_tptr + 12)));
obj_tlen-=16;
obj_tptr+=16;
break;
indent,
tok2str(ethertype_values,
"Unknown Protocol (0x%04x)",
- EXTRACT_16BITS(obj_tptr + 2))));
+ EXTRACT_BE_16BITS(obj_tptr + 2))));
obj_tlen-=4;
obj_tptr+=4;
}
indent,
tok2str(ethertype_values,
"Unknown Protocol (0x%04x)",
- EXTRACT_16BITS(obj_tptr + 2))));
+ EXTRACT_BE_16BITS(obj_tptr + 2))));
ND_PRINT((ndo, ",%s merge capability",((*(obj_tptr + 4)) & 0x80) ? "no" : "" ));
ND_PRINT((ndo, "%s Minimum VPI/VCI: %u/%u",
indent,
- (EXTRACT_16BITS(obj_tptr+4))&0xfff,
- (EXTRACT_16BITS(obj_tptr + 6)) & 0xfff));
+ (EXTRACT_BE_16BITS(obj_tptr + 4))&0xfff,
+ (EXTRACT_BE_16BITS(obj_tptr + 6)) & 0xfff));
ND_PRINT((ndo, "%s Maximum VPI/VCI: %u/%u",
indent,
- (EXTRACT_16BITS(obj_tptr+8))&0xfff,
- (EXTRACT_16BITS(obj_tptr + 10)) & 0xfff));
+ (EXTRACT_BE_16BITS(obj_tptr + 8))&0xfff,
+ (EXTRACT_BE_16BITS(obj_tptr + 10)) & 0xfff));
obj_tlen-=12;
obj_tptr+=12;
break;
indent,
tok2str(ethertype_values,
"Unknown Protocol (0x%04x)",
- EXTRACT_16BITS(obj_tptr + 2))));
+ EXTRACT_BE_16BITS(obj_tptr + 2))));
ND_PRINT((ndo, "%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
indent,
- (EXTRACT_32BITS(obj_tptr+4))&0x7fffff,
- (EXTRACT_32BITS(obj_tptr+8))&0x7fffff,
- (((EXTRACT_16BITS(obj_tptr+4)>>7)&3) == 0 ) ? "10" : "",
- (((EXTRACT_16BITS(obj_tptr + 4) >> 7) & 3) == 2 ) ? "23" : ""));
+ (EXTRACT_BE_32BITS(obj_tptr + 4))&0x7fffff,
+ (EXTRACT_BE_32BITS(obj_tptr + 8))&0x7fffff,
+ (((EXTRACT_BE_16BITS(obj_tptr + 4)>>7)&3) == 0 ) ? "10" : "",
+ (((EXTRACT_BE_16BITS(obj_tptr + 4) >> 7) & 3) == 2 ) ? "23" : ""));
obj_tlen-=12;
obj_tptr+=12;
break;
*(obj_tptr+1),
tok2str(gmpls_payload_values,
"Unknown",
- EXTRACT_16BITS(obj_tptr+2)),
- EXTRACT_16BITS(obj_tptr + 2)));
+ EXTRACT_BE_16BITS(obj_tptr + 2)),
+ EXTRACT_BE_16BITS(obj_tptr + 2)));
obj_tlen-=4;
obj_tptr+=4;
break;
"Unknown",
*(obj_tptr+3) + 256*RSVP_OBJ_RRO),
*(obj_tptr+3),
- EXTRACT_32BITS(obj_tptr + 4)));
+ EXTRACT_BE_32BITS(obj_tptr + 4)));
}
obj_tlen-=*(obj_tptr+1);
obj_tptr+=*(obj_tptr+1);
return-1;
ND_PRINT((ndo, "%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
indent,
- EXTRACT_32BITS(obj_tptr),
- EXTRACT_32BITS(obj_tptr + 4)));
+ EXTRACT_BE_32BITS(obj_tptr),
+ EXTRACT_BE_32BITS(obj_tptr + 4)));
obj_tlen-=8;
obj_tptr+=8;
break;
return-1;
ND_PRINT((ndo, "%s Restart Time: %ums, Recovery Time: %ums",
indent,
- EXTRACT_32BITS(obj_tptr),
- EXTRACT_32BITS(obj_tptr + 4)));
+ EXTRACT_BE_32BITS(obj_tptr),
+ EXTRACT_BE_32BITS(obj_tptr + 4)));
obj_tlen-=8;
obj_tptr+=8;
break;
*/
if (total_subobj_len < 4)
goto invalid;
- subobj_len = EXTRACT_16BITS(obj_tptr);
- subobj_type = (EXTRACT_16BITS(obj_tptr+2))>>8;
- af = (EXTRACT_16BITS(obj_tptr+2))&0x00FF;
+ subobj_len = EXTRACT_BE_16BITS(obj_tptr);
+ subobj_type = (EXTRACT_BE_16BITS(obj_tptr + 2))>>8;
+ af = (EXTRACT_BE_16BITS(obj_tptr + 2))&0x00FF;
ND_PRINT((ndo, "%s Subobject Type: %s (%u), AF: %s (%u), length: %u",
indent,
ND_PRINT((ndo, "%s U-bit: %x, Label type: %u, Logical port id: %u, Label: %u",
indent,
- ((EXTRACT_32BITS(obj_tptr+4))>>31),
- ((EXTRACT_32BITS(obj_tptr+4))&0xFF),
- EXTRACT_32BITS(obj_tptr+8),
- EXTRACT_32BITS(obj_tptr + 12)));
+ ((EXTRACT_BE_32BITS(obj_tptr + 4))>>31),
+ ((EXTRACT_BE_32BITS(obj_tptr + 4))&0xFF),
+ EXTRACT_BE_32BITS(obj_tptr + 8),
+ EXTRACT_BE_32BITS(obj_tptr + 12)));
break;
case RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL:
}
ND_PRINT((ndo, "%s Service level: %u",
- indent, (EXTRACT_32BITS(obj_tptr + 4)) >> 24));
+ indent, (EXTRACT_BE_32BITS(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_32BITS(obj_tptr + 4)));
+ EXTRACT_BE_32BITS(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_32BITS(obj_tptr + 16)));
+ EXTRACT_BE_32BITS(obj_tptr + 16)));
obj_tlen-=20;
obj_tptr+=20;
hexdump=TRUE; /* unless we have a TLV parser lets just hexdump */
return-1;
ND_PRINT((ndo, "%s Refresh Period: %ums",
indent,
- EXTRACT_32BITS(obj_tptr)));
+ EXTRACT_BE_32BITS(obj_tptr)));
obj_tlen-=4;
obj_tptr+=4;
break;
ND_PRINT((ndo, "%s Msg-Version: %u, length: %u",
indent,
(*obj_tptr & 0xf0) >> 4,
- EXTRACT_16BITS(obj_tptr + 2) << 2));
+ EXTRACT_BE_16BITS(obj_tptr + 2) << 2));
obj_tptr+=4; /* get to the start of the service header */
obj_tlen-=4;
while (obj_tlen >= 4) {
- intserv_serv_tlen=EXTRACT_16BITS(obj_tptr+2)<<2;
+ intserv_serv_tlen=EXTRACT_BE_16BITS(obj_tptr + 2)<<2;
ND_PRINT((ndo, "%s Service Type: %s (%u), break bit %s set, Service length: %u",
indent,
tok2str(rsvp_intserv_service_type_values,"unknown",*(obj_tptr)),
ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_16BITS(obj_tptr + 6)));
+ EXTRACT_BE_16BITS(obj_tptr + 6)));
obj_tlen-=8;
obj_tptr+=8;
break;
ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u",
indent,
ip6addr_string(ndo, obj_tptr),
- EXTRACT_16BITS(obj_tptr + 18)));
+ EXTRACT_BE_16BITS(obj_tptr + 18)));
obj_tlen-=20;
obj_tptr+=20;
break;
ND_PRINT((ndo, "%s Source Address: %s, Flow Label: %u",
indent,
ip6addr_string(ndo, obj_tptr),
- EXTRACT_24BITS(obj_tptr + 17)));
+ EXTRACT_BE_24BITS(obj_tptr + 17)));
obj_tlen-=20;
obj_tptr+=20;
break;
ND_PRINT((ndo, "%s Source Address: %s, LSP-ID: 0x%04x",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_16BITS(obj_tptr + 18)));
+ EXTRACT_BE_16BITS(obj_tptr + 18)));
obj_tlen-=20;
obj_tptr+=20;
break;
"%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
indent,
ip6addr_string(ndo, obj_tptr),
- EXTRACT_16BITS(obj_tptr+18),
+ EXTRACT_BE_16BITS(obj_tptr + 18),
indent,
ip6addr_string(ndo, obj_tptr+20),
- EXTRACT_16BITS(obj_tptr + 38)));
+ EXTRACT_BE_16BITS(obj_tptr + 38)));
obj_tlen-=40;
obj_tptr+=40;
break;
ND_PRINT((ndo, "%s Source Address: %s, LSP-ID: 0x%04x",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_16BITS(obj_tptr + 6)));
+ EXTRACT_BE_16BITS(obj_tptr + 6)));
obj_tlen-=8;
obj_tptr+=8;
break;
"%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
indent,
ipaddr_string(ndo, obj_tptr),
- EXTRACT_16BITS(obj_tptr+6),
+ EXTRACT_BE_16BITS(obj_tptr + 6),
indent,
ipaddr_string(ndo, obj_tptr+8),
- EXTRACT_16BITS(obj_tptr + 12)));
+ EXTRACT_BE_16BITS(obj_tptr + 12)));
obj_tlen-=16;
obj_tptr+=16;
break;
case RSVP_CTYPE_1: /* new style */
if (obj_tlen < sizeof(struct rsvp_obj_frr_t))
return-1;
- bw.i = EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->bandwidth);
+ bw.i = EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->bandwidth);
ND_PRINT((ndo, "%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
indent,
(int)obj_ptr.rsvp_obj_frr->setup_prio,
bw.f * 8 / 1000000));
ND_PRINT((ndo, "%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
indent,
- EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->include_any),
- EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->exclude_any),
- EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->include_all)));
+ EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->include_any),
+ EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->exclude_any),
+ EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->include_all)));
obj_tlen-=sizeof(struct rsvp_obj_frr_t);
obj_tptr+=sizeof(struct rsvp_obj_frr_t);
break;
case RSVP_CTYPE_TUNNEL_IPV4: /* old style */
if (obj_tlen < 16)
return-1;
- bw.i = EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->bandwidth);
+ bw.i = EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->bandwidth);
ND_PRINT((ndo, "%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
indent,
(int)obj_ptr.rsvp_obj_frr->setup_prio,
bw.f * 8 / 1000000));
ND_PRINT((ndo, "%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
indent,
- EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->include_any),
- EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->exclude_any)));
+ EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->include_any),
+ EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_frr->exclude_any)));
obj_tlen-=16;
obj_tptr+=16;
break;
case RSVP_CTYPE_1:
ND_PRINT((ndo, "%s CT: %u",
indent,
- EXTRACT_32BITS(obj_tptr) & 0x7));
+ EXTRACT_BE_32BITS(obj_tptr) & 0x7));
obj_tlen-=4;
obj_tptr+=4;
break;
if (obj_tlen < 8)
return-1;
error_code=*(obj_tptr+5);
- error_value=EXTRACT_16BITS(obj_tptr+6);
+ error_value=EXTRACT_BE_16BITS(obj_tptr + 6);
ND_PRINT((ndo, "%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
indent,
ipaddr_string(ndo, obj_tptr),
if (obj_tlen < 20)
return-1;
error_code=*(obj_tptr+17);
- error_value=EXTRACT_16BITS(obj_tptr+18);
+ error_value=EXTRACT_BE_16BITS(obj_tptr + 18);
ND_PRINT((ndo, "%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
indent,
ip6addr_string(ndo, obj_tptr),
case RSVP_CTYPE_1:
if (obj_tlen < 4)
return-1;
- padbytes = EXTRACT_16BITS(obj_tptr+2);
+ padbytes = EXTRACT_BE_16BITS(obj_tptr + 2);
ND_PRINT((ndo, "%s TLV count: %u, padding bytes: %u",
indent,
- EXTRACT_16BITS(obj_tptr),
+ EXTRACT_BE_16BITS(obj_tptr),
padbytes));
obj_tlen-=4;
obj_tptr+=4;
ND_PRINT((ndo, "%s Flags [0x%02x], epoch: %u",
indent,
*obj_tptr,
- EXTRACT_24BITS(obj_tptr + 1)));
+ EXTRACT_BE_24BITS(obj_tptr + 1)));
obj_tlen-=4;
obj_tptr+=4;
/* loop through as long there are no messages left */
while(obj_tlen >= 4) {
ND_PRINT((ndo, "%s Message-ID 0x%08x (%u)",
indent,
- EXTRACT_32BITS(obj_tptr),
- EXTRACT_32BITS(obj_tptr)));
+ EXTRACT_BE_32BITS(obj_tptr),
+ EXTRACT_BE_32BITS(obj_tptr)));
obj_tlen-=4;
obj_tptr+=4;
}
obj_ptr.rsvp_obj_integrity = (const struct rsvp_obj_integrity_t *)obj_tptr;
ND_PRINT((ndo, "%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]",
indent,
- EXTRACT_16BITS(obj_ptr.rsvp_obj_integrity->key_id),
- EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->key_id+2),
- EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->sequence),
- EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->sequence+4),
+ EXTRACT_BE_16BITS(obj_ptr.rsvp_obj_integrity->key_id),
+ EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->key_id + 2),
+ EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->sequence),
+ EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->sequence + 4),
bittok2str(rsvp_obj_integrity_flag_values,
"none",
obj_ptr.rsvp_obj_integrity->flags)));
ND_PRINT((ndo, "%s MD5-sum 0x%08x%08x%08x%08x ",
indent,
- EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest),
- EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest+4),
- EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest+8),
- EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest + 12)));
+ EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->digest),
+ EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->digest + 4),
+ EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->digest + 8),
+ EXTRACT_BE_32BITS(obj_ptr.rsvp_obj_integrity->digest + 12)));
sigcheck = signature_verify(ndo, pptr, plen,
obj_ptr.rsvp_obj_integrity->digest,
return-1;
ND_PRINT((ndo, "%s Flags [%s]", indent,
bittok2str(rsvp_obj_admin_status_flag_values, "none",
- EXTRACT_32BITS(obj_tptr))));
+ EXTRACT_BE_32BITS(obj_tptr))));
obj_tlen-=4;
obj_tptr+=4;
break;
case RSVP_CTYPE_1:
if (obj_tlen < 4)
return-1;
- action = (EXTRACT_16BITS(obj_tptr)>>8);
+ action = (EXTRACT_BE_16BITS(obj_tptr)>>8);
ND_PRINT((ndo, "%s Action: %s (%u), Label type: %u", indent,
tok2str(rsvp_obj_label_set_action_values, "Unknown", action),
- action, ((EXTRACT_32BITS(obj_tptr) & 0x7F))));
+ action, ((EXTRACT_BE_32BITS(obj_tptr) & 0x7F))));
switch (action) {
case LABEL_SET_INCLUSIVE_RANGE:
if (obj_tlen < 12)
return -1;
ND_PRINT((ndo, "%s Start range: %u, End range: %u", indent,
- EXTRACT_32BITS(obj_tptr+4),
- EXTRACT_32BITS(obj_tptr + 8)));
+ EXTRACT_BE_32BITS(obj_tptr + 4),
+ EXTRACT_BE_32BITS(obj_tptr + 8)));
obj_tlen-=12;
obj_tptr+=12;
break;
subchannel = 1;
while(obj_tlen >= 4 ) {
ND_PRINT((ndo, "%s Subchannel #%u: %u", indent, subchannel,
- EXTRACT_32BITS(obj_tptr)));
+ EXTRACT_BE_32BITS(obj_tptr)));
obj_tptr+=4;
obj_tlen-=4;
subchannel++;
/* ok they seem to want to know everything - lets fully decode it */
- plen = tlen = EXTRACT_16BITS(rsvp_com_header->length);
+ plen = tlen = EXTRACT_BE_16BITS(rsvp_com_header->length);
ND_PRINT((ndo, "\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags),
bittok2str(rsvp_header_flag_values,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header->version_flags)),
tlen,
rsvp_com_header->ttl,
- EXTRACT_16BITS(rsvp_com_header->checksum)));
+ EXTRACT_BE_16BITS(rsvp_com_header->checksum)));
if (tlen < sizeof(struct rsvp_common_header)) {
ND_PRINT((ndo, "ERROR: common header too short %u < %lu", tlen,
return;
}
- subplen = subtlen = EXTRACT_16BITS(rsvp_com_header->length);
+ subplen = subtlen = EXTRACT_BE_16BITS(rsvp_com_header->length);
ND_PRINT((ndo, "\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags),
bittok2str(rsvp_header_flag_values,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header->version_flags)),
subtlen,
rsvp_com_header->ttl,
- EXTRACT_16BITS(rsvp_com_header->checksum)));
+ EXTRACT_BE_16BITS(rsvp_com_header->checksum)));
if (subtlen < sizeof(struct rsvp_common_header)) {
ND_PRINT((ndo, "ERROR: common header too short %u < %lu", subtlen,
dp0 = (const struct ip6_rthdr0 *)dp;
ND_TCHECK(dp0->ip6r0_reserved);
- if (EXTRACT_32BITS(dp0->ip6r0_reserved) || ndo->ndo_vflag) {
+ if (EXTRACT_BE_32BITS(dp0->ip6r0_reserved) || ndo->ndo_vflag) {
ND_PRINT((ndo, ", rsv=0x%0x",
- EXTRACT_32BITS(&dp0->ip6r0_reserved)));
+ EXTRACT_BE_32BITS(&dp0->ip6r0_reserved)));
}
if (len % 2 == 1)
if (ndo->ndo_vflag > 1)
ND_PRINT((ndo, " cid %08x call# %d",
- (int) EXTRACT_32BITS(&rxh->cid),
- (int) EXTRACT_32BITS(&rxh->callNumber)));
+ (int) EXTRACT_BE_32BITS(&rxh->cid),
+ (int) EXTRACT_BE_32BITS(&rxh->callNumber)));
ND_PRINT((ndo, " seq %d ser %d",
- (int) EXTRACT_32BITS(&rxh->seq),
- (int) EXTRACT_32BITS(&rxh->serial)));
+ (int) EXTRACT_BE_32BITS(&rxh->seq),
+ (int) EXTRACT_BE_32BITS(&rxh->serial)));
if (ndo->ndo_vflag > 2)
ND_PRINT((ndo, " secindex %d serviceid %hu",
(int) rxh->securityIndex,
- EXTRACT_16BITS(&rxh->serviceId)));
+ EXTRACT_BE_16BITS(&rxh->serviceId)));
if (ndo->ndo_vflag > 1)
for (i = 0; i < NUM_RX_FLAGS; i++) {
*/
if (rxh->type == RX_PACKET_TYPE_DATA &&
- EXTRACT_32BITS(&rxh->seq) == 1 &&
+ EXTRACT_BE_32BITS(&rxh->seq) == 1 &&
rxh->flags & RX_CLIENT_INITIATED) {
/*
*/
} else if (((rxh->type == RX_PACKET_TYPE_DATA &&
- EXTRACT_32BITS(&rxh->seq) == 1) ||
+ EXTRACT_BE_32BITS(&rxh->seq) == 1) ||
rxh->type == RX_PACKET_TYPE_ABORT) &&
(rxh->flags & RX_CLIENT_INITIATED) == 0 &&
rx_cache_find(rxh, (const struct ip *) bp2,
if (++rx_cache_next >= RX_CACHE_SIZE)
rx_cache_next = 0;
- rxent->callnum = EXTRACT_32BITS(&rxh->callNumber);
+ rxent->callnum = EXTRACT_BE_32BITS(&rxh->callNumber);
UNALIGNED_MEMCPY(&rxent->client, &ip->ip_src, sizeof(uint32_t));
UNALIGNED_MEMCPY(&rxent->server, &ip->ip_dst, sizeof(uint32_t));
rxent->dport = dport;
- rxent->serviceId = EXTRACT_32BITS(&rxh->serviceId);
- rxent->opcode = EXTRACT_32BITS(bp + sizeof(struct rx_header));
+ rxent->serviceId = EXTRACT_BE_32BITS(&rxh->serviceId);
+ rxent->opcode = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
}
/*
i = rx_cache_hint;
do {
rxent = &rx_cache[i];
- if (rxent->callnum == EXTRACT_32BITS(&rxh->callNumber) &&
+ if (rxent->callnum == EXTRACT_BE_32BITS(&rxh->callNumber) &&
rxent->client.s_addr == clip &&
rxent->server.s_addr == sip &&
- rxent->serviceId == EXTRACT_32BITS(&rxh->serviceId) &&
+ rxent->serviceId == EXTRACT_BE_32BITS(&rxh->serviceId) &&
rxent->dport == sport) {
/* We got a match! */
#define FIDOUT() { unsigned long n1, n2, n3; \
ND_TCHECK2(bp[0], sizeof(int32_t) * 3); \
- n1 = EXTRACT_32BITS(bp); \
+ n1 = EXTRACT_BE_32BITS(bp); \
bp += sizeof(int32_t); \
- n2 = EXTRACT_32BITS(bp); \
+ n2 = EXTRACT_BE_32BITS(bp); \
bp += sizeof(int32_t); \
- n3 = EXTRACT_32BITS(bp); \
+ n3 = EXTRACT_BE_32BITS(bp); \
bp += sizeof(int32_t); \
ND_PRINT((ndo, " fid %d/%d/%d", (int) n1, (int) n2, (int) n3)); \
}
#define STROUT(MAX) { unsigned int _i; \
ND_TCHECK2(bp[0], sizeof(int32_t)); \
- _i = EXTRACT_32BITS(bp); \
+ _i = EXTRACT_BE_32BITS(bp); \
if (_i > (MAX)) \
goto trunc; \
bp += sizeof(int32_t); \
#define INTOUT() { int _i; \
ND_TCHECK2(bp[0], sizeof(int32_t)); \
- _i = (int) EXTRACT_32BITS(bp); \
+ _i = (int) EXTRACT_BE_32BITS(bp); \
bp += sizeof(int32_t); \
ND_PRINT((ndo, " %d", _i)); \
}
#define UINTOUT() { unsigned long _i; \
ND_TCHECK2(bp[0], sizeof(int32_t)); \
- _i = EXTRACT_32BITS(bp); \
+ _i = EXTRACT_BE_32BITS(bp); \
bp += sizeof(int32_t); \
ND_PRINT((ndo, " %lu", _i)); \
}
#define UINT64OUT() { uint64_t _i; \
ND_TCHECK2(bp[0], sizeof(uint64_t)); \
- _i = EXTRACT_64BITS(bp); \
+ _i = EXTRACT_BE_64BITS(bp); \
bp += sizeof(uint64_t); \
ND_PRINT((ndo, " %" PRIu64, _i)); \
}
#define DATEOUT() { time_t _t; struct tm *tm; char str[256]; \
ND_TCHECK2(bp[0], sizeof(int32_t)); \
- _t = (time_t) EXTRACT_32BITS(bp); \
+ _t = (time_t) EXTRACT_BE_32BITS(bp); \
bp += sizeof(int32_t); \
tm = localtime(&_t); \
strftime(str, 256, "%Y/%m/%d %H:%M:%S", tm); \
#define STOREATTROUT() { unsigned long mask, _i; \
ND_TCHECK2(bp[0], (sizeof(int32_t)*6)); \
- mask = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
+ mask = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); \
if (mask) ND_PRINT((ndo, " StoreStatus")); \
if (mask & 1) { ND_PRINT((ndo, " date")); DATEOUT(); } \
else bp += sizeof(int32_t); \
- _i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
+ _i = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); \
if (mask & 2) ND_PRINT((ndo, " owner %lu", _i)); \
- _i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
+ _i = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); \
if (mask & 4) ND_PRINT((ndo, " group %lu", _i)); \
- _i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
+ _i = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); \
if (mask & 8) ND_PRINT((ndo, " mode %lo", _i & 07777)); \
- _i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
+ _i = EXTRACT_BE_32BITS(bp); bp += sizeof(int32_t); \
if (mask & 16) ND_PRINT((ndo, " segsize %lu", _i)); \
/* undocumented in 3.3 docu */ \
if (mask & 1024) ND_PRINT((ndo, " fsync")); \
#define UBIK_VERSIONOUT() {int32_t epoch; int32_t counter; \
ND_TCHECK2(bp[0], sizeof(int32_t) * 2); \
- epoch = EXTRACT_32BITS(bp); \
+ epoch = EXTRACT_BE_32BITS(bp); \
bp += sizeof(int32_t); \
- counter = EXTRACT_32BITS(bp); \
+ counter = EXTRACT_BE_32BITS(bp); \
bp += sizeof(int32_t); \
ND_PRINT((ndo, " %d.%d", epoch, counter)); \
}
#define AFSUUIDOUT() {uint32_t temp; int _i; \
ND_TCHECK2(bp[0], 11*sizeof(uint32_t)); \
- temp = EXTRACT_32BITS(bp); \
+ temp = EXTRACT_BE_32BITS(bp); \
bp += sizeof(uint32_t); \
ND_PRINT((ndo, " %08x", temp)); \
- temp = EXTRACT_32BITS(bp); \
+ temp = EXTRACT_BE_32BITS(bp); \
bp += sizeof(uint32_t); \
ND_PRINT((ndo, "%04x", temp)); \
- temp = EXTRACT_32BITS(bp); \
+ temp = EXTRACT_BE_32BITS(bp); \
bp += sizeof(uint32_t); \
ND_PRINT((ndo, "%04x", temp)); \
for (_i = 0; _i < 8; _i++) { \
- temp = EXTRACT_32BITS(bp); \
+ temp = EXTRACT_BE_32BITS(bp); \
bp += sizeof(uint32_t); \
ND_PRINT((ndo, "%02x", (unsigned char) temp)); \
} \
ND_TCHECK2(bp[0], (MAX) * sizeof(int32_t)); \
sp = s; \
for (k = 0; k < (MAX); k++) { \
- *sp++ = (u_char) EXTRACT_32BITS(bp); \
+ *sp++ = (u_char) EXTRACT_BE_32BITS(bp); \
bp += sizeof(int32_t); \
} \
s[(MAX)] = '\0'; \
#define DESTSERVEROUT() { unsigned long n1, n2, n3; \
ND_TCHECK2(bp[0], sizeof(int32_t) * 3); \
- n1 = EXTRACT_32BITS(bp); \
+ n1 = EXTRACT_BE_32BITS(bp); \
bp += sizeof(int32_t); \
- n2 = EXTRACT_32BITS(bp); \
+ n2 = EXTRACT_BE_32BITS(bp); \
bp += sizeof(int32_t); \
- n3 = EXTRACT_32BITS(bp); \
+ n3 = EXTRACT_BE_32BITS(bp); \
bp += sizeof(int32_t); \
ND_PRINT((ndo, " server %d:%d:%d", (int) n1, (int) n2, (int) n3)); \
}
* gleaned from fsint/afsint.xg
*/
- fs_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
+ fs_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " fs call %s", tok2str(fs_req, "op#%d", fs_op)));
char a[AFSOPAQUEMAX+1];
FIDOUT();
ND_TCHECK2(bp[0], 4);
- i = EXTRACT_32BITS(bp);
+ i = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
ND_TCHECK2(bp[0], i);
i = min(AFSOPAQUEMAX, i);
{
unsigned long j;
ND_TCHECK2(bp[0], 4);
- j = EXTRACT_32BITS(bp);
+ j = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
for (i = 0; i < j; i++) {
{
char a[AFSOPAQUEMAX+1];
ND_TCHECK2(bp[0], 4);
- i = EXTRACT_32BITS(bp);
+ i = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
ND_TCHECK2(bp[0], i);
i = min(AFSOPAQUEMAX, i);
* Otherwise, just print out the return code
*/
ND_TCHECK2(bp[0], sizeof(int32_t));
- i = (int) EXTRACT_32BITS(bp);
+ i = (int) EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
ND_PRINT((ndo, " error %s", tok2str(afs_fs_errors, "#%d", i)));
* gleaned from fsint/afscbint.xg
*/
- cb_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
+ cb_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " cb call %s", tok2str(cb_req, "op#%d", cb_op)));
{
unsigned long j, t;
ND_TCHECK2(bp[0], 4);
- j = EXTRACT_32BITS(bp);
+ j = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
for (i = 0; i < j; i++) {
ND_PRINT((ndo, " <none!>"));
ND_TCHECK_32BITS(bp);
- j = EXTRACT_32BITS(bp);
+ j = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
if (j != 0)
ND_PRINT((ndo, " expires"));
DATEOUT();
ND_TCHECK2(bp[0], 4);
- t = EXTRACT_32BITS(bp);
+ t = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
tok2str(cb_types, "type %d", t);
}
* gleaned from ptserver/ptint.xg
*/
- pt_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
+ pt_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " pt"));
{
unsigned long j;
ND_TCHECK2(bp[0], 4);
- j = EXTRACT_32BITS(bp);
+ j = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
/*
unsigned long j;
ND_PRINT((ndo, " ids:"));
ND_TCHECK2(bp[0], 4);
- i = EXTRACT_32BITS(bp);
+ i = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
for (j = 0; j < i; j++)
INTOUT();
unsigned long j;
ND_PRINT((ndo, " ids:"));
ND_TCHECK2(bp[0], 4);
- i = EXTRACT_32BITS(bp);
+ i = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
for (j = 0; j < i; j++)
INTOUT();
{
unsigned long j;
ND_TCHECK2(bp[0], 4);
- j = EXTRACT_32BITS(bp);
+ j = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
/*
{
unsigned long j;
ND_TCHECK2(bp[0], 4);
- j = EXTRACT_32BITS(bp);
+ j = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
for (i = 0; i < j; i++) {
INTOUT();
* gleaned from vlserver/vldbint.xg
*/
- vldb_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
+ vldb_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " vldb"));
ND_PRINT((ndo, " volid"));
INTOUT();
ND_TCHECK2(bp[0], sizeof(int32_t));
- i = EXTRACT_32BITS(bp);
+ i = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
if (i <= 2)
ND_PRINT((ndo, " type %s", voltype[i]));
ND_PRINT((ndo, " volid"));
INTOUT();
ND_TCHECK2(bp[0], sizeof(int32_t));
- i = EXTRACT_32BITS(bp);
+ i = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
if (i <= 2)
ND_PRINT((ndo, " type %s", voltype[i]));
bp += sizeof(int32_t);
ND_PRINT((ndo, " numservers"));
ND_TCHECK2(bp[0], sizeof(int32_t));
- nservers = EXTRACT_32BITS(bp);
+ nservers = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
ND_PRINT((ndo, " %lu", nservers));
ND_PRINT((ndo, " servers"));
ND_PRINT((ndo, " partitions"));
for (i = 0; i < 8; i++) {
ND_TCHECK2(bp[0], sizeof(int32_t));
- j = EXTRACT_32BITS(bp);
+ j = EXTRACT_BE_32BITS(bp);
if (i < nservers && j <= 26)
ND_PRINT((ndo, " %c", 'a' + (int)j));
else if (i < nservers)
VECOUT(VLNAMEMAX);
ND_PRINT((ndo, " numservers"));
ND_TCHECK2(bp[0], sizeof(int32_t));
- nservers = EXTRACT_32BITS(bp);
+ nservers = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
ND_PRINT((ndo, " %lu", nservers));
ND_PRINT((ndo, " servers"));
ND_PRINT((ndo, " partitions"));
for (i = 0; i < 13; i++) {
ND_TCHECK2(bp[0], sizeof(int32_t));
- j = EXTRACT_32BITS(bp);
+ j = EXTRACT_BE_32BITS(bp);
if (i < nservers && j <= 26)
ND_PRINT((ndo, " %c", 'a' + (int)j));
else if (i < nservers)
VECOUT(VLNAMEMAX);
ND_PRINT((ndo, " numservers"));
ND_TCHECK2(bp[0], sizeof(int32_t));
- nservers = EXTRACT_32BITS(bp);
+ nservers = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
ND_PRINT((ndo, " %lu", nservers));
ND_PRINT((ndo, " servers"));
ND_PRINT((ndo, " partitions"));
for (i = 0; i < 13; i++) {
ND_TCHECK2(bp[0], sizeof(int32_t));
- j = EXTRACT_32BITS(bp);
+ j = EXTRACT_BE_32BITS(bp);
if (i < nservers && j <= 26)
ND_PRINT((ndo, " %c", 'a' + (int)j));
else if (i < nservers)
* gleaned from kauth/kauth.rg
*/
- kauth_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
+ kauth_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " kauth"));
ND_PRINT((ndo, " domain"));
STROUT(KANAMEMAX);
ND_TCHECK2(bp[0], sizeof(int32_t));
- i = (int) EXTRACT_32BITS(bp);
+ i = (int) EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
ND_TCHECK2(bp[0], i);
bp += i;
* gleaned from volser/volint.xg
*/
- vol_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
+ vol_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " vol call %s", tok2str(vol_req, "op#%d", vol_op)));
{
unsigned long i, j;
ND_TCHECK2(bp[0], 4);
- j = EXTRACT_32BITS(bp);
+ j = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
for (i = 0; i < j; i++) {
DESTSERVEROUT();
{
unsigned long i, j;
ND_TCHECK2(bp[0], 4);
- j = EXTRACT_32BITS(bp);
+ j = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
for (i = 0; i < j; i++) {
ND_PRINT((ndo, " name"));
* gleaned from bozo/bosint.xg
*/
- bos_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
+ bos_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " bos call %s", tok2str(bos_req, "op#%d", bos_op)));
* for (sizeof(rx_header) + 4) bytes, so long as it remains this way
* the line below will not over-read.
*/
- ubik_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
+ ubik_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " ubik call %s", tok2str(ubik_req, "op#%d", ubik_op)));
switch (ubik_op) {
case 10000: /* Beacon */
ND_TCHECK2(bp[0], 4);
- temp = EXTRACT_32BITS(bp);
+ temp = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
ND_PRINT((ndo, " syncsite %s", temp ? "yes" : "no"));
ND_PRINT((ndo, " votestart"));
ND_PRINT((ndo, " length"));
INTOUT();
ND_TCHECK_32BITS(bp);
- temp = EXTRACT_32BITS(bp);
+ temp = EXTRACT_BE_32BITS(bp);
bp += sizeof(int32_t);
tok2str(ubik_lock_types, "type %d", temp);
break;
if (ndo->ndo_vflag > 2)
ND_PRINT((ndo, " bufspace %d maxskew %d",
- (int) EXTRACT_16BITS(&rxa->bufferSpace),
- (int) EXTRACT_16BITS(&rxa->maxSkew)));
+ (int) EXTRACT_BE_16BITS(&rxa->bufferSpace),
+ (int) EXTRACT_BE_16BITS(&rxa->maxSkew)));
- firstPacket = EXTRACT_32BITS(&rxa->firstPacket);
+ firstPacket = EXTRACT_BE_32BITS(&rxa->firstPacket);
ND_PRINT((ndo, " first %d serial %d reason %s",
- firstPacket, EXTRACT_32BITS(&rxa->serial),
+ firstPacket, EXTRACT_BE_32BITS(&rxa->serial),
tok2str(rx_ack_reasons, "#%d", (int) rxa->reason)));
/*
ND_TCHECK(*sctpPktHdr);
sctpPacketLengthRemaining = sctpPacketLength;
- sourcePort = EXTRACT_16BITS(&sctpPktHdr->source);
- destPort = EXTRACT_16BITS(&sctpPktHdr->destination);
+ sourcePort = EXTRACT_BE_16BITS(&sctpPktHdr->source);
+ destPort = EXTRACT_BE_16BITS(&sctpPktHdr->destination);
ip = (const struct ip *)bp2;
if (IP_V(ip) == 6)
break;
}
ND_TCHECK(*chunkDescPtr);
- chunkLength = EXTRACT_16BITS(&chunkDescPtr->chunkLength);
+ chunkLength = EXTRACT_BE_16BITS(&chunkDescPtr->chunkLength);
if (chunkLength < sizeof(*chunkDescPtr)) {
ND_PRINT((ndo, "%s%d) [Bad chunk length %u, < size of chunk descriptor]", sep, chunkCount+1, chunkLength));
break;
}
dataHdrPtr=(const struct sctpDataPart*)bp;
- ppid = EXTRACT_32BITS(&dataHdrPtr->payloadtype);
- ND_PRINT((ndo, "[TSN: %u] ", EXTRACT_32BITS(&dataHdrPtr->TSN)));
- ND_PRINT((ndo, "[SID: %u] ", EXTRACT_16BITS(&dataHdrPtr->streamId)));
- ND_PRINT((ndo, "[SSEQ %u] ", EXTRACT_16BITS(&dataHdrPtr->sequence)));
+ ppid = EXTRACT_BE_32BITS(&dataHdrPtr->payloadtype);
+ ND_PRINT((ndo, "[TSN: %u] ", EXTRACT_BE_32BITS(&dataHdrPtr->TSN)));
+ ND_PRINT((ndo, "[SID: %u] ", EXTRACT_BE_16BITS(&dataHdrPtr->streamId)));
+ ND_PRINT((ndo, "[SSEQ %u] ", EXTRACT_BE_16BITS(&dataHdrPtr->sequence)));
ND_PRINT((ndo, "[PPID %s] ",
tok2str(PayloadProto_idents, "0x%x", ppid)));
return;
}
init=(const struct sctpInitiation*)bp;
- ND_PRINT((ndo, "[init tag: %u] ", EXTRACT_32BITS(&init->initTag)));
- ND_PRINT((ndo, "[rwnd: %u] ", EXTRACT_32BITS(&init->rcvWindowCredit)));
- ND_PRINT((ndo, "[OS: %u] ", EXTRACT_16BITS(&init->NumPreopenStreams)));
- ND_PRINT((ndo, "[MIS: %u] ", EXTRACT_16BITS(&init->MaxInboundStreams)));
- ND_PRINT((ndo, "[init TSN: %u] ", EXTRACT_32BITS(&init->initialTSN)));
+ ND_PRINT((ndo, "[init tag: %u] ", EXTRACT_BE_32BITS(&init->initTag)));
+ ND_PRINT((ndo, "[rwnd: %u] ", EXTRACT_BE_32BITS(&init->rcvWindowCredit)));
+ ND_PRINT((ndo, "[OS: %u] ", EXTRACT_BE_16BITS(&init->NumPreopenStreams)));
+ ND_PRINT((ndo, "[MIS: %u] ", EXTRACT_BE_16BITS(&init->MaxInboundStreams)));
+ ND_PRINT((ndo, "[init TSN: %u] ", EXTRACT_BE_32BITS(&init->initialTSN)));
bp += sizeof(*init);
sctpPacketLengthRemaining -= sizeof(*init);
chunkLengthRemaining -= sizeof(*init);
return;
}
init=(const struct sctpInitiation*)bp;
- ND_PRINT((ndo, "[init tag: %u] ", EXTRACT_32BITS(&init->initTag)));
- ND_PRINT((ndo, "[rwnd: %u] ", EXTRACT_32BITS(&init->rcvWindowCredit)));
- ND_PRINT((ndo, "[OS: %u] ", EXTRACT_16BITS(&init->NumPreopenStreams)));
- ND_PRINT((ndo, "[MIS: %u] ", EXTRACT_16BITS(&init->MaxInboundStreams)));
- ND_PRINT((ndo, "[init TSN: %u] ", EXTRACT_32BITS(&init->initialTSN)));
+ ND_PRINT((ndo, "[init tag: %u] ", EXTRACT_BE_32BITS(&init->initTag)));
+ ND_PRINT((ndo, "[rwnd: %u] ", EXTRACT_BE_32BITS(&init->rcvWindowCredit)));
+ ND_PRINT((ndo, "[OS: %u] ", EXTRACT_BE_16BITS(&init->NumPreopenStreams)));
+ ND_PRINT((ndo, "[MIS: %u] ", EXTRACT_BE_16BITS(&init->MaxInboundStreams)));
+ ND_PRINT((ndo, "[init TSN: %u] ", EXTRACT_BE_32BITS(&init->initialTSN)));
bp += sizeof(*init);
sctpPacketLengthRemaining -= sizeof(*init);
chunkLengthRemaining -= sizeof(*init);
return;
}
sack=(const struct sctpSelectiveAck*)bp;
- ND_PRINT((ndo, "[cum ack %u] ", EXTRACT_32BITS(&sack->highestConseqTSN)));
- ND_PRINT((ndo, "[a_rwnd %u] ", EXTRACT_32BITS(&sack->updatedRwnd)));
- ND_PRINT((ndo, "[#gap acks %u] ", EXTRACT_16BITS(&sack->numberOfdesc)));
- ND_PRINT((ndo, "[#dup tsns %u] ", EXTRACT_16BITS(&sack->numDupTsns)));
+ ND_PRINT((ndo, "[cum ack %u] ", EXTRACT_BE_32BITS(&sack->highestConseqTSN)));
+ ND_PRINT((ndo, "[a_rwnd %u] ", EXTRACT_BE_32BITS(&sack->updatedRwnd)));
+ ND_PRINT((ndo, "[#gap acks %u] ", EXTRACT_BE_16BITS(&sack->numberOfdesc)));
+ ND_PRINT((ndo, "[#dup tsns %u] ", EXTRACT_BE_16BITS(&sack->numDupTsns)));
bp += sizeof(*sack);
sctpPacketLengthRemaining -= sizeof(*sack);
chunkLengthRemaining -= sizeof(*sack);
/* print gaps */
for (fragNo=0;
- chunkLengthRemaining != 0 && fragNo < EXTRACT_16BITS(&sack->numberOfdesc);
+ chunkLengthRemaining != 0 && fragNo < EXTRACT_BE_16BITS(&sack->numberOfdesc);
bp += sizeof(*frag), sctpPacketLengthRemaining -= sizeof(*frag), chunkLengthRemaining -= sizeof(*frag), fragNo++) {
if (chunkLengthRemaining < sizeof(*frag)) {
ND_PRINT((ndo, "bogus chunk length %u]", chunkLength));
frag = (const struct sctpSelectiveFrag *)bp;
ND_PRINT((ndo, "\n\t\t[gap ack block #%d: start = %u, end = %u] ",
fragNo+1,
- EXTRACT_32BITS(&sack->highestConseqTSN) + EXTRACT_16BITS(&frag->fragmentStart),
- EXTRACT_32BITS(&sack->highestConseqTSN) + EXTRACT_16BITS(&frag->fragmentEnd)));
+ EXTRACT_BE_32BITS(&sack->highestConseqTSN) + EXTRACT_BE_16BITS(&frag->fragmentStart),
+ EXTRACT_BE_32BITS(&sack->highestConseqTSN) + EXTRACT_BE_16BITS(&frag->fragmentEnd)));
}
/* print duplicate TSNs */
for (tsnNo=0;
- chunkLengthRemaining != 0 && tsnNo<EXTRACT_16BITS(&sack->numDupTsns);
+ chunkLengthRemaining != 0 && tsnNo<EXTRACT_BE_16BITS(&sack->numDupTsns);
bp += 4, sctpPacketLengthRemaining -= 4, chunkLengthRemaining -= 4, tsnNo++) {
if (chunkLengthRemaining < 4) {
ND_PRINT((ndo, "bogus chunk length %u]", chunkLength));
}
dupTSN = (const u_char *)bp;
ND_PRINT((ndo, "\n\t\t[dup TSN #%u: %u] ", tsnNo+1,
- EXTRACT_32BITS(dupTSN)));
+ EXTRACT_BE_32BITS(dupTSN)));
}
break;
}
sflow_gen_counter = (const struct sflow_generic_counter_t *)pointer;
ND_TCHECK(*sflow_gen_counter);
ND_PRINT((ndo, "\n\t ifindex %u, iftype %u, ifspeed %" PRIu64 ", ifdirection %u (%s)",
- EXTRACT_32BITS(sflow_gen_counter->ifindex),
- EXTRACT_32BITS(sflow_gen_counter->iftype),
- EXTRACT_64BITS(sflow_gen_counter->ifspeed),
- EXTRACT_32BITS(sflow_gen_counter->ifdirection),
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifindex),
+ EXTRACT_BE_32BITS(sflow_gen_counter->iftype),
+ EXTRACT_BE_64BITS(sflow_gen_counter->ifspeed),
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifdirection),
tok2str(sflow_iface_direction_values, "Unknown",
- EXTRACT_32BITS(sflow_gen_counter->ifdirection))));
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifdirection))));
ND_PRINT((ndo, "\n\t ifstatus %u, adminstatus: %s, operstatus: %s",
- EXTRACT_32BITS(sflow_gen_counter->ifstatus),
- EXTRACT_32BITS(sflow_gen_counter->ifstatus)&1 ? "up" : "down",
- (EXTRACT_32BITS(sflow_gen_counter->ifstatus)>>1)&1 ? "up" : "down"));
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifstatus),
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifstatus)&1 ? "up" : "down",
+ (EXTRACT_BE_32BITS(sflow_gen_counter->ifstatus)>>1)&1 ? "up" : "down"));
ND_PRINT((ndo, "\n\t In octets %" PRIu64
", unicast pkts %u, multicast pkts %u, broadcast pkts %u, discards %u",
- EXTRACT_64BITS(sflow_gen_counter->ifinoctets),
- EXTRACT_32BITS(sflow_gen_counter->ifinunicastpkts),
- EXTRACT_32BITS(sflow_gen_counter->ifinmulticastpkts),
- EXTRACT_32BITS(sflow_gen_counter->ifinbroadcastpkts),
- EXTRACT_32BITS(sflow_gen_counter->ifindiscards)));
+ EXTRACT_BE_64BITS(sflow_gen_counter->ifinoctets),
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifinunicastpkts),
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifinmulticastpkts),
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifinbroadcastpkts),
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifindiscards)));
ND_PRINT((ndo, "\n\t In errors %u, unknown protos %u",
- EXTRACT_32BITS(sflow_gen_counter->ifinerrors),
- EXTRACT_32BITS(sflow_gen_counter->ifinunkownprotos)));
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifinerrors),
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifinunkownprotos)));
ND_PRINT((ndo, "\n\t Out octets %" PRIu64
", unicast pkts %u, multicast pkts %u, broadcast pkts %u, discards %u",
- EXTRACT_64BITS(sflow_gen_counter->ifoutoctets),
- EXTRACT_32BITS(sflow_gen_counter->ifoutunicastpkts),
- EXTRACT_32BITS(sflow_gen_counter->ifoutmulticastpkts),
- EXTRACT_32BITS(sflow_gen_counter->ifoutbroadcastpkts),
- EXTRACT_32BITS(sflow_gen_counter->ifoutdiscards)));
+ EXTRACT_BE_64BITS(sflow_gen_counter->ifoutoctets),
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifoutunicastpkts),
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifoutmulticastpkts),
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifoutbroadcastpkts),
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifoutdiscards)));
ND_PRINT((ndo, "\n\t Out errors %u, promisc mode %u",
- EXTRACT_32BITS(sflow_gen_counter->ifouterrors),
- EXTRACT_32BITS(sflow_gen_counter->ifpromiscmode)));
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifouterrors),
+ EXTRACT_BE_32BITS(sflow_gen_counter->ifpromiscmode)));
return 0;
sflow_eth_counter = (const struct sflow_ethernet_counter_t *)pointer;
ND_TCHECK(*sflow_eth_counter);
ND_PRINT((ndo, "\n\t align errors %u, fcs errors %u, single collision %u, multiple collision %u, test error %u",
- EXTRACT_32BITS(sflow_eth_counter->alignerrors),
- EXTRACT_32BITS(sflow_eth_counter->fcserrors),
- EXTRACT_32BITS(sflow_eth_counter->single_collision_frames),
- EXTRACT_32BITS(sflow_eth_counter->multiple_collision_frames),
- EXTRACT_32BITS(sflow_eth_counter->test_errors)));
+ EXTRACT_BE_32BITS(sflow_eth_counter->alignerrors),
+ EXTRACT_BE_32BITS(sflow_eth_counter->fcserrors),
+ EXTRACT_BE_32BITS(sflow_eth_counter->single_collision_frames),
+ EXTRACT_BE_32BITS(sflow_eth_counter->multiple_collision_frames),
+ EXTRACT_BE_32BITS(sflow_eth_counter->test_errors)));
ND_PRINT((ndo, "\n\t deferred %u, late collision %u, excessive collision %u, mac trans error %u",
- EXTRACT_32BITS(sflow_eth_counter->deferred_transmissions),
- EXTRACT_32BITS(sflow_eth_counter->late_collisions),
- EXTRACT_32BITS(sflow_eth_counter->excessive_collisions),
- EXTRACT_32BITS(sflow_eth_counter->mac_transmit_errors)));
+ EXTRACT_BE_32BITS(sflow_eth_counter->deferred_transmissions),
+ EXTRACT_BE_32BITS(sflow_eth_counter->late_collisions),
+ EXTRACT_BE_32BITS(sflow_eth_counter->excessive_collisions),
+ EXTRACT_BE_32BITS(sflow_eth_counter->mac_transmit_errors)));
ND_PRINT((ndo, "\n\t carrier error %u, frames too long %u, mac receive errors %u, symbol errors %u",
- EXTRACT_32BITS(sflow_eth_counter->carrier_sense_errors),
- EXTRACT_32BITS(sflow_eth_counter->frame_too_longs),
- EXTRACT_32BITS(sflow_eth_counter->mac_receive_errors),
- EXTRACT_32BITS(sflow_eth_counter->symbol_errors)));
+ EXTRACT_BE_32BITS(sflow_eth_counter->carrier_sense_errors),
+ EXTRACT_BE_32BITS(sflow_eth_counter->frame_too_longs),
+ EXTRACT_BE_32BITS(sflow_eth_counter->mac_receive_errors),
+ EXTRACT_BE_32BITS(sflow_eth_counter->symbol_errors)));
return 0;
sflow_100basevg_counter = (const struct sflow_100basevg_counter_t *)pointer;
ND_TCHECK(*sflow_100basevg_counter);
ND_PRINT((ndo, "\n\t in high prio frames %u, in high prio octets %" PRIu64,
- EXTRACT_32BITS(sflow_100basevg_counter->in_highpriority_frames),
- EXTRACT_64BITS(sflow_100basevg_counter->in_highpriority_octets)));
+ EXTRACT_BE_32BITS(sflow_100basevg_counter->in_highpriority_frames),
+ EXTRACT_BE_64BITS(sflow_100basevg_counter->in_highpriority_octets)));
ND_PRINT((ndo, "\n\t in norm prio frames %u, in norm prio octets %" PRIu64,
- EXTRACT_32BITS(sflow_100basevg_counter->in_normpriority_frames),
- EXTRACT_64BITS(sflow_100basevg_counter->in_normpriority_octets)));
+ EXTRACT_BE_32BITS(sflow_100basevg_counter->in_normpriority_frames),
+ EXTRACT_BE_64BITS(sflow_100basevg_counter->in_normpriority_octets)));
ND_PRINT((ndo, "\n\t in ipm errors %u, oversized %u, in data errors %u, null addressed frames %u",
- EXTRACT_32BITS(sflow_100basevg_counter->in_ipmerrors),
- EXTRACT_32BITS(sflow_100basevg_counter->in_oversized),
- EXTRACT_32BITS(sflow_100basevg_counter->in_data_errors),
- EXTRACT_32BITS(sflow_100basevg_counter->in_null_addressed_frames)));
+ EXTRACT_BE_32BITS(sflow_100basevg_counter->in_ipmerrors),
+ EXTRACT_BE_32BITS(sflow_100basevg_counter->in_oversized),
+ EXTRACT_BE_32BITS(sflow_100basevg_counter->in_data_errors),
+ EXTRACT_BE_32BITS(sflow_100basevg_counter->in_null_addressed_frames)));
ND_PRINT((ndo, "\n\t out high prio frames %u, out high prio octets %" PRIu64
", trans into frames %u",
- EXTRACT_32BITS(sflow_100basevg_counter->out_highpriority_frames),
- EXTRACT_64BITS(sflow_100basevg_counter->out_highpriority_octets),
- EXTRACT_32BITS(sflow_100basevg_counter->transitioninto_frames)));
+ EXTRACT_BE_32BITS(sflow_100basevg_counter->out_highpriority_frames),
+ EXTRACT_BE_64BITS(sflow_100basevg_counter->out_highpriority_octets),
+ EXTRACT_BE_32BITS(sflow_100basevg_counter->transitioninto_frames)));
ND_PRINT((ndo, "\n\t in hc high prio octets %" PRIu64
", in hc norm prio octets %" PRIu64
", out hc high prio octets %" PRIu64,
- EXTRACT_64BITS(sflow_100basevg_counter->hc_in_highpriority_octets),
- EXTRACT_64BITS(sflow_100basevg_counter->hc_in_normpriority_octets),
- EXTRACT_64BITS(sflow_100basevg_counter->hc_out_highpriority_octets)));
+ EXTRACT_BE_64BITS(sflow_100basevg_counter->hc_in_highpriority_octets),
+ EXTRACT_BE_64BITS(sflow_100basevg_counter->hc_in_normpriority_octets),
+ EXTRACT_BE_64BITS(sflow_100basevg_counter->hc_out_highpriority_octets)));
return 0;
ND_TCHECK(*sflow_vlan_counter);
ND_PRINT((ndo, "\n\t vlan_id %u, octets %" PRIu64
", unicast_pkt %u, multicast_pkt %u, broadcast_pkt %u, discards %u",
- EXTRACT_32BITS(sflow_vlan_counter->vlan_id),
- EXTRACT_64BITS(sflow_vlan_counter->octets),
- EXTRACT_32BITS(sflow_vlan_counter->unicast_pkt),
- EXTRACT_32BITS(sflow_vlan_counter->multicast_pkt),
- EXTRACT_32BITS(sflow_vlan_counter->broadcast_pkt),
- EXTRACT_32BITS(sflow_vlan_counter->discards)));
+ EXTRACT_BE_32BITS(sflow_vlan_counter->vlan_id),
+ EXTRACT_BE_64BITS(sflow_vlan_counter->octets),
+ EXTRACT_BE_32BITS(sflow_vlan_counter->unicast_pkt),
+ EXTRACT_BE_32BITS(sflow_vlan_counter->multicast_pkt),
+ EXTRACT_BE_32BITS(sflow_vlan_counter->broadcast_pkt),
+ EXTRACT_BE_32BITS(sflow_vlan_counter->discards)));
return 0;
ND_TCHECK(*sflow_processor_counter);
ND_PRINT((ndo, "\n\t 5sec %u, 1min %u, 5min %u, total_mem %" PRIu64
", total_mem %" PRIu64,
- EXTRACT_32BITS(sflow_processor_counter->five_sec_util),
- EXTRACT_32BITS(sflow_processor_counter->one_min_util),
- EXTRACT_32BITS(sflow_processor_counter->five_min_util),
- EXTRACT_64BITS(sflow_processor_counter->total_memory),
- EXTRACT_64BITS(sflow_processor_counter->free_memory)));
+ EXTRACT_BE_32BITS(sflow_processor_counter->five_sec_util),
+ EXTRACT_BE_32BITS(sflow_processor_counter->one_min_util),
+ EXTRACT_BE_32BITS(sflow_processor_counter->five_min_util),
+ EXTRACT_BE_64BITS(sflow_processor_counter->total_memory),
+ EXTRACT_BE_64BITS(sflow_processor_counter->free_memory)));
return 0;
sflow_counter_record = (const struct sflow_counter_record_t *)tptr;
ND_TCHECK(*sflow_counter_record);
- enterprise = EXTRACT_32BITS(sflow_counter_record->format);
+ enterprise = EXTRACT_BE_32BITS(sflow_counter_record->format);
counter_type = enterprise & 0x0FFF;
enterprise = enterprise >> 20;
- counter_len = EXTRACT_32BITS(sflow_counter_record->length);
+ counter_len = EXTRACT_BE_32BITS(sflow_counter_record->length);
ND_PRINT((ndo, "\n\t enterprise %u, %s (%u) length %u",
enterprise,
(enterprise == 0) ? tok2str(sflow_counter_type_values,"Unknown",counter_type) : "Unknown",
sflow_counter_sample = (const struct sflow_counter_sample_t *)pointer;
ND_TCHECK(*sflow_counter_sample);
- typesource = EXTRACT_32BITS(sflow_counter_sample->typesource);
- nrecords = EXTRACT_32BITS(sflow_counter_sample->records);
+ typesource = EXTRACT_BE_32BITS(sflow_counter_sample->typesource);
+ nrecords = EXTRACT_BE_32BITS(sflow_counter_sample->records);
type = typesource >> 24;
index = typesource & 0x0FFF;
ND_PRINT((ndo, " seqnum %u, type %u, idx %u, records %u",
- EXTRACT_32BITS(sflow_counter_sample->seqnum),
+ EXTRACT_BE_32BITS(sflow_counter_sample->seqnum),
type,
index,
nrecords));
sflow_expanded_counter_sample = (const struct sflow_expanded_counter_sample_t *)pointer;
ND_TCHECK(*sflow_expanded_counter_sample);
- nrecords = EXTRACT_32BITS(sflow_expanded_counter_sample->records);
+ nrecords = EXTRACT_BE_32BITS(sflow_expanded_counter_sample->records);
ND_PRINT((ndo, " seqnum %u, type %u, idx %u, records %u",
- EXTRACT_32BITS(sflow_expanded_counter_sample->seqnum),
- EXTRACT_32BITS(sflow_expanded_counter_sample->type),
- EXTRACT_32BITS(sflow_expanded_counter_sample->index),
+ EXTRACT_BE_32BITS(sflow_expanded_counter_sample->seqnum),
+ EXTRACT_BE_32BITS(sflow_expanded_counter_sample->type),
+ EXTRACT_BE_32BITS(sflow_expanded_counter_sample->index),
nrecords));
return sflow_print_counter_records(ndo, pointer + sizeof(struct sflow_expanded_counter_sample_t),
sflow_flow_raw = (const struct sflow_expanded_flow_raw_t *)pointer;
ND_TCHECK(*sflow_flow_raw);
ND_PRINT((ndo, "\n\t protocol %s (%u), length %u, stripped bytes %u, header_size %u",
- tok2str(sflow_flow_raw_protocol_values,"Unknown",EXTRACT_32BITS(sflow_flow_raw->protocol)),
- EXTRACT_32BITS(sflow_flow_raw->protocol),
- EXTRACT_32BITS(sflow_flow_raw->length),
- EXTRACT_32BITS(sflow_flow_raw->stripped_bytes),
- EXTRACT_32BITS(sflow_flow_raw->header_size)));
+ tok2str(sflow_flow_raw_protocol_values,"Unknown",EXTRACT_BE_32BITS(sflow_flow_raw->protocol)),
+ EXTRACT_BE_32BITS(sflow_flow_raw->protocol),
+ EXTRACT_BE_32BITS(sflow_flow_raw->length),
+ EXTRACT_BE_32BITS(sflow_flow_raw->stripped_bytes),
+ EXTRACT_BE_32BITS(sflow_flow_raw->header_size)));
/* QUESTION - should we attempt to print the raw header itself?
assuming of course there is wnough data present to do so... */
ND_TCHECK(*sflow_ethernet_frame);
ND_PRINT((ndo, "\n\t frame len %u, type %u",
- EXTRACT_32BITS(sflow_ethernet_frame->length),
- EXTRACT_32BITS(sflow_ethernet_frame->type)));
+ EXTRACT_BE_32BITS(sflow_ethernet_frame->length),
+ EXTRACT_BE_32BITS(sflow_ethernet_frame->type)));
return 0;
sflow_extended_sw_data = (const struct sflow_extended_switch_data_t *)pointer;
ND_TCHECK(*sflow_extended_sw_data);
ND_PRINT((ndo, "\n\t src vlan %u, src pri %u, dst vlan %u, dst pri %u",
- EXTRACT_32BITS(sflow_extended_sw_data->src_vlan),
- EXTRACT_32BITS(sflow_extended_sw_data->src_pri),
- EXTRACT_32BITS(sflow_extended_sw_data->dst_vlan),
- EXTRACT_32BITS(sflow_extended_sw_data->dst_pri)));
+ EXTRACT_BE_32BITS(sflow_extended_sw_data->src_vlan),
+ EXTRACT_BE_32BITS(sflow_extended_sw_data->src_pri),
+ EXTRACT_BE_32BITS(sflow_extended_sw_data->dst_vlan),
+ EXTRACT_BE_32BITS(sflow_extended_sw_data->dst_pri)));
return 0;
/* so, the funky encoding means we cannot blythly mask-off
bits, we must also check the enterprise. */
- enterprise = EXTRACT_32BITS(sflow_flow_record->format);
+ enterprise = EXTRACT_BE_32BITS(sflow_flow_record->format);
flow_type = enterprise & 0x0FFF;
enterprise = enterprise >> 12;
- flow_len = EXTRACT_32BITS(sflow_flow_record->length);
+ flow_len = EXTRACT_BE_32BITS(sflow_flow_record->length);
ND_PRINT((ndo, "\n\t enterprise %u %s (%u) length %u",
enterprise,
(enterprise == 0) ? tok2str(sflow_flow_type_values,"Unknown",flow_type) : "Unknown",
sflow_flow_sample = (const struct sflow_flow_sample_t *)pointer;
ND_TCHECK(*sflow_flow_sample);
- typesource = EXTRACT_32BITS(sflow_flow_sample->typesource);
- nrecords = EXTRACT_32BITS(sflow_flow_sample->records);
+ typesource = EXTRACT_BE_32BITS(sflow_flow_sample->typesource);
+ nrecords = EXTRACT_BE_32BITS(sflow_flow_sample->records);
type = typesource >> 24;
index = typesource & 0x0FFF;
ND_PRINT((ndo, " seqnum %u, type %u, idx %u, rate %u, pool %u, drops %u, input %u output %u records %u",
- EXTRACT_32BITS(sflow_flow_sample->seqnum),
+ EXTRACT_BE_32BITS(sflow_flow_sample->seqnum),
type,
index,
- EXTRACT_32BITS(sflow_flow_sample->rate),
- EXTRACT_32BITS(sflow_flow_sample->pool),
- EXTRACT_32BITS(sflow_flow_sample->drops),
- EXTRACT_32BITS(sflow_flow_sample->in_interface),
- EXTRACT_32BITS(sflow_flow_sample->out_interface),
+ EXTRACT_BE_32BITS(sflow_flow_sample->rate),
+ EXTRACT_BE_32BITS(sflow_flow_sample->pool),
+ EXTRACT_BE_32BITS(sflow_flow_sample->drops),
+ EXTRACT_BE_32BITS(sflow_flow_sample->in_interface),
+ EXTRACT_BE_32BITS(sflow_flow_sample->out_interface),
nrecords));
return sflow_print_flow_records(ndo, pointer + sizeof(struct sflow_flow_sample_t),
sflow_expanded_flow_sample = (const struct sflow_expanded_flow_sample_t *)pointer;
ND_TCHECK(*sflow_expanded_flow_sample);
- nrecords = EXTRACT_32BITS(sflow_expanded_flow_sample->records);
+ nrecords = EXTRACT_BE_32BITS(sflow_expanded_flow_sample->records);
ND_PRINT((ndo, " seqnum %u, type %u, idx %u, rate %u, pool %u, drops %u, records %u",
- EXTRACT_32BITS(sflow_expanded_flow_sample->seqnum),
- EXTRACT_32BITS(sflow_expanded_flow_sample->type),
- EXTRACT_32BITS(sflow_expanded_flow_sample->index),
- EXTRACT_32BITS(sflow_expanded_flow_sample->rate),
- EXTRACT_32BITS(sflow_expanded_flow_sample->pool),
- EXTRACT_32BITS(sflow_expanded_flow_sample->drops),
- EXTRACT_32BITS(sflow_expanded_flow_sample->records)));
+ EXTRACT_BE_32BITS(sflow_expanded_flow_sample->seqnum),
+ EXTRACT_BE_32BITS(sflow_expanded_flow_sample->type),
+ EXTRACT_BE_32BITS(sflow_expanded_flow_sample->index),
+ EXTRACT_BE_32BITS(sflow_expanded_flow_sample->rate),
+ EXTRACT_BE_32BITS(sflow_expanded_flow_sample->pool),
+ EXTRACT_BE_32BITS(sflow_expanded_flow_sample->drops),
+ EXTRACT_BE_32BITS(sflow_expanded_flow_sample->records)));
return sflow_print_flow_records(ndo, pointer + sizeof(struct sflow_expanded_flow_sample_t),
len - sizeof(struct sflow_expanded_flow_sample_t),
/*
* Sanity checking of the header.
*/
- if (EXTRACT_32BITS(sflow_datagram->version) != 5) {
+ if (EXTRACT_BE_32BITS(sflow_datagram->version) != 5) {
ND_PRINT((ndo, "sFlow version %u packet not supported",
- EXTRACT_32BITS(sflow_datagram->version)));
+ EXTRACT_BE_32BITS(sflow_datagram->version)));
return;
}
if (ndo->ndo_vflag < 1) {
ND_PRINT((ndo, "sFlowv%u, %s agent %s, agent-id %u, length %u",
- EXTRACT_32BITS(sflow_datagram->version),
- EXTRACT_32BITS(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6",
+ EXTRACT_BE_32BITS(sflow_datagram->version),
+ EXTRACT_BE_32BITS(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6",
ipaddr_string(ndo, sflow_datagram->agent),
- EXTRACT_32BITS(sflow_datagram->agent_id),
+ EXTRACT_BE_32BITS(sflow_datagram->agent_id),
len));
return;
}
/* ok they seem to want to know everything - lets fully decode it */
- nsamples=EXTRACT_32BITS(sflow_datagram->samples);
+ nsamples=EXTRACT_BE_32BITS(sflow_datagram->samples);
ND_PRINT((ndo, "sFlowv%u, %s agent %s, agent-id %u, seqnum %u, uptime %u, samples %u, length %u",
- EXTRACT_32BITS(sflow_datagram->version),
- EXTRACT_32BITS(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6",
+ EXTRACT_BE_32BITS(sflow_datagram->version),
+ EXTRACT_BE_32BITS(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6",
ipaddr_string(ndo, sflow_datagram->agent),
- EXTRACT_32BITS(sflow_datagram->agent_id),
- EXTRACT_32BITS(sflow_datagram->seqnum),
- EXTRACT_32BITS(sflow_datagram->uptime),
+ EXTRACT_BE_32BITS(sflow_datagram->agent_id),
+ EXTRACT_BE_32BITS(sflow_datagram->seqnum),
+ EXTRACT_BE_32BITS(sflow_datagram->uptime),
nsamples,
len));
sflow_sample = (const struct sflow_sample_header *)tptr;
ND_TCHECK(*sflow_sample);
- sflow_sample_type = (EXTRACT_32BITS(sflow_sample->format)&0x0FFF);
- sflow_sample_len = EXTRACT_32BITS(sflow_sample->len);
+ sflow_sample_type = (EXTRACT_BE_32BITS(sflow_sample->format)&0x0FFF);
+ sflow_sample_len = EXTRACT_BE_32BITS(sflow_sample->len);
if (tlen < sizeof(struct sflow_sample_header))
goto trunc;
register u_int i;
if ((i = *cp++) == 0) {
- i = EXTRACT_16BITS(cp);
+ i = EXTRACT_BE_16BITS(cp);
cp += 2;
}
ND_PRINT((ndo, " %s%d", str, i));
register short i;
if ((i = *cp++) == 0) {
- i = EXTRACT_16BITS(cp);
+ i = EXTRACT_BE_16BITS(cp);
cp += 2;
}
if (i >= 0)
{
u_short ether_type;
- ND_PRINT((ndo, "%3s ",tok2str(sll_pkttype_values,"?",EXTRACT_16BITS(&sllp->sll_pkttype))));
+ ND_PRINT((ndo, "%3s ",tok2str(sll_pkttype_values,"?",EXTRACT_BE_16BITS(&sllp->sll_pkttype))));
/*
* XXX - check the link-layer address type value?
* For now, we just assume 6 means Ethernet.
* XXX - print others as strings of hex?
*/
- if (EXTRACT_16BITS(&sllp->sll_halen) == 6)
+ if (EXTRACT_BE_16BITS(&sllp->sll_halen) == 6)
ND_PRINT((ndo, "%s ", etheraddr_string(ndo, sllp->sll_addr)));
if (!ndo->ndo_qflag) {
- ether_type = EXTRACT_16BITS(&sllp->sll_protocol);
+ ether_type = EXTRACT_BE_16BITS(&sllp->sll_protocol);
if (ether_type <= ETHERMTU) {
/*
p += SLL_HDR_LEN;
hdrlen = SLL_HDR_LEN;
- ether_type = EXTRACT_16BITS(&sllp->sll_protocol);
+ ether_type = EXTRACT_BE_16BITS(&sllp->sll_protocol);
recurse:
/*
return (hdrlen + length);
}
if (ndo->ndo_eflag) {
- uint16_t tag = EXTRACT_16BITS(p);
+ uint16_t tag = EXTRACT_BE_16BITS(p);
ND_PRINT((ndo, "%s, ", ieee8021q_tci_string(tag)));
}
- ether_type = EXTRACT_16BITS(p + 2);
+ ether_type = EXTRACT_BE_16BITS(p + 2);
if (ether_type <= ETHERMTU)
ether_type = LINUX_SLL_P_802_2;
if (!ndo->ndo_qflag) {
ND_PRINT((ndo, "\n\t System %s, System Priority %u, Key %u" \
", Port %u, Port Priority %u\n\t State Flags [%s]",
etheraddr_string(ndo, tlv_ptr.lacp_tlv_actor_partner_info->sys),
- EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->sys_pri),
- EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->key),
- EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->port),
- EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->port_pri),
+ EXTRACT_BE_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->sys_pri),
+ EXTRACT_BE_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->key),
+ EXTRACT_BE_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->port),
+ EXTRACT_BE_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->port_pri),
bittok2str(lacp_tlv_actor_partner_info_state_values,
"none",
tlv_ptr.lacp_tlv_actor_partner_info->state)));
tlv_ptr.lacp_tlv_collector_info = (const struct lacp_tlv_collector_info_t *)tlv_tptr;
ND_PRINT((ndo, "\n\t Max Delay %u",
- EXTRACT_16BITS(tlv_ptr.lacp_tlv_collector_info->max_delay)));
+ EXTRACT_BE_16BITS(tlv_ptr.lacp_tlv_collector_info->max_delay)));
break;
ND_PRINT((ndo, "\n\t Request System %s, Request Port %u, Request Transaction ID 0x%08x",
etheraddr_string(ndo, tlv_ptr.marker_tlv_marker_info->req_sys),
- EXTRACT_16BITS(tlv_ptr.marker_tlv_marker_info->req_port),
- EXTRACT_32BITS(tlv_ptr.marker_tlv_marker_info->req_trans_id)));
+ EXTRACT_BE_16BITS(tlv_ptr.marker_tlv_marker_info->req_port),
+ EXTRACT_BE_32BITS(tlv_ptr.marker_tlv_marker_info->req_trans_id)));
break;
tok2str(slow_oam_code_values, "Unknown (%u)", ptr.slow_oam_common_header->code),
bittok2str(slow_oam_flag_values,
"none",
- EXTRACT_16BITS(&ptr.slow_oam_common_header->flags))));
+ EXTRACT_BE_16BITS(&ptr.slow_oam_common_header->flags))));
switch (ptr.slow_oam_common_header->code) {
case SLOW_OAM_CODE_INFO:
ND_PRINT((ndo, "\n\t OAM-Version %u, Revision %u",
tlv.slow_oam_info->oam_version,
- EXTRACT_16BITS(&tlv.slow_oam_info->revision)));
+ EXTRACT_BE_16BITS(&tlv.slow_oam_info->revision)));
ND_PRINT((ndo, "\n\t State-Parser-Action %s, State-MUX-Action %s",
tok2str(slow_oam_info_type_state_parser_values, "Reserved",
ND_PRINT((ndo, "\n\t OAM-Config Flags [%s], OAM-PDU-Config max-PDU size %u",
bittok2str(slow_oam_info_type_oam_config_values, "none",
tlv.slow_oam_info->oam_config),
- EXTRACT_16BITS(&tlv.slow_oam_info->oam_pdu_config) &
+ EXTRACT_BE_16BITS(&tlv.slow_oam_info->oam_pdu_config) &
OAM_INFO_TYPE_PDU_SIZE_MASK));
ND_PRINT((ndo, "\n\t OUI %s (0x%06x), Vendor-Private 0x%08x",
tok2str(oui_values, "Unknown",
- EXTRACT_24BITS(&tlv.slow_oam_info->oui)),
- EXTRACT_24BITS(&tlv.slow_oam_info->oui),
- EXTRACT_32BITS(&tlv.slow_oam_info->vendor_private)));
+ EXTRACT_BE_24BITS(&tlv.slow_oam_info->oui)),
+ EXTRACT_BE_24BITS(&tlv.slow_oam_info->oui),
+ EXTRACT_BE_32BITS(&tlv.slow_oam_info->vendor_private)));
break;
case SLOW_OAM_INFO_TYPE_ORG_SPECIFIC:
if (tlen < 2)
goto tooshort;
ND_TCHECK2(*tptr, 2);
- ND_PRINT((ndo, "\n\t Sequence Number %u", EXTRACT_16BITS(tptr)));
+ ND_PRINT((ndo, "\n\t Sequence Number %u", EXTRACT_BE_16BITS(tptr)));
tlen -= 2;
tptr += 2;
"\n\t Errors %" PRIu64
"\n\t Error Running Total %" PRIu64
"\n\t Event Running Total %u",
- EXTRACT_16BITS(&tlv.slow_oam_link_event->time_stamp)*100,
- EXTRACT_64BITS(&tlv.slow_oam_link_event->window),
- EXTRACT_64BITS(&tlv.slow_oam_link_event->threshold),
- EXTRACT_64BITS(&tlv.slow_oam_link_event->errors),
- EXTRACT_64BITS(&tlv.slow_oam_link_event->errors_running_total),
- EXTRACT_32BITS(&tlv.slow_oam_link_event->event_running_total)));
+ EXTRACT_BE_16BITS(&tlv.slow_oam_link_event->time_stamp)*100,
+ EXTRACT_BE_64BITS(&tlv.slow_oam_link_event->window),
+ EXTRACT_BE_64BITS(&tlv.slow_oam_link_event->threshold),
+ EXTRACT_BE_64BITS(&tlv.slow_oam_link_event->errors),
+ EXTRACT_BE_64BITS(&tlv.slow_oam_link_event->errors_running_total),
+ EXTRACT_BE_32BITS(&tlv.slow_oam_link_event->event_running_total)));
break;
case SLOW_OAM_LINK_EVENT_ORG_SPECIFIC:
goto trunc;
maxbuf = data + caplen;
type = data[0];
- nbt_len = EXTRACT_16BITS(data + 2);
+ nbt_len = EXTRACT_BE_16BITS(data + 2);
length -= 4;
caplen -= 4;
int total, i;
ND_TCHECK2(data[10], 2);
- name_trn_id = EXTRACT_16BITS(data);
+ name_trn_id = EXTRACT_BE_16BITS(data);
response = (data[2] >> 7);
opcode = (data[2] >> 3) & 0xF;
nm_flags = ((data[2] & 0x7) << 4) + (data[3] >> 4);
rcode = data[3] & 0xF;
- qdcount = EXTRACT_16BITS(data + 4);
- ancount = EXTRACT_16BITS(data + 6);
- nscount = EXTRACT_16BITS(data + 8);
- arcount = EXTRACT_16BITS(data + 10);
+ qdcount = EXTRACT_BE_16BITS(data + 4);
+ ancount = EXTRACT_BE_16BITS(data + 6);
+ nscount = EXTRACT_BE_16BITS(data + 8);
+ arcount = EXTRACT_BE_16BITS(data + 10);
startbuf = data;
if (maxbuf <= data)
if (p == NULL)
goto out;
ND_TCHECK_16BITS(p);
- restype = EXTRACT_16BITS(p);
+ restype = EXTRACT_BE_16BITS(p);
p = smb_fdata(ndo, p, "ResType=[rw]\nResClass=[rw]\nTTL=[rD]\n", p + 8, 0);
if (p == NULL)
goto out;
ND_TCHECK_16BITS(p);
- rdlen = EXTRACT_16BITS(p);
+ rdlen = EXTRACT_BE_16BITS(p);
ND_PRINT((ndo, "ResourceLength=%d\nResourceData=\n", rdlen));
p += 2;
if (rdlen == 6) {
if (caplen < 4)
goto trunc;
maxbuf = data + caplen;
- smb_len = EXTRACT_24BITS(data + 1);
+ smb_len = EXTRACT_BE_24BITS(data + 1);
length -= 4;
caplen -= 4;
ND_TCHECK(stp_bpdu->port_id);
ND_PRINT((ndo, ", bridge-id %s.%04x, length %u",
stp_print_bridge_id((const u_char *)&stp_bpdu->bridge_id),
- EXTRACT_16BITS(&stp_bpdu->port_id), length));
+ EXTRACT_BE_16BITS(&stp_bpdu->port_id), length));
/* in non-verbose mode just print the bridge-id */
if (!ndo->ndo_vflag) {
ND_TCHECK(stp_bpdu->forward_delay);
ND_PRINT((ndo, "\n\tmessage-age %.2fs, max-age %.2fs"
", hello-time %.2fs, forwarding-delay %.2fs",
- (float)EXTRACT_16BITS(&stp_bpdu->message_age) / STP_TIME_BASE,
- (float)EXTRACT_16BITS(&stp_bpdu->max_age) / STP_TIME_BASE,
- (float)EXTRACT_16BITS(&stp_bpdu->hello_time) / STP_TIME_BASE,
- (float)EXTRACT_16BITS(&stp_bpdu->forward_delay) / STP_TIME_BASE));
+ (float) EXTRACT_BE_16BITS(&stp_bpdu->message_age) / STP_TIME_BASE,
+ (float) EXTRACT_BE_16BITS(&stp_bpdu->max_age) / STP_TIME_BASE,
+ (float) EXTRACT_BE_16BITS(&stp_bpdu->hello_time) / STP_TIME_BASE,
+ (float) EXTRACT_BE_16BITS(&stp_bpdu->forward_delay) / STP_TIME_BASE));
ND_PRINT((ndo, "\n\troot-id %s, root-pathcost %u",
stp_print_bridge_id((const u_char *)&stp_bpdu->root_id),
- EXTRACT_32BITS(&stp_bpdu->root_path_cost)));
+ EXTRACT_BE_32BITS(&stp_bpdu->root_path_cost)));
/* Port role is only valid for 802.1w */
if (stp_bpdu->protocol_version == STP_PROTO_RAPID) {
ND_TCHECK(stp_bpdu->root_path_cost);
ND_PRINT((ndo, "CIST root-id %s, CIST ext-pathcost %u",
stp_print_bridge_id((const u_char *)&stp_bpdu->root_id),
- EXTRACT_32BITS(&stp_bpdu->root_path_cost)));
+ EXTRACT_BE_32BITS(&stp_bpdu->root_path_cost)));
ND_TCHECK(stp_bpdu->bridge_id);
ND_PRINT((ndo, "\n\tCIST regional-root-id %s, ",
stp_print_bridge_id((const u_char *)&stp_bpdu->bridge_id)));
ND_TCHECK(stp_bpdu->port_id);
- ND_PRINT((ndo, "CIST port-id %04x,", EXTRACT_16BITS(&stp_bpdu->port_id)));
+ ND_PRINT((ndo, "CIST port-id %04x,", EXTRACT_BE_16BITS(&stp_bpdu->port_id)));
ND_TCHECK(stp_bpdu->forward_delay);
ND_PRINT((ndo, "\n\tmessage-age %.2fs, max-age %.2fs"
", hello-time %.2fs, forwarding-delay %.2fs",
- (float)EXTRACT_16BITS(&stp_bpdu->message_age) / STP_TIME_BASE,
- (float)EXTRACT_16BITS(&stp_bpdu->max_age) / STP_TIME_BASE,
- (float)EXTRACT_16BITS(&stp_bpdu->hello_time) / STP_TIME_BASE,
- (float)EXTRACT_16BITS(&stp_bpdu->forward_delay) / STP_TIME_BASE));
+ (float) EXTRACT_BE_16BITS(&stp_bpdu->message_age) / STP_TIME_BASE,
+ (float) EXTRACT_BE_16BITS(&stp_bpdu->max_age) / STP_TIME_BASE,
+ (float) EXTRACT_BE_16BITS(&stp_bpdu->hello_time) / STP_TIME_BASE,
+ (float) EXTRACT_BE_16BITS(&stp_bpdu->forward_delay) / STP_TIME_BASE));
ND_TCHECK_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET);
- ND_PRINT((ndo, "\n\tv3len %d, ", EXTRACT_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET)));
+ ND_PRINT((ndo, "\n\tv3len %d, ", EXTRACT_BE_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET)));
ND_TCHECK_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12);
ND_PRINT((ndo, "MCID Name "));
if (fn_printzp(ndo, ptr + MST_BPDU_CONFIG_NAME_OFFSET, 32, ndo->ndo_snapend))
goto trunc;
ND_PRINT((ndo, ", rev %u,"
"\n\t\tdigest %08x%08x%08x%08x, ",
- EXTRACT_16BITS(ptr + MST_BPDU_CONFIG_NAME_OFFSET + 32),
- EXTRACT_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET),
- EXTRACT_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 4),
- EXTRACT_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 8),
- EXTRACT_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12)));
+ EXTRACT_BE_16BITS(ptr + MST_BPDU_CONFIG_NAME_OFFSET + 32),
+ EXTRACT_BE_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET),
+ EXTRACT_BE_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 4),
+ EXTRACT_BE_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 8),
+ EXTRACT_BE_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12)));
ND_TCHECK_32BITS(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET);
ND_PRINT((ndo, "CIST int-root-pathcost %u,",
- EXTRACT_32BITS(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET)));
+ EXTRACT_BE_32BITS(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET)));
ND_TCHECK_BRIDGE_ID(ptr + MST_BPDU_CIST_BRIDGE_ID_OFFSET);
ND_PRINT((ndo, "\n\tCIST bridge-id %s, ",
/* Dump all MSTI's */
ND_TCHECK_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET);
- v3len = EXTRACT_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET);
+ v3len = EXTRACT_BE_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET);
if (v3len > MST_BPDU_CONFIG_INFO_LENGTH) {
len = v3len - MST_BPDU_CONFIG_INFO_LENGTH;
offset = MST_BPDU_MSTI_OFFSET;
while (len >= MST_BPDU_MSTI_LENGTH) {
ND_TCHECK2(*(ptr + offset), MST_BPDU_MSTI_LENGTH);
- msti = EXTRACT_16BITS(ptr + offset +
- MST_BPDU_MSTI_ROOT_PRIO_OFFSET);
+ msti = EXTRACT_BE_16BITS(ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET);
msti = msti & 0x0FFF;
ND_PRINT((ndo, "\n\tMSTI %d, Flags [%s], port-role %s",
ND_PRINT((ndo, "\n\t\tMSTI regional-root-id %s, pathcost %u",
stp_print_bridge_id(ptr + offset +
MST_BPDU_MSTI_ROOT_PRIO_OFFSET),
- EXTRACT_32BITS(ptr + offset +
- MST_BPDU_MSTI_ROOT_PATH_COST_OFFSET)));
+ EXTRACT_BE_32BITS(ptr + offset + MST_BPDU_MSTI_ROOT_PATH_COST_OFFSET)));
ND_PRINT((ndo, "\n\t\tMSTI bridge-prio %d, port-prio %d, hops %d",
ptr[offset + MST_BPDU_MSTI_BRIDGE_PRIO_OFFSET] >> 4,
ptr[offset + MST_BPDU_MSTI_PORT_PRIO_OFFSET] >> 4,
ptr = (const u_char *)stp_bpdu;
ND_TCHECK_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 16);
- ND_PRINT((ndo, "\n\tv4len %d, ", EXTRACT_16BITS (ptr + offset)));
+ ND_PRINT((ndo, "\n\tv4len %d, ", EXTRACT_BE_16BITS(ptr + offset)));
ND_PRINT((ndo, "AUXMCID Name "));
if (fn_printzp(ndo, ptr + offset + SPB_BPDU_CONFIG_NAME_OFFSET, 32,
ndo->ndo_snapend))
goto trunc;
ND_PRINT((ndo, ", Rev %u,\n\t\tdigest %08x%08x%08x%08x",
- EXTRACT_16BITS(ptr + offset + SPB_BPDU_CONFIG_REV_OFFSET),
- EXTRACT_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET),
- EXTRACT_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 4),
- EXTRACT_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 8),
- EXTRACT_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 12)));
+ EXTRACT_BE_16BITS(ptr + offset + SPB_BPDU_CONFIG_REV_OFFSET),
+ EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET),
+ EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 4),
+ EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 8),
+ EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_CONFIG_DIGEST_OFFSET + 12)));
ND_PRINT((ndo, "\n\tAgreement num %d, Discarded Agreement num %d, Agreement valid-"
"flag %d,\n\tRestricted role-flag: %d, Format id %d cap %d, "
ptr[offset + SPB_BPDU_AGREEMENT_FORMAT_OFFSET]&0x00ff,
ptr[offset + SPB_BPDU_AGREEMENT_CON_OFFSET]>>4,
ptr[offset + SPB_BPDU_AGREEMENT_CON_OFFSET]&0x00ff,
- EXTRACT_16BITS(ptr + offset + SPB_BPDU_AGREEMENT_EDGE_OFFSET),
- EXTRACT_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET),
- EXTRACT_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET+4),
- EXTRACT_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET+8),
- EXTRACT_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET+12),
- EXTRACT_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET+16)));
+ EXTRACT_BE_16BITS(ptr + offset + SPB_BPDU_AGREEMENT_EDGE_OFFSET),
+ EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET),
+ EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 4),
+ EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 8),
+ EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 12),
+ EXTRACT_BE_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 16)));
return 1;
trunc:
goto trunc;
ND_TCHECK(stp_bpdu->protocol_id);
- if (EXTRACT_16BITS(&stp_bpdu->protocol_id)) {
+ if (EXTRACT_BE_16BITS(&stp_bpdu->protocol_id)) {
ND_PRINT((ndo, "unknown STP version, length %u", length));
return;
}
/* Validate v3 length */
ND_TCHECK_16BITS(p + MST_BPDU_VER3_LEN_OFFSET);
- mstp_len = EXTRACT_16BITS(p + MST_BPDU_VER3_LEN_OFFSET);
+ mstp_len = EXTRACT_BE_16BITS(p + MST_BPDU_VER3_LEN_OFFSET);
mstp_len += 2; /* length encoding itself is 2 bytes */
if (length < (sizeof(struct stp_bpdu_) + mstp_len)) {
goto trunc;
{
/* Validate v4 length */
ND_TCHECK_16BITS(p + MST_BPDU_VER3_LEN_OFFSET + mstp_len);
- spb_len = EXTRACT_16BITS (p + MST_BPDU_VER3_LEN_OFFSET + mstp_len);
+ spb_len = EXTRACT_BE_16BITS(p + MST_BPDU_VER3_LEN_OFFSET + mstp_len);
spb_len += 2;
if (length < (sizeof(struct stp_bpdu_) + mstp_len + spb_len) ||
spb_len < SPB_BPDU_MIN_LEN) {
break;
}
- vci = EXTRACT_16BITS(&p[VCI_POS]);
+ vci = EXTRACT_BE_16BITS(&p[VCI_POS]);
vpi = p[VPI_POS];
p += PKT_BEGIN_POS;
if (!ndo->ndo_nflag) {
snprintf(srcid, sizeof(srcid), "0x%x",
- EXTRACT_32BITS(&rp->rm_xid));
+ EXTRACT_BE_32BITS(&rp->rm_xid));
strlcpy(dstid, "sunrpc", sizeof(dstid));
} else {
snprintf(srcid, sizeof(srcid), "0x%x",
- EXTRACT_32BITS(&rp->rm_xid));
+ EXTRACT_BE_32BITS(&rp->rm_xid));
snprintf(dstid, sizeof(dstid), "0x%x", SUNRPC_PMAPPORT);
}
}
ND_PRINT((ndo, " %s", tok2str(proc2str, " proc #%u",
- EXTRACT_32BITS(&rp->rm_call.cb_proc))));
- x = EXTRACT_32BITS(&rp->rm_call.cb_rpcvers);
+ EXTRACT_BE_32BITS(&rp->rm_call.cb_proc))));
+ x = EXTRACT_BE_32BITS(&rp->rm_call.cb_rpcvers);
if (x != 2)
ND_PRINT((ndo, " [rpcver %u]", x));
- switch (EXTRACT_32BITS(&rp->rm_call.cb_proc)) {
+ switch (EXTRACT_BE_32BITS(&rp->rm_call.cb_proc)) {
case SUNRPC_PMAPPROC_SET:
case SUNRPC_PMAPPROC_UNSET:
case SUNRPC_PMAPPROC_GETPORT:
case SUNRPC_PMAPPROC_CALLIT:
- x = EXTRACT_32BITS(&rp->rm_call.cb_prog);
+ x = EXTRACT_BE_32BITS(&rp->rm_call.cb_prog);
if (!ndo->ndo_nflag)
ND_PRINT((ndo, " %s", progstr(x)));
else
ND_PRINT((ndo, " %u", x));
- ND_PRINT((ndo, ".%u", EXTRACT_32BITS(&rp->rm_call.cb_vers)));
+ ND_PRINT((ndo, ".%u", EXTRACT_BE_32BITS(&rp->rm_call.cb_vers)));
break;
}
}
sp = (const struct symantec_header *)bp;
- etype = EXTRACT_16BITS(&sp->ether_type);
+ etype = EXTRACT_BE_16BITS(&sp->ether_type);
if (!ndo->ndo_qflag) {
if (etype <= ETHERMTU)
ND_PRINT((ndo, "invalid ethertype %u", etype));
sp = (const struct symantec_header *)p;
p += sizeof (struct symantec_header);
- ether_type = EXTRACT_16BITS(&sp->ether_type);
+ ether_type = EXTRACT_BE_16BITS(&sp->ether_type);
if (ether_type <= ETHERMTU) {
/* ether_type not known, print raw packet */
return;
}
- sport = EXTRACT_16BITS(&tp->th_sport);
- dport = EXTRACT_16BITS(&tp->th_dport);
+ sport = EXTRACT_BE_16BITS(&tp->th_sport);
+ dport = EXTRACT_BE_16BITS(&tp->th_dport);
if (ip6) {
if (ip6->ip6_nxt == IPPROTO_TCP) {
return;
}
- seq = EXTRACT_32BITS(&tp->th_seq);
- ack = EXTRACT_32BITS(&tp->th_ack);
- win = EXTRACT_16BITS(&tp->th_win);
- urp = EXTRACT_16BITS(&tp->th_urp);
+ seq = EXTRACT_BE_32BITS(&tp->th_seq);
+ ack = EXTRACT_BE_32BITS(&tp->th_ack);
+ win = EXTRACT_BE_16BITS(&tp->th_win);
+ urp = EXTRACT_BE_16BITS(&tp->th_urp);
if (ndo->ndo_qflag) {
ND_PRINT((ndo, "tcp %d", length - hlen));
if (IP_V(ip) == 4) {
if (ND_TTEST2(tp->th_sport, length)) {
sum = tcp_cksum(ndo, ip, tp, length);
- tcp_sum = EXTRACT_16BITS(&tp->th_sum);
+ tcp_sum = EXTRACT_BE_16BITS(&tp->th_sum);
ND_PRINT((ndo, ", cksum 0x%04x", tcp_sum));
if (sum != 0)
} else if (IP_V(ip) == 6 && ip6->ip6_plen) {
if (ND_TTEST2(tp->th_sport, length)) {
sum = tcp6_cksum(ndo, ip6, tp, length);
- tcp_sum = EXTRACT_16BITS(&tp->th_sum);
+ tcp_sum = EXTRACT_BE_16BITS(&tp->th_sum);
ND_PRINT((ndo, ", cksum 0x%04x", tcp_sum));
if (sum != 0)
case TCPOPT_MAXSEG:
datalen = 2;
LENCHECK(datalen);
- ND_PRINT((ndo, " %u", EXTRACT_16BITS(cp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_16BITS(cp)));
break;
case TCPOPT_WSCALE:
ND_PRINT((ndo, " %d ", datalen / 8));
for (i = 0; i < datalen; i += 8) {
LENCHECK(i + 4);
- s = EXTRACT_32BITS(cp + i);
+ s = EXTRACT_BE_32BITS(cp + i);
LENCHECK(i + 8);
- e = EXTRACT_32BITS(cp + i + 4);
+ e = EXTRACT_BE_32BITS(cp + i + 4);
if (rev) {
s -= thseq;
e -= thseq;
*/
datalen = 4;
LENCHECK(datalen);
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(cp)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(cp)));
break;
case TCPOPT_TIMESTAMP:
datalen = 8;
LENCHECK(datalen);
ND_PRINT((ndo, " val %u ecr %u",
- EXTRACT_32BITS(cp),
- EXTRACT_32BITS(cp + 4)));
+ EXTRACT_BE_32BITS(cp),
+ EXTRACT_BE_32BITS(cp + 4)));
break;
case TCPOPT_SIGNATURE:
case TCPOPT_UTO:
datalen = 2;
LENCHECK(datalen);
- utoval = EXTRACT_16BITS(cp);
+ utoval = EXTRACT_BE_16BITS(cp);
ND_PRINT((ndo, " 0x%x", utoval));
if (utoval & 0x0001)
utoval = (utoval >> 1) * 60;
if (datalen < 2)
goto bad;
/* RFC6994 */
- magic = EXTRACT_16BITS(cp);
+ magic = EXTRACT_BE_16BITS(cp);
ND_PRINT((ndo, "-"));
switch(magic) {
register const struct sunrpc_msg *rp;
enum sunrpc_msg_type direction;
- fraglen = EXTRACT_32BITS(bp) & 0x7FFFFFFF;
+ fraglen = EXTRACT_BE_32BITS(bp) & 0x7FFFFFFF;
if (fraglen > (length) - 4)
fraglen = (length) - 4;
rp = (const struct sunrpc_msg *)(bp + 4);
if (ND_TTEST(rp->rm_direction)) {
- direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
+ direction = (enum sunrpc_msg_type) EXTRACT_BE_32BITS(&rp->rm_direction);
if (dport == NFS_PORT && direction == SUNRPC_CALL) {
- ND_PRINT((ndo, ": NFS request xid %u ", EXTRACT_32BITS(&rp->rm_xid)));
+ ND_PRINT((ndo, ": NFS request xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid)));
nfsreq_noaddr_print(ndo, (const u_char *)rp, fraglen, (const u_char *)ip);
return;
}
if (sport == NFS_PORT && direction == SUNRPC_REPLY) {
- ND_PRINT((ndo, ": NFS reply xid %u ", EXTRACT_32BITS(&rp->rm_xid)));
+ ND_PRINT((ndo, ": NFS reply xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid)));
nfsreply_noaddr_print(ndo, (const u_char *)rp, fraglen, (const u_char *)ip);
return;
}
MD5_Update(&ctx, (const char *)&ip->ip_dst, sizeof(ip->ip_dst));
MD5_Update(&ctx, (const char *)&zero_proto, sizeof(zero_proto));
MD5_Update(&ctx, (const char *)&ip->ip_p, sizeof(ip->ip_p));
- tlen = EXTRACT_16BITS(&ip->ip_len) - IP_HL(ip) * 4;
+ tlen = EXTRACT_BE_16BITS(&ip->ip_len) - IP_HL(ip) * 4;
tlen = htons(tlen);
MD5_Update(&ctx, (const char *)&tlen, sizeof(tlen));
} else if (IP_V(ip) == 6) {
ip6 = (const struct ip6_hdr *)ip;
MD5_Update(&ctx, (const char *)&ip6->ip6_src, sizeof(ip6->ip6_src));
MD5_Update(&ctx, (const char *)&ip6->ip6_dst, sizeof(ip6->ip6_dst));
- len32 = htonl(EXTRACT_16BITS(&ip6->ip6_plen));
+ len32 = htonl(EXTRACT_BE_16BITS(&ip6->ip6_plen));
MD5_Update(&ctx, (const char *)&len32, sizeof(len32));
nxt = 0;
MD5_Update(&ctx, (const char *)&nxt, sizeof(nxt));
if (length < 2)
goto trunc;
ND_TCHECK_16BITS(bp);
- opcode = EXTRACT_16BITS(bp);
+ opcode = EXTRACT_BE_16BITS(bp);
cp = tok2str(op2str, "tftp-#%d", opcode);
ND_PRINT((ndo, " %s", cp));
/* Bail if bogus opcode */
if (length < 2)
goto trunc; /* no block number */
ND_TCHECK_16BITS(bp);
- ND_PRINT((ndo, " block %d", EXTRACT_16BITS(bp)));
+ ND_PRINT((ndo, " block %d", EXTRACT_BE_16BITS(bp)));
break;
case TFTP_ERROR:
goto trunc; /* no error code */
ND_TCHECK_16BITS(bp);
ND_PRINT((ndo, " %s", tok2str(err2str, "tftp-err-#%d \"",
- EXTRACT_16BITS(bp))));
+ EXTRACT_BE_16BITS(bp))));
bp += 2;
length -= 2;
/* Print error message string */
case TSP_SETDATE:
case TSP_SETDATEREQ:
ND_TCHECK(tsp->tsp_time);
- sec = EXTRACT_32BITS(&tsp->tsp_time.tv_sec);
- usec = EXTRACT_32BITS(&tsp->tsp_time.tv_usec);
+ sec = EXTRACT_BE_32BITS(&tsp->tsp_time.tv_sec);
+ usec = EXTRACT_BE_32BITS(&tsp->tsp_time.tv_usec);
/* XXX The comparison below is always false? */
if (usec < 0)
/* invalid, skip the rest of the packet */
u_int dest_node;
ND_TCHECK(ap->dest_port);
- w0 = EXTRACT_32BITS(&ap->w0);
+ w0 = EXTRACT_BE_32BITS(&ap->w0);
user = TIPC_USER(w0);
hsize = TIPC_HSIZE(w0);
msize = TIPC_MSIZE(w0);
- w1 = EXTRACT_32BITS(&ap->w1);
+ w1 = EXTRACT_BE_32BITS(&ap->w1);
mtype = TIPC_MTYPE(w1);
- prev_node = EXTRACT_32BITS(&ap->prev_node);
- orig_port = EXTRACT_32BITS(&ap->orig_port);
- dest_port = EXTRACT_32BITS(&ap->dest_port);
+ prev_node = EXTRACT_BE_32BITS(&ap->prev_node);
+ orig_port = EXTRACT_BE_32BITS(&ap->orig_port);
+ dest_port = EXTRACT_BE_32BITS(&ap->dest_port);
if (hsize <= 6) {
ND_PRINT((ndo, "TIPC v%u.0 %u.%u.%u:%u > %u, headerlength %u bytes, MessageSize %u bytes, %s, messageType %s",
TIPC_VER(w0),
tok2str(tipcmtype_values, "Unknown", mtype)));
} else {
ND_TCHECK(ap->dest_node);
- orig_node = EXTRACT_32BITS(&ap->orig_node);
- dest_node = EXTRACT_32BITS(&ap->dest_node);
+ orig_node = EXTRACT_BE_32BITS(&ap->orig_node);
+ dest_node = EXTRACT_BE_32BITS(&ap->dest_node);
ND_PRINT((ndo, "TIPC v%u.0 %u.%u.%u:%u > %u.%u.%u:%u, headerlength %u bytes, MessageSize %u bytes, %s, messageType %s",
TIPC_VER(w0),
TIPC_ZONE(orig_node), TIPC_CLUSTER(orig_node), TIPC_NODE(orig_node),
if (ndo->ndo_vflag) {
broadcast_ack = TIPC_BROADCAST_ACK(w1);
- w2 = EXTRACT_32BITS(&ap->w2);
+ w2 = EXTRACT_BE_32BITS(&ap->w2);
link_ack = TIPC_LINK_ACK(w2);
link_seq = TIPC_LINK_SEQ(w2);
ND_PRINT((ndo, "\n\tPrevious Node %u.%u.%u, Broadcast Ack %u, Link Ack %u, Link Sequence %u",
u_int link_tol;
ND_TCHECK(ap->dest_node);
- w0 = EXTRACT_32BITS(&ap->w0);
+ w0 = EXTRACT_BE_32BITS(&ap->w0);
user = TIPC_USER(w0);
hsize = TIPC_HSIZE(w0);
msize = TIPC_MSIZE(w0);
- w1 = EXTRACT_32BITS(&ap->w1);
+ w1 = EXTRACT_BE_32BITS(&ap->w1);
mtype = TIPC_MTYPE(w1);
- orig_node = EXTRACT_32BITS(&ap->orig_node);
- dest_node = EXTRACT_32BITS(&ap->dest_node);
+ orig_node = EXTRACT_BE_32BITS(&ap->orig_node);
+ dest_node = EXTRACT_BE_32BITS(&ap->dest_node);
ND_PRINT((ndo, "TIPC v%u.0 %u.%u.%u > %u.%u.%u, headerlength %u bytes, MessageSize %u bytes, %s, messageType %s (0x%08x)",
TIPC_VER(w0),
TIPC_ZONE(orig_node), TIPC_CLUSTER(orig_node), TIPC_NODE(orig_node),
ND_TCHECK(*ap);
seq_gap = TIPC_SEQ_GAP(w1);
broadcast_ack = TIPC_BROADCAST_ACK(w1);
- w2 = EXTRACT_32BITS(&ap->w2);
+ w2 = EXTRACT_BE_32BITS(&ap->w2);
bc_gap_after = TIPC_BC_GAP_AFTER(w2);
bc_gap_to = TIPC_BC_GAP_TO(w2);
- prev_node = EXTRACT_32BITS(&ap->prev_node);
- w4 = EXTRACT_32BITS(&ap->w4);
+ prev_node = EXTRACT_BE_32BITS(&ap->prev_node);
+ w4 = EXTRACT_BE_32BITS(&ap->w4);
last_sent_frag = TIPC_LAST_SENT_FRAG(w4);
next_sent_frag = TIPC_NEXT_SENT_FRAG(w4);
- w5 = EXTRACT_32BITS(&ap->w5);
+ w5 = EXTRACT_BE_32BITS(&ap->w5);
sess_no = TIPC_SESS_NO(w5);
- trans_seq = EXTRACT_32BITS(&ap->trans_seq);
- w9 = EXTRACT_32BITS(&ap->w9);
+ trans_seq = EXTRACT_BE_32BITS(&ap->trans_seq);
+ w9 = EXTRACT_BE_32BITS(&ap->w9);
msg_cnt = TIPC_MSG_CNT(w9);
link_tol = TIPC_LINK_TOL(w9);
ND_PRINT((ndo, "\n\tPrevious Node %u.%u.%u, Session No. %u, Broadcast Ack %u, Sequence Gap %u, Broadcast Gap After %u, Broadcast Gap To %u, Last Sent Packet No. %u, Next sent Packet No. %u, Transport Sequence %u, msg_count %u, Link Tolerance %u",
u_int media_id;
ND_TCHECK(ap->prev_node);
- w0 = EXTRACT_32BITS(&ap->w0);
+ w0 = EXTRACT_BE_32BITS(&ap->w0);
user = TIPC_USER(w0);
hsize = TIPC_HSIZE(w0);
msize = TIPC_MSIZE(w0);
- w1 = EXTRACT_32BITS(&ap->w1);
+ w1 = EXTRACT_BE_32BITS(&ap->w1);
mtype = TIPC_MTYPE(w1);
- dest_domain = EXTRACT_32BITS(&ap->dest_domain);
- prev_node = EXTRACT_32BITS(&ap->prev_node);
+ dest_domain = EXTRACT_BE_32BITS(&ap->dest_domain);
+ prev_node = EXTRACT_BE_32BITS(&ap->prev_node);
ND_PRINT((ndo, "TIPC v%u.0 %u.%u.%u > %u.%u.%u, headerlength %u bytes, MessageSize %u bytes, %s, messageType %s",
TIPC_VER(w0),
if (ndo->ndo_vflag) {
ND_TCHECK(ap->w5);
node_sig = TIPC_NODE_SIG(w1);
- ntwrk_id = EXTRACT_32BITS(&ap->ntwrk_id);
- w5 = EXTRACT_32BITS(&ap->w5);
+ ntwrk_id = EXTRACT_BE_32BITS(&ap->ntwrk_id);
+ w5 = EXTRACT_BE_32BITS(&ap->w5);
media_id = TIPC_MEDIA_ID(w5);
ND_PRINT((ndo, "\n\tNodeSignature %u, network_id %u, media_id %u",
node_sig, ntwrk_id, media_id));
ap = (const struct tipc_pkthdr *)bp;
ND_TCHECK(ap->w0);
- w0 = EXTRACT_32BITS(&ap->w0);
+ w0 = EXTRACT_BE_32BITS(&ap->w0);
user = TIPC_USER(w0);
switch (user)
#define FRAME_TYPE(trp) (((trp)->token_fc & 0xC0) >> 6)
#define TOKEN_FC_LLC 1
-#define BROADCAST(trp) ((EXTRACT_16BITS(&(trp)->token_rcf) & 0xE000) >> 13)
-#define RIF_LENGTH(trp) ((EXTRACT_16BITS(&(trp)->token_rcf) & 0x1f00) >> 8)
-#define DIRECTION(trp) ((EXTRACT_16BITS(&(trp)->token_rcf) & 0x0080) >> 7)
-#define LARGEST_FRAME(trp) ((EXTRACT_16BITS(&(trp)->token_rcf) & 0x0070) >> 4)
-#define RING_NUMBER(trp, x) ((EXTRACT_16BITS(&(trp)->token_rseg[x]) & 0xfff0) >> 4)
-#define BRIDGE_NUMBER(trp, x) ((EXTRACT_16BITS(&(trp)->token_rseg[x]) & 0x000f))
+#define BROADCAST(trp) ((EXTRACT_BE_16BITS(&(trp)->token_rcf) & 0xE000) >> 13)
+#define RIF_LENGTH(trp) ((EXTRACT_BE_16BITS(&(trp)->token_rcf) & 0x1f00) >> 8)
+#define DIRECTION(trp) ((EXTRACT_BE_16BITS(&(trp)->token_rcf) & 0x0080) >> 7)
+#define LARGEST_FRAME(trp) ((EXTRACT_BE_16BITS(&(trp)->token_rcf) & 0x0070) >> 4)
+#define RING_NUMBER(trp, x) ((EXTRACT_BE_16BITS(&(trp)->token_rseg[x]) & 0xfff0) >> 4)
+#define BRIDGE_NUMBER(trp, x) ((EXTRACT_BE_16BITS(&(trp)->token_rseg[x]) & 0x000f))
#define SEGMENT_COUNT(trp) ((int)((RIF_LENGTH(trp) - 2) / 2))
struct token_header {
ND_PRINT((ndo, " [%d:%d]", RING_NUMBER(trp, seg),
BRIDGE_NUMBER(trp, seg)));
} else {
- ND_PRINT((ndo, "rt = %x", EXTRACT_16BITS(&trp->token_rcf)));
+ ND_PRINT((ndo, "rt = %x", EXTRACT_BE_16BITS(&trp->token_rcf)));
for (seg = 0; seg < SEGMENT_COUNT(trp); seg++)
- ND_PRINT((ndo, ":%x", EXTRACT_16BITS(&trp->token_rseg[seg])));
+ ND_PRINT((ndo, ":%x", EXTRACT_BE_16BITS(&trp->token_rseg[seg])));
}
ND_PRINT((ndo, " (%s) ", largest_frame[LARGEST_FRAME(trp)]));
} else {
return;
}
- ND_PRINT((ndo, "\n\tChecksum 0x%04x (unverified)", EXTRACT_16BITS(tptr+2)));
+ ND_PRINT((ndo, "\n\tChecksum 0x%04x (unverified)", EXTRACT_BE_16BITS(tptr + 2)));
tptr += UDLD_HEADER_LEN;
while (tptr < (pptr+length)) {
ND_TCHECK2(*tptr, 4);
- type = EXTRACT_16BITS(tptr);
- len = EXTRACT_16BITS(tptr+2);
+ type = EXTRACT_BE_16BITS(tptr);
+ len = EXTRACT_BE_16BITS(tptr + 2);
ND_PRINT((ndo, "\n\t%s (0x%04x) TLV, length %u",
tok2str(udld_tlv_values, "Unknown", type),
case UDLD_SEQ_NUMBER_TLV:
if (len != 4)
goto invalid;
- ND_PRINT((ndo, ", %u", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, ", %u", EXTRACT_BE_32BITS(tptr)));
break;
default:
u_int ts;
ND_TCHECK_16BITS((const u_int *)hdr);
- ts = EXTRACT_16BITS(hdr);
+ ts = EXTRACT_BE_16BITS(hdr);
if ((ts & 0xf060) != 0) {
/* probably vt */
ND_TCHECK_16BITS(&up->uh_ulen);
ND_PRINT((ndo, "udp/vt %u %d / %d",
- (uint32_t)(EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up)),
+ (uint32_t)(EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up)),
ts & 0x3ff, ts >> 10));
} else {
/* probably vat */
uint32_t i0, i1;
ND_TCHECK_32BITS(&((const u_int *)hdr)[0]);
- i0 = EXTRACT_32BITS(&((const u_int *)hdr)[0]);
+ i0 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[0]);
ND_TCHECK_32BITS(&((const u_int *)hdr)[1]);
- i1 = EXTRACT_32BITS(&((const u_int *)hdr)[1]);
+ i1 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[1]);
ND_TCHECK_16BITS(&up->uh_ulen);
ND_PRINT((ndo, "udp/vat %u c%d %u%s",
- (uint32_t)(EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up) - 8),
+ (uint32_t)(EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up) - 8),
i0 & 0xffff,
i1, i0 & 0x800000? "*" : ""));
/* audio format */
const char * ptype;
ND_TCHECK_32BITS(&((const u_int *)hdr)[0]);
- i0 = EXTRACT_32BITS(&((const u_int *)hdr)[0]);
+ i0 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[0]);
ND_TCHECK_32BITS(&((const u_int *)hdr)[1]);
- i1 = EXTRACT_32BITS(&((const u_int *)hdr)[1]);
+ i1 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[1]);
ND_TCHECK_16BITS(&up->uh_ulen);
- dlen = EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up) - 8;
+ dlen = EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up) - 8;
ip += 2;
len >>= 2;
len -= 2;
i1));
if (ndo->ndo_vflag) {
ND_TCHECK_32BITS(&((const u_int *)hdr)[2]);
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(&((const u_int *)hdr)[2])));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&((const u_int *)hdr)[2])));
if (hasopt) {
u_int i2, optlen;
do {
ND_TCHECK_32BITS(ip);
- i2 = EXTRACT_32BITS(ip);
+ i2 = EXTRACT_BE_32BITS(ip);
optlen = (i2 >> 16) & 0xff;
if (optlen == 0 || optlen > len) {
ND_PRINT((ndo, " !opt"));
if (hasext) {
u_int i2, extlen;
ND_TCHECK_32BITS(ip);
- i2 = EXTRACT_32BITS(ip);
+ i2 = EXTRACT_BE_32BITS(ip);
extlen = (i2 & 0xffff) + 1;
if (extlen > len) {
ND_PRINT((ndo, " !ext"));
}
ND_TCHECK_32BITS(ip);
if (contype == 0x1f) /*XXX H.261 */
- ND_PRINT((ndo, " 0x%04x", EXTRACT_32BITS(ip) >> 16));
+ ND_PRINT((ndo, " 0x%04x", EXTRACT_BE_32BITS(ip) >> 16));
}
trunc:
if ((const u_char *)(rh + 1) > ep)
goto trunc;
ND_TCHECK(*rh);
- len = (EXTRACT_16BITS(&rh->rh_len) + 1) * 4;
- flags = EXTRACT_16BITS(&rh->rh_flags);
+ len = (EXTRACT_BE_16BITS(&rh->rh_len) + 1) * 4;
+ flags = EXTRACT_BE_16BITS(&rh->rh_flags);
cnt = (flags >> 8) & 0x1f;
switch (flags & 0xff) {
case RTCP_PT_SR:
if (len != cnt * sizeof(*rr) + sizeof(*sr) + sizeof(*rh))
ND_PRINT((ndo, " [%d]", len));
if (ndo->ndo_vflag)
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc)));
if ((const u_char *)(sr + 1) > ep)
goto trunc;
ND_TCHECK(*sr);
- ts = (double)(EXTRACT_32BITS(&sr->sr_ntp.upper)) +
- ((double)(EXTRACT_32BITS(&sr->sr_ntp.lower)) /
- 4294967296.0);
- ND_PRINT((ndo, " @%.2f %u %up %ub", ts, EXTRACT_32BITS(&sr->sr_ts),
- EXTRACT_32BITS(&sr->sr_np), EXTRACT_32BITS(&sr->sr_nb)));
+ ts = (double)(EXTRACT_BE_32BITS(&sr->sr_ntp.upper)) +
+ ((double)(EXTRACT_BE_32BITS(&sr->sr_ntp.lower)) /
+ 4294967296.0);
+ ND_PRINT((ndo, " @%.2f %u %up %ub", ts, EXTRACT_BE_32BITS(&sr->sr_ts),
+ EXTRACT_BE_32BITS(&sr->sr_np), EXTRACT_BE_32BITS(&sr->sr_nb)));
rr = (const struct rtcp_rr *)(sr + 1);
break;
case RTCP_PT_RR:
ND_PRINT((ndo, " [%d]", len));
rr = (const struct rtcp_rr *)(rh + 1);
if (ndo->ndo_vflag)
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc)));
break;
case RTCP_PT_SDES:
ND_PRINT((ndo, " sdes %d", len));
if (ndo->ndo_vflag)
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc)));
cnt = 0;
break;
case RTCP_PT_BYE:
ND_PRINT((ndo, " bye %d", len));
if (ndo->ndo_vflag)
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc)));
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rh->rh_ssrc)));
cnt = 0;
break;
default:
goto trunc;
ND_TCHECK(*rr);
if (ndo->ndo_vflag)
- ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rr->rr_srcid)));
- ts = (double)(EXTRACT_32BITS(&rr->rr_lsr)) / 65536.;
- dts = (double)(EXTRACT_32BITS(&rr->rr_dlsr)) / 65536.;
+ ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&rr->rr_srcid)));
+ ts = (double)(EXTRACT_BE_32BITS(&rr->rr_lsr)) / 65536.;
+ dts = (double)(EXTRACT_BE_32BITS(&rr->rr_dlsr)) / 65536.;
ND_PRINT((ndo, " %ul %us %uj @%.2f+%.2f",
- EXTRACT_32BITS(&rr->rr_nl) & 0x00ffffff,
- EXTRACT_32BITS(&rr->rr_ls),
- EXTRACT_32BITS(&rr->rr_dv), ts, dts));
+ EXTRACT_BE_32BITS(&rr->rr_nl) & 0x00ffffff,
+ EXTRACT_BE_32BITS(&rr->rr_ls),
+ EXTRACT_BE_32BITS(&rr->rr_dv), ts, dts));
}
return (hdr + len);
goto trunc;
}
- sport = EXTRACT_16BITS(&up->uh_sport);
- dport = EXTRACT_16BITS(&up->uh_dport);
+ sport = EXTRACT_BE_16BITS(&up->uh_sport);
+ dport = EXTRACT_BE_16BITS(&up->uh_dport);
if (length < sizeof(struct udphdr)) {
udpipaddr_print(ndo, ip, sport, dport);
udpipaddr_print(ndo, ip, sport, dport);
goto trunc;
}
- ulen = EXTRACT_16BITS(&up->uh_ulen);
+ ulen = EXTRACT_BE_16BITS(&up->uh_ulen);
if (ulen < sizeof(struct udphdr)) {
udpipaddr_print(ndo, ip, sport, dport);
ND_PRINT((ndo, "truncated-udplength %d", ulen));
case PT_RPC:
rp = (const struct sunrpc_msg *)(up + 1);
- direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
+ direction = (enum sunrpc_msg_type) EXTRACT_BE_32BITS(&rp->rm_direction);
if (direction == SUNRPC_CALL)
sunrpc_print(ndo, (const u_char *)rp, length,
(const u_char *)ip);
rp = (const struct sunrpc_msg *)(up + 1);
if (ND_TTEST(rp->rm_direction)) {
- direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
+ direction = (enum sunrpc_msg_type) EXTRACT_BE_32BITS(&rp->rm_direction);
if (dport == NFS_PORT && direction == SUNRPC_CALL) {
- ND_PRINT((ndo, "NFS request xid %u ", EXTRACT_32BITS(&rp->rm_xid)));
+ ND_PRINT((ndo, "NFS request xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid)));
nfsreq_noaddr_print(ndo, (const u_char *)rp, length,
(const u_char *)ip);
return;
}
if (sport == NFS_PORT && direction == SUNRPC_REPLY) {
- ND_PRINT((ndo, "NFS reply xid %u ", EXTRACT_32BITS(&rp->rm_xid)));
+ ND_PRINT((ndo, "NFS reply xid %u ", EXTRACT_BE_32BITS(&rp->rm_xid)));
nfsreply_noaddr_print(ndo, (const u_char *)rp, length,
(const u_char *)ip);
return;
* TCP does, and we do so for UDP-over-IPv6.
*/
if (IP_V(ip) == 4 && (ndo->ndo_vflag > 1)) {
- udp_sum = EXTRACT_16BITS(&up->uh_sum);
+ udp_sum = EXTRACT_BE_16BITS(&up->uh_sum);
if (udp_sum == 0) {
ND_PRINT((ndo, "[no cksum] "));
} else if (ND_TTEST2(cp[0], length)) {
/* for IPv6, UDP checksum is mandatory */
if (ND_TTEST2(cp[0], length)) {
sum = udp6_cksum(ndo, ip6, up, length + sizeof(struct udphdr));
- udp_sum = EXTRACT_16BITS(&up->uh_sum);
+ udp_sum = EXTRACT_BE_16BITS(&up->uh_sum);
if (sum != 0) {
ND_PRINT((ndo, "[bad udp cksum 0x%04x -> 0x%04x!] ",
tok2str(vqp_msg_type_values, "unknown (%u)",vqp_common_header->msg_type),
tok2str(vqp_error_code_values, "unknown (%u)",vqp_common_header->error_code),
vqp_common_header->error_code,
- EXTRACT_32BITS(&vqp_common_header->sequence),
+ EXTRACT_BE_32BITS(&vqp_common_header->sequence),
nitems,
len));
ND_TCHECK(*vqp_obj_tlv);
if (sizeof(struct vqp_obj_tlv_t) > tlen)
goto trunc;
- vqp_obj_type = EXTRACT_32BITS(vqp_obj_tlv->obj_type);
- vqp_obj_len = EXTRACT_16BITS(vqp_obj_tlv->obj_length);
+ vqp_obj_type = EXTRACT_BE_32BITS(vqp_obj_tlv->obj_type);
+ vqp_obj_len = EXTRACT_BE_16BITS(vqp_obj_tlv->obj_length);
tptr+=sizeof(struct vqp_obj_tlv_t);
tlen-=sizeof(struct vqp_obj_tlv_t);
case VQP_OBJ_IP_ADDRESS:
if (vqp_obj_len != 4)
goto trunc;
- ND_PRINT((ndo, "%s (0x%08x)", ipaddr_string(ndo, tptr), EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "%s (0x%08x)", ipaddr_string(ndo, tptr), EXTRACT_BE_32BITS(tptr)));
break;
/* those objects have similar semantics - fall through */
case VQP_OBJ_PORT_NAME:
vec[0].len = len;
if (in_cksum(vec, 1))
ND_PRINT((ndo, ", (bad vrrp cksum %x)",
- EXTRACT_16BITS(&bp[6])));
+ EXTRACT_BE_16BITS(&bp[6])));
}
if (version == 3 && ND_TTEST2(bp[0], len)) {
len, len, IPPROTO_VRRP);
if (cksum)
ND_PRINT((ndo, ", (bad vrrp cksum %x)",
- EXTRACT_16BITS(&bp[6])));
+ EXTRACT_BE_16BITS(&bp[6])));
}
ND_PRINT((ndo, ", addrs"));
ND_TCHECK2(*tptr, 8);
ND_PRINT((ndo, "\n\t Config Rev %x, Updater %s",
- EXTRACT_32BITS(tptr),
+ EXTRACT_BE_32BITS(tptr),
ipaddr_string(ndo, tptr+4)));
tptr += 8;
ND_TCHECK2(*tptr, VTP_UPDATE_TIMESTAMP_LEN);
ND_PRINT((ndo, ", Timestamp 0x%08x 0x%08x 0x%08x",
- EXTRACT_32BITS(tptr),
- EXTRACT_32BITS(tptr + 4),
- EXTRACT_32BITS(tptr + 8)));
+ EXTRACT_BE_32BITS(tptr),
+ EXTRACT_BE_32BITS(tptr + 4),
+ EXTRACT_BE_32BITS(tptr + 8)));
tptr += VTP_UPDATE_TIMESTAMP_LEN;
ND_TCHECK2(*tptr, VTP_MD5_DIGEST_LEN);
ND_PRINT((ndo, ", MD5 digest: %08x%08x%08x%08x",
- EXTRACT_32BITS(tptr),
- EXTRACT_32BITS(tptr + 4),
- EXTRACT_32BITS(tptr + 8),
- EXTRACT_32BITS(tptr + 12)));
+ EXTRACT_BE_32BITS(tptr),
+ EXTRACT_BE_32BITS(tptr + 4),
+ EXTRACT_BE_32BITS(tptr + 8),
+ EXTRACT_BE_32BITS(tptr + 12)));
tptr += VTP_MD5_DIGEST_LEN;
break;
*/
ND_TCHECK_32BITS(tptr);
- ND_PRINT((ndo, ", Config Rev %x", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, ", Config Rev %x", EXTRACT_BE_32BITS(tptr)));
/*
* VLAN INFORMATION
ND_PRINT((ndo, "\n\tVLAN info status %s, type %s, VLAN-id %u, MTU %u, SAID 0x%08x, Name ",
tok2str(vtp_vlan_status,"Unknown",vtp_vlan->status),
tok2str(vtp_vlan_type_values,"Unknown",vtp_vlan->type),
- EXTRACT_16BITS(&vtp_vlan->vlanid),
- EXTRACT_16BITS(&vtp_vlan->mtu),
- EXTRACT_32BITS(&vtp_vlan->index)));
+ EXTRACT_BE_16BITS(&vtp_vlan->vlanid),
+ EXTRACT_BE_16BITS(&vtp_vlan->mtu),
+ EXTRACT_BE_32BITS(&vtp_vlan->index)));
len -= VTP_VLAN_INFO_FIXED_PART_LEN;
tptr += VTP_VLAN_INFO_FIXED_PART_LEN;
if (len < 4*((vtp_vlan->name_len + 3)/4))
ND_PRINT((ndo, " (invalid TLV length %u != 1)", tlv_len));
return;
} else {
- tlv_value = EXTRACT_16BITS(tptr+2);
+ tlv_value = EXTRACT_BE_16BITS(tptr + 2);
switch (type) {
case VTP_VLAN_STE_HOP_COUNT:
*/
ND_TCHECK2(*tptr, 4);
- ND_PRINT((ndo, "\n\tStart value: %u", EXTRACT_32BITS(tptr)));
+ ND_PRINT((ndo, "\n\tStart value: %u", EXTRACT_BE_32BITS(tptr)));
break;
case VTP_JOIN_MESSAGE:
next_protocol = *bp;
bp += 1;
- vni = EXTRACT_24BITS(bp);
+ vni = EXTRACT_BE_24BITS(bp);
bp += 4;
ND_PRINT((ndo, "VXLAN-GPE, "));
flags = *bp;
bp += 4;
- vni = EXTRACT_24BITS(bp);
+ vni = EXTRACT_BE_24BITS(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_16BITS(&(d)->dh_len) + sizeof(*(d)))))
+ DOP_ROUNDUP(EXTRACT_BE_16BITS(&(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_32BITS(&id->pi_ps.slot),
+ EXTRACT_BE_32BITS(&id->pi_ps.slot),
ipaddr_string(ndo, &id->pi_ps.page.p_sid),
- EXTRACT_32BITS(&id->pi_ps.page.p_uid),
- EXTRACT_32BITS(&id->pi_mslot),
+ EXTRACT_BE_32BITS(&id->pi_ps.page.p_uid),
+ EXTRACT_BE_32BITS(&id->pi_mslot),
ipaddr_string(ndo, &id->pi_mpage.p_sid),
- EXTRACT_32BITS(&id->pi_mpage.p_uid)));
+ EXTRACT_BE_32BITS(&id->pi_mpage.p_uid)));
- nid = EXTRACT_16BITS(&id->pi_ps.nid);
+ nid = EXTRACT_BE_16BITS(&id->pi_ps.nid);
len -= sizeof(*io) * nid;
io = (const struct id_off *)(id + 1);
cp = (const char *)(io + nid);
c = '<';
for (i = 0; i < nid && ND_TTEST(*io); ++io, ++i) {
ND_PRINT((ndo, "%c%s:%u",
- c, ipaddr_string(ndo, &io->id), EXTRACT_32BITS(&io->off)));
+ c, ipaddr_string(ndo, &io->id), EXTRACT_BE_32BITS(&io->off)));
c = ',';
}
if (i >= nid) {
ND_PRINT((ndo, " please repair %s %s:%u<%u:%u>",
ipaddr_string(ndo, &rreq->pr_id),
ipaddr_string(ndo, &rreq->pr_page.p_sid),
- EXTRACT_32BITS(&rreq->pr_page.p_uid),
- EXTRACT_32BITS(&rreq->pr_sseq),
- EXTRACT_32BITS(&rreq->pr_eseq)));
+ EXTRACT_BE_32BITS(&rreq->pr_page.p_uid),
+ EXTRACT_BE_32BITS(&rreq->pr_sseq),
+ EXTRACT_BE_32BITS(&rreq->pr_eseq)));
return (0);
}
return (-1);
ND_PRINT((ndo, " need %u/%s:%u",
- EXTRACT_32BITS(&preq->pp_low),
+ EXTRACT_BE_32BITS(&preq->pp_low),
ipaddr_string(ndo, &preq->pp_page.p_sid),
- EXTRACT_32BITS(&preq->pp_page.p_uid)));
+ EXTRACT_BE_32BITS(&preq->pp_page.p_uid)));
return (0);
}
ND_PRINT((ndo, " wb-prep:"));
if (len < sizeof(*prep) || !ND_TTEST(*prep))
return (-1);
- n = EXTRACT_32BITS(&prep->pp_n);
+ n = EXTRACT_BE_32BITS(&prep->pp_n);
ps = (const struct pgstate *)(prep + 1);
while (--n >= 0 && ND_TTEST(*ps)) {
const struct id_off *io, *ie;
char c = '<';
ND_PRINT((ndo, " %u/%s:%u",
- EXTRACT_32BITS(&ps->slot),
+ EXTRACT_BE_32BITS(&ps->slot),
ipaddr_string(ndo, &ps->page.p_sid),
- EXTRACT_32BITS(&ps->page.p_uid)));
+ EXTRACT_BE_32BITS(&ps->page.p_uid)));
io = (const struct id_off *)(ps + 1);
for (ie = io + ps->nid; io < ie && ND_TTEST(*io); ++io) {
ND_PRINT((ndo, "%c%s:%u", c, ipaddr_string(ndo, &io->id),
- EXTRACT_32BITS(&io->off)));
+ EXTRACT_BE_32BITS(&io->off)));
c = ',';
}
ND_PRINT((ndo, ">"));
else {
ND_PRINT((ndo, " %s", dopstr[t]));
if (t == DT_SKIP || t == DT_HOLE) {
- uint32_t ts = EXTRACT_32BITS(&dh->dh_ts);
+ uint32_t ts = EXTRACT_BE_32BITS(&dh->dh_ts);
ND_PRINT((ndo, "%d", ts - ss + 1));
if (ss > ts || ts > es) {
ND_PRINT((ndo, "[|]"));
ND_PRINT((ndo, " for %s %s:%u<%u:%u>",
ipaddr_string(ndo, &rrep->pr_id),
ipaddr_string(ndo, &dop->pd_page.p_sid),
- EXTRACT_32BITS(&dop->pd_page.p_uid),
- EXTRACT_32BITS(&dop->pd_sseq),
- EXTRACT_32BITS(&dop->pd_eseq)));
+ EXTRACT_BE_32BITS(&dop->pd_page.p_uid),
+ EXTRACT_BE_32BITS(&dop->pd_sseq),
+ EXTRACT_BE_32BITS(&dop->pd_eseq)));
if (ndo->ndo_vflag)
return (wb_dops(ndo, dop,
- EXTRACT_32BITS(&dop->pd_sseq),
- EXTRACT_32BITS(&dop->pd_eseq)));
+ EXTRACT_BE_32BITS(&dop->pd_sseq),
+ EXTRACT_BE_32BITS(&dop->pd_eseq)));
return (0);
}
ND_PRINT((ndo, " %s:%u<%u:%u>",
ipaddr_string(ndo, &dop->pd_page.p_sid),
- EXTRACT_32BITS(&dop->pd_page.p_uid),
- EXTRACT_32BITS(&dop->pd_sseq),
- EXTRACT_32BITS(&dop->pd_eseq)));
+ EXTRACT_BE_32BITS(&dop->pd_page.p_uid),
+ EXTRACT_BE_32BITS(&dop->pd_sseq),
+ EXTRACT_BE_32BITS(&dop->pd_eseq)));
if (ndo->ndo_vflag)
return (wb_dops(ndo, dop,
- EXTRACT_32BITS(&dop->pd_sseq),
- EXTRACT_32BITS(&dop->pd_eseq)));
+ EXTRACT_BE_32BITS(&dop->pd_sseq),
+ EXTRACT_BE_32BITS(&dop->pd_eseq)));
return (0);
}
header_len = 1 + 8; /* 0xFF, length */
ND_PRINT((ndo, " frame flags+body (64-bit) length"));
ND_TCHECK2(*cp, header_len); /* 0xFF, length */
- body_len_declared = EXTRACT_64BITS(cp + 1);
+ body_len_declared = EXTRACT_BE_64BITS(cp + 1);
ND_PRINT((ndo, " %" PRIu64, body_len_declared));
}
if (body_len_declared == 0)
uint64_t remaining_len;
ND_TCHECK2(*cp, 2);
- frame_offset = EXTRACT_16BITS(cp);
+ frame_offset = EXTRACT_BE_16BITS(cp);
ND_PRINT((ndo, "\n\t frame offset 0x%04x", frame_offset));
cp += 2;
remaining_len = ndo->ndo_snapend - cp; /* without the frame length */
ND_TCHECK2(*p, 2);
if ((p + 1) >= maxbuf)
return(NULL); /* name goes past the end of the buffer */
- l = EXTRACT_16BITS(p) & 0x3FFF;
+ l = EXTRACT_BE_16BITS(p) & 0x3FFF;
if (l == 0) {
/* We have a pointer that points to itself. */
return(NULL);
{
unsigned int x;
ND_TCHECK2(buf[0], 2);
- x = reverse ? EXTRACT_16BITS(buf) :
+ x = reverse ? EXTRACT_BE_16BITS(buf) :
EXTRACT_LE_16BITS(buf);
ND_PRINT((ndo, "%d (0x%x)", x, x));
buf += 2;
{
unsigned int x;
ND_TCHECK2(buf[0], 4);
- x = reverse ? EXTRACT_32BITS(buf) :
+ x = reverse ? EXTRACT_BE_32BITS(buf) :
EXTRACT_LE_32BITS(buf);
ND_PRINT((ndo, "%d (0x%x)", x, x));
buf += 4;
{
uint64_t x;
ND_TCHECK2(buf[0], 8);
- x = reverse ? EXTRACT_64BITS(buf) :
+ x = reverse ? EXTRACT_BE_64BITS(buf) :
EXTRACT_LE_64BITS(buf);
ND_PRINT((ndo, "%" PRIu64 " (0x%" PRIx64 ")", x, x));
buf += 8;
uint32_t x1, x2;
uint64_t x;
ND_TCHECK2(buf[0], 8);
- x1 = reverse ? EXTRACT_32BITS(buf) :
+ x1 = reverse ? EXTRACT_BE_32BITS(buf) :
EXTRACT_LE_32BITS(buf);
- x2 = reverse ? EXTRACT_32BITS(buf + 4) :
+ x2 = reverse ? EXTRACT_BE_32BITS(buf + 4) :
EXTRACT_LE_32BITS(buf + 4);
x = (((uint64_t)x1) << 32) | x2;
ND_PRINT((ndo, "%" PRIu64 " (0x%" PRIx64 ")", x, x));
{
unsigned int x;
ND_TCHECK2(buf[0], 2);
- x = reverse ? EXTRACT_16BITS(buf) :
+ x = reverse ? EXTRACT_BE_16BITS(buf) :
EXTRACT_LE_16BITS(buf);
ND_PRINT((ndo, "0x%X", x));
buf += 2;
{
unsigned int x;
ND_TCHECK2(buf[0], 4);
- x = reverse ? EXTRACT_32BITS(buf) :
+ x = reverse ? EXTRACT_BE_32BITS(buf) :
EXTRACT_LE_32BITS(buf);
ND_PRINT((ndo, "0x%X", x));
buf += 4;
case 'd':
ND_TCHECK2(buf[0], 2);
- stringlen = reverse ? EXTRACT_16BITS(buf) :
+ stringlen = reverse ? EXTRACT_BE_16BITS(buf) :
EXTRACT_LE_16BITS(buf);
ND_PRINT((ndo, "%u", stringlen));
buf += 2;
case 'D':
ND_TCHECK2(buf[0], 4);
- stringlen = reverse ? EXTRACT_32BITS(buf) :
+ stringlen = reverse ? EXTRACT_BE_32BITS(buf) :
EXTRACT_LE_32BITS(buf);
ND_PRINT((ndo, "%u", stringlen));
buf += 4;