Deleted Added
sdiff udiff text old ( 127675 ) new ( 146778 )
full compact
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 $
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 $";
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
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)
99 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 */
121 printf("(NOV-802.3) ");
122 ipx_print(p, length);
123 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) {
132 ip_print(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]);
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 }
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}