Commit graph android_packages_modules_Co.../staticlibs/device
Message SHA1
Merge "Add prefixmsg struct to parse RTM_NEWPREFIX message header." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2024-04-16 08:19:59 +00:00
22d42e6079
Add prefix_cacheinfo struct to parse PREFIX_CACHEINFO attribute.
Bug: 315069348
Test: TH
Change-Id: I6a2cd40ab81fa079cdd6bd309dd48387c6faf146

Xiao Ma   commited 2024-04-16 14:56:25 +09:00
44df982062
Add prefixmsg struct to parse RTM_NEWPREFIX message header.
Bug: 315069348
Test: TH
Change-Id: I8bc5bee20f3043203f591bdfe31a4879a09d1565

Xiao Ma   commited 2024-04-16 14:54:51 +09:00
a25a09d2c2
Convert RTM_NEWPREFIX nlmsg type to string in stringForRtMsgType().
Bug: 315069348
Test: TH
Change-Id: I6773bd467484e444e30a3b504b8969a6aac446d6

Xiao Ma   commited 2024-04-15 13:06:51 +09:00
8d1cad9a11
Add RTM_NEWPREFIX and RTMGRP_IPV6_PREFIX netlink message constants.
Bug: 315069348
Test: TH
Change-Id: Ic0b12b71020a3207f9f7a4759ae39f05282741c2

Xiao Ma   commited 2024-04-11 17:38:12 +09:00
c6e2d82510
Improve the nduser option log readability.
Before:
Nduseroptmsg(10, 40, 48, 134, 0, fe80::2a00:79e1🔤f605%wlan0)

after:
Nduseroptmsg(family:10, opts_len:40, ifindex:48, icmp_type:134, icmp_code:0, srcaddr: fe80::2a00:79e1🔤f605%wlan1, NdOptRdnss(type: 25, length: 5, reserved: 0, lifetime: 1209600,servers:[2001:4860:4860::6464,2001:4860:4860::64]))

Bug: 315069348
Test: TH
Change-Id: I3abfbecd53a8cc00eaed9cbac1d9fe187d265847

Xiao Ma   commited 2024-04-05 18:25:54 +09:00
6fc458350a
Merge changes Ie882a5c7,Id94b6538,I58eda41f into main
* changes:
  Support prefix information option parsing in nduser netlink message.
  Add PrefixInformation option struct to parse nduser option.
  Create IpPrefix in PrefixInformationOption constructor

Patrick Rohr   authored and   Gerrit Code Review   commited 2024-04-01 18:41:53 +00:00
da9dfa2207
Support prefix information option parsing in nduser netlink message.
Bug: 315069348
Test: atest NetworkStaticLibTests
Change-Id: Ie882a5c721befd4384858140a1f0706a0247d3a1

Xiao Ma   commited 2024-04-01 16:06:02 +09:00
5485bb84f1
Add PrefixInformation option struct to parse nduser option.
This is helpful for user space to get the PIO option via netlink message
and check whether the P flag is set or not, this bit flag determines if
we should start DHCPv6 PD process for IPv6 provisioning.

Bug: 315069348
Test: atest NetworkStaticLibTests
Change-Id: Id94b6538c5d88fe43c262ab23c30ccd53c766a62

Xiao Ma   commited 2024-04-01 16:05:59 +09:00
e20dc5ae89
Create IpPrefix in PrefixInformationOption constructor
The constructor is invoked during Struct#parse() at which point we might
as well try to create the IpPrefix object which will be used later. If
this fails for some reason (UnknownHostException or ClassCastException),
the prefix is bogus and should not be used.

Bug: 315069348
Test: TH
Change-Id: I58eda41f98b774fe97389beb1b84e164634a20d3

Xiao Ma   commited 2024-04-01 12:51:19 +09:00
5d3dcb0d64
Add isFeatureEnabled API for CaptivePortalLogin experiment namespace.
Bug: 329361366
Test: atest NetworkStaticLibTests
Change-Id: I3421f04bdace03221a3d6bde27da1d2ffd61e789

Xiao Ma   commited 2024-03-28 08:35:08 +00:00
12f7fd26af
Merge "Make PrefixInformationOption struct constructor visible for testing." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2024-03-26 02:49:46 +00:00
f74488eb37
Make PrefixInformationOption struct constructor visible for testing.
PrefixInformationOption#build always gives the correct option length and
type, visible constructor is easiler to verify the incorrect parameters
in the test, for example, we will verify the code that parses the PIO
option in RA as a ND user option in netlink message.

