26 Commits
Author SHA1 Message Date
Fangrui SongandgVisor bot 0fafb2be8a Align buffer for cmsg
`char control[CMSG_SPACE(sizeof(*out_cmsg_value)) + 1];` is not aligned as
cmsghdr. Accessing its member may lead to a -fsanitize=alignment failure.
Align `control` to struct cmsghdr to fix the issue.

PiperOrigin-RevId: 555951052
2023-08-11 07:54:10 -07:00
Arthur SfezandgVisor bot 1d2822917b Support receiving ttl/hoplimit control message
PiperOrigin-RevId: 429096959
2022-02-16 11:27:21 -08:00
Arthur SfezandgVisor bot 7ea73a6830 Support receiving PKTINFO on icmp endpoints
PiperOrigin-RevId: 428599075
2022-02-14 13:51:49 -08:00
Arthur SfezandgVisor bot 9a87142f27 Simplify TOS and TClass UDP tests
This adds helpers to send both of these control messages via sendmsg,
and most of the initialization is moved into the SetUp body.

The parametrization is now more meaningful. The kDualStack is actually
impactful, which means DifferentTOSAndTClass test has been removed. The
IPv4-mapped IPv6 scenario is now tested in the SetAndReceiveTOSOrTClass.

PiperOrigin-RevId: 426313619
2022-02-03 21:57:29 -08:00
Arthur SfezandgVisor bot 60f5caa026 Add TOS control message for ICMP & RAW sockets
PiperOrigin-RevId: 426208980
2022-02-03 12:19:06 -08:00
Tamir DubersteinandgVisor bot 76cc64da84 Centralize skip logic
- Inline `IfAddrHelper` into its sole user
- Implement pretty-printing `sockaddr_ll`
- Make test class members private, add const accessors
- Log all interface addresses on SetUp for b/137899561

Simplify some things while I'm here.

PiperOrigin-RevId: 401112402
2021-10-05 17:40:22 -07:00
Ghanan GowripalanandgVisor bot e5dbf18828 Compose raw IP with datagram-based endpoint
A raw IP endpoint's write and socket option get/set path can use the
datagram-based endpoint.

This change extracts tests from UDP that may also run on Raw IP sockets.

Updates #6565.
Test: Raw IP + datagram-based socket syscall tests.
PiperOrigin-RevId: 396729727
2021-09-14 18:38:46 -07:00
Sam BalanaandgVisor bot ded8aca3d1 Add bind syscall tests for ICMP and ICMPv6
Updates #5711
Updates #6021
Updates #6022

PiperOrigin-RevId: 377582446
2021-06-04 13:53:17 -07:00
Adam BarthandgVisor bot 951bdf54e3 Make many tests build with NDK.
Not all the tests build yet, but many of them do now.

PiperOrigin-RevId: 375209824
2021-05-21 20:20:49 -07:00
Ting-Yu WangandgVisor bot 23b216cf97 Use if_nametoindex to get interface index.
Removed the TODO to use netlink.

PiperOrigin-RevId: 306721468
2020-04-15 14:31:36 -07:00
Ting-Yu WangandgVisor bot 7bea9be2c9 Make some functions in IfAddrHelper const.
PiperOrigin-RevId: 305782490
2020-04-09 16:22:02 -07:00
Ian GudgerandgVisor bot f6a579e138 Add socket connection stress test.
Tests 65k connection attempts on common types of sockets to check for port
leaks.

Also fixes a bug where dual-stack sockets wouldn't properly re-queue
segments received while closing.

PiperOrigin-RevId: 293241166
2020-02-04 15:54:49 -08: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
Tamir DubersteinandgVisor bot 14a81d39a0 Take addresses as const
PiperOrigin-RevId: 288767927
2020-01-08 13:54:19 -08:00
Adin ScannellandgVisor bot 3b8d99f217 Import and structure cleanup.
PiperOrigin-RevId: 281795269
2019-11-21 11:41:30 -08: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
Jianfeng Tan f12ef5f53f Implement /proc/net/tcp6
Fixes: #829

Signed-off-by: Jianfeng Tan <[email protected]>
Signed-off-by: Jielong Zhou <[email protected]>
2019-09-20 17:20:08 +00:00
Rahat MahmoodandgVisor bot 1d5c2c4bf3 Implement /proc/net/udp.
PiperOrigin-RevId: 266229756
2019-08-29 14:30:41 -07:00
Chris KuiperandgVisor bot 575727d271 Handle interfaceAddr and NIC options separately for IP_MULTICAST_IF
This tweaks the handling code for IP_MULTICAST_IF to ignore the InterfaceAddr
if a NICID is given.

PiperOrigin-RevId: 258982541
2019-07-19 09:29:04 -07:00
Rahat MahmoodandShentubot 05ff1ffaad Implement getsockopt() SO_DOMAIN, SO_PROTOCOL and SO_TYPE.
SO_TYPE was already implemented for everything but netlink sockets.

PiperOrigin-RevId: 253138157
2019-06-13 17:24:51 -07:00
Michael PrattandShentubot 4d52a55201 Change copyright notice to "The gVisor Authors"
Based on the guidelines at
https://opensource.google.com/docs/releasing/authors/.

1. $ rg -l "Google LLC" | xargs sed -i 's/Google LLC.*/The gVisor Authors./'
2. Manual fixup of "Google Inc" references.
3. Add AUTHORS file. Authors may request to be added to this file.
4. Point netstack AUTHORS to gVisor AUTHORS. Drop CONTRIBUTORS.

Fixes #209

PiperOrigin-RevId: 245823212
Change-Id: I64530b24ad021a7d683137459cafc510f5ee1de9
2019-04-29 14:26:23 -07:00
Nicolas LacasseandShentubot f4ce43e1f4 Allow and document bug ids in gVisor codebase.
PiperOrigin-RevId: 245818639
Change-Id: I03703ef0fb9b6675955637b9fe2776204c545789
2019-04-29 14:04:14 -07:00
Amanda TaitandShentubot ea070b9d5f Implement Broadcast support
This change adds support for the SO_BROADCAST socket option in gVisor Netstack.
This support includes getsockopt()/setsockopt() functionality for both UDP and
TCP endpoints (the latter being a NOOP), dispatching broadcast messages up and
down the stack, and route finding/creation for broadcast packets. Finally, a
suite of tests have been implemented, exercising this functionality through the
Linux syscall API.

PiperOrigin-RevId: 234850781
Change-Id: If3e666666917d39f55083741c78314a06defb26c
2019-02-20 12:54:13 -08:00
Ian GudgerandShentubot 80f901b16b Plumb IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP to netstack.
Also includes a few fixes for IPv4 multicast support. IPv6 support is coming in
a followup CL.

PiperOrigin-RevId: 233008638
Change-Id: If7dae6222fef43fda48033f0292af77832d95e82
2019-02-07 23:15:23 -08:00
Brian GeffonandShentubot d3bc79bc84 Open source system call tests.
PiperOrigin-RevId: 224886231
Change-Id: I0fccb4d994601739d8b16b1d4e6b31f40297fb22
2018-12-10 14:42:34 -08:00