Commit Graph

15047 Commits

Author SHA1 Message Date
Thomas Haller
fe5c51726f core: fix memleak releasing priv->path in NMIP4Config and NMIP6Config 2015-01-29 14:59:42 +01:00
Thomas Haller
c4e197d064 libnm: fix memleak in nm_utils_hwaddr_canonical() 2015-01-29 14:59:42 +01:00
Thomas Haller
8396c58167 core: fix memory leak in nm_properties_changed_signal_add_property()
valgrind complains (rightly):

    ==7702== 15 bytes in 2 blocks are definitely lost in loss record 411 of 6,278
    ==7702==    at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==7702==    by 0x8151E6E: g_malloc (gmem.c:104)
    ==7702==    by 0x816972E: g_strdup (gstrfuncs.c:364)
    ==7702==    by 0x1D6671: nm_properties_changed_signal_add_property (nm-properties-changed-signal.c:235)
    ==7702==    by 0x1AF2D5: nm_dbus_manager_register_exported_type (nm-dbus-manager.c:867)
    ==7702==    by 0x7EE0D3D: g_type_class_ref (gtype.c:2220)
    ==7702==    by 0x7EC9A78: g_object_new_valist (gobject.c:1928)
    ==7702==    by 0x7EC9C10: g_object_new (gobject.c:1559)
    ==7702==    by 0x14A5FC: new_link (nm-device-bridge.c:482)
    ==7702==    by 0x1CF8FD: platform_link_cb (nm-manager.c:2154)
    ==7702==    by 0x988FD8B: ffi_call_unix64 (unix64.S:76)
    ==7702==    by 0x988F6BB: ffi_call (ffi64.c:522)
2015-01-29 14:58:18 +01:00
Dan Winship
3debf80d82 libnm-core: fix docs typo 2015-01-29 07:01:41 -05:00
Lubomir Rintel
6771f836ce ip6-config: remove the link-local address on address flush
If it stays after device dispose a connection is assumed.

https://bugzilla.redhat.com/show_bug.cgi?id=1184997
2015-01-28 17:53:25 +01:00
Thomas Haller
8eba28b9bd contrib/rpm: add 10-ibft-plugin.conf config file
Taken from rhel-7.1 package
2015-01-28 13:20:19 +01:00
Jiří Klimeš
0acdd0e1e3 libnm-core: coverity fix
var_deref_op: Dereferencing null pointer "property->param_spec".
2015-01-28 08:57:23 +01:00
Dan Winship
8bbda5cdff Currently if we have two paired bluetooth devices,
nm_device_disambiguate_names() will disambiguate them by their
hardware address. This is not very helpful, so detect this case and
use the Bluetooth device name instead.

This function is used by System Settings when showing the list of
network devices.

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

