Commit Graph

21088 Commits

Author SHA1 Message Date
Thomas Haller
7a21ae3e77 keyfile: reuse NMSetting8021xSchemeVtable in NMKeyfileWriteTypeDataCert 2017-02-17 14:24:34 +01:00
Thomas Haller
199524e426 ifnet: merge ObjectType with NMSetting8021xSchemeVtable in ifnet parser
ifnet has two extra instances @p12_type/@phase2_p12_type, that only
differed from @pk_type/@phase2_pk_type by their suffix.

But as the suffix field as unused, we can drop that entirely.
2017-02-17 14:24:34 +01:00
Thomas Haller
01b8520447 ifcfg-rh: merge ObjectType with NMSetting8021xSchemeVtable in ifcfg-rh writer 2017-02-17 14:24:34 +01:00
Thomas Haller
6627fef1a6 ifcfg-rh: refactor duplicate ObjectType instance to handle PKCS#12 types
If one property has multiple ways to be handled, we should not create
two ObjectType instances, instead let the ObjectType have enough
information to act accordingly.
2017-02-17 14:24:34 +01:00
Thomas Haller
a77e6f1f5d ifcfg-rh: refactor ObjectType structs to make it more similar to NMSetting8021xSchemeVtable 2017-02-17 14:24:34 +01:00
Thomas Haller
1c6b67b0cb libnm-core: add and use internal struct NMSetting8021xSchemeVtable in keyfile 2017-02-17 14:24:34 +01:00
Lubomir Rintel
57e379320e core/8021x: request secrets for keys and certificates PKCS#11 tokens
Unless the secrets are explicitely flagged as not needed we probably require
the PINs.
2017-02-17 14:24:34 +01:00
Lubomir Rintel
eda2ddb8c6 supplicant: set PIN for objects on PKCS#11 tokens 2017-02-17 14:24:34 +01:00
Lubomir Rintel
4121e57c50 cli: add support for 802.1x certificate passwords 2017-02-17 14:24:34 +01:00
Lubomir Rintel
e599e96572 ifcfg-rh: add support for certificate passwords 2017-02-17 14:24:34 +01:00
Lubomir Rintel
538e510473 core/8021x: add password properties for certificates
Useful for certificates that are stored on PKCS#11 tokens. We fail
verification if someone tries tu specify a password for a blob or a flat
file.
2017-02-17 14:24:34 +01:00
Lubomir Rintel
70b370f52c ifcfg-rh: support the pkcs11 scheme for certs/keys
The PKCS#11 URIs start with the "pkcs11:" scheme. There's a slight
possiblity of a clash with file names relative to the ifcfg file, but
that's probably is unlikely enough the leave us not worried.

The alteratives are probably more horrible (using a different key, or
using a separate key for the scheme alone) and it's already simple
enough to avoid a clash by using an absolute file name.
2017-02-17 14:24:34 +01:00
Thomas Haller
4898e2f686 settings: make "ready"/"flags" property read-only
and "filename" construct-only.
2017-02-17 11:09:39 +01:00
Thomas Haller
9e5319dbc0 core: use define for atomic-section-prefix setting for NMConfig
main() should pass the same atomic-section-prefix setting to it's
NMConfig instances. Currently both are NULL, but make it a define
to make this explicit.

Also, make static array @default_values const and sanitize value
when setting PROP_ATOMIC_SECTION_PREFIXES property.
2017-02-17 11:08:29 +01:00
Thomas Haller
a8f0d88596 ifcfg: ensure ipv4.method is not "disabled" when reading IP addresses from alias files
When the main ifcfg file contains no IP addresses, the method
will be "disabled". Later, when reading IP addresses for the
aliases, we must ensure that the method is manual.

Otherwise, validation fails with

  ip.addresses: this property is not allowed for method=disabled
