From: "flichtenheld (Code Review)"
Date: Thu, 28 Nov 2024 12:28:19 +0000
In-Reply-To:
References:
Reply-To: frank@...2641..., arne-openvpn@...1227...,
openvpn-devel@lists.sourceforge.net
Message-ID: <05a2fccbe03b4351c676b556feb8a8fb8eb57af5-EmailReplacePatchSet-HTML@...2715...>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="ucLNehebRng="; charset=UTF-8
Subject: [Openvpn-devel] [S] Change in openvpn[master]: Fix some formatting
related to if/else and macros
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
To: plaisthos
Cc: openvpn-devel
--ucLNehebRng=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/821?usp=3Demail
to look at the new patch set (#2).
Change subject: Fix some formatting related to if/else and macros
......................................................................
Fix some formatting related to if/else and macros
Make it clearer where the blocks are.
Change-Id: If645c3faf149bac82167a91be13541b30a1b8d6a
Signed-off-by: Frank Lichtenheld
---
M src/openvpn/helper.c
M src/openvpn/manage.c
M src/openvpn/openvpn.c
M src/openvpn/route.c
M src/openvpn/socket.c
M src/openvpn/ssl.c
M src/openvpn/tun.c
7 files changed, 29 insertions(+), 16 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/21/821/2
diff --git a/src/openvpn/helper.c b/src/openvpn/helper.c
index bbdbc04..9e28e87 100644
--- a/src/openvpn/helper.c
+++ b/src/openvpn/helper.c
@@ -500,7 +500,7 @@
push_option(o, print_opt_route_gateway_dhcp(&o->gc), M_USAGE);
}
}
- else
+
/*
* HELPER DIRECTIVE:
*
@@ -511,7 +511,7 @@
* pull
* tls-client
*/
- if (o->client)
+ else if (o->client)
{
o->pull =3D true;
o->tls_client =3D true;
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index f296788..e79a118 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -1822,7 +1822,9 @@
}
else
#endif
- man->connection.sd_cli =3D socket_do_accept(man->connection.sd_top, &a=
ct, false);
+ {
+ man->connection.sd_cli =3D socket_do_accept(man->connection.sd_top=
, &act, false);
+ }
if (socket_defined(man->connection.sd_cli))
{
@@ -1971,9 +1973,11 @@
}
else
#endif
- msg(D_LINK_ERRORS | M_ERRNO,
- "MANAGEMENT: connect to %s failed",
- print_sockaddr(man->settings.local->ai_addr, &gc));
+ {
+ msg(D_LINK_ERRORS | M_ERRNO,
+ "MANAGEMENT: connect to %s failed",
+ print_sockaddr(man->settings.local->ai_addr, &gc));
+ }
throw_signal_soft(SIGTERM, "management-connect-failed");
goto done;
}
diff --git a/src/openvpn/openvpn.c b/src/openvpn/openvpn.c
index 1db5422..c52540c 100644
--- a/src/openvpn/openvpn.c
+++ b/src/openvpn/openvpn.c
@@ -274,10 +274,10 @@
/* Query passwords before becoming a daemon if we don't use the
* management interface to get them. */
-#ifdef ENABLE_MANAGEMENT
if (!(c.options.management_flags & MF_QUERY_PASSWORDS))
-#endif
- init_query_passwords(&c);
+ {
+ init_query_passwords(&c);
+ }
/* become a daemon if --daemon */
if (c.first_time)
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index 2e584c7..3d33844 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -3861,8 +3861,9 @@
}
else
#endif
-
- rgi6->gateway.addr_ipv6 =3D gw;
+ {
+ rgi6->gateway.addr_ipv6 =3D gw;
+ }
rgi6->flags |=3D RGI_ADDR_DEFINED;
if (ifp)
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index efd742c..01874fe 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -3389,8 +3389,10 @@
}
else
#endif
- buf->len =3D recvfrom(sock->sd, BPTR(buf), buf_forward_capacity(buf), =
0,
- &from->dest.addr.sa, &fromlen);
+ {
+ buf->len =3D recvfrom(sock->sd, BPTR(buf), buf_forward_capacity(bu=
f), 0,
+ &from->dest.addr.sa, &fromlen);
+ }
/* FIXME: won't do anything when sock->info.af =3D=3D AF_UNSPEC */
if (buf->len >=3D 0 && expectedlen && fromlen !=3D expectedlen)
{
diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index 1f8eb1e..33c22b4 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -327,7 +327,9 @@
}
else
#endif /* ifdef ENABLE_MANAGEMENT */
- get_user_pass(&auth_user_pass, auth_file, UP_TYPE_AUTH, flags);
+ {
+ get_user_pass(&auth_user_pass, auth_file, UP_TYPE_AUTH, flags);
+ }
}
}
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 29d823d..f1aead2 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -3438,7 +3438,9 @@
}
else
#endif
- return write(tt->fd, buf, len);
+ {
+ return write(tt->fd, buf, len);
+ }
}
int
@@ -3451,7 +3453,9 @@
}
else
#endif
- return read(tt->fd, buf, len);
+ {
+ return read(tt->fd, buf, len);
+ }
}
=20
#elif defined(TARGET_AIX)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/821?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: If645c3faf149bac82167a91be13541b30a1b8d6a
Gerrit-Change-Number: 821
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld
Gerrit-Reviewer: plaisthos
Gerrit-CC: openvpn-devel
Gerrit-Attention: plaisthos
Gerrit-MessageType: newpatchset
--ucLNehebRng=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: plaisthos.
flichtenheld uploaded patch set #2 to this change.
<=
p>View Ch=
ange
Fix some formatting related to if/else and macros
Make it c=
learer where the blocks are.
Change-Id: If645c3faf149bac82167a91be13=
541b30a1b8d6a
Signed-off-by: Frank Lichtenheld <frank@...2641...><=
br>---
M src/openvpn/helper.c
M src/openvpn/manage.c
M src/openvpn=
/openvpn.c
M src/openvpn/route.c
M src/openvpn/socket.c
M src/open=
vpn/ssl.c
M src/openvpn/tun.c
7 files changed, 29 insertions(+), 16 d=
eletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/=
changes/21/821/2
diff --git a/src/openvpn/helper.c b/src/openvpn/he=
lper.c
index bbdbc04..9e28e87 100644
--- a/=
src/openvpn/helper.c
+++ b/src/openvpn/helper.c
<=
span>@@ -500,7 +500,7 @@
push_option(o, print_=
opt_route_gateway_dhcp(&o->gc), M_USAGE);
}=
}
- else
+ /*
* HELPER DIRECTIVE:
=
*
@@ -511,7 +511,7 @@
* pull
* tls-client
*/
- if (o->client)
+ else if (o->client)
<=
span> {
o->pull =3D true;
=
o->tls_client =3D true;
diff --git a/src/openvpn=
/manage.c b/src/openvpn/manage.c
index f296788..e79a118 100=
644
--- a/src/openvpn/manage.c
+++ b/src/op=
envpn/manage.c
@@ -1822,7 +1822,9 @@
}=
else
#endif
- man->connection.sd_cli =3D socket_do_ac=
cept(man->connection.sd_top, &act, false);
+ {
+ man->connection.sd_cli =3D socket_do_accept(man-=
>connection.sd_top, &act, false);
+ }
if (socke=
t_defined(man->connection.sd_cli))
{
@@ -1971,9 +1973,11 @@
}
=
else
#endif
- msg(D_LINK_ERRORS | M_ERRNO,
- "MANAGEMENT: connect to %s failed&=
quot;,
- pri=
nt_sockaddr(man->settings.local->ai_addr, &gc));
+ {
+ msg(D_LINK_ERRORS | M_ERRNO,
+ "MAN=
AGEMENT: connect to %s failed",
+ print_sockaddr(man->settings.local->=
ai_addr, &gc));
+=
}
throw_signal_soft(SIGTERM, "managem=
ent-connect-failed");
goto done;
}
diff --git a/src/openvpn/openvpn.c b/src/openvpn=
/openvpn.c
index 1db5422..c52540c 100644
--=
- a/src/openvpn/openvpn.c
+++ b/src/openvpn/openvpn.c
@@ -274,10 +274,10 @@
=
/* Query passwords before becoming a daemon if we don't use the
* management interface to get them. */-#ifdef ENABLE_MANAGEMENT
if (!(c.options.management_flags & MF_QUERY_PAS=
SWORDS))
-#endif=
- init_query_passw=
ords(&c);
+ =
{
+ =
init_query_passwords(&c);
+ }
=
/* become a daemon if --daemon */
if (c.first_=
time)
diff --git a/src/openvpn/route.c b/src/openvpn/route.=
c
index 2e584c7..3d33844 100644
--- a/src/o=
penvpn/route.c
+++ b/src/openvpn/route.c
@@=
-3861,8 +3861,9 @@
}
els=
e
#endif
-
- rgi6->=
gateway.addr_ipv6 =3D gw;
+ {
+ =
rgi6->gateway.addr_ipv6 =3D gw;
+ }
rgi6->flags |=
=3D RGI_ADDR_DEFINED;
if (ifp)=
span>
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index efd742c..01874fe 100644
--- a/src/openvp=
n/socket.c
+++ b/src/openvpn/socket.c
@@ -3=
389,8 +3389,10 @@
}
else #endif
- bu=
f->len =3D recvfrom(sock->sd, BPTR(buf), buf_forward_capacity(buf), 0=
,
- =
&from->dest.addr.sa, &fromlen);
+ {
+ buf->len =3D recvfrom(sock->sd, BPTR(buf), buf_f=
orward_capacity(buf), 0,
+ &from->dest.addr.sa, &fromlen);=
+ }
/* FIXME: won't do anything when sock->info.af =3D=3D AF_UNS=
PEC */
if (buf->len >=3D 0 && expectedle=
n && fromlen !=3D expectedlen)
{
diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index=
1f8eb1e..33c22b4 100644
--- a/src/openvpn/ssl.c
=
+++ b/src/openvpn/ssl.c
@@ -327,7 +327,9 @@
}
else
#endif /* =
ifdef ENABLE_MANAGEMENT */
- get_user_pass(&auth_user_pass, auth_file, UP_TYPE_AUTH, fl=
ags);
+ {
+ get_user_pas=
s(&auth_user_pass, auth_file, UP_TYPE_AUTH, flags);
+ }
}=
}
diff --git a/src/openvpn/tun=
.c b/src/openvpn/tun.c
index 29d823d..f1aead2 100644=
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c=
span>
@@ -3438,7 +3438,9 @@
}
else
#endif
- return write(tt->fd, buf, len);
+ {
+ return write(tt->fd, buf, len);
+ }
}<=
br>
int
@@ -3451,7 +3453,9 @@
}
else
#endif<=
br>- return read(tt->fd, bu=
f, len);
+ {
+ return read(tt-&g=
t;fd, buf, len);
+ =
}
}
#elif defined(TARG=
ET_AIX)
To view, visit change 821. To unsubs=
cribe, or for help writing mail filters, visit settings.
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If645c3faf149bac82167a91be13=
541b30a1b8d6a
Gerrit-Change-Number: 821
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...=
.>
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-MessageType: newpatchset
--ucLNehebRng=--