Skip to contentSkip to conversation

doc/Makefile: rebuild rst docs if input files change

PATCH In review Frank Lichtenheld 3 participants 17 messages Dec 9, 2021 – Feb 16, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 doc/Makefile: rebuild rst docs if input files change

For now the dependencies are statically defined, which should be fine and is still a much better solution than to have no dependencies.

---
 doc/Makefile.am | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
doc/Makefile.am +15 -6
index 1a67f7b5..a31b8097 100644
@@ -23,16 +23,11 @@ build_html_pages = openvpn.8.html openvpn-examples.5.html
 dist_doc_DATA = \
 	management-notes.txt gui-notes.txt
 
-dist_noinst_DATA = \
-	README.plugins interactive-service-notes.rst \
-	openvpn.8.rst \
-	openvpn-examples.5.rst \
+openvpn_sections = \
 	man-sections/advanced-options.rst \
 	man-sections/client-options.rst \
 	man-sections/connection-profiles.rst \
 	man-sections/encryption-options.rst \
-	man-sections/example-fingerprint.rst \
-	man-sections/examples.rst \
 	man-sections/generic-options.rst \
 	man-sections/inline-files.rst \
 	man-sections/link-options.rst \
@@ -53,6 +48,20 @@ dist_noinst_DATA = \
 	man-sections/vpn-network-options.rst \
 	man-sections/windows-options.rst
 
+openvpn_examples_sections = \
+	man-sections/example-fingerprint.rst \
+	man-sections/examples.rst
+
+dist_noinst_DATA = \
+	README.plugins interactive-service-notes.rst \
+	openvpn.8.rst \
+	openvpn-examples.5.rst \
+	$(openvpn_sections) \
+	$(openvpn_examples_sections)
+
+# dependencies
+openvpn.8 openvpn.8.html: $(openvpn_sections)
+openvpn-examples.5 openvpn-examples.5.html: $(openvpn_examples_sections)
 
 ######  GENERIC  RULES  ##########
 
Signature · 1 line
2.30.2
#1 lore raw

PATCH 2/3 doc: fix misc documentation issues

- Broken/missing formatting
- Make it obvious which arguments are optional
- In some cases moved the "Valid syntax" block earlier to make sure the text references argument names after they have been declared.

Only the files touched have been reviewed, all other files likely have similar issues.

---
 doc/man-sections/client-options.rst   | 15 +++++------
 doc/man-sections/generic-options.rst  | 35 +++++++++++++++---------
 doc/man-sections/link-options.rst     | 38 +++++++++++++++++----------
 doc/man-sections/protocol-options.rst |  2 +-
 src/openvpn/options.c                 |  2 +-
 5 files changed, 56 insertions(+), 36 deletions(-)
doc/man-sections/client-options.rst +7 -8
index c5b7ad96..3c0bce4b 100644
@@ -175,17 +175,16 @@ configuration.
   enabled.
 
 --inactive args
+  Valid syntaxes::
+
+       inactive n
+       inactive n bytes
+
   Causes OpenVPN to exit after ``n`` seconds of inactivity on the TUN/TAP
   device. The time length of inactivity is measured since the last
   incoming or outgoing tunnel packet. The default value is 0 seconds,
   which disables this feature.
 
-  Valid syntaxes:
-  ::
-
-       inactive n
-       inactive n bytes
-
   If the optional ``bytes`` parameter is included, exit if less than
   ``bytes`` of combined in/out traffic are produced on the tun/tap device
   in ``n`` seconds.
@@ -329,7 +328,7 @@ configuration.
   If hostname resolve fails for ``--remote``, retry resolve for ``n``
   seconds before failing.
 
-  Set ``n`` to "infinite" to retry indefinitely.
+  Set ``n`` to :code:`infinite` to retry indefinitely.
 
   By default, ``--resolv-retry infinite`` is enabled. You can disable by
   setting n=0.
@@ -348,7 +347,7 @@ configuration.
 --server-poll-timeout n
   When connecting to a remote server do not wait for more than ``n``
   seconds for a response before trying the next server. The default value
-  is 120s. This timeout includes proxy and TCP connect timeouts.
+  is :code:`120`. This timeout includes proxy and TCP connect timeouts.
 
 --static-challenge args
   Enable static challenge/response protocol
doc/man-sections/generic-options.rst +23 -12
index a8f049f2..c5d5fe62 100644
@@ -48,7 +48,7 @@ which mode OpenVPN is configured as.
 
   Note: The SSL library will probably need /dev/urandom to be available
   inside the chroot directory ``dir``. This is because SSL libraries
-  occasionally need to collect fresh random. Newer linux kernels and some
+  occasionally need to collect fresh randomness. Newer linux kernels and some
   BSDs implement a getrandom() or getentropy() syscall that removes the
   need for /dev/urandom to be available.
 
@@ -75,7 +75,7 @@ which mode OpenVPN is configured as.
 
 --config file
   Load additional config options from ``file`` where each line corresponds
-  to one command line option, but with the leading '--' removed.
+  to one command line option, but with the leading :code:`--` removed.
 
   If ``--config file`` is the only option to the openvpn command, the
   ``--config`` can be removed, and the command can be given as ``openvpn
@@ -130,6 +130,11 @@ which mode OpenVPN is configured as.
       secret static.key
 
 --daemon progname
+  Valid syntaxes::
+
+    daemon
+    daemon progname
+
   Become a daemon after all initialization functions are completed. This
   option will cause all message and error output to be sent to the syslog
   file (such as :code:`/var/log/messages`), except for the output of
@@ -166,6 +171,8 @@ which mode OpenVPN is configured as.
   renegotiation (and reauthentication) occurs.
 
 --disable-occ
+  Disable "options consistency check" (OCC).
+
   Don't output a warning message if option inconsistencies are detected
   between peers. An example of an option inconsistency would be where one
   peer uses ``--dev tun`` while the other peer uses ``--dev tap``.
@@ -175,6 +182,11 @@ which mode OpenVPN is configured as.
   version.
 
 --engine engine-name
+  Valid syntaxes::
+
+    engine
+    engine engine-name
+
   Enable OpenSSL hardware-based crypto engine functionality.
 
   If ``engine-name`` is specified, use a specific crypto engine. Use the
@@ -221,16 +233,15 @@ which mode OpenVPN is configured as.
   May be used in order to execute OpenVPN in unprivileged environment.
 
 --keying-material-exporter args
+  Valid syntax::
+
+    keying-material-exporter label len
+
   Save Exported Keying Material [RFC5705] of len bytes (must be between 16
   and 4095 bytes) using ``label`` in environment
   (:code:`exported_keying_material`) for use by plugins in
   :code:`OPENVPN_PLUGIN_TLS_FINAL` callback.
 
-  Valid syntax:
-  ::
-
-    keying-material-exporter label len
-
   Note that exporter ``labels`` have the potential to collide with existing
   PRF labels. In order to prevent this, labels *MUST* begin with
   :code:`EXPORTER`.
@@ -295,7 +306,7 @@ which mode OpenVPN is configured as.
 --remap-usr1 signal
   Control whether internally or externally generated :code:`SIGUSR1` signals
   are remapped to :code:`SIGHUP` (restart without persisting state) or
