StructGroupReq is imported but not used.
The import can be removed.
Bug: 113148576
Test: build only
Change-Id: I6b2ec5eb3f6c6e298fcde8e47dfd0979f889ca1d
The hostname option is only sent when requested in the requested
parameters option. This matches current behavior.
Test: with aosp/763982, regression tests now all pass
atest FrameworksNetTest
Bug: b/109584964
Change-Id: I793173fa893750ddbe72be09f4c2d70e5b285837
Some DhcpServer error code paths could cause a NPE, when the logError
callback was called without an exception. Allowing SharedLog#e to be
called with a null Throwable is less error-prone.
Bug: b/109584964
Test: atest FrameworksNetTests
Change-Id: Idbcdd330a9d1951b27aaf525aaf12e52e102872c
Allow VPN apps to lookup the UID owner of a network connection.
Requires specifying the:
- IP address and port for both the source and destination of a TCP
connection.
- IP address and port for either source and destination or just
source for a UDP connection.
Only TCP and UDP protocols are supported. Only connections for UIDs
that apply to the calling VPN app will be resolved. This is intended
to replace direct app access to /proc/net/{tcp,tcp6,udp,udp6}.
The implementation uses netlink inet_diag sockets[1] to perform
the lookup on TCP sockets as well as UDP sockets when supported
(kernel has CONFIG_INET_UDP_DIAG=y).
[1] http://man7.org/linux/man-pages/man7/sock_diag.7.html
Bug: 9496886
Bug: 109758967
Test: atest HostsideVpnTests
Test: atest InetDiagSocketTest on Taimen with CONFIG_INET_UDP_DIAG
and on Sailfish without CONFIG_INET_UDP_DIAG.
Change-Id: I2bbc7072dd091e2e653dadf6dc05024c04180f34
Test: as follows
- built, flashed, booted
- runtest frameworks-net passes
- manually setting /proc/sys/net/ipv6/<upiface>/conf/hop_limit
to various value yields RAs with expected hop limit settings
in downstream RAs
Bug: 32163131
Change-Id: I248154ca9d836318bf21a2971d0884040525d9fc
Rename TetherInterfaceStateMachine to IpServer. IControlsTethering
is folded into IpServer.Callback and some of the dependencies in
TetheringDependencies are moved into IpServer.Dependencies.
Several things still need fixing, including:
- convert message passing into method calls
- the calls that enable forwarding should be moved up out of
IpServer into the Tethering layer above it
Test: as follows
- built, flashed, booted
- runtest frameworks-net passes
Change-Id: I015f800ed23c8aa5c8c81a74d7b508abfcaab659
This is the completion of cleanup work started in aosp/674269.
Consequently, also remove ResolvUtil.
Test: as follows
- built, flashed, booted
- runtest frameworks-net passes
- presubmit
Bug: 64133961
Bug: 72345192
Bug: 73872000
Bug: 78548486
Change-Id: I980f8a9b67f3f06f2d97a60f8e58e92c36316d40
Currently the kernel sends 3 probes, 1000ms apart when a neighbor is
in NUD_PROBE state (either naturally or artificially moved to that
state when, for example, confirming network configuration following
an AP association/roam).
With this change the device sends 5 probes at 750ms apart. This
gives the network infrastructure a chance to respond to any of
5 probes instead of any of only 3, at a cost of increasing the total
probe time from 3s to 3.75s.
Future changes may read these values from settings (or from somewhere
else) so that experiments may be conducted or values adjusted based on
other information.
Test: as follows
- built, flashed, booted
- runtest frameworks-net passes
- examinaton of /proc settings on wifi shows updated values
- connected to a test network, disconnected the backhaul, ran
"adb shell dumpsys wifi ipclient confirm" while watching
"adb shell tcpdump -n -i wlan0 -l -vv arp", and observed
5 ARP who-has ("solicits") ~750ms apart.
Bug: 62476366
Bug: 62845299
Change-Id: Ib805531b08624805bb63703a5b338b9ff48171d4
Introduce hopLimit into RaParams so in future the value can be passed
in from the control plane up in Tethering.
Test: as follows
- built, flashed, booted
- runtest frameworks-net passes
Bug: 32163131
Change-Id: I8d2f056dcd55d76e89199db1196754fb690250e8
This matches previous behavior, and there could be situations where
another server on the network would be configured to reply to such
requests, so not replying is better than sending NAKs as done now.
Also refactoring requests in DhcpLeaseRepositoryTest and replacing some
INETADDR_UNSPEC usages for giaddr with INET4_ANY (giaddr is a BOOTP
field and can't be unspecified, only empty).
Test: Following DhcpServerTest.py regression tests pass:
test_request_selecting_giaddr_outside_subnet
test_discover_requestaddress_giaddr_outside_subnet
test_discover_knownaddress_giaddr_outside_subnet
test_discover_giaddr_outside_subnet
Also: atest FrameworksNetTests passes
Change-Id: I4decffccfc64d5e0e29c9ce1cf1446644fcf8190
RFC2131#4.3.1 specifies that ciaddr should be set to the "'ciaddr' from
DHCPREQUEST or 0". Previous behavior sets ciaddr if provided by the
client in DHCPREQUEST, so keeping this behavior.
Bug: b/109584964
Test: DhcpServerTest.py debian/macos/win10 renewing test pass
Change-Id: I283e88b1f66f39d24589c5af4518cf9a2e77b95d
- Do not use Inet4Address#toString(), but Inet4Address#getHostAddress()
- Dump enableLegacyDhcpServer in TetheringConfiguration
Bug: b/109584964
Test: manual: flashed, observed logs
Change-Id: I1f4d008b8bb1818e05a68ac0b5da4ce856cc1588
Add Android metered option, rebinding time option (T2), and match
current order of options. Current DHCP server uses subnet_mask,
broadcast_address, router, name_server in this order.
Test: DhcpServerTest.py:test_discover_paramrequestlist passes
atest FrameworksNetTests passes
Bug: b/109584964
Change-Id: I58f904d5fac306f704c16234fd69c2440fe0803d
Set siaddr to the server address instead of zero in DHCPOFFER
Set siaddr to zero instead of the server address in DHCPNAK
Set giaddr to the relay address instead of the server address in
DHCPNAK
Set giaddr to the relay address instead of zero on DHCPACK and
DHCPOFFER
Set server identifier option in DHCPNAK
Current code is not compliant with RFC2131 and does not match dnsmasq
behavior. It was not an issue until now since the packets were only used
by the DHCP client, which does not send DHCPOFFER or DHCPNAK.
Bug: b/109584964
Test: following DhcpServerTest.py regression tests pass:
test_discover_bootpfields
test_request_selecting_inuse
test_request_rebinding_relayed
test_discover_relayed_broadcastbit
test_request_rebinding_wrongaddr_relayed
Also: atest FrameworksNetTests
Change-Id: Ie0bf780498e38945444bff66ca499cff5983a97f
Test: as follows
- built, flashed, booted
- runtest frameworks-net passes
- manual bluetooth tethering testing doesn't seem to trigger any
actual tethering, since bt-pan interface keeps going down on
test device (IpClient never really starts up fully)
Bug: 62476366
Bug: 113136023
Change-Id: I3265f60f8ae125eba4545cb652c95a2f70049058
This differs from previous behavior where dnsmasq would reply to port 68
if the client had no configured address (ciaddr empty in request), or
send replies to the client port if the request ciaddr matched the
assigned lease.
Not all DHCP servers preserve this behavior, and there is no good known
use-case for it. Not replying to such packets is less error-prone and
closer to the standard.
Bug: b/109584964
Test: Added test in DhcpServerTest.py passes
Change-Id: I88d467336cc4f4e4c9498c3787ec22fdef5e1cdd
This first version can serve discover/request/release, although there
are some small behavior changes with current implementation which will
be addressed later.
Also removes final modifiers on start() and stop() in FdEventsReader, to
allow mocking the methods in tests with the current mockito lib.
Test: Added tests pass, manual: flashed a device using the server
Change-Id: I025366ff7d51c4ba31152af50f3dd2b5e280a54d
In common use-cases, only one gateway or DNS server may be set, so the
added methods make it easier for clients to build the parameters.
Bug: b/109584964
Test: runtest --no-hidden-api-checks frameworks-net
Change-Id: Ib54bc60a54ad4ef0605baea62d87b9f14caf8aa7
Those parameters will be used to start DhcpServer or update its
configuration.
Test: runtest DhcpServingParamsTest.java
Bug: b/109584964
Change-Id: Id8d3dcf62d66dcb02accffa8d8500e30f07af452
Also add DhcpReleasePacket
Test: runtest -x DhcpPacketTest.java, manual: still obtains IP
Bug: b/109584964
Change-Id: I19e68e8857646555ea56995880979a8a722757d7
DhcpClient can then be migrated to at least DhcpSocketFactory, and
eventually DhcpPacketListener.
These classes will be used to implement the new DhcpServer.
FdEventsReader is PacketReader with generic T instead of byte[], to
allow reading both received payload and source IP from a UDP socket with
Os.recvfrom().
Bug: 109584964
Test: runtest --no-hidden-api-checks frameworks-net
Change-Id: Idd7dc36938748af701b45f50bde76a2592c9bfdd
This patch correctly invalidates InitialConfiguration objects with more
than one IPv4 address specified.
Bug: 111639419
Test: none
Change-Id: Ifda174636544311bee456f17946779bac7d4a49e
Every error thrown leaked a netlink NETFILTER socket.
Test: as follows
- built, flashed, booted
- runtest frameworks-net passes
- enabled tethering and tried to cause conntrack updates to sessions
that had expired (which causes ErrnoExceptions to be thrown)
while monitoring lsof for system_server's NETFILTER sockets
Bug: 32163131
Bug: 64976634
Bug: 110122306
Change-Id: Ib52b812e8434c27ad9f2596666400c13e03c2216
Also: address a few "error prone" warnings, adding @Override where missing
Test: as follows
- built, flashed, booted
- runtest frameworks-net passes (with --no-hidden-api-checks)
- wifi tethering uses a randomized address, in as much as it can work
Bug: 32163131
Bug: 70673901
Change-Id: Icfabc48f2cf97b362ce292747f47021e84b900da
Additionally, no longer try to transition from within a State's
enter() method (this can encounter Log.wtf()s). Introduce some
CMD_JUMP_* commands and use deferMessage().
Test: as follows
- built, flashed, booted
- runtest -x IpClientTest passes
- basic DHCP wifi association works
Bug: 69800563
Bug: 70394432
Bug: 80284937
Change-Id: I7ed6e1a994a3556af345e8a4dfb51c383f6d5478
(cherry picked from commit ffacb517d40df8ebb52d5906fa844b20c6520cd8)
Not using it doubles the number of DNS lookups for single-stack
networks.
Private DNS hostname resolution still does not use this flag so that we
get all address families in advance, in case of LinkProperties changes.
Bug: b/79811321
Test: manual: Captive portal, 464xlat, networking in apps working
Merged-In: I7037342a93dc48b8e0988e719b9a9a2d5055bcf2
Merged-In: I8ca15fa079cd5ff94e4d9f7e0476504769f9708f
(Clean cherry-pick of pi-dev Ib46756e5e5f8d8d2698c90c5183c368d2d44be7a)
Change-Id: Iedb7a9c5f9caeb66de4505189fca8db91013d844
Not using it doubles the number of DNS lookups for single-stack
networks.
Private DNS hostname resolution still does not use this flag so that we
get all address families in advance, in case of LinkProperties changes.
Bug: b/79811321
Test: manual: Captive portal, 464xlat, networking in apps working
Change-Id: Ib46756e5e5f8d8d2698c90c5183c368d2d44be7a
ApfFilter maintains separate counters for each reason why a packet was
passed or dropped by the filter logic.
There's also a total which should match the individual counters,
*unless* the APF interpreter aborted execution early due to an illegal
instruction or an out-of-bounds access.
Test: both on APFv2 and APFv4-capable device:
runtest -x tests/net/java/android/net/ip/IpClientTest.java
runtest -x tests/net/java/android/net/apf/ApfTest.java
manual tests connected to an AP
Bug: 73804303
Change-Id: I54b17fcbb95dfaea5db975d282314ce73d79d6ec
Merged-In: I54b17fcbb95dfaea5db975d282314ce73d79d6ec
(cherry picked from commit 3cc40ea6c5)
No functional change yet, since startReadPacketFilter() has no callers
at this time. In the future, this new hook will be used to take
periodic snapshots of the APF memory (for instance, when the device
wakes up).
Design note: WifiStateMachine grabs the APF data synchronously
from another thread, but then the data snapshot is delivered to IpClient
via an asynchronous reply, following the same pattern used by other
commands. This means that there's no (practical) way for IpClient to
read the APF data just before replacing the APF program.
Even with this limitation, it's still possible to reliably decode packet
counters and compute deltas relative to the last snapshot, provided that
the address range isn't cleared when installing a new APF filter.
Bug: 73804303
Test: Manual - called the new code and inspected 'dumpsys wifi' output.
Change-Id: Ia0923d71cf3ee4128fb1c381557316300adac1a3
Merged-In: Ia0923d71cf3ee4128fb1c381557316300adac1a3
Merged-In: I3b940f5a3b795f85d244882eaa7eca56bd9e167d
Merged-In: I283fd5fb71f8a679911e58c487a4ac12a5190049
(cherry picked from commit bb2193bf58)
Fixes a system crash on HU when connecting to a wifi AP.
Change-Id: I8b71323985b6c5fc8a75f99470c9f86343d57f90
Bug: 78905546
Test: manually on android auto device
Support keeping IpClient logs around and dumping them
during dumpsys. Previously we got this benefit for
wifi by virtue of WifiStateMachine's long-lived nature.
Now that this is changing we need to be sure we have
logs, and this method gets us Ethernet logs as well.
Bug: 62476366
Bug: 77999594
Test: as follows
- built
- flashed
- booted
- runtest frameworks-net passes
- dumpsys connmetrics [ipclient] works
Merged-In: Ib4daf0902cae91acadbe9965de1fb73c96a47bec
Merged-In: Ie947394fabcaca7fc1d067f095c2442ee2704593
Change-Id: I1136a83de8097fdb4130debe1eaf689be7132fe5
(cherry picked from commit 3f8306b8c5)
Support keeping IpClient logs around and dumping them
during dumpsys. Previously we got this benefit for
wifi by virtue of WifiStateMachine's long-lived nature.
Now that this is changing we need to be sure we have
logs, and this method gets us Ethernet logs as well.
Bug: 62476366
Bug: 77999594
Test: as follows
- built
- flashed
- booted
- runtest frameworks-net passes
- dumpsys connmetrics [ipclient] works
Change-Id: I1136a83de8097fdb4130debe1eaf689be7132fe5
ApfFilter maintains separate counters for each reason why a packet was
passed or dropped by the filter logic.
There's also a total which should match the individual counters,
*unless* the APF interpreter aborted execution early due to an illegal
instruction or an out-of-bounds access.
Test: both on APFv2 and APFv4-capable device:
runtest -x tests/net/java/android/net/ip/IpClientTest.java
runtest -x tests/net/java/android/net/apf/ApfTest.java
manual tests connected to an AP
Bug: 73804303
Change-Id: I54b17fcbb95dfaea5db975d282314ce73d79d6ec