24 Commits

Author SHA1 Message Date
Ayush Ranjan 7caf38420a Ensure RST TCP flag is set in raw socket tests.
Without this flag, the TCP stack will generate RST packets which will lead to
unexpected results.

PiperOrigin-RevId: 574936122
2023-10-19 11:06:43 -07:00
Ayush Ranjan c0a9bb7b3a Additionally expect the custom tos/tclass in TOS_TCLASS_EXPECT_DEFAULT case.
PiperOrigin-RevId: 565458888
2023-09-14 13:25:12 -07:00
Nicolas Lacasse f37b20c011 hostinet: Support ping and raw sockets.
PiperOrigin-RevId: 513902015
2023-03-04 00:40:01 -08:00
Arthur Sfez 21dffa8f4c Support sending TTL and HopLimit
PiperOrigin-RevId: 430554985
2022-02-23 15:40:37 -08:00
Arthur Sfez 86ad7d5b58 Support receiving ttl/hoplimit control message
PiperOrigin-RevId: 429096959
2022-02-16 11:27:21 -08:00
Arthur Sfez 4a94302baf Support receiving PKTINFO on icmp endpoints
PiperOrigin-RevId: 428599075
2022-02-14 13:51:49 -08:00
Ghanan Gowripalan 029554dc3c Support SO_BINDTODEVICE on raw endpoints
PiperOrigin-RevId: 428056402
2022-02-11 11:59:05 -08:00
Arthur Sfez 2d9f7fc7ea Add TOS control message for ICMP & RAW sockets
PiperOrigin-RevId: 426208980
2022-02-03 12:19:06 -08:00
Ghanan Gowripalan b488df0a2f Support SOL_IPV6 -> IPV6_CHECKSUM
PiperOrigin-RevId: 419164074
2021-12-31 21:33:15 -08:00
Ghanan Gowripalan 4ea18a8a7b Support IP_PKTINFO and IPV6_RECVPKTINFO on raw sockets
Updates #1584, #3556.

PiperOrigin-RevId: 402354066
2021-10-11 11:46:54 -07:00
Ghanan Gowripalan 5593b8a7e6 Don't use SOL_UDP when creating sockets
SOL_UDP is used when get/set-ing socket options to specify the socket
level. When creating normal UDP sockets, the protocol need not be
specified. When creating RAW IP sockets for UDP, use IPPROTO_UDP.

PiperOrigin-RevId: 396675986
2021-09-14 14:03:53 -07:00
Ghanan Gowripalan 226e7d32cb Accept packets destined to bound address
...if bound to an address.

We previously checked the source of a packet instead of the destination
of a packet when bound to an address.

PiperOrigin-RevId: 396497647
2021-09-13 19:42:55 -07:00
Ghanan Gowripalan d51bc877f4 Run packet socket tests on Fuchsia
+ Do not check for CAP_NET_RAW on Fuchsia

  Fuchsia does not support capabilities the same way Linux does. Instead
  emulate the check for CAP_NET_RAW by checking if a packet socket may
  be created.

Bug: https://fxbug.dev/79016, https://fxbug.dev/81592
PiperOrigin-RevId: 390263666
2021-08-11 18:21:40 -07:00
Ghanan Gowripalan 34ec00c5e7 Run raw IP socket syscall tests on Fuchsia
+ Do not check for CAP_NET_RAW on Fuchsia

  Fuchsia does not support capabilities the same way Linux does. Instead
  emulate the check for CAP_NET_RAW by checking if a raw IP sockets may
  be created.

PiperOrigin-RevId: 389663218
2021-08-09 10:20:21 -07:00
Ghanan Gowripalan aa26981700 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
Ghanan Gowripalan 9e805ce937 Expose local address from raw sockets
PiperOrigin-RevId: 385940836
2021-07-20 22:50:16 -07:00
Nayana Bidari 3fff4c4a0f Move SO_RCVBUF to socketops.
Fixes #2926, #674

PiperOrigin-RevId: 369457123
2021-04-20 09:32:54 -07:00
Nayana Bidari daf0d3f6ca Move SO_SNDBUF to socketops.
This CL moves {S,G}etsockopt of SO_SNDBUF from all endpoints to socketops. For
unix sockets, we do not support setting of this option.

PiperOrigin-RevId: 353871484
2021-01-26 08:25:34 -08:00
Nayana Bidari b15acae9a6 Fix error code for connect in raw sockets.
PiperOrigin-RevId: 347650354
2020-12-15 11:07:48 -08:00
Nayana Bidari d45420b152 Fix panic when IPv4 address is used in sendmsg for IPv6 sockets
We do not rely on error for getsockopt options(which have boolean values)
anymore. This will cause issue in sendmsg where we used to return error
for IPV6_V6Only option. Fix the panic by returning error (for sockets other
than TCP and UDP) if the address does not match the type(AF_INET/AF_INET6) of
the socket.

PiperOrigin-RevId: 347063838
2020-12-11 13:31:28 -08:00
Tamir Duberstein 9d0d82088a Remove __fuchsia__ defines
These mostly guard linux-only headers; check for linux instead.

PiperOrigin-RevId: 329362762
2020-08-31 13:10:56 -07:00
Bhasker Hariharan 20b556e625 Fix wildcard bind for raw socket.
Fixes #3334

PiperOrigin-RevId: 322846384
2020-07-23 12:54:12 -07:00
Bhasker Hariharan 216dcebc06 Stub out SO_DETACH_FILTER.
Updates #2746

PiperOrigin-RevId: 320757963
2020-07-11 06:22:47 -07:00
Kevin Krakauer 66d1665441 IPv6 raw sockets. Needed for ip6tables.
IPv6 raw sockets never include the IPv6 header.

PiperOrigin-RevId: 318582989
2020-06-26 19:07:02 -07:00