summaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_socket.h
AgeCommit message (Collapse)Author
2023-08-17linux(4): Drop bogus __arm__ condition due to lack of 32-bit arm supportDmitry Chagin
MFC after: 1 month
2023-08-16sys: Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-03-04linux(4): Rename struct l_ifreq members names to avoid conflicts with FreeBSDDmitry Chagin
For now we are using mixed names to access struct ifreq members, some of Linux (ifr_name, ifr_ifindex), others of FreeBSD. To avoid conflicts switch to use FreeBSD names. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D38792
2023-03-04linux(4): Reduce code duplication between MD filesDmitry Chagin
Move struct ifnet definitions under compat/linux. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D38791
2022-05-28linux(4): Handle IP_ORIGDSTADDR socket option for IPPROTO_IP protocol levelDmitry Chagin
MFC after: 2 weeks
2022-05-28linux(4): Handle SO_TIMESTAMPNS socket optionDmitry Chagin
The SO_TIMESTAMPNS enables or disables the receiving of the SCM_TIMESTAMPNS control message. The cmsg_data field is a struct timespec. To distinguish between SO_TIMESTAMP and SO_TIMESTAMPNS in the recvmsg() map the last one to the SO_BINTIME and convert bintime to the timespec. In the rest, implementation is identical to the SO_TIMESTAMP. MFC after: 2 weeks
2022-05-28linux(4): Handle 64-bit SO_TIMESTAMP for 32-bit binariesDmitry Chagin
To solve y2k38 problem in the recvmsg syscall the new SO_TIMESTAMP constant were added on v5.1 Linux kernel. So, old 32-bit binaries that knows only 32-bit time_t uses the old value of the constant, and binaries that knows 64-bit time_t uses the new constant. To determine what size of time_t type is expected by the user-space, store requested value (SO_TIMESTAMP) in the process emuldata structure. MFC after: 2 weeks
2022-05-28linux(4): For future use move SCM definitions below socket optionsDmitry Chagin
MFC after: 2 weeks
2022-04-11linux(4): Handle SO_DOMAIN in getsockopt syscall.Dmitry Chagin
Differential revision: https://reviews.freebsd.org/D34714
2021-10-17linux: recognize TCP_INFO and ratelimit the warningEdward Tomasz Napierala
This ratelimits the "unsupported getsockopt level 6 optname 11" warnings that happen all the time when watching Netflix. Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D32454
2021-03-06linux: add support for SO_PEERGROUPSEdward Tomasz Napierala
The su(8) and sudo(8) from Ubuntu Bionic use it. Sponsored By: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28165
2021-02-07linux: add support for SO_PEERSEC getsockoptEdward Tomasz Napierala
It returns "unconfined", like Linux without SELinux would. Sponsored By: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28164
2020-11-08 - add more linux socket options (sorted by value)Alexander Leidinger
- map those IPv4 / IPv6 socket options which exist in FreeBSD + most of them visually verified to have the same type/layout of arguments + not tested with linux programs to behave as intended - be more human readable for known options which are not handled - be more verbose for unhandled socket message flags we know about - print the jail ID in linux_msg if run in a jail - add possibility to print debug message about known missing parts only once - add multiple levels of sysctl linux.debug: 1: print debug messages, tell about unimplemented stuff (only once) 2: like 1, but also print messages about implemented but not tested stuff (only once) 3+: like 2, but no rate limiting of messages - increase default linux debug level from 1 to 3 We are a lot more verbose in as we need to be (e.g. some of the IP socket options which are the same, and share the same memory layout, and are believed to work). The reason is that we have no good testsuite to test those linux-bits. The LTP or other test suites like the python one, are not fully up to the task we need. As such the excessive messages about emulated but not tested socket options. IMO any MFC (possible, but most probably not by me) should set the default debug level to 1. Discussed with: trasz Notes: svn path=/head/; revision=367481
2020-06-28Make linux(4) support SO_PROTOCOL. Running Python test suiteEdward Tomasz Napierala
with python3.8 from Focal triggers those. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25491 Notes: svn path=/head/; revision=362735
2020-06-12Minor code cleanup; no functional changes.Edward Tomasz Napierala
MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25232 Notes: svn path=/head/; revision=362101
2020-06-11Make linux(4) handle SO_REUSEPORT.Edward Tomasz Napierala
Reviewed by: emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25216 Notes: svn path=/head/; revision=362051
2020-06-10Support SO_SNDBUFFORCE/SO_RCVBUFFORCE by aliasing them to theEdward Tomasz Napierala
standard SO_SNDBUF/SO_RCVBUF. Mostly cosmetics, to get rid of the warning during 'apt upgrade'. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25173 Notes: svn path=/head/; revision=362014
2020-02-05linuxulator: implement sendfileEd Maste
Submitted by: Bora Özarslan <borako.ozarslan@gmail.com> Submitted by: Yang Wang <2333@outlook.jp> Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19917 Notes: svn path=/head/; revision=357577
2020-01-28Add TCP_CORK support to linux(4). This fixes one of the things NginxEdward Tomasz Napierala
trips over. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23171 Notes: svn path=/head/; revision=357203
2020-01-28Add compat.linux.ignore_ip_recverr sysctl. This is a workaroundEdward Tomasz Napierala
for missing IP_RECVERR setsockopt(2) support. Without it, DNS resolution is broken for glibc >= 2.30 (glibc BZ #24047). From the user point of view this fixes "yum update" on recent CentOS 8. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23234 Notes: svn path=/head/; revision=357202
2019-05-13Our bsd_to_linux_sockaddr() and linux_to_bsd_sockaddr() functionsDmitry Chagin
alter the userspace sockaddr to convert the format between linux and BSD versions. That's the minimum 3 of copyin/copyout operations for one syscall. Also some syscall uses linux_sa_put() and linux_getsockaddr() when load sockaddr to userspace or from userspace accordingly. To avoid this chaos, especially converting sockaddr in the userspace, rewrite these 4 functions to convert sockaddr only in kernel and leave only 2 of this functions. Also in order to reduce duplication between MD parts of the Linuxulator put struct sockaddr conversion functions that are MI out into linux_common module. PR: 232920 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20157 Notes: svn path=/head/; revision=347533
2018-02-05Linuxolator whitespace cleanupEd Maste
A version of each of the MD files by necessity exists for each CPU architecture supported by the Linuxolator. Clean these up so that new architectures do not inherit whitespace issues. Clean up shared Linuxolator files while here. Sponsored by: Turing Robotic Industries Inc. Notes: svn path=/head/; revision=328890
2017-11-27sys/compat: further adoption of SPDX licensing ID tags.Pedro F. Giffuni
Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326266
2017-03-18To reduce code duplication move socket defines to the MI path.Dmitry Chagin
MFC after: 1 week Notes: svn path=/head/; revision=315501
2017-03-04Hide Linux socketcall constants under corresponding #ifdef sinceDmitry Chagin
they are used only in i386 Linuxulator. MFC after: 1 week Notes: svn path=/head/; revision=314643
2017-02-18Finich r313684.Dmitry Chagin
Convert linux_recv(), linux_send() and linux_accept() system call arguments to the register_t type too. PR: 217161 MFC after: 3 days xMFC with: r313284,r313285,r313684 Notes: svn path=/head/; revision=313912
2017-02-05Update syscall.master to 4.10-rc6. Also fix comments, a typo,Dmitry Chagin
and wrong numbering for a few unimplemented syscalls. For 32-bit Linuxulator, socketcall() syscall was historically the entry point for the sockets API. Starting in Linux 4.3, direct syscalls are provided for the sockets API. Enable it. The initial version of patch was provided by trasz@ and extended by me. Submitted by: trasz MFC after: 2 week Differential Revision: https://reviews.freebsd.org/D9381 Notes: svn path=/head/; revision=313284
2016-04-30sys/compat/linux*: spelling fixes.Pedro F. Giffuni
Mostly on comments but there are some user-visible messages as well. MFC after: 2 weeks Notes: svn path=/head/; revision=298829
2016-03-09Add support for IPPROTO_IPV6 socket layer for getsockopt/setsockopt calls.Andrey V. Elsukov
Also add mapping for several options from RFC 3493 and 3542. Reviewed by: dchagin Tested by: Joe Love <joe at getsomwhere dot net> MFC after: 2 weeks Notes: svn path=/head/; revision=296557
2015-05-24Convert SCM_TIMESTAMP in recvmsg().Dmitry Chagin
Notes: svn path=/head/; revision=283497
2015-05-24Implement recvmmsg() and sendmmsg() system calls.Dmitry Chagin
Notes: svn path=/head/; revision=283488
2015-05-24Reduce duplication between MD Linux code by moving msg relatedDmitry Chagin
struct definitions out into the compat/linux/linux_socket.h Notes: svn path=/head/; revision=283487
2015-05-2464-bit paltforms, like x86_64, do not use multiplexing onDmitry Chagin
socketcall system calls. Differential Revision: https://reviews.freebsd.org/D1065 Reviewed by: trasz Notes: svn path=/head/; revision=283413
2013-01-29Reduce duplication between i386/linux/linux.h and amd64/linux32/linux.hJohn Baldwin
by moving bits that are MI out into headers in compat/linux. Reviewed by: Chagin Dmitry dmitry | gmail MFC after: 2 weeks Notes: svn path=/head/; revision=246085
2011-03-26linux compat: improve and fix sendmsg/recvmsg compatibilityAndriy Gapon
- implement baseic stubs for capget, capset, prctl PR_GET_KEEPCAPS and prctl PR_SET_KEEPCAPS. - add SCM_CREDS support to sendmsg and recvmsg - modify sendmsg to ignore control messages if not using UNIX domain sockets This should allow linux pulse audio daemon and client work on FreeBSD and interoperate with native counter-parts modulo the differences in pulseaudio versions. PR: kern/149168 Submitted by: John Wehle <john@feith.com> Reviewed by: netchild MFC after: 2 weeks Notes: svn path=/head/; revision=220031
2009-05-18Implement MSG_CMSG_CLOEXEC flag for linux_recvmsg().Dmitry Chagin
Approved by: kib (mentor) MFC after: 1 month Notes: svn path=/head/; revision=192284
2009-05-16Somewhere between 2.6.23 and 2.6.27, Linux added SOCK_CLOEXEC andDmitry Chagin
SOCK_NONBLOCK flags, that allow to save fcntl() calls. Implement a variation of the socket() syscall which takes a flags in addition to the type argument. Approved by: kib (mentor) MFC after: 1 month Notes: svn path=/head/; revision=192206
2009-05-16Return EINVAL in case when the incorrect or unsupportedDmitry Chagin
type argument is specified. Do not map type argument value as its Linux values are identical to FreeBSD values. Approved by: kib (mentor) Notes: svn path=/head/; revision=192205
2009-05-16Emulate SO_PEERCRED socket option.Dmitry Chagin
Temporarily use 0 for pid member as the FreeBSD does not cache remote UNIX domain socket peer pid. PR: kern/102956 Reviewed by: rwatson Approved by: kib (mentor) MFC after: 1 month Notes: svn path=/head/; revision=192203
2009-05-07To avoid excessive code duplication move MI definitions to the MIDmitry Chagin
header file. As it is defined in Linux. Approved by: kib (mentor) MFC after: 1 month Notes: svn path=/head/; revision=191876
2008-11-29Make linux_sendmsg() and linux_recvmsg() work on linux32/amd64.Konstantin Belousov
Change types used in the linux' struct msghdr and struct cmsghdr definitions to the properly-sized architecture-specific types. Move ancillary data handler from linux_sendit() to linux_sendmsg(). Submitted by: dchagin Notes: svn path=/head/; revision=185442
2002-06-02Fix typo in the BSD copyright: s/withough/without/Jens Schweikhardt
Spotted and suggested by: des MFC after: 3 weeks Notes: svn path=/head/; revision=97748
2000-12-19translate the flags in recvfrom and recvmsg from linux to bsd onesAssar Westerlund
Approved by: marcel Notes: svn path=/head/; revision=70178