Attention is currently required from: Antonio Quartulli, Arne Schwabe, Gert
Doering, Răzvan Cojocaru.
Hello Antonio Quartulli, Gert Doering, Răzvan Cojocaru,
I'd like you to reexamine a change. Please visit
https://gerrit.openvpn.net/c/openvpn/+/2105?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review+2 by Antonio Quartulli, Code-Review+2 by Răzvan Cojocaru,
Code-Review-1 by Gert Doering
Change subject: Move gc from openvpn_net_ctx_t to local variables
......................................................................
Move gc from openvpn_net_ctx_t to local variables
All the iproute2 functions use the gc only to create local variables
and strings to ultimately pass to openvpn_execve_check. These do not
need to live longer than the function that calls openvpn_execve_check.
Since argv already has a gc and the variables are used for the
command construction with that argv, just use the gc of that local
argv.
Change-Id: I494a427924ea501382275ea96ef85a6abcd780e5
Signed-off-by: Arne Schwabe <[email protected]>
---
M src/openvpn/networking_iproute2.c
M src/openvpn/networking_iproute2.h
2 files changed, 17 insertions(+), 20 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/05/2105/2
diff --git a/src/openvpn/networking_iproute2.c
b/src/openvpn/networking_iproute2.c
index f091fb3..7a0f4f7 100644
--- a/src/openvpn/networking_iproute2.c
+++ b/src/openvpn/networking_iproute2.c
@@ -43,21 +43,19 @@
{
ctx->es = c->es;
}
- ctx->gc = gc_new();
-
return 0;
}
void
net_ctx_reset(openvpn_net_ctx_t *ctx)
{
- gc_reset(&ctx->gc);
+ (void)ctx;
}
void
net_ctx_free(openvpn_net_ctx_t *ctx)
{
- gc_free(&ctx->gc);
+ (void)ctx;
}
int
@@ -148,7 +146,7 @@
{
struct argv argv = argv_new();
- const char *addr_str = print_in_addr_t(*addr, 0, &ctx->gc);
+ const char *addr_str = print_in_addr_t(*addr, 0, &argv.gc);
argv_printf(&argv, "%s addr add dev %s %s/%d broadcast +", iproute_path,
iface, addr_str, prefixlen);
argv_msg(M_INFO, &argv);
@@ -164,7 +162,7 @@
int prefixlen)
{
struct argv argv = argv_new();
- char *addr_str = (char *)print_in6_addr(*addr, 0, &ctx->gc);
+ char *addr_str = (char *)print_in6_addr(*addr, 0, &argv.gc);
argv_printf(&argv, "%s -6 addr add %s/%d dev %s", iproute_path, addr_str,
prefixlen, iface);
argv_msg(M_INFO, &argv);
@@ -179,7 +177,7 @@
net_addr_v4_del(openvpn_net_ctx_t *ctx, const char *iface, const in_addr_t
*addr, int prefixlen)
{
struct argv argv = argv_new();
- const char *addr_str = print_in_addr_t(*addr, 0, &ctx->gc);
+ const char *addr_str = print_in_addr_t(*addr, 0, &argv.gc);
argv_printf(&argv, "%s addr del dev %s %s/%d", iproute_path, iface,
addr_str, prefixlen);
@@ -196,7 +194,7 @@
int prefixlen)
{
struct argv argv = argv_new();
- char *addr_str = (char *)print_in6_addr(*addr, 0, &ctx->gc);
+ char *addr_str = (char *)print_in6_addr(*addr, 0, &argv.gc);
argv_printf(&argv, "%s -6 addr del %s/%d dev %s", iproute_path, addr_str,
prefixlen, iface);
argv_msg(M_INFO, &argv);
@@ -212,8 +210,8 @@
const in_addr_t *remote)
{
struct argv argv = argv_new();
- const char *local_str = print_in_addr_t(*local, 0, &ctx->gc);
- const char *remote_str = print_in_addr_t(*remote, 0, &ctx->gc);
+ const char *local_str = print_in_addr_t(*local, 0, &argv.gc);
+ const char *remote_str = print_in_addr_t(*remote, 0, &argv.gc);
argv_printf(&argv, "%s addr add dev %s local %s peer %s", iproute_path,
iface, local_str,
remote_str);
@@ -230,8 +228,8 @@
const in_addr_t *remote)
{
struct argv argv = argv_new();
- const char *local_str = print_in_addr_t(*local, 0, &ctx->gc);
- const char *remote_str = print_in_addr_t(*remote, 0, &ctx->gc);
+ const char *local_str = print_in_addr_t(*local, 0, &argv.gc);
+ const char *remote_str = print_in_addr_t(*remote, 0, &argv.gc);
argv_printf(&argv, "%s addr del dev %s local %s peer %s", iproute_path,
iface, local_str,
remote_str);
@@ -248,7 +246,7 @@
const char *iface, uint32_t table, int metric)
{
struct argv argv = argv_new();
- const char *dst_str = print_in_addr_t(*dst, 0, &ctx->gc);
+ const char *dst_str = print_in_addr_t(*dst, 0, &argv.gc);
int ret = 0;
argv_printf(&argv, "%s route add %s/%d", iproute_path, dst_str, prefixlen);
@@ -265,7 +263,7 @@
if (gw)
{
- const char *gw_str = print_in_addr_t(*gw, 0, &ctx->gc);
+ const char *gw_str = print_in_addr_t(*gw, 0, &argv.gc);
argv_printf_cat(&argv, "via %s", gw_str);
}
@@ -286,14 +284,14 @@
const struct in6_addr *gw, const char *iface, uint32_t table,
int metric)
{
struct argv argv = argv_new();
- char *dst_str = (char *)print_in6_addr(*dst, 0, &ctx->gc);
+ char *dst_str = (char *)print_in6_addr(*dst, 0, &argv.gc);
int ret = 0;
argv_printf(&argv, "%s -6 route add %s/%d dev %s", iproute_path, dst_str,
prefixlen, iface);
if (gw)
{
- char *gw_str = (char *)print_in6_addr(*gw, 0, &ctx->gc);
+ char *gw_str = (char *)print_in6_addr(*gw, 0, &argv.gc);
argv_printf_cat(&argv, "via %s", gw_str);
}
@@ -319,7 +317,7 @@
const char *iface, uint32_t table, int metric)
{
struct argv argv = argv_new();
- const char *dst_str = print_in_addr_t(*dst, 0, &ctx->gc);
+ const char *dst_str = print_in_addr_t(*dst, 0, &argv.gc);
int ret = 0;
argv_printf(&argv, "%s route del %s/%d", iproute_path, dst_str, prefixlen);
@@ -345,14 +343,14 @@
const struct in6_addr *gw, const char *iface, uint32_t table,
int metric)
{
struct argv argv = argv_new();
- char *dst_str = (char *)print_in6_addr(*dst, 0, &ctx->gc);
+ char *dst_str = (char *)print_in6_addr(*dst, 0, &argv.gc);
int ret = 0;
argv_printf(&argv, "%s -6 route del %s/%d dev %s", iproute_path, dst_str,
prefixlen, iface);
if (gw)
{
- char *gw_str = (char *)print_in6_addr(*gw, 0, &ctx->gc);
+ char *gw_str = (char *)print_in6_addr(*gw, 0, &argv.gc);
argv_printf_cat(&argv, "via %s", gw_str);
}
diff --git a/src/openvpn/networking_iproute2.h
b/src/openvpn/networking_iproute2.h
index dd7d8b3..dac5f0d 100644
--- a/src/openvpn/networking_iproute2.h
+++ b/src/openvpn/networking_iproute2.h
@@ -28,7 +28,6 @@
struct openvpn_net_ctx
{
struct env_set *es;
- struct gc_arena gc;
};
typedef struct openvpn_net_ctx openvpn_net_ctx_t;
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2105?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I494a427924ea501382275ea96ef85a6abcd780e5
Gerrit-Change-Number: 2105
Gerrit-PatchSet: 2
Gerrit-Owner: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Antonio Quartulli <[email protected]>
Gerrit-Reviewer: Gert Doering <[email protected]>
Gerrit-Reviewer: Răzvan Cojocaru <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Antonio Quartulli <[email protected]>
Gerrit-Attention: Răzvan Cojocaru <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
Gerrit-Attention: Gert Doering <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel