Commit Graph

10071 Commits

Author SHA1 Message Date
Dan Williams
511f3dcef3 libnm-glib: convert NMDeviceWifi AccessPoints to a real property
Note that this will cause the nm_device_wifi_get_access_points() to
return hidden-SSID access point objects immediately, which it
previously did not do until added/removed signals were sent by
NetworkManager for a hidden SSID AP.  Some clients may not handle
this correctly, but given that they would have crashed when the
first hidden SSID AP was found anyway, they should just be fixed.
2014-01-23 17:34:12 -06:00
Dan Williams
4bf27b2e68 libnm-glib: add support for non-pseudo-property added/removed signals
With the addition of D-Bus properties for object-array properties in
NetworkManager core, libnm-glib can use these properties instead of
the pseudo-property stuff.  However, we need to maintain API and
provide individual added/removed signals for these properties, and
that requires diff-ing the new and old object arrays.  Add the
infrastructure for doing that.
2014-01-23 17:34:12 -06:00
Dan Williams
452f8232b7 api/settings: expose the ConnectionRemoved signal
Helps out bindings.
2014-01-23 17:34:12 -06:00
Dan Williams
3964d06b64 api/wimax: add Nsps (Network Service Providers) property
Helps out bindings.
2014-01-23 17:34:12 -06:00
Dan Williams
69fc0d7c87 api/settings: add Connections property
Helps out bindings.
2014-01-23 17:34:12 -06:00
Dan Williams
67676c65bf api/wifi: add GetAllAccessPoints() method
The original GetAccessPoints() method call never returned hidden SSID
access points.  That's useful though, and the new AccessPoints
property returns all of them too, so add this new method to return
all access points, including hidden SSID ones.
2014-01-23 17:34:12 -06:00
Dan Williams
a0c4483bdb api/wifi: add AccessPoints property
Helps other bindings.
2014-01-23 17:34:12 -06:00
Dan Williams
a59ccc4cbb api/core: add Devices property to the Manager 2014-01-23 17:34:12 -06:00
Dan Williams
b69e7c451e cli: handle hidden-SSID access points correctly 2014-01-23 17:34:11 -06:00
Dan Williams
e5045345df wifi: fix double-free of error when handling D-Bus scan request
The error passed into the function by the manager's auth request
logic should not be freed.
2014-01-23 17:26:12 -06:00
Dan Williams
d965348485 wifi: fix crash after "merge: remove at_console..." for wifi scan requests
Fix a crash caused by "merge: remove at_console..." when a scan request
comes in via the D-Bus interface.  This usage of the device "auth-request"
signal was missed the first time around.
2014-01-23 17:12:45 -06:00
Dan Williams
4b39267b9d merge: remove at_console from D-Bus permissions (bgo #707983) (rh #979416)
Remove at_console, ensuring that all necessary calls are protected by
PolicyKit authorization (which at_console is redundant with).  Allows
sessions that are not necessarily local (like SSH or remote desktop)
to talk to NetworkManager, subject to administrator PolicyKit rules.
2014-01-23 16:49:05 -06:00
Dan Williams
d000d1223f policy: allow inactive (remote/SSH) sessions to perform some actions (bgo #707983) (rh #979416)
This commit allows inactive sessions (typically SSH or remote desktop
logins) to modify their own connections, to modify the system hostname
with authorization, and to modify system connections with
authorization.

https://bugzilla.redhat.com/show_bug.cgi?id=979416
https://bugzilla.gnome.org/show_bug.cgi?id=707983
2014-01-23 16:48:19 -06:00
Dan Williams
7e0f94f0f5 dbus: kill at_console usage in permissions (bgo #707983) (rh #979416)
at_console permissions as implemented by D-Bus have some problems:

1) it is now fully redundant with PolicyKit and session tracking via
systemd/ConsoleKit

2) it uses a different mechanism than PolicyKit or systemd to determine
sessions and whether the user is on local or not (pam_console)

3) it was never widely implemented across so removing it
harmonizes D-Bus permissions on all supported distros

To that end, remove the at_console section of the D-Bus permissions,
and rely on session-tracking and PolicyKit to ensure operations are
locked down.

