From: Christian Grothoff Date: Sat, 21 Aug 2010 22:04:27 +0000 (+0000) Subject: renaming X-Git-Tag: initial-import-from-subversion-38251~20557 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=59303b47a266fa1b40da6725f2cac5f29f358cbe;p=oweals%2Fgnunet.git renaming --- diff --git a/src/transport/gnunet-nat-client.c b/src/transport/gnunet-nat-client.c index 1f88f7b8f..0ab29dff8 100644 --- a/src/transport/gnunet-nat-client.c +++ b/src/transport/gnunet-nat-client.c @@ -324,7 +324,7 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other) { struct ip_header ip_pkt; - struct icmp_ttl_exceeded_header icmp_pkt; + struct icmp_ttl_exceeded_header icmp_ttl; struct icmp_echo_header icmp_echo; struct sockaddr_in dst; char packet[sizeof (struct ip_header) * 2 + @@ -353,12 +353,12 @@ send_icmp (const struct in_addr *my_ip, off = sizeof (ip_pkt); /* icmp reply: time exceeded */ - icmp_pkt.type = ICMP_TIME_EXCEEDED; - icmp_pkt.code = 0; - icmp_pkt.checksum = 0; - icmp_pkt.unused = 0; + icmp_ttl.type = ICMP_TIME_EXCEEDED; + icmp_ttl.code = 0; + icmp_ttl.checksum = 0; + icmp_ttl.unused = 0; memcpy (&packet[off], - &icmp_pkt, + &icmp_ttl, sizeof (struct icmp_ttl_exceeded_header)); off += sizeof (struct icmp_ttl_exceeded_header); @@ -392,12 +392,12 @@ send_icmp (const struct in_addr *my_ip, /* no go back to calculate ICMP packet checksum */ off = sizeof (struct ip_header); - icmp_pkt.checksum = htons(calc_checksum((uint16_t*) &packet[off], + icmp_ttl.checksum = htons(calc_checksum((uint16_t*) &packet[off], sizeof (struct icmp_ttl_exceeded_header) + sizeof(struct ip_header) + sizeof(struct icmp_echo_header))); memcpy (&packet[off], - &icmp_pkt, + &icmp_ttl, sizeof (struct icmp_ttl_exceeded_header)); /* prepare for transmission */ diff --git a/src/transport/gnunet-nat-server.c b/src/transport/gnunet-nat-server.c index 0bdd4108b..905a08337 100644 --- a/src/transport/gnunet-nat-server.c +++ b/src/transport/gnunet-nat-server.c @@ -342,8 +342,8 @@ process_icmp_response () ssize_t have; struct in_addr source_ip; struct ip_header ip_pkt; - struct icmp_ttl_exceeded_header icmp_pkt; - struct icmp_echo_header icmp_echo_pkt; + struct icmp_ttl_exceeded_header icmp_ttl; + struct icmp_echo_header icmp_echo; struct udp_header udp_pkt; size_t off; uint32_t port; @@ -361,7 +361,7 @@ process_icmp_response () "Received message of %u bytes\n", (unsigned int) have); #endif - if (have < sizeof (struct ip_header) + sizeof (struct icmp_ttl_exceeded_header) + sizeof (struct ip_header) ) + if (have < (ssize_t) (sizeof (struct ip_header) + sizeof (struct icmp_ttl_exceeded_header) + sizeof (struct ip_header))) { /* malformed */ return; @@ -374,12 +374,12 @@ process_icmp_response () memcpy(&source_ip, &ip_pkt.src_ip, sizeof (source_ip)); - memcpy (&icmp_pkt, + memcpy (&icmp_ttl, &buf[off], sizeof (struct icmp_ttl_exceeded_header)); off += sizeof (struct icmp_ttl_exceeded_header); - if ( (ICMP_TIME_EXCEEDED != icmp_pkt.type) || - (0 != icmp_pkt.code) ) + if ( (ICMP_TIME_EXCEEDED != icmp_ttl.type) || + (0 != icmp_ttl.code) ) { /* different type than what we want */ return; @@ -401,10 +401,10 @@ process_icmp_response () return; } /* grab ICMP ECHO content */ - memcpy (&icmp_echo_pkt, + memcpy (&icmp_echo, &buf[off], sizeof (struct icmp_echo_header)); - port = (uint16_t) ntohl (icmp_echo_pkt.reserved); + port = (uint16_t) ntohl (icmp_echo.reserved); break; case IPPROTO_UDP: if (have != (sizeof (struct ip_header) * 2 +