cluster: Support running multiple instances on the same host

With IP_MULTICAST_LOOP they can see each other. We "just" have to make sure
they use different IP addresses and route metrics to distinguish from each
other.
This commit is contained in:
Samuel Thibault 2025-03-17 20:51:06 +01:00
parent 366faaea76
commit b2942b3c53
5 changed files with 86 additions and 22 deletions

3
util.c
View file

@ -67,7 +67,7 @@ void *shared_malloc(unsigned int size)
}
extern int forked;
extern int cluster_sockfd, tunfd, controlfd, daefd, snoopfd, ifrfd, ifr6fd, rand_fd;
extern int cluster_sockfd, cluster_sockfd2, tunfd, controlfd, daefd, snoopfd, ifrfd, ifr6fd, rand_fd;
extern int pppoediscfd, pppoesessfd;
extern int *radfds;
extern int udpfd[MAX_UDPFD + 1];
@ -103,6 +103,7 @@ pid_t fork_and_close()
// Close sockets
if (clifd != -1) close(clifd);
if (cluster_sockfd != -1) close(cluster_sockfd);
if (cluster_sockfd2 != -1) close(cluster_sockfd2);
if (tunfd != -1) close(tunfd);
for (i = 0; i < config->nbudpfd; i++)