-  SIGTERM (exit).
+  :code:`SIGTERM` (exit).
 
   ``signal`` can be set to :code:`SIGHUP` or :code:`SIGTERM`. By default,
   no remapping occurs.
@@ -372,14 +383,14 @@ which mode OpenVPN is configured as.
   consider using the ``--persist-key`` and ``--persist-tun`` options.
 
 --status args
-  Write operational status to ``file`` every ``n`` seconds.
-
-  Valid syntaxes:
-  ::
+  Valid syntaxes::
 
     status file
     status file n
 
+  Write operational status to ``file`` every ``n`` seconds. ``n`` defaults
+  to :code:`60` if not specified.
+
   Status can also be written to the syslog by sending a :code:`SIGUSR2`
   signal.
 
doc/man-sections/link-options.rst +24 -14
index 32e72a1b..901751bb 100644
@@ -51,13 +51,15 @@ the local and the remote host.
   UDP multicast stream which requires fragmentation.
 
 --keepalive args
+  Valid syntax::
+
+     keepalive interval timeout
+
   A helper directive designed to simplify the expression of ``--ping`` and
   ``--ping-restart``.
 
-  Valid syntax:
-  ::
-
-     keepalive interval timeout
+  Send ping once every ``interval`` seconds, restart if ping is not received
+  for ``timeout`` seconds.
 
   This option can be used on both client and server side, but it is enough
   to add this on the server side as it will push appropriate ``--ping``
@@ -96,7 +98,7 @@ the local and the remote host.
   ``--nobind`` option.
 
 --mark value
-  Mark encrypted packets being sent with value. The mark value can be
+  Mark encrypted packets being sent with ``value``. The mark value can be
   matched in policy routing and packetfilter rules. This option is only
   supported in Linux and does nothing on other operating systems.
 
@@ -106,6 +108,11 @@ the local and the remote host.
   implements a multi-client server capability.
 
 --mssfix max
+  Valid syntaxes::
+
+    mssfix
+    mssfix max
+
   Announce to TCP sessions running over the tunnel that they should limit
   their send packet sizes such that after OpenVPN has encapsulated them,
   the resulting UDP packet size that OpenVPN sends to its peer will not
@@ -167,7 +174,7 @@ the local and the remote host.
   Do not bind to local address and port. The IP stack will allocate a
   dynamic port for returning packets. Since the value of the dynamic port
   could not be known in advance by a peer, this option is only suitable
-  for peers which will be initiating connections by using the --remote
+  for peers which will be initiating connections by using the ``--remote``
   option.
 
 --passtos
@@ -191,6 +198,8 @@ the local and the remote host.
   (2)  To provide a basis for the remote to test the existence of its peer
        using the ``--ping-exit`` option.
 
+  When using OpenVPN in server mode see also ``--keepalive``.
+
 --ping-exit n
   Causes OpenVPN to exit after ``n`` seconds pass without reception of a
   ping or other packet from remote. This option can be combined with
@@ -291,18 +300,19 @@ the local and the remote host.
 --replay-window args
   Modify the replay protection sliding-window size and time window.
 
-  Valid syntax:
-  ::
+  Valid syntaxes::
 
-     replay-window n [t]
+     replay-window n
+     replay-window n t
 
-  Use a replay protection sliding-window of size **n** and a time window
-  of **t** seconds.
+  Use a replay protection sliding-window of size ``n`` and a time window
+  of ``t`` seconds.
 
-  By default **n** is 64 (the IPSec default) and **t** is 15 seconds.
+  By default ``n`` is :code:`64` (the IPSec default) and ``t`` is
+  :code:`15` seconds.
 
-  This option is only relevant in UDP mode, i.e. when either **--proto
-  udp** is specified, or no **--proto** option is specified.
+  This option is only relevant in UDP mode, i.e. when either ``--proto
+  udp`` is specified, or no ``--proto`` option is specified.
 
   When OpenVPN tunnels IP packets over UDP, there is the possibility that
   packets might be dropped or delivered out of order. Because OpenVPN,
doc/man-sections/protocol-options.rst +1 -1
index 1c6b1200..b3edc499 100644
@@ -125,7 +125,7 @@ configured in a compatible way between both the local and remote side.
   configuration if supported by the client and otherwise switch to ``comp-lzo no``
   and add ``--push comp-lzo`` to the client specific configuration.
 
-  ***Security Considerations***
+  **Security Considerations**
 
   Compression and encryption is a tricky combination. If an attacker knows
   or is able to control (parts of) the plain-text of packets that contain
src/openvpn/options.c +1 -1
index ac13412a..c1ec7ed0 100644
@@ -343,7 +343,7 @@ static const char usage_message[] =
     "                       and received from TCP/UDP (caps) or tun/tap (lc)\n"
     "                : 6 to 11 -- debug messages of increasing verbosity\n"
     "--mute n        : Log at most n consecutive messages in the same category.\n"
-    "--status file n : Write operational status to file every n seconds.\n"
+    "--status file [n] : Write operational status to file every n seconds.\n"
     "--status-version [n] : Choose the status file format version number.\n"
     "                  Currently, n can be 1, 2, or 3 (default=1).\n"
     "--disable-occ   : Disable options consistency check between peers.\n"
Signature · 1 line
2.30.2
#2 lore raw

Re: [Openvpn-devel] [PATCH 2/3] doc: fix misc documentation issues

Quoted 32 lines · Frank Lichtenheld

- Broken/missing formatting
- Make it obvious which arguments are optional
- In some cases moved the "Valid syntax" block earlier to make sure the text references argument names after they have been declared.

Only the files touched have been reviewed, all other files likely have similar issues.

---
  doc/man-sections/client-options.rst   | 15 +++++------
  doc/man-sections/generic-options.rst  | 35 +++++++++++++++---------
  doc/man-sections/link-options.rst     | 38 +++++++++++++++++----------
  doc/man-sections/protocol-options.rst |  2 +-
  src/openvpn/options.c                 |  2 +-
  5 files changed, 56 insertions(+), 36 deletions(-)
doc/man-sections/client-options.rst +5 -0
index c5b7ad96..3c0bce4b 100644
@@ -175,17 +175,16 @@ configuration.
    enabled.
 
  --inactive args
+  Valid syntaxes::
+
+       inactive n
+       inactive n bytes
+
    Causes OpenVPN to exit after ``n`` seconds of inactivity on the TUN/TAP

doc/man-sections/client-options.rst configuration. · line 188

Quoted 10 lines
doc/man-sections/client-options.rst +0 -6
    device. The time length of inactivity is measured since the last
    incoming or outgoing tunnel packet. The default value is 0 seconds,
    which disables this feature.
 
-  Valid syntaxes:
-  ::
-
-       inactive n
-       inactive n bytes
-

I'm not sure this change is a clever move. In particular the HTML rendering might in some cases put the option and argument in the same line as the "Valid syntax" line - which looks odd.

This is why I initially put the "Valid syntax" block below a short introduction to what this option is about. This option intro should in theory be as short and concise as possible and should ideally not exceed 2-3 lines. With this approach, the HTML rendering and groff rendering is fairly recognisable.

