]> The Tcpdump Group git mirrors - libpcap/blobdiff - pcap-dos.c
pcap_create_interface() needs the interface name on Linux.
[libpcap] / pcap-dos.c
index bf4777da332ab5c66cfb9b690c5a454c1946241c..ea6b225a23efaa6bacb607223955262ce968cdcb 100644 (file)
@@ -149,11 +149,11 @@ struct pcap_dos {
        struct pcap_stat stat;
 };
 
-pcap_t *pcap_create_interface (const char *device, char *ebuf)
+pcap_t *pcap_create_interface (const char *device _U_, char *ebuf)
 {
        pcap_t *p;
 
-       p = pcap_create_common(device, ebuf, sizeof (struct pcap_dos));
+       p = pcap_create_common(ebuf, sizeof (struct pcap_dos));
        if (p == NULL)
                return (NULL);
 
@@ -194,18 +194,18 @@ static int pcap_activate_dos (pcap_t *pcap)
 
   if (pcap->fd == 1)  /* first time we're called */
   {
-    if (!init_watt32(pcap, pcap->opt.source, pcap->errbuf) ||
-        !first_init(pcap->opt.source, pcap->errbuf, pcap->opt.promisc))
+    if (!init_watt32(pcap, pcap->opt.device, pcap->errbuf) ||
+        !first_init(pcap->opt.device, pcap->errbuf, pcap->opt.promisc))
     {
       return (PCAP_ERROR);
     }
     atexit (close_driver);
   }
-  else if (stricmp(active_dev->name,pcap->opt.source))
+  else if (stricmp(active_dev->name,pcap->opt.device))
   {
     pcap_snprintf (pcap->errbuf, PCAP_ERRBUF_SIZE,
                    "Cannot use different devices simultaneously "
-                   "(`%s' vs. `%s')", active_dev->name, pcap->opt.source);
+                   "(`%s' vs. `%s')", active_dev->name, pcap->opt.device);
     return (PCAP_ERROR);
   }
   handle_to_device [pcap->fd-1] = active_dev;
@@ -451,7 +451,7 @@ static void pcap_cleanup_dos (pcap_t *p)
 {
   struct pcap_dos *pd;
 
-  if (p && !exc_occured)
+  if (!exc_occured)
   {
     pd = p->priv;
     if (pcap_stats(p,NULL) < 0)
@@ -542,7 +542,7 @@ int pcap_lookupnet (const char *device, bpf_u_int32 *localnet,
  * The list, as returned through "alldevsp", may be NULL if no interfaces
  * were up and could be opened.
  */
-int pcap_findalldevs_interfaces (pcap_if_t **alldevsp, char *errbuf)
+int pcap_platform_finddevs  (pcap_if_t **alldevsp, char *errbuf)
 {
   struct device     *dev;
   struct sockaddr_in sa_ll_1, sa_ll_2;
@@ -603,17 +603,6 @@ int pcap_findalldevs_interfaces (pcap_if_t **alldevsp, char *errbuf)
   return (ret);
 }
 
-/*
- * platform-dependent routine to add devices or interfaces.
- * We don't have any, so just return 0.
- */
-int pcap_platform_finddevs  (pcap_if_t **alldevsp, char *errbuf)
-{
-  (void) alldevsp;
-  (void) errbuf;
-  return (0);
-}
-
 /*
  * pcap_assert() is mainly used for debugging
  */
@@ -783,7 +772,7 @@ static void exc_handler (int sig)
          fprintf (stderr, "Catching signal %d.\n", sig);
   }
   exc_occured = 1;
-  pcap_cleanup_dos (NULL);
+  close_driver();
 }
 #endif  /* __DJGPP__ */