Date: Sun, 16 Jul 2000 12:10:16 +0100 (BST) From: Jan Grant <Jan.Grant@bristol.ac.uk> To: Jan Grant <Jan.Grant@bristol.ac.uk> Cc: nimrodm@email.com, freebsd-questions@freebsd.org Subject: Re: DIVERT sockets Message-ID: <Pine.GHP.4.21.0007161206530.196-100000@mail.ilrt.bris.ac.uk> In-Reply-To: <Pine.GHP.4.21.0007161159100.196-100000@mail.ilrt.bris.ac.uk>
index | next in thread | previous in thread | raw e-mail
On Sun, 16 Jul 2000, Jan Grant wrote:
> On Sat, 15 Jul 2000, Nimrod Mesika wrote:
>
> > 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;
>
> I don't know what DIVERT_PORT is defined as, but you may need
>
> htons(DIVERT_PORT)
>
> (and strictly speaking, htonl(INADDR_ANY) if memory serves)
>
> - have you checked what socket the process appears to be listening on
> when it runs?
Actually, you might also want to check that the must-be-zero bytes in
addr really are zero; bzero(&addr, sizeof addr) before you use it. I was
bitten by this on FBSD recently; trying the code on "other Unix{-a-like}
systems" demonstrated a more lax attitude to unused parts of the address
structure.
In other words, make sure than bind() isn't failing.
jan
--
jan grant, ILRT, University of Bristol. http://www.ilrt.bris.ac.uk/
Tel +44(0)117 9287163 Fax +44 (0)117 9287112 RFC822 jan.grant@bris.ac.uk
My "5k award" entry: http://tribble.ilrt.bris.ac.uk/~cmjg/test/small.html
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GHP.4.21.0007161206530.196-100000>
