X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet.c;h=564bce25f8704a70e54ae50907f095420474c8f4;hp=8b340c2b254ca9bf77d0b910da8cea5bdd00ad31;hb=44f9449888344866406c75b178eff83b392b3530;hpb=468f1d2efcce53937b7f5e0540269ae18f29ebac diff --git a/src/net.c b/src/net.c index 8b340c2b..564bce25 100644 --- a/src/net.c +++ b/src/net.c @@ -157,13 +157,13 @@ cp if(debug_lvl > 3) syslog(LOG_DEBUG, "packet to queue: %d", s); - e = xmalloc(sizeof(queue_element_t)); + e = xmalloc(sizeof(*e)); e->packet = xmalloc(s); memcpy(e->packet, packet, s); if(!*q) { - *q = xmalloc(sizeof(packet_queue_t)); + *q = xmalloc(sizeof(**q)); (*q)->head = (*q)->tail = NULL; } @@ -794,7 +794,7 @@ cp if(rp.len >= 0) { f = lookup_conn(rp.from); - if(debug_lvl > 2) + if(debug_lvl > 3) syslog(LOG_DEBUG, "packet from " IP_ADDR_S " (len %d)", IP_ADDR_V(rp.from), rp.len); if(!f) @@ -914,7 +914,7 @@ int handle_new_meta_connection(conn_list_t *cl) { conn_list_t *ncn; struct sockaddr client; - int nfd, len = sizeof(struct sockaddr); + int nfd, len = sizeof(client); cp if((nfd = accept(cl->meta_socket, &client, &len)) < 0) { @@ -957,7 +957,7 @@ cp return -1; } - if((lenin = recv(cl->meta_socket, &tmp, sizeof(tmp), 0)) <= 0) + if((lenin = read(cl->meta_socket, &tmp, sizeof(tmp))) <= 0) { syslog(LOG_ERR, "Receive failed: %m"); return -1; @@ -1061,10 +1061,10 @@ cp from = ntohl(*((unsigned long*)(&vp.data[26]))); to = ntohl(*((unsigned long*)(&vp.data[30]))); - if(debug_lvl > 2) + if(debug_lvl > 3) syslog(LOG_DEBUG, "An IP packet (%04x) for " IP_ADDR_S " from " IP_ADDR_S, ether_type, IP_ADDR_V(to), IP_ADDR_V(from)); - if(debug_lvl > 3) + if(debug_lvl > 4) syslog(LOG_DEBUG, MAC_ADDR_S " to " MAC_ADDR_S, MAC_ADDR_V(vp.data[0]), MAC_ADDR_V(vp.data[6]));