#
2780e5f4 |
| 28-May-2024 |
Gleb Smirnoff <glebius@FreeBSD.org> |
linux: allow RTM_GETADDR without full ifaddrmsg argument
Even modern glibc uses truncated argument for RTM_GETADDR when it wants to list all addresses in a system. See sysdeps/unix/sysv/linux/ifadd
linux: allow RTM_GETADDR without full ifaddrmsg argument
Even modern glibc uses truncated argument for RTM_GETADDR when it wants to list all addresses in a system. See sysdeps/unix/sysv/linux/ifaddrs.c:__netlink_sendreq(). It sends a one char payload. Linux kernel allows that as long as given socket is not marked as a 'strict'. We have a similar flag in the general netlink code and it is checked in sys/netlink/netlink_message_parser.h:nl_parse_header(). If the flag is not present, parser will allocate a temporary zeroed buffer to make the message correct. The checks added in b977dd1ea5fb blocked such message before the parser. My reading of glibc says that there are two types of messages that are sent with __netlink_sendreq() - RTM_GETLINK and RTM_GETADDR. The RTM_GETLINK is binary compatible between Linux and FreeBSD and thus doesn't need any ABI handler.
PR: 279012 Fixes: b977dd1ea5fbc2df3f1279330be4d089322eb2cf
show more ...
|
#
b977dd1e |
| 29-Mar-2024 |
Gleb Smirnoff <glebius@FreeBSD.org> |
linux: make linux_netlink_p->msg_from_linux be able to fail
The KPI for this function was misleading. From the NetLink perspective it looked like a function that: a) allocates new hdr, b) can fail.
linux: make linux_netlink_p->msg_from_linux be able to fail
The KPI for this function was misleading. From the NetLink perspective it looked like a function that: a) allocates new hdr, b) can fail. Neither was true. Let the function return a error code instead of returning the same hdr it was passed to. In case if future Linux NetLink compatibility support calls for reallocating header, pass hdr as pointer to pointer.
With KPI that returns a error, propagate domain conversion errors all the way up to NetLink module. This fixes panic when unknown domain is converted to 0xff and this invalid value is passed into NetLink processing.
PR: 274536 Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D44392
show more ...
|
Revision tags: release/13.3.0 |
|
#
41ce9c8b |
| 27-Feb-2024 |
Gleb Smirnoff <glebius@FreeBSD.org> |
netlink: restore original buffer if nlmsgs_to_linux() fails
Caller is responsible to free it or reuse.
Fixes: 17083b94a91563aba15ba03d1c74796a35bb1c26
|
#
17083b94 |
| 02-Jan-2024 |
Gleb Smirnoff <glebius@FreeBSD.org> |
netlink: use protocol specific receive buffer
Implement Netlink socket receive buffer as a simple TAILQ of nl_buf's, same part of struct sockbuf that is used for send buffer already. This shaves a l
netlink: use protocol specific receive buffer
Implement Netlink socket receive buffer as a simple TAILQ of nl_buf's, same part of struct sockbuf that is used for send buffer already. This shaves a lot of code and a lot of extra processing. The pcb rids of the I/O queues as the socket buffer is exactly the queue. The message writer is simplified a lot, as we now always deal with linear buf. Notion of different buffer types goes away as way as different kinds of writers. The only things remaining are: a socket writer and a group writer. The impact on the network stack is that we no longer use mbufs, so a workaround from d18715475071 disappears.
Note on message throttling. Now the taskqueue throttling mechanism needs to look at both socket buffers protected by their respective locks and on flags in the pcb that are protected by the pcb lock. There is definitely some room for optimization, but this changes tries to preserve as much as possible.
Note on new nl_soreceive(). It emulates soreceive_generic(). It must undergo further optimization, see large comment put in there.
Note on tests/sys/netlink/test_netlink_message_writer.py. This test boiled down almost to nothing with mbufs removed. However, I left it with minimal functionality (it basically checks that allocating N bytes we get N bytes) as it is one of not so many examples of ktest framework that allows to test KPIs with python.
Note on Linux support. It got much simplier: Netlink message writer loses notion of Linux support lifetime, it is same regardless of process ABI. On socket write from Linux process we perform conversion immediately in nl_receive_message() and on an output conversion to Linux happens in in nl_send_one(). XXX: both conversions use M_NOWAIT allocation, which used to be the case before this change, too.
Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D42524
show more ...
|
Revision tags: release/14.0.0 |
|
#
ab393e95 |
| 12-Oct-2023 |
Kristof Provost <kp@FreeBSD.org> |
netlink: move NETLINK define to opt_global.h
Move the NETLINK define into opt_global.h so we can rely on it being set correctly, without having to remember to include opt_netlink.h. This ensures tha
netlink: move NETLINK define to opt_global.h
Move the NETLINK define into opt_global.h so we can rely on it being set correctly, without having to remember to include opt_netlink.h. This ensures that the NETLINK define is correctly set. If not we may end up with unloadable modules, due to missing symbols (such as nlmsg_get_group_writer).
PR: 274306 Reviewed by: imp, markj MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D42179
show more ...
|
#
3460fab5 |
| 18-Aug-2023 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Remove sys/cdefs.h inclusion where it's not needed due to 685dc743
|
#
685dc743 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
#
7ff9ae90 |
| 03-Aug-2023 |
Marius Strobl <marius@FreeBSD.org> |
iflib(9): Remove support for cloning pseudo interfaces
This code was used by the first incarnation of wg(4) and is dead ever since f187d6dfbf633665ba6740fe22742aec60ce02a2 has removed the latter aga
iflib(9): Remove support for cloning pseudo interfaces
This code was used by the first incarnation of wg(4) and is dead ever since f187d6dfbf633665ba6740fe22742aec60ce02a2 has removed the latter again. Moreover, this code matched iflib(4) like a square peg fits in a round hole, was incomplete and despite some hacks still tailored to VPC and wg(4) but not generic. In effect, this reverts the following: 09f6ff4f1a47c3009dc16fdc609a44f2341bc7ac (w/ its "ancillary changes") 9aeca21324f481f57f2ecb7009f461f4f51b62b3 1f93e931d9f0c688f43f98ef777e04636a325526 0f9544d03e89d180f94a7a84b110ec7d2b6c625a 0dd691b41276ce13d25ffb1443af27f85038aa3f
Reviewed by: erj, kbowling Differential Revision: <https://reviews.freebsd.org/D41196>
show more ...
|
#
4d846d26 |
| 10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
show more ...
|
#
fa554de7 |
| 11-May-2023 |
Kristof Provost <kp@FreeBSD.org> |
netlink: reduce default log levels
Reduce the default log level for netlink to LOG_INFO. This removes a number of messages such as
> [nl_iface] dump_sa: unsupported family: 0, skipping or > [nl_ifa
netlink: reduce default log levels
Reduce the default log level for netlink to LOG_INFO. This removes a number of messages such as
> [nl_iface] dump_sa: unsupported family: 0, skipping or > [nl_iface] get_operstate_ether: error calling SIOCGIFMEDIA on vlan0: 22
that are useful for debugging, but not for most users.
Reviewed by: melifaro Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D40062
show more ...
|
#
a6b55ee6 |
| 17-Apr-2023 |
Gleb Smirnoff <glebius@FreeBSD.org> |
net: replace IFF_KNOWSEPOCH with IFF_NEEDSEPOCH
Expect that drivers call into the network stack with the net epoch entered. This has already been the fact since early 2020. The net interrupts, that
net: replace IFF_KNOWSEPOCH with IFF_NEEDSEPOCH
Expect that drivers call into the network stack with the net epoch entered. This has already been the fact since early 2020. The net interrupts, that are marked with INTR_TYPE_NET, were entering epoch since 511d1afb6bf. For the taskqueues there is NET_TASK_INIT() and all drivers that were known back in 2020 we marked with it in 6c3e93cb5a4. However in e87c4940156 we took conservative approach and preferred to opt-in rather than opt-out for the epoch.
This change not only reverts e87c4940156 but adds a safety belt to avoid panicing with INVARIANTS if there is a missed driver. With INVARIANTS we will run in_epoch() check, print a warning and enter the net epoch. A driver that prints can be quickly fixed with the IFF_NEEDSEPOCH flag, but better be augmented to properly enter the epoch itself.
Note on TCP LRO: it is a backdoor to enter the TCP stack bypassing some layers of net stack, ignoring either old IFF_KNOWSEPOCH or the new IFF_NEEDSEPOCH. But the tcp_lro_flush_all() asserts the presence of network epoch. Indeed, all NIC drivers that support LRO already provide the epoch, either with help of INTR_TYPE_NET or just running NET_EPOCH_ENTER() in their code.
Reviewed by: zlei, gallatin, erj Differential Revision: https://reviews.freebsd.org/D39510
show more ...
|
Revision tags: release/13.2.0 |
|
#
b8941935 |
| 27-Mar-2023 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
netlink: fix linux module build w/ netlink.
Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl> MFC after: 2 weeks
|
#
e55e4a6b |
| 23-Feb-2023 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Fixup the interface name translation in netlink
Netlink should translate a FreeBSD interface name to a Linux interface name.
Reviewed by: melifaro Differential Revision: https://reviews.
linux(4): Fixup the interface name translation in netlink
Netlink should translate a FreeBSD interface name to a Linux interface name.
Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D38715 MFC after: 3 days
show more ...
|
#
200fe6e3 |
| 23-Feb-2023 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Use predefined constant instead of hardcoded value
Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D38713 MFC after: 3 days
|
#
d8e53d94 |
| 14-Feb-2023 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Cleanup includes under compat/linux
Cleanup unneeded includes, sort the rest according to style(9). No functional changes.
MFC after: 2 weeks
|
Revision tags: release/12.4.0 |
|
#
43d0c2dd |
| 27-Oct-2022 |
Ed Maste <emaste@FreeBSD.org> |
netlink: use (void) for function definitions with no arguments
For some of these Clang produced a warning that "a function declaration without a prototype is deprecated in all versions of C". In ot
netlink: use (void) for function definitions with no arguments
For some of these Clang produced a warning that "a function declaration without a prototype is deprecated in all versions of C". In other cases the function defintion used () which did not match the header declaration, which used (void).
Sponsored by: The FreeBSD Foundation
show more ...
|
#
7c40e2d5 |
| 26-Aug-2022 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
linuxolator: add netlink support
Add the glue code to support netlink in Linuxolator. linux_common(4) now depends on netlink(4).
All netlink protocol constants are consistent with the Linux version
linuxolator: add netlink support
Add the glue code to support netlink in Linuxolator. linux_common(4) now depends on netlink(4).
All netlink protocol constants are consistent with the Linux version. However, certain OS-specific constants such as AF_INET6, interface flags or default routing table id, are different between FreeBSD and Linux. Thus, it may be needed to rewrite some message parts or even rewrite the whole message, adding or removing some TLVs. The core netlink implementation code provides efficient rewriting callbacks which Linuxolator now uses.
Reviewed by: dchagin Differential Revision: https://reviews.freebsd.org/D36361 MFC after: 2 months
show more ...
|