Showing posts with label openbsd. Show all posts
Showing posts with label openbsd. Show all posts

Monday, December 11, 2006

drinkathon 2k6b

Announcement at events page
Discussion at Undeadly

This event was started at Friday's evening and ended at Saturday's night. We start drinking at bar "Bavarius" and after some beer go to the night club, called "Hungry Duck".

Many good peoples come to this meeting.

Monday, December 4, 2006

audacious port for openbsd

And, finally, it's done. Audacious media player port for openbsd.

Sunday, December 3, 2006

updated: x11/ion

While I was in psychedelic trip, I become maintainer of x11/ion port in OpenBSD ;)

Wednesday, November 29, 2006

temp sensors and mrtg

Temperature monitoring using openbsd's sensor framework and mrtg.

  1. Locate sensors on main board:
    $ dmesg | grep lm
    lm0 at isa0 port 0x290/8: LM79
  2. Locate number of CPU temperature sensor:
    $ sysctl hw.sensors | grep temp
    hw.sensors.7=lm0, Temp1, temp, 36.00 degC / 96.80 degF
  3. Write a simple script for passing temperature to mrtg:
    #!/bin/sh
    sysctl hw.sensors.7 | awk '{ print $4 }'
    sysctl hw.sensors.7 | awk '{ print $4 }'
  4. Add the following lines to your mrtg config:
    Target[Temp1]: `/root/temp.sh`
    MaxBytes[Temp1]: 70
    Options[Temp1]: gauge, noinfo, nopercent
    YLegend[Temp1]: Celsius
    LegendI[Temp1]: Temp
    LegendO[Temp1]: Temp
    Title[Temp1]: CPU temp
    ShortLegend[Temp1]: C
    PageTop[Temp1]: <h1>CPU temp</h1>
  5. Have fun!

Friday, October 20, 2006

pf based nat gateway for office network

Tonight i replace old FreeBSD based NAT gateway to OpenBSD based NAT gateway and firewall. This is short article about pf configuration.

I use Intel Celeron 500MHz based server with two network cards (vr0 and vr1). Here is configuration steps:

  1. buy more beer and pizza!
  2. install openbsd
  3. set net.inet.ip.forwarding sysctl value to “1” and add string net.inet.ip.forwarding=1 to /etc/sysctl.conf file
  4. activate pf. add pf=YES line to /etc/rc.conf.local file
  5. let’s edit /etc/pf.conf file:
    # macros
    ext_if="vr0"
    int_if="vr1"

    # options
    set block-policy return
    set loginterface $ext_if
    set skip on lo

    # scrub
    scrub in

    # network address translation (NAT)
    nat on $ext_if from !($ext_if) to any -> ($ext_if)

    #filter
    block in
    pass out keep state
    antispoof quick for { lo $int_if }
    pass quick on $int_if
  6. load config file. pfctl -f /etc/pf.conf
…and read “The OpenBSD Packet Filter”.

Monday, October 2, 2006

hacking usb device drivers->part 2

This is the second article from “Hacking USB device drivers” series. In this part will be covered device supporting mechanism by USB device drivers.

  • Adding vendor and product IDs for USB drivers (read)
  • Adding support for new devices to USB drivers
    • Introduction
    • Modify dev_devs[] structure

Adding support for new devices to USB drivers

Introduction
All USB devices have vendor ID, product ID and device class. USB device can be attached to driver allocated with supported IDs and/or classes. Typically in USB driver you can see dev_devs[] structure, where dev is a device name. In this structure listed supported products.
USB device drivers can be founded in /usr/src/sys/dev/usb/ directory.

Modify dev_devs[] structure
For example, in uplcom(4) driver uplcom_devs[] structure contain strings like following line:
{ USB_VENDOR_SIEMENS3, USB_PRODUCT_SIEMENS3_X75 },
These lines can be founded in usbdevs_data.h file:
{
USB_VENDOR_SIEMENS3, USB_PRODUCT_SIEMENS3_X75,
"X75",
},
For adding support of new product to USB device driver all you need is modify dev_devs[] structure.

Wednesday, September 27, 2006

hacking usb device drivers->part 1

This is the first article from “Hacking USB device drivers” series. In this part briefly review of one very simple hack: adding missed vendor and product IDs for USB drivers.

  • Adding vendor and product IDs for USB drivers
    • Introduction
    • Changing USB IDs database
    • Result
  • Adding support for new devices to USB drivers (read)

Adding vendor and product IDs for USB drivers

Introduction
I have USB Bluetooth adapter and after plugging this device i got the following new strings in dmesg:
ubt0 at uhub2 port 2 configuration 1 interface 0
ubt0: vendor 0x1131 ISSCBTA, rev 1.10/3.73, addr 2
That’s mean: driver ubt(4) support this device, but vendor and product IDs not present in /usr/src/sys/dev/usb/usbdevs file. Let’s fix it!

Changing USB IDs database
Add the following lines to /usr/src/sys/dev/usb/usbdevs file:
vendor ISSC 0x1131 Integrated System Solution Corp.
...
/* ISSC products */
product ISSC ISSCBTA 0x1001 KY-BT100
Vendor ID must be placed to beginning of file, after vendor with lesser ID. Product IDs must be written in alphabetical order of vendor string. This patch illustrate this rule. And, finally, run make in /usr/src/sys/dev/usb directory for updating usbdevs.h and usbdevs_data.h files.

Result
Now you can build new kernel. Reboot, attach the device and run dmesg. Here is what you finally got:
ubt0 at uhub2 port 2 configuration 1 interface 0
ubt0: Integrated System Solution Corp. KY-BT100, rev 1.10/3.73, addr 2

Saturday, August 26, 2006

using trunk(4) interface in openbsd

In OpenBSD you can use trunk(4) interface for creating link aggregation and link failover.

Introduction
The trunk(4) interface support was added in OpenBSD since 3.9 version (last release at present moment) for allowing link aggregation and link failover. One virtual trunk(4) interface can be created from multiple network interfaces.

Example
Simple example, creating failover trunk, using two Gigabit Ethernet interfaces and one wireless interface:

# ifconfig bge0 up
# ifconfig bge1 up
# ifconfig ath0 nwid test_network up
# ifconfig trunk0 trunkproto failover trunkport bge0 trunkport bge1 trunkport ath0 192.168.0.1 netmask 255.255.255.0
Of course, in this example, loadbalance also can be used.

Links