1diff -Nurb linux/include/linux/if_ether.h linux.p/include/linux/if_ether.h
2--- linux/include/linux/if_ether.h	Mon Jun  4 17:51:51 2001
3+++ linux.p/include/linux/if_ether.h	Mon Jun  4 16:10:17 2001
4@@ -33,8 +33,7 @@
5 #define ETH_FRAME_LEN	1514		/* Max. octets in frame sans FCS */
6 
7 
8-#ifdef 	CONFIG_VLAN_802_1Q
9-
10+#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE))
11 
12 #define VLAN_ETH_ALEN	6		/* Octets in one ethernet addr	 */
13 #define VLAN_ETH_HLEN	18		/* Total octets in header.	 */
14@@ -58,9 +57,7 @@
15    unsigned short	h_vlan_encapsulated_proto; /* packet type ID field (or len) */
16 };
17 
18-
19-#endif
20-
21+#endif /* CONFIG_VLAN_802_1Q ... */
22 
23 /*
24  *	These are the defined Ethernet Protocol ID's.
25diff -Nurb linux/include/linux/netdevice.h linux.p/include/linux/netdevice.h
26--- linux/include/linux/netdevice.h	Mon Jun  4 17:51:51 2001
27+++ linux.p/include/linux/netdevice.h	Mon Jun  4 16:10:48 2001
28@@ -37,14 +37,11 @@
29 #ifdef CONFIG_NET_PROFILE
30 #include <net/profile.h>
31 #endif
32-
33-#if (defined(CONFIG_VLAN_802_1Q))
34-struct vlan_dev_info;
35-#endif
36-
37 #endif
38 
39-
40+#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE))
41+struct vlan_dev_info;
42+#endif /* CONFIG_VLAN_802_1Q ... */
43 
44 struct divert_blk;
45 
46@@ -60,11 +57,11 @@
47  */
48  
49 #if !defined(CONFIG_AX25) && !defined(CONFIG_AX25_MODULE) && !defined(CONFIG_TR)
50-#if defined(CONFIG_VLAN_802_1Q)
51+#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE))
52 #define LL_MAX_HEADER	36
53 #else
54 #define LL_MAX_HEADER	32
55-#endif
56+#endif /* CONFIG_VLAN_802_1Q ... */
57 #else
58 #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
59 #define LL_MAX_HEADER	96
60@@ -168,17 +165,16 @@
61 	atomic_t	hh_refcnt;	/* number of users                   */
62 	unsigned short  hh_type;	/* protocol identifier, f.e ETH_P_IP
63                                          *  NOTE:  For VLANs, this will be the
64-                                         *  encapuslated type. --BLG
65+                                         *  encapsulated type. --BLG
66                                          */
67 	int		(*hh_output)(struct sk_buff *skb);
68 	rwlock_t	hh_lock;
69-
70 	/* cached hardware header; allow for machine alignment needs.        */
71-#ifdef 	CONFIG_VLAN_802_1Q /* we need 4 extra bytes for VLAN headers */
72+#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE)) /* we need 4 extra bytes for VLAN headers */
73  	unsigned long	hh_data[20/sizeof(unsigned long)];
74 #else
75  	unsigned long	hh_data[16/sizeof(unsigned long)];
76-#endif
77+#endif /* CONFIG_VLAN_802_1Q ... */
78 };
79 
80 
81@@ -336,14 +332,13 @@
82 	int			tx_semaphore;
83 #define NETDEV_FASTROUTE_HMASK 0xF
84 	/* Semi-private data. Keep it at the end of device struct. */
85-
86 	struct dst_entry	*fastpath[NETDEV_FASTROUTE_HMASK+1];
87 #endif
88 
89-#ifdef CONFIG_VLAN_802_1Q
90+#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE))
91         /*  Holds information that makes sense if this device is a VLAN device. */
92         struct vlan_dev_info* vlan_dev;
93-#endif
94+#endif /* CONFIG_VLAN_802_1Q ... */
95 
96 #ifdef CONFIG_NET_DIVERT
97 	/* this will get initialized at each interface type init routine */
98diff -Nurb linux/net/802_1Q/Makefile linux.p/net/802_1Q/Makefile
99--- linux/net/802_1Q/Makefile	Mon Jun  4 17:51:51 2001
100+++ linux.p/net/802_1Q/Makefile	Mon Jun  4 16:08:04 2001
101@@ -1,5 +1,5 @@
102 #
103-# Makefile for the Linux Ethernet layer.
104+# Makefile for the Linux 802.1q protocol layer
105 #
106 # Note! Dependencies are done automagically by 'make dep', which also
107 # removes any old dependencies. DON'T put your own dependencies here
108@@ -8,19 +8,14 @@
109 # Note 2! The CFLAGS definition is now in the main makefile...
110 
111 O_TARGET := 802_1Q.o
112+O_OBJS   := vlan.o vlanproc.o vlan_dev.o
113 
114-OBJS	:= vlan.o vlanproc.o vlan_dev.o
115-
116-ifeq ($(CONFIG_SYSCTL),y)
117-OBJS += sysctl_net_vlan.o
118+ifeq ($(CONFIG_VLAN_802_1Q),m)
119+M_OBJS  := $(O_TARGET)
120 endif
121 
122-
123-ifdef CONFIG_NET
124-O_OBJS	:= $(OBJS) $(OBJ2)
125+ifeq ($(CONFIG_SYSCTL),y)
126+O_OBJS += sysctl_net_vlan.o
127 endif
128 
129 include $(TOPDIR)/Rules.make
130-
131-tar:
132-	tar -cvf /dev/f1 .
133diff -Nurb linux/net/802_1Q/sysctl_net_vlan.c linux.p/net/802_1Q/sysctl_net_vlan.c
134--- linux/net/802_1Q/sysctl_net_vlan.c	Mon Jun  4 17:51:51 2001
135+++ linux.p/net/802_1Q/sysctl_net_vlan.c	Mon Jun  4 16:08:04 2001
136@@ -6,7 +6,7 @@
137  * TODO:  What, if anything, should this do??
138  */
139 
140-#ifdef 	CONFIG_VLAN_802_1Q
141+#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE))
142 
143 #include <linux/mm.h>
144 #include <linux/sysctl.h>
145@@ -15,4 +15,4 @@
146 	{0}
147 };
148 
149-#endif
150+#endif /* CONFIG_VLAN_802_1Q ... */
151diff -Nurb linux/net/802_1Q/vlan.c linux.p/net/802_1Q/vlan.c
152--- linux/net/802_1Q/vlan.c	Mon Jun  4 17:51:51 2001
153+++ linux.p/net/802_1Q/vlan.c	Mon Jun  4 17:46:31 2001
154@@ -81,8 +81,6 @@
155  *	Context:	process
156  */
157 int init_module	(void) {
158-        printk(VLAN_INF __FUNCTION__);
159-
160         vlan_proto_init(NULL);
161         return 0;
162 }
163@@ -92,7 +90,8 @@
164  *	o delete /proc/net/router directory and static entries.
165  */ 
166 void cleanup_module (void) {
167-        vlan_proto_cleanup(); // TODO: Define this so modules work.
168+        dev_remove_pack(&vlan_packet_type);
169+        vlan_proc_cleanup();
170 }
171 
172 #else
173@@ -100,11 +99,8 @@
174 
175 /** Non-module init entry point. */
176 __initfunc(void vlan_system_init(void)) {
177-        printk(VLAN_INF __FUNCTION__);
178-
179         /* protocol initialization */
180         vlan_proto_init(NULL);
181-
182 }
183 #endif
184 
185@@ -205,6 +201,7 @@
186                          *  NOTE:  This deletes dev, don't access it again!!
187                          */
188                         unregister_netdevice(dev);
189+			MOD_DEC_USE_COUNT;
190 
191                 }/* if */
192         }/* if */
193@@ -438,6 +435,7 @@
194                                 /* printk(KERN_ALERT "Registering new device."); */
195                                 register_netdevice(new_dev);
196                                 vlan_proc_add_dev(new_dev); /* create it's proc entry */
197+                                MOD_INC_USE_COUNT; /* Add was a success!! */
198                                 return new_dev;
199                         }
200                 }//if
201diff -Nurb linux/net/802_1Q/vlan_dev.c linux.p/net/802_1Q/vlan_dev.c
202--- linux/net/802_1Q/vlan_dev.c	Mon Jun  4 17:51:51 2001
203+++ linux.p/net/802_1Q/vlan_dev.c	Mon Jun  4 16:08:04 2001
204@@ -18,7 +18,6 @@
205  */
206 
207 #include <asm/uaccess.h> /* for copy_from_user */
208-#include <linux/module.h>
209 #include <linux/netdevice.h>
210 #include <linux/skbuff.h>
211 #include <net/datalink.h>
212diff -Nurb linux/net/802_1Q/vlanproc.c linux.p/net/802_1Q/vlanproc.c
213--- linux/net/802_1Q/vlanproc.c	Mon Jun  4 17:51:51 2001
214+++ linux.p/net/802_1Q/vlanproc.c	Mon Jun  4 16:08:04 2001
215@@ -1,19 +1,19 @@
216 /* * -*- linux-c -*- */
217 /*****************************************************************************
218  * vlanproc.c	VLAN Module. /proc filesystem interface.
219-*
220-* Author:	Ben Greear, <greearb@candelatech.com> coppied from wanproc.c
221-*               by: Gene Kozin	<genek@compuserve.com>
222-*
223-* Copyright:	(c) 1998-2000 Ben Greear
224-*
225-*		This program is free software; you can redistribute it and/or
226-*		modify it under the terms of the GNU General Public License
227-*		as published by the Free Software Foundation; either version
228-*		2 of the License, or (at your option) any later version.
229-* ============================================================================
230-* Jan 20, 1998        Ben Greear     Initial Version
231-*****************************************************************************/
232+ *
233+ * Author:	Ben Greear, <greearb@candelatech.com> coppied from wanproc.c
234+ *               by: Gene Kozin	<genek@compuserve.com>
235+ *
236+ * Copyright:	(c) 1998-2000 Ben Greear
237+ *
238+ *		This program is free software; you can redistribute it and/or
239+ *		modify it under the terms of the GNU General Public License
240+ *		as published by the Free Software Foundation; either version
241+ *		2 of the License, or (at your option) any later version.
242+ * ============================================================================
243+ * Jan 20, 1998        Ben Greear     Initial Version
244+ *****************************************************************************/
245 
246 #include <linux/config.h>
247 #include <linux/stddef.h>	/* offsetof(), etc. */
248diff -Nurb linux/net/Config.in linux.p/net/Config.in
249--- linux/net/Config.in	Mon Jun  4 17:51:51 2001
250+++ linux.p/net/Config.in	Mon Jun  4 16:08:04 2001
251@@ -48,12 +48,12 @@
252   fi
253   bool 'Frame Diverter (EXPERIMENTAL)' CONFIG_NET_DIVERT
254   bool '802.2 LLC (EXPERIMENTAL)' CONFIG_LLC
255-
256-  bool '802.1Q VLAN Support (EXPERIMENTAL)' CONFIG_VLAN_802_1Q
257-
258 #  if [ "$CONFIG_LLC" = "y" ]; then
259 #   bool 'Netbeui (EXPERIMENTAL)' CONFIG_NETBEUI
260 #  fi
261+
262+  tristate '802.1Q VLAN Support (EXPERIMENTAL)' CONFIG_VLAN_802_1Q
263+
264   tristate 'Acorn Econet/AUN protocols (EXPERIMENTAL)' CONFIG_ECONET
265   if [ "$CONFIG_ECONET" != "n" ]; then
266     bool '  AUN over UDP' CONFIG_ECONET_AUNUDP
267diff -Nurb linux/net/Makefile linux.p/net/Makefile
268--- linux/net/Makefile	Mon Jun  4 17:51:51 2001
269+++ linux.p/net/Makefile	Mon Jun  4 16:08:04 2001
270@@ -63,6 +63,10 @@
271 
272 ifeq ($(CONFIG_VLAN_802_1Q),y)
273 SUB_DIRS += 802_1Q
274+else
275+  ifeq ($(CONFIG_VLAN_802_1Q),m)
276+    MOD_SUB_DIRS += 802_1Q
277+  endif
278 endif
279 
280 ifeq ($(CONFIG_IPX),y)
281diff -Nurb linux/net/core/dev.c linux.p/net/core/dev.c
282--- linux/net/core/dev.c	Mon Jun  4 17:51:51 2001
283+++ linux.p/net/core/dev.c	Mon Jun  4 16:08:04 2001
284@@ -1,4 +1,4 @@
285-/* -*- linux-c -*-
286+/*
287  * 	NET3	Protocol independent device support routines.
288  *
289  *		This program is free software; you can redistribute it and/or
290@@ -94,11 +94,9 @@
291 #ifdef CONFIG_NET_RADIO
292 #include <linux/wireless.h>
293 #endif	/* CONFIG_NET_RADIO */
294-
295-#ifdef CONFIG_VLAN_802_1Q
296+#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE))
297 #include "../802_1Q/vlan.h"
298-#endif
299-
300+#endif /* CONFIG_VLAN_802_1Q ... */
301 #ifdef CONFIG_PLIP
302 extern int plip_init(void);
303 #endif
304@@ -138,7 +136,6 @@
305  *             --BLG
306  *
307  *		0800	IP
308- *		8100    802.1Q VLAN
309  *		0001	802.3
310  *		0002	AX.25
311  *		0004	802.2
312@@ -146,6 +143,7 @@
313  *		0005	SNAP
314  *		0805	X.25
315  *		0806	ARP
316+ *		8100    802.1Q VLAN
317  *		8137	IPX
318  *		0009	Localtalk
319  *		86DD	IPv6
320@@ -186,10 +184,11 @@
321 /* Taking this out, because lo has problems for some people.  Feel
322  * free to turn it back on and give me (greearb@candelatech.com) bug
323  * reports if you can re-produce the problem. --Ben
324+ *
325+ * #define BENS_FAST_DEV_LOOKUP
326+ *
327+ */
328 
329- #define BENS_FAST_DEV_LOOKUP
330-
331-*/
332 #ifdef BENS_FAST_DEV_LOOKUP
333 /* Fast Device Lookup code.  Should give much better than
334  * linear speed when looking for devices by idx or name.
335@@ -548,7 +547,8 @@
336            /* printk(KERN_ERR "__dev_get_by_name, didn't find it for name: %s\n", name); */
337            return NULL;
338         }
339-#endif
340+#endif  /* BENS_FAST_DEV_LOOKUP */
341+		
342 	for (dev = dev_base; dev != NULL; dev = dev->next) 
343 	{
344 		if (strcmp(dev->name, name) == 0)
345@@ -560,6 +560,7 @@
346 struct device * dev_get_by_index(int ifindex)
347 {
348 	struct device *dev;
349+
350 #ifdef BENS_FAST_DEV_LOOKUP
351         int idx = fdl_calc_index_idx(ifindex);
352         struct dev_hash_node* dhn;
353@@ -572,7 +573,8 @@
354            }
355            return NULL;
356         }
357-#endif
358+#endif /* BENS_FAST_DEV_LOOKUP */
359+
360 	for (dev = dev_base; dev != NULL; dev = dev->next) 
361 	{
362 		if (dev->ifindex == ifindex)
363@@ -1127,7 +1129,7 @@
364 		if(skb==NULL)		
365 			return;
366 			
367-		offset = skb->data - skb->mac.raw;
368+		offset=skb->data-skb->mac.raw;
369 		skb_push(skb,offset);	/* Put header back on for bridge */
370 
371 		if(br_receive_frame(skb))
372@@ -1253,7 +1255,7 @@
373 		}
374 
375 		/*
376-		 * 	Fetch the packet protocol ID. (In Network Byte Order --BLG)
377+		 * 	Fetch the packet protocol ID. 
378 		 */
379 
380 		type = skb->protocol;
381@@ -1903,12 +1905,12 @@
382 #ifdef BENS_FAST_DEV_LOOKUP
383                         /* Doesn't seem to need any additional locking in kernel 2.2 series... --Ben */
384                         __fdl_unregister_netdevice(dev); /* take it out of the name hash table */
385-#endif
386+#endif /* BENS_FAST_DEV_LOOKUP */
387 			memcpy(dev->name, ifr->ifr_newname, IFNAMSIZ);
388 			dev->name[IFNAMSIZ-1] = 0;
389 #ifdef BENS_FAST_DEV_LOOKUP
390                         __fdl_register_netdevice(dev); /* put it back in the name hash table, with the new name */
391-#endif
392+#endif /* BENS_FAST_DEV_LOOKUP */
393 			notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev);
394 			return 0;
395 
396@@ -2113,12 +2115,15 @@
397 				return -EEXIST;
398 		}
399 		dev->next = NULL;
400+
401 #ifdef BENS_FAST_DEV_LOOKUP
402-                /* Must do this before dp is set to dev, or it could be added twice, once
403-                 * on initialization based on dev_base, and once again after that...
404+		/* Must do this before dp is set to dev, or it could be added twice,
405+		 * once on initialization based on dev_base, and once again after
406+		 * that...
407                  */
408                 __fdl_register_netdevice(dev);
409-#endif
410+#endif /* BENS_FAST_DEV_LOOKUP */
411+
412 		*dp = dev;
413 #ifdef CONFIG_NET_DIVERT
414 		ret=alloc_divert_blk(dev);
415@@ -2150,7 +2155,7 @@
416          * on initialization based on dev_base, and once again after that...
417          */
418         __fdl_register_netdevice(dev);
419-#endif
420+#endif /* BENS_FAST_DEV_LOOKUP */
421 	*dp = dev;
422 
423 	/* Notify protocols, that a new device appeared. */
424@@ -2204,7 +2209,7 @@
425 			*dp = d->next;
426 #ifdef BENS_FAST_DEV_LOOKUP
427                         __fdl_unregister_netdevice(dev);
428-#endif
429+#endif /* BENS_FAST_DEV_LOOKUP */
430 			synchronize_bh();
431 			d->next = NULL;
432 
433diff -Nurb linux/net/ethernet/eth.c linux.p/net/ethernet/eth.c
434--- linux/net/ethernet/eth.c	Mon Jun  4 17:51:51 2001
435+++ linux.p/net/ethernet/eth.c	Mon Jun  4 16:08:04 2001
436@@ -186,7 +186,7 @@
437 
438         skb->mac.raw=skb->data;
439 
440-#ifdef CONFIG_VLAN_802_1Q
441+#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE))
442 	/* Moving this below to be more selective.  Reason is that for VLAN
443          * devices, we do not want to pull the header, we'll let the VLAN
444          * device do that instead.  This makes default vlans (based on incoming
445@@ -196,7 +196,7 @@
446         /* skb_pull(skb,dev->hard_header_len); */
447 #else
448         skb_pull(skb,dev->hard_header_len);
449-#endif
450+#endif /* CONFIG_VLAN_802_1Q ... */
451         
452         eth= skb->mac.ethernet;
453 
454@@ -222,7 +222,7 @@
455 			skb->pkt_type=PACKET_OTHERHOST;
456 	}
457 
458-#ifdef CONFIG_VLAN_802_1Q
459+#if (defined(CONFIG_VLAN_802_1Q) || defined(CONFIG_VLAN_802_1Q_MODULE))
460         if (ntohs(eth->h_proto) == ETH_P_802_1Q) {
461                 /* then we have to convert this into a VLAN looking packet.
462                  * We'll wait to do that in the VLAN protocol handler.
463@@ -234,7 +234,7 @@
464         else {
465                 skb_pull(skb, dev->hard_header_len);
466         }
467-#endif
468+#endif /* CONFIG_VLAN_802_1Q ... */
469         
470 	if (ntohs(eth->h_proto) >= 1536)
471 		return eth->h_proto;
472diff -Nurb linux/net/netsyms.c linux.p/net/netsyms.c
473--- linux/net/netsyms.c	Mon Jun  4 17:48:17 2001
474+++ linux.p/net/netsyms.c	Mon Jun  4 17:39:36 2001
475@@ -403,6 +403,12 @@
476 EXPORT_SYMBOL(rtnl_lock);
477 EXPORT_SYMBOL(rtnl_unlock);
478 
479+#if defined(CONFIG_VLAN_802_1Q_MODULE)
480+extern struct Qdisc noqueue_qdisc;
481+EXPORT_SYMBOL(noqueue_qdisc);
482+EXPORT_SYMBOL(dev_change_flags);
483+EXPORT_SYMBOL(eth_header_parse);
484+#endif
485                   
486 /* Used by at least ipip.c.  */
487 EXPORT_SYMBOL(ipv4_config);
488@@ -533,7 +539,6 @@
489 #include<linux/if_ltalk.h>
490 EXPORT_SYMBOL(ltalk_setup);
491 #endif
492-
493 
494 /* Packet scheduler modules want these. */
495 EXPORT_SYMBOL(qdisc_destroy);
496