Bug 210618 - Patch for port translation
Patch for port translation
Product: Red Hat Cluster Suite
Classification: Red Hat
Component: piranha (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Marek Grac
Cluster QE
Depends On:
  Show dependency treegraph
Reported: 2006-10-13 07:18 EDT by Jordi Prats
Modified: 2010-10-22 02:25 EDT (History)
3 users (show)

See Also:
Fixed In Version: RHBA-2008-0794
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-07-25 15:08:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
LVS port translation (14.91 KB, patch)
2006-10-13 07:18 EDT, Jordi Prats
no flags Details | Diff

  None (edit)
Description Jordi Prats 2006-10-13 07:18:24 EDT
Description of problem:


 - Adds a "port" option to real-server blocks in lvs.cf.  This value defaults
   to the virtual service port number if specified, and port 80 if neither are
   specified (this is the default as is currently in piranha).  This port value
   is passed to the "-r" argument for ipvsadm as called by nanny.

 - Adds the "-r" argument to nanny itself, similar to the already existing "-p"
   argument.  The manpage for nanny has been updated to reflect this usage.

 - The special token "%p" has been added to nanny's external check command syntax
   in order to utilize the specific real-server port number in
   external check commands with nanny.  Also see nanny manpage updates. 

Version-Release number of selected component (if applicable): 0.8.2
Comment 1 Jordi Prats 2006-10-13 07:18:24 EDT
Created attachment 138417 [details]
LVS port translation
Comment 5 Stanko Kupcevic 2007-01-11 11:08:25 EST
Patch in CVS
Comment 6 Brenton D. Rothchild 2007-02-26 16:58:03 EST
There are two errors in my original patch submitted by Jordi Prats and found by
Robert Hurst:

1) a log message spelling error
2) a missing update of rport to a log message

Relative to the 0.8.2 source + original patch provided on this bug, they are:

--- piranha-brenton/nanny.c     2006-10-10 08:19:06.000000000 -0500
+++ piranha-robert/nanny.c        2007-02-23 13:59:37.000000000 -0600
@@ -927,7 +927,7 @@
        if (expect_str != NULL) {
                 if (strcmp (expect_str, result) != 0) {
                         piranha_log (flags, (char *)
-                                    "Trouble. Recieved results are not what we
expected from (%s:%d)\n",
+                                    "Trouble. Received results are not what we
expected from (%s:%d)\n",
                                      inet_ntoa (*remoteAddr), rport);
                         res = 1;
                 } else {
@@ -1315,7 +1315,7 @@
                                 /* Failover Service */
                                 piranha_log (flags, (char *)
                                              "Remote service %s:%d is available",
-                                            inet_ntoa (*remoteAddr), port);
+                                            inet_ntoa (*remoteAddr), rport);
                         } else if (service_type == SERV_LVS) {
                                 /* Virtual Server */
                                 int newWeight;

Comment 8 Lon Hohberger 2007-05-10 18:09:14 EDT

So, this *will not work* in anything but NAT configurations.
Comment 9 Lon Hohberger 2007-05-10 18:10:16 EDT
From the ipvsadm man page:

       -r, --real-server server-address
              Real  server  that  an  associated  request  for  service may be
              assigned to.  The server-address is the host address of  a  real
              server, and may plus port. Host can be either a plain IP address
              or a hostname.  Port can be either a plain port  number  or  the
              service  name  of port.  In the case of the masquerading method,
              the host address is usually an RFC 1918 private IP address,  and
              the  port  can be different from that of the associated service.
              With the tunneling and direct  routing  methods,  port  must  be
              equal  to  that of the service address. For normal services, the
              port specified  in the service address will be used if  port  is
              not  specified.  For  fwmark  services,  port may be omitted, in
              which case  the destination port on the real server will be  the
              destination port of the request sent to the virtual service.
Comment 10 Jordi Prats 2007-05-11 02:17:37 EDT
Yes, It only works for NAT configurations. For Direct routing or ip tunnel
configurations you could set additional rules on the real servers to do port
Comment 15 errata-xmlrpc 2008-07-25 15:08:46 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.