No changes are being made to PolicyKit or session-tracking, so any
operations denied by those mechanisms are still denied, and no
permissions are being relaxed.  Instead, this should allow remote
users who log in via remote desktop or SSH to inspect network state,
change connection parameters, and start/stop interfaces.  Obviously
if you are remote, you should not touch the interface which your
connection is using, but that concern shouldn't prevent all the other
nice stuff that you can do with NM.

https://bugzilla.gnome.org/show_bug.cgi?id=707983
https://bugzilla.redhat.com/show_bug.cgi?id=979416
2014-01-23 16:48:19 -06:00
Dan Williams
f0149b6372 core: enforce permissions for SetLogging
This was always protected by D-Bus policy permissions, but just to
be paranoid, ensure it's also protected by explicit checks on the UID.
2014-01-23 16:48:19 -06:00
Dan Williams
474b76134c sessions: fix return value handling for sd_uid_get_sessions() (bgo #707983)
This function returns the number of sessions found, but the return
value wasn't being correctly handled for errors.  Also fix the
require_active parameter value to be 100% clear about what NM wants.
2014-01-23 16:48:19 -06:00
Dan Williams
8ab8990938 settings: return error from GetConnectionByUuid() if caller not in ACL
While this function only returns the path of the requested connection
(the actual settings are always protected), callers that aren't in
the connection's ACL still probably shouldn't get that, if only to
be pedantic.
2014-01-23 16:48:19 -06:00
Dan Williams
29e00fde58 core: add PropertiesChanged signals to IP4 and IP6 config objects
Now that the objects get replaced when IP configuration changes
instead of being destroyed and a new one created, they need
PropertiesChanged signals.

(noticed as a result of auditing all exported D-Bus objects)
2014-01-23 16:48:04 -06:00
Dan Williams
32a001f526 core: allow custom IP address ranges for Shared connections (bgo #675973)
Given an IPv4 address and prefix for a shared config, figure out
the DHCP address range automatically.  To keep things simple we
allow a max of 252 addresses (not including network address,
broadcast address, and the hotspot) no matter what prefix you use,
so if the address is 10.0.10.1, you still only get a range of
10.0.10.2 -> 10.0.10.254.

But we also leave some addresses available above the host address
for static stuff, like we did before.  This is done on a sliding
scale from 0 to 8 addresses, where about 1/10th the number of
available addresses are reserved.

https://bugzilla.gnome.org/show_bug.cgi?id=675973
2014-01-23 16:21:01 -06:00
Dan Williams
13f4a00d4d core: only log about IPv6 Commit the first time
Since IPv6 configuration gets updated every time a router advertisement
comes in, it can lead NM to continuously logging:

NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IPv6 Commit) scheduled...
NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IPv6 Commit) started...
NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IPv6 Commit) complete.

