OpenBSD Hacks

Donovan's CD

These are some hacks I've applied to OpenBSD here at CITI. Some were supplied by others, and are so credited. The rest are mine.

Here is a list of all my OpenBSD cvs commits.

Some laptops I have used, with kernel and X config files:

Some other web pages you might find useful:

All

Afs token passing over ssh

Tunnel nfs v3 over ssh

slimserver
Not as easy as it should be.

Multi-booting
How to install a boot switcher for multiple OS on one i386 machine, particularly for OpenBSD and NT.

wsconsctl
Fix the BackSpace keysym. After applying this fix, copy dev/wscons/wsksymdef.h to /usr/include/dev/wscons, and rebuild /sbin/wsconsctl. To fix the backspace key, you also need to do:

wsconsctl -w keyboard.map+="keycode 14 = Cmd_ResetEmul BackSpace"
Or if you don't want to fix wsconsctl:
wsconsctl -w keyboard.map+="keycode 14 = Cmd_ResetEmul unknown_8"

If you want the "Backspace" key to send ^? instead of ^H, that's fine, but the right way to do this is to bind keycode 14 to KS_Delete. Re-defining KS_BackSpace is just plain wrong. This is done correctly in NetBSD.

August 28, 2002: Six weeks after I tried to get this fixed and was told, "we don't do backspace," my fix has been commited without giving me credit.

xterm
A quick hack to make shift-mouse1 copy & paste a word, and ctl-shift-mouse1 copy a word (like double-click on mouse1).

Some of my firefox config settings

Building Firefox 1.5
Building Firefox 1.5-rc1
Building Firefox 1.0.7
Building Firefox 1.0.5
Building Firefox 1.0.4
Building Firefox 1.0.1
Building Firefox 1.0
Building Firefox 1.0-PR
Building Firefox 0.9
Building Firefox 0.8
Building Firebird 0.7

twm patch for Mozilla focus bug

OpenBSD 4.3

aac
aac management interface stuff. I didn't write this.

nfs-port
Don't insist on a reserved port for nfs mounts.

nfs
Become root in nfs_connect. Needed for tcp mounts against Netapp (for example).

ukbd
Fix the keysym for the Backspace key on usb keyboards (see wscons above).

vfs
Don't panic on dangling inodes. Only needed for afs. Possibly dangerous, not recommended.

wdc
After boot, always use 10 second timeout in wdcwait(). Try this if your disk fails to work after having been spun down.

OpenBSD 4.1

aac
aac management interface stuff. I didn't write this.

mount_nfs
Options -h,-n,-v for mounting by file handle.

nfs
Become root in nfs_connect. Needed for tcp mounts against Netapp (for example).

nfs-port
Don't insist on a reserved port for nfs mounts.

ukbd
Fix the keysym for the Backspace key on usb keyboards (see wscons above).

vfs
Don't panic on dangling inodes. Only needed for afs. Possibly dangerous, not recommended.

wdc
After boot, always use 10 second timeout in wdcwait(). Try this if your disk fails to work after having been spun down.

OpenBSD 4.0

nfs
Become root in nfs_connect. Needed for tcp mounts against Netapp (for example).

nfs-port
Don't insist on a reserved port for nfs mounts.

ral
revision 1.28
date: 2006/12/03 16:39:13; author: damien; state: Exp; lines: +4 -2
fix handling of the SIOCS80211CHANNEL ioctl in monitor mode: don't call xxx_set_chan() if the interface is not up&running.

patch from Steffen Schuetz (st dot sch at gmx dot net) with minor modifications by me.

closes kernel/5313

sdhc
revision 1.17
date: 2007/01/31 12:54:47; author: claudio; state: Exp; lines: +2 -1
Workaround for the problem where the SD card reader stops responding after a card is ejected. Problem identified and patch provided by Matthew R. Dempsky.

ukbd
Fix the keysym for the Backspace key on usb keyboards (see wscons above).

vfs
Don't panic on dangling inodes. Only needed for afs. Possibly dangerous, not recommended.

wdc
After boot, always use 10 second timeout in wdcwait(). Try this if your disk fails to work after having been spun down.

OpenBSD 3.9

install
Don't give up on chown/chgrp/chmod failure (for afs).