Bug: 315069348
Test: TH
Change-Id: I6b88e6718cb873b15936c1f518d357c36c41ffde

Xiao Ma   commited 2024-03-18 15:12:35 +09:00
f0959a78a2
Add IPv6 FragmentHeader struct support
Bug: 285124667
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.structs.FragmentHeaderTest
Change-Id: I90c8a52daa35589977333494355ac239ea057204

KH Shi   commited 2024-03-06 05:05:13 +00:00
f8c7d15850
Merge "Revert "Add method to read trunk stable flag"" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-02-08 10:37:09 +00:00
6de59fa208
Merge changes Icfcc7ade,I1481cb8f,Ic2e8ca0d into main
* changes:
  Make RtNetlinkRouteMessage constructor visible for testing.
  Make StructRtMsg constructor visible for testing.
  Make NduseroptMessage constructor visible for testing.

Xiao Ma   authored and   Gerrit Code Review   commited 2024-02-08 08:20:49 +00:00
f582074f69
Revert "Add method to read trunk stable flag"
This reverts commit b0f489021b.

Reason for revert: Currently reading trunk stable flag from mainline module is not supported. So reverting the CL to avoid confusion.

Change-Id: I0db04f28f378399aa299b325312a6af7f45d4f67

Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-02-08 03:06:34 +00:00
4919dcce94
Make RtNetlinkRouteMessage constructor visible for testing.
Refactor IpClientTest by parsing the netlink message directly instead
of netd callbacks, so we have to initialize a RtNetlinkRouteMessage
instance to trigger IPv4/v6 route updates in the unit test.

Bug: 318764217
Test: atest NetworkStackTests
Change-Id: Icfcc7ade636c89a63d897f4e9246410f6387b3c9

Xiao Ma   commited 2024-02-02 13:25:58 +09:00
f505ef0479
Make StructRtMsg constructor visible for testing.
Refactor IpClientTest by parsing the netlink message directly instead
of netd callbacks, so we have to initialize a StructRtMsg instance to
fill in the RtNetlinkRouteMessage constructor.

Bug: 318764217
Test: atest NetworkStackTests
Change-Id: I1481cb8fab29ae94d48fa342ecf2b303a9701a31

Xiao Ma   commited 2024-02-02 13:25:58 +09:00
2040d8bcc8
Make NduseroptMessage constructor visible for testing.
Refactor IpClientTest by parsing the netlink message directly instead of
netd callbacks, so we have to initialize an NduseroptMessage instance to
trigger IPv6 RDNSS option update in the unit test.

Bug: 318764217
Test: atest NetworkStackTests
Change-Id: Ic2e8ca0d5e71b73c0dbdc3311e72486af371c899

Xiao Ma   commited 2024-02-02 13:25:40 +09:00
4dfc6da55f
Add netlinkSocketForProto() without buffersize.
Test: atest NetworkStaticLibTests
atest FrameworksNetTests

Change-Id: I34a0a29eb7e78490701872229585e61f7a0c1dd3

Yang Sun   commited 2024-02-01 09:50:52 +08:00
1d8b7cc422
Merge "Pass buffer size to NetlinkUtils.netlinkSocketForProto" into main
Maciej Å»enczykowski   authored and   Gerrit Code Review   commited 2024-01-31 01:42:49 +00:00
2cb28ea360
Pass buffer size to NetlinkUtils.netlinkSocketForProto
Pass buffer size to netlinkSocketForProto to allow callers to specify
buffer size. The buffer size is not set if 0 is passed in.

Following callers of netlinkSocketForProto passes SOCKET_RECV_BUFFERSIZE
to keep same behavior as before:
 * OffloadHardwareInterface.createConntrackSocket()
 * NetlinkUtils.sendOneShotKernelMessage()
 * IpSecXfrmController.Dependencies.newNetlinkSocket()
 * InetDiagMessage.getConnectionOwnerUid()
Following callers pass 0 to not update the buffer size:
 * TunInterfaceController - it uses the socket only for writing
 * NetlinkUtils.createNetLinkInetDiagSocket() same behavior as before
Added a SOCKET_DUMP_RECV_BUFFERSIZE of 128k to be used by socket
requesting dump information from kernel:
 * NetlinkUtils.getAndProcessNetlinkDumpMessages() - sends dump request
   and expecting multiple reply messages.

Bug: 320420453

Test: atest NetworkStaticLibTests
atest FrameworksNetTests

Change-Id: I3dcb76963cf2646eb311602b50ab4e44b8ad3e8f

