nd_uint32_t sr_ts; /* reference media timestamp */
nd_uint32_t sr_np; /* no. packets sent */
nd_uint32_t sr_nb; /* no. bytes sent */
nd_uint32_t sr_ts; /* reference media timestamp */
nd_uint32_t sr_np; /* no. packets sent */
nd_uint32_t sr_nb; /* no. bytes sent */
ND_TCHECK_2((const u_int *)hdr);
ts = EXTRACT_BE_U_2(hdr);
if ((ts & 0xf060) != 0) {
/* probably vt */
ND_TCHECK_2((const u_int *)hdr);
ts = EXTRACT_BE_U_2(hdr);
if ((ts & 0xf060) != 0) {
/* probably vt */
- ND_TCHECK_2(up->uh_ulen);
- ND_PRINT((ndo, "udp/vt %u %d / %d",
- (uint32_t)(EXTRACT_BE_U_2(up->uh_ulen) - sizeof(*up)),
- ts & 0x3ff, ts >> 10));
+ ND_PRINT("udp/vt %u %u / %u",
+ length,
+ ts & 0x3ff, ts >> 10);
ND_TCHECK_4(&((const u_int *)hdr)[0]);
i0 = EXTRACT_BE_U_4(&((const u_int *)hdr)[0]);
ND_TCHECK_4(&((const u_int *)hdr)[1]);
i1 = EXTRACT_BE_U_4(&((const u_int *)hdr)[1]);
ND_TCHECK_4(&((const u_int *)hdr)[0]);
i0 = EXTRACT_BE_U_4(&((const u_int *)hdr)[0]);
ND_TCHECK_4(&((const u_int *)hdr)[1]);
i1 = EXTRACT_BE_U_4(&((const u_int *)hdr)[1]);
- ND_TCHECK_2(up->uh_ulen);
- ND_PRINT((ndo, "udp/vat %u c%d %u%s",
- (uint32_t)(EXTRACT_BE_U_2(up->uh_ulen) - sizeof(*up) - 8),
+ ND_PRINT("udp/vat %u c%u %u%s",
+ length - 8,
-rtp_print(netdissect_options *ndo, const void *hdr, u_int len,
- register const struct udphdr *up)
+rtp_print(netdissect_options *ndo, const void *hdr, u_int len)
ND_TCHECK_4(&((const u_int *)hdr)[0]);
i0 = EXTRACT_BE_U_4(&((const u_int *)hdr)[0]);
ND_TCHECK_4(&((const u_int *)hdr)[1]);
i1 = EXTRACT_BE_U_4(&((const u_int *)hdr)[1]);
ND_TCHECK_4(&((const u_int *)hdr)[0]);
i0 = EXTRACT_BE_U_4(&((const u_int *)hdr)[0]);
ND_TCHECK_4(&((const u_int *)hdr)[1]);
i1 = EXTRACT_BE_U_4(&((const u_int *)hdr)[1]);
hasext = i0 & 0x10000000;
contype = (i0 >> 16) & 0x7f;
hasmarker = i0 & 0x800000;
hasext = i0 & 0x10000000;
contype = (i0 >> 16) & 0x7f;
hasmarker = i0 & 0x800000;
len = (EXTRACT_BE_U_2(rh->rh_len) + 1) * 4;
flags = EXTRACT_BE_U_2(rh->rh_flags);
cnt = (flags >> 8) & 0x1f;
switch (flags & 0xff) {
case RTCP_PT_SR:
sr = (const struct rtcp_sr *)(rh + 1);
len = (EXTRACT_BE_U_2(rh->rh_len) + 1) * 4;
flags = EXTRACT_BE_U_2(rh->rh_flags);
cnt = (flags >> 8) & 0x1f;
switch (flags & 0xff) {
case RTCP_PT_SR:
sr = (const struct rtcp_sr *)(rh + 1);
- ND_PRINT((ndo, " @%.2f %u %up %ub", ts, EXTRACT_BE_U_4(sr->sr_ts),
- EXTRACT_BE_U_4(sr->sr_np), EXTRACT_BE_U_4(sr->sr_nb)));
+ ND_PRINT(" @%.2f %u %up %ub", ts, EXTRACT_BE_U_4(sr->sr_ts),
+ EXTRACT_BE_U_4(sr->sr_np), EXTRACT_BE_U_4(sr->sr_nb));
- ND_PRINT((ndo, " type-0x%x %d", flags & 0xff, len));
+ ND_PRINT(" type-0x%x %u", flags & 0xff, len);
ts = (double)(EXTRACT_BE_U_4(rr->rr_lsr)) / 65536.;
dts = (double)(EXTRACT_BE_U_4(rr->rr_dlsr)) / 65536.;
ts = (double)(EXTRACT_BE_U_4(rr->rr_lsr)) / 65536.;
dts = (double)(EXTRACT_BE_U_4(rr->rr_dlsr)) / 65536.;
EXTRACT_BE_U_4(rr->rr_nl) & 0x00ffffff,
EXTRACT_BE_U_4(rr->rr_ls),
EXTRACT_BE_U_4(rr->rr_nl) & 0x00ffffff,
EXTRACT_BE_U_4(rr->rr_ls),
-static int udp_cksum(netdissect_options *ndo, register const struct ip *ip,
- register const struct udphdr *up,
- register u_int len)
+static uint16_t udp_cksum(netdissect_options *ndo, const struct ip *ip,
+ const struct udphdr *up,
+ u_int len)
{
return nextproto4_cksum(ndo, ip, (const uint8_t *)(const void *)up, len, len,
IPPROTO_UDP);
}
{
return nextproto4_cksum(ndo, ip, (const uint8_t *)(const void *)up, len, len,
IPPROTO_UDP);
}
const struct udphdr *up, u_int len)
{
return nextproto6_cksum(ndo, ip6, (const uint8_t *)(const void *)up, len, len,
const struct udphdr *up, u_int len)
{
return nextproto6_cksum(ndo, ip6, (const uint8_t *)(const void *)up, len, len,
- ND_PRINT((ndo, "%s > %s: ",
- ip6addr_string(ndo, &ip6->ip6_src),
- ip6addr_string(ndo, &ip6->ip6_dst)));
+ ND_PRINT("%s > %s: ",
+ ip6addr_string(ndo, ip6->ip6_src),
+ ip6addr_string(ndo, ip6->ip6_dst));
- ND_PRINT((ndo, "%s.%s > %s.%s: ",
- ip6addr_string(ndo, &ip6->ip6_src),
+ ND_PRINT("%s.%s > %s.%s: ",
+ ip6addr_string(ndo, ip6->ip6_src),
- ip6addr_string(ndo, &ip6->ip6_dst),
- udpport_string(ndo, dport)));
+ ip6addr_string(ndo, ip6->ip6_dst),
+ udpport_string(ndo, dport));
- ND_PRINT((ndo, "%s > %s: ",
- ipaddr_string(ndo, &ip->ip_src),
- ipaddr_string(ndo, &ip->ip_dst)));
+ ND_PRINT("%s > %s: ",
+ ipaddr_string(ndo, ip->ip_src),
+ ipaddr_string(ndo, ip->ip_dst));
- ND_PRINT((ndo, "%s.%s > %s.%s: ",
- ipaddr_string(ndo, &ip->ip_src),
+ ND_PRINT("%s.%s > %s.%s: ",
+ ipaddr_string(ndo, ip->ip_src),
- ipaddr_string(ndo, &ip->ip_dst),
- udpport_string(ndo, dport)));
+ ipaddr_string(ndo, ip->ip_dst),
+ udpport_string(ndo, dport));
-udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
- register const u_char *bp2, int fragmented)
+udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
+ const u_char *bp2, int fragmented)
- register const struct udphdr *up;
- register const struct ip *ip;
- register const u_char *cp;
- register const u_char *ep = bp + length;
+ const struct udphdr *up;
+ const struct ip *ip;
+ const u_char *cp;
+ const u_char *ep = ndo->ndo_snapend;
up = (const struct udphdr *)bp;
ip = (const struct ip *)bp2;
if (IP_V(ip) == 6)
ip6 = (const struct ip6_hdr *)bp2;
else
ip6 = NULL;
up = (const struct udphdr *)bp;
ip = (const struct ip *)bp2;
if (IP_V(ip) == 6)
ip6 = (const struct ip6_hdr *)bp2;
else
ip6 = NULL;
udpipaddr_print(ndo, ip, -1, -1);
goto trunc;
}
udpipaddr_print(ndo, ip, -1, -1);
goto trunc;
}
if (length < sizeof(struct udphdr)) {
udpipaddr_print(ndo, ip, sport, dport);
if (length < sizeof(struct udphdr)) {
udpipaddr_print(ndo, ip, sport, dport);
udpipaddr_print(ndo, ip, sport, dport);
goto trunc;
}
ulen = EXTRACT_BE_U_2(up->uh_ulen);
if (ulen < sizeof(struct udphdr)) {
udpipaddr_print(ndo, ip, sport, dport);
udpipaddr_print(ndo, ip, sport, dport);
goto trunc;
}
ulen = EXTRACT_BE_U_2(up->uh_ulen);
if (ulen < sizeof(struct udphdr)) {
udpipaddr_print(ndo, ip, sport, dport);
enum sunrpc_msg_type direction;
switch (ndo->ndo_packettype) {
case PT_VAT:
udpipaddr_print(ndo, ip, sport, dport);
enum sunrpc_msg_type direction;
switch (ndo->ndo_packettype) {
case PT_VAT:
udpipaddr_print(ndo, ip, sport, dport);
break;
case PT_WB:
udpipaddr_print(ndo, ip, sport, dport);
break;
case PT_WB:
udpipaddr_print(ndo, ip, sport, dport);
if (direction == SUNRPC_CALL)
sunrpc_print(ndo, (const u_char *)rp, length,
(const u_char *)ip);
if (direction == SUNRPC_CALL)
sunrpc_print(ndo, (const u_char *)rp, length,
(const u_char *)ip);
case PT_RTP:
udpipaddr_print(ndo, ip, sport, dport);
case PT_RTP:
udpipaddr_print(ndo, ip, sport, dport);
- rtp_print(ndo, (const void *)(up + 1), length, up);
+ rtp_print(ndo, (const void *)(up + 1), length);
udpipaddr_print(ndo, ip, sport, dport);
if (!ndo->ndo_qflag) {
udpipaddr_print(ndo, ip, sport, dport);
if (!ndo->ndo_qflag) {
- if (ND_TTEST(rp->rm_direction)) {
- direction = (enum sunrpc_msg_type) EXTRACT_BE_U_4(&rp->rm_direction);
+ if (ND_TTEST_4(rp->rm_direction)) {
+ direction = (enum sunrpc_msg_type) EXTRACT_BE_U_4(rp->rm_direction);
- ND_PRINT((ndo, "NFS request xid %u ", EXTRACT_BE_U_4(&rp->rm_xid)));
+ ND_PRINT("NFS request xid %u ",
+ EXTRACT_BE_U_4(rp->rm_xid));
nfsreq_noaddr_print(ndo, (const u_char *)rp, length,
(const u_char *)ip);
return;
}
if (sport == NFS_PORT && direction == SUNRPC_REPLY) {
nfsreq_noaddr_print(ndo, (const u_char *)rp, length,
(const u_char *)ip);
return;
}
if (sport == NFS_PORT && direction == SUNRPC_REPLY) {
- ND_PRINT((ndo, "NFS reply xid %u ", EXTRACT_BE_U_4(&rp->rm_xid)));
+ ND_PRINT("NFS reply xid %u ",
+ EXTRACT_BE_U_4(rp->rm_xid));
nfsreply_noaddr_print(ndo, (const u_char *)rp, length,
(const u_char *)ip);
return;
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)) {
* TCP does, and we do so for UDP-over-IPv6.
*/
if (IP_V(ip) == 4 && (ndo->ndo_vflag > 1)) {
- ND_PRINT((ndo, "[no cksum] "));
- } else if (ND_TTEST2(cp[0], length)) {
+ ND_PRINT("[no cksum] ");
+ } else if (ND_TTEST_LEN(cp, length)) {
sum = udp_cksum(ndo, ip, up, length + sizeof(struct udphdr));
if (sum != 0) {
sum = udp_cksum(ndo, ip, up, length + sizeof(struct udphdr));
if (sum != 0) {
}
}
else if (IP_V(ip) == 6 && ip6->ip6_plen) {
/* for IPv6, UDP checksum is mandatory */
}
}
else if (IP_V(ip) == 6 && ip6->ip6_plen) {
/* for IPv6, UDP checksum is mandatory */
sum = udp6_cksum(ndo, ip6, up, length + sizeof(struct udphdr));
sum = udp6_cksum(ndo, ip6, up, length + sizeof(struct udphdr));
else if (IS_SRC_OR_DST_PORT(NTP_PORT))
ntp_print(ndo, (const u_char *)(up + 1), length);
else if (IS_SRC_OR_DST_PORT(KERBEROS_PORT) || IS_SRC_OR_DST_PORT(KERBEROS_SEC_PORT))
else if (IS_SRC_OR_DST_PORT(NTP_PORT))
ntp_print(ndo, (const u_char *)(up + 1), length);
else if (IS_SRC_OR_DST_PORT(KERBEROS_PORT) || IS_SRC_OR_DST_PORT(KERBEROS_SEC_PORT))
else if (IS_SRC_OR_DST_PORT(L2TP_PORT))
l2tp_print(ndo, (const u_char *)(up + 1), length);
#ifdef ENABLE_SMB
else if (IS_SRC_OR_DST_PORT(L2TP_PORT))
l2tp_print(ndo, (const u_char *)(up + 1), length);
#ifdef ENABLE_SMB
nbt_udp138_print(ndo, (const u_char *)(up + 1), length);
#endif
else if (dport == VAT_PORT)
nbt_udp138_print(ndo, (const u_char *)(up + 1), length);
#endif
else if (dport == VAT_PORT)
/*
* Since there are 10 possible ports to check, I think
* a <> test would be more efficient
*/
else if ((sport >= RX_PORT_LOW && sport <= RX_PORT_HIGH) ||
(dport >= RX_PORT_LOW && dport <= RX_PORT_HIGH))
/*
* Since there are 10 possible ports to check, I think
* a <> test would be more efficient
*/
else if ((sport >= RX_PORT_LOW && sport <= RX_PORT_HIGH) ||
(dport >= RX_PORT_LOW && dport <= RX_PORT_HIGH))
- rx_print(ndo, (const void *)(up + 1), length, sport, dport,
+ rx_print(ndo, (const u_char *)(up + 1), length, sport, dport,
(const u_char *) ip);
else if (IS_SRC_OR_DST_PORT(RIPNG_PORT))
ripng_print(ndo, (const u_char *)(up + 1), length);
(const u_char *) ip);
else if (IS_SRC_OR_DST_PORT(RIPNG_PORT))
ripng_print(ndo, (const u_char *)(up + 1), length);
else if (IS_SRC_OR_DST_PORT(RADIUS_PORT) ||
IS_SRC_OR_DST_PORT(RADIUS_NEW_PORT) ||
IS_SRC_OR_DST_PORT(RADIUS_ACCOUNTING_PORT) ||
else if (IS_SRC_OR_DST_PORT(RADIUS_PORT) ||
IS_SRC_OR_DST_PORT(RADIUS_NEW_PORT) ||
IS_SRC_OR_DST_PORT(RADIUS_ACCOUNTING_PORT) ||
lisp_print(ndo, (const u_char *)(up + 1), length);
else if (IS_SRC_OR_DST_PORT(VXLAN_GPE_PORT))
vxlan_gpe_print(ndo, (const u_char *)(up + 1), length);
lisp_print(ndo, (const u_char *)(up + 1), length);
else if (IS_SRC_OR_DST_PORT(VXLAN_GPE_PORT))
vxlan_gpe_print(ndo, (const u_char *)(up + 1), length);
- else if (ND_TTEST(((const struct LAP *)cp)->type) &&
- ((const struct LAP *)cp)->type == lapDDP &&
- (atalk_port(sport) || atalk_port(dport))) {
+ else if (ND_TTEST_1(((const struct LAP *)cp)->type) &&
+ EXTRACT_U_1(((const struct LAP *)cp)->type) == lapDDP &&
+ (atalk_port(sport) || atalk_port(dport))) {