X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet.c;h=507621a2d4e51806e2507388475f277c2a3223da;hp=8352ac54c7bb7c4742ec390f88063cbbd6aa1a82;hb=e1184ad15d6b2e7d58bdcb4489026dd0a35b4e5f;hpb=fcbe215d64d7e2f3b159fff6422d750417877ac4 diff --git a/src/net.c b/src/net.c index 8352ac54..507621a2 100644 --- a/src/net.c +++ b/src/net.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net.c,v 1.35.4.126 2001/07/21 20:21:25 guus Exp $ + $Id: net.c,v 1.35.4.128 2001/08/17 18:14:03 guus Exp $ */ #include "config.h" @@ -204,7 +204,7 @@ cp #ifdef HAVE_SOLARIS if(write(tap_fd, packet->data + 14, packet->len - 14) < 0) - syslog(LOG_ERR, _("Can't write to tun device: %m")); + syslog(LOG_ERR, _("Can't write to tun/tap device: %m")); else total_tap_out += packet->len; #else @@ -360,7 +360,6 @@ cp mymac.net.mac.address.x[5] = 0x00; #ifdef HAVE_LINUX - taptype = TAP_TYPE_ETHERTAP; #ifdef HAVE_TUNTAP /* Ok now check if this is an old ethertap or a new tun/tap thingie */ memset(&ifr, 0, sizeof(ifr)); @@ -371,12 +370,18 @@ cp cp if (!ioctl(tap_fd, TUNSETIFF, (void *) &ifr)) { - syslog(LOG_INFO, _("%s is a new style tun/tap device"), tapfname); + syslog(LOG_INFO, _("%s is a tun/tap device"), tapfname); taptype = TAP_TYPE_TUNTAP; } + else #endif + { + syslog(LOG_INFO, _("%s is an ethertap device"), tapfname); + taptype = TAP_TYPE_ETHERTAP; + } #endif #ifdef HAVE_FREEBSD + syslog(LOG_INFO, _("%s is a tun/tap device"), tapfname); taptype = TAP_TYPE_TUNTAP; #endif #ifdef HAVE_SOLARIS @@ -412,10 +417,13 @@ cp syslog(LOG_ERR, _("Can't set PPA %d: %m"), ppa); return -1; } + if(ioctl(ip_fd, I_LINK, if_fd) < 0){ syslog(LOG_ERR, _("Can't link TUN device to IP: %m")); return -1; } + + syslog(LOG_INFO, _("%s is a tun/tap device"), tapfname); #endif cp @@ -1362,7 +1370,7 @@ cp if(FD_ISSET(p->meta_socket, f)) if(receive_meta(p) < 0) { - terminate_connection(p, 1); + terminate_connection(p, p->status.meta); return; } }