Merge pull request #10 from danrl/master

performance: call ioctl() less often
fix for kernels with no NETLINK_NO_ENOBUFS defined

netlink.c: In function 'netlink_socket':
netlink.c:84:41: error: 'NETLINK_NO_ENOBUFS' undeclared (first use in
this function)
netlink.c:84:41: note: each undeclared identifier is reported only
once for each function it appears in
make[2]: *** [netlink.o] Error 1

This is obvious as my kernel-sources have no "NETLINK_NO_ENOBUFS" definition
in "include/linux/netlink.h".

The culprit is the else-if line here:

[ netlink.c ]

int netlink_socket(void)
{
...
        if (sock == -1) {
                flog(LOG_ERR, "Unable to open netlink socket: %s", strerror(errno));
        }
        else if (setsockopt(sock, SOL_NETLINK, NETLINK_NO_ENOBUFS, &val, sizeof(val)) < 0 ) {
                flog(LOG_ERR, "Unable to setsockopt NETLINK_NO_ENOBUFS: %s", strerror(errno));
        }
...

The NETLINK_NO_ENOBUFS socket flag was first introduced with Linux-kernel
v2.6.29-rc7:

   commit 38938bfe3489394e2eed5e40c9bb8f66a2ce1405
   "netlink: add NETLINK_NO_ENOBUFS socket flag"

The issue in radvd was introduced with:

   commit de9a8849258b2a6a125d686dcb9c424affad354d
   "setsockopt NETLINK_NO_ENOBUFS"

I have added extra checks for SOL_NETLINK and NETLINK_NO_ENOBUFS definitions
which fixes the issue for me.

NOTE: Compile-tested only!
Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
Performance fix in netlink message processing

When running 'top', I sometimes see RADVD consuming a lot of CPU (some
times close to 50%).  I put some debug statements into RADVD, and have
found that RADVD listens to a netlink socket, and basically reloads the
configuration file for every netlink message it receives, regardless of
content.  I have seen more than 60 reloads in a single second, which
are generally triggered for Wireless Extension events for one of the
wireless interfaces.  There currently is a patch
(https://dev.openwrt.org/browser/packages/ipv6/radvd/patches/100-silent-netlink-config-reload.patch)
that attempts to silence the logging of the reloads, but this is really
just masking the problem, and poorly at that.  It seems like RADVD
should be filtering the netlink messages down to what it cares about,
and only then triggering the reload.
IPv6 forwarding setting should be 1 or 2

A value of 2 means that the kernel has enabled IP forwarding and that it
also will perform router solicitation. Whilst this kind of setup may
appear unusual; it is reasonably widely used especially for consumer
devices which will have a WAN link (e.g. ppp, etc.)
update CHANGES and VERSION
adding sign, verify, packages and html make targets

- sign generates hashes and gpg signature of the distribution file
- verify verifies the hashes and gpg signature
- packages generates a few select packages (gz, bz2 and xz)
- html outputs the download links to update the radvd web page
bumping VERSION to rc2
dropping -rc2
fixing logic in the IPv6 forwarding setting check

From akarl10 on GitHub:

	(value != 1 || value != 2) is always true
	should be (value != 1 && value != 2)
Minor whitespace fix in help output
Fix for adverts sent when AdvSendAdvert = off

Adverts were being sent in send_ra with AdvSendAdvert = off because
there was no check to make sure AdvSendAdvert = on.  This commits
adds a check.
Update CHANGES and VERSION (to 1.9.6)
adding TODO comments regarding AdvSendAdvert
do NOT do this: ioctl(sock, SIOCGIFMTU | SIOCGIFHWADDR, &ifr)

Attempting to get more than one value in an ioctl at one time is
bad.  At best, one value will be gotten.  The return values in ifr
are a union, so getting the MTU and hardware address at the same
time will overwrite and corrupt the values.
improved logging for hardware type
updating CHANGES and VERSION for 1.9.7
removing unused INCLUDES from Makefile.am
remove unused mdelay
use -no-strict-aliasing
reindented the code

... with  indent -linux -l180 *.c *.h