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, 2000 |
| 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 | */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 21 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 22 | /* \summary: Ethernet 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 | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 30 | #define ND_LONGJMP_FROM_TCHECK |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 31 | #include "netdissect.h" |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 32 | #include "extract.h" |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 33 | #include "addrtoname.h" |
| 34 | #include "ethertype.h" |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 35 | |
| 36 | /* |
| 37 | * Structure of an Ethernet header. |
| 38 | */ |
| 39 | struct ether_header { |
| 40 | nd_mac_addr ether_dhost; |
| 41 | nd_mac_addr ether_shost; |
| 42 | nd_uint16_t ether_length_type; |
| 43 | }; |
| 44 | |
| 45 | /* |
| 46 | * Length of an Ethernet header; note that some compilers may pad |
| 47 | * "struct ether_header" to a multiple of 4 bytes, for example, so |
| 48 | * "sizeof (struct ether_header)" may not give the right answer. |
| 49 | */ |
| 50 | #define ETHER_HDRLEN 14 |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 51 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 52 | const struct tok ethertype_values[] = { |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 53 | { ETHERTYPE_IP, "IPv4" }, |
| 54 | { ETHERTYPE_MPLS, "MPLS unicast" }, |
| 55 | { ETHERTYPE_MPLS_MULTI, "MPLS multicast" }, |
| 56 | { ETHERTYPE_IPV6, "IPv6" }, |
| 57 | { ETHERTYPE_8021Q, "802.1Q" }, |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 58 | { ETHERTYPE_8021Q9100, "802.1Q-9100" }, |
| 59 | { ETHERTYPE_8021QinQ, "802.1Q-QinQ" }, |
| 60 | { ETHERTYPE_8021Q9200, "802.1Q-9200" }, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 61 | { ETHERTYPE_MACSEC, "802.1AE MACsec" }, |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 62 | { ETHERTYPE_VMAN, "VMAN" }, |
| 63 | { ETHERTYPE_PUP, "PUP" }, |
| 64 | { ETHERTYPE_ARP, "ARP"}, |
| 65 | { ETHERTYPE_REVARP, "Reverse ARP"}, |
| 66 | { ETHERTYPE_NS, "NS" }, |
| 67 | { ETHERTYPE_SPRITE, "Sprite" }, |
| 68 | { ETHERTYPE_TRAIL, "Trail" }, |
| 69 | { ETHERTYPE_MOPDL, "MOP DL" }, |
| 70 | { ETHERTYPE_MOPRC, "MOP RC" }, |
| 71 | { ETHERTYPE_DN, "DN" }, |
| 72 | { ETHERTYPE_LAT, "LAT" }, |
| 73 | { ETHERTYPE_SCA, "SCA" }, |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 74 | { ETHERTYPE_TEB, "TEB" }, |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 75 | { ETHERTYPE_LANBRIDGE, "Lanbridge" }, |
| 76 | { ETHERTYPE_DECDNS, "DEC DNS" }, |
| 77 | { ETHERTYPE_DECDTS, "DEC DTS" }, |
| 78 | { ETHERTYPE_VEXP, "VEXP" }, |
| 79 | { ETHERTYPE_VPROD, "VPROD" }, |
| 80 | { ETHERTYPE_ATALK, "Appletalk" }, |
| 81 | { ETHERTYPE_AARP, "Appletalk ARP" }, |
| 82 | { ETHERTYPE_IPX, "IPX" }, |
| 83 | { ETHERTYPE_PPP, "PPP" }, |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 84 | { ETHERTYPE_MPCP, "MPCP" }, |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 85 | { ETHERTYPE_SLOW, "Slow Protocols" }, |
| 86 | { ETHERTYPE_PPPOED, "PPPoE D" }, |
| 87 | { ETHERTYPE_PPPOES, "PPPoE S" }, |
| 88 | { ETHERTYPE_EAPOL, "EAPOL" }, |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 89 | { ETHERTYPE_RRCP, "RRCP" }, |
| 90 | { ETHERTYPE_MS_NLB_HB, "MS NLB heartbeat" }, |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 91 | { ETHERTYPE_JUMBO, "Jumbo" }, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 92 | { ETHERTYPE_NSH, "NSH" }, |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 93 | { ETHERTYPE_LOOPBACK, "Loopback" }, |
| 94 | { ETHERTYPE_ISO, "OSI" }, |
| 95 | { ETHERTYPE_GRE_ISO, "GRE-OSI" }, |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 96 | { ETHERTYPE_CFM_OLD, "CFM (old)" }, |
| 97 | { ETHERTYPE_CFM, "CFM" }, |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 98 | { ETHERTYPE_IEEE1905_1, "IEEE1905.1" }, |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 99 | { ETHERTYPE_LLDP, "LLDP" }, |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 100 | { ETHERTYPE_TIPC, "TIPC"}, |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 101 | { ETHERTYPE_GEONET_OLD, "GeoNet (old)"}, |
| 102 | { ETHERTYPE_GEONET, "GeoNet"}, |
| 103 | { ETHERTYPE_CALM_FAST, "CALM FAST"}, |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 104 | { ETHERTYPE_AOE, "AoE" }, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 105 | { ETHERTYPE_PTP, "PTP" }, |
| 106 | { ETHERTYPE_ARISTA, "Arista Vendor Specific Protocol" }, |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 107 | { 0, NULL} |
| 108 | }; |
| 109 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 110 | static void |
| 111 | ether_addresses_print(netdissect_options *ndo, const u_char *src, |
| 112 | const u_char *dst) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 113 | { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 114 | ND_PRINT("%s > %s, ", |
| 115 | GET_ETHERADDR_STRING(src), GET_ETHERADDR_STRING(dst)); |
| 116 | } |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 117 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 118 | static void |
| 119 | ether_type_print(netdissect_options *ndo, uint16_t type) |
| 120 | { |
| 121 | if (!ndo->ndo_qflag) |
| 122 | ND_PRINT("ethertype %s (0x%04x)", |
| 123 | tok2str(ethertype_values, "Unknown", type), type); |
| 124 | else |
| 125 | ND_PRINT("%s", |
| 126 | tok2str(ethertype_values, "Unknown Ethertype (0x%04x)", type)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 127 | } |
| 128 | |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 129 | /* |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 130 | * Common code for printing Ethernet frames. |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 131 | * |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 132 | * It can handle Ethernet headers with extra tag information inserted |
| 133 | * after the destination and source addresses, as is inserted by some |
| 134 | * switch chips, and extra encapsulation header information before |
| 135 | * printing Ethernet header information (such as a LANE ID for ATM LANE). |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 136 | */ |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 137 | static u_int |
| 138 | ether_common_print(netdissect_options *ndo, const u_char *p, u_int length, |
| 139 | u_int caplen, |
| 140 | void (*print_switch_tag)(netdissect_options *ndo, const u_char *), |
| 141 | u_int switch_tag_len, |
| 142 | void (*print_encap_header)(netdissect_options *ndo, const u_char *), |
| 143 | const u_char *encap_header_arg) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 144 | { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 145 | const struct ether_header *ehp; |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 146 | u_int orig_length; |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 147 | u_int hdrlen; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 148 | u_short length_type; |
| 149 | int printed_length; |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 150 | int llc_hdrlen; |
| 151 | struct lladdr_info src, dst; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 152 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 153 | if (caplen < ETHER_HDRLEN + switch_tag_len) { |
| 154 | nd_print_trunc(ndo); |
| 155 | return caplen; |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 156 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 157 | if (length < ETHER_HDRLEN + switch_tag_len) { |
| 158 | nd_print_trunc(ndo); |
| 159 | return length; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 160 | } |
| 161 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 162 | if (print_encap_header != NULL) |
| 163 | (*print_encap_header)(ndo, encap_header_arg); |
| 164 | |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 165 | orig_length = length; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 166 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 167 | /* |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 168 | * Get the source and destination addresses, skip past them, |
| 169 | * and print them if we're printing the link-layer header. |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 170 | */ |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 171 | ehp = (const struct ether_header *)p; |
| 172 | src.addr = ehp->ether_shost; |
| 173 | src.addr_string = etheraddr_string; |
| 174 | dst.addr = ehp->ether_dhost; |
| 175 | dst.addr_string = etheraddr_string; |
| 176 | |
| 177 | length -= 2*MAC_ADDR_LEN; |
| 178 | caplen -= 2*MAC_ADDR_LEN; |
| 179 | p += 2*MAC_ADDR_LEN; |
| 180 | hdrlen = 2*MAC_ADDR_LEN; |
| 181 | |
| 182 | if (ndo->ndo_eflag) |
| 183 | ether_addresses_print(ndo, src.addr, dst.addr); |
| 184 | |
| 185 | /* |
| 186 | * Print the switch tag, if we have one, and skip past it. |
| 187 | */ |
| 188 | if (print_switch_tag != NULL) |
| 189 | (*print_switch_tag)(ndo, p); |
| 190 | |
| 191 | length -= switch_tag_len; |
| 192 | caplen -= switch_tag_len; |
| 193 | p += switch_tag_len; |
| 194 | hdrlen += switch_tag_len; |
| 195 | |
| 196 | /* |
| 197 | * Get the length/type field, skip past it, and print it |
| 198 | * if we're printing the link-layer header. |
| 199 | */ |
| 200 | recurse: |
| 201 | length_type = GET_BE_U_2(p); |
| 202 | |
| 203 | length -= 2; |
| 204 | caplen -= 2; |
| 205 | p += 2; |
| 206 | hdrlen += 2; |
| 207 | |
| 208 | /* |
| 209 | * Process 802.1AE MACsec headers. |
| 210 | */ |
| 211 | printed_length = 0; |
| 212 | if (length_type == ETHERTYPE_MACSEC) { |
| 213 | /* |
| 214 | * MACsec, aka IEEE 802.1AE-2006 |
| 215 | * Print the header, and try to print the payload if it's not encrypted |
| 216 | */ |
| 217 | if (ndo->ndo_eflag) { |
| 218 | ether_type_print(ndo, length_type); |
| 219 | ND_PRINT(", length %u: ", orig_length); |
| 220 | printed_length = 1; |
| 221 | } |
| 222 | |
| 223 | int ret = macsec_print(ndo, &p, &length, &caplen, &hdrlen, |
| 224 | &src, &dst); |
| 225 | |
| 226 | if (ret == 0) { |
| 227 | /* Payload is encrypted; print it as raw data. */ |
| 228 | if (!ndo->ndo_suppress_default_print) |
| 229 | ND_DEFAULTPRINT(p, caplen); |
| 230 | return hdrlen; |
| 231 | } else if (ret > 0) { |
| 232 | /* Problem printing the header; just quit. */ |
| 233 | return ret; |
| 234 | } else { |
| 235 | /* |
| 236 | * Keep processing type/length fields. |
| 237 | */ |
| 238 | length_type = GET_BE_U_2(p); |
| 239 | |
| 240 | length -= 2; |
| 241 | caplen -= 2; |
| 242 | p += 2; |
| 243 | hdrlen += 2; |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | /* |
| 248 | * Process VLAN tag types. |
| 249 | */ |
| 250 | while (length_type == ETHERTYPE_8021Q || |
| 251 | length_type == ETHERTYPE_8021Q9100 || |
| 252 | length_type == ETHERTYPE_8021Q9200 || |
| 253 | length_type == ETHERTYPE_8021QinQ) { |
| 254 | /* |
| 255 | * It has a VLAN tag. |
| 256 | * Print VLAN information, and then go back and process |
| 257 | * the enclosed type field. |
| 258 | */ |
| 259 | if (caplen < 4) { |
| 260 | ndo->ndo_protocol = "vlan"; |
| 261 | nd_print_trunc(ndo); |
| 262 | return hdrlen + caplen; |
| 263 | } |
| 264 | if (length < 4) { |
| 265 | ndo->ndo_protocol = "vlan"; |
| 266 | nd_print_trunc(ndo); |
| 267 | return hdrlen + length; |
| 268 | } |
| 269 | if (ndo->ndo_eflag) { |
| 270 | uint16_t tag = GET_BE_U_2(p); |
| 271 | |
| 272 | ether_type_print(ndo, length_type); |
| 273 | if (!printed_length) { |
| 274 | ND_PRINT(", length %u: ", orig_length); |
| 275 | printed_length = 1; |
| 276 | } else |
| 277 | ND_PRINT(", "); |
| 278 | ND_PRINT("%s, ", ieee8021q_tci_string(tag)); |
| 279 | } |
| 280 | |
| 281 | length_type = GET_BE_U_2(p + 2); |
| 282 | p += 4; |
| 283 | length -= 4; |
| 284 | caplen -= 4; |
| 285 | hdrlen += 4; |
| 286 | } |
| 287 | |
| 288 | /* |
| 289 | * We now have the final length/type field. |
| 290 | */ |
| 291 | if (length_type <= MAX_ETHERNET_LENGTH_VAL) { |
| 292 | /* |
| 293 | * It's a length field, containing the length of the |
| 294 | * remaining payload; use it as such, as long as |
| 295 | * it's not too large (bigger than the actual payload). |
| 296 | */ |
| 297 | if (length_type < length) { |
| 298 | length = length_type; |
| 299 | if (caplen > length) |
| 300 | caplen = length; |
| 301 | } |
| 302 | |
| 303 | /* |
| 304 | * Cut off the snapshot length to the end of the |
| 305 | * payload. |
| 306 | */ |
| 307 | nd_push_snapend(ndo, p + length); |
| 308 | |
| 309 | if (ndo->ndo_eflag) { |
| 310 | ND_PRINT("802.3"); |
| 311 | if (!printed_length) |
| 312 | ND_PRINT(", length %u: ", length); |
| 313 | } |
| 314 | |
| 315 | /* |
| 316 | * An LLC header follows the length. Print that and |
| 317 | * higher layers. |
| 318 | */ |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 319 | llc_hdrlen = llc_print(ndo, p, length, caplen, &src, &dst); |
| 320 | if (llc_hdrlen < 0) { |
| 321 | /* packet type not known, print raw packet */ |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 322 | if (!ndo->ndo_suppress_default_print) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 323 | ND_DEFAULTPRINT(p, caplen); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 324 | llc_hdrlen = -llc_hdrlen; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 325 | } |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 326 | hdrlen += llc_hdrlen; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 327 | nd_pop_packet_info(ndo); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 328 | } else if (length_type == ETHERTYPE_JUMBO) { |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 329 | /* |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 330 | * It's a type field, with the type for Alteon jumbo frames. |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 331 | * See |
| 332 | * |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 333 | * https://tools.ietf.org/html/draft-ietf-isis-ext-eth-01 |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 334 | * |
| 335 | * which indicates that, following the type field, |
| 336 | * there's an LLC header and payload. |
| 337 | */ |
| 338 | /* Try to print the LLC-layer header & higher layers */ |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 339 | llc_hdrlen = llc_print(ndo, p, length, caplen, &src, &dst); |
| 340 | if (llc_hdrlen < 0) { |
| 341 | /* packet type not known, print raw packet */ |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 342 | if (!ndo->ndo_suppress_default_print) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 343 | ND_DEFAULTPRINT(p, caplen); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 344 | llc_hdrlen = -llc_hdrlen; |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 345 | } |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 346 | hdrlen += llc_hdrlen; |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 347 | } else if (length_type == ETHERTYPE_ARISTA) { |
| 348 | if (caplen < 2) { |
| 349 | ND_PRINT("[|arista]"); |
| 350 | return hdrlen + caplen; |
| 351 | } |
| 352 | if (length < 2) { |
| 353 | ND_PRINT("[|arista]"); |
| 354 | return hdrlen + length; |
| 355 | } |
| 356 | ether_type_print(ndo, length_type); |
| 357 | ND_PRINT(", length %u: ", orig_length); |
| 358 | int bytesConsumed = arista_ethertype_print(ndo, p, length); |
| 359 | if (bytesConsumed > 0) { |
| 360 | p += bytesConsumed; |
| 361 | length -= bytesConsumed; |
| 362 | caplen -= bytesConsumed; |
| 363 | hdrlen += bytesConsumed; |
| 364 | goto recurse; |
| 365 | } else { |
| 366 | /* subtype/version not known, print raw packet */ |
| 367 | if (!ndo->ndo_eflag && length_type > MAX_ETHERNET_LENGTH_VAL) { |
| 368 | ether_addresses_print(ndo, src.addr, dst.addr); |
| 369 | ether_type_print(ndo, length_type); |
| 370 | ND_PRINT(", length %u: ", orig_length); |
| 371 | } |
| 372 | if (!ndo->ndo_suppress_default_print) |
| 373 | ND_DEFAULTPRINT(p, caplen); |
| 374 | } |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 375 | } else { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 376 | /* |
| 377 | * It's a type field with some other value. |
| 378 | */ |
| 379 | if (ndo->ndo_eflag) { |
| 380 | ether_type_print(ndo, length_type); |
| 381 | if (!printed_length) |
| 382 | ND_PRINT(", length %u: ", orig_length); |
| 383 | else |
| 384 | ND_PRINT(", "); |
| 385 | } |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 386 | if (ethertype_print(ndo, length_type, p, length, caplen, &src, &dst) == 0) { |
| 387 | /* type not known, print raw packet */ |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 388 | if (!ndo->ndo_eflag) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 389 | /* |
| 390 | * We didn't print the full link-layer |
| 391 | * header, as -e wasn't specified, so |
| 392 | * print only the source and destination |
| 393 | * MAC addresses and the final Ethernet |
| 394 | * type. |
| 395 | */ |
| 396 | ether_addresses_print(ndo, src.addr, dst.addr); |
| 397 | ether_type_print(ndo, length_type); |
| 398 | ND_PRINT(", length %u: ", orig_length); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 399 | } |
| 400 | |
| 401 | if (!ndo->ndo_suppress_default_print) |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 402 | ND_DEFAULTPRINT(p, caplen); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 403 | } |
| 404 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 405 | return hdrlen; |
| 406 | } |
| 407 | |
| 408 | /* |
| 409 | * Print an Ethernet frame while specyfing a non-standard Ethernet header |
| 410 | * length. |
| 411 | * This might be encapsulated within another frame; we might be passed |
| 412 | * a pointer to a function that can print header information for that |
| 413 | * frame's protocol, and an argument to pass to that function. |
| 414 | * |
| 415 | * FIXME: caplen can and should be derived from ndo->ndo_snapend and p. |
| 416 | */ |
| 417 | u_int |
| 418 | ether_switch_tag_print(netdissect_options *ndo, const u_char *p, u_int length, |
| 419 | u_int caplen, |
| 420 | void (*print_switch_tag)(netdissect_options *, const u_char *), |
| 421 | u_int switch_tag_len) |
| 422 | { |
| 423 | return ether_common_print(ndo, p, length, caplen, print_switch_tag, |
| 424 | switch_tag_len, NULL, NULL); |
| 425 | } |
| 426 | |
| 427 | /* |
| 428 | * Print an Ethernet frame. |
| 429 | * This might be encapsulated within another frame; we might be passed |
| 430 | * a pointer to a function that can print header information for that |
| 431 | * frame's protocol, and an argument to pass to that function. |
| 432 | * |
| 433 | * FIXME: caplen can and should be derived from ndo->ndo_snapend and p. |
| 434 | */ |
| 435 | u_int |
| 436 | ether_print(netdissect_options *ndo, |
| 437 | const u_char *p, u_int length, u_int caplen, |
| 438 | void (*print_encap_header)(netdissect_options *ndo, const u_char *), |
| 439 | const u_char *encap_header_arg) |
| 440 | { |
| 441 | ndo->ndo_protocol = "ether"; |
| 442 | return ether_common_print(ndo, p, length, caplen, NULL, 0, |
| 443 | print_encap_header, encap_header_arg); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 444 | } |
| 445 | |
| 446 | /* |
| 447 | * This is the top level routine of the printer. 'p' points |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 448 | * to the ether header of the packet, 'h->len' is the length |
| 449 | * of the packet off the wire, and 'h->caplen' is the number |
| 450 | * of bytes actually captured. |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 451 | */ |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 452 | void |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 453 | ether_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 454 | const u_char *p) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 455 | { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 456 | ndo->ndo_protocol = "ether"; |
| 457 | ndo->ndo_ll_hdr_len += |
| 458 | ether_print(ndo, p, h->len, h->caplen, NULL, NULL); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 459 | } |
| 460 | |
| 461 | /* |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 462 | * This is the top level routine of the printer. 'p' points |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 463 | * to the ether header of the packet, 'h->len' is the length |
| 464 | * of the packet off the wire, and 'h->caplen' is the number |
| 465 | * of bytes actually captured. |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 466 | * |
| 467 | * This is for DLT_NETANALYZER, which has a 4-byte pseudo-header |
| 468 | * before the Ethernet header. |
| 469 | */ |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 470 | void |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 471 | netanalyzer_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 472 | const u_char *p) |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 473 | { |
| 474 | /* |
| 475 | * Fail if we don't have enough data for the Hilscher pseudo-header. |
| 476 | */ |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 477 | ndo->ndo_protocol = "netanalyzer"; |
| 478 | ND_TCHECK_LEN(p, 4); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 479 | |
| 480 | /* Skip the pseudo-header. */ |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 481 | ndo->ndo_ll_hdr_len += 4; |
| 482 | ndo->ndo_ll_hdr_len += |
| 483 | ether_print(ndo, p + 4, h->len - 4, h->caplen - 4, NULL, NULL); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 484 | } |
| 485 | |
| 486 | /* |
| 487 | * This is the top level routine of the printer. 'p' points |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 488 | * to the ether header of the packet, 'h->len' is the length |
| 489 | * of the packet off the wire, and 'h->caplen' is the number |
| 490 | * of bytes actually captured. |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 491 | * |
| 492 | * This is for DLT_NETANALYZER_TRANSPARENT, which has a 4-byte |
| 493 | * pseudo-header, a 7-byte Ethernet preamble, and a 1-byte Ethernet SOF |
| 494 | * before the Ethernet header. |
| 495 | */ |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 496 | void |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 497 | netanalyzer_transparent_if_print(netdissect_options *ndo, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 498 | const struct pcap_pkthdr *h, |
| 499 | const u_char *p) |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 500 | { |
| 501 | /* |
| 502 | * Fail if we don't have enough data for the Hilscher pseudo-header, |
| 503 | * preamble, and SOF. |
| 504 | */ |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 505 | ndo->ndo_protocol = "netanalyzer_transparent"; |
| 506 | ND_TCHECK_LEN(p, 12); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 507 | |
| 508 | /* Skip the pseudo-header, preamble, and SOF. */ |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 509 | ndo->ndo_ll_hdr_len += 12; |
| 510 | ndo->ndo_ll_hdr_len += |
| 511 | ether_print(ndo, p + 12, h->len - 12, h->caplen - 12, NULL, NULL); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 512 | } |
| 513 | |
| 514 | /* |
| 515 | * Prints the packet payload, given an Ethernet type code for the payload's |
| 516 | * protocol. |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 517 | * |
| 518 | * Returns non-zero if it can do so, zero if the ethertype is unknown. |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 519 | */ |
| 520 | |
| 521 | int |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 522 | ethertype_print(netdissect_options *ndo, |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 523 | u_short ether_type, const u_char *p, |
| 524 | u_int length, u_int caplen, |
| 525 | const struct lladdr_info *src, const struct lladdr_info *dst) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 526 | { |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 527 | switch (ether_type) { |
| 528 | |
| 529 | case ETHERTYPE_IP: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 530 | ip_print(ndo, p, length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 531 | return (1); |
| 532 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 533 | case ETHERTYPE_IPV6: |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 534 | ip6_print(ndo, p, length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 535 | return (1); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 536 | |
| 537 | case ETHERTYPE_ARP: |
| 538 | case ETHERTYPE_REVARP: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 539 | arp_print(ndo, p, length, caplen); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 540 | return (1); |
| 541 | |
| 542 | case ETHERTYPE_DN: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 543 | decnet_print(ndo, p, length, caplen); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 544 | return (1); |
| 545 | |
| 546 | case ETHERTYPE_ATALK: |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 547 | if (ndo->ndo_vflag) |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 548 | ND_PRINT("et1 "); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 549 | atalk_print(ndo, p, length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 550 | return (1); |
| 551 | |
| 552 | case ETHERTYPE_AARP: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 553 | aarp_print(ndo, p, length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 554 | return (1); |
| 555 | |
| 556 | case ETHERTYPE_IPX: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 557 | ND_PRINT("(NOV-ETHII) "); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 558 | ipx_print(ndo, p, length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 559 | return (1); |
| 560 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 561 | case ETHERTYPE_ISO: |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 562 | if (length == 0 || caplen == 0) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 563 | ndo->ndo_protocol = "isoclns"; |
| 564 | nd_print_trunc(ndo); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 565 | return (1); |
| 566 | } |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 567 | /* At least one byte is required */ |
| 568 | /* FIXME: Reference for this byte? */ |
| 569 | ND_TCHECK_LEN(p, 1); |
Elliott Hughes | cec480a | 2017-12-19 16:54:57 -0800 | [diff] [blame] | 570 | isoclns_print(ndo, p + 1, length - 1); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 571 | return(1); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 572 | |
| 573 | case ETHERTYPE_PPPOED: |
| 574 | case ETHERTYPE_PPPOES: |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 575 | case ETHERTYPE_PPPOED2: |
| 576 | case ETHERTYPE_PPPOES2: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 577 | pppoe_print(ndo, p, length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 578 | return (1); |
| 579 | |
| 580 | case ETHERTYPE_EAPOL: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 581 | eapol_print(ndo, p); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 582 | return (1); |
| 583 | |
| 584 | case ETHERTYPE_RRCP: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 585 | rrcp_print(ndo, p, length, src, dst); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 586 | return (1); |
| 587 | |
| 588 | case ETHERTYPE_PPP: |
| 589 | if (length) { |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 590 | ND_PRINT(": "); |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 591 | ppp_print(ndo, p, length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 592 | } |
| 593 | return (1); |
| 594 | |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 595 | case ETHERTYPE_MPCP: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 596 | mpcp_print(ndo, p, length); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 597 | return (1); |
| 598 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 599 | case ETHERTYPE_SLOW: |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 600 | slow_print(ndo, p, length); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 601 | return (1); |
| 602 | |
| 603 | case ETHERTYPE_CFM: |
| 604 | case ETHERTYPE_CFM_OLD: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 605 | cfm_print(ndo, p, length); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 606 | return (1); |
| 607 | |
| 608 | case ETHERTYPE_LLDP: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 609 | lldp_print(ndo, p, length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 610 | return (1); |
| 611 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 612 | case ETHERTYPE_NSH: |
| 613 | nsh_print(ndo, p, length); |
| 614 | return (1); |
| 615 | |
| 616 | case ETHERTYPE_LOOPBACK: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 617 | loopback_print(ndo, p, length); |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 618 | return (1); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 619 | |
| 620 | case ETHERTYPE_MPLS: |
| 621 | case ETHERTYPE_MPLS_MULTI: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 622 | mpls_print(ndo, p, length); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 623 | return (1); |
| 624 | |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 625 | case ETHERTYPE_TIPC: |
| 626 | tipc_print(ndo, p, length, caplen); |
| 627 | return (1); |
| 628 | |
| 629 | case ETHERTYPE_MS_NLB_HB: |
| 630 | msnlb_print(ndo, p); |
| 631 | return (1); |
| 632 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 633 | case ETHERTYPE_GEONET_OLD: |
| 634 | case ETHERTYPE_GEONET: |
| 635 | geonet_print(ndo, p, length, src); |
| 636 | return (1); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 637 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 638 | case ETHERTYPE_CALM_FAST: |
| 639 | calm_fast_print(ndo, p, length, src); |
| 640 | return (1); |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 641 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 642 | case ETHERTYPE_AOE: |
| 643 | aoe_print(ndo, p, length); |
| 644 | return (1); |
| 645 | |
Elliott Hughes | 820eced | 2021-08-20 18:00:50 -0700 | [diff] [blame] | 646 | case ETHERTYPE_PTP: |
| 647 | ptp_print(ndo, p, length); |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 648 | return (1); |
| 649 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 650 | case ETHERTYPE_LAT: |
| 651 | case ETHERTYPE_SCA: |
| 652 | case ETHERTYPE_MOPRC: |
| 653 | case ETHERTYPE_MOPDL: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 654 | case ETHERTYPE_IEEE1905_1: |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 655 | /* default_print for now */ |
| 656 | default: |
| 657 | return (0); |
| 658 | } |
| 659 | } |