diff options
author | Erik Kline <ek@google.com> | 2015-11-12 17:53:28 +0900 |
---|---|---|
committer | Erik Kline <ek@google.com> | 2015-11-12 17:53:28 +0900 |
commit | 46e72b15acc9965d180a4136dc81335fb0c166d9 (patch) | |
tree | d913a0cb56e386af5ca3f98eb248cf59cfca947c | |
parent | 50425146ec98a51b13fcb91af8d69556950835b2 (diff) | |
download | android_external_dnsmasq-46e72b15acc9965d180a4136dc81335fb0c166d9.tar.gz android_external_dnsmasq-46e72b15acc9965d180a4136dc81335fb0c166d9.tar.bz2 android_external_dnsmasq-46e72b15acc9965d180a4136dc81335fb0c166d9.zip |
Change dnsmasq input command argument separator
Heretofore netd issued commands to dnsmasq over a stdin channel
using ":" as an argument separator. This make it very complicated
to issue commands that involve IPv6 addresses.
This changes the separator from ":" to "|".
Bug: 9580643
Change-Id: If62147e12c6e3dc9448cae0d3e20fa989cf19b95
-rwxr-xr-x | src/dnsmasq.c | 2 | ||||
-rwxr-xr-x | src/network.c | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/dnsmasq.c b/src/dnsmasq.c index 52d222e..a1b6578 100755 --- a/src/dnsmasq.c +++ b/src/dnsmasq.c @@ -1007,7 +1007,7 @@ static int check_android_listeners(fd_set *set) { char *params = current_cmd; int len = strlen(current_cmd); - cmd = strsep(¶ms, ":"); + cmd = strsep(¶ms, "|"); if (!strcmp(cmd, "update_dns")) { if (params != NULL) { set_servers(params); diff --git a/src/network.c b/src/network.c index 9ae9037..676701c 100755 --- a/src/network.c +++ b/src/network.c @@ -16,6 +16,8 @@ #include "dnsmasq.h" +static const char SEPARATOR[] = "|"; + #ifdef HAVE_LINUX_NETWORK int indextoname(int fd, int index, char *name) @@ -922,7 +924,7 @@ void check_servers(void) * Ingests a new list of interfaces and starts to listen on them, adding only the new * and stopping to listen to any interfaces not on the new list. * - * interfaces - input in the format "bt-pan:eth0:wlan0:..>" up to 1024 bytes long + * interfaces - input in the format "bt-pan|eth0|wlan0|..>" up to 1024 bytes long */ void set_interfaces(const char *interfaces) { @@ -947,7 +949,7 @@ void set_interfaces(const char *interfaces) die(_("interface string too long: %s"), NULL, EC_BADNET); } strncpy(s, interfaces, sizeof(s)); - while((interface = strsep(&next, ":"))) { + while((interface = strsep(&next, SEPARATOR))) { if_tmp = safe_malloc(sizeof(struct iname)); memset(if_tmp, 0, sizeof(struct iname)); if ((if_tmp->name = strdup(interface)) == NULL) { @@ -1034,7 +1036,7 @@ void set_interfaces(const char *interfaces) } /* - * Takes a string in the format "0x100b:1.2.3.4:1.2.3.4:..." - up to 1024 bytes in length + * Takes a string in the format "0x100b|1.2.3.4|1.2.3.4|..." - up to 1024 bytes in length * - The first element is the socket mark to set on sockets that forward DNS queries. * - The subsequent elements are the DNS servers to forward queries to. */ @@ -1074,10 +1076,10 @@ int set_servers(const char *servers) char *saddr; /* Parse the mark. */ - mark_string = strsep(&next, ":"); + mark_string = strsep(&next, SEPARATOR); mark = strtoul(mark_string, NULL, 0); - while ((saddr = strsep(&next, ":"))) { + while ((saddr = strsep(&next, SEPARATOR))) { union mysockaddr addr, source_addr; memset(&addr, 0, sizeof(addr)); memset(&source_addr, 0, sizeof(source_addr)); |