355 Commits
Author SHA1 Message Date
Lucas ManningandgVisor bot 9581066c30 Clone the packet during ipv6 processing.
PiperOrigin-RevId: 734359605
2025-03-06 18:22:11 -08:00
Lucas ManningandgVisor bot cd70b0a4c0 Add support for the experiment option header in IPv6.
PiperOrigin-RevId: 702771719
2024-12-04 10:25:30 -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
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
Tony GongandgVisor bot b1cbae9a50 Add getter for NDP configuration
PiperOrigin-RevId: 669127173
2024-08-29 18:08:52 -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
Andrei VaginandgVisor bot b488752cba netstack: implement RTM_SETLINK/IFLA_NET_NS_FD
IFLA_NET_NS_FD specifies a file descriptor that refers to a network namespace.

PiperOrigin-RevId: 648882826
2024-07-02 16:49:27 -07:00
Andrei VaginandgVisor bot 646a033213 tcpip: destroy both ends of one veth pair together
PiperOrigin-RevId: 645562424
2024-06-21 18:50:54 -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
Andrei Vagin af92292ac8 Fix typos 2024-05-02 11:09:16 -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
Kevin KrakauerandgVisor bot 289757e903 netstack: support source hints in routes
PiperOrigin-RevId: 587841841
2023-12-04 14:30:57 -08:00
Kevin KrakauerandgVisor bot 03d35d400f Automated rollback of changelist 580649803
PiperOrigin-RevId: 582102498
2023-11-13 15:30:48 -08:00
Nayana BidariandgVisor bot 5d2bf25468 Change IPv6 fragment 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 fragement ID generation for IPv6 is changed to return a completely random
uint32 number.

PiperOrigin-RevId: 581364034
2023-11-10 14:10:42 -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
Kevin KrakauerandgVisor bot 1a680b825b netstack: rename IncRef() to TryIncRef() to better reflect its behavior
PiperOrigin-RevId: 572084130
2023-10-09 17:28:41 -07:00
Christopher KochandgVisor bot a76207d81b Set NA router flag if forwarding is enabled.
PiperOrigin-RevId: 546155328
2023-07-06 19:37:53 -07:00
Christopher KochandgVisor bot e91eeea83f Allow SLAAC to work without requiring an NDP dispatcher.
Before this change, a non-nil NDPDisp was required to make AutoGenLinkLocal
(i.e. SLAAC) work in netstack.

PiperOrigin-RevId: 546128157
2023-07-06 16:59:06 -07:00
Lucas ManningandgVisor bot 6c8187194a Automated rollback of changelist 538230394
PiperOrigin-RevId: 540671483
2023-06-15 13:21:26 -07:00