doc/man-sections/client-options.rst configuration. · line 331

Quoted 9 lines
doc/man-sections/client-options.rst +1 -1
    If the optional ``bytes`` parameter is included, exit if less than
    ``bytes`` of combined in/out traffic are produced on the tun/tap device
    in ``n`` seconds.
@@ -329,7 +328,7 @@ configuration.
    If hostname resolve fails for ``--remote``, retry resolve for ``n``
    seconds before failing.
 
-  Set ``n`` to "infinite" to retry indefinitely.
+  Set ``n`` to :code:`infinite` to retry indefinitely.

Changes like this are good, and that improves the HTML rendering as well (and we can make it even better with a better CSS included).

[...snip...]

doc/man-sections/client-options.rst which mode OpenVPN is configured as. · line 175

Quoted 6 lines
doc/man-sections/client-options.rst +2 -0
@@ -166,6 +171,8 @@ which mode OpenVPN is configured as.
    renegotiation (and reauthentication) occurs.
 
  --disable-occ
+  Disable "options consistency check" (OCC).
+

This is good!

[...snip...]

doc/man-sections/client-options.rst the local and the remote host. · line 115

Quoted 9 lines
doc/man-sections/client-options.rst +5 -0
@@ -106,6 +108,11 @@ the local and the remote host.
    implements a multi-client server capability.
 
  --mssfix max
+  Valid syntaxes::
+
+    mssfix
+    mssfix max
+

This section actually has a conflict with latest git master.

[...snip...]

doc/man-sections/client-options.rst the local and the remote host. · line 306

Quoted 11 lines
doc/man-sections/client-options.rst +3 -3
@@ -291,18 +300,19 @@ the local and the remote host.
  --replay-window args
    Modify the replay protection sliding-window size and time window.
 
-  Valid syntax:
-  ::
+  Valid syntaxes::
 
-     replay-window n [t]
+     replay-window n
+     replay-window n t

This is reasonable, might be clearer this way.

Quoted 21 lines
doc/man-sections/client-options.rst +6 -5
-  Use a replay protection sliding-window of size **n** and a time window
-  of **t** seconds.
+  Use a replay protection sliding-window of size ``n`` and a time window
+  of ``t`` seconds.
 
-  By default **n** is 64 (the IPSec default) and **t** is 15 seconds.
+  By default ``n`` is :code:`64` (the IPSec default) and ``t`` is
+  :code:`15` seconds.
 
-  This option is only relevant in UDP mode, i.e. when either **--proto
-  udp** is specified, or no **--proto** option is specified.
+  This option is only relevant in UDP mode, i.e. when either ``--proto
+  udp`` is specified, or no ``--proto`` option is specified.
 
    When OpenVPN tunnels IP packets over UDP, there is the possibility that
    packets might be dropped or delivered out of order. Because OpenVPN,
doc/man-sections/protocol-options.rst +0 -0
index 1c6b1200..b3edc499 100644

doc/man-sections/protocol-options.rst configured in a compatible way between both the local and remote side. · line 128

Quoted 5 lines
doc/man-sections/protocol-options.rst +1 -1
@@ -125,7 +125,7 @@ configured in a compatible way between both the local and remote side.
    configuration if supported by the client and otherwise switch to ``comp-lzo no``
    and add ``--push comp-lzo`` to the client specific configuration.
 
-  ***Security Considerations***
+  **Security Considerations**

This is a more a style/cosmetic change. The idea with *** was to actually have the star-wrapping visible in the rendering. This was done a few places where trying to highlight this even better was the intension. This should not be found many places though, and typically related to security challenges.

src/openvpn/options.c static const char usage_message[] = · line 346

Quoted 13 lines
doc/man-sections/protocol-options.rst +0 -0
    Compression and encryption is a tricky combination. If an attacker knows
    or is able to control (parts of) the plain-text of packets that contain
src/openvpn/options.c +1 -1
index ac13412a..c1ec7ed0 100644
@@ -343,7 +343,7 @@ static const char usage_message[] =
      "                       and received from TCP/UDP (caps) or tun/tap (lc)\n"
      "                : 6 to 11 -- debug messages of increasing verbosity\n"
      "--mute n        : Log at most n consecutive messages in the same category.\n"
-    "--status file n : Write operational status to file every n seconds.\n"
+    "--status file [n] : Write operational status to file every n seconds.\n"

This is also good!

I've not commented all changes, just the generic ideas of changes here. There are lots of good things here, and most of it makes sense. I'd just be very careful moving the "Valid syntax" blocks around.

If we just want security warnings in plain bold or wrapped in '*' is more a design/layout detail. I would suggest that we try to find better ways to highlight these security related aspects in a clear and visible way though. It doesn't mean it need to stay as it is today, though. The current approach was more or less a "this can work" approach.

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#3 lore raw

PATCH v2 2/3 doc: fix misc documentation issues

In reply to Frank Lichtenheld

- Broken/missing formatting
- Make it obvious which arguments are optional

Only the files touched have been reviewed, all other files likely have similar issues.

---
 doc/man-sections/client-options.rst  |  4 ++--
 doc/man-sections/generic-options.rst | 34 ++++++++++++++++++++--------
 doc/man-sections/link-options.rst    | 26 +++++++++++++--------
 src/openvpn/options.c                |  2 +-
 4 files changed, 43 insertions(+), 23 deletions(-)

v2: remove some changes David disliked. Not that important.

doc/man-sections/client-options.rst +2 -2
index 92a02e28..c7cec176 100644
@@ -398,7 +398,7 @@ configuration.
   If hostname resolve fails for ``--remote``, retry resolve for ``n``
   seconds before failing.
 
-  Set ``n`` to "infinite" to retry indefinitely.
+  Set ``n`` to :code:`infinite` to retry indefinitely.
 
   By default, ``--resolv-retry infinite`` is enabled. You can disable by
   setting n=0.
@@ -417,7 +417,7 @@ configuration.
 --server-poll-timeout n
   When connecting to a remote server do not wait for more than ``n``
   seconds for a response before trying the next server. The default value
-  is 120s. This timeout includes proxy and TCP connect timeouts.
+  is :code:`120`. This timeout includes proxy and TCP connect timeouts.
 
 --static-challenge args
   Enable static challenge/response protocol
doc/man-sections/generic-options.rst +24 -10
index a8f049f2..9060a235 100644
@@ -48,7 +48,7 @@ which mode OpenVPN is configured as.
 
   Note: The SSL library will probably need /dev/urandom to be available
   inside the chroot directory ``dir``. This is because SSL libraries
-  occasionally need to collect fresh random. Newer linux kernels and some
+  occasionally need to collect fresh randomness. Newer linux kernels and some
   BSDs implement a getrandom() or getentropy() syscall that removes the
   need for /dev/urandom to be available.
 
@@ -75,7 +75,7 @@ which mode OpenVPN is configured as.
 
 --config file
   Load additional config options from ``file`` where each line corresponds
-  to one command line option, but with the leading '--' removed.
+  to one command line option, but with the leading :code:`--` removed.
 
   If ``--config file`` is the only option to the openvpn command, the
   ``--config`` can be removed, and the command can be given as ``openvpn