2017-02-16 21:55:40 +01:00
Lubomir Rintel
53a00b8198 checkpoint: drop a redundant assignment 2017-02-16 18:12:47 +01:00
Lubomir Rintel
4752ef20d6 wifi: error check nla_parse_nested()
Makes coverity happy.
2017-02-16 18:12:46 +01:00
Lubomir Rintel
9b1c6e9497 tests: drop a dead case branch
It seems to annoy coverity.
2017-02-16 18:12:45 +01:00
Lubomir Rintel
eb0228713d tools: only consider SOs that exist when finding symbols to export
Also, set pipefail to catch the failures of all components of a
pipeline.
2017-02-16 16:12:02 +01:00
Lubomir Rintel
dbbcd076fb build: disable dependency tracking on distcheck
This just tests a configuration we don't typically run also potentially
making distcheck a tiny bit faster.
2017-02-16 15:57:03 +01:00
Lubomir Rintel
258382be12 build: create missing directories for out-of-tree builds
They could be created by dumb luck with dependency tracking, but
apparently some distributions disable that.
2017-02-16 15:55:23 +01:00
Lubomir Rintel
568c4f3e49 dbus: improve the connectivity check and manager state documentation
This hopefully clears up the confusion between Connectivity and State
properties.
2017-02-16 15:44:28 +01:00
Lubomir Rintel
07bf4151ba manager: retrigger the connectivity check if we loose a default route
Update the connectivity state if we go from CONNECTED_GLOBAL to
CONNECTED_LOCAL. It will likely fail immediately (unless there's a default
route we're not aware of or the check URL is routable locally), keeping the
Connectivity property up-to-date.
2017-02-16 15:44:28 +01:00
Thomas Haller
5caa9d877b contrit/rpm: create source tarball from git immidiately in SOURCES directory
Instead of first creating it as "$TEMP/NetworkManager-${VERSION}.tar.xz"
and then copy it to "$TEMP/SOURCES".
2017-02-16 11:32:53 +01:00
Thomas Haller
b04868cb52 contrit/rpm: print the used "$SOURCE" tarball in the summary output of build.sh 2017-02-16 11:04:00 +01:00
Lubomir Rintel
bc6a383dd7 cli: fix match()
Fixes: 84c484ed5b
2017-02-16 10:39:08 +01:00
Thomas Haller
432717cf47 contrib/rpm: add explict configure options for building NetworkManager in "build_clean.sh"
When we create a source tarball, documentation and other generated files
are disted. Those files depend on the configure options when creating
the tarball. For example, the generated man pages contain the compile time
configurable default values.

For that reason, it is generally better to regenerate the documentation when
building NetworkManager. However, let's set explict configure options to
have a more reproducible way to generate the tarball.

When doing a release, you should not just call `make dist`. Instead, the
proper way of creating an official source tarball is:

  $ ./contrib/fedora/rpm/build_clean.sh --srpm
2017-02-15 23:27:39 +01:00
Thomas Haller
4179cbb677 build: fix dist-ing "man/common.ent.in" 2017-02-15 23:21:29 +01:00
Thomas Haller
03efe8dba7 build: fix out-of-tree build generating "man/common.ent"
Fixes: 4de6f603e3
2017-02-15 23:21:29 +01:00
Thomas Haller
4de6f603e3 build: use sed instead of AC_SUBST() to generate man/common.ent
Otherwise, substitions are not properly expanded.

For example

- "AC_SUBST(nmrundir, '${runstatedir}'/$PACKAGE, [NetworkManager runtime state directory])"
  gives ${runstatedir}/NetworkManager/resolv.conf

- "AC_SUBST(nmrundir, "${runstatedir}/$PACKAGE", [NetworkManager runtime state directory])"
  gives ${prefix}/var/run/NetworkManager/resolv.conf
2017-02-15 18:36:24 +01:00
Thomas Haller
0cad8307a5 libnm-glib: merge branch 'libnm-glib-warnings'
https://bugzilla.gnome.org/show_bug.cgi?id=778610
2017-02-15 16:31:52 +01:00
Philip Withnall
5a38b5c88b libnm-glib/nm-object: defer assignment of default D-Bus connection
If no D-Bus connection is provided to the constructor of an NMObject, a
default one will be assigned in set_property(). However, construction of
that default D-Bus connection might fail (if our connection to the
system bus is refused, for example), so priv->connection might still be
NULL. This will cause the constructor to fail construction of the
NMObject, which is correct, but hard to debug.

Instead, move the default D-Bus connection handling into the
constructor, so all the (priv->connection == NULL) handling is in the
same place. Print out any error message.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=778610
2017-02-15 16:30:16 +01:00
Philip Withnall
78058f7809 libnm-glib: add some missing precondition assertions
To validate the connection and path for NmObject subclass instances.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=778610
2017-02-15 16:30:13 +01:00
Lubomir Rintel
84c484ed5b cli: make match() return boolean
Coccinelle semantic patch:

  @@
  @@
  -int
  +gboolean
          matches (...);

  @@
  expression pattern, cmd, len;
  @@
  -int
  +gboolean
          matches (...)
          {
                  ...
  -               return memcmp (pattern, cmd, len);
  +               return memcmp (pattern, cmd, len) == 0;
          }

  @@
  expression prefix, str;
  @@
  (
  -matches (prefix, str) != 0
  +!matches (prefix, str)
  |
  -matches (prefix, str) == 0
  +matches (prefix, str)
  )

  @@
  expression prefix, str;
  @@
  -(matches (prefix, str))
  +matches (prefix, str)

  @@
  expression prefix, str;
  @@
  -(!matches (prefix, str))
  +!matches (prefix, str)

spatch --smpl-spacing --sp-file match.cocci --dir clients/cli/ \
  --include-headers --macro-file shared/nm-utils/gsystem-local-alloc.h
2017-02-15 13:04:07 +01:00
Lubomir Rintel
1d40c5f476 cli: add nmcli g logging completion
This is sort of ugly, because it includes the domain and log levels
verbatim. They're just plain strings on the API, there's no way the
client would know which ones are valid.

On the other hand this kills one of two uses of nmc_parse_args(), which
probably means it's not a very good abstraction and maybe we should get
rid of it altogether. It is in particular unfriendly to argument
completion.
2017-02-15 11:16:19 +01:00
Lubomir Rintel
8bd7bbba02 cli: add completion for "nmcli c edit" 2017-02-15 11:16:19 +01:00
Lubomir Rintel
29bb6ae4fe cli: complete the [-][-]help arguments 2017-02-15 11:16:19 +01:00
Lubomir Rintel
1a0c779214 cli: complete VPN types 2017-02-15 11:16:19 +01:00
Thomas Haller
37b659f75f NEWS: update 2017-02-14 18:00:18 +01:00
Thomas Haller
15177a34be dns: change behavior for "rc-manager=symlink" to preserve "/etc/resolv.conf" as file
The purpose of "rc-manager=symlink" is so that the administrator can point
the "/etc/resolv.conf" as a symlink to a certain file, and thus indicating
that a certain component is responsible to manage resolv.conf, while others
should stay away from it.
For example, systemd-resolved never touches "/etc/resolv.conf", but
expects the admin to setup the symlink appropriately. It also recognizes
whether the symlink points to it's own resolv.conf in /run or to another
component.

Previously, "rc-manager=symlink" would always replace a regular file
with a symlink to "/var/run/NetworkManager/resolv.conf". Only if
"/etc/resolv.conf" is already a symlink somewhere else, NM would not
touch it. This with the exception that if "/etc/resolv.conf" points to
"/var/run/NetworkManager/resolv.conf", it would replace the symlink
with the same link to raise inotify events.

Change behavior so if "/etc/resolv.conf" is already a regular file, keep
it as file.
This means, if you have multiple components that don't care, everybody
can write the "/etc/resolv.conf" (as file) and there is no clear
expressed responsibility.
It was wrong that NetworkManager would convert the file to a symlink,
this should be reserved to the admin. Instead, NetworkManager should
accept that the intent is unspecified and preserve the regular file.
It's up to the admin to replace the symlink to somewhere else (to keep
NM off), or to point it to "/var/run/NetworkManager/resolv.conf", to show
the explicit intent.

