Deleted Added
full compact
print-fddi.c (56896) print-fddi.c (75118)
1/*
2 * Copyright (c) 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

--- 4 unchanged lines hidden (view full) ---

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 *
1/*
2 * Copyright (c) 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

--- 4 unchanged lines hidden (view full) ---

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 * $FreeBSD: head/contrib/tcpdump/print-fddi.c 56896 2000-01-30 01:05:24Z fenner $
21 * $FreeBSD: head/contrib/tcpdump/print-fddi.c 75118 2001-04-03 07:50:46Z fenner $
22 */
23
24#ifndef lint
25static const char rcsid[] =
22 */
23
24#ifndef lint
25static const char rcsid[] =
26 "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.40 1999/12/14 16:49:02 fenner Exp $ (LBL)";
26 "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.50 2000/12/23 20:48:13 guy Exp $ (LBL)";
27#endif
28
29#ifdef HAVE_CONFIG_H
30#include "config.h"
31#endif
32
33#include <sys/param.h>
34#include <sys/time.h>
35#include <sys/socket.h>
36#include <sys/file.h>
37#include <sys/ioctl.h>
38
27#endif
28
29#ifdef HAVE_CONFIG_H
30#include "config.h"
31#endif
32
33#include <sys/param.h>
34#include <sys/time.h>
35#include <sys/socket.h>
36#include <sys/file.h>
37#include <sys/ioctl.h>
38
39#if __STDC__
40struct mbuf;
41struct rtentry;
42#endif
43#include <net/if.h>
44
45#include <netinet/in.h>
39#include <netinet/in.h>
46#include <net/ethernet.h>
47#include <netinet/in_systm.h>
48#include <netinet/ip.h>
49
50#include <ctype.h>
51#include <netdb.h>
52#include <pcap.h>
53#include <stdio.h>
54#include <string.h>
55
56#include "interface.h"
57#include "addrtoname.h"
58#include "ethertype.h"
59
40
41#include <ctype.h>
42#include <netdb.h>
43#include <pcap.h>
44#include <stdio.h>
45#include <string.h>
46
47#include "interface.h"
48#include "addrtoname.h"
49#include "ethertype.h"
50
51#include "ether.h"
60#include "fddi.h"
61
62/*
63 * Some FDDI interfaces use bit-swapped addresses.
64 */
65#if defined(ultrix) || defined(__alpha) || defined(__bsdi) || defined(__NetBSD__)
66int fddi_bitswap = 0;
67#else

--- 25 unchanged lines hidden (view full) ---

93 * Also, to really support FDDI (and better support 802.2
94 * over ethernet) we really need to re-think the rather simple
95 * minded assumptions about fixed length & fixed format link
96 * level headers made in gencode.c. One day...
97 *
98 * - vj
99 */
100
52#include "fddi.h"
53
54/*
55 * Some FDDI interfaces use bit-swapped addresses.
56 */
57#if defined(ultrix) || defined(__alpha) || defined(__bsdi) || defined(__NetBSD__)
58int fddi_bitswap = 0;
59#else

--- 25 unchanged lines hidden (view full) ---

