67 Commits
Author SHA1 Message Date
Lucas ManningandgVisor bot cd70b0a4c0 Add support for the experiment option header in IPv6.
PiperOrigin-RevId: 702771719
2024-12-04 10:25:30 -08:00
Jing Chen a093ad0450 Simplify and format gVisor codebase.
The changes are just output of `gofmt -s -w .`.
2024-10-13 00:50:32 -07:00
Jing ChenandgVisor bot cf5c4c9cbf Replace reflect.DeepEqual with [slices/maps].Equal.
They are faster on slice/map comparisons.

PiperOrigin-RevId: 633080355
2024-05-12 21:20:18 -07:00
Kevin KrakauerandgVisor bot 89d6bf18c8 have gVisor use renamed buffer package
PiperOrigin-RevId: 537209194
2023-06-01 21:27:49 -07:00
Adin ScannellandgVisor bot 1ceb814544 Add default_applicable_licenses rules to packages.
PiperOrigin-RevId: 513581243
2023-03-02 10:50:04 -08:00
Ghanan GowripalanandgVisor bot d3894e4481 Populate IGMPv3 report checksum
Updates #8346

PiperOrigin-RevId: 501969927
2023-01-13 16:56:40 -08:00
Ghanan GowripalanandgVisor bot 89062d5985 Support unordered MGP record validation
This change updates the checker and network testutil packages to support
the validation of unordered MGP(v2) records which may be present across
one or more reports.

This allows us to share more code across the IP-generic and IP-specific
multicast group protocol tests while also preparing us for followup
changes which coalesces records in unpredictable order.

Updates #8346

PiperOrigin-RevId: 501910064
2023-01-13 12:20:21 -08:00
Ghanan GowripalanandgVisor bot 4632d45dd8 Perform MLDv2/IGMPv3 without SSM
This change introduces support for MLDv2/IGMPv3. Note that this change
does not yet introduce APIs to perform source filtering so SSM is not
yet supported. Also note that this change does not yet coalesce records
in a report as that will come in a follow-up.

Updates #8346

PiperOrigin-RevId: 501336347
2023-01-11 11:39:25 -08:00
Lucas ManningandgVisor bot 22ca20c0f1 Move checksum to its own package and optimize bufferv2 checksumming.
Checksum capabilities are logically separate from tcpip header definitions
and operations. It makes sense to extract this logic into its own package.
This is also necessary to avoid circular dependencies with bufferv2.

PiperOrigin-RevId: 473096480
2022-09-08 15:17:00 -07:00
Lucas ManningandgVisor bot 1f2b30d70c Refactor netstack to use bufferv2 instead of buffer.
This change has significant performance implications. bufferv2 is reference
counted and pooled, which alleviates heap/GC pressure. Below are the results
from running the iperf benchmark.

HEAD:
BenchmarkIperf/operation.Upload-16    1552  ns/op   46.6GiB total allocations
BenchmarkIperf/operation.Download-16  1114  ns/op   68.6GiB total allocations

w/ change:
BenchmarkIperf/operation.Upload-16    1139  ns/op (-27%)   1.41GiB total allocations (-97%)
BenchmarkIperf/operation.Download-16  753.2 ns/op (-33%)   706MiB  total allocations (-99%)

PiperOrigin-RevId: 462453185
2022-07-21 13:09:31 -07:00
Lucas ManningandgVisor bot e64458ff08 Remove VectorisedView everywhere.
PiperOrigin-RevId: 453471156
2022-06-07 10:36:23 -07:00
Arthur SfezandgVisor bot 9d5239e714 Rename ControlMessages type to indicate the cmsg direction
With the introduction of sendable control messages, the original cmsg type
is now renamed to ReceivableControlMessages.

PiperOrigin-RevId: 430319598
2022-02-22 16:18:16 -08:00
Ghanan GowripalanandgVisor bot 0f620e9773 Fix UDP checksum calculation
A zero value for the UDP checksum indicates that the sender did not
include a checksum. This is allowed for IPv4 but not for IPv6. A
package may be specially crafted such that the checksum naturally has a
zero valued checksum. However, UDP requires that when this happens, the
sender must transmit the all ones value instead.

