summaryrefslogtreecommitdiff
path: root/sbin
AgeCommit message (Collapse)Author
2018-08-26Unveil pflogd(8). Similiar to florian@'s recent changes to ifconfig(8),Bryan Steele
the priviledged parent cannot be pledged due to certain ioctls, but we can use unveil(2) to lock down its access to the filesystem. To be able to use hostnames/dns in tcpdump-like filter expressions, we unveil /etc/{resolv.conf,hosts,services} "r", kept in sync with the kernel bypass for pledge("dns") Additionally, we need to unveil /dev/bpf "r" and the output log file "rwc". The unpriviledged child is pledged "stdio recvfd" and thus does not need any unveils. With feedback/testing from florian@, deraadt@ ok florian@ deraadt@
2018-08-26pflogd(8): don't try to rename(2) broken/invalid pflog files, instead,Bryan Steele
suspend logging until the log file has been moved out of the way, and we have received either SIGHUP or SIGALRM. ok florian@ deraadt@
2018-08-26The three -B forms of disklabel(8) were nuked years ago. So removeKenneth R Westerback
stray reference to them.
2018-08-24Drop special handling of SIGSYS.cheloha
Tolerance for up to 25 SIGSYS deliveries was added to init(8) soon after the addition of sysctl(2) at CSRG, presumably to ease the transition to the new ABI. After 25 years of work the ABI transition is finally complete and we can now safely remove this splint. In general, we now have better practices and methods for helping userspace across kernel ABI breaks. ok deraadt@
2018-08-24display CPU_CPUID / machdep.cpuid in hex not decimalJonathan Gray
2018-08-23Always check the return values of get_[fsize|bsize|cpg].Kenneth R Westerback
Accept partition changes only if all succeed. ok tb@ deraadt@
2018-08-21Unbreak 'R'esize.Kenneth R Westerback
Problem noted and fix tested by jcs@. ok otto@
2018-08-19Call daemon with 0 as first argument so that it changes the cwd to /Florian Obser
otherwise the main process will keep sitting in the directory from where slaacd was started which might for example prevent an unmount. Problem first observed by dlg in ntpd(8). Discussed with deraadt@
2018-08-15Restore ability to use hostnames to configure ip addresses.Florian Obser
Unveil /etc/{resolv.conf,hosts,services} which keeps it in sync with the kernel bypass for pledge("dns"). OK deraadt pointed out by & OK stsp
2018-08-14unveil(2) /etc/nologin.txt for readingcheloha
ok deraadt
2018-08-13The iterator i is not the option code, but simply the index for thePatrick Wildt
array that stores the option codes. Fixes the issue where it named an incorrect option on error. Found by Florian Kaiser ok krw@
2018-08-13consistent macros;Jason McIntyre
2018-08-12Add administrative options to LACP trunk implementation.ccardenas
The trunk driver now has a new ioctl (SIOCxTRUNKOPTS), which for now only has options for LACP: * Mode - Active or Passive (default Active) * Timeout - Fast or Slow (default Slow) * System Priority - 1(high) to 65535(low) (default 32768/0x8000) * Port Priority - 1(high) to 65535(low) (default 32768/0x8000) * IFQ Priority - 0 to NUM_QUEUES (default 6) At the moment, ifconfig only has options for lacpmode and lacptimeout plumbed as those are the immediate need. The approach taken for the options was to make them on a "trunk" vs a "port" as what's typically seen on various NOSes (JunOS, NXOS, etc...) as it's uncommon for a host to have one link "Passive" and the other "Active" in a given trunk. Just like on a NOS, when applying lacpmode or lacptimeout, the settings are immediately applied to all existing ports in the trunk and to all future ports brought into the trunk. Tested by many on a plethora of NIC drivers and switches. Ok remi@
2018-08-12Make ifconfig's -joinlist command work as advertised.Stefan Sperling
ok deraadt phessler
2018-08-12add missing markup;Jason McIntyre
2018-08-11Nuke stray/pointless 'volatile' for local var.Kenneth R Westerback
2018-08-11Fix problems ofthe ifconfig argument parser with "ifconfig <if> join".Sebastian Benoit
Due to the way the parsing works, you cannot have an option that accepts strings as argument or no argument, without side effects: for example "join <nwid>" could only join networks that did not have a nwid identical to another ifconfig option, i.e. "join mtu" or "join join" would not work. Solve this by making join always require an nwid. Listing all the configured nwids for auto-join is moved to the new option "joinlist". Removing _all_ auto-join configuration is moved to "-joinlist". deraadt@ likes it and ok phessler@ stsp@
2018-08-10Zap bits in host_v4(), use mask parameterkn
This avoids a duplicate strrchr() call and makes the function consistent with host_v6() regarding mask handling. While here, use the destination's size in memcpy instead of hardcoding its type. OK sashan
2018-08-09Drop support for guessing an old-style class A, B, or C netmask fromIngo Schwarze
a bare dot-notation IP address by counting trailing zero octets. Instead, assume -host when neither -net nor -netmask nor -prefixlen is given. Error out when -net is requested but no netmask is specified. This removes the last use of the IN_CLASS* macros from this program. OK claudio@ kn@, and many agreed with the general direction during g2k18.
2018-08-08ifconfig cannot be pledged because of its overwhelming amount ofFlorian Obser
used ioctls. Furthermore due to the way the command line parser is written it is difficult to apply the traditional first initialize then pledge pattern. unveil(2) gives us a different approach: By veiling everything with unveil("/", "") and then locking down unveil with unveil(NULL, NULL) we remove all filesystem access from ifconfig kind of like giving a regular user a chroot without any files. OK deraadt
2018-08-08tabs are ok at start of line, but internally space seperation is the normTheo de Raadt
2018-08-06make ifconfig <if> join display the list of networks configured forSebastian Benoit
auto-join with feedback from florian and stsp ok florian@ phessler@ (on previous versions of the diff) stsp@
2018-08-06Remove cpath pledge(2) promise. We decided that not deleting the unix controlRicardo Mestre
sockets cause no harm and this way we close another attack surface by not allowing the daemon to create/delete any more files. OK kn@
2018-08-05Since -s argument is no longer checked, during reexec, the argv size then mustRicardo Mestre
be shortened by 1. OK florian@
2018-08-04Oops. Missing chunk from previous 'secs' -> 'ui'.Kenneth R Westerback
2018-08-04Rename local variable 'secs' to 'ui' to be consistant with all otherKenneth R Westerback
uses of getuint64(). No change to executable.
2018-08-04Leave the control socket behind on shutdown. It doesn't hurt anyone.Florian Obser
On the other hand it is much more powerful to get rid of cpath; slaacd has no filesystem access whatsoever. Triggered by mestre@'s work to fix unlinking in other daemons and a question from deraadt@ OK mestre
2018-08-03Move pledge after getopt when we know whether the operation is reboot,Theo de Raadt
powerdown, halt, or singleuser. Before pledge, unveil access to /dev/console, /etc/rc for singleuser entry, execute of /usr/bin/wall to alert users, and creation of the fastboot and nologin files. Also conditionally allow execute of halt, reboot, or the shell depending on mode. Believe all scenarios were tested -- please exercise this one a bit.
2018-08-03document that wpakey needs a preceeding nwid OR join specificationAlexander Hall
ok phessler@
2018-08-02errno is never checked after a call to getuint64(). So there is noKenneth R Westerback
point to getuint64() setting it to EINVAL when the user enters an invalid value or aborts input with a ^D.
2018-07-31Zap v4mask and v6mask in host()kn
Simply defer checks whether a mask has been specified to where it's set in host_*(); this is to reduce address family specific code. OK sashan
2018-07-30recognize WSMOUSE_TYPE_TOUCHPAD devicesJoshua Stein
ok bru
2018-07-30Simplify host()kn
Get rid of the `cont' flag, zap obvious comments, add error label. OK benno sashan
2018-07-28Use strtonum in host()kn
This is simpler than checking three cases for `q' and gives nicer error messages. While here, use `v6mask' as maximum netmask instead of hardcoding it. OK sashan
2018-07-27Have slaacd(8) share information on receiving a MTU advertisement withbket
slaacctl(8). OK florian@
2018-07-27Enable slaacd(8) to set MTU on an interface.bket
If a router advertisement message with the MTU option is received on an interface slaacd will set the specified MTU on that interface. Lots of help from florian@. Thank you! OK florian@
2018-07-24Move duplicate code into new helper print_addr_str()kn
This simply puts the wiggle around inet_ntop() from four into one location. OK benno
2018-07-24Simplify getaddrinfo() error handlingkn
`error' is not used so drop it and jump to the end. OK sashan
2018-07-23When moving between networks slaacd configures new addresses butFlorian Obser
leaves old ones behind. The IPv6 RFCs don't seem to offer guidance on what to do in this case. (RFC 5220 discusses related issues, but not exactly this.) It seems a bit harsh to just delete old addresses - a naive implementation can easily lead to flip-flopping between two prefixes. Instead set the preferred lifetime to 0 for all addresses on an interface when the link goes down, thus marking addresses as deprecated but still usable. When the link comes back send a router solicitation. If we are still on the old network and receive a router advertisement the preferred lifetime will increase and the addresses will no longer be deprecated. If we moved to a new network we will get new router advertisements and form new addresses. The old ones will stay deprecated and the address selection algorithm will prefer new addresses. Problem reported by many. testing & OK phessler
2018-07-23replace references to rtadvd(8) with rad(8)Florian Obser
OK deraadt, phessler, jmc
2018-07-23Handle duplicate address detection failures.Florian Obser
We get notified when duplication is detected on the route socket. For privacy addresses simply generate a new random address. If we have soii enabled increase the dad counter on the prefix and generate a new address. For eui64 addresses nothing can be done.
2018-07-22No need to re-implement realloc(). Just use itKenneth R Westerback
the way the man page says. ok tb@
2018-07-22Tweak comment about truncating NULs to reflect newKenneth R Westerback
reality.
2018-07-22When finished pulling an option out of a buffer, skip directly to theKenneth R Westerback
next option. Don't rely on truncated NULs being ignored because NUL == DHO_PAD. ok tb@
2018-07-21Reading past the end of a buffer is bad, Even if theKenneth R Westerback
extra byte is always there. Even if the byte contains innocuous data that isn't used. Eeven if a particular level of optimization of a particular compiler avoids it by processing things backwards. Bad. So simplify and correct logic. Perhaps even proof the code against future generations of clever compilers. Pointed out by Brandon Falk. Thanks! ok millert@ tb@
2018-07-21There is no need to initialise global and static local variables to zero,Claudio Jeker
they are like that by default. OK florian@
2018-07-20Stop checking table commands for `create'kn
Tiny left over from 2003 when it was removed. Twist the logic by checking for `show' and `test' to make it even simpler. OK sashan henning
2018-07-19i found a nicer way to describe -join;Jason McIntyre
2018-07-18replace manual zero initialization of various fields with memset;Florian Obser
makes the code shorter and easier to read. suggested by & OK claudio
2018-07-18When running flood ping with count packets (-c) set an alarm afterFlorian Obser
sending all packets otherwise ping will wait forever to see all answers - which might not arrive on lossy links. Problem pointed out by, input & OK claudio