Commit Graph

783 Commits

Author SHA1 Message Date
Jiří Klimeš
0d4a5f0328 Revert "libnm-util: refactor NMSetting construction, assert of setting name"
This reverts commit f43586fc17.

This broke stuff as "name" was set on various places after construction. So we
revert the commit for now, and will rework it.
2013-11-28 11:18:54 +01:00
Thomas Haller
f43586fc17 libnm-util: refactor NMSetting construction, assert of setting name
Make the name property CONSTRUCT_ONLY. With this there is also no more
need to overwrite the constructor().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-27 23:10:17 +01:00
Thomas Haller
b8b8af38c1 libnm-util: fix minor memory leak in infiniband setting
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-27 21:19:11 +01:00
Thomas Haller
5cdd592457 libnm-util: trivial: rename private field and enum value in NMSettingVlan
The public property is called NM_SETTING_VLAN_INTERFACE_NAME,
so also the internal field and the PROP_* enum should carry
the same name.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-27 21:01:41 +01:00
Thomas Haller
63c9c399c5 libnm-util: fix minor memory leaks in bond and team setting
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-27 20:55:58 +01:00
Jiří Klimeš
0f02392123 doc: fix description of nm_setting_set_secret_flags() 2013-11-18 15:59:05 +01:00
Thomas Haller
97935382f4 coverity: fix various warnings detected with Coverity
These are (most likely) only warnings and not severe bugs.
Some of these changes are mostly made to get a clean run of
Coverity without any warnings.

Error found by running Coverity scan

https://bugzilla.redhat.com/show_bug.cgi?id=1025894

Co-Authored-By: Jiří Klimeš <jklimes@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-13 15:29:24 +01:00
Thomas Haller
f059298896 trivial: whitespace fix
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-07 21:32:08 +01:00
Thomas Haller
03943e2854 trivial: make nm_connection_dump more forgiving when passing NULL
nm_connection_dump is mainly used for printf debugging, so
no need about being overly critical about not accepting NULL.
Just don't dump anything.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-07 19:30:38 +01:00
Dan Winship
16e824fe34 libnm-util: belatedly export nm_setting_generic_new() 2013-11-01 13:04:11 -04:00
Jiří Klimeš
8ec031fb0e core: again allow calling AddAndActivateConnection() without a connection
When settings are NULL or empty in impl_manager_add_and_activate_connection(),
the connection is created and completed by nm_utils_complete_generic() or
nm_device_complete_connection().

Also, do not assert in nm_connection_is_type(). Returning FALSE there is
sufficient.

Related commit a878cd8145
2013-11-01 14:07:04 +01:00
Jiří Klimeš
abe4f4daf5 libnm-util: do not assert valid connection type in nm_connection_is_type()
That is not useful, simply return FALSE.
2013-11-01 12:38:25 +01:00
Dan Williams
77e50740a8 libnm-util: add Data Center Bridging (DCB) setting
Includes various fixes & cleanups from Thomas Haller.
2013-10-31 13:28:42 -05:00
Jiří Klimeš
a9ea67185e libnm-util: validate "primary" bonding option as an interface name
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-25 22:32:47 +02:00
Thomas Haller
0c6a98df78 libnm-util: do not g_warn when trying to set invalid bond option
nm_setting_bond_add_option returns TRUE or FALSE indicating, whether
the bond option was properly set. So, the API already kind of expects
invalid values, so there is no reason to warn about it.

Co-Authored-By: Jiří Klimeš <jklimes@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-25 22:32:47 +02:00
Thomas Haller
df4e159728 libnm-util: expose nm_setting_bond_validate_option as public API
Co-Authored-By: Jiří Klimeš <jklimes@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-25 22:32:47 +02:00
Thomas Haller
4b85408e34 bond: handle bond options more gracefully
Support new bonding options and set them carefully. The options cannot
be set arbitrarily because they interfere with each other.

This commit is forward-ported from rhel-6.5, see patch
rh901662-bond-more-options.patch, originally written by Dan Williams.

https://bugzilla.redhat.com/show_bug.cgi?id=901662
https://bugzilla.redhat.com/show_bug.cgi?id=905532