iwi
revision 1.67 author: damien
call iwi_stop() at beginning of iwi_init() so that all rings are properly reset when iwi_init() is called from iwi_ioctl() on ENETRESET. this fixes a firmware panic when setting a WEP key multiple times for instance. fix some printf while i'm here.
pointed out by Kurt Miller (kurt@).

mount_nfs
Options -h,-n,-v for mounting by file handle.

nfs
Become root in nfs_connect. Needed for tcp mounts against Netapp (for example).

nfs-port
Don't insist on a reserved port for nfs mounts.

ral
Various backports for ral(4).

ukbd
Fix the keysym for the Backspace key on usb keyboards (see wscons above).

vfs
Don't panic on dangling inodes. Only needed for afs. Possibly dangerous, not recommended.

wdc
After boot, always use 10 second timeout in wdcwait(). Try this if your disk fails to work after having been spun down.

OpenBSD 3.6

aac
Various fixes from Nathan Binkert to the aac(4) driver.

bcm5750
Support for bcm5750 backported from 3.7.

fd
Do not allow users to trick suid programs into re-opening files via /dev/fd (from 3.7).

install
Don't give up on chown/chgrp/chmod failure (for afs).

ioperm
Constrain i386_set_ioperm(2) so even root is blocked from accessing the ioports unless the machine is running at lower securelevels or with an open X11 aperture (from 3.7).

msdos
Fix a bug where a truncate operation involving truncate() or ftruncate() on an MSDOSFS file system either failed, silently corrupted the file, or sometimes corrupted the neighboring file.

From Ariff Abdullah via trhodes@freebsd.org. FreeBSD PR 53695.

nfs
Become root in nfs_connect. Needed for tcp mounts against Netapp (for example).

nfs-port
Don't insist on a reserved port.

scsi
Fixes for the Archos Multimedia Jukebox. I got the quirk from FreeBSD scsi_da.c and the code from Kenneth R Westerback.

ukbd
Fix the keysym for the Backspace key on usb keyboards (see wscons above).

vfs
Don't panic on dangling inodes. Only needed for afs. Possibly dangerous, not recommended.

wdc
After boot, always use 10 second timeout in wdcwait(). Try this if your disk fails to work after having been spun down.

OpenBSD 3.5

install
Don't give up on chown/chgrp failure (for afs).

pccbb
More chip init code for TI. From FreeBSD via NetBSD.

usb
Initialise `restartcnt' in the newly malloc'd usbd_port structure. Fixes "uhub0: port error, giving up port 1" From FreeBSD.

vfs
Don't panic on dangling inodes. Only needed for afs. Possibly dangerous, not recommended.

vt8366
Init Viatech 8366. From FreeBSD.

wdc
Always use 10 second timeout in wdcwait(). Try this if your disk fails to work after having been spun down.

OpenBSD 3.3

em
Update em(4) for Intel 82547 gigE (and others)

i2o
Various i2o fixes from Free/NetBSD, an unsuccessfull attempt to get an Adaptec controller to work.

install
Don't give up on chown/chgrp failure (for afs).

l2cache
Failed attempt to re-enable L2 cache after resume on a Thinkpad 240 (you don't need this).

nfs
Don't crash in nfs_link() for cross-device links.

pccbb
More chip init code for TI. From FreeBSD via NetBSD.

procfs
Check for integer overflow in procfs. Back-ported from the OpenBSD 3.5 patch.

tcp_input
Reply to in-window SYN with a rate-limited ACK. Back-ported from the OpenBSD 3.5 patch.

scsi
Add a quirk for the Archos Multimedia Jukebox. I got this from FreeBSD scsi_da.c.

ssh
Don't check directory permissions up the tree from ~/.ssh.

usb
Initialise `restartcnt' in the newly malloc'd usbd_port structure. Fixes "uhub0: port error, giving up port 1". From FreeBSD.

vfs
Don't panic on dangling inodes. Only needed for afs. Possibly dangerous, not recommended.

vt8366
Init Viatech 8366. From FreeBSD.

wdc
Always use 10 second timeout in wdcwait(). Try this if your disk fails to work after having been spun down.

OpenBSD 3.1

altq
Allow non-pentium kernel configs to build.

install
Don't give up on chown/chgrp failure (for afs).

ip_input
Only free rt once. From Henric Jungheim <henric@attbi.com>.

