Re: Specifying something other than lo0 for addr_space

Alex Rousskov <[email protected]>
Newsgroups gmane.comp.web.web-polygraph.user
Message-ID <[email protected]>
On Sun, 2006-04-23 at 01:33 -0700, Herbert Pfennig wrote:

> I am trying to configure addr_space in the polymix-4.pg bench to be something
> other than the loopback address (lo0). When the test starts, it says it created
> 250 total agent addresses, but in reality only creates two. 

With Herbert help, we have figured out what is going on.  Some versions
of some OSes require /32 subnets for aliases on public network
interfaces. Recent FreeBSD versions are an example.  While Polygraph
supports arbitrary subnets, the problem was that the PolyMix-4
addressing scheme had strict checks which prohibited such settings to
avoid a misconfiguration.

A patch that fixes the problem is attached. With this patch, Polygraph
warns but does not quit if an explicit subnet violates PolyMix-4 rules.

HTH,

Alex.
too-small-subnet.patch (text/x-patch, 1.8 KB)
Newer FreeBSD versions require (/32, /128) nmasks for aliases on public
interfaces. Warn, but do not quit if the explicit mask is too small.

Index: src/pgl/VerFourAsSym.cc
===================================================================
RCS file: /usr/local/CVS/polygraph/src/pgl/VerFourAsSym.cc,v
retrieving revision 1.5
diff -u -r1.5 VerFourAsSym.cc
--- src/pgl/VerFourAsSym.cc	9 Sep 2003 23:37:05 -0000	1.5
+++ src/pgl/VerFourAsSym.cc	17 May 2006 00:29:59 -0000
@@ -171,17 +171,24 @@
 int VerFourAsSym::addAddr(Array<PglNetAddrRange*> &ranges, const NetAddrSym &addr, int subnet) const {
 	NetAddrSym *clone = (NetAddrSym*)addr.clone();
 	int explicitSubnet = -1;
-	// note: newer FreeBSD versions may require (/32, /128) nmasks for aliases
 	if (!clone->subnet(explicitSubnet))
 		clone->setSubnet(subnet);
 	else
 	if (explicitSubnet <= subnet) // XXX: this logic is not IPv6-aware
 		subnet = explicitSubnet;
 	else {
-		cerr << addr.loc() << "error: the explicit subnet of the " << addr
-			<< " address (/" << explicitSubnet << ") is 'smaller' than"
-			<< " minimal subnet required to accomodate all agent addresses"
-			<< " on one host (/" << subnet << ")" << endl << xexit;
+		// Newer FreeBSD versions require (/32, /128) nmasks for aliases.
+		// Warn, but do not quit.
+		const int currentHash = explicitSubnet ^ subnet;
+		static int warnLessHash = ~currentHash; // initialized once
+		if (currentHash != warnLessHash) {
+			warnLessHash = currentHash;
+			clog << addr.loc() << "warning: the explicit subnet of the " << 
+				addr << " address (/" << explicitSubnet << ") is 'smaller' " <<
+				"than minimal subnet required to accomodate all agent " <<
+				"addresses on one host (/" << subnet << "). Whether this " <<
+				"is OK depends on your environment." << endl;
+		}
 	}
 
 	PglNetAddrRange r;
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.