San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <stdlib.h> |
| 18 | #include <errno.h> |
San Mehat | 1873784 | 2010-01-21 09:22:43 -0800 | [diff] [blame] | 19 | #include <fcntl.h> |
Olivier Bailly | ff2c0d8 | 2010-11-17 11:45:07 -0800 | [diff] [blame] | 20 | #include <string.h> |
San Mehat | 1873784 | 2010-01-21 09:22:43 -0800 | [diff] [blame] | 21 | |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 22 | #include <sys/socket.h> |
| 23 | #include <sys/stat.h> |
San Mehat | 1873784 | 2010-01-21 09:22:43 -0800 | [diff] [blame] | 24 | #include <sys/types.h> |
| 25 | #include <sys/wait.h> |
| 26 | |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 27 | #include <netinet/in.h> |
| 28 | #include <arpa/inet.h> |
| 29 | |
| 30 | #define LOG_TAG "TetherController" |
| 31 | #include <cutils/log.h> |
Kazuhiro Ondo | 6b858eb | 2011-06-24 20:31:03 -0500 | [diff] [blame] | 32 | #include <cutils/properties.h> |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 33 | |
Lorenzo Colitti | 667c477 | 2014-08-26 14:13:07 -0700 | [diff] [blame] | 34 | #include "Fwmark.h" |
JP Abgrall | 69261cb | 2014-06-19 18:35:24 -0700 | [diff] [blame] | 35 | #include "NetdConstants.h" |
Lorenzo Colitti | 667c477 | 2014-08-26 14:13:07 -0700 | [diff] [blame] | 36 | #include "Permission.h" |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 37 | #include "TetherController.h" |
| 38 | |
Sreeram Ramachandran | 87475a1 | 2014-07-15 16:20:28 -0700 | [diff] [blame] | 39 | TetherController::TetherController() { |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 40 | mInterfaces = new InterfaceCollection(); |
Lorenzo Colitti | 667c477 | 2014-08-26 14:13:07 -0700 | [diff] [blame] | 41 | mDnsNetId = 0; |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 42 | mDnsForwarders = new NetAddressCollection(); |
| 43 | mDaemonFd = -1; |
| 44 | mDaemonPid = 0; |
| 45 | } |
| 46 | |
| 47 | TetherController::~TetherController() { |
| 48 | InterfaceCollection::iterator it; |
| 49 | |
| 50 | for (it = mInterfaces->begin(); it != mInterfaces->end(); ++it) { |
| 51 | free(*it); |
| 52 | } |
| 53 | mInterfaces->clear(); |
| 54 | |
| 55 | mDnsForwarders->clear(); |
| 56 | } |
| 57 | |
| 58 | int TetherController::setIpFwdEnabled(bool enable) { |
| 59 | |
Steve Block | 7b984e3 | 2011-12-20 16:22:42 +0000 | [diff] [blame] | 60 | ALOGD("Setting IP forward enable = %d", enable); |
Kazuhiro Ondo | 6b858eb | 2011-06-24 20:31:03 -0500 | [diff] [blame] | 61 | |
| 62 | // In BP tools mode, do not disable IP forwarding |
| 63 | char bootmode[PROPERTY_VALUE_MAX] = {0}; |
| 64 | property_get("ro.bootmode", bootmode, "unknown"); |
| 65 | if ((enable == false) && (0 == strcmp("bp-tools", bootmode))) { |
| 66 | return 0; |
| 67 | } |
| 68 | |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 69 | int fd = open("/proc/sys/net/ipv4/ip_forward", O_WRONLY); |
| 70 | if (fd < 0) { |
Steve Block | 5ea0c05 | 2012-01-06 19:18:11 +0000 | [diff] [blame] | 71 | ALOGE("Failed to open ip_forward (%s)", strerror(errno)); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 72 | return -1; |
| 73 | } |
| 74 | |
| 75 | if (write(fd, (enable ? "1" : "0"), 1) != 1) { |
Steve Block | 5ea0c05 | 2012-01-06 19:18:11 +0000 | [diff] [blame] | 76 | ALOGE("Failed to write ip_forward (%s)", strerror(errno)); |
Robert Greenwalt | 37dc4a5 | 2010-04-28 16:05:04 -0700 | [diff] [blame] | 77 | close(fd); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 78 | return -1; |
| 79 | } |
| 80 | close(fd); |
| 81 | return 0; |
| 82 | } |
| 83 | |
| 84 | bool TetherController::getIpFwdEnabled() { |
| 85 | int fd = open("/proc/sys/net/ipv4/ip_forward", O_RDONLY); |
| 86 | |
| 87 | if (fd < 0) { |
Steve Block | 5ea0c05 | 2012-01-06 19:18:11 +0000 | [diff] [blame] | 88 | ALOGE("Failed to open ip_forward (%s)", strerror(errno)); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 89 | return false; |
| 90 | } |
| 91 | |
| 92 | char enabled; |
| 93 | if (read(fd, &enabled, 1) != 1) { |
Steve Block | 5ea0c05 | 2012-01-06 19:18:11 +0000 | [diff] [blame] | 94 | ALOGE("Failed to read ip_forward (%s)", strerror(errno)); |
Robert Greenwalt | 37dc4a5 | 2010-04-28 16:05:04 -0700 | [diff] [blame] | 95 | close(fd); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 96 | return -1; |
| 97 | } |
| 98 | |
| 99 | close(fd); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 100 | return (enabled == '1' ? true : false); |
| 101 | } |
| 102 | |
Dmitry Shmidt | bc775ed | 2013-12-12 16:41:16 -0800 | [diff] [blame] | 103 | #define TETHER_START_CONST_ARG 8 |
| 104 | |
Robert Greenwalt | 3208ea0 | 2010-03-24 16:32:55 -0700 | [diff] [blame] | 105 | int TetherController::startTethering(int num_addrs, struct in_addr* addrs) { |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 106 | if (mDaemonPid != 0) { |
Steve Block | 5ea0c05 | 2012-01-06 19:18:11 +0000 | [diff] [blame] | 107 | ALOGE("Tethering already started"); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 108 | errno = EBUSY; |
| 109 | return -1; |
| 110 | } |
| 111 | |
Steve Block | 7b984e3 | 2011-12-20 16:22:42 +0000 | [diff] [blame] | 112 | ALOGD("Starting tethering services"); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 113 | |
| 114 | pid_t pid; |
| 115 | int pipefd[2]; |
| 116 | |
| 117 | if (pipe(pipefd) < 0) { |
Steve Block | 5ea0c05 | 2012-01-06 19:18:11 +0000 | [diff] [blame] | 118 | ALOGE("pipe failed (%s)", strerror(errno)); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 119 | return -1; |
| 120 | } |
| 121 | |
| 122 | /* |
| 123 | * TODO: Create a monitoring thread to handle and restart |
| 124 | * the daemon if it exits prematurely |
| 125 | */ |
| 126 | if ((pid = fork()) < 0) { |
Steve Block | 5ea0c05 | 2012-01-06 19:18:11 +0000 | [diff] [blame] | 127 | ALOGE("fork failed (%s)", strerror(errno)); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 128 | close(pipefd[0]); |
| 129 | close(pipefd[1]); |
| 130 | return -1; |
| 131 | } |
| 132 | |
| 133 | if (!pid) { |
| 134 | close(pipefd[1]); |
| 135 | if (pipefd[0] != STDIN_FILENO) { |
| 136 | if (dup2(pipefd[0], STDIN_FILENO) != STDIN_FILENO) { |
Steve Block | 5ea0c05 | 2012-01-06 19:18:11 +0000 | [diff] [blame] | 137 | ALOGE("dup2 failed (%s)", strerror(errno)); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 138 | return -1; |
| 139 | } |
| 140 | close(pipefd[0]); |
| 141 | } |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 142 | |
Dmitry Shmidt | bc775ed | 2013-12-12 16:41:16 -0800 | [diff] [blame] | 143 | int num_processed_args = TETHER_START_CONST_ARG + (num_addrs/2) + 1; |
Robert Greenwalt | 3208ea0 | 2010-03-24 16:32:55 -0700 | [diff] [blame] | 144 | char **args = (char **)malloc(sizeof(char *) * num_processed_args); |
| 145 | args[num_processed_args - 1] = NULL; |
| 146 | args[0] = (char *)"/system/bin/dnsmasq"; |
Peter Nilsson | b756f69 | 2011-09-08 09:48:31 -0700 | [diff] [blame] | 147 | args[1] = (char *)"--keep-in-foreground"; |
Robert Greenwalt | 3208ea0 | 2010-03-24 16:32:55 -0700 | [diff] [blame] | 148 | args[2] = (char *)"--no-resolv"; |
| 149 | args[3] = (char *)"--no-poll"; |
Dmitry Shmidt | bc775ed | 2013-12-12 16:41:16 -0800 | [diff] [blame] | 150 | args[4] = (char *)"--dhcp-authoritative"; |
Jeff Sharkey | 6df79da | 2012-04-18 21:53:35 -0700 | [diff] [blame] | 151 | // TODO: pipe through metered status from ConnService |
Dmitry Shmidt | bc775ed | 2013-12-12 16:41:16 -0800 | [diff] [blame] | 152 | args[5] = (char *)"--dhcp-option-force=43,ANDROID_METERED"; |
| 153 | args[6] = (char *)"--pid-file"; |
| 154 | args[7] = (char *)""; |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 155 | |
Dmitry Shmidt | bc775ed | 2013-12-12 16:41:16 -0800 | [diff] [blame] | 156 | int nextArg = TETHER_START_CONST_ARG; |
Robert Greenwalt | 3208ea0 | 2010-03-24 16:32:55 -0700 | [diff] [blame] | 157 | for (int addrIndex=0; addrIndex < num_addrs;) { |
| 158 | char *start = strdup(inet_ntoa(addrs[addrIndex++])); |
| 159 | char *end = strdup(inet_ntoa(addrs[addrIndex++])); |
| 160 | asprintf(&(args[nextArg++]),"--dhcp-range=%s,%s,1h", start, end); |
| 161 | } |
| 162 | |
| 163 | if (execv(args[0], args)) { |
Steve Block | 5ea0c05 | 2012-01-06 19:18:11 +0000 | [diff] [blame] | 164 | ALOGE("execl failed (%s)", strerror(errno)); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 165 | } |
Steve Block | 5ea0c05 | 2012-01-06 19:18:11 +0000 | [diff] [blame] | 166 | ALOGE("Should never get here!"); |
JP Abgrall | ce4f379 | 2012-08-06 13:44:44 -0700 | [diff] [blame] | 167 | _exit(-1); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 168 | } else { |
| 169 | close(pipefd[0]); |
| 170 | mDaemonPid = pid; |
| 171 | mDaemonFd = pipefd[1]; |
Robert Greenwalt | 3d4c758 | 2012-12-11 12:33:37 -0800 | [diff] [blame] | 172 | applyDnsInterfaces(); |
Steve Block | 7b984e3 | 2011-12-20 16:22:42 +0000 | [diff] [blame] | 173 | ALOGD("Tethering services running"); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | return 0; |
| 177 | } |
| 178 | |
| 179 | int TetherController::stopTethering() { |
| 180 | |
| 181 | if (mDaemonPid == 0) { |
Steve Block | 5ea0c05 | 2012-01-06 19:18:11 +0000 | [diff] [blame] | 182 | ALOGE("Tethering already stopped"); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 183 | return 0; |
| 184 | } |
| 185 | |
Steve Block | 7b984e3 | 2011-12-20 16:22:42 +0000 | [diff] [blame] | 186 | ALOGD("Stopping tethering services"); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 187 | |
| 188 | kill(mDaemonPid, SIGTERM); |
San Mehat | 1873784 | 2010-01-21 09:22:43 -0800 | [diff] [blame] | 189 | waitpid(mDaemonPid, NULL, 0); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 190 | mDaemonPid = 0; |
| 191 | close(mDaemonFd); |
| 192 | mDaemonFd = -1; |
Steve Block | 7b984e3 | 2011-12-20 16:22:42 +0000 | [diff] [blame] | 193 | ALOGD("Tethering services stopped"); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 194 | return 0; |
| 195 | } |
Matthew Xie | 1994410 | 2012-07-12 16:42:07 -0700 | [diff] [blame] | 196 | |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 197 | bool TetherController::isTetheringStarted() { |
| 198 | return (mDaemonPid == 0 ? false : true); |
| 199 | } |
| 200 | |
Kenny Root | cf52faf | 2010-02-18 09:59:55 -0800 | [diff] [blame] | 201 | #define MAX_CMD_SIZE 1024 |
| 202 | |
Lorenzo Colitti | 667c477 | 2014-08-26 14:13:07 -0700 | [diff] [blame] | 203 | int TetherController::setDnsForwarders(unsigned netId, char **servers, int numServers) { |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 204 | int i; |
Kenny Root | cf52faf | 2010-02-18 09:59:55 -0800 | [diff] [blame] | 205 | char daemonCmd[MAX_CMD_SIZE]; |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 206 | |
Lorenzo Colitti | 667c477 | 2014-08-26 14:13:07 -0700 | [diff] [blame] | 207 | Fwmark fwmark; |
| 208 | fwmark.netId = netId; |
| 209 | fwmark.explicitlySelected = true; |
| 210 | fwmark.protectedFromVpn = true; |
| 211 | fwmark.permission = PERMISSION_SYSTEM; |
| 212 | |
| 213 | snprintf(daemonCmd, sizeof(daemonCmd), "update_dns:0x%x", fwmark.intValue); |
Kenny Root | cf52faf | 2010-02-18 09:59:55 -0800 | [diff] [blame] | 214 | int cmdLen = strlen(daemonCmd); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 215 | |
| 216 | mDnsForwarders->clear(); |
| 217 | for (i = 0; i < numServers; i++) { |
Lorenzo Colitti | 667c477 | 2014-08-26 14:13:07 -0700 | [diff] [blame] | 218 | ALOGD("setDnsForwarders(0x%x %d = '%s')", fwmark.intValue, i, servers[i]); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 219 | |
| 220 | struct in_addr a; |
| 221 | |
| 222 | if (!inet_aton(servers[i], &a)) { |
Steve Block | 5ea0c05 | 2012-01-06 19:18:11 +0000 | [diff] [blame] | 223 | ALOGE("Failed to parse DNS server '%s'", servers[i]); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 224 | mDnsForwarders->clear(); |
| 225 | return -1; |
| 226 | } |
Kenny Root | cf52faf | 2010-02-18 09:59:55 -0800 | [diff] [blame] | 227 | |
Nick Kralevich | ad5b41f | 2012-07-19 18:48:05 -0700 | [diff] [blame] | 228 | cmdLen += (strlen(servers[i]) + 1); |
| 229 | if (cmdLen + 1 >= MAX_CMD_SIZE) { |
Steve Block | 7b984e3 | 2011-12-20 16:22:42 +0000 | [diff] [blame] | 230 | ALOGD("Too many DNS servers listed"); |
Kenny Root | cf52faf | 2010-02-18 09:59:55 -0800 | [diff] [blame] | 231 | break; |
| 232 | } |
| 233 | |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 234 | strcat(daemonCmd, ":"); |
| 235 | strcat(daemonCmd, servers[i]); |
| 236 | mDnsForwarders->push_back(a); |
| 237 | } |
| 238 | |
Lorenzo Colitti | 667c477 | 2014-08-26 14:13:07 -0700 | [diff] [blame] | 239 | mDnsNetId = netId; |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 240 | if (mDaemonFd != -1) { |
Steve Block | 7b984e3 | 2011-12-20 16:22:42 +0000 | [diff] [blame] | 241 | ALOGD("Sending update msg to dnsmasq [%s]", daemonCmd); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 242 | if (write(mDaemonFd, daemonCmd, strlen(daemonCmd) +1) < 0) { |
Steve Block | 5ea0c05 | 2012-01-06 19:18:11 +0000 | [diff] [blame] | 243 | ALOGE("Failed to send update command to dnsmasq (%s)", strerror(errno)); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 244 | mDnsForwarders->clear(); |
| 245 | return -1; |
| 246 | } |
| 247 | } |
| 248 | return 0; |
| 249 | } |
| 250 | |
Lorenzo Colitti | 667c477 | 2014-08-26 14:13:07 -0700 | [diff] [blame] | 251 | unsigned TetherController::getDnsNetId() { |
| 252 | return mDnsNetId; |
| 253 | } |
| 254 | |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 255 | NetAddressCollection *TetherController::getDnsForwarders() { |
| 256 | return mDnsForwarders; |
| 257 | } |
| 258 | |
Robert Greenwalt | 3d4c758 | 2012-12-11 12:33:37 -0800 | [diff] [blame] | 259 | int TetherController::applyDnsInterfaces() { |
Robert Greenwalt | 3d4c758 | 2012-12-11 12:33:37 -0800 | [diff] [blame] | 260 | char daemonCmd[MAX_CMD_SIZE]; |
| 261 | |
| 262 | strcpy(daemonCmd, "update_ifaces"); |
| 263 | int cmdLen = strlen(daemonCmd); |
| 264 | InterfaceCollection::iterator it; |
| 265 | bool haveInterfaces = false; |
| 266 | |
| 267 | for (it = mInterfaces->begin(); it != mInterfaces->end(); ++it) { |
| 268 | cmdLen += (strlen(*it) + 1); |
| 269 | if (cmdLen + 1 >= MAX_CMD_SIZE) { |
| 270 | ALOGD("Too many DNS ifaces listed"); |
| 271 | break; |
| 272 | } |
| 273 | |
| 274 | strcat(daemonCmd, ":"); |
| 275 | strcat(daemonCmd, *it); |
| 276 | haveInterfaces = true; |
| 277 | } |
| 278 | |
| 279 | if ((mDaemonFd != -1) && haveInterfaces) { |
| 280 | ALOGD("Sending update msg to dnsmasq [%s]", daemonCmd); |
| 281 | if (write(mDaemonFd, daemonCmd, strlen(daemonCmd) +1) < 0) { |
| 282 | ALOGE("Failed to send update command to dnsmasq (%s)", strerror(errno)); |
| 283 | return -1; |
| 284 | } |
| 285 | } |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 286 | return 0; |
| 287 | } |
| 288 | |
Robert Greenwalt | 3d4c758 | 2012-12-11 12:33:37 -0800 | [diff] [blame] | 289 | int TetherController::tetherInterface(const char *interface) { |
| 290 | ALOGD("tetherInterface(%s)", interface); |
JP Abgrall | 69261cb | 2014-06-19 18:35:24 -0700 | [diff] [blame] | 291 | if (!isIfaceName(interface)) { |
| 292 | errno = ENOENT; |
| 293 | return -1; |
| 294 | } |
Robert Greenwalt | 3d4c758 | 2012-12-11 12:33:37 -0800 | [diff] [blame] | 295 | mInterfaces->push_back(strdup(interface)); |
| 296 | |
| 297 | if (applyDnsInterfaces()) { |
| 298 | InterfaceCollection::iterator it; |
| 299 | for (it = mInterfaces->begin(); it != mInterfaces->end(); ++it) { |
| 300 | if (!strcmp(interface, *it)) { |
| 301 | free(*it); |
| 302 | mInterfaces->erase(it); |
| 303 | break; |
| 304 | } |
| 305 | } |
| 306 | return -1; |
| 307 | } else { |
| 308 | return 0; |
| 309 | } |
| 310 | } |
| 311 | |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 312 | int TetherController::untetherInterface(const char *interface) { |
| 313 | InterfaceCollection::iterator it; |
| 314 | |
Robert Greenwalt | 3d4c758 | 2012-12-11 12:33:37 -0800 | [diff] [blame] | 315 | ALOGD("untetherInterface(%s)", interface); |
| 316 | |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 317 | for (it = mInterfaces->begin(); it != mInterfaces->end(); ++it) { |
| 318 | if (!strcmp(interface, *it)) { |
| 319 | free(*it); |
| 320 | mInterfaces->erase(it); |
Robert Greenwalt | 3d4c758 | 2012-12-11 12:33:37 -0800 | [diff] [blame] | 321 | |
| 322 | return applyDnsInterfaces(); |
San Mehat | 9d10b34 | 2010-01-18 09:51:02 -0800 | [diff] [blame] | 323 | } |
| 324 | } |
| 325 | errno = ENOENT; |
| 326 | return -1; |
| 327 | } |
| 328 | |
| 329 | InterfaceCollection *TetherController::getTetheredInterfaceList() { |
| 330 | return mInterfaces; |
| 331 | } |