print-arcnet.c (276788) | print-arcnet.c (285275) |
---|---|
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 --- 167 unchanged lines hidden (view full) --- 176 u_int caplen = h->caplen; 177 u_int length = h->len; 178 const struct arc_header *ap; 179 180 int phds, flag = 0, archdrlen = 0; 181 u_int seqid = 0; 182 u_char arc_type; 183 | 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 --- 167 unchanged lines hidden (view full) --- 176 u_int caplen = h->caplen; 177 u_int length = h->len; 178 const struct arc_header *ap; 179 180 int phds, flag = 0, archdrlen = 0; 181 u_int seqid = 0; 182 u_char arc_type; 183 |
184 if (caplen < ARC_HDRLEN) { | 184 if (caplen < ARC_HDRLEN || length < ARC_HDRLEN) { |
185 ND_PRINT((ndo, "[|arcnet]")); 186 return (caplen); 187 } 188 189 ap = (const struct arc_header *)p; 190 arc_type = ap->arc_type; 191 192 switch (arc_type) { --- 4 unchanged lines hidden (view full) --- 197 case ARCTYPE_ARP_OLD: 198 case ARCTYPE_DIAGNOSE: 199 phds = 0; 200 archdrlen = ARC_HDRLEN; 201 break; 202 } 203 204 if (phds) { | 185 ND_PRINT((ndo, "[|arcnet]")); 186 return (caplen); 187 } 188 189 ap = (const struct arc_header *)p; 190 arc_type = ap->arc_type; 191 192 switch (arc_type) { --- 4 unchanged lines hidden (view full) --- 197 case ARCTYPE_ARP_OLD: 198 case ARCTYPE_DIAGNOSE: 199 phds = 0; 200 archdrlen = ARC_HDRLEN; 201 break; 202 } 203 204 if (phds) { |
205 if (caplen < ARC_HDRNEWLEN) { | 205 if (caplen < ARC_HDRNEWLEN || length < ARC_HDRNEWLEN) { |
206 arcnet_print(ndo, p, length, 0, 0, 0); 207 ND_PRINT((ndo, "[|phds]")); 208 return (caplen); 209 } 210 211 if (ap->arc_flag == 0xff) { | 206 arcnet_print(ndo, p, length, 0, 0, 0); 207 ND_PRINT((ndo, "[|phds]")); 208 return (caplen); 209 } 210 211 if (ap->arc_flag == 0xff) { |
212 if (caplen < ARC_HDRNEWLEN_EXC) { | 212 if (caplen < ARC_HDRNEWLEN_EXC || length < ARC_HDRNEWLEN_EXC) { |
213 arcnet_print(ndo, p, length, 0, 0, 0); 214 ND_PRINT((ndo, "[|phds extended]")); 215 return (caplen); 216 } 217 flag = ap->arc_flag2; 218 seqid = EXTRACT_16BITS(&ap->arc_seqid2); 219 archdrlen = ARC_HDRNEWLEN_EXC; 220 } else { --- 42 unchanged lines hidden (view full) --- 263{ 264 u_int caplen = h->caplen; 265 u_int length = h->len; 266 const struct arc_linux_header *ap; 267 268 int archdrlen = 0; 269 u_char arc_type; 270 | 213 arcnet_print(ndo, p, length, 0, 0, 0); 214 ND_PRINT((ndo, "[|phds extended]")); 215 return (caplen); 216 } 217 flag = ap->arc_flag2; 218 seqid = EXTRACT_16BITS(&ap->arc_seqid2); 219 archdrlen = ARC_HDRNEWLEN_EXC; 220 } else { --- 42 unchanged lines hidden (view full) --- 263{ 264 u_int caplen = h->caplen; 265 u_int length = h->len; 266 const struct arc_linux_header *ap; 267 268 int archdrlen = 0; 269 u_char arc_type; 270 |
271 if (caplen < ARC_LINUX_HDRLEN) { | 271 if (caplen < ARC_LINUX_HDRLEN || length < ARC_LINUX_HDRLEN) { |
272 ND_PRINT((ndo, "[|arcnet]")); 273 return (caplen); 274 } 275 276 ap = (const struct arc_linux_header *)p; 277 arc_type = ap->arc_type; 278 279 switch (arc_type) { 280 default: 281 archdrlen = ARC_LINUX_HDRNEWLEN; | 272 ND_PRINT((ndo, "[|arcnet]")); 273 return (caplen); 274 } 275 276 ap = (const struct arc_linux_header *)p; 277 arc_type = ap->arc_type; 278 279 switch (arc_type) { 280 default: 281 archdrlen = ARC_LINUX_HDRNEWLEN; |
282 if (caplen < ARC_LINUX_HDRNEWLEN) { | 282 if (caplen < ARC_LINUX_HDRNEWLEN || length < ARC_LINUX_HDRNEWLEN) { |
283 ND_PRINT((ndo, "[|arcnet]")); 284 return (caplen); 285 } 286 break; 287 case ARCTYPE_IP_OLD: 288 case ARCTYPE_ARP_OLD: 289 case ARCTYPE_DIAGNOSE: 290 archdrlen = ARC_LINUX_HDRLEN; --- 30 unchanged lines hidden (view full) --- 321{ 322 switch (arctype) { 323 324 case ARCTYPE_IP_OLD: 325 case ARCTYPE_IP: 326 ip_print(ndo, p, length); 327 return (1); 328 | 283 ND_PRINT((ndo, "[|arcnet]")); 284 return (caplen); 285 } 286 break; 287 case ARCTYPE_IP_OLD: 288 case ARCTYPE_ARP_OLD: 289 case ARCTYPE_DIAGNOSE: 290 archdrlen = ARC_LINUX_HDRLEN; --- 30 unchanged lines hidden (view full) --- 321{ 322 switch (arctype) { 323 324 case ARCTYPE_IP_OLD: 325 case ARCTYPE_IP: 326 ip_print(ndo, p, length); 327 return (1); 328 |
329#ifdef INET6 | |
330 case ARCTYPE_INET6: 331 ip6_print(ndo, p, length); 332 return (1); | 329 case ARCTYPE_INET6: 330 ip6_print(ndo, p, length); 331 return (1); |
333#endif /*INET6*/ | |
334 335 case ARCTYPE_ARP_OLD: 336 case ARCTYPE_ARP: 337 case ARCTYPE_REVARP: 338 arp_print(ndo, p, length, caplen); 339 return (1); 340 341 case ARCTYPE_ATALK: /* XXX was this ever used? */ --- 20 unchanged lines hidden --- | 332 333 case ARCTYPE_ARP_OLD: 334 case ARCTYPE_ARP: 335 case ARCTYPE_REVARP: 336 arp_print(ndo, p, length, caplen); 337 return (1); 338 339 case ARCTYPE_ATALK: /* XXX was this ever used? */ --- 20 unchanged lines hidden --- |