return (p);
}
#endif /* INET6 */
+
+/* Represent TCI part of the 802.1Q 4-octet tag as text. */
+const char *
+ieee8021q_tci_string(const uint16_t tci)
+{
+ static char buf[128];
+ snprintf(buf, sizeof(buf), "vlan %u, p %u%s",
+ tci & 0xfff,
+ tci >> 13,
+ (tci & 0x1000) ? ", DEI" : "");
+ return buf;
+}
#ifdef INET6
extern struct h6namemem *newh6namemem(void);
#endif
+extern const char * ieee8021q_tci_string(const uint16_t);
#define ipaddr_string(ndo, p) getname(ndo, (const u_char *)(p))
#ifdef INET6
if (ndo->ndo_eflag) {
uint16_t tag = EXTRACT_16BITS(p);
- ND_PRINT((ndo, "vlan %u, p %u%s, ",
- tag & 0xfff,
- tag >> 13,
- (tag & 0x1000) ? ", CFI" : ""));
+ ND_PRINT((ndo, "%s, ", ieee8021q_tci_string(tag)));
}
ether_type = EXTRACT_16BITS(p + 2);
if (ndo->ndo_eflag) {
uint16_t tag = EXTRACT_16BITS(p);
- ND_PRINT((ndo, "vlan %u, p %u%s, ",
- tag & 0xfff,
- tag >> 13,
- (tag & 0x1000) ? ", CFI" : ""));
+ ND_PRINT((ndo, "%s, ", ieee8021q_tci_string(tag)));
}
ether_type = EXTRACT_16BITS(p + 2);