]> The Tcpdump Group git mirrors - libpcap/blobdiff - pcap-libdlpi.c
Clean up findalldevs code.
[libpcap] / pcap-libdlpi.c
index 625f1e0a31ed5168000f626b8a68aa633d2e6e6f..933f2bdc039c3b2cf9873aeda24d5d03bf1e870c 100644 (file)
@@ -298,6 +298,13 @@ pcap_platform_finddevs(pcap_if_t **alldevsp, char *errbuf)
 
        /* dlpi_walk() for loopback will be added here. */
 
+       /*
+        * Find all DLPI devices in the current zone.
+        *
+        * XXX - will pcap_findalldevs_interfaces() find any devices
+        * outside the current zone?  If not, the only reason to call
+        * it would be to get the interface addresses.
+        */
        dlpi_walk(list_interfaces, &lw, 0);
 
        if (lw.lw_err != 0) {
@@ -309,7 +316,11 @@ pcap_platform_finddevs(pcap_if_t **alldevsp, char *errbuf)
 
        /* Add linkname if it does not exist on the list. */
        for (entry = lw.lw_list; entry != NULL; entry = entry->lnl_next) {
-               if (pcap_add_if(alldevsp, entry->linkname, 0, NULL, errbuf) < 0)
+               /*
+                * If it isn't already in the list of devices, try to
+                * add it.
+                */
+               if (find_or_add_dev(alldevsp, entry->linkname, 0, NULL, errbuf) == NULL)
                        retv = -1;
        }
 done: