mirror of
https://git.openafs.org/openafs.git
synced 2025-01-22 17:00:15 +00:00
bozo: report bosserver -rxbind address
Create a file on bosserver startup called bosserver.rxbind in the server local directory which contains an address local scripts may use to contact the bosserver. When bosserver is started with the -rxbind option, write the address selected from the intersection of the interfaces, NetInfo, and NetRestrict configuration to the bosserver.rxbind file, otherwise write the loopback address 127.0.0.1. Update the RedHat init script to use the new bosserver.rxbind file. Change-Id: I00a4249ae7445f872625ec46f960e778483d1f9f Reviewed-on: http://gerrit.openafs.org/5488 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
4a0d8cc24e
commit
9133aa6ed3
@ -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;
|
||||
|
||||
|
@ -34,7 +34,14 @@ stop() {
|
||||
echo
|
||||
return 1
|
||||
fi
|
||||
/usr/bin/bos shutdown localhost -wait -localauth
|
||||
if [ "x$BOSSERVER_HOST" = "x" ] ; then
|
||||
if [ -f /usr/afs/local/bosserver.rxbind ] ; then
|
||||
BOSSERVER_HOST=`cat /usr/afs/local/bosserver.rxbind`
|
||||
else
|
||||
BOSSERVER_HOST="localhost"
|
||||
fi
|
||||
fi
|
||||
/usr/bin/bos shutdown $BOSSERVER_HOST -wait -localauth
|
||||
RETVAL=$?
|
||||
if [ $RETVAL -ne 0 ] ; then
|
||||
echo -n $"failed to shutdown OpenAFS"
|
||||
@ -46,6 +53,7 @@ stop() {
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/openafs-server
|
||||
[ $RETVAL -eq 0 ] && rm -f /usr/afs/local/bosserver.rxbind
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
|
@ -331,6 +331,9 @@ initDirPathArray(void)
|
||||
pathp = dirPathArray[AFSDIR_SERVER_BOZINIT_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_BOSCONFIG_DIR, AFSDIR_BOZINIT_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_BOZRXBIND_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_BOSCONFIG_DIR, AFSDIR_BOZRXBIND_FILE);
|
||||
|
||||
pathp = dirPathArray[AFSDIR_SERVER_BOSVR_FILEPATH_ID];
|
||||
AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_BOSSERVER_DIR, AFSDIR_BOSVR_FILE);
|
||||
|
||||
|
@ -145,6 +145,7 @@ ConstructLocalLogPath(const char *cpath,
|
||||
#define AFSDIR_BOZCONFNEW_FILE "BosConfig.new"
|
||||
#define AFSDIR_BOZINIT_FILE "BozoInit"
|
||||
#define AFSDIR_BOZLOG_FILE "BosLog"
|
||||
#define AFSDIR_BOZRXBIND_FILE "bosserver.rxbind"
|
||||
#define AFSDIR_BOSVR_FILE "bosserver"
|
||||
#define AFSDIR_VOLSERLOG_FILE "VolserLog"
|
||||
#define AFSDIR_AUDIT_FILE "Audit"
|
||||
@ -254,6 +255,7 @@ typedef enum afsdir_id {
|
||||
AFSDIR_SERVER_BOZCONFNEW_FILEPATH_ID,
|
||||
AFSDIR_SERVER_BOZINIT_FILEPATH_ID,
|
||||
AFSDIR_SERVER_BOZLOG_FILEPATH_ID,
|
||||
AFSDIR_SERVER_BOZRXBIND_FILEPATH_ID,
|
||||
AFSDIR_SERVER_BOSVR_FILEPATH_ID,
|
||||
AFSDIR_SERVER_SLVGLOCK_FILEPATH_ID,
|
||||
AFSDIR_SERVER_VOLSERLOG_FILEPATH_ID,
|
||||
@ -335,6 +337,7 @@ const char *getDirPath(afsdir_id_t string_id);
|
||||
#define AFSDIR_SERVER_BOZCONFNEW_FILEPATH getDirPath(AFSDIR_SERVER_BOZCONFNEW_FILEPATH_ID)
|
||||
#define AFSDIR_SERVER_BOZINIT_FILEPATH getDirPath(AFSDIR_SERVER_BOZINIT_FILEPATH_ID)
|
||||
#define AFSDIR_SERVER_BOZLOG_FILEPATH getDirPath(AFSDIR_SERVER_BOZLOG_FILEPATH_ID)
|
||||
#define AFSDIR_SERVER_BOZRXBIND_FILEPATH getDirPath(AFSDIR_SERVER_BOZRXBIND_FILEPATH_ID)
|
||||
#define AFSDIR_SERVER_BOSVR_FILEPATH getDirPath(AFSDIR_SERVER_BOSVR_FILEPATH_ID)
|
||||
#define AFSDIR_SERVER_SLVGLOCK_FILEPATH getDirPath(AFSDIR_SERVER_SLVGLOCK_FILEPATH_ID)
|
||||
#define AFSDIR_SERVER_VOLSERLOG_FILEPATH getDirPath(AFSDIR_SERVER_VOLSERLOG_FILEPATH_ID)
|
||||
|
@ -135,6 +135,7 @@ extern int
|
||||
#define AFSDIR_BOZCONFNEW_FILE "BosConfig.new"
|
||||
#define AFSDIR_BOZINIT_FILE "BozoInit"
|
||||
#define AFSDIR_BOZLOG_FILE "BosLog"
|
||||
#define AFSDIR_BOZRXBIND_FILE "bosserver.rxbind"
|
||||
#define AFSDIR_BOSVR_FILE "bosserver"
|
||||
#define AFSDIR_VOLSERLOG_FILE "VolserLog"
|
||||
#define AFSDIR_AUDIT_FILE "Audit"
|
||||
@ -246,6 +247,7 @@ typedef enum afsdir_id {
|
||||
AFSDIR_SERVER_BOZCONFNEW_FILEPATH_ID,
|
||||
AFSDIR_SERVER_BOZINIT_FILEPATH_ID,
|
||||
AFSDIR_SERVER_BOZLOG_FILEPATH_ID,
|
||||
AFSDIR_SERVER_BOZRXBIND_FILEPATH_ID,
|
||||
AFSDIR_SERVER_BOSVR_FILEPATH_ID,
|
||||
AFSDIR_SERVER_SLVGLOCK_FILEPATH_ID,
|
||||
AFSDIR_SERVER_VOLSERLOG_FILEPATH_ID,
|
||||
@ -327,6 +329,7 @@ const char *getDirPath(afsdir_id_t string_id);
|
||||
#define AFSDIR_SERVER_BOZCONFNEW_FILEPATH getDirPath(AFSDIR_SERVER_BOZCONFNEW_FILEPATH_ID)
|
||||
#define AFSDIR_SERVER_BOZINIT_FILEPATH getDirPath(AFSDIR_SERVER_BOZINIT_FILEPATH_ID)
|
||||
#define AFSDIR_SERVER_BOZLOG_FILEPATH getDirPath(AFSDIR_SERVER_BOZLOG_FILEPATH_ID)
|
||||
#define AFSDIR_SERVER_BOZRXBIND_FILEPATH getDirPath(AFSDIR_SERVER_BOZRXBIND_FILEPATH_ID)
|
||||
#define AFSDIR_SERVER_BOSVR_FILEPATH getDirPath(AFSDIR_SERVER_BOSVR_FILEPATH_ID)
|
||||
#define AFSDIR_SERVER_SLVGLOCK_FILEPATH getDirPath(AFSDIR_SERVER_SLVGLOCK_FILEPATH_ID)
|
||||
#define AFSDIR_SERVER_VOLSERLOG_FILEPATH getDirPath(AFSDIR_SERVER_VOLSERLOG_FILEPATH_ID)
|
||||
|
Loading…
Reference in New Issue
Block a user