the new pcap_create/pcap_activate model, use pcap->opt.source rather
than pcap->md.device in the activate routine (pcap->md.device isn't
set), don't free the pcap_t if the activate routine fails, fix the
error return code paths not to set handle_to_device, fix references to
pcap_close_dos() to refer to pcap_cleanup_dos() as we renamed the
routine.
* pcap-dos.c: Interface to PKTDRVR, NDIS2 and 32-bit pmode
* network drivers.
*
* pcap-dos.c: Interface to PKTDRVR, NDIS2 and 32-bit pmode
* network drivers.
*
- * @(#) $Header: /tcpdump/master/libpcap/pcap-dos.c,v 1.2.2.3 2008-04-14 20:41:51 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/pcap-dos.c,v 1.2.2.4 2008-04-19 17:49:37 guy Exp $ (LBL)
static struct device *handle_to_device [20];
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 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);
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);
*/
static int pcap_activate_dos (pcap_t *pcap)
{
*/
static int pcap_activate_dos (pcap_t *pcap)
{
- int err = 0;
-
- if (p->opt.rfmon) {
/*
* No monitor mode on DOS.
*/
/*
* No monitor mode on DOS.
*/
if (pcap->fd == 1) /* first time we're called */
{
if (pcap->fd == 1) /* first time we're called */
{
- if (!init_watt32(pcap, pcap->md.device, pcap->errbuf) ||
- !first_init(pcap->md.device, pcap->errbuf, pcap->opt.promisc))
+ if (!init_watt32(pcap, pcap->opt.source, pcap->errbuf) ||
+ !first_init(pcap->opt.source, pcap->errbuf, pcap->opt.promisc))
return (PCAP_ERROR);
}
atexit (close_driver);
}
return (PCAP_ERROR);
}
atexit (close_driver);
}
- else if (stricmp(active_dev->name,pcap->md.device))
+ else if (stricmp(active_dev->name,pcap->opt.source))
{
snprintf (pcap->errbuf, PCAP_ERRBUF_SIZE,
"Cannot use different devices simultaneously "
{
snprintf (pcap->errbuf, PCAP_ERRBUF_SIZE,
"Cannot use different devices simultaneously "
- "(`%s' vs. `%s')", active_dev->name, pcap->md.device);
- free (pcap);
- err = PCAP_ERROR;
+ "(`%s' vs. `%s')", active_dev->name, pcap->opt.source);
+ return (PCAP_ERROR);
}
handle_to_device [pcap->fd-1] = active_dev;
}
handle_to_device [pcap->fd-1] = active_dev;
fprintf (stderr, "Catching signal %d.\n", sig);
}
exc_occured = 1;
fprintf (stderr, "Catching signal %d.\n", sig);
}
exc_occured = 1;
+ pcap_cleanup_dos (NULL);