- mymac.type = SUBNET_MAC;
- mymac.net.mac.address.x[0] = 0xfe;
- mymac.net.mac.address.x[1] = 0xfd;
- mymac.net.mac.address.x[2] = 0x00;
- mymac.net.mac.address.x[3] = 0x00;
- mymac.net.mac.address.x[4] = 0x00;
- mymac.net.mac.address.x[5] = 0x00;
-
-#ifdef HAVE_LINUX
- #ifdef HAVE_TUNTAP
- /* Ok now check if this is an old ethertap or a new tun/tap thingie */
- memset(&ifr, 0, sizeof(ifr));
-cp
- ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
- if (netname)
- strncpy(ifr.ifr_name, netname, IFNAMSIZ);
-cp
- if (!ioctl(tap_fd, TUNSETIFF, (void *) &ifr))
- {
- syslog(LOG_INFO, _("%s is a Linux tun/tap device"), tapfname);
- taptype = TAP_TYPE_TUNTAP;
- }
- else
- if (!ioctl(tap_fd, (('T'<< 8) | 202), (void *) &ifr))
- {
- syslog(LOG_INFO, _("%s is a Linux tun/tap device"), tapfname);
- syslog(LOG_WARNING, _("Old ioctl() request used"));
- taptype = TAP_TYPE_TUNTAP;
- }
- else
- #endif
- {
- syslog(LOG_INFO, _("%s is a Linux ethertap device"), tapfname);
- taptype = TAP_TYPE_ETHERTAP;
- }
-#endif
-#ifdef HAVE_FREEBSD
- syslog(LOG_INFO, _("%s is a FreeBSD tap device"), tapfname);
- taptype = TAP_TYPE_TUNTAP;
-#endif
-#ifdef HAVE_SOLARIS
- ppa = 0;
-
- ptr = tapfname;
- while(*ptr && !isdigit((int)*ptr)) ptr++;
- ppa = atoi(ptr);
-
- if( (ip_fd = open("/dev/ip", O_RDWR, 0)) < 0){
- syslog(LOG_ERR, _("Could not open /dev/ip: %m"));
- return -1;
- }
-
- /* Assign a new PPA and get its unit number. */
- if( (ppa = ioctl(nfd, TUNNEWPPA, ppa)) < 0){
- syslog(LOG_ERR, _("Can't assign new interface: %m"));
- return -1;
- }
-
- if( (if_fd = open(tapfname, O_RDWR, 0)) < 0){
- syslog(LOG_ERR, _("Could not open %s twice: %m"), tapfname);
- return -1;
- }
-
- if(ioctl(if_fd, I_PUSH, "ip") < 0){
- syslog(LOG_ERR, _("Can't push IP module: %m"));
- return -1;
- }
-
- /* Assign ppa according to the unit number returned by tun device */
- if(ioctl(if_fd, IF_UNITSEL, (char *)&ppa) < 0){
- 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 Solaris tun device"), tapfname);
-#endif
-
-cp
- return 0;
-}
-
-/*
- set up the socket that we listen on for incoming
- (tcp) connections
-*/
-int setup_listen_meta_socket(int port)