Hi Luigi, Thanks for response, the vmnet/tap stuff sounds like neat stuff. After reading the description of tap (from the vtun site), the system seems to make a lot of sense. However, I'm not sure how vmnet comes into play here - what purpose does it serve, shouldn't I just be able to read from the /dev/tap0 and bridge between tap0 and fxp0?
I tried writing a simple program to use tap. Basically, I have the bridge setup as such net.link.ether.bridge_cfg: fxp0:0,tap0:0 tap1:1 bge0:1 And I ran this quick test program that I wrote: #include <sys/types.h> // ssize_t #include <sys/socket.h> // ::socket #include <netinet/in_systm.h> // n_long #include <netinet/in.h> // IPPROTO_DIVERT, struct sockaddr_in #include <netinet/ip.h> // IP_MAXPACKET #include <netinet/tcp.h> // struct tcphdr #include <fcntl.h> // ::fcntl #include <err.h> // ::err #include <errno.h> // errno #include <stdio.h> // ::printf #include <string.h> // ::bcopy #include <unistd.h> // ::close #define MAX(a, b) (((a) > (b)) ? (a) : (b)) /** main */ int main() { int nFDRight; int nFDLeft; unsigned char kpucInPacket[IP_MAXPACKET]; nFDRight = open("/dev/tap0", O_RDWR); if (nFDRight < 0) ::err(errno, "open"); nFDLeft = open("/dev/tap1", O_RDWR); if (nFDLeft < 0) ::err(errno, "open"); fd_set masterReadSocks; fd_set currentReadSocks; FD_ZERO(&masterReadSocks); FD_SET(nFDRight,&masterReadSocks); FD_SET(nFDLeft, &masterReadSocks); int nMaxFD = MAX(nFDRight, nFDLeft); while (true) { ::bcopy(&masterReadSocks, ¤tReadSocks, sizeof(fd_set)); int nSelectValue = select(nMaxFD + 1, ¤tReadSocks, NULL, NULL, NULL); printf("Unblocked on select\n"); if (nSelectValue == -1) { /* Signal interrupted, just continue */ if (errno == EINTR) continue; ::err(errno, "select"); } if (FD_ISSET(nFDRight, ¤tReadSocks)) { int nReadSize = read(nFDRight, kpucInPacket, sizeof(kpucInPacket)); if (nReadSize < 0) err(errno, "read"); if (write(nFDLeft, kpucInPacket, nReadSize) < 0) err(errno, "write"); } if (FD_ISSET(nFDLeft, ¤tReadSocks)) { int nReadSize = read(nFDLeft, kpucInPacket, sizeof(kpucInPacket)); if (nReadSize < 0) err(errno, "read"); if (write(nFDRight, kpucInPacket, nReadSize) < 0) err(errno, "write"); } } close(nFDLeft); close(nFDRight); } Unfortunately, it doesn't work, it only gets a read event when I make changes to the tap interface via ifconfig. I guess I don't fully understand how the /dev/tapN interface works, can you (or anybody who also know) point out what I'm doing wrong? Thanks again! Bernie ---------------------------------------- This mail sent through www.mywaterloo.ca _______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "[EMAIL PROTECTED]"