Commit Graph

732 Commits

Author SHA1 Message Date
Francesco Giudici
12b9d30ae6 ifcfg-rh: add support to 802-3.[auto-negotiate,speed,duplex] properties
NOTE: changed the default value for auto-negotiate from TRUE to FALSE.

Normalization enforces that no values for speed and duplex are there
when autonegotiation is on. This is required as autoneg on with specific
speed and duplex set means to ethtool to use autonegotiation but
advertise that specific speed and duplex only.

autoneg off, speed 0 and duplex NULL means to ignore link negotiation.
2016-11-22 15:24:47 +01:00
Lubomir Rintel
2d2b21501f libnm-core/vpn-editor-plugin: add missing documentation
../../libnm-core/nm-vpn-editor-plugin.h:108: warning: Field description for NMVpnEditorPluginInterface::notify_plugin_info_set is missing in source code comment block.
2016-11-21 13:53:03 +01:00
Thomas Haller
34eb8d513f libnm/trivial: move hexstr<>bin conversion functions
nm_utils_hexstr2bin() is quite similar to hwaddr_aton(), and
nm_utils_bin2hexstr() is similar to _bin2str_buf().

Move them close to each other. Maybe one day they should be
consolidated. But their API is slightly different, so the
consolidation would require some effort.

For now, just move them close to each other, so that it's
clearer that two similar (but distinct) functions exists.
2016-11-13 16:01:18 +01:00
Thomas Haller
2481eaac15 man: clarify HWADDR for nm-setting-ifcfg-rh manual 2016-11-10 14:08:41 +01:00
Thomas Haller
a6416cbd13 ip-tunnel: tigthen up checks for valid IP tunnel modes
The compiler warns us when we don't specify all enum values
in a switch(), provided that default: is missing.

Make use of that to get a warning when we add a new tunnel mode.
2016-11-09 17:45:39 +01:00
Beniamino Galvani
cd73f281cc tui: add support for IP tunnel connections 2016-11-09 17:45:39 +01:00
Beniamino Galvani
5aea82d383 libnm-core: ensure a IP tunnel connection specifies a remote IP
The IP of the remote endpoint is always required.
2016-11-09 17:45:34 +01:00
Lubomir Rintel
0e6d194060 settings: allow method=shared with manual IPv6 configuration
IPv4 already allows setting an address, reusing its prefix for the network
it shares connection with. Additionally, for IPv6, the NDP can also share
the DNS configuration.
2016-11-09 17:23:32 +01:00
Thomas Haller
e36f6a7e52 libnm: add nm_utils_uuid_generate_buf() util 2016-11-09 12:07:33 +01:00
Thomas Haller
37bf643213 libnm: don't initialize buffer for uuid_unparse_lower() with zeros 2016-11-09 12:07:33 +01:00
Thomas Haller
fedee13c37 libnm: refactor loop in crypto_md5_hash()
Break the loop in the middle and avoid g_checksum_reset() call.
In many cases, we only want one MD5 sum, not a longer digest.
2016-11-09 12:07:33 +01:00
Thomas Haller
30c66b6f79 libnm: disable assertions in crypto_md5_hash() in non-debug builds 2016-11-09 11:42:56 +01:00
Thomas Haller
64ed277380 libnm-core: minor cleanups in nm-setting-vlan.c
Don't g_warn() from within the library. It's not clear
that the caller did something wrong, we shouldn't issue
glog warnings.
2016-11-02 15:22:59 +01:00
Thomas Haller
f23320478d libnm-core: fix memleak in nm-setting-vlan.c (priority_strv_to_maplist()) 2016-11-02 15:21:25 +01:00
Thomas Haller
e5fe5a4c03 libnm-core/utils: update hwaddr utilities
_nm_utils_hwaddr_length() did a validation of the string
and returned the length of the address. In all cases where
we were interested in that, we also either want to validate
the address, get the address in binary form, or canonicalize
the address.

We can avoid these duplicate checks, by using _nm_utils_hwaddr_aton()
which both does the parsing and returning the length.
2016-10-28 16:28:29 +02:00
Beniamino Galvani
ddeef464af checkpoint: introduce new flags to better restore previous state
When a global checkpoint is created (one with empty device list) we
save the status of all devices to restore it later. After the
checkpoint new interfaces and connections may appear and they can
significantly influence the overall networking status, but we don't
consider them at the moment.

Introduce a new flag DELETE_NEW_CONNECTIONS to delete any connection
added after the checkpoint and similarly a DISCONNECT_NEW_DEVICES to
ensure that the connection active on newly appeared devices doesn't
disrupt network connectivity.

