Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Jun 2001 02:22:10 +0200
From:      Bjoern Fischer <bfischer@Techfak.Uni-Bielefeld.DE>
To:        Urban Olsson <Urban.E.Olsson@telia.se>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: modified FreeBSD gateway
Message-ID:  <20010602022210.A320@broccoli.no-support.loc>
In-Reply-To: <778DFE9B4E3BD111A74E08002BA3DC0D03DA524A@trab-hermes.haninge.trab.se>; from Urban.E.Olsson@telia.se on Fri, Jun 01, 2001 at 12:54:43PM %2B0200
References:  <778DFE9B4E3BD111A74E08002BA3DC0D03DA524A@trab-hermes.haninge.trab.se>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello Urban,

> What I have done so far is to use the natd daemon as an example but I hav=
e a
> problem. The divert seems to work but the problem is that I can=B4t get t=
he
> packets in my userspace program. Is there some specific port that I should
> use for the divert socket? This is not very clear in the natd code. I can=
=B4t
> find where the port is set and if it is a special port reserved for the
> divert sockets.

You create the divert socket with

  socket(PF_INET, SOCK_RAW, IPPROTO_DIVERT);

The port is set as usual (bind(2)). You must specify the same port
as it is configured into the ipfw divert or tee directive (you have
properly configured ipfw?).
See the manpages ipfw(8) and divert(4).

In /usr/src/sbin/natd/natd.c the port is set pretty normally with
bind() (line 241 fff.). Sure we talk about the the same code? IMHO the
code is clean, straight forward and well commented.

  Bj=F6rn Fischer

--=20
-----BEGIN GEEK CODE BLOCK-----
GCS d--(+) s++: a- C+++(-) UB++++OSI++++$ P+++(-) L---(++) !E W- N+ o>+
K- !w !O !M !V  PS++  PE-  PGP++  t+++  !5 X++ tv- b+++ D++ G e+ h-- y+=20
------END GEEK CODE BLOCK------

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010602022210.A320>