From 56889e2bb6d732af2fd881bc24e45a2c1a51e38b Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 30 Jun 2016 21:29:14 -0700 Subject: Clean up {DAG, Septel, Myricom SNF}-only builds. In the core code, treat them similarly to other builds. In the configure script, ensure that no other pcap-XXX.c file is built, so we have only the entries for the capture mechanism in question in the tables for pcap_findalldevs() and pcap_create(), so that those routines are the only ones called. If XXX_ONLY is defined in pcap-XXX.c, define a stub pcap_platform_finddevs() that finds no regular interfaces and a stub pcap_create_interface() that fails with a "we only support XXX" error message. --- pcap-snf.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'pcap-snf.c') diff --git a/pcap-snf.c b/pcap-snf.c index a72fdd88..207c4959 100644 --- a/pcap-snf.c +++ b/pcap-snf.c @@ -490,3 +490,31 @@ snf_create(const char *device, char *ebuf, int *is_ours) ps->snf_boardnum = boardnum; return p; } + +#ifdef SNF_ONLY +/* + * This libpcap build supports only SNF cards, not regular network + * interfaces.. + */ + +/* + * There are no regular interfaces, just DAG interfaces. + */ +int +pcap_platform_finddevs(pcap_if_t **alldevsp, char *errbuf) +{ + *alldevsp = NULL; + return (0); +} + +/* + * Attempts to open a regular interface fail. + */ +pcap_t * +pcap_create_interface(const char *device, char *errbuf) +{ + pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, + "This version of libpcap only supports SNF cards"); + return NULL; +} +#endif -- cgit v1.2.1