Skip to contentSkip to conversation

Generic user-space routing library -- need collaborator

DISCUSSION Philip Prindeville 2 participants 2 messages Jun 3, 2012 – Jun 11, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi.

I'm working on adding a few more portability classes to Poco (a multi-platform C++ toolkit) and wanted to add a Net::Routing class for examining and manipulating the routing tables.

The C++ would just be convenience wrappers around a core C library that handles the netlink semantics. I've looked at libmnl and it's handy, but I need a higher level of abstraction (for instance, parsing an RTA_NETMASK for IPv6 is anything but well-documented).

I'm running into the limits of my linux-specific knowledge, though. I can get a specific route, but not the non-specific (default) route. Unless I'm doing something wrong (and I may be), the only way to get the default route seems to be to either get a route to a host you know will never be in your routing table, or else to dump the entire table and grep it out.

Not sure if that's a shortcoming in the rtnetlink API or my being an idiot.

Maybe both.

Anyway, if anyone can walk me through parsing some of the more esoteric routing permutations (like 6to4 tunnels, etc) I'd appreciate their contacting me out-of-band.

Thanks,

-Philip

#1 lore raw
Quoted 5 lines · Philip Prindeville

Hi.

I'm working on adding a few more portability classes to Poco (a multi-platform C++ toolkit) and wanted to add a Net::Routing class for examining and manipulating the routing tables.

The C++ would just be convenience wrappers around a core C library that handles the netlink semantics. I've looked at libmnl and it's handy, but I need a higher level of abstraction (for instance, parsing an RTA_NETMASK for IPv6 is anything but well-documented).

You want to look at libnl. It's similiar to libmnl but provides a higher level of abstraction. It implements routing, netfilter and generic netlink parsing and message construction.

http://www.infradead.org/~tgr/libnl/

You should be able to easily construct C++ wrappers around the lib.

~Thomas