Archives for C

C Programming

DerBlinkenLightenWorken

Okay, I’ll grant you, it doesn’t look that impressive. That’s just the basic ‘Blinky’ first-step demo for the Keil MPC2400 board. Basic light chaser using the pot to set the speed of the blinking.

However, it’s a bit more fun when I note that the Keil environment was run from within Virtualbox on my Debian laptop and it still used the USB JTAG connection to connect to the board and it all worked without a hitch on the first try.

Apart from the obvious convienence this means to me (I don’t have to dual-boot to programme the board, I can run the exercises from within Linux, which I prefer), it’s just downright impressive that Virtualbox is that far along.

Well, maybe not to you young kids, but to someone who was in college when the web came along, this is impressive :D

 … Read the rest

Maximum Password Length in Coova-Chilli

Bad Day So for the last few days I’ve been banging my head up against the same problem in the lab. We currently use Chillispot to run our access points for the Metakall user trials, which is grand, but it’s also fairly out of date – it hasn’t been actively developed on since 1997 – and it has some serious security issues. So with the new academic year looming, we’re moving over to its successor, Coova-Chilli.

Coova has a few neat features we like, and it’s also being actively maintained, which is important. So I took our testbed server, installed FreeRADIUS and MySQL and Apache and all the custom stuff we’ve written and generally got things set up, and then went to install the latest version of coova-chilli (1.0.14). There was an hour of swearing at iptables as usual (I really am coming to hate that program), and then I thought that’d be that.

But of course not.

 … Read the rest

Metakall User Trial

So this is what I’ve been up to for the last year; building this pretty much from scratch (rebuilding it in fact) and getting it to the launched stage. Everything from low-level C code for custom servers, to custom freeRADIUS modules (again in C) to the MacOS and iPhone/iPod Touch clients I’m writing at the moment (Will, if you’re reading this, I’m finally using Objective C again :D ), and all the project management and dogsbody stuff you’d expect.

Fingers crossed it works properly :)

METAKALL USER TRIAL KICKS OFF IN TRINITY COLLEGE DUBLIN

For Immediate Release

METAKALL USER TRIAL KICKS OFF IN TRINITY COLLEGE DUBLIN

Dublin, April 10 — Metakall, a WiFi authentication and metering system, has begun its second user trial in Trinity College Dublin this week for students and staff, allowing access to the internet from mobile devices and allowing them to make phone calls over the internet in cooperation with FreeSpeech.ie.

Metakall, which is funded by an Enterprise Ireland grant, may be among the first of 300 companies to spin out under the new joint TCD/UCD Innovation Academy announced last month by the two colleges along with the Taoiseach, Tanaiste, Minster for Finance and Minister for Education.

Headed up by Dr.Hitesh Tewari, an expert in internet micropayments, the project has a working system but is still working on usability, testing, and on creating new clients for different platforms. Several companies including Eircom and O2 have expressed interest in the technology developed by Metakall, and talks are ongoing regarding a possible installation in San Jose.

The Metakall system was initially trialled in August last year in TCD. Significant changes have since been made to the technology, which consists of a client which runs on the user’s laptop or mobile phone, connecting them to the wireless internet system on the … Read the rest

gethostbyname_r()

Okay, so I can’t really go into too much of the big picture since this is from the day job, but I can certainly tear into gethostbyname_r() a bit.

For part of what we’re doing, we’re sending a RADIUS message using the freeradius project’s radius client library. So, nice and simple (after you’ve done some setup):

result = rc_acct(rh, 0, send);

Easy enough, right? So it fails. Specifically, it segfaults and since it’s in a multithreaded server, it’s a pain to track down. And I mean a pain. Hours of fun with DDD, gdb, nana and finally printf() lead to here:

res = gethostbyname_r(hostname, &hostbuf, tmphostbuf, hostbuflen, &hp, &herr)

Ah. gethostbyname_r(), the glibc2-reentrant thread-safe version of gethostbyname(). Except that it’s deprecated, and has the unique property of working differently on just about every machine out there.

And of course, in my machine, and the server, it’s going nuts. Not because of a dodgy parameter or anything like that, though that took a while to confirm, it’s going nuts because of the way /etc/nsswitch.conf is written:

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4

That’s the standard way to write nsswitch.conf in ubuntu – it first checks the  /etc/hosts file, then uses the avahi daemon, then the DNS system.

Only that’s not good enough for gethostbyname_r(). Grrr. So after a full day bug-chasing through two codebases, the fix is to change a configuration file to this:

#hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4
hosts:          dns files

What a waste of a day! Gah!

I’m going to rewrite the radius-client library to use getaddrinfo() over the next while. I already have to make some changes to it to cope with other things, I may … Read the rest