Tuesday, November 25, 2008

pf IPv4 and IPv6 shortcut

There's a shortcut for creating a pf rule that applies to both IPv4 and IPv6. E.g.:

pass in quick on em0 from { 192.168.86.0/24, 2001:418:c0de:babe::/64 } to any keep state label "experimentation"

Results in:

root@soulfury:~# pfctl -sr | grep experimentation
pass in quick on em0 inet from 192.168.86.0/24 to any flags S/SA keep state label "experimentation"
pass in quick on em0 inet6 from 2001:418:c0de:babe::/64 to any flags S/SA keep state label "experimentation"

Monday, November 24, 2008

Hello world from links

I forgot to bring my MacBook, so I'm now surfing the Net in a text-only browser inside a server. I'm surprised that Blogger works. Very cool.

Saturday, November 22, 2008

Hello world from Acer 4330 and Windows Vista

Hello world! WLAN and LAN works fine.

Acer 4330 Driver Installation

I'm continuing the setup for my Acer 4330 laptop. I gave up installing Windows XP because I don't have the time to hunt down the correct drivers. I've installed Windows Vista instead.

I'm annoyed with Vista's UI. Fortunately, I won't have to use this because I'll give this to my parents. Sorry mom and dad, I really don't have time to install XP. This is the best I can do.

The DVD provided with the laptop contains multiple drivers. I think Acer doesn't use a standard hardware for all of its laptops. I think they just choose the cheapest hardware available at the time of production.

Anyway, here are the drivers that worked for me:
Chipset - Intel Chipset
VGA - Intel VGA driver
Audio - Realtek (No need to install; it works after installing Vista. Install this if you want the volume buttons to work.)
Modem - Foxconn, probably, but I didn't install it
LAN - Realtek
TouchPad - ALPS Touchpad
Card Reader - I don't know; there was no need to install it.
Camera - There are 3 drivers (Suyin, Bison, and Chicony), but I didn't bother installing any of them. Please leave a comment if you know the correct one.
WLAN - Atheros
BlueTooth - the only driver, Foxconn, doesn't seem to work. I'm not sure if there's really a built-in Bluetooth in this laptop. There's a Bluetooth button, but this may have been reserved for other models.

Friday, November 14, 2008

HOWTO Turn off DHCP Servers in VMware Linux

To turn off VMware's DHCP server in host-only network, simply find the appropriate DHCP process, and kill it:

root@soulfury:~# ps auxww | grep dhcp
root 5060 0.0 0.0 1892 252 ? Ss Nov10 0:00 /usr/bin/vmnet-dhcpd -cf /etc/vmware/vmnet8/dhcpd/dhcpd.conf -lf /etc/vmware/vmnet8/dhcpd/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet8.pid vmnet8
root 5061 0.0 0.0 1888 520 ? Ss Nov10 0:00 /usr/bin/vmnet-dhcpd -cf /etc/vmware/vmnet1/dhcpd/dhcpd.conf -lf /etc/vmware/vmnet1/dhcpd/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet1.pid vmnet1
root 21281 0.0 0.0 2796 748 pts/0 R+ 15:31 0:00 grep dhcp
root@soulfury:~# kill 5061

Thursday, November 13, 2008

FreeBSD Problem: Can't see files/dirty state at each boot.

Weird problem. The filesystem is in an unclean state at each boot, even though I have ran fsck before booting the system. Initially, our problem is that our app can't "see" certain files at first read, although subsequent attempts on reading them are OK. Later, we discovered that the filesystem is dirty at each boot. The problem is similar to this issue in FreeBSD-CURRENT. We're using FreeBSD 7.0-RELEASE though, so I'm not sure if we have the same problem. I need to track this down.

Tuesday, November 04, 2008

PHP doesn't support dot characters in form names

I've written a PHP proxy script that communicates with an underlying application. I encountered a problem where the script is unable to proxy data that contains dot characters in the form name.

To illustrate:
<?php
var_dump($_POST);
?>
<form action="test.php" method="post">
<input name="this.is.a/variable" type="text" />
<input type="submit" />
</form>
Output:
array(1) {
["this_is_a/variable"]=>
string(0) ""
}
Notice the array key in the var_dump(); dots are converted into underscore.

Solution

I accessed the raw input stream directly instead of using $_POST:
<?php
$data = file_get_contents("php://input");
$response = proxy_blah_blah($data);
?>