A malformed RA could cause the Ra constructor in ApfFilter to
enter an infinite loop while holding the class lock. This blocks
IpManager until reboot and drains the battery.
Bug: 29586253
Change-Id: Idaa46b3bc50371db076630881883807c2fa21674
IPv4 broadcast packets can be very common (e.g. every 2s) so they
need to be dropped in the general case. They also may be critical
for certain discovery protocols, so allow them through with APF
when the WiFi multicast lock is held.
Bug: 26238573
Change-Id: I03e09a2b9c779da5da775e78b95e9e0339720eaf
For now this just drops all non-ICMPv6 packets to ff00::/8 when
mMulticastFilter is true. Multicast ICMPv6 is already mostly
dealt with by other filters - the L2 multicast filter, the RA
filter, the multicast NA filter, and ND offload.
Bug: 28393601
Change-Id: Ia7b0d4f00fac6710093befe6a726b46677a5f20b
This used to be done by some WiFi firmwares but should now be done by APF
for consistency across the board.
Bug: 28304368
Change-Id: Ic75f408affc1f56e1ecf4d347d0c287aa72250bf
This ensures that IpManager has a complete copy of DHCP state
before configuring the IPv4 address. That way, when the netlink
notification of the IPv4 address arrives, we are guaranteed to
have all DHCP information (including DNS servers and routes)
available and we will never send the IPv4 address before the DNS
servers.
Bug: 27605330
Change-Id: I732424dfe2408be9e40028563e99d610b541e12d
Now that it's long since been unused also delete the locking that was
introduced to make it possible.
Bug: 17733693
Bug: 24837343
Change-Id: Iee817a7c2e1d1dc9c080d3124d5986232dcda00f
- fold IpReachabilityMonitor* classes into a single IpReachabilityEvent.
- only log an event for NUD_FAILED Netlink answers.
- distinguish between NUD_FAILED with or without lost of provisioning.
- do not record host ip addresses.
- record interface name instead of interface index when losing
provisioning.
- also return an error code when probeNeighbor fails, and log this error
code in IpReachability events.
Bug: 28204408
Change-Id: I5f0def0ab1ace7e467a0c69b3b82d07ef2252307
This patch moves the event logging of DHCP response packet parse errors
to DHCPClient in a single place. It also logs receive IO errors as
DHCPErrors instead of DHCPClientEvents.
BUG=28197345
Change-Id: I7ad666cff4d8b97915880477347fbb3f588fdb2a
APF version 2 and prior versions fail to execute JNEBS with R1 argument.
The APF interpreter tries to use R1's value as the number of bytes to
compare, as well as the offset within the packet to compare at.
This change makes ApfFilter avoid using this and makes the APF generator
throw if this is used. This was limiting the IPv4 filter, causing it to
only drop multicast (when multicast filtering was enabled), rather than
a wider range of broadcast packets.
Bug: 28206777
Change-Id: I8d116e024e8bd641b21053c6b1defc734d744467
This patch adds an event class derived from IpConnectivityEvent that
records parsing errors of DHCP response packets.
Change-Id: I19516cf05e3419c4262e3236899e52987e5f2264
DHCP receive thread was spinning on a boolean variable to know when to
stop. That variable had no volatile qualifier, potentially preventing
the thread from stopping at all. Without a volatile qualifier, the reads
and writes in halt() could be reordered in such a way that the running
thread is interrupted before mStopped is set t true. Also, the optimizer
could decide to hoist mStopped in a register inside the running thread,
preventing the loop from exiting.
Change-Id: I5b30c1247808114f0e5b46e230978ee7ea18ab8e
1. Decode RDNSS options.
2. Keep track of how many times the program was updated.
3. Remove the leading / from the IPv4 address.
Change-Id: Ida0518a94ea7d952c82c8181b09044eff907b714
When an interface is removed, all netlink events for that
interface are lost, because netd will no longer be able to
resolve the ifindex in the netlink event to an interface name,
and it only communicates to the framework events that include an
interface name.
This can cause us to end up with stale IP addresses if, for
example, wlan0 is removed because we switch wifi back from AP
mode to STA mode when exiting tethering. The presence of stale
IPv4 addresses can in turn lead us to miss a provisioning
notification because we already think we have an IPv4 address.
Change-Id: Ib64559a5a4fa261f483760b69fa7996314e7cc17
The WiFi chipset's ARP offload may handle this when the
AP is asleep, but when the AP is awake and the chipset is in
wake-on-wifi mode use APF to filter these packets.
Bug: 27477163
Change-Id: I180c08bd7301a1af9c3f728ff3cba06ca4e1022d
Use APF to implement WifiManager.MulticastLock, if APF isn't available
fallback to the present behavior of using DRIVER RXFILTER. Since we
don't know whether APF is supported until we're connected, postpone
enabling/disabling the multicast filter until then; this should be
fine as there isn't much need to filter packets if there aren't any
packets going by since we're not connected.
Bug: 26238573
Change-Id: I862c053f1c8c3a41de50c2951cf14b3ca6923a2a
Avoid adjusting ApfFilter.Ra.mPacket's postion() and limit()
in matches(). This avoids potential bugs in other parts of
the code that previously relied on limit() being reset.
Also for good measure change some limit() calls to capacity()
as it's more final.
Change-Id: I466e87ce6838f68654b24f2c9543a6cd547d3f87