Fix broadcast i think
This commit is contained in:
parent
e769e5448f
commit
730d60d02c
3
bbs.c
3
bbs.c
@ -1,6 +1,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -63,7 +64,7 @@ void broadcast(char *mess, ...) {
|
|||||||
memset(&s, 0, sizeof(struct sockaddr_in));
|
memset(&s, 0, sizeof(struct sockaddr_in));
|
||||||
|
|
||||||
s.sin_family=AF_INET;
|
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);
|
s.sin_port = htons((unsigned short)conf.broadcast_port);
|
||||||
bind(bcast_sock, (struct sockaddr *)&s, sizeof(struct sockaddr_in));
|
bind(bcast_sock, (struct sockaddr *)&s, sizeof(struct sockaddr_in));
|
||||||
|
|
||||||
|
2
bbs.h
2
bbs.h
@ -129,6 +129,8 @@ struct bbs_config {
|
|||||||
int automsgwritelvl;
|
int automsgwritelvl;
|
||||||
int broadcast_enable;
|
int broadcast_enable;
|
||||||
int broadcast_port;
|
int broadcast_port;
|
||||||
|
char *broadcast_address;
|
||||||
|
|
||||||
int mail_conference_count;
|
int mail_conference_count;
|
||||||
struct mail_conference **mail_conferences;
|
struct mail_conference **mail_conferences;
|
||||||
int door_count;
|
int door_count;
|
||||||
|
@ -26,6 +26,7 @@ UNZIP Command = unzip -j -o *a -d *d
|
|||||||
Archivers = config/archivers.ini
|
Archivers = config/archivers.ini
|
||||||
Broadcast Enable = false
|
Broadcast Enable = false
|
||||||
Broadcast Port = 2027
|
Broadcast Port = 2027
|
||||||
|
Broadcast Address = 192.168.1.255
|
||||||
|
|
||||||
[paths]
|
[paths]
|
||||||
WWW Path = /home/andrew/MagickaBBS/www
|
WWW Path = /home/andrew/MagickaBBS/www
|
||||||
|
2
main.c
2
main.c
@ -387,6 +387,8 @@ static int handler(void* user, const char* section, const char* name,
|
|||||||
}
|
}
|
||||||
} else if (strcasecmp(name, "broadcast port") == 0) {
|
} else if (strcasecmp(name, "broadcast port") == 0) {
|
||||||
conf->broadcast_port = atoi(value);
|
conf->broadcast_port = atoi(value);
|
||||||
|
} else if (strcasecmp(name, "broadcast address") == 0) {
|
||||||
|
conf->broadcast_address = strdup(value);
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(section, "paths") == 0){
|
} else if (strcasecmp(section, "paths") == 0){
|
||||||
if (strcasecmp(name, "ansi path") == 0) {
|
if (strcasecmp(name, "ansi path") == 0) {
|
||||||
|
Reference in New Issue
Block a user