aboutsummaryrefslogtreecommitdiff
path: root/src/openvpn/networking_iproute2.c
diff options
context:
space:
mode:
authorArne Schwabe2020-04-16 13:39:30 +0200
committerGert Doering2020-04-19 12:33:38 +0200
commit9cf7b4925a54d93fbea1cadcf3dc0e11f3ce358f (patch)
tree6697aac029015cbc7e8b7f46412236ce0fa9fe62 /src/openvpn/networking_iproute2.c
parentcbde07f474ae9e92b329475767c4660dd35b4ee4 (diff)
downloadopenvpn-9cf7b4925a54d93fbea1cadcf3dc0e11f3ce358f.zip
openvpn-9cf7b4925a54d93fbea1cadcf3dc0e11f3ce358f.tar.gz
Another round of uncrustify code cleanup.
After the last big formatting patch a number of changes have been commited that do not conform with our style/uncrustify config. This has lead to the problem that running uncrustify on before sending PR some of the changes made by uncrustify need to be backed out again. To bring everything back to the agreed upon style, run uncrustify once more. Uncrustify version used: Uncrustify-0.70.1_f I double checked the result by running uncrustify (Uncrustify-0.69.0_f) from Ubuntu focal/20.04 which does not do any further changes and uncrustify 0.66.1_f from Ubuntu bionic/18.04 Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20200416113930.15192-3-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19750.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src/openvpn/networking_iproute2.c')
-rw-r--r--src/openvpn/networking_iproute2.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/openvpn/networking_iproute2.c b/src/openvpn/networking_iproute2.c
index 0f9e899..f3b9c61 100644
--- a/src/openvpn/networking_iproute2.c
+++ b/src/openvpn/networking_iproute2.c
@@ -43,7 +43,9 @@ net_ctx_init(struct context *c, openvpn_net_ctx_t *ctx)
{
ctx->es = NULL;
if (c)
+ {
ctx->es = c->es;
+ }
ctx->gc = gc_new();
return 0;
@@ -207,10 +209,14 @@ net_route_v4_add(openvpn_net_ctx_t *ctx, const in_addr_t *dst, int prefixlen,
argv_printf(&argv, "%s route add %s/%d", iproute_path, dst_str, prefixlen);
if (metric > 0)
+ {
argv_printf_cat(&argv, "metric %d", metric);
+ }
if (iface)
+ {
argv_printf_cat(&argv, "dev %s", iface);
+ }
if (gw)
{
@@ -246,7 +252,9 @@ net_route_v6_add(openvpn_net_ctx_t *ctx, const struct in6_addr *dst,
}
if (metric > 0)
+ {
argv_printf_cat(&argv, "metric %d", metric);
+ }
argv_msg(D_ROUTE, &argv);
openvpn_execve_check(&argv, ctx->es, 0, "ERROR: Linux route -6 add command failed");
@@ -267,7 +275,9 @@ net_route_v4_del(openvpn_net_ctx_t *ctx, const in_addr_t *dst, int prefixlen,
argv_printf(&argv, "%s route del %s/%d", iproute_path, dst_str, prefixlen);
if (metric > 0)
+ {
argv_printf_cat(&argv, "metric %d", metric);
+ }
argv_msg(D_ROUTE, &argv);
openvpn_execve_check(&argv, ctx->es, 0, "ERROR: Linux route delete command failed");
@@ -296,7 +306,9 @@ net_route_v6_del(openvpn_net_ctx_t *ctx, const struct in6_addr *dst,
}
if (metric > 0)
+ {
argv_printf_cat(&argv, "metric %d", metric);
+ }
argv_msg(D_ROUTE, &argv);
openvpn_execve_check(&argv, ctx->es, 0, "ERROR: Linux route -6 del command failed");
@@ -314,7 +326,9 @@ net_route_v4_best_gw(openvpn_net_ctx_t *ctx, const in_addr_t *dst,
FILE *fp = fopen("/proc/net/route", "r");
if (!fp)
+ {
return -1;
+ }
char line[256];
int count = 0;