Commit c14bac18 authored by Mike Hibler's avatar Mike Hibler

Quick hack to allow passing command line config options to mfrisbeed.

In particular, need to pass in a base multicast address for the null config
so we don't have to recompile on each subboss.
parent cbd68e9e
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2010-2011 University of Utah and the Flux Group.
* Copyright (c) 2010-2012 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -50,15 +50,15 @@ config_signal(int sig)
}
int
config_init(char *style, int readit)
config_init(char *style, int readit, char *opts)
{
int rv;
if (strcmp(style, "emulab") == 0) {
#ifdef USE_EMULAB_CONFIG
extern struct config *emulab_init();
extern struct config *emulab_init(char *);
if (myconfig == NULL) {
if ((myconfig = emulab_init()) != NULL)
if ((myconfig = emulab_init(opts)) != NULL)
log("Using Emulab configuration");
} else
log("Emulab config init failed");
......@@ -68,9 +68,9 @@ config_init(char *style, int readit)
}
if (strcmp(style, "null") == 0) {
#ifdef USE_NULL_CONFIG
extern struct config *null_init();
extern struct config *null_init(char *);
if (myconfig == NULL) {
if ((myconfig = null_init()) != NULL)
if ((myconfig = null_init(opts)) != NULL)
log("Using null configuration");
} else
log("Null config init failed");
......
......@@ -1725,7 +1725,7 @@ struct config emulab_config = {
};
struct config *
emulab_init(void)
emulab_init(char *opts)
{
static int called;
char pathbuf[PATH_MAX], *path;
......
......@@ -677,7 +677,7 @@ struct config null_config = {
};
struct config *
null_init(void)
null_init(char *opts)
{
char pathbuf[PATH_MAX], *path;
static int called;
......@@ -687,6 +687,20 @@ null_init(void)
return &null_config;
called++;
/*
* XXX the only option we recognize right now is
* mcaddr=A.B.C.D
*/
if (opts && opts[0]) {
char *cp = index(opts, '=');
if (cp) {
*cp = 0;
if (strcmp(opts, "mcaddr") == 0)
DEFAULT_MCADDR = cp + 1;
*cp = '=';
}
}
if (imagedir == NULL)
imagedir = DEFAULT_IMAGEDIR;
if ((path = myrealpath(imagedir, pathbuf)) == NULL) {
......
......@@ -76,7 +76,7 @@ struct config {
void (*config_dump)(FILE *);
};
extern int config_init(char *, int);
extern int config_init(char *, int, char *);
extern void config_deinit(void);
extern int config_read(void);
extern int config_get_host_authinfo(struct in_addr *,
......
......@@ -70,6 +70,7 @@ static int canredirect = 0;
static int usechildauth = 0;
static int mirrormode = 0;
static char *configstyle = "null";
static char *configopts = "";
static struct in_addr ifaceip;
static int igmpqueryinterval = 0;
......@@ -110,7 +111,7 @@ main(int argc, char **argv)
log(" acting as IGMP querier on %s with %d second interval",
inet_ntoa(ifaceip), igmpqueryinterval);
#endif
config_init(configstyle, 1);
config_init(configstyle, 1, configopts);
/* Just dump the config to stdout in human readable form and exit. */
if (dumpconfig) {
......@@ -1313,6 +1314,7 @@ usage(void)
fprintf(stderr, "mfrisbeed [-ADRd] [-X method] [-I imagedir] [-S parentIP] [-P parentport] [-p port]\n");
fprintf(stderr, "Basic:\n");
fprintf(stderr, " -C <style> configuration style: emulab, file, or null\n");
fprintf(stderr, " -O <str> configuration options, style-specific\n");
fprintf(stderr, " -I <dir> default directory where images are stored\n");
fprintf(stderr, " -x <methods> transfer methods to allow from clients: ucast, mcast, bcast or any\n");
fprintf(stderr, " -X <method> transfer method to request from parent\n");
......@@ -1334,7 +1336,7 @@ get_options(int argc, char **argv)
{
int ch;
while ((ch = getopt(argc, argv, "AC:DI:MRX:x:S:P:p:i:dhQ:")) != -1)
while ((ch = getopt(argc, argv, "AC:O:DI:MRX:x:S:P:p:i:dhQ:")) != -1)
switch(ch) {
case 'A':
usechildauth = 1;
......@@ -1351,6 +1353,9 @@ get_options(int argc, char **argv)
exit(1);
}
break;
case 'O':
configopts = optarg;
break;
case 'x':
case 'X':
{
......
......@@ -5,6 +5,14 @@
# BEFORE: testbed
# KEYWORD: shutdown
#
# Base multicast address.
# By default for the null config we use, it is "239.192.1".
# Subbosses on the same network should use different values; e.g., 239.193.1.
#
#MCBASEADDR=""
MCBASEADDR="239.192.1"
#
# Start up the frisbee master server on a subboss.
# There is no sure fire way to dynamically tell if we are a subboss right now.
......@@ -58,6 +66,9 @@ esac
echo -n " mfrisbeed"
rm -f /var/run/frisbeed-*.pid
args="-C null -S @BOSSNODE_IP@ -I /z/image_cache -A -M -R"
if [ -n "$MCBASEADDR" ]; then
args="$args -O mcaddr=$MCBASEADDR"
fi
if [ -x @prefix@/sbin/daemon_wrapper ]; then
@prefix@/sbin/daemon_wrapper -i 30 -l @prefix@/log/mfrisbeed_wrapper.log \
@prefix@/sbin/mfrisbeed -d $args
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment