version 1.1.1.1, 2012/02/21 22:14:23
|
version 1.1.1.2, 2013/07/22 11:54:42
|
Line 52
|
Line 52
|
#endif |
#endif |
#endif /* HAVE_PACKET_SOCKET */ |
#endif /* HAVE_PACKET_SOCKET */ |
|
|
#include "../include/bpf.h" |
|
#include "../include/libnet.h" |
#include "../include/libnet.h" |
|
|
|
/* These should not vary across linux systems, and are only defined in |
|
* <pcap-bpf.h>, included from <pcap.h>, but since we have no other dependency |
|
* on libpcap right now, define locally. I'm not sure if this is a good idea, |
|
* but we'll try. |
|
*/ |
|
#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ |
|
#define DLT_FDDI 10 /* FDDI */ |
|
#define DLT_RAW 12 /* raw IP */ |
|
|
#include "../include/gnuc.h" |
#include "../include/gnuc.h" |
#ifdef HAVE_OS_PROTO_H |
#ifdef HAVE_OS_PROTO_H |
#include "../include/os-proto.h" |
#include "../include/os-proto.h" |
Line 79 libnet_open_link(libnet_t *l)
|
Line 87 libnet_open_link(libnet_t *l)
|
#endif |
#endif |
if (l->fd == -1) |
if (l->fd == -1) |
{ |
{ |
snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, | if (errno == EPERM) { |
"socket: %s", strerror(errno)); | snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
| "%s(): UID/EUID 0 or capability CAP_NET_RAW required", |
| __func__); |
| |
| } else { |
| snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, |
| "socket: %s", strerror(errno)); |
| } |
goto bad; |
goto bad; |
} |
} |
|
|
Line 175 libnet_close_link(libnet_t *l)
|
Line 190 libnet_close_link(libnet_t *l)
|
|
|
#if (HAVE_PACKET_SOCKET) |
#if (HAVE_PACKET_SOCKET) |
static int |
static int |
get_iface_index(int fd, const int8_t *device) | get_iface_index(int fd, const char *device) |
{ |
{ |
struct ifreq ifr; |
struct ifreq ifr; |
|
|
Line 194 get_iface_index(int fd, const int8_t *device)
|
Line 209 get_iface_index(int fd, const int8_t *device)
|
|
|
|
|
int |
int |
libnet_write_link(libnet_t *l, u_int8_t *packet, u_int32_t size) | libnet_write_link(libnet_t *l, const uint8_t *packet, uint32_t size) |
{ |
{ |
int c; |
int c; |
#if (HAVE_PACKET_SOCKET) |
#if (HAVE_PACKET_SOCKET) |
Line 291 bad:
|
Line 306 bad:
|
return (NULL); |
return (NULL); |
} |
} |
|
|
|
/* ---- Emacs Variables ---- |
|
* Local Variables: |
|
* c-basic-offset: 4 |
|
* indent-tabs-mode: nil |
|
* End: |
|
*/ |
|
|
/* EOF */ |
/* EOF */ |