that's annoying.  So after the initial configuration is done, make
subsequent IPv6 Commit log messages debug instead of info.
2014-01-23 16:06:01 -06:00
Dan Williams
6e8345d89b core: don't disable IPv6 when assuming connections (rh #1052157)
Don't disable IPv6 when we're about to assume a connection that may well
have IPv6 already configured on the interface, which removes all addresses
and routes from the interface and generally Breaks Stuff.
2014-01-23 16:05:44 -06:00
Dan Winship
38ef82d015 core: various fixes to autoconnect retry handling (rh #1029480) 2014-01-23 15:16:24 -05:00
Dan Winship
e2ab0eaf75 devices: when disconnecting master, propagate reason to the slaves
When disconnecting a master device, propagate its NMDeviceStateReason
to the slaves. That way, if the reason is USER_REQUESTED, then the
slaves will be blocked from re-autoconnecting as well.
2014-01-23 15:16:09 -05:00
Dan Winship
26cfe9f5ce core: fix master deactivation
NMActiveConnection was categorizing all deactivation of master
connections as "failure", and NMActRequest was deactivating all of the
master's slaves with REASON_DEPENDENCY_FAILED no matter what the real
reason was.

In fact, NMActiveConnection only needs to handle the cases where the
master fails before enslaving the device; any failure after that point
will be caught by existing master/slave checks in NMDevice. So update
the code accordingly (and remove the master_failed code from
NMVpnConnection entirely, since no master supports having VPN slaves).
2014-01-23 15:16:09 -05:00
Dan Winship
072dca8ad0 core: properly deactivate active connections that fail early
If a master activation failed early (eg, because the virtual device
could not be created), then the slaves were not being notified of the
failure. Fix that.
2014-01-23 15:16:09 -05:00
Dan Winship
5cac8dad79 devices: add :master property
Add a property to NMDevice that can be used to tell whether the device
is enslaved, and if so what its master is.

This is currently internal-only, but it could be exported later
perhaps.
2014-01-23 15:16:09 -05:00
Dan Winship
12ee696d83 core: add some autoconnect debugging messages 2014-01-23 15:16:09 -05:00
Dan Winship
979b8920b4 core: move virtual device autoconnect tracking bits out of NMManager
Virtual devices may be created and destroyed, but we need to keep
their autoconnect state across that. Previously this was handled by
NMManager, but it really belongs with the other autoconnect tracking
in NMPolicy and NMSettingsConnection.

This also fixes a bug where NMPolicy would sometimes decide to
autoactivate a virtual device connection which NMManager would then
have to cancel.
2014-01-23 15:16:09 -05:00
Dan Winship
971167e2a8 core: disable auto-re-connect of intentionally-disconnected connection
If a connection is disconnected by the user, don't allow it to
autoconnect again immediately after.
2014-01-23 15:15:00 -05:00
Dan Winship
c4fc72c795 devices: start using the DEACTIVATING state
When a device is disconnected by the user (as opposed to due to
network or hardware error, etc), set it first to DEACTIVATING, which
does nothing but queue a transition to disconnected. This lets other
parts of NM observe the device when it is about-to-disconnect, but
still has an associated connection.
2014-01-23 15:15:00 -05:00
Dan Winship
eceb613f4c core: don't retry connection with no secrets after timeout
NMPolicy was resetting the "don't autoconnect because we don't have
secrets" state on a connection when the autoconnect-retries timer
timed out, but this doesn't make sense, since the timeout doesn't
change the fact that there are no secrets.

https://bugzilla.gnome.org/show_bug.cgi?id=670631
2014-01-23 15:15:00 -05:00
Dan Winship
4e74670b47 core: clarify clearing of autoconnect-blocked state
NMPolicy was clearing the autoconnect-blocked state on a connection
any time a device with that connection changed state. This happened to
basically do the right thing, but it would be clearer if we only reset
the state after successfully getting past the NEED_AUTH stage.
2014-01-23 15:15:00 -05:00
Dan Winship
828c316080 core: simplify autoconnect retry handling
Move some of the can-autoconnect tracking into NMSettingsConnection
rather than having NMPolicy track it using object data.
2014-01-23 15:15:00 -05:00
Dan Winship
3d30ff01ef core: remove useless NMSettings::connections-loaded signal
NMSettings (and NMConnectionProvider) had a signal to indicate when it
had loaded the connections, but in reality this always happened before
nm_settings_new() returned (as a side effect of calling
unmanaged_specs_changed()) and so no one else would ever actually see
the signal. So just kill it.
2014-01-23 15:14:49 -05:00
Dan Winship
6c332f33aa tui: add a (void) cast to avoid a coverity warning 2014-01-23 15:04:08 -05:00
Dan Williams
a9f1d12178 dhcp: don't add an IPv6 address if one wasn't given (rh #1048046)
In information-only mode (where RA is providing addresses), DHCPv6
may not give an address.  NetworkManager was adding a blank one
anyway, which is invalid.  Don't do that.
2014-01-23 12:16:02 -06:00
Jiří Klimeš
e809990405 Merge changes for 'nmcli connection show' (rh #997999)
The syntax changes to:
nmcli con show [--active] [id | uuid | path | apath] <ID> ...

https://bugzilla.redhat.com/show_bug.cgi?id=997999
2014-01-23 13:53:56 +01:00
Thomas Haller
b5e2a45266 cli/bash-completion: update completion for new nmcli connection show syntax
As nmcli changes the syntax for the 'connection show' command,
this patch for bash completion also breaks several cases when
completing for an old nmcli command.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-23 13:46:46 +01:00
Jiří Klimeš
0c4d2b2b9e cli: allow processing all connections with the same name
When there are multiple connection profiles of the same name, we used to take
and process only the first one.
We change the behaviour to process all the connections now in these commands:

nmcli connection show   <duplicated name>
nmcli connection down   <duplicated name>
nmcli connection delete <duplicated name>
2014-01-23 13:46:46 +01:00
Jiří Klimeš
26f8889286 cli: consolidate active and configured connections (rh #997999)
Handle connection profiles in a single 'show' command instead of 'show active'
and 'show configured'.

nmcli con show [--active] [[id|uuid|path|apath] <bla>]

nmcli con show           : display all connection profiles
nmcli con show --active  : only display active connection profiles
                           (filters out inactive profiles)

nmcli con show myeth     : display details of "myeth" profile, and also active
                           connection info (if the profile is active)
nmcli -f profile con show myeth : only display "myeth"'s static configuration
nmcli -f active  con show myeth : only display active details of "myeth"
nmcli -f connection.id,ipv4,general con show myeth
                                          : display "connection.id"a property
                                            "ipv4" setting and "GENERAL" group
                                            of active data

https://bugzilla.redhat.com/show_bug.cgi?id=997999
2014-01-23 13:45:46 +01:00
Jiří Klimeš
85272df6eb examples: update get_ips.py python example for DNS information 2014-01-23 12:56:45 +01:00
Jiří Klimeš
8ee4f58e9e libnm-glib: additional functions to get nameservers (rh #1056146)
This commit adds two new functions for introspection users to get nameservers:
guint32 nm_ip6_config_get_num_nameservers (NMIP6Config *config)
const struct in6_addr *nm_ip6_config_get_nameserver (NMIP6Config *config, guint32 idx)
The existing function can't be used due to GObject introspection limitations:
const GSList *nm_ip6_config_get_nameservers (NMIP6Config *config);

https://bugzilla.redhat.com/show_bug.cgi?id=1056146
2014-01-23 12:53:18 +01:00
Dan Winship
041f449a91 platform: fix linux nm_platform_link_get_physical_port_id() (rh #804527)
It was reading the wrong property name
2014-01-22 13:20:18 -05:00
Jiří Klimeš
0ff286adcf man: add a Team example to nmcli-examples manual page 2014-01-22 17:53:28 +01:00
Jiří Klimeš
3391fa810c libnm-glib: export missing get_gateway() and get_searches() functions
They were added by db9b7e10ac commit.
2014-01-22 15:52:19 +01:00
Dan Winship
1d42962e7f logging: fix "nmcli gen log level FOO"
The change to per-domain log levels means that when setting just the
level, we need to re-set the log level for each domain (since it's the
"logging" bit array that actually determines what gets logged).
nm_logging_setup() was dealing correctly with domains=NULL, but not
domains="" (which is what happens when it is invoked with only a level
via D-Bus), so doing "nmcli gen log level DEBUG" would change the
"default" log level, but leave all of the domains still at their
previous level:

danw@laptop:NetworkManager> nmcli g log
LEVEL  DOMAINS
INFO   PLATFORM,RFKILL,ETHER,WIFI,BT,MB,DHCP4,DHCP6,PPP,IP4,IP6...

danw@laptop:NetworkManager> nmcli g log level DEBUG
danw@laptop:NetworkManager> nmcli g log
LEVEL  DOMAINS
DEBUG  PLATFORM:INFO,RFKILL:INFO,ETHER:INFO,WIFI:INFO,BT:INFO...
2014-01-22 09:48:42 -05:00
Thomas Haller
2b87dbb2a9 core: cleanup data types for nm_platform_sysctl_get_int32()
The sysctl values in the kernel (for those values for which
nm_platform_sysctl_get_uint() is currently used) are defined as s32.
Change nm_platform_sysctl_get_uint() to nm_platform_sysctl_get_int32()
and ensure, that a matching integer type is used thoroughly.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-22 12:23:58 +01:00
Thomas Haller
63075d98a5 core: add nm_utils_ascii_str_to_int64() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-22 12:12:02 +01:00
Michael Schaller
6b5d31954f wired: only request new secrets during the inital connection
This ports commit 30fe3e1876
for wifi to ethernet.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-21 21:01:56 +01:00
Scott Shambarger
31fe84e467 core: Add host route for DHCP4 server if outside assigned subnet (bgo #721767)
Some ISP's provide leases from central servers that are on different
subnets that the address offered.  If the host does not configure the
interface as the default route, the dhcp server may not be reachable
via unicast, and a host specific route is needed.

https://bugzilla.gnome.org/show_bug.cgi?id=721767
https://bugzilla.redhat.com/show_bug.cgi?id=983325

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-21 21:01:56 +01:00