Co-Authored-By: Dan Williams <dcbw@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-25 22:32:47 +02:00
Dan Winship
3b97185ff8 libnm-util: fix slave IP config checking
NMSettingConnection was making sure that bond slaves didn't have an IP
configuration, but it should have been making that check for bridge
and team slaves too.
2013-10-24 12:25:08 -04:00
Dan Winship
f4c3e2f643 libnm-util: centralize find_setting_by_name code
Several settings types' verify() functions need to find a particular
setting from the all_settings list that NMConnection passes them. Add
a convenience function for this.
2013-10-24 12:25:08 -04:00
Dan Winship
83c5a69126 libnm-util: fix a leak in NMSettingIP6Config 2013-10-24 12:25:08 -04:00
jvoisin
00ffb78c8d core: add support for EAP-PWD authentication 2013-10-23 21:07:30 -05:00
Thomas Haller
3eb1d5e902 core: cleanup freeing of glib collections of pointers
When freeing one of the collections such as GArray, GPtrArray, GSList,
etc. it is common that the items inside the connections must be
freed/unrefed too.

The previous code often iterated over the collection first with
e.g. g_ptr_array_foreach and passing e.g. g_free as GFunc argument.
For one, this has the problem, that g_free has a different signature
GDestroyNotify then the expected GFunc. Moreover, this can be
simplified either by setting a clear function
(g_ptr_array_set_clear_func) or by passing the destroy function to the
free function (g_slist_free_full).

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-22 19:53:57 +02:00
Yuri Chornoivan
61de24ba35 Fix typos
https://bugzilla.gnome.org/show_bug.cgi?id=710505
2013-10-19 11:49:18 -04:00
Dan Winship
5bcdfd3985 libnm-util: remove reference to non-existent "Posix" namespace
There's no way in gobject-introspection to annotate something as
returning an arbitrary C struct type, so don't try.
2013-10-11 10:16:41 -04:00
Dan Winship
76cc2bd9df libnm-util, libnm-glib: fix up some gtk-doc comments
gtk-doc recognizes that #NMFoos is the plural of #NMFoo now, so you
don't need to put an empty comment between the type name and the "s"
to make it work. (Unfortunately, it's not smart enough to realize that
"NMIP4Addresses" is the plural of "NMIP4Address".)

Also, add some missing "#"s noticed along the way.
2013-10-11 10:16:14 -04:00
Thomas Haller
2b25d0d3e0 core: avoid use-after-free in libnm-util/bond.verify()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-08 22:33:19 +02:00
Dan Winship
cbe261caa2 libnm: more valgrinding fixes 2013-10-03 11:04:45 -04:00
Jiří Klimeš
6d2e033a0e libnm-util: only remove ARP when MIIMON is being set to non-zero and vice versa
miimon or arp_interval == 0 means 'disable'. So we should not remove options of
one mode when the other mode is actually being disabled (set to zero).
2013-10-01 17:26:03 +02:00
Dan Winship
e69727bf8a libnm-util: support the "primary" bond option 2013-09-27 09:34:41 -04:00
Dan Winship
4959936704 libnm-util, libnm-glib: bump .so versions to be higher than 0.9.8.4's 2013-09-25 10:16:55 -04:00
Jiří Klimeš
2e8746aab2 core: remove 'wep40' and 'wep104' from several places in NM
wep40 and wep104 are not valid values for 'pairwise' property and they are not
used for dynamic WEP as 'group' ciphers as well.

See https://bugzilla.redhat.com/show_bug.cgi?id=1005171 for some details.
2013-09-18 12:07:29 +02:00
Dan Winship
066b592241 all: standardize on NMSettingWired:mac-address for all VLANs
Currently, ethernet-based VLANs can specify the hardware address of
the parent device (and, in theory, the cloned hardware address and MTU
of the VLAN device) by using an NMSettingWired in addition to the
NMSettingVlan.

The theory was that non-ethernet-based VLANs, when we eventually
supported them, would likewise use the setting type corresponding to
their parent device. However, this turns out to be both complicated
(the settings plugins and connection editor would have a
hard-to-impossible time figuring out which setting type to use in some
cases) and incorrect (for most L2 settings [eg, BSSID, bond mode,
etc], the VLAN can't have its own values separate from the parent
device).

