Commit Graph

278610 Commits

Author SHA1 Message Date
Brooks Davis
d701f45aba Remove telnetd sources
Differential Revision:	https://reviews.freebsd.org/D36621
2022-10-05 17:27:14 +01:00
Kristof Provost
1d090028d3 pf: use time_to for timestamps
Use time_t rather than uint32_t to represent the timestamps. That means
we have 64 bits rather than 32 on all platforms except i386, avoiding
the Y2K38 issues on most platforms.

Reviewed by:	Zhenlei Huang
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D36837
2022-10-05 17:52:27 +02:00
Zhenlei Huang
1fc839f489 if_vxlan(4): Add missing statistic for input packets
Event:		Aberdeen hackathon 2022
Reviewed by:	bryanv, kp
Differential Revision:	https://reviews.freebsd.org/D36841
2022-10-05 12:38:30 +02:00
Kristof Provost
fd6ecc184d dhclient-script: cope with /32 address leases
On certain cloud platforms (Google Cloud, Packet.net and others) the
DHCP server offers a /32 address. This makes adding the default route
fail since it is not reachable via any interface. Linux's
dhclient-script seem to usually have a special case for that and
explicitly adds an interface route to the router's address.

FreeBSD's dhclient-script already has a special case for when the router
address is the same as the leased address. Now also add one for when
it's a different address that doesn't fall in the interface's subnet.

PR:		241792
Event:		Aberdeen hackathon 2022
Submitted by:	sigsys@gmail.com
Reviewed by:	dch, kp, bz (+1 on the idea, not reviewed), thj
MFC after:	1 week
2022-10-05 12:24:31 +02:00
Hans Petter Selasky
55a3bd000d usb(4): Make sure the enumeration thread doesn't loop too fast.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-05 12:12:33 +02:00
Ivan Quitschal
d2d3046436 vt(4): Clear paste buffer after pasting.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
Differential Revision:	https://reviews.freebsd.org/D36042
2022-10-05 11:51:49 +02:00
Ivan Quitschal
90b8910054 vt(4): When cutting a line, append a newline character.
While at it optimise "case 3" into a default.
This way there is no need to initialize the "mark" variable in the beginning,
because all cases set it.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
Differential Revision:	https://reviews.freebsd.org/D36042
2022-10-05 11:51:48 +02:00
Hans Petter Selasky
18a44589fc vt(4): Use define instead of numerical value.
No functional change intended.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-05 11:51:48 +02:00
Hans Petter Selasky
4ea90153ac vt(4): Make sure pressing the extend button updates the current selection.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-05 11:51:41 +02:00
Andrew Turner
fbc9f1b2d6 Remove an extra argument to SYSCTL_FOREACH
This was missed in e0853c9336.

Sponsored by:	The FreeBSD Foundation
2022-10-05 10:27:48 +01:00
Andrew Turner
e0853c9336 Use SYSCTL_FOREACH in drm2
This was added recently. Use it to get the correct _FOREACH macro.

Sponsored by:	The FreeBSD Foundation
2022-10-05 10:26:36 +01:00
Andrew Turner
9d4cff787e Remove pre-armv6 support from devmap
Remove an old code path that was used used by Armv4/5 so is unused now.

Sponsored by:	The FreeBSD Foundation
2022-10-05 09:56:17 +01:00
Michael Tuexen
8ff4fc03e6 traceroute6: fix capabilities for the rcv socket
On the receive socket, recvmsg() and poll()/select() is called.
Therefore, CAP_EVENT is needed in addition to CAP_RECV..

While there, check the socket for readbility before calling recvmsg().

Reviewed by:		markj@
MFC after:		3 days
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D36878
2022-10-04 23:40:29 +02:00
Gleb Smirnoff
b958b862b1 netlink: make it working without INET6 2022-10-04 14:39:49 -07:00
Gleb Smirnoff
a87d2d1830 netlink: fix standalone module build 2022-10-04 14:38:40 -07:00
Ed Maste
963c7b084b ssh-keysign: fix double free in error path
From OpenSSH-portable commit 141535b904b6, OpenBSD commit 3d21aa127b1f.

MFC after:		3 days
2022-10-04 16:34:37 -04:00
Ed Maste
666605ad2d ssh-keygen: fix double free in error path
From OpenSSH-portable commit 5062ad48814b, OpenBSD commit 39f35e16ba87.

MFC after:	3 days
2022-10-04 16:33:11 -04:00
Ed Maste
5e5ebbee81 ssh-keyscan: Strictly enforce the maximum allowed SSH2 banner size
From OpenSSH-portable commit ff89b1bed807, OpenBSD commit 6ae664f9f4db.