Yang Sun   commited 2024-01-30 21:54:48 +08:00
7934241c8f
Merge "Add SOCK_CLOEXEC to NetlinkUtils.netlinkSocketForProto" into main
Maciej Å»enczykowski   authored and   Gerrit Code Review   commited 2024-01-29 10:49:48 +00:00
7412936a8c
Add SOCK_CLOEXEC to NetlinkUtils.netlinkSocketForProto
Bug: 320420453

Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink.NetlinkUtilsTest

Change-Id: I166a0d5185a18274ed82f739f289969c1f989b20

Yang Sun   commited 2024-01-29 09:37:26 +08:00
a080b1900a
Support adding an IPv4 address via RTM_NEWADDR netlink message.
Usually we can call InterfaceController.setIPv4Address API to add an
IPv4 address on the interface, in fact it ends up calling the native
Netd API which doesn't support setting deprecation/expiration time. In
user space we already have the netlink infra to send RTM_NEWADDR for
IPv6 address, extend the function to support IPv4 as well, then we can
deprecate the Netd API in IpClient.

Bug: 129660498
Test: atest NetworkStaticLibTests
Change-Id: I9fc7ba8d7035e0ed1df8c1f2baef9ec7e1806be3

Xiao Ma   commited 2024-01-26 05:40:34 +00:00
a3d165e814
BpfMap - add R/W constructor alias
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7cef2b19f55e6e056b46bb1b28f85c7f7376f6f4

Maciej Å»enczykowski   commited 2024-01-23 16:16:44 -08:00
06155c8040
BpfMap.java - remove spurious import
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id4ceeb0dc0cb8ffbd4a4bfb75359f311a00a08a7

Maciej Å»enczykowski   commited 2024-01-23 16:16:32 -08:00
e64e4eacce
Merge "Parse destination and source mac address of ARP packet." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2024-01-22 06:22:46 +00:00
94192b136b
Address review feedback
This commit addresses the review feeback of aosp/2864606
to add a wtf log for unexpected cases.

Bug: 320842025
Test: m
Change-Id: I1581b0e754b74aac72278a0db61d9836618d50b5

Chiachang Wang   commited 2024-01-18 06:21:12 +00:00
12b002deaf
Address format check issues
Address format check issue to remove unused import.

Test: m
Change-Id: Id3d6838b26ccdfd6d24a5c18ec45d2c97af22796

Chiachang Wang   commited 2024-01-18 06:21:12 +00:00
28a0f3457f
Parse destination and source mac address of ARP packet.
This can be used in the integration test to assert if an ARP packet
captured on the tap interface is broadcast or unicast request.

Bug: 315076572
Test: atest NetworkStaticLibTests
Change-Id: I52c0b18bf3fd2b64727912e54c045a8e8405d2f6

Xiao Ma   commited 2024-01-17 23:43:11 +09:00
0f7f901c87
Migrate Tethering#dump to use runWithScissorsForDump
This change includes:
  1. Refactor the logic in Tethering#dump into utils class.
  2. Move the utils class to a common place which could be referenced
     from other sub-modules.
  3. Add @MonitorThreadLeak annotation to enforce
     there is no thread leak problem.

Test: atest FrameworksNetTests NetworkStaticLibTests
Test: atest ConnectivityCoverageTests:com.android.networkstack.tethering.TetheringTest#testDumpTetheringLog
Test: adb shell dumpsys tethering (with hardcoded exception)
Fix: 312669345

Change-Id: Ia6fdfeeec2110afa0ec9e056e9db3843748845c3

Junyu Lai   commited 2024-01-10 13:56:55 +08:00
2ff42d264b
implement Thread Border Router e2e integration test
This implements a basic border routing test case (ping) and demonstrates a
valid test environment for Thread Border Router test cases.

Later we can add more packet verifications and more test cases.

Bug: 295843010
Test: atest android.net.ThreadBorderRouterTest

Change-Id: Ifb9b6d45539143a227c2bc0ed69b5c3167ef9acd

Handa Wang   commited 2023-12-26 15:24:54 +08:00
806f5a1bec
Merge changes I71545bee,Ic26cddab,I57b36e66,I71367761,I07e7aa8c into main
* changes:
  Use NetlinkUtil to process dump messages in InetDiagMessage.
  Add mif6ctl struct definition.
  Add mf6cctl struct definition.
  Add Mrt6Msg struct for multicast routing support.
  Add support to dump all multicast routes in NetlinkUtils

