[automerger skipped] Delete the clatd code that assigns IPv4 and IPv6 addresses. am: f13d56995f -s ours

am skip reason: Change-Id I8265e9bb04d44ed1dda445fa91881fcd1601dc47 with SHA-1 baa3c6aefa is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/external/android-clat/+/11704601

Change-Id: Id988d11a460dce58421c8ff28c5020335c7d910c
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_test.cpp b/clatd_test.cpp
index 8f10e32..e24b036 100644
--- a/clatd_test.cpp
+++ b/clatd_test.cpp
@@ -585,8 +585,6 @@
     inet_pton(AF_INET, kIPv4LocalAddr, &Global_Clatd_Config.ipv4_local_subnet);
     inet_pton(AF_INET6, kIPv6PlatSubnet, &Global_Clatd_Config.plat_subnet);
     memset(&Global_Clatd_Config.ipv6_local_subnet, 0, sizeof(in6_addr));
-    Global_Clatd_Config.ipv6_host_id    = in6addr_any;
-    Global_Clatd_Config.use_dynamic_iid = 1;
     Global_Clatd_Config.default_pdp_interface = const_cast<char *>(sTun.name().c_str());
   }
 
@@ -854,7 +852,6 @@
 
 TEST_F(ClatdTest, TranslateChecksumNeutral) {
   // Generate a random clat IPv6 address and check that translation is checksum-neutral.
-  Global_Clatd_Config.ipv6_host_id = in6addr_any;
   ASSERT_TRUE(inet_pton(AF_INET6, "2001:db8:1:2:f076:ae99:124e:aa54",
                         &Global_Clatd_Config.ipv6_local_subnet));
 
diff --git a/config.c b/config.c
index d4cc9af..554db0e 100644
--- a/config.c
+++ b/config.c
@@ -35,66 +35,6 @@
 
 struct clat_config Global_Clatd_Config;
 
-/* function: config_item_str
- * locates the config item and returns the pointer to a string, or NULL on failure.  Caller frees
- * pointer
- *   root       - parsed configuration
- *   item_name  - name of config item to locate
- *   defaultvar - value to use if config item isn't present
- */
-char *config_item_str(cnode *root, const char *item_name, const char *defaultvar) {
-  const char *tmp;
-
-  if (!(tmp = config_str(root, item_name, defaultvar))) {
-    logmsg(ANDROID_LOG_FATAL, "%s config item needed", item_name);
-    return NULL;
-  }
-  return strdup(tmp);
-}
-
-/* function: config_item_int16_t
- * locates the config item, parses the integer, and returns the pointer ret_val_ptr, or NULL on
- * failure
- *   root        - parsed configuration
- *   item_name   - name of config item to locate
- *   defaultvar  - value to use if config item isn't present
- *   ret_val_ptr - pointer for return value storage
- */
-int16_t *config_item_int16_t(cnode *root, const char *item_name, const char *defaultvar,
-                             int16_t *ret_val_ptr) {
-  const char *tmp;
-  char *endptr;
-  long int conf_int;
-
-  if (!(tmp = config_str(root, item_name, defaultvar))) {
-    logmsg(ANDROID_LOG_FATAL, "%s config item needed", item_name);
-    return NULL;
-  }
-
-  errno    = 0;
-  conf_int = strtol(tmp, &endptr, 10);
-  if (errno > 0) {
-    logmsg(ANDROID_LOG_FATAL, "%s config item is not numeric: %s (error=%s)", item_name, tmp,
-           strerror(errno));
-    return NULL;
-  }
-  if (endptr == tmp || *tmp == '\0') {
-    logmsg(ANDROID_LOG_FATAL, "%s config item is not numeric: %s", item_name, tmp);
-    return NULL;
-  }
-  if (*endptr != '\0') {
-    logmsg(ANDROID_LOG_FATAL, "%s config item contains non-numeric characters: %s", item_name,
-           endptr);
-    return NULL;
-  }
-  if (conf_int > INT16_MAX || conf_int < INT16_MIN) {
-    logmsg(ANDROID_LOG_FATAL, "%s config item is too big/small: %d", item_name, conf_int);
-    return NULL;
-  }
-  *ret_val_ptr = conf_int;
-  return ret_val_ptr;
-}
-
 /* function: config_item_ip
  * locates the config item, parses the ipv4 address, and returns the pointer ret_val_ptr, or NULL on
  * failure
@@ -122,33 +62,6 @@
   return ret_val_ptr;
 }
 
-/* function: config_item_ip6
- * locates the config item, parses the ipv6 address, and returns the pointer ret_val_ptr, or NULL on
- * failure
- *   root        - parsed configuration
- *   item_name   - name of config item to locate
- *   defaultvar  - value to use if config item isn't present
- *   ret_val_ptr - pointer for return value storage
- */
-struct in6_addr *config_item_ip6(cnode *root, const char *item_name, const char *defaultvar,
-                                 struct in6_addr *ret_val_ptr) {
-  const char *tmp;
-  int status;
-
-  if (!(tmp = config_str(root, item_name, defaultvar))) {
-    logmsg(ANDROID_LOG_FATAL, "%s config item needed", item_name);
-    return NULL;
-  }
-
-  status = inet_pton(AF_INET6, tmp, ret_val_ptr);
-  if (status <= 0) {
-    logmsg(ANDROID_LOG_FATAL, "invalid IPv6 address specified for %s: %s", item_name, tmp);
-    return NULL;
-  }
-
-  return ret_val_ptr;
-}
-
 /* function: ipv6_prefix_equal
  * compares the prefixes two ipv6 addresses. assumes the prefix lengths are both /64.
  *   a1 - first address
@@ -165,7 +78,6 @@
  */
 int read_config(const char *file, const char *uplink_interface) {
   cnode *root   = config_node("", "");
-  unsigned flags;
 
   if (!root) {
     logmsg(ANDROID_LOG_FATAL, "out of memory");
@@ -187,22 +99,7 @@
                       &Global_Clatd_Config.ipv4_local_subnet))
     goto failed;
 
-  if (!config_item_int16_t(root, "ipv4_local_prefixlen", DEFAULT_IPV4_LOCAL_PREFIXLEN,
-                           &Global_Clatd_Config.ipv4_local_prefixlen))
-    goto failed;
-
-  if (!config_item_ip6(root, "ipv6_host_id", "::", &Global_Clatd_Config.ipv6_host_id)) goto failed;
-
-  /* In order to prevent multiple devices attempting to use the same clat address, never use a
-     statically-configured interface ID on a broadcast interface such as wifi. */
-  if (!IN6_IS_ADDR_UNSPECIFIED(&Global_Clatd_Config.ipv6_host_id)) {
-    ifc_init();
-    ifc_get_info(Global_Clatd_Config.default_pdp_interface, NULL, NULL, &flags);
-    ifc_close();
-    Global_Clatd_Config.use_dynamic_iid = (flags & IFF_BROADCAST) != 0;
-  } else {
-    Global_Clatd_Config.use_dynamic_iid = 1;
-  }
+  Global_Clatd_Config.ipv4_local_prefixlen = 29;
 
   return 1;
 
@@ -210,22 +107,3 @@
   free(root);
   return 0;
 }
