Change in openvpn[master]: FreeBSD DCO: repair --inactive
A message that is not in the archive (sent off-list or not yet received): gerrit.1762430608000.I48c877843d24144450af1282b7524bb3ba18232e@...2715...
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1351?usp=email
to review the following change.
Change subject: FreeBSD DCO: repair --inactive
......................................................................
FreeBSD DCO: repair --inactive
--inactive on DCO requires a working DCO counters query function (dco_get_peer_stats(), implemented in the previous commit) and that the DCO implementation in use fills the "tun_{read,write}_bytes" fields for the peer context.
FreeBSD DCO only fills the "dco_{read,write}_bytes" counters - which is something we can't fix in OpenVPN, this needs kernel enhancements.
So, to make the feature (mostly) work, check the other set of counters on FreeBSD. Caveat: this will count encryption overhead and keepalives, so it will still not work for --inactive <n> without a byte count, or for byte counts with too tight thresholds.
Adding the #ifdef to forward.c was considered the least bad alternative.
Github: OpenVPN/openvpn#898
---
M doc/man-sections/client-options.rst
M src/openvpn/forward.c
2 files changed, 12 insertions(+), 0 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/51/1351/1
doc/man-sections/client-options.rst +5 -0
@@ -274,6 +274,11 @@ counted as traffic, as they are used internally by OpenVPN and are not an indication of actual user activity. + NOTE: on FreeBSD with DCO, due to platform limits, the previous paragraph + is not correct. In that case, encapsulation overhead and keepalives are + counted, so using this feature needs a sufficiently-high `bytes` value to + take these extra numbers into account. + --proto-force p When iterating through connection profiles, only consider profiles using protocol ``p`` (:code:`tcp` \| :code:`udp`).
src/openvpn/forward.c +7 -0
@@ -476,13 +476,20 @@* and the logic needs to change - we permit the event to trigger and check * kernel DCO counters here, returning and rearming the timer if there was * sufficient traffic. +* +* NOTE: FreeBSD DCO does not supply "tun bytes" (= decrypted payload) today, +* so "dco bytes" (encrypted bytes, including keepalives) is used instead */ static void check_inactivity_timeout (struct context *c) {if (dco_enabled (&c->options) &&dco_get_peer_stats (c, true) ==0 ) { +#ifdef TARGET_FREEBSD +int64_t tot_bytes = c->c2.dco_read_bytes + c->c2.dco_write_bytes; +#else int64_t tot_bytes = c->c2.tun_read_bytes + c->c2.tun_write_bytes; +#endif int64_t new_bytes = tot_bytes - c->c2.inactivity_bytes;if (new_bytes > c->options.inactivity_minimum_bytes)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1351?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I48c877843d24144450af1282b7524bb3ba18232e
Gerrit-Change-Number: 1351
Gerrit-PatchSet: 1
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: cron2, plaisthos.
flichtenheld has posted comments on this change by cron2. ( http://gerrit.openvpn.net/c/openvpn/+/1351?usp=email )
Change subject: FreeBSD DCO: repair --inactive
......................................................................
Patch Set 2: Code-Review-1
(1 comment)
File doc/man-sections/client-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/1351/comment/e40e0d29_5f8564ab?usp=email :
PS2, Line 279: counted, so using this feature needs a sufficiently-high bytes value to
Wrong rst syntax
```suggestion counted, so using this feature needs a sufficiently-high ``bytes`` value to ```
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1351?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I48c877843d24144450af1282b7524bb3ba18232e
Gerrit-Change-Number: 1351
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Fri, 07 Nov 2025 13:34:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: cron2, flichtenheld, plaisthos.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1351?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld
Change subject: FreeBSD DCO: repair --inactive
......................................................................
FreeBSD DCO: repair --inactive
--inactive on DCO requires a working DCO counters query function (dco_get_peer_stats(), implemented in the previous commit) and that the DCO implementation in use fills the "tun_{read,write}_bytes" fields for the peer context.
FreeBSD DCO only fills the "dco_{read,write}_bytes" counters - which is something we can't fix in OpenVPN, this needs kernel enhancements.
So, to make the feature (mostly) work, check the other set of counters on FreeBSD. Caveat: this will count encryption overhead and keepalives, so it will still not work for --inactive <n> without a byte count, or for byte counts with too tight thresholds.
Adding the #ifdef to forward.c was considered the least bad alternative.
v2: fix rst syntax for manpage addition
Github: OpenVPN/openvpn#898
---
M doc/man-sections/client-options.rst
M src/openvpn/forward.c
2 files changed, 12 insertions(+), 0 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/51/1351/3
doc/man-sections/client-options.rst +5 -0
@@ -274,6 +274,11 @@ counted as traffic, as they are used internally by OpenVPN and are not an indication of actual user activity. + NOTE: on FreeBSD with DCO, due to platform limits, the previous paragraph + is not correct. In that case, encapsulation overhead and keepalives are + counted, so using this feature needs a sufficiently-high ``bytes`` value to + take these extra numbers into account. + --proto-force p When iterating through connection profiles, only consider profiles using protocol ``p`` (:code:`tcp` \| :code:`udp`).
src/openvpn/forward.c +7 -0
@@ -476,13 +476,20 @@* and the logic needs to change - we permit the event to trigger and check * kernel DCO counters here, returning and rearming the timer if there was * sufficient traffic. +* +* NOTE: FreeBSD DCO does not supply "tun bytes" (= decrypted payload) today, +* so "dco bytes" (encrypted bytes, including keepalives) is used instead */ static void check_inactivity_timeout (struct context *c) {if (dco_enabled (&c->options) &&dco_get_peer_stats (c, true) ==0 ) { +#ifdef TARGET_FREEBSD +int64_t tot_bytes = c->c2.dco_read_bytes + c->c2.dco_write_bytes; +#else int64_t tot_bytes = c->c2.tun_read_bytes + c->c2.tun_write_bytes; +#endif int64_t new_bytes = tot_bytes - c->c2.inactivity_bytes;if (new_bytes > c->options.inactivity_minimum_bytes)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1351?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I48c877843d24144450af1282b7524bb3ba18232e
Gerrit-Change-Number: 1351
Gerrit-PatchSet: 3
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change by cron2. ( http://gerrit.openvpn.net/c/openvpn/+/1351?usp=email )
Change subject: FreeBSD DCO: repair --inactive
......................................................................
Patch Set 3:
(1 comment)
File doc/man-sections/client-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/1351/comment/19987177_2318aa2c?usp=email :
PS2, Line 279: counted, so using this feature needs a sufficiently-high bytes value to
Quoted 1 line
Wrong rst syntax […]
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1351?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I48c877843d24144450af1282b7524bb3ba18232e
Gerrit-Change-Number: 1351
Gerrit-PatchSet: 3
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Fri, 07 Nov 2025 13:50:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Attention is currently required from: cron2, flichtenheld, plaisthos.
ralf_lici has posted comments on this change by cron2. ( http://gerrit.openvpn.net/c/openvpn/+/1351?usp=email )
Change subject: FreeBSD DCO: repair --inactive
......................................................................
Patch Set 4: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1351?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I48c877843d24144450af1282b7524bb3ba18232e
Gerrit-Change-Number: 1351
Gerrit-PatchSet: 4
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: ralf_lici <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Sun, 09 Nov 2025 08:02:09 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v4 1/1 FreeBSD DCO: repair --inactive
In reply to a message not in the archive--inactive on DCO requires a working DCO counters query function (dco_get_peer_stats(), implemented in the previous commit) and that the DCO implementation in use fills the "tun_{read,write}_bytes" fields for the peer context.
FreeBSD DCO only fills the "dco_{read,write}_bytes" counters - which is something we can't fix in OpenVPN, this needs kernel enhancements.
So, to make the feature (mostly) work, check the other set of counters on FreeBSD. Caveat: this will count encryption overhead and keepalives, so it will still not work for --inactive <n> without a byte count, or for byte counts with too tight thresholds.
Adding the #ifdef to forward.c was considered the least bad alternative.
v2: fix rst syntax for manpage addition
Github: OpenVPN/openvpn#898
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1351
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1351
This mail reflects revision 4 of this Change.
Acked-by according to Gerrit (reflected above):
Ralf Lici <[email protected]...>
doc/man-sections/client-options.rst +5 -0
@@ -274,6 +274,11 @@ counted as traffic, as they are used internally by OpenVPN and are not an indication of actual user activity. + NOTE: on FreeBSD with DCO, due to platform limits, the previous paragraph + is not correct. In that case, encapsulation overhead and keepalives are + counted, so using this feature needs a sufficiently-high ``bytes`` value to + take these extra numbers into account. + --proto-force p When iterating through connection profiles, only consider profiles using protocol ``p`` (:code:`tcp` \| :code:`udp`).
src/openvpn/forward.c +7 -0
@@ -476,13 +476,20 @@* and the logic needs to change - we permit the event to trigger and check * kernel DCO counters here, returning and rearming the timer if there was * sufficient traffic. +* +* NOTE: FreeBSD DCO does not supply "tun bytes" (= decrypted payload) today, +* so "dco bytes" (encrypted bytes, including keepalives) is used instead */ static void check_inactivity_timeout (struct context *c) {if (dco_enabled (&c->options) &&dco_get_peer_stats (c, true) ==0 ) { +#ifdef TARGET_FREEBSD +int64_t tot_bytes = c->c2.dco_read_bytes + c->c2.dco_write_bytes; +#else int64_t tot_bytes = c->c2.tun_read_bytes + c->c2.tun_write_bytes; +#endif int64_t new_bytes = tot_bytes - c->c2.inactivity_bytes;if (new_bytes > c->options.inactivity_minimum_bytes)
[Openvpn-devel] [PATCH applied] Re: FreeBSD DCO: repair --inactive
Re-tested on FreeBSD 14.3 + DCO, still works (and breaks nothing else, says buildbot).
Your patch has been applied to the master branch.
commit 7fe5cc03abf2e11bb108dba3117923934dc16150
Author: Gert Doering Date: Sun Nov 9 09:42:31 2025 +0100
FreeBSD DCO: repair --inactive
Signed-off-by: Gert Doering <[email protected]...>
Acked-by: Ralf Lici <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1351
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34274.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Hello flichtenheld, plaisthos, ralf_lici,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1351?usp=email
to look at the new patch set (#5).
The following approvals got outdated and were removed:
Code-Review+2 by ralf_lici
Change subject: FreeBSD DCO: repair --inactive
......................................................................
FreeBSD DCO: repair --inactive
--inactive on DCO requires a working DCO counters query function (dco_get_peer_stats(), implemented in the previous commit) and that the DCO implementation in use fills the "tun_{read,write}_bytes" fields for the peer context.
FreeBSD DCO only fills the "dco_{read,write}_bytes" counters - which is something we can't fix in OpenVPN, this needs kernel enhancements.
So, to make the feature (mostly) work, check the other set of counters on FreeBSD. Caveat: this will count encryption overhead and keepalives, so it will still not work for --inactive <n> without a byte count, or for byte counts with too tight thresholds.
Adding the #ifdef to forward.c was considered the least bad alternative.
v2: fix rst syntax for manpage addition
Github: OpenVPN/openvpn#898
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1351
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34274.html
---
M doc/man-sections/client-options.rst
M src/openvpn/forward.c
2 files changed, 12 insertions(+), 0 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/51/1351/5
doc/man-sections/client-options.rst +5 -0
@@ -274,6 +274,11 @@ counted as traffic, as they are used internally by OpenVPN and are not an indication of actual user activity. + NOTE: on FreeBSD with DCO, due to platform limits, the previous paragraph + is not correct. In that case, encapsulation overhead and keepalives are + counted, so using this feature needs a sufficiently-high ``bytes`` value to + take these extra numbers into account. + --proto-force p When iterating through connection profiles, only consider profiles using protocol ``p`` (:code:`tcp` \| :code:`udp`).
src/openvpn/forward.c +7 -0
@@ -476,13 +476,20 @@* and the logic needs to change - we permit the event to trigger and check * kernel DCO counters here, returning and rearming the timer if there was * sufficient traffic. +* +* NOTE: FreeBSD DCO does not supply "tun bytes" (= decrypted payload) today, +* so "dco bytes" (encrypted bytes, including keepalives) is used instead */ static void check_inactivity_timeout (struct context *c) {if (dco_enabled (&c->options) &&dco_get_peer_stats (c, true) ==0 ) { +#ifdef TARGET_FREEBSD +int64_t tot_bytes = c->c2.dco_read_bytes + c->c2.dco_write_bytes; +#else int64_t tot_bytes = c->c2.tun_read_bytes + c->c2.tun_write_bytes; +#endif int64_t new_bytes = tot_bytes - c->c2.inactivity_bytes;if (new_bytes > c->options.inactivity_minimum_bytes)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1351?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I48c877843d24144450af1282b7524bb3ba18232e
Gerrit-Change-Number: 1351
Gerrit-PatchSet: 5
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: ralf_lici <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1351?usp=email )
Change subject: FreeBSD DCO: repair --inactive
......................................................................
FreeBSD DCO: repair --inactive
--inactive on DCO requires a working DCO counters query function (dco_get_peer_stats(), implemented in the previous commit) and that the DCO implementation in use fills the "tun_{read,write}_bytes" fields for the peer context.
FreeBSD DCO only fills the "dco_{read,write}_bytes" counters - which is something we can't fix in OpenVPN, this needs kernel enhancements.
So, to make the feature (mostly) work, check the other set of counters on FreeBSD. Caveat: this will count encryption overhead and keepalives, so it will still not work for --inactive <n> without a byte count, or for byte counts with too tight thresholds.
Adding the #ifdef to forward.c was considered the least bad alternative.
v2: fix rst syntax for manpage addition
Github: OpenVPN/openvpn#898
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1351
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34274.html
---
M doc/man-sections/client-options.rst
M src/openvpn/forward.c
2 files changed, 12 insertions(+), 0 deletions(-)
doc/man-sections/client-options.rst +5 -0
@@ -274,6 +274,11 @@ counted as traffic, as they are used internally by OpenVPN and are not an indication of actual user activity. + NOTE: on FreeBSD with DCO, due to platform limits, the previous paragraph + is not correct. In that case, encapsulation overhead and keepalives are + counted, so using this feature needs a sufficiently-high ``bytes`` value to + take these extra numbers into account. + --proto-force p When iterating through connection profiles, only consider profiles using protocol ``p`` (:code:`tcp` \| :code:`udp`).
src/openvpn/forward.c +7 -0
@@ -476,13 +476,20 @@* and the logic needs to change - we permit the event to trigger and check * kernel DCO counters here, returning and rearming the timer if there was * sufficient traffic. +* +* NOTE: FreeBSD DCO does not supply "tun bytes" (= decrypted payload) today, +* so "dco bytes" (encrypted bytes, including keepalives) is used instead */ static void check_inactivity_timeout (struct context *c) {if (dco_enabled (&c->options) &&dco_get_peer_stats (c, true) ==0 ) { +#ifdef TARGET_FREEBSD +int64_t tot_bytes = c->c2.dco_read_bytes + c->c2.dco_write_bytes; +#else int64_t tot_bytes = c->c2.tun_read_bytes + c->c2.tun_write_bytes; +#endif int64_t new_bytes = tot_bytes - c->c2.inactivity_bytes;if (new_bytes > c->options.inactivity_minimum_bytes)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1351?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I48c877843d24144450af1282b7524bb3ba18232e
Gerrit-Change-Number: 1351
Gerrit-PatchSet: 5
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: ralf_lici <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>