diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-04-29 16:56:56 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-04-29 16:56:56 -0700 |
commit | a8726835c9064a1f2c6a261b14c637950abdd2bc (patch) | |
tree | fc9add560d1919d3f2c050d3da486038fba9e355 /watchlink/netlink_utils.cc | |
parent | e87f46b4abc10fe3fc59562d6be25fb96bce1970 (diff) | |
download | quagga-a8726835c9064a1f2c6a261b14c637950abdd2bc.tar.bz2 quagga-a8726835c9064a1f2c6a261b14c637950abdd2bc.tar.xz |
remove watchlink - no longer used
The watchlink daemon is no longer used, so code can be removed.
If it is needed for future changes it can be recovered from the
source code control system.
Diffstat (limited to 'watchlink/netlink_utils.cc')
-rw-r--r-- | watchlink/netlink_utils.cc | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/watchlink/netlink_utils.cc b/watchlink/netlink_utils.cc deleted file mode 100644 index 18a4b3ff..00000000 --- a/watchlink/netlink_utils.cc +++ /dev/null @@ -1,59 +0,0 @@ -#include <errno.h> -#include <string.h> -#include <arpa/inet.h> -#include <linux/types.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <linux/rtnetlink.h> -#include <syslog.h> - -#include "netlink_utils.hh" - - -/* Maskbit. */ -static u_char maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, - 0xf8, 0xfc, 0xfe, 0xff}; - -/* Convert masklen into IP address's netmask. */ -void -masklen2ip (int masklen, struct in_addr *netmask) -{ - u_char *pnt; - int bit; - int offset; - - memset (netmask, 0, sizeof (struct in_addr)); - pnt = (unsigned char *) netmask; - - offset = masklen / 8; - bit = masklen % 8; - - while (offset--) - *pnt++ = 0xff; - - if (bit) - *pnt = maskbit[bit]; -} - - -in_addr_t -ipv4_broadcast_addr (in_addr_t hostaddr, int masklen) -{ - struct in_addr mask; - - masklen2ip (masklen, &mask); - return (masklen != 32-1) ? - /* normal case */ - (hostaddr | ~mask.s_addr) : - /* special case for /31 */ - (hostaddr ^ ~mask.s_addr); -} - -in_addr_t -ipv4_first_addr (in_addr_t hostaddr, int masklen) -{ - struct in_addr mask; - masklen2ip (masklen, &mask); - return (hostaddr & mask.s_addr); -} - |