From owner-svn-src-all@freebsd.org Mon Mar 6 08:13:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D70B6CFB83E; Mon, 6 Mar 2017 08:13:20 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 873931C95; Mon, 6 Mar 2017 08:13:20 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v268DJxs041692; Mon, 6 Mar 2017 08:13:19 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v268DJUq041691; Mon, 6 Mar 2017 08:13:19 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201703060813.v268DJUq041691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 6 Mar 2017 08:13:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314769 - head/lib/libpcap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Mar 2017 08:13:20 -0000 Author: delphij Date: Mon Mar 6 08:13:19 2017 New Revision: 314769 URL: https://svnweb.freebsd.org/changeset/base/314769 Log: Remove compatibility with old libpcap. Differential Revision: https://reviews.freebsd.org/D9606 Modified: head/lib/libpcap/pcap-netmap.c Modified: head/lib/libpcap/pcap-netmap.c ============================================================================== --- head/lib/libpcap/pcap-netmap.c Mon Mar 6 07:11:23 2017 (r314768) +++ head/lib/libpcap/pcap-netmap.c Mon Mar 6 08:13:19 2017 (r314769) @@ -22,6 +22,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ #ifdef HAVE_CONFIG_H @@ -42,24 +44,7 @@ #include "pcap-int.h" -/* - * $FreeBSD$ - * - * This code is meant to build also on other versions of libpcap. - * - * older libpcap miss p->priv, use p->md.device instead (and allocate). - * Also opt.timeout was in md.timeout before. - * Use #define PCAP_IF_UP to discriminate - */ -#ifdef PCAP_IF_UP #define NM_PRIV(p) ((struct pcap_netmap *)(p->priv)) -#define the_timeout opt.timeout -#else -#define HAVE_NO_PRIV -#define NM_PRIV(p) ((struct pcap_netmap *)(p->md.device)) -#define SET_PRIV(p, x) p->md.device = (void *)x -#define the_timeout md.timeout -#endif #if defined (linux) /* On FreeBSD we use IFF_PPROMISC which is in ifr_flagshigh. @@ -124,7 +109,7 @@ pcap_netmap_dispatch(pcap_t *p, int cnt, if (ret != 0) break; errno = 0; - ret = poll(&pfd, 1, p->the_timeout); + ret = poll(&pfd, 1, p->opt.timeout); } return ret; } @@ -197,10 +182,6 @@ pcap_netmap_close(pcap_t *p) } } nm_close(d); -#ifdef HAVE_NO_PRIV - free(pn); - SET_PRIV(p, NULL); // unnecessary -#endif pcap_cleanup_live_common(p); } @@ -216,10 +197,6 @@ pcap_netmap_activate(pcap_t *p) snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "netmap open: cannot access %s: %s\n", p->opt.device, pcap_strerror(errno)); -#ifdef HAVE_NO_PRIV - free(pn); - SET_PRIV(p, NULL); // unnecessary -#endif pcap_cleanup_live_common(p); return (PCAP_ERROR); } @@ -261,23 +238,9 @@ pcap_netmap_create(const char *device, c *is_ours = (!strncmp(device, "netmap:", 7) || !strncmp(device, "vale", 4)); if (! *is_ours) return NULL; -#ifdef HAVE_NO_PRIV - { - void *pn = calloc(1, sizeof(struct pcap_netmap)); - if (pn == NULL) - return NULL; - p = pcap_create_common(device, ebuf); - if (p == NULL) { - free(pn); - return NULL; - } - SET_PRIV(p, pn); - } -#else p = pcap_create_common(ebuf, sizeof (struct pcap_netmap)); if (p == NULL) return (NULL); -#endif p->activate_op = pcap_netmap_activate; return (p); }