diff options
author | natano <natano@openbsd.org> | 2016-05-28 07:00:18 +0000 |
---|---|---|
committer | natano <natano@openbsd.org> | 2016-05-28 07:00:18 +0000 |
commit | 2abf9a0d86fa9b4fb1b6fb30d464b452304d1b90 (patch) | |
tree | 3c1599cc8846249363d55b245b3c954b2c92dc84 /usr.sbin/hostapd | |
parent | Do the endpoint verification before opening the pipe on the selected (diff) | |
download | wireguard-openbsd-2abf9a0d86fa9b4fb1b6fb30d464b452304d1b90.tar.xz wireguard-openbsd-2abf9a0d86fa9b4fb1b6fb30d464b452304d1b90.zip |
Replace the /dev/bpf* open loop with a plain open("/dev/bpf0", ...).
ok deraadt jca
Diffstat (limited to 'usr.sbin/hostapd')
-rw-r--r-- | usr.sbin/hostapd/hostapd.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/usr.sbin/hostapd/hostapd.c b/usr.sbin/hostapd/hostapd.c index 942ecfbd8a2..3bb5bd5a572 100644 --- a/usr.sbin/hostapd/hostapd.c +++ b/usr.sbin/hostapd/hostapd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hostapd.c,v 1.36 2015/12/22 19:45:09 mmcc Exp $ */ +/* $OpenBSD: hostapd.c,v 1.37 2016/05/28 07:00:18 natano Exp $ */ /* * Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org> @@ -170,29 +170,14 @@ hostapd_check_file_secrecy(int fd, const char *fname) int hostapd_bpf_open(u_int flags) { - u_int i; int fd = -1; - char *dev; struct bpf_version bpv; - /* - * Try to open the next available BPF device - */ - for (i = 0; i < 255; i++) { - if (asprintf(&dev, "/dev/bpf%u", i) == -1) - hostapd_fatal("failed to allocate buffer\n"); - - if ((fd = open(dev, flags)) != -1) { - free(dev); - break; - } - - free(dev); + if ((fd = open("/dev/bpf0", flags)) == -1) { + hostapd_fatal("unable to open BPF device: %s\n", + strerror(errno)); } - if (fd == -1) - hostapd_fatal("unable to open BPF device\n"); - /* * Get and validate the BPF version */ |