亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tun.c

?? 一個開源的VPN原碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* *  OpenVPN -- An application to securely tunnel IP networks *             over a single UDP port, with support for TLS-based *             session authentication and key exchange, *             packet encryption, packet authentication, and *             packet compression. * *  Copyright (C) 2002 James Yonan <jim@yonan.net> * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program (see the file COPYING included with this *  distribution); if not, write to the Free Software Foundation, Inc., *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA *//* * This file is based on the TUN/TAP driver interface routines * from VTun by Maxim Krasnyansky <max_mk@yahoo.com>. */#include "config.h"#include "syshead.h"#include "tun.h"#include "fdmisc.h"#include "error.h"#include "buffer.h"#include "common.h"#include "misc.h"#include "memdbg.h"static boolis_dev_type (const char *dev, const char *dev_type, const char *match_type){  ASSERT (dev);  ASSERT (match_type);  if (dev_type)    return !strcmp (dev_type, match_type);  else    return !strncmp (dev, match_type, strlen (match_type));}const char *dev_type_string(const char *dev, const char *dev_type){  if (is_dev_type (dev, dev_type, "tun"))    return "tun";  else if (is_dev_type (dev, dev_type, "tap"))    return "tap";  else if (is_dev_type (dev, dev_type, "null"))    return "null";  else    return "[unknown-dev-type]";}const char *dev_component_in_dev_node (const char *dev_node){  const char *ret;  const int dirsep = '/';  if (dev_node)    {      ret = rindex (dev_node, dirsep);      if (ret && *ret)	++ret;      else	ret = dev_node;      if (*ret)	return ret;    }  return NULL;}/* * Called by the open_tun function of OSes to check if we * explicitly support IPv6. * * In this context, explicit means that the OS expects us to * do something special to the tun socket in order to support * IPv6, i.e. it is not transparent. * * ipv6_explicitly_supported should be set to false if we don't * have any explicit IPv6 code in the tun device handler. * * If ipv6_explicitly_supported is true, then we have explicit * OS-specific tun dev code for handling IPv6.  If so, tt->ipv6 * is set according to the --tun-ipv6 command line option. */static voidipv6_support (bool ipv6, bool ipv6_explicitly_supported, struct tuntap* tt){  tt->ipv6 = false;  if (ipv6_explicitly_supported)    tt->ipv6 = ipv6;  else if (ipv6)    msg (M_WARN, "NOTE: explicit support for IPv6 tun devices is not provided for this OS");}/* do ifconfig */voiddo_ifconfig (const char *dev, const char *dev_type,	     const char *ifconfig_local, const char *ifconfig_remote,	     int tun_mtu){  if (ifconfig_local && ifconfig_remote)    {      char command_line[256];      if (!is_dev_type (dev, dev_type, "tun"))	msg (M_FATAL, "%s is not a tun device.  The --ifconfig option works only for tun devices.  You should use an --up script to ifconfig a tap device.", dev);#if defined(TARGET_LINUX)      snprintf (command_line, sizeof (command_line),		IFCONFIG_PATH " %s %s pointopoint %s mtu %d",		dev,		ifconfig_local,		ifconfig_remote,		tun_mtu		);      msg (M_INFO, "%s", command_line);      system_check (command_line, "Linux ifconfig failed", true);#elif defined(TARGET_SOLARIS)      /* example: ifconfig tun2 10.2.0.2 10.2.0.1 mtu 1450 netmask 255.255.255.255 up */      snprintf (command_line, sizeof (command_line),		IFCONFIG_PATH " %s %s %s mtu %d netmask 255.255.255.255 up",		dev,		ifconfig_local,		ifconfig_remote,		tun_mtu		);      msg (M_INFO, "%s", command_line);      system_check (command_line, "Solaris ifconfig failed", true);#elif defined(TARGET_OPENBSD)      /*       * OpenBSD tun devices appear to be persistent by default.  It seems in order       * to make this work correctly, we need to delete the previous instance       * (if it exists), and re-ifconfig.  Let me know if you know a better way.       */      snprintf (command_line, sizeof (command_line),		IFCONFIG_PATH " %s delete",		dev);      msg (M_INFO, "%s", command_line);      system_check (command_line, NULL, false);      msg (M_INFO, "NOTE: Tried to delete pre-existing tun instance -- No Problem if failure");      /* example: ifconfig tun2 10.2.0.2 10.2.0.1 mtu 1450 netmask 255.255.255.255 up */      snprintf (command_line, sizeof (command_line),		IFCONFIG_PATH " %s %s %s mtu %d netmask 255.255.255.255 up",		dev,		ifconfig_local,		ifconfig_remote,		tun_mtu		);      msg (M_INFO, "%s", command_line);      system_check (command_line, "OpenBSD ifconfig failed", true);#elif defined(TARGET_NETBSD)      snprintf (command_line, sizeof (command_line),	        IFCONFIG_PATH " %s %s %s mtu %d netmask 255.255.255.255 up",	        dev,		ifconfig_local,                ifconfig_remote,                tun_mtu                );      msg (M_INFO, "%s", command_line);      system_check (command_line, "NetBSD ifconfig failed", true);#elif defined(TARGET_DARWIN)      /*       * Darwin seems to exibit similar behaviour to OpenBSD...       */      snprintf (command_line, sizeof (command_line),		IFCONFIG_PATH " %s delete",		dev);      msg (M_INFO, "%s", command_line);      system_check (command_line, NULL, false);      msg (M_INFO, "NOTE: Tried to delete pre-existing tun instance -- No Problem if failure");      /* example: ifconfig tun2 10.2.0.2 10.2.0.1 mtu 1450 netmask 255.255.255.255 up */      snprintf (command_line, sizeof (command_line),		IFCONFIG_PATH " %s %s %s mtu %d netmask 255.255.255.255 up",		dev,		ifconfig_local,		ifconfig_remote,		tun_mtu		);      msg (M_INFO, "%s", command_line);      system_check (command_line, "Darwin ifconfig failed", true);#elif defined(TARGET_FREEBSD)      /* example: ifconfig tun2 10.2.0.2 10.2.0.1 mtu 1450 netmask 255.255.255.255 up */      snprintf (command_line, sizeof (command_line),		IFCONFIG_PATH " %s %s %s mtu %d netmask 255.255.255.255 up",		dev,		ifconfig_local,		ifconfig_remote,		tun_mtu		);      msg (M_INFO, "%s", command_line);      system_check (command_line, "FreeBSD ifconfig failed", true);#else      msg (M_FATAL, "Sorry, but I don't know how to do 'ifconfig' commands on this operating system.  You should ifconfig your tun/tap device manually or use an --up script.");#endif    }}voidclear_tuntap (struct tuntap *tuntap){  tuntap->fd = -1;#ifdef TARGET_SOLARIS  tuntap->ip_fd = -1;#endif  tuntap->ipv6 = false;  CLEAR (tuntap->actual);}static voidopen_null (struct tuntap *tt){  clear_tuntap (tt);  strncpynt (tt->actual, "null", sizeof (tt->actual));}static voidopen_tun_generic (const char *dev, const char *dev_node,		  bool ipv6, bool ipv6_explicitly_supported,		  struct tuntap *tt){  char tunname[64];  clear_tuntap (tt);  ipv6_support (ipv6, ipv6_explicitly_supported, tt);  if (!strcmp(dev, "null"))    {      open_null (tt);    }  else    {      if (dev_node)	snprintf (tunname, sizeof (tunname), "%s", dev_node);      else	snprintf (tunname, sizeof (tunname), "/dev/%s", dev);      if ((tt->fd = open (tunname, O_RDWR)) < 0)	msg (M_ERR, "Cannot open tun/tap dev %s", tunname);      set_nonblock (tt->fd);      msg (M_INFO, "tun/tap device %s opened", tunname);      strncpynt (tt->actual, dev, sizeof (tt->actual));    }}static voidclose_tun_generic (struct tuntap *tt){  if (tt->fd >= 0)    close (tt->fd);  clear_tuntap (tt);}#if defined(TARGET_LINUX)#ifdef HAVE_LINUX_IF_TUN_H	/* New driver support */#if defined(HAVE_NETINET_IF_ETHER_H) && defined(HAVE_NETINET_IP_H) && defined(ETH_P_IPV6)#define LINUX_IPV6 1#else#define LINUX_IPV6 0#endifvoidopen_tun (const char *dev, const char *dev_type, const char *dev_node, bool ipv6,	  struct tuntap *tt){  struct ifreq ifr;  clear_tuntap (tt);  ipv6_support (ipv6, LINUX_IPV6, tt);  if (!strcmp(dev, "null"))    {      open_null (tt);    }  else    {      if (!dev_node)	dev_node = "/dev/net/tun";      if ((tt->fd = open (dev_node, O_RDWR)) < 0)	msg (M_ERR, "Cannot open tun/tap dev %s", dev_node);      CLEAR (ifr);      if (!tt->ipv6)	ifr.ifr_flags = IFF_NO_PI;      if (is_dev_type (dev, dev_type, "tun"))	{	  ifr.ifr_flags |= IFF_TUN;	}      else if (is_dev_type (dev, dev_type, "tap"))	{	  ifr.ifr_flags |= IFF_TAP;	}      else	{	  msg (M_FATAL, "I don't recognize device %s as a tun or tap device",	       dev);	}      if (strlen (dev) > 3)		/* unit number specified? */	strncpynt (ifr.ifr_name, dev, IFNAMSIZ);      if (ioctl (tt->fd, TUNSETIFF, (void *) &ifr) < 0)	msg (M_ERR, "Cannot ioctl TUNSETIFF %s", dev);      set_nonblock (tt->fd);      msg (M_INFO, "tun/tap device %s opened", ifr.ifr_name);      strncpynt (tt->actual, ifr.ifr_name, sizeof (tt->actual));    }}#ifdef TUNSETPERSISTvoid

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
...中文天堂在线一区| 亚洲欧美国产三级| 亚洲理论在线观看| 日韩高清欧美激情| 色综合av在线| 国产精品美女久久福利网站| 美女在线视频一区| 日本黄色一区二区| 国产精品网站在线观看| 久久激情综合网| 欧美军同video69gay| 亚洲免费在线观看| 国产盗摄一区二区三区| 精品精品欲导航| 亚洲成人免费av| 色婷婷av一区二区三区大白胸| 国产亲近乱来精品视频| 精品一区二区久久| 欧美一区二区在线播放| 亚洲福利视频一区| 色欧美日韩亚洲| 亚洲少妇中出一区| 不卡av电影在线播放| 久久久久久久一区| 国内精品国产三级国产a久久| 日韩一区二区中文字幕| 日韩中文欧美在线| 在线综合视频播放| 丝袜美腿亚洲色图| 欧美一区二区三区思思人| 亚洲精品国产视频| 91丨九色丨尤物| ●精品国产综合乱码久久久久| 成人免费视频一区二区| 国产精品久久午夜夜伦鲁鲁| 成人黄页毛片网站| 亚洲欧美日韩一区二区三区在线观看| av欧美精品.com| 亚洲精品久久久久久国产精华液| 日本韩国欧美在线| 午夜欧美在线一二页| 91麻豆精品国产自产在线| 日本色综合中文字幕| 欧美变态tickle挠乳网站| 精品影视av免费| 中文字幕欧美日韩一区| 一本大道久久a久久综合婷婷| 一区二区三区蜜桃网| 91麻豆精品国产自产在线| 久久97超碰国产精品超碰| 欧美国产成人精品| 欧美天天综合网| 日韩vs国产vs欧美| 久久久午夜精品| 92国产精品观看| 欧美aaa在线| 国产精品女主播av| 欧美女孩性生活视频| 精品一区二区三区久久| 亚洲美女区一区| 日韩一区二区在线观看视频播放| 国产精品一区免费视频| 亚洲永久精品大片| 欧美α欧美αv大片| 91在线免费看| 狠狠色伊人亚洲综合成人| 亚洲欧美偷拍卡通变态| 欧美一区二区三区在线电影| 国产精品 日产精品 欧美精品| 伊人一区二区三区| 久久综合狠狠综合久久综合88| 91麻豆福利精品推荐| 狠狠网亚洲精品| 亚洲综合一区在线| 日本一区二区三区久久久久久久久不| 欧洲人成人精品| 成人综合日日夜夜| 日本美女视频一区二区| 亚洲人快播电影网| 久久亚洲欧美国产精品乐播 | 欧美日韩视频不卡| 高清国产一区二区| 美腿丝袜亚洲三区| 亚洲一区中文日韩| 国产精品视频麻豆| 精品国产伦一区二区三区免费| 欧美午夜精品理论片a级按摩| 岛国av在线一区| 久久国产精品区| 亚洲成人免费在线观看| 亚洲三级理论片| 国产精品久久久久久妇女6080| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 欧美日韩综合不卡| 99国产精品久| 国产精品白丝jk黑袜喷水| 日韩av电影天堂| 亚洲高清中文字幕| 亚洲激情校园春色| 国产精品久久看| 日本一区二区成人在线| 国产亚洲一二三区| 精品免费日韩av| 日韩精品专区在线影院观看| 欧美视频一区在线观看| 欧洲精品在线观看| 日本韩国一区二区三区视频| 色哟哟在线观看一区二区三区| 成人美女在线观看| 国产成人福利片| 成人免费毛片aaaaa**| 国产精品一区二区视频| 国产成人一区在线| 北条麻妃一区二区三区| 成人黄色一级视频| 色综合天天综合狠狠| 色综合久久88色综合天天| 99国产精品99久久久久久| 91美女视频网站| 欧美性色黄大片| 欧美日韩美少妇| 日韩欧美高清一区| 精品欧美乱码久久久久久| 精品福利视频一区二区三区| 久久精品欧美日韩精品| 中文字幕一区免费在线观看| 亚洲免费在线电影| 日韩精品免费专区| 国模大尺度一区二区三区| 国产91丝袜在线播放0| 成人美女视频在线观看18| 色婷婷精品大在线视频| 欧美日韩精品福利| 久久综合99re88久久爱| 中文字幕永久在线不卡| 亚洲国产视频a| 激情文学综合插| 91在线国产福利| 欧美日本乱大交xxxxx| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 欧美精品色综合| 久久综合一区二区| 亚洲美女精品一区| 男女激情视频一区| 北条麻妃一区二区三区| 在线不卡中文字幕播放| 久久久久久夜精品精品免费| 亚洲人成网站色在线观看| 免费观看在线综合色| 成人免费高清在线| 欧美一区二区免费视频| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 国产日韩欧美精品一区| 国产精品传媒视频| 日本aⅴ精品一区二区三区 | 亚洲免费在线播放| 经典三级视频一区| 欧美在线不卡一区| 久久婷婷国产综合精品青草| 一区二区三区免费观看| 国产精品一二二区| 91麻豆精品国产自产在线观看一区| 国产日韩欧美亚洲| 日本aⅴ免费视频一区二区三区| 99视频有精品| 欧美电影免费观看高清完整版| 亚洲美女一区二区三区| 国产精品一线二线三线| 69av一区二区三区| 亚洲乱码国产乱码精品精小说 | 亚洲一卡二卡三卡四卡| 高清不卡一二三区| 日韩欧美视频一区| 亚洲综合丝袜美腿| 97久久精品人人做人人爽50路| 精品久久久久av影院| 视频一区视频二区中文字幕| 91偷拍与自偷拍精品| 国产精品你懂的| 国产精品一线二线三线精华| 日韩视频123| 日本不卡在线视频| 在线精品亚洲一区二区不卡| 国产精品国产三级国产aⅴ入口 | 亚洲黄色性网站| 丁香婷婷综合网| 欧美国产日本视频| 国产iv一区二区三区| 精品国产sm最大网站| 久久精品国产一区二区| 日韩视频一区二区| 蜜桃视频第一区免费观看| 欧美日韩国产123区| 亚洲一级不卡视频| 精品视频一区二区不卡| 香蕉久久一区二区不卡无毒影院| 精品视频一区二区三区免费| 丝袜美腿亚洲综合| 精品国产欧美一区二区| 美女视频网站久久|