- networking modules eth_tap and eth_tuntap fixed for OpenBSD
- removed unnecessary spaces
This commit is contained in:
parent
79afc6dd01
commit
4314b6a911
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: eth_tap.cc,v 1.27 2005-12-10 18:37:35 vruppert Exp $
|
// $Id: eth_tap.cc,v 1.28 2006-11-23 17:21:58 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||||
@ -275,37 +275,38 @@ bx_tap_pktmover_c::sendpkt(void *buf, unsigned io_len)
|
|||||||
Bit8u txbuf[BX_PACKET_BUFSIZE];
|
Bit8u txbuf[BX_PACKET_BUFSIZE];
|
||||||
txbuf[0] = 0;
|
txbuf[0] = 0;
|
||||||
txbuf[1] = 0;
|
txbuf[1] = 0;
|
||||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) // Should be fixed for other *BSD
|
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
|
||||||
memcpy (txbuf, buf, io_len);
|
defined(__APPLE__) || defined(__OpenBSD__) // Should be fixed for other *BSD
|
||||||
unsigned int size = write (fd, txbuf, io_len);
|
memcpy(txbuf, buf, io_len);
|
||||||
|
unsigned int size = write(fd, txbuf, io_len);
|
||||||
if (size != io_len) {
|
if (size != io_len) {
|
||||||
#else
|
#else
|
||||||
memcpy (txbuf+2, buf, io_len);
|
memcpy(txbuf+2, buf, io_len);
|
||||||
unsigned int size = write (fd, txbuf, io_len+2);
|
unsigned int size = write(fd, txbuf, io_len+2);
|
||||||
if (size != io_len+2) {
|
if (size != io_len+2) {
|
||||||
#endif
|
#endif
|
||||||
BX_PANIC (("write on tap device: %s", strerror (errno)));
|
BX_PANIC(("write on tap device: %s", strerror(errno)));
|
||||||
} else {
|
} else {
|
||||||
BX_DEBUG (("wrote %d bytes + 2 byte pad on tap", io_len));
|
BX_DEBUG(("wrote %d bytes + 2 byte pad on tap", io_len));
|
||||||
}
|
}
|
||||||
#if BX_ETH_TAP_LOGGING
|
#if BX_ETH_TAP_LOGGING
|
||||||
BX_DEBUG (("sendpkt length %u", io_len));
|
BX_DEBUG(("sendpkt length %u", io_len));
|
||||||
// dump raw bytes to a file, eventually dump in pcap format so that
|
// dump raw bytes to a file, eventually dump in pcap format so that
|
||||||
// tcpdump -r FILE can interpret them for us.
|
// tcpdump -r FILE can interpret them for us.
|
||||||
int n = fwrite (buf, io_len, 1, txlog);
|
int n = fwrite(buf, io_len, 1, txlog);
|
||||||
if (n != 1) BX_ERROR (("fwrite to txlog failed, io_len = %u", io_len));
|
if (n != 1) BX_ERROR(("fwrite to txlog failed, io_len = %u", io_len));
|
||||||
// dump packet in hex into an ascii log file
|
// dump packet in hex into an ascii log file
|
||||||
fprintf (txlog_txt, "NE2K transmitting a packet, length %u\n", io_len);
|
fprintf(txlog_txt, "NE2K transmitting a packet, length %u\n", io_len);
|
||||||
Bit8u *charbuf = (Bit8u *)buf;
|
Bit8u *charbuf = (Bit8u *)buf;
|
||||||
for (n=0; n<(int)io_len; n++) {
|
for (n=0; n<(int)io_len; n++) {
|
||||||
if (((n % 16) == 0) && n>0)
|
if (((n % 16) == 0) && n>0)
|
||||||
fprintf (txlog_txt, "\n");
|
fprintf(txlog_txt, "\n");
|
||||||
fprintf (txlog_txt, "%02x ", charbuf[n]);
|
fprintf(txlog_txt, "%02x ", charbuf[n]);
|
||||||
}
|
}
|
||||||
fprintf (txlog_txt, "\n--\n");
|
fprintf(txlog_txt, "\n--\n");
|
||||||
// flush log so that we see the packets as they arrive w/o buffering
|
// flush log so that we see the packets as they arrive w/o buffering
|
||||||
fflush (txlog);
|
fflush(txlog);
|
||||||
fflush (txlog_txt);
|
fflush(txlog_txt);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: eth_tuntap.cc,v 1.25 2006-08-05 15:53:52 vruppert Exp $
|
// $Id: eth_tuntap.cc,v 1.26 2006-11-23 17:21:59 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||||
@ -62,7 +62,7 @@
|
|||||||
#include <linux/if_tun.h>
|
#include <linux/if_tun.h>
|
||||||
#else
|
#else
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#ifndef __APPLE__
|
#if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
|
||||||
#include <net/if_tap.h>
|
#include <net/if_tap.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user