aboutsummaryrefslogtreecommitdiffstats
path: root/net/802
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2007-02-09 09:24:24 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-02-11 02:19:09 -0500
commit9afa0949eea959f28248b717757c201765f1c19b (patch)
treeaf9d6416f945870a7e8137fdedc0026189d2c61f /net/802
parent66efc5a7e3061c3597ac43a8bb1026488d57e66b (diff)
[NET] 802: Fix whitespace errors.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/802')
-rw-r--r--net/802/fc.c24
-rw-r--r--net/802/fddi.c26
-rw-r--r--net/802/hippi.c20
-rw-r--r--net/802/psnap.c2
-rw-r--r--net/802/tr.c136
5 files changed, 104 insertions, 104 deletions
diff --git a/net/802/fc.c b/net/802/fc.c
index 2a27e37bc4cb..d64e6a502958 100644
--- a/net/802/fc.c
+++ b/net/802/fc.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * NET3: Fibre Channel device handling subroutines 2 * NET3: Fibre Channel device handling subroutines
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License 5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 6 * as published by the Free Software Foundation; either version
@@ -31,18 +31,18 @@
31#include <net/arp.h> 31#include <net/arp.h>
32 32
33/* 33/*
34 * Put the headers on a Fibre Channel packet. 34 * Put the headers on a Fibre Channel packet.
35 */ 35 */
36 36
37static int fc_header(struct sk_buff *skb, struct net_device *dev, 37static int fc_header(struct sk_buff *skb, struct net_device *dev,
38 unsigned short type, 38 unsigned short type,
39 void *daddr, void *saddr, unsigned len) 39 void *daddr, void *saddr, unsigned len)
40{ 40{
41 struct fch_hdr *fch; 41 struct fch_hdr *fch;
42 int hdr_len; 42 int hdr_len;
43 43
44 /* 44 /*
45 * Add the 802.2 SNAP header if IP as the IPv4 code calls 45 * Add the 802.2 SNAP header if IP as the IPv4 code calls
46 * dev->hard_header directly. 46 * dev->hard_header directly.
47 */ 47 */
48 if (type == ETH_P_IP || type == ETH_P_ARP) 48 if (type == ETH_P_IP || type == ETH_P_ARP)
@@ -60,7 +60,7 @@ static int fc_header(struct sk_buff *skb, struct net_device *dev,
60 else 60 else
61 { 61 {
62 hdr_len = sizeof(struct fch_hdr); 62 hdr_len = sizeof(struct fch_hdr);
63 fch = (struct fch_hdr *)skb_push(skb, hdr_len); 63 fch = (struct fch_hdr *)skb_push(skb, hdr_len);
64 } 64 }
65 65
66 if(saddr) 66 if(saddr)
@@ -68,20 +68,20 @@ static int fc_header(struct sk_buff *skb, struct net_device *dev,
68 else 68 else
69 memcpy(fch->saddr,dev->dev_addr,dev->addr_len); 69 memcpy(fch->saddr,dev->dev_addr,dev->addr_len);
70 70
71 if(daddr) 71 if(daddr)
72 { 72 {
73 memcpy(fch->daddr,daddr,dev->addr_len); 73 memcpy(fch->daddr,daddr,dev->addr_len);
74 return(hdr_len); 74 return(hdr_len);
75 } 75 }
76 return -hdr_len; 76 return -hdr_len;
77} 77}
78 78
79/* 79/*
80 * A neighbour discovery of some species (eg arp) has completed. We 80 * A neighbour discovery of some species (eg arp) has completed. We
81 * can now send the packet. 81 * can now send the packet.
82 */ 82 */
83 83
84static int fc_rebuild_header(struct sk_buff *skb) 84static int fc_rebuild_header(struct sk_buff *skb)
85{ 85{
86 struct fch_hdr *fch=(struct fch_hdr *)skb->data; 86 struct fch_hdr *fch=(struct fch_hdr *)skb->data;
87 struct fcllc *fcllc=(struct fcllc *)(skb->data+sizeof(struct fch_hdr)); 87 struct fcllc *fcllc=(struct fcllc *)(skb->data+sizeof(struct fch_hdr));
@@ -100,7 +100,7 @@ static void fc_setup(struct net_device *dev)
100{ 100{
101 dev->hard_header = fc_header; 101 dev->hard_header = fc_header;
102 dev->rebuild_header = fc_rebuild_header; 102 dev->rebuild_header = fc_rebuild_header;
103 103
104 dev->type = ARPHRD_IEEE802; 104 dev->type = ARPHRD_IEEE802;
105 dev->hard_header_len = FC_HLEN; 105 dev->hard_header_len = FC_HLEN;
106 dev->mtu = 2024; 106 dev->mtu = 2024;
diff --git a/net/802/fddi.c b/net/802/fddi.c
index 797c6d961deb..0b98fe2fa2f6 100644
--- a/net/802/fddi.c
+++ b/net/802/fddi.c
@@ -15,7 +15,7 @@
15 * Mark Evans, <evansmp@uhura.aston.ac.uk> 15 * Mark Evans, <evansmp@uhura.aston.ac.uk>
16 * Florian La Roche, <rzsfl@rz.uni-sb.de> 16 * Florian La Roche, <rzsfl@rz.uni-sb.de>
17 * Alan Cox, <gw4pts@gw4pts.ampr.org> 17 * Alan Cox, <gw4pts@gw4pts.ampr.org>
18 * 18 *
19 * This program is free software; you can redistribute it and/or 19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License 20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version 21 * as published by the Free Software Foundation; either version
@@ -25,7 +25,7 @@
25 * Alan Cox : New arp/rebuild header 25 * Alan Cox : New arp/rebuild header
26 * Maciej W. Rozycki : IPv6 support 26 * Maciej W. Rozycki : IPv6 support
27 */ 27 */
28 28
29#include <linux/module.h> 29#include <linux/module.h>
30#include <asm/system.h> 30#include <asm/system.h>
31#include <linux/types.h> 31#include <linux/types.h>
@@ -57,7 +57,7 @@ static int fddi_header(struct sk_buff *skb, struct net_device *dev,
57{ 57{
58 int hl = FDDI_K_SNAP_HLEN; 58 int hl = FDDI_K_SNAP_HLEN;
59 struct fddihdr *fddi; 59 struct fddihdr *fddi;
60 60
61 if(type != ETH_P_IP && type != ETH_P_IPV6 && type != ETH_P_ARP) 61 if(type != ETH_P_IP && type != ETH_P_IPV6 && type != ETH_P_ARP)
62 hl=FDDI_K_8022_HLEN-3; 62 hl=FDDI_K_8022_HLEN-3;
63 fddi = (struct fddihdr *)skb_push(skb, hl); 63 fddi = (struct fddihdr *)skb_push(skb, hl);
@@ -74,7 +74,7 @@ static int fddi_header(struct sk_buff *skb, struct net_device *dev,
74 } 74 }
75 75
76 /* Set the source and destination hardware addresses */ 76 /* Set the source and destination hardware addresses */
77 77
78 if (saddr != NULL) 78 if (saddr != NULL)
79 memcpy(fddi->saddr, saddr, dev->addr_len); 79 memcpy(fddi->saddr, saddr, dev->addr_len);
80 else 80 else
@@ -95,7 +95,7 @@ static int fddi_header(struct sk_buff *skb, struct net_device *dev,
95 * (or in future other address resolution) has completed on 95 * (or in future other address resolution) has completed on
96 * this sk_buff. We now let ARP fill in the other fields. 96 * this sk_buff. We now let ARP fill in the other fields.
97 */ 97 */
98 98
99static int fddi_rebuild_header(struct sk_buff *skb) 99static int fddi_rebuild_header(struct sk_buff *skb)
100{ 100{
101 struct fddihdr *fddi = (struct fddihdr *)skb->data; 101 struct fddihdr *fddi = (struct fddihdr *)skb->data;
@@ -105,7 +105,7 @@ static int fddi_rebuild_header(struct sk_buff *skb)
105 /* Try to get ARP to resolve the header and fill destination address */ 105 /* Try to get ARP to resolve the header and fill destination address */
106 return arp_find(fddi->daddr, skb); 106 return arp_find(fddi->daddr, skb);
107 else 107 else
108#endif 108#endif
109 { 109 {
110 printk("%s: Don't know how to resolve type %04X addresses.\n", 110 printk("%s: Don't know how to resolve type %04X addresses.\n",
111 skb->dev->name, ntohs(fddi->hdr.llc_snap.ethertype)); 111 skb->dev->name, ntohs(fddi->hdr.llc_snap.ethertype));
@@ -120,19 +120,19 @@ static int fddi_rebuild_header(struct sk_buff *skb)
120 * up. It's used to fill in specific skb fields and to set 120 * up. It's used to fill in specific skb fields and to set
121 * the proper pointer to the start of packet data (skb->data). 121 * the proper pointer to the start of packet data (skb->data).
122 */ 122 */
123 123
124__be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev) 124__be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev)
125{ 125{
126 struct fddihdr *fddi = (struct fddihdr *)skb->data; 126 struct fddihdr *fddi = (struct fddihdr *)skb->data;
127 __be16 type; 127 __be16 type;
128 128
129 /* 129 /*
130 * Set mac.raw field to point to FC byte, set data field to point 130 * Set mac.raw field to point to FC byte, set data field to point
131 * to start of packet data. Assume 802.2 SNAP frames for now. 131 * to start of packet data. Assume 802.2 SNAP frames for now.
132 */ 132 */
133 133
134 skb->mac.raw = skb->data; /* point to frame control (FC) */ 134 skb->mac.raw = skb->data; /* point to frame control (FC) */
135 135
136 if(fddi->hdr.llc_8022_1.dsap==0xe0) 136 if(fddi->hdr.llc_8022_1.dsap==0xe0)
137 { 137 {
138 skb_pull(skb, FDDI_K_8022_HLEN-3); 138 skb_pull(skb, FDDI_K_8022_HLEN-3);
@@ -143,9 +143,9 @@ __be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev)
143 skb_pull(skb, FDDI_K_SNAP_HLEN); /* adjust for 21 byte header */ 143 skb_pull(skb, FDDI_K_SNAP_HLEN); /* adjust for 21 byte header */
144 type=fddi->hdr.llc_snap.ethertype; 144 type=fddi->hdr.llc_snap.ethertype;
145 } 145 }
146 146
147 /* Set packet type based on destination address and flag settings */ 147 /* Set packet type based on destination address and flag settings */
148 148
149 if (*fddi->daddr & 0x01) 149 if (*fddi->daddr & 0x01)
150 { 150 {
151 if (memcmp(fddi->daddr, dev->broadcast, FDDI_K_ALEN) == 0) 151 if (memcmp(fddi->daddr, dev->broadcast, FDDI_K_ALEN) == 0)
@@ -153,7 +153,7 @@ __be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev)
153 else 153 else
154 skb->pkt_type = PACKET_MULTICAST; 154 skb->pkt_type = PACKET_MULTICAST;
155 } 155 }
156 156
157 else if (dev->flags & IFF_PROMISC) 157 else if (dev->flags & IFF_PROMISC)
158 { 158 {
159 if (memcmp(fddi->daddr, dev->dev_addr, FDDI_K_ALEN)) 159 if (memcmp(fddi->daddr, dev->dev_addr, FDDI_K_ALEN))
@@ -187,7 +187,7 @@ static void fddi_setup(struct net_device *dev)
187 dev->addr_len = FDDI_K_ALEN; 187 dev->addr_len = FDDI_K_ALEN;
188 dev->tx_queue_len = 100; /* Long queues on FDDI */ 188 dev->tx_queue_len = 100; /* Long queues on FDDI */
189 dev->flags = IFF_BROADCAST | IFF_MULTICAST; 189 dev->flags = IFF_BROADCAST | IFF_MULTICAST;
190 190
191 memset(dev->broadcast, 0xFF, FDDI_K_ALEN); 191 memset(dev->broadcast, 0xFF, FDDI_K_ALEN);
192} 192}
193 193
diff --git a/net/802/hippi.c b/net/802/hippi.c
index 579e2ddf5ebe..be0da59323b3 100644
--- a/net/802/hippi.c
+++ b/net/802/hippi.c
@@ -39,7 +39,7 @@
39#include <asm/system.h> 39#include <asm/system.h>
40 40
41/* 41/*
42 * Create the HIPPI MAC header for an arbitrary protocol layer 42 * Create the HIPPI MAC header for an arbitrary protocol layer
43 * 43 *
44 * saddr=NULL means use device source address 44 * saddr=NULL means use device source address
45 * daddr=NULL means leave destination address (eg unresolved arp) 45 * daddr=NULL means leave destination address (eg unresolved arp)
@@ -104,8 +104,8 @@ static int hippi_rebuild_header(struct sk_buff *skb)
104 /* 104 /*
105 * Only IP is currently supported 105 * Only IP is currently supported
106 */ 106 */
107 107
108 if(hip->snap.ethertype != __constant_htons(ETH_P_IP)) 108 if(hip->snap.ethertype != __constant_htons(ETH_P_IP))
109 { 109 {
110 printk(KERN_DEBUG "%s: unable to resolve type %X addresses.\n",skb->dev->name,ntohs(hip->snap.ethertype)); 110 printk(KERN_DEBUG "%s: unable to resolve type %X addresses.\n",skb->dev->name,ntohs(hip->snap.ethertype));
111 return 0; 111 return 0;
@@ -122,11 +122,11 @@ static int hippi_rebuild_header(struct sk_buff *skb)
122/* 122/*
123 * Determine the packet's protocol ID. 123 * Determine the packet's protocol ID.
124 */ 124 */
125 125
126__be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev) 126__be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev)
127{ 127{
128 struct hippi_hdr *hip; 128 struct hippi_hdr *hip;
129 129
130 hip = (struct hippi_hdr *) skb->data; 130 hip = (struct hippi_hdr *) skb->data;
131 131
132 /* 132 /*
@@ -173,10 +173,10 @@ static int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p)
173{ 173{
174 /* Never send broadcast/multicast ARP messages */ 174 /* Never send broadcast/multicast ARP messages */
175 p->mcast_probes = 0; 175 p->mcast_probes = 0;
176 176
177 /* In IPv6 unicast probes are valid even on NBMA, 177 /* In IPv6 unicast probes are valid even on NBMA,
178 * because they are encapsulated in normal IPv6 protocol. 178 * because they are encapsulated in normal IPv6 protocol.
179 * Should be a generic flag. 179 * Should be a generic flag.
180 */ 180 */
181 if (p->tbl->family != AF_INET6) 181 if (p->tbl->family != AF_INET6)
182 p->ucast_probes = 0; 182 p->ucast_probes = 0;
@@ -193,7 +193,7 @@ static void hippi_setup(struct net_device *dev)
193 dev->hard_header_parse = NULL; 193 dev->hard_header_parse = NULL;
194 dev->hard_header_cache = NULL; 194 dev->hard_header_cache = NULL;
195 dev->header_cache_update = NULL; 195 dev->header_cache_update = NULL;
196 dev->neigh_setup = hippi_neigh_setup_dev; 196 dev->neigh_setup = hippi_neigh_setup_dev;
197 197
198 /* 198 /*
199 * We don't support HIPPI `ARP' for the time being, and probably 199 * We don't support HIPPI `ARP' for the time being, and probably
@@ -210,9 +210,9 @@ static void hippi_setup(struct net_device *dev)
210 210
211 /* 211 /*
212 * HIPPI doesn't support broadcast+multicast and we only use 212 * HIPPI doesn't support broadcast+multicast and we only use
213 * static ARP tables. ARP is disabled by hippi_neigh_setup_dev. 213 * static ARP tables. ARP is disabled by hippi_neigh_setup_dev.
214 */ 214 */
215 dev->flags = 0; 215 dev->flags = 0;
216} 216}
217 217
218/** 218/**
diff --git a/net/802/psnap.c b/net/802/psnap.c
index 270b9d2cae65..6e7c2120b83f 100644
--- a/net/802/psnap.c
+++ b/net/802/psnap.c
@@ -117,7 +117,7 @@ module_exit(snap_exit);
117 */ 117 */
118struct datalink_proto *register_snap_client(unsigned char *desc, 118struct datalink_proto *register_snap_client(unsigned char *desc,
119 int (*rcvfunc)(struct sk_buff *, 119 int (*rcvfunc)(struct sk_buff *,
120 struct net_device *, 120 struct net_device *,
121 struct packet_type *, 121 struct packet_type *,
122 struct net_device *)) 122 struct net_device *))
123{ 123{
diff --git a/net/802/tr.c b/net/802/tr.c
index 829deb41ce81..31509f613401 100644
--- a/net/802/tr.c
+++ b/net/802/tr.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * NET3: Token ring device handling subroutines 2 * NET3: Token ring device handling subroutines
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License 5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 6 * as published by the Free Software Foundation; either version
@@ -12,7 +12,7 @@
12 * 22 Jun 98 Paul Norton <p.norton@computer.org> Rearranged 12 * 22 Jun 98 Paul Norton <p.norton@computer.org> Rearranged
13 * tr_header and tr_type_trans to handle passing IPX SNAP and 13 * tr_header and tr_type_trans to handle passing IPX SNAP and
14 * 802.2 through the correct layers. Eliminated tr_reformat. 14 * 802.2 through the correct layers. Eliminated tr_reformat.
15 * 15 *
16 */ 16 */
17 17
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
@@ -45,7 +45,7 @@ static void rif_check_expire(unsigned long dummy);
45/* 45/*
46 * Each RIF entry we learn is kept this way 46 * Each RIF entry we learn is kept this way
47 */ 47 */
48 48
49struct rif_cache { 49struct rif_cache {
50 unsigned char addr[TR_ALEN]; 50 unsigned char addr[TR_ALEN];
51 int iface; 51 int iface;
@@ -62,7 +62,7 @@ struct rif_cache {
62 * We hash the RIF cache 32 ways. We do after all have to look it 62 * We hash the RIF cache 32 ways. We do after all have to look it
63 * up a lot. 63 * up a lot.
64 */ 64 */
65 65
66static struct rif_cache *rif_table[RIF_TABLE_SIZE]; 66static struct rif_cache *rif_table[RIF_TABLE_SIZE];
67 67
68static DEFINE_SPINLOCK(rif_lock); 68static DEFINE_SPINLOCK(rif_lock);
@@ -71,7 +71,7 @@ static DEFINE_SPINLOCK(rif_lock);
71/* 71/*
72 * Garbage disposal timer. 72 * Garbage disposal timer.
73 */ 73 */
74 74
75static struct timer_list rif_timer; 75static struct timer_list rif_timer;
76 76
77int sysctl_tr_rif_timeout = 60*10*HZ; 77int sysctl_tr_rif_timeout = 60*10*HZ;
@@ -96,16 +96,16 @@ static inline unsigned long rif_hash(const unsigned char *addr)
96 * Put the headers on a token ring packet. Token ring source routing 96 * Put the headers on a token ring packet. Token ring source routing
97 * makes this a little more exciting than on ethernet. 97 * makes this a little more exciting than on ethernet.
98 */ 98 */
99 99
100static int tr_header(struct sk_buff *skb, struct net_device *dev, 100static int tr_header(struct sk_buff *skb, struct net_device *dev,
101 unsigned short type, 101 unsigned short type,
102 void *daddr, void *saddr, unsigned len) 102 void *daddr, void *saddr, unsigned len)
103{ 103{
104 struct trh_hdr *trh; 104 struct trh_hdr *trh;
105 int hdr_len; 105 int hdr_len;
106 106
107 /* 107 /*
108 * Add the 802.2 SNAP header if IP as the IPv4/IPv6 code calls 108 * Add the 802.2 SNAP header if IP as the IPv4/IPv6 code calls
109 * dev->hard_header directly. 109 * dev->hard_header directly.
110 */ 110 */
111 if (type == ETH_P_IP || type == ETH_P_IPV6 || type == ETH_P_ARP) 111 if (type == ETH_P_IP || type == ETH_P_IPV6 || type == ETH_P_ARP)
@@ -123,7 +123,7 @@ static int tr_header(struct sk_buff *skb, struct net_device *dev,
123 else 123 else
124 { 124 {
125 hdr_len = sizeof(struct trh_hdr); 125 hdr_len = sizeof(struct trh_hdr);
126 trh = (struct trh_hdr *)skb_push(skb, hdr_len); 126 trh = (struct trh_hdr *)skb_push(skb, hdr_len);
127 } 127 }
128 128
129 trh->ac=AC; 129 trh->ac=AC;
@@ -137,8 +137,8 @@ static int tr_header(struct sk_buff *skb, struct net_device *dev,
137 /* 137 /*
138 * Build the destination and then source route the frame 138 * Build the destination and then source route the frame
139 */ 139 */
140 140
141 if(daddr) 141 if(daddr)
142 { 142 {
143 memcpy(trh->daddr,daddr,dev->addr_len); 143 memcpy(trh->daddr,daddr,dev->addr_len);
144 tr_source_route(skb,trh,dev); 144 tr_source_route(skb,trh,dev);
@@ -147,13 +147,13 @@ static int tr_header(struct sk_buff *skb, struct net_device *dev,
147 147
148 return -hdr_len; 148 return -hdr_len;
149} 149}
150 150
151/* 151/*
152 * A neighbour discovery of some species (eg arp) has completed. We 152 * A neighbour discovery of some species (eg arp) has completed. We
153 * can now send the packet. 153 * can now send the packet.
154 */ 154 */
155 155
156static int tr_rebuild_header(struct sk_buff *skb) 156static int tr_rebuild_header(struct sk_buff *skb)
157{ 157{
158 struct trh_hdr *trh=(struct trh_hdr *)skb->data; 158 struct trh_hdr *trh=(struct trh_hdr *)skb->data;
159 struct trllc *trllc=(struct trllc *)(skb->data+sizeof(struct trh_hdr)); 159 struct trllc *trllc=(struct trllc *)(skb->data+sizeof(struct trh_hdr));
@@ -162,7 +162,7 @@ static int tr_rebuild_header(struct sk_buff *skb)
162 /* 162 /*
163 * FIXME: We don't yet support IPv6 over token rings 163 * FIXME: We don't yet support IPv6 over token rings
164 */ 164 */
165 165
166 if(trllc->ethertype != htons(ETH_P_IP)) { 166 if(trllc->ethertype != htons(ETH_P_IP)) {
167 printk("tr_rebuild_header: Don't know how to resolve type %04X addresses ?\n", ntohs(trllc->ethertype)); 167 printk("tr_rebuild_header: Don't know how to resolve type %04X addresses ?\n", ntohs(trllc->ethertype));
168 return 0; 168 return 0;
@@ -172,39 +172,39 @@ static int tr_rebuild_header(struct sk_buff *skb)
172 if(arp_find(trh->daddr, skb)) { 172 if(arp_find(trh->daddr, skb)) {
173 return 1; 173 return 1;
174 } 174 }
175 else 175 else
176#endif 176#endif
177 { 177 {
178 tr_source_route(skb,trh,dev); 178 tr_source_route(skb,trh,dev);
179 return 0; 179 return 0;
180 } 180 }
181} 181}
182 182
183/* 183/*
184 * Some of this is a bit hackish. We intercept RIF information 184 * Some of this is a bit hackish. We intercept RIF information
185 * used for source routing. We also grab IP directly and don't feed 185 * used for source routing. We also grab IP directly and don't feed
186 * it via SNAP. 186 * it via SNAP.
187 */ 187 */
188 188
189__be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev) 189__be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev)
190{ 190{
191 191
192 struct trh_hdr *trh=(struct trh_hdr *)skb->data; 192 struct trh_hdr *trh=(struct trh_hdr *)skb->data;
193 struct trllc *trllc; 193 struct trllc *trllc;
194 unsigned riflen=0; 194 unsigned riflen=0;
195 195
196 skb->mac.raw = skb->data; 196 skb->mac.raw = skb->data;
197 197
198 if(trh->saddr[0] & TR_RII) 198 if(trh->saddr[0] & TR_RII)
199 riflen = (ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8; 199 riflen = (ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8;
200 200
201 trllc = (struct trllc *)(skb->data+sizeof(struct trh_hdr)-TR_MAXRIFLEN+riflen); 201 trllc = (struct trllc *)(skb->data+sizeof(struct trh_hdr)-TR_MAXRIFLEN+riflen);
202 202
203 skb_pull(skb,sizeof(struct trh_hdr)-TR_MAXRIFLEN+riflen); 203 skb_pull(skb,sizeof(struct trh_hdr)-TR_MAXRIFLEN+riflen);
204 204
205 if(*trh->daddr & 0x80) 205 if(*trh->daddr & 0x80)
206 { 206 {
207 if(!memcmp(trh->daddr,dev->broadcast,TR_ALEN)) 207 if(!memcmp(trh->daddr,dev->broadcast,TR_ALEN))
208 skb->pkt_type=PACKET_BROADCAST; 208 skb->pkt_type=PACKET_BROADCAST;
209 else 209 else
210 skb->pkt_type=PACKET_MULTICAST; 210 skb->pkt_type=PACKET_MULTICAST;
@@ -213,7 +213,7 @@ __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev)
213 { 213 {
214 skb->pkt_type=PACKET_MULTICAST; 214 skb->pkt_type=PACKET_MULTICAST;
215 } 215 }
216 else if(dev->flags & IFF_PROMISC) 216 else if(dev->flags & IFF_PROMISC)
217 { 217 {
218 if(memcmp(trh->daddr, dev->dev_addr, TR_ALEN)) 218 if(memcmp(trh->daddr, dev->dev_addr, TR_ALEN))
219 skb->pkt_type=PACKET_OTHERHOST; 219 skb->pkt_type=PACKET_OTHERHOST;
@@ -221,10 +221,10 @@ __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev)
221 221
222 if ((skb->pkt_type != PACKET_BROADCAST) && 222 if ((skb->pkt_type != PACKET_BROADCAST) &&
223 (skb->pkt_type != PACKET_MULTICAST)) 223 (skb->pkt_type != PACKET_MULTICAST))
224 tr_add_rif_info(trh,dev) ; 224 tr_add_rif_info(trh,dev) ;
225 225
226 /* 226 /*
227 * Strip the SNAP header from ARP packets since we don't 227 * Strip the SNAP header from ARP packets since we don't
228 * pass them through to the 802.2/SNAP layers. 228 * pass them through to the 802.2/SNAP layers.
229 */ 229 */
230 230
@@ -241,32 +241,32 @@ __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev)
241} 241}
242 242
243/* 243/*
244 * We try to do source routing... 244 * We try to do source routing...
245 */ 245 */
246 246
247void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,struct net_device *dev) 247void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,struct net_device *dev)
248{ 248{
249 int slack; 249 int slack;
250 unsigned int hash; 250 unsigned int hash;
251 struct rif_cache *entry; 251 struct rif_cache *entry;
252 unsigned char *olddata; 252 unsigned char *olddata;
253 unsigned long flags; 253 unsigned long flags;
254 static const unsigned char mcast_func_addr[] 254 static const unsigned char mcast_func_addr[]
255 = {0xC0,0x00,0x00,0x04,0x00,0x00}; 255 = {0xC0,0x00,0x00,0x04,0x00,0x00};
256 256
257 spin_lock_irqsave(&rif_lock, flags); 257 spin_lock_irqsave(&rif_lock, flags);
258 258
259 /* 259 /*
260 * Broadcasts are single route as stated in RFC 1042 260 * Broadcasts are single route as stated in RFC 1042
261 */ 261 */
262 if( (!memcmp(&(trh->daddr[0]),&(dev->broadcast[0]),TR_ALEN)) || 262 if( (!memcmp(&(trh->daddr[0]),&(dev->broadcast[0]),TR_ALEN)) ||
263 (!memcmp(&(trh->daddr[0]),&(mcast_func_addr[0]), TR_ALEN)) ) 263 (!memcmp(&(trh->daddr[0]),&(mcast_func_addr[0]), TR_ALEN)) )
264 { 264 {
265 trh->rcf=htons((((sizeof(trh->rcf)) << 8) & TR_RCF_LEN_MASK) 265 trh->rcf=htons((((sizeof(trh->rcf)) << 8) & TR_RCF_LEN_MASK)
266 | TR_RCF_FRAME2K | TR_RCF_LIMITED_BROADCAST); 266 | TR_RCF_FRAME2K | TR_RCF_LIMITED_BROADCAST);
267 trh->saddr[0]|=TR_RII; 267 trh->saddr[0]|=TR_RII;
268 } 268 }
269 else 269 else
270 { 270 {
271 hash = rif_hash(trh->daddr); 271 hash = rif_hash(trh->daddr);
272 /* 272 /*
@@ -277,7 +277,7 @@ void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,struct net_device *
277 /* 277 /*
278 * If we found an entry we can route the frame. 278 * If we found an entry we can route the frame.
279 */ 279 */
280 if(entry) 280 if(entry)
281 { 281 {
282#if TR_SR_DEBUG 282#if TR_SR_DEBUG
283printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0], 283printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0],
@@ -287,7 +287,7 @@ printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0],
287 { 287 {
288 trh->rcf=entry->rcf; 288 trh->rcf=entry->rcf;
289 memcpy(&trh->rseg[0],&entry->rseg[0],8*sizeof(unsigned short)); 289 memcpy(&trh->rseg[0],&entry->rseg[0],8*sizeof(unsigned short));
290 trh->rcf^=htons(TR_RCF_DIR_BIT); 290 trh->rcf^=htons(TR_RCF_DIR_BIT);
291 trh->rcf&=htons(0x1fff); /* Issam Chehab <ichehab@madge1.demon.co.uk> */ 291 trh->rcf&=htons(0x1fff); /* Issam Chehab <ichehab@madge1.demon.co.uk> */
292 292
293 trh->saddr[0]|=TR_RII; 293 trh->saddr[0]|=TR_RII;
@@ -301,14 +301,14 @@ printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0],
301 } 301 }
302 entry->last_used=jiffies; 302 entry->last_used=jiffies;
303 } 303 }
304 else 304 else
305 { 305 {
306 /* 306 /*
307 * Without the information we simply have to shout 307 * Without the information we simply have to shout
308 * on the wire. The replies should rapidly clean this 308 * on the wire. The replies should rapidly clean this
309 * situation up. 309 * situation up.
310 */ 310 */
311 trh->rcf=htons((((sizeof(trh->rcf)) << 8) & TR_RCF_LEN_MASK) 311 trh->rcf=htons((((sizeof(trh->rcf)) << 8) & TR_RCF_LEN_MASK)
312 | TR_RCF_FRAME2K | TR_RCF_LIMITED_BROADCAST); 312 | TR_RCF_FRAME2K | TR_RCF_LIMITED_BROADCAST);
313 trh->saddr[0]|=TR_RII; 313 trh->saddr[0]|=TR_RII;
314#if TR_SR_DEBUG 314#if TR_SR_DEBUG
@@ -320,7 +320,7 @@ printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0],
320 /* Compress the RIF here so we don't have to do it in the driver(s) */ 320 /* Compress the RIF here so we don't have to do it in the driver(s) */
321 if (!(trh->saddr[0] & 0x80)) 321 if (!(trh->saddr[0] & 0x80))
322 slack = 18; 322 slack = 18;
323 else 323 else
324 slack = 18 - ((ntohs(trh->rcf) & TR_RCF_LEN_MASK)>>8); 324 slack = 18 - ((ntohs(trh->rcf) & TR_RCF_LEN_MASK)>>8);
325 olddata = skb->data; 325 olddata = skb->data;
326 spin_unlock_irqrestore(&rif_lock, flags); 326 spin_unlock_irqrestore(&rif_lock, flags);
@@ -333,7 +333,7 @@ printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0],
333 * We have learned some new RIF information for our source 333 * We have learned some new RIF information for our source
334 * routing. 334 * routing.
335 */ 335 */
336 336
337static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev) 337static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev)
338{ 338{
339 unsigned int hash, rii_p = 0; 339 unsigned int hash, rii_p = 0;
@@ -343,29 +343,29 @@ static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev)
343 343
344 spin_lock_irqsave(&rif_lock, flags); 344 spin_lock_irqsave(&rif_lock, flags);
345 saddr0 = trh->saddr[0]; 345 saddr0 = trh->saddr[0];
346 346
347 /* 347 /*
348 * Firstly see if the entry exists 348 * Firstly see if the entry exists
349 */ 349 */
350 350
351 if(trh->saddr[0] & TR_RII) 351 if(trh->saddr[0] & TR_RII)
352 { 352 {
353 trh->saddr[0]&=0x7f; 353 trh->saddr[0]&=0x7f;
354 if (((ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8) > 2) 354 if (((ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8) > 2)
355 { 355 {
356 rii_p = 1; 356 rii_p = 1;
357 } 357 }
358 } 358 }
359 359
360 hash = rif_hash(trh->saddr); 360 hash = rif_hash(trh->saddr);
361 for(entry=rif_table[hash];entry && memcmp(&(entry->addr[0]),&(trh->saddr[0]),TR_ALEN);entry=entry->next); 361 for(entry=rif_table[hash];entry && memcmp(&(entry->addr[0]),&(trh->saddr[0]),TR_ALEN);entry=entry->next);
362 362
363 if(entry==NULL) 363 if(entry==NULL)
364 { 364 {
365#if TR_SR_DEBUG 365#if TR_SR_DEBUG
366printk("adding rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n", 366printk("adding rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n",
367 trh->saddr[0],trh->saddr[1],trh->saddr[2], 367 trh->saddr[0],trh->saddr[1],trh->saddr[2],
368 trh->saddr[3],trh->saddr[4],trh->saddr[5], 368 trh->saddr[3],trh->saddr[4],trh->saddr[5],
369 ntohs(trh->rcf)); 369 ntohs(trh->rcf));
370#endif 370#endif
371 /* 371 /*
@@ -377,7 +377,7 @@ printk("adding rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n",
377 */ 377 */
378 entry=kmalloc(sizeof(struct rif_cache),GFP_ATOMIC); 378 entry=kmalloc(sizeof(struct rif_cache),GFP_ATOMIC);
379 379
380 if(!entry) 380 if(!entry)
381 { 381 {
382 printk(KERN_DEBUG "tr.c: Couldn't malloc rif cache entry !\n"); 382 printk(KERN_DEBUG "tr.c: Couldn't malloc rif cache entry !\n");
383 spin_unlock_irqrestore(&rif_lock, flags); 383 spin_unlock_irqrestore(&rif_lock, flags);
@@ -400,13 +400,13 @@ printk("adding rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n",
400 { 400 {
401 entry->local_ring = 1; 401 entry->local_ring = 1;
402 } 402 }
403 } 403 }
404 else /* Y. Tahara added */ 404 else /* Y. Tahara added */
405 { 405 {
406 /* 406 /*
407 * Update existing entries 407 * Update existing entries
408 */ 408 */
409 if (!entry->local_ring) 409 if (!entry->local_ring)
410 if (entry->rcf != (trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK)) && 410 if (entry->rcf != (trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK)) &&
411 !(trh->rcf & htons(TR_RCF_BROADCAST_MASK))) 411 !(trh->rcf & htons(TR_RCF_BROADCAST_MASK)))
412 { 412 {
@@ -417,9 +417,9 @@ printk("updating rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n",
417 ntohs(trh->rcf)); 417 ntohs(trh->rcf));
418#endif 418#endif
419 entry->rcf = trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK); 419 entry->rcf = trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK);
420 memcpy(&(entry->rseg[0]),&(trh->rseg[0]),8*sizeof(unsigned short)); 420 memcpy(&(entry->rseg[0]),&(trh->rseg[0]),8*sizeof(unsigned short));
421 } 421 }
422 entry->last_used=jiffies; 422 entry->last_used=jiffies;
423 } 423 }
424 trh->saddr[0]=saddr0; /* put the routing indicator back for tcpdump */ 424 trh->saddr[0]=saddr0; /* put the routing indicator back for tcpdump */
425 spin_unlock_irqrestore(&rif_lock, flags); 425 spin_unlock_irqrestore(&rif_lock, flags);
@@ -429,16 +429,16 @@ printk("updating rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n",
429 * Scan the cache with a timer and see what we need to throw out. 429 * Scan the cache with a timer and see what we need to throw out.
430 */ 430 */
431 431
432static void rif_check_expire(unsigned long dummy) 432static void rif_check_expire(unsigned long dummy)
433{ 433{
434 int i; 434 int i;
435 unsigned long flags, next_interval = jiffies + sysctl_tr_rif_timeout/2; 435 unsigned long flags, next_interval = jiffies + sysctl_tr_rif_timeout/2;
436 436
437 spin_lock_irqsave(&rif_lock, flags); 437 spin_lock_irqsave(&rif_lock, flags);
438 438
439 for(i =0; i < RIF_TABLE_SIZE; i++) { 439 for(i =0; i < RIF_TABLE_SIZE; i++) {
440 struct rif_cache *entry, **pentry; 440 struct rif_cache *entry, **pentry;
441 441
442 pentry = rif_table+i; 442 pentry = rif_table+i;
443 while((entry=*pentry) != NULL) { 443 while((entry=*pentry) != NULL) {
444 unsigned long expires 444 unsigned long expires
@@ -455,7 +455,7 @@ static void rif_check_expire(unsigned long dummy)
455 } 455 }
456 } 456 }
457 } 457 }
458 458
459 spin_unlock_irqrestore(&rif_lock, flags); 459 spin_unlock_irqrestore(&rif_lock, flags);
460 460
461 mod_timer(&rif_timer, next_interval); 461 mod_timer(&rif_timer, next_interval);
@@ -466,7 +466,7 @@ static void rif_check_expire(unsigned long dummy)
466 * Generate the /proc/net information for the token ring RIF 466 * Generate the /proc/net information for the token ring RIF
467 * routing. 467 * routing.
468 */ 468 */
469 469
470#ifdef CONFIG_PROC_FS 470#ifdef CONFIG_PROC_FS
471 471
472static struct rif_cache *rif_get_idx(loff_t pos) 472static struct rif_cache *rif_get_idx(loff_t pos)
@@ -475,7 +475,7 @@ static struct rif_cache *rif_get_idx(loff_t pos)
475 struct rif_cache *entry; 475 struct rif_cache *entry;
476 loff_t off = 0; 476 loff_t off = 0;
477 477
478 for(i = 0; i < RIF_TABLE_SIZE; i++) 478 for(i = 0; i < RIF_TABLE_SIZE; i++)
479 for(entry = rif_table[i]; entry; entry = entry->next) { 479 for(entry = rif_table[i]; entry; entry = entry->next) {
480 if (off == pos) 480 if (off == pos)
481 return entry; 481 return entry;
@@ -504,7 +504,7 @@ static void *rif_seq_next(struct seq_file *seq, void *v, loff_t *pos)
504 goto scan; 504 goto scan;
505 } 505 }
506 506
507 if (ent->next) 507 if (ent->next)
508 return ent->next; 508 return ent->next;
509 509
510 i = rif_hash(ent->addr); 510 i = rif_hash(ent->addr);
@@ -541,13 +541,13 @@ static int rif_seq_show(struct seq_file *seq, void *v)
541 ttl/HZ); 541 ttl/HZ);
542 542
543 if (entry->local_ring) 543 if (entry->local_ring)
544 seq_puts(seq, "local\n"); 544 seq_puts(seq, "local\n");
545 else { 545 else {
546 546
547 seq_printf(seq, "%04X", ntohs(entry->rcf)); 547 seq_printf(seq, "%04X", ntohs(entry->rcf));
548 rcf_len = ((ntohs(entry->rcf) & TR_RCF_LEN_MASK)>>8)-2; 548 rcf_len = ((ntohs(entry->rcf) & TR_RCF_LEN_MASK)>>8)-2;
549 if (rcf_len) 549 if (rcf_len)
550 rcf_len >>= 1; 550 rcf_len >>= 1;
551 for(j = 1; j < rcf_len; j++) { 551 for(j = 1; j < rcf_len; j++) {
552 if(j==1) { 552 if(j==1) {
553 segment=ntohs(entry->rseg[j-1])>>4; 553 segment=ntohs(entry->rseg[j-1])>>4;
@@ -559,7 +559,7 @@ static int rif_seq_show(struct seq_file *seq, void *v)
559 } 559 }
560 seq_putc(seq, '\n'); 560 seq_putc(seq, '\n');
561 } 561 }
562 } 562 }
563 return 0; 563 return 0;
564} 564}
565 565
@@ -591,7 +591,7 @@ static void tr_setup(struct net_device *dev)
591 /* 591 /*
592 * Configure and register 592 * Configure and register
593 */ 593 */
594 594
595 dev->hard_header = tr_header; 595 dev->hard_header = tr_header;
596 dev->rebuild_header = tr_rebuild_header; 596 dev->rebuild_header = tr_rebuild_header;
597 597
@@ -600,7 +600,7 @@ static void tr_setup(struct net_device *dev)
600 dev->mtu = 2000; 600 dev->mtu = 2000;
601 dev->addr_len = TR_ALEN; 601 dev->addr_len = TR_ALEN;
602 dev->tx_queue_len = 100; /* Long queues on tr */ 602 dev->tx_queue_len = 100; /* Long queues on tr */
603 603
604 memset(dev->broadcast,0xFF, TR_ALEN); 604 memset(dev->broadcast,0xFF, TR_ALEN);
605 605
606 /* New-style flags. */ 606 /* New-style flags. */