diff options
Diffstat (limited to 'drivers/net')
42 files changed, 934 insertions, 88 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index e70315a85447..5c69d57f8548 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2523,6 +2523,19 @@ config PPP_BSDCOMP | |||
2523 | module; it is called bsd_comp and will show up in the directory | 2523 | module; it is called bsd_comp and will show up in the directory |
2524 | modules once you have said "make modules". If unsure, say N. | 2524 | modules once you have said "make modules". If unsure, say N. |
2525 | 2525 | ||
2526 | config PPP_MPPE | ||
2527 | tristate "PPP MPPE compression (encryption) (EXPERIMENTAL)" | ||
2528 | depends on PPP && EXPERIMENTAL | ||
2529 | select CRYPTO | ||
2530 | select CRYPTO_SHA1 | ||
2531 | select CRYPTO_ARC4 | ||
2532 | ---help--- | ||
2533 | Support for the MPPE Encryption protocol, as employed by the | ||
2534 | Microsoft Point-to-Point Tunneling Protocol. | ||
2535 | |||
2536 | See http://pptpclient.sourceforge.net/ for information on | ||
2537 | configuring PPTP clients and servers to utilize this method. | ||
2538 | |||
2526 | config PPPOE | 2539 | config PPPOE |
2527 | tristate "PPP over Ethernet (EXPERIMENTAL)" | 2540 | tristate "PPP over Ethernet (EXPERIMENTAL)" |
2528 | depends on EXPERIMENTAL && PPP | 2541 | depends on EXPERIMENTAL && PPP |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 7c313cb341b8..4cffd34442aa 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -112,6 +112,7 @@ obj-$(CONFIG_PPP_ASYNC) += ppp_async.o | |||
112 | obj-$(CONFIG_PPP_SYNC_TTY) += ppp_synctty.o | 112 | obj-$(CONFIG_PPP_SYNC_TTY) += ppp_synctty.o |
113 | obj-$(CONFIG_PPP_DEFLATE) += ppp_deflate.o | 113 | obj-$(CONFIG_PPP_DEFLATE) += ppp_deflate.o |
114 | obj-$(CONFIG_PPP_BSDCOMP) += bsd_comp.o | 114 | obj-$(CONFIG_PPP_BSDCOMP) += bsd_comp.o |
115 | obj-$(CONFIG_PPP_MPPE) += ppp_mppe.o | ||
115 | obj-$(CONFIG_PPPOE) += pppox.o pppoe.o | 116 | obj-$(CONFIG_PPPOE) += pppox.o pppoe.o |
116 | 117 | ||
117 | obj-$(CONFIG_SLIP) += slip.o | 118 | obj-$(CONFIG_SLIP) += slip.o |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index b38fa245a607..c53848f787eb 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/version.h> | ||
22 | #include <linux/dma-mapping.h> | 21 | #include <linux/dma-mapping.h> |
23 | 22 | ||
24 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 50f43dbf31ae..1f7ca453bb4a 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -67,7 +67,6 @@ | |||
67 | */ | 67 | */ |
68 | 68 | ||
69 | #include <linux/config.h> | 69 | #include <linux/config.h> |
70 | #include <linux/version.h> | ||
71 | 70 | ||
72 | #include <linux/module.h> | 71 | #include <linux/module.h> |
73 | #include <linux/kernel.h> | 72 | #include <linux/kernel.h> |
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index c0af6fb1fbba..f8c9bcdab68b 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -60,7 +60,6 @@ | |||
60 | #include <linux/etherdevice.h> | 60 | #include <linux/etherdevice.h> |
61 | #include <linux/init.h> | 61 | #include <linux/init.h> |
62 | #include <linux/skbuff.h> | 62 | #include <linux/skbuff.h> |
63 | #include <linux/version.h> | ||
64 | #include <linux/spinlock.h> | 63 | #include <linux/spinlock.h> |
65 | #include <linux/crc32.h> | 64 | #include <linux/crc32.h> |
66 | #include <linux/mii.h> | 65 | #include <linux/mii.h> |
diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h index 1105543b9d88..e7ec96c964a9 100644 --- a/drivers/net/fs_enet/fs_enet.h +++ b/drivers/net/fs_enet/fs_enet.h | |||
@@ -4,7 +4,6 @@ | |||
4 | #include <linux/mii.h> | 4 | #include <linux/mii.h> |
5 | #include <linux/netdevice.h> | 5 | #include <linux/netdevice.h> |
6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
7 | #include <linux/version.h> | ||
8 | #include <linux/list.h> | 7 | #include <linux/list.h> |
9 | 8 | ||
10 | #include <linux/fs_enet_pd.h> | 9 | #include <linux/fs_enet_pd.h> |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 962580f2c4ab..54d294ad6df5 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -90,7 +90,6 @@ | |||
90 | #include <asm/irq.h> | 90 | #include <asm/irq.h> |
91 | #include <asm/uaccess.h> | 91 | #include <asm/uaccess.h> |
92 | #include <linux/module.h> | 92 | #include <linux/module.h> |
93 | #include <linux/version.h> | ||
94 | #include <linux/dma-mapping.h> | 93 | #include <linux/dma-mapping.h> |
95 | #include <linux/crc32.h> | 94 | #include <linux/crc32.h> |
96 | #include <linux/mii.h> | 95 | #include <linux/mii.h> |
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index c77ca6c0d04a..220084e53341 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <asm/irq.h> | 43 | #include <asm/irq.h> |
44 | #include <asm/uaccess.h> | 44 | #include <asm/uaccess.h> |
45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
46 | #include <linux/version.h> | ||
47 | #include <linux/crc32.h> | 46 | #include <linux/crc32.h> |
48 | #include <linux/workqueue.h> | 47 | #include <linux/workqueue.h> |
49 | #include <linux/ethtool.h> | 48 | #include <linux/ethtool.h> |
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c index 68e3578e7613..5a2d810ce575 100644 --- a/drivers/net/gianfar_ethtool.c +++ b/drivers/net/gianfar_ethtool.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <asm/irq.h> | 34 | #include <asm/irq.h> |
35 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
36 | #include <linux/module.h> | 36 | #include <linux/module.h> |
37 | #include <linux/version.h> | ||
38 | #include <linux/crc32.h> | 37 | #include <linux/crc32.h> |
39 | #include <asm/types.h> | 38 | #include <asm/types.h> |
40 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c index 5a74d3d3dbe1..7263395d78bb 100644 --- a/drivers/net/gianfar_mii.c +++ b/drivers/net/gianfar_mii.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/spinlock.h> | 32 | #include <linux/spinlock.h> |
33 | #include <linux/mm.h> | 33 | #include <linux/mm.h> |
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/version.h> | ||
36 | #include <linux/platform_device.h> | 35 | #include <linux/platform_device.h> |
37 | #include <asm/ocp.h> | 36 | #include <asm/ocp.h> |
38 | #include <linux/crc32.h> | 37 | #include <linux/crc32.h> |
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index b71fab6e34f4..e92c17f6931c 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c | |||
@@ -96,7 +96,6 @@ | |||
96 | 96 | ||
97 | #undef HP100_MULTICAST_FILTER /* Need to be debugged... */ | 97 | #undef HP100_MULTICAST_FILTER /* Need to be debugged... */ |
98 | 98 | ||
99 | #include <linux/version.h> | ||
100 | #include <linux/module.h> | 99 | #include <linux/module.h> |
101 | #include <linux/kernel.h> | 100 | #include <linux/kernel.h> |
102 | #include <linux/string.h> | 101 | #include <linux/string.h> |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 94239f67f3a3..be191d80ef9c 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -35,7 +35,6 @@ | |||
35 | 35 | ||
36 | #include <linux/config.h> | 36 | #include <linux/config.h> |
37 | #include <linux/module.h> | 37 | #include <linux/module.h> |
38 | #include <linux/version.h> | ||
39 | #include <linux/types.h> | 38 | #include <linux/types.h> |
40 | #include <linux/errno.h> | 39 | #include <linux/errno.h> |
41 | #include <linux/ioport.h> | 40 | #include <linux/ioport.h> |
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index 49e5467bdd73..6a3129bc15a6 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c | |||
@@ -46,10 +46,8 @@ | |||
46 | #include <linux/udp.h> | 46 | #include <linux/udp.h> |
47 | 47 | ||
48 | #ifdef CONFIG_SERIAL_8250 | 48 | #ifdef CONFIG_SERIAL_8250 |
49 | #include <linux/serial.h> | 49 | #include <linux/serial_core.h> |
50 | #include <asm/serial.h> | 50 | #include <linux/serial_8250.h> |
51 | #define IOC3_BAUD (22000000 / (3*16)) | ||
52 | #define IOC3_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) | ||
53 | #endif | 51 | #endif |
54 | 52 | ||
55 | #include <linux/netdevice.h> | 53 | #include <linux/netdevice.h> |
@@ -1146,12 +1144,11 @@ static inline int ioc3_is_menet(struct pci_dev *pdev) | |||
1146 | * around ioc3 oddities in this respect. | 1144 | * around ioc3 oddities in this respect. |
1147 | * | 1145 | * |
1148 | * The IOC3 serials use a 22MHz clock rate with an additional divider by 3. | 1146 | * The IOC3 serials use a 22MHz clock rate with an additional divider by 3. |
1149 | * (IOC3_BAUD = (22000000 / (3*16))) | ||
1150 | */ | 1147 | */ |
1151 | 1148 | ||
1152 | static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3) | 1149 | static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3) |
1153 | { | 1150 | { |
1154 | struct serial_struct req; | 1151 | struct uart_port port; |
1155 | 1152 | ||
1156 | /* | 1153 | /* |
1157 | * We need to recognice and treat the fourth MENET serial as it | 1154 | * We need to recognice and treat the fourth MENET serial as it |
@@ -1165,20 +1162,25 @@ static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3) | |||
1165 | if (ioc3_is_menet(pdev) && PCI_SLOT(pdev->devfn) == 3) | 1162 | if (ioc3_is_menet(pdev) && PCI_SLOT(pdev->devfn) == 3) |
1166 | return; | 1163 | return; |
1167 | 1164 | ||
1168 | /* Register to interrupt zero because we share the interrupt with | 1165 | /* |
1169 | the serial driver which we don't properly support yet. */ | 1166 | * Register to interrupt zero because we share the interrupt with |
1170 | memset(&req, 0, sizeof(req)); | 1167 | * the serial driver which we don't properly support yet. |
1171 | req.irq = 0; | 1168 | * |
1172 | req.flags = IOC3_COM_FLAGS; | 1169 | * Can't use UPF_IOREMAP as the whole of IOC3 resources have already |
1173 | req.io_type = SERIAL_IO_MEM; | 1170 | * been registered. |
1174 | req.iomem_reg_shift = 0; | 1171 | */ |
1175 | req.baud_base = IOC3_BAUD; | 1172 | memset(&port, 0, sizeof(port)); |
1176 | 1173 | port.irq = 0; | |
1177 | req.iomem_base = (unsigned char *) &ioc3->sregs.uarta; | 1174 | port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; |
1178 | register_serial(&req); | 1175 | port.iotype = UPIO_MEM; |
1179 | 1176 | port.regshift = 0; | |
1180 | req.iomem_base = (unsigned char *) &ioc3->sregs.uartb; | 1177 | port.uartclk = 22000000 / 3; |
1181 | register_serial(&req); | 1178 | |
1179 | port.membase = (unsigned char *) &ioc3->sregs.uarta; | ||
1180 | serial8250_register_port(&port); | ||
1181 | |||
1182 | port.membase = (unsigned char *) &ioc3->sregs.uartb; | ||
1183 | serial8250_register_port(&port); | ||
1182 | } | 1184 | } |
1183 | #endif | 1185 | #endif |
1184 | 1186 | ||
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c index 0282771b1cbb..3137592d60c0 100644 --- a/drivers/net/irda/donauboe.c +++ b/drivers/net/irda/donauboe.c | |||
@@ -1459,8 +1459,10 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
1459 | */ | 1459 | */ |
1460 | IRDA_DEBUG (1, "%s(BANDWIDTH), %s, (%X/%ld\n", __FUNCTION__ | 1460 | IRDA_DEBUG (1, "%s(BANDWIDTH), %s, (%X/%ld\n", __FUNCTION__ |
1461 | ,dev->name, INB (OBOE_STATUS), irq->ifr_baudrate ); | 1461 | ,dev->name, INB (OBOE_STATUS), irq->ifr_baudrate ); |
1462 | if (!in_interrupt () && !capable (CAP_NET_ADMIN)) | 1462 | if (!in_interrupt () && !capable (CAP_NET_ADMIN)) { |
1463 | return -EPERM; | 1463 | ret = -EPERM; |
1464 | goto out; | ||
1465 | } | ||
1464 | 1466 | ||
1465 | /* self->speed=irq->ifr_baudrate; */ | 1467 | /* self->speed=irq->ifr_baudrate; */ |
1466 | /* toshoboe_setbaud(self); */ | 1468 | /* toshoboe_setbaud(self); */ |
@@ -1470,8 +1472,10 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
1470 | case SIOCSMEDIABUSY: /* Set media busy */ | 1472 | case SIOCSMEDIABUSY: /* Set media busy */ |
1471 | IRDA_DEBUG (1, "%s(MEDIABUSY), %s, (%X/%x)\n", __FUNCTION__ | 1473 | IRDA_DEBUG (1, "%s(MEDIABUSY), %s, (%X/%x)\n", __FUNCTION__ |
1472 | ,dev->name, INB (OBOE_STATUS), capable (CAP_NET_ADMIN) ); | 1474 | ,dev->name, INB (OBOE_STATUS), capable (CAP_NET_ADMIN) ); |
1473 | if (!capable (CAP_NET_ADMIN)) | 1475 | if (!capable (CAP_NET_ADMIN)) { |
1474 | return -EPERM; | 1476 | ret = -EPERM; |
1477 | goto out; | ||
1478 | } | ||
1475 | irda_device_set_media_busy (self->netdev, TRUE); | 1479 | irda_device_set_media_busy (self->netdev, TRUE); |
1476 | break; | 1480 | break; |
1477 | case SIOCGRECEIVING: /* Check if we are receiving right now */ | 1481 | case SIOCGRECEIVING: /* Check if we are receiving right now */ |
@@ -1483,7 +1487,7 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
1483 | IRDA_DEBUG (1, "%s(?), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd); | 1487 | IRDA_DEBUG (1, "%s(?), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd); |
1484 | ret = -EOPNOTSUPP; | 1488 | ret = -EOPNOTSUPP; |
1485 | } | 1489 | } |
1486 | 1490 | out: | |
1487 | spin_unlock_irqrestore(&self->spinlock, flags); | 1491 | spin_unlock_irqrestore(&self->spinlock, flags); |
1488 | return ret; | 1492 | return ret; |
1489 | 1493 | ||
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index d86d8f055a6c..77eadf84cb2c 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -58,7 +58,6 @@ | |||
58 | 58 | ||
59 | #include <linux/config.h> | 59 | #include <linux/config.h> |
60 | #include <linux/module.h> | 60 | #include <linux/module.h> |
61 | #include <linux/version.h> | ||
62 | #include <linux/types.h> | 61 | #include <linux/types.h> |
63 | #include <linux/errno.h> | 62 | #include <linux/errno.h> |
64 | #include <linux/ioport.h> | 63 | #include <linux/ioport.h> |
diff --git a/drivers/net/mac8390.c b/drivers/net/mac8390.c index ce5761816a64..d8c99f038fa0 100644 --- a/drivers/net/mac8390.c +++ b/drivers/net/mac8390.c | |||
@@ -15,7 +15,6 @@ | |||
15 | * and fixed access to Sonic Sys card which masquerades as a Farallon | 15 | * and fixed access to Sonic Sys card which masquerades as a Farallon |
16 | * by rayk@knightsmanor.org */ | 16 | * by rayk@knightsmanor.org */ |
17 | 17 | ||
18 | #include <linux/version.h> | ||
19 | #include <linux/module.h> | 18 | #include <linux/module.h> |
20 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
21 | #include <linux/types.h> | 20 | #include <linux/types.h> |
diff --git a/drivers/net/mv643xx_eth.h b/drivers/net/mv643xx_eth.h index bcfda5192da0..f769f9b626ea 100644 --- a/drivers/net/mv643xx_eth.h +++ b/drivers/net/mv643xx_eth.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef __MV643XX_ETH_H__ | 1 | #ifndef __MV643XX_ETH_H__ |
2 | #define __MV643XX_ETH_H__ | 2 | #define __MV643XX_ETH_H__ |
3 | 3 | ||
4 | #include <linux/version.h> | ||
5 | #include <linux/module.h> | 4 | #include <linux/module.h> |
6 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
7 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 59e8183c639e..400f652282d7 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/spinlock.h> | 31 | #include <linux/spinlock.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
34 | #include <asm/string.h> | ||
34 | 35 | ||
35 | #define PPP_VERSION "2.4.2" | 36 | #define PPP_VERSION "2.4.2" |
36 | 37 | ||
@@ -835,8 +836,11 @@ process_input_packet(struct asyncppp *ap) | |||
835 | err: | 836 | err: |
836 | /* frame had an error, remember that, reset SC_TOSS & SC_ESCAPE */ | 837 | /* frame had an error, remember that, reset SC_TOSS & SC_ESCAPE */ |
837 | ap->state = SC_PREV_ERROR; | 838 | ap->state = SC_PREV_ERROR; |
838 | if (skb) | 839 | if (skb) { |
840 | /* make skb appear as freshly allocated */ | ||
839 | skb_trim(skb, 0); | 841 | skb_trim(skb, 0); |
842 | skb_reserve(skb, - skb_headroom(skb)); | ||
843 | } | ||
840 | } | 844 | } |
841 | 845 | ||
842 | /* Called when the tty driver has data for us. Runs parallel with the | 846 | /* Called when the tty driver has data for us. Runs parallel with the |
@@ -889,10 +893,17 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
889 | skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); | 893 | skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); |
890 | if (skb == 0) | 894 | if (skb == 0) |
891 | goto nomem; | 895 | goto nomem; |
892 | /* Try to get the payload 4-byte aligned */ | 896 | ap->rpkt = skb; |
897 | } | ||
898 | if (skb->len == 0) { | ||
899 | /* Try to get the payload 4-byte aligned. | ||
900 | * This should match the | ||
901 | * PPP_ALLSTATIONS/PPP_UI/compressed tests in | ||
902 | * process_input_packet, but we do not have | ||
903 | * enough chars here to test buf[1] and buf[2]. | ||
904 | */ | ||
893 | if (buf[0] != PPP_ALLSTATIONS) | 905 | if (buf[0] != PPP_ALLSTATIONS) |
894 | skb_reserve(skb, 2 + (buf[0] & 1)); | 906 | skb_reserve(skb, 2 + (buf[0] & 1)); |
895 | ap->rpkt = skb; | ||
896 | } | 907 | } |
897 | if (n > skb_tailroom(skb)) { | 908 | if (n > skb_tailroom(skb)) { |
898 | /* packet overflowed MRU */ | 909 | /* packet overflowed MRU */ |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index d3c9958b00d0..50430f79f8cf 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -137,13 +137,14 @@ struct ppp { | |||
137 | 137 | ||
138 | /* | 138 | /* |
139 | * Bits in flags: SC_NO_TCP_CCID, SC_CCP_OPEN, SC_CCP_UP, SC_LOOP_TRAFFIC, | 139 | * Bits in flags: SC_NO_TCP_CCID, SC_CCP_OPEN, SC_CCP_UP, SC_LOOP_TRAFFIC, |
140 | * SC_MULTILINK, SC_MP_SHORTSEQ, SC_MP_XSHORTSEQ, SC_COMP_TCP, SC_REJ_COMP_TCP. | 140 | * SC_MULTILINK, SC_MP_SHORTSEQ, SC_MP_XSHORTSEQ, SC_COMP_TCP, SC_REJ_COMP_TCP, |
141 | * SC_MUST_COMP | ||
141 | * Bits in rstate: SC_DECOMP_RUN, SC_DC_ERROR, SC_DC_FERROR. | 142 | * Bits in rstate: SC_DECOMP_RUN, SC_DC_ERROR, SC_DC_FERROR. |
142 | * Bits in xstate: SC_COMP_RUN | 143 | * Bits in xstate: SC_COMP_RUN |
143 | */ | 144 | */ |
144 | #define SC_FLAG_BITS (SC_NO_TCP_CCID|SC_CCP_OPEN|SC_CCP_UP|SC_LOOP_TRAFFIC \ | 145 | #define SC_FLAG_BITS (SC_NO_TCP_CCID|SC_CCP_OPEN|SC_CCP_UP|SC_LOOP_TRAFFIC \ |
145 | |SC_MULTILINK|SC_MP_SHORTSEQ|SC_MP_XSHORTSEQ \ | 146 | |SC_MULTILINK|SC_MP_SHORTSEQ|SC_MP_XSHORTSEQ \ |
146 | |SC_COMP_TCP|SC_REJ_COMP_TCP) | 147 | |SC_COMP_TCP|SC_REJ_COMP_TCP|SC_MUST_COMP) |
147 | 148 | ||
148 | /* | 149 | /* |
149 | * Private data structure for each channel. | 150 | * Private data structure for each channel. |
@@ -1027,6 +1028,56 @@ ppp_xmit_process(struct ppp *ppp) | |||
1027 | ppp_xmit_unlock(ppp); | 1028 | ppp_xmit_unlock(ppp); |
1028 | } | 1029 | } |
1029 | 1030 | ||
1031 | static inline struct sk_buff * | ||
1032 | pad_compress_skb(struct ppp *ppp, struct sk_buff *skb) | ||
1033 | { | ||
1034 | struct sk_buff *new_skb; | ||
1035 | int len; | ||
1036 | int new_skb_size = ppp->dev->mtu + | ||
1037 | ppp->xcomp->comp_extra + ppp->dev->hard_header_len; | ||
1038 | int compressor_skb_size = ppp->dev->mtu + | ||
1039 | ppp->xcomp->comp_extra + PPP_HDRLEN; | ||
1040 | new_skb = alloc_skb(new_skb_size, GFP_ATOMIC); | ||
1041 | if (!new_skb) { | ||
1042 | if (net_ratelimit()) | ||
1043 | printk(KERN_ERR "PPP: no memory (comp pkt)\n"); | ||
1044 | return NULL; | ||
1045 | } | ||
1046 | if (ppp->dev->hard_header_len > PPP_HDRLEN) | ||
1047 | skb_reserve(new_skb, | ||
1048 | ppp->dev->hard_header_len - PPP_HDRLEN); | ||
1049 | |||
1050 | /* compressor still expects A/C bytes in hdr */ | ||
1051 | len = ppp->xcomp->compress(ppp->xc_state, skb->data - 2, | ||
1052 | new_skb->data, skb->len + 2, | ||
1053 | compressor_skb_size); | ||
1054 | if (len > 0 && (ppp->flags & SC_CCP_UP)) { | ||
1055 | kfree_skb(skb); | ||
1056 | skb = new_skb; | ||
1057 | skb_put(skb, len); | ||
1058 | skb_pull(skb, 2); /* pull off A/C bytes */ | ||
1059 | } else if (len == 0) { | ||
1060 | /* didn't compress, or CCP not up yet */ | ||
1061 | kfree_skb(new_skb); | ||
1062 | new_skb = skb; | ||
1063 | } else { | ||
1064 | /* | ||
1065 | * (len < 0) | ||
1066 | * MPPE requires that we do not send unencrypted | ||
1067 | * frames. The compressor will return -1 if we | ||
1068 | * should drop the frame. We cannot simply test | ||
1069 | * the compress_proto because MPPE and MPPC share | ||
1070 | * the same number. | ||
1071 | */ | ||
1072 | if (net_ratelimit()) | ||
1073 | printk(KERN_ERR "ppp: compressor dropped pkt\n"); | ||
1074 | kfree_skb(skb); | ||
1075 | kfree_skb(new_skb); | ||
1076 | new_skb = NULL; | ||
1077 | } | ||
1078 | return new_skb; | ||
1079 | } | ||
1080 | |||
1030 | /* | 1081 | /* |
1031 | * Compress and send a frame. | 1082 | * Compress and send a frame. |
1032 | * The caller should have locked the xmit path, | 1083 | * The caller should have locked the xmit path, |
@@ -1113,29 +1164,14 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1113 | /* try to do packet compression */ | 1164 | /* try to do packet compression */ |
1114 | if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state != 0 | 1165 | if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state != 0 |
1115 | && proto != PPP_LCP && proto != PPP_CCP) { | 1166 | && proto != PPP_LCP && proto != PPP_CCP) { |
1116 | new_skb = alloc_skb(ppp->dev->mtu + ppp->dev->hard_header_len, | 1167 | if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) { |
1117 | GFP_ATOMIC); | 1168 | if (net_ratelimit()) |
1118 | if (new_skb == 0) { | 1169 | printk(KERN_ERR "ppp: compression required but down - pkt dropped.\n"); |
1119 | printk(KERN_ERR "PPP: no memory (comp pkt)\n"); | ||
1120 | goto drop; | 1170 | goto drop; |
1121 | } | 1171 | } |
1122 | if (ppp->dev->hard_header_len > PPP_HDRLEN) | 1172 | skb = pad_compress_skb(ppp, skb); |
1123 | skb_reserve(new_skb, | 1173 | if (!skb) |
1124 | ppp->dev->hard_header_len - PPP_HDRLEN); | 1174 | goto drop; |
1125 | |||
1126 | /* compressor still expects A/C bytes in hdr */ | ||
1127 | len = ppp->xcomp->compress(ppp->xc_state, skb->data - 2, | ||
1128 | new_skb->data, skb->len + 2, | ||
1129 | ppp->dev->mtu + PPP_HDRLEN); | ||
1130 | if (len > 0 && (ppp->flags & SC_CCP_UP)) { | ||
1131 | kfree_skb(skb); | ||
1132 | skb = new_skb; | ||
1133 | skb_put(skb, len); | ||
1134 | skb_pull(skb, 2); /* pull off A/C bytes */ | ||
1135 | } else { | ||
1136 | /* didn't compress, or CCP not up yet */ | ||
1137 | kfree_skb(new_skb); | ||
1138 | } | ||
1139 | } | 1175 | } |
1140 | 1176 | ||
1141 | /* | 1177 | /* |
@@ -1155,7 +1191,8 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1155 | return; | 1191 | return; |
1156 | 1192 | ||
1157 | drop: | 1193 | drop: |
1158 | kfree_skb(skb); | 1194 | if (skb) |
1195 | kfree_skb(skb); | ||
1159 | ++ppp->stats.tx_errors; | 1196 | ++ppp->stats.tx_errors; |
1160 | } | 1197 | } |
1161 | 1198 | ||
@@ -1552,6 +1589,9 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1552 | && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0) | 1589 | && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0) |
1553 | skb = ppp_decompress_frame(ppp, skb); | 1590 | skb = ppp_decompress_frame(ppp, skb); |
1554 | 1591 | ||
1592 | if (ppp->flags & SC_MUST_COMP && ppp->rstate & SC_DC_FERROR) | ||
1593 | goto err; | ||
1594 | |||
1555 | proto = PPP_PROTO(skb); | 1595 | proto = PPP_PROTO(skb); |
1556 | switch (proto) { | 1596 | switch (proto) { |
1557 | case PPP_VJC_COMP: | 1597 | case PPP_VJC_COMP: |
diff --git a/drivers/net/ppp_mppe.c b/drivers/net/ppp_mppe.c new file mode 100644 index 000000000000..1985d1b57c45 --- /dev/null +++ b/drivers/net/ppp_mppe.c | |||
@@ -0,0 +1,724 @@ | |||
1 | /* | ||
2 | * ppp_mppe.c - interface MPPE to the PPP code. | ||
3 | * This version is for use with Linux kernel 2.6.14+ | ||
4 | * | ||
5 | * By Frank Cusack <fcusack@fcusack.com>. | ||
6 | * Copyright (c) 2002,2003,2004 Google, Inc. | ||
7 | * All rights reserved. | ||
8 | * | ||
9 | * License: | ||
10 | * Permission to use, copy, modify, and distribute this software and its | ||
11 | * documentation is hereby granted, provided that the above copyright | ||
12 | * notice appears in all copies. This software is provided without any | ||
13 | * warranty, express or implied. | ||
14 | * | ||
15 | * ALTERNATIVELY, provided that this notice is retained in full, this product | ||
16 | * may be distributed under the terms of the GNU General Public License (GPL), | ||
17 | * in which case the provisions of the GPL apply INSTEAD OF those given above. | ||
18 | * | ||
19 | * This program is free software; you can redistribute it and/or modify | ||
20 | * it under the terms of the GNU General Public License as published by | ||
21 | * the Free Software Foundation; either version 2 of the License, or | ||
22 | * (at your option) any later version. | ||
23 | * | ||
24 | * This program is distributed in the hope that it will be useful, | ||
25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
27 | * GNU General Public License for more details. | ||
28 | * | ||
29 | * You should have received a copy of the GNU General Public License | ||
30 | * along with this program; if not, write to the Free Software | ||
31 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
32 | * | ||
33 | * | ||
34 | * Changelog: | ||
35 | * 08/12/05 - Matt Domsch <Matt_Domsch@dell.com> | ||
36 | * Only need extra skb padding on transmit, not receive. | ||
37 | * 06/18/04 - Matt Domsch <Matt_Domsch@dell.com>, Oleg Makarenko <mole@quadra.ru> | ||
38 | * Use Linux kernel 2.6 arc4 and sha1 routines rather than | ||
39 | * providing our own. | ||
40 | * 2/15/04 - TS: added #include <version.h> and testing for Kernel | ||
41 | * version before using | ||
42 | * MOD_DEC_USAGE_COUNT/MOD_INC_USAGE_COUNT which are | ||
43 | * deprecated in 2.6 | ||
44 | */ | ||
45 | |||
46 | #include <linux/config.h> | ||
47 | #include <linux/module.h> | ||
48 | #include <linux/kernel.h> | ||
49 | #include <linux/version.h> | ||
50 | #include <linux/init.h> | ||
51 | #include <linux/types.h> | ||
52 | #include <linux/slab.h> | ||
53 | #include <linux/string.h> | ||
54 | #include <linux/crypto.h> | ||
55 | #include <linux/mm.h> | ||
56 | #include <linux/ppp_defs.h> | ||
57 | #include <linux/ppp-comp.h> | ||
58 | #include <asm/scatterlist.h> | ||
59 | |||
60 | #include "ppp_mppe.h" | ||
61 | |||
62 | MODULE_AUTHOR("Frank Cusack <fcusack@fcusack.com>"); | ||
63 | MODULE_DESCRIPTION("Point-to-Point Protocol Microsoft Point-to-Point Encryption support"); | ||
64 | MODULE_LICENSE("Dual BSD/GPL"); | ||
65 | MODULE_ALIAS("ppp-compress-" __stringify(CI_MPPE)); | ||
66 | MODULE_VERSION("1.0.2"); | ||
67 | |||
68 | static void | ||
69 | setup_sg(struct scatterlist *sg, const void *address, unsigned int length) | ||
70 | { | ||
71 | sg[0].page = virt_to_page(address); | ||
72 | sg[0].offset = offset_in_page(address); | ||
73 | sg[0].length = length; | ||
74 | } | ||
75 | |||
76 | #define SHA1_PAD_SIZE 40 | ||
77 | |||
78 | /* | ||
79 | * kernel crypto API needs its arguments to be in kmalloc'd memory, not in the module | ||
80 | * static data area. That means sha_pad needs to be kmalloc'd. | ||
81 | */ | ||
82 | |||
83 | struct sha_pad { | ||
84 | unsigned char sha_pad1[SHA1_PAD_SIZE]; | ||
85 | unsigned char sha_pad2[SHA1_PAD_SIZE]; | ||
86 | }; | ||
87 | static struct sha_pad *sha_pad; | ||
88 | |||
89 | static inline void sha_pad_init(struct sha_pad *shapad) | ||
90 | { | ||
91 | memset(shapad->sha_pad1, 0x00, sizeof(shapad->sha_pad1)); | ||
92 | memset(shapad->sha_pad2, 0xF2, sizeof(shapad->sha_pad2)); | ||
93 | } | ||
94 | |||
95 | /* | ||
96 | * State for an MPPE (de)compressor. | ||
97 | */ | ||
98 | struct ppp_mppe_state { | ||
99 | struct crypto_tfm *arc4; | ||
100 | struct crypto_tfm *sha1; | ||
101 | unsigned char *sha1_digest; | ||
102 | unsigned char master_key[MPPE_MAX_KEY_LEN]; | ||
103 | unsigned char session_key[MPPE_MAX_KEY_LEN]; | ||
104 | unsigned keylen; /* key length in bytes */ | ||
105 | /* NB: 128-bit == 16, 40-bit == 8! */ | ||
106 | /* If we want to support 56-bit, */ | ||
107 | /* the unit has to change to bits */ | ||
108 | unsigned char bits; /* MPPE control bits */ | ||
109 | unsigned ccount; /* 12-bit coherency count (seqno) */ | ||
110 | unsigned stateful; /* stateful mode flag */ | ||
111 | int discard; /* stateful mode packet loss flag */ | ||
112 | int sanity_errors; /* take down LCP if too many */ | ||
113 | int unit; | ||
114 | int debug; | ||
115 | struct compstat stats; | ||
116 | }; | ||
117 | |||
118 | /* struct ppp_mppe_state.bits definitions */ | ||
119 | #define MPPE_BIT_A 0x80 /* Encryption table were (re)inititalized */ | ||
120 | #define MPPE_BIT_B 0x40 /* MPPC only (not implemented) */ | ||
121 | #define MPPE_BIT_C 0x20 /* MPPC only (not implemented) */ | ||
122 | #define MPPE_BIT_D 0x10 /* This is an encrypted frame */ | ||
123 | |||
124 | #define MPPE_BIT_FLUSHED MPPE_BIT_A | ||
125 | #define MPPE_BIT_ENCRYPTED MPPE_BIT_D | ||
126 | |||
127 | #define MPPE_BITS(p) ((p)[4] & 0xf0) | ||
128 | #define MPPE_CCOUNT(p) ((((p)[4] & 0x0f) << 8) + (p)[5]) | ||
129 | #define MPPE_CCOUNT_SPACE 0x1000 /* The size of the ccount space */ | ||
130 | |||
131 | #define MPPE_OVHD 2 /* MPPE overhead/packet */ | ||
132 | #define SANITY_MAX 1600 /* Max bogon factor we will tolerate */ | ||
133 | |||
134 | /* | ||
135 | * Key Derivation, from RFC 3078, RFC 3079. | ||
136 | * Equivalent to Get_Key() for MS-CHAP as described in RFC 3079. | ||
137 | */ | ||
138 | static void get_new_key_from_sha(struct ppp_mppe_state * state, unsigned char *InterimKey) | ||
139 | { | ||
140 | struct scatterlist sg[4]; | ||
141 | |||
142 | setup_sg(&sg[0], state->master_key, state->keylen); | ||
143 | setup_sg(&sg[1], sha_pad->sha_pad1, sizeof(sha_pad->sha_pad1)); | ||
144 | setup_sg(&sg[2], state->session_key, state->keylen); | ||
145 | setup_sg(&sg[3], sha_pad->sha_pad2, sizeof(sha_pad->sha_pad2)); | ||
146 | |||
147 | crypto_digest_digest (state->sha1, sg, 4, state->sha1_digest); | ||
148 | |||
149 | memcpy(InterimKey, state->sha1_digest, state->keylen); | ||
150 | } | ||
151 | |||
152 | /* | ||
153 | * Perform the MPPE rekey algorithm, from RFC 3078, sec. 7.3. | ||
154 | * Well, not what's written there, but rather what they meant. | ||
155 | */ | ||
156 | static void mppe_rekey(struct ppp_mppe_state * state, int initial_key) | ||
157 | { | ||
158 | unsigned char InterimKey[MPPE_MAX_KEY_LEN]; | ||
159 | struct scatterlist sg_in[1], sg_out[1]; | ||
160 | |||
161 | get_new_key_from_sha(state, InterimKey); | ||
162 | if (!initial_key) { | ||
163 | crypto_cipher_setkey(state->arc4, InterimKey, state->keylen); | ||
164 | setup_sg(sg_in, InterimKey, state->keylen); | ||
165 | setup_sg(sg_out, state->session_key, state->keylen); | ||
166 | if (crypto_cipher_encrypt(state->arc4, sg_out, sg_in, | ||
167 | state->keylen) != 0) { | ||
168 | printk(KERN_WARNING "mppe_rekey: cipher_encrypt failed\n"); | ||
169 | } | ||
170 | } else { | ||
171 | memcpy(state->session_key, InterimKey, state->keylen); | ||
172 | } | ||
173 | if (state->keylen == 8) { | ||
174 | /* See RFC 3078 */ | ||
175 | state->session_key[0] = 0xd1; | ||
176 | state->session_key[1] = 0x26; | ||
177 | state->session_key[2] = 0x9e; | ||
178 | } | ||
179 | crypto_cipher_setkey(state->arc4, state->session_key, state->keylen); | ||
180 | } | ||
181 | |||
182 | /* | ||
183 | * Allocate space for a (de)compressor. | ||
184 | */ | ||
185 | static void *mppe_alloc(unsigned char *options, int optlen) | ||
186 | { | ||
187 | struct ppp_mppe_state *state; | ||
188 | unsigned int digestsize; | ||
189 | |||
190 | if (optlen != CILEN_MPPE + sizeof(state->master_key) | ||
191 | || options[0] != CI_MPPE || options[1] != CILEN_MPPE) | ||
192 | goto out; | ||
193 | |||
194 | state = (struct ppp_mppe_state *) kmalloc(sizeof(*state), GFP_KERNEL); | ||
195 | if (state == NULL) | ||
196 | goto out; | ||
197 | |||
198 | memset(state, 0, sizeof(*state)); | ||
199 | |||
200 | state->arc4 = crypto_alloc_tfm("arc4", 0); | ||
201 | if (!state->arc4) | ||
202 | goto out_free; | ||
203 | |||
204 | state->sha1 = crypto_alloc_tfm("sha1", 0); | ||
205 | if (!state->sha1) | ||
206 | goto out_free; | ||
207 | |||
208 | digestsize = crypto_tfm_alg_digestsize(state->sha1); | ||
209 | if (digestsize < MPPE_MAX_KEY_LEN) | ||
210 | goto out_free; | ||
211 | |||
212 | state->sha1_digest = kmalloc(digestsize, GFP_KERNEL); | ||
213 | if (!state->sha1_digest) | ||
214 | goto out_free; | ||
215 | |||
216 | /* Save keys. */ | ||
217 | memcpy(state->master_key, &options[CILEN_MPPE], | ||
218 | sizeof(state->master_key)); | ||
219 | memcpy(state->session_key, state->master_key, | ||
220 | sizeof(state->master_key)); | ||
221 | |||
222 | /* | ||
223 | * We defer initial key generation until mppe_init(), as mppe_alloc() | ||
224 | * is called frequently during negotiation. | ||
225 | */ | ||
226 | |||
227 | return (void *)state; | ||
228 | |||
229 | out_free: | ||
230 | if (state->sha1_digest) | ||
231 | kfree(state->sha1_digest); | ||
232 | if (state->sha1) | ||
233 | crypto_free_tfm(state->sha1); | ||
234 | if (state->arc4) | ||
235 | crypto_free_tfm(state->arc4); | ||
236 | kfree(state); | ||
237 | out: | ||
238 | return NULL; | ||
239 | } | ||
240 | |||
241 | /* | ||
242 | * Deallocate space for a (de)compressor. | ||
243 | */ | ||
244 | static void mppe_free(void *arg) | ||
245 | { | ||
246 | struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; | ||
247 | if (state) { | ||
248 | if (state->sha1_digest) | ||
249 | kfree(state->sha1_digest); | ||
250 | if (state->sha1) | ||
251 | crypto_free_tfm(state->sha1); | ||
252 | if (state->arc4) | ||
253 | crypto_free_tfm(state->arc4); | ||
254 | kfree(state); | ||
255 | } | ||
256 | } | ||
257 | |||
258 | /* | ||
259 | * Initialize (de)compressor state. | ||
260 | */ | ||
261 | static int | ||
262 | mppe_init(void *arg, unsigned char *options, int optlen, int unit, int debug, | ||
263 | const char *debugstr) | ||
264 | { | ||
265 | struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; | ||
266 | unsigned char mppe_opts; | ||
267 | |||
268 | if (optlen != CILEN_MPPE | ||
269 | || options[0] != CI_MPPE || options[1] != CILEN_MPPE) | ||
270 | return 0; | ||
271 | |||
272 | MPPE_CI_TO_OPTS(&options[2], mppe_opts); | ||
273 | if (mppe_opts & MPPE_OPT_128) | ||
274 | state->keylen = 16; | ||
275 | else if (mppe_opts & MPPE_OPT_40) | ||
276 | state->keylen = 8; | ||
277 | else { | ||
278 | printk(KERN_WARNING "%s[%d]: unknown key length\n", debugstr, | ||
279 | unit); | ||
280 | return 0; | ||
281 | } | ||
282 | if (mppe_opts & MPPE_OPT_STATEFUL) | ||
283 | state->stateful = 1; | ||
284 | |||
285 | /* Generate the initial session key. */ | ||
286 | mppe_rekey(state, 1); | ||
287 | |||
288 | if (debug) { | ||
289 | int i; | ||
290 | char mkey[sizeof(state->master_key) * 2 + 1]; | ||
291 | char skey[sizeof(state->session_key) * 2 + 1]; | ||
292 | |||
293 | printk(KERN_DEBUG "%s[%d]: initialized with %d-bit %s mode\n", | ||
294 | debugstr, unit, (state->keylen == 16) ? 128 : 40, | ||
295 | (state->stateful) ? "stateful" : "stateless"); | ||
296 | |||
297 | for (i = 0; i < sizeof(state->master_key); i++) | ||
298 | sprintf(mkey + i * 2, "%02x", state->master_key[i]); | ||
299 | for (i = 0; i < sizeof(state->session_key); i++) | ||
300 | sprintf(skey + i * 2, "%02x", state->session_key[i]); | ||
301 | printk(KERN_DEBUG | ||
302 | "%s[%d]: keys: master: %s initial session: %s\n", | ||
303 | debugstr, unit, mkey, skey); | ||
304 | } | ||
305 | |||
306 | /* | ||
307 | * Initialize the coherency count. The initial value is not specified | ||
308 | * in RFC 3078, but we can make a reasonable assumption that it will | ||
309 | * start at 0. Setting it to the max here makes the comp/decomp code | ||
310 | * do the right thing (determined through experiment). | ||
311 | */ | ||
312 | state->ccount = MPPE_CCOUNT_SPACE - 1; | ||
313 | |||
314 | /* | ||
315 | * Note that even though we have initialized the key table, we don't | ||
316 | * set the FLUSHED bit. This is contrary to RFC 3078, sec. 3.1. | ||
317 | */ | ||
318 | state->bits = MPPE_BIT_ENCRYPTED; | ||
319 | |||
320 | state->unit = unit; | ||
321 | state->debug = debug; | ||
322 | |||
323 | return 1; | ||
324 | } | ||
325 | |||
326 | static int | ||
327 | mppe_comp_init(void *arg, unsigned char *options, int optlen, int unit, | ||
328 | int hdrlen, int debug) | ||
329 | { | ||
330 | /* ARGSUSED */ | ||
331 | return mppe_init(arg, options, optlen, unit, debug, "mppe_comp_init"); | ||
332 | } | ||
333 | |||
334 | /* | ||
335 | * We received a CCP Reset-Request (actually, we are sending a Reset-Ack), | ||
336 | * tell the compressor to rekey. Note that we MUST NOT rekey for | ||
337 | * every CCP Reset-Request; we only rekey on the next xmit packet. | ||
338 | * We might get multiple CCP Reset-Requests if our CCP Reset-Ack is lost. | ||
339 | * So, rekeying for every CCP Reset-Request is broken as the peer will not | ||
340 | * know how many times we've rekeyed. (If we rekey and THEN get another | ||
341 | * CCP Reset-Request, we must rekey again.) | ||
342 | */ | ||
343 | static void mppe_comp_reset(void *arg) | ||
344 | { | ||
345 | struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; | ||
346 | |||
347 | state->bits |= MPPE_BIT_FLUSHED; | ||
348 | } | ||
349 | |||
350 | /* | ||
351 | * Compress (encrypt) a packet. | ||
352 | * It's strange to call this a compressor, since the output is always | ||
353 | * MPPE_OVHD + 2 bytes larger than the input. | ||
354 | */ | ||
355 | static int | ||
356 | mppe_compress(void *arg, unsigned char *ibuf, unsigned char *obuf, | ||
357 | int isize, int osize) | ||
358 | { | ||
359 | struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; | ||
360 | int proto; | ||
361 | struct scatterlist sg_in[1], sg_out[1]; | ||
362 | |||
363 | /* | ||
364 | * Check that the protocol is in the range we handle. | ||
365 | */ | ||
366 | proto = PPP_PROTOCOL(ibuf); | ||
367 | if (proto < 0x0021 || proto > 0x00fa) | ||
368 | return 0; | ||
369 | |||
370 | /* Make sure we have enough room to generate an encrypted packet. */ | ||
371 | if (osize < isize + MPPE_OVHD + 2) { | ||
372 | /* Drop the packet if we should encrypt it, but can't. */ | ||
373 | printk(KERN_DEBUG "mppe_compress[%d]: osize too small! " | ||
374 | "(have: %d need: %d)\n", state->unit, | ||
375 | osize, osize + MPPE_OVHD + 2); | ||
376 | return -1; | ||
377 | } | ||
378 | |||
379 | osize = isize + MPPE_OVHD + 2; | ||
380 | |||
381 | /* | ||
382 | * Copy over the PPP header and set control bits. | ||
383 | */ | ||
384 | obuf[0] = PPP_ADDRESS(ibuf); | ||
385 | obuf[1] = PPP_CONTROL(ibuf); | ||
386 | obuf[2] = PPP_COMP >> 8; /* isize + MPPE_OVHD + 1 */ | ||
387 | obuf[3] = PPP_COMP; /* isize + MPPE_OVHD + 2 */ | ||
388 | obuf += PPP_HDRLEN; | ||
389 | |||
390 | state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE; | ||
391 | if (state->debug >= 7) | ||
392 | printk(KERN_DEBUG "mppe_compress[%d]: ccount %d\n", state->unit, | ||
393 | state->ccount); | ||
394 | obuf[0] = state->ccount >> 8; | ||
395 | obuf[1] = state->ccount & 0xff; | ||
396 | |||
397 | if (!state->stateful || /* stateless mode */ | ||
398 | ((state->ccount & 0xff) == 0xff) || /* "flag" packet */ | ||
399 | (state->bits & MPPE_BIT_FLUSHED)) { /* CCP Reset-Request */ | ||
400 | /* We must rekey */ | ||
401 | if (state->debug && state->stateful) | ||
402 | printk(KERN_DEBUG "mppe_compress[%d]: rekeying\n", | ||
403 | state->unit); | ||
404 | mppe_rekey(state, 0); | ||
405 | state->bits |= MPPE_BIT_FLUSHED; | ||
406 | } | ||
407 | obuf[0] |= state->bits; | ||
408 | state->bits &= ~MPPE_BIT_FLUSHED; /* reset for next xmit */ | ||
409 | |||
410 | obuf += MPPE_OVHD; | ||
411 | ibuf += 2; /* skip to proto field */ | ||
412 | isize -= 2; | ||
413 | |||
414 | /* Encrypt packet */ | ||
415 | setup_sg(sg_in, ibuf, isize); | ||
416 | setup_sg(sg_out, obuf, osize); | ||
417 | if (crypto_cipher_encrypt(state->arc4, sg_out, sg_in, isize) != 0) { | ||
418 | printk(KERN_DEBUG "crypto_cypher_encrypt failed\n"); | ||
419 | return -1; | ||
420 | } | ||
421 | |||
422 | state->stats.unc_bytes += isize; | ||
423 | state->stats.unc_packets++; | ||
424 | state->stats.comp_bytes += osize; | ||
425 | state->stats.comp_packets++; | ||
426 | |||
427 | return osize; | ||
428 | } | ||
429 | |||
430 | /* | ||
431 | * Since every frame grows by MPPE_OVHD + 2 bytes, this is always going | ||
432 | * to look bad ... and the longer the link is up the worse it will get. | ||
433 | */ | ||
434 | static void mppe_comp_stats(void *arg, struct compstat *stats) | ||
435 | { | ||
436 | struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; | ||
437 | |||
438 | *stats = state->stats; | ||
439 | } | ||
440 | |||
441 | static int | ||
442 | mppe_decomp_init(void *arg, unsigned char *options, int optlen, int unit, | ||
443 | int hdrlen, int mru, int debug) | ||
444 | { | ||
445 | /* ARGSUSED */ | ||
446 | return mppe_init(arg, options, optlen, unit, debug, "mppe_decomp_init"); | ||
447 | } | ||
448 | |||
449 | /* | ||
450 | * We received a CCP Reset-Ack. Just ignore it. | ||
451 | */ | ||
452 | static void mppe_decomp_reset(void *arg) | ||
453 | { | ||
454 | /* ARGSUSED */ | ||
455 | return; | ||
456 | } | ||
457 | |||
458 | /* | ||
459 | * Decompress (decrypt) an MPPE packet. | ||
460 | */ | ||
461 | static int | ||
462 | mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf, | ||
463 | int osize) | ||
464 | { | ||
465 | struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; | ||
466 | unsigned ccount; | ||
467 | int flushed = MPPE_BITS(ibuf) & MPPE_BIT_FLUSHED; | ||
468 | int sanity = 0; | ||
469 | struct scatterlist sg_in[1], sg_out[1]; | ||
470 | |||
471 | if (isize <= PPP_HDRLEN + MPPE_OVHD) { | ||
472 | if (state->debug) | ||
473 | printk(KERN_DEBUG | ||
474 | "mppe_decompress[%d]: short pkt (%d)\n", | ||
475 | state->unit, isize); | ||
476 | return DECOMP_ERROR; | ||
477 | } | ||
478 | |||
479 | /* | ||
480 | * Make sure we have enough room to decrypt the packet. | ||
481 | * Note that for our test we only subtract 1 byte whereas in | ||
482 | * mppe_compress() we added 2 bytes (+MPPE_OVHD); | ||
483 | * this is to account for possible PFC. | ||
484 | */ | ||
485 | if (osize < isize - MPPE_OVHD - 1) { | ||
486 | printk(KERN_DEBUG "mppe_decompress[%d]: osize too small! " | ||
487 | "(have: %d need: %d)\n", state->unit, | ||
488 | osize, isize - MPPE_OVHD - 1); | ||
489 | return DECOMP_ERROR; | ||
490 | } | ||
491 | osize = isize - MPPE_OVHD - 2; /* assume no PFC */ | ||
492 | |||
493 | ccount = MPPE_CCOUNT(ibuf); | ||
494 | if (state->debug >= 7) | ||
495 | printk(KERN_DEBUG "mppe_decompress[%d]: ccount %d\n", | ||
496 | state->unit, ccount); | ||
497 | |||
498 | /* sanity checks -- terminate with extreme prejudice */ | ||
499 | if (!(MPPE_BITS(ibuf) & MPPE_BIT_ENCRYPTED)) { | ||
500 | printk(KERN_DEBUG | ||
501 | "mppe_decompress[%d]: ENCRYPTED bit not set!\n", | ||
502 | state->unit); | ||
503 | state->sanity_errors += 100; | ||
504 | sanity = 1; | ||
505 | } | ||
506 | if (!state->stateful && !flushed) { | ||
507 | printk(KERN_DEBUG "mppe_decompress[%d]: FLUSHED bit not set in " | ||
508 | "stateless mode!\n", state->unit); | ||
509 | state->sanity_errors += 100; | ||
510 | sanity = 1; | ||
511 | } | ||
512 | if (state->stateful && ((ccount & 0xff) == 0xff) && !flushed) { | ||
513 | printk(KERN_DEBUG "mppe_decompress[%d]: FLUSHED bit not set on " | ||
514 | "flag packet!\n", state->unit); | ||
515 | state->sanity_errors += 100; | ||
516 | sanity = 1; | ||
517 | } | ||
518 | |||
519 | if (sanity) { | ||
520 | if (state->sanity_errors < SANITY_MAX) | ||
521 | return DECOMP_ERROR; | ||
522 | else | ||
523 | /* | ||
524 | * Take LCP down if the peer is sending too many bogons. | ||
525 | * We don't want to do this for a single or just a few | ||
526 | * instances since it could just be due to packet corruption. | ||
527 | */ | ||
528 | return DECOMP_FATALERROR; | ||
529 | } | ||
530 | |||
531 | /* | ||
532 | * Check the coherency count. | ||
533 | */ | ||
534 | |||
535 | if (!state->stateful) { | ||
536 | /* RFC 3078, sec 8.1. Rekey for every packet. */ | ||
537 | while (state->ccount != ccount) { | ||
538 | mppe_rekey(state, 0); | ||
539 | state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE; | ||
540 | } | ||
541 | } else { | ||
542 | /* RFC 3078, sec 8.2. */ | ||
543 | if (!state->discard) { | ||
544 | /* normal state */ | ||
545 | state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE; | ||
546 | if (ccount != state->ccount) { | ||
547 | /* | ||
548 | * (ccount > state->ccount) | ||
549 | * Packet loss detected, enter the discard state. | ||
550 | * Signal the peer to rekey (by sending a CCP Reset-Request). | ||
551 | */ | ||
552 | state->discard = 1; | ||
553 | return DECOMP_ERROR; | ||
554 | } | ||
555 | } else { | ||
556 | /* discard state */ | ||
557 | if (!flushed) { | ||
558 | /* ccp.c will be silent (no additional CCP Reset-Requests). */ | ||
559 | return DECOMP_ERROR; | ||
560 | } else { | ||
561 | /* Rekey for every missed "flag" packet. */ | ||
562 | while ((ccount & ~0xff) != | ||
563 | (state->ccount & ~0xff)) { | ||
564 | mppe_rekey(state, 0); | ||
565 | state->ccount = | ||
566 | (state->ccount + | ||
567 | 256) % MPPE_CCOUNT_SPACE; | ||
568 | } | ||
569 | |||
570 | /* reset */ | ||
571 | state->discard = 0; | ||
572 | state->ccount = ccount; | ||
573 | /* | ||
574 | * Another problem with RFC 3078 here. It implies that the | ||
575 | * peer need not send a Reset-Ack packet. But RFC 1962 | ||
576 | * requires it. Hopefully, M$ does send a Reset-Ack; even | ||
577 | * though it isn't required for MPPE synchronization, it is | ||
578 | * required to reset CCP state. | ||
579 | */ | ||
580 | } | ||
581 | } | ||
582 | if (flushed) | ||
583 | mppe_rekey(state, 0); | ||
584 | } | ||
585 | |||
586 | /* | ||
587 | * Fill in the first part of the PPP header. The protocol field | ||
588 | * comes from the decrypted data. | ||
589 | */ | ||
590 | obuf[0] = PPP_ADDRESS(ibuf); /* +1 */ | ||
591 | obuf[1] = PPP_CONTROL(ibuf); /* +1 */ | ||
592 | obuf += 2; | ||
593 | ibuf += PPP_HDRLEN + MPPE_OVHD; | ||
594 | isize -= PPP_HDRLEN + MPPE_OVHD; /* -6 */ | ||
595 | /* net osize: isize-4 */ | ||
596 | |||
597 | /* | ||
598 | * Decrypt the first byte in order to check if it is | ||
599 | * a compressed or uncompressed protocol field. | ||
600 | */ | ||
601 | setup_sg(sg_in, ibuf, 1); | ||
602 | setup_sg(sg_out, obuf, 1); | ||
603 | if (crypto_cipher_decrypt(state->arc4, sg_out, sg_in, 1) != 0) { | ||
604 | printk(KERN_DEBUG "crypto_cypher_decrypt failed\n"); | ||
605 | return DECOMP_ERROR; | ||
606 | } | ||
607 | |||
608 | /* | ||
609 | * Do PFC decompression. | ||
610 | * This would be nicer if we were given the actual sk_buff | ||
611 | * instead of a char *. | ||
612 | */ | ||
613 | if ((obuf[0] & 0x01) != 0) { | ||
614 | obuf[1] = obuf[0]; | ||
615 | obuf[0] = 0; | ||
616 | obuf++; | ||
617 | osize++; | ||
618 | } | ||
619 | |||
620 | /* And finally, decrypt the rest of the packet. */ | ||
621 | setup_sg(sg_in, ibuf + 1, isize - 1); | ||
622 | setup_sg(sg_out, obuf + 1, osize - 1); | ||
623 | if (crypto_cipher_decrypt(state->arc4, sg_out, sg_in, isize - 1) != 0) { | ||
624 | printk(KERN_DEBUG "crypto_cypher_decrypt failed\n"); | ||
625 | return DECOMP_ERROR; | ||
626 | } | ||
627 | |||
628 | state->stats.unc_bytes += osize; | ||
629 | state->stats.unc_packets++; | ||
630 | state->stats.comp_bytes += isize; | ||
631 | state->stats.comp_packets++; | ||
632 | |||
633 | /* good packet credit */ | ||
634 | state->sanity_errors >>= 1; | ||
635 | |||
636 | return osize; | ||
637 | } | ||
638 | |||
639 | /* | ||
640 | * Incompressible data has arrived (this should never happen!). | ||
641 | * We should probably drop the link if the protocol is in the range | ||
642 | * of what should be encrypted. At the least, we should drop this | ||
643 | * packet. (How to do this?) | ||
644 | */ | ||
645 | static void mppe_incomp(void *arg, unsigned char *ibuf, int icnt) | ||
646 | { | ||
647 | struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; | ||
648 | |||
649 | if (state->debug && | ||
650 | (PPP_PROTOCOL(ibuf) >= 0x0021 && PPP_PROTOCOL(ibuf) <= 0x00fa)) | ||
651 | printk(KERN_DEBUG | ||
652 | "mppe_incomp[%d]: incompressible (unencrypted) data! " | ||
653 | "(proto %04x)\n", state->unit, PPP_PROTOCOL(ibuf)); | ||
654 | |||
655 | state->stats.inc_bytes += icnt; | ||
656 | state->stats.inc_packets++; | ||
657 | state->stats.unc_bytes += icnt; | ||
658 | state->stats.unc_packets++; | ||
659 | } | ||
660 | |||
661 | /************************************************************* | ||
662 | * Module interface table | ||
663 | *************************************************************/ | ||
664 | |||
665 | /* | ||
666 | * Procedures exported to if_ppp.c. | ||
667 | */ | ||
668 | static struct compressor ppp_mppe = { | ||
669 | .compress_proto = CI_MPPE, | ||
670 | .comp_alloc = mppe_alloc, | ||
671 | .comp_free = mppe_free, | ||
672 | .comp_init = mppe_comp_init, | ||
673 | .comp_reset = mppe_comp_reset, | ||
674 | .compress = mppe_compress, | ||
675 | .comp_stat = mppe_comp_stats, | ||
676 | .decomp_alloc = mppe_alloc, | ||
677 | .decomp_free = mppe_free, | ||
678 | .decomp_init = mppe_decomp_init, | ||
679 | .decomp_reset = mppe_decomp_reset, | ||
680 | .decompress = mppe_decompress, | ||
681 | .incomp = mppe_incomp, | ||
682 | .decomp_stat = mppe_comp_stats, | ||
683 | .owner = THIS_MODULE, | ||
684 | .comp_extra = MPPE_PAD, | ||
685 | }; | ||
686 | |||
687 | /* | ||
688 | * ppp_mppe_init() | ||
689 | * | ||
690 | * Prior to allowing load, try to load the arc4 and sha1 crypto | ||
691 | * libraries. The actual use will be allocated later, but | ||
692 | * this way the module will fail to insmod if they aren't available. | ||
693 | */ | ||
694 | |||
695 | static int __init ppp_mppe_init(void) | ||
696 | { | ||
697 | int answer; | ||
698 | if (!(crypto_alg_available("arc4", 0) && | ||
699 | crypto_alg_available("sha1", 0))) | ||
700 | return -ENODEV; | ||
701 | |||
702 | sha_pad = kmalloc(sizeof(struct sha_pad), GFP_KERNEL); | ||
703 | if (!sha_pad) | ||
704 | return -ENOMEM; | ||
705 | sha_pad_init(sha_pad); | ||
706 | |||
707 | answer = ppp_register_compressor(&ppp_mppe); | ||
708 | |||
709 | if (answer == 0) | ||
710 | printk(KERN_INFO "PPP MPPE Compression module registered\n"); | ||
711 | else | ||
712 | kfree(sha_pad); | ||
713 | |||
714 | return answer; | ||
715 | } | ||
716 | |||
717 | static void __exit ppp_mppe_cleanup(void) | ||
718 | { | ||
719 | ppp_unregister_compressor(&ppp_mppe); | ||
720 | kfree(sha_pad); | ||
721 | } | ||
722 | |||
723 | module_init(ppp_mppe_init); | ||
724 | module_exit(ppp_mppe_cleanup); | ||
diff --git a/drivers/net/ppp_mppe.h b/drivers/net/ppp_mppe.h new file mode 100644 index 000000000000..7a14e058c668 --- /dev/null +++ b/drivers/net/ppp_mppe.h | |||
@@ -0,0 +1,86 @@ | |||
1 | #define MPPE_PAD 4 /* MPPE growth per frame */ | ||
2 | #define MPPE_MAX_KEY_LEN 16 /* largest key length (128-bit) */ | ||
3 | |||
4 | /* option bits for ccp_options.mppe */ | ||
5 | #define MPPE_OPT_40 0x01 /* 40 bit */ | ||
6 | #define MPPE_OPT_128 0x02 /* 128 bit */ | ||
7 | #define MPPE_OPT_STATEFUL 0x04 /* stateful mode */ | ||
8 | /* unsupported opts */ | ||
9 | #define MPPE_OPT_56 0x08 /* 56 bit */ | ||
10 | #define MPPE_OPT_MPPC 0x10 /* MPPC compression */ | ||
11 | #define MPPE_OPT_D 0x20 /* Unknown */ | ||
12 | #define MPPE_OPT_UNSUPPORTED (MPPE_OPT_56|MPPE_OPT_MPPC|MPPE_OPT_D) | ||
13 | #define MPPE_OPT_UNKNOWN 0x40 /* Bits !defined in RFC 3078 were set */ | ||
14 | |||
15 | /* | ||
16 | * This is not nice ... the alternative is a bitfield struct though. | ||
17 | * And unfortunately, we cannot share the same bits for the option | ||
18 | * names above since C and H are the same bit. We could do a u_int32 | ||
19 | * but then we have to do a htonl() all the time and/or we still need | ||
20 | * to know which octet is which. | ||
21 | */ | ||
22 | #define MPPE_C_BIT 0x01 /* MPPC */ | ||
23 | #define MPPE_D_BIT 0x10 /* Obsolete, usage unknown */ | ||
24 | #define MPPE_L_BIT 0x20 /* 40-bit */ | ||
25 | #define MPPE_S_BIT 0x40 /* 128-bit */ | ||
26 | #define MPPE_M_BIT 0x80 /* 56-bit, not supported */ | ||
27 | #define MPPE_H_BIT 0x01 /* Stateless (in a different byte) */ | ||
28 | |||
29 | /* Does not include H bit; used for least significant octet only. */ | ||
30 | #define MPPE_ALL_BITS (MPPE_D_BIT|MPPE_L_BIT|MPPE_S_BIT|MPPE_M_BIT|MPPE_H_BIT) | ||
31 | |||
32 | /* Build a CI from mppe opts (see RFC 3078) */ | ||
33 | #define MPPE_OPTS_TO_CI(opts, ci) \ | ||
34 | do { \ | ||
35 | u_char *ptr = ci; /* u_char[4] */ \ | ||
36 | \ | ||
37 | /* H bit */ \ | ||
38 | if (opts & MPPE_OPT_STATEFUL) \ | ||
39 | *ptr++ = 0x0; \ | ||
40 | else \ | ||
41 | *ptr++ = MPPE_H_BIT; \ | ||
42 | *ptr++ = 0; \ | ||
43 | *ptr++ = 0; \ | ||
44 | \ | ||
45 | /* S,L bits */ \ | ||
46 | *ptr = 0; \ | ||
47 | if (opts & MPPE_OPT_128) \ | ||
48 | *ptr |= MPPE_S_BIT; \ | ||
49 | if (opts & MPPE_OPT_40) \ | ||
50 | *ptr |= MPPE_L_BIT; \ | ||
51 | /* M,D,C bits not supported */ \ | ||
52 | } while (/* CONSTCOND */ 0) | ||
53 | |||
54 | /* The reverse of the above */ | ||
55 | #define MPPE_CI_TO_OPTS(ci, opts) \ | ||
56 | do { \ | ||
57 | u_char *ptr = ci; /* u_char[4] */ \ | ||
58 | \ | ||
59 | opts = 0; \ | ||
60 | \ | ||
61 | /* H bit */ \ | ||
62 | if (!(ptr[0] & MPPE_H_BIT)) \ | ||
63 | opts |= MPPE_OPT_STATEFUL; \ | ||
64 | \ | ||
65 | /* S,L bits */ \ | ||
66 | if (ptr[3] & MPPE_S_BIT) \ | ||
67 | opts |= MPPE_OPT_128; \ | ||
68 | if (ptr[3] & MPPE_L_BIT) \ | ||
69 | opts |= MPPE_OPT_40; \ | ||
70 | \ | ||
71 | /* M,D,C bits */ \ | ||
72 | if (ptr[3] & MPPE_M_BIT) \ | ||
73 | opts |= MPPE_OPT_56; \ | ||
74 | if (ptr[3] & MPPE_D_BIT) \ | ||
75 | opts |= MPPE_OPT_D; \ | ||
76 | if (ptr[3] & MPPE_C_BIT) \ | ||
77 | opts |= MPPE_OPT_MPPC; \ | ||
78 | \ | ||
79 | /* Other bits */ \ | ||
80 | if (ptr[0] & ~MPPE_H_BIT) \ | ||
81 | opts |= MPPE_OPT_UNKNOWN; \ | ||
82 | if (ptr[1] || ptr[2]) \ | ||
83 | opts |= MPPE_OPT_UNKNOWN; \ | ||
84 | if (ptr[3] & ~MPPE_ALL_BITS) \ | ||
85 | opts |= MPPE_OPT_UNKNOWN; \ | ||
86 | } while (/* CONSTCOND */ 0) | ||
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 24b7233a803c..e57df8dfe6b4 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -55,7 +55,6 @@ | |||
55 | #include <linux/timex.h> | 55 | #include <linux/timex.h> |
56 | #include <linux/sched.h> | 56 | #include <linux/sched.h> |
57 | #include <linux/ethtool.h> | 57 | #include <linux/ethtool.h> |
58 | #include <linux/version.h> | ||
59 | #include <linux/workqueue.h> | 58 | #include <linux/workqueue.h> |
60 | #include <linux/if_vlan.h> | 59 | #include <linux/if_vlan.h> |
61 | 60 | ||
diff --git a/drivers/net/sk98lin/h/skdrv1st.h b/drivers/net/sk98lin/h/skdrv1st.h index 308440bd0e12..91b8d4f45904 100644 --- a/drivers/net/sk98lin/h/skdrv1st.h +++ b/drivers/net/sk98lin/h/skdrv1st.h | |||
@@ -39,9 +39,6 @@ | |||
39 | #ifndef __INC_SKDRV1ST_H | 39 | #ifndef __INC_SKDRV1ST_H |
40 | #define __INC_SKDRV1ST_H | 40 | #define __INC_SKDRV1ST_H |
41 | 41 | ||
42 | /* Check kernel version */ | ||
43 | #include <linux/version.h> | ||
44 | |||
45 | typedef struct s_AC SK_AC; | 42 | typedef struct s_AC SK_AC; |
46 | 43 | ||
47 | /* Set card versions */ | 44 | /* Set card versions */ |
diff --git a/drivers/net/sk_mca.c b/drivers/net/sk_mca.c index 4c56b8d8221b..e5d6d95960c7 100644 --- a/drivers/net/sk_mca.c +++ b/drivers/net/sk_mca.c | |||
@@ -93,7 +93,6 @@ History: | |||
93 | #include <linux/mca-legacy.h> | 93 | #include <linux/mca-legacy.h> |
94 | #include <linux/init.h> | 94 | #include <linux/init.h> |
95 | #include <linux/module.h> | 95 | #include <linux/module.h> |
96 | #include <linux/version.h> | ||
97 | #include <linux/netdevice.h> | 96 | #include <linux/netdevice.h> |
98 | #include <linux/etherdevice.h> | 97 | #include <linux/etherdevice.h> |
99 | #include <linux/skbuff.h> | 98 | #include <linux/skbuff.h> |
diff --git a/drivers/net/sk_mca.h b/drivers/net/sk_mca.h index 7e7c99582746..d6fa1823dfa6 100644 --- a/drivers/net/sk_mca.h +++ b/drivers/net/sk_mca.h | |||
@@ -1,5 +1,3 @@ | |||
1 | #include <linux/version.h> | ||
2 | |||
3 | #ifndef _SK_MCA_INCLUDE_ | 1 | #ifndef _SK_MCA_INCLUDE_ |
4 | #define _SK_MCA_INCLUDE_ | 2 | #define _SK_MCA_INCLUDE_ |
5 | 3 | ||
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 38b2b0a3ce96..d167deda9a53 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c | |||
@@ -147,7 +147,6 @@ TODO: - fix forced speed/duplexing code (broken a long time ago, when | |||
147 | #define DRV_RELDATE "October 3, 2005" | 147 | #define DRV_RELDATE "October 3, 2005" |
148 | 148 | ||
149 | #include <linux/config.h> | 149 | #include <linux/config.h> |
150 | #include <linux/version.h> | ||
151 | #include <linux/module.h> | 150 | #include <linux/module.h> |
152 | #include <linux/kernel.h> | 151 | #include <linux/kernel.h> |
153 | #include <linux/pci.h> | 152 | #include <linux/pci.h> |
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index a368d08e7d19..82c6b757d306 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -61,7 +61,6 @@ | |||
61 | #include <linux/timer.h> | 61 | #include <linux/timer.h> |
62 | #include <linux/slab.h> | 62 | #include <linux/slab.h> |
63 | #include <linux/interrupt.h> | 63 | #include <linux/interrupt.h> |
64 | #include <linux/version.h> | ||
65 | #include <linux/string.h> | 64 | #include <linux/string.h> |
66 | #include <linux/wait.h> | 65 | #include <linux/wait.h> |
67 | #include <asm/io.h> | 66 | #include <asm/io.h> |
diff --git a/drivers/net/wireless/hostap/hostap.c b/drivers/net/wireless/hostap/hostap.c index 6a96cd9f2685..3d2ea61033be 100644 --- a/drivers/net/wireless/hostap/hostap.c +++ b/drivers/net/wireless/hostap/hostap.c | |||
@@ -13,7 +13,6 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/config.h> | 15 | #include <linux/config.h> |
16 | #include <linux/version.h> | ||
17 | #include <linux/module.h> | 16 | #include <linux/module.h> |
18 | #include <linux/init.h> | 17 | #include <linux/init.h> |
19 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index 59fc15572395..abfae7fedebc 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
@@ -31,7 +31,6 @@ | |||
31 | 31 | ||
32 | 32 | ||
33 | #include <linux/config.h> | 33 | #include <linux/config.h> |
34 | #include <linux/version.h> | ||
35 | 34 | ||
36 | #include <asm/delay.h> | 35 | #include <asm/delay.h> |
37 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c index da0c80fb941c..2e85bdced2dd 100644 --- a/drivers/net/wireless/hostap/hostap_pci.c +++ b/drivers/net/wireless/hostap/hostap_pci.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * Andy Warner <andyw@pobox.com> */ | 5 | * Andy Warner <andyw@pobox.com> */ |
6 | 6 | ||
7 | #include <linux/config.h> | 7 | #include <linux/config.h> |
8 | #include <linux/version.h> | ||
9 | #include <linux/module.h> | 8 | #include <linux/module.h> |
10 | #include <linux/init.h> | 9 | #include <linux/init.h> |
11 | #include <linux/if.h> | 10 | #include <linux/if.h> |
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c index 78d67b408b2f..94fe2449f099 100644 --- a/drivers/net/wireless/hostap/hostap_plx.c +++ b/drivers/net/wireless/hostap/hostap_plx.c | |||
@@ -8,7 +8,6 @@ | |||
8 | 8 | ||
9 | 9 | ||
10 | #include <linux/config.h> | 10 | #include <linux/config.h> |
11 | #include <linux/version.h> | ||
12 | #include <linux/module.h> | 11 | #include <linux/module.h> |
13 | #include <linux/init.h> | 12 | #include <linux/init.h> |
14 | #include <linux/if.h> | 13 | #include <linux/if.h> |
diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h index a1a9cbcf6c2f..140fdf2a0a09 100644 --- a/drivers/net/wireless/ipw2100.h +++ b/drivers/net/wireless/ipw2100.h | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/socket.h> | 37 | #include <linux/socket.h> |
38 | #include <linux/if_arp.h> | 38 | #include <linux/if_arp.h> |
39 | #include <linux/wireless.h> | 39 | #include <linux/wireless.h> |
40 | #include <linux/version.h> | ||
41 | #include <net/iw_handler.h> // new driver API | 40 | #include <net/iw_handler.h> // new driver API |
42 | 41 | ||
43 | #include <net/ieee80211.h> | 42 | #include <net/ieee80211.h> |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 136884cef908..b0d195d1721a 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -31,6 +31,7 @@ | |||
31 | ******************************************************************************/ | 31 | ******************************************************************************/ |
32 | 32 | ||
33 | #include "ipw2200.h" | 33 | #include "ipw2200.h" |
34 | #include <linux/version.h> | ||
34 | 35 | ||
35 | #define IPW2200_VERSION "git-1.0.8" | 36 | #define IPW2200_VERSION "git-1.0.8" |
36 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" | 37 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" |
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index 617ec4dba17a..1c98db0652c9 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/config.h> | 34 | #include <linux/config.h> |
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | 36 | ||
37 | #include <linux/version.h> | ||
38 | #include <linux/pci.h> | 37 | #include <linux/pci.h> |
39 | #include <linux/netdevice.h> | 38 | #include <linux/netdevice.h> |
40 | #include <linux/ethtool.h> | 39 | #include <linux/ethtool.h> |
diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h index 7a17bb31fc89..f5d856db92a1 100644 --- a/drivers/net/wireless/orinoco.h +++ b/drivers/net/wireless/orinoco.h | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/netdevice.h> | 12 | #include <linux/netdevice.h> |
13 | #include <linux/wireless.h> | 13 | #include <linux/wireless.h> |
14 | #include <net/iw_handler.h> | 14 | #include <net/iw_handler.h> |
15 | #include <linux/version.h> | ||
16 | 15 | ||
17 | #include "hermes.h" | 16 | #include "hermes.h" |
18 | 17 | ||
diff --git a/drivers/net/wireless/prism54/isl_38xx.c b/drivers/net/wireless/prism54/isl_38xx.c index 866c476933c3..109a96d90007 100644 --- a/drivers/net/wireless/prism54/isl_38xx.c +++ b/drivers/net/wireless/prism54/isl_38xx.c | |||
@@ -18,7 +18,6 @@ | |||
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/version.h> | ||
22 | #include <linux/module.h> | 21 | #include <linux/module.h> |
23 | #include <linux/types.h> | 22 | #include <linux/types.h> |
24 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
diff --git a/drivers/net/wireless/prism54/isl_38xx.h b/drivers/net/wireless/prism54/isl_38xx.h index e83e4912ab66..8af20980af8d 100644 --- a/drivers/net/wireless/prism54/isl_38xx.h +++ b/drivers/net/wireless/prism54/isl_38xx.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #ifndef _ISL_38XX_H | 20 | #ifndef _ISL_38XX_H |
21 | #define _ISL_38XX_H | 21 | #define _ISL_38XX_H |
22 | 22 | ||
23 | #include <linux/version.h> | ||
24 | #include <asm/io.h> | 23 | #include <asm/io.h> |
25 | #include <asm/byteorder.h> | 24 | #include <asm/byteorder.h> |
26 | 25 | ||
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index 5c1a1adf1ff8..135a156db25d 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c | |||
@@ -20,7 +20,6 @@ | |||
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/version.h> | ||
24 | #include <linux/module.h> | 23 | #include <linux/module.h> |
25 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
26 | #include <linux/if_arp.h> | 25 | #include <linux/if_arp.h> |
diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c index 78bdb359835e..5ddf29599032 100644 --- a/drivers/net/wireless/prism54/islpci_dev.c +++ b/drivers/net/wireless/prism54/islpci_dev.c | |||
@@ -19,7 +19,6 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/version.h> | ||
23 | #include <linux/module.h> | 22 | #include <linux/module.h> |
24 | 23 | ||
25 | #include <linux/netdevice.h> | 24 | #include <linux/netdevice.h> |
diff --git a/drivers/net/wireless/prism54/islpci_dev.h b/drivers/net/wireless/prism54/islpci_dev.h index efbed4397951..07053165e4c5 100644 --- a/drivers/net/wireless/prism54/islpci_dev.h +++ b/drivers/net/wireless/prism54/islpci_dev.h | |||
@@ -23,7 +23,6 @@ | |||
23 | #ifndef _ISLPCI_DEV_H | 23 | #ifndef _ISLPCI_DEV_H |
24 | #define _ISLPCI_DEV_H | 24 | #define _ISLPCI_DEV_H |
25 | 25 | ||
26 | #include <linux/version.h> | ||
27 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
28 | #include <linux/wireless.h> | 27 | #include <linux/wireless.h> |
29 | #include <net/iw_handler.h> | 28 | #include <net/iw_handler.h> |
diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c index a92ce3af3fa9..33d64d2ee53f 100644 --- a/drivers/net/wireless/prism54/islpci_eth.c +++ b/drivers/net/wireless/prism54/islpci_eth.c | |||
@@ -17,7 +17,6 @@ | |||
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/version.h> | ||
21 | #include <linux/module.h> | 20 | #include <linux/module.h> |
22 | 21 | ||
23 | #include <linux/pci.h> | 22 | #include <linux/pci.h> |
diff --git a/drivers/net/wireless/prism54/islpci_hotplug.c b/drivers/net/wireless/prism54/islpci_hotplug.c index dc040caab7d7..b41d666fea3c 100644 --- a/drivers/net/wireless/prism54/islpci_hotplug.c +++ b/drivers/net/wireless/prism54/islpci_hotplug.c | |||
@@ -18,7 +18,6 @@ | |||
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/version.h> | ||
22 | #include <linux/module.h> | 21 | #include <linux/module.h> |
23 | #include <linux/pci.h> | 22 | #include <linux/pci.h> |
24 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |