mark shroyer, dot com: this is where I keep my things

Site Navigation


Code

Patch for segfault in OpenBSD 4.3’s pfctl

July 2, 2008 11:52 PM

A couple of months ago, I upgraded an old PowerPC machine from OpenBSD 4.2 to 4.3, and I discovered that the new version of pfctl in 4.3 would segfault when reading my old pf.conf file. Some brief poking around with GDB revealed the root of the problem, an uninitialized variable in the new configuration file parser.

If you’ve been bitten by this as well, here’s a patch with the minor change that solved the problem for me:

--- sbin/pfctl/parse.y  Sat Feb 23 15:31:08 2008                                          
+++ sbin/pfctl/parse.y  Thu May 15 08:55:38 2008                                          
@@ -3487,9 +3487,11 @@                                                                    

 qname          : QUEUE STRING                          {                                 
                        $$.qname = $2;                                                    
+                       $$.pqname = NULL;                                                 
                }                                                                         
                | QUEUE '(' STRING ')'                  {                                 
                        $$.qname = $3;                                                    
+                       $$.pqname = NULL;                                                 
                }                                                                         
                | QUEUE '(' STRING comma STRING ')'     {                                 
                        $$.qname = $3;

To apply this patch, perform the following (assuming that you have the OpenBSD 4.3 source code tree at /usr/src on your system):

# cd /usr/src
# patch -p0 </path/to/above/patch
# cd sbin/pfctl
# make && make install

My ISP blocks outbound SMTP traffic, unfortunately, and I didn’t feel like setting up Sendmail relaying just so I could submit a sendbug report, so I couldn’t open a ticket for the bug. I did send this patch to the bugs@ mailing list, but it was unable to generate any interest there; if someone stumbles across this who has a functional sendbug on their system, I’d be grateful if you could submit this patch in a proper bug report.

The segmentation fault doesn’t occur on the i386 port of OpenBSD (as far as I can tell), nor does it occur on the macppc port unless you use the “queue ( qname, pqname )” ALTQ syntax, so it’s easy to see why the hordes aren’t exactly beating down the OpenBSD folks’ doors about this one. So I figured I should post this here, where people might find it, until someone gets around to committing an official fix.

Posted in Code, Unix | 0 Trackbacks | 0 Comments

UF Weather Report Widget Thingy

June 3, 2008 8:28 PM

I’ve tired of manually pointing my browser at http://www.phys.ufl.edu/weather/ each time I want to check the conditions on campus, so I made a small widget to bring the campus weather report to my NetVibes home page:

UF Weather widget screenshot

Fellow Gators can use this widget too – just click here to add it to your NetVibes home page, or here to add it to iGoogle. Or copy the widget’s URL to manually add it to any other UWA-aware application:

http://markshroyer.com/code/uwa/uf-weather/widget.xhtml

Posted in Code, Web | 0 Trackbacks | 0 Comments

ISC DHCPD status report generator

September 18, 2007 3:46 PM

After setting up my apartment’s OpenBSD based network, I decided it would be handy to have a simple report generator to describe active DHCPD leases. I also wanted to brush up on Perl a bit. This Perl script is the natural result of such circumstances.

Run dhcpd-report.pl to generate a plaintext or HTML report of current leases in the DHCPD lease database and reservations in dhcpd.conf. In my usage, I have the script set to run once every five minutes in a cron job, sending output to an HTML file in a web server document root. (On OpenBSD, httpd runs in a chroot jail; if I were to run this script as CGI it wouldn’t have direct access to the DHCPD configuration files.) Thus the script can be used to give you a reasonably up to date web page displaying your network’s DHCP clients.

By default, the program looks for dhcpd.leases and dhcpd.conf in /var/db/ and /etc/, respectively, which are these files’ locations in OpenBSD 4.1. If needed, you can change where the script looks for these files by modifying a pair of constants near the top of the main program.

dhcpd-report.pl requires the Date::Format and Date::Parse modules from CPAN. See the POD documentation* for more info.

Download: dhcpd-report.pl


*Sort of like an ATM machine or a PIN number…

Posted in Code, Unix | 0 Trackbacks | 0 Comments

Exporting AddressBook birthdays to Remind

May 20, 2007 12:06 PM

I always thought I was a bit of an oddball for choosing the ancient scheduler Remind as my favorite OS X calendar software. But as it turns out, I’m not quite as alone as I had assumed. I guess OS X is a bigger draw to Unix geeks than I realized.

So I’ve decided to publish a tool that I wrote a few months back, a simple little Objective-C command line application that reads the birthdays of all your OS X AddressBook contacts and outputs them in .reminders format.

The source code bundle is here. After installation, see the manpage remind_birthdays(1) for documentation.