Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 108845
b: refs/heads/master
c: 9f59365
h: refs/heads/master
i:
  108843: 783e114
v: v3
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Aug 19, 2008
1 parent 36cb188 commit e7688ed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 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: fab00c5d15091546be681426c60b2ed2c10513bf
refs/heads/master: 9f593653742d1dd816c4e94c6e5154a57ccba6d1
1 change: 1 addition & 0 deletions trunk/drivers/char/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -1571,6 +1571,7 @@ u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport)

return half_md4_transform(hash, keyptr->secret);
}
EXPORT_SYMBOL_GPL(secure_ipv4_port_ephemeral);

#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
Expand Down
8 changes: 6 additions & 2 deletions trunk/net/ipv4/netfilter/nf_nat_proto_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,13 @@ bool nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
range_size = ntohs(range->max.all) - min + 1;
}

off = *rover;
if (range->flags & IP_NAT_RANGE_PROTO_RANDOM)
off = net_random();
off = secure_ipv4_port_ephemeral(tuple->src.u3.ip, tuple->dst.u3.ip,
maniptype == IP_NAT_MANIP_SRC
? tuple->dst.u.all
: tuple->src.u.all);
else
off = *rover;

for (i = 0; i < range_size; i++, off++) {
*portptr = htons(min + off % range_size);
Expand Down

0 comments on commit e7688ed

Please sign in to comment.