if (hlen < sizeof(*tp)) {
ND_PRINT((ndo, " tcp %d [bad hdr length %u - too short, < %lu]",
length - hlen, hlen, (unsigned long)sizeof(*tp)));
return;
}
if (hlen < sizeof(*tp)) {
ND_PRINT((ndo, " tcp %d [bad hdr length %u - too short, < %lu]",
length - hlen, hlen, (unsigned long)sizeof(*tp)));
return;
}
- ND_TCHECK(*tp);
-
- 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 (IP_V(ip) == 4) {
if (ND_TTEST2(tp->th_sport, length)) {
sum = tcp_cksum(ndo, ip, tp, length);
if (IP_V(ip) == 4) {
if (ND_TTEST2(tp->th_sport, length)) {
sum = tcp_cksum(ndo, ip, tp, length);
ND_PRINT((ndo, ", cksum 0x%04x", tcp_sum));
if (sum != 0)
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);
} else if (IP_V(ip) == 6 && ip6->ip6_plen) {
if (ND_TTEST2(tp->th_sport, length)) {
sum = tcp6_cksum(ndo, ip6, tp, length);
ND_PRINT((ndo, ", cksum 0x%04x", tcp_sum));
if (sum != 0)
ND_PRINT((ndo, ", cksum 0x%04x", tcp_sum));
if (sum != 0)
ND_PRINT((ndo, " %d ", datalen / 8));
for (i = 0; i < datalen; i += 8) {
LENCHECK(i + 4);
ND_PRINT((ndo, " %d ", datalen / 8));
for (i = 0; i < datalen; i += 8) {
LENCHECK(i + 4);
/* RFC 5925 Section 2.2:
* "The Length value MUST be greater than or equal to 4."
* (This includes the Kind and Length fields already processed
/* RFC 5925 Section 2.2:
* "The Length value MUST be greater than or equal to 4."
* (This includes the Kind and Length fields already processed
- ND_PRINT((ndo, " keyid %u rnextkeyid %u", cp[0], cp[1]));
+ LENCHECK(1);
+ ND_PRINT((ndo, " keyid %u", cp[0]));
+ LENCHECK(2);
+ ND_PRINT((ndo, " rnextkeyid %u", cp[1]));
- ND_PRINT((ndo, " mac "));
- for (i = 2; i < datalen; i++)
+ ND_PRINT((ndo, " mac 0x"));
+ for (i = 2; i < datalen; i++) {
+ LENCHECK(i + 1);
ND_PRINT((ndo, " 0x%x", utoval));
if (utoval & 0x0001)
utoval = (utoval >> 1) * 60;
ND_PRINT((ndo, " 0x%x", utoval));
if (utoval & 0x0001)
utoval = (utoval >> 1) * 60;
} else if (IS_SRC_OR_DST_PORT(SMTP_PORT)) {
ND_PRINT((ndo, ": "));
smtp_print(ndo, bp, length);
} else if (IS_SRC_OR_DST_PORT(SMTP_PORT)) {
ND_PRINT((ndo, ": "));
smtp_print(ndo, bp, length);
+ } else if (IS_SRC_OR_DST_PORT(WHOIS_PORT)) {
+ ND_PRINT((ndo, ": "));
+ txtproto_print(ndo, bp, length, "whois", NULL, 0); /* RFC 3912 */
} else if (IS_SRC_OR_DST_PORT(BGP_PORT))
bgp_print(ndo, bp, length);
else if (IS_SRC_OR_DST_PORT(PPTP_PORT))
} else if (IS_SRC_OR_DST_PORT(BGP_PORT))
bgp_print(ndo, bp, length);
else if (IS_SRC_OR_DST_PORT(PPTP_PORT))
* TCP DNS query has 2byte length at the head.
* XXX packet could be unaligned, it can go strange
*/
* TCP DNS query has 2byte length at the head.
* XXX packet could be unaligned, it can go strange
*/
- ns_print(ndo, bp + 2, length - 2, 0);
+ domain_print(ndo, bp + 2, length - 2, 0);
} else if (IS_SRC_OR_DST_PORT(MSDP_PORT)) {
msdp_print(ndo, bp, length);
} else if (IS_SRC_OR_DST_PORT(RPKI_RTR_PORT)) {
} else if (IS_SRC_OR_DST_PORT(MSDP_PORT)) {
msdp_print(ndo, bp, length);
} else if (IS_SRC_OR_DST_PORT(RPKI_RTR_PORT)) {
if (fraglen > (length) - 4)
fraglen = (length) - 4;
rp = (const struct sunrpc_msg *)(bp + 4);
if (ND_TTEST(rp->rm_direction)) {
if (fraglen > (length) - 4)
fraglen = (length) - 4;
rp = (const struct sunrpc_msg *)(bp + 4);
if (ND_TTEST(rp->rm_direction)) {
- ND_PRINT((ndo, ": NFS request xid %u ", EXTRACT_32BITS(&rp->rm_xid)));
- nfsreq_print_noaddr(ndo, (const u_char *)rp, fraglen, (const u_char *)ip);
+ 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);
- ND_PRINT((ndo, ": NFS reply xid %u ", EXTRACT_32BITS(&rp->rm_xid)));
- nfsreply_print_noaddr(ndo, (const u_char *)rp, fraglen, (const u_char *)ip);
+ 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);
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));
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 = 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));
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));
MD5_Update(&ctx, (const char *)&len32, sizeof(len32));
nxt = 0;
MD5_Update(&ctx, (const char *)&nxt, sizeof(nxt));
MD5_Update(&ctx, (const char *)&len32, sizeof(len32));
nxt = 0;
MD5_Update(&ctx, (const char *)&nxt, sizeof(nxt));