Commit Graph

16307 Commits

Author SHA1 Message Date
Thomas Haller
9719988674 ifcfg-rh: get rid of the internal "current" pointer
It was not used and it is bad style. Especially, because
in the next commit we want to remove multiple definitions
of a key. Thus, we usually always iterate until the end.
2016-11-09 12:07:34 +01:00
Thomas Haller
1ae62854f5 ifcfg-rh: refactor svUnescape()
Move the g_strchomp() inside svUnescape(). It is part of the
escaping process (although of course wrong to do, because
it accepts "FOO=  bar". That will be fixed later).

Thereby, change the signature to allow in the future
to do unescape without additional copy.
2016-11-09 12:07:34 +01:00
Thomas Haller
85beac6dd4 ifcfg-rh: allow leading spaces before variable names 2016-11-09 12:07:34 +01:00
Thomas Haller
afc394b969 ifcfg-rh: assert that keys are valid shell names 2016-11-09 12:07:34 +01:00
Thomas Haller
806ffbbe14 ifcfg-rh: cleanup svEscape()
Use size_t type for string length and have character sets
as #define.
2016-11-09 12:07:34 +01:00
Thomas Haller
917ab8334b ifcfg-rh/trivial: rename svGetValue() and related
svGetValue() had the meaning of returning a string, except the
empty word "" was coerced to NULL.

svGetValueFull() had the meaing of returing the value as string,
including the empty word.

Rename those functions to better express what they do.

Same for svSetValue*().
2016-11-09 12:07:34 +01:00
Thomas Haller
2a3b238d49 ifcfg-rh: add and use svSetValueBoolean() 2016-11-09 12:07:34 +01:00
Thomas Haller
b473256cfd ifcfg-rh: remove unused argument "verbatim" from shvar.h API
It is wrong to allow access to unquoted ifcfg-rh values.
All users of this ~feature~ misused it to encode meaning
in the type of quotation, which is wrong.

Also, shvar.h is not able to fully parse shell. We can improve
that, but it should be handled internally, in one place. Not by
callers applying some quirks after getting a "verbatim" value.
2016-11-09 12:07:34 +01:00
Thomas Haller
1fb3d5d794 ifcfg-rh: don't call svSetValue with verbatim=TRUE
This is at best a performance optimization. In the next step
get rid of the verbatim argument, so ensure we pass FALSE everwhere.
2016-11-09 12:07:34 +01:00
Thomas Haller
58b69e2f90 ifcfg-rh/trivial: remove unused functions utils_single_quote_string() and unquote 2016-11-09 12:07:34 +01:00
Thomas Haller
39a79b0ee7 ifcfg-rh: handle quotes of WPA_PSK key inside shvar.h
It is wrong to move the handling of quotes outside of shvar.h.
The ifcfg-rh core library (shvar.h) should handle quotation
transparently.

It is also wrong to encode meaning of the WPA_PSK depending on whether
the value is quoted or not. A psk that is 64 chars *must* be in hex
representation, and anything else is taken literal.

Also, the special handling of bash-syntax with $' was wrong. Including
the unit test "keys-test-wifi-wpa-psk-2" which contained invalid shell.
Support for $' must be done inside of shvar.h, for all properties alike
not just for WPA_PSK.
2016-11-09 12:07:34 +01:00
Thomas Haller
5a43b733b9 ifcfg-rh: change ESSID handling
Let shvar.h do the escaping/unescaping of the ESSID.
We should not treat a value differently whether it is quoted or not.

Also, cutting away double quotes and calling svUnescape() is just wrong.

Now, we write a value in hex if it contains non-printable characters
or if the reader would treat it like a hex value. Reader treats ESSID
now as hex if it starts with "0x" followed by pairs of hex digits.
2016-11-09 12:07:34 +01:00
Thomas Haller
912a866353 ifcfg-rh: read team key non-verbatim from ifcfg-rh
svUnescape() has no problem with extremely long strings.
It does not allocate any memory and has O(n) complexity.
No problem.

If somebody has a problem with extremely large files it's
shvarFile itself which caches the entire file in memory.

