From: "ralf_lici (Code Review)" Date: Fri, 6 Sep 2024 15:44:48 +0000 References: Reply-To: ralf@...2726..., 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="HN8je6Met2Y="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: Minor fix on ifconfig parameter warning List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --HN8je6Met2Y= 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/+/736?usp=3Demail to review the following change. Change subject: Minor fix on ifconfig parameter warning ...................................................................... Minor fix on ifconfig parameter warning Handle the case of tun device and subnet topology in ifconfig_sanity_check(). Emit a warning if the second parameter of ifconfig doesn't look like a netmask. Change-Id: I2f55eabd0e950edc3fbcd08b257257cf9ed9c8d8 Signed-off-by: Ralf Lici --- M src/openvpn/tun.c 1 file changed, 5 insertions(+), 4 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/36/736/1 diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index ce3d882..875f558 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -510,20 +510,21 @@ { struct gc_arena gc =3D gc_new(); const bool looks_like_netmask =3D ((addr & 0xFF000000) =3D=3D 0xFF0000= 00); - if (tun) + if (tun && (topology =3D=3D TOP_NET30 || topology =3D=3D TOP_P2P)) { - if (looks_like_netmask && (topology =3D=3D TOP_NET30 || topology = =3D=3D TOP_P2P)) + if (looks_like_netmask) { msg(M_WARN, "WARNING: Since you are using --dev tun with a poi= nt-to-point topology, the second argument to --ifconfig must be an IP addre= ss. You are using something (%s) that looks more like a netmask. %s", print_in_addr_t(addr, 0, &gc), ifconfig_warn_how_to_silence); } } - else /* tap */ + else /* tap or tun with subnet topology */ { if (!looks_like_netmask) { - msg(M_WARN, "WARNING: Since you are using --dev tap, the secon= d argument to --ifconfig must be a netmask, for example something like 255.= 255.255.0. %s", + msg(M_WARN, "WARNING: Since you are using --dev %s, the second= argument to --ifconfig must be a netmask, for example something like 255.2= 55.255.0. %s", + tun ? "tun with a subnet topology" : "tap", ifconfig_warn_how_to_silence); } } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/736?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I2f55eabd0e950edc3fbcd08b257257cf9ed9c8d8 Gerrit-Change-Number: 736 Gerrit-PatchSet: 1 Gerrit-Owner: ralf_lici Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --HN8je6Met2Y= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

ralf_lici would like plaisthos and flichtenheld to review this change.

Vi= ew Change

Minor fix on ifconfig parameter warning

Handle the cas= e of tun device and subnet topology in
ifconfig_sanity_check(). Emit a w= arning if the second parameter of
ifconfig doesn't look like a netma= sk.

Change-Id: I2f55eabd0e950edc3fbcd08b257257cf9ed9c8d8
Signed-o= ff-by: Ralf Lici <ralf@...2726...>
---
M src/openvpn/tun.c
1= file changed, 5 insertions(+), 4 deletions(-)

git pull ssh://ger=
rit.openvpn.net:29418/openvpn refs/changes/36/736/1
diff --git a/sr=
c/openvpn/tun.c b/src/openvpn/tun.c
index ce3d882..875f558 = 100644
--- a/src/openvpn/tun.c
+++ b/src/op= envpn/tun.c
@@ -510,20 +510,21 @@
{=
struct gc_arena gc =3D gc_new();
const = bool looks_like_netmask =3D ((addr & 0xFF000000) =3D=3D 0xFF000000);
- if (tun)
<= span style=3D"color: hsl(120, 100%, 40%);">+ if (tun && (topolog= y =3D=3D TOP_NET30 || topology =3D=3D TOP_P2P))

{
- if (looks_like_net= mask && (topology =3D=3D TOP_NET30 || topology =3D=3D TOP_P2P))
+ if (looks_like_= netmask)
{
msg(M_WARN= , "WARNING: Since you are using --dev tun with a point-to-point topolo= gy, the second argument to --ifconfig must be an IP address. You are using= something (%s) that looks more like a netmask. %s",
= print_in_addr_t(addr, 0, &gc),
= ifconfig_warn_how_to_silence);
} }
- els= e /* tap */
+ else= /* tap or tun with subnet topology */
{
if (!looks_like_netmask)

{
<= span style=3D"color: hsl(0, 100%, 40%);">- msg(M_WARN, "WAR= NING: Since you are using --dev tap, the second argument to --ifconfig must= be a netmask, for example something like 255.255.255.0. %s",
+ msg(M_WARN, &quo= t;WARNING: Since you are using --dev %s, the second argument to --ifconfig = must be a netmask, for example something like 255.255.255.0. %s",
+ tun ? &q= uot;tun with a subnet topology" : "tap",
= ifconfig_warn_how_to_silence);
}
}

To view, visit change 736. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2f55eabd0e950edc3fbcd08b257= 257cf9ed9c8d8
Gerrit-Change-Number: 736
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <ralf@...2726...>= ;
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...>
Gerrit-MessageType: newchange
--HN8je6Met2Y=--