Snap for 8426163 from 07f75c13b8c43e216469bf2332aa0e29846fa510 to mainline-tzdata2-release
Change-Id: I7cf890bf803433275822839465b01dd7a991ba1e
diff --git a/Android.bp b/Android.bp
index bdddd7a..7c1c1df 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,26 +1,3 @@
-package {
- default_applicable_licenses: ["external_android-clat_license"],
-}
-
-// Added automatically by a large-scale-change
-//
-// large-scale-change included anything that looked like it might be a license
-// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
-//
-// Please consider removing redundant or irrelevant files from 'license_text:'.
-// See: http://go/android-license-faq
-license {
- name: "external_android-clat_license",
- visibility: [":__subpackages__"],
- license_kinds: [
- "SPDX-license-identifier-Apache-2.0",
- ],
- license_text: [
- "LICENSE",
- "NOTICE",
- ],
-}
-
cc_defaults {
name: "clatd_defaults",
@@ -86,13 +63,12 @@
tidy_flags: [
"-warnings-as-errors=clang-analyzer-security*,cert-*,android-*",
],
- // Actually not required for clatd itself. See comments in the rc file.
- init_rc: [
- "vendor-464xlat.rc",
- ],
- sanitize: {
- memtag_heap: true,
- },
+}
+
+// The configuration file.
+prebuilt_etc {
+ name: "clatd.conf",
+ src: "clatd.conf",
}
// Unit tests.
diff --git a/METADATA b/METADATA
deleted file mode 100644
index d97975c..0000000
--- a/METADATA
+++ /dev/null
@@ -1,3 +0,0 @@
-third_party {
- license_type: NOTICE
-}
diff --git a/clatd.c b/clatd.c
index 3ffe934..422cded 100644
--- a/clatd.c
+++ b/clatd.c
@@ -58,6 +58,11 @@
volatile sig_atomic_t running = 1;
+/* function: stop_loop
+ * signal handler: stop the event loop
+ */
+void stop_loop() { running = 0; }
+
/* function: configure_packet_socket
* Binds the packet socket and attaches the receive filter to it.
* sock - the socket to configure
diff --git a/clatd.conf b/clatd.conf
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clatd.conf
diff --git a/clatd.h b/clatd.h
index 899458c..a3f9326 100644
--- a/clatd.h
+++ b/clatd.h
@@ -18,7 +18,6 @@
#ifndef __CLATD_H__
#define __CLATD_H__
-#include <signal.h>
#include <stdlib.h>
#include <sys/uio.h>
@@ -36,8 +35,7 @@
// how frequently (in seconds) to poll for an address change while there is no traffic
#define NO_TRAFFIC_INTERFACE_POLL_FREQUENCY 90
-extern volatile sig_atomic_t running;
-
+void stop_loop();
void configure_tun_ip(const struct tun_data *tunnel, const char *v4_addr, int mtu);
void set_capability(uint64_t target_cap);
void drop_root_but_keep_caps();
diff --git a/dump.c b/dump.c
index 7332d6c..28db13f 100644
--- a/dump.c
+++ b/dump.c
@@ -21,7 +21,6 @@
#include <arpa/inet.h>
#include <linux/icmp.h>
-#include <linux/if_tun.h>
#include <netinet/icmp6.h>
#include <netinet/in.h>
#include <netinet/ip.h>
@@ -34,7 +33,6 @@
#include "clatd.h"
#include "debug.h"
-#include "dump.h"
#include "logging.h"
#if CLAT_DEBUG
diff --git a/dump.h b/dump.h
index 6b96cd2..c3f0477 100644
--- a/dump.h
+++ b/dump.h
@@ -31,14 +31,14 @@
void dump_udp(const struct udphdr *udp, const struct iphdr *ip, const uint8_t *payload,
size_t payload_size);
void dump_tcp(const struct tcphdr *tcp, const struct iphdr *ip, const uint8_t *payload,
- size_t payload_size, const uint8_t *options, size_t options_size);
+ size_t payload_size, const char *options, size_t options_size);
void dump_ip6(struct ip6_hdr *header);
void dump_icmp6(struct icmp6_hdr *icmp6);
void dump_udp6(const struct udphdr *udp, const struct ip6_hdr *ip6, const uint8_t *payload,
size_t payload_size);
void dump_tcp6(const struct tcphdr *tcp, const struct ip6_hdr *ip6, const uint8_t *payload,
- size_t payload_size, const uint8_t *options, size_t options_size);
+ size_t payload_size, const char *options, size_t options_size);
void logcat_hexdump(const char *info, const uint8_t *data, size_t len);
void dump_iovec(const struct iovec *iov, int iov_len);
diff --git a/main.c b/main.c
index 52e22ac..683b507 100644
--- a/main.c
+++ b/main.c
@@ -35,11 +35,6 @@
#define DEVICEPREFIX "v4-"
-/* function: stop_loop
- * signal handler: stop the event loop
- */
-static void stop_loop() { running = 0; };
-
/* function: print_help
* in case the user is running this on the command line
*/
@@ -148,16 +143,5 @@
logmsg(ANDROID_LOG_INFO, "Shutting down clat on %s", uplink_interface);
del_anycast_address(tunnel.write_fd6, &Global_Clatd_Config.ipv6_local_subnet);
- close(tunnel.write_fd6);
- close(tunnel.read_fd6);
- close(tunnel.fd4);
-
- if (running) {
- logmsg(ANDROID_LOG_INFO, "Clatd on %s waiting for SIGTERM", uplink_interface);
- while (running) sleep(60);
- logmsg(ANDROID_LOG_INFO, "Clatd on %s received SIGTERM", uplink_interface);
- } else {
- logmsg(ANDROID_LOG_INFO, "Clatd on %s already received SIGTERM", uplink_interface);
- }
return 0;
}
diff --git a/vendor-464xlat.rc b/vendor-464xlat.rc
deleted file mode 100644
index 609531d..0000000
--- a/vendor-464xlat.rc
+++ /dev/null
@@ -1,15 +0,0 @@
-# Certain vendors disable 464xlat by setting a vendor property.
-# The connectivity code in the Tethering APEX needs to disable
-# 464xlat when the property is set, but it is only allowed to
-# access non-vendor system properties. So copy the property to
-# a property available to system APIs in android.sysprop.
-#
-# Arguably this script should live close to the code that uses
-# it, but scrips in APEXes are not allowed to use "on property".
-# So put it here close to clatd, which is at least related to
-# 464xlat.
-on property:persist.vendor.net.doxlat=true
- setprop net.464xlat.cellular.enabled true
-
-on property:persist.vendor.net.doxlat=false
- setprop net.464xlat.cellular.enabled false