(Port of a libnm-gtk patch written by Ryan Lortie.)
2015-01-27 17:07:49 -05:00
Dan Winship
9d3e0cff9f contrib: fix NetworkManager.spec after the dispatcher script change 2015-01-27 16:45:27 -05:00
Thomas Haller
d4b257b613 NEWS: mention missing feature for 1.0 2015-01-27 21:46:01 +01:00
Dan Winship
8de1bec803 dispatcher: fix ifcfg-rh example dispatcher script (rh #1160013)
Routing table entries for a device get flushed when the device is
deactivated, but rules table entries don't, so we have to flush them
by hand.
2015-01-27 13:51:45 -05:00
Thomas Haller
11ccf949a3 core: fix nm_ip_config_intersect() only to remove addresses, routes and gateway
Otherwise we remove the DNS configuration during platform events.

Fixes: 557667df12
2015-01-26 17:56:03 +01:00
Thomas Haller
ddac52a61e device: schedule queued_ip_config_change() after constructing device
During queued_ip_config_change(), we eventually call update_ip_config()
and ip4_config_merge_and_apply(). These functions read the IP configuration
from platform and setup the private ip4_config instance.

Trigger this initialization after constructing the device to setup
the IP configuration.

Before, for unmanaged devices we would not call ip4_config_merge_and_apply()
until the first platform change event.

Note that in the worst case we do some unnecessary work due to this,
because queued_ip_config_change() must already be robust to be called
at any time.
2015-01-26 17:56:03 +01:00
Thomas Haller
aadef137b4 default-route: don't return devices without active connection as best_config() or best_device()
Since 0c136c1e2, we also track the default route for devices
without active-connection (unmanaged). They must not be returned
as best_config() or as best_device(), because the caller don't
expect unmanaged devices here.

This also gets closer to the original behavior of get_best_device()
before merging default-route-manager in d4417e3460
where we also would ignore devices depending on the state.

This fixes an assertion when having an interface unmanaged
and activating it externally:

    #0  0x00007ffff6806187 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
    #1  0x00007ffff6807dea in __GI_abort () at abort.c:89
    #2  0x00007ffff6c0aec5 in g_assertion_message (domain=domain@entry=0x5332d5 "NetworkManager", file=file@entry=0x539460 "nm-default-route-manager.c", line=line@entry=1056, func=func@entry=0x539920 <__FUNCTION__.28934> "_ipx_get_best_config", message=message@entry=0x8c9cb0 "assertion failed: (req)") at gtestutils.c:2356
    #3  0x00007ffff6c0af5a in g_assertion_message_expr (domain=domain@entry=0x5332d5 "NetworkManager", file=file@entry=0x539460 "nm-default-route-manager.c", line=line@entry=1056, func=func@entry=0x539920 <__FUNCTION__.28934> "_ipx_get_best_config", expr=expr@entry=0x53132f "req") at gtestutils.c:2371
    #4  0x000000000049a196 in _ipx_get_best_config (self=<optimized out>, ignore_never_default=ignore_never_default@entry=1, out_ip_iface=out_ip_iface@entry=0x7fffffffd310, out_ac=out_ac@entry=0x0, out_device=0x0, out_vpn=0x7fffffffd318, vtable=0x7a0a00 <vtable_ip4>, vtable=0x7a0a00 <vtable_ip4>) at nm-default-route-manager.c:1056
    #5  0x000000000049a3f6 in nm_default_route_manager_ip4_get_best_config (self=<optimized out>, ignore_never_default=ignore_never_default@entry=1, out_ip_iface=out_ip_iface@entry=0x7fffffffd310, out_ac=out_ac@entry=0x0, out_device=out_device@entry=0x0, out_vpn=out_vpn@entry=0x7fffffffd318) at nm-default-route-manager.c:1079
    #6  0x00000000004b7518 in update_ip4_dns (self=0x7ecac0 [NMPolicy], out_vpn=0x7fffffffd318, out_device=0x0, out_ac=0x0, out_ip_iface=0x7fffffffd310, ignore_never_default=1) at nm-policy.c:390
    #7  0x00000000004b7518 in update_ip4_dns (dns_mgr=0x8623a0 [NMDnsManager], policy=0x7ecac0 [NMPolicy]) at nm-policy.c:406
    #8  0x00000000004b99d5 in device_ip4_config_changed (device=0x8844b0 [NMDeviceEthernet], new_config=0x908aa0 [NMIP4Config], old_config=0x908aa0 [NMIP4Config], user_data=0x7ecac0) at nm-policy.c:1260
    #9  0x000000368f405d60 in ffi_call_unix64 () at /lib64/libffi.so.6
    #10 0x000000368f4057d1 in ffi_call () at /lib64/libffi.so.6
    #11 0x00007ffff6ee5b8c in g_cclosure_marshal_generic_va (closure=0x886a40, return_value=0x0, instance=0x8844b0, args_list=<optimized out>, marshal_data=0x0, n_params=2, param_types=0x87d3a0) at gclosure.c:1541
    #12 0x00007ffff6ee5144 in _g_closure_invoke_va (closure=closure@entry=0x886a40, return_value=return_value@entry=0x0, instance=instance@entry=0x8844b0, args=args@entry=0x7fffffffd810, n_params=<optimized out>, param_types=0x87d3a0) at gclosure.c:831
    #13 0x00007ffff6eff900 in g_signal_emit_valist (instance=0x8844b0, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffffd810) at gsignal.c:3201
    #14 0x00007ffff6f0014f in g_signal_emit (instance=instance@entry=0x8844b0, signal_id=<optimized out>, detail=detail@entry=0) at gsignal.c:3348
    #15 0x000000000044a1f4 in nm_device_set_ip4_config (self=self@entry=0x8844b0 [NMDeviceEthernet], new_config=new_config@entry=0x9089a0 [NMIP4Config], default_route_metric=default_route_metric@entry=100, commit=commit@entry=0, reason=reason@entry=0x0) at devices/nm-device.c:5866
    #16 0x000000000044a5af in ip4_config_merge_and_apply (self=self@entry=0x8844b0 [NMDeviceEthernet], config=config@entry=0x0, commit=commit@entry=0, out_reason=out_reason@entry=0x0) at devices/nm-device.c:3037
    #17 0x000000000044b4fd in update_ip_config (self=self@entry=0x8844b0 [NMDeviceEthernet], initial=initial@entry=0) at devices/nm-device.c:6617
    #18 0x000000000044bc39 in queued_ip_config_change (user_data=<optimized out>) at devices/nm-device.c:6688
    #19 0x00007ffff6be4e1b in g_main_context_dispatch (context=0x7ba3a0) at gmain.c:3122
    #20 0x00007ffff6be4e1b in g_main_context_dispatch (context=context@entry=0x7ba3a0) at gmain.c:3737
    #21 0x00007ffff6be51b0 in g_main_context_iterate (context=0x7ba3a0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3808
    #22 0x00007ffff6be54d2 in g_main_loop_run (loop=0x7ba460) at gmain.c:4002
    #23 0x000000000043291d in main (argc=1, argv=0x7fffffffdef8) at main.c:442

Fixes: da708059da
2015-01-26 17:54:58 +01:00
Thomas Haller
670eb57321 logging: assert that NMLogDomains compiles to a 64 bit enum
Enum types larger then the native 'int' type are undefined behavior
according to C standard. Assert that our compiler does the right thing.

  the expression that defines the value of an enumeration constant shall
  be an integer constant expression that has a value representable as an
  int
2015-01-26 16:30:27 +01:00
Thomas Haller
11b9562898 wifi: reduce logging level for find_active_ap()
find_active_ap() is called repeatedly, which significantly spams
WIFI:DEBUG logging. Downgrade those logging statements to TRACE
level.
2015-01-26 13:16:14 +01:00
Lubomir Rintel
5f50c0480a platform: merge: branch 'lr/ipv6-tokens' (rh #1104689)
This adds support for tokenised identifier use as specified in
draft-chown-6man-tokenised-ipv6-identifiers-02 Internet Draft,
enabled if there's a support for tokenised identifiers in libnl.

https://bugzilla.redhat.com/show_bug.cgi?id=1104689
https://tools.ietf.org/html/draft-chown-6man-tokenised-ipv6-identifiers-02
2015-01-26 13:05:35 +01:00
Lubomir Rintel
c2f9940470 platform: Add support for IPv6 tokenized identifiers on Linux 2015-01-26 13:05:06 +01:00
Lubomir Rintel
954a4b69b8 platform: refresh link cache when IPv6 tokenized identifier changes 2015-01-26 13:05:06 +01:00
Lubomir Rintel
b47d55b500 build: Check for tokenized identifier support in libnl-route-3 2015-01-26 13:05:06 +01:00
Lubomir Rintel
24e7ea7860 core: Use tokenized identifiers when constructing an address
We trigger a new solicitation upon seeing the new token. Kernel triggers one
too, but that one is of no use to us, since the advertisement might arrive sooner
than we learn about the token change.
2015-01-26 13:05:06 +01:00
Lubomir Rintel
db5603e615 platform: Add support for IPv6 tokenized identifiers 2015-01-26 13:05:06 +01:00
Lubomir Rintel
0d59984ce8 core: Add NMUtilsIPv6IfaceId to nm-types.h
We'd like to use it in nm-platform.h, but it's included by
NetworkManagerUtils.h before the declaration occurs.
2015-01-26 13:05:06 +01:00
Piotr Drąg
2d08e701a0 po: update Polish (pl) translation (bgo #743500)
https://bugzilla.gnome.org/show_bug.cgi?id=743500
2015-01-26 12:13:51 +01:00
Lubomir Rintel
477033b9ef manager: don't attempt to activate ipv6.method=shared connections
It would be nice if we supported IPv6 network sharing (maybe RFC 7278?),
but we don't. Let's not attempt to bring it up, it would fail in stage3.

https://bugzilla.redhat.com/show_bug.cgi?id=1183015
2015-01-25 21:29:07 +01:00
Thomas Haller
a6aacde469 build: replace echo -n by printf '%s' in configure.ac
https://bugzilla.gnome.org/show_bug.cgi?id=743480
2015-01-25 14:54:21 +01:00
Thomas Haller
0c136c1e2c core: merge branch 'th/bgo740443_device_ip_changes'
This branch brings three major changes:

- when routes or addresses are removed externally,
  remove those entiries also from what we want to configure
  on the interface. That way, on the next commit, we will
  not re-add those externally removed entries.
  -- at least not unless the entries reappear due to an
  event such as a new DHCP lease.

- the combined NMIPConfig object of a device which is also
  exposed via DBUS, will no longer contain those externally
  removed entries. The IP config really shows what is actually
  configured.

- for default-routes, no longer enforce the default route even
  on managed devices. Only during commit phases, we might re-add/
  remove a default route from a device, otherwise, pickup the
  default route (or its absence) as actually configured.

https://bugzilla.gnome.org/show_bug.cgi?id=740443
2015-01-24 18:27:35 +01:00
Thomas Haller
da708059da device: always pickup externally configured default routes for a device
Even more eagerly pickup external default routes from the device.
For assumed devices we already picked up the default route.

(a) For assumed devices we already did not enforce the default route at all.
Instead it was always picked up by from the actualy system
configuration. Note that this is the case for assumed-generated
connections and for assuming existing connections.
That means that when NM assumes a connection at startup, it will never
actively manage the default route on that interface. It will only react
on what is present.

(b) For managed devices that have by configuration no default route, still pick up
the default route. That means, that even a device that is managed and
never-default=yes, can have the default route -- if configured externally.

(c) Only during a commit phase (i.e. when we have new configuraiton to be
applied), we enforce the default route or its absence.

(d) During any IP change event from platform, we again pickup whatever
is present. That means if you remove the default route from a managed
interface, NM will not re-add it until anything triggers (c).

This also means, that during the commit phase, we add default routes as
'synced' to the default-route-manager, but the following event from platform,
will change the route entry immediately to 'non-synced'. That is
expected and correct.
2015-01-24 18:27:12 +01:00
Thomas Haller
557667df12 device: better accept external IP changes
When receiving IP changes via platform event, remove all missing
addresses and routes from our internal configurations (such as
wwan, vpn, dhcp).

The effect is that on the next commit, those addresses and routes will
not be re-added as they were explicitly removed by the user.

However on a new DHCP lease or similar events, the addresses will
be added anew.

Another important improvement is that the NMIPxConfig of the active
device reflects when addresses or routes get removed externally. Before
we would continue to expose those entires although they were not
actually configured on the device.

https://bugzilla.gnome.org/show_bug.cgi?id=740443
2015-01-24 18:27:12 +01:00
Thomas Haller
2c06449085 device: require a direct route for IPv6 gateway
In the IPv4 case, we check whether we have a direct route to the gateway
also by looking at the configured addresses/subnets. That is correct,
because every IPv4 address also implies a subnet route.

For IPv6, we explicitly add all subnet routes manually (noprefixroute),
hence, we have a direct route exactly if we have it in our list.
Regardless of the configured IPv6 prefixes.
2015-01-24 18:27:12 +01:00
Thomas Haller
4a83afd530 device: refactor ipx_config_merge_and_apply()
No functional change, but restructure code to make it clearer(?).
2015-01-24 18:27:12 +01:00
Thomas Haller
49d700e862 core: add intersect() functions to NMIP?Config 2015-01-24 18:27:12 +01:00
Thomas Haller
92d800b2e3 core: refactor subtract() functions in NMIP?Config
Factor out code of the nm_ip4_config_subtract() and
nm_ip6_config_subtract() functions. The code can be reused in the
following commit.
2015-01-24 18:27:12 +01:00
Thomas Haller
df9533d045 default-route: improve logging format for default route entries
The previous syntax (s/S for synced, n/N for never-default) is confusing.
Indicate 'never-default' by '0', vs. '1'.
Indicated synced/non-synced as '+sync' and '-sync'.
2015-01-24 18:27:12 +01:00
Dan Williams
091daaa60e vapi: add some missing device and setting types 2015-01-23 15:36:55 -06:00
Dan Winship
f0e74622cc team: fix teamd startup code (rh #1184923)
Since 03a5a85d, NMDeviceTeam was trying to use priv->teamd_pid to
decide whether a teamd_dbus_vanished() call indicated "teamd hasn't
been started yet" or "teamd was previously started and has now
exited". But this resulted in a race condition, where at startup, a
device could call g_dbus_watch_name(), then launch teamd (causing
teamd_pid to get set), and then have gdbus report that teamd hasn't
been started yet before the newly-launched teamd managed to grab the
bus name. Since teamd_pid would already be set when
teamd_dbus_vanished() was called, it would decide that this meant
"teamd was previously started and has now exited", so it would call
teamd_cleanup(), killing the just-started teamd process.

Fix this by having teamd_dbus_vanished() check priv->tdc instead,
which doesn't get set until after the first teamd_dbus_appeared()
call.
2015-01-23 10:05:20 -05:00
Lubomir Rintel
44e065359e dist: include manual page sources
Ommittes by mistake with an errorneous substitution.

https://mail.gnome.org/archives/networkmanager-list/2015-January/msg00066.html
2015-01-23 11:03:41 +01:00
Lubomir Rintel
799820f859 libnm: drop libdbus-glib from pkg-config file
libnm uses GIO DBus library instead.

https://mail.gnome.org/archives/networkmanager-list/2015-January/msg00065.html
2015-01-22 19:17:46 +01:00
Thomas Haller
8dce71be74 device: adjust default route metric for BRIDGE device type
We forgot to include the BRIDGE, so that bridge
devices got a default priority (route-metric) of 950
Add it between VLAN and MODEM type.

Also return a different metric for UNKNOWN
device types, but these priorities are not
actually expected.
2015-01-22 18:56:37 +01:00
Thomas Haller
7d2e43a455 core/trivial: fix documentation of nm_utils_uuid_generate_from_strings() 2015-01-22 14:03:37 +01:00
Dan Williams
3d25613327 merge: stop pppd before notifying ModemManager to disconnect (bgo #734347) 2015-01-21 18:36:48 -06:00
Aleksander Morgado
a6fedb1a26 wwan: consolidate format of log messages 2015-01-21 18:36:00 -06:00
Aleksander Morgado
fe090c34b7 wwan: wait for pppd to exit before relaying the port to ModemManager
ModemManager needs to have CLOCAL set in the TTY termios configuration, in order
to notify the kernel that modem control lines are not in effect (e.g. so that a
transition to LOW in the DCD input control line doesn't trigger a hangup in the
TTY).

pppd in the other hand, needs CLOCAL unset in order to have proper modem control
lines in effect during the PPP session. So, when pppd starts it will store the
original termios settings, and before exiting it will restore the original
settings in the TTY. In other words, if CLOCAL was set before launching pppd,
CLOCAL will be also set after pppd exits.

Now, in order for this sequence to work correctly, NetworkManager also needs to
make sure that ModemManager is notified about the disconnection only after pppd
has really finished re-configuring the TTY.

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

----------------------

Once the patch is applied, we will be making sure that ModemManager is only
notified about the disconnection AFTER pppd has fully exited:
    NetworkManager[27589]: <info>  (ttyUSB2): device state change: activated -> deactivating (reason 'user-requested') [100 110 39]
    Terminating on signal 15
    nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 10 / phase 'terminate'
    nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 8 / phase 'network'
    Connect time 0.3 minutes.
    Sent 56 bytes, received 0 bytes.
    nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 5 / phase 'establish'
    nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 11 / phase 'disconnect'
    Connection terminated.
    nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 1 / phase 'dead'
    nm-pppd-plugin-Message: nm-ppp-plugin: (nm_exit_notify): cleaning up
    NetworkManager[27589]: <warn>  pppd pid 27617 exited with error: pppd received a signal
    NetworkManager[27589]: <info>  (ttyUSB2): modem state changed, 'connected' --> 'disconnecting' (reason: user-requested)
    NetworkManager[27589]: <info>  (ttyUSB2): modem state changed, 'disconnecting' --> 'registered' (reason: user-requested)
    NetworkManager[27589]: <info>  (ttyUSB2) modem deactivation finished
    NetworkManager[27589]: <info>  (ttyUSB2): device state change: deactivating -> disconnected (reason 'user-requested') [110 30 39]
    NetworkManager[27589]: <info>  (ttyUSB2): deactivating device (reason 'user-requested') [39]
2015-01-21 18:36:00 -06:00
Aleksander Morgado
ec61601a22 wwan,modem: let disconnect() be an async operation 2015-01-21 18:36:00 -06:00
Aleksander Morgado
14f732e8df ppp-manager: new async stop() method to request stop and wait for it to complete
This method doesn't prevent the original logic in which the child process was
stopped when the last reference of the PPP manager was unref-ed.
2015-01-21 18:35:59 -06:00
Aleksander Morgado
f3efdbcdf2 device: new deactivate_async() method to be run during DEACTIVATING phase
This method isn't run if NM is quitting; so the deactivate() method still needs
to be implemented to handle sync disconnection requests.
2015-01-21 17:58:50 -06:00
Dan Williams
6bb0cffba3 merge: add support for Wi-Fi powersave (bgo #739084) 2015-01-21 17:28:12 -06:00
Mathieu Trudel-Lapierre
a428de8215 wifi: set wireless powersave for nl80211 devices when activated
Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>

(fixups and WEXT implementation by dcbw)
2015-01-21 14:31:14 -06:00
Dan Williams
c3e319266c cli: add support for wifi.powersave setting 2015-01-21 14:31:14 -06:00
Dan Williams
6a3531d02d ifcfg-rh: add Wi-Fi powersave support 2015-01-21 14:31:14 -06:00