Commit Graph

15047 Commits

Author SHA1 Message Date
Thomas Haller
d7518d111f platform/tests: log timestamp in test messages 2015-12-10 17:13:49 +01:00
Thomas Haller
eeb7d20ee0 platform: fix memleak in _nl_sock_flush_data()
Fixes: 9a16ce0876
2015-12-10 17:13:48 +01:00
Thomas Haller
10b684b827 platform: fix event_handler_read_netlink_one() wrongly returning with nothing to read
When the errno was accidentally set to EAGAIN or EWOULDBLOCK,
we would only read one single message and return that there is
nothing to read.

This means, if there were more then one messages ready to read,
we would only read the first one and return to the main-loop
(which then again calls back to platform as more data is ready
to be read).
2015-12-10 17:13:48 +01:00
Lubomir Rintel
1057e30dc8 vpn-connection: notify the object of banner change
Otherwise the D-Bus clients won't notice the banner has been set.
2015-12-10 16:12:02 +01:00
Thomas Haller
9bc7b295a4 platform: merge branch 'th/platform-api-cleanup-bgo759261' into master
https://bugzilla.gnome.org/show_bug.cgi?id=759261
2015-12-10 14:36:45 +01:00
Thomas Haller
76521816a5 platform/trivial: remove obsolete code comment
The explainations no longer hold for the most part. Documentation
that is not directly the code is bound the expire.

The code is the best documentation!! :)
2015-12-10 14:33:50 +01:00
Thomas Haller
9eea5b63a2 platform: remove g_return() checks for platform klass implementation
With g_return() we try to catch wrong invocations of a function
or passing invalid arguments.

Having ~forgot~ to overwrite a virtual function is such a serious
and fundamental issue, that checking for it at runtime is wasteful
and unnessesary.

If we ever hit such a situation, just crash.
2015-12-10 14:33:50 +01:00
Thomas Haller
1a7b19ea6a platform: move reading sysctl-options for master/slave to NMPlatform
These functions are only helpers for accessing sysctl and independent
from NMLinuxPlatform. Move their implementation to the base class.
2015-12-10 14:33:49 +01:00
Thomas Haller
9166ee6958 platform/trivial: rename sysctl slave/master option functions
These function purely operate on sysctl by reading/writing to file.
Rename them to reflect that they are not related to netlink parts
of platform.
2015-12-10 14:33:49 +01:00
Thomas Haller
eef388990f platform/trivial: rename link related functions
Link related functions should have a "nm_platform_link" prefix. Rename.

Naming is a subjective matter and one might argue that omitting
the "link" part from the name is shorter and even preferred.

However, I think functions related to links should have a common
prefix as the underlyings are strongly related.
2015-12-10 14:33:49 +01:00
Thomas Haller
6a7730241b trival: fix whitespace 2015-12-10 14:33:49 +01:00
Thomas Haller
a4de9187ff platform: return pointer to NMPlatformLink object for add functions
Let the link-add functions return the internal pointer to the platform
link object. Similar to link-get, which doesn't copy the link either.

Also adjust the sole users of the add-functions (create-and-realize)
to take the pointer.

