Commit graph

301 commits

Author SHA1 Message Date
Thomas Haller 022117ff36 cli/tests: add "clients/common/tests/test-general.c" 2017-04-05 16:53:06 +02:00
Thomas Haller d9462879ac build: build intermediate library libnmc.la for nmcli
Used for unit testing in the next commit.

Also add libnmc-base.la, which contains common files for nmcli and
nmtui.
2017-04-05 16:53:06 +02:00
Thomas Haller db300afba1 cli: split out new file "nm-meta-setting-access.h"
"nm-meta-setting-desc.h" contains static type description, vtable and (internal)
accessor functions. Add accessor functions that operate on top of the type description
to "nm-meta-setting-access.h".
2017-04-05 16:53:06 +02:00
Thomas Haller d2af54f9bb build: fix out-of-tree build after moving generated settings-docs.c
Fixes: d720f0955f
2017-03-30 17:52:05 +02:00
Thomas Haller d720f0955f cli: embed gtk-doc directly in property-info structure
Also mark them for translation.
2017-03-30 16:35:52 +02:00
Thomas Haller f5a0b62765 cli: use enum property type for connection.lldp
Change in behavior:

  - the setter would previoulsy allow "enable" case-insensitive.
    Now, it's case sensitive.
2017-03-30 13:09:58 +02:00
Thomas Haller a8730c51c8 libnm: move enum utils to new shared file shared/nm-utils/nm-enum-utils.h
libnm contains the public function nm_utils_enum_from_str() et al.
The function is not flexible enough for nmcli's usecase. So, I would
need another public function like nm_utils_enum_from_str_full() that
has an extended API.

That was already required previously for ifcfg-rh writer, but in that
case I could just add it as internal API as libnm-core is linked statically
with NetworkManager.

I don't want to commit to a public API for an utility function. So move
the code instead to the shared directory, so that nmcli may link
statically against it and use the internal API.
2017-03-30 13:09:58 +02:00
Thomas Haller 23298bfc88 cli: move utils function from common.h to nm-meta-setting-desc.c
These functions are only used by nm-meta-setting-desc.c. Make them internal.
Unfortunately, they are part of "common.h" which cannot be used without
the rest of nmcli. Still todo.
2017-03-30 13:09:58 +02:00
Thomas Haller b5c8622ad3 cli: split nm-meta-setting-desc out of settings
This part contains static functions and variables to describe
settings. It is distinct from the mechanism to use them, or
access them.

Split it out.

It still uses clients/cli/common.h and clients/cli/utils.h
which shall be fixed next.
2017-03-30 13:09:58 +02:00
Thomas Haller d3ad7920de cli: add setting-info structure to settings.c
Will get more use soon.
2017-03-30 13:09:55 +02:00
Thomas Haller 68ab166f38 build: declare build dependencies requiring "nm-core-enum-types.h"
cat <<-EOF > /tmp/glib-mkenums
	#!/bin/bash
	sleep 15 && /usr/bin/glib-mkenums "\$@"
	EOF

	chmod +x /tmp/glib-mkenums

	(export PATH="/tmp:$PATH" &&
	 git clean -fdx &&
	 ./autogen.sh &&
	 make -j20 all-am)
2017-03-29 11:26:04 +02:00
Beniamino Galvani e044071825 ifcfg-rh: also check BONDING_OPTS to determine the connection type
Connections with "TYPE=Ethernet" and "BONDING_OPTS=..." are regarded
by initscripts as bond masters. To maintain the best compatibility, do
the same.

https://bugzilla.redhat.com/show_bug.cgi?id=1434555
2017-03-29 09:47:37 +02:00
Thomas Haller 18663c0960 build: declare build dependency for ifcfg-rh tests 2017-03-28 22:37:19 +02:00
Lubomir Rintel 9d43869e47 core: make connectivity checking per-device
This moves tracking of connectivity to NMDevice and makes the NMManager
negotiate the best of known connectivity states of devices. The NMConnectivity
singleton handles its own configuration and scheduling of the permission
checks, but otherwise greatly simplifies it.

This will be useful to determine correct metrics for multiple default routes
depending on actual internet connectivity.

The per-device connection checks is not yet exposed on the D-Bus, since they
probably should be per-address-family as well.
2017-03-28 15:26:47 +02:00
Thomas Haller 4ec7dd987e libnm: add NMSettingUser
This only adds new API for a NMSettingUser. The setting class
is still entirely unused.

