Re: SQUID: TCP Source Port Mapping Available?

From: Matthew <g2639@dont-contact.us>
Date: Wed, 26 Apr 2000 21:53:40 +0100 (BST)

i think its the comm.c module that handles socket connections in squid. I
was interested to find out how to pick u're own source port, so i tried
binding to a local (IN_ADDRANY) source port before connecting to a remote
port - and it worked (i checked using a sniffer).

you might already know this - but heres some code.

#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>

int main() {
   struct sockaddr_in me, him;
   int c;
   me.sin_addr.s_addr = INADDR_ANY;
   me.sin_port = htons(2000);
   me.sin_family = AF_INET;
   him.sin_addr.s_addr = inet_addr("192.168.0.3");
   him.sin_port = htons(139);
   him.sin_family = AF_INET;
   c = socket(AF_INET, SOCK_STREAM, 0);
   bind(c, (struct sockaddr *) &me, sizeof(struct sockaddr_in));
   connect(c, (struct sockaddr *) &him, sizeof(struct sockaddr_in));
   sleep(15);
   close(c);
   return 0;
}

On Thu, 27 Apr 2000, Dinesh wrote:

> Hi!
>
> Does Squid 2 (what else? :-)) support TCP source port mapping?
>
> I need Squid to map all connections from 3 subscribers with their
> network ranges (10.1/16) to (10.3/16)
> to a particular range in the source port number of the proxy's
> connection to the origin server on ther internet.
>
> Is the feature there? I do not think so. No squid options
> suggests this. But I would like the Squid Team to confirm it.
>
> Subscribers Proxy Internet
> IP PORT IP PORT
> S1 (10.1/16) 10.0.0.1:(2000-2999) to Internet:80
> S2 (10.1/16) 10.0.0.1:(3000-3999) to Internet:80
> S3 (10.1/16) 10.0.0.1:(4000-4999) to Internet:80
>
> If feature is not there:
>
> 0. Is this idea easily implementable in Squid 2?
> 1. What is the best way to implement this idea?
>
> Thanks.
>
> Dinesh
>
>
> Status: RO
> Content-Length: 769
> Lines: 27
>
>
Received on Wed Apr 26 2000 - 14:59:48 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:53:04 MST