Eventually we still copy the returned data, because accessing platform can
invalidate the returned pointer. Thus we don't actually safe any copying
by this (at least every use of the function currently leads to the data
being copied).
Still change it, because I think the API of NMPlatform should look like that.
2015-12-10 14:33:49 +01:00
Thomas Haller
2a14a28fe0 device: pass const NMPlatformLink instance to setup_start()/setup_finish()
NMPlatformLink is a plain struct (not a GObject, for which we usually
don't use const). We certainly don't want the functions to modify the
passed-in data.
2015-12-09 17:05:45 +01:00
Thomas Haller
590b9a830d device: accept UNKNOWN device types during create_and_realize()
There are the link-types NONE and UNKNOWN. NONE is a linktype that is never
returned by platform, but UNKNOWN is very much a valid (albeit unspecified)
type.

Effectively, create_and_realized() should create a link of a known type,
thus it should never return an UNKNOWN link type at this point. Still
change it because it feels more correct.
2015-12-09 16:57:39 +01:00
Beniamino Galvani
efd5515f96 merge: vxlan devices creation support
https://bugzilla.gnome.org/show_bug.cgi?id=756963
2015-12-09 16:37:05 +01:00
Beniamino Galvani
69f3489954 platform/tests: use nmtst_inet{4,6}_from_string() helpers 2015-12-09 16:36:46 +01:00
Beniamino Galvani
228d2dab82 libnm-glib: consider unknown devices as generic ones
After commit 8ca6e412c1, libnm-glib is
able to instantiate unknown devices as dummy objects without creating
a D-Bus proxy for them. Enable this behavior for every new unknown
device type.
2015-12-09 16:36:46 +01:00
Beniamino Galvani
dc0676330b platform/tests: create vxlan links also using platform code 2015-12-09 16:36:46 +01:00
Beniamino Galvani
d6a0b2c28f libnm: add NMDeviceVxlan 2015-12-09 16:36:46 +01:00
Beniamino Galvani
a448854b44 device/vxlan: support device creation 2015-12-09 16:36:46 +01:00
Beniamino Galvani
01e95c8c95 platform: add vxlan support
Add a new method to the platform code to create vxlan devices.
2015-12-09 16:36:46 +01:00
Beniamino Galvani
7da440b798 cli: add vxlan support 2015-12-09 16:36:46 +01:00
Beniamino Galvani
95dfd99afc libnm-core: add NMSettingVxlan
Add a new NMSettingVxlan which describes properties of VXLAN
connections.
2015-12-09 16:36:46 +01:00
Lubomir Rintel
a5c42eeb45 device: don't try to match the spec against a device with no hwaddr
It could be an unrealized device.
2015-12-09 15:55:12 +01:00
Lubomir Rintel
7e5f27a21c manager: let external devices go on removal
If we didn't create them, we shouldn't keep them around unrealized.
2015-12-09 15:41:39 +01:00
Beniamino Galvani
e25d144d77 merge: macvlan and macvtap devices creation support
https://bugzilla.gnome.org/show_bug.cgi?id=755986
2015-12-09 14:30:27 +01:00
Beniamino Galvani
f841f17882 libnm: add NMDeviceMacvlan 2015-12-09 14:30:08 +01:00
Beniamino Galvani
4de8851eca device/macvlan: support device creation 2015-12-09 14:30:08 +01:00
Beniamino Galvani
3871056019 platform: add macvtap link creation support 2015-12-09 14:30:08 +01:00
Beniamino Galvani
62c1f2c6a8 platform/tests: test macvlans also using platform code 2015-12-09 14:30:08 +01:00
Beniamino Galvani
27c0f8def4 platform: add macvlan link creation support 2015-12-09 14:30:08 +01:00
Beniamino Galvani
c3e6e25239 cli: add macvlan support 2015-12-09 14:30:08 +01:00
Beniamino Galvani
4d0192e661 libnm-core: add NMSettingMacvlan
The setting contains properties that are specific to macvlans and
macvtaps.
2015-12-09 14:30:08 +01:00
Beniamino Galvani
c1be9856bf platform: return the macvlan mode as integer
It's easier to handle it as an integer than as a string.
2015-12-09 14:30:07 +01:00
Thomas Haller
783b3642d0 man: correct manual page with respect to whitespace in device-spec 2015-12-09 14:08:43 +01:00
Beniamino Galvani
4a9ae9d14e device/tun: set tun mode when the device is created
Otherwise after 72c36bd6db ("device/tun: fix reloading tun
properties") the mode would remain always set to the default value
"tun".

Fixes: 9110ad39c5
2015-12-09 13:48:59 +01:00
Jiří Klimeš
20e750a3c3 libnm: fix description of NMDeviceIPTunnel:input-key property
Fixes: e2da055f90
2015-12-09 13:33:17 +01:00
Jiří Klimeš
1a48e5d918 libnm: fix indenting in libnm/nm-device-ip-tunnel.c
Fixes: e2da055f90
2015-12-09 13:29:02 +01:00
Thomas Haller
b9a35b6913 device/trivial: rename variable 2015-12-09 12:49:29 +01:00
Thomas Haller
e967cbd0bf device: during activating device transit to DISCONNECTED state
When activating a device, we must progress the device state to
disconnected state.

This matters when activating a device without carrier. In this
case we would have skipped DISCONNECTED state. Skipping the
device state then leads to other issues like a slave device
never noticing that the master got ready.
2015-12-09 12:42:50 +01:00
Thomas Haller
2d1d187493 device: add NM_DEVICE_CHECK_DEV_AVAILABLE_FOR_USER_REQUEST flag
This generalizes _NM_DEVICE_CHECK_DEV_AVAILABLE_IGNORE_CARRIER.
2015-12-09 12:08:40 +01:00
Thomas Haller
7eeadc2caf device: fix enum value NM_DEVICE_CHECK_CON_AVAILABLE_ALL
ALL had wrongly the value 0x05 instead of 0x03.
2015-12-09 12:04:36 +01:00
Beniamino Galvani
158c63eb2c device: move initialization of ifindex to constructor()
Device subclasses (for example NMDeviceWifi) can use the ifindex in
their constructor(), but the value now is set later in
parent class constructed(). This causes the following:

  nm_platform_wifi_get_capabilities: assertion 'ifindex > 0' failed

Fix this by initializing ifindex earlier in NMDevice's
constructor(). While at it, remove the

  nm_assert (pllink->type != NM_LINK_TYPE_NONE);

assertion, since pllink can be NULL there.

Fixes: 6db04dc206
2015-12-09 11:09:48 +01:00
Jiří Klimeš
3e5fea9820 cli: TAB-complete yes/no for boolean properties in the editor 2015-12-09 09:31:36 +01:00
Lubomir Rintel
e68619df06 merge: branch 'lr/device-link-type'
Avoids a mismatch of incompatible devices of the same class. Consider two
devices of tap class, one of tun mode and one of tap mode.
2015-12-08 18:14:53 +01:00
Lubomir Rintel
1762d58a8c manager: improve the add_device() error handling a bit
Let it indicate that it didn't succeed adding a device to the global list and
bail out.
2015-12-08 18:11:53 +01:00
Lubomir Rintel
f72d0f6efb device: set link type from all factories
This is, in particular, important for devices that support multiple link types
which can not be changed once the platform device exists.
2015-12-08 18:11:53 +01:00
Lubomir Rintel
7dbf821cb2 device: precisely match the link type to the platform device
The unrealized device's factory could be using one particular link type, don't
allow matching the device to a non-matching one.
2015-12-08 18:11:53 +01:00
Lubomir Rintel
6db04dc206 device: add link_type property
This is to make it possible for the device factories to indicate the desired
link type and make it possible to avoid matching the unrealized device to a
platform device of different link type.
2015-12-08 18:11:52 +01:00
Thomas Haller
5201c3d8f9 trival: fix whitespace 2015-12-08 11:52:37 +01:00