Also, libnm-core allows team configs to be 1 MB in size.
So, allow that here too.
2016-11-09 12:07:34 +01:00
Thomas Haller
22ef66e6bb ifcfg-rh: unescape ifcfg value for CIPHER_GROUP/CIPHER_PAIRWISE
It's not clear why we would read the CIPHER_GROUP/CIPHER_PAIRWISE
verbatim=TRUE (without shell unescaping). Especially since ifcfg-rh
writer does
  svSetValue (ifcfg, "CIPHER_PAIRWISE", str->str, FALSE);
2016-11-09 12:07:34 +01:00
Thomas Haller
8f9432327c ifcfg-rh/trivial: coding style/white-space 2016-11-09 12:07:33 +01:00
Thomas Haller
f950f7922e ifcfg-rh/tests: use cleanup macros in ifcfg-rh test 2016-11-09 12:07:33 +01:00
Thomas Haller
f5e6f1d65b shared: add nmtst_auto_unlinkfile cleanup macro 2016-11-09 12:07:33 +01:00
Thomas Haller
b204801b7e shared: add nmtst_file_get_contents() 2016-11-09 12:07:33 +01:00
Thomas Haller
858daf57bc shared: add NM_STRCHAR_ALL() and NM_STRCHAR_ANY() macros 2016-11-09 12:07:33 +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
e028edd1c5 libnm/trivial: fix code comment for internal header libnm/nm-manager.h 2016-11-08 14:27:07 +01:00
Beniamino Galvani
7aa936109f dhcp: merge branch 'bg/dhclient-dup-reqlist-bgo773571'
https://bugzilla.gnome.org/show_bug.cgi?id=773571
2016-11-08 13:41:26 +01:00
Beniamino Galvani
2049e97d9e dhcp: refactor parsing of 'request' and 'also request' options
Refactor the code to be simpler and use a single list for both
'request' and 'also request' statements. This also has the advantage
that we can properly handle 'request' statements and reset the list of
options instead of appending to it.
2016-11-08 13:40:12 +01:00
trulyliu
bbc28a2f97 dhcp: do not add 'also request' DHCP option to generated dhclient config file
if the option already exists in original config file 'request' section.

https://bugzilla.gnome.org/show_bug.cgi?id=773571
2016-11-08 13:40:12 +01:00
Thomas Haller
c9209093b4 contrib/rpm: put translations in NetworkManager-libnm and NetworkManager-glib packages
One can install the libraries without NetworkManager. Thus, the
translations should be there.

Doing this increases the package size of the libraries significantly.

For a user who only has libnm without NetworkManager installed, this
is acceptable, because the whole point of the change is to ensure such
a user also gets translations.

For a user who requires libnm and libnm-glib packages, this
unfortunately increases the additional package size as the translations
are now present twice.

What would be better is if NetworkManager-libnm would only contain
translations for libnm/NetworkManager, and NetworkManager-glib only
translations for libnm-util/libnm-glib.
2016-11-08 10:21:44 +01:00
Beniamino Galvani
084da69a30 manager: force connectivity check when there is a default active connection
The interaction between the manager state and connectivity check code
is tricky. When there is an active connection with a default route and
NMConnectivity reports full connectivity, we set the CONNECTED_GLOBAL
state. However, if the connectivity check hasn't run yet, we stay in
CONNECTED_SITE state. If there are also other connections that are
activating, the state is set to CONNECTING.

This is a problem, because in CONNECTING we never run the connectivity
check and thus we fail to recognize that there is full connectivity
until a periodic check is run.

To solve this, schedule the connectivity check every time there is an
active connection with default route, even if other connection are
still activating, so that the check result can make the state progress
to CONNECTED_GLOBAL.
2016-11-07 14:22:14 +01:00
Beniamino Galvani
948a183d48 device: merge branch 'bg/sw-devices-cloned-mac-rh1386872'
Honor the ethernet.cloned-mac-address property for bond and bridge
connections.