MFC after:	3 days
2022-10-04 16:30:00 -04:00
Martin Matuska
be181ee2a2 zfs: merge openzfs/zfs@d62bafee9
Notable upstream pull request merges:
  #13857 Enforce "-F" flag on resuming recv of full/newfs on existing dataset
  #13928 Revert "Reduce dbuf_find() lock contention"
  #13928 Dynamically size dbuf hash mutex array
  #13930 zpool: Don't print "repairing" on force faulted drives
  #13938 Bring per_txg_dirty_frees_percent back to 30
  #13939 Fix panic in dsl_process_sub_livelist for EINTR
  #13954 Fix bad free in skein code
  #13967 Fix potential NULL pointer dereference in dsl_dataset_promote_check()

Obtained from:	OpenZFS
OpenZFS commit:	d62bafee9f
2022-10-04 20:16:52 +02:00
Mark Johnston
6a720fb95a git-arc: Fix handling of review title containing double quotes 2022-10-04 13:05:54 -04:00
Mark Johnston
bdd101c4d4 dtrace: Add a "regs" variable
This allows invop-based providers (i.e., fbt and kinst) to expose the
register file of the CPU at the point where the probe fired.  It does
not work for SDT providers because their probes are implemented as plain
function calls and so don't save registers.  It's not clear what
semantics "regs" should have for them anyway.

This is akin to "uregs", which nominally provides access to the
userspace registers.  In fact, DIF already had a DIF_VAR_REGS variable
defined, it was simply unimplemented.

Usage example: print the contents of %rdi upon each call to
amd64_syscall():

    fbt::amd64_syscall:entry {printf("%x", regs[R_RDI]);}

Note that the R_* constants are defined in /usr/lib/dtrace/regs_x86.d.
Currently there are no similar definitions for non-x86 platforms.

Reviewed by:	christos
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D36799
2022-10-04 13:05:54 -04:00
Mark Johnston
cba2fa7c5b makefs: Add a cast to placate static analyzers
"prefixlen" will always be smaller than 32 but adding a cast is
harmless.

Reported by:	Coverity
2022-10-04 13:05:54 -04:00
Mark Johnston
d5dc278eec riscv: Apply 8d7ee2047c to the riscv pmap
Reviewed by:	alc
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36840
2022-10-04 13:05:54 -04:00
Mark Johnston
d7eec79b70 makefs: Plug a memory leak
nvlist_find_string() would return a copy of the found value, but callers
assumed they would have to make their own copy.  It's simpler to change
nvlist_find_string() than it is to change callers, so do that.

Reported by:	Coverity
2022-10-04 13:05:54 -04:00
Andrew Turner
47218e711e Include opt_platform.h to ensure FDT is defined
We need to include opt_platform.h as it's where FDT will be defined.

Sponsored by:	The FreeBSD Foundation
2022-10-04 17:38:56 +01:00
Andrew Turner
89a9a13c1a Remove unneeded FDT checks from phydev and regdev
They are only ever built when FDT is enabled so there is no need to
check for it in the files.

Sponsored by:	The FreeBSD Foundation
2022-10-04 17:37:37 +01:00
Andrew Turner
a0a4f5cf17 Clear the indirect flag in the GICv3 ITS driver
Summary:
The indirect flag tells the hardware to use a flat or two level table.
As we only support using the flat table ensure the flag that marks
which is in use is set correctly.

We can't rely on this being set correctly as some firmware may set the
indirect flag, e.g. booting from LinuxBoot.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36873
2022-10-04 17:14:16 +01:00
Ed Maste
9515313b26 libc: Fix size range check in setvbuf
From enh at google.com via openbsd-tech mailing list via pfg@:

The existing test is wrong for LP64, where size_t has twice as many
relevant bits as int, not just one. (Found by inspection by
rprichard.)
2022-10-04 12:03:56 -04:00
Hans Petter Selasky
89e5ef8917 Fix kernel build after 754cb545b6 .
By adding missing include file for powerpc64, QORIQ64.

Differential Revision:	https://reviews.freebsd.org/D36565
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-04 17:13:17 +02:00
Alexander Motin
a58536b91a pci: Disable Electromechanical Interlock.
Add sysctl/tunable to control Electromechanical Interlock support.
Disable it by default since Linux does not do it either and it seems
the number of systems having it broken is higher than having working.

This fixes NVMe backplane operation on ASUS RS500A-E11-RS12U server
with AMD EPYC 7402 CPU, where attempts to control reported interlock
for some reason end up in PCIe link loss, while interlock status does
not change (it is not really there).

