Commit Graph

10305 Commits

Author SHA1 Message Date
Dan Winship
e9fbf805a8 trivial: fix spacing in src/devices/wifi/nm-wifi-ap.h
This file had a bad mix of tabs and spaces. Fix it.
2014-08-05 10:54:39 -04:00
Thomas Haller
67ad3fcb5b platform/tests: disable platform root test 'test-link-linux' for now
This test is quite broken and fails often. It does not fail
always, but the changes for a failure are high.

We certainly should fix that, but for now exclude the test from
`make check`.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-04 16:17:49 +02:00
Thomas Haller
242d350fcf libnm-util/test: fix tests not to write a core file
test_libnm_linking() executes ./test-libnm-linking which
is supposed to crash. When the user set `ulimit -c unlimited`
before, this will leave a left-over core file.

In case of `make distcheck`, this is quite bad because it lets
the make target fail:

    ERROR: files left in build directory after distclean:
    ./libnm-util/tests/core.31481

Fix this by setting the (soft) rlimit for writing core files
to 0 before executing the test binary.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-04 16:17:36 +02:00
Geoffrey Thomas
5c31ed880d supplicant: fix invalid parameter type in AddBlob D-Bus call
Types passed to dbus-glib need to be GTypes, not D-Bus type. While the
DBUS_TYPE_G_* macros are GTypes from libdbus-glib, the other DBUS_ types
aren't.

