1 Patch by Robert Scheck <robert@fedoraproject.org> for libnet >= 1.1.4, which backports
2 capability support instead of explicitly checking for UID 0. Further information can be
3 found at the following links:
5 - https://bugzilla.redhat.com/show_bug.cgi?id=589770
6 - http://github.com/sam-github/libnet/commit/671742244c20804c9e935326e3649dac3382f17a
8 --- libnet-1.1.4/src/libnet_init.c 2009-06-05 02:31:44.000000000 +0200
9 +++ libnet-1.1.4/src/libnet_init.c.capability 2010-07-09 22:57:10.000000000 +0200
14 -#if !defined(__WIN32__)
15 - if (getuid() && geteuid())
17 - snprintf(err_buf, LIBNET_ERRBUF_SIZE,
18 - "%s(): UID or EUID of 0 required\n", __func__);
22 +#if defined(__WIN32__)
25 if ((WSAStartup(0x0202, &wsaData)) != 0)
26 --- libnet-1.1.4/src/libnet_link_linux.c 2009-06-05 02:31:44.000000000 +0200
27 +++ libnet-1.1.4/src/libnet_link_linux.c.capability 2010-07-09 22:58:33.000000000 +0200
30 if (ioctl(l->fd, SIOCGIFHWADDR, &ifr) < 0 )
32 - snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
33 - "SIOCGIFHWADDR: %s", strerror(errno));
34 + if (errno == EPERM) {
35 + snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
36 + "%s(): UID/EUID 0 or capability CAP_NET_RAW required",
40 + snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
41 + "socket: %s", strerror(errno));