On Wed, 2010-07-14 at 23:35 +0100, Andrew Beverley wrote: > > > In order to obtain mark information from the existing connection (using > > > libnetfilter_conntrack), I need to know the local and remote port > > > number, and the local and remote IP address of each connection. Most of > > > this information is in 'class fde', but not all of it. Is it available > > > elsewhere, or will I need to retrieve it myself? If so, is using > > > getsockopt() the best way of doing so? > > > > In Squid-3.1+ the above info should all be stored in fde via Ip::Address. > > Which holds the port paired with address, unless erased by some update. > > I'm using comm_local_port() to get the local port, remoteAddr() for the > remote IP address, and remote_port for the remote port. However, I'm > struggling with the local IP address. If I use local_addr I just get > [::] (localhost?), but I need the internet facing local IP address (as > per the connection tracking table). Any clues please?
All sorted. I'm using GetAddrInfo (passing getsockname the value of server_fd) for the local information and fde->ipaddr and fde->remote_port for the remote information. I'm successfully retrieving the mark on the incoming connection with these details. Thanks, Andy
