Message ID | 20241126142639.67446-2-alex@terarocket.io |
---|---|
State | Changes Requested |
Headers | show |
Series | [Openvpn-devel,1/2] Haiku: Introduce basic platform support | expand |
Hi, On Tue, Nov 26, 2024 at 02:26:59PM +0000, Alexander von Gluck via Openvpn-devel wrote: > diff --git a/src/openvpn/route.c b/src/openvpn/route.c > index fa20d08f..8d319123 100644 > --- a/src/openvpn/route.c > +++ b/src/openvpn/route.c > @@ -54,6 +54,12 @@ > #include <net/route.h> /* RT_ROUNDUP(), RT_ADVANCE() */ > #endif > > +#if defined(TARGET_HAIKU) > +#include <SupportDefs.h> /* uint32, etc */ > +#include <net/if.h> /* ifconf etc */ > +#include <sys/sockio.h> /* SIOCGRTTABLE, etc */ > +#endif /* TARGET_HAIKU */ > + System includes go to "syshead.h". > #ifdef _WIN32 > #include "openvpn-msg.h" > > @@ -1857,14 +1863,16 @@ add_route(struct route_ipv4 *r, > > { > /* ex: route add /dev/net/ipro1000/0 default gw 192.168.1.1 netmask 255.255.255.0 */ > - argv_printf(&argv, "route add %s inet default gw %s netmask %s", > + argv_printf(&argv, "%s add %s inet %s gw %s netmask %s", > + ROUTE_PATH, > rgi- > >iface, > + network, Please squash this part into patch 1/2 - having one patch introduce something new for #ifdef TARGET_HAIKU, only to have the next patch modify the very same line is not helpful. > +#elif defined(TARGET_HAIKU) > + > + { > + // route del /dev/net/ipro1000/0 inet 192.168.0.0 gw 192.168.1.1 netmask 255.255.0.0 No // comments At least adding/deleting of routes should be "in patch 1". The get_default_gateway() part could, technically, go into its own patch ("it adds independent new functionality") - but since this all fairly small, it can just be part of the single patch. A few lines of README would be nice, if anything special is needed to make OpenVPN work on HAIKU, with you patch ("you need to install the tun/tap driver from $url, then reboot twice at midnight, and off you go"). gert
diff --git a/src/openvpn/route.c b/src/openvpn/route.c index fa20d08f..8d319123 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -54,6 +54,12 @@ #include <net/route.h> /* RT_ROUNDUP(), RT_ADVANCE() */ #endif +#if defined(TARGET_HAIKU) +#include <SupportDefs.h> /* uint32, etc */ +#include <net/if.h> /* ifconf etc */ +#include <sys/sockio.h> /* SIOCGRTTABLE, etc */ +#endif /* TARGET_HAIKU */ + #ifdef _WIN32 #include "openvpn-msg.h" @@ -1857,14 +1863,16 @@ add_route(struct route_ipv4 *r, { /* ex: route add /dev/net/ipro1000/0 default gw 192.168.1.1 netmask 255.255.255.0 */ - argv_printf(&argv, "route add %s inet default gw %s netmask %s", + argv_printf(&argv, "%s add %s inet %s gw %s netmask %s", + ROUTE_PATH, rgi- >iface, + network, gateway, netmask); argv_msg(D_ROUTE, &argv); bool ret = openvpn_execve_check(&argv, es, 0, - "ERROR: Haiku route add command failed"); + "ERROR: Haiku inet route add command failed"); status = ret ? RTA_SUCCESS : RTA_ERROR; }