https://bugzilla.redhat.com/show_bug.cgi?id=1378393
2016-10-24 09:57:18 +02:00
Thomas Haller
9061432d55 build: merge "libnm/Makefile.am" into toplevel Makefile 2016-10-19 17:16:07 +02:00
Thomas Haller
8fdd5dec72 build: merge "libnm-core/tests/Makefile.am" into toplevel Makefile
libnm-core/Makefile.libnm-core still exists, it is used by
libnm/Makefile.am.
2016-10-19 15:26:30 +02:00
Thomas Haller
e99978cb54 build: merge "libnm-core/Makefile.am" into toplevel Makefile
libnm-core/Makefile.libnm-core still exists, it is used by
libnm/Makefile.am.

Also, libnm-core/tests/Makefile.am still exists.
2016-10-19 15:26:30 +02:00
Thomas Haller
274de2555b build/trivial: rename VALGRIND_RULES in Makefile.am to NM_LOG_COMPILER 2016-10-19 15:26:30 +02:00
Beniamino Galvani
f63e28b147 ifcfg-rh: support the autoconnect-retries property 2016-10-16 12:56:09 +02:00
Beniamino Galvani
51d7a18f2e libnm-core: introduce connection.autoconnect-retries property
While technically it's already possible to implement a fail-over
mechanism using multiple connections (for example, defining a higher
priority DHCP connection with short DHCP timeout and a lower priority
one with static address), in practice this doesn't work well as we try
to autoactivate each connection 4 times before switching to the next
one.

Introduce a connection.autoconnect-retries property that can be used
to change the number of retries. The special value 0 means infinite
and can be used to try the connection forever. A -1 value means the
global configured default, which is equal to 4 unless overridden.

https://bugzilla.gnome.org/show_bug.cgi?id=763524
2016-10-16 10:08:13 +02:00
Beniamino Galvani
185f008521 libnm-core: fix documentation comments
../libnm-core/nm-utils.c:4405: Warning: NM: nm_utils_is_json_object: unknown parameter 'str' in documentation comment, should be 'json'
../libnm-core/nm-connection.c:2208: Warning: NM: nm_connection_get_setting_proxy: return value: Missing (transfer) annotation
2016-10-14 10:05:54 +02:00
Thomas Haller
0e47b327dc libnm: move backported symbols from libnm-core to libnm
Backported symbols only make sense for libnm itself, not for
libnm-core which is statically linked with NetworkManager and
nm-ifcace-helper. Declaring the symbols in libnm-core, means
that NetworkManager binary also contains them, although there
are not used.

Move them to libnm.
2016-10-13 21:33:33 +02:00
Thomas Haller
814b1aec53 libnm/tests: fix bug in test
Fixes: 6b904a51ee
2016-10-11 14:08:36 +02:00
Thomas Haller
6b904a51ee shared: re-define _G_BOOLEAN_EXPR() to allow nesting g_assert()
g_assert() uses G_LIKELY(), which in turn uses _G_BOOLEAN_EXPR().
As glib's version of _G_BOOLEAN_EXPR() uses a local variable
_g_boolean_var_, we cannot nest a G_LIKELY() inside a G_LIKELY(),
or inside a g_assert(), or a g_assert() inside a g_assert().

Workaround that, by redefining the macro.

I already encountered this problem before, when having a nm_assert()
inside a ({...}) block, inside a g_assert(). Then I just avoided that
combination, but this situation is quite easy to encounter.
2016-10-11 13:14:43 +02:00
Thomas Haller
8b51e345af libnm/proxy: add proxy setting for non-slave connection during normalization
And reject slave settings with proxies.
2016-10-05 14:53:21 +02:00
Thomas Haller
e2c71c82e7 libnm: cleanup error paths in _nm_connection_verify() 2016-10-05 14:46:18 +02:00
Thomas Haller
29b576bd70 proxy: cleanup handling of proxy-method
The numeric value of NM_SETTING_PROXY_METHOD_NONE should be zero,
as that is the more natural default.

Also, cast all uses of the enum values in g_object_set() to
(int).
2016-10-05 14:46:18 +02:00
Thomas Haller
2de000e1d2 proxy: reject huge pac_script values in verify() 2016-10-04 11:44:44 +02:00
Atul Anand
20098591d9 proxy: change semantics of pac-script
libnm-core: pac-script property in NMSettingProxy now represents the
script itself not the location. It ensures that the connection is
self contained.

