The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 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: Distance Vector Multicast Routing Protocol printer */ |
| 23 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 24 | #ifdef HAVE_CONFIG_H |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 25 | #include <config.h> |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 26 | #endif |
| 27 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -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 "extract.h" |
| 32 | #include "addrtoname.h" |
| 33 | |
| 34 | /* |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 35 | * See: RFC 1075 and draft-ietf-idmr-dvmrp-v3 |
| 36 | * |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 37 | * DVMRP message types and flag values shamelessly stolen from |
| 38 | * mrouted/dvmrp.h. |
| 39 | */ |
| 40 | #define DVMRP_PROBE 1 /* for finding neighbors */ |
| 41 | #define DVMRP_REPORT 2 /* for reporting some or all routes */ |
| 42 | #define DVMRP_ASK_NEIGHBORS 3 /* sent by mapper, asking for a list */ |
| 43 | /* of this router's neighbors */ |
| 44 | #define DVMRP_NEIGHBORS 4 /* response to such a request */ |
| 45 | #define DVMRP_ASK_NEIGHBORS2 5 /* as above, want new format reply */ |
| 46 | #define DVMRP_NEIGHBORS2 6 |
| 47 | #define DVMRP_PRUNE 7 /* prune message */ |
| 48 | #define DVMRP_GRAFT 8 /* graft message */ |
| 49 | #define DVMRP_GRAFT_ACK 9 /* graft acknowledgement */ |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 50 | static const struct tok dvmrp_msgtype_str[] = { |
| 51 | { DVMRP_PROBE, "Probe" }, |
| 52 | { DVMRP_REPORT, "Report" }, |
| 53 | { DVMRP_ASK_NEIGHBORS, "Ask-neighbors(old)" }, |
| 54 | { DVMRP_NEIGHBORS, "Neighbors(old)" }, |
| 55 | { DVMRP_ASK_NEIGHBORS2, "Ask-neighbors2" }, |
| 56 | { DVMRP_NEIGHBORS2, "Neighbors2" }, |
| 57 | { DVMRP_PRUNE, "Prune" }, |
| 58 | { DVMRP_GRAFT, "Graft" }, |
| 59 | { DVMRP_GRAFT_ACK, "Graft-ACK" }, |
| 60 | { 0, NULL } |
| 61 | }; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 62 | |
| 63 | /* |
| 64 | * 'flags' byte values in DVMRP_NEIGHBORS2 reply. |
| 65 | */ |
| 66 | #define DVMRP_NF_TUNNEL 0x01 /* neighbors reached via tunnel */ |
| 67 | #define DVMRP_NF_SRCRT 0x02 /* tunnel uses IP source routing */ |
| 68 | #define DVMRP_NF_DOWN 0x10 /* kernel state of interface */ |
| 69 | #define DVMRP_NF_DISABLED 0x20 /* administratively disabled */ |
| 70 | #define DVMRP_NF_QUERIER 0x40 /* I am the subnet's querier */ |
| 71 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 72 | static void print_probe(netdissect_options *, const u_char *, u_int); |
| 73 | static void print_report(netdissect_options *, const u_char *, u_int); |
| 74 | static void print_neighbors(netdissect_options *, const u_char *, u_int); |
| 75 | static void print_neighbors2(netdissect_options *, const u_char *, u_int, uint8_t, uint8_t); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 76 | |
| 77 | void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 78 | dvmrp_print(netdissect_options *ndo, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 79 | const u_char *bp, u_int len) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 80 | { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 81 | u_char type; |
| 82 | uint8_t major_version, minor_version; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 83 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 84 | ndo->ndo_protocol = "dvmrp"; |
| 85 | if (len < 8) { |
| 86 | ND_PRINT(" [length %u < 8]", len); |
| 87 | goto invalid; |
| 88 | } |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 89 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 90 | type = GET_U_1(bp + 1); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 91 | |
| 92 | /* Skip IGMP header */ |
| 93 | bp += 8; |
| 94 | len -= 8; |
| 95 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 96 | ND_PRINT(" %s", tok2str(dvmrp_msgtype_str, "[type %u]", type)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 97 | switch (type) { |
| 98 | |
| 99 | case DVMRP_PROBE: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 100 | if (ndo->ndo_vflag) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 101 | print_probe(ndo, bp, len); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 102 | } |
| 103 | break; |
| 104 | |
| 105 | case DVMRP_REPORT: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 106 | if (ndo->ndo_vflag > 1) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 107 | print_report(ndo, bp, len); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 108 | } |
| 109 | break; |
| 110 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 111 | case DVMRP_NEIGHBORS: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 112 | print_neighbors(ndo, bp, len); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 113 | break; |
| 114 | |
| 115 | case DVMRP_NEIGHBORS2: |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 116 | /* |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 117 | * extract version from IGMP group address field |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 118 | */ |
| 119 | bp -= 4; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 120 | major_version = GET_U_1(bp + 3); |
| 121 | minor_version = GET_U_1(bp + 2); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 122 | bp += 4; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 123 | print_neighbors2(ndo, bp, len, major_version, minor_version); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 124 | break; |
| 125 | |
| 126 | case DVMRP_PRUNE: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 127 | ND_PRINT(" src %s grp %s", GET_IPADDR_STRING(bp), GET_IPADDR_STRING(bp + 4)); |
| 128 | ND_PRINT(" timer "); |
| 129 | unsigned_relts_print(ndo, GET_BE_U_4(bp + 8)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 130 | break; |
| 131 | |
| 132 | case DVMRP_GRAFT: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 133 | ND_PRINT(" src %s grp %s", GET_IPADDR_STRING(bp), GET_IPADDR_STRING(bp + 4)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 134 | break; |
| 135 | |
| 136 | case DVMRP_GRAFT_ACK: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 137 | ND_PRINT(" src %s grp %s", GET_IPADDR_STRING(bp), GET_IPADDR_STRING(bp + 4)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 138 | break; |
| 139 | } |
| 140 | return; |
| 141 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 142 | invalid: |
| 143 | nd_print_invalid(ndo); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 144 | } |
| 145 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 146 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 147 | print_report(netdissect_options *ndo, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 148 | const u_char *bp, |
| 149 | u_int len) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 150 | { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 151 | uint32_t mask, origin; |
| 152 | u_int metric, done; |
| 153 | u_int i, width; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 154 | |
| 155 | while (len > 0) { |
| 156 | if (len < 3) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 157 | ND_PRINT(" [length %u < 3]", len); |
| 158 | goto invalid; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 159 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 160 | mask = (uint32_t)0xff << 24 | GET_U_1(bp) << 16 | |
| 161 | GET_U_1(bp + 1) << 8 | GET_U_1(bp + 2); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 162 | width = 1; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 163 | if (GET_U_1(bp)) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 164 | width = 2; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 165 | if (GET_U_1(bp + 1)) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 166 | width = 3; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 167 | if (GET_U_1(bp + 2)) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 168 | width = 4; |
| 169 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 170 | ND_PRINT("\n\tMask %s", intoa(htonl(mask))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 171 | bp += 3; |
| 172 | len -= 3; |
| 173 | do { |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 174 | if (len < width + 1) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 175 | ND_PRINT("\n\t [Truncated Report]"); |
| 176 | goto invalid; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 177 | } |
| 178 | origin = 0; |
| 179 | for (i = 0; i < width; ++i) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 180 | origin = origin << 8 | GET_U_1(bp); |
| 181 | bp++; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 182 | } |
| 183 | for ( ; i < 4; ++i) |
| 184 | origin <<= 8; |
| 185 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 186 | metric = GET_U_1(bp); |
| 187 | bp++; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 188 | done = metric & 0x80; |
| 189 | metric &= 0x7f; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 190 | ND_PRINT("\n\t %s metric %u", intoa(htonl(origin)), |
| 191 | metric); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 192 | len -= width + 1; |
| 193 | } while (!done); |
| 194 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 195 | return; |
| 196 | |
| 197 | invalid: |
| 198 | nd_print_invalid(ndo); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 199 | } |
| 200 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 201 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 202 | print_probe(netdissect_options *ndo, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 203 | const u_char *bp, |
| 204 | u_int len) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 205 | { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 206 | if (len < 4) { |
| 207 | ND_PRINT(" [full length %u < 4]", len); |
| 208 | goto invalid; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 209 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 210 | ND_PRINT(ndo->ndo_vflag > 1 ? "\n\t" : " "); |
| 211 | ND_PRINT("genid %u", GET_BE_U_4(bp)); |
| 212 | if (ndo->ndo_vflag < 2) |
| 213 | return; |
| 214 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 215 | bp += 4; |
| 216 | len -= 4; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 217 | while (len > 0) { |
| 218 | if (len < 4) { |
| 219 | ND_PRINT("[remaining length %u < 4]", len); |
| 220 | goto invalid; |
| 221 | } |
| 222 | ND_PRINT("\n\tneighbor %s", GET_IPADDR_STRING(bp)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 223 | bp += 4; len -= 4; |
| 224 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 225 | return; |
| 226 | |
| 227 | invalid: |
| 228 | nd_print_invalid(ndo); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 229 | } |
| 230 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 231 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 232 | print_neighbors(netdissect_options *ndo, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 233 | const u_char *bp, |
| 234 | u_int len) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 235 | { |
| 236 | const u_char *laddr; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 237 | u_char metric; |
| 238 | u_char thresh; |
| 239 | int ncount; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 240 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 241 | while (len > 0) { |
| 242 | if (len < 7) { |
| 243 | ND_PRINT(" [length %u < 7]", len); |
| 244 | goto invalid; |
| 245 | } |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 246 | laddr = bp; |
| 247 | bp += 4; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 248 | metric = GET_U_1(bp); |
| 249 | bp++; |
| 250 | thresh = GET_U_1(bp); |
| 251 | bp++; |
| 252 | ncount = GET_U_1(bp); |
| 253 | bp++; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 254 | len -= 7; |
| 255 | while (--ncount >= 0) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 256 | if (len < 4) { |
| 257 | ND_PRINT(" [length %u < 4]", len); |
| 258 | goto invalid; |
| 259 | } |
| 260 | ND_PRINT(" [%s ->", GET_IPADDR_STRING(laddr)); |
| 261 | ND_PRINT(" %s, (%u/%u)]", |
| 262 | GET_IPADDR_STRING(bp), metric, thresh); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 263 | bp += 4; |
| 264 | len -= 4; |
| 265 | } |
| 266 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 267 | return; |
| 268 | |
| 269 | invalid: |
| 270 | nd_print_invalid(ndo); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 271 | } |
| 272 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 273 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 274 | print_neighbors2(netdissect_options *ndo, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 275 | const u_char *bp, |
| 276 | u_int len, uint8_t major_version, |
| 277 | uint8_t minor_version) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 278 | { |
| 279 | const u_char *laddr; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 280 | u_char metric, thresh, flags; |
| 281 | int ncount; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 282 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 283 | ND_PRINT(" (v %u.%u):", major_version, minor_version); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 284 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 285 | while (len > 0) { |
| 286 | if (len < 8) { |
| 287 | ND_PRINT(" [length %u < 8]", len); |
| 288 | goto invalid; |
| 289 | } |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 290 | laddr = bp; |
| 291 | bp += 4; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 292 | metric = GET_U_1(bp); |
| 293 | bp++; |
| 294 | thresh = GET_U_1(bp); |
| 295 | bp++; |
| 296 | flags = GET_U_1(bp); |
| 297 | bp++; |
| 298 | ncount = GET_U_1(bp); |
| 299 | bp++; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 300 | len -= 8; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 301 | while (--ncount >= 0 && len > 0) { |
| 302 | if (len < 4) { |
| 303 | ND_PRINT(" [length %u < 4]", len); |
| 304 | goto invalid; |
| 305 | } |
| 306 | ND_PRINT(" [%s -> ", GET_IPADDR_STRING(laddr)); |
| 307 | ND_PRINT("%s (%u/%u", GET_IPADDR_STRING(bp), |
| 308 | metric, thresh); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 309 | if (flags & DVMRP_NF_TUNNEL) |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 310 | ND_PRINT("/tunnel"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 311 | if (flags & DVMRP_NF_SRCRT) |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 312 | ND_PRINT("/srcrt"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 313 | if (flags & DVMRP_NF_QUERIER) |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 314 | ND_PRINT("/querier"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 315 | if (flags & DVMRP_NF_DISABLED) |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 316 | ND_PRINT("/disabled"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 317 | if (flags & DVMRP_NF_DOWN) |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 318 | ND_PRINT("/down"); |
| 319 | ND_PRINT(")]"); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 320 | bp += 4; |
| 321 | len -= 4; |
| 322 | } |
| 323 | if (ncount != -1) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 324 | ND_PRINT(" [invalid ncount]"); |
| 325 | goto invalid; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 326 | } |
| 327 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 328 | return; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 329 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 330 | invalid: |
| 331 | nd_print_invalid(ndo); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 332 | } |