File: vlan_2.2-module.patch

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