kafs
Use Transarc afs syscall instead of arla. Not needed for OpenAFS, which uses the arla syscall.

ssh
Don't check directory permissions up the tree from ~/.ssh.

stand
Various /boot fixes from Marcus Watts <mdw@umich.edu>.

vfs
Don't panic on dangling inodes, don't lock fs on unmount. Only needed for afs. Possibly dangerous, not recommended.

wdc
Always use 10 second timeout in wdcwait(). Try this if your disk fails to work after having been spun down.

OpenBSD 3.0

apm
Back out kqueue. Fixes bios initiated suspend on Thinkpad 240. If you apply this, you must also run the 2.9 apmd.

elink3
Zero csum on re-use. Try this if you get 50% packet loss on ep devices (3c589 etc).

libkafs
Patch for Transarc or OpenAFS (as opposed to arla).

ssh
Add backwards compatibility for k4 and afs ticket/token passing. I'm not sure how safe this is.

vfs
Don't panic on dangling inodes, don't lock fs on unmount. Only needed for afs. Possibly dangerous, not recommended.

wdc
Always use 10 second timeout in wdcwait(). Try this if your disk fails to work after having been spun down.

xl
Disestablish shutdown hook on detach.

OpenBSD 2.9

am7990
Fix to the le(4) driver that eliminates the remaining le1: device timeout errors that occur when OBSD is a guest OS using VMware. I got this from tholo via Kurt Miller.

vfs
Don't panic on dangling inodes, don't lock fs on unmount. Only needed for afs. Possibly dangerous, not recommended.

vmware_drv.tar.gz
XFree86 server and vmware driver. With this you can run XFree86 4.0.3 on OpenBSD as a vmware client. For installation instructions see "Using XFree86 4.x in a Linux Virtual Machine". You don't need this if you are running XFree86 4.1.0 or later, which has the vmware driver built in.

wdc
Always use 10 second timeout in wdcwait(). Try this if your disk fails to work after having been spun down.

OpenBSD 2.8

apm
Do periodic check once at boot, ignoring errors. Try this if you get "apm0: disconnected" at boot time.

pms
Re-enable interrupts to avoid queue overflow. Try this if your machine hangs after apm resume when you move the mouse.

vfs
Don't panic on dangling inodes, don't lock fs on unmount. Only needed for afs. Possibly dangerous, not recommended.

wdc
Always use 10 second timeout in wdcwait(). Try this if your disk fails to work after having been spun down.

OpenBSD 2.7

ddb
Partial fix for lkm symbol loading.

gateA20
Don't disable keyboard in gateA20 probe for IBM L40. Fix suggested by me, implemented by Tobias Weingartner.

machdep
Fix from niklas for pmap_changebit panic.

ppp
Shut up about ipv6 not supported.

vfs
Don't panic on dangling inodes, don't lock fs on unmount. Only needed for afs. Possibly dangerous, not recommended.

wdc
Always use 10 second timeout in wdcwait(). Try this if your disk fails to work after having been spun down.

OpenBSD 2.6

ddb
Partial fix for lkm symbol loading.

gateA20
Don't disable keyboard in gateA20 probe for IBM L40. Fix suggested by me, implemented by Tobias Weingartner.

vfs
Don't panic on dangling inodes, don't lock fs on unmount. Only needed for afs. Possibly dangerous, not recommended.

wdc
Always use 10 second timeout in wdcwait(). Try this if your disk fails to work after having been spun down.

OpenBSD 2.5

com
Don't turn off uart when closing cua device if tty is waiting. Instead just drop dtr briefly.

pc-card
The list of available irqs doesn't work on any computer I know of. This patch fixes the list so that the 3c589 ethernet will work on several different machines. I haven't tried any modems.

pccom
Don't turn off uart when closing cua device if tty is waiting. Instead just drop dtr briefly.

vfs
Don't panic on dangling inodes, don't lock fs on unmount. Only needed for afs. Possibly dangerous, not recommended.

OpenBSD 2.4

To fix the backspace key in pcvt, add this entry to /usr/share/misc/keycap.pcvt:

bs:\
	:K15=^H:
Now, as root, type "kcon -m bs".

gateA20
Don't disable keyboard in gateA20 probe for IBM L40. Fix suggested by me, implemented by Tobias Weingartner.

