Skip to contentSkip to conversation

ip.7: Document IP_LOCAL_PORT_RANGE socket option

PATCH Superseded Jakub Sitnicki 4 participants 5 messages Feb 1, 2023 – Feb 6, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ip.7: Document IP_LOCAL_PORT_RANGE socket option

Linux commit 91d0b78c5177 ("inet: Add IP_LOCAL_PORT_RANGE socket option") introduced a new socket option available for AF_INET and AF_INET6 sockets.

Option will be available starting from Linux 6.3. Document it.

---
Submitting this man page update as the author of the feature.

We did a technical review of the man page text together with the code [1].

[1]: https://lore.kernel.org/all/[email protected]/

---
 man7/ip.7 | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
man7/ip.7 +21 -0
index f69af1b32..f166c3b57 100644
@@ -439,6 +439,27 @@ and
 .B IP_TOS
 are ignored.
 .TP
+.BR IP_LOCAL_PORT_RANGE " (since Linux 6.3)"
+Set or get the per-socket default local port range. This option can be used to
+clamp down the global local port range, defined by the
+.I ip_local_port_range
+.I /proc
+interface described below, for a given socket.
+.IP
+The option takes an
+.I uint32_t
+value with the high 16 bits set to the upper range bound, and the low 16 bits
+set to the lower range bound. Range bounds are inclusive. The 16-bit values
+should be in host byte order.
+.IP
+The lower bound has to be less than the upper bound when both bounds are not
+zero. Otherwise, setting the option fails with EINVAL.
+.IP
+If either bound is outside of the global local port range, or is zero, then that
+bound has no effect.
+.IP
+To reset the setting, pass zero as both the upper and the lower bound.
+.TP
 .BR IP_MSFILTER " (since Linux 2.4.22 / 2.5.68)"
 This option provides access to the advanced full-state filtering API.
 Argument is an
Signature · 1 line
2.39.1
#1 lore raw
Quoted 9 lines · On Wed, 1 Feb 2023 13:36:34 +0100 Jakub Sitnicki <[email protected]> wrote:

Linux commit 91d0b78c5177 ("inet: Add IP_LOCAL_PORT_RANGE socket option") introduced a new socket option available for AF_INET and AF_INET6 sockets.

Option will be available starting from Linux 6.3. Document it.

---
Submitting this man page update as the author of the feature.

Quoted 6 lines

We did a technical review of the man page text together with the code [1].

[1]: https://lore.kernel.org/all/[email protected]/

---
 man7/ip.7 | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Marking this patch as not applicable in netdev patchwork since it is for documentation and I assume linux-man has its own tracking.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Jakub Sitnicki
Quoted 5 lines · Jakub Sitnicki

Linux commit 91d0b78c5177 ("inet: Add IP_LOCAL_PORT_RANGE socket option") introduced a new socket option available for AF_INET and AF_INET6 sockets.

Option will be available starting from Linux 6.3. Document it.

Quoted 7 lines

---
Submitting this man page update as the author of the feature.

We did a technical review of the man page text together with the code [1].

[1]: https://lore.kernel.org/all/[email protected]/

#3 lore raw
In reply to Jakub Sitnicki

Hi Jakub,

Quoted 10 lines · Jakub Sitnicki

Linux commit 91d0b78c5177 ("inet: Add IP_LOCAL_PORT_RANGE socket option") introduced a new socket option available for AF_INET and AF_INET6 sockets.

Option will be available starting from Linux 6.3. Document it.

---
Submitting this man page update as the author of the feature.

We did a technical review of the man page text together with the code [1].

The formatting LGTM. Could you please resend when it arrives to Linus's tree?

Cheers,

Alex

Quoted 38 lines

[1]: https://lore.kernel.org/all/[email protected]/

---
  man7/ip.7 | 21 +++++++++++++++++++++
  1 file changed, 21 insertions(+)
man7/ip.7 +21 -0
index f69af1b32..f166c3b57 100644
@@ -439,6 +439,27 @@ and
  .B IP_TOS
  are ignored.
  .TP
+.BR IP_LOCAL_PORT_RANGE " (since Linux 6.3)"
+Set or get the per-socket default local port range. This option can be used to
+clamp down the global local port range, defined by the
+.I ip_local_port_range
+.I /proc
+interface described below, for a given socket.
+.IP
+The option takes an
+.I uint32_t
+value with the high 16 bits set to the upper range bound, and the low 16 bits
+set to the lower range bound. Range bounds are inclusive. The 16-bit values
+should be in host byte order.
+.IP
+The lower bound has to be less than the upper bound when both bounds are not
+zero. Otherwise, setting the option fails with EINVAL.
+.IP
+If either bound is outside of the global local port range, or is zero, then that
+bound has no effect.
+.IP
+To reset the setting, pass zero as both the upper and the lower bound.
+.TP
  .BR IP_MSFILTER " (since Linux 2.4.22 / 2.5.68)"
  This option provides access to the advanced full-state filtering API.
  Argument is an
Signature · 2 lines
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
#4 lore raw
Quoted 12 lines · Alejandro Colomar

[[PGP Signed Part:Undecided]]
Hi Jakub,

Quoted 7 lines · Jakub Sitnicki

Linux commit 91d0b78c5177 ("inet: Add IP_LOCAL_PORT_RANGE socket option") introduced a new socket option available for AF_INET and AF_INET6 sockets. Option will be available starting from Linux 6.3. Document it.

---
Submitting this man page update as the author of the feature. We did a technical review of the man page text together with the code [1].

Quoted 1 line

The formatting LGTM. Could you please resend when it arrives to Linus's tree?

Thanks for the review, Alex. Will do.

-Jakub