diff --git a/bbs.c b/bbs.c index 43b1190..8f800cf 100644 --- a/bbs.c +++ b/bbs.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -63,7 +64,7 @@ void broadcast(char *mess, ...) { memset(&s, 0, sizeof(struct sockaddr_in)); s.sin_family=AF_INET; - s.sin_addr.s_addr = htonl(INADDR_ANY); + s.sin_addr.s_addr = inet_addr(conf.broadcast_address); s.sin_port = htons((unsigned short)conf.broadcast_port); bind(bcast_sock, (struct sockaddr *)&s, sizeof(struct sockaddr_in)); diff --git a/bbs.h b/bbs.h index f00c236..05d5d56 100644 --- a/bbs.h +++ b/bbs.h @@ -129,6 +129,8 @@ struct bbs_config { int automsgwritelvl; int broadcast_enable; int broadcast_port; + char *broadcast_address; + int mail_conference_count; struct mail_conference **mail_conferences; int door_count; diff --git a/config_default/bbs.ini b/config_default/bbs.ini index 9e1aef3..63ceafd 100644 --- a/config_default/bbs.ini +++ b/config_default/bbs.ini @@ -26,6 +26,7 @@ UNZIP Command = unzip -j -o *a -d *d Archivers = config/archivers.ini Broadcast Enable = false Broadcast Port = 2027 +Broadcast Address = 192.168.1.255 [paths] WWW Path = /home/andrew/MagickaBBS/www diff --git a/main.c b/main.c index 0638b6d..f12880b 100644 --- a/main.c +++ b/main.c @@ -387,6 +387,8 @@ static int handler(void* user, const char* section, const char* name, } } else if (strcasecmp(name, "broadcast port") == 0) { conf->broadcast_port = atoi(value); + } else if (strcasecmp(name, "broadcast address") == 0) { + conf->broadcast_address = strdup(value); } } else if (strcasecmp(section, "paths") == 0){ if (strcasecmp(name, "ansi path") == 0) {