diff options
| author | Maciej Żenczykowski <maze@google.com> | 2020-06-02 12:56:40 +0000 |
|---|---|---|
| committer | Maciej Zenczykowski <maze@google.com> | 2020-06-04 09:50:53 +0000 |
| commit | 6be24d8214cf00faa279deba4e690058d84f6458 (patch) | |
| tree | 4159aafba215a57de7e5c1f6211e78f626edd48b | |
| parent | 2c286b07025be273e99f8d8c2aa05ec35f0cc90c (diff) | |
| download | platform_external_android-clat-6be24d8214cf00faa279deba4e690058d84f6458.tar.gz platform_external_android-clat-6be24d8214cf00faa279deba4e690058d84f6458.tar.bz2 platform_external_android-clat-6be24d8214cf00faa279deba4e690058d84f6458.zip | |
cleanup - config_item_int16() & DEFAULT_IPV4_LOCAL_PREFIXLEN
Test:
git grep 'config_item_int16|DEFAULT_IPV4_LOCAL_PREFIXLEN'
comes up empty
Bug: 144730808
Test: atest clatd_test netd_integration_test
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Original-Change: https://android-review.googlesource.com/1322223
Merged-In: I71716cdcba382bc5fb1efa5000189f63a57015c9
Change-Id: I71716cdcba382bc5fb1efa5000189f63a57015c9
| -rw-r--r-- | config.c | 47 | ||||
| -rw-r--r-- | config.h | 1 |
2 files changed, 1 insertions, 47 deletions
@@ -35,49 +35,6 @@ struct clat_config Global_Clatd_Config; -/* 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 @@ -169,9 +126,7 @@ int read_config(const char *file, const char *uplink_interface) { &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; + Global_Clatd_Config.ipv4_local_prefixlen = 29; return 1; @@ -22,7 +22,6 @@ #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; |
