"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "main.c" between
mrouted-3.9.7.tar.gz and mrouted-3.9.8.tar.gz

About: mrouted is an implementation of the DVMRP multicast routing protocol.

main.c  (mrouted-3.9.7):main.c  (mrouted-3.9.8)
skipping to change at line 47 skipping to change at line 47
static int sighandled = 0; static int sighandled = 0;
#define GOT_SIGINT 0x01 #define GOT_SIGINT 0x01
#define GOT_SIGHUP 0x02 #define GOT_SIGHUP 0x02
#define GOT_SIGUSR1 0x04 #define GOT_SIGUSR1 0x04
#define GOT_SIGUSR2 0x08 #define GOT_SIGUSR2 0x08
int cache_lifetime = DEFAULT_CACHE_LIFETIME; int cache_lifetime = DEFAULT_CACHE_LIFETIME;
int prune_lifetime = AVERAGE_PRUNE_LIFETIME; int prune_lifetime = AVERAGE_PRUNE_LIFETIME;
int startupdelay = DEFAULT_STARTUP_DELAY;
int vifstatedefault = 0; int vifstatedefault = 0;
int missingok = 0; int missingok = 0;
int debug = 0; int debug = 0;
extern char *__progname; extern char *__progname;
time_t mrouted_init_time; time_t mrouted_init_time;
#define NHANDLERS 2 #define NHANDLERS 2
static struct ihandler { static struct ihandler {
int fd; /* File descriptor */ int fd; /* File descriptor */
skipping to change at line 192 skipping to change at line 193
} }
} }
} }
} }
static void usage(void) static void usage(void)
{ {
size_t i, j, k; size_t i, j, k;
struct debugname *d; struct debugname *d;
fprintf(stderr, "Usage: %s [-fhpv] [-c file] [-d [level[,level...]]]\n\n", _ fprintf(stderr,
_progname); "Usage: %s [-fhpv] [-c file] [-d [level[,level...]]]\n\n"
fputs(" -c, --config=FILE Configuration file to use, default /etc/mroute " -c, --config=FILE Configuration file to use, default /etc
d.conf\n", stderr); /mrouted.conf\n"
fputs(" -d, --debug[=LEVEL] Debug level, see below for valid levels\n", st " -d, --debug[=LEVEL] Debug level, see below for valid levels
derr); \n"
fputs(" -f, --foreground Run in foreground, do not detach from calling " -f, --foreground Run in foreground, do not detach from c
terminal\n", stderr); alling terminal\n"
fputs(" -h, --help Show this help text\n", stderr); " -h, --help Show this help text\n"
fputs(" -N, --no-interfaces Disable all interfaces by default\n", stderr); " -N, --no-interfaces Disable all interfaces by default\n"
fputs(" -M, --missing-ok Missing interfaces are OK\n", stderr); " -M, --missing-ok Missing interfaces are OK\n"
fputs(" -p Disable pruning. Deprecated, compatibility op " -D, --startup-delay=DELAY Set startup delay before forwarding, de
tion\n", stderr); fault %d seconds\n"
fputs(" -r, --show-routes Show state of VIFs and multicast routing table " -p Disable pruning. Deprecated, compatibi
s\n", stderr); lity option\n"
fprintf(stderr, " -v, --version Show %s version\n", __progname); " -r, --show-routes Show state of VIFs and multicast routin
fputs("\n", stderr); g tables\n"
" -v, --version Show %s version\n"
"\n", __progname, DEFAULT_STARTUP_DELAY, __progname);
j = 0xffffffff; j = 0xffffffff;
k = 0; k = 0;
fputs("Valid debug levels:\n ", stderr); fputs("Valid debug levels:\n ", stderr);
for (i = 0, d = debugnames; i < ARRAY_LEN(debugnames); i++, d++) { for (i = 0, d = debugnames; i < ARRAY_LEN(debugnames); i++, d++) {
if ((j & d->level) == d->level) { if ((j & d->level) == d->level) {
if (k++) if (k++)
fputs(", ", stderr); fputs(", ", stderr);
if (!(k % 6)) if (!(k % 6))
fputs("\n ", stderr); fputs("\n ", stderr);
skipping to change at line 244 skipping to change at line 247
struct sigaction sa; struct sigaction sa;
struct option long_options[] = { struct option long_options[] = {
{"config", 1, 0, 'c'}, {"config", 1, 0, 'c'},
{"debug", 2, 0, 'd'}, {"debug", 2, 0, 'd'},
{"foreground", 0, 0, 'f'}, {"foreground", 0, 0, 'f'},
{"help", 0, 0, 'h'}, {"help", 0, 0, 'h'},
{"version", 0, 0, 'v'}, {"version", 0, 0, 'v'},
{"show-routes", 0, 0, 'r'}, {"show-routes", 0, 0, 'r'},
{"no-intefaces", 0, 0, 'N'}, {"no-intefaces", 0, 0, 'N'},
{"missing-ok", 0, 0, 'M'}, {"missing-ok", 0, 0, 'M'},
{"startup-delay", 1, 0, 'D'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
snprintf(versionstring, sizeof(versionstring), "mrouted version %s", todaysv ersion); snprintf(versionstring, sizeof(versionstring), "mrouted version %s", todaysv ersion);
while ((ch = getopt_long(argc, argv, "MNc:d::fhprv", long_options, NULL)) != EOF) { while ((ch = getopt_long(argc, argv, "D:MNc:d::fhprv", long_options, NULL)) != EOF) {
switch (ch) { switch (ch) {
case 'D':
startupdelay = atoi(optarg);
break;
case 'M': case 'M':
missingok++; missingok++;
break; break;
case 'N': case 'N':
vifstatedefault = VIFF_DISABLED; vifstatedefault = VIFF_DISABLED;
break; break;
case 'c': case 'c':
configfilename = optarg; configfilename = optarg;
skipping to change at line 316 skipping to change at line 324
case 'v': case 'v':
printf("%s\n", versionstring); printf("%s\n", versionstring);
return 0; return 0;
default: default:
usage(); usage();
} }
} }
/* Check for unsupported command line arguments */
argc -= optind; argc -= optind;
argv += optind;
if (argc > 0) if (argc > 0)
usage(); usage();
if (geteuid() != 0) { if (geteuid() != 0) {
fprintf(stderr, "%s: must be root\n", __progname); fprintf(stderr, "%s: must be root\n", __progname);
exit(1); exit(1);
} }
setlinebuf(stderr); setlinebuf(stderr);
if (debug != 0) { if (debug != 0) {
skipping to change at line 485 skipping to change at line 492
/* XXX HACK /* XXX HACK
* This will cause black holes for the first few seconds after startup, * This will cause black holes for the first few seconds after startup,
* since we are exchanging routes but not actually forwarding. * since we are exchanging routes but not actually forwarding.
* However, it eliminates much of the startup transient. * However, it eliminates much of the startup transient.
* *
* It's possible that we can set a flag which says not to report any * It's possible that we can set a flag which says not to report any
* routes (just accept reports) until this timer fires, and then * routes (just accept reports) until this timer fires, and then
* do a report_to_all_neighbors(ALL_ROUTES) immediately before * do a report_to_all_neighbors(ALL_ROUTES) immediately before
* turning on DVMRP. * turning on DVMRP.
*/ */
timer_setTimer(10, final_init, NULL); timer_setTimer(startupdelay, final_init, NULL);
/* /*
* Main receive loop. * Main receive loop.
*/ */
dummy = 0; dummy = 0;
difftime.tv_usec = 0; difftime.tv_usec = 0;
gettimeofday(&curtime, NULL); gettimeofday(&curtime, NULL);
lasttime = curtime; lasttime = curtime;
for (;;) { for (;;) {
secs = timer_nextTimer(); secs = timer_nextTimer();
skipping to change at line 594 skipping to change at line 601
lasttime = curtime; lasttime = curtime;
if (secs == 0 || difftime.tv_sec > 0) if (secs == 0 || difftime.tv_sec > 0)
age_callout_queue(difftime.tv_sec); age_callout_queue(difftime.tv_sec);
secs = -1; secs = -1;
} while (difftime.tv_sec > 0); } while (difftime.tv_sec > 0);
} }
logit(LOG_NOTICE, 0, "%s exiting", versionstring); logit(LOG_NOTICE, 0, "%s exiting", versionstring);
free(pfd);
cleanup(); cleanup();
return 0; return 0;
} }
static void final_init(void *i) static void final_init(void *i)
{ {
char *s = (char *)i; char *s = (char *)i;
logit(LOG_NOTICE, 0, "%s%s", versionstring, s ? s : ""); logit(LOG_NOTICE, 0, "%s%s", versionstring, s ? s : "");
 End of changes. 9 change blocks. 
21 lines changed or deleted 29 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS