-static void print_tcp_rst_data(netdissect_options *, register const u_char *sp, u_int length);
-static void print_tcp_fastopen_option(netdissect_options *ndo, register const u_char *cp,
+static void print_tcp_rst_data(netdissect_options *, const u_char *sp, u_int length);
+static void print_tcp_fastopen_option(netdissect_options *ndo, const u_char *cp,
{
return nextproto4_cksum(ndo, ip, (const uint8_t *)tp, len, len,
IPPROTO_TCP);
{
return nextproto4_cksum(ndo, ip, (const uint8_t *)tp, len, len,
IPPROTO_TCP);
- register const struct ip6_hdr *ip6,
- register const struct tcphdr *tp,
- register u_int len)
+ const struct ip6_hdr *ip6,
+ const struct tcphdr *tp,
+ u_int len)
{
return nextproto6_cksum(ndo, ip6, (const uint8_t *)tp, len, len,
IPPROTO_TCP);
{
return nextproto6_cksum(ndo, ip6, (const uint8_t *)tp, len, len,
IPPROTO_TCP);
- register const u_char *bp, register u_int length,
- register const u_char *bp2, int fragmented)
+ const u_char *bp, u_int length,
+ const u_char *bp2, int fragmented)
uint16_t sport, dport, win, urp;
uint32_t seq, ack, thseq, thack;
u_int utoval;
uint16_t magic;
uint16_t sport, dport, win, urp;
uint32_t seq, ack, thseq, thack;
u_int utoval;
uint16_t magic;
ND_PRINT((ndo, "%s.%s > %s.%s: ",
ip6addr_string(ndo, &ip6->ip6_src),
tcpport_string(ndo, sport),
ND_PRINT((ndo, "%s.%s > %s.%s: ",
ip6addr_string(ndo, &ip6->ip6_src),
tcpport_string(ndo, sport),
tcpport_string(ndo, sport), tcpport_string(ndo, dport)));
}
} else {
tcpport_string(ndo, sport), tcpport_string(ndo, dport)));
}
} else {
ND_PRINT((ndo, "%s.%s > %s.%s: ",
ipaddr_string(ndo, &ip->ip_src),
tcpport_string(ndo, sport),
ND_PRINT((ndo, "%s.%s > %s.%s: ",
ipaddr_string(ndo, &ip->ip_src),
tcpport_string(ndo, sport),
- 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_U_4(tp->th_seq);
+ ack = EXTRACT_BE_U_4(tp->th_ack);
+ win = EXTRACT_BE_U_2(tp->th_win);
+ urp = EXTRACT_BE_U_2(tp->th_urp);
ND_PRINT((ndo, "Flags [%s]", bittok2str_nosep(tcp_flag_values, "none", flags)));
if (!ndo->ndo_Sflag && (flags & TH_ACK)) {
ND_PRINT((ndo, "Flags [%s]", bittok2str_nosep(tcp_flag_values, "none", flags)));
if (!ndo->ndo_Sflag && (flags & TH_ACK)) {
sum = tcp_cksum(ndo, ip, tp, 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)
ND_PRINT((ndo, " (correct)"));
}
} else if (IP_V(ip) == 6 && ip6->ip6_plen) {
ND_PRINT((ndo, " (correct)"));
}
} else if (IP_V(ip) == 6 && ip6->ip6_plen) {
sum = tcp6_cksum(ndo, ip6, tp, 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, "%s", tok2str(tcp_option_values, "unknown-%u", opt)));
ND_PRINT((ndo, "%s", tok2str(tcp_option_values, "unknown-%u", opt)));
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);
case CANT_CHECK_SIGNATURE:
ND_PRINT((ndo, "can't check - "));
for (i = 0; i < TCP_SIGLEN; ++i)
case CANT_CHECK_SIGNATURE:
ND_PRINT((ndo, "can't check - "));
for (i = 0; i < TCP_SIGLEN; ++i)
- ND_PRINT((ndo, " cap %02x id %u", cp[0], cp[1]));
+ ND_PRINT((ndo, " cap %02x id %u", EXTRACT_U_1(cp), EXTRACT_U_1(cp + 1)));
if (datalen > 2) {
ND_PRINT((ndo, " mac 0x"));
for (i = 2; i < datalen; i++) {
LENCHECK(i + 1);
if (datalen > 2) {
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;
* 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)) {
ldp_print(ndo, bp, length);
}
else if ((IS_SRC_OR_DST_PORT(NFS_PORT)) &&
ldp_print(ndo, bp, length);
}
else if ((IS_SRC_OR_DST_PORT(NFS_PORT)) &&
/*
* If data present, header length valid, and NFS port used,
* assume NFS.
/*
* If data present, header length valid, and NFS port used,
* assume NFS.
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_U_4(&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_U_4(&rp->rm_xid)));
+ nfsreply_noaddr_print(ndo, (const u_char *)rp, fraglen, (const u_char *)ip);
if (length > MAX_RST_DATA_LEN) {
length = MAX_RST_DATA_LEN; /* can use -X for longer */
ND_PRINT((ndo, "+")); /* indicate we truncate */
}
ND_PRINT((ndo, " "));
while (length-- && sp < ndo->ndo_snapend) {
if (length > MAX_RST_DATA_LEN) {
length = MAX_RST_DATA_LEN; /* can use -X for longer */
ND_PRINT((ndo, "+")); /* indicate we truncate */
}
ND_PRINT((ndo, " "));
while (length-- && sp < ndo->ndo_snapend) {
} else {
ND_PRINT((ndo, " cookie "));
for (i = 0; i < datalen; ++i)
} else {
ND_PRINT((ndo, " cookie "));
for (i = 0; i < datalen; ++i)
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));
* Step 2: Update MD5 hash with TCP header, excluding options.
* The TCP checksum must be set to zero.
*/
* Step 2: Update MD5 hash with TCP header, excluding options.
* The TCP checksum must be set to zero.
*/