]> tinc-vpn.org Git - tinc/blobdiff - src/netutl.c
Initially, the vpn_mask of a connection is 255.255.255.255 to avoid confusion with...
[tinc] / src / netutl.c
index 417092e3e911aa37df76276cdc0343dd4a35534b..ce47c3e9b049892d4e20b00896c41f989d35bb1f 100644 (file)
@@ -126,10 +126,13 @@ cp
 */
 conn_list_t *new_conn_list(void)
 {
-  conn_list_t *p = xmalloc(sizeof(conn_list_t));
+  conn_list_t *p = xmalloc(sizeof(*p));
 cp
   /* initialise all those stupid pointers at once */
-  memset(p, '\0', sizeof(conn_list_t));
+  memset(p, '\0', sizeof(*p));
+  p->vpn_mask = (ip_t)(~0L); /* If this isn't done, it would be a
+                                wastebucket for all packets with
+                                unknown destination. */
   p->nexthop = p;
 cp
   return p;
@@ -213,7 +216,7 @@ cp
        return NULL;
     }
 
-  ip = xmalloc(sizeof(ip_mask_t));
+  ip = xmalloc(sizeof(*ip));
   ip->ip = ntohl(*((ip_t*)(h->h_addr_list[0])));
 
   ip->mask = masker ? ~((1 << (32 - masker)) - 1) : 0;