Commit Graph

1021 Commits

Author SHA1 Message Date
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