9 Commits
Author SHA1 Message Date
Kevin KrakauerandgVisor bot 925904e24e netstack: add IP source selection test that was rolled back
See cl/557941259 for the original.

PiperOrigin-RevId: 580624680
2023-11-08 12:52:08 -08:00
Lucas ManningandgVisor bot 4cd842b20a Automated rollback of changelist 557941259
PiperOrigin-RevId: 566749598
2023-09-19 14:51:59 -07:00
Kevin KrakauerandgVisor bot fd95313e83 netstack: use longest prefix match to choose IPs on a NIC
Once a NIC is chosen for a route, we currently just grab the first IP on the
NIC as the source address. We should choose the address with the longest
matching prefix instead.

This is a simple linear search of the route table. That's slow for large
tables, but large tables are exceedingly rare for use with gVisor and we can
always reimplement this with a trie if it becomes necessary.

PiperOrigin-RevId: 557941259
2023-08-17 14:45:53 -07:00
Kevin KrakauerandgVisor bot 64268c8483 netstack: make tcpip.Address an opaque type
The important change here is in tcpip/tcpip.go, where tcpip.Address is defined.
The rest is updating uses of tcpip.Address.

This is preparation for netip.Addr or []byte based addresses, which should save
us a bunch of allocations. Currently, we allocate every time we want to, say,
get a tcpip.Address from a header. This is because the header is a byte slice,
but Address is a string. Strings are immutable, so Go allocates and copies.

PiperOrigin-RevId: 532284732
2023-05-15 18:07:03 -07:00
Adin ScannellandgVisor bot 1ceb814544 Add default_applicable_licenses rules to packages.
PiperOrigin-RevId: 513581243
2023-03-02 10:50:04 -08:00
Nick BrownandgVisor bot 22a6a37079 Record counts of packets with unknown L3/L4 numbers
Previously, we recorded a single aggregated count. These per-protocol counts
can help us debug field issues when frames are dropped for this reason.

PiperOrigin-RevId: 405913911
2021-10-27 10:06:55 -07:00
Nick BrownandgVisor bot b8b43f70c8 Send ICMP errors when link address resolution fails
Before this change, we would silently drop packets when link resolution
failed. This change brings us into line with RFC 792 (IPv4) and RFC 4443 (IPv6),
both of which specify that gateways should return an ICMP error to the sender
when link resolution fails.

PiperOrigin-RevId: 374699789
2021-05-19 12:13:09 -07:00
Arthur SfezandgVisor bot 60bdf7ed31 Move multicounter testutil functions out of network/ip
This is in preparation of having aggregated NIC stats at the stack
level. These validation functions will be needed outside of the
network layer packages to test aggregated NIC stats.

PiperOrigin-RevId: 373180565
2021-05-11 10:25:33 -07:00
Kevin KrakauerandgVisor bot 10de8978f9 Use nicer formatting for IP addresses in tests
This was semi-automated -- there are many addresses that were not replaced.
Future commits should clean those up.

Parse4 and Parse6 were given their own package because //pkg/test can introduce
dependency cycles, as it depends transitively on //pkg/tcpip and some other
netstack packages.

PiperOrigin-RevId: 368726528
2021-04-15 15:11:04 -07:00