rxbind-for-servers-20060612

FIXES 32308

support -rxbind switch for servers
This commit is contained in:
Derrick Brashear 2006-06-13 01:28:48 +00:00
parent 33418253e0
commit 592d97f947
13 changed files with 319 additions and 73 deletions

View File

@ -71,6 +71,11 @@ static afs_int32 nextDay;
struct ktime bozo_nextRestartKT, bozo_nextDayKT;
int bozo_newKTs;
int rxBind = 0;
#define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
afs_uint32 SHostAddrs[ADDRSPERSITE];
#ifdef BOS_RESTRICTED_MODE
int bozo_isrestricted = 0;
int bozo_restdisable = 0;
@ -719,6 +724,7 @@ main(int argc, char **argv, char **envp)
int i;
char namebuf[AFSDIR_PATH_MAX];
int rxMaxMTU = -1;
afs_uint32 host = htonl(INADDR_ANY);
#ifndef AFS_NT40_ENV
int nofork = 0;
struct stat sb;
@ -813,6 +819,9 @@ main(int argc, char **argv, char **envp)
bozo_isrestricted = 1;
}
#endif
else if (strcmp(argv[code], "-rxbind") == 0) {
rxBind = 1;
}
else if (!strcmp(argv[i], "-rxmaxmtu")) {
if ((i + 1) >= argc) {
fprintf(stderr, "missing argument for -rxmaxmtu\n");
@ -864,14 +873,14 @@ main(int argc, char **argv, char **envp)
#ifndef AFS_NT40_ENV
printf("Usage: bosserver [-noauth] [-log] "
"[-auditlog <log path>] "
"[-rxmaxmtu <bytes>] "
"[-rxmaxmtu <bytes>] [-rxbind] "
"[-syslog[=FACILITY]] "
"[-enable_peer_stats] [-enable_process_stats] "
"[-nofork] " "[-help]\n");
#else
printf("Usage: bosserver [-noauth] [-log] "
"[-auditlog <log path>] "
"[-rxmaxmtu <bytes>] "
"[-rxmaxmtu <bytes>] [-rxbind] "
"[-enable_peer_stats] [-enable_process_stats] "
"[-help]\n");
#endif
@ -1028,7 +1037,23 @@ main(int argc, char **argv, char **envp)
rx_SetMaxMTU(rxMaxMTU);
}
tservice = rx_NewService( /* port */ 0, /* service id */ 1,
if (rxBind) {
afs_int32 ccode;
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 {
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 */
bozo_rxsc,
@ -1038,8 +1063,8 @@ main(int argc, char **argv, char **envp)
rx_SetStackSize(tservice, BOZO_LWP_STACKSIZE); /* so gethostbyname works (in cell stuff) */
tservice =
rx_NewService(0, RX_STATS_SERVICE_ID, "rpcstats", bozo_rxsc, 3,
RXSTATS_ExecuteRequest);
rx_NewServiceHost(host, 0, RX_STATS_SERVICE_ID, "rpcstats", bozo_rxsc,
3, RXSTATS_ExecuteRequest);
rx_SetMinProcs(tservice, 2);
rx_SetMaxProcs(tservice, 4);
rx_StartServer(1); /* donate this process */

View File

@ -76,6 +76,11 @@ char dbDir[AFSDIR_PATH_MAX], cellConfDir[AFSDIR_PATH_MAX];
/* debugging control */
int debugging = 0;
int rxBind = 0;
#define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
afs_uint32 SHostAddrs[ADDRSPERSITE];
#if defined(AFS_PTHREAD_ENV)
char *
threadNum(void)
@ -357,11 +362,10 @@ main(argc, argv)
struct afsconf_cell cellinfo;
time_t currentTime;
afs_int32 code = 0;
afs_uint32 host = ntohl(INADDR_ANY);
char clones[MAXHOSTSPERCELL];
struct rx_service *tservice;
struct rx_securityClass *sca[3];
@ -517,6 +521,24 @@ main(argc, argv)
rx_SetRxDeadTime(60); /* 60 seconds inactive before timeout */
if (rxBind) {
afs_int32 ccode;
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 {
ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
}
if (ccode == 1) {
host = SHostAddrs[0];
rx_InitHost(host, htons(AFSCONF_BUDBPORT));
}
}
code = ubik_ServerInitByInfo (globalConfPtr->myHost,
htons(AFSCONF_BUDBPORT),
&cellinfo,
@ -540,7 +562,7 @@ main(argc, argv)
rx_SetNoJumbo();
tservice =
rx_NewService(0, BUDB_SERVICE, "BackupDatabase", sca, 3,
rx_NewServiceHost(host, 0, BUDB_SERVICE, "BackupDatabase", sca, 3,
BUDB_ExecuteRequest);
if (tservice == (struct rx_service *)0) {
LogError(0, "Could not create backup database rx service\n");

View File

@ -106,6 +106,10 @@ afs_int32 statusSize;
afs_int32 BufferSize; /* Size in B stored for data */
char *centralLogFile;
afs_int32 lastLog; /* Log last pass info */
int rxBind = 0;
#define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
afs_uint32 SHostAddrs[ADDRSPERSITE];
/* dummy routine for the audit work. It should do nothing since audits */
/* occur at the server level and bos is not a server. */
@ -857,6 +861,7 @@ WorkerBee(as, arock)
PROCESS dbWatcherPid;
#endif
time_t t;
afs_uint32 host = htonl(INADDR_ANY);
debugLevel = 0;
@ -1039,8 +1044,25 @@ WorkerBee(as, arock)
autoQuery = 0;
localauth = (as->parms[5].items ? 1 : 0);
rxBind = (as->parms[8].items ? 1 : 0);
code = rx_Init(htons(BC_TAPEPORT + portOffset));
if (rxBind) {
afs_int32 ccode;
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 {
ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
}
if (ccode == 1)
host = SHostAddrs[0];
}
code = rx_InitHost(host, htons(BC_TAPEPORT + portOffset));
if (code) {
TapeLog(0, 0, code, 0, "rx init failed on port %u\n",
BC_TAPEPORT + portOffset);
@ -1080,7 +1102,7 @@ WorkerBee(as, arock)
}
service =
rx_NewService(0, 1, "BUTC", securityObjects, 3, TC_ExecuteRequest);
rx_NewServiceHost, (host, 0, 1, "BUTC", securityObjects, 3, TC_ExecuteRequest);
if (!service) {
TLog(0, "rx_NewService");
exit(1);
@ -1183,6 +1205,8 @@ main(argc, argv)
"file to restore to");
cmd_AddParm(ts, "-xbsaforcemultiple", CMD_FLAG, (CMD_OPTIONAL | CMD_HIDE),
"Force multiple XBSA server support");
cmd_AddParm(ts, "-rxbind", CMD_FLAG, CMD_OPTIONAL,
"bind Rx socket");
/* Initialize dirpaths */
if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) {

View File

@ -59,6 +59,10 @@ struct ubik_dbase *KA_dbase;
afs_int32 myHost = 0;
afs_int32 verbose_track = 1;
afs_int32 krb4_cross = 0;
afs_int32 rxBind = 0;
#define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
afs_uint32 SHostAddrs[ADDRSPERSITE];
struct afsconf_dir *KA_conf; /* for getting cell info */
@ -168,6 +172,7 @@ main(argc, argv)
int level; /* security level for Ubik */
afs_int32 i;
char clones[MAXHOSTSPERCELL];
afs_uint32 host = ntohl(INADDR_ANY);
struct rx_service *tservice;
struct rx_securityClass *sca[1];
@ -203,7 +208,7 @@ main(argc, argv)
if (argc == 0) {
usage:
printf("Usage: kaserver [-noAuth] [-fastKeys] [-database <dbpath>] "
"[-auditlog <log path>] "
"[-auditlog <log path>] [-rxbind] "
"[-localfiles <lclpath>] [-minhours <n>] [-servers <serverlist>] "
"[-crossrealm]"
/*" [-enable_peer_stats] [-enable_process_stats] " */
@ -305,6 +310,8 @@ main(argc, argv)
verbose_track = 0;
else if (IsArg("-crossrealm"))
krb4_cross = 1;
else if (IsArg("-rxbind"))
rxBind = 1;
else if (IsArg("-minhours")) {
MinHours = atoi(argv[++a]);
} else if (IsArg("-enable_peer_stats")) {
@ -377,6 +384,25 @@ main(argc, argv)
ubik_CheckRXSecurityRock = (char *)KA_conf;
ubik_nBuffers = 80;
if (rxBind) {
afs_int32 ccode;
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 {
ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
}
if (ccode == 1) {
host = SHostAddrs[0];
rx_InitHost(host, htons(AFSCONF_KAUTHPORT));
}
}
if (servers)
code =
ubik_ServerInit(myHost, htons(AFSCONF_KAUTHPORT), serverList,
@ -397,8 +423,8 @@ main(argc, argv)
rx_SetNoJumbo();
tservice =
rx_NewService(0, KA_AUTHENTICATION_SERVICE, "AuthenticationService",
sca, 1, KAA_ExecuteRequest);
rx_NewServiceHost(host, 0, KA_AUTHENTICATION_SERVICE,
"AuthenticationService", sca, 1, KAA_ExecuteRequest);
if (tservice == (struct rx_service *)0) {
ViceLog(0, ("Could not create Authentication rx service\n"));
exit(3);
@ -406,8 +432,9 @@ main(argc, argv)
rx_SetMinProcs(tservice, 1);
rx_SetMaxProcs(tservice, 1);
tservice =
rx_NewService(0, KA_TICKET_GRANTING_SERVICE, "TicketGrantingService",
rx_NewServiceHost(host, 0, KA_TICKET_GRANTING_SERVICE, "TicketGrantingService",
sca, 1, KAT_ExecuteRequest);
if (tservice == (struct rx_service *)0) {
ViceLog(0, ("Could not create Ticket Granting rx service\n"));
@ -421,7 +448,7 @@ main(argc, argv)
scm[RX_SCINDEX_KAD] =
rxkad_NewServerSecurityObject(rxkad_crypt, 0, kvno_admin_key, 0);
tservice =
rx_NewService(0, KA_MAINTENANCE_SERVICE, "Maintenance", scm, 3,
rx_NewServiceHost(host, 0, KA_MAINTENANCE_SERVICE, "Maintenance", scm, 3,
KAM_ExecuteRequest);
if (tservice == (struct rx_service *)0) {
ViceLog(0, ("Could not create Maintenance rx service\n"));
@ -432,7 +459,7 @@ main(argc, argv)
rx_SetStackSize(tservice, 10000);
tservice =
rx_NewService(0, RX_STATS_SERVICE_ID, "rpcstats", scm, 3,
rx_NewServiceHost(host, 0, RX_STATS_SERVICE_ID, "rpcstats", scm, 3,
RXSTATS_ExecuteRequest);
if (tservice == (struct rx_service *)0) {
ViceLog(0, ("Could not create rpc stats rx service\n"));

View File

@ -167,6 +167,10 @@ char *pr_realmName;
int restricted = 0;
int rxMaxMTU = -1;
int rxBind = 0;
#define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
afs_uint32 SHostAddrs[ADDRSPERSITE];
static struct afsconf_cell info;
@ -222,6 +226,7 @@ main(int argc, char **argv)
int kerberosKeys; /* set if found some keys */
int lwps = 3;
char clones[MAXHOSTSPERCELL];
afs_uint32 host = htonl(INADDR_ANY);
const char *pr_dbaseName;
char *whoami = "ptserver";
@ -305,6 +310,9 @@ main(int argc, char **argv)
else if (strncmp(arg, "-restricted", alen) == 0) {
restricted = 1;
}
else if (strncmp(arg, "-rxbind", alen) == 0) {
rxBind = 1;
}
else if (strncmp(arg, "-enable_peer_stats", alen) == 0) {
rx_enablePeerRPCStats();
} else if (strncmp(arg, "-enable_process_stats", alen) == 0) {
@ -374,16 +382,16 @@ main(int argc, char **argv)
"[-syslog[=FACILITY]] "
"[-p <number of processes>] [-rebuild] "
"[-groupdepth <depth>] "
"[-restricted] [-rxmaxmtu <bytes>]"
"[-restricted] [-rxmaxmtu <bytes>] [-rxbind] "
"[-enable_peer_stats] [-enable_process_stats] "
"[-default_access default_user_access default_group_access] "
"[-help]\n");
#else /* AFS_NT40_ENV */
printf("Usage: ptserver [-database <db path>] "
"[-auditlog <log path>] "
"[-p <number of processes>] [-rebuild] "
"[-p <number of processes>] [-rebuild] [-rxbind] "
"[-default_access default_user_access default_group_access] "
"[-restricted] [-rxmaxmtu <bytes>]"
"[-restricted] [-rxmaxmtu <bytes>] [-rxbind] "
"[-groupdepth <depth>] " "[-help]\n");
#endif
#else
@ -394,13 +402,13 @@ main(int argc, char **argv)
"[-p <number of processes>] [-rebuild] "
"[-enable_peer_stats] [-enable_process_stats] "
"[-default_access default_user_access default_group_access] "
"[-restricted] [-rxmaxmtu <bytes>]"
"[-restricted] [-rxmaxmtu <bytes>] [-rxbind] "
"[-help]\n");
#else /* AFS_NT40_ENV */
printf("Usage: ptserver [-database <db path>] "
"[-auditlog <log path>] "
"[-default_access default_user_access default_group_access] "
"[-restricted] [-rxmaxmtu <bytes>]"
"[-restricted] [-rxmaxmtu <bytes>] [-rxbind] "
"[-p <number of processes>] [-rebuild] " "[-help]\n");
#endif
#endif
@ -493,6 +501,25 @@ main(int argc, char **argv)
* and the header are in separate Ubik buffers then 120 buffers may be
* required. */
ubik_nBuffers = 120 + /*fudge */ 40;
if (rxBind) {
afs_int32 ccode;
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 {
ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
}
if (ccode == 1) {
host = SHostAddrs[0];
rx_InitHost(host, htons(AFSCONF_PROTPORT));
}
}
code =
ubik_ServerInitByInfo(myHost, htons(AFSCONF_PROTPORT), &info, &clones,
pr_dbaseName, &dbase);
@ -519,7 +546,7 @@ main(int argc, char **argv)
}
tservice =
rx_NewService(0, PRSRV, "Protection Server", sc, 3,
rx_NewServiceHost(host, 0, PRSRV, "Protection Server", sc, 3,
PR_ExecuteRequest);
if (tservice == (struct rx_service *)0) {
fprintf(stderr, "ptserver: Could not create new rx service.\n");
@ -529,7 +556,7 @@ main(int argc, char **argv)
rx_SetMaxProcs(tservice, lwps);
tservice =
rx_NewService(0, RX_STATS_SERVICE_ID, "rpcstats", sc, 3,
rx_NewServiceHost(host, 0, RX_STATS_SERVICE_ID, "rpcstats", sc, 3,
RXSTATS_ExecuteRequest);
if (tservice == (struct rx_service *)0) {
fprintf(stderr, "ptserver: Could not create new rx service.\n");

View File

@ -1361,9 +1361,10 @@ rxi_SetCallNumberVector(register struct rx_connection *aconn,
service name might be used for probing for
statistics) */
struct rx_service *
rx_NewService(u_short port, u_short serviceId, char *serviceName,
struct rx_securityClass **securityObjects, int nSecurityObjects,
afs_int32(*serviceProc) (struct rx_call * acall))
rx_NewServiceHost(afs_uint32 host, u_short port, u_short serviceId,
char *serviceName, struct rx_securityClass **securityObjects,
int nSecurityObjects,
afs_int32(*serviceProc) (struct rx_call * acall))
{
osi_socket socket = OSI_NULLSOCKET;
register struct rx_service *tservice;
@ -1394,7 +1395,7 @@ rx_NewService(u_short port, u_short serviceId, char *serviceName,
for (i = 0; i < RX_MAX_SERVICES; i++) {
register struct rx_service *service = rx_services[i];
if (service) {
if (port == service->servicePort) {
if (port == service->servicePort && host == service->serviceHost) {
if (service->serviceId == serviceId) {
/* The identical service has already been
* installed; if the caller was intending to
@ -1435,6 +1436,7 @@ rx_NewService(u_short port, u_short serviceId, char *serviceName,
service = tservice;
service->magic = MAGIC_RXSVC;
service->socket = socket;
service->serviceHost = host;
service->servicePort = port;
service->serviceId = serviceId;
service->serviceName = serviceName;
@ -1458,6 +1460,14 @@ rx_NewService(u_short port, u_short serviceId, char *serviceName,
return 0;
}
struct rx_service *
rx_NewService(u_short port, u_short serviceId, char *serviceName,
struct rx_securityClass **securityObjects, int nSecurityObjects,
afs_int32(*serviceProc) (struct rx_call * acall))
{
return rx_NewServiceHost(htonl(INADDR_ANY), port, serviceId, serviceName, securityObjects, nSecurityObjects, serviceProc);
}
/* Generic request processing loop. This routine should be called
* by the implementation dependent rx_ServerProc. If socketp is
* non-null, it will be set to the file descriptor that this thread

View File

@ -310,6 +310,7 @@ struct rx_connection {
struct rx_service {
int magic;
u_short serviceId; /* Service number */
afs_uint32 serviceHost; /* IP address for this service */
u_short servicePort; /* UDP port for this service */
char *serviceName; /* Name of the service */
osi_socket socket; /* socket structure or file descriptor */

View File

@ -53,6 +53,15 @@ extern struct rx_service *rx_NewService(u_short port, u_short serviceId,
afs_int32(*serviceProc) (struct
rx_call *
acall));
extern struct rx_service *rx_NewServiceHost(afs_uint32 host, u_short port,
u_short serviceId,
char *serviceName,
struct rx_securityClass
**securityObjects,
int nSecurityObjects,
afs_int32(*serviceProc) (struct
rx_call *
acall));
extern void rxi_ServerProc(int threadID, struct rx_call *newcall,
osi_socket * socketp);
extern void rx_WakeupServerProcs(void);

View File

@ -240,6 +240,8 @@ ubik_ServerInitCommon(afs_int32 myHost, short myPort,
ubik_sc[secIndex] = secClass;
}
}
/* for backwards compat this should keep working as it does now
and not host bind */
code = rx_Init(myPort);
if (code < 0)
return code;

View File

@ -69,6 +69,11 @@ char *whoami;
static int Quit();
int rxBind = 0;
#define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
afs_uint32 SHostAddrs[ADDRSPERSITE];
/* check whether caller is authorized to manage RX statistics */
int
update_rxstat_userok(struct rx_call *call)
@ -183,6 +188,7 @@ main(int argc, char *argv[])
{
struct rx_securityClass *securityObjects[3];
struct rx_service *service;
afs_uint32 host = htonl(INADDR_ANY);
int a = 0;
rxkad_level level;
@ -234,15 +240,20 @@ main(int argc, char *argv[])
for (a = 1; a < argc; a++) {
if (argv[a][0] == '-') { /* parse options */
char arg[256];
lcstring(arg, argv[a], sizeof(arg));
newLevel = rxkad_StringToLevel(&argv[a][1]);
if (newLevel != -1) {
level = newLevel; /* set new level */
if (strcmp(argv[a], "-rxbind") == 0) {
rxBind = 1;
continue;
} else {
char arg[256];
lcstring(arg, argv[a], sizeof(arg));
newLevel = rxkad_StringToLevel(&argv[a][1]);
if (newLevel != -1) {
level = newLevel; /* set new level */
continue;
}
}
usage:
Quit("Usage: upserver [<directory>+] [-crypt <directory>+] [-clear <directory>+] [-auth <directory>+] [-help]\n");
Quit("Usage: upserver [<directory>+] [-crypt <directory>+] [-clear <directory>+] [-auth <directory>+] [-rxbind] [-help]\n");
} else {
int dirlen;
if (nDirs >= sizeof(dirName) / sizeof(dirName[0]))
@ -270,9 +281,25 @@ main(int argc, char *argv[])
exit(1);
}
if (rxBind) {
afs_int32 ccode;
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 {
ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
}
if (ccode == 1)
host = SHostAddrs[0];
}
/* Initialize Rx, telling it port number this server will use for its
* single service */
if (rx_Init(htons(AFSCONF_UPDATEPORT)) < 0)
if (rx_InitHost(host, htons(AFSCONF_UPDATEPORT)) < 0)
Quit("rx_init");
/* Create a single security object, in this case the null security object,
@ -296,8 +323,8 @@ main(int argc, char *argv[])
* which is called to decode requests is passed in here
* (UPDATE_ExecuteRequest). */
service =
rx_NewService(0, UPDATE_SERVICEID, "UPDATE", securityObjects, 3,
UPDATE_ExecuteRequest);
rx_NewServiceHost(host, 0, UPDATE_SERVICEID, "UPDATE", securityObjects,
3, UPDATE_ExecuteRequest);
if (service == (struct rx_service *)0)
Quit("rx_NewService");
rx_SetMaxProcs(service, 2);

View File

@ -172,6 +172,7 @@ int SawPctSpare;
int debuglevel = 0;
int printBanner = 0;
int rxJumbograms = 1; /* default is to send and receive jumbograms. */
int rxBind = 0; /* don't bind */
int rxMaxMTU = -1;
afs_int32 implicitAdminRights = PRSFS_LOOKUP; /* The ADMINISTER right is
* already implied */
@ -889,6 +890,7 @@ FlagMsg()
strcat(buffer, "[-rxdbg (enable rx debugging)] ");
strcat(buffer, "[-rxdbge (enable rxevent debugging)] ");
strcat(buffer, "[-rxmaxmtu <bytes>] ");
strcat(buffer, "[-rxbind (bind the Rx socket to one address)] ");
#ifdef AFS_DEMAND_ATTACH_FS
strcat(buffer, "[-fs-state-dont-save (disable state save during shutdown)] ");
strcat(buffer, "[-fs-state-dont-restore (disable state restore during startup)] ");
@ -1266,6 +1268,8 @@ ParseArgs(int argc, char *argv[])
#endif
else if (!strcmp(argv[i], "-nojumbo")) {
rxJumbograms = 0;
} else if (!strcmp(argv[i], "-rxbind")) {
rxBind = 1;
} else if (!strcmp(argv[i], "-rxmaxmtu")) {
if ((i + 1) >= argc) {
fprintf(stderr, "missing argument for -rxmaxmtu\n");
@ -1775,6 +1779,43 @@ Do_VLRegisterRPC()
return 0;
}
afs_int32
SetupVL()
{
afs_int32 code;
extern int rxi_numNetAddrs;
extern afs_uint32 rxi_NetAddrs[];
#ifndef AFS_NT40_ENV
if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || AFSDIR_SERVER_NETINFO_FILEPATH) {
/*
* Find addresses we are supposed to register as per the netrestrict
* and netinfo files (/usr/afs/local/NetInfo and
* /usr/afs/local/NetRestict)
*/
char reason[1024];
afs_int32 code = parseNetFiles(FS_HostAddrs, NULL, NULL,
ADDRSPERSITE, reason,
AFSDIR_SERVER_NETINFO_FILEPATH,
AFSDIR_SERVER_NETRESTRICT_FILEPATH);
if (code < 0) {
ViceLog(0, ("Can't register any valid addresses: %s\n", reason));
exit(1);
}
FS_HostAddr_cnt = (afs_uint32) code;
} else
#endif
{
FS_HostAddr_cnt = rx_getAllAddr(FS_HostAddrs, ADDRSPERSITE);
}
if (FS_HostAddr_cnt == 1 && rxBind == 1)
code = FS_HostAddrs[0];
else
code = htonl(INADDR_ANY);
return code;
}
afs_int32
InitVL()
{
@ -1806,30 +1847,7 @@ InitVL()
/* A good sysid file exists; inform the vlserver. If any conflicts,
* we always use the latest interface available as the real truth.
*/
#ifndef AFS_NT40_ENV
if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || AFSDIR_SERVER_NETINFO_FILEPATH) {
/*
* Find addresses we are supposed to register as per the netrestrict
* and netinfo files (/usr/afs/local/NetInfo and
* /usr/afs/local/NetRestict)
*/
char reason[1024];
afs_int32 code = parseNetFiles(FS_HostAddrs, NULL, NULL,
ADDRSPERSITE, reason,
AFSDIR_SERVER_NETINFO_FILEPATH,
AFSDIR_SERVER_NETRESTRICT_FILEPATH);
if (code < 0) {
ViceLog(0, ("Can't register any valid addresses: %s\n", reason));
exit(1);
}
FS_HostAddr_cnt = (afs_uint32) code;
} else
#endif
{
FS_HostAddr_cnt = rx_getAllAddr(FS_HostAddrs, ADDRSPERSITE);
}
FS_registered = 1;
code = Do_VLRegisterRPC();
return code;
}
@ -1854,6 +1872,7 @@ main(int argc, char *argv[])
#endif
int curLimit;
time_t t;
afs_uint32 rx_bindhost;
#ifdef AFS_AIX32_ENV
struct sigaction nsa;
@ -2019,7 +2038,9 @@ main(int argc, char *argv[])
#endif
if (udpBufSize)
rx_SetUdpBufSize(udpBufSize); /* set the UDP buffer size for receive */
if (rx_Init((int)htons(7000)) < 0) {
rx_bindhost = SetupVL();
if (rx_InitHost(rx_bindhost, (int)htons(7000)) < 0) {
ViceLog(0, ("Cannot initialize RX\n"));
exit(1);
}
@ -2036,11 +2057,12 @@ main(int argc, char *argv[])
sc[1] = 0; /* rxvab_NewServerSecurityObject(key1, 0) */
sc[2] = rxkad_NewServerSecurityObject(rxkad_clear, NULL, get_key, NULL);
sc[3] = rxkad_NewServerSecurityObject(rxkad_crypt, NULL, get_key, NULL);
tservice = rx_NewService( /* port */ 0, /* service id */ 1, /*service name */
"AFS",
/* security classes */ sc,
/* numb sec classes */
4, RXAFS_ExecuteRequest);
tservice = rx_NewServiceHost(rx_bindhost, /* port */ 0, /* service id */
1, /*service name */
"AFS",
/* security classes */ sc,
/* numb sec classes */
4, RXAFS_ExecuteRequest);
if (!tservice) {
ViceLog(0,
("Failed to initialize RX, probably two servers running.\n"));

View File

@ -72,6 +72,10 @@ int LogLevel = 0;
int smallMem = 0;
int rxJumbograms = 1; /* default is to send and receive jumbo grams */
int rxMaxMTU = -1;
afs_int32 rxBind = 0;
#define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
afs_uint32 SHostAddrs[ADDRSPERSITE];
static void
CheckSignal_Signal()
@ -144,6 +148,7 @@ main(argc, argv)
extern int rx_extraPackets;
char commandLine[150];
char clones[MAXHOSTSPERCELL];
afs_uint32 host = ntohl(INADDR_ANY);
#ifdef AFS_AIX32_ENV
/*
@ -179,6 +184,9 @@ main(argc, argv)
} else if (strcmp(argv[index], "-nojumbo") == 0) {
rxJumbograms = 0;
} else if (strcmp(argv[index], "-rxbind") == 0) {
rxBind = 1;
} else if (!strcmp(argv[index], "-rxmaxmtu")) {
if ((index + 1) >= argc) {
fprintf(stderr, "missing argument for -rxmaxmtu\n");
@ -245,14 +253,14 @@ main(argc, argv)
/* support help flag */
#ifndef AFS_NT40_ENV
printf("Usage: vlserver [-p <number of processes>] [-nojumbo] "
"[-rxmaxmtu <bytes>] "
"[-rxmaxmtu <bytes>] [-rxbind] "
"[-auditlog <log path>] "
"[-syslog[=FACILITY]] "
"[-enable_peer_stats] [-enable_process_stats] "
"[-help]\n");
#else
printf("Usage: vlserver [-p <number of processes>] [-nojumbo] "
"[-rxmaxmtu <bytes>] "
"[-rxmaxmtu <bytes>] [-rxbind] "
"[-auditlog <log path>] "
"[-enable_peer_stats] [-enable_process_stats] "
"[-help]\n");
@ -323,6 +331,24 @@ main(argc, argv)
if (noAuth)
afsconf_SetNoAuthFlag(tdir, 1);
if (rxBind) {
afs_int32 ccode;
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 {
ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
}
if (ccode == 1) {
host = SHostAddrs[0];
rx_InitHost(host, htons(AFSCONF_VLDBPORT));
}
}
ubik_nBuffers = 512;
ubik_CRXSecurityProc = afsconf_ClientAuth;
ubik_CRXSecurityRock = (char *)tdir;
@ -351,8 +377,9 @@ main(argc, argv)
sc[0] = rxnull_NewServerSecurityObject();
sc[1] = (struct rx_securityClass *)0;
sc[2] = rxkad_NewServerSecurityObject(0, tdir, afsconf_GetKey, NULL);
tservice =
rx_NewService(0, USER_SERVICE_ID, "Vldb server", sc, 3,
rx_NewServiceHost(host, 0, USER_SERVICE_ID, "Vldb server", sc, 3,
VL_ExecuteRequest);
if (tservice == (struct rx_service *)0) {
printf("vlserver: Could not create VLDB_SERVICE rx service\n");
@ -364,7 +391,7 @@ main(argc, argv)
rx_SetMaxProcs(tservice, lwps);
tservice =
rx_NewService(0, RX_STATS_SERVICE_ID, "rpcstats", sc, 3,
rx_NewServiceHost(host, 0, RX_STATS_SERVICE_ID, "rpcstats", sc, 3,
RXSTATS_ExecuteRequest);
if (tservice == (struct rx_service *)0) {
printf("vlserver: Could not create rpc stats rx service\n");

View File

@ -95,6 +95,10 @@ int lwps = 9;
int udpBufSize = 0; /* UDP buffer size for receive */
int Testing = 0; /* for ListViceInodes */
int rxBind = 0;
#define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
afs_uint32 SHostAddrs[ADDRSPERSITE];
#define VS_EXIT(code) { \
osi_audit(VS_ExitEvent, code, AUD_END); \
@ -244,6 +248,7 @@ main(int argc, char **argv)
int rxJumbograms = 1; /* default is to send and receive jumbograms. */
int rxMaxMTU = -1;
int bufSize = 0; /* temp variable to read in udp socket buf size */
afs_uint32 host = ntohl(INADDR_ANY);
#ifdef AFS_AIX32_ENV
/*
@ -288,6 +293,8 @@ main(int argc, char **argv)
DoLogging = 1;
} else if (strcmp(argv[code], "-help") == 0) {
goto usage;
} else if (strcmp(argv[code], "-rxbind") == 0) {
rxBind = 1;
} else if (strcmp(argv[code], "-p") == 0) {
lwps = atoi(argv[++code]);
if (lwps > MAXLWP) {
@ -379,7 +386,7 @@ main(int argc, char **argv)
#ifndef AFS_NT40_ENV
printf("Usage: volserver [-log] [-p <number of processes>] "
"[-auditlog <log path>] "
"[-nojumbo] [-rxmaxmtu <bytes>] "
"[-nojumbo] [-rxmaxmtu <bytes>] [-rxbind] "
"[-udpsize <size of socket buffer in bytes>] "
"[-syslog[=FACILITY]] "
"[-enable_peer_stats] [-enable_process_stats] "
@ -387,7 +394,7 @@ main(int argc, char **argv)
#else
printf("Usage: volserver [-log] [-p <number of processes>] "
"[-auditlog <log path>] "
"[-nojumbo] [-rxmaxmtu <bytes>] "
"[-nojumbo] [-rxmaxmtu <bytes>] [-rxbind] "
"[-udpsize <size of socket buffer in bytes>] "
"[-enable_peer_stats] [-enable_process_stats] "
"[-help]\n");
@ -426,7 +433,23 @@ main(int argc, char **argv)
rx_nPackets = rxpackets; /* set the max number of packets */
if (udpBufSize)
rx_SetUdpBufSize(udpBufSize); /* set the UDP buffer size for receive */
code = rx_Init((int)htons(AFSCONF_VOLUMEPORT));
if (rxBind) {
afs_int32 ccode;
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 {
ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
}
if (ccode == 1)
host = SHostAddrs[0];
}
code = rx_InitHost(host, (int)htons(AFSCONF_VOLUMEPORT));
if (code) {
fprintf(stderr, "rx init failed on socket AFSCONF_VOLUMEPORT %u\n",
AFSCONF_VOLUMEPORT);
@ -478,7 +501,7 @@ main(int argc, char **argv)
if (securityObjects[0] == (struct rx_securityClass *)0)
Abort("rxnull_NewServerSecurityObject");
service =
rx_NewService(0, VOLSERVICE_ID, "VOLSER", securityObjects, 3,
rx_NewServiceHost(host, 0, VOLSERVICE_ID, "VOLSER", securityObjects, 3,
AFSVolExecuteRequest);
if (service == (struct rx_service *)0)
Abort("rx_NewService");