Signed-off-by: Geoffrey Thomas <gthomas@mokafive.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-04 14:59:03 +02:00
Thomas Haller
536029a96d libnm-util/tests: fix build for older glib with unknown G_SPAWN_DEFAULT
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-04 13:30:37 +02:00
Christian Kirbach
7eb6f5128a po: update German (de) translation (bgo #734150)
https://bugzilla.gnome.org/show_bug.cgi?id=734150

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-02 00:53:33 +02:00
Thomas Haller
ab8966d935 core: cleanup getting iface for NMDevice for logging
Since refactoring logging, these calls are not needed.
Just forgot to remove them.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-02 00:51:36 +02:00
Thomas Haller
833ff17cd7 build: fix out-of-tree build for libnm-core
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 22:08:09 +02:00
Thomas Haller
cb5a976191 libnm-util/test: fix build for clang due to deprecated warning
For clang, we have to include nm-glib-compat.h to redefine
G_GNUC_BEGIN_IGNORE_DEPRECATIONS.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 21:42:04 +02:00
Dan Winship
4b54e4db80 libnm: Initial merge of "libnm" work (bgo #680675)
libnm is the new NetworkManager client library that will replace
libnm-util/libnm-glib for NM 1.0.

THIS API IS NOT YET STABLE. Don't use it yet.
2014-08-01 14:35:01 -04:00
Dan Winship
d7b56c7b7e libnm, libnm-utils: error out if mixed libnm/libnm-util symbols are detected
If a program accidentally ends up linking in both libnm and libnm-util
(presumably via different dependencies), error out immediately.
2014-08-01 14:34:40 -04:00
Dan Winship
d0b05b34d5 libnm: add NetworkManager.h, disallow including individual headers
Add NetworkManager.h, which includes all of the other NM header, and
require all external users of libnm to use that rather than the
individual headers.

(An exception is made for nm-dbus-interface.h,
nm-vpn-dbus-interface.h, and nm-version.h, which can be included
separately.)
2014-08-01 14:34:40 -04:00
Dan Winship
3ddce74803 libnm: rename NetworkManager.h and NetworkManagerVPN.h
"NetworkManager.h"'s name (and non-standard capitalization) suggest
that it's some sort of high-level super-important header, but it's
really just low-level D-Bus stuff. Rename it to "nm-dbus-interface.h"
and likewise "NetworkManagerVPN.h" to "nm-vpn-dbus-interface.h"
2014-08-01 14:34:40 -04:00
Dan Winship
258e74eb0c libnm: make the the use of GInitable mandatory
Remove _nm_object_ensure_inited(), etc; objects that implement
GInitable are now mandatory-to-init().

Remove constructor() implementations that sometimes return NULL; do
all the relevant checking in init() instead.

Make nm_client_new() and nm_remote_settings_new() take a GCancellable
and a GError**.
2014-08-01 14:34:40 -04:00
Dan Winship
8ca2998d81 libnm: add init_dbus() virtual method to NMObject
Rather than having each object type override constructed() to call
_nm_object_register_properties(), have NMObject call a virtual method
on the subclass to ask it to register them.

Move some code around in nm-client.c and nm-object.c so that all
D-Bus-related initialization happens in init_dbus(), and
non-D-Bus-related stuff stays in construct().

(This simplifies the next commit.)
2014-08-01 14:34:40 -04:00
Dan Winship
a0e9a4bd45 libnm: remove _new functions from NMObject subclasses
Most NMObjects should not be manually created, they should only be
received from NMClient or NMRemoteSettings.
2014-08-01 14:34:40 -04:00
Dan Winship
2fc55941a3 libnm: fix up class struct reserved slots
Add reserved slots to those classes that were missing them (or had run
out), and sync up the number of slots across classes:

  - 8 slots for "important" classes, abstract base classes, and
    classes we expect we might need to add new virtual methods or
    signals to later.

  - 4 for everything else

Also, rearrange the class elements in a few places into standard order
(signals first, then methods).
2014-08-01 14:34:40 -04:00
Dan Winship
bdda66a813 libnm-core, etc: move NMSecretAgentCapabilities to NetworkManager.h
NMSecretAgentCapabilities was being defined in both
libnm/nm-secret-agent.h and in src/settings/nm-secret-agent.h. Since
it's part of the D-Bus interface, move it to
libnm-core/nm-dbus-interface.h.
2014-08-01 14:34:40 -04:00
Dan Winship
dc1b76432b include: drop nm-settings-flags.h, move NMSecretAgentGetSecretsFlags
For some reason, the flags used by o.fd.NM.SecretAgent.GetSecrets were
defined as both NMSecretAgentGetSecretsFlags in
libnm{,-glib}/nm-secret-agent.h, and then separately as
NMSettingsGetSecretsFlags in include/nm-settings-flags.h.
(NMSettingsGetSecretsFlags also had an additional internal-use-only
value, but that was added later after the duplication already
existed.)

Fix this by moving NMSecretAgentGetSecretsFlags from libnm to
nm-dbus-interface.h, adding the internal-use-only value to it as well,
updating the core code to use that, and then removing
nm-settings-flags.h.
2014-08-01 14:34:39 -04:00
Dan Winship
9a930b3e89 libnm: add NetworkManager.h and NetworkManagerVPN.h to enum-types 2014-08-01 14:34:07 -04:00
Dan Winship
f441cf2b90 libnm: consistently use "INTERFACE" rather than "IFACE" in macros
Most D-Bus interface name macros used "INTERFACE" in their name (eg,
NM_DBUS_INTERFACE), but a few used "IFACE" instead (eg,
NM_DBUS_IFACE_SETTINGS). Make them consistent.
2014-08-01 14:34:06 -04:00
Dan Winship
3ac0f52878 libnm, core, cli, tui: fix the capitalization of various types
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").

NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
2014-08-01 14:34:06 -04:00
Dan Winship
b4ae6eaec9 libnm: remove Since tags and NM_AVAILABLE_IN_* attributes
Everything currently in libnm has always been there.
2014-08-01 14:34:06 -04:00
Dan Winship
054c12ea30 libnm: remove all deprecated functions and types
Remove deprecated functions and enum types.

For now, deprecated properties are still around, because removing them
would cause warnings when talking to older implementations.
2014-08-01 14:34:05 -04:00
Dan Winship
b9fef07fff libnm-util: remove NM_UTIL_PRIVATE_CALL, NMSettingIP4Config:address-labels
Since libnm-util is no longer used from within NM, its copy of
NM_UTIL_PRIVATE_CALL is now useless, and the internal-only
NMSettingIP4Config:address-labels property is no longer needed.
2014-08-01 14:34:05 -04:00
Dan Winship
058915a9ae contrib: update NetworkManager.spec for libnm
Add libnm to NetworkManager.spec, and try to update the descriptions
of NetworkManager-devel, NetworkManager-glib, and
NetworkManager-glib-devel to make sense in the libnm world...
2014-08-01 14:34:05 -04:00
Dan Winship
a7c4d53d03 all: port everything to libnm
Since the API has not changed at this point, this is mostly just a
matter of updating Makefiles, and changing references to the library
name in comments.

NetworkManager cannot link to libnm due to the duplicated type/symbol
names. So it links to libnm-core.la directly, which means that
NetworkManager gets a separate copy of that code from libnm.so.
Everything else links to libnm.
2014-08-01 14:34:05 -04:00
Dan Winship
c5daa4c4df docs: add libnm documentation
Add docs infrastructure
2014-08-01 14:34:05 -04:00
Dan Winship
eedcf185a7 libnm: add libnm/libnm-core (part 2)
This fixes up the code from the previous "clean" import, and adds
build infrastructure.

[There are two slightly orthogonal sets of changes in this patch.
First, the files added in the previous commit were modified as followed:

  # Replace internal references to "libnm-util" and "libnm-glib" with "libnm"
  perl -pi -e 's/libnm-(util|glib)/libnm/;' libnm-core/*.[ch] libnm-core/tests/*.[ch] libnm/*.[ch] libnm/tests/*.[ch]

  # Fix includes of the enum-types files
  perl -pi -e 's/nm-utils-enum-types/nm-core-enum-types/;' libnm-core/*.[ch] libnm-core/tests/*.[ch] libnm/*.[ch] libnm/tests/*.[ch]
  perl -pi -e 's/nm-glib-enum-types/nm-enum-types/;' libnm/*.[ch] libnm/tests/*.[ch]

  # Fix some python example code
  perl -pi -e 's/import NMClient/import NM/;' -e 's/NMClient.Client\(\)/NM.Client()/;' libnm/nm-client.c

Then, the build infrastructure was added (without further modifying
any existing files in libnm-core or libnm.)

Note: to regenerate libnm.ver after rebase:
  (head -2 libnm-util/libnm-util.ver; (grep -h '\s'nm_ libnm-util/libnm-util.ver libnm-glib/libnm-glib.ver | env LANG=C sort); tail -3 libnm-util/libnm-util.ver) > libnm/libnm.ver
]
2014-08-01 14:34:04 -04:00
Dan Winship
d595f7843e libnm: add libnm/libnm-core (part 1)
This commit begins creating the new "libnm", which will replace
libnm-util and libnm-glib.

The main reason for the libnm-util/libnm-glib split is that the daemon
needs to link to libnm-util (to get NMSettings, NMConnection, etc),
but can't link to libnm-glib (because it uses many of the same type
names as the NetworkManager daemon. eg, NMDevice). So the daemon links
to only libnm-util, but basically all clients link to both.

With libnm, there will be only a single client-visible library, and
NetworkManager will internally link against a private "libnm-core"
containing the parts that used to be in libnm-util.

(The "libnm-core" parts still need to be in their own directory so
that the daemon can see those header files without also seeing the
ones in libnm/ that conflict with its own headers.)

[This commit just copies the source code from libnm-util/ to
libnm-core/, and libnm-glib/ to libnm/:

  mkdir -p libnm-core/tests/
  mkdir -p libnm/tests/
  cp libnm-util/*.[ch] libnm-util/nm-version.h.in libnm-core/
  rm -f libnm-core/nm-version.h libnm-core/nm-setting-template.[ch] libnm-core/nm-utils-enum-types.[ch]
  cp libnm-util/tests/*.[ch] libnm-core/tests/
  cp libnm-glib/*.[ch] libnm/
  rm -f libnm/libnm_glib.[ch] libnm/libnm-glib-test.c libnm/nm-glib-enum-types.[ch]
  cp libnm-glib/tests/*.[ch] libnm/tests/

]
2014-08-01 14:34:04 -04:00
Thomas Haller
c123a24dc4 Merge branch 'th/bgo733212_logging'
https://bugzilla.gnome.org/show_bug.cgi?id=733212

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:11:02 +02:00
Thomas Haller
be55d774eb core: refactoring logging in NMDevice to use new _LOG() macros
Make use of the previously added _LOG() macros in nm-device.c.
This reduces code, but also ensures printing the same prefix for
every logline produced *for* a device instance.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:09:47 +02:00
Thomas Haller
7de955c0d2 core/trivial: change variable name for self pointer in NMDevice to @self
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:09:23 +02:00
Thomas Haller
75d8a805e7 core: add logging macro _LOG() and _LOGD() to nm-device.c
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
ca7329f7d4 core/logging: add new logging macro nm_log_obj()
Add new macro nm_log_obj() to prefix the log line with a pointer value
as identifier. This macro can be used to give each logging line a common
prefix with defined format. It is mainly intended to print a message
"for" an object, for example inside a method function.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
573576bedd core/logging: define nm_log() to check for nm_logging_enabled() first
Change the definition of nm_log() to first check whether logging is
enabled. This has the benefit, that the logging arguments don't have
to be evaluated if logging is disabled.

With this change, you must ensure, that calling any logging function
is side-effect-free. For example:
    nm_log_debug ("This is a bug %s, %d", has_side_effect (), ++i);
would be a bug, because the logging arguments get only evaluated
depending on the logging setup.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
7509d4f80f core/logging: change order or domain/level arguments for nm_log()
Now the order of arguments corresponds to nm_logging_enabled().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
60cf1b8fcd core/logging: define logging macros based on nm_log()
Base the definition of nm_log_*() macros on the nm_log() macro,
instead of directly on the _nm_log() function.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
19d4bda69a core/logging: ensure that logging is always initialized
Ensure that nm_logging_setup() was called for all functions
where it actually makes a difference.

This is especially important for nm_logging_enabled(),
so that the behavior of the following is identical:

    nm_log_info(LOGD_CORE, "hello world");

and
    if (nm_logging_enabled (LOGL_INFO, LOGD_CORE))
        nm_log_info(LOGD_CORE, "hello world");

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
453d1aa71d core/logging: return static string from nm_logging_domains_to_string()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
85b972e9b8 core/logging: return static string from nm_logging_level_to_string()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
ff6946a193 core/logging: align logging after "<LEVEL>" prefix
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
f6882496e3 core/logging: add assert to nm_logging_setup() to check input arguments
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
a69037431c core/logging: remove unused #undef from header file
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:25 +02:00
Thomas Haller
65c43a680e utils: add _NM_UTILS_MACRO_FIRST and _NM_UTILS_MACRO_REST macros
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:24 +02:00
Thomas Haller
9f832d99be core: add project-wide header file nm-utils-internal.h
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:24 +02:00
Thomas Haller
8720c8e136 core: no need to clone ifname in nm_device_generate_connection()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 19:06:24 +02:00
Dan Winship
bd37e0ea58 Misc libnm-glib/tests/ fixes (bgo #734121) 2014-08-01 12:12:48 -04:00
Dan Winship
48ad586209 libnm-glib: add tests of NMClient:manager-running and NMRemoteSettings:service-running
Test that the code to track whether NetworkManager is running works
correctly.
2014-08-01 12:12:42 -04:00
Dan Winship
fe264a2d01 libnm-glib: fix a crash when using multiple NMClients
NMObjectCache was assuming there would never be more than one object
with the same path, but since NMClient is an NMObject, it was getting
cached too, so if you created two clients and then unreffed one of
them, it's possible the wrong one could get left in the cache, causing
a crash the next time the other one called nm_object_cache_clear().

Fix this by only adding NMObjects to the cache in the codepaths where
we also check to see if the object was already in the cache.

(This also means we can remove the "except" argument to
nm_object_cache_clear(), since the NMClient won't be cached any more.)
2014-08-01 12:12:42 -04:00