Commit Graph

7740 Commits

Author SHA1 Message Date
Dan Winship
0186330a4b settings: use NMConfig directly rather than reparsing NetworkManager.conf
Add some new API to NMConfig so that NMSettings and its plugins can
use NMConfig to look up values rather than reparsing the config file
themselves.

Also, move the no-auto-default cache from NetworkManager.conf to
$NMSTATEDIR/no-auto-default.state, so NM isn't rewriting its own
config file at runtime.
2013-04-03 10:23:48 -04:00
Dan Winship
57b0ed4154 settings: clarify that NMDefaultWiredConnection is ethernet-only
NMSettings would try to create an NMDefaultWiredConnection for any
NMDeviceWired subclass, and there was some code to deal with
InfiniBand in the code. But nm_default_wired_connection_new() required
the hwaddr length to be ETH_ALEN, so InfiniBand would never have
worked (and probably shouldn't have, since people generally don't want
the auto-default behavior on servers anyway). And we certainly never
intended for this code to apply to bridges and bonds. So fix it to
only apply to ethernet devices, and remove the vestigial
InfiniBand-related code.
2013-04-03 10:23:48 -04:00
Dan Winship
b3e8361f0f settings: don't pass config_path to NMSettings and settings plugins
They can just call nm_config_get() now to get the config, and
nm_config_get_path() to get its path.
2013-04-03 10:23:48 -04:00
Dan Winship
26de9db14b core: remove some can't-happen checks
Most of the various nm_foo_manager_get/new() calls never return NULL,
so just g_assert() that fact rather than logging a separate error
message for each one.
2013-04-03 10:23:48 -04:00
Dan Winship
213a3a4d2e core: don't pass config data to NMDHCPManager and NMDnsManager
Rather than passing specific bits of data to NMDHCPManager and
NMDnsManager, just let them call nm_config_get() and then get the data
themselves.

Also, remove the GError argument from nm_dhcp_manager_new(), since the
function never returned NULL. This in turn means there is no longer
any need for a distinction between nm_dhcp_manager_new() and
nm_dhcp_manager_get(), so remove the former.
2013-04-03 10:23:48 -04:00
Dan Winship
0b815ca166 config: add NMConfigDevice
Add NMConfigDevice, which is mostly just a wrapper around
nm_device_get_hw_address() and nm_device_spec_match_list(), and
implement it in NMDevice. This will be used for config options that
match devices. (We can't use NMDevice directly for dependency
reasons.)
2013-04-03 10:23:48 -04:00
Dan Winship
29ed892de7 config, man: hide connectivity-check command-line options
There is no reason to configure the connectivity-check options from
the command line rather than from the config file. Keep the options,
for backward-compatibility, but remove them from the man page and hide
them from --help.
2013-04-03 10:23:48 -04:00
Dan Winship
8bb9ee8d3b config: fix documentation of --log-domains
The list of log domains in the --log-domains documentation had gotten
out of date. Fix this by adding nm_logging_all_domain_to_string()
(and, for completeness, nm_logging_all_levels_to_string()), and use
those to fill in the help string.
2013-04-03 10:23:47 -04:00
Dan Winship
3407726758 config: move config-related command-line options into nm-config.c
Rather than having main.c parse them and then hand them all to
nm_config_new(), just let nm-config provide its own GOptionEntry
array to merge in with main's.
2013-04-03 10:23:47 -04:00
Dan Winship
4a7727d93a config: make NMConfig non-refcounted
It's a singleton that always exists. Callers shouldn't have to
refcount it.

Also, move its cleanup code from dispose() to finalize(), and remove
some unnecessary checks in it.
2013-04-03 10:23:47 -04:00
Dan Winship
53bd84feff config: move NMConfig into its own subdirectory/library
Also, remove the unused NMConfigError, and add a config-parsing test
program.
2013-04-03 10:23:47 -04:00
Jiří Klimeš
f17ab954f6 libnm-util: make nm_setting_vpn_remove_*() return gboolean instead of void
to match other property removal functions, like nm_setting_bond_remove_option()
or nm_setting_wired_remove_s390_option().

Note:
This is an API change, make sure to bump soname when releasing libnm-util.
2013-04-03 08:35:47 +02:00
Dan Winship
228f6459e1 dns-manager: remove an incorrect and unnecessary line
gcc 4.8.0 has a new warning that triggers on

    static void
    compute_hash (NMDnsManager *self, guint8 buffer[HASH_LEN])
    {
        ...
        memset (buffer, 0, sizeof (buffer));
        ...
    }

