diff options
Diffstat (limited to 'net/802/tr.c')
-rw-r--r-- | net/802/tr.c | 136 |
1 files changed, 68 insertions, 68 deletions
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 | ||
49 | struct rif_cache { | 49 | struct 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 | ||
66 | static struct rif_cache *rif_table[RIF_TABLE_SIZE]; | 66 | static struct rif_cache *rif_table[RIF_TABLE_SIZE]; |
67 | 67 | ||
68 | static DEFINE_SPINLOCK(rif_lock); | 68 | static 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 | ||
75 | static struct timer_list rif_timer; | 75 | static struct timer_list rif_timer; |
76 | 76 | ||
77 | int sysctl_tr_rif_timeout = 60*10*HZ; | 77 | int 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 | ||
100 | static int tr_header(struct sk_buff *skb, struct net_device *dev, | 100 | static 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 | ||
156 | static int tr_rebuild_header(struct sk_buff *skb) | 156 | static 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 | ||
247 | void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,struct net_device *dev) | 247 | void 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 |
283 | printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0], | 283 | printk("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 | ||
337 | static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev) | 337 | static 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 |
366 | printk("adding rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n", | 366 | printk("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 | ||
432 | static void rif_check_expire(unsigned long dummy) | 432 | static 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 | ||
472 | static struct rif_cache *rif_get_idx(loff_t pos) | 472 | static 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. */ |