@@ -130,8 +130,14 @@ which mode OpenVPN is configured as.
       secret static.key
 
 --daemon progname
-  Become a daemon after all initialization functions are completed. This
-  option will cause all message and error output to be sent to the syslog
+  Become a daemon after all initialization functions are completed.
+
+  Valid syntaxes::
+
+    daemon
+    daemon progname
+
+  This option will cause all message and error output to be sent to the syslog
   file (such as :code:`/var/log/messages`), except for the output of
   scripts and ifconfig commands, which will go to :code:`/dev/null` unless
   otherwise redirected. The syslog redirection occurs immediately at the
@@ -142,7 +148,7 @@ which mode OpenVPN is configured as.
   The optional ``progname`` parameter will cause OpenVPN to report its
   program name to the system logger as ``progname``. This can be useful in
   linking OpenVPN messages in the syslog file with specific tunnels. When
-  unspecified, ``progname`` defaults to "openvpn".
+  unspecified, ``progname`` defaults to :code:`openvpn`.
 
   When OpenVPN is run with the ``--daemon`` option, it will try to delay
   daemonization until the majority of initialization functions which are
@@ -166,6 +172,8 @@ which mode OpenVPN is configured as.
   renegotiation (and reauthentication) occurs.
 
 --disable-occ
+  Disable "options consistency check" (OCC).
+
   Don't output a warning message if option inconsistencies are detected
   between peers. An example of an option inconsistency would be where one
   peer uses ``--dev tun`` while the other peer uses ``--dev tap``.
@@ -177,6 +185,11 @@ which mode OpenVPN is configured as.
 --engine engine-name
   Enable OpenSSL hardware-based crypto engine functionality.
 
+  Valid syntaxes::
+
+    engine
+    engine engine-name
+
   If ``engine-name`` is specified, use a specific crypto engine. Use the
   ``--show-engines`` standalone option to list the crypto engines which
   are supported by OpenSSL.
@@ -191,7 +204,7 @@ which mode OpenVPN is configured as.
   call, improving CPU efficiency by 5% to 10%.
 
   This option can only be used on non-Windows systems, when ``--proto
-  udp`` is specified, and when ``--shaper`` is NOT specified.
+  udp`` is specified, and when ``--shaper`` is *NOT* specified.
 
 --group group
   Similar to the ``--user`` option, this option changes the group ID of
@@ -221,7 +234,7 @@ which mode OpenVPN is configured as.
   May be used in order to execute OpenVPN in unprivileged environment.
 
 --keying-material-exporter args
