From 166d872d9ec681a8cd0e915edccbd856e5060553 Mon Sep 17 00:00:00 2001
From: Chris Kuethe <chris.kuethe@gmail.com>
Date: Tue, 4 Oct 2022 11:44:20 -0700
Subject: [PATCH] Apparently `pcap_lookupdev` is deprecated

---
 src/passivedns.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/passivedns.c b/src/passivedns.c
index eb080b0..ced6587 100644
--- a/src/passivedns.c
+++ b/src/passivedns.c
@@ -1520,8 +1520,15 @@ int main(int argc, char *argv[])
     }
     else {
         /* Look up an available device if non specified */
-        if (config.dev == 0x0)
-            config.dev = pcap_lookupdev(config.errbuf);
+        if (config.dev == 0x0) {
+            pcap_if_t *alldevs;
+            if (0 != pcap_findalldevs(&alldevs, config.errbuf)) {
+                elog("[*] Error pcap_findalldevs: %s \n", config.errbuf);
+                exit(1);
+            }
+            config.dev = strdup(alldevs[0].name);
+            pcap_freealldevs(alldevs);
+        }
         olog("[*] Device: %s\n", config.dev);
 
         if ((config.handle = pcap_open_live(config.dev, SNAPLENGTH, config.promisc, 500,
