From aa55e1345bb84993273fabe4680a08b48fa99944 Mon Sep 17 00:00:00 2001 From: gborowiak Date: Tue, 16 Sep 2003 19:26:38 +0000 Subject: changed the structure of the hash table reedited to 80col/8tab and K-R indent 0.0.0.0 IP address is now illegal --- .../include/linux/netfilter_bridge/ebt_among.h | 34 +++++----------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'kernel/linux/include/linux/netfilter_bridge/ebt_among.h') diff --git a/kernel/linux/include/linux/netfilter_bridge/ebt_among.h b/kernel/linux/include/linux/netfilter_bridge/ebt_among.h index e02581a..307c1fe 100644 --- a/kernel/linux/include/linux/netfilter_bridge/ebt_among.h +++ b/kernel/linux/include/linux/netfilter_bridge/ebt_among.h @@ -27,45 +27,23 @@ * if they are the same we compare 2 first. * * Yes, it is a memory overhead, but in 2003 AD, who cares? - * - * `next_ofs' contains a "serialized" pointer to the next tuple in - * the synonym list. It is a difference between address of the next - * tuple and address of the entire wormhash structure, in bytes - * or 0 if there is no next tuple. - * - * `table' contains begins of the synonym lists for - * - * This was introduced to make wormhash structure movable. As you may - * guess, once structure is passed to the kernel, the real pointers - * would become invalid. Also comparison would not work if they were - * built of absolute pointers. - * - * From the other side, using indices of the `pool' array would be - * slower. CPU would have to multiply index * size of tuple at each - * access to a tuple and add this to the address of the beginning - * of the `pool' array. - * - * Summary: - * - * The code is damn unreadable and unclear, but - and that's the - * point - effective. */ struct ebt_mac_wormhash_tuple { - int next_ofs; uint32_t cmp[2]; uint32_t ip; }; struct ebt_mac_wormhash { - int table[256]; + int table[257]; int poolsize; struct ebt_mac_wormhash_tuple pool[0]; }; -#define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) + (x)->poolsize * sizeof(struct ebt_mac_wormhash_tuple) : 0) +#define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) \ + + (x)->poolsize * sizeof(struct ebt_mac_wormhash_tuple) : 0) struct ebt_among_info { @@ -77,8 +55,10 @@ struct ebt_among_info #define EBT_AMONG_DST_NEG 0x1 #define EBT_AMONG_SRC_NEG 0x2 -#define ebt_among_wh_dst(x) ((x)->wh_dst_ofs ? (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_dst_ofs) : NULL) -#define ebt_among_wh_src(x) ((x)->wh_src_ofs ? (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_src_ofs) : NULL) +#define ebt_among_wh_dst(x) ((x)->wh_dst_ofs ? \ + (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_dst_ofs) : NULL) +#define ebt_among_wh_src(x) ((x)->wh_src_ofs ? \ + (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_src_ofs) : NULL) #define EBT_AMONG_MATCH "among" -- cgit v1.2.3