Patch: Changing route table size (RT_HASH_DIVISOR) is broken in 2.2

From: Ben McCann (bmccann@indusriver.com)
Date: Tue Jul 04 2000 - 06:15:11 EST


We needed to change the route table size (RT_HASH_DIVISOR) and found a small
problem in the inlined function 'rt_hash_code'. That function used a numeric
'0xff' instead of 'RT_HASH_DIVISOR-1'. Heres the patch (against 2.2.16) for
net/ipv4/route.c:

--- net/ipv4/route.c.bad Tue Jul 4 07:01:41 2000
+++ net/ipv4/route.c Tue Jun 13 20:46:41 2000
@@ -183,7 +183,7 @@
        unsigned hash = ((daddr&0xF0F0F0F0)>>4)|((daddr&0x0F0F0F0F)<<4);
        hash = hash^saddr^tos;
        hash = hash^(hash>>16);
- return (hash^(hash>>8)) & 0xFF;
+ return (hash^(hash>>8)) & (RT_HASH_DIVISOR-1);
 }
 
 #ifdef CONFIG_PROC_FS

I haven't checked 2.4 sources but it may be broken there too...

Thanks,
Ben McCann

-- 
---
Ben McCann                              Indus River Networks
                                        31 Nagog Park
                                        Acton, MA, 01720
email: bmccann@indusriver.com           web: www.indusriver.com 
phone: (978) 266-8140                   fax: (978) 266-8111

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jul 07 2000 - 21:00:15 EST