-
-/* function; dump_config
- * prints the current config
- */
-void dump_config() {
-  char charbuffer[INET6_ADDRSTRLEN];
-
-  logmsg(
-    ANDROID_LOG_DEBUG, "ipv6_local_subnet = %s",
-    inet_ntop(AF_INET6, &Global_Clatd_Config.ipv6_local_subnet, charbuffer, sizeof(charbuffer)));
-  logmsg(
-    ANDROID_LOG_DEBUG, "ipv4_local_subnet = %s",
-    inet_ntop(AF_INET, &Global_Clatd_Config.ipv4_local_subnet, charbuffer, sizeof(charbuffer)));
-  logmsg(ANDROID_LOG_DEBUG, "ipv4_local_prefixlen = %d", Global_Clatd_Config.ipv4_local_prefixlen);
-  logmsg(ANDROID_LOG_DEBUG, "plat_subnet = %s",
-         inet_ntop(AF_INET6, &Global_Clatd_Config.plat_subnet, charbuffer, sizeof(charbuffer)));
-  logmsg(ANDROID_LOG_DEBUG, "default_pdp_interface = %s",
-         Global_Clatd_Config.default_pdp_interface);
-}
diff --git a/config.h b/config.h
index 50efeeb..555b968 100644
--- a/config.h
+++ b/config.h
@@ -22,16 +22,13 @@
 #include <netinet/in.h>
 
 #define DEFAULT_IPV4_LOCAL_SUBNET "192.0.0.4"
-#define DEFAULT_IPV4_LOCAL_PREFIXLEN "29"
 
 struct clat_config {
   struct in6_addr ipv6_local_subnet;
-  struct in6_addr ipv6_host_id;
   struct in_addr ipv4_local_subnet;
   int16_t ipv4_local_prefixlen;
   struct in6_addr plat_subnet;
   char *default_pdp_interface;
-  int use_dynamic_iid;
 };
 
 extern struct clat_config Global_Clatd_Config;