Yang Sun   authored and   Gerrit Code Review   commited 2023-12-25 03:19:12 +00:00
907c6e377b
Merge "Add netlink attributes field into the InetDiagMessage" into main
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-12-25 03:09:42 +00:00
504f6d6c90
Add netlink attributes field into the InetDiagMessage
Add nlAttrs parameter to store the remaining attributes data.

As a part of follow-up work from aosp/2354202, the TCP socket
parsing can be done by using existing InetDiagMessage class.
The missing piece in the InetDiagMessage class is the possible
netlink attributes fields that may be appended after an
InetDiagMessage.

Bug: 311119352
Bug: 265877161
Test: atest NetworkStaticLibTests
Change-Id: I9c34166124fd4efba2ab211bfb537ccce5e774a4

Chiachang Wang   commited 2023-12-25 01:40:13 +00:00
4fc3f4fa15
Use NetlinkUtil to process dump messages in InetDiagMessage.
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink.InetDiagSocketTest
atest FrameworksNetTests:android.net.connectivity.com.android.server.ConnectivityServiceTest

Change-Id: I71545beea8e4d9d9993f473813017f76094dc2e0

Yang Sun   commited 2023-12-22 18:56:19 +08:00
4e3bc16e48
Add mif6ctl struct definition.
This is used to configure interfaces for multicast routing.

Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.structs.StructMif6ctlTest
Change-Id: Ic26cddab2d5a9f90f63b0828c3e133d830aa0db4

Yang Sun   commited 2023-12-22 18:51:27 +08:00
03e3ceaab1
Add mf6cctl struct definition.
This is used to configure multicast routes.

Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.structs.StructMf6cctlTest
Change-Id: I57b36e6678262f48781b70ab77d49b920c7ddca2

Yang Sun   commited 2023-12-22 18:51:15 +08:00
15d4e023f7
Add Mrt6Msg struct for multicast routing support.
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.structs.StructMrt6MsgTest
Change-Id: I71367761662117aa6c0af3153039e50266d79259

Yang Sun   commited 2023-12-22 18:05:40 +08:00
50b4fd79fa
Add support to dump all multicast routes in NetlinkUtils
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink.NetlinkUtilsTest
Change-Id: I07e7aa8ce677dafb94891c8075f8822dadcfd6d1

Yang Sun   commited 2023-12-21 10:06:33 +08:00
3ee59057b7
Add getRtmFamily for RtNetlinkRouteMessage
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink.RtNetlinkRouteMessageTest
Change-Id: Ifdf5afc4f58ff55bd20cc60e23b17c3138754392

Yang Sun   commited 2023-12-17 17:34:39 +08:00
6000558538
Add support for multicast route in RtNetlinkRouteMessage
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink.RtNetlinkRouteMessageTest
Change-Id: I2f3d69a5bda81de65e4a36e0db61d98dcf082b2d

Yang Sun   commited 2023-12-17 17:31:00 +08:00
08622b8ecb
Add support for long values in StructNlAttr
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink.StructNlAttrTest
Change-Id: Iaaa7f63a2b550f017a8c75f84b9d69bf9e829a8c

Yang Sun   commited 2023-12-16 21:58:15 +08:00
d4195824ab
Add support for processing netlink dump messages
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink.NetlinkUtilsTest
Change-Id: I15e208dca5ed6a723585f79cf09276017bc8a885

Yang Sun   commited 2023-12-16 21:58:07 +08:00
0b2d75c09a
Merge changes I395560fb,If6abc33c into main
* changes:
  Add support for NLM_F_DUMP request in StructNLMsgHdr
  Mark NetworkStaticLibTestsLib as test for lint

Yang Sun   authored and   Gerrit Code Review   commited 2023-12-12 12:46:55 +00:00
336f3c1084
[XFRM_MSG_NEWSA] Support polling SA state with netlink message
Bug: 308011229
Test: IpSecXfrmControllerTest
Change-Id: Id765cd8d8d7e330969877cb0890bd828417fb6b8

Yan Yan   commited 2023-12-11 18:43:34 +00:00
4df361975d
Add support for NLM_F_DUMP request in StructNLMsgHdr
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink.StructNlMsgHdrTest
Change-Id: I395560fb1edfb1c806b2ed4c74a7a3081c7b2515

Yang Sun   commited 2023-12-09 20:03:43 +08:00
9ea3be13fc
[XFRM_MSG_NEWSA] Support xfrm_replay_state_esn and XFRM_MSG_NEWSA
Bug: 308011229
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink
      (new tests added)
Change-Id: I4c21a64c634b1814d52ce81a48abe2550876b755

Yan Yan   commited 2023-12-05 10:49:16 -08:00
0a892e6ec2