MFC after:	2 weeks
2022-10-04 10:34:15 -04:00
Hans Petter Selasky
1d41a05557 Fix kernel build after fcb3f813f3 .
By adding missing ifdefs for INET and INET6 when building LINT-NOIP .

Differential Revision:	https://reviews.freebsd.org/D36731
Sponsored by:	NVIDIA Networking
2022-10-04 16:08:39 +02:00
Hans Petter Selasky
c2a808b977 Fix kernel build after fcb3f813f3 .
By adding missing ifdefs for INET6 .

Differential Revision:	https://reviews.freebsd.org/D36731
Sponsored by:	NVIDIA Networking
2022-10-04 15:55:36 +02:00
Hans Petter Selasky
9f69c0b87d Fix kernel build after fcb3f813f3 .
By updating function arguments for ipsec_kmod_ctlinput() which is used
when loading IPSEC support via kernel modules.

Differential Revision:	https://reviews.freebsd.org/D36731
Sponsored by:	NVIDIA Networking
2022-10-04 15:42:51 +02:00
Hans Petter Selasky
d97ecf714e time(3): Increase precision of time conversion functions by using gcd.
When converting times to and from units which have many leading zeros,
it pays off to compute the greatest common divisor first, and then do the
scaling product. This way all time unit conversion comes down to scaling a
signed or unsigned 64-bit value by a fraction represented by two signed
or unsigned 32-bit integers.

SBT_1S is defined as 2^32 . When scaling using powers of 10 above 1,
the gcd of SBT_1S and 10^N is always greater than or equal to 4,
when N is greater or equal to 2.

Scaling a sbt value to milliseconds is then done by multiplying by
(1000 / 8) and dividing by (2^32 / 8).

This trick allows for higher precision at very little additional CPU cost.

It shall also be noted that the Xtosbt() functions prior to this patch,
sometimes were off-by-one:

For example when converting 1 / 8 of a second to sbt as 125ms the old sbt
conversion function would compute 0x20000001 while the new function computes
0x20000000 which multiplied by 8 becomes SBT_1S, which is the correct value.

Reviewed by:	kib@
Differential Revision:	https://reviews.freebsd.org/D36857
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-04 13:51:06 +02:00
Hans Petter Selasky
2ae0861242 cuse(3): Cosmetic change about testing boolean values.
No functional change intended.

Differential Revision:	https://reviews.freebsd.org/D36633
Suggested by:	jrtc27@ and avg@
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-04 13:51:06 +02:00
Hans Petter Selasky
1024bb2633 qdivrem: Predict division by zero as false.
Division by zero triggers an arithmetic exception and should not be very
common. Predict this.

No functional change intended.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-04 13:51:06 +02:00
Randall Stewart
cd84e78f09 tcp idle reduce does not work for a server.
TCP has an idle-reduce feature that allows a connection to reduce its
cwnd after it has been idle more than an RTT. This feature only works
for a sending side connection. It does this by at output checking the
idle time (t_rcvtime vs ticks) to see if its more than the RTO timeout.

The problem comes if you are a web server. You get a request and
then send out all the data.. then go idle. The next time you would
send is in response to a request from the peer asking for more data.
But the thing is you updated t_rcvtime when the request came in so
you never reduce.

The fix is to do the idle reduce check also on inbound.

Reviewed by: tuexen, rscheff
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D36721
2022-10-04 07:09:01 -04:00
Gleb Smirnoff
77198a945a tcp_timers: provide tcp_timer_drop() and tcp_timer_close()
Two functions to call tcp_drop() and tcp_close() from a callout context.
Garbage collect tcp_inpinfo_lock_del(), it has a single use now.

Differential revision:	https://reviews.freebsd.org/D36397
2022-10-03 22:21:55 -07:00
Gleb Smirnoff
775e20c159 tcp: make tcp_drop_syn_sent() static 2022-10-03 21:11:17 -07:00
Gleb Smirnoff
fcb3f813f3 netinet*: remove PRC_ constants and streamline ICMP processing
In the original design of the network stack from the protocol control
input method pr_ctlinput was used notify the protocols about two very
different kinds of events: internal system events and receival of an
ICMP messages from outside.  These events were coded with PRC_ codes.
Today these methods are removed from the protosw(9) and are isolated
to IPv4 and IPv6 stacks and are called only from icmp*_input().  The
PRC_ codes now just create a shim layer between ICMP codes and errors
or actions taken by protocols.

- Change ipproto_ctlinput_t to pass just pointer to ICMP header.  This
  allows protocols to not deduct it from the internal IP header.
