From owner-freebsd-questions Sat Jul 15 8:50:57 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mail.bezeqint.net (mail-a.bezeqint.net [192.115.106.23]) by hub.freebsd.org (Postfix) with ESMTP id E0D7937B5D5 for ; Sat, 15 Jul 2000 08:50:54 -0700 (PDT) (envelope-from nimrodm@bezeqint.net) Received: from bsd.net.il ([212.179.173.176]) by mail.bezeqint.net (Sun Internet Mail Server sims.3.5.2000.03.23.18.03.p10) with ESMTP id <0FXQ00BCBXAV06@mail.bezeqint.net> for freebsd-questions@freebsd.org; Sat, 15 Jul 2000 18:49:44 +0300 (IDT) Received: (from nimrodm@localhost) by bsd.net.il (8.9.3/8.9.3) id SAA01840 for freebsd-questions@freebsd.org; Sat, 15 Jul 2000 18:44:27 +0300 (IDT envelope-from nimrodm) Date: Sat, 15 Jul 2000 18:44:27 +0300 From: Nimrod Mesika Subject: DIVERT sockets To: freebsd-questions@freebsd.org Reply-To: nimrodm@email.com Message-id: <20000715184427.A1771@localhost.bsd.net.il> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline Mail-Followup-To: freebsd-questions@freebsd.org User-Agent: Mutt/1.2i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I'm trying to divert all TCP traffic to/from a certain remote site to my box. IPFW show lists the following rules: 00050 20 1200 divert 8000 tcp from 212.179.173.176 to 206.168.112.90 00060 0 0 divert 8000 tcp from 206.168.112.90 to 212.179.173.176 00100 2308 635572 allow ip from any to any via lo0 00200 0 0 deny ip from any to 127.0.0.0/8 65000 32247 18345055 allow ip from any to any 65535 0 0 deny ip from any to any Where 212... is my local address and 206... is the remote address (just an example). As you can see 20 packets should have been diverted to socket 8000. In my program I use the following code (taken from natd) to receive the packets: divertInOut = socket (PF_INET, SOCK_RAW, IPPROTO_DIVERT); addr.sin_family = AF_INET; addr.sin_addr.s_addr= INADDR_ANY; addr.sin_port = DIVERT_PORT; bind(divertInOut, (struct sockaddr*) &addr, sizeof addr); origBytes = recvfrom (fd, packetBuf, sizeof packetBuf, 0, (struct sockaddr*) &packetAddr, &addrSize); .. but I get nothing! Any ideas what I'm doing wrong? Should I be sending this to freebsd-net mailing list? -- Nimrod. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message