]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
23 months agoCygwin: drop macro and code for CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK
Corinna Vinschen [Wed, 3 Aug 2022 13:48:56 +0000 (15:48 +0200)]
Cygwin: drop macro and code for CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: drop unused CYGWIN_VERSION_CHECK_FOR_S_IEXEC macro
Corinna Vinschen [Wed, 3 Aug 2022 13:39:14 +0000 (15:39 +0200)]
Cygwin: drop unused CYGWIN_VERSION_CHECK_FOR_S_IEXEC macro

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: drop macro and code for CYGWIN_VERSION_OLD_STDIO_CRLF_HANDLING
Corinna Vinschen [Wed, 3 Aug 2022 13:38:11 +0000 (15:38 +0200)]
Cygwin: drop macro and code for CYGWIN_VERSION_OLD_STDIO_CRLF_HANDLING

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: drop macro and code for CYGWIN_VERSION_DLL_MALLOC_ENV
Corinna Vinschen [Wed, 3 Aug 2022 13:35:07 +0000 (15:35 +0200)]
Cygwin: drop macro and code for CYGWIN_VERSION_DLL_MALLOC_ENV

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: drop macro and code for CYGWIN_VERSION_DLL_IS_OLD_TERMIOS
Corinna Vinschen [Wed, 3 Aug 2022 13:33:58 +0000 (15:33 +0200)]
Cygwin: drop macro and code for CYGWIN_VERSION_DLL_IS_OLD_TERMIOS

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: drop requirement to build newlib's stdio64
Corinna Vinschen [Wed, 3 Aug 2022 11:41:35 +0000 (13:41 +0200)]
Cygwin: drop requirement to build newlib's stdio64

