RE: [Pound Mailing List] Location comparision with backend address & host

Raj Kishore1/CHN/TCS <raj.kishore1-/[email protected]>
Newsgroups gmane.comp.web.pound.general
Message-ID <[email protected]>
Hi Joe,
Thanks for the previous replies.
We have modified the pound 1.9 socket structures to listen IPV4/ipv6 address.
However when IPV4 request comes,it is mapped to IPV6 address as  ::ffff:<X.X.X.X>
In case of IPV6 client, it is fetching the IPV6 address only.
Is it the right mechansim to handle ipv4 client in ipv4 mapped ipv6 address mode in pound?
Do we need to handele explicitly  the IPV4-6 mapped address in dual stack?
 
Please provide clarity
Thanks,
Raj Kishore

----- Original Message -----
From: Joe Gooch <[email protected]>
To: '[email protected]' <[email protected]>
Sent: Mon, 11 Mar 2013 21:42:39 +0530 (IST)
Subject: RE: [Pound Mailing List] Location comparision with backend address & host



IPv6 support was added in v2.4, and is available in the current release (v2.6)
 
It’s as easy as:
$ host www.sapphireschoolnurse.com
www.sapphireschoolnurse.com has address 67.216.66.153
www.sapphireschoolnurse.com has IPv6 address 2604:7e00:30:1::301
 
ListenHTTP
	    Address 2604:7e00:30:1::301
	    Port 80
   ….
End
 
ListenHTTP
	    Address 67.216.66.153
	    Port 80
   ….
End
 
 
I haven’t tried it, but I don’t see why you couldn’t do a wildcard interface, or explicitly specify 0.0.0.0 or :: or ::ffff:0.0.0.0    I always explicitly define my listening interfaces by ip address.
 
 
As for the items in get_host… I didn’t write it, so I don’t know off the top of my head.  However, I don’t see your concern.
From man getaddrinfo:
 
Given node and service, which identify an Internet host and a service, getaddrinfo() returns one or more addrinfo structures, each of which contains an Internet address that
	   can be specified in a call to bind(2) or connect(2).  The getaddrinfo() function combines the functionality provided by the getservbyname(3) and  getservbyport(3)  functions
	   into a single interface, but unlike the latter functions, getaddrinfo() is reentrant and allows programs to eliminate IPv4-versus-IPv6 dependencies.
 
And:
	   ai_socktype This field specifies the preferred socket type, for example SOCK_STREAM or SOCK_DGRAM.  Specifying 0 in this field indicates that socket addresses  of  any  type
				   can be returned by getaddrinfo().
 
Since pound is in fact instantiating STREAM sockets, this seems appropriate.
 
ai_protocol would indicate AF_INET or AF_INET6.
 
 
 
Maybe if you gave us a better idea of what you’re trying to accomplish?  If you’re just trying to set up Dual Stack, I think Pound already has what you need.
 

Joe
 



From: Raj Kishore1/CHN/TCS [mailto:[email protected]] 
Sent: Monday, March 11, 2013 8:52 AM
To: [email protected]
Subject: RE: [Pound Mailing List] Location comparision with backend address & host
 
Hi Joe,
Thanks for your reply. No our clients arent proxies. However we are using
pound 1.9 version to make it to support dual stack.  

Few additional questions
1) Does the latest version support wild card interfaces as in 1.9 version?
2) In Pound 2.4, why is there a break for TCP socket in get_host method as shown below?
How does it support Dual-Stack?


 /*
 * Search for a host name, return the addrinfo for it
 */
