48 lines
1.5 KiB
Diff
48 lines
1.5 KiB
Diff
From a47f0cbb3d76db07b1c88ec70fd9ef1cec8c3c72 Mon Sep 17 00:00:00 2001
|
|
From: Guy Harris <gharris@sonic.net>
|
|
Date: Sat, 10 Apr 2021 19:20:49 -0700
|
|
Subject: [PATCH] Use sock_initaddress() to look up rpcap server addresses.
|
|
|
|
It does additional checking, and returns better error messages.
|
|
|
|
(cherry picked from commit b8b358a098500d68b790f7a303388d939621e256)
|
|
|
|
Conflict:Replacing snprintf with pcap_snprintf
|
|
Reference:https://github.com/the-tcpdump-group/libpcap/commit/a47f0cbb3d76db07b1c88ec70fd9ef1cec8c3c72
|
|
|
|
---
|
|
pcap-rpcap.c | 9 ++++-----
|
|
1 file changed, 4 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/pcap-rpcap.c b/pcap-rpcap.c
|
|
index a2612e9924..0c6c558960 100644
|
|
--- a/pcap-rpcap.c
|
|
+++ b/pcap-rpcap.c
|
|
@@ -1003,11 +1003,10 @@ rpcap_remoteact_getsock(const char *host, int *error, char *errbuf)
|
|
hints.ai_family = PF_UNSPEC;
|
|
hints.ai_socktype = SOCK_STREAM;
|
|
|
|
- retval = getaddrinfo(host, "0", &hints, &addrinfo);
|
|
+ retval = sock_initaddress(host, "0", &hints, &addrinfo, errbuf,
|
|
+ PCAP_ERRBUF_SIZE);
|
|
if (retval != 0)
|
|
{
|
|
- pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "getaddrinfo() %s",
|
|
- gai_strerror(retval));
|
|
*error = 1;
|
|
return NULL;
|
|
}
|
|
@@ -2992,10 +2991,10 @@ int pcap_remoteact_close(const char *host, char *errbuf)
|
|
hints.ai_family = PF_UNSPEC;
|
|
hints.ai_socktype = SOCK_STREAM;
|
|
|
|
- retval = getaddrinfo(host, "0", &hints, &addrinfo);
|
|
+ retval = sock_initaddress(host, "0", &hints, &addrinfo, errbuf,
|
|
+ PCAP_ERRBUF_SIZE);
|
|
if (retval != 0)
|
|
{
|
|
- pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "getaddrinfo() %s", gai_strerror(retval));
|
|
return -1;
|
|
}
|
|
|