From: natano Date: Wed, 19 Apr 2017 05:36:12 +0000 (+0000) Subject: Switch base tools from /dev/bpf0 to /dev/bpf. Now that /dev/bpf has been X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7b08a90aae262418a4b5fe9eae6b24d21fd1dcd4;p=openbsd Switch base tools from /dev/bpf0 to /dev/bpf. Now that /dev/bpf has been around for two releases, it should be safe to do so. ok bluhm deraadt sthen tb yasuoka --- diff --git a/lib/libpcap/pcap-bpf.c b/lib/libpcap/pcap-bpf.c index 3aa492cbb2b..1b3388835a0 100644 --- a/lib/libpcap/pcap-bpf.c +++ b/lib/libpcap/pcap-bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcap-bpf.c,v 1.34 2016/05/08 08:20:50 natano Exp $ */ +/* $OpenBSD: pcap-bpf.c,v 1.35 2017/04/19 05:36:12 natano Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996, 1998 @@ -216,9 +216,9 @@ bpf_open(pcap_t *p) { int fd; - fd = open("/dev/bpf0", O_RDWR); + fd = open("/dev/bpf", O_RDWR); if (fd == -1 && errno == EACCES) - fd = open("/dev/bpf0", O_RDONLY); + fd = open("/dev/bpf", O_RDONLY); if (fd == -1) { if (errno == EACCES) diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c index 2e6978c48b8..bdf44d2e8e4 100644 --- a/sbin/dhclient/bpf.c +++ b/sbin/dhclient/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.49 2017/04/18 13:59:09 krw Exp $ */ +/* $OpenBSD: bpf.c,v 1.50 2017/04/19 05:36:12 natano Exp $ */ /* BPF socket interface code, originally contributed by Archie Cobbs. */ @@ -78,13 +78,13 @@ if_register_bpf(struct interface_info *ifi) struct ifreq ifr; int sock; - if ((sock = open("/dev/bpf0", O_RDWR | O_CLOEXEC)) == -1) + if ((sock = open("/dev/bpf", O_RDWR | O_CLOEXEC)) == -1) fatal("Can't open bpf"); /* Set the BPF device to point at this interface. */ strlcpy(ifr.ifr_name, ifi->name, IFNAMSIZ); if (ioctl(sock, BIOCSETIF, &ifr) < 0) - fatal("Can't attach interface %s to /dev/bpf0", ifi->name); + fatal("Can't attach interface %s to /dev/bpf", ifi->name); return (sock); } diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c index 48d3aa95cdc..59180d01527 100644 --- a/usr.sbin/arp/arp.c +++ b/usr.sbin/arp/arp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arp.c,v 1.78 2017/04/15 11:50:24 bluhm Exp $ */ +/* $OpenBSD: arp.c,v 1.79 2017/04/19 05:36:12 natano Exp $ */ /* $NetBSD: arp.c,v 1.12 1995/04/24 13:25:18 cgd Exp $ */ /* @@ -821,7 +821,7 @@ wake(const char *ether_addr, const char *iface) char *pname = NULL; int bpf; - if ((bpf = open("/dev/bpf0", O_RDWR)) == -1) + if ((bpf = open("/dev/bpf", O_RDWR)) == -1) err(1, "Failed to bind to bpf"); if (iface == NULL) { diff --git a/usr.sbin/dhcpd/bpf.c b/usr.sbin/dhcpd/bpf.c index 9b4ea9ec9c6..784301a5e1b 100644 --- a/usr.sbin/dhcpd/bpf.c +++ b/usr.sbin/dhcpd/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.18 2017/04/18 13:59:09 krw Exp $ */ +/* $OpenBSD: bpf.c,v 1.19 2017/04/19 05:36:12 natano Exp $ */ /* BPF socket interface code, originally contributed by Archie Cobbs. */ @@ -77,7 +77,7 @@ if_register_bpf(struct interface_info *info) { int sock; - if ((sock = open("/dev/bpf0", O_RDWR)) == -1) + if ((sock = open("/dev/bpf", O_RDWR)) == -1) fatal("Can't open bpf device"); /* Set the BPF device to point at this interface. */ diff --git a/usr.sbin/dhcrelay/bpf.c b/usr.sbin/dhcrelay/bpf.c index b842cffc5fd..49ac514a2eb 100644 --- a/usr.sbin/dhcrelay/bpf.c +++ b/usr.sbin/dhcrelay/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.18 2017/04/05 14:40:56 reyk Exp $ */ +/* $OpenBSD: bpf.c,v 1.19 2017/04/19 05:36:12 natano Exp $ */ /* BPF socket interface code, originally contributed by Archie Cobbs. */ @@ -72,7 +72,7 @@ if_register_bpf(struct interface_info *info) int sock; /* Open the BPF device */ - if ((sock = open("/dev/bpf0", O_RDWR)) == -1) + if ((sock = open("/dev/bpf", O_RDWR)) == -1) fatal("Can't open bpf device"); /* Set the BPF device to point at this interface. */ diff --git a/usr.sbin/dhcrelay6/bpf.c b/usr.sbin/dhcrelay6/bpf.c index 1289d9a504a..dbc7098c9a8 100644 --- a/usr.sbin/dhcrelay6/bpf.c +++ b/usr.sbin/dhcrelay6/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.1 2017/03/17 14:45:16 rzalamena Exp $ */ +/* $OpenBSD: bpf.c,v 1.2 2017/04/19 05:36:13 natano Exp $ */ /* BPF socket interface code, originally contributed by Archie Cobbs. */ @@ -75,7 +75,7 @@ if_register_bpf(struct interface_info *info) int sock; /* Open the BPF device */ - if ((sock = open("/dev/bpf0", O_RDWR)) == -1) + if ((sock = open("/dev/bpf", O_RDWR)) == -1) fatal("Can't open bpf device"); /* Set the BPF device to point at this interface. */ diff --git a/usr.sbin/hostapd/hostapd.c b/usr.sbin/hostapd/hostapd.c index 3bb5bd5a572..9e84a0700b1 100644 --- a/usr.sbin/hostapd/hostapd.c +++ b/usr.sbin/hostapd/hostapd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hostapd.c,v 1.37 2016/05/28 07:00:18 natano Exp $ */ +/* $OpenBSD: hostapd.c,v 1.38 2017/04/19 05:36:13 natano Exp $ */ /* * Copyright (c) 2004, 2005 Reyk Floeter @@ -173,7 +173,7 @@ hostapd_bpf_open(u_int flags) int fd = -1; struct bpf_version bpv; - if ((fd = open("/dev/bpf0", flags)) == -1) { + if ((fd = open("/dev/bpf", flags)) == -1) { hostapd_fatal("unable to open BPF device: %s\n", strerror(errno)); } diff --git a/usr.sbin/mopd/common/pf.c b/usr.sbin/mopd/common/pf.c index 939fbf31653..d38b1095e9d 100644 --- a/usr.sbin/mopd/common/pf.c +++ b/usr.sbin/mopd/common/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.16 2016/05/28 07:00:18 natano Exp $ */ +/* $OpenBSD: pf.c,v 1.17 2017/04/19 05:36:13 natano Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -98,7 +98,7 @@ pfInit(char *interface, int mode, u_short protocol, int typ) insns }; - if ((fd = open("/dev/bpf0", mode)) == -1) { + if ((fd = open("/dev/bpf", mode)) == -1) { syslog(LOG_ERR,"pfInit: open bpf %m"); return (-1); } diff --git a/usr.sbin/npppd/npppd/privsep.c b/usr.sbin/npppd/npppd/privsep.c index d248b724bed..5b934469ef1 100644 --- a/usr.sbin/npppd/npppd/privsep.c +++ b/usr.sbin/npppd/npppd/privsep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep.c,v 1.22 2016/05/28 07:00:18 natano Exp $ */ +/* $OpenBSD: privsep.c,v 1.23 2017/04/19 05:36:13 natano Exp $ */ /* * Copyright (c) 2010 Yasuoka Masahiko @@ -983,7 +983,7 @@ privsep_npppd_check_open(struct PRIVSEP_OPEN_ARG *arg) int readonly; } const allow_paths[] = { { NPPPD_DIR "/", 1, 1 }, - { "/dev/bpf0", 0, 0 }, + { "/dev/bpf", 0, 0 }, { "/etc/resolv.conf", 0, 1 }, { "/dev/tun", 1, 0 }, { "/dev/pppx", 1, 0 } diff --git a/usr.sbin/npppd/pppoe/pppoed.c b/usr.sbin/npppd/pppoe/pppoed.c index ec4e90e496b..75b6fa97f0c 100644 --- a/usr.sbin/npppd/pppoe/pppoed.c +++ b/usr.sbin/npppd/pppoe/pppoed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pppoed.c,v 1.20 2016/05/28 07:00:18 natano Exp $ */ +/* $OpenBSD: pppoed.c,v 1.21 2017/04/19 05:36:13 natano Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -28,7 +28,7 @@ /**@file * This file provides the PPPoE(RFC2516) server(access concentrator) * implementaion. - * $Id: pppoed.c,v 1.20 2016/05/28 07:00:18 natano Exp $ + * $Id: pppoed.c,v 1.21 2017/04/19 05:36:13 natano Exp $ */ #include /* ALIGN */ #include @@ -273,7 +273,7 @@ pppoed_listener_start(pppoed_listener *_this, int restart) goto fail; } - if ((_this->bpf = priv_open("/dev/bpf0", O_RDWR)) == -1) { + if ((_this->bpf = priv_open("/dev/bpf", O_RDWR)) == -1) { pppoed_log(_pppoed, log_level, "Cannot open bpf: %m"); goto fail; } diff --git a/usr.sbin/rarpd/rarpd.c b/usr.sbin/rarpd/rarpd.c index 81dcb1f4737..a2dc5d9c4a0 100644 --- a/usr.sbin/rarpd/rarpd.c +++ b/usr.sbin/rarpd/rarpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rarpd.c,v 1.71 2017/01/20 06:22:38 krw Exp $ */ +/* $OpenBSD: rarpd.c,v 1.72 2017/04/19 05:36:13 natano Exp $ */ /* $NetBSD: rarpd.c,v 1.25 1998/04/23 02:48:33 mrg Exp $ */ /* @@ -244,8 +244,8 @@ rarp_open(char *device) struct ifreq ifr; u_int dlt; - if ((fd = open("/dev/bpf0", O_RDWR)) == -1) - error("/dev/bpf0: %s", strerror(errno)); + if ((fd = open("/dev/bpf", O_RDWR)) == -1) + error("/dev/bpf: %s", strerror(errno)); /* Set immediate mode so packets are processed as they arrive. */ immediate = 1; diff --git a/usr.sbin/rbootd/bpf.c b/usr.sbin/rbootd/bpf.c index cce33fa6351..069253c0973 100644 --- a/usr.sbin/rbootd/bpf.c +++ b/usr.sbin/rbootd/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.25 2016/05/28 07:00:18 natano Exp $ */ +/* $OpenBSD: bpf.c,v 1.26 2017/04/19 05:36:13 natano Exp $ */ /* $NetBSD: bpf.c,v 1.5.2.1 1995/11/14 08:45:42 thorpej Exp $ */ /* @@ -84,7 +84,7 @@ BpfOpen(void) struct ifreq ifr; int n; - if ((BpfFd = open("/dev/bpf0", O_RDWR)) == -1) { + if ((BpfFd = open("/dev/bpf", O_RDWR)) == -1) { syslog(LOG_ERR, "bpf: can't open device: %m"); DoExit(); } diff --git a/usr.sbin/rbootd/rbootd.8 b/usr.sbin/rbootd/rbootd.8 index cc1f4d57968..f2ac57adb8b 100644 --- a/usr.sbin/rbootd/rbootd.8 +++ b/usr.sbin/rbootd/rbootd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: rbootd.8,v 1.16 2016/05/28 07:00:18 natano Exp $ +.\" $OpenBSD: rbootd.8,v 1.17 2017/04/19 05:36:13 natano Exp $ .\" $NetBSD: rbootd.8,v 1.3 1995/08/21 17:05:16 thorpej Exp $ .\" .\" Copyright (c) 1988, 1992 The University of Utah and the Center @@ -41,7 +41,7 @@ .\" Utah Hdr: rbootd.man 3.1 92/07/06 .\" Author: Jeff Forys, University of Utah CSS .\" -.Dd $Mdocdate: May 28 2016 $ +.Dd $Mdocdate: April 19 2017 $ .Dt RBOOTD 8 .Os .Sh NAME @@ -135,7 +135,7 @@ Turn off debugging, do nothing if already off. .El .Sh FILES .Bl -tag -width /usr/libexec/rbootd -compact -.It Pa /dev/bpf0 +.It Pa /dev/bpf packet-filter device .It Pa /etc/rbootd.conf configuration file diff --git a/usr.sbin/tcpdump/privsep_pcap.c b/usr.sbin/tcpdump/privsep_pcap.c index 70d9f7d6fe6..d5965aa8c38 100644 --- a/usr.sbin/tcpdump/privsep_pcap.c +++ b/usr.sbin/tcpdump/privsep_pcap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep_pcap.c,v 1.21 2016/05/08 08:20:50 natano Exp $ */ +/* $OpenBSD: privsep_pcap.c,v 1.22 2017/04/19 05:36:13 natano Exp $ */ /* * Copyright (c) 2004 Can Erkin Acar @@ -182,7 +182,7 @@ pcap_live(const char *device, int snaplen, int promisc, u_int dlt, if (device == NULL || snaplen <= 0) return (-1); - if ((fd = open("/dev/bpf0", O_RDONLY)) == -1) + if ((fd = open("/dev/bpf", O_RDONLY)) == -1) return (-1); v = 32768; /* XXX this should be a user-accessible hook */ diff --git a/usr.sbin/tcpdump/tcpdump.8 b/usr.sbin/tcpdump/tcpdump.8 index c8b3de13b46..947461a6fca 100644 --- a/usr.sbin/tcpdump/tcpdump.8 +++ b/usr.sbin/tcpdump/tcpdump.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tcpdump.8,v 1.91 2016/05/08 08:20:50 natano Exp $ +.\" $OpenBSD: tcpdump.8,v 1.92 2017/04/19 05:36:13 natano Exp $ .\" .\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996 .\" The Regents of the University of California. All rights reserved. @@ -19,7 +19,7 @@ .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" -.Dd $Mdocdate: May 8 2016 $ +.Dd $Mdocdate: April 19 2017 $ .Dt TCPDUMP 8 .Os .Sh NAME @@ -44,7 +44,7 @@ prints out the headers of packets on a network interface that match the boolean .Ar expression . You must have read access to -.Pa /dev/bpf0 . +.Pa /dev/bpf . .Pp The options are as follows: .Bl -tag -width "-c count"