Commit Graph
17 Commits
Author SHA1 Message Date
Nicolas LacasseandgVisor bot 0820d98b38 Deflake socket_ip_unbound_test_runsc_ptrace_hostnet
The comment notes that this has different behavior on
different kernels. Support for hostinet was added in
recently cl/513942981. We should skip on hostinet to
avoid flaky behavior.

PiperOrigin-RevId: 514017548
2023-03-04 00:57:50 -08:00
Nick BrownandgVisor bot 81b5f09c06 Avoid UB when bit shifting
The 0 literal is a signed integer; bitshifting its (negative) complement is
undefined behavior.

PiperOrigin-RevId: 480717288
2022-10-12 14:27:44 -07:00
Jing ChenandgVisor bot 39c266c680 Use network protocol default ttl instead of a hardcoded one.
PiperOrigin-RevId: 423886874
2022-01-24 12:46:25 -08:00
Ghanan GowripalanandgVisor bot 129cc47c63 Move socket_test_util to //test/util
...and rename the library to socket_util.

PiperOrigin-RevId: 386348306
2021-07-22 16:37:15 -07:00
Andrei VaginandgVisor bot 9a1f20e8fb net/tcpip: connect to unset loopback address has to return EADDRNOTAVAIL
In the docker container, the ipv6 loopback address is not set,
and connect("::1") has to return ENEADDRNOTAVAIL in this case.

Without this fix, it returns EHOSTUNREACH.

PiperOrigin-RevId: 340002915
2020-10-31 01:19:40 -07:00
Zach KoopmansandgVisor bot 545e16a41e Skip ECN test for native/linux tests.
Skip check for ECN bits in native/linux tests. General advice
for the ECN field is to leave the setting to the kernel, so
behavior of the test is undefined for different kernels.

http://www.masterraghu.com/subjects/np/introduction/unix_network_programming_v1.3/ch07lev1sec6.html

PiperOrigin-RevId: 327451414
2020-08-19 09:51:04 -07:00
Ian GudgerandgVisor bot 25d372ee45 Add support for SO_REUSEADDR to TCP sockets/endpoints.
For TCP sockets, SO_REUSEADDR relaxes the rules for binding addresses.

gVisor/netstack already supported a behavior similar to SO_REUSEADDR, but did
not allow disabling it. This change brings the SO_REUSEADDR behavior closer to
the behavior implemented by Linux and adds a new SO_REUSEADDR disabled
behavior. Like Linux, SO_REUSEADDR is now disabled by default.

PiperOrigin-RevId: 317984380
2020-06-23 19:15:38 -07:00
Bhasker HariharanandgVisor bot 66954a0fab Fix TtlDefault test on linux.
Different flavors of linux seem to use different defaults we accept 64
or 127 as the TtlDefault in the test.

PiperOrigin-RevId: 316961150
2020-06-17 14:08:48 -07:00
Ian GudgerandgVisor bot 4dcb81ce50 Add support for SO_REUSEADDR to UDP sockets/endpoints.
On UDP sockets, SO_REUSEADDR allows multiple sockets to bind to the same
address, but only delivers packets to the most recently bound socket. This
differs from the behavior of SO_REUSEADDR on TCP sockets. SO_REUSEADDR for TCP
sockets will likely need an almost completely independent implementation.

SO_REUSEADDR has some odd interactions with the similar SO_REUSEPORT. These
interactions are tested fairly extensively and all but one particularly odd
one (that honestly seems like a bug) behave the same on gVisor and Linux.

PiperOrigin-RevId: 315844832
2020-06-10 23:49:26 -07:00
Nayana BidariandgVisor bot 6551647061 Fix the error code for syscall test with null TOS.
The setsockopt with nullptr can fail with either EFAULT or zero.

PiperOrigin-RevId: 315777107
2020-06-10 15:06:45 -07:00
Adin ScannellandgVisor bot 1b8ff2ce79 Change to standard types.
PiperOrigin-RevId: 290846481
2020-01-21 17:28:57 -08:00
gVisor bot 33f3ef287f Merge pull request #1492 from majek:err_typo_in_netstack_tests
PiperOrigin-RevId: 290840370
2020-01-21 16:32:49 -08:00
Ting-Yu WangandgVisor bot ff943d5ed4 Fix slice bounds out of range panic in parsing socket control message.
Panic found by syzakller.

PiperOrigin-RevId: 288799046
2020-01-08 16:32:34 -08:00
Ting-Yu WangandgVisor bot 617c84d313 Fix return codes for {get,set}sockopt for some nullptr cases.
Updates #1092

PiperOrigin-RevId: 280547239
2019-11-14 17:04:34 -08:00
HaiboandgVisor bot eaab6788a0 test/syscall: Remove duplicated gtest/gtest.h.
Signed-off-by: Haibo Xu <[email protected]>
Change-Id: I05a7ec69b98b88931ba4a8adb3e8a7b822006001
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gvisor/pull/1023 from xiaobo55x:syscall_test d44a8b1f827ed4081997af96cd58ba7449e0a9e1
PiperOrigin-RevId: 276740442
2019-10-25 12:40:36 -07:00
gVisor bot 5440fe96bc Internal change.
PiperOrigin-RevId: 274700093
2019-10-14 17:46:52 -07:00
Ian GudgerandgVisor bot 7cd7f6c0b0 Implement IP_TTL.
Also change the default TTL to 64 to match Linux.

PiperOrigin-RevId: 273430341
2019-10-07 19:29:51 -07:00