The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994, 1995, 1996 |
| 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: Internet Group Management Protocol (IGMP) printer */ |
| 23 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 24 | /* |
| 25 | * specification: |
| 26 | * |
| 27 | * RFC 2236 for IGMPv2 |
| 28 | * RFC 3376 for IGMPv3 |
| 29 | * draft-asaeda-mboned-mtrace-v2 for the mtrace message |
| 30 | */ |
| 31 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 32 | #ifdef HAVE_CONFIG_H |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 33 | #include <config.h> |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 34 | #endif |
| 35 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 36 | #include "netdissect-stdinc.h" |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 37 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 38 | #include "netdissect.h" |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 39 | #include "addrtoname.h" |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 40 | #include "extract.h" |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 41 | |
| 42 | #ifndef IN_CLASSD |
| 43 | #define IN_CLASSD(i) (((int32_t)(i) & 0xf0000000) == 0xe0000000) |
| 44 | #endif |
| 45 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 46 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 47 | /* (following from ipmulti/mrouted/prune.h) */ |
| 48 | |
| 49 | /* |
| 50 | * The packet format for a traceroute request. |
| 51 | */ |
| 52 | struct tr_query { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 53 | nd_uint32_t tr_src; /* traceroute source */ |
| 54 | nd_uint32_t tr_dst; /* traceroute destination */ |
| 55 | nd_uint32_t tr_raddr; /* traceroute response address */ |
| 56 | nd_uint8_t tr_rttl; /* response ttl */ |
| 57 | nd_uint24_t tr_qid; /* qid */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 58 | }; |
| 59 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 60 | /* |
| 61 | * Traceroute response format. A traceroute response has a tr_query at the |
| 62 | * beginning, followed by one tr_resp for each hop taken. |
| 63 | */ |
| 64 | struct tr_resp { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 65 | nd_uint32_t tr_qarr; /* query arrival time */ |
| 66 | nd_uint32_t tr_inaddr; /* incoming interface address */ |
| 67 | nd_uint32_t tr_outaddr; /* outgoing interface address */ |
| 68 | nd_uint32_t tr_rmtaddr; /* parent address in source tree */ |
| 69 | nd_uint32_t tr_vifin; /* input packet count on interface */ |
| 70 | nd_uint32_t tr_vifout; /* output packet count on interface */ |
| 71 | nd_uint32_t tr_pktcnt; /* total incoming packets for src-grp */ |
| 72 | nd_uint8_t tr_rproto; /* routing proto deployed on router */ |
| 73 | nd_uint8_t tr_fttl; /* ttl required to forward on outvif */ |
| 74 | nd_uint8_t tr_smask; /* subnet mask for src addr */ |
| 75 | nd_uint8_t tr_rflags; /* forwarding error codes */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | /* defs within mtrace */ |
| 79 | #define TR_QUERY 1 |
| 80 | #define TR_RESP 2 |
| 81 | |
| 82 | /* fields for tr_rflags (forwarding error codes) */ |
| 83 | #define TR_NO_ERR 0 |
| 84 | #define TR_WRONG_IF 1 |
| 85 | #define TR_PRUNED 2 |
| 86 | #define TR_OPRUNED 3 |
| 87 | #define TR_SCOPED 4 |
| 88 | #define TR_NO_RTE 5 |
| 89 | #define TR_NO_FWD 7 |
| 90 | #define TR_NO_SPACE 0x81 |
| 91 | #define TR_OLD_ROUTER 0x82 |
| 92 | |
| 93 | /* fields for tr_rproto (routing protocol) */ |
| 94 | #define TR_PROTO_DVMRP 1 |
| 95 | #define TR_PROTO_MOSPF 2 |
| 96 | #define TR_PROTO_PIM 3 |
| 97 | #define TR_PROTO_CBT 4 |
| 98 | |
| 99 | /* igmpv3 report types */ |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 100 | static const struct tok igmpv3report2str[] = { |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 101 | { 1, "is_in" }, |
| 102 | { 2, "is_ex" }, |
| 103 | { 3, "to_in" }, |
| 104 | { 4, "to_ex" }, |
| 105 | { 5, "allow" }, |
| 106 | { 6, "block" }, |
| 107 | { 0, NULL } |
| 108 | }; |
| 109 | |
| 110 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 111 | print_mtrace(netdissect_options *ndo, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 112 | const char *typename, |
| 113 | const u_char *bp, u_int len) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 114 | { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 115 | const struct tr_query *tr = (const struct tr_query *)(bp + 8); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 116 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 117 | if (len < 8 + sizeof (struct tr_query)) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 118 | ND_PRINT(" [invalid len %u]", len); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 119 | return; |
| 120 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 121 | ND_PRINT("%s %u: %s to %s reply-to %s", |
| 122 | typename, |
| 123 | GET_BE_U_3(tr->tr_qid), |
| 124 | GET_IPADDR_STRING(tr->tr_src), GET_IPADDR_STRING(tr->tr_dst), |
| 125 | GET_IPADDR_STRING(tr->tr_raddr)); |
| 126 | if (IN_CLASSD(GET_BE_U_4(tr->tr_raddr))) |
| 127 | ND_PRINT(" with-ttl %u", GET_U_1(tr->tr_rttl)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 131 | print_igmpv3_report(netdissect_options *ndo, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 132 | const u_char *bp, u_int len) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 133 | { |
| 134 | u_int group, nsrcs, ngroups; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 135 | u_int i, j; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 136 | |
| 137 | /* Minimum len is 16, and should be a multiple of 4 */ |
| 138 | if (len < 16 || len & 0x03) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 139 | ND_PRINT(" [invalid len %u]", len); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 140 | return; |
| 141 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 142 | ngroups = GET_BE_U_2(bp + 6); |
| 143 | ND_PRINT(", %u group record(s)", ngroups); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 144 | if (ndo->ndo_vflag > 0) { |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 145 | /* Print the group records */ |
| 146 | group = 8; |
| 147 | for (i=0; i<ngroups; i++) { |
| 148 | if (len < group+8) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 149 | ND_PRINT(" [invalid number of groups]"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 150 | return; |
| 151 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 152 | ND_PRINT(" [gaddr %s", GET_IPADDR_STRING(bp + group + 4)); |
| 153 | ND_PRINT(" %s", tok2str(igmpv3report2str, " [v3-report-#%u]", |
| 154 | GET_U_1(bp + group))); |
| 155 | nsrcs = GET_BE_U_2(bp + group + 2); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 156 | /* Check the number of sources and print them */ |
| 157 | if (len < group+8+(nsrcs<<2)) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 158 | ND_PRINT(" [invalid number of sources %u]", nsrcs); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 159 | return; |
| 160 | } |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 161 | if (ndo->ndo_vflag == 1) |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 162 | ND_PRINT(", %u source(s)", nsrcs); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 163 | else { |
| 164 | /* Print the sources */ |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 165 | ND_PRINT(" {"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 166 | for (j=0; j<nsrcs; j++) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 167 | ND_PRINT(" %s", GET_IPADDR_STRING(bp + group + 8 + (j << 2))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 168 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 169 | ND_PRINT(" }"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 170 | } |
| 171 | /* Next group record */ |
| 172 | group += 8 + (nsrcs << 2); |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 173 | ND_PRINT("]"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 174 | } |
| 175 | } |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 179 | print_igmpv3_query(netdissect_options *ndo, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 180 | const u_char *bp, u_int len) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 181 | { |
| 182 | u_int mrc; |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 183 | u_int mrt; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 184 | u_int nsrcs; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 185 | u_int i; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 186 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 187 | ND_PRINT(" v3"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 188 | /* Minimum len is 12, and should be a multiple of 4 */ |
| 189 | if (len < 12 || len & 0x03) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 190 | ND_PRINT(" [invalid len %u]", len); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 191 | return; |
| 192 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 193 | mrc = GET_U_1(bp + 1); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 194 | if (mrc < 128) { |
| 195 | mrt = mrc; |
| 196 | } else { |
| 197 | mrt = ((mrc & 0x0f) | 0x10) << (((mrc & 0x70) >> 4) + 3); |
| 198 | } |
| 199 | if (mrc != 100) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 200 | ND_PRINT(" [max resp time "); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 201 | if (mrt < 600) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 202 | ND_PRINT("%.1fs", mrt * 0.1); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 203 | } else { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 204 | unsigned_relts_print(ndo, mrt / 10); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 205 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 206 | ND_PRINT("]"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 207 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 208 | if (GET_BE_U_4(bp + 4) == 0) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 209 | return; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 210 | ND_PRINT(" [gaddr %s", GET_IPADDR_STRING(bp + 4)); |
| 211 | nsrcs = GET_BE_U_2(bp + 10); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 212 | if (nsrcs > 0) { |
| 213 | if (len < 12 + (nsrcs << 2)) |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 214 | ND_PRINT(" [invalid number of sources]"); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 215 | else if (ndo->ndo_vflag > 1) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 216 | ND_PRINT(" {"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 217 | for (i=0; i<nsrcs; i++) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 218 | ND_PRINT(" %s", GET_IPADDR_STRING(bp + 12 + (i << 2))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 219 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 220 | ND_PRINT(" }"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 221 | } else |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 222 | ND_PRINT(", %u source(s)", nsrcs); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 223 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 224 | ND_PRINT("]"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 228 | igmp_print(netdissect_options *ndo, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 229 | const u_char *bp, u_int len) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 230 | { |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 231 | struct cksum_vec vec[1]; |
| 232 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 233 | ndo->ndo_protocol = "igmp"; |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 234 | if (ndo->ndo_qflag) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 235 | ND_PRINT("igmp"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 236 | return; |
| 237 | } |
| 238 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 239 | switch (GET_U_1(bp)) { |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 240 | case 0x11: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 241 | ND_PRINT("igmp query"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 242 | if (len >= 12) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 243 | print_igmpv3_query(ndo, bp, len); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 244 | else { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 245 | if (GET_U_1(bp + 1)) { |
| 246 | ND_PRINT(" v2"); |
| 247 | if (GET_U_1(bp + 1) != 100) |
| 248 | ND_PRINT(" [max resp time %u]", GET_U_1(bp + 1)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 249 | } else |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 250 | ND_PRINT(" v1"); |
| 251 | if (GET_BE_U_4(bp + 4)) |
| 252 | ND_PRINT(" [gaddr %s]", GET_IPADDR_STRING(bp + 4)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 253 | if (len != 8) |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 254 | ND_PRINT(" [len %u]", len); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 255 | } |
| 256 | break; |
| 257 | case 0x12: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 258 | ND_PRINT("igmp v1 report %s", GET_IPADDR_STRING(bp + 4)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 259 | if (len != 8) |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 260 | ND_PRINT(" [len %u]", len); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 261 | break; |
| 262 | case 0x16: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 263 | ND_PRINT("igmp v2 report %s", GET_IPADDR_STRING(bp + 4)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 264 | break; |
| 265 | case 0x22: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 266 | ND_PRINT("igmp v3 report"); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 267 | print_igmpv3_report(ndo, bp, len); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 268 | break; |
| 269 | case 0x17: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 270 | ND_PRINT("igmp leave %s", GET_IPADDR_STRING(bp + 4)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 271 | break; |
| 272 | case 0x13: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 273 | ND_PRINT("igmp dvmrp"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 274 | if (len < 8) |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 275 | ND_PRINT(" [len %u]", len); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 276 | else |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 277 | dvmrp_print(ndo, bp, len); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 278 | break; |
| 279 | case 0x14: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 280 | ND_PRINT("igmp pimv1"); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 281 | pimv1_print(ndo, bp, len); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 282 | break; |
| 283 | case 0x1e: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 284 | print_mtrace(ndo, "mresp", bp, len); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 285 | break; |
| 286 | case 0x1f: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 287 | print_mtrace(ndo, "mtrace", bp, len); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 288 | break; |
| 289 | default: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 290 | ND_PRINT("igmp-%u", GET_U_1(bp)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 291 | break; |
| 292 | } |
| 293 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 294 | if (ndo->ndo_vflag && len >= 4 && ND_TTEST_LEN(bp, len)) { |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 295 | /* Check the IGMP checksum */ |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 296 | vec[0].ptr = bp; |
| 297 | vec[0].len = len; |
| 298 | if (in_cksum(vec, 1)) |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 299 | ND_PRINT(" bad igmp cksum %x!", GET_BE_U_2(bp + 2)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 300 | } |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 301 | } |