LinuxEthernetTap.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. /*
  2. * Copyright (c)2019 ZeroTier, Inc.
  3. *
  4. * Use of this software is governed by the Business Source License included
  5. * in the LICENSE.TXT file in the project's root directory.
  6. *
  7. * Change Date: 2025-01-01
  8. *
  9. * On the date above, in accordance with the Business Source License, use
  10. * of this software will be governed by version 2.0 of the Apache License.
  11. */
  12. /****/
  13. #ifdef __GNUC__
  14. #pragma GCC diagnostic ignored "-Wrestrict"
  15. #endif
  16. #include "../node/Constants.hpp"
  17. #ifdef __LINUX__
  18. #include "../node/Utils.hpp"
  19. #include "../node/Mutex.hpp"
  20. #include "../node/Dictionary.hpp"
  21. #include "OSUtils.hpp"
  22. #include "LinuxEthernetTap.hpp"
  23. #include "LinuxNetLink.hpp"
  24. #include <stdint.h>
  25. #include <stdio.h>
  26. #include <stdlib.h>
  27. #include <string.h>
  28. #include <unistd.h>
  29. #include <signal.h>
  30. #include <fcntl.h>
  31. #include <errno.h>
  32. #include <sys/types.h>
  33. #include <sys/stat.h>
  34. #include <sys/ioctl.h>
  35. #include <sys/wait.h>
  36. #include <sys/select.h>
  37. #include <netinet/in.h>
  38. #include <net/if_arp.h>
  39. #include <arpa/inet.h>
  40. #include <linux/if.h>
  41. #include <linux/if_tun.h>
  42. #include <linux/if_addr.h>
  43. #include <linux/if_ether.h>
  44. #include <ifaddrs.h>
  45. #include <algorithm>
  46. #include <utility>
  47. #include <string>
  48. #include <ctype.h>
  49. #include <sys/utsname.h>
  50. #ifndef IFNAMSIZ
  51. #define IFNAMSIZ 16
  52. #endif
  53. #define ZT_TAP_BUF_SIZE 16384
  54. // ff:ff:ff:ff:ff:ff with no ADI
  55. static const ZeroTier::MulticastGroup _blindWildcardMulticastGroup(ZeroTier::MAC(0xff),0);
  56. namespace ZeroTier {
  57. // determine if we're running a really old linux kernel.
  58. // Kernels in the 2.6.x series don't behave the same when bringing up
  59. // the tap devices.
  60. //
  61. // Returns true if the kernel major version is < 3
  62. bool isOldLinuxKernel() {
  63. struct utsname buffer;
  64. char *p;
  65. long ver[16];
  66. int i = 0;
  67. if (uname(&buffer) != 0) {
  68. perror("uname");
  69. exit(EXIT_FAILURE);
  70. }
  71. p = buffer.release;
  72. while (*p) {
  73. if (isdigit(*p)) {
  74. ver[i] = strtol(p, &p, 10);
  75. i++;
  76. } else {
  77. p++;
  78. }
  79. }
  80. return ver[0] < 3;
  81. }
  82. static const char _base32_chars[32] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','2','3','4','5','6','7' };
  83. static void _base32_5_to_8(const uint8_t *in,char *out)
  84. {
  85. out[0] = _base32_chars[(in[0]) >> 3];
  86. out[1] = _base32_chars[(in[0] & 0x07) << 2 | (in[1] & 0xc0) >> 6];
  87. out[2] = _base32_chars[(in[1] & 0x3e) >> 1];
  88. out[3] = _base32_chars[(in[1] & 0x01) << 4 | (in[2] & 0xf0) >> 4];
  89. out[4] = _base32_chars[(in[2] & 0x0f) << 1 | (in[3] & 0x80) >> 7];
  90. out[5] = _base32_chars[(in[3] & 0x7c) >> 2];
  91. out[6] = _base32_chars[(in[3] & 0x03) << 3 | (in[4] & 0xe0) >> 5];
  92. out[7] = _base32_chars[(in[4] & 0x1f)];
  93. }
  94. LinuxEthernetTap::LinuxEthernetTap(
  95. const char *homePath,
  96. const MAC &mac,
  97. unsigned int mtu,
  98. unsigned int metric,
  99. uint64_t nwid,
  100. const char *friendlyName,
  101. void (*handler)(void *,void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int),
  102. void *arg) :
  103. _handler(handler),
  104. _arg(arg),
  105. _nwid(nwid),
  106. _mac(mac),
  107. _homePath(homePath),
  108. _mtu(mtu),
  109. _fd(0),
  110. _enabled(true),
  111. _run(true)
  112. {
  113. static std::mutex s_tapCreateLock;
  114. char procpath[128],nwids[32];
  115. struct stat sbuf;
  116. // Create only one tap at a time globally.
  117. std::lock_guard<std::mutex> tapCreateLock(s_tapCreateLock);
  118. // Make sure Linux netlink is initialized.
  119. (void)LinuxNetLink::getInstance();
  120. OSUtils::ztsnprintf(nwids,sizeof(nwids),"%.16llx",nwid);
  121. _fd = ::open("/dev/net/tun",O_RDWR);
  122. if (_fd <= 0) {
  123. _fd = ::open("/dev/tun",O_RDWR);
  124. if (_fd <= 0)
  125. throw std::runtime_error(std::string("could not open TUN/TAP device: ") + strerror(errno));
  126. }
  127. struct ifreq ifr;
  128. memset(&ifr,0,sizeof(ifr));
  129. // Restore device names from legacy devicemap, but for new devices we use a base32-based
  130. // canonical device name.
  131. std::map<std::string,std::string> globalDeviceMap;
  132. FILE *devmapf = fopen((_homePath + ZT_PATH_SEPARATOR_S + "devicemap").c_str(),"r");
  133. if (devmapf) {
  134. char buf[256];
  135. while (fgets(buf,sizeof(buf),devmapf)) {
  136. char *x = (char *)0;
  137. char *y = (char *)0;
  138. char *saveptr = (char *)0;
  139. for(char *f=Utils::stok(buf,"\r\n=",&saveptr);(f);f=Utils::stok((char *)0,"\r\n=",&saveptr)) {
  140. if (!x) x = f;
  141. else if (!y) y = f;
  142. else break;
  143. }
  144. if ((x)&&(y)&&(x[0])&&(y[0]))
  145. globalDeviceMap[x] = y;
  146. }
  147. fclose(devmapf);
  148. }
  149. bool recalledDevice = false;
  150. std::map<std::string,std::string>::const_iterator gdmEntry = globalDeviceMap.find(nwids);
  151. if (gdmEntry != globalDeviceMap.end()) {
  152. Utils::scopy(ifr.ifr_name,sizeof(ifr.ifr_name),gdmEntry->second.c_str());
  153. OSUtils::ztsnprintf(procpath,sizeof(procpath),"/proc/sys/net/ipv4/conf/%s",ifr.ifr_name);
  154. recalledDevice = (stat(procpath,&sbuf) != 0);
  155. }
  156. if (!recalledDevice) {
  157. #ifdef __SYNOLOGY__
  158. int devno = 50;
  159. do {
  160. OSUtils::ztsnprintf(ifr.ifr_name,sizeof(ifr.ifr_name),"eth%d",devno++);
  161. OSUtils::ztsnprintf(procpath,sizeof(procpath),"/proc/sys/net/ipv4/conf/%s",ifr.ifr_name);
  162. } while (stat(procpath,&sbuf) == 0); // try zt#++ until we find one that does not exist
  163. #else
  164. uint64_t trial = 0; // incremented in the very unlikely event of a name collision with another network
  165. do {
  166. const uint64_t nwid40 = (nwid ^ (nwid >> 24)) + trial++;
  167. uint8_t tmp2[5];
  168. char tmp3[11];
  169. tmp2[0] = (uint8_t)((nwid40 >> 32) & 0xff);
  170. tmp2[1] = (uint8_t)((nwid40 >> 24) & 0xff);
  171. tmp2[2] = (uint8_t)((nwid40 >> 16) & 0xff);
  172. tmp2[3] = (uint8_t)((nwid40 >> 8) & 0xff);
  173. tmp2[4] = (uint8_t)(nwid40 & 0xff);
  174. tmp3[0] = 'z';
  175. tmp3[1] = 't';
  176. _base32_5_to_8(tmp2,tmp3 + 2);
  177. tmp3[10] = (char)0;
  178. memcpy(ifr.ifr_name,tmp3,11);
  179. OSUtils::ztsnprintf(procpath,sizeof(procpath),"/proc/sys/net/ipv4/conf/%s",ifr.ifr_name);
  180. } while (stat(procpath,&sbuf) == 0);
  181. #endif
  182. }
  183. ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
  184. if (ioctl(_fd,TUNSETIFF,(void *)&ifr) < 0) {
  185. ::close(_fd);
  186. throw std::runtime_error("unable to configure TUN/TAP device for TAP operation");
  187. }
  188. ::ioctl(_fd,TUNSETPERSIST,0); // valgrind may generate a false alarm here
  189. _dev = ifr.ifr_name;
  190. ::fcntl(_fd,F_SETFD,fcntl(_fd,F_GETFD) | FD_CLOEXEC);
  191. (void)::pipe(_shutdownSignalPipe);
  192. _tapReaderThread = std::thread([this]{
  193. uint8_t b[ZT_TAP_BUF_SIZE];
  194. fd_set readfds,nullfds;
  195. int n,nfds,r;
  196. std::vector<void *> buffers;
  197. struct ifreq ifr;
  198. memset(&ifr,0,sizeof(ifr));
  199. strcpy(ifr.ifr_name,_dev.c_str());
  200. const int sock = socket(AF_INET,SOCK_DGRAM,0);
  201. if (sock <= 0)
  202. return;
  203. if (ioctl(sock,SIOCGIFFLAGS,(void *)&ifr) < 0) {
  204. ::close(sock);
  205. printf("WARNING: ioctl() failed setting up Linux tap device (bring interface up)\n");
  206. return;
  207. }
  208. ifr.ifr_ifru.ifru_hwaddr.sa_family = ARPHRD_ETHER;
  209. _mac.copyTo(ifr.ifr_ifru.ifru_hwaddr.sa_data,6);
  210. if (ioctl(sock,SIOCSIFHWADDR,(void *)&ifr) < 0) {
  211. ::close(sock);
  212. printf("WARNING: ioctl() failed setting up Linux tap device (set MAC)\n");
  213. return;
  214. }
  215. usleep(100000);
  216. if (isOldLinuxKernel()) {
  217. ifr.ifr_ifru.ifru_mtu = (int)_mtu;
  218. if (ioctl(sock,SIOCSIFMTU,(void *)&ifr) < 0) {
  219. ::close(sock);
  220. printf("WARNING: ioctl() failed setting up Linux tap device (set MTU)\n");
  221. return;
  222. }
  223. usleep(100000);
  224. }
  225. ifr.ifr_flags |= IFF_MULTICAST;
  226. ifr.ifr_flags |= IFF_UP;
  227. if (ioctl(sock,SIOCSIFFLAGS,(void *)&ifr) < 0) {
  228. ::close(sock);
  229. printf("WARNING: ioctl() failed setting up Linux tap device (bring interface up)\n");
  230. return;
  231. }
  232. usleep(100000);
  233. if (!isOldLinuxKernel()) {
  234. ifr.ifr_ifru.ifru_hwaddr.sa_family = ARPHRD_ETHER;
  235. _mac.copyTo(ifr.ifr_ifru.ifru_hwaddr.sa_data,6);
  236. if (ioctl(sock,SIOCSIFHWADDR,(void *)&ifr) < 0) {
  237. ::close(sock);
  238. printf("WARNING: ioctl() failed setting up Linux tap device (set MAC)\n");
  239. return;
  240. }
  241. ifr.ifr_ifru.ifru_mtu = (int)_mtu;
  242. if (ioctl(sock,SIOCSIFMTU,(void *)&ifr) < 0) {
  243. ::close(sock);
  244. printf("WARNING: ioctl() failed setting up Linux tap device (set MTU)\n");
  245. return;
  246. }
  247. }
  248. fcntl(_fd,F_SETFL,O_NONBLOCK);
  249. ::close(sock);
  250. if (!_run)
  251. return;
  252. FD_ZERO(&readfds);
  253. FD_ZERO(&nullfds);
  254. nfds = (int)std::max(_shutdownSignalPipe[0],_fd) + 1;
  255. r = 0;
  256. for(;;) {
  257. FD_SET(_shutdownSignalPipe[0],&readfds);
  258. FD_SET(_fd,&readfds);
  259. select(nfds,&readfds,&nullfds,&nullfds,(struct timeval *)0);
  260. if (FD_ISSET(_shutdownSignalPipe[0],&readfds))
  261. break;
  262. if (FD_ISSET(_fd,&readfds)) {
  263. for(;;) { // read until there are no more packets, then return to outer select() loop
  264. n = (int)::read(_fd,b + r,ZT_TAP_BUF_SIZE - r);
  265. if (n > 0) {
  266. // Some tap drivers like to send the ethernet frame and the
  267. // payload in two chunks, so handle that by accumulating
  268. // data until we have at least a frame.
  269. r += n;
  270. if (r > 14) {
  271. if (r > ((int)_mtu + 14)) // sanity check for weird TAP behavior on some platforms
  272. r = _mtu + 14;
  273. if (_enabled) {
  274. //_tapq.post(std::pair<void *,int>(buf,r));
  275. //buf = nullptr;
  276. MAC to(b, 6),from(b + 6, 6);
  277. unsigned int etherType = Utils::ntoh(((const uint16_t *)b)[6]);
  278. _handler(_arg, nullptr, _nwid, from, to, etherType, 0, (const void *)(b + 14),(unsigned int)(r - 14));
  279. }
  280. r = 0;
  281. }
  282. } else {
  283. r = 0;
  284. break;
  285. }
  286. }
  287. }
  288. }
  289. });
  290. }
  291. LinuxEthernetTap::~LinuxEthernetTap()
  292. {
  293. _run = false;
  294. (void)::write(_shutdownSignalPipe[1],"\0",1);
  295. _tapReaderThread.join();
  296. ::close(_fd);
  297. ::close(_shutdownSignalPipe[0]);
  298. ::close(_shutdownSignalPipe[1]);
  299. }
  300. void LinuxEthernetTap::setEnabled(bool en)
  301. {
  302. _enabled = en;
  303. }
  304. bool LinuxEthernetTap::enabled() const
  305. {
  306. return _enabled;
  307. }
  308. static bool ___removeIp(const std::string &_dev,const InetAddress &ip)
  309. {
  310. LinuxNetLink::getInstance().removeAddress(ip, _dev.c_str());
  311. return true;
  312. }
  313. bool LinuxEthernetTap::addIps(std::vector<InetAddress> ips)
  314. {
  315. #ifdef __SYNOLOGY__
  316. std::string filepath = "/etc/sysconfig/network-scripts/ifcfg-"+_dev;
  317. std::string cfg_contents = "DEVICE="+_dev+"\nBOOTPROTO=static";
  318. int ip4=0,ip6=0,ip4_tot=0,ip6_tot=0;
  319. for(int i=0; i<(int)ips.size(); i++) {
  320. if (ips[i].isV4())
  321. ip4_tot++;
  322. else
  323. ip6_tot++;
  324. }
  325. // Assemble and write contents of ifcfg-dev file
  326. for(int i=0; i<(int)ips.size(); i++) {
  327. if (ips[i].isV4()) {
  328. char iptmp[64],iptmp2[64];
  329. std::string numstr4 = ip4_tot > 1 ? std::to_string(ip4) : "";
  330. cfg_contents += "\nIPADDR"+numstr4+"="+ips[i].toIpString(iptmp)
  331. + "\nNETMASK"+numstr4+"="+ips[i].netmask().toIpString(iptmp2)+"\n";
  332. ip4++;
  333. } else {
  334. char iptmp[64],iptmp2[64];
  335. std::string numstr6 = ip6_tot > 1 ? std::to_string(ip6) : "";
  336. cfg_contents += "\nIPV6ADDR"+numstr6+"="+ips[i].toIpString(iptmp)
  337. + "\nNETMASK"+numstr6+"="+ips[i].netmask().toIpString(iptmp2)+"\n";
  338. ip6++;
  339. }
  340. }
  341. OSUtils::writeFile(filepath.c_str(), cfg_contents.c_str(), cfg_contents.length());
  342. // Finally, add IPs
  343. for(int i=0; i<(int)ips.size(); i++){
  344. LinuxNetLink::getInstance().addAddress(ips[i], _dev.c_str());
  345. }
  346. return true;
  347. #endif // __SYNOLOGY__
  348. return false;
  349. }
  350. bool LinuxEthernetTap::addIp(const InetAddress &ip)
  351. {
  352. if (!ip)
  353. return false;
  354. std::vector<InetAddress> allIps(ips());
  355. if (std::binary_search(allIps.begin(),allIps.end(),ip))
  356. return true;
  357. // Remove and reconfigure if address is the same but netmask is different
  358. for(std::vector<InetAddress>::iterator i(allIps.begin());i!=allIps.end();++i) {
  359. if (i->ipsEqual(ip))
  360. ___removeIp(_dev,*i);
  361. }
  362. LinuxNetLink::getInstance().addAddress(ip, _dev.c_str());
  363. return true;
  364. }
  365. bool LinuxEthernetTap::removeIp(const InetAddress &ip)
  366. {
  367. if (!ip)
  368. return true;
  369. std::vector<InetAddress> allIps(ips());
  370. if (std::find(allIps.begin(),allIps.end(),ip) != allIps.end()) {
  371. if (___removeIp(_dev,ip))
  372. return true;
  373. }
  374. return false;
  375. }
  376. std::vector<InetAddress> LinuxEthernetTap::ips() const
  377. {
  378. struct ifaddrs *ifa = (struct ifaddrs *)0;
  379. if (getifaddrs(&ifa))
  380. return std::vector<InetAddress>();
  381. std::vector<InetAddress> r;
  382. struct ifaddrs *p = ifa;
  383. while (p) {
  384. if ((!strcmp(p->ifa_name,_dev.c_str()))&&(p->ifa_addr)&&(p->ifa_netmask)&&(p->ifa_addr->sa_family == p->ifa_netmask->sa_family)) {
  385. switch(p->ifa_addr->sa_family) {
  386. case AF_INET: {
  387. struct sockaddr_in *sin = (struct sockaddr_in *)p->ifa_addr;
  388. struct sockaddr_in *nm = (struct sockaddr_in *)p->ifa_netmask;
  389. r.push_back(InetAddress(&(sin->sin_addr.s_addr),4,Utils::countBits((uint32_t)nm->sin_addr.s_addr)));
  390. } break;
  391. case AF_INET6: {
  392. struct sockaddr_in6 *sin = (struct sockaddr_in6 *)p->ifa_addr;
  393. struct sockaddr_in6 *nm = (struct sockaddr_in6 *)p->ifa_netmask;
  394. uint32_t b[4];
  395. memcpy(b,nm->sin6_addr.s6_addr,sizeof(b));
  396. r.push_back(InetAddress(sin->sin6_addr.s6_addr,16,Utils::countBits(b[0]) + Utils::countBits(b[1]) + Utils::countBits(b[2]) + Utils::countBits(b[3])));
  397. } break;
  398. }
  399. }
  400. p = p->ifa_next;
  401. }
  402. if (ifa)
  403. freeifaddrs(ifa);
  404. std::sort(r.begin(),r.end());
  405. r.erase(std::unique(r.begin(),r.end()),r.end());
  406. return r;
  407. }
  408. void LinuxEthernetTap::put(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len)
  409. {
  410. char putBuf[ZT_MAX_MTU + 64];
  411. if ((_fd > 0)&&(len <= _mtu)&&(_enabled)) {
  412. to.copyTo(putBuf,6);
  413. from.copyTo(putBuf + 6,6);
  414. *((uint16_t *)(putBuf + 12)) = htons((uint16_t)etherType);
  415. memcpy(putBuf + 14,data,len);
  416. len += 14;
  417. (void)::write(_fd,putBuf,len);
  418. }
  419. }
  420. std::string LinuxEthernetTap::deviceName() const
  421. {
  422. return _dev;
  423. }
  424. void LinuxEthernetTap::setFriendlyName(const char *friendlyName)
  425. {
  426. }
  427. void LinuxEthernetTap::scanMulticastGroups(std::vector<MulticastGroup> &added,std::vector<MulticastGroup> &removed)
  428. {
  429. char *ptr,*ptr2;
  430. unsigned char mac[6];
  431. std::vector<MulticastGroup> newGroups;
  432. int fd = ::open("/proc/net/dev_mcast",O_RDONLY);
  433. if (fd > 0) {
  434. char buf[131072];
  435. int n = (int)::read(fd,buf,sizeof(buf));
  436. if ((n > 0)&&(n < (int)sizeof(buf))) {
  437. buf[n] = (char)0;
  438. for(char *l=strtok_r(buf,"\r\n",&ptr);(l);l=strtok_r((char *)0,"\r\n",&ptr)) {
  439. int fno = 0;
  440. char *devname = (char *)0;
  441. char *mcastmac = (char *)0;
  442. for(char *f=strtok_r(l," \t",&ptr2);(f);f=strtok_r((char *)0," \t",&ptr2)) {
  443. if (fno == 1)
  444. devname = f;
  445. else if (fno == 4)
  446. mcastmac = f;
  447. ++fno;
  448. }
  449. if ((devname)&&(!strcmp(devname,_dev.c_str()))&&(mcastmac)&&(Utils::unhex(mcastmac,mac,6) == 6))
  450. newGroups.push_back(MulticastGroup(MAC(mac,6),0));
  451. }
  452. }
  453. ::close(fd);
  454. }
  455. std::vector<InetAddress> allIps(ips());
  456. for(std::vector<InetAddress>::iterator ip(allIps.begin());ip!=allIps.end();++ip)
  457. newGroups.push_back(MulticastGroup::deriveMulticastGroupForAddressResolution(*ip));
  458. std::sort(newGroups.begin(),newGroups.end());
  459. newGroups.erase(std::unique(newGroups.begin(),newGroups.end()),newGroups.end());
  460. for(std::vector<MulticastGroup>::iterator m(newGroups.begin());m!=newGroups.end();++m) {
  461. if (!std::binary_search(_multicastGroups.begin(),_multicastGroups.end(),*m))
  462. added.push_back(*m);
  463. }
  464. for(std::vector<MulticastGroup>::iterator m(_multicastGroups.begin());m!=_multicastGroups.end();++m) {
  465. if (!std::binary_search(newGroups.begin(),newGroups.end(),*m))
  466. removed.push_back(*m);
  467. }
  468. _multicastGroups.swap(newGroups);
  469. }
  470. void LinuxEthernetTap::setMtu(unsigned int mtu)
  471. {
  472. if (_mtu != mtu) {
  473. _mtu = mtu;
  474. int sock = socket(AF_INET,SOCK_DGRAM,0);
  475. if (sock > 0) {
  476. struct ifreq ifr;
  477. memset(&ifr,0,sizeof(ifr));
  478. ifr.ifr_ifru.ifru_mtu = (int)mtu;
  479. ioctl(sock,SIOCSIFMTU,(void *)&ifr);
  480. close(sock);
  481. }
  482. }
  483. }
  484. } // namespace ZeroTier
  485. #endif // __LINUX__