summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am5
-rw-r--r--src/aes.c4
-rw-r--r--src/aeswepd.c29
-rw-r--r--src/interface.c4
-rw-r--r--src/iwkey.c4
-rw-r--r--src/keyapi.c4
-rw-r--r--src/util.c4
-rw-r--r--src/wireless.h6
8 files changed, 50 insertions, 10 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 8e5d700..e5c0928 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,10 +23,11 @@ aeswepd_SOURCES = aeswepd.c aeswepd.h \
interface.c interface.h \
iwkey.c iwkey.h \
util.c util.h \
- wireless.h wireless.15.h \
+ wireless.h wireless.15.h wireless.16.h \
keyapi.c keyapi.h
-aeswepd_LDADD = -lmcrypt
+aeswepd_LDADD = -lmcrypt $(LIBDAEMON_LIBS)
+aeswepd_CFLAGS = $(LIBDAEMON_CFLAGS)
install-exec-hook:
cd $(DESTDIR)/$(sbindir) && ln -sf aeswepd aeswepls
diff --git a/src/aes.c b/src/aes.c
index 5356e66..b89ef0c 100644
--- a/src/aes.c
+++ b/src/aes.c
@@ -18,6 +18,10 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <mcrypt.h>
#include <stdio.h>
#include <string.h>
diff --git a/src/aeswepd.c b/src/aeswepd.c
index 1f74c64..3c651e1 100644
--- a/src/aeswepd.c
+++ b/src/aeswepd.c
@@ -20,6 +20,10 @@
#define _GNU_SOURCE
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <assert.h>
#include <sys/select.h>
#include <string.h>
@@ -45,11 +49,12 @@
#include "keyapi.h"
uint8_t aes_key[AES_KEY_LEN];
-int rekey_time = 15*60;
-int n_max_keys = 3;
+int rekey_time = 24*60*60, /* prior to 0.4: 15*60*/
+ n_max_keys = 3;
+
int key_map[MAX_WEP_KEYS];
char *interface_name = NULL;
-int daemonize = 1, use_syslog = 1, wait_on_fork = 0, use_status_file = 1;
+int daemonize = 1, use_syslog = 1, wait_on_fork = 0, use_status_file = 1, wait_on_kill = 0;
char log_ident[32], pid_ident[32];
FILE *status_file = NULL;
@@ -321,6 +326,7 @@ void usage(char *p) {
" -E --key-env=KEYENV Specify environment variable to read key from\n"
" -m --max-keys=NR Specify the number of keys to use concurrently (%i)\n"
" -w --wait-on-fork Wait until daemon fork finished (%s)\n"
+ " -W --wait-on-kill When run with -k, wait until the daemon died (%s)\n"
" -l --list-keys Show keys of running daemon\n"
" -h --help Show this help\n"
" -k --kill Kill a running daemon\n"
@@ -334,6 +340,7 @@ void usage(char *p) {
rekey_time,
n_max_keys,
wait_on_fork ? "on" : "off",
+ wait_on_kill ? "on" : "off",
AES_KEY_LEN);
}
@@ -345,6 +352,7 @@ void parse_args(int argc, char *argv[]) {
{"rekey-time", required_argument, 0, 't'},
{"max-keys", required_argument, 0, 'm'},
{"wait-on-fork", no_argument, 0, 'w'},
+ {"wait-on-kill", no_argument, 0, 'W'},
{"help", no_argument, 0, 'h'},
{"kill", no_argument, 0, 'k'},
{"check-running", no_argument, 0, 'c'},
@@ -374,7 +382,7 @@ void parse_args(int argc, char *argv[]) {
for (;;) {
int c;
- if ((c = getopt_long(argc, argv, "nsi:t:m:whkcvlK:F:E:", long_options, &option_index)) < 0)
+ if ((c = getopt_long(argc, argv, "nsi:t:m:whkcvlK:F:E:W", long_options, &option_index)) < 0)
break;
switch (c) {
@@ -469,6 +477,10 @@ void parse_args(int argc, char *argv[]) {
break;
}
+ case 'W':
+ wait_on_kill = !wait_on_kill;
+ break;
+
default:
daemon_log(LOG_ERR, "Unknown parameter.\n");
exit(1);
@@ -490,7 +502,14 @@ void parse_args(int argc, char *argv[]) {
}
if (_kill) {
- if (daemon_pid_file_kill(SIGINT) < 0) {
+ int rv;
+
+ if (wait_on_kill)
+ rv = daemon_pid_file_kill_wait(SIGINT, 5);
+ else
+ rv = daemon_pid_file_kill(SIGINT);
+
+ if (rv < 0) {
daemon_log(LOG_ERR, "Failed to kill daemon. (%s)", strerror(errno));
exit(6);
}
diff --git a/src/interface.c b/src/interface.c
index b33472c..6099354 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -18,6 +18,10 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <errno.h>
#include <string.h>
diff --git a/src/iwkey.c b/src/iwkey.c
index bebe1bc..ca9572e 100644
--- a/src/iwkey.c
+++ b/src/iwkey.c
@@ -18,6 +18,10 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <assert.h>
#include <string.h>
#include <stdio.h>
diff --git a/src/keyapi.c b/src/keyapi.c
index a67012d..a5b5351 100644
--- a/src/keyapi.c
+++ b/src/keyapi.c
@@ -18,6 +18,10 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "iwkey.h"
const struct key_api * key_api_get(const char *c) {
diff --git a/src/util.c b/src/util.c
index df1f836..f56b0bb 100644
--- a/src/util.c
+++ b/src/util.c
@@ -18,6 +18,10 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <unistd.h>
#include <sys/socket.h>
#include <string.h>
diff --git a/src/wireless.h b/src/wireless.h
index 55262ae..73ff314 100644
--- a/src/wireless.h
+++ b/src/wireless.h
@@ -23,9 +23,9 @@
#include <sys/types.h>
#include <sys/socket.h>
-
-
#include <linux/if.h>
-#include "wireless.15.h"
+#include <net/if_arp.h>
+
+#include "wireless.16.h"
#endif