What we should have done was just have :mac-address,
:cloned-mac-address, and :mtu properties on NMSettingVlan. However, at
this point, for backward-compatibility, we will just stick with using
a combination of NMSettingVlan and NMSettingWired, but we will use
NMSettingWired regardless of the underlying hardware type.
2013-09-12 18:34:23 -04:00
Daniel Drake
3f4811be22 libnm-util: accept old-style UUIDs as valid
Old versions such as 0.9.4 generated 40-character UUIDs with no
hashes, but libnm-util regards them as invalid. That means that
existing connections stop working when upgrading from 0.9.4.

Continue accepting such UUIDs as valid, and add a test so that
we don't forget in future.
2013-09-09 08:20:37 -05:00
Jiří Klimeš
9835da7c74 libnm-util: update description of team:config and team-port:config properties 2013-09-06 13:52:27 +02:00
Jiří Klimeš
8e050a3a77 trivial: fix a typo in description of ipv6.method in libnm-util 2013-09-04 12:56:17 +02:00
Dan Winship
5094d00b1e libnm-util: fix nm_setting_wireless_ap_security_compatible()
It was still looking at priv->security.
2013-09-03 13:47:46 -04:00
Jiří Klimeš
0e57603e43 libnm-util: nm_utils_hwaddr_aton_len() allow hyphens in MAC string (rh #1002553)
http://en.wikipedia.org/wiki/MAC_address#Notational_conventions
Both 01:23:45:67:89:ab and 01-23-45-67-89-ab are used and valid.
2013-09-02 10:08:02 +02:00
Jiří Klimeš
0185e8371f libnm-util: deprecate 'security' property of '802-11-wireless' setting
'security' property is redundant, because the security restrictions are easily
recognized by the presence of '802-11-wireless-security' in a Wi-Fi connection.
The setting has to be present anyway, but we also had to set and check whether
the value in 'security' matches the security setting.
Following the KISS principle, it is best not to use the 'security' property
altogether.
2013-09-02 09:46:31 +02:00
Jiří Klimeš
284cce0405 test: remove deprecated 'security' property from tests
Adjust tests not to use deprecated 'security' property.
2013-09-02 09:46:31 +02:00
Pavel Šimerda
2a4a359eb1 libnm-util: add NM_SETTING_COMPARE_FLAG_CANDIDATE flag
Acked-by: Dan Winship <danw@gnome.org>
Acked-by: Thomas Haller <thaller@redhat.com>
2013-08-22 22:06:47 +02:00
Dan Winship
bfce3f7dc8 build: switch from $(INCLUDES) to $(AM_CPPFLAGS) to make automake happy
Unfortunately, $(AM_CPPFLAGS) gets overridden by per-target _CPPFLAGS
variables, which $(INCLUDES) did not, so this requires some additional
changes.

In most places, I have just gotten rid of the per-target _CPPFLAGS
variables; in directories with a single target, the per-target
variable is unnecessary, and in directories with multiple targets, the
per-target variable is often undesirable, since it forces some files
to be compiled twice, even though there ends up being no difference
between the two files.
2013-08-22 11:49:16 -04:00
Jiri Pirko
886c760f8b ifcfg-rh: reader: allow device to not have ipv4 setting.
If BOOTPROTO is set to "none", user states that no ipv4 setting should
be set. So respect that.

Introduce helper is_any_ip4_address_defined() along the way to make the
code more readable.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-22 08:51:48 -04:00
Jiri Pirko
64cdb1a7f0 libnm-util: add setting for team port
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:14 -05:00
Jiri Pirko
3dcb7935a5 libnm-util: add team device setting
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:53:03 -05:00
Pavel Šimerda
320a9d16a3 all: replace struct in_addr with guint32 2013-08-03 00:15:07 -05:00
Jiří Klimeš
72e65ef45c trivial: use capital "B" in InfiniBand 2013-07-22 10:34:38 +02:00
Jiří Klimeš
b40e5f4aa9 libnm-util: fix possible crash when IP method is NULL 2013-07-03 16:50:18 +02:00
Jiří Klimeš
c8d5f73218 libnm-util: fix description comment for 'read-only' property 2013-07-01 17:52:25 +02:00
Jiří Klimeš
44b6a441b9 libnm-util: update 'timestamp' property description, noting it is read-only 2013-07-01 17:07:24 +02:00
Jiří Klimeš
236155d9c9 libnm-util: remove 'downdelay' and 'updelay' when setting 'arp_interval'
Both 'downdelay' and 'updelay' bonding options are only valid with 'miimon'
that is being removed when setting 'arp_interval'.
2013-06-25 18:03:11 +02:00