diff options
author | Alberto Gonzalez Iniesta <agi@inittab.org> | 2016-12-27 18:25:47 +0100 |
---|---|---|
committer | Alberto Gonzalez Iniesta <agi@inittab.org> | 2016-12-27 18:25:47 +0100 |
commit | 79f3537f69e125f19f59c36aa090120a63186a54 (patch) | |
tree | 2089a3b7dac990841dbc2e4d9b2f535b82dbb0af /src/openvpn/lladdr.c | |
parent | f2137fedb30cb87448eb03b2f288920df6187571 (diff) | |
parent | 3a2bbdb05ca6a6996e424c9fb225cb0d53804125 (diff) |
Merge tag 'upstream/2.4.0'
Upstream version 2.4.0
Diffstat (limited to 'src/openvpn/lladdr.c')
-rw-r--r-- | src/openvpn/lladdr.c | 87 |
1 files changed, 46 insertions, 41 deletions
diff --git a/src/openvpn/lladdr.c b/src/openvpn/lladdr.c index 57f447b..ff71e48 100644 --- a/src/openvpn/lladdr.c +++ b/src/openvpn/lladdr.c @@ -1,5 +1,5 @@ /* - * Support routine for configuring link layer address + * Support routine for configuring link layer address */ #ifdef HAVE_CONFIG_H @@ -12,56 +12,61 @@ #include "error.h" #include "misc.h" -int set_lladdr(const char *ifname, const char *lladdr, - const struct env_set *es) +int +set_lladdr(const char *ifname, const char *lladdr, + const struct env_set *es) { - struct argv argv = argv_new (); - int r; + struct argv argv = argv_new(); + int r; + + if (!ifname || !lladdr) + { + return -1; + } - if (!ifname || !lladdr) - return -1; - #if defined(TARGET_LINUX) #ifdef ENABLE_IPROUTE - argv_printf (&argv, - "%s link set addr %s dev %s", - iproute_path, lladdr, ifname); + argv_printf(&argv, + "%s link set addr %s dev %s", + iproute_path, lladdr, ifname); #else - argv_printf (&argv, - "%s %s hw ether %s", - IFCONFIG_PATH, - ifname, lladdr); + argv_printf(&argv, + "%s %s hw ether %s", + IFCONFIG_PATH, + ifname, lladdr); #endif #elif defined(TARGET_SOLARIS) - argv_printf (&argv, - "%s %s ether %s", - IFCONFIG_PATH, - ifname, lladdr); + argv_printf(&argv, + "%s %s ether %s", + IFCONFIG_PATH, + ifname, lladdr); #elif defined(TARGET_OPENBSD) - argv_printf (&argv, - "%s %s lladdr %s", - IFCONFIG_PATH, - ifname, lladdr); + argv_printf(&argv, + "%s %s lladdr %s", + IFCONFIG_PATH, + ifname, lladdr); #elif defined(TARGET_DARWIN) - argv_printf (&argv, - "%s %s lladdr %s", - IFCONFIG_PATH, - ifname, lladdr); + argv_printf(&argv, + "%s %s lladdr %s", + IFCONFIG_PATH, + ifname, lladdr); #elif defined(TARGET_FREEBSD) - argv_printf (&argv, - "%s %s ether %s", - IFCONFIG_PATH, - ifname, lladdr); -#else - msg (M_WARN, "Sorry, but I don't know how to configure link layer addresses on this operating system."); - return -1; -#endif + argv_printf(&argv, + "%s %s ether %s", + IFCONFIG_PATH, + ifname, lladdr); +#else /* if defined(TARGET_LINUX) */ + msg(M_WARN, "Sorry, but I don't know how to configure link layer addresses on this operating system."); + return -1; +#endif /* if defined(TARGET_LINUX) */ - argv_msg (M_INFO, &argv); - r = openvpn_execve_check (&argv, es, M_WARN, "ERROR: Unable to set link layer address."); - if (r) - msg (M_INFO, "TUN/TAP link layer address set to %s", lladdr); + argv_msg(M_INFO, &argv); + r = openvpn_execve_check(&argv, es, M_WARN, "ERROR: Unable to set link layer address."); + if (r) + { + msg(M_INFO, "TUN/TAP link layer address set to %s", lladdr); + } - argv_reset (&argv); - return r; + argv_reset(&argv); + return r; } |