305 Commits
Author SHA1 Message Date
Lucas ManningandgVisor bot 078be62712 Add support for setting the experiment option header in IPv4.
PiperOrigin-RevId: 702486039
2024-12-03 15:21:54 -08:00
Jeff MartinandgVisor bot 966dfe5505 Avoid panic when forwarding races with endpoint shutdown
Catch tcpip.ErrClosedForSend errors while forwarding. This may occur if
an endpoint is being shutdown at the same time as it's being used to
forward a packet.

PiperOrigin-RevId: 695452542
2024-11-11 12:58:45 -08:00
Kevin KrakauerandgVisor bot ce727c3fc5 netstack: add log for martian packet dropping
Martian packets are dropped by default, but some setups require accepting them.
A rate limited log will help users quickly hone in on the issue, which is
otherwise unclear and time-consuming to debug.

PiperOrigin-RevId: 693487838
2024-11-05 15:01:15 -08:00
Koichi Shiraishi 0cf77c02f8 all: remove use io/ioutil deprecated package & fix some deprecated thing
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2024-10-10 20:36:24 +09:00
Lucas ManningandgVisor bot a446b45d4d Ensure views returned by PullUp are owned exclusively by their packet.
PiperOrigin-RevId: 681977034
2024-10-03 12:12:57 -07:00
Jeff MartinandgVisor bot 772fccacb4 netstack: remove stale TODOs for multicast forwarding
Support for multicast forwarding was finished by nahurley@google.com in
commit 7d3a75fa60. These TODOs are no
longer applicable and can be removed

Updates #7338

PiperOrigin-RevId: 650748952
2024-07-09 13:59:59 -07:00
Nayana BidariandgVisor bot 90266aa28a Netstack S/R: Mark all the structs in netstack as savable.
Marks the structs in netstack as savable. This does not change or break any
existing behavior as the netstack itself is not savable yet.

PiperOrigin-RevId: 635943481
2024-05-21 15:19:07 -07:00
Kevin KrakauerandgVisor bot e367e0b134 make PMTUD on by default and settable via sockopt
We've supported PMTUD for a long time and just never turned it on.

Addresses #10344.

PiperOrigin-RevId: 634003508
2024-05-15 10:44:02 -07:00
Lucas ManningandgVisor bot 52fc5b60f7 Add a method for inspecting assigned addresses.
This new method allows checking for the existence of assigned addresses without
taking an extra reference that needs to be DecRefed. DecRef takes exclusive
locks. Contention on the addressState lock causes performance issues when
multiple goroutines are processing IP packets simultaneously. This isn't the
case today since IP processing is single threaded, but will be eventually.

PiperOrigin-RevId: 623567408
2024-04-10 12:12:23 -07:00
Kevin KrakauerandgVisor bot 3c75945fd6 netstack: remove PacketBuffer.IsNil()
The change was originally motivated by ticket references (cl/450976957), which
were never implemented.

PiperOrigin-RevId: 617480960
2024-03-20 05:31:48 -07:00
Kevin KrakauerandgVisor bot 5b4fbd06d8 netstack: remove PacketBufferPtr
PacketBufferPtr is leftover from a dead experiment. Just use *PacketBuffer.

PiperOrigin-RevId: 611531815
2024-02-29 11:10:38 -08:00
Ayush RanjanandgVisor bot 5eaa66a2ed Fix ipv4.endpoint.AddAndAcquirePermanentAddress() to write lock endpoint mutex.
Fixes #7951

PiperOrigin-RevId: 598068487
2024-01-12 22:23:12 -08:00
Kevin KrakauerandgVisor bot 289757e903 netstack: support source hints in routes
PiperOrigin-RevId: 587841841
2023-12-04 14:30:57 -08:00
Nayana BidariandgVisor bot 505e1fd33f Change IPv4 ID generation algorithm.
This addresses an issue discovered by Inon Kaplan (PhD candidate in the
Hebrew University School of Computer Science and Engineering), Ron Even (BSc
graduate of Bar Ilan University) and Amit Klein (faculty member in the Hebrew
University School of Computer Science and Engineering). Details will be
provided in their paper, to be presented in a forthcoming academic conference.

The ID generation for IPv4 is changed to return a completely random number.

