Cleanup:
authorGuus Sliepen <guus@tinc-vpn.org>
Sat, 8 Jun 2002 12:57:10 +0000 (12:57 +0000)
committerGuus Sliepen <guus@tinc-vpn.org>
Sat, 8 Jun 2002 12:57:10 +0000 (12:57 +0000)
 - Remove checks for specific OS's, instead check for #defines/#includes.
 - Use uint??_t where appropriate.
 - Mask handling functions use void pointers to get rid of silly casts.

14 files changed:
configure.in
src/conf.c
src/graph.c
src/net.c
src/net.h
src/net_packet.c
src/net_setup.c
src/net_socket.c
src/netutl.c
src/netutl.h
src/node.h
src/route.c
src/subnet.c
src/tincd.c

index d8b68e4ce6f3122c0a18697b5f9e18f396a4c904..5efcd870608e196cd69d8fde0efd3dda8d2708c8 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 
-dnl $Id: configure.in,v 1.13.2.44 2002/04/19 14:06:40 guus Exp $
+dnl $Id: configure.in,v 1.13.2.45 2002/06/08 12:57:09 guus Exp $
 
 AC_INIT(src/tincd.c)
 AM_INIT_AUTOMAKE(tinc, 1.0-cvs)
@@ -69,8 +69,9 @@ dnl Checks for libraries.
 
 dnl Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS([fcntl.h limits.h sys/ioctl.h syslog.h unistd.h \
-sys/time.h malloc.h strings.h sys/file.h])
+AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdint.h strings.h syslog.h unistd.h \
+net/ethernet.h net/if.h netinet/ip.h netinet/tcp.h \
+sys/file.h sys/ioctl.h sys/param.h sys/time.h])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -95,8 +96,8 @@ dnl Checks for library functions.
 AC_FUNC_MEMCMP
 AC_FUNC_ALLOCA
 AC_TYPE_SIGNAL
-AC_CHECK_FUNCS([ftime socket select strtol strerror flock unsetenv \
-asprintf putenv strdup fcloseall daemon strsignal get_current_dir_name])
+AC_CHECK_FUNCS([asprintf daemon fcloseall flock ftime get_current_dir_name \
+putenv select strdup strerror strsignal strtol unsetenv])
 jm_FUNC_MALLOC
 jm_FUNC_REALLOC
 
index bc29e071c2539d69d554ae6317ac201a95a2ed2e..96dbef3537cf68f3f2fdfcfc5ee033587f66b46b 100644 (file)
@@ -19,7 +19,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: conf.c,v 1.9.4.55 2002/04/09 11:42:48 guus Exp $
+    $Id: conf.c,v 1.9.4.56 2002/06/08 12:57:09 guus Exp $
 */
 
 #include "config.h"
@@ -255,8 +255,8 @@ cp
 
   /* Teach newbies what subnets are... */
 