85 * Also, to really support FDDI (and better support 802.2
86 * over ethernet) we really need to re-think the rather simple
87 * minded assumptions about fixed length & fixed format link
88 * level headers made in gencode.c. One day...
89 *
90 * - vj
91 */
92
101#define FDDI_HDRLEN (sizeof(struct fddi_header))
102
103static u_char fddi_bit_swap[] = {
104 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
105 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
106 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
107 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
108 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
109 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
110 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,

--- 175 unchanged lines hidden (view full) ---

286 extract_fddi_addrs(fddip, (char *)ESRC(&ehdr), (char *)EDST(&ehdr));
287 /*
288 * Some printers want to get back at the link level addresses,
289 * and/or check that they're not walking off the end of the packet.
290 * Rather than pass them all the way down, we set these globals.
291 */
292 snapend = p + caplen;
293 /*
93static u_char fddi_bit_swap[] = {
94 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
95 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
96 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
97 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
98 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
99 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
100 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,

--- 175 unchanged lines hidden (view full) ---

276 extract_fddi_addrs(fddip, (char *)ESRC(&ehdr), (char *)EDST(&ehdr));
277 /*
278 * Some printers want to get back at the link level addresses,
279 * and/or check that they're not walking off the end of the packet.
280 * Rather than pass them all the way down, we set these globals.
281 */
282 snapend = p + caplen;
283 /*
294 * Actually, the only printer that uses packetp is print-bootp.c,
295 * and it assumes that packetp points to an Ethernet header. The
296 * right thing to do is to fix print-bootp.c to know which link
297 * type is in use when it excavates. XXX
284 * Actually, the only printers that use packetp are print-arp.c
285 * and print-bootp.c, and they assume that packetp points to an
286 * Ethernet header. The right thing to do is to fix them to know
287 * which link type is in use when they excavate. XXX
298 */
299 packetp = (u_char *)&ehdr;
300
301 if (eflag)
302 fddi_print(fddip, length, ESRC(&ehdr), EDST(&ehdr));
303
304 /* Skip over FDDI MAC header */
305 length -= FDDI_HDRLEN;
306 p += FDDI_HDRLEN;
307 caplen -= FDDI_HDRLEN;
308
309 /* Frame Control field determines interpretation of packet */
310 extracted_ethertype = 0;
311 if ((fddip->fddi_fc & FDDIFC_CLFF) == FDDIFC_LLC_ASYNC) {
312 /* Try to print the LLC-layer header & higher layers */
288 */
289 packetp = (u_char *)&ehdr;
290
291 if (eflag)
292 fddi_print(fddip, length, ESRC(&ehdr), EDST(&ehdr));
293
294 /* Skip over FDDI MAC header */
295 length -= FDDI_HDRLEN;
296 p += FDDI_HDRLEN;
297 caplen -= FDDI_HDRLEN;
298
299 /* Frame Control field determines interpretation of packet */
300 extracted_ethertype = 0;
301 if ((fddip->fddi_fc & FDDIFC_CLFF) == FDDIFC_LLC_ASYNC) {
302 /* Try to print the LLC-layer header & higher layers */
313 if (llc_print(p, length, caplen, ESRC(&ehdr), EDST(&ehdr))
314 == 0) {
303 if (llc_print(p, length, caplen, ESRC(&ehdr), EDST(&ehdr),
304 &extracted_ethertype) == 0) {
315 /*
316 * Some kinds of LLC packet we cannot
317 * handle intelligently
318 */
319 if (!eflag)
305 /*
306 * Some kinds of LLC packet we cannot
307 * handle intelligently
308 */
309 if (!eflag)
320 fddi_print(fddip, length,
310 fddi_print(fddip, length + FDDI_HDRLEN,
321 ESRC(&ehdr), EDST(&ehdr));
322 if (extracted_ethertype) {
323 printf("(LLC %s) ",
324 etherproto_string(htons(extracted_ethertype)));
325 }
326 if (!xflag && !qflag)
327 default_print(p, caplen);
328 }
329 } else if ((fddip->fddi_fc & FDDIFC_CLFF) == FDDIFC_SMT)
330 fddi_smt_print(p, caplen);
331 else {
332 /* Some kinds of FDDI packet we cannot handle intelligently */
333 if (!eflag)
311 ESRC(&ehdr), EDST(&ehdr));
312 if (extracted_ethertype) {
313 printf("(LLC %s) ",
314 etherproto_string(htons(extracted_ethertype)));
315 }
316 if (!xflag && !qflag)
317 default_print(p, caplen);
318 }
319 } else if ((fddip->fddi_fc & FDDIFC_CLFF) == FDDIFC_SMT)
320 fddi_smt_print(p, caplen);
321 else {
322 /* Some kinds of FDDI packet we cannot handle intelligently */
323 if (!eflag)
334 fddi_print(fddip, length, ESRC(&ehdr), EDST(&ehdr));
324 fddi_print(fddip, length + FDDI_HDRLEN, ESRC(&ehdr),
325 EDST(&ehdr));
335 if (!xflag && !qflag)
336 default_print(p, caplen);
337 }
338 if (xflag)
339 default_print(p, caplen);
340out:
341 putchar('\n');
342}
326 if (!xflag && !qflag)
327 default_print(p, caplen);
328 }
329 if (xflag)
330 default_print(p, caplen);
331out:
332 putchar('\n');
333}