|
@@ -246,8 +246,9 @@ get_unique_tuple(struct ip_conntrack_tuple *tuple,
|
|
|
if (maniptype == IP_NAT_MANIP_SRC) {
|
|
|
if (find_appropriate_src(orig_tuple, tuple, range)) {
|
|
|
DEBUGP("get_unique_tuple: Found current src map\n");
|
|
|
- if (!ip_nat_used_tuple(tuple, conntrack))
|
|
|
- return;
|
|
|
+ if (!(range->flags & IP_NAT_RANGE_PROTO_RANDOM))
|
|
|
+ if (!ip_nat_used_tuple(tuple, conntrack))
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -261,6 +262,13 @@ get_unique_tuple(struct ip_conntrack_tuple *tuple,
|
|
|
|
|
|
proto = ip_nat_proto_find_get(orig_tuple->dst.protonum);
|
|
|
|
|
|
+ /* Change protocol info to have some randomization */
|
|
|
+ if (range->flags & IP_NAT_RANGE_PROTO_RANDOM) {
|
|
|
+ proto->unique_tuple(tuple, range, maniptype, conntrack);
|
|
|
+ ip_nat_proto_put(proto);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
/* Only bother mapping if it's not already in range and unique */
|
|
|
if ((!(range->flags & IP_NAT_RANGE_PROTO_SPECIFIED)
|
|
|
|| proto->in_range(tuple, maniptype, &range->min, &range->max))
|