int
get_host(char *const name, struct addrinfo *res)
{
struct addrinfo *chain, *ap;
int ret_val;
#ifdef HAVE_INET_NTOP
if((ret_val = getaddrinfo(name, NULL, NULL, &chain)) == 0) {
for(ap = chain; ap != NULL; ap = ap->ai_next)
if(ap->ai_socktype == SOCK_STREAM)
break;
Thanks,
Raj

----- Original Message -----
From: Joe Gooch <[email protected]>
To: '[email protected]' <[email protected]>
Sent: Thu, 07 Mar 2013 20:34:02 +0530 (IST)
Subject: RE: [Pound Mailing List] Location comarision with backend address & host

Sorry, 1.9 was released in 2005.  So it’s more like 8 years old.:-D
 

Joe
 



From: Joe Gooch 
Sent: Thursday, March 07, 2013 9:39 AM
To: '[email protected]'
Subject: RE: [Pound Mailing List] Location comarision with backend address & host
 
Your clients are proxies?
 
Client 1.1.1.1 ->  Pound 2.2.2.2   ->  Backends 3.3.3.3 and 4.4.4.4
 
Client 1.1.1.1 contacts pound at 2.2.2.2, with url /
Pound 2.2.2.2 contacts Backend 3.3.3.3 with URL /
 
Backend 3.3.3.3 sends a redirect:
Location: http://3.3.3.3/mysite/
 
Pound compares said location header against the BACKEND addresses.  Hey look, backend 3.3.3.3 is trying to redirect to itself!  But client 1.1.1.1 can’t speak to 3.3.3.3.  It’s speaking to 2.2.2.2. 
Pound rewrites the location:
Location: http://2.2.2.2/mysite/
 
And sends it back to the client.
 
 
This behavior is controllable with config option RewriteLocation and RewriteDestination in versions of code that aren’t already 4+ years out of date.
 

Joe
 



From: Raj Kishore1/CHN/TCS [mailto:[email protected]] 
Sent: Thursday, March 07, 2013 9:04 AM
To:[email protected]
Subject: RE: [Pound Mailing List] Location comarision with backend address & host
 
Hi,

When External Client sends a request, it is only going to be proxy address. Why
is there a condition to compare the location header address to that of backend address list?
Please clarify!!

for(i = 0; i < grp->tot_pri; i++)
    if(memcmp(&grp->backend_addr[i].addr.sin_addr, &addr.sin_addr, sizeof(addr.sin_addr)) == 0
    && memcmp(&grp->backend_addr[i].addr.sin_port, &addr.sin_port, sizeof(addr.sin_port)) == 0)
    return 1;
    return 0;

 
Thanks
Raj

----- Original Message -----
From: Joe Gooch <[email protected]>
To: '[email protected]' <[email protected]>
Sent: Wed, 06 Mar 2013 20:06:24 +0530 (IST)
Subject: RE: [Pound Mailing List] Location comarision with backend address & host

is_be is used for location rewriting.  If the backend throws a redirect, and the address is one of our known backends, then we can rewrite the redirect to point to the proxy address. (as you usually wouldn’t want the client to try to hit the backend directly, and it’s even possible it can’t hit the backend directly because it might be a private address)
 
Why would you want to remove this?
 
Joe
 
 
 



From: Raj Kishore1/CHN/TCS [mailto:[email protected]] 
Sent: Wednesday, March 06, 2013 3:48 AM
To:[email protected]
Subject: [Pound Mailing List] Location comarision with backend address & host
 
Hi,
In pound 1.9 version, function "is_be" function in  file svc.c is written to find if a host is in our list of back-ends. Could anyone explain the need of such comparision of the location address with list of backend address and with to_host . What could be the effect in pound if this function is removed?
Comparision:-
if(memcmp(&to_host->sin_addr, &addr.sin_addr, sizeof(addr.sin_addr)) == 0
    && memcmp(&to_host->sin_port, &addr.sin_port, sizeof(addr.sin_port)) == 0)
    return 1;
    for(i = 0; i < grp->tot_pri; i++)
    if(memcmp(&grp->backend_addr[i].addr.sin_addr, &addr.sin_addr, sizeof(addr.sin_addr)) == 0
    && memcmp(&grp->backend_addr[i].addr.sin_port, &addr.sin_port, sizeof(addr.sin_port)) == 0)
    return 1;
    return 0;

=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.