nmcli: Supports loading of PAC Script via file path or written explicitly.
2016-10-04 11:44:44 +02:00
Atul Anand
812b8774f6 proxy: remove unnecessary APIs
Unnecessary APIs have been removed from nm-setting-proxy, client like
nm-connection-editor are expected to create a PAC script snippet the load
the location of file in NM.
2016-10-04 11:44:44 +02:00
Atul Anand
2a40112ebe libnm: API for Proxy Feature
libnm-core has been expanded to include proxy settings which clients
like nmcli, nm-connection-editor use to configure proxy in PacRunner. It
offers three modes i.e 'auto', 'manual'and 'none' and accordingly take
data to configure PacRunner. The modes matches on the PacRunner side too.
2016-10-04 11:44:13 +02:00
Thomas Haller
b4e66c4818 shared: add nm_clear_g_free() 2016-10-03 12:02:34 +02:00
Thomas Haller
a83eb773ce all: modify line separator comments to be 80 chars wide
sed 's#^/\*\{5\}\*\+/$#/*****************************************************************************/#' $(git grep -l '\*\{5\}' | grep '\.[hc]$') -i
2016-10-03 12:01:15 +02:00
Lubomir Rintel
67999ef2d3 libnm-core/tests: disable the JSON validation check without jansson 2016-09-27 18:37:22 +02:00
Pellaeon Lin
4d7cf9a16d libnm: fix typo g_size to gsize
Fixes: 32f78ae6c3

https://bugzilla.gnome.org/show_bug.cgi?id=772062
2016-09-27 18:08:13 +02:00
Thomas Haller
146e0d23bc libnm: reject too large team-config JSON 2016-09-27 10:56:57 +02:00
Thomas Haller
32f78ae6c3 libnm: expose nm_utils_is_json_object() utility function
Since we possibly already link against libjansson, we can also expose some
helper utils which allows nmcli to do basic validation of JSON without
requiring to duplicate the effort of using libjansson.

Also, tighten up the cecks to ensure that we have a JSON object at hand.
We are really interested in that and not of arrays or literals.
2016-09-27 10:56:42 +02:00
Thomas Haller
ee86069601 shared: add test for NM_SET_OUT() 2016-09-26 17:00:38 +02:00
Thomas Haller
e152eea218 build: fix breakage of enums-to-docbook.pl script for NMCapability enum
GEN      nm-dbus-types.xml
    Documentation for value '*' missing at ../tools/enums-to-docbook.pl line 134, <> line 95.
    Makefile:1579: recipe for target 'nm-dbus-types.xml' failed

Fixes: 93a753e311
2016-09-23 19:11:45 +02:00
Beniamino Galvani
0e96d23733 crypto: don't try to decrypt PKCS#8 key if no password is supplied
crypto_verify_private_key_data() must try to decrypt the key only when
a password is supplied.

Previously the decrypt test always passed because we detected an
unsupported cipher and faked success. Now since version 3.5.4 gnutls
supports PBES1-DES-CBC-MD5 and the key is actually decrypted when a
password is supplied.

Also, don't assert that a wrong password works because we're now able
to actually verify it (only with recent gnutls).

https://bugzilla.gnome.org/show_bug.cgi?id=771623
2016-09-23 18:05:54 +02:00
Thomas Haller
93a753e311 capabilities: add comment about capability range 2016-09-23 16:09:06 +02:00
Thomas Haller
ab26248080 capabilities: fix number for NM_CAPABILITY_TEAM
The enum defines should name their numerical value explicitly,
so that it can be easily seen by looking at the code. Also,
they are public, stable API. They must not change.

Anyway, the capability 0 shall be reserved. Change NM_CAPABILITY_TEAM
to value 1.
2016-09-23 15:49:52 +02:00
Marius Vollmer
2ca1ce5d88 team: Add NM_CAPABILITY_TEAM 2016-09-23 15:49:52 +02:00
Marius Vollmer
1bb00ae66a manager: Add "Capabilities" property 2016-09-23 15:49:52 +02:00
Thomas Haller
c3ecca225c core: add _nm_utils_array_find_binary_search()
Also add nm_cmp_uint32_p_with_data(). Will be used later.
2016-09-23 15:49:29 +02:00
Thomas Haller
08f5681b0e core: const arguments for _nm_utils_ptrarray_find_*() functions 2016-09-23 15:34:17 +02:00
Thomas Haller
0fb723e720 libnm: relax comparison of bond-option for INFERRABLE match
When comparing the bond-settings of an activated device against
the settings from the connection, some properties might easily
differ. Hack them around in NMSettingBond:compare_property().

For example:

the setting in the connection has:
    [bond]
    mode=active-backup

later, the device gets:
    [bond]
    active_slave=inf_ib0
    fail_over_mac=active
    mode=active-backup

Note that the fail_over_mac changes due to:
  kernel: nm-bond: enslaved VLAN challenged slave inf_ib0. Adding VLANs will be blocked as long as inf_ib0 is part of bond nm-bond
  kernel: nm-bond: The slave device specified does not support setting the MAC address
  kernel: nm-bond: Setting fail_over_mac to active for active-backup mode

https://bugzilla.redhat.com/show_bug.cgi?id=1375558
2016-09-22 18:32:54 +02:00
Thomas Haller
b1fd5a06c4 macros: simplify NM_IN_SET() and NM_IN_STRSET() macros
and support up to 16 arguments.
2016-09-22 16:34:22 +02:00