diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2014-03-08 20:29:48 +0000 |
---|---|---|
committer | Lorenzo Colitti <lorenzo@google.com> | 2014-03-08 20:29:48 +0000 |
commit | 5b29cefbea5b612b8cfff4b60e7481185133d005 (patch) | |
tree | 84ab5de17aeb19423b3bea869a98b317f438b160 | |
parent | d0024fbd9285f473cd0053e4816393dbd0706b85 (diff) | |
download | android_external_android-clat-5b29cefbea5b612b8cfff4b60e7481185133d005.tar.gz android_external_android-clat-5b29cefbea5b612b8cfff4b60e7481185133d005.tar.bz2 android_external_android-clat-5b29cefbea5b612b8cfff4b60e7481185133d005.zip |
Revert "DO NOT MERGE: Fix compiler warnings and enable -Wall -Werror"
This reverts commit d0024fbd9285f473cd0053e4816393dbd0706b85.
Change-Id: I59201406f1f404b97c48877863835bdaeefc33e2
-rw-r--r-- | Android.mk | 1 | ||||
-rw-r--r-- | clatd.c | 2 | ||||
-rw-r--r-- | ipv6.c | 14 | ||||
-rw-r--r-- | translate.c | 5 | ||||
-rw-r--r-- | translate.h | 2 |
5 files changed, 12 insertions, 12 deletions
@@ -3,7 +3,6 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES:=clatd.c dump.c checksum.c translate.c icmp.c ipv4.c ipv6.c config.c dns64.c logging.c getaddr.c getroute.c netlink_callbacks.c netlink_msg.c setif.c setroute.c mtu.c -LOCAL_CFLAGS := -Wall -Werror LOCAL_C_INCLUDES := external/libnl-headers LOCAL_STATIC_LIBRARIES := libnl_2 LOCAL_SHARED_LIBRARIES := libcutils liblog @@ -82,7 +82,7 @@ void set_forwarding(int fd, const char *setting) { /* function: stop_loop * signal handler: stop the event loop */ -void stop_loop() { +void stop_loop(int signal) { running = 0; } @@ -42,7 +42,8 @@ * len - size of ip payload * returns: the highest position in the output clat_packet that's filled in */ -int icmp6_packet(clat_packet out, int pos, const struct icmp6_hdr *icmp6, size_t len) { +int icmp6_packet(clat_packet out, int pos, const struct icmp6_hdr *icmp6, uint32_t checksum, + size_t len) { const char *payload; size_t payload_size; @@ -54,7 +55,7 @@ int icmp6_packet(clat_packet out, int pos, const struct icmp6_hdr *icmp6, size_t payload = (const char *) (icmp6 + 1); payload_size = len - sizeof(struct icmp6_hdr); - return icmp6_to_icmp(out, pos, icmp6, payload, payload_size); + return icmp6_to_icmp(out, pos, icmp6, checksum, payload, payload_size); } /* function: log_bad_address @@ -62,18 +63,16 @@ int icmp6_packet(clat_packet out, int pos, const struct icmp6_hdr *icmp6, size_t * fmt - printf-style format, use %s to place the address * badaddr - the bad address in question */ -#if CLAT_DEBUG void log_bad_address(const char *fmt, const struct in6_addr *src, const struct in6_addr *dst) { +#if CLAT_DEBUG char srcstr[INET6_ADDRSTRLEN]; char dststr[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, src, srcstr, sizeof(srcstr)); inet_ntop(AF_INET6, dst, dststr, sizeof(dststr)); logmsg_dbg(ANDROID_LOG_ERROR, fmt, srcstr, dststr); -} -#else -#define log_bad_address(fmt, src, dst) #endif +} /* function: ipv6_packet * takes an ipv6 packet and hands it off to the layer 4 protocol function @@ -137,7 +136,8 @@ int ipv6_packet(clat_packet out, int pos, const char *packet, size_t len) { // does not support IPv6 extension headers, this will drop any packet with them if(protocol == IPPROTO_ICMP) { - iov_len = icmp6_packet(out, pos + 1, (const struct icmp6_hdr *) next_header, len_left); + iov_len = icmp6_packet(out, pos + 1, (const struct icmp6_hdr *) next_header, checksum, + len_left); } else if(ip6->ip6_nxt == IPPROTO_TCP) { iov_len = tcp_packet(out, pos + 1, (const struct tcphdr *) next_header, checksum, len_left); diff --git a/translate.c b/translate.c index 599182d..71263fa 100644 --- a/translate.c +++ b/translate.c @@ -149,7 +149,7 @@ void fill_ip_header(struct iphdr *ip, uint16_t payload_len, uint8_t protocol, // Third-party ICMPv6 message. This may have been originated by an native IPv6 address. // In that case, the source IPv6 address can't be translated and we need to make up an IPv4 // source address. For now, use 255.0.0.<ttl>, which at least looks useful in traceroute. - if ((uint32_t) ip->saddr == INADDR_NONE) { + if (ip->saddr == (uint32_t) INADDR_NONE) { ttl_guess = icmp_guess_ttl(old_header->ip6_hlim); ip->saddr = htonl((0xff << 24) + ttl_guess); } @@ -236,11 +236,12 @@ int icmp_to_icmp6(clat_packet out, int pos, const struct icmphdr *icmp, uint32_t * translate ipv6 icmp to ipv4 icmp * out - output packet * icmp6 - source packet icmp6 header + * checksum - pseudo-header checksum (unused) * payload - icmp6 payload * payload_size - size of payload * returns: the highest position in the output clat_packet that's filled in */ -int icmp6_to_icmp(clat_packet out, int pos, const struct icmp6_hdr *icmp6, +int icmp6_to_icmp(clat_packet out, int pos, const struct icmp6_hdr *icmp6, uint32_t checksum, const char *payload, size_t payload_size) { struct icmphdr *icmp_targ = out[pos].iov_base; uint8_t icmp_type; diff --git a/translate.h b/translate.h index c4d8ede..356050f 100644 --- a/translate.h +++ b/translate.h @@ -54,7 +54,7 @@ int ipv6_packet(clat_packet out, int pos, const char *packet, size_t len); // Translate ICMP packets. int icmp_to_icmp6(clat_packet out, int pos, const struct icmphdr *icmp, uint32_t checksum, const char *payload, size_t payload_size); -int icmp6_to_icmp(clat_packet out, int pos, const struct icmp6_hdr *icmp6, +int icmp6_to_icmp(clat_packet out, int pos, const struct icmp6_hdr *icmp6, uint32_t checksum, const char *payload, size_t payload_size); // Translate TCP and UDP packets. |