Mar 12

Testing ntrack

For the last years, applications that needed to be online have been patched to ask NetworkManager for connectivity status. This neat idea turned out to be a disaster for other apps that provide connectivity...

Background

Until NetworkManager appeared in scene, network management was painful on Linux. Connecting to a wireless network or a VPN involved several command line scripts, editing files with alien syntax, etc. Seriously, it was a joke when compared to what other operating systems had available. So when NetworkManager was released it filled a nice gap in the Linux Desktop, and everyone rejoiced.

The problem

In early 2008, some key apps of the Linux desktop were patched to listen to NetworkManager for connectivity status. Applications such as Firefox or pidgin would not work if NetworkManager considered the system wasn't online.

As you might know, I have been involved in Linux connection managers since late 2006. The software were I have spent most of my energies, Wader, suffered from this. As the connection was established without NetworkManager, the applications that listened to its signals thought they were offline and thus did not work. Some apps had a workaround (like Firefox) while others didn't (pidgin).

Say you want to connect via a competing connection manager, such as WICD, Firefox & co will not work. Say you are a token ring user, well you are out of luck, NetworkManager has no plans to support token ring. As you can see the current status is not that good if you are not a NetworkManager developer/user.

The solution

Thankfully, Alexander Sack stepped up and started working on ntrack after some talks we had in a UDS.

ntrack is described on its homepage as:

"ntrack aims to be a lightweight and easy to use library for application developers that want to get events on network online status changes such as online, offline or route changes."

ntrack does one thing, and excels at it. It just listens for Netlink messages regarding route changes, and will infer if it is connected from them. As you can see, this approach will work regardless of the connection manager or underlying technology used. In order to be online, you must create a route. Thus the responsibility of determining whether we are connected or not resides on a small daemon completely independent of the connection manager. This is a good thing.

Today I have tested the last ntrack release (0.6) and a patched empathy that listens to ntrack rather than NetworkManager and it worked wonderfully! I tested it with both PPP and NDIS (HSO) dialup and ntrack detected immediately if I was connected or not. Nice job Alexander :)

Future steps

We are going to "lobby" for its inclusion on Debian/Ubuntu, and patch those applications listening to NetworkManager to listen to ntrack instead. ntrack has already been accepted in Debian and it will automatically appear in the next Ubuntu version (Lucid+1). Hopefully the rest of the distros will follow, and in 1-2 years we will have recovered from this error.