Deleted Added
full compact
print-sll.c (190207) print-sll.c (214478)
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

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

80 */
81 (void)printf("802.3");
82 break;
83
84 case LINUX_SLL_P_802_2:
85 /*
86 * 802.2.
87 */
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

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

80 */
81 (void)printf("802.3");
82 break;
83
84 case LINUX_SLL_P_802_2:
85 /*
86 * 802.2.
87 */
88 (void)printf("802.3");
88 (void)printf("802.2");
89 break;
90
91 default:
92 /*
93 * What is it?
94 */
95 (void)printf("ethertype Unknown (0x%04x)",
96 ether_type);

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

137
138 /*
139 * Go past the cooked-mode header.
140 */
141 length -= SLL_HDR_LEN;
142 caplen -= SLL_HDR_LEN;
143 p += SLL_HDR_LEN;
144
89 break;
90
91 default:
92 /*
93 * What is it?
94 */
95 (void)printf("ethertype Unknown (0x%04x)",
96 ether_type);

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

137
138 /*
139 * Go past the cooked-mode header.
140 */
141 length -= SLL_HDR_LEN;
142 caplen -= SLL_HDR_LEN;
143 p += SLL_HDR_LEN;
144
145 ether_type = ntohs(sllp->sll_protocol);
145 ether_type = EXTRACT_16BITS(&sllp->sll_protocol);
146
146
147recurse:
147 /*
148 * Is it (gag) an 802.3 encapsulation, or some non-Ethernet
149 * packet type?
150 */
151 if (ether_type <= ETHERMTU) {
152 /*
153 * Yes - what type is it?
154 */

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

182 if (extracted_ethertype) {
183 printf("(LLC %s) ",
184 etherproto_string(htons(extracted_ethertype)));
185 }
186 if (!suppress_default_print)
187 default_print(p, caplen);
188 break;
189 }
148 /*
149 * Is it (gag) an 802.3 encapsulation, or some non-Ethernet
150 * packet type?
151 */
152 if (ether_type <= ETHERMTU) {
153 /*
154 * Yes - what type is it?
155 */

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

183 if (extracted_ethertype) {
184 printf("(LLC %s) ",
185 etherproto_string(htons(extracted_ethertype)));
186 }
187 if (!suppress_default_print)
188 default_print(p, caplen);
189 break;
190 }
190 } else if (ether_encap_print(ether_type, p, length, caplen,
191 &extracted_ethertype) == 0) {
192 /* ether_type not known, print raw packet */
193 if (!eflag)
194 sll_print(sllp, length + SLL_HDR_LEN);
195 if (!suppress_default_print)
196 default_print(p, caplen);
191 } else if (ether_type == ETHERTYPE_8021Q) {
192 /*
193 * Print VLAN information, and then go back and process
194 * the enclosed type field.
195 */
196 if (caplen < 4 || length < 4) {
197 printf("[|vlan]");
198 return (SLL_HDR_LEN);
199 }
200 if (eflag) {
201 u_int16_t tag = EXTRACT_16BITS(p);
202
203 printf("vlan %u, p %u%s, ",
204 tag & 0xfff,
205 tag >> 13,
206 (tag & 0x1000) ? ", CFI" : "");
207 }
208
209 ether_type = EXTRACT_16BITS(p + 2);
210 if (ether_type <= ETHERMTU)
211 ether_type = LINUX_SLL_P_802_2;
212 if (!qflag) {
213 (void)printf("ethertype %s, ",
214 tok2str(ethertype_values, "Unknown", ether_type));
215 }
216 p += 4;
217 length -= 4;
218 caplen -= 4;
219 goto recurse;
220 } else {
221 if (ethertype_print(ether_type, p, length, caplen) == 0) {
222 /* ether_type not known, print raw packet */
223 if (!eflag)
224 sll_print(sllp, length + SLL_HDR_LEN);
225 if (!suppress_default_print)
226 default_print(p, caplen);
227 }
197 }
198
199 return (SLL_HDR_LEN);
200}
228 }
229
230 return (SLL_HDR_LEN);
231}