From owner-freebsd-hackers Wed Nov 10 11:20:41 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by hub.freebsd.org (Postfix) with ESMTP id 04705152A4 for ; Wed, 10 Nov 1999 11:19:49 -0800 (PST) (envelope-from julian@whistle.com) Received: from current1.whiste.com (current1.whistle.com [207.76.205.22]) by alpo.whistle.com (8.9.1a/8.9.1) with ESMTP id LAA57499; Wed, 10 Nov 1999 11:18:59 -0800 (PST) Date: Wed, 10 Nov 1999 11:18:58 -0800 (PST) From: Julian Elischer To: Sunthiti Patchararungruang Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Problem about Raw IP socket In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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