From d2f671bdc7fb95dcccc16277edddc7425729279d Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sat, 24 Aug 2019 16:43:34 +0200 Subject: [PATCH] Define searchpath for route with macro Allows it to be easily overridden using the compiler commmandline. Just like IFCONFIGPATH. --- src/tun.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tun.c b/src/tun.c index c05a591..9429cb1 100644 --- a/src/tun.c +++ b/src/tun.c @@ -39,6 +39,10 @@ #define IFCONFIGPATH "PATH=/sbin:/bin " #endif +#ifndef ROUTEPATH +#define ROUTEPATH "PATH=/sbin:/bin " +#endif + #ifdef WINDOWS32 #include "windows.h" #include @@ -629,7 +633,7 @@ tun_setip(const char *ip, const char *other_ip, int netbits) } else { snprintf(cmdline, sizeof(cmdline), - "/sbin/route add %s/%d %s", + ROUTEPATH "route add %s/%d %s", inet_ntoa(netip), netbits, ip); } fprintf(stderr, "Adding route %s/%d to %s\n", inet_ntoa(netip), netbits, ip);