Article delegate-en/4034 of [1-5169] on the server localhost:119
  upper oldest olders older1 this newer1 newers latest
search
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
[Reference:<_A4030@delegate-en.ML_>]
Newsgroups: mail-lists.delegate-en

[DeleGate-En] Re: Use the same outgoing IP address as the incoming IP address
31 Jul 2008 18:07:30 GMT Sorin Esanu <pgagqbdyi-p53o7e4kogtr.ml@ml.delegate.org>




Yutaka Sato wrote:
> In message <_A4029@delegate-en.ML_> on 07/31/08(06:22:55)
> you Sorin Esanu <pgagqbdyi-p53o7e4kogtr.ml@ml.delegate.org> wrote:
>  |Those 3 ips have different routes to world wide internet. So the 
>  |application program does not have to select anything in respect to 
>  |routes to destination servers. This is done by the hardware that route 
>  |those ip addresses.
>  |Anyway, I am aware that I can start 3 different DeleGate with different 
>  |SRCIF, but that is waist of resources. What if I have 100 ips and I want 
>  |to do that...
>
> Wow, do you really have such number of interfaces on a machine?
>   
Not on this one I run delegate. But I have one with more than 300 ips, 
on a single real interface...
>  |All I need is a simple way of telling DeleGate to automatically use to 
>  |connect to final destination the ip that the original request came on. I 
>  |need to keep things apart, but with the minimum effort...
>
> With the enclosed patch, you can use the following options to bind
> the source address of an outgoing connection to the address of
> incomming port of the session.
>
>   SRCIF=clif.-    ... bind the source address to the client-side interface
>
>   SRCIF=dontroute.clif.-   ... and set the SO_DONTROUTE option
>
> I confirmed the patch adds the behavior described above, but I don't
> know if or not this is useful for source routing.
>
> Cheers,
> Yutaka
> --
>   9 9   Yutaka Sato <y.sato@delegate.org> http://delegate.org/y.sato/
>  ( ~ )  National Institute of Advanced Industrial Science and Technology
> _<   >_ 1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan
> Do the more with the less -- B. Fuller
>
>
> *** dist/src/delegate9.8.4-pre2/src/inets.c	Mon Jul 14 14:40:43 2008
> --- inets.c	Thu Jul 31 07:35:01 2008
> ***************
> *** 2038,2043 ****
> --- 2038,2061 ----
>   /*
>   	bind_insock(sock,SRCHOST,SRCPORT);
>   */
> + 	if( strtailstr(SRCHOST,"clif.-") ){
> + 		const char *CTX_clif_host(DGC*Conn);
> + 		const char *clif;
> + 		DGC *MainConn();
> + 		int on = 1;
> + 		int rcode;
> + 
> + 		clif = CTX_clif_host(MainConn());
> + 		VSA_atosa(&Vaddr,0,gethostaddr(clif));
> + 		bind_inets(sock,&Vaddr,0,SRCPORT);
> + 		gethostName(sock,AVStr(sockname),"%A:%P");
> + 		sv1log("[%d] source port = %s:%d = %s\n",sock,clif,SRCPORT,sockname);
> + 		if( streq(SRCHOST,"dontroute.clif.-") ){
> + 			rcode = SETsockopt(sock,SOL_SOCKET,SO_DONTROUTE,&on,sizeof(on));
> + 			sv1log("#### [%s] dontroute = %d\n",clif,rcode);
> + 		}
> + 		return;
> + 	}
>   	if( *SRCHOST )
>   		VSA_atosa(&Vaddr,0,gethostaddr(SRCHOST));
>   	else	VSA_atosa(&Vaddr,0,"0.0.0.0");
>   


Seems like this patch is working. I will test more and give some feedback.

Thanks!

  admin search upper oldest olders older1 this newer1 newers latest
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
@_@V