summaryrefslogtreecommitdiff
path: root/common/netlinkclient/src/android/net/netlink
AgeCommit message (Collapse)Author
2020-04-20Merge "Mark StructNdOptPref64#prefix @NonNull." into rvc-devLorenzo Colitti
2020-04-20Mark StructNdOptPref64#prefix @NonNull.Lorenzo Colitti
The prefix can never be null. Mark it as such to make it clearer that no null checks for it are needed. Bug: 153694684 Test: atest NetworkStackTests:NduseroptMessageTest NetworkStackTests:StructNdOptPref64Test Merged-In: Ica4f6f7545e63e0665c2a4ae4de8323f3fd93e1c Change-Id: Ica4f6f7545e63e0665c2a4ae4de8323f3fd93e1c
2020-04-20Listen for pref64 RA attributes in IpClientLinkObserver.Lorenzo Colitti
This allows IpClient to parse the pref64 RA option and put it in the LinkProperties to be sent to ConnectivityService. IpClientLinkObserver is a natural place for this because it is the part of IpClient that is already tasked with receiving netlink events and storing the results in IpClient's LinkProperties. Instead of using the path used by most attributes, which are parsed by NetlinkHandler, converted to a string array, then re-parsed and sent over binder call to the networkstack, simply open a netlink socket in the networkstack process and read the netlink messages from there. In the future, we can build on this to parse other netlink messages (e.g., IP addresses, routes, RDNSS, etc.) in the networkstack and entirely remove the dependency on netd's NetlinkHandler, which is crufty, hard to extend, and does not support interface indices. This means that the pref64 attribute will not be ordered with respect to other netlink events. This is acceptable because the pref64 attribute does not need to be ordered with any other information and its presence or absence does not cause provisioning to succeed or fail. Today the pref64 is learned through an entirely different codepath (DNS lookups) and that is not ordered in any way either. This CL does not change the threading model: the netlink updates are processed on the handler thread like all the other updates seen by IpClientLinkObserver, and all access to mLinkProperties is synchronized (this). This synchronization is no longer necessary because everything is on the handler thread anyway, but that will be cleaned up in a future CL. Because netlink events contain interface indices, but IpClient and netd deal with interface names, IpClientLinkObserver must be told what the interface index is. This is done when startProvisioning is called, because that is when IpClient fetches the interface parameters including the MAC address and interface index. It cannot be done when IpClientLinkObserver is started, because at that time the interface might not exist, or might exist with a previous interface index. The interface index is cleared when IpClient enters the stopped state and the LinkProperties are cleared. Bug: 153694684 Test: atest NetworkStackNextIntegrationTests:IpClientIntegrationTest#testPref64Option --iterations 100 Change-Id: I3f8d2fbf2e203c6f90029947fa55b5e0b3b06d94
2020-04-18Support constructing a StructNdOptPref64 from data.Lorenzo Colitti
This is mostly useful in tests at the moment. Also address a review comment from a previous CL. Bug: 152723363 Test: atest NetworkStackTests:NduseroptMessageTest NetworkStackTests:StructNdOptPref64Test Merged-In: I29c3967200e1353972503739b9ba4d1194ce162b Change-Id: I29c3967200e1353972503739b9ba4d1194ce162b
2020-04-18Support serializing a StructNdOptPref64 to a ByteBuffer.Lorenzo Colitti
Bug: 153694684 Test: new unit tests Merged-In: I82a3239a532fe4141627d146f9d47ba99d1622dd Change-Id: I82a3239a532fe4141627d146f9d47ba99d1622dd
2020-04-17Fix parsing a NduseroptMessage inside a NetlinkMessage.Treehugger Robot
The parsing code inside NduseroptMessage assumed that the message started at the beginning of the buffer. Fix this, and also restore the original endianness and limit of the buffer after parsing. Add tests for this, and make the existing tests a bit more readable. Bug: 153694684 Test: new unit tests Merged-In: Id0b4dc18dd219b4d35846e161022a37c8de3e3bb Change-Id: Id0b4dc18dd219b4d35846e161022a37c8de3e3bb
2020-04-16Support parsing ND option messages.Lorenzo Colitti
Define a new StructNduseroptmsg class that is a rough equivalent of the "struct nduseroptmsg" used to pass RA options from the kernel to userspace. Also define a new NdOption class and make the existing pref64 option subclass it. Bug: 153694684 Test: new unit tests Change-Id: I3b71e63ee2cdaa40d095e889188943c5b0cd13af Merged-In: I3b71e63ee2cdaa40d095e889188943c5b0cd13af (cherry picked from commit 48d23146bf3e6e272538f120f1d4af0fef441710)
2020-04-16Support decoding the new PREF64 RA option.Lorenzo Colitti
Bug: 153694684 Test: new unit tests Merged-In: I94346939cda910b01ffee75cf8b62a23ec5314cc Change-Id: I94346939cda910b01ffee75cf8b62a23ec5314cc
2019-11-26Follow up commit of aosp/1157146Chiachang Wang
Address follow up actions and comments Bug: 130325409 Test: NetworkStackTests NetworkStackNextTests Change-Id: Ic768f08e5e54667e375c0d486df278773d9c707a
2019-11-26Remove netlinkclient dependency on shared-srcsRemi NGUYEN VAN
Usage of shared-srcs should be avoided as including shared sources in multiple build rules is inefficient and error-prone. (clean cherry-pick of internal change) Bug: 145146475 Test: m netlink-client FrameworksTelephonyTests Merged-In: I57b2e470d5ec70bfc354d016555c0bbfb9ffdbe4 Change-Id: I57b2e470d5ec70bfc354d016555c0bbfb9ffdbe4
2019-11-20Move shared packages to NetworkStack projectRemi NGUYEN VAN
Both were already statically linked both in the NetworkStack module and the framework, so this change only reorganizes the file locations. It makes more sense to have the library files in the NetworkStack module folder, as changes to these files will be released with the same cadence as the module, not the framework. Bug: 139106271 Test: built, flashed, WiFi working Change-Id: Ibcf9967ebb837e7f3c012a5dd7bf8917344e2ee5