conntrack: Select correct sport range for well-known origin sport.
Like the kernel datapath. The sport nat range for well-konwn origin
sport should limit in the well-known ports.
Acked-by: Paolo Valerio
@@ -2265,8 +2265,16 @@ set_sport_range(const struct nat_action_info_t *ni, const struct conn_key *k,
if (((ni->nat_action & NAT_ACTION_SNAT_ALL) == NAT_ACTION_SRC) ||
((ni->nat_action & NAT_ACTION_DST))) {
*curr = ntohs(k->src.port);
+ if (*curr < 512) {
+ *min = 1;
+ *max = 511;
+ } else if (*curr < 1024) {
+ *min = 600;
+ *max = 1023;
+ } else {
*min = MIN_NAT_EPHEMERAL_PORT;
*max = MAX_NAT_EPHEMERAL_PORT;
+ }
} else {
*min = ni->min_port;
*max = ni->max_port;
