[OpenAFS-devel] patch: make bozo honor -rxbind (correctly)

Adam Megacz megacz@cs.berkeley.edu
Fri, 23 Mar 2007 12:14:41 -0700


Bozo needs to call rxInitHost() rather than rxInit() when -rxbind is
present.  This patch causes it to read NetInfo/NetRestrict earlier in
the startup process so it can make that decision.

  /afs/megacz.com/debian/patches/openafs/1.4.4/openafs-bozo-obey-rxbind-patch

BTW, with this patch on 1.4.4 I have finally achieved my goal of
running two OpenAFS cells off of the same machine without any kernel
patches.  Previously I had to use linux's vserver to clobber them into
binding to different addresses.  Big thanks also to whomever added the
volserver-fileserver-via-domain-socket patch; that was crucial too.

  - a


--- openafs-1.4.4/src/bozo/bosserver.c	2007-03-23 03:44:03.000000000 -0700
+++ openafs-1.4.4/src/bozo/bosserver.c	2006-12-21 15:15:35.000000000 -0800
@@ -953,36 +953,13 @@
     /* Write current state of directory permissions to log file */
     DirAccessOK();
 
-    if (rxBind) {
-	afs_int32 ccode;
-#ifndef AFS_NT40_ENV
-        if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || 
-            AFSDIR_SERVER_NETINFO_FILEPATH) {
-            char reason[1024];
-            ccode = parseNetFiles(SHostAddrs, NULL, NULL,
-                                           ADDRSPERSITE, reason,
-                                           AFSDIR_SERVER_NETINFO_FILEPATH,
-                                           AFSDIR_SERVER_NETRESTRICT_FILEPATH);
-        } else 
-#endif	
-	{
-            ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
-        }
-        if (ccode == 1) 
-            host = SHostAddrs[0];
-    }
-
     for (i = 0; i < 10; i++) {
-      if (rxBind) {
-        code = rx_InitHost(host, htons(AFSCONF_NANNYPORT));
-      } else {
-        code = rx_Init(htons(AFSCONF_NANNYPORT));
-      }
-      if (code) {
-        bozo_Log("can't initialize rx: code=%d\n", code);
-        sleep(3);
-      } else
-        break;
+	code = rx_Init(htons(AFSCONF_NANNYPORT));
+	if (code) {
+	    bozo_Log("can't initialize rx: code=%d\n", code);
+	    sleep(3);
+	} else
+	    break;
     }
     if (i >= 10) {
 	bozo_Log("Bos giving up, can't initialize rx\n");
@@ -1059,6 +1036,25 @@
 	rx_SetMaxMTU(rxMaxMTU);
     }
 
+    if (rxBind) {
+	afs_int32 ccode;
+#ifndef AFS_NT40_ENV
+        if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || 
+            AFSDIR_SERVER_NETINFO_FILEPATH) {
+            char reason[1024];
+            ccode = parseNetFiles(SHostAddrs, NULL, NULL,
+                                           ADDRSPERSITE, reason,
+                                           AFSDIR_SERVER_NETINFO_FILEPATH,
+                                           AFSDIR_SERVER_NETRESTRICT_FILEPATH);
+        } else 
+#endif	
+	{
+            ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
+        }
+        if (ccode == 1) 
+            host = SHostAddrs[0];
+    }
+
     tservice = rx_NewServiceHost(host,  /* port */ 0, /* service id */ 1,
 			     /*service name */ "bozo",
 			     /* security classes */