Use iface instead of interface because it might already be declared in

system header files.
This commit is contained in:
Guus Sliepen 2003-07-18 13:45:06 +00:00
parent 96ee04b678
commit 123bb765d1
4 changed files with 15 additions and 20 deletions

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.h,v 1.1.2.9 2003/07/15 16:38:18 guus Exp $ $Id: device.h,v 1.1.2.10 2003/07/18 13:45:06 guus Exp $
*/ */
#ifndef __TINC_DEVICE_H__ #ifndef __TINC_DEVICE_H__
@ -26,12 +26,7 @@
extern int device_fd; extern int device_fd;
extern char *device; extern char *device;
#ifdef HAVE_CYGWIN
extern char *iface; extern char *iface;
#define interface iface
#else
extern char *interface;
#endif
extern int setup_device(void); extern int setup_device(void);
extern void close_device(void); extern void close_device(void);

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: graph.c,v 1.1.2.25 2003/07/17 15:06:26 guus Exp $ $Id: graph.c,v 1.1.2.26 2003/07/18 13:45:06 guus Exp $
*/ */
/* We need to generate two trees from the graph: /* We need to generate two trees from the graph:
@ -262,7 +262,7 @@ void sssp_bfs(void)
asprintf(&envp[0], "NETNAME=%s", netname ? : ""); asprintf(&envp[0], "NETNAME=%s", netname ? : "");
asprintf(&envp[1], "DEVICE=%s", device ? : ""); asprintf(&envp[1], "DEVICE=%s", device ? : "");
asprintf(&envp[2], "INTERFACE=%s", interface ? : ""); asprintf(&envp[2], "INTERFACE=%s", iface ? : "");
asprintf(&envp[3], "NODE=%s", n->name); asprintf(&envp[3], "NODE=%s", n->name);
sockaddr2str(&n->address, &address, &port); sockaddr2str(&n->address, &address, &port);
asprintf(&envp[4], "REMOTEADDRESS=%s", address); asprintf(&envp[4], "REMOTEADDRESS=%s", address);

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net_setup.c,v 1.1.2.35 2003/07/17 15:06:26 guus Exp $ $Id: net_setup.c,v 1.1.2.36 2003/07/18 13:45:06 guus Exp $
*/ */
#include "system.h" #include "system.h"
@ -525,7 +525,7 @@ int setup_network_connections(void)
/* Run tinc-up script to further initialize the tap interface */ /* Run tinc-up script to further initialize the tap interface */
asprintf(&envp[0], "NETNAME=%s", netname ? : ""); asprintf(&envp[0], "NETNAME=%s", netname ? : "");
asprintf(&envp[1], "DEVICE=%s", device ? : ""); asprintf(&envp[1], "DEVICE=%s", device ? : "");
asprintf(&envp[2], "INTERFACE=%s", interface ? : ""); asprintf(&envp[2], "INTERFACE=%s", iface ? : "");
asprintf(&envp[3], "NAME=%s", myself->name); asprintf(&envp[3], "NAME=%s", myself->name);
envp[4] = NULL; envp[4] = NULL;
@ -577,7 +577,7 @@ void close_network_connections(void)
asprintf(&envp[0], "NETNAME=%s", netname ? : ""); asprintf(&envp[0], "NETNAME=%s", netname ? : "");
asprintf(&envp[1], "DEVICE=%s", device ? : ""); asprintf(&envp[1], "DEVICE=%s", device ? : "");
asprintf(&envp[2], "INTERFACE=%s", interface ? : ""); asprintf(&envp[2], "INTERFACE=%s", iface ? : "");
asprintf(&envp[3], "NAME=%s", myself->name); asprintf(&envp[3], "NAME=%s", myself->name);
envp[4] = NULL; envp[4] = NULL;

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net_socket.c,v 1.1.2.28 2003/07/18 13:41:35 guus Exp $ $Id: net_socket.c,v 1.1.2.29 2003/07/18 13:45:06 guus Exp $
*/ */
#include "system.h" #include "system.h"
@ -48,7 +48,7 @@ int setup_listen_socket(sockaddr_t *sa)
int nfd, flags; int nfd, flags;
char *addrstr; char *addrstr;
int option; int option;
char *interface; char *iface;
struct ifreq ifr; struct ifreq ifr;
cp(); cp();
@ -84,14 +84,14 @@ int setup_listen_socket(sockaddr_t *sa)
#endif #endif
if(get_config_string if(get_config_string
(lookup_config(config_tree, "BindToInterface"), &interface)) { (lookup_config(config_tree, "BindToInterface"), &iface)) {
#if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE) #if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE)
memset(&ifr, 0, sizeof(ifr)); memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_ifrn.ifrn_name, interface, IFNAMSIZ); strncpy(ifr.ifr_ifrn.ifrn_name, iface, IFNAMSIZ);
if(setsockopt(nfd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr))) { if(setsockopt(nfd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr))) {
close(nfd); close(nfd);
logger(LOG_ERR, _("Can't bind to interface %s: %s"), interface, logger(LOG_ERR, _("Can't bind to interface %s: %s"), iface,
strerror(errno)); strerror(errno));
return -1; return -1;
} }
@ -125,7 +125,7 @@ int setup_vpn_in_socket(sockaddr_t *sa)
char *addrstr; char *addrstr;
int option; int option;
#if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE) #if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE)
char *interface; char *iface;
struct ifreq ifr; struct ifreq ifr;
#endif #endif
@ -151,13 +151,13 @@ int setup_vpn_in_socket(sockaddr_t *sa)
#if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE) #if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE)
if(get_config_string if(get_config_string
(lookup_config(config_tree, "BindToInterface"), &interface)) { (lookup_config(config_tree, "BindToInterface"), &iface)) {
memset(&ifr, 0, sizeof(ifr)); memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_ifrn.ifrn_name, interface, IFNAMSIZ); strncpy(ifr.ifr_ifrn.ifrn_name, iface, IFNAMSIZ);
if(setsockopt(nfd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr))) { if(setsockopt(nfd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr))) {
close(nfd); close(nfd);
logger(LOG_ERR, _("Can't bind to interface %s: %s"), interface, logger(LOG_ERR, _("Can't bind to interface %s: %s"), iface,
strerror(errno)); strerror(errno));
return -1; return -1;
} }