openvpn 1.x: route on darwin
is there any plan to include route patch for darwin in 1.x ?
http://cvs.sourceforge.net/viewcvs.py/openvpn/openvpn/route.c?r1=1.2.2.4&r2=1.2.2.5
thanks
Regards
Julien Touche
Right now all new patches are going into 2.0, but I'm certainly amenable to merging localized patches such as the route patch for darwin into 1.x.
I will add to the todo list for 1.6.1.
James
Quoted 3 lines · Julien TOUCHE
is there any plan to include route patch for darwin in 1.x ?
http://cvs.sourceforge.net/viewcvs.py/openvpn/openvpn/route.c?r1=1.2.2.4&r2=1.2.2.5
Quoted 17 lines
thanks
RegardsJulien Touche
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Quoted 4 lines · James Yonan
Right now all new patches are going into 2.0, but I'm certainly amenable to merging localized patches such as the route patch for darwin into 1.x.
I will add to the todo list for 1.6.1.
Hmm. On Unixlike systems it typically easier to call sh script to do this kind of config changes. This looks like superior solution to me.
For example, udhcpcd (DHCP clent) never ever touches configuration of eth device it operates over. It handles _only_ DHCP protocol, and whenever it detects change in DHCP state (i.e. it obtains/loses a license), it calls program specified via --script directive. That program is typically sh script. It can be easily changed to do whatever needed (routing table changes of arbitrary complexity, popup windows, ring a bell, whatever). Without changing udchcd source.
udhcpcd passes all parameters to the script via env, not command line. It makes it easy to add new parameters as udhcpcd evolve without breaking existing scripts. --
vda
Quoted 11 lines · Denis Vlasenko
Quoted 4 lines · James Yonan
Right now all new patches are going into 2.0, but I'm certainly amenable to merging localized patches such as the route patch for darwin into 1.x.
I will add to the todo list for 1.6.1.
Hmm. On Unixlike systems it typically easier to
call sh script to do this kind of config changes.
This looks like superior solution to me.
both are available.
it's also very simple to do all things in one config file.
patch join (same than 2.0, build ok)
Regards
Julien
route.c renamed from route.c.orig +45 -0
@@ -634,6 +634,23 @@if (r->metric_defined)buf_printf (&buf," -rtt %d" , r->metric);#endif +#elif defined(TARGET_DARWIN) + +buf_printf (&buf,ROUTE_PATH " add" ); + +#if 0 +if (r->metric_defined) +buf_printf (&buf," -rtt %d" , r->metric); +#endif + +buf_printf (&buf," -net %s %s %s" , + network, + gateway, + netmask); + +msg (D_ROUTE ,"%s" ,BSTR (&buf)); + status =system_check (BSTR (&buf),"ERROR: FreeBSD route add command failed" , false); + buf_printf (&buf, " -net %s %s -netmask %s", network,
@@ -723,6 +740,17 @@msg (D_ROUTE ,"%s" ,BSTR (&buf));system_check (BSTR (&buf),"ERROR: OpenBSD route delete command failed" , false); +#elif defined(TARGET_DARWIN ) + +buf_printf (&buf,ROUTE_PATH " delete -net %s %s %s" , + network, + gateway, + netmask); + +msg (D_ROUTE ,"%s" ,BSTR (&buf)); +system_check (BSTR (&buf),"ERROR: Darwin route delete command failed" , false); + +#else msg (M_FATAL ,"Sorry, but I don't know how to do 'route' commands on this operating system. Try putting your routes in a --route-up script" );#endif
@@ -859,6 +887,23 @@ rtm.rtm_version =RTM_VERSION ; rtm.rtm_seq = ++seq; rtm.rtm_addrs = rtm_addrs; + +#elif defined(TARGET_DARWUB ) + +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> + +/* all of this is taken from <net/route.h> in Darwin */ +#define RTA_DST 0x1 +#define RTA_GATEWAY 0x2 +#define RTA_NETMASK 0x4 + +#define RTM_GET 0x4 +#define RTM_VERSION 5 + +#define RTF_UP 0x1 +#define RTF_GATEWAY 0x2 so_dst.sa_family =AF_INET ; so_dst.sa_len =sizeof (struct sockaddr_in );