Re: [tcpdump-workers] [Patch] pcap-dos.c

2013-03-28 Thread Guy Harris

On Mar 28, 2013, at 5:53 AM, Gisle Vanem  wrote:

> This file has fallen behind since pcap_create() was put in
> pcap.c long time ago (a more generic create-function). Hence:

Checked into the trunk and the 1.4 branch.

___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


[tcpdump-workers] [Patch] pcap-dos.c

2013-03-28 Thread Gisle Vanem

This file has fallen behind since pcap_create() was put in
pcap.c long time ago (a more generic create-function). Hence:

--- Git-Latest\pcap-dos.c   Wed Nov 28 23:41:44 2012
+++ pcap-dos.c  Thu Nov 29 00:00:12 2012
@@ -143,7 +143,7 @@
  return handle_to_device [fd-1];
}

-pcap_t *pcap_create (const char *device, char *ebuf)
+pcap_t *pcap_create_interface (const char *device, char *ebuf)
{
   pcap_t *p;

@@ -211,7 +211,7 @@
pcap_read_one (pcap_t *p, pcap_handler callback, u_char *data)
{
  struct pcap_pkthdr pcap;
-  struct timeval now, expiry;
+  struct timeval now, expiry = { 0,0 };
  BYTE  *rx_buf;
  intrx_len = 0;

@@ -287,7 +287,7 @@
  return (1);
}

-/* If not to wait for a packet or pcap_close() called from
+/* If not to wait for a packet or pcap_cleanup_dos() called from
 * e.g. SIGINT handler, exit loop now.
 */
if (p->md.timeout <= 0 || (volatile int)p->fd <= 0)

--

The change in the comment is just to make it clear it's not pcap_close()
that's called directly.

--gv
___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Re: [tcpdump-workers] [Patch] pcap-dos.c

2008-04-25 Thread Gisle Vanem

"Guy Harris" <[EMAIL PROTECTED]> wrote:

So what *is* this case?  The error message is "Cannot use different 
devices simultaneously"; does that mean that you can have multiple 
instances of the same device open at the same time, but you can't have 
instances of more than one device open at the same time?


At least with a packet-driver (not tested other types) one can have 

1 instances open at the same time. But I'm not sure it's important

to be able to open 2 pcap-handles on DOS (since we have no threads etc).
We could probably leave the error-code as-is.

--gv
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Re: [tcpdump-workers] [Patch] pcap-dos.c

2008-04-25 Thread Guy Harris

Guy Harris wrote:

Gisle Vanem wrote:


Ok, but I reckoned PCAP_ERROR was too vague. I'm not sure what
errorcode would cover this case.


Perhaps we should add a new error code.


So what *is* this case?  The error message is "Cannot use different 
devices simultaneously"; does that mean that you can have multiple 
instances of the same device open at the same time, but you can't have 
instances of more than one device open at the same time?

-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Re: [tcpdump-workers] [Patch] pcap-dos.c

2008-04-22 Thread Guy Harris

Gisle Vanem wrote:

Two more details:


Checked in.
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Re: [tcpdump-workers] [Patch] pcap-dos.c

2008-04-22 Thread Gisle Vanem

Two more details:

--- pcap-dos.c.orig  Sat Apr 19 16:49:21 2008
+++ pcap-dos.cTue Apr 22 17:50:52 2008
@@ -1,6 +1,6 @@
/*
 *  This file is part of DOS-libpcap
- *  Ported to DOS/DOSX by G. Vanem <[EMAIL PROTECTED]>
+ *  Ported to DOS/DOSX by G. Vanem <[EMAIL PROTECTED]>
 *
 *  pcap-dos.c: Interface to PKTDRVR, NDIS2 and 32-bit pmode
 *  network drivers.
@@ -996,7 +996,7 @@
 * Application config hooks to set various driver parameters.
 */

-static struct config_table debug_tab[] = {
+static const struct config_table debug_tab[] = {
{ "PKT.DEBUG",   ARG_ATOI,   &pcap_pkt_debug},
{ "PKT.VECTOR",  ARG_ATOX_W, NULL   },
{ "NDIS.DEBUG",  ARG_ATOI,   NULL   },

--- CREDITS.orig  Fri Feb 08 00:34:49 2008
+++ CREDITS Tue Apr 22 18:06:13 2008
@@ -38,7 +38,7 @@
   Fulko Hew   
   Gianluca Varenni
   Gilbert Hoyek   
-   Gisle Vanem 
+   Gisle Vanem 
   Graeme Hewson   
   Greg Stark  
   Greg Troxel 

--gv
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Re: [tcpdump-workers] [Patch] pcap-dos.c

2008-04-19 Thread Guy Harris

Gisle Vanem wrote:


Ok, but I reckoned PCAP_ERROR was too vague. I'm not sure what
errorcode would cover this case.


Perhaps we should add a new error code.
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Re: [tcpdump-workers] [Patch] pcap-dos.c

2008-04-19 Thread Gisle Vanem

"Guy Harris" <[EMAIL PROTECTED]> wrote:


@@ -201,7 +202,7 @@
  "Cannot use different devices simultaneously "
  "(`%s' vs. `%s')", active_dev->name, pcap->md.device);
free (pcap);
-err = PCAP_ERROR;
+err = PCAP_ERROR_ACTIVATED;


PCAP_ERROR_ACTIVATED means you've called pcap_activate() on a pcap_t 
that's already had pcap_activate() called on it; this is a different case.


Ok, but I reckoned PCAP_ERROR was too vague. I'm not sure what
errorcode would cover this case.

--gv
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Re: [tcpdump-workers] [Patch] pcap-dos.c

2008-04-19 Thread Guy Harris

Gisle Vanem wrote:

The recent change for pcap_activate() broke the DOS-port.
Here's a small fix:


Checked into the main and 1.0 branches, along with some changes and 
other fixes.



   p->activate_op = pcap_activate_dos;
+   p->md.device = device;


I just changed it to use opt.device rather than md.device and not to 
bother setting md.device (the old code didn't use md.device).



@@ -201,7 +202,7 @@
  "Cannot use different devices simultaneously "
  "(`%s' vs. `%s')", active_dev->name, pcap->md.device);
free (pcap);
-err = PCAP_ERROR;
+err = PCAP_ERROR_ACTIVATED;


PCAP_ERROR_ACTIVATED means you've called pcap_activate() on a pcap_t 
that's already had pcap_activate() called on it; this is a different case.

-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


[tcpdump-workers] [Patch] pcap-dos.c

2008-04-19 Thread Gisle Vanem

The recent change for pcap_activate() broke the DOS-port.
Here's a small fix:

--- pcap-dos.c.orig  Mon Apr 14 19:40:58 2008
+++ pcap-doc.cThu Apr 17 15:33:00 2008
@@ -97,10 +97,10 @@

static struct device *handle_to_device [20];

-static void pcap_activate_dos (pcap_t *p);
+static int  pcap_activate_dos (pcap_t *p);
static int  pcap_read_dos (pcap_t *p, int cnt, pcap_handler callback,
   u_char *data);
-static void pcap_close_dos (pcap_t *p);
+static void pcap_cleanup_dos (pcap_t *p);
static int  pcap_stats_dos (pcap_t *p, struct pcap_stat *ps);
static int  pcap_sendpacket_dos (pcap_t *p, const void *buf, size_t len);
static int  pcap_setfilter_dos (pcap_t *p, struct bpf_program *fp);
@@ -152,6 +152,7 @@
   return (NULL);

   p->activate_op = pcap_activate_dos;
+   p->md.device = device;
   return (p);
}

@@ -163,7 +164,7 @@
{
  int err = 0;

-  if (p->opt.rfmon) {
+  if (pcap->opt.rfmon) {
/*
 * No monitor mode on DOS.
 */
@@ -201,7 +202,7 @@
  "Cannot use different devices simultaneously "
  "(`%s' vs. `%s')", active_dev->name, pcap->md.device);
free (pcap);
-err = PCAP_ERROR;
+err = PCAP_ERROR_ACTIVATED;
  }
  handle_to_device [pcap->fd-1] = active_dev;
  return (err);
@@ -743,7 +744,7 @@
 fprintf (stderr, "Catching signal %d.\n", sig);
  }
  exc_occured = 1;
-  pcap_close_dos (NULL);
+  pcap_cleanup_dos (NULL);
}
#endif  /* __DJGPP__ */



--gv
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.