because "sizeof (buffer)" is *not* HASH_LEN, it's sizeof(guint8*). The
memset() was not necessary anyway since the g_checksum_get_digest()
after it will always end up filling in buffer, so just remove it.

https://bugzilla.gnome.org/show_bug.cgi?id=697041
2013-04-02 16:15:06 -04:00
Pavel Šimerda
1680143558 libnm-glib: adapt example to python 3.x
It now works with sufficiently recent python 2.x or python 3.x, whatever
is the distribution default. This patch fixes 'make check' for
distributions where 'python' means python 3.x, like Gentoo.
2013-04-02 11:44:24 +02:00
Pavel Šimerda
eb2b990ddc trivial: rename rand to avoid -Wshadow 2013-04-02 11:03:47 +02:00
Dan Williams
afc7f17191 libnm-glib: convert DHCP option parsing to GHashTableIter 2013-04-01 17:18:54 -05:00
Dan Williams
a492d29ceb libnm-util: convert remaining NMConnection users to GHashTableIter 2013-04-01 17:18:54 -05:00
Dan Williams
6c7c2b874d libnm-util: convert nm_setting_new_from_hash() to GHashTableIter 2013-04-01 17:18:54 -05:00
Dan Williams
a8d33c7e2c libnm-util: convert nm_connection_duplicate() to GHashTableIter 2013-04-01 17:18:54 -05:00
Dan Williams
7a7ce3b8e2 libnm-util: convert nm_connection_dump() to GHashTableIter 2013-04-01 17:18:54 -05:00
Dan Williams
df02e7324c libnm-util: convert nm_connection_compare() to GHashTableIter
And finally add some testcases for it too.
2013-04-01 17:18:54 -05:00
Dan Williams
66230eb2f6 libnm-util: reduce memory used by NMConnection
The setting names used when inserting a setting into the hash
table are const since they are derived from GObject internals,
so there's no need to strdup them.
2013-04-01 17:18:53 -05:00
Dan Williams
1699a93be3 libnm-glib: fix memory leak of GSimpleAsyncResult loading object properties 2013-04-01 17:18:53 -05:00
Dan Williams
faf376dad1 libnm-util: fix memory leaks of dhcp_hostname and dhcp_client_id 2013-04-01 17:18:53 -05:00
Dan Williams
b1fc88154b libnm-glib: fix memory leak of GSimpleAsyncResult getting connection settings 2013-04-01 17:18:53 -05:00
Dan Williams
c00e2f1d9d libnm-util: fix some memory leaks in testcases
Helps suppress valgrind false positives.
2013-04-01 17:18:53 -05:00
Dan Williams
bc921e35da valgrind: add common suppressions
Stuff for GObject and NSS that is allocated but never expected
to be freed.
2013-04-01 17:12:37 -05:00
Dan Williams
0ab00b895b libnm-util: make nm_setting_wired_add_s390_option() argument names consistent 2013-04-01 17:12:22 -05:00
Jiří Klimeš
2109f41cc6 libnm-util: consolidate hex-string <-> bin conversion functions
and move them to libnm-util's nm-utils.s so that they are easily available.
2013-03-28 16:59:58 +01:00
Pavel Šimerda
bd3c80029d trivial: add coverage data to .gitignore 2013-03-27 14:49:39 +01:00
Dan Williams
5d6d5cd136 dhclient: copy leasefiles from old location if needed (rh #916233) (bgo #696210)
When the default leasefile location got moved from distro-specific
dhclient locations to a single NM-specific location, that apparently
broke scripts and external tools that depended on the old location,
like dract netbooting.

During a netboot, DHCP is started from the initramfs and gets a
lease, and the leasefile lives in the initramfs.  When the real
system is started, and the rootfs switches from the initramfs to
the actual rootfs, something needs to copy the leasefiles over to
where NetworkManager can find them.  For dracut at least, various
dracut scripts were doing this, and copying to the old location
in /var/lib/dhclient or /var/lib/dhcp.  Which means NM can no
longer find them, and proceeds to acquire a new DHCP lease when
taking over the existing connection, rather than renewing the
existing lease.  This can lead to loss of network connectivity
and thus the netboot process fails.

If no leasefile for the connection in the new location exists,
look in the old locations and copy that leasefile over to the new
location.
2013-03-26 15:26:18 -05:00
Dan Winship
9e71bb3cd5 cli: add property get functions - returning property value for presentation
Simplify code by using property get functions, with most of them
autogenerated based on GObject properties and GValue transforms.

Based on a patch from Jiří Klimeš
2013-03-26 12:15:49 -04:00
Jiří Klimeš
113d358ce5 cli: make 'value' in NmcOutputField non const 2013-03-26 12:15:49 -04:00
Dan Winship
6ff924f82f libnm-utils: change the GValue transforms to match nmcli's outputs
That way, nmcli can use them...
2013-03-26 12:15:49 -04:00
Dan Winship
331b69bd90 libnm-util: split GValue transforms out of nm-utils.c
nm-utils.c is really big, so split the GValue transforms out into
their own file.
2013-03-26 12:15:49 -04:00
Jiří Klimeš
dc58072f7b libnm-util: install :pin and :pin-flags as properties for NMSetting8021x
GLib-GObject-WARNING **: g_object_get_property: object class `NMSetting8021x' has no property named `pin'
GLib-GObject-WARNING **: g_object_get_property: object class `NMSetting8021x' has no property named `pin-flags'
2013-03-26 16:49:37 +01:00
Dan Williams
e8cbde2704 mobile: clarifiy modem state change log message
Otherwise it looks like it might be the NMDevice state change, which
it isn't.
2013-03-25 15:56:06 -05:00
Dan Williams
6ef543d3a6 mobile: downgrade MM launch failure warning severity to debug
MM won't always be present, and if it's not, your logs will fill up
with warnings about MM not being able to be launched.  And when
running with systemd, you'll get a different class of errors like:

<warn> error poking ModemManager: GDBus.Error:org.freedesktop.systemd1.LoadFailed:
   Unit dbus-org.freedesktop.ModemManager1.service failed to load: No such file or
   directory. See system logs and 'systemctl status
   dbus-org.freedesktop.ModemManager1.service' for details.

and I'm tired of chasing and special-casing all the launch-failed
errors that D-Bus and systemd use.

Plus, we have dynamic log level changing via the D-Bus interface so if
people need to debug this, just chaning the log level will tell you
what's wrong.
2013-03-25 15:38:00 -05:00
Dan Williams
824fd06c34 ppp: ignore errors getting final PPP stats
The PPP interface may be gone already, especially if the connection
was terminated by the PPP peer.  It's pointless to warn in these
cases since getitng the final stats is best-effort anyway.
2013-03-25 15:26:51 -05:00
Dan Williams
f515df39b5 core: don't crash checking unmanaged specs if device has no hardware address
Not all devices have a hardware address, like WWAN or ADSL.  So don't
unconditionally expect one.
2013-03-25 15:17:35 -05:00
Sandeep Shedmake
b31ac326dd po: updated Marathi (mr) translation (bgo #696116) 2013-03-25 09:40:32 +01:00
Sweta Kothari
ff2633380c po: updated Gujarati (gu) translation (bgo #696535) 2013-03-25 09:36:31 +01:00
Rajesh Ranjan
70d7f5c194 po: updated Hindi (hi) translation (bgo #696537) 2013-03-25 09:32:52 +01:00
Shantha kumar
f749349635 po: updated Tamil (ta) translation (bgo #696536) 2013-03-25 09:29:11 +01:00
Manoj Kumar Giri
786e13839b po: updated Oriya (Odia) (or) translation (bgo #696534) 2013-03-25 09:23:08 +01:00
Piotr Drąg
980d87e8f4 po: updated Polish (pl) translation (bgo #696459) 2013-03-25 09:09:55 +01:00
Piotr Drąg
5ca123bdf1 po: fix syntax errors in gl, hr and or translations 2013-03-25 08:56:33 +01:00
Jiří Klimeš
82fb1978a4 all: use G_VALUE_INIT to initialize GValue variables
It makes the initializations more explicit.
G_VALUE_INIT is available since glib 2.30, and NM now require glib >= 2.32
2013-03-25 08:41:18 +01:00
Pavel Šimerda
a78a1847c6 testing: fix configure.ac typo regarding valgrind
--without-valgrind will now work properly.
2013-03-23 03:35:44 +01:00
Pavel Šimerda
2675af05b9 testing: support for valgrind memory checking
Use @VALGRIND_RULES@ in Makefile.am for modules that you want to check
for memory leaks.
2013-03-22 23:08:20 +01:00