From: "d12fk (Code Review)" Date: Tue, 11 Nov 2025 01:12:04 +0000 References: Reply-To: heiko@...515..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="u5AAdcQb/tg="; charset=UTF-8 Subject: [Openvpn-devel] [XS] 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: plaisthos , flichtenheld Cc: openvpn-devel --u5AAdcQb/tg= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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/+/1363?usp=3Demail to review the following change. 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 --- M src/openvpnserv/interactive.c 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/63/1363/1 diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 0712986..46274ce 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -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); } -- 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: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ia74a931c703d594bdf8ccada9b783b94608de278 Gerrit-Change-Number: 1363 Gerrit-PatchSet: 1 Gerrit-Owner: d12fk Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld --u5AAdcQb/tg= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: flichtenheld, plaisthos.

d12fk would like plaisthos and flichtenheld to review t= his change.

V= iew Change

iservice: use saved iface index to restore =
metric

When adding block rules, the interface metric of the VPN adap= ter is
temporarily modified so that an old version of Windows 10 would p= ick
it up first when looking up stuff via DNS. These metrics are reverte= d 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 w= rong interface.

Reported-by: stephan@...2953...
Change-Id: Ia74a9= 31c703d594bdf8ccada9b783b94608de278
Signed-off-by: Heiko Hund <heiko@= ...2662...>
---
M src/openvpnserv/interactive.c
1 file changed,= 2 insertions(+), 2 deletions(-)

git pull ssh:=
//gerrit.openvpn.net:29418/openvpn refs/changes/63/1363/1
diff --=
git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c<=
br>index 0712986..46274ce 100644
--- a/src/openvpnser= v/interactive.c
+++ b/src/openvpnserv/interactive.c<= br>@@ -762,11 +762,11 @@
err =3D delete_wfp_= block_filters(block_data->engine);
if (block_da= ta->metric_v4 >=3D 0)
{
- set_interface_metric(msg->i= face.index, AF_INET, block_data->metric_v4);
+ set_interface_metric(block_data->= ;index, AF_INET, block_data->metric_v4);
}
if (block_data->metric_v6 >=3D 0)
{

- = set_interface_metric(msg->iface.index, AF_INET6, block_data->metri= c_v6);
+ s= et_interface_metric(block_data->index, AF_INET6, block_data->metric_v= 6);
}
free(block_data);
}

To view, visit change 136= 3. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia74a931c703d594bdf8ccada9b7= 83b94608de278
Gerrit-Change-Number: 1363
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <heiko@...515...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
= --u5AAdcQb/tg=--