From a8726835c9064a1f2c6a261b14c637950abdd2bc Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 29 Apr 2008 16:56:56 -0700 Subject: 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. --- watchlink/netlink_utils.cc | 59 ---------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 watchlink/netlink_utils.cc (limited to 'watchlink/netlink_utils.cc') 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 -#include -#include -#include -#include -#include -#include -#include - -#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); -} - -- cgit v1.2.3