diff options
author | Paul Jensen <pauljensen@google.com> | 2014-05-30 13:19:10 -0400 |
---|---|---|
committer | Paul Jensen <pauljensen@google.com> | 2014-06-02 10:38:30 -0400 |
commit | a1c871c8efad6c0b69e27d3b85e82a27e282b8be (patch) | |
tree | d9b3beee0e179e2545a34f74a4e640410bdfe1a9 /config.c | |
parent | 079fd2305ef90d95a1bfdb200e2975e9db86bf43 (diff) | |
download | platform_external_android-clat-a1c871c8efad6c0b69e27d3b85e82a27e282b8be.tar.gz platform_external_android-clat-a1c871c8efad6c0b69e27d3b85e82a27e282b8be.tar.bz2 platform_external_android-clat-a1c871c8efad6c0b69e27d3b85e82a27e282b8be.zip |
Make DNS request for plat prefix detection network specific.
When plat prefix detection is done on a non-default network it
must use the network specific version of getaddrinfo() so the
plat prefix corresponds to the particular network. The network
is specified to clatd via a NetID command line argument.
Change-Id: I77a47b24e68c7786f790974f05787a40a4934af5
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -152,15 +152,16 @@ void free_config() { /* function: dns64_detection * does dns lookups to set the plat subnet or exits on failure, waits forever for a dns response with a query backoff timer + * net_id - (optional) netId to use, NETID_UNSET indicates use of default network */ -void dns64_detection() { +void dns64_detection(unsigned net_id) { int backoff_sleep, status; struct in6_addr tmp_ptr; backoff_sleep = 1; while(1) { - status = plat_prefix(Global_Clatd_Config.plat_from_dns64_hostname,&tmp_ptr); + status = plat_prefix(Global_Clatd_Config.plat_from_dns64_hostname,net_id,&tmp_ptr); if(status > 0) { memcpy(&Global_Clatd_Config.plat_subnet, &tmp_ptr, sizeof(struct in6_addr)); return; @@ -223,8 +224,10 @@ int subnet_from_interface(cnode *root, const char *interface) { * file - filename to parse * uplink_interface - interface to use to reach the internet and supplier of address space * plat_prefix - (optional) plat prefix to use, otherwise follow config file + * net_id - (optional) netId to use, NETID_UNSET indicates use of default network */ -int read_config(const char *file, const char *uplink_interface, const char *plat_prefix) { +int read_config(const char *file, const char *uplink_interface, const char *plat_prefix, + unsigned net_id) { cnode *root = config_node("", ""); void *tmp_ptr = NULL; @@ -277,7 +280,7 @@ int read_config(const char *file, const char *uplink_interface, const char *plat if(!(Global_Clatd_Config.plat_from_dns64_hostname = config_item_str(root, "plat_from_dns64_hostname", DEFAULT_DNS64_DETECTION_HOSTNAME))) goto failed; - dns64_detection(); + dns64_detection(net_id); } } |