The best approach to change network configuration from applications.

Alastair Johnson alastair at
Thu Oct 9 15:36:09 CEST 2008

Nicola Mfb wrote:
> 2008/10/9 Alastair Johnson <alastair at 
> <mailto:alastair at>>
>     Nicola Mfb wrote:
>      > I'm trying to write a test application that should change the network
>      > configuration with a gui, what's the best approach?
>      > Manually change /etc/network/interfaces? a wrapper library to do
>     that?
>      > dbus api call?
>     That depends on which distro you're using, and how complete its network
>     management is. 2008.x is using ConnMan which is an attempt at a lighter
>     weight version of NetworkManager, but it seems rather incomplete. I
>     think FSO is sticking with the basic debian-based interface using
>     /etc/network/interfaces which mostly works according to the debian
>     networking handbook. IIRC the bits needed for roaming connections are
> Hi Alastair, here a better explanation of what I'd like to do:
> I'm trying to use dbus with C++/QT under FSO, to test it I'm writing a 
> simple gui that is able to turn on/off the bluetooth adapter, and to 
> spawn a pan connection to my nap gentoo boxes. This is really simple 
> with dbus, and works fine with dbus-send or mdbus, now I'd like to 
> support network configuration to have different pan profiles, with or 
> without dhcp, with or without default routing and so on.

Sounds good.

> So actually should I modify /etc/network/interfaces directly in my 
> application or spawn some external script that does this with sed and 
> after launch ifdown/ifup bnep0?
> This seems not much elegant to me, and to avoid mistakes on the 
> configuration file, I should read busybox c code to understand how it 
> read that file (a curiosity, there is a doc file in busybox that says 
> please do not use ifup/ifdown approach:))

Debian lets you have multiple configurations for the same interface, so 
you can have for example different configs for eth0 at home and at work, 
or for wifi at different locations. I've not dealt with it in depth 
myself, except for trying to use its wifi roaming config and finding 
bits of that system missing.

> The problem become bigger if I want to add a pan server option and so 
> change ip forwarding and iptables rules, launch dhcp or change the its 
> ip range, and so on...
> What's we may expect in the future? would be nice to have frameworkd 
> offer nice api to hide and abstract all this tasks? should we ask for 
> connman/networkmanager official/default support in OE?

OE already has both connman and networkmanager. I built it under 
fso-testing yesterday but haven't tried it yet. The KDE front end for 
NetworkManager may be close to what you're aiming at, depending on how 
much of it is pure Qt and how much KDE. I haven't used networkmanager 
much so I don't know if it supports configuring bluetooth connections.

More information about the community mailing list