Given that 64 bit Cygwin defines all file access types (off_t,
fpos_t, and derived types) as 64 bit anyway, there's no reason
left to rely on the stdio64 part of newlib.  Use base functions
and base types.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: path: Make some symlinks to /cygdrive/* work.
Takashi Yano [Mon, 1 Aug 2022 00:02:23 +0000 (09:02 +0900)]
Cygwin: path: Make some symlinks to /cygdrive/* work.

- Previously, some symbolic links to /cygdrive/* (e.g. /cygdrive/C,
  /cygdrive/./c, /cygdrive//c, etc.) did not work. This patch fixes
  the issue.
  Addresses: https://cygwin.com/pipermail/cygwin/2022-July/251994.html

23 months agoCygwin: console: Modify ConEmu cygwin connector hook.
Takashi Yano [Mon, 1 Aug 2022 22:42:53 +0000 (07:42 +0900)]
Cygwin: console: Modify ConEmu cygwin connector hook.

- Previously, LoadLibraryA() is hooked for ConEmu cygwin connector.
  With this patch, GetProcAddress() for "RequestTermConnector" is
  hooked instead which is more essential for ConEmu cygwin connector.

23 months agoCygwin: pty: Treat *.bat and *.cmd as a non-cygwin console app.
Takashi Yano [Sun, 31 Jul 2022 08:42:00 +0000 (17:42 +0900)]
Cygwin: pty: Treat *.bat and *.cmd as a non-cygwin console app.

- If *.bat or *.cmd is executed directly from cygwin shell, pty
  failed to switch I/O pipe to that for native apps. This patch
  fixes the issue.

23 months agoCygwin: console: Avoid accessing NULL pointer via cygheap->ctty.
Takashi Yano [Fri, 29 Jul 2022 12:40:18 +0000 (21:40 +0900)]
Cygwin: console: Avoid accessing NULL pointer via cygheap->ctty.

- Recent commit "Cygwin: console: Add missing input_mutex guard."
  has a problem that causes NULL pointer access if cygheap->ctty
  is NULL. This patch fixes the issue.

23 months agoCygwin: Set threadnames with SetThreadDescription()
Jon Turney [Thu, 19 May 2022 16:27:39 +0000 (17:27 +0100)]
Cygwin: Set threadnames with SetThreadDescription()

gdb master recently learnt how to use GetThreadDescription() [1], so set
threadnames using SetThreadDescription() [available since Windows 10
1607] as well.

This is superior to using a special exception to indicate the thread
name to the debugger, because the thread name isn't missed if you don't
have a debugger attached at the time it's set.

It's not clear what the encoding of a thread name string is, we assume
UTF8 for the moment.

For the moment, continue to use the old method as well, for the benefit
of older gdb versions etc.

[1] https://sourceware.org/pipermail/gdb-patches/2022-April/187833.html

23 months agoCygwin: uname: drop useless support for unsupported CPU arches
Corinna Vinschen [Fri, 29 Jul 2022 10:19:54 +0000 (12:19 +0200)]
Cygwin: uname: drop useless support for unsupported CPU arches

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: gmon.h: drop 32 bit considerations
Corinna Vinschen [Fri, 29 Jul 2022 10:19:18 +0000 (12:19 +0200)]
Cygwin: gmon.h: drop 32 bit considerations

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: profile.c: drop i686 register access
Corinna Vinschen [Fri, 29 Jul 2022 10:17:43 +0000 (12:17 +0200)]
Cygwin: profile.c: drop i686 register access

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: rename __cygwin_environ and drop env redirection via cur_environ()
Corinna Vinschen [Thu, 28 Jul 2022 20:00:40 +0000 (22:00 +0200)]
Cygwin: rename __cygwin_environ and drop env redirection via cur_environ()

Back in early Cygwin development a function based access to the
environment was exported, the internal environ in Cygwin was called
__cygwin_environ and cur_environ() was used to access the environment
indirectly .  The history of that necessity is not documented,
but kept in i686 for backward compatibility.

The x86_64 port eventually used __cygwin_environ directly and exported
it as DATA under the usual name environ.

We don't need the i686 workaround anymore, so just rename
__cygwin_environ to environ, drop the cur_environ() macro and
simply export environ under its own name.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: perl scripts: drop support for i686
Corinna Vinschen [Thu, 28 Jul 2022 18:05:55 +0000 (20:05 +0200)]
Cygwin: perl scripts: drop support for i686

- rename "is64bit" to "is_x86_64"
- Always set sym_prefix to empty string and add a FIXME
- speclib: rename uscore to sym_prefix and fix bug in string handling

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
23 months agoCygwin: console: Add workaround for ConEmu cygwin connector.
Takashi Yano [Thu, 28 Jul 2022 12:58:04 +0000 (21:58 +0900)]
Cygwin: console: Add workaround for ConEmu cygwin connector.

- ConEmu cygwin connector conflicts with cons_master_thread since
  it does not use read() to read console input. With this patch,
  cons_master_thread is disabled in ConEmu cygwin connector.

23 months agoCygwin: console: Add missing input_mutex guard.
Takashi Yano [Thu, 28 Jul 2022 12:52:39 +0000 (21:52 +0900)]
Cygwin: console: Add missing input_mutex guard.

- Setting con.disable_master_thread flag should be guarded by
  input_mutex, however, it was not. This patch fixes that.

23 months agoCygwin: Fix previous attempt to drop i386 targets from hookapi
Corinna Vinschen [Thu, 28 Jul 2022 14:38:01 +0000 (16:38 +0200)]
Cygwin: Fix previous attempt to drop i386 targets from hookapi

Somehow this patch looks like it was pushed before having been
finished.  Let's try again...

Fixes: e46f15c2d168 ("Cygwin: hookapi: drop handling i386 targets")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: _dll_crt0: minimize target-specific conditional code
Corinna Vinschen [Thu, 14 Jul 2022 18:08:58 +0000 (20:08 +0200)]
Cygwin: _dll_crt0: minimize target-specific conditional code

Only the assembler snippet is really x86_64-specific, so minimize the
conditional code block to this snippet.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: hookapi: drop handling i386 targets
Corinna Vinschen [Thu, 14 Jul 2022 18:06:09 +0000 (20:06 +0200)]
Cygwin: hookapi: drop handling i386 targets

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: fix or delete a few comments to drop 32 bit references
Corinna Vinschen [Thu, 14 Jul 2022 16:32:53 +0000 (18:32 +0200)]
Cygwin: fix or delete a few comments to drop 32 bit references

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: drop cyglsa.h. LSA subauth is not supported anymore
Corinna Vinschen [Thu, 14 Jul 2022 10:48:39 +0000 (12:48 +0200)]
Cygwin: drop cyglsa.h.  LSA subauth is not supported anymore

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: drop 32 bit target from linker script
Corinna Vinschen [Thu, 14 Jul 2022 10:33:21 +0000 (12:33 +0200)]
Cygwin: drop 32 bit target from linker script

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoCygwin: drop tmpfile export alias for 32 bit systems
Corinna Vinschen [Thu, 14 Jul 2022 09:41:01 +0000 (11:41 +0200)]
Cygwin: drop tmpfile export alias for 32 bit systems

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2 years agoAdd --enable-newlib-reent-thread-local option
Matt Joyce [Mon, 16 May 2022 09:51:54 +0000 (11:51 +0200)]
Add --enable-newlib-reent-thread-local option

By default, Newlib uses a huge object of type struct _reent to store
thread-specific data.  This object is returned by __getreent() if the
__DYNAMIC_REENT__ Newlib configuration option is defined.

The reentrancy structure contains for example errno and the standard input,
output, and error file streams.  This means that if an application only uses
errno it has a dependency on the file stream support even if it does not use
it.  This is an issue for lower end targets and applications which need to
qualify the software according to safety standards (for example ECSS-E-ST-40C,
ECSS-Q-ST-80C, IEC 61508, ISO 26262, DO-178, DO-330, DO-333).

If the new _REENT_THREAD_LOCAL configuration option is enabled, then struct
_reent is replaced by dedicated thread-local objects for each struct _reent
member.  The thread-local objects are defined in translation units which use
the corresponding object.

2 years agoAdd _REENT_IS_NULL()
Matt Joyce [Mon, 23 May 2022 09:29:57 +0000 (11:29 +0200)]
Add _REENT_IS_NULL()

In a follow up patch, struct _reent is optionally replaced by dedicated
thread-local objects.  In this case,_REENT is optionally defined to NULL.  Add
the _REENT_IS_NULL() macro to disable this check on demand.

2 years agoAdd _REENT_SIG_FUNC(ptr)
Matt Joyce [Fri, 4 Feb 2022 10:47:18 +0000 (11:47 +0100)]
Add _REENT_SIG_FUNC(ptr)

Add a _REENT_SIG_FUNC() macro to encapsulate access to the
_sig_func member of struct reent. This will help to replace the
struct member with a thread-local storage object in a follow up
patch.

2 years agoAdd _REENT_CVTBUF(ptr)
Matt Joyce [Thu, 3 Feb 2022 11:24:26 +0000 (12:24 +0100)]
Add _REENT_CVTBUF(ptr)

Add a _REENT_CVTBUF() macro to encapsulate access to the _cvtbuf
member of struct reent. This will help to replace the struct
member with a thread-local storage object in a follow up patch.

2 years agoAdd _REENT_CVTLEN(ptr)
Matt Joyce [Thu, 3 Feb 2022 10:19:14 +0000 (11:19 +0100)]
Add _REENT_CVTLEN(ptr)

Add a _REENT_CVTLEN() macro to encapsulate access to the _cvtlen
member of struct reent. This will help to replace the struct
member with a thread-local storage object in a follow-up patch.

2 years agoAdd _REENT_CLEANUP(ptr)
Matt Joyce [Thu, 3 Feb 2022 09:18:53 +0000 (10:18 +0100)]
Add _REENT_CLEANUP(ptr)

Add a _REENT_CLEANUP() macro to encapsulate access to the
__cleanup member of struct reent. This will help to replace the
struct member with a thread-local storage object in a follow up
patch.

2 years agoAdd _REENT_LOCALE(ptr)
Matt Joyce [Wed, 2 Feb 2022 11:47:30 +0000 (12:47 +0100)]
Add _REENT_LOCALE(ptr)

Add a _REENT_LOCALE() macro to encapsulate access to the _locale
member of struct reent. This will help to replace the struct
member with a thread-local storage object in a follow up patch.

2 years agoAdd _REENT_INC(ptr)
Matt Joyce [Wed, 2 Feb 2022 08:49:00 +0000 (09:49 +0100)]
Add _REENT_INC(ptr)

Add a _REENT_INC() macro to encapsulate access to the _inc member
of struct reent. This will help to replace the struct member with
a thread-local storage object in a follow up patch.

2 years agoAdd _REENT_STDERR(ptr)
Matt Joyce [Tue, 1 Feb 2022 12:05:53 +0000 (13:05 +0100)]
Add _REENT_STDERR(ptr)

Add a _REENT_STDERR() macro to encapsulate access to the _stderr
member of struct reent. This will help to replace the struct
member with a thread-local storage object in a follow up patch.

2 years agoAdd _REENT_STDOUT(ptr)
Matt Joyce [Tue, 1 Feb 2022 11:37:46 +0000 (12:37 +0100)]
Add _REENT_STDOUT(ptr)

Add a _REENT_STDOUT() macro to encapsulate access to the _stdout
member of struct reent. This will help to replace the struct
member with a thread-local storage object in a follow up patch.

2 years agoAdd _REENT_STDIN(ptr)
Matt Joyce [Fri, 28 Jan 2022 09:58:36 +0000 (10:58 +0100)]
Add _REENT_STDIN(ptr)

Add a _REENT_STDIN() macro to encapsulate access to the _stdin
member of struct reent. This will help to replace the struct
member with a thread-local storage object in a follow up patch.

2 years agoAdd _REENT_ERRNO(ptr)
Matt Joyce [Tue, 18 Jan 2022 09:13:04 +0000 (10:13 +0100)]
Add _REENT_ERRNO(ptr)

Add a _REENT_ERRNO() macro to encapsulate the access to the
_errno member of struct reent. This will help to replace the
structure member with a thread-local storage object in a follow
up patch.

Replace uses of __errno_r() with _REENT_ERRNO().  Keep __errno_r() macro for
potential users outside of Newlib.

2 years agoDefine _REENT_EMERGENCY(ptr) only once
Matt Joyce [Mon, 16 May 2022 08:54:31 +0000 (10:54 +0200)]
Define _REENT_EMERGENCY(ptr) only once

Use this macro to access the _emergency member of struct _reent.  This macro
will help to replace the _emergency member of struct _reent with a thread-local
storage object in a follow up patch.

2 years agoMove content in <sys/reent.h>
Sebastian Huber [Wed, 18 May 2022 17:21:44 +0000 (19:21 +0200)]
Move content in <sys/reent.h>

Move definitions not directly related to struct _reent to the bottom of the
file.  This allows a contiguous #ifndef _REENT_THREAD_LOCAL_STORAGE block.

2 years agoUpdate FAQs which are out of date on the details of setup UI
Jon Turney [Fri, 1 Jul 2022 14:21:38 +0000 (15:21 +0100)]
Update FAQs which are out of date on the details of setup UI

2 years agoUpdate FAQs for removal of 32-bit Cygwin
Jon Turney [Fri, 1 Jul 2022 14:20:42 +0000 (15:20 +0100)]
Update FAQs for removal of 32-bit Cygwin

Update FAQs for removal of 32-bit Cygwin
Also update FAQs for dropping support for Windows Vista/Server 20008

2 years agoCygwin: clipboard: Add workaround for setting clipboard failure.
Takashi Yano [Sat, 2 Jul 2022 03:08:51 +0000 (12:08 +0900)]
Cygwin: clipboard: Add workaround for setting clipboard failure.

- OpenClipboard() just after CloseClipboard() sometimes fails. Due
  to this, /dev/clipboard sometimes fails to set CF_UNICODETEXT
  data. This patch add a workaround for this issue.

2 years agoRTEMS: Add README
Sebastian Huber [Mon, 11 Jul 2022 06:26:42 +0000 (08:26 +0200)]
RTEMS: Add README

2 years agolibc/syslog: fully deprecate and don't try to open "/dev/log"
Gleb Smirnoff [Fri, 24 Jun 2022 16:09:11 +0000 (09:09 -0700)]
libc/syslog: fully deprecate and don't try to open "/dev/log"

The "/dev/log" socket existed in pre-FreeBSD times.  Later it was
substituted to a compatibility symlink.  The symlink creation was
deprecated in FreeBSD 10.2 and 9-STABLE.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35304

2 years agoarp: Implement sticky ARP mode for interfaces.
Konrad Sewiłło-Jopek [Fri, 27 May 2022 11:02:57 +0000 (11:02 +0000)]
arp: Implement sticky ARP mode for interfaces.

Provide sticky ARP flag for network interface which marks it as the
"sticky" one similarly to what we have for bridges. Once interface is
marked sticky, any address resolved using the ARP will be saved as a
static one in the ARP table. Such functionality may be used to prevent
ARP spoofing or to decrease latencies in Ethernet networks.

The drawbacks include potential limitations in usage of ARP-based
load-balancers and high-availability solutions such as carp(4).

The implemented option is disabled by default, therefore should not
impact the default behaviour of the networking stack.

Sponsored by: Conclusive Engineering sp. z o.o.
Reviewed By: melifaro, pauamma_gundo.com
Differential Revision: https://reviews.freebsd.org/D35314
MFC after: 2 weeks

2 years agoCorrectly measure system load averages > 1024
Alan Somers [Thu, 5 May 2022 21:35:23 +0000 (15:35 -0600)]
Correctly measure system load averages > 1024

The old fixed-point arithmetic used for calculating load averages had an
overflow at 1024.  So on systems with extremely high load, the observed
load average would actually fall back to 0 and shoot up again, creating
a kind of sawtooth graph.

Fix this by using 64-bit math internally, while still reporting the load
average to userspace as a 32-bit number.

Sponsored by: Axcient
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D35134

2 years agoAdd ifcap2 names for RXTLS4 and RXTLS6 interface capabilities
Konstantin Belousov [Wed, 15 Dec 2021 03:03:23 +0000 (05:03 +0200)]
Add ifcap2 names for RXTLS4 and RXTLS6 interface capabilities

and corresponding nvlist capabilities name strings.

Reviewed by: hselasky, jhb, kp (previous version)
Sponsored by: NVIDIA Networking
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D32551

2 years agoKernel-side infrastructure to implement nvlist-based set/get ifcaps
Konstantin Belousov [Sun, 17 Oct 2021 15:00:34 +0000 (18:00 +0300)]
Kernel-side infrastructure to implement nvlist-based set/get ifcaps

Reviewed by: hselasky, jhb, kp (previous version)
Sponsored by: NVIDIA Networking
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D32551

2 years agotcp: LRO code to deal with all 12 TCP header flags
Richard Scheffenegger [Tue, 1 Feb 2022 16:25:49 +0000 (17:25 +0100)]
tcp: LRO code to deal with all 12 TCP header flags

TCP per RFC793 has 4 reserved flag bits for future use. One
of those bits may be used for Accurate ECN.
This patch is to include these bits in the LRO code to ease
the extensibility if/when these bits are used.

Reviewed By: hselasky, rrs, #transport
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34127

2 years agokernel: deprecate Internet Class A/B/C
Mike Karels [Wed, 27 Oct 2021 03:01:09 +0000 (22:01 -0500)]
kernel: deprecate Internet Class A/B/C

Hide historical Class A/B/C macros unless IN_HISTORICAL_NETS is defined;
define it for user level.  Define IN_MULTICAST separately from IN_CLASSD,
and use it in pf instead of IN_CLASSD.  Stop using class for setting
default masks when not specified; instead, define new default mask
(24 bits).  Warn when an Internet address is set without a mask.

MFC after: 1 month
Reviewed by: cy
Differential Revision: https://reviews.freebsd.org/D32708

2 years agotcp: socket option to get stack alias name
Peter Lei [Tue, 26 Oct 2021 03:08:54 +0000 (20:08 -0700)]
tcp: socket option to get stack alias name

TCP stack sysctl nodes are currently inserted using the stack
name alias. Allow the user to get the current stack's alias to
allow for programatic sysctl access.

Obtained from: Netflix

2 years agotcp: Add hystart-plus to cc_newreno and rack.
Randall Stewart [Fri, 22 Oct 2021 11:10:28 +0000 (07:10 -0400)]
tcp: Add hystart-plus to cc_newreno and rack.

TCP Hystart draft version -03:
https://datatracker.ietf.org/doc/html/draft-ietf-tcpm-hystartplusplus

Is a new version of hystart that allows one to carefully exit slow start if the RTT
spikes too much. The newer version has a slower-slow-start so to speak that then
kicks in for five round trips. To see if you exited too early, if not into congestion avoidance.
This commit will add that feature to our newreno CC and add the needed bits in rack to
be able to enable it.

Reviewed by: tuexen
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D32373

2 years agotcp: Add support for DSACK based reordering window to rack.
Randall Stewart [Tue, 17 Aug 2021 20:29:22 +0000 (16:29 -0400)]
tcp: Add support for DSACK based reordering window to rack.

The rack stack, with respect to the rack bits in it, was originally built based
on an early I-D of rack. In fact at that time the TLP bits were in a separate
I-D. The dynamic reordering window based on DSACK events was not present
in rack at that time. It is now part of the RFC and we need to update our stack
to include these features. However we want to have a way to control the feature
so that we can, if the admin decides, make it stay the same way system wide as
well as via socket option. The new sysctl and socket option has the following
meaning for setting:

00 (0) - Keep the old way, i.e. reordering window is 1 and do not use DSACK bytes to add to reorder window
01 (1) - Change the Reordering window to 1/4 of an RTT but do not use DSACK bytes to add to reorder window
10 (2) - Keep the reordering window as 1, but do use SACK bytes to add additional 1/4 RTT delay to the reorder window
11 (3) - reordering window is 1/4 of an RTT and add additional DSACK bytes to increase the reordering window (RFC behavior)

The default currently in the sysctl is 3 so we get standards based behavior.
Reviewed by: tuexen
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D31506

2 years agotsleep: Add a PNOLOCK flag
Andrew Gallatin [Thu, 5 Aug 2021 21:16:30 +0000 (17:16 -0400)]
tsleep: Add a PNOLOCK flag

Add a PNOLOCK flag so that, in the race circumstance where
wakeup races are externally mitigated, tsleep() can be
called with a sleep time of 0 without triggering an
an assertion.

Reviewed by: jhb
Sponsored by: Netflix

2 years agosocket: Implement SO_RERROR
Roy Marples [Wed, 28 Jul 2021 15:46:59 +0000 (08:46 -0700)]
socket: Implement SO_RERROR

SO_RERROR indicates that receive buffer overflows should be handled as
errors. Historically receive buffer overflows have been ignored and
programs could not tell if they missed messages or messages had been
truncated because of overflows. Since programs historically do not
expect to get receive overflow errors, this behavior is not the
default.

This is really really important for programs that use route(4) to keep
in sync with the system. If we loose a message then we need to reload
the full system state, otherwise the behaviour from that point is
undefined and can lead to chasing bogus bug reports.

Reviewed by: philip (network), kbowling (transport), gbe (manpages)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26652

2 years agopf: syncookie support
Kristof Provost [Thu, 20 May 2021 09:54:41 +0000 (11:54 +0200)]
pf: syncookie support

Import OpenBSD's syncookie support for pf. This feature help pf resist
TCP SYN floods by only creating states once the remote host completes
the TCP handshake rather than when the initial SYN packet is received.

This is accomplished by using the initial sequence numbers to encode a
cookie (hence the name) in the SYN+ACK response and verifying this on
receipt of the client ACK.

Reviewed by: kbowling
Obtained from: OpenBSD
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31138

2 years agotcp: Add a socket option to rack
Randall Stewart [Wed, 26 May 2021 10:43:30 +0000 (06:43 -0400)]
tcp: Add a socket option to rack

so we can test various changes to the slop value in timers.

Timer_slop, in TCP, has been 200ms for a long time. This value dates back
a long time when delayed ack timers were longer and links were slower. A
200ms timer slop allows 1 MSS to be sent over a 60kbps link. Its possible that
lowering this value to something more in line with todays delayed ack values (40ms)
might improve TCP. This bit of code makes it so rack can, via a socket option,
adjust the timer slop.

Reviewed by: mtuexen
Sponsered by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D30249

2 years agotcp: SACK Lost Retransmission Detection (LRD)
Richard Scheffenegger [Mon, 10 May 2021 16:47:47 +0000 (18:47 +0200)]
tcp: SACK Lost Retransmission Detection (LRD)

Recover from excessive losses without reverting to a
retransmission timeout (RTO). Disabled by default, enable
with sysctl net.inet.tcp.do_lrd=1

Reviewed By: #transport, rrs, tuexen, #manpages
Sponsored by: Netapp, Inc.
Differential Revision: https://reviews.freebsd.org/D28931

2 years agoThis brings into sync FreeBSD with the netflix
Randall Stewart [Thu, 6 May 2021 15:22:26 +0000 (11:22 -0400)]
This brings into sync FreeBSD with the netflix

versions of rack and bbr. This fixes several breakages (panics) since the
tcp_lro code was committed that have been reported. Quite a few new features
are now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the
largest). There is also support for ack-war prevention. Documents comming soon
on rack..

Sponsored by:           Netflix
Reviewed by: rscheff, mtuexen
Differential Revision: https://reviews.freebsd.org/D30036

2 years agoUse thunks for compat ioctls using struct ifgroupreq.
John Baldwin [Wed, 5 May 2021 20:59:00 +0000 (13:59 -0700)]
Use thunks for compat ioctls using struct ifgroupreq.

Reviewed by: brooks, kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D29893

2 years agoioccom: define ioctl cmd value that can never be valid
Konstantin Belousov [Thu, 22 Apr 2021 19:40:08 +0000 (22:40 +0300)]
ioccom: define ioctl cmd value that can never be valid

Its use is for cases where some filler is needed for cmd, or we need an
indication that there were no cmd supplied, and so on.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29935

2 years agopoll(2): Add POLLRDHUP.
Thomas Munro [Wed, 28 Apr 2021 09:31:38 +0000 (21:31 +1200)]
poll(2): Add POLLRDHUP.

Teach poll(2) to support Linux-style POLLRDHUP events for sockets, if
requested.  Triggered when the remote peer shuts down writing or closes
its end.

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D29757

2 years agotcp: add support for TCP over UDP
Michael Tuexen [Sun, 18 Apr 2021 14:08:08 +0000 (16:08 +0200)]
tcp: add support for TCP over UDP

Adding support for TCP over UDP allows communication with
TCP stacks which can be implemented in userspace without
requiring special priviledges or specific support by the OS.
This is joint work with rrs.

Reviewed by: rrs
Sponsored by: Netflix, Inc.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29469

2 years agotermios: add more speeds
Bjoern A. Zeeb [Wed, 10 Mar 2021 22:17:07 +0000 (22:17 +0000)]
termios: add more speeds

A lot of small arm64 gadgets are using 1500000 as console speed.
While cu can perfectly deal with this some 3rd party software, e.g.,
comms/conserver-con add speeds based on B<n> being defined.
Having it defined here simplifies enhancing other software.

Obtained-from: NetBSD sys/sys/termios.h 1.36
MFC-after: 2 weeks
Reviewed-by: philip (,okayed by imp)
Differential Revision: https://reviews.freebsd.org/D29209

2 years agoRevert "SO_RERROR indicates that receive buffer overflows"
Alexander V. Chernikov [Mon, 8 Feb 2021 22:30:39 +0000 (22:30 +0000)]
Revert "SO_RERROR indicates that receive buffer overflows"

Wrong version of the change was pushed inadvertenly.

This reverts commit 4a01b854ca5c2e5124958363b3326708b913af71.

2 years agoSO_RERROR indicates that receive buffer overflows
Alexander V. Chernikov [Sun, 7 Feb 2021 17:21:18 +0000 (17:21 +0000)]
SO_RERROR indicates that receive buffer overflows

should be handled as errors. Historically receive buffer overflows have been
ignored and programs could not tell if they missed messages or messages had
been truncated because of overflows. Since programs historically do not expect
to get receive overflow errors, this behavior is not the default.

This is really really important for programs that use route(4) to keep in sync
with the system. If we loose a message then we need to reload the full system
state, otherwise the behaviour from that point is undefined and can lead
to chasing bogus bug reports.

2 years agoExpose clang's alignment builtins and use them for roundup2/rounddown2
Alex Richardson [Wed, 3 Feb 2021 15:27:17 +0000 (15:27 +0000)]
Expose clang's alignment builtins and use them for roundup2/rounddown2

This makes roundup2/rounddown2 type- and const-preserving and allows
using it on pointer types without casting to uintptr_t first. Not
performing pointer-to-integer conversions also helps the compiler's
optimization passes and can therefore result in better code generation.
When using it with integer values there should be no change other than
the compiler checking that the alignment value is a valid power-of-two.

I originally implemented these builtins for CHERI a few years ago and
they have been very useful for CheriBSD. However, they are also useful
for non-CHERI code so I was able to upstream them for Clang 10.0.

Rationale from the clang documentation:
Clang provides builtins to support checking and adjusting alignment
of pointers and integers. These builtins can be used to avoid relying
on implementation-defined behavior of arithmetic on integers derived
from pointers. Additionally, these builtins retain type information
and, unlike bitwise arithmetic, they can perform semantic checking on
the alignment value.

There is also a feature request for GCC, so GCC may also support it in
the future: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98641

Reviewed By: brooks, jhb, imp
Differential Revision: https://reviews.freebsd.org/D28332

2 years agoCatch up with 6edfd179c86: mechanically rename IFCAP_NOMAP to IFCAP_MEXTPG.
Gleb Smirnoff [Thu, 28 Jan 2021 21:08:48 +0000 (13:08 -0800)]
Catch up with 6edfd179c86: mechanically rename IFCAP_NOMAP to IFCAP_MEXTPG.

Originally IFCAP_NOMAP meant that the mbuf has external storage pointer
that points to unmapped address.  Then, this was extended to array of
such pointers.  Then, such mbufs were augmented with header/trailer.
Basically, extended mbufs are extended, and set of features is subject
to change.  The new name should be generic enough to avoid further
renaming.

2 years agoAdd tcgetwinsize(3) and tcsetwinsize(3) to termios
Konstantin Belousov [Thu, 24 Dec 2020 23:05:31 +0000 (01:05 +0200)]
Add tcgetwinsize(3) and tcsetwinsize(3) to termios

These functions get/set tty winsize respectively, and are trivial wrappers
around corresponding termio ioctls.

The functions are expected to be a part of POSIX.1 issue 8:
https://www.austingroupbugs.net/view.php?id=1151#c3856.
They are currently available in NetBSD and in musl libc.

PR: 251868
Submitted by: Soumendra Ganguly <soumendraganguly@gmail.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27650

2 years agoFilter TCP connections to SO_REUSEPORT_LB listen sockets by NUMA domain
Andrew Gallatin [Sat, 19 Dec 2020 22:04:46 +0000 (22:04 +0000)]
Filter TCP connections to SO_REUSEPORT_LB listen sockets by NUMA domain

In order to efficiently serve web traffic on a NUMA
machine, one must avoid as many NUMA domain crossings as
possible. With SO_REUSEPORT_LB, a number of workers can share a
listen socket. However, even if a worker sets affinity to a core
or set of cores on a NUMA domain, it will receive connections
associated with all NUMA domains in the system. This will lead to
cross-domain traffic when the server writes to the socket or
calls sendfile(), and memory is allocated on the server's local
NUMA node, but transmitted on the NUMA node associated with the
TCP connection. Similarly, when the server reads from the socket,
he will likely be reading memory allocated on the NUMA domain
associated with the TCP connection.

This change provides a new socket ioctl, TCP_REUSPORT_LB_NUMA. A
server can now tell the kernel to filter traffic so that only
incoming connections associated with the desired NUMA domain are
given to the server. (Of course, in the case where there are no
servers sharing the listen socket on some domain, then as a
fallback, traffic will be hashed as normal to all servers sharing
the listen socket regardless of domain). This allows a server to
deal only with traffic that is local to its NUMA domain, and
avoids cross-domain traffic in most cases.

This patch, and a corresponding small patch to nginx to use
TCP_REUSPORT_LB_NUMA allows us to serve 190Gb/s of kTLS encrypted
https media content from dual-socket Xeons with only 13% (as
measured by pcm.x) cross domain traffic on the memory controller.

Reviewed by: jhb, bz (earlier version), bcr (man page)
Tested by: gonzo
Sponsored by: Netfix
Differential Revision: https://reviews.freebsd.org/D21636

2 years agostyle(9): Correct whitespace in struct definitions
Brooks Davis [Fri, 11 Dec 2020 01:00:07 +0000 (01:00 +0000)]
style(9): Correct whitespace in struct definitions

struct ifconf and struct ifreq use the odd style "struct<tab>foo".
struct ifdrv seems to have tried to follow this but was committed with
spaces in place of most tabs resulting in "struct<space><space>ifdrv".

MFC after: 3 days

2 years agounix(4): Enhance LOCAL_CREDS_PERSISTENT ABI
Conrad Meyer [Tue, 17 Nov 2020 20:01:21 +0000 (20:01 +0000)]
unix(4): Enhance LOCAL_CREDS_PERSISTENT ABI

As this ABI is still fresh (r367287), let's correct some mistakes now:

- Version the structure to allow for future changes
- Include sender's pid in control message structure
- Use a distinct control message type from the cmsgcred / sockcred mess

Discussed with: kib, markj, trasz
Differential Revision: https://reviews.freebsd.org/D27084

2 years agounix(4): Add SOL_LOCAL:LOCAL_CREDS_PERSISTENT
Conrad Meyer [Tue, 3 Nov 2020 01:17:45 +0000 (01:17 +0000)]
unix(4): Add SOL_LOCAL:LOCAL_CREDS_PERSISTENT

This option is intended to be semantically identical to Linux's
SOL_SOCKET:SO_PASSCRED.  For now, it is mutually exclusive with the
pre-existing sockopt SOL_LOCAL:LOCAL_CREDS.

Reviewed by: markj (penultimate version)
Differential Revision: https://reviews.freebsd.org/D27011

2 years agoIntegrate 4.4BSD-Lite2 changes to IOC_* definitions
Warner Losh [Fri, 30 Oct 2020 22:00:35 +0000 (22:00 +0000)]
Integrate 4.4BSD-Lite2 changes to IOC_* definitions

Bring in the long-overdue 4.4BSD-Lite2 rev 8.3 by cgd of
sys/ioccom.h. This uses UL suffix for the IOC_* constants so they
don't sign extend. Also bring in the handy diagram from NetBSD's
version of this file. This alters the 4.4BSD-Lite2 code slightly
in a way that's semantically the same but more compact.

This should stop the warnings from Chrome for bogus sign extension.

Reviewed by: kib@, jhb@
Differential Revision: https://reviews.freebsd.org/D26423

2 years agoSupport hardware rate limiting (pacing) with TLS offload.
John Baldwin [Thu, 29 Oct 2020 00:23:16 +0000 (00:23 +0000)]
Support hardware rate limiting (pacing) with TLS offload.

- Add a new send tag type for a send tag that supports both rate
  limiting (packet pacing) and TLS offload (mostly similar to D22669
  but adds a separate structure when allocating the new tag type).

- When allocating a send tag for TLS offload, check to see if the
  connection already has a pacing rate.  If so, allocate a tag that
  supports both rate limiting and TLS offload rather than a plain TLS
  offload tag.

- When setting an initial rate on an existing ifnet KTLS connection,
  set the rate in the TCP control block inp and then reset the TLS
  send tag (via ktls_output_eagain) to reallocate a TLS + ratelimit
  send tag.  This allocates the TLS send tag asynchronously from a
  task queue, so the TLS rate limit tag alloc is always sleepable.

- When modifying a rate on a connection using KTLS, look for a TLS
  send tag.  If the send tag is only a plain TLS send tag, assume we
  failed to allocate a TLS ratelimit tag (either during the
  TCP_TXTLS_ENABLE socket option, or during the send tag reset
  triggered by ktls_output_eagain) and ignore the new rate.  If the
  send tag is a ratelimit TLS send tag, change the rate on the TLS tag
  and leave the inp tag alone.

- Lock the inp lock when setting sb_tls_info for a socket send buffer
  so that the routines in tcp_ratelimit can safely dereference the
  pointer without needing to grab the socket buffer lock.

- Add an IFCAP_TXTLS_RTLMT capability flag and associated
  administrative controls in ifconfig(8).  TLS rate limit tags are
  only allocated if this capability is enabled.  Note that TLS offload
  (whether unlimited or rate limited) always requires IFCAP_TXTLS[46].

Reviewed by: gallatin, hselasky
Relnotes: yes
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26691

2 years agoImplement SIOCGIFALIAS.
Andrey V. Elsukov [Wed, 14 Oct 2020 09:22:54 +0000 (09:22 +0000)]
Implement SIOCGIFALIAS.

It is lightweight way to check if an IPv4 address exists.

Submitted by: Roy Marples
Reviewed by: gnn, melifaro
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26636

2 years agoAdd IP(V6)_VLAN_PCP to set 802.1 priority per-flow.
Richard Scheffenegger [Fri, 9 Oct 2020 12:06:43 +0000 (12:06 +0000)]
Add IP(V6)_VLAN_PCP to set 802.1 priority per-flow.

This adds a new IP_PROTO / IPV6_PROTO setsockopt (getsockopt)
option IP(V6)_VLAN_PCP, which can be set to -1 (interface
default), or explicitly to any priority between 0 and 7.

Note that for untagged traffic, explicitly adding a
priority will insert a special 801.1Q vlan header with
vlan ID = 0 to carry the priority setting

Reviewed by: gallatin, rrs
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26409

2 years agoFix typo.
Konstantin Belousov [Wed, 7 Oct 2020 10:58:56 +0000 (10:58 +0000)]
Fix typo.

Sponsored by: Mellanox Technologies/NVIDIA Networking
MFC after: 3 days

2 years agoIntroduce scalable route multipath.
Alexander V. Chernikov [Sat, 3 Oct 2020 10:47:17 +0000 (10:47 +0000)]
Introduce scalable route multipath.

This change is based on the nexthop objects landed in D24232.

The change introduces the concept of nexthop groups.
Each group contains the collection of nexthops with their
 relative weights and a dataplane-optimized structure to enable
 efficient nexthop selection.

Simular to the nexthops, nexthop groups are immutable. Dataplane part
 gets compiled during group creation and is basically an array of
 nexthop pointers, compiled w.r.t their weights.

With this change, `rt_nhop` field of `struct rtentry` contains either
 nexthop or nexthop group. They are distinguished by the presense of
 NHF_MULTIPATH flag.
All dataplane lookup functions returns pointer to the nexthop object,
leaving nexhop groups details inside routing subsystem.

User-visible changes:

The change is intended to be backward-compatible: all non-mpath operations
 should work as before with ROUTE_MPATH and net.route.multipath=1.

All routes now comes with weight, default weight is 1, maximum is 2^24-1.

Current maximum multipath group width is statically set to 64.
 This will become sysctl-tunable in the followup changes.

Using functionality:
* Recompile kernel with ROUTE_MPATH
* set net.route.multipath to 1

route add -6 2001:db8::/32 2001:db8::2 -weight 10
route add -6 2001:db8::/32 2001:db8::3 -weight 20

netstat -6On

Nexthop groups data

Internet6:
GrpIdx  NhIdx     Weight   Slots                                 Gateway     Netif  Refcnt
1         ------- ------- ------- --------------------------------------- ---------       1
              13      10       1                             2001:db8::2     vlan2
              14      20       2                             2001:db8::3     vlan2

Next steps:
* Land outbound hashing for locally-originated routes ( D26523 ).
* Fix net/bird multipath (net/frr seems to work fine)
* Add ROUTE_MPATH to GENERIC
* Set net.route.multipath=1 by default

Tested by: olivier
Reviewed by: glebius
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D26449

2 years agoadd SIOCGIFDATA ioctl
Ed Maste [Mon, 28 Sep 2020 16:54:39 +0000 (16:54 +0000)]
add SIOCGIFDATA ioctl

For interfaces that do not support SIOCGIFMEDIA (for which there are
quite a few) the only fallback is to query the interface for
if_data->ifi_link_state.  While it's possible to get at if_data for an
interface via getifaddrs(3) or sysctl, both are heavy weight mechanisms.

SIOCGIFDATA is a simple ioctl to retrieve this fast with very little
resource use in comparison.  This implementation mirrors that of other
similar ioctls in FreeBSD.

Submitted by: Roy Marples <roy@marples.name>
Reviewed by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D26538

2 years agoTCP: send full initial window when timestamps are in use
Richard Scheffenegger [Fri, 25 Sep 2020 10:38:19 +0000 (10:38 +0000)]
TCP: send full initial window when timestamps are in use

The fastpath in tcp_output tries to send out
full segments, and avoid sending partial segments by
comparing against the static t_maxseg variable.
That value does not consider tcp options like timestamps,
while the initial window calculation is using
the correct dynamic tcp_maxseg() function.

Due to this interaction, the last, full size segment
is considered too short and not sent out immediately.

Reviewed by: tuexen
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26478

2 years agoAdd two new ifnet capabilities
Navdeep Parhar [Fri, 18 Sep 2020 02:10:28 +0000 (02:10 +0000)]
Add two new ifnet capabilities

for hw checksumming and TSO for VXLAN traffic.

These are similar to the existing VLAN capabilities.

Reviewed by: kib@
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D25873

2 years agoSupport for userspace non-transparent superpages (largepages).
Konstantin Belousov [Wed, 9 Sep 2020 22:12:51 +0000 (22:12 +0000)]
Support for userspace non-transparent superpages (largepages).

Created with shm_open2(SHM_LARGEPAGE) and then configured with
FIOSSHMLPGCNF ioctl, largepages posix shared memory objects guarantee
that all userspace mappings of it are served by superpage non-managed
mappings.

Only amd64 for now, both 2M and 1G superpages can be requested, the
later requires CPU feature.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D24652

2 years agoInclude the psind in data returned by mincore(2).
Mark Johnston [Wed, 2 Sep 2020 18:16:43 +0000 (18:16 +0000)]
Include the psind in data returned by mincore(2).

Currently we use a single bit to indicate whether the virtual page is
part of a superpage.  To support a forthcoming implementation of
non-transparent 1GB superpages, it is useful to provide more detailed
information about large page sizes.

The change converts MINCORE_SUPER into a mask for MINCORE_PSIND(psind)
values, indicating a mapping of size psind, where psind is an index into
the pagesizes array returned by getpagesizes(3), which in turn comes
from the hw.pagesizes sysctl.  MINCORE_PSIND(1) is equal to the old
value of MINCORE_SUPER.

For now, two bits are used to record the page size, permitting values
of MAXPAGESIZES up to 4.

Reviewed by: alc, kib
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26238

2 years agosys: clean up empty lines in .c and .h files
Mateusz Guzik [Tue, 1 Sep 2020 22:12:58 +0000 (22:12 +0000)]
sys: clean up empty lines in .c and .h files

2 years agonet: clean up empty lines in .c and .h files
Mateusz Guzik [Tue, 1 Sep 2020 21:19:14 +0000 (21:19 +0000)]
net: clean up empty lines in .c and .h files

2 years agoAdd SOL_LOCAL symbolic constant for unix socket option level.
Konstantin Belousov [Mon, 3 Aug 2020 22:13:02 +0000 (22:13 +0000)]
Add SOL_LOCAL symbolic constant for unix socket option level.

The constant seems to exists on MacOS X >= 10.8.

Requested by: swills
Reviewed by: allanjude, kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D25933

2 years agoshm_open2: Implement SHM_GROW_ON_WRITE
Kyle Evans [Fri, 10 Jul 2020 00:43:45 +0000 (00:43 +0000)]
shm_open2: Implement SHM_GROW_ON_WRITE

Lack of SHM_GROW_ON_WRITE is actively breaking Python's memfd_create tests,
so go ahead and implement it. A future change will make memfd_create always
set SHM_GROW_ON_WRITE, to match Linux behavior and unbreak Python's tests
on -CURRENT.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D25502

2 years agoHyperV socket implementation for FreeBSD
Wei Hu [Wed, 20 May 2020 11:03:59 +0000 (11:03 +0000)]
HyperV socket implementation for FreeBSD

This change adds Hyper-V socket feature in FreeBSD. New socket address
family AF_HYPERV and its kernel support are added.

Submitted by: Wei Hu <weh@microsoft.com>
Reviewed by: Dexuan Cui <decui@microsoft.com>
Relnotes: yes
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D24061

2 years agoInitial support for kernel offload of TLS receive.
John Baldwin [Mon, 27 Apr 2020 23:17:19 +0000 (23:17 +0000)]
Initial support for kernel offload of TLS receive.

- Add a new TCP_RXTLS_ENABLE socket option to set the encryption and
  authentication algorithms and keys as well as the initial sequence
  number.

- When reading from a socket using KTLS receive, applications must use
  recvmsg().  Each successful call to recvmsg() will return a single
  TLS record.  A new TCP control message, TLS_GET_RECORD, will contain
  the TLS record header of the decrypted record.  The regular message
  buffer passed to recvmsg() will receive the decrypted payload.  This
  is similar to the interface used by Linux's KTLS RX except that
  Linux does not return the full TLS header in the control message.

- Add plumbing to the TOE KTLS interface to request either transmit
  or receive KTLS sessions.

- When a socket is using receive KTLS, redirect reads from
  soreceive_stream() into soreceive_generic().

- Note that this interface is currently only defined for TLS 1.1 and
  1.2, though I believe we will be able to reuse the same interface
  and structures for 1.3.

2 years agoThis change does a small prepratory step
Randall Stewart [Mon, 27 Apr 2020 16:30:29 +0000 (16:30 +0000)]
This change does a small prepratory step

in getting the latest rack and bbr in from the NF repo. When those come in the
OOB data handling will be fixed where Skyzaller crashes.

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

2 years agoConvert route caching to nexthop caching.
Alexander V. Chernikov [Sat, 25 Apr 2020 09:06:11 +0000 (09:06 +0000)]
Convert route caching to nexthop caching.

This change is build on top of nexthop objects introduced in r359823.

Nexthops are separate datastructures, containing all necessary information
 to perform packet forwarding such as gateway interface and mtu. Nexthops
 are shared among the routes, providing more pre-computed cache-efficient
 data while requiring less memory. Splitting the LPM code and the attached
 data solves multiple long-standing problems in the routing layer,
 drastically reduces the coupling with outher parts of the stack and allows
 to transparently introduce faster lookup algorithms.

Route caching was (re)introduced to minimise (slow) routing lookups, allowing
 for notably better performance for large TCP senders. Caching works by
 acquiring rtentry reference, which is protected by per-rtentry mutex.
 If the routing table is changed (checked by comparing the rtable generation id)
 or link goes down, cache record gets withdrawn.

Nexthops have the same reference counting interface, backed by refcount(9).
This change merely replaces rtentry with the actual forwarding nextop as a
 cached object, which is mostly mechanical. Other moving parts like cache
 cleanup on rtable change remains the same.

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

2 years agoMake the path length of UNIX domain sockets
Jonathan T. Looney [Tue, 14 Apr 2020 15:27:24 +0000 (15:27 +0000)]
Make the path length of UNIX domain sockets

specified by a #define. Also, add a comment describing the historical context
for this length.

Reviewed by: bz, jhb, kbowling (previous version)
MFC after: 2 weeks
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D24272

2 years agoIntroduce nexthop objects and new routing KPI.
Alexander V. Chernikov [Sun, 12 Apr 2020 14:30:00 +0000 (14:30 +0000)]
Introduce nexthop objects and new routing KPI.

This is the foundational change for the routing subsytem rearchitecture.
 More details and goals are available in https://reviews.freebsd.org/D24141 .

This patch introduces concept of nexthop objects and new nexthop-based
 routing KPI.

Nexthops are objects, containing all necessary information for performing
 the packet output decision. Output interface, mtu, flags, gw address goes
 there. For most of the cases, these objects will serve the same role as
 the struct rtentry is currently serving.
Typically there will be low tens of such objects for the router even with
 multiple BGP full-views, as these objects will be shared between routing
 entries. This allows to store more information in the nexthop.

New KPI:

struct nhop_object *fib4_lookup(uint32_t fibnum, struct in_addr dst,
  uint32_t scopeid, uint32_t flags, uint32_t flowid);
struct nhop_object *fib6_lookup(uint32_t fibnum, const struct in6_addr *dst6,
  uint32_t scopeid, uint32_t flags, uint32_t flowid);

These 2 function are intended to replace all all flavours of
 <in_|in6_>rtalloc[1]<_ign><_fib>, mpath functions  and the previous
 fib[46]-generation functions.

Upon successful lookup, they return nexthop object which is guaranteed to
 exist within current NET_EPOCH. If longer lifetime is desired, one can
 specify NHR_REF as a flag and get a referenced version of the nexthop.
 Reference semantic closely resembles rtentry one, allowing sed-style conversion.

Additionally, another 2 functions are introduced to support uRPF functionality
 inside variety of our firewalls. Their primary goal is to hide the multipath
 implementation details inside the routing subsystem, greatly simplifying
 firewalls implementation:

int fib4_lookup_urpf(uint32_t fibnum, struct in_addr dst, uint32_t scopeid,
  uint32_t flags, const struct ifnet *src_if);
int fib6_lookup_urpf(uint32_t fibnum, const struct in6_addr *dst6, uint32_t scopeid,
  uint32_t flags, const struct ifnet *src_if);

All functions have a separate scopeid argument, paving way to eliminating IPv6 scope
 embedding and allowing to support IPv4 link-locals in the future.

Structure changes:
 * rtentry gets new 'rt_nhop' pointer, slightly growing the overall size.
 * rib_head gets new 'rnh_preadd' callback pointer, slightly growing overall sz.

Old KPI:
During the transition state old and new KPI will coexists. As there are another 4-5
 decent-sized conversion patches, it will probably take a couple of weeks.
To support both KPIs, fields not required by the new KPI (most of rtentry) has to be
 kept, resulting in the temporary size increase.
Once conversion is finished, rtentry will notably shrink.

More details:
* architectural overview: https://reviews.freebsd.org/D24141
* list of the next changes: https://reviews.freebsd.org/D24232

Reviewed by: ae,glebius(initial version)
Differential Revision: https://reviews.freebsd.org/D24232

2 years agoAlthough most of the NIC drivers are epoch ready,
Gleb Smirnoff [Mon, 24 Feb 2020 21:07:30 +0000 (21:07 +0000)]
Although most of the NIC drivers are epoch ready,

due to peer pressure switch over to opt-in instead of opt-out for epoch.

Instead of IFF_NEEDSEPOCH, provide IFF_KNOWSEPOCH. If driver marks
itself with IFF_KNOWSEPOCH, then ether_input() would not enter epoch
when processing its packets.

Now this will create recursive entrance in epoch in >90% network
drivers, but will guarantee safeness of the transition.

Mark several tested drivers as IFF_KNOWSEPOCH.

Reviewed by: hselasky, jeff, bz, gallatin
Differential Revision: https://reviews.freebsd.org/D23674

2 years agoWhite space cleanup --
Randall Stewart [Wed, 12 Feb 2020 13:31:36 +0000 (13:31 +0000)]
White space cleanup --

remove trailing tab's or spaces from any line.

Sponsored by: Netflix Inc.

2 years agoIntroduce flag IFF_NEEDSEPOCH
Gleb Smirnoff [Thu, 23 Jan 2020 01:41:09 +0000 (01:41 +0000)]
Introduce flag IFF_NEEDSEPOCH

that marks Ethernet interfaces that supposedly may call into ether_input()
without network epoch.

They all need to be reviewed before 13.0-RELEASE.  Some may need
be fixed.  The flag is not planned to be used in the kernel for
a long time.

2 years agoAdd flags for upcoming patches related to improved ECN handling.
Michael Tuexen [Tue, 31 Dec 2019 14:32:48 +0000 (14:32 +0000)]
Add flags for upcoming patches related to improved ECN handling.

No functional change.

Submitted by: Richard Scheffenegger
Reviewed by: rgrimes@, tuexen@
Differential Revision: https://reviews.freebsd.org/D22429

2 years agoMake use of the stats(3) framework in the TCP stack.
Edward Tomasz Napierala [Mon, 2 Dec 2019 20:58:04 +0000 (20:58 +0000)]
Make use of the stats(3) framework in the TCP stack.

This makes it possible to retrieve per-connection statistical
information such as the receive window size, RTT, or goodput,
using a newly added TCP_STATS getsockopt(3) option, and extract
them using the stats_voistat_fetch(3) API.

See the net/tcprtt port for an example consumer of this API.

Compared to the existing TCP_INFO system, the main differences
are that this mechanism is easy to extend without breaking ABI,
and provides statistical information instead of raw "snapshots"
of values at a given point in time.  stats(3) is more generic
and can be used in both userland and the kernel.

Reviewed by: thj
Tested by: thj
Obtained from: Netflix
Relnotes: yes
Sponsored by: Klara Inc, Netflix
Differential Revision: https://reviews.freebsd.org/D20655

2 years agoJail and capability mode for shm_rename;
David Bright [Mon, 18 Nov 2019 13:31:16 +0000 (13:31 +0000)]
Jail and capability mode for shm_rename;

add audit support for shm_rename

Co-mingling two things here:

  * Addressing some feedback from Konstantin and Kyle re: jail,
    capability mode, and a few other things
  * Adding audit support as promised.

The audit support change includes a partial refresh of OpenBSM from
upstream, where the change to add shm_rename has already been
accepted. Matthew doesn't plan to work on refreshing anything else to
support audit for those new event types.

Submitted by: Matthew Bryan <matthew.bryan@isilon.com>
Reviewed by: kib
Relnotes: Yes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22083

This page took 0.078544 seconds and 5 git commands to generate.