History log of /src/sys/compat/linux/linux_socket.c (Results 1 – 25 of 996)
Revision Date Author Comments
# 47b27326 15-Oct-2025 Gleb Smirnoff <glebius@FreeBSD.org>

linux: add translation for MCAST_JOIN_GROUP family of socket options

Differential Revision: https://reviews.freebsd.org/D52937


# 10b789d7 29-Aug-2025 Olivier Certner <olce@FreeBSD.org>

linux: getsockopt(): Simplify exporting groups a bit

No functional change (intended).

Go through conversion to a 'l_gid_t' before copying out in order to cope
with differing group types (except for

linux: getsockopt(): Simplify exporting groups a bit

No functional change (intended).

Go through conversion to a 'l_gid_t' before copying out in order to cope
with differing group types (except for not representable values, of
course). This is what is done, e.g., for getgroups() in 'linux_misc.c'.
As Linux's group type is the same as ours on all architectures, we could
as well just stop bothering and copy out our memory representation,
eliminating the loop here. Whatever the choice, though, it has to be
consistent here and there.

Introduce 'out' of type 'l_gid_t' to avoid performing "by hand" array
arithmetics when copying out.

MFC after: 5 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52280

show more ...


# 186dc094 10-Mar-2025 Alex S <iwtcex@gmail.com>

linux: Handle IP_RECVTOS cmsg type

This unbreaks apps using GameNetworkingSockets from Valve.


# 9f55630b 10-Mar-2025 Alex S <iwtcex@gmail.com>

linux: Fix a typo in linux_recvmsg_common

We are supposed to check the result of bsd_to_linux_sockopt_level here
rather than its input.


# a43b745a 13-Nov-2024 Mark Johnston <markj@FreeBSD.org>

linux sendfile: Fix handling of non-blocking sockets

FreeBSD sendfile() may perform a partial transfer and return EAGAIN if
the socket is non-blocking. Linux sendfile() expects no error in this
cas

linux sendfile: Fix handling of non-blocking sockets

FreeBSD sendfile() may perform a partial transfer and return EAGAIN if
the socket is non-blocking. Linux sendfile() expects no error in this
case, so squash EAGAIN.

PR: 282495
Tested by: pieter@krikkit.xyz
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D47447

show more ...


# 13a5a46c 29-Apr-2024 Andrew Gallatin <gallatin@FreeBSD.org>

Fix new users of MAXPHYS and hide it from the kernel namespace

In cd8537910406, kib made maxphys a load-time tunable. This made
the #define MAXPHYS in sys/param.h almost entirely obsolete, as
it c

Fix new users of MAXPHYS and hide it from the kernel namespace

In cd8537910406, kib made maxphys a load-time tunable. This made
the #define MAXPHYS in sys/param.h almost entirely obsolete, as
it could now be overridden by kern.maxphys at boot time, or by
opt_maxphys.h.

However, decades of tradition have led to several new, incorrect, uses
of MAXPHYS in other parts of the kernel, mostly by seasoned
developers. I've corrected those uses here in a mechanical fashion,
and verified that it fixes a bug in the md driver that I was
experiencing.

Since using MAXPHYS is such an easy mistake to make, it is best to
hide it from the kernel namespace. So I've moved its definition to
_maxphys.h, which is now included in param.h only for userspace.

That brings up the fact that lots of userspace programs use MAXPHYS
for different reasons, most of them probably wrong. Userspace consumers
that really need to know the value of maxphys should probably be
changed to use the kern.maxphys sysctl. But that's outside the scope
of this change.

Reviewed by: imp, jkim, kib, markj
Fixes: 30038a8b4efc ("md: Get rid of the pbuf zone")
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D44986

show more ...


# ca63710d 22-Apr-2024 Lexi Winter <lexi@le-Fay.ORG>

linux: ignore setsockopt(IPV6_RECVERR)

Under Linux, the socket options IP_RECVERR and IPV6_RECVERR are used to
receive socket errors via a dedicated 'error queue' which can be
retrieved via recvmsg(

linux: ignore setsockopt(IPV6_RECVERR)

Under Linux, the socket options IP_RECVERR and IPV6_RECVERR are used to
receive socket errors via a dedicated 'error queue' which can be
retrieved via recvmsg(). FreeBSD does not support this functionality.

For IPv4, the sysctl compat.linux.ignore_ip_recverr can be set to 1 to
silently ignore attempts to set IP_RECVERR and return success to the
application, which is wrong, but is required for (among other things)
a functional DNS client in recent versions of glibc.

Add support for ignoring IPV6_RECVERR, controlled by the same sysctl.
This fixes DNS in Linux when using IPv6 resolvers.

Reviewed by: imp, Jose Luis Duran
Pull Request: https://github.com/freebsd/freebsd-src/pull/1118

show more ...


# 9d4a08d1 29-Mar-2024 Gleb Smirnoff <glebius@FreeBSD.org>

linux: use sa_family_t for address family conversions

Express "conversion failed" with maximum possible value. This allows to
reduce number of size/signedness conversion in the code that utilizes t

linux: use sa_family_t for address family conversions

Express "conversion failed" with maximum possible value. This allows to
reduce number of size/signedness conversion in the code that utilizes the
functions.

PR: 274536
Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D44375

show more ...


# f27aff8f 27-Dec-2023 Gleb Smirnoff <glebius@FreeBSD.org>

linux/netlink: don't override sopt level

This override effectively prevents correct entering of netlink
protocol specific pr_ctloutput in sosetopt().

Reviewed by: melifaro
Differential Revision: h

linux/netlink: don't override sopt level

This override effectively prevents correct entering of netlink
protocol specific pr_ctloutput in sosetopt().

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D42520

show more ...


# 0fac350c 30-Nov-2023 Gleb Smirnoff <glebius@FreeBSD.org>

sockets: don't malloc/free sockaddr memory on getpeername/getsockname

Just like it was done for accept(2) in cfb1e92912b4, use same approach
for two simplier syscalls that return socket addresses.

sockets: don't malloc/free sockaddr memory on getpeername/getsockname

Just like it was done for accept(2) in cfb1e92912b4, use same approach
for two simplier syscalls that return socket addresses. Although,
these two syscalls aren't performance critical, this change generalizes
some code between 3 syscalls trimming code size.

Following example of accept(2), provide VNET-aware and INVARIANT-checking
wrappers sopeeraddr() and sosockaddr() around protosw methods.

Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D42694

show more ...


# cfb1e929 30-Nov-2023 Gleb Smirnoff <glebius@FreeBSD.org>

sockets: don't malloc/free sockaddr memory on accept(2)

Let the accept functions provide stack memory for protocols to fill it in.
Generic code should provide sockaddr_storage, specialized code may

sockets: don't malloc/free sockaddr memory on accept(2)

Let the accept functions provide stack memory for protocols to fill it in.
Generic code should provide sockaddr_storage, specialized code may provide
smaller structure.

While rewriting accept(2) make 'addrlen' a true in/out parameter, reporting
required length in case if provided length was insufficient. Our manual
page accept(2) and POSIX don't explicitly require that, but one can read
the text as they do. Linux also does that. Update tests accordingly.

Reviewed by: rscheff, tuexen, zlei, dchagin
Differential Revision: https://reviews.freebsd.org/D42635

show more ...


# 524c9acc 20-Aug-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Replace linux32_copyiniov by freebsd32_copyiniov

MFC after: 1 month


# 4f9fac78 19-Aug-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Return EAGAIN instead of ENOBUFS for non-blocking sockets in sendfile

MFC after: 1 month


# da5a6738 19-Aug-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Allow in fd to be a socket in sendfile

In this case sendfile fallback is used.

MFC after: 1 month


# 3460fab5 18-Aug-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Remove sys/cdefs.h inclusion where it's not needed due to 685dc743


# 6ecab394 17-Aug-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Drop bogus __arm__ condition due to lack of 32-bit arm support

MFC after: 1 month


# 4a521544 17-Aug-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Don't miss error from underlying in sendfile

MFC after: 1 month


# bb66c597 17-Aug-2023 James McLaughlin <james_mclgh.net>

linux(4): Add sendfile fallback for non-socket fds

Before Linux 2.6.33, out_fd must refer to a socket. Since Linux 2.6.33
it can be any file.
The patch was originally provided by James McLaughlin an

linux(4): Add sendfile fallback for non-socket fds

Before Linux 2.6.33, out_fd must refer to a socket. Since Linux 2.6.33
it can be any file.
The patch was originally provided by James McLaughlin and adapted by me
for copy_file_range.

PR: 262535
Differential revision: https://reviews.freebsd.org/D34555
MFC after: 1 month

show more ...


# 7307c439 17-Aug-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Use native off_t for fo_sendfile call

MFC after: 1 month


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 2467ccdd 14-Aug-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Fix MSG_CTRUNC handling in recvmsg()

The MSG_CTRUNC flag of the msg_flags member of the message header is
set uppon successful completition if the control data was truncated.
Upon return f

linux(4): Fix MSG_CTRUNC handling in recvmsg()

The MSG_CTRUNC flag of the msg_flags member of the message header is
set uppon successful completition if the control data was truncated.
Upon return from a successful call msg_controllen should contain the
length of the control message sequence.

Fixes: 0eda2cea
MFC after: 1 week

show more ...


# 9d0c9b6d 14-Aug-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Add a comment explaining udata freeing on error

MFC after: 1 week


# de20eb26 14-Aug-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Refactor recvmsg

As the amount of handled anxiliary messages grows move they handlers
into a separate functions.

MFC after: 1 week


# bbaa5523 14-Aug-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Skip unsupported anxiliary message

Instead of returning error, skip unsupported anxiliary messages and
fail if no one handled.

MFC after: 1 week


# a21238d8 14-Aug-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Improve readability of recvmsg control buffer copyout code

MFC after: 1 week


12345678910>>...40