aboutsummaryrefslogtreecommitdiff
path: root/pcap-new.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-03-13 20:14:57 -0700
committerGuy Harris <guy@alum.mit.edu>2017-03-13 20:14:57 -0700
commit77ac17c44f1a276b0d1149042a2a691a30f04ccd (patch)
tree7cbcb8f3410ae7040ee215268b67a2724a094e9a /pcap-new.c
parent92e4d638fb3432d93ca4d5871300332879a829ce (diff)
Fix remote opening and remote open error string return.
Pass the interface name, not the full URL, to pcap_create(). If pcap_open_rpcap() fails, copy the error message from the pcap_t to errbuf, as we'll be closing and freeing the pcap_t.
Diffstat (limited to 'pcap-new.c')
-rw-r--r--pcap-new.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pcap-new.c b/pcap-new.c
index 3c8e43d2..5b9a8a4b 100644
--- a/pcap-new.c
+++ b/pcap-new.c
@@ -576,7 +576,7 @@ pcap_t *pcap_open(const char *source, int snaplen, int flags, int read_timeout,
break;
case PCAP_SRC_IFLOCAL:
- fp = pcap_create(source, errbuf);
+ fp = pcap_create(name, errbuf);
if (fp == NULL)
return (NULL);
status = pcap_set_snaplen(fp, snaplen);
@@ -629,15 +629,15 @@ pcap_t *pcap_open(const char *source, int snaplen, int flags, int read_timeout,
fail:
if (status == PCAP_ERROR)
pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
- source, fp->errbuf);
+ name, fp->errbuf);
else if (status == PCAP_ERROR_NO_SUCH_DEVICE ||
status == PCAP_ERROR_PERM_DENIED ||
status == PCAP_ERROR_PROMISC_PERM_DENIED)
pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s (%s)",
- source, pcap_statustostr(status), fp->errbuf);
+ name, pcap_statustostr(status), fp->errbuf);
else
pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
- source, pcap_statustostr(status));
+ name, pcap_statustostr(status));
pcap_close(fp);
return NULL;