along with this program; if not, write to the Free Software\r
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
\r
- $Id: device.c,v 1.1.2.8 2003/07/15 16:27:39 guus Exp $\r
+ $Id: device.c,v 1.1.2.9 2003/07/18 13:41:35 guus Exp $\r
*/\r
\r
-#include "config.h"\r
-\r
-#include <stdio.h>\r
-#include <stdbool.h>\r
-#include <errno.h>\r
-#include <sys/types.h>\r
-#include <sys/stat.h>\r
-#include <signal.h>\r
-#include <fcntl.h>\r
-#include <unistd.h>\r
-#include <string.h>\r
+#include "system.h"\r
+\r
#include <w32api/windows.h>\r
#include <w32api/winioctl.h>\r
\r
-// #include <utils.h>\r
#include "conf.h"\r
-#include "net.h"\r
#include "logger.h"\r
+#include "net.h"\r
#include "route.h"\r
-\r
-#include "system.h"\r
+#include "utils.h"\r
+#include "xalloc.h"\r
\r
/* Definitions from CIPE */\r
\r
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: device.c,v 1.1.2.8 2003/07/12 17:41:47 guus Exp $
+ $Id: device.c,v 1.1.2.9 2003/07/18 13:41:36 guus Exp $
*/
-#include "config.h"
-
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <fcntl.h>
-#include <net/if.h>
-#include <unistd.h>
-#include <string.h>
+#include "system.h"
-#include <utils.h>
#include "conf.h"
-#include "net.h"
#include "logger.h"
-
-#include "system.h"
+#include "net.h"
+#include "utils.h"
#define DEFAULT_DEVICE "/dev/tun0"
int device_fd = -1;
int device_type;
char *device;
-char *interface;
+char *iface;
char *device_info;
int device_total_in = 0;
int device_total_out = 0;
if(!get_config_string(lookup_config(config_tree, "Device"), &device))
device = DEFAULT_DEVICE;
- if(!get_config_string(lookup_config(config_tree, "Interface"), &interface))
- interface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
+ if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
+ iface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
if((device_fd = open(device, O_RDWR | O_NONBLOCK)) < 0) {
logger(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno));
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: device.c,v 1.1.2.11 2003/07/12 17:41:47 guus Exp $
+ $Id: device.c,v 1.1.2.12 2003/07/18 13:41:36 guus Exp $
*/
-#include "config.h"
-
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <fcntl.h>
-#include <net/if.h>
-#include <unistd.h>
-#include <string.h>
+#include "system.h"
-#include <utils.h>
#include "conf.h"
-#include "net.h"
#include "logger.h"
-
-#include "system.h"
+#include "net.h"
+#include "utils.h"
#define DEFAULT_DEVICE "/dev/tap0"
int device_fd = -1;
int device_type;
char *device;
-char *interface;
+char *iface;
char *device_info;
int device_total_in = 0;
int device_total_out = 0;
if(!get_config_string(lookup_config(config_tree, "Device"), &device))
device = DEFAULT_DEVICE;
- if(!get_config_string(lookup_config(config_tree, "Interface"), &interface))
- interface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
+ if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
+ iface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
if((device_fd = open(device, O_RDWR | O_NONBLOCK)) < 0) {
logger(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno));
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: device.c,v 1.1.2.18 2003/07/17 15:06:27 guus Exp $
+ $Id: device.c,v 1.1.2.19 2003/07/18 13:41:36 guus Exp $
*/
#include "system.h"
int device_fd = -1;
int device_type;
char *device;
-char *interface;
+char *iface;
char ifrname[IFNAMSIZ];
char *device_info;
if(!get_config_string(lookup_config(config_tree, "Device"), &device))
device = DEFAULT_DEVICE;
- if(!get_config_string(lookup_config(config_tree, "Interface"), &interface))
+ if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
#ifdef HAVE_TUNTAP
- interface = netname;
+ iface = netname;
#else
- interface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
+ iface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
#endif
device_fd = open(device, O_RDWR | O_NONBLOCK);
device_info = _("Linux tun/tap device (tap mode)");
}
- if(interface)
- strncpy(ifr.ifr_name, interface, IFNAMSIZ);
+ if(iface)
+ strncpy(ifr.ifr_name, iface, IFNAMSIZ);
if(!ioctl(device_fd, TUNSETIFF, (void *) &ifr)) {
strncpy(ifrname, ifr.ifr_name, IFNAMSIZ);
- interface = ifrname;
+ iface = ifrname;
} else if(!ioctl(device_fd, (('T' << 8) | 202), (void *) &ifr)) {
logger(LOG_WARNING, _("Old ioctl() request was needed for %s"), device);
strncpy(ifrname, ifr.ifr_name, IFNAMSIZ);
- interface = ifrname;
+ iface = ifrname;
} else
#endif
{
overwrite_mac = 1;
device_info = _("Linux ethertap device");
device_type = DEVICE_TYPE_ETHERTAP;
- interface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
+ iface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
}
logger(LOG_INFO, _("%s is a %s"), device, device_info);
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: net_socket.c,v 1.1.2.27 2003/07/17 15:06:26 guus Exp $
+ $Id: net_socket.c,v 1.1.2.28 2003/07/18 13:41:35 guus Exp $
*/
#include "system.h"
int nfd, flags;
char *addrstr;
int option;
-#if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE)
char *interface;
struct ifreq ifr;
-#endif
cp();
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: device.c,v 1.1.2.10 2003/07/12 17:41:48 guus Exp $
+ $Id: device.c,v 1.1.2.11 2003/07/18 13:41:36 guus Exp $
*/
-#include "config.h"
-
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <fcntl.h>
-#include <net/if.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <utils.h>
+#include "system.h"
+
#include "conf.h"
-#include "net.h"
#include "logger.h"
-
-#include "system.h"
+#include "net.h"
+#include "utils.h"
#define DEFAULT_DEVICE "/dev/tun0"
int device_fd = -1;
int device_type;
char *device;
-char *interface;
+char *iface;
char *device_info;
int device_total_in = 0;
if(!get_config_string(lookup_config(config_tree, "Device"), &device))
device = DEFAULT_DEVICE;
- if(!get_config_string(lookup_config(config_tree, "Interface"), &interface))
- interface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
+ if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
+ iface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
if((device_fd = open(device, O_RDWR | O_NONBLOCK)) < 0) {
logger(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno));
return -1;
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: device.c,v 1.1.2.15 2003/07/12 17:41:48 guus Exp $
+ $Id: device.c,v 1.1.2.16 2003/07/18 13:41:36 guus Exp $
*/
-#include "config.h"
-
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <fcntl.h>
-#include <net/if.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <utils.h>
+#include "system.h"
+
#include "conf.h"
-#include "net.h"
#include "logger.h"
-
-#include "system.h"
+#include "net.h"
+#include "utils.h"
#define DEFAULT_DEVICE "/dev/tun0"
int device_fd = -1;
int device_type;
char *device;
-char *interface;
+char *iface;
char *device_info;
int device_total_in = 0;
if(!get_config_string(lookup_config(config_tree, "Device"), &device))
device = DEFAULT_DEVICE;
- if(!get_config_string(lookup_config(config_tree, "Interface"), &interface))
- interface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
+ if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
+ iface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
if((device_fd = open(device, O_RDWR | O_NONBLOCK)) < 0) {
logger(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno));
return -1;
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: device.c,v 1.1.2.14 2003/07/12 17:41:48 guus Exp $
+ $Id: device.c,v 1.1.2.15 2003/07/18 13:41:37 guus Exp $
*/
-#include "config.h"
+#include "system.h"
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/ioctl.h>
#include <sys/stropts.h>
#include <sys/sockio.h>
#include <net/if_tun.h>
-#define DEFAULT_DEVICE "/dev/tun"
-
-#include <utils.h>
#include "conf.h"
-#include "net.h"
#include "logger.h"
+#include "net.h"
+#include "utils.h"
-#include "system.h"
+#define DEFAULT_DEVICE "/dev/tun"
int device_fd = -1;
int device_type;
char *device = NULL;
-char *interface = NULL;
+char *iface = NULL;
char ifrname[IFNAMSIZ];
char *device_info = NULL;
return -1;
}
- if(!get_config_string(lookup_config(config_tree, "Interface"), &interface))
- asprintf(&interface, "tun%d", ppa);
+ if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
+ asprintf(&iface, "tun%d", ppa);
device_info = _("Solaris tun device");