From: Andrew Deason Date: Tue, 7 Aug 2018 16:17:43 +0000 (-0500) Subject: Call rx_InitHost once during daemon startup X-Git-Tag: openafs-devel-1_9_0~430 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=78ed034603781a979687a45c08eb8b13e515e8bf Call rx_InitHost once during daemon startup Currently, a few daemons calls rx_InitHost in different places, and under different conditions. For example, vlserver calls rx_InitHost only when we -rxbind to a specific ip address, and then also makes an additional rx_Init call. Other daemons always call rx_InitHost, or just call rx_InitHost sometimes and don't make an extra rx_Init call. To try to make the various daemons behave a little more consistently, change the startup code to always call rx_InitHost, and to only call it once. Note that rx_InitHost is the same as calling rx_Init with INADDR_ANY as the ip address, and calling rx_Init* after a previous rx_Init* call is effectively a no-op. Change-Id: Ifd15175349a7b4695e684ca82deb8a8af5063073 Reviewed-on: https://gerrit.openafs.org/13271 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- diff --git a/src/bozo/bosserver.c b/src/bozo/bosserver.c index 547a3af..df38bd4 100644 --- a/src/bozo/bosserver.c +++ b/src/bozo/bosserver.c @@ -1153,11 +1153,7 @@ main(int argc, char **argv, char **envp) host = GetRxBindAddress(); } for (i = 0; i < 10; i++) { - if (rxBind) { - code = rx_InitHost(host, htons(AFSCONF_NANNYPORT)); - } else { - code = rx_Init(htons(AFSCONF_NANNYPORT)); - } + code = rx_InitHost(host, htons(AFSCONF_NANNYPORT)); if (code) { bozo_Log("can't initialize rx: code=%d\n", code); sleep(3); diff --git a/src/budb/server.c b/src/budb/server.c index 3a80918..99b8a57 100644 --- a/src/budb/server.c +++ b/src/budb/server.c @@ -531,10 +531,16 @@ main(int argc, char **argv) } if (ccode == 1) { host = SHostAddrs[0]; - rx_InitHost(host, htons(AFSCONF_BUDBPORT)); } } + code = rx_InitHost(host, htons(AFSCONF_BUDBPORT)); + if (code) { + LogError(code, "rx init failed\n"); + afs_com_err(whoami, code, "rx init failed"); + ERROR(code); + } + /* Disable jumbograms */ rx_SetNoJumbo(); diff --git a/src/kauth/kaserver.c b/src/kauth/kaserver.c index da824bc..d28c736 100644 --- a/src/kauth/kaserver.c +++ b/src/kauth/kaserver.c @@ -410,10 +410,15 @@ main(int argc, char *argv[]) } if (ccode == 1) { host = SHostAddrs[0]; - rx_InitHost(host, htons(AFSCONF_KAUTHPORT)); } } + code = rx_InitHost(host, htons(AFSCONF_KAUTHPORT)); + if (code) { + afs_com_err(whoami, code, "rx init failed"); + exit(2); + } + /* Disable jumbograms */ rx_SetNoJumbo(); diff --git a/src/ptserver/ptserver.c b/src/ptserver/ptserver.c index 2ab437d..63ed325 100644 --- a/src/ptserver/ptserver.c +++ b/src/ptserver/ptserver.c @@ -541,14 +541,15 @@ main(int argc, char **argv) } if (ccode == 1) { host = SHostAddrs[0]; - /* the following call is idempotent so if/when it gets called - * again by the ubik init stuff, it doesn't really matter - * -- klm - */ - rx_InitHost(host, htons(AFSCONF_PROTPORT)); } } + code = rx_InitHost(host, htons(AFSCONF_PROTPORT)); + if (code < 0) { + ViceLog(0, ("ptserver: Rx init failed: %d\n", code)); + PT_EXIT(1); + } + /* Disable jumbograms */ rx_SetNoJumbo(); diff --git a/src/vlserver/vlserver.c b/src/vlserver/vlserver.c index 08ecab9..ac6ef09 100644 --- a/src/vlserver/vlserver.c +++ b/src/vlserver/vlserver.c @@ -463,7 +463,6 @@ main(int argc, char **argv) } if (ccode == 1) { host = SHostAddrs[0]; - rx_InitHost(host, htons(AFSCONF_VLDBPORT)); } } @@ -477,7 +476,7 @@ main(int argc, char **argv) } } - code = rx_Init(htons(AFSCONF_VLDBPORT)); + code = rx_InitHost(host, htons(AFSCONF_VLDBPORT)); if (code < 0) { VLog(0, ("vlserver: Rx init failed: %d\n", code)); exit(1);