[automerger skipped] cleanup - remove send_tun() am: 73a5f20360 -s ours
am skip reason: Change-Id If81ca18bf5a33549b532de0d6406e32f4560c93a with SHA-1 65de290172 is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/android-clat/+/11736438
Change-Id: I9edaadb9bbc60f7638f711857a8f8b309b4bce11
diff --git a/Android.bp b/Android.bp
index bff97d3..ac24a00 100644
--- a/Android.bp
+++ b/Android.bp
@@ -20,7 +20,6 @@
filegroup {
name: "clatd_common",
srcs: [
- "config.c",
"clatd.c",
"dump.c",
"getaddr.c",
@@ -66,12 +65,6 @@
],
}
-// The configuration file.
-prebuilt_etc {
- name: "clatd.conf",
- src: "clatd.conf",
-}
-
// Unit tests.
cc_test {
name: "clatd_test",
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..d97975c
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,3 @@
+third_party {
+ license_type: NOTICE
+}
diff --git a/clatd.c b/clatd.c
index edae761..7063215 100644
--- a/clatd.c
+++ b/clatd.c
@@ -50,7 +50,8 @@
#include "ring.h"
#include "setif.h"
#include "translate.h"
-#include "tun.h"
+
+struct clat_config Global_Clatd_Config;
/* 40 bytes IPv6 header - 20 bytes IPv4 header + 8 bytes fragment header */
#define MTU_DELTA 28
diff --git a/clatd.conf b/clatd.conf
deleted file mode 100644
index e69de29..0000000
--- a/clatd.conf
+++ /dev/null
diff --git a/clatd_test.cpp b/clatd_test.cpp
index 514aaa8..c16a4dd 100644
--- a/clatd_test.cpp
+++ b/clatd_test.cpp
@@ -34,7 +34,6 @@
#include "getaddr.h"
#include "netutils/checksum.h"
#include "translate.h"
-#include "tun.h"
}
// For convenience.
diff --git a/config.c b/config.c
deleted file mode 100644
index d83b958..0000000
--- a/config.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2011 Daniel Drown
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * config.c - configuration settings
- */
-
-#include <arpa/inet.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <cutils/config_utils.h>
-#include <netutils/checksum.h>
-#include <netutils/ifc.h>
-
-#include "clatd.h"
-#include "config.h"
-#include "getaddr.h"
-#include "logging.h"
-
-struct clat_config Global_Clatd_Config;
-
-/* function: ipv6_prefix_equal
- * compares the prefixes two ipv6 addresses. assumes the prefix lengths are both /64.
- * a1 - first address
- * a2 - second address
- * returns: 0 if the subnets are different, 1 if they are the same.
- */
-int ipv6_prefix_equal(struct in6_addr *a1, struct in6_addr *a2) { return !memcmp(a1, a2, 8); }
diff --git a/config.h b/config.h
index 0152df0..1ba6850 100644
--- a/config.h
+++ b/config.h
@@ -21,6 +21,14 @@
#include <linux/if.h>
#include <netinet/in.h>
+#include "ring.h"
+
+struct tun_data {
+ char device4[IFNAMSIZ];
+ int read_fd6, write_fd6, fd4;
+ struct packet_ring ring;
+};
+
struct clat_config {
struct in6_addr ipv6_local_subnet;
struct in_addr ipv4_local_subnet;
@@ -30,6 +38,14 @@
extern struct clat_config Global_Clatd_Config;
-int ipv6_prefix_equal(struct in6_addr *a1, struct in6_addr *a2);
+/* function: ipv6_prefix_equal
+ * compares the /64 prefixes of two ipv6 addresses.
+ * a1 - first address
+ * a2 - second address
+ * returns: 0 if the subnets are different, 1 if they are the same.
+ */
+static inline int ipv6_prefix_equal(struct in6_addr *a1, struct in6_addr *a2) {
+ return !memcmp(a1, a2, 8);
+}
#endif /* __CONFIG_H__ */
diff --git a/main.c b/main.c
index c4834d9..683b507 100644
--- a/main.c
+++ b/main.c
@@ -32,7 +32,6 @@
#include "config.h"
#include "logging.h"
#include "setif.h"
-#include "tun.h"
#define DEVICEPREFIX "v4-"
diff --git a/ring.c b/ring.c
index 96a50ca..7626c6d 100644
--- a/ring.c
+++ b/ring.c
@@ -24,10 +24,10 @@
#include <sys/mman.h>
#include <sys/socket.h>
+#include "config.h"
#include "logging.h"
#include "ring.h"
#include "translate.h"
-#include "tun.h"
int ring_create(struct tun_data *tunnel) {
// Will eventually be bound to htons(ETH_P_IPV6) protocol,
diff --git a/translate.c b/translate.c
index f759726..728acc3 100644
--- a/translate.c
+++ b/translate.c
@@ -26,7 +26,6 @@
#include "icmp.h"
#include "logging.h"
#include "translate.h"
-#include "tun.h"
/* function: packet_checksum
* calculates the checksum over all the packet components starting from pos
diff --git a/tun.h b/tun.h
deleted file mode 100644
index 1dc9136..0000000
--- a/tun.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * tun.h - tun device functions
- */
-#ifndef __TUN_H__
-#define __TUN_H__
-
-#include <fcntl.h>
-#include <linux/if.h>
-#include <sys/uio.h>
-#include <unistd.h>
-
-#include "common.h"
-#include "ring.h"
-
-struct tun_data {
- char device4[IFNAMSIZ];
- int read_fd6, write_fd6, fd4;
- struct packet_ring ring;
-};
-
-#endif