Date: Wed, 12 Nov 1997 22:12:48 +0000 From: Brian Somers <brian@awfulhak.org> To: Feiyi Wang <fwang2@eos.ncsu.edu> Cc: questions@FreeBSD.ORG Subject: Re: divert socket problem Message-ID: <199711122212.WAA06756@awfulhak.demon.co.uk> In-Reply-To: Your message of "Wed, 12 Nov 1997 15:05:50 EST." <346A0C1E.687@eos.ncsu.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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 Do you mean /sbin/ipfw add divert 50000 all from any 89 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, ....) Do you mean recvfrom() ? If so, this looks ok except for the above ipfw command. > > Thanks > > /Feiyi -- Brian <brian@Awfulhak.org>, <brian@FreeBSD.org>, <bri@OpenBSD.org> <http://www.Awfulhak.org> Don't _EVER_ lose your sense of humour....
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199711122212.WAA06756>