diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-11-09 17:10:29 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-11-09 17:14:10 +0100 |
commit | c34723cfb980c6a8d957892cfd5466df44b50863 (patch) | |
tree | 682839cf75093bb77c43f95631ffc864b3fcf852 /src/fastd.c | |
parent | f5a723399dfc3969bdb712b22616721ec740f818 (diff) | |
download | fastd-c34723cfb980c6a8d957892cfd5466df44b50863.tar fastd-c34723cfb980c6a8d957892cfd5466df44b50863.zip |
Use a global ioctl socket
Based-on-patch-by: Julian Kornberger <jk+github@digineo.de>
Diffstat (limited to 'src/fastd.c')
-rw-r--r-- | src/fastd.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/fastd.c b/src/fastd.c index 3d5b3d4..2d0b47a 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -173,6 +173,10 @@ static inline uint16_t get_bind_port(const fastd_bind_address_t *addr) { /** Initializes the configured sockets */ static void init_sockets(void) { + ctx.ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0); + if (ctx.ioctl_sock < 0) + exit_errno("unable to create ioctl socket"); + ctx.socks = fastd_new_array(conf.n_bind_addrs, fastd_socket_t); size_t i; @@ -204,6 +208,9 @@ static void close_sockets(void) { fastd_socket_close(&ctx.socks[i]); free(ctx.socks); + + if (close(ctx.ioctl_sock)) + pr_error_errno("close"); } /** Calls the on-pre-up command */ |