Search This Blog

Wednesday, November 5, 2014

NetworkManagerQt 0.9.8.3 is out


Bugs fixed in NMQt 0.9.8.3:

. Add workaround to properly update IpInterface.
339652: Add IPv6 configuration for VPN connections (needed for OpenVPN).
. Remove IPv6 setting from cdma/gsm connections since NetworkManager does not support this configuration.

5 comments:

STiAT said...

Since I couldn't find it - is there any API documentation available already?

Lamarque said...

Well, you can generate the documentation from the source code using doxygen:

git clone git://anongit.kde.org/libnm-qt
mkdir build
cd build
cmake ../libnm-qt
make apidox

I have just configured the git repository to make the same documentation appear in http://api.kde.org/extragear-api/libs-apidocs/libnm-qt/html/index.html. It should be available tomorrow.

Unknown said...

Hi Lamarque

I'd like to write a program setting up a WPA2 connection using libnm-qt (well, actually the backport to Qt4 which can be found here http://download.kde.org/unstable/networkmanager-qt/0.9.8.3/src/libnm-qt-0.9.8.3.tar.xz, for some reason I really can't switch to Qt5).

As a proof of concept I modified the example libnm-qt/examples/createconnection/main.cpp. The problem is that even if I call setPsk like it is done in the Handler class of plasma-nm, the psk field does not appear in the configuration file under /etc/NetworkManager/system-connections/

Here are my modifications:

1) To make the example attempt to connect also to WPA2 networks I commented out the condition filtering them out

2) I added the 3 lines below

....
NetworkManager::Ipv4Setting::Ptr ipv4Setting = settings->setting(Setting::Ipv4).dynamicCast();
ipv4Setting->setMethod(NetworkManager::Ipv4Setting::Automatic);

// 3 lines added by me
NetworkManager::WirelessSecuritySetting::Ptr wifiSecurity = settings->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast();
wifiSecurity->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaPsk);
wifiSecurity->setPsk("12345678");

// We try to add and activate our new wireless connection
QDBusPendingReply reply = NetworkManager::addAndActivateConnection(settings->toMap(), wifiDevice->uni(), accessPointPath);

reply.waitForFinished();
...

Is there something special to take into account when setting the psk?

Lamarque said...

You need to add the following two lines after the three lines you added:

wifiSecurity->setInitialized(true);
wirelessSetting->setSecurity("802-11-wireless-security");

Unknown said...

Now it works, thx!