The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 |
| 3 | * The Regents of the University of California. All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that: (1) source code distributions |
| 7 | * retain the above copyright notice and this paragraph in its entirety, (2) |
| 8 | * distributions including binary code include the above copyright notice and |
| 9 | * this paragraph in its entirety in the documentation or other materials |
| 10 | * provided with the distribution, and (3) all advertising materials mentioning |
| 11 | * features or use of this software display the following acknowledgement: |
| 12 | * ``This product includes software developed by the University of California, |
| 13 | * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of |
| 14 | * the University nor the names of its contributors may be used to endorse |
| 15 | * or promote products derived from this software without specific prior |
| 16 | * written permission. |
| 17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED |
| 18 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
| 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 20 | */ |
| 21 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 22 | /* \summary: UDP printer */ |
| 23 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 24 | #ifdef HAVE_CONFIG_H |
| 25 | #include "config.h" |
| 26 | #endif |
| 27 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 28 | #include <netdissect-stdinc.h> |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 29 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 30 | #include "netdissect.h" |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 31 | #include "addrtoname.h" |
| 32 | #include "extract.h" |
| 33 | #include "appletalk.h" |
| 34 | |
| 35 | #include "udp.h" |
| 36 | |
| 37 | #include "ip.h" |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 38 | #include "ip6.h" |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 39 | #include "ipproto.h" |
| 40 | #include "rpc_auth.h" |
| 41 | #include "rpc_msg.h" |
| 42 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 43 | #include "nfs.h" |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 44 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 45 | static const char vat_tstr[] = " [|vat]"; |
| 46 | static const char rtp_tstr[] = " [|rtp]"; |
| 47 | static const char rtcp_tstr[] = " [|rtcp]"; |
| 48 | static const char udp_tstr[] = " [|udp]"; |
| 49 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 50 | struct rtcphdr { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 51 | uint16_t rh_flags; /* T:2 P:1 CNT:5 PT:8 */ |
| 52 | uint16_t rh_len; /* length of message (in words) */ |
| 53 | uint32_t rh_ssrc; /* synchronization src id */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 54 | }; |
| 55 | |
| 56 | typedef struct { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 57 | uint32_t upper; /* more significant 32 bits */ |
| 58 | uint32_t lower; /* less significant 32 bits */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 59 | } ntp64; |
| 60 | |
| 61 | /* |
| 62 | * Sender report. |
| 63 | */ |
| 64 | struct rtcp_sr { |
| 65 | ntp64 sr_ntp; /* 64-bit ntp timestamp */ |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 66 | uint32_t sr_ts; /* reference media timestamp */ |
| 67 | uint32_t sr_np; /* no. packets sent */ |
| 68 | uint32_t sr_nb; /* no. bytes sent */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | /* |
| 72 | * Receiver report. |
| 73 | * Time stamps are middle 32-bits of ntp timestamp. |
| 74 | */ |
| 75 | struct rtcp_rr { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 76 | uint32_t rr_srcid; /* sender being reported */ |
| 77 | uint32_t rr_nl; /* no. packets lost */ |
| 78 | uint32_t rr_ls; /* extended last seq number received */ |
| 79 | uint32_t rr_dv; /* jitter (delay variance) */ |
| 80 | uint32_t rr_lsr; /* orig. ts from last rr from this src */ |
| 81 | uint32_t rr_dlsr; /* time from recpt of last rr to xmit time */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 82 | }; |
| 83 | |
| 84 | /*XXX*/ |
| 85 | #define RTCP_PT_SR 200 |
| 86 | #define RTCP_PT_RR 201 |
| 87 | #define RTCP_PT_SDES 202 |
| 88 | #define RTCP_SDES_CNAME 1 |
| 89 | #define RTCP_SDES_NAME 2 |
| 90 | #define RTCP_SDES_EMAIL 3 |
| 91 | #define RTCP_SDES_PHONE 4 |
| 92 | #define RTCP_SDES_LOC 5 |
| 93 | #define RTCP_SDES_TOOL 6 |
| 94 | #define RTCP_SDES_NOTE 7 |
| 95 | #define RTCP_SDES_PRIV 8 |
| 96 | #define RTCP_PT_BYE 203 |
| 97 | #define RTCP_PT_APP 204 |
| 98 | |
| 99 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 100 | vat_print(netdissect_options *ndo, const void *hdr, register const struct udphdr *up) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 101 | { |
| 102 | /* vat/vt audio */ |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 103 | u_int ts; |
| 104 | |
| 105 | ND_TCHECK_16BITS((const u_int *)hdr); |
| 106 | ts = EXTRACT_16BITS(hdr); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 107 | if ((ts & 0xf060) != 0) { |
| 108 | /* probably vt */ |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 109 | ND_TCHECK_16BITS(&up->uh_ulen); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 110 | ND_PRINT((ndo, "udp/vt %u %d / %d", |
| 111 | (uint32_t)(EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up)), |
| 112 | ts & 0x3ff, ts >> 10)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 113 | } else { |
| 114 | /* probably vat */ |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 115 | uint32_t i0, i1; |
| 116 | |
| 117 | ND_TCHECK_32BITS(&((const u_int *)hdr)[0]); |
| 118 | i0 = EXTRACT_32BITS(&((const u_int *)hdr)[0]); |
| 119 | ND_TCHECK_32BITS(&((const u_int *)hdr)[1]); |
| 120 | i1 = EXTRACT_32BITS(&((const u_int *)hdr)[1]); |
| 121 | ND_TCHECK_16BITS(&up->uh_ulen); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 122 | ND_PRINT((ndo, "udp/vat %u c%d %u%s", |
| 123 | (uint32_t)(EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up) - 8), |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 124 | i0 & 0xffff, |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 125 | i1, i0 & 0x800000? "*" : "")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 126 | /* audio format */ |
| 127 | if (i0 & 0x1f0000) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 128 | ND_PRINT((ndo, " f%d", (i0 >> 16) & 0x1f)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 129 | if (i0 & 0x3f000000) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 130 | ND_PRINT((ndo, " s%d", (i0 >> 24) & 0x3f)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 131 | } |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 132 | |
| 133 | trunc: |
| 134 | ND_PRINT((ndo, "%s", vat_tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 138 | rtp_print(netdissect_options *ndo, const void *hdr, u_int len, |
| 139 | register const struct udphdr *up) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 140 | { |
| 141 | /* rtp v1 or v2 */ |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 142 | const u_int *ip = (const u_int *)hdr; |
| 143 | u_int hasopt, hasext, contype, hasmarker, dlen; |
| 144 | uint32_t i0, i1; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 145 | const char * ptype; |
| 146 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 147 | ND_TCHECK_32BITS(&((const u_int *)hdr)[0]); |
| 148 | i0 = EXTRACT_32BITS(&((const u_int *)hdr)[0]); |
| 149 | ND_TCHECK_32BITS(&((const u_int *)hdr)[1]); |
| 150 | i1 = EXTRACT_32BITS(&((const u_int *)hdr)[1]); |
| 151 | ND_TCHECK_16BITS(&up->uh_ulen); |
| 152 | dlen = EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up) - 8; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 153 | ip += 2; |
| 154 | len >>= 2; |
| 155 | len -= 2; |
| 156 | hasopt = 0; |
| 157 | hasext = 0; |
| 158 | if ((i0 >> 30) == 1) { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 159 | /* rtp v1 - draft-ietf-avt-rtp-04 */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 160 | hasopt = i0 & 0x800000; |
| 161 | contype = (i0 >> 16) & 0x3f; |
| 162 | hasmarker = i0 & 0x400000; |
| 163 | ptype = "rtpv1"; |
| 164 | } else { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 165 | /* rtp v2 - RFC 3550 */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 166 | hasext = i0 & 0x10000000; |
| 167 | contype = (i0 >> 16) & 0x7f; |
| 168 | hasmarker = i0 & 0x800000; |
| 169 | dlen -= 4; |
| 170 | ptype = "rtp"; |
| 171 | ip += 1; |
| 172 | len -= 1; |
| 173 | } |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 174 | ND_PRINT((ndo, "udp/%s %d c%d %s%s %d %u", |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 175 | ptype, |
| 176 | dlen, |
| 177 | contype, |
| 178 | (hasopt || hasext)? "+" : "", |
| 179 | hasmarker? "*" : "", |
| 180 | i0 & 0xffff, |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 181 | i1)); |
| 182 | if (ndo->ndo_vflag) { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 183 | ND_TCHECK_32BITS(&((const u_int *)hdr)[2]); |
| 184 | ND_PRINT((ndo, " %u", EXTRACT_32BITS(&((const u_int *)hdr)[2]))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 185 | if (hasopt) { |
| 186 | u_int i2, optlen; |
| 187 | do { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 188 | ND_TCHECK_32BITS(ip); |
| 189 | i2 = EXTRACT_32BITS(ip); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 190 | optlen = (i2 >> 16) & 0xff; |
| 191 | if (optlen == 0 || optlen > len) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 192 | ND_PRINT((ndo, " !opt")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 193 | return; |
| 194 | } |
| 195 | ip += optlen; |
| 196 | len -= optlen; |
| 197 | } while ((int)i2 >= 0); |
| 198 | } |
| 199 | if (hasext) { |
| 200 | u_int i2, extlen; |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 201 | ND_TCHECK_32BITS(ip); |
| 202 | i2 = EXTRACT_32BITS(ip); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 203 | extlen = (i2 & 0xffff) + 1; |
| 204 | if (extlen > len) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 205 | ND_PRINT((ndo, " !ext")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 206 | return; |
| 207 | } |
| 208 | ip += extlen; |
| 209 | } |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 210 | ND_TCHECK_32BITS(ip); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 211 | if (contype == 0x1f) /*XXX H.261 */ |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 212 | ND_PRINT((ndo, " 0x%04x", EXTRACT_32BITS(ip) >> 16)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 213 | } |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 214 | |
| 215 | trunc: |
| 216 | ND_PRINT((ndo, "%s", rtp_tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | static const u_char * |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 220 | rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 221 | { |
| 222 | /* rtp v2 control (rtcp) */ |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 223 | const struct rtcp_rr *rr = 0; |
| 224 | const struct rtcp_sr *sr; |
| 225 | const struct rtcphdr *rh = (const struct rtcphdr *)hdr; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 226 | u_int len; |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 227 | uint16_t flags; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 228 | int cnt; |
| 229 | double ts, dts; |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 230 | if ((const u_char *)(rh + 1) > ep) |
| 231 | goto trunc; |
| 232 | ND_TCHECK(*rh); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 233 | len = (EXTRACT_16BITS(&rh->rh_len) + 1) * 4; |
| 234 | flags = EXTRACT_16BITS(&rh->rh_flags); |
| 235 | cnt = (flags >> 8) & 0x1f; |
| 236 | switch (flags & 0xff) { |
| 237 | case RTCP_PT_SR: |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 238 | sr = (const struct rtcp_sr *)(rh + 1); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 239 | ND_PRINT((ndo, " sr")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 240 | if (len != cnt * sizeof(*rr) + sizeof(*sr) + sizeof(*rh)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 241 | ND_PRINT((ndo, " [%d]", len)); |
| 242 | if (ndo->ndo_vflag) |
| 243 | ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc))); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 244 | if ((const u_char *)(sr + 1) > ep) |
| 245 | goto trunc; |
| 246 | ND_TCHECK(*sr); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 247 | ts = (double)(EXTRACT_32BITS(&sr->sr_ntp.upper)) + |
| 248 | ((double)(EXTRACT_32BITS(&sr->sr_ntp.lower)) / |
| 249 | 4294967296.0); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 250 | ND_PRINT((ndo, " @%.2f %u %up %ub", ts, EXTRACT_32BITS(&sr->sr_ts), |
| 251 | EXTRACT_32BITS(&sr->sr_np), EXTRACT_32BITS(&sr->sr_nb))); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 252 | rr = (const struct rtcp_rr *)(sr + 1); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 253 | break; |
| 254 | case RTCP_PT_RR: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 255 | ND_PRINT((ndo, " rr")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 256 | if (len != cnt * sizeof(*rr) + sizeof(*rh)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 257 | ND_PRINT((ndo, " [%d]", len)); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 258 | rr = (const struct rtcp_rr *)(rh + 1); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 259 | if (ndo->ndo_vflag) |
| 260 | ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 261 | break; |
| 262 | case RTCP_PT_SDES: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 263 | ND_PRINT((ndo, " sdes %d", len)); |
| 264 | if (ndo->ndo_vflag) |
| 265 | ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 266 | cnt = 0; |
| 267 | break; |
| 268 | case RTCP_PT_BYE: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 269 | ND_PRINT((ndo, " bye %d", len)); |
| 270 | if (ndo->ndo_vflag) |
| 271 | ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rh->rh_ssrc))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 272 | cnt = 0; |
| 273 | break; |
| 274 | default: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 275 | ND_PRINT((ndo, " type-0x%x %d", flags & 0xff, len)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 276 | cnt = 0; |
| 277 | break; |
| 278 | } |
| 279 | if (cnt > 1) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 280 | ND_PRINT((ndo, " c%d", cnt)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 281 | while (--cnt >= 0) { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 282 | if ((const u_char *)(rr + 1) > ep) |
| 283 | goto trunc; |
| 284 | ND_TCHECK(*rr); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 285 | if (ndo->ndo_vflag) |
| 286 | ND_PRINT((ndo, " %u", EXTRACT_32BITS(&rr->rr_srcid))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 287 | ts = (double)(EXTRACT_32BITS(&rr->rr_lsr)) / 65536.; |
| 288 | dts = (double)(EXTRACT_32BITS(&rr->rr_dlsr)) / 65536.; |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 289 | ND_PRINT((ndo, " %ul %us %uj @%.2f+%.2f", |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 290 | EXTRACT_32BITS(&rr->rr_nl) & 0x00ffffff, |
| 291 | EXTRACT_32BITS(&rr->rr_ls), |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 292 | EXTRACT_32BITS(&rr->rr_dv), ts, dts)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 293 | } |
| 294 | return (hdr + len); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 295 | |
| 296 | trunc: |
| 297 | ND_PRINT((ndo, "%s", rtcp_tstr)); |
| 298 | return ep; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 299 | } |
| 300 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 301 | static int udp_cksum(netdissect_options *ndo, register const struct ip *ip, |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 302 | register const struct udphdr *up, |
| 303 | register u_int len) |
| 304 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 305 | return nextproto4_cksum(ndo, ip, (const uint8_t *)(const void *)up, len, len, |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 306 | IPPROTO_UDP); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 307 | } |
| 308 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 309 | static int udp6_cksum(netdissect_options *ndo, const struct ip6_hdr *ip6, |
| 310 | const struct udphdr *up, u_int len) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 311 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 312 | return nextproto6_cksum(ndo, ip6, (const uint8_t *)(const void *)up, len, len, |
| 313 | IPPROTO_UDP); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 314 | } |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 315 | |
| 316 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 317 | udpipaddr_print(netdissect_options *ndo, const struct ip *ip, int sport, int dport) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 318 | { |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 319 | const struct ip6_hdr *ip6; |
| 320 | |
| 321 | if (IP_V(ip) == 6) |
| 322 | ip6 = (const struct ip6_hdr *)ip; |
| 323 | else |
| 324 | ip6 = NULL; |
| 325 | |
| 326 | if (ip6) { |
| 327 | if (ip6->ip6_nxt == IPPROTO_UDP) { |
| 328 | if (sport == -1) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 329 | ND_PRINT((ndo, "%s > %s: ", |
| 330 | ip6addr_string(ndo, &ip6->ip6_src), |
| 331 | ip6addr_string(ndo, &ip6->ip6_dst))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 332 | } else { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 333 | ND_PRINT((ndo, "%s.%s > %s.%s: ", |
| 334 | ip6addr_string(ndo, &ip6->ip6_src), |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 335 | udpport_string(ndo, sport), |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 336 | ip6addr_string(ndo, &ip6->ip6_dst), |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 337 | udpport_string(ndo, dport))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 338 | } |
| 339 | } else { |
| 340 | if (sport != -1) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 341 | ND_PRINT((ndo, "%s > %s: ", |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 342 | udpport_string(ndo, sport), |
| 343 | udpport_string(ndo, dport))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 344 | } |
| 345 | } |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 346 | } else { |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 347 | if (ip->ip_p == IPPROTO_UDP) { |
| 348 | if (sport == -1) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 349 | ND_PRINT((ndo, "%s > %s: ", |
| 350 | ipaddr_string(ndo, &ip->ip_src), |
| 351 | ipaddr_string(ndo, &ip->ip_dst))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 352 | } else { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 353 | ND_PRINT((ndo, "%s.%s > %s.%s: ", |
| 354 | ipaddr_string(ndo, &ip->ip_src), |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 355 | udpport_string(ndo, sport), |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 356 | ipaddr_string(ndo, &ip->ip_dst), |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 357 | udpport_string(ndo, dport))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 358 | } |
| 359 | } else { |
| 360 | if (sport != -1) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 361 | ND_PRINT((ndo, "%s > %s: ", |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 362 | udpport_string(ndo, sport), |
| 363 | udpport_string(ndo, dport))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 364 | } |
| 365 | } |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 370 | udp_print(netdissect_options *ndo, register const u_char *bp, u_int length, |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 371 | register const u_char *bp2, int fragmented) |
| 372 | { |
| 373 | register const struct udphdr *up; |
| 374 | register const struct ip *ip; |
| 375 | register const u_char *cp; |
| 376 | register const u_char *ep = bp + length; |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 377 | uint16_t sport, dport, ulen; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 378 | register const struct ip6_hdr *ip6; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 379 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 380 | if (ep > ndo->ndo_snapend) |
| 381 | ep = ndo->ndo_snapend; |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 382 | up = (const struct udphdr *)bp; |
| 383 | ip = (const struct ip *)bp2; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 384 | if (IP_V(ip) == 6) |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 385 | ip6 = (const struct ip6_hdr *)bp2; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 386 | else |
| 387 | ip6 = NULL; |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 388 | if (!ND_TTEST(up->uh_dport)) { |
| 389 | udpipaddr_print(ndo, ip, -1, -1); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 390 | goto trunc; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 391 | } |
| 392 | |
| 393 | sport = EXTRACT_16BITS(&up->uh_sport); |
| 394 | dport = EXTRACT_16BITS(&up->uh_dport); |
| 395 | |
| 396 | if (length < sizeof(struct udphdr)) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 397 | udpipaddr_print(ndo, ip, sport, dport); |
| 398 | ND_PRINT((ndo, "truncated-udp %d", length)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 399 | return; |
| 400 | } |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 401 | if (!ND_TTEST(up->uh_ulen)) { |
| 402 | udpipaddr_print(ndo, ip, sport, dport); |
| 403 | goto trunc; |
| 404 | } |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 405 | ulen = EXTRACT_16BITS(&up->uh_ulen); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 406 | if (ulen < sizeof(struct udphdr)) { |
| 407 | udpipaddr_print(ndo, ip, sport, dport); |
| 408 | ND_PRINT((ndo, "truncated-udplength %d", ulen)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 409 | return; |
| 410 | } |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 411 | ulen -= sizeof(struct udphdr); |
| 412 | length -= sizeof(struct udphdr); |
| 413 | if (ulen < length) |
| 414 | length = ulen; |
| 415 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 416 | cp = (const u_char *)(up + 1); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 417 | if (cp > ndo->ndo_snapend) { |
| 418 | udpipaddr_print(ndo, ip, sport, dport); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 419 | goto trunc; |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 420 | } |
| 421 | |
| 422 | if (ndo->ndo_packettype) { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 423 | register const struct sunrpc_msg *rp; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 424 | enum sunrpc_msg_type direction; |
| 425 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 426 | switch (ndo->ndo_packettype) { |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 427 | |
| 428 | case PT_VAT: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 429 | udpipaddr_print(ndo, ip, sport, dport); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 430 | vat_print(ndo, (const void *)(up + 1), up); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 431 | break; |
| 432 | |
| 433 | case PT_WB: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 434 | udpipaddr_print(ndo, ip, sport, dport); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 435 | wb_print(ndo, (const void *)(up + 1), length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 436 | break; |
| 437 | |
| 438 | case PT_RPC: |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 439 | rp = (const struct sunrpc_msg *)(up + 1); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 440 | direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction); |
| 441 | if (direction == SUNRPC_CALL) |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 442 | sunrpcrequest_print(ndo, (const u_char *)rp, length, |
| 443 | (const u_char *)ip); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 444 | else |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 445 | nfsreply_print(ndo, (const u_char *)rp, length, |
| 446 | (const u_char *)ip); /*XXX*/ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 447 | break; |
| 448 | |
| 449 | case PT_RTP: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 450 | udpipaddr_print(ndo, ip, sport, dport); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 451 | rtp_print(ndo, (const void *)(up + 1), length, up); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 452 | break; |
| 453 | |
| 454 | case PT_RTCP: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 455 | udpipaddr_print(ndo, ip, sport, dport); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 456 | while (cp < ep) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 457 | cp = rtcp_print(ndo, cp, ep); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 458 | break; |
| 459 | |
| 460 | case PT_SNMP: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 461 | udpipaddr_print(ndo, ip, sport, dport); |
| 462 | snmp_print(ndo, (const u_char *)(up + 1), length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 463 | break; |
| 464 | |
| 465 | case PT_CNFP: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 466 | udpipaddr_print(ndo, ip, sport, dport); |
| 467 | cnfp_print(ndo, cp); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 468 | break; |
| 469 | |
| 470 | case PT_TFTP: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 471 | udpipaddr_print(ndo, ip, sport, dport); |
| 472 | tftp_print(ndo, cp, length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 473 | break; |
| 474 | |
| 475 | case PT_AODV: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 476 | udpipaddr_print(ndo, ip, sport, dport); |
| 477 | aodv_print(ndo, (const u_char *)(up + 1), length, |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 478 | ip6 != NULL); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 479 | break; |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 480 | |
| 481 | case PT_RADIUS: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 482 | udpipaddr_print(ndo, ip, sport, dport); |
| 483 | radius_print(ndo, cp, length); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 484 | break; |
| 485 | |
| 486 | case PT_VXLAN: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 487 | udpipaddr_print(ndo, ip, sport, dport); |
| 488 | vxlan_print(ndo, (const u_char *)(up + 1), length); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 489 | break; |
| 490 | |
| 491 | case PT_PGM: |
| 492 | case PT_PGM_ZMTP1: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 493 | udpipaddr_print(ndo, ip, sport, dport); |
| 494 | pgm_print(ndo, cp, length, bp2); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 495 | break; |
| 496 | case PT_LMP: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 497 | udpipaddr_print(ndo, ip, sport, dport); |
| 498 | lmp_print(ndo, cp, length); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 499 | break; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 500 | } |
| 501 | return; |
| 502 | } |
| 503 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 504 | udpipaddr_print(ndo, ip, sport, dport); |
| 505 | if (!ndo->ndo_qflag) { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 506 | register const struct sunrpc_msg *rp; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 507 | enum sunrpc_msg_type direction; |
| 508 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 509 | rp = (const struct sunrpc_msg *)(up + 1); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 510 | if (ND_TTEST(rp->rm_direction)) { |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 511 | direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction); |
| 512 | if (dport == NFS_PORT && direction == SUNRPC_CALL) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 513 | ND_PRINT((ndo, "NFS request xid %u ", EXTRACT_32BITS(&rp->rm_xid))); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 514 | nfsreq_print_noaddr(ndo, (const u_char *)rp, length, |
| 515 | (const u_char *)ip); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 516 | return; |
| 517 | } |
| 518 | if (sport == NFS_PORT && direction == SUNRPC_REPLY) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 519 | ND_PRINT((ndo, "NFS reply xid %u ", EXTRACT_32BITS(&rp->rm_xid))); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 520 | nfsreply_print_noaddr(ndo, (const u_char *)rp, length, |
| 521 | (const u_char *)ip); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 522 | return; |
| 523 | } |
| 524 | #ifdef notdef |
| 525 | if (dport == SUNRPC_PORT && direction == SUNRPC_CALL) { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 526 | sunrpcrequest_print((const u_char *)rp, length, (const u_char *)ip); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 527 | return; |
| 528 | } |
| 529 | #endif |
| 530 | } |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 531 | } |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 532 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 533 | if (ndo->ndo_vflag && !ndo->ndo_Kflag && !fragmented) { |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 534 | /* Check the checksum, if possible. */ |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 535 | uint16_t sum, udp_sum; |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 536 | |
| 537 | /* |
| 538 | * XXX - do this even if vflag == 1? |
| 539 | * TCP does, and we do so for UDP-over-IPv6. |
| 540 | */ |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 541 | if (IP_V(ip) == 4 && (ndo->ndo_vflag > 1)) { |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 542 | udp_sum = EXTRACT_16BITS(&up->uh_sum); |
| 543 | if (udp_sum == 0) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 544 | ND_PRINT((ndo, "[no cksum] ")); |
| 545 | } else if (ND_TTEST2(cp[0], length)) { |
| 546 | sum = udp_cksum(ndo, ip, up, length + sizeof(struct udphdr)); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 547 | |
| 548 | if (sum != 0) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 549 | ND_PRINT((ndo, "[bad udp cksum 0x%04x -> 0x%04x!] ", |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 550 | udp_sum, |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 551 | in_cksum_shouldbe(udp_sum, sum))); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 552 | } else |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 553 | ND_PRINT((ndo, "[udp sum ok] ")); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 554 | } |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 555 | } |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 556 | else if (IP_V(ip) == 6 && ip6->ip6_plen) { |
| 557 | /* for IPv6, UDP checksum is mandatory */ |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 558 | if (ND_TTEST2(cp[0], length)) { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 559 | sum = udp6_cksum(ndo, ip6, up, length + sizeof(struct udphdr)); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 560 | udp_sum = EXTRACT_16BITS(&up->uh_sum); |
| 561 | |
| 562 | if (sum != 0) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 563 | ND_PRINT((ndo, "[bad udp cksum 0x%04x -> 0x%04x!] ", |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 564 | udp_sum, |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 565 | in_cksum_shouldbe(udp_sum, sum))); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 566 | } else |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 567 | ND_PRINT((ndo, "[udp sum ok] ")); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 568 | } |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 569 | } |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 570 | } |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 571 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 572 | if (!ndo->ndo_qflag) { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 573 | if (IS_SRC_OR_DST_PORT(NAMESERVER_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 574 | ns_print(ndo, (const u_char *)(up + 1), length, 0); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 575 | else if (IS_SRC_OR_DST_PORT(MULTICASTDNS_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 576 | ns_print(ndo, (const u_char *)(up + 1), length, 1); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 577 | else if (IS_SRC_OR_DST_PORT(TIMED_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 578 | timed_print(ndo, (const u_char *)(up + 1)); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 579 | else if (IS_SRC_OR_DST_PORT(TFTP_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 580 | tftp_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 581 | else if (IS_SRC_OR_DST_PORT(BOOTPC_PORT) || IS_SRC_OR_DST_PORT(BOOTPS_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 582 | bootp_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 583 | else if (IS_SRC_OR_DST_PORT(RIP_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 584 | rip_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 585 | else if (IS_SRC_OR_DST_PORT(AODV_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 586 | aodv_print(ndo, (const u_char *)(up + 1), length, |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 587 | ip6 != NULL); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 588 | else if (IS_SRC_OR_DST_PORT(ISAKMP_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 589 | isakmp_print(ndo, (const u_char *)(up + 1), length, bp2); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 590 | else if (IS_SRC_OR_DST_PORT(ISAKMP_PORT_NATT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 591 | isakmp_rfc3948_print(ndo, (const u_char *)(up + 1), length, bp2); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 592 | #if 1 /*???*/ |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 593 | else if (IS_SRC_OR_DST_PORT(ISAKMP_PORT_USER1) || IS_SRC_OR_DST_PORT(ISAKMP_PORT_USER2)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 594 | isakmp_print(ndo, (const u_char *)(up + 1), length, bp2); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 595 | #endif |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 596 | else if (IS_SRC_OR_DST_PORT(SNMP_PORT) || IS_SRC_OR_DST_PORT(SNMPTRAP_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 597 | snmp_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 598 | else if (IS_SRC_OR_DST_PORT(NTP_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 599 | ntp_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 600 | else if (IS_SRC_OR_DST_PORT(KERBEROS_PORT) || IS_SRC_OR_DST_PORT(KERBEROS_SEC_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 601 | krb_print(ndo, (const void *)(up + 1)); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 602 | else if (IS_SRC_OR_DST_PORT(L2TP_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 603 | l2tp_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 604 | #ifdef ENABLE_SMB |
| 605 | else if (IS_SRC_OR_DST_PORT(NETBIOS_NS_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 606 | nbt_udp137_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 607 | else if (IS_SRC_OR_DST_PORT(NETBIOS_DGRAM_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 608 | nbt_udp138_print(ndo, (const u_char *)(up + 1), length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 609 | #endif |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 610 | else if (dport == VAT_PORT) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 611 | vat_print(ndo, (const void *)(up + 1), up); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 612 | else if (IS_SRC_OR_DST_PORT(ZEPHYR_SRV_PORT) || IS_SRC_OR_DST_PORT(ZEPHYR_CLT_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 613 | zephyr_print(ndo, (const void *)(up + 1), length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 614 | /* |
| 615 | * Since there are 10 possible ports to check, I think |
| 616 | * a <> test would be more efficient |
| 617 | */ |
| 618 | else if ((sport >= RX_PORT_LOW && sport <= RX_PORT_HIGH) || |
| 619 | (dport >= RX_PORT_LOW && dport <= RX_PORT_HIGH)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 620 | rx_print(ndo, (const void *)(up + 1), length, sport, dport, |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 621 | (const u_char *) ip); |
| 622 | else if (IS_SRC_OR_DST_PORT(RIPNG_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 623 | ripng_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 624 | else if (IS_SRC_OR_DST_PORT(DHCP6_SERV_PORT) || IS_SRC_OR_DST_PORT(DHCP6_CLI_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 625 | dhcp6_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 626 | else if (IS_SRC_OR_DST_PORT(AHCP_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 627 | ahcp_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 628 | else if (IS_SRC_OR_DST_PORT(BABEL_PORT) || IS_SRC_OR_DST_PORT(BABEL_PORT_OLD)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 629 | babel_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 630 | else if (IS_SRC_OR_DST_PORT(HNCP_PORT)) |
| 631 | hncp_print(ndo, (const u_char *)(up + 1), length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 632 | /* |
| 633 | * Kludge in test for whiteboard packets. |
| 634 | */ |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 635 | else if (dport == WB_PORT) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 636 | wb_print(ndo, (const void *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 637 | else if (IS_SRC_OR_DST_PORT(CISCO_AUTORP_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 638 | cisco_autorp_print(ndo, (const void *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 639 | else if (IS_SRC_OR_DST_PORT(RADIUS_PORT) || |
| 640 | IS_SRC_OR_DST_PORT(RADIUS_NEW_PORT) || |
| 641 | IS_SRC_OR_DST_PORT(RADIUS_ACCOUNTING_PORT) || |
| 642 | IS_SRC_OR_DST_PORT(RADIUS_NEW_ACCOUNTING_PORT) || |
| 643 | IS_SRC_OR_DST_PORT(RADIUS_CISCO_COA_PORT) || |
| 644 | IS_SRC_OR_DST_PORT(RADIUS_COA_PORT) ) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 645 | radius_print(ndo, (const u_char *)(up+1), length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 646 | else if (dport == HSRP_PORT) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 647 | hsrp_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 648 | else if (IS_SRC_OR_DST_PORT(LWRES_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 649 | lwres_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 650 | else if (IS_SRC_OR_DST_PORT(LDP_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 651 | ldp_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 652 | else if (IS_SRC_OR_DST_PORT(OLSR_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 653 | olsr_print(ndo, (const u_char *)(up + 1), length, |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 654 | (IP_V(ip) == 6) ? 1 : 0); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 655 | else if (IS_SRC_OR_DST_PORT(MPLS_LSP_PING_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 656 | lspping_print(ndo, (const u_char *)(up + 1), length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 657 | else if (dport == BFD_CONTROL_PORT || |
| 658 | dport == BFD_ECHO_PORT ) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 659 | bfd_print(ndo, (const u_char *)(up+1), length, dport); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 660 | else if (IS_SRC_OR_DST_PORT(LMP_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 661 | lmp_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 662 | else if (IS_SRC_OR_DST_PORT(VQP_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 663 | vqp_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 664 | else if (IS_SRC_OR_DST_PORT(SFLOW_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 665 | sflow_print(ndo, (const u_char *)(up + 1), length); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 666 | else if (dport == LWAPP_CONTROL_PORT) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 667 | lwapp_control_print(ndo, (const u_char *)(up + 1), length, 1); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 668 | else if (sport == LWAPP_CONTROL_PORT) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 669 | lwapp_control_print(ndo, (const u_char *)(up + 1), length, 0); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 670 | else if (IS_SRC_OR_DST_PORT(LWAPP_DATA_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 671 | lwapp_data_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 672 | else if (IS_SRC_OR_DST_PORT(SIP_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 673 | sip_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 674 | else if (IS_SRC_OR_DST_PORT(SYSLOG_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 675 | syslog_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 676 | else if (IS_SRC_OR_DST_PORT(OTV_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 677 | otv_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 678 | else if (IS_SRC_OR_DST_PORT(VXLAN_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 679 | vxlan_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 680 | else if (IS_SRC_OR_DST_PORT(GENEVE_PORT)) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 681 | geneve_print(ndo, (const u_char *)(up + 1), length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 682 | else if (IS_SRC_OR_DST_PORT(LISP_CONTROL_PORT)) |
| 683 | lisp_print(ndo, (const u_char *)(up + 1), length); |
| 684 | else if (IS_SRC_OR_DST_PORT(VXLAN_GPE_PORT)) |
| 685 | vxlan_gpe_print(ndo, (const u_char *)(up + 1), length); |
| 686 | else if (ND_TTEST(((const struct LAP *)cp)->type) && |
| 687 | ((const struct LAP *)cp)->type == lapDDP && |
| 688 | (atalk_port(sport) || atalk_port(dport))) { |
| 689 | if (ndo->ndo_vflag) |
| 690 | ND_PRINT((ndo, "kip ")); |
| 691 | llap_print(ndo, cp, length); |
| 692 | } else { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 693 | if (ulen > length) |
| 694 | ND_PRINT((ndo, "UDP, bad length %u > %u", |
| 695 | ulen, length)); |
| 696 | else |
| 697 | ND_PRINT((ndo, "UDP, length %u", ulen)); |
| 698 | } |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 699 | } else { |
| 700 | if (ulen > length) |
| 701 | ND_PRINT((ndo, "UDP, bad length %u > %u", |
| 702 | ulen, length)); |
| 703 | else |
| 704 | ND_PRINT((ndo, "UDP, length %u", ulen)); |
| 705 | } |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 706 | return; |
| 707 | |
| 708 | trunc: |
| 709 | ND_PRINT((ndo, "%s", udp_tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 710 | } |
| 711 | |
| 712 | |
| 713 | /* |
| 714 | * Local Variables: |
| 715 | * c-style: whitesmith |
| 716 | * c-basic-offset: 8 |
| 717 | * End: |
| 718 | */ |