The wrong behavior causes dangling symlinks when somebody disables
NetworkManager for good.

https://bugzilla.redhat.com/show_bug.cgi?id=1367551
2017-02-14 17:45:55 +01:00
Thomas Haller
97cdb690f2 contrib/rpm: no longer package the Changelog with the libnm-devel/glib-devel packages 2017-02-14 17:39:46 +01:00
Thomas Haller
6aaee976f9 Changelog: remove and replace the changelog by a stub 2017-02-14 17:39:46 +01:00
Beniamino Galvani
f71e1379d6 dhcp: dhclient: reset the request list if conf file contains 'request'
After commit 2049e97d9e ("dhcp: refactor parsing of 'request' and
'also request' options") NM parses all the existing 'request' and
'also request' from the original configuration file and appends them
as 'also request' to avoid duplicates and conflicts.

So if the original file contains 'request x' (which means "request
only option x instead of builtin defaults"), we would translate it
into 'also request x', which appends the option to the builtin
defaults, causing duplicates in the DHCP request as dhclient seems not
smart enough to sanitize the list by itself.

To fix this, ensure that the request list is reset if the
configuration file contains a 'request'.

Fixes: 2049e97d9e

https://bugzilla.gnome.org/show_bug.cgi?id=778430
2017-02-14 11:29:05 +01:00
Thomas Haller
5a03de7051 wifi: introduce enum type NMSupplicantInterfaceState instead of plain int
Also change the signature of the NM_SUPPLICANT_INTERFACE_STATE signal,
to have three "int" type arguments. Thereby also fix the subscribers
to this signal that wrongly had type guint32, instead of guint
(which happens to be the same underlying type, so no real problem).

https://mail.gnome.org/archives/networkmanager-list/2017-February/msg00021.html
2017-02-14 09:47:05 +01:00
Thomas Haller
0769a52f05 build: simplify (un)install hooks for man pages 2017-02-14 00:17:32 +01:00
Thomas Haller
b599f1b743 build: combine handling of setting docs and man pages
Building the man pages via xsltproc requires "docbook.xsl"
which is part of docbook.

Previously, we would build the man pages solely based on
"--enable-introspection", which checks for the presence of
xsltproc, but not docbook. This can lead to build failure
when docbook is not available, but "--enable-introspection"
is given.

Instead of adding yet another configure option to fine-tune
and say "--with-docbook --disable-gtk-doc", just simplify it.

Now, documentation (both man pages and setting docs) will be generated
with "--enable-gtk-doc" and "--enable-introspection".
If the documentation is not about to be generated, pre-generated docs
will be installed if they are available. That is commonly the case
with a source tarball, but not with a git checkout.
Finally, if documentation is nither generated nor pre-generated,
no documentation will be installed *duh*.

This removes the possibility to treat man pages separate from settings
docs. Now you either generate both, install both pre-generated, or don't
get any of them.

https://bugzilla.gnome.org/show_bug.cgi?id=778551
2017-02-14 00:08:22 +01:00
Thomas Haller
5936a8babe build: move code around and reorder conditions
No changes really, except moving related stuff closer together.
2017-02-13 18:12:26 +01:00
Lubomir Rintel
9d2290135c cli: make nmcli do its own command completion
https://bugzilla.gnome.org/show_bug.cgi?id=777328
2017-02-13 16:32:15 +01:00
Beniamino Galvani
b2146a43e5 cli: fix setting of private key password
We can't pass the password obtained from
nm_setting_802_1x_get_*private_key_password() to
nm_setting_802_1x_set_*private_key() as the latter also frees the old
password.

Fixes: afd2811028
2017-02-13 15:50:21 +01:00
Thomas Haller
ed07de8667 platform: avoid printing "(null)" interface name during logging
Avoids:

    platform: link: setting up '(null)' (11)

Use nm_strquote_a() to quote the string if it is not NULL.
2017-02-10 17:31:16 +01:00