Deleted Added
full compact
print-llc.c (127675) print-llc.c (146778)
1/*
2 * Copyright (c) 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

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

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 * Code by Matt Thomas, Digital Equipment Corporation
22 * with an awful lot of hacking by Jeffrey Mogul, DECWRL
23 *
1/*
2 * Copyright (c) 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

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

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 * Code by Matt Thomas, Digital Equipment Corporation
22 * with an awful lot of hacking by Jeffrey Mogul, DECWRL
23 *
24 * $FreeBSD: head/contrib/tcpdump/print-llc.c 127675 2004-03-31 14:57:24Z bms $
24 * $FreeBSD: head/contrib/tcpdump/print-llc.c 146778 2005-05-29 19:09:28Z sam $
25 */
26
27#ifndef lint
28static const char rcsid[] _U_ =
25 */
26
27#ifndef lint
28static const char rcsid[] _U_ =
29 "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.53.2.3 2003/12/29 22:33:18 hannes Exp $";
29 "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.61 2005/04/06 21:32:41 mcr Exp $";
30#endif
31
32#ifdef HAVE_CONFIG_H
33#include "config.h"
34#endif
35
36#include <tcpdump-stdinc.h>
37
38#include <stdio.h>
39#include <string.h>
40
41#include "interface.h"
42#include "addrtoname.h"
43#include "extract.h" /* must come after interface.h */
44
45#include "llc.h"
46#include "ethertype.h"
30#endif
31
32#ifdef HAVE_CONFIG_H
33#include "config.h"
34#endif
35
36#include <tcpdump-stdinc.h>
37
38#include <stdio.h>
39#include <string.h>
40
41#include "interface.h"
42#include "addrtoname.h"
43#include "extract.h" /* must come after interface.h */
44
45#include "llc.h"
46#include "ethertype.h"
47#include "oui.h"
47
48static struct tok llc_values[] = {
49 { LLCSAP_NULL, "Null" },
50 { LLCSAP_GLOBAL, "Global" },
51 { LLCSAP_8021B_I, "802.1B I" },
52 { LLCSAP_8021B_G, "802.1B G" },
53 { LLCSAP_IP, "IP" },
54 { LLCSAP_PROWAYNM, "ProWay NM" },

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

91 default_print((u_char *)p, caplen);
92 return(0);
93 }
94
95 /* Watch out for possible alignment problems */
96 memcpy((char *)&llc, (char *)p, min(caplen, sizeof(llc)));
97
98 if (eflag)
48
49static struct tok llc_values[] = {
50 { LLCSAP_NULL, "Null" },
51 { LLCSAP_GLOBAL, "Global" },
52 { LLCSAP_8021B_I, "802.1B I" },
53 { LLCSAP_8021B_G, "802.1B G" },
54 { LLCSAP_IP, "IP" },
55 { LLCSAP_PROWAYNM, "ProWay NM" },

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

92 default_print((u_char *)p, caplen);
93 return(0);
94 }
95
96 /* Watch out for possible alignment problems */
97 memcpy((char *)&llc, (char *)p, min(caplen, sizeof(llc)));
98
99 if (eflag)
99 printf("LLC, dsap %s (0x%02x), ssap %s (0x%02x), cmd 0x%02x, ",
100 printf("LLC, dsap %s (0x%02x), ssap %s (0x%02x), cmd 0x%02x: ",
100 tok2str(llc_values,"Unknown",llc.dsap),
101 llc.dsap,
102 tok2str(llc_values,"Unknown",llc.ssap),
103 llc.ssap,
104 llc.llcu);
105
106 if (llc.ssap == LLCSAP_GLOBAL && llc.dsap == LLCSAP_GLOBAL) {
107 /*

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

113 * with a signature of two bytes of 0xFF (which is
114 * LLCSAP_GLOBAL).
115 *
116 * (It might also have been an Ethernet_802.3 IPX at
117 * one time, but got bridged onto another network,
118 * such as an 802.11 network; this has appeared in at
119 * least one capture file.)
120 */
101 tok2str(llc_values,"Unknown",llc.dsap),
102 llc.dsap,
103 tok2str(llc_values,"Unknown",llc.ssap),
104 llc.ssap,
105 llc.llcu);
106
107 if (llc.ssap == LLCSAP_GLOBAL && llc.dsap == LLCSAP_GLOBAL) {
108 /*

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

114 * with a signature of two bytes of 0xFF (which is
115 * LLCSAP_GLOBAL).
116 *
117 * (It might also have been an Ethernet_802.3 IPX at
118 * one time, but got bridged onto another network,
119 * such as an 802.11 network; this has appeared in at
120 * least one capture file.)
121 */
121 printf("(NOV-802.3) ");
122 ipx_print(p, length);
123 return (1);
122
123 if (eflag)
124 printf("IPX-802.3: ");
125
126 ipx_print(p, length);
127 return (1);
124 }
125
126 if (llc.ssap == LLCSAP_8021D && llc.dsap == LLCSAP_8021D) {
127 stp_print(p, length);
128 return (1);
129 }
130
131 if (llc.ssap == LLCSAP_IP && llc.dsap == LLCSAP_IP) {
128 }
129
130 if (llc.ssap == LLCSAP_8021D && llc.dsap == LLCSAP_8021D) {
131 stp_print(p, length);
132 return (1);
133 }
134
135 if (llc.ssap == LLCSAP_IP && llc.dsap == LLCSAP_IP) {
132 ip_print(p+4, length-4);
136 ip_print(gndo, p+4, length-4);
133 return (1);
134 }
135
136 if (llc.ssap == LLCSAP_IPX && llc.dsap == LLCSAP_IPX &&
137 llc.llcui == LLC_UI) {
138 /*
139 * This is an Ethernet_802.2 IPX frame, with an 802.3
140 * header and an 802.2 LLC header with the source and

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

213 }
214
215 caplen -= sizeof(llc);
216 length -= sizeof(llc);
217 p += sizeof(llc);
218
219 orgcode = EXTRACT_24BITS(&llc.llc_orgcode[0]);
220 et = EXTRACT_16BITS(&llc.llc_ethertype[0]);
137 return (1);
138 }
139
140 if (llc.ssap == LLCSAP_IPX && llc.dsap == LLCSAP_IPX &&
141 llc.llcui == LLC_UI) {
142 /*
143 * This is an Ethernet_802.2 IPX frame, with an 802.3
144 * header and an 802.2 LLC header with the source and

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

217 }
218
219 caplen -= sizeof(llc);
220 length -= sizeof(llc);
221 p += sizeof(llc);
222
223 orgcode = EXTRACT_24BITS(&llc.llc_orgcode[0]);
224 et = EXTRACT_16BITS(&llc.llc_ethertype[0]);
225
226 if (eflag)
227 (void)printf("oui %s (0x%06x), ethertype %s (0x%04x): ",
228 tok2str(oui_values,"Unknown",orgcode),
229 orgcode,
230 tok2str(ethertype_values,"Unknown", et),
231 et);
232
221 /*
222 * XXX - what *is* the right bridge pad value here?
223 * Does anybody ever bridge one form of LAN traffic
224 * over a networking type that uses 802.2 LLC?
225 */
226 ret = snap_print(p, length, caplen, extracted_ethertype,
227 orgcode, et, 2);
228 if (ret)

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

305 LLC_I_NS(control),
306 LLC_IS_NR(control),
307 f);
308 }
309 p += 4;
310 length -= 4;
311 caplen -= 4;
312 }
233 /*
234 * XXX - what *is* the right bridge pad value here?
235 * Does anybody ever bridge one form of LAN traffic
236 * over a networking type that uses 802.2 LLC?
237 */
238 ret = snap_print(p, length, caplen, extracted_ethertype,
239 orgcode, et, 2);
240 if (ret)

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

317 LLC_I_NS(control),
318 LLC_IS_NR(control),
319 f);
320 }
321 p += 4;
322 length -= 4;
323 caplen -= 4;
324 }
313 (void)printf(" len=%d", length);
314 return(1);
315}
316
317int
318snap_print(const u_char *p, u_int length, u_int caplen,
319 u_short *extracted_ethertype, u_int32_t orgcode, u_short et,
320 u_int bridge_pad)
321{

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

424
425 case PID_RFC2684_BPDU:
426 stp_print(p, length);
427 return (1);
428 }
429 }
430 return (0);
431}
325 return(1);
326}
327
328int
329snap_print(const u_char *p, u_int length, u_int caplen,
330 u_short *extracted_ethertype, u_int32_t orgcode, u_short et,
331 u_int bridge_pad)
332{

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

435
436 case PID_RFC2684_BPDU:
437 stp_print(p, length);
438 return (1);
439 }
440 }
441 return (0);
442}
443
444
445/*
446 * Local Variables:
447 * c-style: whitesmith
448 * c-basic-offset: 8
449 * End:
450 */