Commit Graph

15047 Commits

Author SHA1 Message Date
Thomas Haller
41ced630fb libnm-glib: fix resetting IP config during additional SetConfig() calls
When receiving updated VPN IP configuration from the helper after the
initial connect event, the library overwrites the already initialized
GValue fields by calling g_value_init() again. This is an error and causes
the following warning:

   (nm-openvpn-service:27645): GLib-GObject-WARNING **: gvalue.c:183: cannot initialize GValue with type gchararray, the value has already been initialized as gchararray

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-04 20:17:22 +02:00
Dan Winship
53857a3ef7 core: add debug logging to nm_utils_match_connection()
Related: rh#1086237
2014-06-04 11:24:05 -04:00
Dan Winship
d47b749a75 libnm-utils: remove INFERRABLE flag from properties we don't actually infer
ipv4.never-default, ipv4.may-fail, and ipv6.privacy were marked
INFERRABLE, but NMIP4Config / NMIP6Config didn't actually infer them,
so they could cause connections to not match themselves after a
restart.

(Found while debugging https://bugzilla.redhat.com/show_bug.cgi?id=1086237,
though this is not actually the problem there.)

Related: rh#1086237
2014-06-04 11:23:54 -04:00
Thomas Haller
43e4b1b6f7 firewall: merge branch 'th/rh1103782_firewall_zone_conflict'
https://bugzilla.redhat.com/show_bug.cgi?id=1103782

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-04 15:07:13 +02:00
Thomas Haller
c29388bf02 firewall: fix ZONE_CONFLICT when adding firewall interface to zone
Firewalld call addInterface() fails with ZONE_CONFLICT if the interface
is already part of another zone. This complicates the code in NM,
because we would have to keep better track of the zone in which the
interface currently is. Which might be quite difficult because
the zone might be changed from an external program (so we would have
to monitor the firewall configuration and work around potential races).

