Deleted Added
full compact
27c27
< __FBSDID("$FreeBSD: head/sys/netinet/ipfw/ip_fw_table.c 200838 2009-12-22 13:53:34Z luigi $");
---
> __FBSDID("$FreeBSD: head/sys/netinet/ipfw/ip_fw_table.c 201120 2009-12-28 10:12:35Z luigi $");
81a82,93
> /*
> * The radix code expects addr and mask to be array of bytes,
> * with the first byte being the length of the array. rn_inithead
> * is called with the offset in bits of the lookup key within the
> * array. If we use a sockaddr_in as the underlying type,
> * sin_len is conveniently located at offset 0, sin_addr is at
> * offset 4 and normally aligned.
> * But for portability, let's avoid assumption and make the code explicit
> */
> #define KEY_LEN(v) *((uint8_t *)&(v))
> #define KEY_OFS (8*offsetof(struct sockaddr_in, sin_addr))
>
97c109
< ent->addr.sin_len = ent->mask.sin_len = 8;
---
> KEY_LEN(ent->addr) = KEY_LEN(ent->mask) = 8;
122c134
< sa.sin_len = mask.sin_len = 8;
---
> KEY_LEN(sa) = KEY_LEN(mask) = 8;
182c194
< if (!rn_inithead((void **)&ch->tables[i], 32)) {
---
> if (!rn_inithead((void **)&ch->tables[i], KEY_OFS)) {
203c215
< sa.sin_len = 8;
---
> KEY_LEN(sa) = 8;