summaryrefslogtreecommitdiff
path: root/sbin
AgeCommit message (Collapse)Author
2023-07-03Nuke unused label 'next:'.Kenneth R Westerback
2023-07-03The only thing worse than treating 'return' as a function call isKenneth R Westerback
randomly mixing 'return (blah)' and 'return blah' idioms. Nuke the '()'s. No intentional functional change.
2023-07-02Add button mappings for two- and three-finger clicks on clickpads.Ulf Brosziewski
Based on a proposal of tobhe@. ok tobhe@
2023-06-29Fix handling of 'N-* 100' template entries.Kenneth R Westerback
'N-* 100' means a max of all 'extra' disk space not all disk space. Fixes templates with partitions after a 'N-* 100' entry. Reported by anton@
2023-06-28Add support to verify X509 chain from CERT payloads.Tobias Heider
Encode cert and intermediate CAs in new cert bundle object, so the information can be passed to the ca process in one step. Pass untrusted intermediates to X509_verify_cert(). From markus@
2023-06-28Don't call daemon() after proc_init(), otherwise the child processesGerhard Roth
would lose their parent. ok tobhe@
2023-06-28Refactor editor_allocspace() into easier to follow pieces.Kenneth R Westerback
editor_allocspace() interates over alloc_tables calling allocate_space(). allocate_space() iterates over space_allocations calling allocate_partition(). allocate_partition() calls allocate_diskchunk() which finds disk space for the partition. No intentional functional change. ok otto@
2023-06-25remove ca_sslinit()Omar Polo
it's a noop; nowadays both LibreSSL and OpenSSL libcrypto and libssl initialize themselves automatically before doing anything. spotted by tb, ok tb tobhe
2023-06-21Add a parameter 'action' to mpfree() so it can optionally discardKenneth R Westerback
or keep the memory pointed at by the char ** parameter. Allows mpfree() to be used against the global mountpoints[] and eliminates a couple of manual loops to free the current contents of mountpoints[]. No intentional functional change.
2023-06-20Take more care to ensure name_to_string() always returns a properKenneth R Westerback
string. Don't rely on GPT partition name containing a terminating zero or the reserved bytes beyond gp_name being properly initialized to zero.
2023-06-19"%-Ns\n" is more appropriately "%s\n" to avoid adding extraneousKenneth R Westerback
blanks to the end of the line. Unexpected line wrapping noticed by kettenis@, cause spotted by deraadt@ Nuke an unused variable in passing.
2023-06-19Improve the ibuf API by adding these functions:Claudio Jeker
Functions extending ibuf_add to work with more specific data types ibuf_add_buf, ibuf_add_zero, ibuf_add_n8, ibuf_add_n16, ibuf_add_n32, ibuf_add_n64 Functions replacing ibuf_seek where data at a specific offset is modified ibuf_set, ibuf_set_n8, ibuf_set_n16, ibuf_set_n32, ibuf_set_n64 Functions to check, get and set the filedescriptor stored on the ibuf ibuf_fd_avail, ibuf_fd_get, ibuf_fd_set and ibuf_data() to access the data buffer, to be used together with ibuf_size() On top of this add an optimized imsg_compose_ibuf() where an ibuf is wrapped into an imsg in an efficent way. Finally remove msgbuf_drain since it is not used by anything outside of the ibuf code. Because of this removal bump the major of libutil. Remove ibuf_data() in iked since the same function is now provided by libutil. OK tb@
2023-06-19Replace eclectic mix of errx(4, "out of memory"), err(4, NULL)Kenneth R Westerback
and err(1, NULL) with consistent err(1, NULL) when responding to out of memory conditions.
2023-06-19The group "operator" gatekeeps a few superuser abilities (dumping disks,Theo de Raadt
manipulating tape drives -> means gid operator on device nodes). This group is also used with group-access bit on the setuid-root shutdown command (mode ug+x,u+s). Some people use this to shutdown/reboot their machines, but use of that group is giving them disk read access also, which is wrong. It would be a pain to re-gid all the device nodes, so instead let's renumber the operator execution gid into group "_shutdown". Users using this shutdown/reboot functionality will notice it no longer works, and move themselves to the correct group. Various choices discussed at large, this seems our best choice. ok sthen
2023-06-18Add and use CHUNKSZ() to replace 'chunk->stop - chunk->start'Kenneth R Westerback
occurrances. Shorter lines, more obvious intent.
2023-06-18Use UINT64_MAX instead of -1 to set a uint64_t value toKenneth R Westerback
its maximum.
2023-06-17Fix leak of key.id_buf in pubkey auth case.Tobias Heider
from markus
2023-06-16Now that print_host() is unused, rename it to print_addr() and simplify.Theo Buehler
ok claudio tobhe
2023-06-14Replace the last few print_host() calls with print_addr() ones.Claudio Jeker
In most cases print_host(addr, buf, buflen) can be replaced with strlcpy(buf, print_addr(addr), buflen). Some code was never fully adjusted to the full power of print_host() and there are remnants of times well before print_host() supported multiple internal buffers. With and OK tb@
2023-06-13iked: introduce and use print_addr()Theo Buehler
The vast majority of print_host() callers cast the first argument (usually a sockaddr_storage *) to (struct sockaddr *) and pass both a NULL buffer and 0 length. Cast and useless arguments lead to awkward line wrapping in many places. Clean this up by introducing a helper. Make this helper take a void pointer, so all casts go away. ok claudio kn tobhe
2023-06-13Fix FILE leak in error path.Claudio Jeker
If flowf is NULL then fclose(spif) must be called. Split up the error check from if (spif == NULL || flowf == NULL) to individual checks since that is easier to read. Noticed by markus@, OK tb@
2023-06-12Use stdio open_memstream(3) to build up log strings instead of trying toClaudio Jeker
abuse ibufs for that. Using stdio for this has the benefit of using any stdio function to build up strings including fprintf(). With and OK tb@
2023-06-09Readd "-wgpsk", accidentially dropped in r1.465 adding "wgdescr"Klemens Nanni
Noticed by Bradley Latus Diff from Jane Johansson OK tb
2023-06-07Rename ifconfig tcprecvoffload to tcplro. It is shorter andAlexander Bluhm
more consistent. discussed with jan@ mvs@ chris@ claudio@ dlg@
2023-06-06Use same pattern to work with offset by using a uint8_t pointer thatClaudio Jeker
is loaded with ibuf_data(). This is by no means better but allows to switch ibuf_data() to return void *. OK tb@
2023-06-06Use ibuf_seek() instead of ibuf_data() + offset constructs. Effect isClaudio Jeker
the same in these cases. OK tb@
2023-06-01Add support for wireguard peer descriptionsKlemens Nanni
"wgdescr[iption] foo" to label one peer (amongst many) on a wg(4) interface, "-wgdescr[iption]" or "wgdescr ''" to remove the label, completely analogous to existing interface discriptions. Idea/initial diff from Mikolaj Kucharski (OK sthen) Tests/prodded by Hrvoje Popovski Tweaks/manual bits from me Feedback deraadt sthen mvs claudio OK claudio
2023-05-30Replace the one use of ibuf_prepend() using a similar ibuf_new() + ibuf_cat()Claudio Jeker
method but instead of overwriting ibuf internals replace the buf a level up. Users of ikev2_msg_send() are not allowed to hold and reuse a pointer to msg_data (which is another footgun to disarm at some point). OK tb@
2023-05-23Replace ibuf_advance() with ibuf_reserve().Claudio Jeker
OK tobhe@ tb@ kn@
2023-05-23With the retirement of expert mode, get_fsize(), get_bsize() andKenneth R Westerback
get_cpt() simply set a partition's p_fragblock/p_cpg to default values. Replace them with a single function set_fragblock(). No functional change.
2023-05-23Replace ibuf_release() with ibuf_free() since the former just calls the latterClaudio Jeker
OK kn@ tb@
2023-05-23There is no need to ibuf_zero() or memset() any buffers.Claudio Jeker
More cleanup will follow. OK tobhe@
2023-05-21If an MBR partition start or end can be represented by CHS, setKenneth R Westerback
both CHS and LBA values in the MBR partition. Restores pre-7.0 initialization of MBR partition start/end, using slightly less opaque code that retains the slightly different initialization required by GPT protective MBR's. Fixes booting from disks >8G on systems where the BIOS uses CHS. Encountered by Paul de Weerd on his Alix.2 using BIOS 0.99. Much diagnosis and testing by Paul of various iterations. Thanks!
2023-05-20p_fragblock = DISKLABELV1_FFS_FRAGBLOCK(0, 0) sets p_fragblock toKenneth R Westerback
0. Just use p_fragblock = 0 as in all other initializations of p_fragblock. No functional change.
2023-05-17Implement battery management sysctl. This will provide a set of sysctlsMark Kettenis
to control the charging of laptop batteries: * hw.battery.chargemode (int) -1: force discharge 0: inhibit charge 1: auto In auto mode charging may be controlled by: * hw.battery.chargestop (int) Percentage (0-100) of last full capacity at which the battery should stop charging. * hw.battery.chargestart (int) Percentage (0-100) of last full capacity at which the battery should start charging. The idea is that with hw.battery.chargemode=1 hw.battery.chargestop=80 hw.battery.chargestart=75 the battery would be kept charged within the range between 75% and 80%. Allowable settings and some details of the behavior may differ between hardware implementations. Committing this early to easy testing of further diffs that implement this functionality in acpithinkpad(4) and aplsmc(4). ok kn@
2023-05-17Make function and symmetry obvious by renaming PRT_make() toKenneth R Westerback
PRT_prt_to_dp() and PRT_parse() to PRT_dp_to_prt(). No functional change.
2023-05-16Use separate IFCAPs for LRO and TSO.Jan Klemkow
This diff introduces separate capabilities for TCP offloading. We split this into LRO (large receive offloading) and TSO (TCP segmentation offloading). LRO can be turned on/off via tcprecvoffload option of ifconfig and is not inherited to sub interfaces. TSO is inherited by sub interfaces to signal this hardware offloading capability to the network stack. With tweaks from bluhm, claudio and dlg ok bluhm, claudio
2023-05-14Improve emulation of a disktab entry (-t) by using the typeKenneth R Westerback
specified in the disktab entry (:dt:) when setting the default disklabel's d_type. This will enable installboot(8) to know the vnd device should be treated as a floppy disk. Feedback & improved field packing from millert@
2023-05-13In the absence of the 'disktype' command line parameter alwaysKenneth R Westerback
use the d_type value provided by the kernel when creating, editing or printing a disklabel. i.e. treat d_type as disk geometry is treated, reflecting current reality as opposed to historical data.
2023-05-12Add interface names in front of error messages.Jan Klemkow
Suggested by Hrvoje Popovski. ok phessler@
2023-05-10Display correct type name for Microsoft basic data GPTKenneth R Westerback
partitions. Inadvertantly lost in transition to new menu logic.
2023-05-10Microsoft GPT partition attributes can appear on partitions otherKenneth R Westerback
than Basic Data partitions. e.g. Windows Recovery and Windows Reserved partitions. So tweak verbiage to make clear they are MS attributes by prepending 'MS' and always display them. No functional change other than modified fdisk -v output.
2023-05-09switch pflogd from using a bpf read timeout to a wait timeout.David Gwynne
a bpf read timeout means every read will end after the timeout expires. because pflogd has a half second read timeout it would sit in a loop doing reads all the time even if there were no packets to log. the wait timeout means that when bpf catches a packet, it will wait a bit for more packets to arrive before waking up the pending read. pflogd now sits in the read syscall until packets are actually available to log. found by deraadt@ and ktrace discussed with and ok sashan@
2023-05-07GPT partitions with the 'Required' attribute are not deleted by -A.Kenneth R Westerback
2023-05-06Replace pointless %d formatting of 0 values withKenneth R Westerback
literal '0's. No functional change.
2023-04-30avoid use after freeJonathan Gray
ok florian@
2023-04-30Remove artifical limit of 2 hours on a PIO lifetime, as recommended byPeter Hessler
draft-ietf-6man-slaac-renum-05 and implemented by Linux in 2020. OK florian@
2023-04-30Fix that atactl sd0 readattr didn't work for some disks. Change it toYASUOKA Masahiko
check the cksums of the attribute values instead of comparing the revisions. diff from NetBSD through naito.yuichiro at gmail.com. test by kolipe.c at exoticsilicon.com. ok kevlo miod deraadt
2023-04-28This change speeds up DIOCGETRULE ioctl(2) which pfctl(8) uses toAlexandr Nedvedicky
retrieve rules from kernel. The current implementation requires like O((n^2)/2) operation to read the complete rule set, because each DIOCGETRULE operation must iterate over previous n rules to find (n + 1)-th rule to read. To address the issue diff introduces a pf_trans structure to keep pointer to next rule to read, thus reading process does not need to iterate from beginning of rule set to reach the next rule. All transactions opened by process get closed either when process is done (reads all rules) or when /dev/pf device is closed. the diff also comes with lots of improvements from dlg@ and kn@ OK dlg@, kn@
2023-04-27Retire -E's "expert" mode. Introduced 23 years ago to avoidKenneth R Westerback
confusing users with FFS attributes that only experts should fiddle with. Actual use has withered away with functionality rendered moot or moved elsewhere. '-e' remains for the truly obscure corner cases. Simply excise the code for now to see if hidden users/uses are exposed. Further simplifications are possible if no such users/uses surface. ok with sthen@ millert@ kn@ otto@