Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Nov 1999 11:18:58 -0800 (PST)
From:      Julian Elischer <julian@whistle.com>
To:        Sunthiti Patchararungruang <stt@pluto.cpe.ku.ac.th>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Problem about Raw IP socket
Message-ID:  <Pine.BSF.4.10.9911101109560.15640-100000@current1.whistle.com>
In-Reply-To: <Pine.BSF.4.05.9911102242100.21112-100000@pluto.cpe.ku.ac.th>

next in thread | previous in thread | raw e-mail | index | archive | help
set up some IPFW rules that select next hops withthe 'fwd' command

e.g.
998 divert .....

1000 skipto 10000
1002 fwd nexthop1 ip from any to any
1004 fwd nexthop2 ip from any to any
1006 fwd nexthop3 ip from any to any
10000 .......



then  in the address field of the sendto specify the ( rule# -1)

e.g.

addr->rulenumber = 1003;   /* I can't check the actual fieldname from here
*/
sendto(divertsock, packet, pcklen, add, addrlen,flags); /* args may be
wrong order */




The address struct you get with teh divert  should already contain the
rule number of the rule that diverted (998). change it to 101 to send to
rule 1002
or 1003 to send to rule 1004  etc.







On Wed, 10 Nov 1999, Sunthiti Patchararungruang wrote:

> Dear Sir,
> 
> I have to create a route program for my thesis. Its operation is different
> from normal packet forwarding. Therefore, I need to forward all packets   
> instead of using normal packet forwarding in FreeBSD kernel. I capture    
> packets via Divert socket. It works well. I can grap IP packket including 
> its header. However, I use normal Raw IP socket to write the packets to   
> selected next-hop. I use socket option SO_DONTROUTE and IP_HDRINCL with my
> Raw IP socket and use "sendto" to write packets with "sockaddr" set to the
> IP of the next-hop-gateway. The sendto command always return error with   
> errno=22. How can I solve this error?
> 
> Thank you for all help.
> 
> Regards,
> Sunthiti Patchararungruang
> 
> 
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
> 



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?Pine.BSF.4.10.9911101109560.15640-100000>