Export --redirect-gateway parameters
PATCH 1/1 Export --redirect-gateway parameters
Report the flags passed to the --redirect-gateway and --redirect-private flags, so that systems that manage routing tables have hints about how the routing table should be modified.
--- doc/openvpn.8 | 10 ++++++++++ src/openvpn/route.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+)
doc/openvpn.8 +10 -0
@@ -5924,6 +5924,16 @@ modifier is specified, and deleted from the environment after the script returns. .\"********************************************************* .TP +.B redirect_gateway +The comma-separated list of flags provided to the +.B \-\-redirect-gateway +option. +.TP +.B redirect_private +The comma-separated list of flags provided to the +.B \-\-redirect-private +option. +.TP .B proto The .B \-\-proto
src/openvpn/route.c +30 -0
@@ -548,6 +548,35 @@ add_block_local (struct route_list *rl) } } +static void +setenv_redirect_gateway (struct env_set *es,unsigned int flags) { +struct gc_arena gc =gc_new (); +if (flags &RG_ENABLE ) + { +struct buffer val =alloc_buf_gc (256 , &gc ); +char *name ="redirect_private" ; + +if (flags &RG_REROUTE_GW ) + name ="redirect_gateway" ; +if (flags &RG_LOCAL ) +buf_printf ( &val,"local," ); +if (flags &RG_AUTO_LOCAL ) +buf_printf ( &val,"autolocal," ); +if (flags &RG_DEF1 ) +buf_printf ( &val,"def1," ); +if (flags &RG_BYPASS_DHCP ) +buf_printf ( &val,"bypass-dhcp," ); +if (flags &RG_BYPASS_DNS ) +buf_printf ( &val,"bypass-dns," ); +if (flags &RG_BLOCK_LOCAL ) +buf_printf ( &val,"block-local," ); +buf_rmtail (&val,',' ); + +setenv_str ( es, name,BSTR (&val) ); + } +gc_free (&gc); +} + bool init_route_list (struct route_list *rl, const struct route_option_list *opt,
@@ -620,6 +649,7 @@ init_route_list (struct route_list *rl, {add_block_local (rl);get_bypass_addresses (&rl->spec.bypass, rl->flags); +setenv_redirect_gateway (es, rl->flags);#ifdef ENABLE_DEBUG print_bypass_addresses (&rl->spec.bypass);#endif
Signature · 1 line
1.9.1.423.g4596e3a
Anyone in particular I should Cc this change to?
Quoted 84 lines · Paul Stewart
Report the flags passed to the --redirect-gateway and --redirect-private flags, so that systems that manage routing tables have hints about how the routing table should be modified.
Signed-off-by Paul Stewart <[email protected]...>--- doc/openvpn.8 | 10 ++++++++++ src/openvpn/route.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+)doc/openvpn.8 +0
-0@@ -5924,6 +5924,16 @@ modifier is specified, and deleted from theenvironment
after the script returns. .\"********************************************************* .TP
+.Bredirect_gatewaydoc/openvpn.8 +9
-0+The comma-separated list of flags provided to the +.B \-\-redirect-gateway +option. +.TP +.B redirect_private +The comma-separated list of flags provided to the +.B \-\-redirect-private +option. +.TP .B proto The .B \-\-protosrc/openvpn/route.c +30
-1@@ -548,6 +548,35 @@ add_block_local (struct route_list *rl) } } +static void +setenv_redirect_gateway (struct env_set *es,unsigned int flags) { +struct gc_arena gc =gc_new (); +if (flags &RG_ENABLE ) + { +struct buffer val =alloc_buf_gc (256 , &gc ); +char *name ="redirect_private" ; + +if (flags &RG_REROUTE_GW ) + name ="redirect_gateway" ; +if (flags &RG_LOCAL ) +buf_printf ( &val,"local," ); +if (flags &RG_AUTO_LOCAL ) +buf_printf ( &val,"autolocal," ); +if (flags &RG_DEF1 ) +buf_printf ( &val,"def1," ); +if (flags &RG_BYPASS_DHCP ) +buf_printf ( &val,"bypass-dhcp," ); +if (flags &RG_BYPASS_DNS ) +buf_printf ( &val,"bypass-dns," ); +if (flags &RG_BLOCK_LOCAL ) +buf_printf ( &val,"block-local," ); +buf_rmtail (&val,',' ); + +setenv_str ( es, name,BSTR (&val) ); + } +gc_free (&gc); +} + bool init_route_list (struct route_list *rl, const struct route_option_list *opt,@@ -620,6 +649,7 @@ init_route_list (struct route_list *rl, {add_block_local (rl);get_bypass_addresses (&rl->spec.bypass, rl->flags); +setenv_redirect_gateway (es, rl->flags);#ifdef ENABLE_DEBUG print_bypass_addresses (&rl->spec.bypass);#endif --1.9.1.423.g4596e3a
Hi,
Quoted 1 line · Paul Stewart
Anyone in particular I should Cc this change to?
If you find someone with lots of time on his hands, that one would be a good choice :-)
Otherwise, openvpn-devel is good. We might need some occasional poking due to "not enough time in a day" - apologies for that.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Hi,
Quoted 3 lines · Paul Stewart
Report the flags passed to the --redirect-gateway and --redirect-private flags, so that systems that manage routing tables have hints about how the routing table should be modified.
I mentioned that we don't have enough time, and so it was - apologies for not looking into this more quickly.
We discussed this today, and while the code is good enough, it needs to satisfy the "why is this needed?" requirement - could you explain a bit better what this would be used for?
(The drawback of this patch is that it needs maintenance if we add new options, like "--redirect-gateway ipv6" - David suggested that we add a global mapping table for that, and I wonder if the actual use case warrants the extra maintenance effort...)
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...