From owner-freebsd-questions Wed Nov 12 12:06:17 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id MAA03825 for questions-outgoing; Wed, 12 Nov 1997 12:06:17 -0800 (PST) (envelope-from owner-freebsd-questions) Received: from cc00ms.unity.ncsu.edu (cc00ms.unity.ncsu.edu [152.1.1.35]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id MAA03817 for ; Wed, 12 Nov 1997 12:06:08 -0800 (PST) (envelope-from fwang2@eos.ncsu.edu) Received: from loki.csc.ncsu.edu (loki.csc.ncsu.edu [152.1.213.138]) by cc00ms.unity.ncsu.edu (8.8.4/US19Dec96) with SMTP id PAA21893 for ; Wed, 12 Nov 1997 15:06:05 -0500 (EST) Message-ID: <346A0C1E.687@eos.ncsu.edu> Date: Wed, 12 Nov 1997 15:05:50 -0500 From: Feiyi Wang X-Mailer: Mozilla 3.01Gold (X11; I; SunOS 5.4 sun4m) MIME-Version: 1.0 To: questions@FreeBSD.ORG Subject: divert socket problem Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Hi, there I am playing with DIVERT socket. Basically, I want to divert a particular protocol stream to another port, and read it from my program. The firewall rules I am using is pretty simple. 89 is the protocol number. /sbin/ipfw -f flush /sbin/ipfw divert 50000 89 from any to any /sbin/ipfw pass all from any to any >From /sbin/ipfw show, I can see there ARE packets which match the rule 2 and diverted. But I can't read anything, recvfrom() blocks. Am I missing something here? Anybody can help me out? sockfd = socket(AF_INET,SOCK_RAW, IPPROTO_DIVERT) addr.sin_family = AF_INET addr.sin_addr.s_addr=INADDR_ANY addr.sin_port=50000 bind(sockfd, (struct sockaddr *)&addr, sizeof addr) readfrom(sockfd, ....) Thanks /Feiyi