markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (c) 2016, 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 | package android.net; |
| 18 | |
| 19 | import android.net.INetdUnsolicitedEventListener; |
| 20 | import android.net.InterfaceConfigurationParcel; |
Yan Yan | 1111180 | 2022-12-16 02:17:07 +0000 | [diff] [blame] | 21 | import android.net.IpSecMigrateInfoParcel; |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 22 | import android.net.MarkMaskParcel; |
| 23 | import android.net.NativeNetworkConfig; |
| 24 | import android.net.RouteInfoParcel; |
| 25 | import android.net.TetherConfigParcel; |
| 26 | import android.net.TetherOffloadRuleParcel; |
| 27 | import android.net.TetherStatsParcel; |
| 28 | import android.net.UidRangeParcel; |
| 29 | import android.net.netd.aidl.NativeUidRangeConfig; |
| 30 | |
| 31 | /** {@hide} */ |
| 32 | interface INetd { |
| 33 | /** |
| 34 | * Returns true if the service is responding. |
| 35 | */ |
| 36 | boolean isAlive(); |
| 37 | |
| 38 | /** |
| 39 | * Replaces the contents of the specified UID-based firewall chain. |
| 40 | * |
| 41 | * The chain may be an allowlist chain or a denylist chain. A denylist chain contains DROP |
| 42 | * rules for the specified UIDs and a RETURN rule at the end. An allowlist chain contains RETURN |
| 43 | * rules for the system UID range (0 to {@code UID_APP} - 1), RETURN rules for for the specified |
| 44 | * UIDs, and a DROP rule at the end. The chain will be created if it does not exist. |
| 45 | * |
| 46 | * @param chainName The name of the chain to replace. |
| 47 | * @param isAllowlist Whether this is an allowlist or denylist chain. |
| 48 | * @param uids The list of UIDs to allow/deny. |
| 49 | * @return true if the chain was successfully replaced, false otherwise. |
Ken Chen | 91dc3a1 | 2023-11-13 12:18:53 +0800 | [diff] [blame^] | 50 | * @deprecated unimplemented on T+. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 51 | */ |
| 52 | boolean firewallReplaceUidChain(in @utf8InCpp String chainName, |
| 53 | boolean isAllowlist, |
| 54 | in int[] uids); |
| 55 | |
| 56 | /** |
| 57 | * Enables or disables data saver mode on costly network interfaces. |
| 58 | * |
| 59 | * - When disabled, all packets to/from apps in the penalty box chain are rejected on costly |
| 60 | * interfaces. Traffic to/from other apps or on other network interfaces is allowed. |
| 61 | * - When enabled, only apps that are in the happy box chain and not in the penalty box chain |
| 62 | * are allowed network connectivity on costly interfaces. All other packets on these |
| 63 | * interfaces are rejected. The happy box chain always contains all system UIDs; to disallow |
| 64 | * traffic from system UIDs, place them in the penalty box chain. |
| 65 | * |
| 66 | * By default, data saver mode is disabled. This command has no effect but might still return an |
| 67 | * error) if {@code enable} is the same as the current value. |
| 68 | * |
| 69 | * @param enable whether to enable or disable data saver mode. |
| 70 | * @return true if the if the operation was successful, false otherwise. |
| 71 | */ |
| 72 | boolean bandwidthEnableDataSaver(boolean enable); |
| 73 | |
| 74 | /** |
| 75 | * Creates a physical network (i.e., one containing physical interfaces. |
| 76 | * @deprecated use networkCreate() instead. |
| 77 | * |
| 78 | * @param netId the networkId to create. |
| 79 | * @param permission the permission necessary to use the network. Must be one of |
| 80 | * PERMISSION_NONE/PERMISSION_NETWORK/PERMISSION_SYSTEM. |
| 81 | * |
| 82 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 83 | * unix errno. |
| 84 | */ |
| 85 | void networkCreatePhysical(int netId, int permission); |
| 86 | |
| 87 | /** |
| 88 | * Creates a VPN network. |
| 89 | * @deprecated use networkCreate() instead. |
| 90 | * |
| 91 | * @param netId the network to create. |
| 92 | * @param secure whether unprivileged apps are allowed to bypass the VPN. |
| 93 | * |
| 94 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 95 | * unix errno. |
| 96 | */ |
| 97 | void networkCreateVpn(int netId, boolean secure); |
| 98 | |
| 99 | /** |
| 100 | * Destroys a network. Any interfaces added to the network are removed, and the network ceases |
| 101 | * to be the default network. |
| 102 | * |
| 103 | * @param netId the network to destroy. |
| 104 | * |
| 105 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 106 | * unix errno. |
| 107 | */ |
| 108 | void networkDestroy(int netId); |
| 109 | |
| 110 | /** |
| 111 | * Adds an interface to a network. The interface must not be assigned to any network, including |
| 112 | * the specified network. |
| 113 | * |
| 114 | * @param netId the network to add the interface to. |
| 115 | * @param interface the name of the interface to add. |
| 116 | * |
| 117 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 118 | * unix errno. |
| 119 | */ |
| 120 | void networkAddInterface(int netId, in @utf8InCpp String iface); |
| 121 | |
| 122 | /** |
| 123 | * Adds an interface to a network. The interface must be assigned to the specified network. |
| 124 | * |
| 125 | * @param netId the network to remove the interface from. |
| 126 | * @param interface the name of the interface to remove. |
| 127 | * |
| 128 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 129 | * unix errno. |
| 130 | */ |
| 131 | void networkRemoveInterface(int netId, in @utf8InCpp String iface); |
| 132 | |
| 133 | /** |
| 134 | * Adds the specified UID ranges to the specified network. The network can be physical or |
| 135 | * virtual. Traffic from the UID ranges will be routed to the network by default. |
| 136 | * |
| 137 | * @param netId the network ID of the network to add the ranges to. |
| 138 | * @param uidRanges a set of non-overlapping ranges of UIDs to add. These exact ranges |
| 139 | * must not overlap with existing ranges assigned to this network. |
| 140 | * |
| 141 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 142 | * unix errno. |
| 143 | */ |
| 144 | void networkAddUidRanges(int netId, in UidRangeParcel[] uidRanges); |
| 145 | |
| 146 | /** |
| 147 | * Remove the specified UID ranges from the specified network. The network can be physical or |
| 148 | * virtual. Traffic from the UID ranges will no longer be routed to the network by default. |
| 149 | * |
| 150 | * @param netId the network ID of the network to remove the ranges from. |
| 151 | * @param uidRanges a set of non-overlapping ranges of UIDs to remove. These exact ranges |
| 152 | * must already be assigned to this network. |
| 153 | * |
| 154 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 155 | * unix errno. |
| 156 | */ |
| 157 | void networkRemoveUidRanges(int netId, in UidRangeParcel[] uidRanges); |
| 158 | |
| 159 | /** |
| 160 | * Adds or removes one rule for each supplied UID range to prohibit all network activity outside |
| 161 | * of secure VPN. |
| 162 | * |
| 163 | * When a UID is covered by one of these rules, traffic sent through any socket that is not |
| 164 | * protected or explicitly overriden by the system will be rejected. The kernel will respond |
| 165 | * with an ICMP prohibit message. |
| 166 | * |
| 167 | * Initially, there are no such rules. Any rules that are added will only last until the next |
| 168 | * restart of netd or the device. |
| 169 | * |
| 170 | * @param add {@code true} if the specified UID ranges should be denied access to any network |
| 171 | * which is not secure VPN by adding rules, {@code false} to remove existing rules. |
| 172 | * @param uidRanges a set of non-overlapping, contiguous ranges of UIDs to which to apply or |
| 173 | * remove this restriction. |
| 174 | * <p> Added rules should not overlap with existing rules. Likewise, removed rules should |
| 175 | * each correspond to an existing rule. |
| 176 | * |
| 177 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 178 | * unix errno. |
| 179 | */ |
| 180 | void networkRejectNonSecureVpn(boolean add, in UidRangeParcel[] uidRanges); |
| 181 | |
| 182 | /** |
| 183 | * Administratively closes sockets belonging to the specified UIDs. |
| 184 | */ |
| 185 | void socketDestroy(in UidRangeParcel[] uidRanges, in int[] exemptUids); |
| 186 | |
| 187 | /** |
| 188 | * Instruct the tethering DNS server to reevaluated serving interfaces. |
| 189 | * This is needed to for the DNS server to observe changes in the set |
| 190 | * of potential listening IP addresses. (Listening on wildcard addresses |
| 191 | * can turn the device into an open resolver; b/7530468) |
| 192 | * |
| 193 | * TODO: Return something richer than just a boolean. |
| 194 | */ |
| 195 | boolean tetherApplyDnsInterfaces(); |
| 196 | |
| 197 | /** |
| 198 | * Return tethering statistics. |
| 199 | * |
| 200 | * @return an array of TetherStatsParcel, where each entry contains the upstream interface |
| 201 | * name and its tethering statistics since netd startup. |
| 202 | * There will only ever be one entry for a given interface. |
| 203 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 204 | * cause of the failure. |
| 205 | */ |
| 206 | TetherStatsParcel[] tetherGetStats(); |
| 207 | |
| 208 | /** |
| 209 | * Add/Remove and IP address from an interface. |
| 210 | * |
| 211 | * @param ifName the interface name |
| 212 | * @param addrString the IP address to add/remove as a string literal |
| 213 | * @param prefixLength the prefix length associated with this IP address |
| 214 | * |
| 215 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 216 | * unix errno. |
| 217 | */ |
| 218 | void interfaceAddAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, |
| 219 | int prefixLength); |
| 220 | void interfaceDelAddress(in @utf8InCpp String ifName, in @utf8InCpp String addrString, |
| 221 | int prefixLength); |
| 222 | |
| 223 | /** |
| 224 | * Set and get /proc/sys/net interface configuration parameters. |
| 225 | * |
| 226 | * @param ipversion One of IPV4/IPV6 integers, indicating the desired IP version directory. |
| 227 | * @param which One of CONF/NEIGH integers, indicating the desired parameter category directory. |
| 228 | * @param ifname The interface name portion of the path; may also be "all" or "default". |
| 229 | * @param parameter The parameter name portion of the path. |
| 230 | * @param value The value string to be written into the assembled path. |
| 231 | * |
| 232 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 233 | * unix errno. |
| 234 | */ |
| 235 | |
| 236 | const int IPV4 = 4; |
| 237 | const int IPV6 = 6; |
| 238 | const int CONF = 1; |
| 239 | const int NEIGH = 2; |
| 240 | @utf8InCpp String getProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, |
| 241 | in @utf8InCpp String parameter); |
| 242 | void setProcSysNet(int ipversion, int which, in @utf8InCpp String ifname, |
| 243 | in @utf8InCpp String parameter, in @utf8InCpp String value); |
| 244 | |
| 245 | /** |
| 246 | * Sets owner of socket ParcelFileDescriptor to the new UID, checking to ensure that the caller's |
| 247 | * uid is that of the old owner's, and that this is a UDP-encap socket |
| 248 | * |
| 249 | * @param ParcelFileDescriptor socket Socket file descriptor |
| 250 | * @param int newUid UID of the new socket fd owner |
| 251 | */ |
| 252 | void ipSecSetEncapSocketOwner(in ParcelFileDescriptor socket, int newUid); |
| 253 | |
| 254 | /** |
| 255 | * Reserve an SPI from the kernel |
| 256 | * |
| 257 | * @param transformId a unique identifier for allocated resources |
| 258 | * @param sourceAddress InetAddress as string for the sending endpoint |
| 259 | * @param destinationAddress InetAddress as string for the receiving endpoint |
| 260 | * @param spi a requested 32-bit unique ID or 0 to request random allocation |
| 261 | * @return the SPI that was allocated or 0 if failed |
| 262 | */ |
| 263 | int ipSecAllocateSpi( |
| 264 | int transformId, |
| 265 | in @utf8InCpp String sourceAddress, |
| 266 | in @utf8InCpp String destinationAddress, |
| 267 | int spi); |
| 268 | |
| 269 | /** |
Yan Yan | 1111180 | 2022-12-16 02:17:07 +0000 | [diff] [blame] | 270 | * Update an IPsec SA (xfrm_state) describing how ip(v6) traffic will be encrypted |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 271 | * or decrypted. |
| 272 | * |
| 273 | * @param transformId a unique identifier for allocated resources |
| 274 | * @param mode either Transport or Tunnel mode |
| 275 | * @param sourceAddress InetAddress as string for the sending endpoint |
| 276 | * @param destinationAddress InetAddress as string for the receiving endpoint |
| 277 | * @param underlyingNetId the netId of the network to which the SA is applied. Only accepted for |
| 278 | * tunnel mode SAs. |
| 279 | * @param spi a 32-bit unique ID allocated to the user |
| 280 | * @param markValue a 32-bit unique ID chosen by the user |
| 281 | * @param markMask a 32-bit mask chosen by the user |
| 282 | * @param authAlgo a string identifying the authentication algorithm to be used |
| 283 | * @param authKey a byte array containing the authentication key |
| 284 | * @param authTruncBits the truncation length of the MAC produced by the authentication algorithm |
| 285 | * @param cryptAlgo a string identifying the encryption algorithm to be used |
| 286 | * @param cryptKey a byte arrray containing the encryption key |
| 287 | * @param cryptTruncBits unused parameter |
| 288 | * @param aeadAlgo a string identifying the authenticated encryption algorithm to be used |
| 289 | * @param aeadKey a byte arrray containing the key to be used in authenticated encryption |
| 290 | * @param aeadIcvBits the truncation length of the ICV produced by the authentication algorithm |
| 291 | * (similar to authTruncBits in function) |
| 292 | * @param encapType encapsulation type used (if any) for the udp encap socket |
| 293 | * @param encapLocalPort the port number on the host to be used in encap packets |
| 294 | * @param encapRemotePort the port number of the remote to be used for encap packets |
| 295 | * @param interfaceId the identifier for the IPsec tunnel interface. |
| 296 | * Only accepted for tunnel mode SAs. |
| 297 | */ |
| 298 | void ipSecAddSecurityAssociation( |
| 299 | int transformId, |
| 300 | int mode, |
| 301 | in @utf8InCpp String sourceAddress, |
| 302 | in @utf8InCpp String destinationAddress, |
| 303 | int underlyingNetId, |
| 304 | int spi, |
| 305 | int markValue, |
| 306 | int markMask, |
| 307 | in @utf8InCpp String authAlgo, in byte[] authKey, in int authTruncBits, |
| 308 | in @utf8InCpp String cryptAlgo, in byte[] cryptKey, in int cryptTruncBits, |
| 309 | in @utf8InCpp String aeadAlgo, in byte[] aeadKey, in int aeadIcvBits, |
| 310 | int encapType, |
| 311 | int encapLocalPort, |
| 312 | int encapRemotePort, |
| 313 | int interfaceId); |
| 314 | |
| 315 | /** |
| 316 | * Delete a previously created security association identified by the provided parameters |
| 317 | * |
| 318 | * @param transformId a unique identifier for allocated resources |
| 319 | * @param sourceAddress InetAddress as string for the sending endpoint |
| 320 | * @param destinationAddress InetAddress as string for the receiving endpoint |
| 321 | * @param spi a requested 32-bit unique ID allocated to the user |
| 322 | * @param markValue a 32-bit unique ID chosen by the user |
| 323 | * @param markMask a 32-bit mask chosen by the user |
| 324 | * @param interfaceId the identifier for the IPsec tunnel interface. |
| 325 | */ |
| 326 | void ipSecDeleteSecurityAssociation( |
| 327 | int transformId, |
| 328 | in @utf8InCpp String sourceAddress, |
| 329 | in @utf8InCpp String destinationAddress, |
| 330 | int spi, |
| 331 | int markValue, |
| 332 | int markMask, |
| 333 | int interfaceId); |
| 334 | |
| 335 | /** |
| 336 | * Apply a previously created SA to a specified socket, starting IPsec on that socket |
| 337 | * |
| 338 | * @param socket a user-provided socket that will have IPsec applied |
| 339 | * @param transformId a unique identifier for allocated resources |
| 340 | * @param direction DIRECTION_IN or DIRECTION_OUT |
| 341 | * @param sourceAddress InetAddress as string for the sending endpoint |
| 342 | * @param destinationAddress InetAddress as string for the receiving endpoint |
| 343 | * @param spi a 32-bit unique ID allocated to the user (socket owner) |
| 344 | */ |
| 345 | void ipSecApplyTransportModeTransform( |
| 346 | in ParcelFileDescriptor socket, |
| 347 | int transformId, |
| 348 | int direction, |
| 349 | in @utf8InCpp String sourceAddress, |
| 350 | in @utf8InCpp String destinationAddress, |
| 351 | int spi); |
| 352 | |
| 353 | /** |
| 354 | * Remove an IPsec SA from a given socket. This will allow unencrypted traffic to flow |
| 355 | * on that socket if a transform had been previously applied. |
| 356 | * |
| 357 | * @param socket a user-provided socket from which to remove any IPsec configuration |
| 358 | */ |
| 359 | void ipSecRemoveTransportModeTransform( |
| 360 | in ParcelFileDescriptor socket); |
| 361 | |
| 362 | /** |
| 363 | * Adds an IPsec global policy. |
| 364 | * |
| 365 | * @param transformId a unique identifier for allocated resources |
| 366 | * @param selAddrFamily the address family identifier for the selector |
| 367 | * @param direction DIRECTION_IN or DIRECTION_OUT |
| 368 | * @param tmplSrcAddress InetAddress as string for the sending endpoint |
| 369 | * @param tmplDstAddress InetAddress as string for the receiving endpoint |
| 370 | * @param spi a 32-bit unique ID allocated to the user |
| 371 | * @param markValue a 32-bit unique ID chosen by the user |
| 372 | * @param markMask a 32-bit mask chosen by the user |
| 373 | * @param interfaceId the identifier for the IPsec tunnel interface. |
| 374 | */ |
| 375 | void ipSecAddSecurityPolicy( |
| 376 | int transformId, |
| 377 | int selAddrFamily, |
| 378 | int direction, |
| 379 | in @utf8InCpp String tmplSrcAddress, |
| 380 | in @utf8InCpp String tmplDstAddress, |
| 381 | int spi, |
| 382 | int markValue, |
| 383 | int markMask, |
| 384 | int interfaceId); |
| 385 | |
| 386 | /** |
| 387 | * Updates an IPsec global policy. |
| 388 | * |
| 389 | * @param transformId a unique identifier for allocated resources |
| 390 | * @param selAddrFamily the address family identifier for the selector |
| 391 | * @param direction DIRECTION_IN or DIRECTION_OUT |
| 392 | * @param tmplSrcAddress InetAddress as string for the sending endpoint |
| 393 | * @param tmplDstAddress InetAddress as string for the receiving endpoint |
| 394 | * @param spi a 32-bit unique ID allocated to the user |
| 395 | * @param markValue a 32-bit unique ID chosen by the user |
| 396 | * @param markMask a 32-bit mask chosen by the user |
| 397 | * @param interfaceId the identifier for the IPsec tunnel interface. |
| 398 | */ |
| 399 | void ipSecUpdateSecurityPolicy( |
| 400 | int transformId, |
| 401 | int selAddrFamily, |
| 402 | int direction, |
| 403 | in @utf8InCpp String tmplSrcAddress, |
| 404 | in @utf8InCpp String tmplDstAddress, |
| 405 | int spi, |
| 406 | int markValue, |
| 407 | int markMask, |
| 408 | int interfaceId); |
| 409 | |
| 410 | /** |
| 411 | * Deletes an IPsec global policy. |
| 412 | * |
| 413 | * Deletion of global policies does not do any matching based on the templates, thus |
| 414 | * template source/destination addresses are not needed (as opposed to add/update). |
| 415 | * |
| 416 | * @param transformId a unique identifier for allocated resources |
| 417 | * @param selAddrFamily the address family identifier for the selector |
| 418 | * @param direction DIRECTION_IN or DIRECTION_OUT |
| 419 | * @param markValue a 32-bit unique ID chosen by the user |
| 420 | * @param markMask a 32-bit mask chosen by the user |
| 421 | * @param interfaceId the identifier for the IPsec tunnel interface. |
| 422 | */ |
| 423 | void ipSecDeleteSecurityPolicy( |
| 424 | int transformId, |
| 425 | int selAddrFamily, |
| 426 | int direction, |
| 427 | int markValue, |
| 428 | int markMask, |
| 429 | int interfaceId); |
| 430 | |
| 431 | // This could not be declared as @uft8InCpp; thus, when used in native code it must be |
| 432 | // converted from a UTF-16 string to an ASCII string. |
| 433 | const String IPSEC_INTERFACE_PREFIX = "ipsec"; |
| 434 | |
| 435 | /** |
| 436 | * Add a IPsec Tunnel Interface. |
| 437 | * |
| 438 | * @param devName a unique identifier that represents the name of the device |
| 439 | * @param localAddress InetAddress as string for the local endpoint |
| 440 | * @param remoteAddress InetAddress as string for the remote endpoint |
| 441 | * @param iKey, to match Policies and SAs for input packets. |
| 442 | * @param oKey, to match Policies and SAs for output packets. |
| 443 | * @param interfaceId the identifier for the IPsec tunnel interface. |
| 444 | */ |
| 445 | void ipSecAddTunnelInterface( |
| 446 | in @utf8InCpp String deviceName, |
| 447 | in @utf8InCpp String localAddress, |
| 448 | in @utf8InCpp String remoteAddress, |
| 449 | int iKey, |
| 450 | int oKey, |
| 451 | int interfaceId); |
| 452 | |
| 453 | /** |
| 454 | * Update a IPsec Tunnel Interface. |
| 455 | * |
| 456 | * @param devName a unique identifier that represents the name of the device |
| 457 | * @param localAddress InetAddress as string for the local endpoint |
| 458 | * @param remoteAddress InetAddress as string for the remote endpoint |
| 459 | * @param iKey, to match Policies and SAs for input packets. |
| 460 | * @param oKey, to match Policies and SAs for output packets. |
| 461 | * @param interfaceId the identifier for the IPsec tunnel interface. |
| 462 | */ |
| 463 | void ipSecUpdateTunnelInterface( |
| 464 | in @utf8InCpp String deviceName, |
| 465 | in @utf8InCpp String localAddress, |
| 466 | in @utf8InCpp String remoteAddress, |
| 467 | int iKey, |
| 468 | int oKey, |
| 469 | int interfaceId); |
| 470 | |
| 471 | /** |
| 472 | * Removes a IPsec Tunnel Interface. |
| 473 | * |
| 474 | * @param devName a unique identifier that represents the name of the device |
| 475 | */ |
| 476 | void ipSecRemoveTunnelInterface(in @utf8InCpp String deviceName); |
| 477 | |
| 478 | /** |
| 479 | * Request notification of wakeup packets arriving on an interface. Notifications will be |
| 480 | * delivered to INetdEventListener.onWakeupEvent(). |
| 481 | * |
| 482 | * @param ifName the interface |
| 483 | * @param prefix arbitrary string used to identify wakeup sources in onWakeupEvent |
| 484 | */ |
| 485 | void wakeupAddInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); |
| 486 | |
| 487 | /** |
| 488 | * Stop notification of wakeup packets arriving on an interface. |
| 489 | * |
| 490 | * @param ifName the interface |
| 491 | * @param prefix arbitrary string used to identify wakeup sources in onWakeupEvent |
| 492 | */ |
| 493 | void wakeupDelInterface(in @utf8InCpp String ifName, in @utf8InCpp String prefix, int mark, int mask); |
| 494 | |
| 495 | const int IPV6_ADDR_GEN_MODE_EUI64 = 0; |
| 496 | const int IPV6_ADDR_GEN_MODE_NONE = 1; |
| 497 | const int IPV6_ADDR_GEN_MODE_STABLE_PRIVACY = 2; |
| 498 | const int IPV6_ADDR_GEN_MODE_RANDOM = 3; |
| 499 | |
| 500 | const int IPV6_ADDR_GEN_MODE_DEFAULT = 0; |
| 501 | /** |
| 502 | * Set IPv6 address generation mode. IPv6 should be disabled before changing mode. |
| 503 | * |
| 504 | * @param mode SLAAC address generation mechanism to use |
| 505 | */ |
| 506 | void setIPv6AddrGenMode(in @utf8InCpp String ifName, int mode); |
| 507 | |
| 508 | /** |
| 509 | * Add idletimer for specific interface |
| 510 | * |
| 511 | * @param ifName Name of target interface |
| 512 | * @param timeout The time in seconds that will trigger idletimer |
| 513 | * @param classLabel The unique identifier for this idletimer |
| 514 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 515 | * cause of the failure. |
| 516 | */ |
| 517 | void idletimerAddInterface( |
| 518 | in @utf8InCpp String ifName, |
| 519 | int timeout, |
| 520 | in @utf8InCpp String classLabel); |
| 521 | |
| 522 | /** |
| 523 | * Remove idletimer for specific interface |
| 524 | * |
| 525 | * @param ifName Name of target interface |
| 526 | * @param timeout The time in seconds that will trigger idletimer |
| 527 | * @param classLabel The unique identifier for this idletimer |
| 528 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 529 | * cause of the failure. |
| 530 | */ |
| 531 | void idletimerRemoveInterface( |
| 532 | in @utf8InCpp String ifName, |
| 533 | int timeout, |
| 534 | in @utf8InCpp String classLabel); |
| 535 | |
| 536 | const int PENALTY_POLICY_ACCEPT = 1; |
| 537 | const int PENALTY_POLICY_LOG = 2; |
| 538 | const int PENALTY_POLICY_REJECT = 3; |
| 539 | |
| 540 | /** |
| 541 | * Offers to detect sockets sending data not wrapped inside a layer of SSL/TLS encryption. |
| 542 | * |
| 543 | * @param uid Uid of the app |
| 544 | * @param policyPenalty The penalty policy of the app |
| 545 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 546 | * cause of the failure. |
| 547 | */ |
| 548 | void strictUidCleartextPenalty(int uid, int policyPenalty); |
| 549 | |
| 550 | /** |
| 551 | * Start clatd |
| 552 | * |
Hungming Chen | ed12926 | 2022-04-26 19:10:45 +0800 | [diff] [blame] | 553 | * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd |
| 554 | * control plane moved to the mainline module starting in T. See ClatCoordinator. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 555 | * @param ifName interface name to start clatd |
| 556 | * @param nat64Prefix the NAT64 prefix, e.g., "2001:db8:64::/96". |
| 557 | * @return a string, the IPv6 address that will be used for 464xlat. |
| 558 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 559 | * cause of the failure. |
| 560 | */ |
| 561 | @utf8InCpp String clatdStart(in @utf8InCpp String ifName, in @utf8InCpp String nat64Prefix); |
| 562 | |
| 563 | /** |
| 564 | * Stop clatd |
| 565 | * |
Hungming Chen | ed12926 | 2022-04-26 19:10:45 +0800 | [diff] [blame] | 566 | * @deprecated This method has no effect and throws UnsupportedOperationException. The clatd |
| 567 | * control plane moved to the mainline module starting in T. See ClatCoordinator. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 568 | * @param ifName interface name to stop clatd |
| 569 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 570 | * cause of the failure. |
| 571 | */ |
| 572 | void clatdStop(in @utf8InCpp String ifName); |
| 573 | |
Lorenzo Colitti | 747ba67 | 2022-06-15 23:39:12 +0900 | [diff] [blame] | 574 | /** |
| 575 | * Packet mark that identifies non-offloaded ingress clat packets. |
| 576 | */ |
| 577 | const int CLAT_MARK = 0xdeadc1a7; |
| 578 | |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 579 | /** |
| 580 | * Get status of IP forwarding |
| 581 | * |
| 582 | * @return true if IP forwarding is enabled, false otherwise. |
| 583 | */ |
| 584 | boolean ipfwdEnabled(); |
| 585 | |
| 586 | /** |
| 587 | * Get requester list of IP forwarding |
| 588 | * |
| 589 | * @return An array of strings containing requester list of IP forwarding |
| 590 | */ |
| 591 | @utf8InCpp String[] ipfwdGetRequesterList(); |
| 592 | |
| 593 | /** |
| 594 | * Enable IP forwarding for specific requester |
| 595 | * |
| 596 | * @param requester requester name to enable IP forwarding. It is a unique name which will be |
| 597 | * stored in Netd to make sure if any requester needs IP forwarding. |
| 598 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 599 | * cause of the failure. |
| 600 | */ |
| 601 | void ipfwdEnableForwarding(in @utf8InCpp String requester); |
| 602 | |
| 603 | /** |
| 604 | * Disable IP forwarding for specific requester |
| 605 | * |
| 606 | * @param requester requester name to disable IP forwarding. This name should match the |
| 607 | * names which are set by ipfwdEnableForwarding. |
| 608 | * IP forwarding would be disabled if it is the last requester. |
| 609 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 610 | * cause of the failure. |
| 611 | */ |
| 612 | void ipfwdDisableForwarding(in @utf8InCpp String requester); |
| 613 | |
| 614 | /** |
| 615 | * Add forwarding ip rule |
| 616 | * |
| 617 | * @param fromIface interface name to add forwarding ip rule |
| 618 | * @param toIface interface name to add forwarding ip rule |
| 619 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 620 | * cause of the failure. |
| 621 | */ |
| 622 | void ipfwdAddInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); |
| 623 | |
| 624 | /** |
| 625 | * Remove forwarding ip rule |
| 626 | * |
| 627 | * @param fromIface interface name to remove forwarding ip rule |
| 628 | * @param toIface interface name to remove forwarding ip rule |
| 629 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 630 | * cause of the failure. |
| 631 | */ |
| 632 | void ipfwdRemoveInterfaceForward(in @utf8InCpp String fromIface, in @utf8InCpp String toIface); |
| 633 | |
| 634 | /** |
| 635 | * Set quota for interface |
| 636 | * |
| 637 | * @param ifName Name of target interface |
| 638 | * @param bytes Quota value in bytes |
| 639 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 640 | * cause of the failure. |
| 641 | */ |
| 642 | void bandwidthSetInterfaceQuota(in @utf8InCpp String ifName, long bytes); |
| 643 | |
| 644 | /** |
| 645 | * Remove quota for interface |
| 646 | * |
| 647 | * @param ifName Name of target interface |
| 648 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 649 | * cause of the failure. |
| 650 | */ |
| 651 | void bandwidthRemoveInterfaceQuota(in @utf8InCpp String ifName); |
| 652 | |
| 653 | /** |
| 654 | * Set alert for interface |
| 655 | * |
| 656 | * @param ifName Name of target interface |
| 657 | * @param bytes Alert value in bytes |
| 658 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 659 | * cause of the failure. |
| 660 | */ |
| 661 | void bandwidthSetInterfaceAlert(in @utf8InCpp String ifName, long bytes); |
| 662 | |
| 663 | /** |
| 664 | * Remove alert for interface |
| 665 | * |
| 666 | * @param ifName Name of target interface |
| 667 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 668 | * cause of the failure. |
| 669 | */ |
| 670 | void bandwidthRemoveInterfaceAlert(in @utf8InCpp String ifName); |
| 671 | |
| 672 | /** |
| 673 | * Set global alert |
| 674 | * |
| 675 | * @param bytes Alert value in bytes |
| 676 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 677 | * cause of the failure. |
| 678 | */ |
| 679 | void bandwidthSetGlobalAlert(long bytes); |
| 680 | |
| 681 | /** |
| 682 | * Add naughty app bandwidth rule for specific app |
| 683 | * |
| 684 | * @param uid uid of target app |
| 685 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 686 | * cause of the failure. |
Ken Chen | 91dc3a1 | 2023-11-13 12:18:53 +0800 | [diff] [blame^] | 687 | * @deprecated unimplemented on T+. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 688 | */ |
| 689 | void bandwidthAddNaughtyApp(int uid); |
| 690 | |
| 691 | /** |
| 692 | * Remove naughty app bandwidth rule for specific app |
| 693 | * |
| 694 | * @param uid uid of target app |
| 695 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 696 | * cause of the failure. |
Ken Chen | 91dc3a1 | 2023-11-13 12:18:53 +0800 | [diff] [blame^] | 697 | * @deprecated unimplemented on T+. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 698 | */ |
| 699 | void bandwidthRemoveNaughtyApp(int uid); |
| 700 | |
| 701 | /** |
| 702 | * Add nice app bandwidth rule for specific app |
| 703 | * |
| 704 | * @param uid uid of target app |
| 705 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 706 | * cause of the failure. |
Ken Chen | 91dc3a1 | 2023-11-13 12:18:53 +0800 | [diff] [blame^] | 707 | * @deprecated unimplemented on T+. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 708 | */ |
| 709 | void bandwidthAddNiceApp(int uid); |
| 710 | |
| 711 | /** |
| 712 | * Remove nice app bandwidth rule for specific app |
| 713 | * |
| 714 | * @param uid uid of target app |
| 715 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 716 | * cause of the failure. |
Ken Chen | 91dc3a1 | 2023-11-13 12:18:53 +0800 | [diff] [blame^] | 717 | * @deprecated unimplemented on T+. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 718 | */ |
| 719 | void bandwidthRemoveNiceApp(int uid); |
| 720 | |
| 721 | /** |
| 722 | * Start tethering |
| 723 | * |
| 724 | * @param dhcpRanges dhcp ranges to set. |
| 725 | * dhcpRanges might contain many addresss {addr1, addr2, aadr3, addr4...} |
| 726 | * Netd splits them into ranges: addr1-addr2, addr3-addr4, etc. |
| 727 | * An odd number of addrs will fail. |
| 728 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 729 | * cause of the failure. |
| 730 | */ |
| 731 | void tetherStart(in @utf8InCpp String[] dhcpRanges); |
| 732 | |
| 733 | /** |
| 734 | * Stop tethering |
| 735 | * |
| 736 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 737 | * cause of the failure. |
| 738 | */ |
| 739 | void tetherStop(); |
| 740 | |
| 741 | /** |
| 742 | * Get status of tethering |
| 743 | * |
| 744 | * @return true if tethering is enabled, false otherwise. |
| 745 | */ |
| 746 | boolean tetherIsEnabled(); |
| 747 | |
| 748 | /** |
| 749 | * Setup interface for tethering |
| 750 | * |
| 751 | * @param ifName interface name to add |
| 752 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 753 | * cause of the failure. |
| 754 | */ |
| 755 | void tetherInterfaceAdd(in @utf8InCpp String ifName); |
| 756 | |
| 757 | /** |
| 758 | * Reset interface for tethering |
| 759 | * |
| 760 | * @param ifName interface name to remove |
| 761 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 762 | * cause of the failure. |
| 763 | */ |
| 764 | void tetherInterfaceRemove(in @utf8InCpp String ifName); |
| 765 | |
| 766 | /** |
| 767 | * Get the interface list which is stored in netd |
| 768 | * The list contains the interfaces managed by tetherInterfaceAdd/tetherInterfaceRemove |
| 769 | * |
| 770 | * @return An array of strings containing interface list result |
| 771 | */ |
| 772 | @utf8InCpp String[] tetherInterfaceList(); |
| 773 | |
| 774 | /** |
| 775 | * Set DNS forwarder server |
| 776 | * |
| 777 | * @param netId the upstream network to forward DNS queries to |
| 778 | * @param dnsAddrs DNS server address to set |
| 779 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 780 | * cause of the failure. |
| 781 | */ |
| 782 | void tetherDnsSet(int netId, in @utf8InCpp String[] dnsAddrs); |
| 783 | |
| 784 | /** |
| 785 | * Return the DNS list set by tetherDnsSet |
| 786 | * |
| 787 | * @return An array of strings containing the list of DNS servers |
| 788 | */ |
| 789 | @utf8InCpp String[] tetherDnsList(); |
| 790 | |
| 791 | const int LOCAL_NET_ID = 99; |
| 792 | |
| 793 | /** |
| 794 | * Constant net ID for the "dummy" network. |
| 795 | * |
| 796 | * The dummy network is used to blackhole or reject traffic. Any attempt to use it will |
| 797 | * either drop the packets or fail with ENETUNREACH. |
| 798 | */ |
| 799 | const int DUMMY_NET_ID = 51; |
| 800 | |
| 801 | /** |
| 802 | * Constant net ID for the "unreachable" network. |
| 803 | * |
| 804 | * The unreachable network is used to reject traffic. Any attempt to use it will fail |
| 805 | * with ENETUNREACH. |
| 806 | */ |
| 807 | const int UNREACHABLE_NET_ID = 52; |
| 808 | |
| 809 | // Route does not specify a next hop |
| 810 | const String NEXTHOP_NONE = ""; |
| 811 | // Route next hop is unreachable |
| 812 | const String NEXTHOP_UNREACHABLE = "unreachable"; |
| 813 | // Route next hop is throw |
| 814 | const String NEXTHOP_THROW = "throw"; |
| 815 | |
| 816 | /** |
| 817 | * Add a route for specific network |
| 818 | * |
| 819 | * @param netId the network to add the route to |
| 820 | * @param ifName the name of interface of the route. |
| 821 | * This interface should be assigned to the netID. |
| 822 | * @param destination the destination of the route |
| 823 | * @param nextHop The route's next hop address, |
| 824 | * or it could be either NEXTHOP_NONE, NEXTHOP_UNREACHABLE, NEXTHOP_THROW. |
| 825 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 826 | * cause of the failure. |
| 827 | */ |
| 828 | void networkAddRoute( |
| 829 | int netId, |
| 830 | in @utf8InCpp String ifName, |
| 831 | in @utf8InCpp String destination, |
| 832 | in @utf8InCpp String nextHop); |
| 833 | |
| 834 | /** |
| 835 | * Remove a route for specific network |
| 836 | * |
| 837 | * @param netId the network to remove the route from |
| 838 | * @param ifName the name of interface of the route. |
| 839 | * This interface should be assigned to the netID. |
| 840 | * @param destination the destination of the route |
| 841 | * @param nextHop The route's next hop address, |
| 842 | * or it could be either NEXTHOP_NONE, NEXTHOP_UNREACHABLE, NEXTHOP_THROW. |
| 843 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 844 | * cause of the failure. |
| 845 | */ |
| 846 | void networkRemoveRoute( |
| 847 | int netId, |
| 848 | in @utf8InCpp String ifName, |
| 849 | in @utf8InCpp String destination, |
| 850 | in @utf8InCpp String nextHop); |
| 851 | |
| 852 | /** |
| 853 | * Add a route to legacy routing table for specific network |
| 854 | * |
| 855 | * @param netId the network to add the route to |
| 856 | * @param ifName the name of interface of the route. |
| 857 | * This interface should be assigned to the netID. |
| 858 | * @param destination the destination of the route |
| 859 | * @param nextHop The route's next hop address, |
| 860 | * or it could be either NEXTHOP_NONE, NEXTHOP_UNREACHABLE, NEXTHOP_THROW. |
| 861 | * @param uid uid of the user |
| 862 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 863 | * cause of the failure. |
| 864 | */ |
| 865 | void networkAddLegacyRoute( |
| 866 | int netId, |
| 867 | in @utf8InCpp String ifName, |
| 868 | in @utf8InCpp String destination, |
| 869 | in @utf8InCpp String nextHop, |
| 870 | int uid); |
| 871 | |
| 872 | /** |
| 873 | * Remove a route from legacy routing table for specific network |
| 874 | * |
| 875 | * @param netId the network to remove the route from |
| 876 | * @param ifName the name of interface of the route. |
| 877 | * This interface should be assigned to the netID. |
| 878 | * @param destination the destination of the route |
| 879 | * @param nextHop The route's next hop address, |
| 880 | * or it could be either NEXTHOP_NONE, NEXTHOP_UNREACHABLE, NEXTHOP_THROW. |
| 881 | * @param uid uid of the user |
| 882 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 883 | * cause of the failure. |
| 884 | */ |
| 885 | void networkRemoveLegacyRoute( |
| 886 | int netId, |
| 887 | in @utf8InCpp String ifName, |
| 888 | in @utf8InCpp String destination, |
| 889 | in @utf8InCpp String nextHop, |
| 890 | int uid); |
| 891 | |
| 892 | /** |
| 893 | * Get default network |
| 894 | * |
| 895 | * @return netId of default network |
| 896 | */ |
| 897 | int networkGetDefault(); |
| 898 | |
| 899 | /** |
| 900 | * Set network as default network |
| 901 | * |
| 902 | * @param netId the network to set as the default |
| 903 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 904 | * cause of the failure. |
| 905 | */ |
| 906 | void networkSetDefault(int netId); |
| 907 | |
| 908 | /** |
| 909 | * Clear default network |
| 910 | * |
| 911 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 912 | * cause of the failure. |
| 913 | */ |
| 914 | void networkClearDefault(); |
| 915 | |
| 916 | /** |
| 917 | * PERMISSION_NONE is used for regular networks and apps. TODO: use PERMISSION_INTERNET |
| 918 | * for this instead, and use PERMISSION_NONE to indicate no network permissions at all. |
| 919 | */ |
| 920 | const int PERMISSION_NONE = 0; |
| 921 | |
| 922 | /** |
| 923 | * PERMISSION_NETWORK represents the CHANGE_NETWORK_STATE permission. |
| 924 | */ |
| 925 | const int PERMISSION_NETWORK = 1; |
| 926 | |
| 927 | /** |
| 928 | * PERMISSION_SYSTEM represents the ability to use restricted networks. This is mostly |
| 929 | * equivalent to the CONNECTIVITY_USE_RESTRICTED_NETWORKS permission. |
| 930 | */ |
| 931 | const int PERMISSION_SYSTEM = 2; |
| 932 | |
| 933 | /** |
| 934 | * NO_PERMISSIONS indicates that this app is installed and doesn't have either |
| 935 | * PERMISSION_INTERNET or PERMISSION_UPDATE_DEVICE_STATS. |
| 936 | * TODO: use PERMISSION_NONE to represent this case |
| 937 | */ |
| 938 | const int NO_PERMISSIONS = 0; |
| 939 | |
| 940 | /** |
| 941 | * PERMISSION_INTERNET indicates that the app can create AF_INET and AF_INET6 sockets |
| 942 | */ |
| 943 | const int PERMISSION_INTERNET = 4; |
| 944 | |
| 945 | /** |
| 946 | * PERMISSION_UPDATE_DEVICE_STATS is used for system UIDs and privileged apps |
| 947 | * that have the UPDATE_DEVICE_STATS permission |
| 948 | */ |
| 949 | const int PERMISSION_UPDATE_DEVICE_STATS = 8; |
| 950 | |
| 951 | /** |
| 952 | * PERMISSION_UNINSTALLED is used when an app is uninstalled from the device. All internet |
| 953 | * related permissions need to be cleaned |
| 954 | */ |
| 955 | const int PERMISSION_UNINSTALLED = -1; |
| 956 | |
| 957 | |
| 958 | /** |
| 959 | * Sets the permission required to access a specific network. |
| 960 | * |
| 961 | * @param netId the network to set |
| 962 | * @param permission network permission to use |
| 963 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 964 | * cause of the failure. |
| 965 | */ |
| 966 | void networkSetPermissionForNetwork(int netId, int permission); |
| 967 | |
| 968 | /** |
| 969 | * Assigns network access permissions to the specified users. |
| 970 | * |
| 971 | * @param permission network permission to use |
| 972 | * @param uids uid of users to set permission |
| 973 | */ |
| 974 | void networkSetPermissionForUser(int permission, in int[] uids); |
| 975 | |
| 976 | /** |
| 977 | * Clears network access permissions for the specified users. |
| 978 | * |
| 979 | * @param uids uid of users to clear permission |
| 980 | */ |
| 981 | void networkClearPermissionForUser(in int[] uids); |
| 982 | |
| 983 | /** |
| 984 | * Assigns android.permission.INTERNET and/or android.permission.UPDATE_DEVICE_STATS to the uids |
| 985 | * specified. Or remove all permissions from the uids. |
| 986 | * |
| 987 | * @param permission The permission to grant, it could be either PERMISSION_INTERNET and/or |
| 988 | * PERMISSION_UPDATE_DEVICE_STATS. If the permission is NO_PERMISSIONS, then |
| 989 | * revoke all permissions for the uids. |
| 990 | * @param uids uid of users to grant permission |
Ken Chen | 91dc3a1 | 2023-11-13 12:18:53 +0800 | [diff] [blame^] | 991 | * @deprecated unimplemented on T+. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 992 | */ |
| 993 | void trafficSetNetPermForUids(int permission, in int[] uids); |
| 994 | |
| 995 | /** |
| 996 | * Gives the specified user permission to protect sockets from VPNs. |
| 997 | * Typically used by VPN apps themselves, to ensure that the sockets |
| 998 | * they use to communicate with the VPN server aren't routed through |
| 999 | * the VPN network. |
| 1000 | * |
| 1001 | * @param uid uid of user to set |
| 1002 | */ |
| 1003 | void networkSetProtectAllow(int uid); |
| 1004 | |
| 1005 | /** |
| 1006 | * Removes the permission to protect sockets from VPN. |
| 1007 | * |
| 1008 | * @param uid uid of user to set |
| 1009 | */ |
| 1010 | void networkSetProtectDeny(int uid); |
| 1011 | |
| 1012 | /** |
| 1013 | * Get the status of network protect for user |
| 1014 | * |
| 1015 | * @param uids uid of user |
| 1016 | * @return true if the user can protect sockets from VPN, false otherwise. |
| 1017 | */ |
| 1018 | boolean networkCanProtect(int uid); |
| 1019 | |
| 1020 | /** Only allows packets from specific UID/Interface. |
| 1021 | @deprecated use FIREWALL_ALLOWLIST. */ |
| 1022 | const int FIREWALL_WHITELIST = 0; |
| 1023 | |
| 1024 | /** Only allows packets from specific UID/Interface. */ |
| 1025 | const int FIREWALL_ALLOWLIST = 0; |
| 1026 | |
| 1027 | /** Blocks packets from specific UID/Interface. |
| 1028 | @deprecated use FIREWALL_DENYLIST. */ |
| 1029 | const int FIREWALL_BLACKLIST = 1; |
| 1030 | |
| 1031 | /** Blocks packets from specific UID/Interface. */ |
| 1032 | const int FIREWALL_DENYLIST = 1; |
| 1033 | |
| 1034 | /** |
| 1035 | * Set type of firewall |
| 1036 | * Type allowlist only allows packets from specific UID/Interface |
| 1037 | * Type denylist blocks packets from specific UID/Interface |
| 1038 | * |
| 1039 | * @param firewalltype type of firewall, either FIREWALL_ALLOWLIST or FIREWALL_DENYLIST |
| 1040 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1041 | * cause of the failure. |
| 1042 | */ |
| 1043 | void firewallSetFirewallType(int firewalltype); |
| 1044 | |
| 1045 | // Specify allow Rule which allows packets |
| 1046 | const int FIREWALL_RULE_ALLOW = 1; |
| 1047 | // Specify deny Rule which drops packets |
| 1048 | const int FIREWALL_RULE_DENY = 2; |
| 1049 | |
| 1050 | // No specific chain is chosen, use general firewall chain(fw_input, fw_output) |
| 1051 | const int FIREWALL_CHAIN_NONE = 0; |
| 1052 | // Specify DOZABLE chain(fw_dozable) which is used in dozable mode |
| 1053 | const int FIREWALL_CHAIN_DOZABLE = 1; |
| 1054 | // Specify STANDBY chain(fw_standby) which is used in standby mode |
| 1055 | const int FIREWALL_CHAIN_STANDBY = 2; |
| 1056 | // Specify POWERSAVE chain(fw_powersave) which is used in power save mode |
| 1057 | const int FIREWALL_CHAIN_POWERSAVE = 3; |
| 1058 | // Specify RESTRICTED chain(fw_restricted) which is used in restricted |
| 1059 | // networking mode |
| 1060 | const int FIREWALL_CHAIN_RESTRICTED = 4; |
| 1061 | |
| 1062 | /** |
| 1063 | * Set firewall rule for interface |
| 1064 | * |
| 1065 | * @param ifName the interface to allow/deny |
| 1066 | * @param firewallRule either FIREWALL_RULE_ALLOW or FIREWALL_RULE_DENY |
| 1067 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1068 | * cause of the failure. |
| 1069 | */ |
| 1070 | void firewallSetInterfaceRule(in @utf8InCpp String ifName, int firewallRule); |
| 1071 | |
| 1072 | /** |
| 1073 | * Set firewall rule for uid |
| 1074 | * |
| 1075 | * @param childChain target chain |
| 1076 | * @param uid uid to allow/deny |
| 1077 | * @param firewallRule either FIREWALL_RULE_ALLOW or FIREWALL_RULE_DENY |
| 1078 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1079 | * cause of the failure. |
Ken Chen | 91dc3a1 | 2023-11-13 12:18:53 +0800 | [diff] [blame^] | 1080 | * @deprecated unimplemented on T+. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 1081 | */ |
| 1082 | void firewallSetUidRule(int childChain, int uid, int firewallRule); |
| 1083 | |
| 1084 | /** |
| 1085 | * Enable/Disable target firewall child chain |
| 1086 | * |
| 1087 | * @param childChain target chain to enable |
| 1088 | * @param enable whether to enable or disable child chain. |
| 1089 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1090 | * cause of the failure. |
Ken Chen | 91dc3a1 | 2023-11-13 12:18:53 +0800 | [diff] [blame^] | 1091 | * @deprecated unimplemented on T+. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 1092 | */ |
| 1093 | void firewallEnableChildChain(int childChain, boolean enable); |
| 1094 | |
| 1095 | /** |
| 1096 | * Get interface list |
| 1097 | * |
| 1098 | * @return An array of strings containing all the interfaces on the system. |
| 1099 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 1100 | * unix errno. |
| 1101 | */ |
| 1102 | @utf8InCpp String[] interfaceGetList(); |
| 1103 | |
| 1104 | // Must be kept in sync with constant in InterfaceConfiguration.java |
| 1105 | const String IF_STATE_UP = "up"; |
| 1106 | const String IF_STATE_DOWN = "down"; |
| 1107 | |
| 1108 | const String IF_FLAG_BROADCAST = "broadcast"; |
| 1109 | const String IF_FLAG_LOOPBACK = "loopback"; |
| 1110 | const String IF_FLAG_POINTOPOINT = "point-to-point"; |
| 1111 | const String IF_FLAG_RUNNING = "running"; |
| 1112 | const String IF_FLAG_MULTICAST = "multicast"; |
| 1113 | |
| 1114 | /** |
| 1115 | * Get interface configuration |
| 1116 | * |
| 1117 | * @param ifName interface name |
| 1118 | * @return An InterfaceConfigurationParcel for the specified interface. |
| 1119 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 1120 | * unix errno. |
| 1121 | */ |
| 1122 | InterfaceConfigurationParcel interfaceGetCfg(in @utf8InCpp String ifName); |
| 1123 | |
| 1124 | /** |
| 1125 | * Set interface configuration |
| 1126 | * |
| 1127 | * @param cfg Interface configuration to set |
| 1128 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 1129 | * unix errno. |
| 1130 | */ |
| 1131 | void interfaceSetCfg(in InterfaceConfigurationParcel cfg); |
| 1132 | |
| 1133 | /** |
| 1134 | * Set interface IPv6 privacy extensions |
| 1135 | * |
| 1136 | * @param ifName interface name |
| 1137 | * @param enable whether to enable or disable this setting. |
| 1138 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1139 | * cause of the failure. |
| 1140 | */ |
| 1141 | void interfaceSetIPv6PrivacyExtensions(in @utf8InCpp String ifName, boolean enable); |
| 1142 | |
| 1143 | /** |
| 1144 | * Clear all IP addresses on the given interface |
| 1145 | * |
| 1146 | * @param ifName interface name |
| 1147 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 1148 | * POSIX errno. |
| 1149 | */ |
| 1150 | void interfaceClearAddrs(in @utf8InCpp String ifName); |
| 1151 | |
| 1152 | /** |
| 1153 | * Enable or disable IPv6 on the given interface |
| 1154 | * |
| 1155 | * @param ifName interface name |
| 1156 | * @param enable whether to enable or disable this setting. |
| 1157 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1158 | * cause of the failure. |
| 1159 | */ |
| 1160 | void interfaceSetEnableIPv6(in @utf8InCpp String ifName, boolean enable); |
| 1161 | |
| 1162 | /** |
| 1163 | * Set interface MTU |
| 1164 | * |
| 1165 | * @param ifName interface name |
| 1166 | * @param mtu MTU value |
| 1167 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1168 | * cause of the failure. |
| 1169 | */ |
| 1170 | void interfaceSetMtu(in @utf8InCpp String ifName, int mtu); |
| 1171 | |
| 1172 | /** |
| 1173 | * Add forwarding rule/stats on given interface. |
| 1174 | * |
| 1175 | * @param intIface downstream interface |
| 1176 | * @param extIface upstream interface |
| 1177 | */ |
| 1178 | void tetherAddForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); |
| 1179 | |
| 1180 | /** |
| 1181 | * Remove forwarding rule/stats on given interface. |
| 1182 | * |
| 1183 | * @param intIface downstream interface |
| 1184 | * @param extIface upstream interface |
| 1185 | */ |
| 1186 | void tetherRemoveForward(in @utf8InCpp String intIface, in @utf8InCpp String extIface); |
| 1187 | |
| 1188 | /** |
| 1189 | * Set the values of tcp_{rmem,wmem}. |
| 1190 | * |
| 1191 | * @param rmemValues the target values of tcp_rmem, each value is separated by spaces |
| 1192 | * @param wmemValues the target values of tcp_wmem, each value is separated by spaces |
| 1193 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1194 | * cause of the failure. |
| 1195 | */ |
| 1196 | void setTcpRWmemorySize(in @utf8InCpp String rmemValues, in @utf8InCpp String wmemValues); |
| 1197 | |
| 1198 | /** |
| 1199 | * Register unsolicited event listener |
| 1200 | * Netd supports multiple unsolicited event listeners. |
| 1201 | * |
| 1202 | * @param listener unsolicited event listener to register |
| 1203 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1204 | * cause of the failure. |
| 1205 | */ |
| 1206 | void registerUnsolicitedEventListener(INetdUnsolicitedEventListener listener); |
| 1207 | |
| 1208 | /** |
| 1209 | * Add ingress interface filtering rules to a list of UIDs |
| 1210 | * |
| 1211 | * For a given uid, once a filtering rule is added, the kernel will only allow packets from the |
| 1212 | * allowed interface and loopback to be sent to the list of UIDs. |
| 1213 | * |
| 1214 | * Calling this method on one or more UIDs with an existing filtering rule but a different |
| 1215 | * interface name will result in the filtering rule being updated to allow the new interface |
| 1216 | * instead. Otherwise calling this method will not affect existing rules set on other UIDs. |
| 1217 | * |
| 1218 | * @param ifName the name of the interface on which the filtering rules will allow packets to |
| 1219 | be received. |
| 1220 | * @param uids an array of UIDs which the filtering rules will be set |
| 1221 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1222 | * cause of the failure. |
Ken Chen | 91dc3a1 | 2023-11-13 12:18:53 +0800 | [diff] [blame^] | 1223 | * @deprecated unimplemented on T+. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 1224 | */ |
| 1225 | void firewallAddUidInterfaceRules(in @utf8InCpp String ifName, in int[] uids); |
| 1226 | |
| 1227 | /** |
| 1228 | * Remove ingress interface filtering rules from a list of UIDs |
| 1229 | * |
| 1230 | * Clear the ingress interface filtering rules from the list of UIDs which were previously set |
| 1231 | * by firewallAddUidInterfaceRules(). Ignore any uid which does not have filtering rule. |
| 1232 | * |
| 1233 | * @param uids an array of UIDs from which the filtering rules will be removed |
| 1234 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1235 | * cause of the failure. |
Ken Chen | 91dc3a1 | 2023-11-13 12:18:53 +0800 | [diff] [blame^] | 1236 | * @deprecated unimplemented on T+. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 1237 | */ |
| 1238 | void firewallRemoveUidInterfaceRules(in int[] uids); |
| 1239 | |
| 1240 | /** |
| 1241 | * Request netd to change the current active network stats map. |
| 1242 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1243 | * cause of the failure. |
Ken Chen | 91dc3a1 | 2023-11-13 12:18:53 +0800 | [diff] [blame^] | 1244 | * @deprecated unimplemented on T+. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 1245 | */ |
| 1246 | void trafficSwapActiveStatsMap(); |
| 1247 | |
| 1248 | /** |
| 1249 | * Retrieves OEM netd listener interface |
| 1250 | * |
| 1251 | * @return a IBinder object, it could be casted to oem specific interface. |
| 1252 | */ |
| 1253 | IBinder getOemNetd(); |
| 1254 | |
| 1255 | /** |
| 1256 | * Start tethering with given configuration |
| 1257 | * |
| 1258 | * @param config config to start tethering. |
| 1259 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1260 | * cause of the failure. |
| 1261 | */ |
| 1262 | void tetherStartWithConfiguration(in TetherConfigParcel config); |
| 1263 | |
| 1264 | |
| 1265 | /** |
| 1266 | * Get the fwmark and its net id mask for the given network id. |
| 1267 | * |
| 1268 | * @param netId the network to get the fwmark and mask for. |
| 1269 | * @return A MarkMaskParcel of the given network id. |
| 1270 | */ |
| 1271 | MarkMaskParcel getFwmarkForNetwork(int netId); |
| 1272 | |
| 1273 | /** |
| 1274 | * Add a route for specific network |
| 1275 | * |
| 1276 | * @param netId the network to add the route to |
| 1277 | * @param routeInfo parcelable with route information |
| 1278 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1279 | * cause of the failure. |
| 1280 | */ |
| 1281 | void networkAddRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); |
| 1282 | |
| 1283 | /** |
| 1284 | * Update a route for specific network |
| 1285 | * |
| 1286 | * @param routeInfo parcelable with route information |
| 1287 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1288 | * cause of the failure. |
| 1289 | */ |
| 1290 | void networkUpdateRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); |
| 1291 | |
| 1292 | /** |
| 1293 | * Remove a route for specific network |
| 1294 | * |
| 1295 | * @param routeInfo parcelable with route information |
| 1296 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1297 | * cause of the failure. |
| 1298 | */ |
| 1299 | void networkRemoveRouteParcel(int netId, in android.net.RouteInfoParcel routeInfo); |
| 1300 | |
| 1301 | /** |
| 1302 | * Adds a tethering offload rule, or updates it if it already exists. |
| 1303 | * |
| 1304 | * Currently, only downstream /128 IPv6 entries are supported. An existing rule will be updated |
| 1305 | * if the input interface and destination prefix match. Otherwise, a new rule will be created. |
| 1306 | * |
Hungming Chen | ed12926 | 2022-04-26 19:10:45 +0800 | [diff] [blame] | 1307 | * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline |
| 1308 | * module accesses the BPF map directly starting in S. See BpfCoordinator. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 1309 | * @param rule The rule to add or update. |
| 1310 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1311 | * cause of the failure. |
| 1312 | */ |
| 1313 | void tetherOffloadRuleAdd(in TetherOffloadRuleParcel rule); |
| 1314 | |
| 1315 | /** |
| 1316 | * Deletes a tethering offload rule. |
| 1317 | * |
| 1318 | * Currently, only downstream /128 IPv6 entries are supported. An existing rule will be deleted |
| 1319 | * if the destination IP address and the source interface match. It is not an error if there is |
| 1320 | * no matching rule to delete. |
| 1321 | * |
Hungming Chen | ed12926 | 2022-04-26 19:10:45 +0800 | [diff] [blame] | 1322 | * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline |
| 1323 | * module accesses the BPF map directly starting in S. See BpfCoordinator. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 1324 | * @param rule The rule to delete. |
| 1325 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1326 | * cause of the failure. |
| 1327 | */ |
| 1328 | void tetherOffloadRuleRemove(in TetherOffloadRuleParcel rule); |
| 1329 | |
| 1330 | /** |
| 1331 | * Return BPF tethering offload statistics. |
| 1332 | * |
Hungming Chen | ed12926 | 2022-04-26 19:10:45 +0800 | [diff] [blame] | 1333 | * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline |
| 1334 | * module accesses the BPF map directly starting in S. See BpfCoordinator. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 1335 | * @return an array of TetherStatsParcel's, where each entry contains the upstream interface |
| 1336 | * index and its tethering statistics since tethering was first started. |
| 1337 | * There will only ever be one entry for a given interface index. |
| 1338 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1339 | * cause of the failure. |
| 1340 | */ |
| 1341 | TetherStatsParcel[] tetherOffloadGetStats(); |
| 1342 | |
| 1343 | /** |
| 1344 | * Set a per-interface quota for tethering offload. |
| 1345 | * |
Hungming Chen | ed12926 | 2022-04-26 19:10:45 +0800 | [diff] [blame] | 1346 | * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline |
| 1347 | * module accesses the BPF map directly starting in S. See BpfCoordinator. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 1348 | * @param ifIndex Index of upstream interface |
| 1349 | * @param quotaBytes The quota defined as the number of bytes, starting from zero and counting |
Hungming Chen | ed12926 | 2022-04-26 19:10:45 +0800 | [diff] [blame] | 1350 | * from *now*. A value of QUOTA_UNLIMITED (-1) indicates there is no limit. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 1351 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1352 | * cause of the failure. |
| 1353 | */ |
| 1354 | void tetherOffloadSetInterfaceQuota(int ifIndex, long quotaBytes); |
| 1355 | |
| 1356 | /** |
| 1357 | * Return BPF tethering offload statistics and clear the stats for a given upstream. |
| 1358 | * |
| 1359 | * Must only be called once all offload rules have already been deleted for the given upstream |
| 1360 | * interface. The existing stats will be fetched and returned. The stats and the limit for the |
| 1361 | * given upstream interface will be deleted as well. |
| 1362 | * |
| 1363 | * The stats and limit for a given upstream interface must be initialized (using |
| 1364 | * tetherOffloadSetInterfaceQuota) before any offload will occur on that interface. |
| 1365 | * |
Hungming Chen | ed12926 | 2022-04-26 19:10:45 +0800 | [diff] [blame] | 1366 | * @deprecated This method has no effect and throws UnsupportedOperationException. The mainline |
| 1367 | * module accesses the BPF map directly starting in S. See BpfCoordinator. |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 1368 | * @param ifIndex Index of upstream interface. |
| 1369 | * @return TetherStatsParcel, which contains the given upstream interface index and its |
| 1370 | * tethering statistics since tethering was first started on that upstream interface. |
| 1371 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1372 | * cause of the failure. |
| 1373 | */ |
| 1374 | TetherStatsParcel tetherOffloadGetAndClearStats(int ifIndex); |
| 1375 | |
| 1376 | /** |
| 1377 | * Creates a network. |
| 1378 | * |
| 1379 | * @param config the configuration of network. |
| 1380 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 1381 | * unix errno. |
| 1382 | */ |
| 1383 | void networkCreate(in NativeNetworkConfig config); |
| 1384 | |
| 1385 | /** |
| 1386 | * Adds the specified UID ranges to the specified network. The network can be physical or |
| 1387 | * virtual. Traffic from the UID ranges will be routed to the network by default. The possible |
| 1388 | * value of subsidiary priority for physical and unreachable networks is 0-999. 0 is the highest |
| 1389 | * priority. 0 is also the default value. Virtual network supports only the default value. |
| 1390 | * |
| 1391 | * @param NativeUidRangeConfig a parcel contains netId, UID ranges, subsidiary priority, etc. |
| 1392 | * |
| 1393 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 1394 | * unix errno. |
| 1395 | */ |
| 1396 | void networkAddUidRangesParcel(in NativeUidRangeConfig uidRangesConfig); |
| 1397 | |
| 1398 | /** |
| 1399 | * Removes the specified UID ranges from the specified network. The network can be physical or |
| 1400 | * virtual. Traffic from the UID ranges will no longer be routed to the network by default. The |
| 1401 | * possible value of subsidiary priority for physical and unreachable networks is 0-999. 0 is |
| 1402 | * the highest priority. 0 is also the default value. Virtual network supports only the default |
| 1403 | * value. |
| 1404 | * |
| 1405 | * @param NativeUidRangeConfig a parcel contains netId, UID ranges, subsidiary priority, etc. |
| 1406 | * |
| 1407 | * @throws ServiceSpecificException in case of failure, with an error code corresponding to the |
| 1408 | * unix errno. |
| 1409 | */ |
| 1410 | void networkRemoveUidRangesParcel(in NativeUidRangeConfig uidRangesConfig); |
Yan Yan | 1111180 | 2022-12-16 02:17:07 +0000 | [diff] [blame] | 1411 | |
| 1412 | /** |
| 1413 | * Migrate an existing IPsec tunnel mode SA to different addresses. |
| 1414 | * |
| 1415 | * If the underlying network also changes, caller must update it by |
| 1416 | * calling ipSecAddSecurityAssociation. |
| 1417 | * |
| 1418 | * @param migrateInfo parcelable with migration info. |
| 1419 | * |
| 1420 | * @throws ServiceSpecificException in case of failure, with an error code indicating the |
| 1421 | * cause of the failure. |
| 1422 | */ |
| 1423 | void ipSecMigrate(in android.net.IpSecMigrateInfoParcel migrateInfo); |
| 1424 | |
| 1425 | /** |
| 1426 | * IPSEC_DIRECTION_IN is used for IPsec SAs or policies that direct traffic towards the host. |
| 1427 | */ |
| 1428 | const int IPSEC_DIRECTION_IN = 0; |
| 1429 | |
| 1430 | /** |
| 1431 | * IPSEC_DIRECTION_OUT is used for IPsec SAs or policies that direct traffic away from the host. |
| 1432 | */ |
| 1433 | const int IPSEC_DIRECTION_OUT = 1; |
Ken Chen | da7a00d | 2022-12-23 17:26:13 +0800 | [diff] [blame] | 1434 | |
| 1435 | /** |
| 1436 | * Set the list of allowed UIDs for all networks with restrictions. |
| 1437 | * |
| 1438 | * This list is the entire list of restrictions for all networks known by |
| 1439 | * netd. Calling this function always defines the entire list of restrictions, |
| 1440 | * and networks not in the passed list are always reset to having no |
| 1441 | * restrictions. |
| 1442 | * |
| 1443 | * @param NativeUidRangeConfig[] An array of allowlists, one per network. For each allowlist: |
| 1444 | * - netId: the netId on which to set the allowlist |
| 1445 | * - uidRanges: the UIDs allowed to use this network |
| 1446 | * - subPriority: unused |
| 1447 | */ |
| 1448 | void setNetworkAllowlist(in NativeUidRangeConfig[] allowedNetworks); |
markchien | 38c3248 | 2021-09-29 12:19:44 +0800 | [diff] [blame] | 1449 | } |