PiperOrigin-RevId: 587102343
2023-12-01 13:31:24 -08:00
Nayana BidariandgVisor bot 6262b00330 Change IPv4 ID generation algorithm.
This addresses an issue discovered by Inon Kaplan (PhD candidate in the
Hebrew University School of Computer Science and Engineering), Ron Even (BSc
graduate of Bar Ilan University) and Amit Klein (faculty member in the Hebrew
University School of Computer Science and Engineering). Details will be
provided in their paper, to be presented in a forthcoming academic conference.

Update the IPv4 ID generation algorithm by incrementing the hash value with a
random number rather than incrementing it by 1 everytime.

PiperOrigin-RevId: 582753591
2023-11-15 11:52:01 -08:00
Kevin KrakauerandgVisor bot 03d35d400f Automated rollback of changelist 580649803
PiperOrigin-RevId: 582102498
2023-11-13 15:30:48 -08:00
Kevin KrakauerandgVisor bot 40ee36ac4c Automated rollback of changelist 580051079
PiperOrigin-RevId: 580649803
2023-11-08 14:04:04 -08:00
Kevin KrakauerandgVisor bot b988b57921 runsc: reproduce NAT table inside gVisor only when non-default
... instead of depending on a flag.

In most cases the NAT table is in an all-ACCEPT default state:

```
root@5a7ce3a6c623:/# iptables -t nat -S
-P PREROUTING ACCEPT
-P INPUT ACCEPT
-P OUTPUT ACCEPT
-P POSTROUTING ACCEPT
```

In such cases we leave iptables off in the sandbox as a performance
optimization.

But when the table contains anything else, we now install those rules inside
the sandbox.

Turns out packetdrill installes a rule, so support for that rules is also added
in this CL.

PiperOrigin-RevId: 580051079
2023-11-06 22:05:48 -08:00
Kevin KrakauerandgVisor bot 83f75082e5 nestack: use cryptographically secure RNG when appropriate
This addresses an issue discovered by Inon Kaplan (PhD candidate in the
Hebrew University School of Computer Science and Engineering), Ron Even (BSc
graduate of Bar Ilan University) and Amit Klein (faculty member in the Hebrew
University School of Computer Science and Engineering). Details will be
provided in their paper, to be presented in a forthcoming academic conference.

Also:
- Add a secure RNG type to prevent mixing up with the default PRNG
- Give the PRNG the name `InsecureRNG` to make it more obvious to future
  contributors that some RNGs are inappropriate in certain instances.
- Some tests were injecting fake RNGs and had to be relaxed: they relied on the
  stack calling the RNG a specific number of times and in a specific order.
  That order is now changed, and is too brittle to unit test.
- Remove the double package comment in pkg/rand. The linter complains.
PiperOrigin-RevId: 577513723
2023-10-28 16:14:07 -07:00
Andrei Vagin 5f4abad306 Fix a few typos
It is an idea of running codespell as part of our presubmit checks.
Before enabling it for new changes, let's fix what it has found.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2023-10-25 12:13:42 -07:00
Lucas ManningandgVisor bot 949461f2b3 Automated rollback of changelist 558922801
PiperOrigin-RevId: 566731014
2023-09-19 13:46:56 -07:00
Kevin KrakauerandgVisor bot baf097a14d netstack: refactor IPv4 source address selection
This was in the wrong place. This CL just refactors it into package ipv4, just
as IPv6-specific logic is in package ipv6.

PiperOrigin-RevId: 558922801
2023-08-21 15:54:10 -07:00
Lucas ManningandgVisor bot 6c8187194a Automated rollback of changelist 538230394
PiperOrigin-RevId: 540671483
2023-06-15 13:21:26 -07:00
Lucas ManningandgVisor bot 639ca440e6 Change Buffer.PullUp so that it returns views that are not shared.
The underlying chunks returned from PullUp should not be shared,
since the underlying slice can sometimes be directly modified. This change
also reworks some of the network parsing code so that ownership of
views is more explicit to the reader.

PiperOrigin-RevId: 538230394
2023-06-06 10:51:15 -07:00
Kevin KrakauerandgVisor bot 89d6bf18c8 have gVisor use renamed buffer package
PiperOrigin-RevId: 537209194
2023-06-01 21:27:49 -07:00