https://bugzilla.redhat.com/show_bug.cgi?id=1386872
2016-11-07 14:12:24 +01:00
Beniamino Galvani
06418b2034 bond: support the ethernet.cloned-mac-address property 2016-11-07 14:06:50 +01:00
Beniamino Galvani
f1d595d129 bridge: support the ethernet.cloned-mac-address property 2016-11-07 14:06:50 +01:00
Beniamino Galvani
67ea41f0a0 device: add @set_permanent argument to nm_device_hw_addr_set()
In a later commit the function will be used to restore a MAC address
without changing its type.
2016-11-07 14:06:44 +01:00
Lubomir Rintel
1cc4ff3716 tools: fix the create-exports script on 32-bit 2016-11-06 15:36:24 +01:00
Lubomir Rintel
9d31cc916f Revert "contrib/rpm: regenerate the linker version script NetworkManager.ver while building the package"
Back this out. It breaks i686 build unnecessarily now and also is
something that proabably that should run on distcheck and not package
build.

This reverts commit cf678811b5.
2016-11-06 15:19:16 +01:00
Lubomir Rintel
af96d0bf82 release: bump version to 1.5.2 (development) 2016-11-06 14:12:11 +01:00
Beniamino Galvani
f37af130c1 build: remove spurious trailing comma from configure.ac
Fixes the following message when running configure:

./configure: line 26830: ,: command not found

Fixes: cd98705d21
2016-11-05 16:13:49 +01:00
Lubomir Rintel
9e4232dbe6 build: set correct path to common.ent for out-of-tree builds
Otherwise the docbook files won't be able to expand the macros such as
version or build-time configurable paths.
2016-11-04 12:29:55 +01:00
Lubomir Rintel
9bd0ea7954 contrib/rpm: drop dhclient requirement
We fall back to the internal client for the very minimal installations.
Based on: 209b5a57fd
2016-11-03 17:56:38 +01:00
Lubomir Rintel
bcb158e1bc NEWS: update for a development snapshot 2016-11-03 17:56:13 +01:00
Lubomir Rintel
bcad38ac31 man: use /run instead of /var/run
/var/run is just a compatibility symlink, according to file-hierarchy(7).
2016-11-03 17:56:13 +01:00
Lubomir Rintel
b8785c8c3c Revert "contrib/rpm: add NetworkManager-config-dhcp-dhclient package"
This probably needs more discussion, maybe there's a better solution
than a separate RPM package for a single line of configuration.

Related: https://pagure.io/fedora-comps/pull-request/62

This reverts commit 209b5a57fd.
2016-11-03 17:56:13 +01:00
Thomas Haller
7491e51ac0 config: print default value of main.dhcp with --print-config 2016-11-03 17:50:13 +01:00
Lubomir Rintel
dcc13cfcd8 contrib/rpm: drop udev dependency
We happily run in containers without udev.
2016-11-03 16:01:23 +01:00
Lubomir Rintel
ef0a68b942 contrib/rpm: drop iptables and dnsmasq dependencies
We just fail ipv4.method=shared without it, no need to drag it in for
configurations that don't share IPv4.
2016-11-03 16:01:23 +01:00
Lubomir Rintel
64770ee518 contrib/rpm: drop explicit readline dependency
RPM auto-generates a SONAME dependency.
2016-11-03 16:01:23 +01:00
Lubomir Rintel
5f4be85742 contrib/rpm: drop iproute dependency
We don't actually ever need it.
2016-11-03 16:01:23 +01:00
Thomas Haller
4be9b4a2cb build: move policy file from "policy/" to "data/" 2016-11-03 14:18:23 +01:00
Thomas Haller
e2b93beb83 build: fix vala build of libnm.vapi
make[2]: Entering directory './NetworkManager/NetworkManager-1.5.1/_build/sub'
     VAPIGEN vapi/libnm.vapi
    Gio-2.0.gir:62318.7-62318.47: warning: Virtual method `G.Resolver.lookup_service_async' conflicts with method of the same name
    Gio-2.0.gir:64704.7-64704.31: warning: Signal `G.Settings.change_event' conflicts with method of the same name
    Gio-2.0.gir:84847.7-84851.24: error: `UnixSocketAddress' already contains a definition for `abstract'
    Gio-2.0.gir:84690.7-84692.21: note: previous definition of `abstract' was here
    Makefile:16410: recipe for target 'vapi/libnm.vapi' failed

Fixes: 0fa2cf19e5
2016-11-03 14:18:23 +01:00
Thomas Haller
3be57bfba1 build: fix dist-ing vapi/NM-1.0.metadata
Fixes: 0fa2cf19e5
2016-11-03 14:00:21 +01:00