The point is getting the new API into 1.8.0 release of libnm.
It's easier to backport the use of the API to a stable branch
then backporting public API.

https://bugzilla.gnome.org/show_bug.cgi?id=776276
https://bugzilla.redhat.com/show_bug.cgi?id=1421429
2017-03-28 14:58:21 +02:00
Lubomir Rintel 7750a384a5 libnm-util/vapi: add missing dependencies
Works by dumb luck for in-tree build, because the .deps files that are
meant for the distribution happen to be the builddir. The out-of-tree
builds would generate an empty file.
2017-03-24 11:38:49 +01:00
Lubomir Rintel ec17f82960 build: yet another missing dependency 2017-03-24 11:38:49 +01:00
Thomas Haller 8b9dfa013d build: fix building clients/cli/settings-docs.c (4)
We also dist libnm/nm-property-docs.xml, so depending on
whether we build from git or source tarball, the file
is in $(srcdir) or $(builddir).

Fixes: d7ad13591b
2017-03-24 10:48:56 +01:00
Thomas Haller 5581d91973 build: fix building clients/cli/settings-docs.c (3)
Fixes: d7ad13591b
2017-03-24 10:31:15 +01:00
Thomas Haller 431493827b build: fix building clients/cli/settings-docs.c (2)
Fixes: d7ad13591b
2017-03-23 23:23:47 +01:00
Thomas Haller 3468a54ec1 build: fix building clients/cli/settings-docs.c
Fixes: d7ad13591b
2017-03-23 20:57:28 +01:00
Thomas Haller 0fefcbfb2d build: don't link against libm.so
There are very few places where we actually use floating point
or #include <math.h>.

Drop that library, although we very likely still get it as indirect
dependency (e.g. on my system it is still dragged in by libsystemd.so,
libudev.so and libnl-3.so).
2017-03-23 19:06:02 +01:00
Thomas Haller d628ada05a build: remove currently unneeded include of shared/nm-setting-metadata.h from nmcli
One day, I wish we would have more setting metadata in shared via
"shared/nm-setting-metadata.h", ready for nmcli and nmtui to use
(by statically linking against the internal API).

Anyway, it is still unused, so drop the files from the SOURCES of
nmcli.
2017-03-23 18:58:47 +01:00
Thomas Haller d7ad13591b build: fix out-of-tree build for including "clients/cli/settings-docs.c"
"$(srcdir)/clients/cli/settings.c" includes "$(builddir)/clients/cli/settings-docs.c",
hence, we need "-I$(builddir)/clients/cli".

This basically reverts commit bbce089840,
but adds dependencies so that the build directory exists.
2017-03-23 18:50:34 +01:00
Lubomir Rintel bbce089840 cli/build: drop $builddir/cli/ from the include path
The sources should reach files in the $builddir using #include "".
Besides, it is not guarranteed to be around:

    CC       shared/clients_cli_nmcli-nm-setting-metadata.o
  cc1: error: ./clients/cli: No such file or directory [-Werror=missing-include-dirs]
  cc1: all warnings being treated as errors
  Makefile:12971: recipe for target 'shared/clients_cli_nmcli-nm-setting-metadata.o' failed
2017-03-23 17:41:04 +01:00
Lubomir Rintel 96571ec621 build: ensure libnm-core is around before mkenums puts files there
It's not sufficient to make nm-core-enum-types.[ch] depend on the
dirstamp, because they also depend on their own stamps that are to be
placed in libnm-core.

  $ make libnm-core/nm-core-enum-types.h.stamp
    GEN      libnm-core/nm-core-enum-types.h
  /bin/sh: libnm-core/nm-core-enum-types.h.tmp: No such file or directory
  ../../Makefile.glib:107: recipe for target 'libnm-core/nm-core-enum-types.h.stamp' failed
  make: *** [libnm-core/nm-core-enum-types.h.stamp] Error 1
2017-03-23 17:41:04 +01:00
Thomas Haller e32839838e udev: drop libgudev in favor of libudev
libgudev is just a wrapper around libudev. We can
use libudev directly and drop the dependency for
libgudev.
2017-03-22 12:41:06 +01:00
Francesco Giudici 7307dea9c4 connectivity: switch connectivity checking to libcurl
[lkundrak@v3.sk: removed libsoup altogether, implemented TODOs and fixed
the poll condition handling]

