X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnetutl.c;h=fc53aae2261172de3028934b7bfee5c7eb523c0b;hp=417092e3e911aa37df76276cdc0343dd4a35534b;hb=d878230ebef5f1a14a23c266dc425666d9e805eb;hpb=3a3356865267ff4c1e4f7d73f6d1486952d641b5 diff --git a/src/netutl.c b/src/netutl.c index 417092e3..fc53aae2 100644 --- a/src/netutl.c +++ b/src/netutl.c @@ -42,7 +42,7 @@ conn_list_t *lookup_conn(ip_t ip) { conn_list_t *p = conn_list; -cp + /* Exact match suggested by James B. MacLean */ for(p = conn_list; p != NULL; p = p->next) if(ip == p->vpn_ip) @@ -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;