Commit Graph

8982 Commits

Author SHA1 Message Date
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
Scott Shambarger
2b461bfa19 core: set classful prefix length for DHCP4 static routes (bgo #721771)
Follow RFC 3442 to set network prefix based on address class.
However, still uses host routing if the target address is not a
network address (ie host part not zero).

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-21 21:01:56 +01:00
Thomas Haller
240c92ddb5 libnm-util: add assert to nm_utils_ip4_netmask_to_prefix
g_return if the user provides an invalid netmask.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-21 21:01:56 +01:00
Dan Williams
efd0e2a589 core: respect connection permissions for internal activation requests
Similar to "core: respect connection user permissions for activation/deactivation",
if a master connection is being activated because a slave connection requested
it, ensure that the user requesting the master connection is allowed to
activate it.
2014-01-21 13:41:18 -06:00
Dan Williams
eb8bc5396e core: respect connection user permissions for activation/deactivation
This appears to be a bug since the original 0.9.0 release when
connection permissions were implemented.

If all the following are true:
- the user is local (as determined by systemd or ConsoleKit)
- the user has been given the NETWORK_CONTROL PolicyKit permission
- the user is not listed in the connection's permissions
- the user knows the D-Bus object path of a connection which they
have no permissions for

then that user may activate/deactivate connections that are not
visible to that user as determined by the connection permissions.
Fix that by ensuring that these operations check whether the user
has permission.

These operations are *not* affected, and have always checked user
permissions before allowing the operation:
- modifying any connection details
- requesting any secrets or passwords for the connection
- deleting the connection
2014-01-21 12:18:49 -06:00
Dan Williams
a52c3e2e5f libnm-util: fix trivial GOI copy & paste issue 2014-01-21 10:18:23 -06:00
Jiří Klimeš
6b19d530e8 cli: always get up-to-date dirty status 2014-01-21 16:39:43 +01:00
Jiří Klimeš
92939e6919 cli: fix crash when edited profile was removed by another client (rh #1011942)
Use g_weak_ref_get() that either returns an object with reference increment or
returns NULL.
That fixes the problem.  However, in the long run we should rework the editor
loop trying to merge that with GMainLoop, which could help for various issues.

https://bugzilla.redhat.com/show_bug.cgi?id=1011942
2014-01-21 16:36:00 +01:00
Thomas Haller
a16b7a8253 core: fix warning about pending action "autoactivate"
Fix the following warning:
  add_pending_action (2): 'autoactivate' already added

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-20 22:34:27 +01:00
Thomas Haller
40562b0aa5 trivial: rename field to give it a unique name
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-20 21:51:04 +01:00
Jiří Klimeš
07adfe4de4 cli: fix TAB-completion and 'goto' after saving connection
On 'save' we replace settings in the local connection, so we also need to
update stored setting pointers.
2014-01-20 17:38:11 +01:00
Dan Williams
f36bfd2039 trivial: remove stray '\' 2014-01-17 10:55:46 -06:00
Dan Williams
4478d86ea8 trivial: fix variable shadowing 2014-01-17 10:26:42 -06:00
Dan Winship
94c29932e2 tui: fix build 2014-01-16 14:54:39 -05:00
Thomas Haller
177c767320 core/platform: fix wrong calculation of address lifetime/preferred for kernel addresses
When receiving an IPv4/IPv6 address from the kernel, platform set the
timestamp to an invalid value before. The address timestamp must be set
to *now*, because the lifetime and preferred arguments are counting from
now.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-16 20:44:29 +01:00
Dan Winship
e9fe63cdaa trivial: annotate/adjust some code to appease Coverity 2014-01-16 14:23:45 -05:00
Dan Winship
a7249cc619 core: fix a possible crash if given an empty IP4 config
update_system_hostname() was bailing out if (there is no IP4 config or
the IP4 config has no addresses) AND (there is no IP6 config or the
IP6 config has no addresses), but it would then hit an assertion and
crash if there was a valid IP6 config along with an IP4 config with no
addresses. Fix that and get rid of some redundancy.

Sort of pointed out by Coverity.
2014-01-16 14:23:45 -05:00
Jiří Klimeš
577d5ef324 libgsystem: update libgsystem to latest master
Fix for compilation with GLib 2.32.
2014-01-16 18:04:27 +01:00
Jiří Klimeš
68fe50ff3a examples: add an python example (using GI) getting device IPs 2014-01-16 17:37:16 +01:00
Jiří Klimeš
7ffbbae3a0 libnm-glib; fix introspection annotations so that <ipv6>.get_address() worked
Without the correct annotation, the functions didn't work correctly in Python
(causing segmentation fault).
2014-01-16 17:37:16 +01:00
Thomas Haller
e18da9f6ae libndp: update libndp
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-16 15:41:57 +01:00
Thomas Haller
bde2ba3371 gsystem: update libgsystem
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-16 15:41:26 +01:00
Dan Winship
86e14fd6a9 tui: various fixes
https://bugzilla.gnome.org/show_bug.cgi?id=720844
2014-01-16 09:19:07 -05:00
Dan Winship
46ef9029bc tui: fix activation of "new" Wi-Fi networks
When activating a never-before-used Wi-Fi network, we need to call
nm_client_add_and_activate_connection(), not
nm_client_activate_connection(). (We still pass a NULL connection,
since NM will attempt to auto-fill it for us, and will succeed as long
as it's not an 802.1x connection.)
2014-01-16 09:19:07 -05:00
Dan Winship
64cb43b3b2 tui: add nmt_newt_text_width()
We were using g_utf8_strlen() to measure strings for layout, but that
counts combining marks too, and also fails to deal with "fullwidth"
(ie, double-width) CJK characters.

Add a new utility function to do a better job of this (based on code
from vte), and use it everywhere.
2014-01-16 09:19:07 -05:00
Dan Winship
1d40b9f872 tui: implement deactivation in "nmtui connect" 2014-01-16 09:19:07 -05:00
Dan Winship
0fe46a5839 tui: reorganize "nmtui connect" code
Make NmtConnectConnectionList just a dumb connection list, and have
the actual connecting code be in nmtui-connect.c
2014-01-16 09:19:06 -05:00
Dan Winship
c0663e42d0 tui: correctly return errors from NmtSecretAgent 2014-01-16 09:19:06 -05:00
Dan Winship
4c0ac46a99 libnm-util: add a missing GValue transform needed by nmtui 2014-01-16 09:19:06 -05:00
Dan Winship
c1017d04df tui: rename nmt_newt_error_dialog() to nmt_newt_message_dialog() 2014-01-16 09:19:06 -05:00
Dan Winship
eb9cd6da08 tui: reorganize the main dialog
"Cancel" didn't really make sense here, but changing it to "Quit" is
also weird because if you were going to use the "OK" button you'd have
to tab past "Quit" first... So make it be an option in the menu
instead.
2014-01-16 09:19:06 -05:00
Dan Winship
867c3cdae0 tui: fix the error-on-startup cases 2014-01-16 09:19:06 -05:00
Dan Winship
ed6b8f8c1d tui: localize startup/usage-related strings 2014-01-16 09:19:06 -05:00
Dan Winship
bbb416a6a7 tui: error out if NM is not running 2014-01-16 09:19:06 -05:00
Dan Winship
034d812433 tui: don't pop up a dialog on g_log messages
Unless NMTUI_DEBUG is set, don't pop up a dialog when a
g_warning/critical/etc occurs. Just hide the main screen briefly so
the error doesn't get printed over the UI, and restore it after; any
messages that get logged will be visible after nmtui exits.
2014-01-16 09:19:06 -05:00
Dan Winship
9c8845c35d tui: don't bother making links (nmtui-edit, etc) in build tree
They end up not working right from the build tree anyway, because the
nmtui libtool wrapper doesn't pass its argv[0] on to the actual
binary.
2014-01-16 09:19:06 -05:00
Dan Winship
8c12177f78 tui: don't center the buttons in a button box
Since we can't align buttons to half-character positions, they end up
looking more random than centered:

  |   <Add>   |
  | <Edit...> |
  | <Delete>  |

So just let them be left-aligned instead. It looks better.
2014-01-16 09:19:06 -05:00
Dan Winship
33d544f472 tui: fix keyboard focus problem
The keyboard focus was getting reset to the first widget any time a
widget changed validity, because the form wasn't updating priv->focus
when it should have.
2014-01-16 09:19:06 -05:00
Jiří Klimeš
d3170f3f1b trivial: fix typo in man page 2014-01-16 09:55:48 +01:00
Jiří Klimeš
080b3a43b5 man: update nmcli-examples manual page 2014-01-15 17:40:02 +01:00