-  Save Exported Keying Material [RFC5705] of len bytes (must be between 16
+  Save Exported Keying Material [RFC5705] of ``len`` bytes (must be between 16
   and 4095 bytes) using ``label`` in environment
   (:code:`exported_keying_material`) for use by plugins in
   :code:`OPENVPN_PLUGIN_TLS_FINAL` callback.
@@ -289,13 +302,13 @@ which mode OpenVPN is configured as.
 
       --providers legacy default
 
-  Behaviour of changing this option between SIGHUP might not be well behaving.
+  Behaviour of changing this option between :code:`SIGHUP` might not be well behaving.
   If you need to change/add/remove this option, fully restart OpenVPN.
 
 --remap-usr1 signal
   Control whether internally or externally generated :code:`SIGUSR1` signals
   are remapped to :code:`SIGHUP` (restart without persisting state) or
-  SIGTERM (exit).
+  :code:`SIGTERM` (exit).
 
   ``signal`` can be set to :code:`SIGHUP` or :code:`SIGTERM`. By default,
   no remapping occurs.
@@ -372,7 +385,8 @@ which mode OpenVPN is configured as.
   consider using the ``--persist-key`` and ``--persist-tun`` options.
 
 --status args
-  Write operational status to ``file`` every ``n`` seconds.
+  Write operational status to ``file`` every ``n`` seconds. ``n`` defaults
+  to :code:`60` if not specified.
 
   Valid syntaxes:
   ::
doc/man-sections/link-options.rst +16 -10
index 1cf6dd84..52df843d 100644
@@ -71,6 +71,9 @@ the local and the remote host.
 
      keepalive interval timeout
 
+  Send ping once every ``interval`` seconds, restart if ping is not received
+  for ``timeout`` seconds.
+
   This option can be used on both client and server side, but it is enough
   to add this on the server side as it will push appropriate ``--ping``
   and ``--ping-restart`` options to the client. If used on both server and
@@ -113,7 +116,7 @@ the local and the remote host.
   ``--nobind`` option.
 
 --mark value
-  Mark encrypted packets being sent with value. The mark value can be
+  Mark encrypted packets being sent with ``value``. The mark value can be
   matched in policy routing and packetfilter rules. This option is only
   supported in Linux and does nothing on other operating systems.
 
@@ -202,7 +205,7 @@ the local and the remote host.
   Do not bind to local address and port. The IP stack will allocate a
   dynamic port for returning packets. Since the value of the dynamic port
   could not be known in advance by a peer, this option is only suitable
-  for peers which will be initiating connections by using the --remote
+  for peers which will be initiating connections by using the ``--remote``
   option.
 
 --passtos
@@ -226,6 +229,8 @@ the local and the remote host.
   (2)  To provide a basis for the remote to test the existence of its peer
        using the ``--ping-exit`` option.
 
+  When using OpenVPN in server mode see also ``--keepalive``.
+
 --ping-exit n
   Causes OpenVPN to exit after ``n`` seconds pass without reception of a
   ping or other packet from remote. This option can be combined with
@@ -326,18 +331,19 @@ the local and the remote host.
 --replay-window args
   Modify the replay protection sliding-window size and time window.
 
-  Valid syntax:
-  ::
+  Valid syntaxes::
 
-     replay-window n [t]
+     replay-window n
+     replay-window n t
 
-  Use a replay protection sliding-window of size **n** and a time window
-  of **t** seconds.
+  Use a replay protection sliding-window of size ``n`` and a time window
+  of ``t`` seconds.
 
-  By default **n** is 64 (the IPSec default) and **t** is 15 seconds.
+  By default ``n`` is :code:`64` (the IPSec default) and ``t`` is
+  :code:`15` seconds.
 
-  This option is only relevant in UDP mode, i.e. when either **--proto
-  udp** is specified, or no **--proto** option is specified.
+  This option is only relevant in UDP mode, i.e. when either ``--proto
+  udp`` is specified, or no ``--proto`` option is specified.
 
   When OpenVPN tunnels IP packets over UDP, there is the possibility that
   packets might be dropped or delivered out of order. Because OpenVPN,
src/openvpn/options.c +1 -1
index 2538421b..92aeba3d 100644
@@ -344,7 +344,7 @@ static const char usage_message[] =
     "                       and received from TCP/UDP (caps) or tun/tap (lc)\n"
     "                : 6 to 11 -- debug messages of increasing verbosity\n"
     "--mute n        : Log at most n consecutive messages in the same category.\n"
-    "--status file n : Write operational status to file every n seconds.\n"
+    "--status file [n] : Write operational status to file every n seconds.\n"
     "--status-version [n] : Choose the status file format version number.\n"
     "                  Currently, n can be 1, 2, or 3 (default=1).\n"
     "--disable-occ   : Disable options consistency check between peers.\n"
Signature · 1 line
2.30.2
Acked-by on v2 2/3
#4 lore raw

Re: [Openvpn-devel] [PATCH 2/3 v2] doc: fix misc documentation issues

Quoted 14 lines · Frank Lichtenheld

- Broken/missing formatting
- Make it obvious which arguments are optional

Only the files touched have been reviewed, all other files likely have similar issues.

---
  doc/man-sections/client-options.rst  |  4 ++--
  doc/man-sections/generic-options.rst | 34 ++++++++++++++++++++--------
  doc/man-sections/link-options.rst    | 26 +++++++++++++--------
  src/openvpn/options.c                |  2 +-
  4 files changed, 43 insertions(+), 23 deletions(-)
Quoted 5 lines

v2: remove some changes David disliked. Not that important.

Quoted 1 line

Regards,
--
Frank Lichtenheld

Thanks!

This time I've only glared at the changes in diff format, but they all look sane and good to me.

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: doc: fix misc documentation issues

In reply to Frank Lichtenheld

Your patch has been applied to the master branch.

commit fe340a9c1ee1b04b17e7fb367043ff575763b91c

Author: Frank Lichtenheld
Date:   Mon Feb 14 18:33:42 2022 +0100
     doc: fix misc documentation issues

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: David Sommerseth <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg23788.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#6 lore raw

PATCH 3/3 doc/options: clean up documentation for --proto and related options

In reply to Frank Lichtenheld

The family specific options were generally omitted.

---
 doc/man-sections/client-options.rst |  5 +++++
 doc/man-sections/link-options.rst   |  5 ++++-
 src/openvpn/options.c               | 17 +++++++++--------
 3 files changed, 18 insertions(+), 9 deletions(-)
doc/man-sections/client-options.rst +5 -0
index 3c0bce4b..3a836226 100644
@@ -198,6 +198,11 @@ configuration.
   When iterating through connection profiles, only consider profiles using
   protocol ``p`` (:code:`tcp` \| :code:`udp`).
 
+  Note that this specifically only affects the protocol, not the inet
+  family (i.e. IPv4 vs. IPv6). While the option actually accepts
+  values like :code:`udp6`, there is no difference to specifying
+  :code:`udp`.
+
 --pull
   This option must be used on a client which is connecting to a
   multi-client server. It indicates to OpenVPN that it should accept
doc/man-sections/link-options.rst +4 -1
index 901751bb..a4c3166b 100644
@@ -258,7 +258,10 @@ the local and the remote host.
 
 --proto p
   Use protocol ``p`` for communicating with remote host. ``p`` can be
-  :code:`udp`, :code:`tcp-client`, or :code:`tcp-server`.
+  :code:`udp`, :code:`tcp-client`, or :code:`tcp-server`. You can also
+  limit OpenVPN to use only IPv4 or only IPv6 by specifying ``p`` as
+  :code:`udp4`, :code:`tcp4-client`, :code:`tcp4-server` or :code:`udp6`,
+  :code:`tcp6-client`, :code:`tcp6-server`, respectively.
 
   The default protocol is :code:`udp` when ``--proto`` is not specified.
 
src/openvpn/options.c +9 -8
index c1ec7ed0..c7cf3400 100644
@@ -125,9 +125,11 @@ static const char usage_message[] =
     "--remote-random-hostname : Add a random string to remote DNS name.\n"
     "--mode m        : Major mode, m = 'p2p' (default, point-to-point) or 'server'.\n"
     "--proto p       : Use protocol p for communicating with peer.\n"
-    "                  p = udp (default), tcp-server, or tcp-client\n"
+    "                  p = udp (default), tcp-server, tcp-client\n"
+    "                      udp4, tcp4-server, tcp4-client\n"
+    "                      udp6, tcp6-server, tcp6-client\n"
     "--proto-force p : only consider protocol p in list of connection profiles.\n"
-    "                  p = udp6, tcp6-server, or tcp6-client (ipv6)\n"
+    "                  p = udp or tcp\n"
     "--connect-retry n [m] : For client, number of seconds to wait between\n"
     "                  connection retries (default=%d). On repeated retries\n"
     "                  the wait time is exponentially increased to a maximum of m\n"
@@ -2314,15 +2316,16 @@ options_postprocess_verify_ce(const struct options *options,
         }
         if (!(proto_is_udp(ce->proto) || ce->proto == PROTO_TCP_SERVER))
         {
-            msg(M_USAGE, "--mode server currently only supports "
-                "--proto udp or --proto tcp-server or proto tcp6-server");
+#define USAGE_VALID_SERVER_PROTOS "--mode server currently only supports " \
+            "--proto values of udp, tcp-server, tcp4-server, or tcp6-server"
+            msg(M_USAGE, USAGE_VALID_SERVER_PROTOS);
         }
 #if PORT_SHARE
         if ((options->port_share_host || options->port_share_port)
             && (ce->proto != PROTO_TCP_SERVER))
         {
             msg(M_USAGE, "--port-share only works in TCP server mode "
-                "(--proto tcp-server or tcp6-server)");
+                "(--proto values of tcp-server, tcp4-server, or tcp6-server)");
         }
 #endif
         if (!options->tls_server)