pccom
Don't block on carrier in pccom cua open.

com
Don't block on carrier in pccom cua open.

vfs
Don't panic on dangling inodes, don't lock fs on unmount. Only needed for afs. Possibly dangerous, not recommended.

OpenBSD 2.3

cd
Fix timestamp timezone correction for cd9660. Bill Simpson first noticed the problem, I found the bug, and Theo fixed it.

gateA20
Don't disable keyboard in gateA20 probe for IBM L40. Fix suggested by me, implemented by Tobias Weingartner.

wdc
Make kernel compile if we have IDE controller but no wd drive. Independently found and fixed by angelos for 2.4.

vfs
Don't panic on dangling inodes, don't lock fs on unmount. Only needed for afs. Possibly dangerous, not recommended.

OpenBSD 2.2

apm
Configure apm even if power management is disengaged. Don't panic in apmopen if apm not configured. Fix some printfs.

cd
Fix timestamp timezone correction for cd9660. Bill Simpson first noticed the problem, I found the bug, and Theo fixed it.

de500B.tar.gz
New if_de driver that supports the de500B. Very experimental. If you try this with any other adaptors, please report the results back to me.

The tar file contains the complete driver source as well as diffs from the 2.2 source. You can either install the driver or apply the diff but don't try to do both.

elink3
Remember default media type. Fixes 3c905. This fix made it in to 2.2 at the last minute, so if you have the final release you don't need this patch.

todr
Don't update time-of-day register on halt. Try this if your notebook computer hangs on halt or reboot. I've seen this on the Gateway Handbook and various models of IBM Thinkpad.

vfs
Don't panic on dangling inodes. Only needed for afs.

wdc
Don't "clear pending interrupt" if no atapi bus is configured. Try this if you have a notebook computer and your disk refuses to spin down, immediately spins back up, or gets a disk error just after spinup. Also compute block numbers correctly on a restarted transfer. Make kernel compile if we have IDE controller but no wd drive.

OpenBSD 2.1

apm
Comment out spurious error message.

ed
Comment out spurious error message.

vfs
Don't panic on dangling inodes. Only needed for afs.

wdc
Don't "clear pending interrupt." Mostly useful for some notebook computers. Don't use this if you have ATAPI.

OpenBSD 2.0

apm
Comment out spurious error message.

com
Don't forget to init the uart. I forgot who suggested this one.

ed
Comment out spurious error message.

fd
Config flag 0x10 forces drive to be found even if it won't probe. Needed for Compaq Aero.

locore
I removed the hlt instruction from the idle loop to suppress an annoying speaker buzz on my Gateway Handbook. If you don't have a Handbook, you probably don't need or want this one. This was suggested to me by Todd Williamson <toddw@rb.isl.secom.co.jp>.

vfs
Don't panic on dangling inodes. Only needed for afs.

wdc
Don't "clear pending interrupt." Mostly useful for some notebook computers. Don't use this if you have ATAPI. Also many other fixes suggested by various people.

NetBSD 1.1

ffs
This one is dangerous. I hacked the sync system call to not do anything if the only changes were to atime, ctime, etc. This is an attempt to make the disk be less active on my notebook computer. Without this hack, the disk spins up even if the only thing I did was hit the "shift" key to unblank the screen. That's because the atime on /dev/pty? changes every time you hit a key.

locore
I removed the hlt instruction from the idle loop to suppress an annoying speaker buzz on my Gateway Handbook. If you don't have a Handbook, you probably don't need or want this one. This was suggested to me by Todd Williamson <toddw@rb.isl.secom.co.jp>.

pms-3
The ps/2 mouse doesn't work on many notebook computers. This fix was suggested by someone else. I think I got it from the bugs database.

tty
The OPOST bit gets lost when you change tty modes, leaving your tty in an uncooked condition. This fix was given to me by mycroft@mit.edu (Charles M. Hannum).

vfs
Sync file systems in reverse mount order, and don't panic on dangling vnodes at unmount time. Useful if you are running afs or some other stacked file system.

wd
The disk driver doesn't work on most notebook computers. On spinup after a timeout spindown, the disk either fails to spin up, spins up too soon, or becomes terminally wedged. Part of this fix was suggested by David Carrel <carrel@cisco.com>, but most of it is mine.

Jim Rees