- Change ip6proto_ctlinput_t to pass just struct ip6ctlparam pointer.
  It has all the information needed to the protocols.  In the structure,
  change ip6c_finaldst fields to sockaddr_in6.  The reason is that
  icmp6_input() already has this address wrapped in sockaddr, and the
  protocols want this address as sockaddr.
- For UDP tunneling control input, as well as for IPSEC control input,
  change the prototypes to accept a transparent union of either ICMP
  header pointer or struct ip6ctlparam pointer.
- In icmp_input() and icmp6_input() do only validation of ICMP header and
  count bad packets.  The translation of ICMP codes to errors/actions is
  done by protocols.
- Provide icmp_errmap() and icmp6_errmap() as substitute to inetctlerrmap,
  inet6ctlerrmap arrays.
- In protocol ctlinput methods either trust what icmp_errmap() recommend,
  or do our own logic based on the ICMP header.

Differential revision:	https://reviews.freebsd.org/D36731
2022-10-03 20:53:04 -07:00
Gleb Smirnoff
809fef2913 netipsec: move specific ipsecmethods declarations to ipsec_support.h
where struct ipsec_methods is defined.  Not a functional change.
Allows further modification of method prototypes without breaking
compilation of other ipsec compilation units.

Differential revision:	https://reviews.freebsd.org/D36730
2022-10-03 20:53:04 -07:00
Gleb Smirnoff
c0fc81e913 netinet*: remove dead code from TCP, UDP, SCTP control input
Now these functions are called only from icmp*_input().  The pointer
to the ICMP data is never NULL and cmd has a limited set of values.

In the past the functions were demultiplexing control messages from
ICMP layer, as well as internally generated events.  In the latter
case the the pointer to IP would be NULL.

Differential revision:	https://reviews.freebsd.org/D36729
2022-10-03 20:53:04 -07:00
Gleb Smirnoff
7f3b00a87a netinet: filter out invalid ICMP responses in ip_icmp()
instead of doing that in every ipproto_ctlinput_t method.

Reviewed by:		melifaro
Differential revision:	https://reviews.freebsd.org/D36728
2022-10-03 20:53:04 -07:00
Gleb Smirnoff
53807a8a27 netinet*: use sparse C99 initializer for inetctlerrmap
and mark those PRC_* codes, that are used.  The rest are dead code.
This is not a functional change, but illustrative to make easier
review of following changes.
2022-10-03 20:53:04 -07:00
Gleb Smirnoff
43d39ca7e5 netinet*: de-void control input IP protocol methods
After decoupling of protosw(9) and IP wire protocols in 78b1fc05b2 for
IPv4 we got vector ip_ctlprotox[] that is executed only and only from
icmp_input() and respectively for IPv6 we got ip6_ctlprotox[] executed
only and only from icmp6_input().  This allows to use protocol specific
argument types in these methods instead of struct sockaddr and void.

Reviewed by:		melifaro
Differential revision:	https://reviews.freebsd.org/D36727
2022-10-03 20:53:04 -07:00
Gleb Smirnoff
46ddeb6be8 netinet6: retire ip6protosw.h
The netinet/ipprotosw.h and netinet6/ip6protosw.h were KAME relics, with
the former removed in f0ffb944d2 in 2001 and the latter survived until
today.  It has been reduced down to only one useful declaration that
moves to ip6_var.h

Reviewed by:		melifaro
Differential revision:	https://reviews.freebsd.org/D36726
2022-10-03 20:53:04 -07:00
Gleb Smirnoff
0ab46f28dc tcp: remove unnecessary include of tcp6_var.h
Reviewed by:		rscheff, melifaro
Differential revision:	https://reviews.freebsd.org/D36725
2022-10-03 20:53:04 -07:00
Gleb Smirnoff
bb77f0c204 udp: typedef udp tunneling functions to functions, not pointers
With this change one can make a forward declaration of a function
that is of UDP tunneling type.

Reviewed by:		melifaro
Differential revision:	https://reviews.freebsd.org/D36724
2022-10-03 20:53:04 -07:00
Gleb Smirnoff
24b96f35b9 netinet*: move ipproto_register() and co to ip_var.h and ip6_var.h
This is a FreeBSD KPI and belongs to private header not netinet/in.h.

Reviewed by:		melifaro
Differential revision:	https://reviews.freebsd.org/D36723
2022-10-03 20:53:04 -07:00
John Baldwin
ab9293239c qsort_b_test: Only build on clang.
GCC doesn't support -fblocks.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D36809
2022-10-03 16:14:39 -07:00