fcntl(sock, F_SETFL, fcntl(sock, F_GETFL) | O_NONBLOCK);
fcntl(tap, F_SETFL, fcntl(tap, F_GETFL) | O_NONBLOCK);
fcntl(sock, F_SETFL, fcntl(sock, F_GETFL) | O_NONBLOCK);
fcntl(tap, F_SETFL, fcntl(tap, F_GETFL) | O_NONBLOCK);
}
openlog(sprintf2("mctap-%s", tapname), LOG_PID, LOG_DAEMON);
}
openlog(sprintf2("mctap-%s", tapname), LOG_PID, LOG_DAEMON);
+ if(pidfd != NULL) {
+ fprintf(pidfd, "%i\n", getpid());
+ fclose(pidfd);
+ }
+
+ signal(SIGTERM, sighand);
+ signal(SIGINT, sighand);
+ signal(SIGHUP, sighand);
memset(&dst, 0, sizeof(dst));
dst.sin_family = AF_INET;
dst.sin_addr = group;
dst.sin_port = htons(port);
bridge(sock, tap, (struct sockaddr *)&dst, sizeof(dst));
memset(&dst, 0, sizeof(dst));
dst.sin_family = AF_INET;
dst.sin_addr = group;
dst.sin_port = htons(port);
bridge(sock, tap, (struct sockaddr *)&dst, sizeof(dst));