Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Nov 1997 15:05:50 -0500
From:      Feiyi Wang <fwang2@eos.ncsu.edu>
To:        questions@FreeBSD.ORG
Subject:   divert socket problem
Message-ID:  <346A0C1E.687@eos.ncsu.edu>

next 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
/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, ....)


Thanks

/Feiyi



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