LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

How to get VIP in a c program from LVS_NAT

To: "'lvs-users@xxxxxxxxxxxxxxxxxxxxxx'" <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: How to get VIP in a c program from LVS_NAT
From: Jeremy Kusnetz <JKusnetz@xxxxxxxx>
Date: Tue, 14 Oct 2003 15:45:20 -0400
Hello,

I would like to make a patch to a program that sets up environment variables
based on the connecting host's remote ip and the local ip.  The local ip
gives me the IP address of the realserver.  Is it possible to find out what
the VIP the remote host is really connecting to?

For example I have a remote host (1.2.3.4) which connects to a VIP (4.3.2.1)
on the director and gets NATed to my program listening on (10.1.1.1) on the
realserver.

The program current will set:
TCPREMOTEIP to 1.2.3.4
TCPLOCALIP to 10.1.1.1

I would like to set
TCPVIRTUALIP to 4.3.2.1

Some code snipets from the program:

  socket_local4(t,localip,&localport);
  socket_accept4(s,remoteip,&remoteport);

  localipstr[ip4_fmt(localipstr,localip)] = 0;
  remoteipstr[ip4_fmt(remoteipstr,remoteip)] = 0;

  env("TCPLOCALIP",localipstr);
  env("TCPREMOTEIP",remoteipstr);

Any tips and pointers would be of great use!
<Prev in Thread] Current Thread [Next in Thread>