gluon-radv-filterd: Handle bind errors

The bind to an interface can fail and the socket then isn't working as
expected. The daemon must therefore handle this problem.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
This commit is contained in:
Sven Eckelmann 2017-12-20 11:24:10 +01:00 committed by Jan-Philipp Litza
parent f9b3b2438c
commit 9d194c3f7f
No known key found for this signature in database
GPG Key ID: 1FB658053CE27196

View File

@ -130,7 +130,7 @@ static void error_message(int status, int errnum, char *message, ...) {
exit(status); exit(status);
} }
static void cleanup() { static void cleanup(void) {
struct router *router; struct router *router;
close(G.sock); close(G.sock);
@ -217,7 +217,9 @@ static int init_packet_socket(unsigned int ifindex) {
.sll_protocol = htons(ETH_P_IPV6), .sll_protocol = htons(ETH_P_IPV6),
.sll_ifindex = ifindex, .sll_ifindex = ifindex,
}; };
bind(sock, (struct sockaddr *)&bind_iface, sizeof(bind_iface)); ret = bind(sock, (struct sockaddr *)&bind_iface, sizeof(bind_iface));
if (ret < 0)
exit_errno("can't bind socket");
return sock; return sock;
} }
@ -297,7 +299,7 @@ check_failed:
return; return;
} }
static void expire_routers() { static void expire_routers(void) {
struct router **prev_ptr = &G.routers; struct router **prev_ptr = &G.routers;
struct router *router; struct router *router;
struct router *safe; struct router *safe;
@ -316,7 +318,7 @@ static void expire_routers() {
} }
} }
static void update_tqs() { static void update_tqs(void) {
FILE *f; FILE *f;
struct router *router; struct router *router;
char path[PATH_MAX]; char path[PATH_MAX];
@ -491,7 +493,7 @@ static int fork_execvp_timeout(struct timespec *timeout, const char *file, const
return -1; return -1;
} }
static void update_ebtables() { static void update_ebtables(void) {
struct timespec timeout = { struct timespec timeout = {
.tv_nsec = EBTABLES_TIMEOUT, .tv_nsec = EBTABLES_TIMEOUT,
}; };