@@ -2366,9 +2369,7 @@ options_postprocess_verify_ce(const struct options *options,
         }
         if (!(proto_is_dgram(ce->proto) || ce->proto == PROTO_TCP_SERVER))
         {
-            msg(M_USAGE,
-                "--mode server currently only supports --proto udp or --proto "
-                "tcp-server or --proto tcp6-server");
+            msg(M_USAGE, USAGE_VALID_SERVER_PROTOS);
         }
         if (!proto_is_udp(ce->proto) && (options->cf_max || options->cf_per))
         {
Signature · 1 line
2.30.2
#7 lore raw

Re: [Openvpn-devel] [PATCH 3/3] doc/options: clean up documentation for --proto and related options

Quoted 58 lines · Frank Lichtenheld

The family specific options were generally omitted.

---
  doc/man-sections/client-options.rst |  5 +++++
  doc/man-sections/link-options.rst   |  5 ++++-
  src/openvpn/options.c               | 17 +++++++++--------
  3 files changed, 18 insertions(+), 9 deletions(-)
doc/man-sections/client-options.rst +5 -0
index 3c0bce4b..3a836226 100644
@@ -198,6 +198,11 @@ configuration.
    When iterating through connection profiles, only consider profiles using
    protocol ``p`` (:code:`tcp` \| :code:`udp`).
 
+  Note that this specifically only affects the protocol, not the inet
+  family (i.e. IPv4 vs. IPv6). While the option actually accepts
+  values like :code:`udp6`, there is no difference to specifying
+  :code:`udp`.
+
  --pull
    This option must be used on a client which is connecting to a
    multi-client server. It indicates to OpenVPN that it should accept
doc/man-sections/link-options.rst +4 -1
index 901751bb..a4c3166b 100644
@@ -258,7 +258,10 @@ the local and the remote host.
 
  --proto p
    Use protocol ``p`` for communicating with remote host. ``p`` can be
-  :code:`udp`, :code:`tcp-client`, or :code:`tcp-server`.
+  :code:`udp`, :code:`tcp-client`, or :code:`tcp-server`. You can also
+  limit OpenVPN to use only IPv4 or only IPv6 by specifying ``p`` as
+  :code:`udp4`, :code:`tcp4-client`, :code:`tcp4-server` or :code:`udp6`,
+  :code:`tcp6-client`, :code:`tcp6-server`, respectively.
 
    The default protocol is :code:`udp` when ``--proto`` is not specified.
 
src/openvpn/options.c +4 -2
index c1ec7ed0..c7cf3400 100644
@@ -125,9 +125,11 @@ static const char usage_message[] =
      "--remote-random-hostname : Add a random string to remote DNS name.\n"
      "--mode m        : Major mode, m = 'p2p' (default, point-to-point) or 'server'.\n"
      "--proto p       : Use protocol p for communicating with peer.\n"
-    "                  p = udp (default), tcp-server, or tcp-client\n"
+    "                  p = udp (default), tcp-server, tcp-client\n"
+    "                      udp4, tcp4-server, tcp4-client\n"
+    "                      udp6, tcp6-server, tcp6-client\n"
      "--proto-force p : only consider protocol p in list of connection profiles.\n"
-    "                  p = udp6, tcp6-server, or tcp6-client (ipv6)\n"
+    "                  p = udp or tcp\n"
      "--connect-retry n [m] : For client, number of seconds to wait between\n"
      "                  connection retries (default=%d). On repeated retries\n"
      "                  the wait time is exponentially increased to a maximum of m\n"

src/openvpn/options.c options_postprocess_verify_ce(const struct options *options, · line 2321

Quoted 8 lines
src/openvpn/options.c +3 -2
@@ -2314,15 +2316,16 @@ options_postprocess_verify_ce(const struct options *options,
          }
          if (!(proto_is_udp(ce->proto) || ce->proto == PROTO_TCP_SERVER))
          {
-            msg(M_USAGE, "--mode server currently only supports "
-                "--proto udp or --proto tcp-server or proto tcp6-server");
+#define USAGE_VALID_SERVER_PROTOS "--mode server currently only supports " \
+            "--proto values of udp, tcp-server, tcp4-server, or tcp6-server"
+            msg(M_USAGE, USAGE_VALID_SERVER_PROTOS);

The location of #define USAGE_VALID_SERVER_PROTOS is a bit odd. Because it is also used outside of the if() scope where it is defined. I would prefer if this would be defined higher up, maybe around line 2306, where the whole MODE_SERVER option parsing starts. This makes it clearer it is may be used more places.

I've just looked briefly at these changes. And it looks reasonable. The ill-placed #define is the biggest issue for me in this patch. It would be good to get a second-opinion on the added notes though, that the man page info is correct. Otherwise this looks good.

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#8 lore raw

PATCH v2 3/3 doc/options: clean up documentation for --proto and related options

The family specific options were generally omitted.

---
 doc/man-sections/client-options.rst |  5 +++++
 doc/man-sections/link-options.rst   |  5 ++++-
 src/openvpn/options.c               | 17 +++++++++--------
 3 files changed, 18 insertions(+), 9 deletions(-)

v2: move #define around

doc/man-sections/client-options.rst +5 -0
index 73f1ea51..4c4a8707 100644
@@ -198,6 +198,11 @@ configuration.
   When iterating through connection profiles, only consider profiles using
   protocol ``p`` (:code:`tcp` \| :code:`udp`).
 
+  Note that this specifically only affects the protocol, not the inet
+  family (i.e. IPv4 vs. IPv6). While the option actually accepts
+  values like :code:`udp6`, there is no difference to specifying
+  :code:`udp`.
+
 --pull
   This option must be used on a client which is connecting to a
   multi-client server. It indicates to OpenVPN that it should accept
doc/man-sections/link-options.rst +4 -1
index cbc1e97b..0457727e 100644
@@ -276,7 +276,10 @@ the local and the remote host.
 
 --proto p
   Use protocol ``p`` for communicating with remote host. ``p`` can be
-  :code:`udp`, :code:`tcp-client`, or :code:`tcp-server`.
+  :code:`udp`, :code:`tcp-client`, or :code:`tcp-server`. You can also
+  limit OpenVPN to use only IPv4 or only IPv6 by specifying ``p`` as
+  :code:`udp4`, :code:`tcp4-client`, :code:`tcp4-server` or :code:`udp6`,
+  :code:`tcp6-client`, :code:`tcp6-server`, respectively.
 
   The default protocol is :code:`udp` when ``--proto`` is not specified.
 
src/openvpn/options.c +9 -8
index 1176a7c8..e7eba341 100644
@@ -126,9 +126,11 @@ static const char usage_message[] =
     "--remote-random-hostname : Add a random string to remote DNS name.\n"
     "--mode m        : Major mode, m = 'p2p' (default, point-to-point) or 'server'.\n"
     "--proto p       : Use protocol p for communicating with peer.\n"
-    "                  p = udp (default), tcp-server, or tcp-client\n"
+    "                  p = udp (default), tcp-server, tcp-client\n"
+    "                      udp4, tcp4-server, tcp4-client\n"
+    "                      udp6, tcp6-server, tcp6-client\n"
     "--proto-force p : only consider protocol p in list of connection profiles.\n"
-    "                  p = udp6, tcp6-server, or tcp6-client (ipv6)\n"
+    "                  p = udp or tcp\n"
     "--connect-retry n [m] : For client, number of seconds to wait between\n"
     "                  connection retries (default=%d). On repeated retries\n"
     "                  the wait time is exponentially increased to a maximum of m\n"
@@ -2298,6 +2300,8 @@ options_postprocess_verify_ce(const struct options *options,
      */
     if (options->mode == MODE_SERVER)
     {
+#define USAGE_VALID_SERVER_PROTOS "--mode server currently only supports " \
+      "--proto values of udp, tcp-server, tcp4-server, or tcp6-server"
 #ifdef TARGET_ANDROID
         msg(M_FATAL, "--mode server not supported on Android");
 #endif
@@ -2315,15 +2319,14 @@ options_postprocess_verify_ce(const struct options *options,
         }
         if (!(proto_is_udp(ce->proto) || ce->proto == PROTO_TCP_SERVER))
         {
-            msg(M_USAGE, "--mode server currently only supports "
-                "--proto udp or --proto tcp-server or proto tcp6-server");
+            msg(M_USAGE, USAGE_VALID_SERVER_PROTOS);
         }
 #if PORT_SHARE
         if ((options->port_share_host || options->port_share_port)
             && (ce->proto != PROTO_TCP_SERVER))
         {
             msg(M_USAGE, "--port-share only works in TCP server mode "
-                "(--proto tcp-server or tcp6-server)");
+                "(--proto values of tcp-server, tcp4-server, or tcp6-server)");
         }
 #endif
         if (!options->tls_server)
@@ -2367,9 +2370,7 @@ options_postprocess_verify_ce(const struct options *options,
         }
         if (!(proto_is_dgram(ce->proto) || ce->proto == PROTO_TCP_SERVER))
         {
-            msg(M_USAGE,
-                "--mode server currently only supports --proto udp or --proto "
-                "tcp-server or --proto tcp6-server");
+            msg(M_USAGE, USAGE_VALID_SERVER_PROTOS);
         }
         if (!proto_is_udp(ce->proto) && (options->cf_max || options->cf_per))
         {

--
2.30.2

#9 lore raw

Re: [Openvpn-devel] [PATCH 3/3 v2] doc/options: clean up documentation for --proto and related options

Quoted 16 lines · Frank Lichtenheld

The family specific options were generally omitted.

---
  doc/man-sections/client-options.rst |  5 +++++
  doc/man-sections/link-options.rst   |  5 ++++-
  src/openvpn/options.c               | 17 +++++++++--------
  3 files changed, 18 insertions(+), 9 deletions(-)

v2: move #define around

doc/man-sections/client-options.rst +0 -0
index 73f1ea51..4c4a8707 100644

doc/man-sections/client-options.rst configuration. · line 205

Quoted 8 lines
doc/man-sections/client-options.rst +5 -0
@@ -198,6 +198,11 @@ configuration.
    When iterating through connection profiles, only consider profiles using
    protocol ``p`` (:code:`tcp` \| :code:`udp`).
 
+  Note that this specifically only affects the protocol, not the inet
+  family (i.e. IPv4 vs. IPv6). While the option actually accepts
+  values like :code:`udp6`, there is no difference to specifying
+  :code:`udp`.
+

I'm sorry I didn't catch this at the previous round; somehow I mixed it with the --proto change below. The section above is related to --proto-force.

May I suggest we clarify this text a bit more? As we have multiple definitions of protocol - whether it is the IP layer protocol or the TCP/UDP protocol on top of the IP layer. And in --proto we do indeed mix them up into a single option.

Perhaps something like the suggestion below might be somewhat clearer?

Note that this specifically only affects the TCP/IP transport layer protocol (UDP/TCP), not the TCP/IP network layers (IPv4/IPv6). In practice it means it will only consider connection profiles using either TCP or UDP. This does not affect whether IPv4 or IPv6 is used as IP protocols. In this context, :code:udp, :code:udp4 and :code:udp6 are all considered the same. And similar with :code:tcp, :code:tcp4 and :code:tcp6

The rest of the changes looks good now, and the relocation of the #define is better as well.

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#10 lore raw

Re: [Openvpn-devel] [PATCH 3/3 v2] doc/options: clean up documentation for --proto and related options

Quoted 29 lines

David Sommerseth <[email protected]...> hat am 11.02.2022 21:39 geschrieben:

Quoted 24 lines · Frank Lichtenheld

The family specific options were generally omitted.

---
  doc/man-sections/client-options.rst |  5 +++++
  doc/man-sections/link-options.rst   |  5 ++++-
  src/openvpn/options.c               | 17 +++++++++--------
  3 files changed, 18 insertions(+), 9 deletions(-)

v2: move #define around

doc/man-sections/client-options.rst +5 -0
index 73f1ea51..4c4a8707 100644
@@ -198,6 +198,11 @@ configuration.
    When iterating through connection profiles, only consider profiles using
    protocol ``p`` (:code:`tcp` \| :code:`udp`).
 
+  Note that this specifically only affects the protocol, not the inet
+  family (i.e. IPv4 vs. IPv6). While the option actually accepts
+  values like :code:`udp6`, there is no difference to specifying
+  :code:`udp`.
+

[...]

Quoted 10 lines

Perhaps something like the suggestion below might be somewhat clearer?

Note that this specifically only affects the TCP/IP transport layer protocol (UDP/TCP), not the TCP/IP network layers (IPv4/IPv6). In practice it means it will only consider connection profiles using either TCP or UDP. This does not affect whether IPv4 or IPv6 is used as IP protocols. In this context, :code:udp, :code:udp4 and :code:udp6 are all considered the same. And similar with :code:tcp, :code:tcp4 and :code:tcp6

Thanks, I hate it ;)

Seriously though, I find this too clunky. Yes, TCP/IP is technically the correct name, but isn't that even more confusing?

Maybe we can find a compromise:

Note that this specifically only filters by the transport layer protocol, i.e. UDP or TCP. This does not affect whether IPv4 or IPv6 is used as IP protocol.

For implementation reasons the option accepts the :code:4 and :code:6 suffixes when specifying the protocol
(i.e. :code:udp4 / :code:udp6 / :code:tcp4 / :code:tcp6). However, these behave the same as without the suffix and should be avoided to prevent confusion.

Regards,
--
Frank Lichtenheld

#11 lore raw

Re: [Openvpn-devel] [PATCH 3/3 v2] doc/options: clean up documentation for --proto and related options

Quoted 52 lines · Frank Lichtenheld
Quoted 29 lines

David Sommerseth <[email protected]...> hat am 11.02.2022 21:39 geschrieben:

Quoted 24 lines · Frank Lichtenheld

The family specific options were generally omitted.

---
   doc/man-sections/client-options.rst |  5 +++++
   doc/man-sections/link-options.rst   |  5 ++++-
   src/openvpn/options.c               | 17 +++++++++--------
   3 files changed, 18 insertions(+), 9 deletions(-)

v2: move #define around

doc/man-sections/client-options.rst +5 -0
index 73f1ea51..4c4a8707 100644
@@ -198,6 +198,11 @@ configuration.
     When iterating through connection profiles, only consider profiles using
     protocol ``p`` (:code:`tcp` \| :code:`udp`).
 
+  Note that this specifically only affects the protocol, not the inet
+  family (i.e. IPv4 vs. IPv6). While the option actually accepts
+  values like :code:`udp6`, there is no difference to specifying
+  :code:`udp`.
+

[...]

Quoted 10 lines

Perhaps something like the suggestion below might be somewhat clearer?

Note that this specifically only affects the TCP/IP transport layer protocol (UDP/TCP), not the TCP/IP network layers (IPv4/IPv6). In practice it means it will only consider connection profiles using either TCP or UDP. This does not affect whether IPv4 or IPv6 is used as IP protocols. In this context, :code:udp, :code:udp4 and :code:udp6 are all considered the same. And similar with :code:tcp, :code:tcp4 and :code:tcp6

Thanks, I hate it ;)

Seriously though, I find this too clunky. Yes, TCP/IP is technically the correct name, but isn't that even more confusing?

Maybe we can find a compromise:

Note that this specifically only filters by the transport layer protocol, i.e. UDP or TCP. This does not affect whether IPv4 or IPv6 is used as IP protocol.

Quoted 5 lines

For implementation reasons the option accepts the :code:4 and :code:6 suffixes when specifying the protocol
(i.e. :code:udp4 / :code:udp6 / :code:tcp4 / :code:tcp6). However, these behave the same as without the suffix and should be avoided to prevent confusion.

Thanks, that's better! Let's roll with that.

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#12 lore raw

PATCH v3 3/3 doc/options: clean up documentation for --proto and related options

In reply to Frank Lichtenheld

The family specific options were generally omitted.

---
 doc/man-sections/client-options.rst | 10 ++++++++++
 doc/man-sections/link-options.rst   |  5 ++++-
 src/openvpn/options.c               | 17 +++++++++--------
 3 files changed, 23 insertions(+), 9 deletions(-)

v2: move #define around
v3: reword --proto-force with input from David

doc/man-sections/client-options.rst +10 -0
index c7cec176..e53b5262 100644
@@ -199,6 +199,16 @@ configuration.
   When iterating through connection profiles, only consider profiles using
   protocol ``p`` (:code:`tcp` \| :code:`udp`).
 
+  Note that this specifically only filters by the transport layer
+  protocol, i.e. UDP or TCP. This does not affect whether IPv4 or
+  IPv6 is used as IP protocol.
+
+  For implementation reasons the option accepts the :code:`4` and :code:`6`
+  suffixes when specifying the protocol
+  (i.e. :code:`udp4` / :code:`udp6` / :code:`tcp4` / :code:`tcp6`).
+  However, these behave the same as without the suffix and should be avoided
+  to prevent confusion.
+
 --pull
   This option must be used on a client which is connecting to a
   multi-client server. It indicates to OpenVPN that it should accept
doc/man-sections/link-options.rst +4 -1
index 52df843d..782aa738 100644
@@ -289,7 +289,10 @@ the local and the remote host.
 
 --proto p
   Use protocol ``p`` for communicating with remote host. ``p`` can be
-  :code:`udp`, :code:`tcp-client`, or :code:`tcp-server`.
+  :code:`udp`, :code:`tcp-client`, or :code:`tcp-server`. You can also
+  limit OpenVPN to use only IPv4 or only IPv6 by specifying ``p`` as
+  :code:`udp4`, :code:`tcp4-client`, :code:`tcp4-server` or :code:`udp6`,
+  :code:`tcp6-client`, :code:`tcp6-server`, respectively.
 
   The default protocol is :code:`udp` when ``--proto`` is not specified.
 
src/openvpn/options.c +9 -8
index 92aeba3d..7ce0ba61 100644
@@ -126,9 +126,11 @@ static const char usage_message[] =
     "--remote-random-hostname : Add a random string to remote DNS name.\n"
     "--mode m        : Major mode, m = 'p2p' (default, point-to-point) or 'server'.\n"
     "--proto p       : Use protocol p for communicating with peer.\n"
-    "                  p = udp (default), tcp-server, or tcp-client\n"
+    "                  p = udp (default), tcp-server, tcp-client\n"
+    "                      udp4, tcp4-server, tcp4-client\n"
+    "                      udp6, tcp6-server, tcp6-client\n"
     "--proto-force p : only consider protocol p in list of connection profiles.\n"
-    "                  p = udp6, tcp6-server, or tcp6-client (ipv6)\n"
+    "                  p = udp or tcp\n"
     "--connect-retry n [m] : For client, number of seconds to wait between\n"
     "                  connection retries (default=%d). On repeated retries\n"
     "                  the wait time is exponentially increased to a maximum of m\n"
@@ -2300,6 +2302,8 @@ options_postprocess_verify_ce(const struct options *options,
      */
     if (options->mode == MODE_SERVER)
     {
+#define USAGE_VALID_SERVER_PROTOS "--mode server currently only supports " \
+      "--proto values of udp, tcp-server, tcp4-server, or tcp6-server"
 #ifdef TARGET_ANDROID
         msg(M_FATAL, "--mode server not supported on Android");
 #endif
@@ -2317,15 +2321,14 @@ options_postprocess_verify_ce(const struct options *options,
         }
         if (!(proto_is_udp(ce->proto) || ce->proto == PROTO_TCP_SERVER))
         {
-            msg(M_USAGE, "--mode server currently only supports "
-                "--proto udp or --proto tcp-server or proto tcp6-server");
+            msg(M_USAGE, USAGE_VALID_SERVER_PROTOS);
         }
 #if PORT_SHARE
         if ((options->port_share_host || options->port_share_port)
             && (ce->proto != PROTO_TCP_SERVER))
         {
             msg(M_USAGE, "--port-share only works in TCP server mode "
-                "(--proto tcp-server or tcp6-server)");
+                "(--proto values of tcp-server, tcp4-server, or tcp6-server)");
         }
 #endif
         if (!options->tls_server)
@@ -2369,9 +2372,7 @@ options_postprocess_verify_ce(const struct options *options,
         }
         if (!(proto_is_dgram(ce->proto) || ce->proto == PROTO_TCP_SERVER))
         {
-            msg(M_USAGE,
-                "--mode server currently only supports --proto udp or --proto "
-                "tcp-server or --proto tcp6-server");
+            msg(M_USAGE, USAGE_VALID_SERVER_PROTOS);
         }
         if (!proto_is_udp(ce->proto) && (options->cf_max || options->cf_per))
         {
Signature · 1 line
2.30.2
Acked-by on v3 3/3
#13 lore raw

Re: [Openvpn-devel] [PATCH 3/3 v3] doc/options: clean up documentation for --proto and related options

Quoted 4 lines · Frank Lichtenheld

The family specific options were generally omitted.

Quoted 9 lines
---
  doc/man-sections/client-options.rst | 10 ++++++++++
  doc/man-sections/link-options.rst   |  5 ++++-
  src/openvpn/options.c               | 17 +++++++++--------
  3 files changed, 23 insertions(+), 9 deletions(-)

v2: move #define around
v3: reword --proto-force with input from David

This looks good. Only glared at changes, and they looks good to me.

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#14 lore raw

[Openvpn-devel] [PATCH applied] Re: doc/options: clean up documentation for --proto and related options

In reply to Frank Lichtenheld

Your patch has been applied to the master and release/2.5 branch (applied without resistance, documentation improvements are good).

commit ba9a07a69db3ddb63fceac05b92a000d9b1c805e (master) commit 1e177d87f968be14f14b293273039c522ed1a75f (release/2.5)

Author: Frank Lichtenheld
Date:   Tue Feb 15 15:54:25 2022 +0100
     doc/options: clean up documentation for --proto and related options

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: David Sommerseth <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg23798.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

Acked-by on v1 1/3
#15 lore raw
In reply to Frank Lichtenheld
Quoted 9 lines · Frank Lichtenheld

For now the dependencies are statically defined, which should be fine and is still a much better solution than to have no dependencies.

---
  doc/Makefile.am | 21 +++++++++++++++------
  1 file changed, 15 insertions(+), 6 deletions(-)

Done code review and lightly tested it, where it does what it is intended to do. This change makes a lot of sense as well.

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#16 lore raw
In reply to Frank Lichtenheld

Your patch has been applied to the master branch.

I think it makes sense for release/2.5 as well, but the Makefile looks a bit different there (no examples-fingerprint.rst at least, did not look into it more in detail).

commit 529cc6a52fc45a1a67abb5c91819ba4fb2f631e3

Author: Frank Lichtenheld
Date:   Thu Dec 9 18:11:36 2021 +0100
     doc/Makefile: rebuild rst docs if input files change

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: David Sommerseth <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg23369.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering