Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 88269
b: refs/heads/master
c: 1b9b70e
h: refs/heads/master
i:
  88267: b798dc6
v: v3
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Apr 9, 2008
1 parent bb13f6b commit 498862c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b41f5bfff73f244101b34f3603974ef7aeadf545
refs/heads/master: 1b9b70ea2ebaab26c3e4fed385dfab6fc16359ed
23 changes: 5 additions & 18 deletions trunk/net/netfilter/xt_hashlimit.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,38 +466,25 @@ static inline void rateinfo_recalc(struct dsthash_ent *dh, unsigned long now)

static inline __be32 maskl(__be32 a, unsigned int l)
{
return htonl(ntohl(a) & ~(~(u_int32_t)0 >> l));
return l ? htonl(ntohl(a) & ~0 << (32 - l)) : 0;
}

#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
static void hashlimit_ipv6_mask(__be32 *i, unsigned int p)
{
switch (p) {
case 0:
i[0] = i[1] = 0;
i[2] = i[3] = 0;
break;
case 1 ... 31:
case 0 ... 31:
i[0] = maskl(i[0], p);
i[1] = i[2] = i[3] = 0;
break;
case 32:
i[1] = i[2] = i[3] = 0;
break;
case 33 ... 63:
case 32 ... 63:
i[1] = maskl(i[1], p - 32);
i[2] = i[3] = 0;
break;
case 64:
i[2] = i[3] = 0;
break;
case 65 ... 95:
case 64 ... 95:
i[2] = maskl(i[2], p - 64);
i[3] = 0;
case 96:
i[3] = 0;
break;
case 97 ... 127:
case 96 ... 127:
i[3] = maskl(i[3], p - 96);
break;
case 128:
Expand Down

0 comments on commit 498862c

Please sign in to comment.