From: "cron2 (Code Review)" Date: Fri, 14 Nov 2025 21:01:12 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., heiko@...515..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: <28bef360666cde2f4ba93d83fefe3850cb198af6-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="mw0ue29Rn4s="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: iservice: use saved iface index to restore metric List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: d12fk , plaisthos , flichtenheld , stipa Cc: openvpn-devel --mw0ue29Rn4s= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#3) to the change originally created by= d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1363?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by stipa Change subject: iservice: use saved iface index to restore metric ...................................................................... iservice: use saved iface index to restore metric When adding block rules, the interface metric of the VPN adapter is temporarily modified so that an old version of Windows 10 would pick it up first when looking up stuff via DNS. These metrics are reverted to the old value when the block is removed. When reverting them, instead of using the stored interface index where the original values were read from, we were using the interface index passed to the service with the wfp block message. That index could theoretically be different from the one stored, which would result in the metric being set to the wrong interface. Reported-by: stephan@...2953... Change-Id: Ia74a931c703d594bdf8ccada9b783b94608de278 Signed-off-by: Heiko Hund Acked-by: Lev Stipakov Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1363 Message-Id: <20251112215106.14182-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34= 400.html Signed-off-by: Gert Doering --- M src/openvpnserv/interactive.c 1 file changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/63/1363/3 diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 0712986..33282c63 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -752,7 +752,7 @@ } static DWORD -DeleteWfpBlock(const wfp_block_message_t *msg, undo_lists_t *lists) +DeleteWfpBlock(undo_lists_t *lists) { DWORD err =3D 0; wfp_block_data_t *block_data =3D RemoveListItem(&(*lists)[wfp_block], = CmpAny, NULL); @@ -762,11 +762,11 @@ err =3D delete_wfp_block_filters(block_data->engine); if (block_data->metric_v4 >=3D 0) { - set_interface_metric(msg->iface.index, AF_INET, block_data->me= tric_v4); + set_interface_metric(block_data->index, AF_INET, block_data->m= etric_v4); } if (block_data->metric_v6 >=3D 0) { - set_interface_metric(msg->iface.index, AF_INET6, block_data->m= etric_v6); + set_interface_metric(block_data->index, AF_INET6, block_data->= metric_v6); } free(block_data); } @@ -829,7 +829,7 @@ if (err) { /* delete the filters, remove undo item and free interface= data */ - DeleteWfpBlock(msg, lists); + DeleteWfpBlock(lists); engine =3D NULL; } } @@ -854,7 +854,7 @@ } else { - return DeleteWfpBlock(msg, lists); + return DeleteWfpBlock(lists); } } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1363?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ia74a931c703d594bdf8ccada9b783b94608de278 Gerrit-Change-Number: 1363 Gerrit-PatchSet: 3 Gerrit-Owner: d12fk Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel --mw0ue29Rn4s= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #3 to the change originally created by d12fk.

<= p>View C= hange

The following approvals got outdated and were removed: Code-Review+2 by stipa

iservice: use saved iface index to =
restore metric

When adding block rules, the interface metric of the = VPN adapter is
temporarily modified so that an old version of Windows 10= would pick
it up first when looking up stuff via DNS. These metrics are= reverted to
the old value when the block is removed.

When revert= ing them, instead of using the stored interface index where
the original= values were read from, we were using the interface index
passed to the = service with the wfp block message. That index could
theoretically be di= fferent from the one stored, which would result in
the metric being set = to the wrong interface.

Reported-by: stephan@...2953...
Change-Id= : Ia74a931c703d594bdf8ccada9b783b94608de278
Signed-off-by: Heiko Hund &l= t;heiko@...2662...>
Acked-by: Lev Stipakov <lstipakov@...277...>= ;
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1363
Message-Id:= <20251112215106.14182-1-gert@...1296...>
URL: https://www.mail-ar= chive.com/openvpn-devel@lists.sourceforge.net/msg34400.html
Signed-off-b= y: Gert Doering <gert@...1296...>
---
M src/openvpnserv/interac= tive.c
1 file changed, 5 insertions(+), 5 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/63/1= 363/3
diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/=
interactive.c
index 0712986..33282c63 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv= /interactive.c
@@ -752,7 +752,7 @@
}

static DWORD
-DeleteWfpBlock(const wfp_block_message_t *msg, undo_li= sts_t *lists)
+Delete= WfpBlock(undo_lists_t *lists)
{
DWORD= err =3D 0;
wfp_block_data_t *block_data =3D RemoveLis= tItem(&(*lists)[wfp_block], CmpAny, NULL);
@@ -762,11 += 762,11 @@
err =3D delete_wfp_block_filters(block_d= ata->engine);
if (block_data->metric_v4 >= =3D 0)
{
- set_interface_metric(msg->iface.index, AF_INET, = block_data->metric_v4);
+ set_interface_metric(block_data->index, AF_INET, bloc= k_data->metric_v4);
}
= if (block_data->metric_v6 >=3D 0)
{- set_interface_metr= ic(msg->iface.index, AF_INET6, block_data->metric_v6);
+ set_interface_metric(b= lock_data->index, AF_INET6, block_data->metric_v6);

= }
free(block_data);
}=
@@ -829,7 +829,7 @@
if (err)<= /span>
{
/* delete t= he filters, remove undo item and free interface data */
- DeleteWfpBlock(msg, lists= );
+ D= eleteWfpBlock(lists);
engine =3D NULL;
}
}
@@ -= 854,7 +854,7 @@
}
else
= {
- r= eturn DeleteWfpBlock(msg, lists);
+ return DeleteWfpBlock(lists);
}<= /span>
}


To= view, visit change 1363. To unsubscribe, or for help writing mail filters, vis= it settings.=

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia74a931c703d594bdf8ccada9b7= 83b94608de278
Gerrit-Change-Number: 1363
Gerrit-PatchSet: 3
Gerrit-Owner: d12fk <heiko@...515...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-Reviewer: stipa <lstipakov@...277...= >
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --mw0ue29Rn4s=--