From owner-freebsd-questions Wed Nov 12 22:01:22 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id WAA17475 for questions-outgoing; Wed, 12 Nov 1997 22:01:22 -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 WAA17470 for ; Wed, 12 Nov 1997 22:01:16 -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 BAA06265; Thu, 13 Nov 1997 01:01:19 -0500 (EST) Message-ID: <346A97A0.211F@eos.ncsu.edu> Date: Thu, 13 Nov 1997 01:01:04 -0500 From: Feiyi Wang X-Mailer: Mozilla 3.01Gold (X11; I; SunOS 5.4 sun4m) MIME-Version: 1.0 To: archie@whistle.com CC: questions@FreeBSD.ORG Subject: Another divert socket question Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Hi, Archie I have another divert socket question to bother you. In divert man page, it is said that: "Normally, packets read as incoming should be written as incoming; similiarly for outgoing packets. When reading and then writing back packets, passing the same socket address supplied by recvfrom(2) unmodified to sendto(2) simplifies things". I am a bit confused here: when I do recvfrom(2), the socket address I am getting is actually a source (struct socketaddr*), if I pass it unmodified to sendto(2) as detination, it seems contradict to my usual sense of "read as incoming, write as incoming". Am I missing something here? I do tried this way, it seemed not work. To make my question clear, here is what I am trying to do - A routing daemon (gated) is listening proto 89 via "normal raw socket". I first use "ipfw" divert all ip packets with proto 89 to another port, which got a divert socket binded, after packet checking ok, I want to re-inject it into the incoming stream without affecting gated daemon. Can it be done? Now reading is ok, but when I write back, but gated daemon seems never receive the packets. Thanks a lot, /Feiyi