From owner-freebsd-questions Wed Nov 12 19:00:20 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id TAA06282 for questions-outgoing; Wed, 12 Nov 1997 19:00:20 -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 TAA06264 for ; Wed, 12 Nov 1997 19:00:14 -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 WAA25963; Wed, 12 Nov 1997 22:00:24 -0500 (EST) Message-ID: <346A6D3A.299F@eos.ncsu.edu> Date: Wed, 12 Nov 1997 22:00:10 -0500 From: Feiyi Wang X-Mailer: Mozilla 3.01Gold (X11; I; SunOS 5.4 sun4m) MIME-Version: 1.0 To: Archie Cobbs CC: questions@FreeBSD.ORG, brian@awfulhak.org Subject: Re: Divert Socket Problem References: <199711130239.SAA13189@bubba.whistle.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk I should be damned, now the problem is solved. Archie is right, I forgot use htons() to convert the port number. I have a "good reason" of not doing that :-), I am refering "natd" source code, and it didn't use htons at all, should that be a bug? Thanks guys /Feiyi Archie Cobbs wrote: > > Feiyi Wang writes: > > Hi, thanks very the input, but the problem looks hopeless :( > > > > - I am using the newest FreeBSD 2.2.5 > > > > - Both DIVERT and FIREWALL have been enable in kernel, or else it won't > > allow me to create a divert socket. > > > > - Return values of all system calls are checked, actually, the divert > > socket fd is 3, (stdin, stdout, stderr, not it's 3, right?) > > > > - The firewall rule (sbin/ipfw divert 50000 89 from any to any) seems > > correct. I double check the ipfw synopsis. > > Hmm, that's what I was afraid of :-) > > Don't have your original email, but are you setting the > addr.sin_port = 50000 instead of htons(50000) ? > > -Archie > > ___________________________________________________________________________ > Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com