Commit Graph

10071 Commits

Author SHA1 Message Date
Jiří Klimeš
d7b8aeea33 tui: use 128 as the default prefix for IPv6 addresses 2014-06-02 17:39:51 +02:00
Jiří Klimeš
5378d7929e tui: fix a crash when editing an IPv6 address (rh #1103702)
https://bugzilla.redhat.com/show_bug.cgi?id=1103702
2014-06-02 17:39:46 +02:00
Thomas Haller
48b4d0eaf2 core/logging: remove thread-safe initialization guard for nm_logging_syslog_openlog()
The logging routines are not thread-safe in general, so there is no
need for trying to make nm_logging_syslog_openlog() thread-safe.
Also nm_logging_syslog_openlog() is only called by the main() routine.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-02 16:08:02 +02:00
Thomas Haller
7ac7249fc8 core/firewall: fix accessing non-existing connection for device in firewall_started()
When starting firewall, NMPolicy would fail the following assertion:

    NetworkManager[1462]: <debug> [1401708294.250829] [firewall-manager/nm-firewall-manager.c:218] name_owner_changed(): firewall started
    (NetworkManager:1462): libnm-util-CRITICAL **: nm_connection_get_setting_connection: assertion 'NM_IS_CONNECTION (connection)' failed

    #0  0x0000003370c504e9 in g_logv () from /lib64/libglib-2.0.so.0
    #1  0x0000003370c5063f in g_log () from /lib64/libglib-2.0.so.0
    #2  0x00007f306f960e11 in nm_connection_get_setting_connection (connection=0x0) at nm-connection.c:1441
    #3  0x0000000000482319 in firewall_started (manager=<optimized out>, user_data=<optimized out>) at nm-policy.c:1881
    #4  0x0000003371c104c7 in _g_closure_invoke_va () from /lib64/libgobject-2.0.so.0
    #5  0x0000003371c29749 in g_signal_emit_valist () from /lib64/libgobject-2.0.so.0
    #6  0x0000003371c2a3af in g_signal_emit () from /lib64/libgobject-2.0.so.0
    #7  0x0000000000445d39 in name_owner_changed (dbus_mgr=<optimized out>, name=<optimized out>, old_owner=0x1452660 "", new_owner=0x1536720 ":1.175", user_data=<optimized out>) at firewall-manager/nm-firewall-manager.c:220
    ...

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-02 16:08:02 +02:00
Thomas Haller
16d34bfe82 build: fix installing network-online.target for existing link
When reinstalling NM on the same location, it would fail with

    Making install in data
    make[1]: Entering directory `/home/data/src/NetworkManager/data'
    make[2]: Entering directory `/home/data/src/NetworkManager/data'
    install -d /opt/test/lib/systemd/system/network-online.target.wants
    ln -s /opt/test/lib/systemd/system/NetworkManager-wait-online.service /opt/test/lib/systemd/system/network-online.target.wants
    ln: failed to create symbolic link ‘/opt/test/lib/systemd/system/network-online.target.wants/NetworkManager-wait-online.service’: File exists
    make[2]: *** [install-exec-local] Error 1

https://bugzilla.gnome.org/show_bug.cgi?id=728965

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-02 16:05:46 +02:00
Thomas Haller
070e19dc31 contrib/build: cleanup build.sh script and improve build_clean.sh
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-31 19:27:42 +02:00
Thomas Haller
7857043195 contrib/build: cleanup build.sh script by adding write_changelog() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-31 19:27:42 +02:00
Thomas Haller
dbed9e5378 contrib/build: remove external NMTUI source from build.sh
nmtui is long part of the NM main source. Remove the code from the build.sh
script to add 'nmtui' from an external tarball.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-31 19:27:38 +02:00
Thomas Haller
c98b3fcd52 contrib/build: fix spec file after creating network-online.target.wants link in Makefile
Fix NetworkManager.spec file after changing `make install` in commit
afd30f5f3b.

https://bugzilla.gnome.org/show_bug.cgi?id=728965

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-31 14:55:52 +02:00
Pavel Šimerda
afd30f5f3b implement systemd network-online.target properly (bgo #728965)
Make network-online.target depend on NetworkManager-wait-online.service
just as is done in Fedora. This makes network-online.target work with
NetworkManager as described in systemd documentation.

An alternative way would be to use a combination of setting
Install.WantedBy to network-online.target and enabling the service by
default. This alternative approach is currently used by
systemd-networkd.

https://bugzilla.gnome.org/show_bug.cgi?id=728965

Acked-By: Dan Williams <dcbw@redhat.com>
2014-05-30 22:23:08 +02:00
Pavel Šimerda
186e4dcf7a dns: preliminary support for unbound (bgo #699810)
The script is called synchronously from NetworkManager so it can handle
asynchronicity itself. The long-term plan is to incorporate the script
partially into the new plugin and partially into a dnssec-trigger
library which will be used instead of dnssec-trigger daemon.

https://bugzilla.gnome.org/show_bug.cgi?id=699810

Acked-By: Thomas Haller <thaller@redhat.com>
Acked-By: Dan Williams <dcbw@redhat.com>
2014-05-30 21:29:26 +02:00
Thomas Haller
9c6ac81aa3 bluez: fix crash when removing NMBluezDevice
Fixes regression introduced by commit 4674f10399.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 21:25:14 +02:00
Dan Williams
c4dd68bce9 core: remove unused 'error' argument to check_connection_compatible()
Nothing uses the error, so simplify some code and save 5K (0.45%) in
binary size.
2014-05-30 13:49:30 -05:00
Thomas Haller
253bfa5c47 platform: fix crash after 'fix check_cache_items() to check items in two steps'
Fixes regression introduced by commit 90ab7e83ff.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 20:20:16 +02:00
Thomas Haller
98052255ba platform: merge branch 'th/bgo730934_platform_route_lookup'
https://bugzilla.gnome.org/show_bug.cgi?id=730934#c2

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 18:40:46 +02:00
Thomas Haller
a312dc6d1d platform: fix lookup of routes and deletion of IPv4 routes
When doing a lookup for an libnl route, the cache comparison function
for routes takes into account 'family', 'tos', 'table', 'dst', and 'prio'.

In NetworkManager we don't use all of these properties for a route, so
at several places when doing a cache lookup we don't have all identifying
properties. Usually we only have 'family' and 'dst' ('table' is
implicit 0, because NM does currently not care about any other tables).

The problem is that NM sees routes with different 'tos', 'prio', but it
cannot look them up in the cache. Add a hack to search the cache
fuzzy.

This is similar to the hack for link, where the identifying properties
are 'family' and 'ifindex', but we only have 'ifindex' at hand. However,
contrary to this hack, we coerce the 'family' to AF_UNSPEC for every link cache
operation. This is not viable in this case, because we internally need
the 'tos' field.

We need the 'tos' field because when deleting an IPv4 route, the 'tos' field must
match. See fib_table_delete(). This was already partially fixed by commit
f0daf90298, but before the lookup to the
cached object would fail for any non-zero 'tos'.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 18:39:09 +02:00
Thomas Haller
cffca6a1c2 platform/trivial: add fixme code comment
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 18:39:08 +02:00
Thomas Haller
90ab7e83ff platform: fix check_cache_items() to check items in two steps
check_cache_items() iterated over all items and called refresh_object().
But refresh_object() might remove the current object from the cache, so
this would break the iteration.

Instead check the items in two steps. First find all the objects we care
about and build a list of them. Then check them.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 18:39:08 +02:00
Thomas Haller
68bd8711d2 platform/trivial: fix typo in ip6_route_exists()
By passing INADDR_ANY as a gconstpointer, we actually always passed NULL
as gateway. Maybe this was not intended, but it seems correct now
and is proven to work. So this fixe has no behavioral change.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 18:38:49 +02:00
Thomas Haller
fad5472b34 Merge branch 'th/bgo729844_set_bridge_mac_address'
https://bugzilla.gnome.org/show_bug.cgi?id=729844

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 17:03:20 +02:00
Thomas Haller
5e45ec6acc keyfile: support NM_SETTING_BRIDGE_MAC_ADDRESS property
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 17:02:31 +02:00
Jiří Klimeš
54e689234d ifcfg-rh: read/write bridge.mac-address property as MACADDR variable 2014-05-30 17:02:31 +02:00
Jiří Klimeš
e88979a354 cli: add optional 'mac' argument for 'nmcli con add type bridge'
This allows setting bridge MAC either on command-line
nmcli con add type bridge con-name mybridge mac 11:22:33:44:55:66
or provide it when asked
nmcli -a con add type bridge con-name mybridge
2014-05-30 17:02:31 +02:00
Jiří Klimeš
43edc90438 cli: support new bridge.mac-address property 2014-05-30 17:02:31 +02:00
Thomas Haller
6e06a7d4a1 core: match the NMSettingBridge:mac-address in NMDeviceBridge:check_connection_compatible()
https://bugzilla.gnome.org/show_bug.cgi?id=729844

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 17:02:31 +02:00
Thomas Haller
1701a70b9e core: set NMSettingBridge:mac-address when creating new bridge
This feature requires recent support from the kernel.

Most notably these upstream kernel commits are required:
 -  92c0574f11598c8036f81e27d2e8bdd6eed7d76d
 - 43598813386f6205edf3c21f1fe97f731ccb4f15
 - 30313a3d5794472c3548d7288e306a5492030370

The latter of them was merged to upstream kernel version 3.15-rc5.

https://bugzilla.gnome.org/show_bug.cgi?id=729844

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 17:02:31 +02:00
Thomas Haller
891eb83f45 libnm-util: add property NM_SETTING_BRIDGE_MAC_ADDRESS to NMSettingBridge
https://bugzilla.gnome.org/show_bug.cgi?id=729844

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 17:02:31 +02:00
Thomas Haller
968b468b2f platform: allow setting address when adding software link (bridge)
Add an additional address parameter to link_add/bridge_add, to set the
MAC address of software devices.

https://bugzilla.gnome.org/show_bug.cgi?id=729844

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 17:02:31 +02:00
Dan Williams
a03a76ea60 bluez: fix incorrect error code comparing Bluetooth connections
C&P error in my commit 4674f10399.
2014-05-30 09:35:42 -05:00
Thomas Haller
00a6f9dcf9 Merge branch 'th/nm_utils_hwaddr_ntoa_len'
https://mail.gnome.org/archives/networkmanager-list/2014-May/msg00046.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 11:41:12 +02:00
Dan Williams
4674f10399 bluez: store Bluetooth address as an array not a string
It's only ever used as an MAC address array, so we might as well
make it one instead of a string.  Saves a memory allocation and
some cycles converting back and forth.

This also fixes a bug, where NMDeviceBt:check_connection_compatible()
would not set GError on mismatch of bdaddr.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 11:32:37 +02:00
Thomas Haller
7013014744 core: refactor to use nm_utils_hwaddr_ntoa_len() instead of printf()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 11:32:20 +02:00
Thomas Haller
002718ec0f ifnet: refactor to use nm_utils_hwaddr_ntoa_len() instead of printf()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 11:32:20 +02:00
Thomas Haller
40110d3568 ifcfg-rh: refactor writer to use nm_utils_hwaddr_ntoa_len()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 11:32:20 +02:00
Thomas Haller
b15fea034d ifcfg-rh: add helper svSetValue_free()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 11:32:20 +02:00
Thomas Haller
fedf7ca303 libnm-util: optimize nm_utils_hwaddr_ntoa_len()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-30 11:32:20 +02:00
Jiří Klimeš
a7fa1aed1b trivial: clarify comments in test-general.c and NetworkManagerUtils.c 2014-05-30 09:21:02 +02:00
Jiří Klimeš
fbdf8857c3 core: take over connections with IPv6 method 'ignore' for 'auto' (rh #1083196)
If we had a connection with IPv6.method = ignore, we simply ignored IPv6. So
we should assume this connection even if there is an SLAAC address on the
interface.

https://bugzilla.redhat.com/show_bug.cgi?id=1083196
2014-05-30 09:20:55 +02:00
Thomas Haller
b5a94ae479 merge branch 'jk/keyfile-mac-fix' (bgo #730514)
https://bugzilla.gnome.org/show_bug.cgi?id=730514
2014-05-29 19:01:35 +02:00
Thomas Haller
d426ed28c2 keyfile: stricter checking for invalid HWADDR length in mac_address_parser()
When reading a hardware address in keyfile plugin, check for the
expected length already in mac_address_parser().

Before, we would call the deprecated function nm_utils_hwaddr_type()
to see if it can be some kind of MAC address. In that case, the error
was caught later during NMSetting:verify().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-29 19:01:00 +02:00
Thomas Haller
415c86eb9a keyfile: don't check HWADDR length in mac_address_writer()
When converting the MAC address to keyfile value, simply accept
any given byte array and pass it to nm_utils_hwaddr_ntoa_len().
This no longer restricts the length of accepted addresses as known by
nm_utils_hwaddr_type(). It is up to the caller to perform any validation
of the MAC address.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-29 19:01:00 +02:00
Thomas Haller
c4d90c5660 cli: don't use nm_utils_hwaddr_type() to stringify HWADDR
Use nm_utils_hwaddr_ntoa_len() instead of nm_utils_hwaddr_ntoa().
This makes it no longer necessary to determine the type of the MAC
address based on the address length.

This makes the GETTER more accepting towards other lengths.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-29 19:00:59 +02:00
Thomas Haller
3cda194b44 libnm-util: make hwaddr functions more robust against invalid arguments
- nm_utils_hwaddr_len() and nm_utils_hwaddr_type() no longer assert
  against known input types/lengths. Now they can be used to detect the
  hwaddr type, returning -1 on unknown.
- more checking of input arguments in nm_utils_hwaddr_aton() and
  related. Also note, that nm_utils_hwaddr_aton_len() has @len of type
  gsize, so we cannot pass on the output of nm_utils_hwaddr_len()
  without checking for -1.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-29 19:00:59 +02:00
Jiří Klimeš
dce6599ec0 keyfile: fix reading MAC in old format (list of integers)
Don't call nm_utils_hwaddr_type () with random len, because it causes ugly
  (NetworkManager:25325): libnm-util-CRITICAL **: file nm-utils.c: line 1989 (nm_utils_hwaddr_type): should not be reached

And add a testcase.

https://bugzilla.gnome.org/show_bug.cgi?id=730514
2014-05-29 19:00:41 +02:00
Jiří Klimeš
32b559044e dhcp: dhclient v6 stores address lifetimes in different variables (rh #1086237)
It uses 'new_max_life' for valid lifetime and 'new_preferred_life' for
preferred lifetime.

https://bugzilla.redhat.com/show_bug.cgi?id=1086237

See also https://bugzilla.redhat.com/show_bug.cgi?id=1032809
2014-05-29 11:49:28 +02:00
Jiří Klimeš
d7216505bb cli: do not restrict VPN type of created connections (rh #1100750)
There may be third-party VPN plugins nmcli is not aware of.
We still print a warning if nmcli doesn't know the type. It helps to catch up
typos.

https://bugzilla.redhat.com/show_bug.cgi?id=1100750
2014-05-28 09:37:15 +02:00
Jiří Klimeš
649e4be103 cli: extract username and gateway for some more VPN types 2014-05-28 09:37:15 +02:00
Thomas Haller
f0daf90298 platform: fix regression failing with ESRCH when deleting IPv4 routes
When deleting an IPv4 route, several fields must match (or be left
unspecified/zero). See fib_table_delete().

Previously, NM would look into the cache and use that object for
deletion. This was changed recently, thereby breaking the deletion
of routes by not specifying all properties as needed.

Fixes regression introduced by commit 019bf7512d.

Related: https://bugzilla.gnome.org/show_bug.cgi?id=726273

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-27 21:40:31 +02:00
Jiří Klimeš
98ae6e06d2 all: g_type_init() has been deprecated in GLib 2.35.0
g_type_init() deprecation:
https://bugzilla.gnome.org/show_bug.cgi?id=686161
2014-05-27 16:58:21 +02:00
Dan Winship
aba55670cc man: clarify the meaning of "nm-online --wait-for-startup"
https://bugzilla.gnome.org/show_bug.cgi?id=700651
2014-05-27 10:53:53 -04:00