Skip to content

Conversation

@mhusaam
Copy link

@mhusaam mhusaam commented Jan 13, 2026

The linux kernel provides NF_NAT_RANGE_PROTO_OFFSET flag (netfilter nf_nat_core.c for reference), to make sure that when port ranges are used, then if possible, one-to-one mapping is maintained between external port range and internal port range. But for that flag to be set, iptables extension libxt_DNAT.c requires that base port is also passed along with the port range. Therefore, make sure that if the conditions are right, then we also pass a base port to iptables. One such example where this behaviour is expected is TR-181 data model's Device.NAT.PortMapping. object's InternalPort attribute.

The linux kernel provides NF_NAT_RANGE_PROTO_OFFSET flag (netfilter
nf_nat_core.c for reference), to make sure that when port ranges
are used, then if possible, one-to-one mapping is maintained
between external port range and internal port range. But for that
flag to be set, iptables extension libxt_DNAT.c requires that
base port is also passed along with the port range. Therefore,
make sure that if the conditions are right, then we also pass a
base port to iptables. One such example where this behaviour is
expected is TR-181 data model's Device.NAT.PortMapping. object's
InternalPort attribute.
@mhusaam
Copy link
Author

mhusaam commented Jan 13, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant