bozo: report bosserver -rxbind address
[openafs.git] / src / bozo / bosserver.c
index d8db010..7e448d5 100644 (file)
@@ -161,6 +161,8 @@ bozo_ReBozo(void)
        close(i);
     }
 
+    unlink(AFSDIR_SERVER_BOZRXBIND_FILEPATH);
+
     execv(argv[0], argv);      /* should not return */
     _exit(1);
 #endif /* AFS_NT40_ENV */
@@ -799,6 +801,34 @@ bozo_DeletePidFile(char *ainst, char *aname)
     return 0;
 }
 
+/**
+ * Create the rxbind file of this bosserver.
+ *
+ * @param host  bind address of this server
+ *
+ * @returns status
+ */
+void
+bozo_CreateRxBindFile(afs_uint32 host)
+{
+    char buffer[16];
+    FILE *fp;
+
+    if (host == htonl(INADDR_ANY)) {
+       host = htonl(0x7f000001);
+    }
+
+    afs_inet_ntoa_r(host, buffer);
+    bozo_Log("Listening on %s:%d\n", buffer, AFSCONF_NANNYPORT);
+    if ((fp = fopen(AFSDIR_SERVER_BOZRXBIND_FILEPATH, "w")) == NULL) {
+       bozo_Log("Unable to open rxbind address file: %s, code=%d\n",
+                AFSDIR_SERVER_BOZRXBIND_FILEPATH, errno);
+    } else {
+       fprintf(fp, "%s\n", buffer);
+       fclose(fp);
+    }
+}
+
 /* start a process and monitor it */
 
 #include "AFS_component_version_number.c"
@@ -1142,6 +1172,8 @@ main(int argc, char **argv, char **envp)
        exit(code);
     }
 
+    bozo_CreateRxBindFile(host);       /* for local scripts */
+
     /* opened the cell databse */
     bozo_confdir = tdir;