diff options
author | Christopher K Lee <christopher.lee@cspi.com> | 2016-12-13 13:05:41 -0500 |
---|---|---|
committer | Christopher K Lee <christopher.lee@cspi.com> | 2016-12-13 13:05:41 -0500 |
commit | 842012ab4d8188a66a4c03da66f1782ba31dcecb (patch) | |
tree | bfcb88b6df06ecec7ad122abb4e118ac8589c4d4 /pcap-snf.c | |
parent | eb770f57ca9024a78ebb1a8b337d1ca7531c79e9 (diff) | |
parent | c980b57bc984223ff6b44f70b51e02ef8edea4cd (diff) |
Merge branch 'master' of https://github.com/the-tcpdump-group/libpcap
Diffstat (limited to 'pcap-snf.c')
-rw-r--r-- | pcap-snf.c | 35 |
1 files changed, 30 insertions, 5 deletions
@@ -66,9 +66,6 @@ snf_platform_cleanup(pcap_t *p) { struct pcap_snf *ps = p->priv; - if (p == NULL) - return; - #ifdef SNF_HAVE_INJECT_API if (ps->snf_inj) snf_inject_close(ps->snf_inj); @@ -245,7 +242,7 @@ static int snf_activate(pcap_t* p) { struct pcap_snf *ps = p->priv; - char *device = p->opt.source; + char *device = p->opt.device; const char *nr = NULL; int err; int flags = -1, ring_id = -1; @@ -594,7 +591,7 @@ snf_create(const char *device, char *ebuf, int *is_ours) /* OK, it's probably ours. */ *is_ours = 1; - p = pcap_create_common(device, ebuf, sizeof (struct pcap_snf)); + p = pcap_create_common(ebuf, sizeof (struct pcap_snf)); if (p == NULL) return NULL; ps = p->priv; @@ -617,3 +614,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 |