-  if(((subnet->type == SUBNET_IPV4) && maskcheck((char *)&subnet->net.ipv4.address, subnet->net.ipv4.prefixlength, sizeof(ipv4_t)))
-     || ((subnet->type == SUBNET_IPV6) && maskcheck((char *)&subnet->net.ipv6.address, subnet->net.ipv6.prefixlength, sizeof(ipv6_t))))
+  if(((subnet->type == SUBNET_IPV4) && maskcheck(&subnet->net.ipv4.address, subnet->net.ipv4.prefixlength, sizeof(ipv4_t)))
+     || ((subnet->type == SUBNET_IPV6) && maskcheck(&subnet->net.ipv6.address, subnet->net.ipv6.prefixlength, sizeof(ipv6_t))))
     {
       syslog(LOG_ERR, _("Network address and prefix length do not match for configuration variable %s in %s line %d"),
              cfg->variable, cfg->file, cfg->line);
index 53152a545155736e43974f5eabaaba6e23a5d03e..9d9bc1f301645690ea3968245c96e1e133bf3c00 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: graph.c,v 1.1.2.11 2002/03/24 16:28:27 guus Exp $
+    $Id: graph.c,v 1.1.2.12 2002/06/08 12:57:09 guus Exp $
 */
 
 /* We need to generate two trees from the graph:
@@ -50,7 +50,7 @@
 #include <syslog.h>
 #include "config.h"
 #include <string.h>
-#if defined(HAVE_FREEBSD) || defined(HAVE_OPENBSD)
+#ifdef HAVE_SYS_PARAM_H
  #include <sys/param.h>
 #endif
 #include <netinet/in.h>
index 358e7a9c79a0aba676196684ed5c2d4f6508df23..7ebbbd0f0ba21995228a938b97092bbe3d49551a 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: net.c,v 1.35.4.171 2002/05/01 09:15:58 guus Exp $
+    $Id: net.c,v 1.35.4.172 2002/06/08 12:57:09 guus Exp $
 */
 
 #include "config.h"
 #include <fcntl.h>
 #include <netdb.h>
 #include <netinet/in.h>
-#ifdef HAVE_LINUX
+#ifdef HAVE_NETINET_IP_H
  #include <netinet/ip.h>
+#endif
+#ifdef HAVE_NETINET_TCP_H
  #include <netinet/tcp.h>
 #endif
 #include <stdio.h>
index 922c5cf1b1d8e7bd88c13cd1465dc0fe6e79f110..29839a29ee13b1b0e370031dd69b843186723c10 100644 (file)
--- a/src/net.h
+++ b/src/net.h
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: net.h,v 1.9.4.49 2002/03/27 15:01:36 guus Exp $
+    $Id: net.h,v 1.9.4.50 2002/06/08 12:57:09 guus Exp $
 */
 
 #ifndef __TINC_NET_H__
 #include <netinet/in.h>
 #include <sys/time.h>
 
+#ifdef HAVE_STDINT_H
+ #include <stdint.h>
+#endif
+
 #include "config.h"
 
 #ifdef ENABLE_JUMBOGRAMS
 
 typedef struct mac_t
 {
-  unsigned char x[6];
+  uint8_t x[6];
 } mac_t;
 
 typedef struct ipv4_t
 {
-  unsigned char x[4];
+  uint8_t x[4];
 } ipv4_t;
 
 typedef struct ip_mask_t {
@@ -61,7 +65,7 @@ typedef struct ip_mask_t {
 
 typedef struct ipv6_t
 {
-  unsigned short x[8];
+  uint16_t x[8];
 } ipv6_t;
 
 typedef unsigned short port_t;
@@ -83,8 +87,8 @@ typedef union {
 typedef struct vpn_packet_t {
   length_t len;                        /* the actual number of bytes in the `data' field */
   int priority;                 /* priority or TOS */
-  unsigned int seqno;          /* 32 bits sequence number (network byte order of course) */
-  unsigned char data[MAXSIZE];
+  uint32_t seqno;              /* 32 bits sequence number (network byte order of course) */
+  uint8_t data[MAXSIZE];
 } vpn_packet_t;
 
 typedef struct queue_element_t {
index f0423c10f5d082282d03eaaffada550f5e58e901..8dac0d9c1da57e680d3d60c21c7718bc682beb28 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: net_packet.c,v 1.1.2.14 2002/04/18 20:09:05 zarq Exp $
+    $Id: net_packet.c,v 1.1.2.15 2002/06/08 12:57:09 guus Exp $
 */
 
 #include "config.h"
 #include <fcntl.h>
 #include <netdb.h>
 #include <netinet/in.h>
-#ifdef HAVE_LINUX
+#ifdef HAVE_NETINET_IP_H
  #include <netinet/ip.h>
+#endif
+#ifdef HAVE_NETINET_TCP_H
  #include <netinet/tcp.h>
 #endif
 #include <stdio.h>
index ec0700c3f3e1ad1cd88126e848a442325f84f5fa..d2a60f0245f324fdbe6f83aaa3e495b1fa4e08fc 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: net_setup.c,v 1.1.2.16 2002/06/02 16:06:33 guus Exp $
+    $Id: net_setup.c,v 1.1.2.17 2002/06/08 12:57:10 guus Exp $
 */
 
 #include "config.h"
 #include <fcntl.h>
 #include <netdb.h>
 #include <netinet/in.h>
-#ifdef HAVE_LINUX
+#ifdef HAVE_NETINET_IP_H
  #include <netinet/ip.h>
+#endif
+#ifdef HAVE_NETINET_TCP_H
  #include <netinet/tcp.h>
 #endif
 #include <stdio.h>
index 5111ec25d2773635752896db8f1094ba124d78d4..74841875d5a827112b1f2150f5dc04e6301e015e 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: net_socket.c,v 1.1.2.12 2002/04/18 20:09:05 zarq Exp $
+    $Id: net_socket.c,v 1.1.2.13 2002/06/08 12:57:10 guus Exp $
 */
 
 #include "config.h"
 #include <fcntl.h>
 #include <netdb.h>
 #include <netinet/in.h>
-#ifdef HAVE_LINUX
+#ifdef HAVE_NETINET_IP_H
  #include <netinet/ip.h>
+#endif
+#ifdef HAVE_NETINET_TCP_H
  #include <netinet/tcp.h>
 #endif
 #include <stdio.h>
@@ -241,10 +243,12 @@ cp
 
   /* Optimize TCP settings */
 
-#ifdef HAVE_LINUX
+#if defined(SOL_TCP) && defined(TCP_NODELAY)
   option = 1;
   setsockopt(c->socket, SOL_TCP, TCP_NODELAY, &option, sizeof(option));
+#endif
 
+#if defined(SOL_IP) && defined(IP_TOS)
   option = IPTOS_LOWDELAY;
   setsockopt(c->socket, SOL_IP, IP_TOS, &option, sizeof(option));
 #endif
@@ -337,10 +341,12 @@ begin:
 
   /* Optimize TCP settings */
 
-#ifdef HAVE_LINUX
+#if defined(SOL_TCP) && defined(TCP_NODELAY)
   option = 1;
   setsockopt(c->socket, SOL_TCP, TCP_NODELAY, &option, sizeof(option));
+#endif
 
+#if defined(SOL_IP) && defined(IP_TOS)
   option = IPTOS_LOWDELAY;
   setsockopt(c->socket, SOL_IP, IP_TOS, &option, sizeof(option));
 #endif
index 4d91bf4460cb1e40662e0c47c915cf4f804b27ed..82a4259bbd9c86eac14a1f7143843d8aed822594 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: netutl.c,v 1.12.4.37 2002/06/07 11:14:05 wsl Exp $
+    $Id: netutl.c,v 1.12.4.38 2002/06/08 12:57:10 guus Exp $
 */
 
 #include "config.h"
@@ -27,7 +27,7 @@
 #include <netinet/in.h>
 #include <stdio.h>
 #include <stdlib.h>
-#ifndef HAVE_NETBSD
+#ifndef HAVE_STDINT_H
  #include <stdint.h>
 #endif
 #include <string.h>
@@ -115,10 +115,8 @@ cp
       exit(0);
     }
 
-#ifdef HAVE_LINUX
   if((scopeid = strchr(address, '%')))
     *scopeid = '\0';  /* Descope. */
-#endif
 
   *addrstr = xstrdup(address);
   *portstr = xstrdup(port);
@@ -185,9 +183,11 @@ void sockaddrunmap(sockaddr_t *sa)
 
 /* Subnet mask handling */
 
-int maskcmp(char *a, char *b, int masklen, int len)
+int maskcmp(void *va, void *vb, int masklen, int len)
 {
   int i, m, result;
+  char *a = va;
+  char *b = vb;
 cp
   for(m = masklen, i = 0; m >= 8; m -= 8, i++)
     if((result = a[i] - b[i]))
@@ -199,9 +199,10 @@ cp
   return 0;
 }
 
-void mask(char *a, int masklen, int len)
+void mask(void *va, int masklen, int len)
 {
   int i;
+  char *a = va;
 cp
   i = masklen / 8;
   masklen %= 8;
@@ -213,9 +214,11 @@ cp
     a[i] = 0;
 }
 
-void maskcpy(char *a, char *b, int masklen, int len)
+void maskcpy(void *va, void *vb, int masklen, int len)
 {
   int i, m;
+  char *a = va;
+  char *b = vb;
 cp
   for(m = masklen, i = 0; m >= 8; m -= 8, i++)
     a[i] = b[i];
@@ -230,9 +233,10 @@ cp
     a[i] = 0;
 }
 
-int maskcheck(char *a, int masklen, int len)
+int maskcheck(void *va, int masklen, int len)
 {
   int i;
+  char *a = va;
 cp
   i = masklen / 8;
   masklen %= 8;
index 654d7ad4ba160c829c74311153e12fa92c546f6c..7126e0c34e267e5c468873f2af2714db5d3bba8c 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: netutl.h,v 1.2.4.11 2002/03/17 15:59:29 guus Exp $
+    $Id: netutl.h,v 1.2.4.12 2002/06/08 12:57:10 guus Exp $
 */
 
 #ifndef __TINC_NETUTL_H__
 
 extern int hostnames;
 
-extern char *hostlookup(unsigned long);
 extern struct addrinfo *str2addrinfo(char *, char *, int);
 extern sockaddr_t str2sockaddr(char *, char *);
 extern void sockaddr2str(sockaddr_t *, char **, char **);
 extern char *sockaddr2hostname(sockaddr_t *);
 extern int sockaddrcmp(sockaddr_t *, sockaddr_t *);
 extern void sockaddrunmap(sockaddr_t *);
-extern int maskcmp(char *, char *, int, int);
-extern void maskcpy(char *, char *, int, int);
-extern void mask(char *, int, int);
-extern int maskcheck(char *, int, int);
+extern int maskcmp(void *, void *, int, int);
+extern void maskcpy(void *, void *, int, int);
+extern void mask(void *, int, int);
+extern int maskcheck(void *, int, int);
 
 #endif /* __TINC_NETUTL_H__ */
index 98147d3ef8814f2f87c4c4082b0bae6ce0dab2c3..6f366c2a72123d5bcad3acfe5a34939a51c6b5cb 100644 (file)
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: node.h,v 1.1.2.13 2002/03/19 22:48:25 guus Exp $
+    $Id: node.h,v 1.1.2.14 2002/06/08 12:57:10 guus Exp $
 */
 
 #ifndef __TINC_NODE_H__
 #define __TINC_NODE_H__
 
+#ifdef HAVE_STDINT_H
+ #include <stdint.h>
+#endif
+
 #include <avl_tree.h>
 
 #include "subnet.h"
@@ -67,8 +71,8 @@ typedef struct node_t {
 
   struct connection_t *connection; /* Connection associated with this node (if a direct connection exists) */
 
-  unsigned int sent_seqno;         /* Sequence number last sent to this node */
-  unsigned int received_seqno;     /* Sequence number last received from this node */
+  uint32_t sent_seqno;         /* Sequence number last sent to this node */
+  uint32_t received_seqno;     /* Sequence number last received from this node */
 } node_t;
 
 extern struct node_t *myself;
index 48a14ca80f2893ac304a613b4fd338b6557e1953..9ddb1d1c4c5c373b7a49ca591372cb9a718dd414 100644 (file)
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: route.c,v 1.1.2.39 2002/06/05 00:25:55 guus Exp $
+    $Id: route.c,v 1.1.2.40 2002/06/08 12:57:10 guus Exp $
 */
 
 #include "config.h"
 
-#if defined(HAVE_FREEBSD) || defined(HAVE_OPENBSD) || defined(HAVE_NETBSD)
+#ifdef HAVE_SYS_PARAM_H
  #include <sys/param.h>
 #endif
 #include <sys/socket.h>
 #include <netinet/in.h>
-#if defined(HAVE_SOLARIS) || defined(HAVE_OPENBSD) || defined(HAVE_NETBSD)
+#ifdef HAVE_NET_IF_H
  #include <net/if.h>
- #define ETHER_ADDR_LEN 6
-#else
+#endif
+#ifdef HAVE_NET_ETHERNET_H
  #include <net/ethernet.h>
 #endif
 #include <netinet/ip6.h>
@@ -40,7 +40,7 @@
 #include <xalloc.h>
 #include <syslog.h>
 #include <string.h>
-#ifndef HAVE_NETBSD
+#ifdef HAVE_STDINT_H
  #include <stdint.h>
 #endif
 
 
 #include "system.h"
 
+#ifndef ETHER_ADDR_LEN
+ #define ETHER_ADDR_LEN 6
+#endif
+
 int routing_mode = RMODE_ROUTER;
 int priorityinheritance = 0;
 int macexpire = 600;
@@ -173,14 +177,14 @@ cp
       if(debug_lvl >= DEBUG_TRAFFIC)
         {
           syslog(LOG_WARNING, _("Cannot route packet: unknown IPv6 destination address %hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx"),
-           ntohs(*(short unsigned int *)&packet->data[38]),
-           ntohs(*(short unsigned int *)&packet->data[40]),
-           ntohs(*(short unsigned int *)&packet->data[42]),
-           ntohs(*(short unsigned int *)&packet->data[44]),
-           ntohs(*(short unsigned int *)&packet->data[46]),
-           ntohs(*(short unsigned int *)&packet->data[48]),
-           ntohs(*(short unsigned int *)&packet->data[50]),
-           ntohs(*(short unsigned int *)&packet->data[52]));
+           ntohs(*(uint16_t *)&packet->data[38]),
+           ntohs(*(uint16_t *)&packet->data[40]),
+           ntohs(*(uint16_t *)&packet->data[42]),
+           ntohs(*(uint16_t *)&packet->data[44]),
+           ntohs(*(uint16_t *)&packet->data[46]),
+           ntohs(*(uint16_t *)&packet->data[48]),
+           ntohs(*(uint16_t *)&packet->data[50]),
+           ntohs(*(uint16_t *)&packet->data[52]));
         }
 
       return NULL;
@@ -189,9 +193,9 @@ cp
   return subnet->owner;  
 }
 
-unsigned short int inet_checksum(unsigned short int *data, int len, unsigned short int prevsum)
+uint16_t inet_checksum(uint16_t *data, int len, uint16_t prevsum)
 {
-  unsigned long int checksum = prevsum ^ 0xFFFF;
+  uint32_t checksum = prevsum ^ 0xFFFF;
 
   while(len--)
     checksum += ntohs(*data++);
@@ -208,7 +212,7 @@ void route_neighborsol(vpn_packet_t *packet)
   struct nd_neighbor_solicit *ns;
   struct nd_opt_hdr *opt;
   subnet_t *subnet;
-  short unsigned int checksum;
+  uint16_t checksum;
   
   struct {
     struct in6_addr ip6_src;      /* source address */
@@ -248,8 +252,8 @@ cp
   
   /* Generate checksum */
   
-  checksum = inet_checksum((unsigned short int *)&pseudo, sizeof(pseudo)/2, ~0);
-  checksum = inet_checksum((unsigned short int *)ns, sizeof(*ns)/2 + 4, checksum);
+  checksum = inet_checksum((uint16_t *)&pseudo, sizeof(pseudo)/2, ~0);
+  checksum = inet_checksum((uint16_t *)ns, sizeof(*ns)/2 + 4, checksum);
 
   if(checksum)
     {
@@ -305,8 +309,8 @@ cp
   
   /* Generate checksum */
   
-  checksum = inet_checksum((unsigned short int *)&pseudo, sizeof(pseudo)/2, ~0);
-  checksum = inet_checksum((unsigned short int *)ns, sizeof(*ns)/2 + 4, checksum);
+  checksum = inet_checksum((uint16_t *)&pseudo, sizeof(pseudo)/2, ~0);
+  checksum = inet_checksum((uint16_t *)ns, sizeof(*ns)/2 + 4, checksum);
 
   ns->nd_ns_hdr.icmp6_cksum = htons(checksum);
 
@@ -318,7 +322,7 @@ void route_arp(vpn_packet_t *packet)
 {
   struct ether_arp *arp;
   subnet_t *subnet;
-  unsigned char ipbuf[4];
+  uint8_t ipbuf[4];
 cp
   /* First, snatch the source address from the ARP packet */
 
@@ -335,8 +339,8 @@ cp
 
   if(ntohs(arp->arp_hrd) != ARPHRD_ETHER ||
      ntohs(arp->arp_pro) != ETHERTYPE_IP ||
-     (int) (arp->arp_hln) != ETHER_ADDR_LEN ||
-     (int) (arp->arp_pln) != 4 ||
+     arp->arp_hln != ETHER_ADDR_LEN ||
+     arp->arp_pln != 4 ||
      ntohs(arp->arp_op) != ARPOP_REQUEST )
     {
       if(debug_lvl > DEBUG_TRAFFIC)
@@ -383,7 +387,7 @@ cp
 
 void route_outgoing(vpn_packet_t *packet)
 {
-  unsigned short int type;
+  uint16_t type;
   node_t *n = NULL;
 cp
   /* FIXME: multicast? */
@@ -391,7 +395,7 @@ cp
   switch(routing_mode)
     {
       case RMODE_ROUTER:
-        type = ntohs(*((unsigned short*)(&packet->data[12])));
+        type = ntohs(*((uint16_t *)(&packet->data[12])));
         switch(type)
           {
             case 0x0800:
@@ -440,9 +444,9 @@ void route_incoming(node_t *source, vpn_packet_t *packet)
       case RMODE_ROUTER:
         {
           node_t *n = NULL;
-         unsigned short int type;
+         uint16_t type;
 
-          type = ntohs(*((unsigned short*)(&packet->data[12])));
+          type = ntohs(*((uint16_t *)(&packet->data[12])));
           switch(type)
             {
               case 0x0800:
index 9d13d7c5cea7621744cd62e085cfe1553fbf4ca2..d971a4d7121be16cb23503b5d6a27bfad7b7e20c 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: subnet.c,v 1.1.2.35 2002/04/26 18:13:00 zarq Exp $
+    $Id: subnet.c,v 1.1.2.36 2002/06/08 12:57:10 guus Exp $
 */
 
 #include "config.h"
@@ -176,7 +176,7 @@ subnet_t *str2net(char *subnetstr)
 {
   int i, l;
   subnet_t *subnet;
-  unsigned short int x[8];
+  uint16_t x[8];
 cp
   subnet = new_subnet();
 cp
@@ -323,14 +323,14 @@ cp
            break;
          }
 
-        if (!maskcmp((char *)address, (char *)&p->net.ipv4.address, p->net.ipv4.prefixlength, sizeof(ipv4_t)))
+        if (!maskcmp(address, &p->net.ipv4.address, p->net.ipv4.prefixlength, sizeof(ipv4_t)))
           break;
         else
           {
             /* Otherwise, see if there is a bigger enclosing subnet */
 
             subnet.net.ipv4.prefixlength = p->net.ipv4.prefixlength - 1;
-            maskcpy((char *)&subnet.net.ipv4.address, (char *)&p->net.ipv4.address, subnet.net.ipv4.prefixlength, sizeof(ipv4_t));
+            maskcpy(&subnet.net.ipv4.address, &p->net.ipv4.address, subnet.net.ipv4.prefixlength, sizeof(ipv4_t));
           }
       }
   } while (p);
@@ -360,14 +360,14 @@ cp
        if(p->type != SUBNET_IPV6)
          return NULL;
 
-        if (!maskcmp((char *)address, (char *)&p->net.ipv6.address, p->net.ipv6.prefixlength, sizeof(ipv6_t)))
+        if (!maskcmp(address, &p->net.ipv6.address, p->net.ipv6.prefixlength, sizeof(ipv6_t)))
           break;
         else
           {
             /* Otherwise, see if there is a bigger enclosing subnet */
 
             subnet.net.ipv6.prefixlength = p->net.ipv6.prefixlength - 1;
-            maskcpy((char *)&subnet.net.ipv6.address, (char *)&p->net.ipv6.address, subnet.net.ipv6.prefixlength, sizeof(ipv6_t));
+            maskcpy(&subnet.net.ipv6.address, &p->net.ipv6.address, subnet.net.ipv6.prefixlength, sizeof(ipv6_t));
           }
       }
    } while (p);
index b8b29596f0ef8d6f50ec52d93b418b25a1de40d3..0838e8291216689680c93b7f2c1629a2a68a01ab 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: tincd.c,v 1.10.4.58 2002/03/11 11:23:04 guus Exp $
+    $Id: tincd.c,v 1.10.4.59 2002/06/08 12:57:10 guus Exp $
 */
 
 #include "config.h"
@@ -338,7 +338,7 @@ main(int argc, char **argv, char **envp)
   if(show_help)
     usage(0);
 
-#ifdef HAVE_SOLARIS
+#ifndef LOG_PERROR
   openlog("tinc", LOG_CONS, LOG_DAEMON);        /* Catch all syslog() calls issued before detaching */
 #else
   openlog("tinc", LOG_PERROR, LOG_DAEMON);      /* Catch all syslog() calls issued before detaching */