PiperOrigin-RevId: 429113399
2022-02-16 12:31:00 -08:00
Arthur SfezandgVisor bot 86ad7d5b58 Support receiving ttl/hoplimit control message
PiperOrigin-RevId: 429096959
2022-02-16 11:27:21 -08:00
Arthur SfezandgVisor bot 4a94302baf Support receiving PKTINFO on icmp endpoints
PiperOrigin-RevId: 428599075
2022-02-14 13:51:49 -08:00
Arthur SfezandgVisor bot 2d9f7fc7ea Add TOS control message for ICMP & RAW sockets
PiperOrigin-RevId: 426208980
2022-02-03 12:19:06 -08:00
Ghanan GowripalanandgVisor bot 89a0011c10 Support IPV6_RECVPKTINFO on UDP sockets
PiperOrigin-RevId: 397631833
2021-09-19 13:15:28 -07:00
Zeling FengandgVisor bot 50ed6b2e09 Use a hash function to generate tcp timestamp offset
Also fix an option parsing error in checker.TCPTimestampChecker while I am here.

PiperOrigin-RevId: 391828329
2021-08-19 13:15:40 -07:00
Tamir DubersteinandgVisor bot 2c1df1f445 Use fake clocks in all tests
...except TCP tests and NDP tests that mutate globals. These will be
undertaken later.

Updates #5940.

PiperOrigin-RevId: 376145608
2021-05-27 05:06:04 -07:00
Tamir DubersteinandgVisor bot 74b10e31a4 Remove detritus
- Unused constants
- Unused functions
- Unused arguments
- Unkeyed literals
- Unnecessary conversions

PiperOrigin-RevId: 375253464
2021-05-22 05:49:34 -07:00
Nick BrownandgVisor bot 1daabac237 Process Hop-by-Hop header when forwarding IPv6 packets
Currently, we process IPv6 extension headers when receiving packets
but not when forwarding them. This is fine for the most part, with
with one exception: RFC 8200 requires that we process the
Hop-by-Hop headers even while forwarding packets.

This CL adds that support by invoking the Hop-by-hop logic performed
when receiving packets during forwarding as well.

PiperOrigin-RevId: 373145478
2021-05-11 07:25:56 -07:00
Arthur SfezandgVisor bot 2c8379d957 Expose header methods that validate checksums
This is done for IPv4, UDP and TCP headers.

This also changes the packet checkers used in tests to error on
zero-checksum, not sure why it was allowed before.

And while I'm here, make comments' case consistent.

RELNOTES: n/a

Fixes #5049

PiperOrigin-RevId: 369383862
2021-04-20 00:28:42 -07:00
Ghanan GowripalanandgVisor bot 68065d1ceb Detect looped-back NDP DAD messages
...as per RFC 7527.

If a looped-back DAD message is received, do not fail DAD since our own
DAD message does not indicate that a neighbor has the address assigned.

Test: ndp_test.TestDADResolveLoopback
PiperOrigin-RevId: 363224288
2021-03-16 11:09:26 -07:00
Zeling FengandgVisor bot 2a888a106d Give TCP flags a dedicated type
- Implement Stringer for it so that we can improve error messages.
- Use TCPFlags through the code base. There used to be a mixed usage of byte,
  uint8 and int as TCP flags.

PiperOrigin-RevId: 361940150
2021-03-09 18:00:03 -08:00
Ting-Yu WangandgVisor bot 1cd76d958a Make dedicated methods for data operations in PacketBuffer
One of the preparation to decouple underlying buffer implementation.
There are still some methods that tie to VectorisedView, and they will be
changed gradually in later CLs.

This CL also introduce a new ICMPv6ChecksumParams to replace long list of
parameters when calling ICMPv6Checksum, aiming to be more descriptive.

PiperOrigin-RevId: 360778149
2021-03-03 16:05:16 -08:00