A better and simpler fix is to simply always use the changeZone() call.
This will do the right thing, regardless if the interface is already part
of a zone or not.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-04 14:54:11 +02:00
Thomas Haller
c598336de8 firewall: fix ZONE_CONFLICT when removing interface from zone
The firewalld removeInterface call fails with ZONE_CONFLICT when
removing an interface from a wrong zone. This can happen, when the
connection gets modified, while being active (which is related to
bgo#724041).

By not specifying any zone, we remove the interface from the zone
where it currently is added. This behavior was introduced in upstream
firewalld with commit cc3101ab70a3997228be7bc9f45a069c7fccfa36, March 2012,
r0_2_3-1.
This is the behavior we actually want and we don't have to keep proper track
of the current zone.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-04 14:54:11 +02:00
Thomas Haller
3bc38ad531 firewall: extend logging to show id for async dbus calls in NMFirewallManager
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-04 14:54:09 +02:00
Thomas Haller
e3605ab924 firewall: refactor allocation of CBInfo data in NMFirewallManager
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-04 14:45:08 +02:00
Thomas Haller
dde731f0ad firewall: refactor reentrancy for dispose() in NMFirewallManager
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-04 14:45:08 +02:00
Thomas Haller
69dc3f96c5 contrib/build: require readline library for nmcli in NetworkManager.spec
This is needed since commit 13b10607d4.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-04 12:05:03 +02:00
Thomas Haller
3b3e33f8ec core/logging: initialize level_names array with explicit array initilizer (trivial)
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-04 10:37:50 +02:00
Thomas Haller
6b5fb892e1 core/logging: when comparing glib log levels, ignore non-level flags
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-04 10:37:50 +02:00
Jiří Klimeš
13b10607d4 Merge changes for readline support in nmcli (bgo #729846)
libreadline is now a build-time dependency.
We now use it throughout nmcli when asking for user input, not only in the
editor. That brings a better experience especially of 'nmcli --ask con add'
and also allows TAB completion usage.

https://bugzilla.gnome.org/show_bug.cgi?id=729846
https://bugzilla.redhat.com/show_bug.cgi?id=1007365
2014-06-04 10:11:12 +02:00
Jiří Klimeš
82db87a144 cli: use readline for quit confirmation in editor, and accept localized answer 2014-06-04 09:47:37 +02:00
Jiří Klimeš
00c700bf2c cli: implement TAB completion for connection and interface names
For commands like
nmcli -a dev disconnect
nmcli -a con up
...
2014-06-04 09:47:37 +02:00
Jiří Klimeš
bfb1200b4f cli: implement TAB completion for inputs in questionnaire mode
and also
- accept yes/no options as localized strings
- simplify some questionnaire code
2014-06-04 09:47:37 +02:00
Jiří Klimeš
480f69e23f cli: use readline also in other commands (besides interactive editor)
It is used for '--ask' option. The main use is for questionnaires
(nmcli -a con add).
2014-06-04 09:47:37 +02:00
Jiří Klimeš
b71af5b144 cli: make prompt argument a printf-like format string, remove history argument
for nmc_readline()
2014-06-04 09:47:37 +02:00
Jiří Klimeš
a3d89d65c4 cli: move readline related functions to common.h to be usable throughout nmcli
Renames
readline_x() to nmc_readline()
gen_func_basic() to nmc_rl_gen_func_basic()

The commit doesn't change functionality, only moves and renames the functions,
so that they can be used in other places too.
2014-06-04 09:47:37 +02:00
Jiří Klimeš
03be41d409 cli/build: make libreadline a build-time dependency (bgo #729846)
and link nmcli against it.

This simplifies code, makes sure that line editing capability is supported,
and will allow using readline on other places too.

https://bugzilla.gnome.org/show_bug.cgi?id=729846
https://bugzilla.redhat.com/show_bug.cgi?id=1007365
2014-06-04 09:47:37 +02:00
Jiří Klimeš
fd93fb9fb9 cli: don't leak 'str' returned by g_strdup_vprintf() 2014-06-04 08:55:35 +02:00
Jiří Klimeš
7a79a78a1b Merge tui fixes for IPv6 routes and MAC address (bgo #731160)
- fixes crash when editing IPv6 routes
- fixes editing of Cloned MAC address
2014-06-03 16:13:28 +02:00
Dan Winship
d57795d474 tui: fix NmtMacEntry validation/display
NmtMacEntry would allow you to input 1 character more than it should
have. Fix that.

Also, the code to insert ":"s automatically was bumping against some
weirdness in NmtNewtEntry that made it so that the ":" didn't get
displayed until you typed one more character after the one where it
got inserted. Hack around that by manually requesting a redraw.

https://bugzilla.gnome.org/show_bug.cgi?id=731160
2014-06-03 16:06:35 +02:00
Dan Winship
5ee85fe46e tui: fix setting Clone MAC Address properties
NmtMacEntry wasn't notifying its mac-address property when it changed,
so the change never got saved to the NMSetting.

https://bugzilla.gnome.org/show_bug.cgi?id=731160
2014-06-03 16:06:35 +02:00
Jiří Klimeš
92898e84d6 tui: fix a crash when editing IPv6 routes 2014-06-03 14:08:38 +02:00
Dan Williams
ffd961febf core: properly initialize unmanaged_flags and handle carrier_changed() for unmanaged devices
Fixes the following g_warn():
    #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  0x0000003370c50956 in g_warn_message () from /lib64/libglib-2.0.so.0
    #3  0x0000000000439962 in carrier_changed (device=0x1d94300, carrier=1) at devices/nm-device.c:1021
    #4  0x0000000000488f12 in carrier_changed (device=0x1d94300, carrier=1) at devices/nm-device-ethernet.c:1646
    #5  0x0000000000434c94 in nm_device_set_carrier (device=device@entry=0x1d94300, carrier=1) at devices/nm-device.c:1104
    #6  0x0000000000434dd5 in check_carrier (device=device@entry=0x1d94300) at devices/nm-device.c:1298
    #7  0x0000000000434ef8 in constructed (object=0x1d94300) at devices/nm-device.c:550
    #8  0x0000003371c15d87 in g_object_new_internal () from /lib64/libgobject-2.0.so.0
    #9  0x0000003371c17814 in g_object_new_valist () from /lib64/libgobject-2.0.so.0
    #10 0x0000003371c17c11 in g_object_new () from /lib64/libgobject-2.0.so.0
    #11 0x000000000048bc2e in nm_device_ethernet_new (platform_device=platform_device@entry=0x1d82e58) at devices/nm-device-ethernet.c:336
    #12 0x000000000047c600 in platform_link_added (self=0x1d70150, ifindex=ifindex@entry=2, plink=plink@entry=0x1d82e58, reason=reason@entry=NM_PLATFORM_REASON_INTERNAL) at nm-manager.c:1954
    #13 0x000000000047c7db in platform_link_cb (platform=<optimized out>, ifindex=2, plink=0x1d82e58, change_type=<optimized out>, reason=NM_PLATFORM_REASON_INTERNAL, user_data=0x1d70150) at nm-manager.c:2038
    #14 0x0000003371805d8c in ffi_call_unix64 () from /lib64/libffi.so.6
    #15 0x00000033718056bc in ffi_call () from /lib64/libffi.so.6
    #16 0x0000003371c10ad8 in g_cclosure_marshal_generic () from /lib64/libgobject-2.0.so.0
    #17 0x0000003371c10298 in g_closure_invoke () from /lib64/libgobject-2.0.so.0
    #18 0x0000003371c2235d in signal_emit_unlocked_R () from /lib64/libgobject-2.0.so.0
    #19 0x0000003371c2a0f2 in g_signal_emit_valist () from /lib64/libgobject-2.0.so.0
    #20 0x0000003371c2a3af in g_signal_emit () from /lib64/libgobject-2.0.so.0
    #21 0x000000000044f6ba in nm_platform_query_devices () at platform/nm-platform.c:330
    #22 0x000000000047de4c in nm_manager_start (self=0x1d70150) at nm-manager.c:4025
    #23 0x0000000000429d31 in main (argc=1, argv=0x7fffb4c31628) at main.c:654

https://mail.gnome.org/archives/networkmanager-list/2014-June/msg00000.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-02 19:07:57 +02:00
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