Co-authored-by: Lubomir Rintel <lkundrak@v3.sk>
2017-03-22 12:09:39 +01:00
Lubomir Rintel c05befd5aa dns-manager: use libpsl directly
...instead of via libsoup. This makes it possible to do gTLD suffix checking
even if we're building without libsoup support.
2017-03-22 12:09:39 +01:00
Lubomir Rintel a91369f80d libnm-core: drop NMVpnConnectionStateReason
It's now the same as NMActiveConnectionStateReason. Keep a compatibility
typedef and enum.
2017-03-17 10:21:19 +01:00
Lubomir Rintel e947739dd6 build: avoid passing enums-to-docbook.pl to itself on its command line 2017-03-16 17:11:29 +01:00
Lubomir Rintel 2198f73b0e build: delete unsuccessfully built artifacts
We use output redirection in numerous places; leaving the half-built
artifacts in place would cause the subsequent builds to succeed when it
should not.
2017-03-16 17:10:51 +01:00
Lubomir Rintel e3c87e80de build: allow longer manual page titles
Otherwise the docbook template chops off the "NM-SETTINGS-IFCFG-RH"
title; even in the middle of an escape sequence.
2017-03-10 14:35:18 +01:00
Thomas Haller fada1da80b systemd: merge branch systemd into master 2017-03-09 01:04:15 +01:00
Beniamino Galvani 9dac51d9c0 team: support the ethernet.cloned-mac-address property
The only reliable way of setting a MAC address for the team is through
the "hwaddr" property in the configuration passed to teamd. In order
to rewrite the configuration we need Jansson support; since it is
already a requirement for teamd, let the team plugin depend on it.
2017-02-23 10:07:06 +01:00
Beniamino Galvani a1b729fddb build: automatically determine Jansson support if not specified
If configure is called without --enable-json-validation or
--disable-json-validation, let's automatically choose a value
depending on the availability of the library.
2017-02-23 10:05:48 +01:00
Beniamino Galvani b42f780e04 core: add support for dummy devices
Add support for creating dummy devices. This commit adds a D-Bus
interface 'org.freedesktop.NetworkManager.Device.Dummy' which is used
primarily for determining the device type but does not carry any
properties.
2017-02-22 21:05:04 +01:00
Beniamino Galvani 1bf2d3b049 libnm-core: add dummy connection setting
The setting must be present in connections with type=dummy. It does
not contain any property.
2017-02-22 21:05:04 +01:00
Thomas Haller 86ac68049a build: ensure libnm-core directory exists for generated files
Since we generate "libnm-core/nm-core-enum-types.h" via GLIB_GENERAED,
there is no obvious place to $(MKDIR_P). Add a dependency to the
.dirstamp of the directory to instruct automake to create the directory.
2017-02-22 13:16:28 +01:00
Thomas Haller 47e55561a7 build: ensure build directories exist for gdbus-codegen targets 2017-02-22 11:48:40 +01:00
Thomas Haller d440958de1 build: don't depend on libnm-core directory for make target 2017-02-22 11:43:21 +01:00
Thomas Haller c2f0764c1e build: add slash to directory name for mkdir
Just for consistency with other locations that call
$(MKDIR_P).
2017-02-22 11:42:38 +01:00
Thomas Haller e824dd34f0 build: fix type on Makefile.am
Fixes: 3cc00dd550
2017-02-21 00:37:48 +01:00
Thomas Haller 3cc00dd550 ifcfg: also read DEFROUTE and GATEWAY from alias files
Also accept DEFROUTE and GATEWAY when they are defined in
alias files -- provided, that they are not yet defined
in the main ifcfg file.
2017-02-20 23:18:36 +01:00
Thomas Haller c79e84368a all: add new "shared/nm-setting-metadata.h" file
"shared/nm-setting-metadata.h" will contain data structures
to handle NM setting properties in a generic way.

For now, this is internal API, but shared between libnm-core (which
extends to libnm, NetworkManager, device-plugins, settings-plugins),
and nmcli.

Related: https://bugzilla.gnome.org/show_bug.cgi?id=732292
2017-02-17 19:51:53 +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
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