Commit graph

10967 commits

Author SHA1 Message Date
Thomas Haller 125f7c4d40 dhcp: log the configured DHCP client
Also move enumerating the installed DHCP plugins to the beginning
of nm_dhcp_manager_init().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-13 20:10:07 +01:00
Lubomir Rintel ae829a88ce contrib: Enable PolicyKit agent in RPM 2014-11-13 18:57:04 +01:00
Lubomir Rintel 84c8558622 contrib: Require libselinux for RPM build
It ensures ifcfg-rh doesn't mess up the labels.
2014-11-13 18:57:04 +01:00
Lubomir Rintel 94a57d5e07 cli: Finish waiting for device activation when they disconnect
When wifi secrets are missing, NM_DEVICE_STATE_FAILED due to
NM_DEVICE_STATE_REASON_NO_SECRETS is immediately followed by traversal to
NM_DEVICE_STATE_DISCONNECTED as soon as the server makes sure it won't
reconnect automatically. We sometimes aren't quick to handle the first signal
and only get the latter one.

Let's treat all states that aren't ordinarily reached upon activation as bad.
2014-11-13 18:55:37 +01:00
Dan Winship 749cc84a95 tui: fix unsetting Gateway (rh #1163896)
When the Gateway field is empty, we need to set the property to NULL,
not "".
2014-11-13 11:30:57 -05:00
Lubomir Rintel 46c869b295 merge: wifi bssid handling fixes
Avoid passing NULL bssid where it does not make sense, fix a couple of bad
asserts.

https://bugzilla.gnome.org/show_bug.cgi?id=739258
2014-11-13 16:42:45 +01:00
Jiří Klimeš beec6c87ff libnm-util: fix typos in libnm-util documentation 2014-11-13 10:21:34 +01:00
Dan Winship 955f41d5f4 tui: fix alignment of pop-up menus
Pop-up menus were slightly mis-aligned in the main window, and even
more mis-aligned in slave-editing windows. Fix that.

Also add a bit of padding to the pop-up window, because it just looks
better that way.
2014-11-12 17:34:24 -05:00
Dan Williams c0c90fa65d build: fix configure formatting of IN6_ADDR_GEN_MODE check
Print the result, and make the m4 formatting consistent with the
other kernel checks.
2014-11-12 15:13:33 -06:00
Dan Winship 29ed625fea tui: fix gateway editing
Since adding NMSettingIPConfig:gateway, we were just binding that
property to the Gateway entry as a string. But this caused two
different problems: first, we were trying to set the :gateway property
from the entry even when the IP address in the entry was incomplete
(causing warnings), and second, we were no longer enforcing the rule
that the gateway can only be set when there are static addresses
configured.

Fix this by adding back nm_editor_bind_ip_gateway_to_string(), but
with new semantics reflecting the new way NMSettingIPConfig:addresses
and :gateway work. (Besides just fixing the new bugs, this also makes
the Gateway entry insensitive when there are no addresses; before,
nmtui would allow you to type there, but the value would not be
saved.)

Fixes: Test263_nmtui_ipv4_addresses_delete_ip_and_back_to_auto

https://bugzilla.gnome.org/show_bug.cgi?id=740017
2014-11-12 16:04:59 -05:00
Thomas Haller dd9bb5f376 man: fix make uninstall to remove the nmtui manual pages
Fixes: 1e8b681d4f
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-12 17:40:05 +01:00
Lubomir Rintel 4edab14e73 bluez: Another bluez5 build fix
Fixes the "unused declaration" warning with -Werror and no bluez-libs.

Fixes: f1c9595311
Fixes: 751b52e50b
2014-11-12 17:13:03 +01:00
Thomas Haller e40fc7bb17 bluez: fix build without bluez5-dun
make[5]: Entering directory `./NetworkManager/_build/src/devices/bluetooth'
      CC       nm-bluez-device.lo
    ../../../../src/devices/bluetooth/nm-bluez-device.c: In function 'nm_bluez_device_disconnect':
    ../../../../src/devices/bluetooth/nm-bluez-device.c:430:5: error: "WITH_BLUEZ5_DUN" is not defined [-Werror=undef]
     #if WITH_BLUEZ5_DUN

Fixes: f1c9595311
Fixes: 751b52e50b
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-12 16:51:14 +01:00
Lubomir Rintel 751b52e50b bluetooth: Don't call into bluez5 DUN code when it's not enabled
It is conditionally compiled depending on presence of bluez-libs.
Results in undefined symbols:

NetworkManager[19346]: <warn>  (/libnm-device-plugin-bluetooth.so): failed to
    load plugin: /usr/lib64/NetworkManager/libnm-device-plugin-bluetooth.so:
    undefined symbol: nm_bluez5_dun_cleanup
2014-11-12 16:15:20 +01:00
Thomas Haller 66b05c94c0 platform: assert against expected lifetime values of NMPlatformIPAddress
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-12 15:58:47 +01:00
Jiří Klimeš 0391c8b161 trivial: fix description of route-metric 2014-11-12 15:30:54 +01:00
Jiří Klimeš a928ce89ef clients: only handle secret requests for connection being explicitly activated
When a connection is being activated, nmcli could ask for secrets for another
connection, which might confuse users. We check the request now and only ask
for secrets of connection being activated.

Test case:
$ nmcli con up my-ethernet0
Passwords or encryption keys are required to access the wireless network 'Red Hat'.
Warning: password for '802-1x.identity' not given in 'passwd-file' and nmcli cannot ask without '--ask' option.
2014-11-12 13:41:49 +01:00
Thomas Haller dcb25a37a5 glib-compat: sync local definition of g_clear_pointer() with upstream glib and remove atomic operations
Upstream glib changed g_clear_pointer() not to use atomic functions.
Update or local definition to b1dd594a22e3499caafdeccd7fa223a032b9e177
glib/gmem.h (glib 2.41.3).

(fixup whitespace to match our style).

See also the related bug https://bugzilla.gnome.org/show_bug.cgi?id=733969
from glib.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-12 11:11:41 +01:00
Dan Williams 12f2f09e55 core: remove unused variable 2014-11-11 17:28:50 -06:00
Dan Williams 38b6037f33 vpn: update DefaultRouteManager before sending state change signal
The DRM now affects DNS too, since it determines the "best" IPv4
and IPv6 configs based on it's idea of the default route.  The
Policy is also still updating DNS from a state-change handler for
VPN connections.

This led to a situation where the Policy would remove the VPN's
IP config from the DNS manager in vpn_connection_deactivated() and
call update_ip4_dns(), whereupon get_best_ip4_config()  returned
the just-removed VPN IPv4 config as "best" because the VPN connection
hadn't yet told the DefaultRouteManager to remove it.

Which meant VPN nameservers stuck around in resolv.conf for a long
time after the VPN was disconnected.

Fixes: a39a3ae4cd
2014-11-11 16:14:47 -06:00
Dan Winship b27f87c714 tui: fix generated new connection names
Now that "i" is being used in the first loop over all connections, we
need to reset it before using it again in the loop to find an
available name.
2014-11-11 16:44:27 -05:00
Thomas Haller 900763ce0f dhcp: fix adapter for sd logging macros to show file location
Previously we were logging:
   <debug> [1415715440.639086] [__FILE__:__LINE__] client_set_lease_timeouts(): DHCP CLIENT (0xcf221f86): T1 expires in 11h 59min 53.566147s

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-11 22:40:25 +01:00
Jiří Klimeš 142dbf213e cli: show gateway as a separate item in active connection data (bgo #739958)
Example (for active connection ethernet-13)
$ nmcli -f active con show ethernet-13
...
IP4.ADDRESS[1]:                         10.34.25.205/23
IP4.GATEWAY:                            10.34.25.254
IP4.ROUTE[1]:                           dst = 10.38.5.26/32, nh = 0.0.0.0, mt = 20
...

https://bugzilla.gnome.org/show_bug.cgi?id=739958
2014-11-11 17:15:03 +01:00
Thomas Haller f2097ca482 keyfile: don't assert when parsing invalid prefix
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-11 16:09:08 +01:00
Thomas Haller 1e8b681d4f man: add manual page for nmtui(1)
https://bugzilla.gnome.org/show_bug.cgi?id=739710

Branch: th/bgo739710_man_nmtui
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-11 16:01:38 +01:00
Thomas Haller 75a0ac080f core: fix integer type of mtu variable
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-11 13:27:33 +01:00
Thomas Haller 714f50dafc core: don't pass NULL for "%s" format to g_message
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-11 12:52:04 +01:00
Thomas Haller 5f017e96b3 device: fix fetching the IPv6 default route for assumed devices
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-11 12:21:14 +01:00
Jiří Klimeš b75dfc62e8 cli: fix nmcli timeout when disconnecting a device
$ nmcli dev disconnect nm-bond
Error: Timeout 10 sec expired.

When a software device is disconnected, it will be removed. And it may not go
to NM_DEVICE_STATE_DISCONNECTED state before that. So we need to listen to
"device-removed" signal.

Fixes:Beaker:test_log-NetworkManager_Test189_bond_activate
2014-11-10 17:22:52 +01:00
Lubomir Rintel a14bc5f67c dhcp-manager: Keep size of PID consistent
Things explode on i386 when marshalling a 32-bit value when a 64-bit one is
expected:

  Program received signal SIGSEGV, Segmentation fault.
  __memset_sse2 () at ../sysdeps/i386/i686/multiarch/memset-sse2.S:242
  242		movdqu	%xmm0, (%edx)
  Missing separate debuginfos, use: debuginfo-install nss-mdns-0.10-15.fc21.i686
  (gdb) bt
  #0  0xffffffff in __memset_sse2 () at ../sysdeps/i386/i686/multiarch/memset-sse2.S:242
  #1  0xffffffff in g_hash_table_remove_all_nodes (__len=<optimized out>, __ch=0, __dest=<optimized out>)
      at /usr/include/bits/string3.h:84
  #2  0xffffffff in g_hash_table_remove_all_nodes (hash_table=hash_table@entry=0x82ee250<error reading variable: Cannot access memory at address 0x8dbaacd6>, notify=notify@entry=1) at ghash.c:481
  #3  0xffffffff in g_hash_table_unref (hash_table=0x82ee250<error reading variable: Cannot access memory at address 0x8dbaacd6>) at ghash.c:1042
  #4  0xffffffff in _g_type_boxed_free (type=136861824, value=0x82ee250) at gtype.c:4262
  #5  0xffffffff in boxed_proxy_value_free (value=0xbfffe8ec) at gboxed.c:209
  #6  0xffffffff in g_value_unset (value=value@entry=0xbfffe8ec) at gvalue.c:272
  #7  0xffffffff in g_signal_emit_valist (instance=instance@entry=0x82492b8, signal_id=signal_id@entry=125, detail=detail@entry=0, var_args=<optimized out>, var_args@entry=0xbfffea4c "\030\342.\bL#") at gsignal.c:3338
  #8  0xffffffff in g_signal_emit (instance=0x82492b8, signal_id=125, detail=0) at gsignal.c:3365
  #9  0x0809c05d in handle_event (proxy=0xb5d012e8 [DBusGProxy], options=0x82eb640 = {...}, user_data=0x82492b8)
      at dhcp-manager/nm-dhcp-listener.c:146
  #10 0xffffffff in g_cclosure_marshal_VOID__BOXED (closure=0x82bf270, return_value=0x0, n_param_values=2, param_values=0x82c60c0, invocation_hint=0xbfffec68, marshal_data=0x0) at gmarshal.c:1120
  #11 0xffffffff in marshal_dbus_message_to_g_marshaller () at /lib/libdbus-glib-1.so.2
  #15 0xffffffff in <emit signal received:org-freedesktop-nm_dhcp_client-Event on instance 0xb5d012e8 [DBusGProxy]> (instance=0xb5d012e8, signal_id=19, detail=915) at gsignal.c:3365
      #12 0xffffffff in g_closure_invoke (closure=0x82bf270, return_value=return_value@entry=0x0, n_param_values=n_param_values@entry=3, param_values=param_values@entry=0xbfffecc0, invocation_hint=invocation_hint@entry=0xbfffec68) at gclosure.c:768
      #13 0xffffffff in signal_emit_unlocked_R (node=node@entry=0x8263660, detail=detail@entry=915, instance=0xb5d012e8, emission_return=emission_return@entry=0x0, instance_and_params=0xbfffecc0) at gsignal.c:3553
      #14 0xffffffff in g_signal_emit_valist (instance=instance@entry=0xb5d012e8, signal_id=signal_id@entry=19, detail=detail@entry=915, var_args=0xbfffee34 "\340\370.\b\004",
      var_args@entry=0xbfffee2c "\340\370.\b\300\303/\b\340\370.\b\004") at gsignal.c:3309
  #16 0xffffffff in dbus_g_proxy_manager_filter () at /lib/libdbus-glib-1.so.2
  #17 0xffffffff in dbus_connection_dispatch () at /lib/libdbus-1.so.3
  #18 0xffffffff in message_queue_dispatch () at /lib/libdbus-glib-1.so.2
  #19 0xffffffff in g_main_context_dispatch (context=0x8246720) at gmain.c:3111
  #20 0xffffffff in g_main_context_dispatch (context=context@entry=0x8246720) at gmain.c:3710
  #21 0xffffffff in g_main_context_iterate (context=0x8246720, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3781
  #22 0xffffffff in g_main_loop_run (loop=0x8246798) at gmain.c:3975
  #23 0x08070c09 in main (argc=1, argv=0xbffff2b4) at main.c:479
  (gdb)

PIDs use native word width, a gint seems more suitable than gint32 or gint64.

https://bugzilla.gnome.org/show_bug.cgi?id=739861
2014-11-10 12:58:42 +01:00
Lubomir Rintel ba7f17a02b libnm: Fix type mismatch in test
Causes the info->remaining to be counted incorrectly possibly resulting in
g_main_loop_quit() being called twice:

  Program received signal SIGSEGV, Segmentation fault.
  0x00007ffff5a03155 in g_mutex_lock (mutex=0x7ffff7b764b4) at gthread-posix.c:1331
  1331	  if G_UNLIKELY (g_atomic_int_add (&mutex->i[0], 1) != 0)
  Missing separate debuginfos, use: debuginfo-install libgcc-4.9.2-1.fc21.x86_64 libgudev1-216-8.fc21.x86_64 libselinux-2.3-5.fc21.x86_64 libuuid-2.25.2-1.fc21.x86_64 ncurses-libs-5.9-16.20140323.fc21.x86_64 nspr-4.10.7-1.fc21.x86_64 nss-3.17.2-1.fc21.x86_64 nss-softokn-3.17.2-1.fc21.x86_64 nss-softokn-freebl-3.17.2-1.fc21.x86_64 nss-util-3.17.2-1.fc21.x86_64 sqlite-3.8.7-1.fc21.x86_64 systemd-libs-216-8.fc21.x86_64
  (gdb) bt
  #0  0x00007ffff5a03155 in g_mutex_lock (mutex=0x7ffff7b764b4) at gthread-posix.c:1331
  #1  0x00007ffff59bf258 in g_main_loop_quit (loop=0x7fffffffd130) at gmain.c:4000
  #5  0x00007ffff5edc3bf in <emit signal notify:active-connection on instance 0x5555557bd180 [NMDeviceVlan]> (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3365
      #2  0x00007ffff5ec1d35 in g_closure_invoke (closure=0x5555557b3da0, return_value=return_value@entry=0x0, n_param_values=2, param_values=param_values@entry=0x7fffffffd760, invocation_hint=invocation_hint@entry=0x7fffffffd700) at gclosure.c:768
      #3  0x00007ffff5ed3a52 in signal_emit_unlocked_R (node=node@entry=0x555555787040, detail=detail@entry=341, instance=instance@entry=0x5555557bd180, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffffd760) at gsignal.c:3553
      #4  0x00007ffff5edc191 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fffffffd8f0) at gsignal.c:3309
  #6  0x00007ffff5ec6465 in g_object_dispatch_properties_changed (object=0x7ffff7b764b4, n_pspecs=1434087776, pspecs=0x5555557ba880) at gobject.c:1056
  #7  0x00007ffff5ec88c1 in g_object_notify (pspec=<optimized out>, object=0x5555557bd180 [NMDeviceVlan])
      at gobject.c:1149
  #8  0x00007ffff5ec88c1 in g_object_notify (object=0x5555557bd180 [NMDeviceVlan], property_name=property_name@entry=0x7ffff7b772f6 "active-connection") at gobject.c:1197
  #9  0x00007ffff7ae57d3 in deferred_notify_cb (data=<optimized out>) at nm-object.c:246
  #10 0x00007ffff59beafb in g_main_context_dispatch (context=0x555555784ac0) at gmain.c:3111
  #11 0x00007ffff59beafb in g_main_context_dispatch (context=context@entry=0x555555784ac0) at gmain.c:3710
  #12 0x00007ffff59bee98 in g_main_context_iterate (context=0x555555784ac0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3781
  #13 0x00007ffff59bf1c2 in g_main_loop_run (loop=0x5555557699e0) at gmain.c:3975
  #14 0x000055555555811d in test_activate_virtual () at test-nm-client.c:1103
  #15 0x00007ffff59e4243 in g_test_run_suite_internal (tc=0x555555769a30) at gtestutils.c:2059
  #16 0x00007ffff59e4243 in g_test_run_suite_internal (suite=suite@entry=0x555555766640, path=path@entry=0x7ffff5a6355e "") at gtestutils.c:2120
  #17 0x00007ffff59e4412 in g_test_run_suite_internal (suite=suite@entry=0x555555766620, path=<optimized out>,
      path@entry=0x7ffff5a6355e "") at gtestutils.c:2131
  #18 0x00007ffff59e477b in g_test_run_suite (suite=0x555555766620) at gtestutils.c:2184
  #19 0x00007ffff59e47b1 in g_test_run () at gtestutils.c:1488
  #20 0x0000555555556c01 in main (argc=1, argv=0x7fffffffe028) at test-nm-client.c:1189

https://bugzilla.gnome.org/show_bug.cgi?id=739861
2014-11-10 12:58:36 +01:00
Thomas Haller ee0c1cf0bd policy: fix using wrong loop counter in _platform_route_sync_flush()
Fixes: e8824f6a52
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-10 12:30:39 +01:00
Dan Williams 14537c71d8 libnm-core: emit added/removed signals before property change notifications
Because internal objects do some processing/setup in the various
_added class signal handlers, they need to be emitted before
property change notifications.  Otherwise it leads to situations
where external objects that listen to NMClient property changes
will be called before internal processing has been completed.

Specifically, NMRemoteSettings uses connection_added() to check
connection visibility and assign the new connection to one of
two internal arrays.  If a client got a property notification
for NMClient::connections before NMRemoteSettings can process
the new connection, then nm_client_get_connections() will
return an empty array because NMRemoteSettings hasn't had the
chance to add the new connection to priv->visible yet, which
is done in NMRemoteSettings::connection_added().

Fixes:Beaker:NetworkManager_Test240_nmtui_general_realtime_refresh_edit_screen
2014-11-07 16:58:43 -06:00
Thomas Haller dde8e703f8 libnm: make dispose() of NMClient reentrant
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-07 23:08:18 +01:00
Dan Winship a1a338f9b0 libnm: fix a crash after unreffing NMClient
Make NMClient disconnect from the NMManager and NMRemoteSettings
signals when disposing, in case they outlive the NMClient (which
shouldn't happen, but...)
2014-11-07 17:00:39 -05:00
Dan Williams a5eb556d8c dhcp: demote DHCP client registration message to 'debug' level
Was supposed to be that level originally.
2014-11-07 14:51:50 -06:00
Thomas Haller 1f61cb82de po/test: add contrib/rpm directory to POTFILES.skip
Add contrib/fedora/rpm/ directory to POTFILES.skip.
Otherwise, after building an RPM, make check would fail
due to the source files from the rpmbuild.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-07 21:50:43 +01:00
Dan Winship 2728b57240 docs: fix libnm docs out-of-tree build 2014-11-07 15:46:46 -05:00
Thomas Haller b1e26735a0 contrib/rpm: add option to only building SRPM
Set environment variable BUILDTYPE=SRPM or call
`build_clean.sh --srpm`.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-07 21:31:12 +01:00
Dan Winship 3e3e54a56c cli: fix an activation bug
Add a missing g_clear_error() that, for circuitous reasons, made
trying to activate a virtual connection fail silently.
2014-11-07 13:58:01 -05:00
Dan Williams 289f788158 merge: add 'configure-and-quit' option (rh #1083683) (rh #863515)
When initial configuration is complete, spawns helpers to preserve
DHCP and RA addresses on interfaces and quits the main NM process.
2014-11-07 12:20:43 -06:00
Dan Williams 5149fd120d iface-helper: add nm-iface-helper for dynamic configure-then-quit support
When quitting, the Manager asks each device to spawn the interface helper,
which persists and manages dynamic address on the interface after NetworkManager
is gone.  If the dynamic address cannot be maintaned, the helper quits and
the interface's address may be removed when their lifetime runs out.

To keep the helper as simple as possible, NetworkManager passes most of the
configuration on the command-line, including some properties of the device's
current state, which are necessary for the helper to maintain DHCP leases
or IPv6 SLAAC addresses.
2014-11-07 12:18:33 -06:00
Jiří Klimeš 9ff8c01d4a man: document 'configure-and-quit' configuration option 2014-11-07 12:18:33 -06:00
Dan Williams a01e2ff91d core: add option to quit when startup is complete (rh #863515) (rh #1083683)
Cloud setups often have a never-changing setup and since every cycle counts,
they don't really want a management process running in the background after
network setup is complete.  Since it's likely a VM, it's not like links
are going to go up/down very often.

Add a new "configure-quit=true/false" config option which, when set to true,
will quit NetworkManager after startup and initial configuration is complete.
2014-11-07 12:18:33 -06:00
Dan Williams 7df18cba5b core: add nm_utils_ip4_property_path() 2014-11-07 12:18:33 -06:00
Dan Williams 49cac9f32f dhcp: track last IPv4 address on start for renewal
Really only used by systemd because it doesn't have as good lease
handling, but it's also necessary if we switch DHCP clients mid-stream
(which we'll be doing later) since the new DHCP client won't
have a lease file for the current IP address, and thus has nowhere
to pull the current IP address from to request the same address
from the DHCP server.
2014-11-07 12:18:33 -06:00
Dan Williams 034917e129 dhcp: preserve hostname for later use 2014-11-07 12:18:33 -06:00
Dan Williams e43174f368 dhcp: preserve DHCPv4 client ID for later use
If we can, read the existing client ID from the leasefile and preserve
it for later use.
2014-11-07 12:18:32 -06:00
Dan Williams 318a8c2d72 dhcp: move client-specific knowledge out of the manager 2014-11-07 12:18:32 -06:00
Dan Williams 0b98dc4387 dhcp: move D-Bus DHCP listener into separate class
This simplifies the manager and ensures that only the clients
that use D-Bus-based DHCP helpers need to care about them.
2014-11-07 12:18:32 -06:00