Commit graph

977 commits

Author SHA1 Message Date
Dan Winship 6f61b3b934 libnm-util: add nm-util-private.h header with nm_util_get_private() 2014-03-26 10:39:36 -04:00
Dan Williams 13c348dcd9 libnm-util: fix Bridge priority default (rh #1073664)
Due to a misread of the kernel code, the bridge priority default
when STP was enabled was 0x80 instead of 0x8000.
2014-03-14 15:29:11 -05:00
Thomas Haller b73783b4a4 trivial: fix invalid code comment
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-14 17:06:19 +01:00
Thomas Haller 2f67105a91 libnm-util: remove assert to nm_utils_ip4_netmask_to_prefix
Commit 240c92ddb5 added an assert
to check that the input netmask is valid. Revert that commit for
the most part, some changes to the test function are not reverted.

We don't want to assert for a valid netmask, because it's
common to read the netmask from (untrusted) user input, so we
don't want to assert against it.

The caller *could* validate the netmask from untrusted sources, but
with the assert in place it cannot validate it in the most obvious way:

    prefix = nm_utils_ip4_netmask_to_prefix (netmask);
    if (netmask != nm_utils_ip4_prefix_to_netmask (prefix))
        goto fail;

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-14 16:55:51 +01:00
Thomas Haller 269ab02081 test: fix failure in make check due to invalid sorting of libnm-util/libnm-util.ver
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-06 20:09:45 +01:00
Dan Winship 4a5e2ced08 libnm-util: add nm_utils_check_virtual_device_compatibility()
Add a function encoding the logic of what virtual types support what
slave/parent types, so clients don't need to encode it themselves.
2014-03-06 09:37:20 -05:00
Dan Winship 50dea202a8 libnm-util: fix minor bugs in nm_setting_vlan_remove_priority_str_by_value()
Plug a leak, remove some dead code.
2014-03-05 11:20:54 -05:00
Jiří Klimeš 28bd3cab28 core: add 'type' and 'id' property for NMActiveConnection (rh #1061822)
https://bugzilla.redhat.com/show_bug.cgi?id=1061822
2014-03-05 16:17:13 +01:00
Jiří Klimeš d98a34dcda libnm-util: more specific error for missing ipv[46].adddress when method=manual 2014-03-03 12:42:05 +01:00
Dan Winship e4a8cfd502 libnm-util: fix some parameter names to kill gtk-doc warnings 2014-02-28 16:12:49 -05:00
Jiří Klimeš 642cfdeebf libnm-util: add *_remove_*_by_value() functions for 'vlan' setting
nm_setting_vlan_remove_priority_by_value()
nm_setting_vlan_remove_priority_str_by_value()
2014-02-28 10:39:09 +01:00
Jiří Klimeš 1e5370b4d2 libnm-util: add *_remove_*_by_value() functions for '802-11-wireless-security' setting
nm_setting_wireless_security_remove_proto_by_value()
nm_setting_wireless_security_remove_pairwise_by_value()
nm_setting_wireless_security_remove_group_by_value()
2014-02-28 10:39:09 +01:00
Jiří Klimeš de646d9588 libnm-util: add *_remove_*_by_value() functions for '802-11-wireless' setting
nm_setting_wired_remove_mac_blacklist_item_by_value()

Also add missing function nm_setting_wired_clear_mac_blacklist_items() and notify
about mac-address-blacklist changes.
2014-02-28 10:39:09 +01:00
Jiří Klimeš ca0aa8139c libnm-util: add *_remove_*_by_value() functions for '802-3-ethernet' setting
nm_setting_wired_remove_mac_blacklist_item_by_value()
and missing
nm_setting_wired_clear_mac_blacklist_items()
2014-02-28 10:39:09 +01:00
Jiří Klimeš b59bd75956 libnm-util: add *_remove_*_by_value() functions for 'connection' setting
nm_setting_connection_remove_permission_by_value()
nm_setting_connection_remove_secondary_by_value()
2014-02-28 10:39:09 +01:00
Jiří Klimeš 7c817d4176 libnm-util: add *_remove_*_by_value() functions for '802-1x' setting
nm_setting_802_1x_remove_eap_method_by_value()
nm_setting_802_1x_remove_altsubject_match_by_value()
nm_setting_802_1x_remove_phase2_altsubject_match_by_value()
2014-02-28 10:38:53 +01:00
Jiří Klimeš 1303ac3e9c libnm-util: add *_remove_*_by_value() functions for 'ipv4' and 'ipv6' settings
nm_setting_ip4_config_remove_dns_by_value()
nm_setting_ip4_config_remove_dns_search_by_value()
nm_setting_ip4_config_remove_address_by_value()
nm_setting_ip4_config_remove_route_by_value()

nm_setting_ip6_config_remove_dns_by_value()
nm_setting_ip6_config_remove_dns_search_by_value()
nm_setting_ip6_config_remove_address_by_value()
nm_setting_ip6_config_remove_route_by_value()
2014-02-28 10:31:41 +01:00
Jiří Klimeš 3789412160 libnm-util: fix adding values to 'phase2-altsubject-matches'
It was mixed up with 'altsubject-matches'.
2014-02-25 18:42:24 +01:00
Jiří Klimeš 68066b40f2 libnm-util: fix verify_identity() in '802-1x' setting
We need to return FALSE on error, otherwise we pile GErrors and assert in
nm_setting_verify().
2014-02-25 15:57:54 +01:00
Jiří Klimeš c2a1cb1a44 docs: use %TRUE, %FALSE macros instead of plain TRUE, FALSE values for gtkdoc 2014-02-24 17:00:39 +01:00
Dan Winship 9c4d86ee80 libnm-util, libnm-glib: add versioned deprecation/availability macros
Add versioned NM_DEPRECATED_IN_* and NM_AVAILABLE_IN_* macros, and tag
new/deprecated functions accordingly. (All currently-deprecated
functions are assumed to have been deprecated in 0.9.10.)

Add NM_VERSION_MIN_REQUIRED and NM_VERSION_MAX_ALLOWED macros which
can be set to determine which versions will cause warnings.

With the current settings, external consumers of the
libnm-util/libnm-glib APIs will have MIN_REQUIRED and MAX_ALLOWED both
set to NM_VERSION_0_9_8 by default, meaning they will get warnings
about functions added in 0.9.10. NM internally sets
NM_VERSION_MAX_ALLOWED to NM_VERSION_NEXT_STABLE to ensure that it is
always allowed to use all APIs.
2014-02-13 11:24:37 -05:00
Dan Winship 95be722e54 libnm-util, libnm-glib: add some missing "Since: 0.9.10" tags
Based on diffing libnm-util.ver and libnm-glib.ver with their 0.9.8
versions.
2014-02-13 11:24:37 -05:00
Dan Winship f7b1b28202 libnm-util, libnm-glib: add device/connection describing functions
Add functions to describe and disambiguate devices and connections for
display to the user. Originally from libnm-gtk.
2014-01-27 15:39:51 -05:00
Dan Williams 32a001f526 core: allow custom IP address ranges for Shared connections (bgo #675973)
Given an IPv4 address and prefix for a shared config, figure out
the DHCP address range automatically.  To keep things simple we
allow a max of 252 addresses (not including network address,
broadcast address, and the hotspot) no matter what prefix you use,
so if the address is 10.0.10.1, you still only get a range of
10.0.10.2 -> 10.0.10.254.

But we also leave some addresses available above the host address
for static stuff, like we did before.  This is done on a sliding
scale from 0 to 8 addresses, where about 1/10th the number of
available addresses are reserved.

https://bugzilla.gnome.org/show_bug.cgi?id=675973
2014-01-23 16:21:01 -06:00
Thomas Haller 240c92ddb5 libnm-util: add assert to nm_utils_ip4_netmask_to_prefix
g_return if the user provides an invalid netmask.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-21 21:01:56 +01:00
Dan Williams a52c3e2e5f libnm-util: fix trivial GOI copy & paste issue 2014-01-21 10:18:23 -06:00
Jiří Klimeš 7ffbbae3a0 libnm-glib; fix introspection annotations so that <ipv6>.get_address() worked
Without the correct annotation, the functions didn't work correctly in Python
(causing segmentation fault).
2014-01-16 17:37:16 +01:00
Dan Winship 4c0ac46a99 libnm-util: add a missing GValue transform needed by nmtui 2014-01-16 09:19:06 -05:00
Thomas Haller ff6315cbab libnm-util: only emit one CHANGED signal when adding several settings
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-15 17:01:53 +01:00
Thomas Haller 123bf9eea4 libnm-util: raise CHANGED signal in nm_connection_update_secrets only on change
This changes behaviour of nm_connection_update_secrets() in that it will
now return %TRUE, if there are no secrets to be cleared. Seems more
correct, to return success if there is nothing to do.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-15 17:01:53 +01:00
Thomas Haller 0f38213129 libnm-util: raise CHANGED signal in nm_connection_clear_secrets only on change
Often, nm_connection_clear_secrets does have no consequences, because
there is nothing to be cleared. Only raise a signal, if something
actually changed.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-15 17:01:53 +01:00
Thomas Haller 4dd6ab8f4b libnl-util: refactor nm_utils_ip4_prefix_to_netmask/netmask_to_prefix
- use a more efficient implementation for prefix_to_netmask
- fix netmask_to_prefix to behave consistently in case of
  invalid netmask
- remove unused duplicated functions from NetworkManagerUtils.c
- add test functions

Based-on-patch-by: Pavel Šimerda <psimerda@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Related: https://bugzilla.gnome.org/show_bug.cgi?id=721771
2014-01-10 13:34:57 -06:00
Jiří Klimeš eac3c36bbf trivial: fix erroneous copy&paste value in libnm-glib 2013-12-18 10:06:06 +01:00
Thomas Haller b7f6169dbd libnm-util: minor refactoring in nm_connection_compare()
Evaluate a cheaper comparison first, to fail early

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-17 17:18:14 -06:00
Dan Winship d174825412 libnm-util: don't introspect nm_utils_inet[46]_ntop
nm_utils_inet4_ntop() and nm_utils_inet6_ntop() have arguments of
non-introspected types, so mark them (skip) to avoid warnings from
g-ir-scanner.
2013-12-16 13:06:52 -05:00
Thomas Haller 9d319e6da0 libnm-util: refactor NMSetting name and register_settings
- refactor register_settings to allow lookup by GType and
  add the settings name to SettingInfo.

- setting NM_SETTING_NAME is deprecated and should not be set anymore.
  Indeed it has always be a bug, to reset the name to a different value.
  The only valid place to set the name was in the _init() function of
  the derived class itself.
  This is now no longer needed/possible. Instead the name get's
  detected based on the registered setting types. This makes use of
  the registered metadata that is available anyway since every
  usable setting has to register itself.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-12 21:47:13 +01:00
Jiří Klimeš b5b49a4bc0 trivial: fix typo in pppoe::service property 2013-12-12 13:14:11 +01:00
Jiří Klimeš 98bcbd2d24 libnm-util: don't touch dhcp-send-hostname when setting dhcp-hostname (rh #1001529)
It is better to leave it to user whether he wants to enable sending hostname,
because he probably disabled it manually (dhcp-send-hostname is TRUE by default).
Also, this would not work for plugins that read and set dhcp-hostname after
dhcp-send-hostname.

https://bugzilla.redhat.com/show_bug.cgi?id=1001529
2013-12-12 08:32:13 +01:00
Thomas Haller 6f2cfe263e all: refactor to make use of nm_utils_inet[46]_ntop functions
https://bugzilla.gnome.org/show_bug.cgi?id=711684

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-09 17:21:22 +01:00
Thomas Haller 41f8114359 libnm-util: add nm_utils_inet[46]_ntop functions
https://bugzilla.gnome.org/show_bug.cgi?id=711684

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-09 17:21:21 +01:00
Thomas Haller 1c031cddf7 libnm-util: bugfix wrong diff result in nm_connection_diff
Commit 6abc7b78f6 introduced a
bug in nm_connection_diff() by not reading the property value with
g_object_get_property().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-09 11:26:33 +01:00
Thomas Haller 6abc7b78f6 libnm-util: call virtual compare_property in nm_connection_diff
nm_connection_diff must also use the virtual functions like
nm_connection_compare. This way, settings can overwrite the default
comparison of individual properties.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-05 17:09:46 -06:00
Dan Williams 5f15409684 libnm-util: add INFERRABLE flag and remove CANDIDATE
INFERRABLE means the opposite of CANDIDATE; a property which NetworkManager
can read ("infer") from the system or the kernel when generating
connections.  CANDIDATE isn't a great name and thus dies.
2013-12-05 16:07:24 -06:00
Dan Williams 983079cd59 libnm-util: remove usage of NM_SETTING_PARAM_SERIALIZE
The only property that is not serializes is each settings' 'name'
property, so the flag serves no purpose.
2013-12-02 15:26:12 -06:00
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
Jiří Klimeš 128c9d788f libnm-util: verify() - can't set both IPv4 'disabled' and IPv6 'ignore' method 2013-06-25 18:03:02 +02:00
Jiří Klimeš 71b5b77b3a libnm-util: add Since tag to interface-name property 2013-06-24 12:39:01 +02:00
Jiří Klimeš 2cc42bad06 libnm-util: fix tests after 'gateway-ping-timeout' addition 2013-06-24 12:24:17 +02:00
Dan Williams 00203a8798 libnm-util: add gateway-ping-timeout property to connection setting
To better handle broken hardware, like switches which don't pass
traffic for a few seconds after a carrier has been negotiated,
add a timeout to control how long to wait for successful pings
of the gateway before giving up and proceeding with IP config.
Default is 0, which means don't ping the gateway, just assume
the NIC/switch aren't lying and can pass traffic immediately.
2013-06-21 16:17:18 -05:00
Dan Winship 84468ad653 libnm-util: fix alphabetization in libnm-util.ver
to fix "make check"
2013-06-14 12:24:40 -03:00
Dan Winship 6854481fe8 libnm-util: add P_Key support to NMSettingInfiniband
Add p-key and parent properties to NMSettingInfiniband, for specifying
additional interfaces using alternate IPoIB partitions.
2013-06-13 15:52:51 -03:00
Dan Winship 9a73db17d5 libnm-util: add nm_utils_hwaddr_valid() 2013-06-13 15:52:51 -03:00
Jiří Klimeš 88d9db0cdb libnm-util: make some error messages clearer
The 'setting' gerund could be confused with 'setting' as a NMSetting.
2013-06-13 10:05:18 +02:00
Jiří Klimeš 816ac9ee70 libnm-util: prefix errors with 'setting.property' instead of 'property' only 2013-06-13 10:05:18 +02:00
Dan Winship 82ac7da754 libnm-util: add hwaddr functions that take length rather than type
Add nm_utils_hwaddr_ntoa_len() and nm_utils_hwaddr_aton_len(), which
take a length rather than a type, which is generally more convenient,
and also necessary if you might be encountering devices of unknown
types.
2013-06-11 09:27:45 -03:00
Aleksander Morgado 46853f0821 libnm-util: deprecate 'network-type' and 'allowed-bands' in GSM settings
When requesting connections to ModemManager, NetworkManager shouldn't try to
request specific bands or network types to use. Leave those requests to other
system configuration tools talking directly to ModemManager.

https://bugzilla.gnome.org/show_bug.cgi?id=701504
2013-06-05 12:39:24 -05:00
Dan Winship 43617d4c1d libnm-util: deprecate nm_utils_slist_free(), use g_slist_free_full() 2013-05-29 17:13:30 -03:00
Dan Williams cd5d92705d settings: track whether connection is saved to disk or not
Use the new NMConnection 'changed' signal to mark connections
as dirty/unsaved, and reset that when they get flushed to disk.
Previously, the 'Updated' signal was emitted only when the
connection was changed and flushed to disk, but now we have
more granular needs, and the signal is emitted whenever the
connection actually *is* changed, regardless of whether its
flushed to disk or not.
2013-05-28 12:26:55 -05:00
Dan Williams 87517ba6df libnm-util: sync some 802.1x function arguments with documentation 2013-05-28 12:26:55 -05:00
Dan Williams f6064e7b74 libnm-util: implement connection changed signal
Emitted whenever settings are added or removed from the connection,
and whenever any property of any setting in the connection is changed.
2013-05-28 12:26:55 -05:00
Jiří Klimeš 18e9fba3d8 libnm-util: correct documentation for NMSettingConnection:timestamp 2013-05-28 18:19:37 +02:00
Dan Williams 1d8ab72a60 libnm-util: fix hashing of secrets broken by 4d326182
4d326182 changed connection hashing slightly such that now base type settings
are always returned even if they are empty. Unfortunately a bunch of code in
the settings hashed connections with the ONLY_SECRETS flag and then checked
whether the returned hash was NULL or not to determine whether there were
any secrets, and then called nm_connection_update_secrets() with the hash.

nm_connection_update_secrets() would fail in the case where a setting
name was given, but the passed-in secrets hash did not contain any secrets
for the requested setting.  Instead, the function should return success
to match the semantics of passing in an entire connection hash which may
not have any secrets either.
2013-05-20 13:56:48 -05:00
Jiří Klimeš ced61dfc7f libnm-util: add access functions for 'mac-address-blacklist' to wired/wireless
nm_setting_wire(d/less)_get_num_mac_blacklist_items()
nm_setting_wire(d/less)_get_mac_blacklist_item()
nm_setting_wire(d/less)_add_mac_blacklist_item()
nm_setting_wire(d/less)_remove_mac_blacklist_item()
2013-05-07 19:38:31 +02:00
Dan Winship 8b823d7c6a libnm-util: add NMSettingGeneric
Add NMSettingGeneric, a dummy L2 NMSetting for creating NMConnections
for devices that are not specifically recognized.
2013-05-07 12:46:56 -04:00
Dan Williams 0a5f272c35 libnm-util: correct documentation for nm_setting_update_secrets() 2013-05-04 13:18:28 -05:00
Dan Williams 5f61594585 wifi: wep40 and wep104 are invalid algorithms for WPA pairwise
The supplicant rejects them, so any configuration that used them
wasn't working for a long time anyway.  Remove them.
2013-05-03 10:31:50 -05:00
Dan Williams ccaf5231a2 libnm-util: clarify WiFi security pairwise/group property descriptions 2013-05-03 10:31:50 -05:00
Dan Williams 72ea5dac33 libnm-util: clarify WiFi setting MAC address blacklist description 2013-05-03 10:31:50 -05:00
Dan Williams 229cba8354 libnm-util: clarify 802.1x password and password-raw documentation 2013-05-03 10:31:50 -05:00
Jiří Klimeš 5a50e60ac3 libnm-util: define NM_SETTING_GSM_BANDS_MAX - maximal value for allowed bands
and use it in 'allowed-bands' property installation.

The macro NM_SETTING_GSM_BANDS_MAX also allows libnm-util users to check
if bands are valid (before setting them).
2013-05-03 17:23:41 +02:00
Dan Winship 4d32618264 libnm-util: handle "empty" connection-type settings correctly
nm_setting_to_hash() would return NULL if the setting had entirely
default values, but this effectively meant that you could never have a
connection whose "connection type" setting (eg, NMSettingWired) had
all default values. (This ended up not usually being a problem in
practice because most such settings had at least one property with a
mandatory string value where the GObject property had a default value
of NULL.)

However, NMSettingGeneric will have no properties, so it would always
get stripped out when converting to a hash, invalidating the
connection. Fix that.
2013-05-03 08:39:10 -04:00
Dan Winship 6cb786f569 libnm-util: move setting priority functions to nm-setting.c
None of these take an NMConnection; they logically belong in
NMSetting.
2013-05-03 08:39:06 -04:00
Jiří Klimeš c35dda8727 libnm-util: fix the maximal value for gsm 'allowed-bands' property
The bitfields have to be OR-ed with the bitwise |, not ||.
2013-05-03 10:11:56 +02:00
Jiří Klimeš bfc20af513 libnm-util: fix WEP key type comparison in nm_utils_wep_key_valid() 2013-05-03 10:11:56 +02:00
Jiří Klimeš 841c259119 libnm-util: make nm_connection_replace_settings_from_connection() safer
When 'connection' and 'new_connection' arguments are the same object make the
function no-op and simply return true. Otherwise 'connection's settings are
removed, making it invalid.

Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
2013-04-22 10:15:53 -05:00
Dan Winship 649d2e4c1b libnm-util: fix doc bug in NMSettingIP6Config 2013-04-19 15:37:48 -04:00
Martin Pitt 57a9fb3c89 Use %NULL macro in doc strings
Mass-converted "NULL" to "%NULL" in docstrings with

  find -name '*.c'| xargs sed -i '/^ \*.*[^%]NULL/ s/NULL\b/%NULL/g'
2013-04-19 10:08:17 -04:00
Martin Pitt 6226fb9b59 libnm-util: Fix transfer annotations of nm_{connection,setting}_need_secrets()
The various need_secrets() implementation do allocate a fresh GPtrArray, but
add static strings to them without dup'ing. Thus callers must _not_ free the
array elements, only the array itself. Adjust documentation and annotations
accordingly.

Also adjust the corresponding comment in the goi-list-connections.py example.

https://bugzilla.gnome.org/show_bug.cgi?id=698175
2013-04-19 09:43:56 -04:00
Dan Williams bafd0d557d libnm-util: add nm_connection_replace_settings_from_connection() (bgo #696387)
Convenience function to replace settings in one conneciton with settings
from another, without having to go through the nm_connection_to_hash()
steps, which are just inefficient and kinda pointless.
2013-04-17 12:23:34 -05:00
Dan Williams 4aa91e22a0 libnm-util: fix mis-freed VLAN priority list element
We want to free the element data, then remove the element from the
list.  Instead the code freed the element data, then treated the
element data pointer as a GSList link, which is completely wrong.
2013-04-11 19:11:51 -05:00
Dan Winship 5fec30d98e Revert :carrier-detect properties and associated code
Ignoring carrier is generally something you want at the machine level
(eg, for a server), not at the connection level.
2013-04-03 10:23:49 -04:00
Jiří Klimeš f17ab954f6 libnm-util: make nm_setting_vpn_remove_*() return gboolean instead of void
to match other property removal functions, like nm_setting_bond_remove_option()
or nm_setting_wired_remove_s390_option().

Note:
This is an API change, make sure to bump soname when releasing libnm-util.
2013-04-03 08:35:47 +02:00
Dan Williams a492d29ceb libnm-util: convert remaining NMConnection users to GHashTableIter 2013-04-01 17:18:54 -05:00
Dan Williams 6c7c2b874d libnm-util: convert nm_setting_new_from_hash() to GHashTableIter 2013-04-01 17:18:54 -05:00
Dan Williams a8d33c7e2c libnm-util: convert nm_connection_duplicate() to GHashTableIter 2013-04-01 17:18:54 -05:00
Dan Williams 7a7ce3b8e2 libnm-util: convert nm_connection_dump() to GHashTableIter 2013-04-01 17:18:54 -05:00
Dan Williams df02e7324c libnm-util: convert nm_connection_compare() to GHashTableIter
And finally add some testcases for it too.
2013-04-01 17:18:54 -05:00
Dan Williams 66230eb2f6 libnm-util: reduce memory used by NMConnection
The setting names used when inserting a setting into the hash
table are const since they are derived from GObject internals,
so there's no need to strdup them.
2013-04-01 17:18:53 -05:00
Dan Williams faf376dad1 libnm-util: fix memory leaks of dhcp_hostname and dhcp_client_id 2013-04-01 17:18:53 -05:00
Dan Williams c00e2f1d9d libnm-util: fix some memory leaks in testcases
Helps suppress valgrind false positives.
2013-04-01 17:18:53 -05:00
Dan Williams 0ab00b895b libnm-util: make nm_setting_wired_add_s390_option() argument names consistent 2013-04-01 17:12:22 -05:00
Jiří Klimeš 2109f41cc6 libnm-util: consolidate hex-string <-> bin conversion functions
and move them to libnm-util's nm-utils.s so that they are easily available.
2013-03-28 16:59:58 +01:00
Dan Winship 6ff924f82f libnm-utils: change the GValue transforms to match nmcli's outputs
That way, nmcli can use them...
2013-03-26 12:15:49 -04:00
Dan Winship 331b69bd90 libnm-util: split GValue transforms out of nm-utils.c
nm-utils.c is really big, so split the GValue transforms out into
their own file.
2013-03-26 12:15:49 -04:00
Jiří Klimeš dc58072f7b libnm-util: install :pin and :pin-flags as properties for NMSetting8021x
GLib-GObject-WARNING **: g_object_get_property: object class `NMSetting8021x' has no property named `pin'
GLib-GObject-WARNING **: g_object_get_property: object class `NMSetting8021x' has no property named `pin-flags'
2013-03-26 16:49:37 +01:00
Jiří Klimeš 82fb1978a4 all: use G_VALUE_INIT to initialize GValue variables
It makes the initializations more explicit.
G_VALUE_INIT is available since glib 2.30, and NM now require glib >= 2.32
2013-03-25 08:41:18 +01:00
Jiří Klimeš d7d2015dfd libnm-util: add nm_setting_wired_get_valid_s390_options() 2013-03-19 08:59:50 +01:00
Jiří Klimeš cc1de4676e libnm-util: fix documentation of add(remove)_s390_option() 2013-03-18 18:11:29 +01:00
Colin Walters ffb6df6f4a libnm-glib,libnm-util: -glib requires -util, -util requires NetworkManager
libnm-glib's public headers include headers from libnm-util. While it
does work to just $(pkg-config --cflags --libs libnm-glib), this is
only because libnm-glib has a requires on NetworkManager which happens
to use the same include directory as libnm-util.

The correct dependency chain is thus:
libnm-glib -> libnm-util -> NetworkManager

Signed-off-by: Colin Walters <walters@verbum.org>
2013-03-14 10:23:19 -05:00
Jiří Klimeš f36c7301f0 libnm-util: more verbose verification errors for :interface-name 2013-03-14 11:00:45 +01:00
Jiří Klimeš 2295e5fbe0 libnm-util: add the detailed description of interface-name to blurb as well
So that the description is in the generated documentation and nm-settings(5)
manual page.
2013-03-14 10:36:50 +01:00
Dan Winship 2d668d763e libnm-util: add NMSettingConnection:interface-name
https://bugzilla.gnome.org/show_bug.cgi?id=693684
2013-03-13 16:45:18 -04:00
Jiří Klimeš df142a5dc4 libnm-util: make property verification errors more descriptive
- fix g_set_error()/g_set_error_literal() usage
- make the error messages translatable
- use g_prefix_error() to prepend property name
2013-03-13 17:47:11 +01:00
Dan Williams fa97543186 libnm-util: free temporary decoded base64 data when parsing OpenSSL key files
==7347== 1,201 bytes in 1 blocks are definitely lost in loss record 5,016 of 5,107
==7347==    at 0x4A06B0F: calloc (vg_replace_malloc.c:593)
==7347==    by 0x39B90548E6: g_malloc0 (gmem.c:189)
==7347==    by 0x39B9026F8D: g_base64_decode (gbase64.c:407)
==7347==    by 0x4C51CA1: parse_old_openssl_key_file (crypto.c:227)
==7347==    by 0x4C51EC3: crypto_decrypt_private_key_data (crypto.c:497)
==7347==    by 0x4C529BE: crypto_verify_private_key_data (crypto.c:706)
==7347==    by 0x4C52B7B: crypto_verify_private_key (crypto.c:735)
==7347==    by 0x4C5CCC5: nm_setting_802_1x_set_private_key (nm-setting-8021x.c:1633)
==7347==    by 0xC8F64D4: eap_tls_reader (reader.c:2270)
==7347==    by 0xC8F4886: fill_8021x (reader.c:2704)
==7347==    by 0xC8F8311: wireless_connection_from_ifcfg (reader.c:2825)
==7347==    by 0xC8FAFD2: connection_from_file (reader.c:4303)
2013-03-08 09:27:51 -06:00
Dan Williams c22e4da986 libnm-util: free PPPoE setting private data members
==23089== 342 bytes in 38 blocks are definitely lost in loss record 4,870 of 5,123
==23089==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
==23089==    by 0x39B905488E: g_malloc (gmem.c:159)
==23089==    by 0x39B906A4BB: g_strdup (gstrfuncs.c:356)
==23089==    by 0x31FC02DA90: set_property (nm-setting-pppoe.c:220)
==23089==    by 0x39B9819972: g_object_set_property (gobject.c:1352)
==23089==    by 0x31FC01A9A7: nm_setting_enumerate_values (nm-setting.c:589)
==23089==    by 0x31FC01AA81: nm_setting_duplicate (nm-setting.c:264)
==23089==    by 0x31FC01633B: duplicate_cb (nm-connection.c:1182)
==23089==    by 0x39B903F8DF: g_hash_table_foreach (ghash.c:1524)
==23089==    by 0x31FC01756C: nm_connection_duplicate (nm-connection.c:1203)
==23089==    by 0x4A7BE3: get_settings_auth_cb (nm-settings-connection.c:1062)
==23089==    by 0x4A5624: auth_start (nm-settings-connection.c:1008)
2013-03-08 09:27:51 -06:00
Dan Williams ca00badb03 libnm-util: free temporary string when parsing OpenSSL key files
'str' was not freed anywhere.

==23089== 2,072 (24 direct, 2,048 indirect) bytes in 1 blocks are definitely lost in loss record 5,063 of 5,123
==23089==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
==23089==    by 0x39B905488E: g_malloc (gmem.c:159)
==23089==    by 0x39B9068CA1: g_slice_alloc (gslice.c:1003)
==23089==    by 0x39B906C7FA: g_string_sized_new (gstring.c:121)
==23089==    by 0x39B906CE75: g_string_new_len (gstring.c:186)
==23089==    by 0x31FC0149CE: parse_old_openssl_key_file (crypto.c:150)
==23089==    by 0x31FC014E33: crypto_decrypt_private_key_data (crypto.c:494)
==23089==    by 0x31FC01592E: crypto_verify_private_key_data (crypto.c:703)
==23089==    by 0x31FC015AEB: crypto_verify_private_key (crypto.c:732)
==23089==    by 0x31FC0200E5: nm_setting_802_1x_set_private_key (nm-setting-8021x.c:1640)
==23089==    by 0xC694304: eap_tls_reader (reader.c:2280)
==23089==    by 0xC692756: fill_8021x (reader.c:2714)
2013-03-08 09:27:51 -06:00
Dan Williams 2878481c09 libnm-util: free temporary GByteArray when using NM_SETTING_802_1X_CK_SCHEME_PATH
If the certificate's format was valid, but we're asked to refer to it by
paths instead of using the raw data, 'data' would be leaked.

==23089== 8,232 (40 direct, 8,192 indirect) bytes in 1 blocks are definitely lost in loss record 5,109 of 5,123
==23089==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
==23089==    by 0x39B905488E: g_malloc (gmem.c:159)
==23089==    by 0x39B9068CA1: g_slice_alloc (gslice.c:1003)
==23089==    by 0x39B9024539: g_array_sized_new (garray.c:195)
==23089==    by 0x31FC0146EA: file_to_g_byte_array (crypto.c:319)
==23089==    by 0x31FC01543B: crypto_load_and_verify_certificate (crypto.c:606)
==23089==    by 0x31FC01ED26: nm_setting_802_1x_set_client_cert (nm-setting-8021x.c:819)
==23089==    by 0xC6944A4: eap_tls_reader (reader.c:2316)
==23089==    by 0xC692756: fill_8021x (reader.c:2714)
==23089==    by 0xC696151: wireless_connection_from_ifcfg (reader.c:2832)
==23089==    by 0xC698E3A: connection_from_file (reader.c:4316)
==23089==    by 0xC69135C: nm_ifcfg_connection_new (nm-ifcfg-connection.c:119)
==23089==
==23089== 8,352 (160 direct, 8,192 indirect) bytes in 4 blocks are definitely lost in loss record 5,110 of 5,123
==23089==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
==23089==    by 0x39B905488E: g_malloc (gmem.c:159)
==23089==    by 0x39B9068CA1: g_slice_alloc (gslice.c:1003)
==23089==    by 0x39B9024539: g_array_sized_new (garray.c:195)
==23089==    by 0x31FC0146EA: file_to_g_byte_array (crypto.c:319)
==23089==    by 0x31FC01543B: crypto_load_and_verify_certificate (crypto.c:606)
==23089==    by 0x31FC01E5E6: nm_setting_802_1x_set_ca_cert (nm-setting-8021x.c:538)
==23089==    by 0xC694DD8: eap_peap_reader (reader.c:2358)
==23089==    by 0xC692756: fill_8021x (reader.c:2714)
==23089==    by 0xC696151: wireless_connection_from_ifcfg (reader.c:2832)
==23089==    by 0xC698E3A: connection_from_file (reader.c:4316)
==23089==    by 0xC69135C: nm_ifcfg_connection_new (nm-ifcfg-connection.c:119)
2013-03-08 09:27:51 -06:00
Dan Williams 0f5b91ad2e libnm-util: fix leak of s390 subchannels
==23089== 7,293 (1,248 direct, 6,045 indirect) bytes in 39 blocks are definitely lost in loss record 5,100 of 5,123
==23089==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
==23089==    by 0x39B905488E: g_malloc (gmem.c:159)
==23089==    by 0x39B9068CA1: g_slice_alloc (gslice.c:1003)
==23089==    by 0x39B9024E90: g_ptr_array_sized_new (garray.c:884)
==23089==    by 0x31FB81B3FC: ptrarray_copy (dbus-gvalue-utils.c:1047)
==23089==    by 0x31FB81845C: proxy_value_copy (dbus-gtype-specialized.c:446)
==23089==    by 0x39B980F51E: g_boxed_copy (gboxed.c:359)
==23089==    by 0x31FC03134C: set_property (nm-setting-wired.c:619)
==23089==    by 0x39B9819972: g_object_set_property (gobject.c:1352)
==23089==    by 0x31FC01A9A7: nm_setting_enumerate_values (nm-setting.c:589)
==23089==    by 0x31FC01AA81: nm_setting_duplicate (nm-setting.c:264)
==23089==    by 0x31FC01633B: duplicate_cb (nm-connection.c:1182)
2013-03-08 09:27:51 -06:00
Dan Winship 6f44b7f3c6 all: remove redundant return-if-fail checks
NM_IS_FOO(x) returns FALSE if x is NULL, so we don't need a separate
(x != NULL) check before it.
2013-03-07 07:32:27 -05:00
Dan Williams 80886c2866 libnm-glib: work around possible compiler bug with GValueArray deprecation workarounds
GValueArray is deprecated.  Unfortunately, it's part of our API right now,
so we have to keep it around for a while.  But since it's deprecated, and
we want to know about *other* deprecations, we have to suppress deprecations
about GValueArray.  Unfortunately using macros to do that (eg in
nm-gvaluearray-compat.h) exposes some compiler bugs due to the combination
of parentheses/braces and #pragma from G_GNUC_BEGIN_IGNORE_DEPRECATIONS,
resulting in warnings like:

nm-utils.c:920:9: error: expected expression before ‘#pragma’

Work around this by not trying to stuff what's now a macro (eg
g_value_array_get_nth) into what's already a macro (G_VALUE_TYPE).
There's probably a better way to do this...
2013-02-27 17:16:27 +01:00
Dan Winship ed9e2d8377 build: avoid GValueArray deprecation warnings
Avoid warnings about GValueArray being deprecated by adding macros
that wrap G_GNUC_BEGIN_IGNORE_DEPRECATIONS /
G_GNUC_END_IGNORE_DEPRECATIONS around the GValueArray calls.
2013-02-26 13:07:33 +01:00
Dan Williams 47d8db57b5 trivial: plug some memory leaks
(review+ danw)
2013-02-25 16:07:03 +01:00
Dan Williams 3e689be15e libnm-util: bump soname for added functions 2013-02-22 08:34:19 -06:00
Dan Williams 873550592c libnm-util: add Since tags to new functions and properties 2013-02-22 08:34:06 -06:00
Dan Williams 4b863a4b72 trivial: fix up test-general.c after carrier-detect changes 2013-02-18 15:51:33 -06:00
Jiří Klimeš 2fef987980 libnm-util: add the detailed description of carrier-detect to blurb as well
So that we have the description in generated html documentation and nm-settings
manual page.
2013-02-18 15:57:12 +01:00
Dan Winship feeafb8cf1 core: Update device activation for :carrier-detect
Add a "need_carrier" argument to nm_device_is_available(), to allow
distinguishing between "device is not available", "device is fully
available", and "device is available except for not having carrier".

Adjust various parts of NMDevice and NMManager to allow for the
possibility of activating a connection with :carrier-detect = "no" on
a device with no carrier, and to avoid auto-disconnecting devices with
:carrier-detect = "on-activate".

https://bugzilla.gnome.org/show_bug.cgi?id=688284
2013-02-15 13:40:39 -05:00
Dan Winship 5266e25e2b libnm-utils: add :carrier-detect properties
For settings corresponding to devices that have a :carrier property
(ie bond, bridge, infiniband, vlan, and wired), add a :carrier-detect
property specifying how that affects the connection:

  yes: The connection can only be activated when the device
      has carrier, and will be deactivated if the device loses
      carrier (for more than 4 seconds).
  no: The connection ignores carrier on the device; it can be
      activated when there is no carrier, and stays activated
      when carrier is lost.
  on-activate: The connection can only be activated when the
      device has carrier, but it will not be deactivated if the
      device loses carrier.

https://bugzilla.gnome.org/show_bug.cgi?id=688284
2013-02-15 13:40:38 -05:00
Dan Winship 57327a6a57 libnm-util, libnm-glib: fix NMConnection:path again
24cda2bc broke the ability to set NMConnection:path back to NULL after
it had been set, as part of a hack to try to make
NMRemoteConnection:dbus-path work. Fix that by moving the hack
entirely into NMRemoteConnection.

https://bugzilla.gnome.org/show_bug.cgi?id=693829
2013-02-14 13:47:44 -05:00
Dan Winship 24cda2bc36 libnm-util, libnm-glib: Make NMRemoteConnection instantiable by NMObject
In order to resolve NMRemoteConnection-valued properties, NMObject
needs to be able to create NMRemoteConnections. But NMObject assumes
that all the objects it will be creating have "dbus-connection" and
"dbus-path" properties. So add those properties to NMRemoteConnection,
aliasing the existing "bus" and "path" properties (and ensure that
whichever version gets set, we keep that value, rather than letting it
get overwritten by the NULL default value of the other one).

https://bugzilla.gnome.org/show_bug.cgi?id=693669
2013-02-14 09:31:33 -05:00
Dan Winship 08f04466e8 all: remove more pointless NULL checks
GObject creation cannot normally fail, except for types that implement
GInitable and take a GError in their _new() method. Some NM types
override constructor() and return NULL in some cases, but these
generally only happen in the case of programmer error (eg, failing to
set a mandatory property), and so crashing is reasonable (and most
likely inevitable anyway).

So, remove all NULL checks after calls to g_object_new() and its
myriad wrappers.

https://bugzilla.gnome.org/show_bug.cgi?id=693678
2013-02-13 13:38:36 -05:00
Dan Winship d04f286327 all: remove pointless NULL checks
g_malloc(), etc, never return NULL, by API contract. Likewise, by
extension, no other glib function ever returns NULL due to lack of
memory. So remove lots of unnecessary checks (the vast majority of
which would have immediately crashed had they ever run anyway, since
g_set_error(), g_warning(), and nm_log_*() all need to allocate
memory).

https://bugzilla.gnome.org/show_bug.cgi?id=693678
2013-02-13 13:38:13 -05:00
Jiří Klimeš bf610255a1 libnm-util: move verify_wep_key() and verify_wpa_psk() to nm-utils.c
and rename them to nm_utils_wep_key_valid(), nm_utils_wpa_psk_valid().
They are general functions and can also be used elsewere usefully.
2013-02-06 13:29:58 +01:00
Dan Winship 8d1c646134 libnm-util: and fix up NMSettingBridgePort gtk-docs too... 2013-01-11 16:21:39 -05:00
Dan Winship d069e4894e libnm-util: fix up NMSettingBridge gtk-docs 2013-01-11 14:49:11 -05:00
Dan Williams e651169a3d libnm-util: fix format string warning 2012-12-04 12:06:20 -06:00
Dan Williams d723457ac7 libnm-util: add NMSettingBridgePort 2012-11-30 13:21:50 -06:00
Dan Williams 8ecded9a9b libnm-util: add NMSettingBridge 2012-11-30 13:21:50 -06:00
Jiří Klimeš 7147c3d1a3 libnm-util: return FALSE on missing NMSettingVlan:parent && NMSettingWired:mac-address
in NMSettingVlan's verify()
2012-11-29 16:39:15 +01:00
Stefan Brüns 357f312cea trivial: fix typos, wrong log domain in DHCPv4 2012-11-20 08:59:55 -06:00
Gene Czarcinski 90b99522d7 dhcp: fix DHCPv6 to support server-side dynamic DNS (bgo #684242)
This patch makes DHCPv6 support more or less equivalent to that
one of IPv4 DHCP.

(dcbw: fix some formatting, rearrange code so it's less convoluted,
fix up writing hostname to ifcfg files)
2012-11-16 17:26:19 -06:00
Pavel Šimerda faa1bcb540 build: improve documentation and test configure options
Use --enable-doc and --enable-tests instead of --with-docs and
--with-tests. This is consistent with other features and with
--enable-gtk-doc option. Support current variants as fallback.

Don't build tests unless --enable-tests is specified.
2012-11-13 20:23:06 +01:00
Colin Walters 59f2cd0f8d build: remove G_DISABLE_DEPRECATED
This functionality is (mostly) obsoleted by the newer
GLIB_VERSION_MIN_REQUIRED and GLIB_VERSION_MAX_ALLOWED defines.  With
this, your build doesn't all of a sudden blow up if we deprecate
something in GLib - you have to explicitly opt-in to the newer
version.

G_DISABLE_DEPRECATED does still apply for macros and things that can't
take __attribute__((deprecated)), but it's not really worth the pain
and cargo culting around just for that.
2012-10-31 19:41:07 +01:00
Dan Williams 38e3819b4e libnm-util: clean up setting registration
Make setting type registration less icky; instead of having the
connection register all the settings, have the settings themselves
register that information at library load time.  Putting this sort
of thing in G_DEFINE_TYPE_WITH_CODE is apparently more standard
than the home-rolled stuff we had before.  Also document the
priority stuff so when adding new settings, people know what
priority to use.

(cleanups by jklimes)
2012-10-29 15:12:58 -05:00
Jiří Klimeš c0458cb433 docs: correct the description of nm_utils_ap_mode_security_valid() 2012-10-18 11:01:06 +02:00
Dan Williams e6bdb8bc55 libnm-util: add methods for AP-mode security filtering
Add a helper like nm_utils_security_valid() except for access point
mode.  We can't use nm_utils_security_valid() without changing the
arguments, hence the new function.  Plus in AP mode all you care about
are the device capabilities, not AP flags since the device *is*
the AP.
2012-10-17 14:07:37 -05:00
Jan Luebbe f9c72dee3e wifi: support ap-mode with wpa_supplicant
A new value for NM80211Mode is introduced (NM_802_11_MODE_AP) and the
new mode is passed to wpa_supplicant analogous to adhoc-mode.
The places which need to know the interface mode have been extended to
handle the new mode.

If the configuration does not contain a fixed frequency, a channel is
selected the same way as with adhoc-mode before.
2012-10-17 12:08:11 -05:00
Jiří Klimeš 347e149e39 libnm-util: un-deprecate seen-bssids property and adjust its description 2012-10-16 15:48:53 +02:00
Dan Winship 7005762f50 build: "make check" fixes 2012-10-04 09:07:49 -04:00
Dan Winship de0163fc5c libnm-util: Improve NMSettingVlan's verify()
Do slightly more validation if NMSettingVlan properties, and make sure
that at least one method of specifying a parent is used.

Remove the check that id is in range, since gobject will not allow you
to set the property to a value outside its declared range anyway.
2012-09-27 13:57:20 -04:00
Dan Winship 6878d20ac4 all: Don't use ctype.h macros
The ctype macros (eg, isalnum(), tolower()) are locale-dependent. Use
glib's ASCII-only versions instead.

Also, replace isascii() with g_ascii_isprint(), since isascii()
accepts control characters, which isn't what the code wanted in any of
the places where it was using it.
2012-09-26 12:14:37 -04:00
Dan Winship 74b6b9c768 libnm-util: move nm_utils_is_uuid() here
This is useful outside the daemon too, so move it into libnm-utils.
2012-09-26 12:14:37 -04:00
Jiří Klimeš 4ee617ddf2 libnm-util: add "secondaries" property containing secondary connection UUIDs
These connections are to be activated with the base connection.
2012-09-21 13:46:54 +02:00
Marius B. Kotsbak c4a85acf80 core: add settings for 4G (LTE) network modes
NM_SETTING_GSM_NETWORK_TYPE_PREFER_4G and NM_SETTING_GSM_NETWORK_TYPE_4G added.
2012-09-11 11:47:22 -05:00
Dan Williams 81ff3b0f44 libnm-util: minor cleanups for nm_utils_iface_valid_name() 2012-08-29 17:55:03 -05:00
Thomas Graf b46508b5c6 libnm-util: move dev_valid_name() to libnm-util and make it public
The bridging code needs it as well.
2012-08-29 17:46:54 -05:00
Dan Williams 4e80077cfa libnm-util: handle RSN IBSS in AP/connection compatibility checks 2012-08-27 16:56:57 -05:00
Dan Williams f19c33b56f docs: clarify byte order of returned value from nm_utils_ip4_prefix_to_netmask() 2012-08-13 11:00:54 -05:00
Dan Williams 4106013753 trivial: fix documentation typo 2012-08-06 19:53:39 -05:00
Dan Williams ace5cd0138 docs: document OLPC Mesh setting errors 2012-08-06 19:51:23 -05:00
Dan Winship 1814fbca71 libnm-util: remove InfiniBand references in NMSettingVlan
IPoIB doesn't support VLANs (it has something similar done
differently), so remove the references to it in the docs.
2012-07-30 20:36:37 -04:00