Commit Graph

160 Commits

Author SHA1 Message Date
Francesco Giudici
4657390d45 cli: add support to Team link watchers 2017-12-08 00:46:26 +01:00
Beniamino Galvani
ca06f82371 clients: fix display value for dns-options
We must show the default value "(default)" when the list of
dns-options is initialized but empty.
2017-11-30 23:54:45 +01:00
Beniamino Galvani
60f57ebe4a cli: fix connection type completion
Don't show completion for all setting types but only for base ones.

Before:
 $ nmcli connection add type <TAB>
 802-11-olpc-mesh          ethernet                  ppp
 802-11-wireless           generic                   pppoe
 802-11-wireless-security  gsm                       proxy
 802-1x                    infiniband                serial
 802-3-ethernet            ip-tunnel                 team
 adsl                      ipv4                      team-port
 bluetooth                 ipv6                      tun
 bond                      macsec                    user
 bridge                    macvlan                   vlan
 bridge-port               olpc-mesh                 vpn
 cdma                      ovs-bridge                vxlan
 connection                ovs-interface             wifi
 dcb                       ovs-patch                 wifi-sec
 dummy                     ovs-port                  wimax

After:
 $ nmcli connection add type <TAB>
 802-11-olpc-mesh  cdma              macsec            team
 802-11-wireless   dummy             macvlan           tun
 802-3-ethernet    ethernet          olpc-mesh         vlan
 adsl              generic           ovs-bridge        vpn
 bluetooth         gsm               ovs-interface     vxlan
 bond              infiniband        ovs-port          wifi
 bridge            ip-tunnel         pppoe             wimax
2017-11-20 21:58:58 +01:00
Thomas Haller
3ee8de20c4 all: include "nm-utils/nm-hash-utils.h" by default
Next we will use siphash24() instead of the glib version g_direct_hash() or
g_str_hash(). Hence, the "nm-utils/nm-hash-utils.h" header becomes very
fundamental and will be needed basically everywhere.

Instead of requiring the users to include them, let it be included via
"nm-default.h" header.
2017-11-16 11:49:51 +01:00
Thomas Haller
8cb86d947c clients: avoid crash in _complete_fcn_connection_master()
Found by coverity, but not a practical issue, because we
wouldn't actually call the function with text NULL.
2017-11-15 18:10:31 +01:00
Francesco Giudici
81527f1a09 cli: add team-port properties 2017-11-09 17:56:15 +01:00
Francesco Giudici
e1220c933f cli: add team properties 2017-11-09 17:56:15 +01:00
Thomas Haller
2730dc60de all: move setting 802-1x.auth-retries to connection.auth-retries
The number of authentication retires is useful also for passwords aside
802-1x settings. For example, src/devices/wifi/nm-device-wifi.c also has
a retry counter and uses a hard-coded value of 3.

Move the setting, so that it can be used in general. Although it is still
not implemented for other settings.

This is an API and ABI break.
2017-11-02 11:41:01 +01:00
Thomas Haller
89e518db5a libnm,cli,ifcfg-rh: add NMSetting8021x:auth-retries property 2017-10-31 19:35:33 +01:00
Lubomir Rintel
aec8d36b3e clients: add support for ovs-bridge setting 2017-10-30 17:40:09 +01:00
Lubomir Rintel
6f73b4608a clients: add support for ovs-port setting 2017-10-30 17:40:09 +01:00
Lubomir Rintel
6dcd54b0de clients: add support for ovs-interface setting 2017-10-30 17:40:09 +01:00
Lubomir Rintel
e7ab81098a clients: add support for ovs-patch setting 2017-10-30 17:40:09 +01:00
Thomas Haller
3434261811 core,clients: use our own string hashing function nm_str_hash()
Replace the usage of g_str_hash() with our own nm_str_hash().

GLib's g_str_hash() uses djb2 hashing function, just like we
do at the moment. The only difference is, that we use a diffrent
seed value.

Note, that we initialize the hash seed with random data (by calling
getrandom() or reading /dev/urandom). That is a change compared to
before.

This change of the hashing function and accessing the random pool
might be undesired for libnm/libnm-core. Hence, the change is not
done there as it possibly changes behavior for public API. Maybe
we should do that later though.

At this point, there isn't much of a change. This patch becomes
interesting, if we decide to use a different hashing algorithm.
2017-10-18 13:05:00 +02:00
Thomas Haller
cc1ee1d286 all: rework configuring route table support by adding "route-table" setting
We added "ipv4.route-table-sync" and "ipv6.route-table-sync" to not change
behavior for users that configured policy routing outside of NetworkManager,
for example, via a dispatcher script. Users had to explicitly opt-in
for NetworkManager to fully manage all routing tables.

These settings were awkward. Replace them with new settings "ipv4.route-table"
and "ipv6.route-table". Note that this commit breaks API/ABI on the unstable
development branch by removing recently added API.

As before, a connection will have no route-table set by default. This
has the meaning that policy-routing is not enabled and only the main table
will be fully synced. Once the user sets a table, we recognize that and
NetworkManager manages all routing tables.

The new route-table setting has other important uses: analog to
"ipv4.route-metric", it is the default that applies to all routes.
Currently it only works for static routes, not DHCP, SLAAC,
default-route, etc. That will be implemented later.

For static routes, each route still can explicitly set a table, and
overwrite the per-connection setting in "ipv4.route-table" and
"ipv6.route-table".
2017-10-09 22:05:36 +02:00
Thomas Haller
c71f26bf92 libnm,cli: add IP setting "route-table-sync" 2017-09-26 19:39:36 +02:00
Francesco Giudici
e04c9af5fd nmcli: allow to set dhcp-timeout as "infinity"
DHCP timeout may now be explicitly disabled by setting the
ipv[4,6].dhcp-timeout options to "infinity".
This will set the DHCP timeout value to MAXINT32.
2017-09-18 18:44:43 +02:00
Thomas Haller
6ece7d6dd3 cli: cleanup _get_fcn_gobject_int() and _set_fcn_gobject_int() 2017-09-12 16:52:49 +02:00
Thomas Haller
a8d2a4ebaf cli: implement dcb priority as plain int property
There are basically three options:

1)  use a separate _get_fcn_gobject_dcb_priority() getter and
    implement them as a new type _pt_gobject_dcb_priority.
2a) implement them as _pt_gobject_int and set nicks as value_infos,
    repeating the nicks 3 times.
2b) like 2a, but use a macro to define how the DCB priority shall
    behave at one place.

I think 1) is ugly. In the previous form, it also does not support
setting the property to "unset". We should implement properties as
types, and modify their behavior (by setting value_infos), instead
of implementing multiple, different types.

I slightly prefer 2b) over 2a) because it defines the behavior once,
but it's a bit harder to follow.
2017-09-12 16:34:17 +02:00
Thomas Haller
4c8673d978 cli: refactor connection.autoconnect-retires to use int-getter 2017-09-12 16:34:17 +02:00
Thomas Haller
e36ed195ba cli: refactor ipv4.dad-timeout to use int-getter
- Reduce duplicated code and implement the property according to
  best-practice for integer types.

- Do not translate the output

- This way, the setter also supprts the nick names
2017-09-12 16:03:05 +02:00
Thomas Haller
6ad53975b3 cli: fix _set_fcn_gobject_int_impl() to accept nick for setting int property
Fixes: e086cf1887
2017-09-12 16:02:39 +02:00
Lubomir Rintel
9481bda939 clients: don't default Bluetooth to the PANU profile
No reason to, the other types are no less likely. Quite the contrary, if
the user specifies a GSM APN we're sure to use a DUN profile.

  $ ./clients/cli/nmcli c add type bluetooth ifname '*' bluetooth.bdaddr 1C:E2:CC:56:6C:45 apn internet
  $ nmcli c show bluetooth-1 |grep bluetooth.type
  bluetooth.type:                         panu
                                          ^^^^ not cool
2017-08-23 16:19:32 +02:00
Lubomir Rintel
0718b25508 clients: allow GSM and CDMA for Bluetooth connections
Unbreaks Bluetooth DUN. Probably broken with the nm-meta-setting-desc
refactor, hence the Fixes tag. I didn't actually check.

  $ nmcli c add type bluetooth ifname '*' bluetooth.bdaddr 1C:E2:CC:56:6C:45 connection.id bt bt-type dun-gsm
  Error: 'apn' argument is required.
  $ nmcli c add type bluetooth ifname '*' bluetooth.bdaddr 1C:E2:CC:56:6C:45 connection.id bt bt-type dun-gsm apn internet
  Error: invalid <setting>.<property> 'apn'.
  $

This is where it starts to get sad ^

  $ nmcli c add type bluetooth ifname '*' bluetooth.bdaddr 1C:E2:CC:56:6C:45 connection.id bt bt-type dun-gsm gsm.apn internet
  Error: invalid or not allowed setting 'gsm': 'gsm' not among [connection, bluetooth, bridge, ipv4, ipv6, proxy].
  $

This is where it gets obvious what went wrong ^

Fixes: b5c8622ad3
2017-08-23 16:08:42 +02:00
Beniamino Galvani
f83e56ec6d libnm,clients: add 'parent' property to PPPoE setting
When the property is set, it specifies the device on which PPPoE is to
be started. The ppp interface will be named as the
connection.interface-name property.

When the property is not set the previous behavior will be retained,
i.e. the PPPoE connection will be started on connection.interface-name
and the PPP interface will have a random name.
2017-08-05 08:03:15 +02:00
Beniamino Galvani
17ec3aef2f bridge: introduce a bridge.group-forward-mask connection property
https://bugzilla.redhat.com/show_bug.cgi?id=1358615
2017-07-27 09:35:11 +02:00
Beniamino Galvani
46d2168393 clients: reorder properties of connection setting
The order matters for the 'nmcli connection show' output and for the
interactive mode of nmcli. Users should not rely on the order in both
cases, but since we have an extensive test suite for the interactive
mode, restore the order as it was in 1.8.
2017-06-22 15:01:15 +02:00
Beniamino Galvani
afac7621ae clients: return NULL array on auto-completion failure
readline crashes if we return an empty completion list; return NULL
instead.

This is reproducible, for example, with:

 $ nmcli --ask connection add
 Interface name [*]: doesnotexist<TAB>
 Segmentation fault (core dumped)

 $ nmcli --ask connection add
 Interface name [*]:
 Connection type: avian-carr<TAB>
 Segmentation fault (core dumped)
2017-06-22 15:01:15 +02:00
Lubomir Rintel
aedeb3cbf4 clients: add support for Bluetooth NAP type 2017-05-31 20:17:42 +02:00
Lubomir Rintel
ab46c9c70c clients: allow bridge settings for Bluetooth devices
Will be useful for Bluetooth NAP.
2017-05-31 20:17:39 +02:00
Beniamino Galvani
ce956a240b clients: fix MTU setter function
Don't reuse _set_fcn_gobject_int_impl() because it requires
gobject_int subtype data in the property info, while MTU properties
have mtu subtype data.
2017-05-26 18:16:19 +02:00
Beniamino Galvani
c73b39c3a6 clients: fix typo 2017-05-24 10:42:33 +02:00
Beniamino Galvani
f15fd1e504 clients: fix meta setting descriptor for connection.autoconnect-slaves
Don't specify .get_gtype for properties of enum type.

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

Fixes: c55561d303
2017-05-24 10:41:37 +02:00
Thomas Haller
c72a07a604 clients: implement wifi-sec.wep-key-type as enum property
This way, we get tab completion for the enum values, and
can reuse existing code.

This requires a pre-set-notify hook, that is invoked before
setting the property.
2017-05-23 13:37:10 +02:00
Thomas Haller
d6bdf6d9dc clients: fix error message for setting flags enums
The min/max for flags must be unsigned. We need to keep track of
whether we have flags or an enum, and adjust min/max.
2017-05-23 13:37:10 +02:00
Thomas Haller
cfc9f5a9fd clients: implement team.config as string property
... with separate validation function.
2017-05-23 13:37:10 +02:00
Thomas Haller
9a68123827 clients: implement serial.parity as enum property
Previously we would only consider the first character of
value. For example, "Nonsense" was also allowed. Don't do
that anymore.
2017-05-23 13:37:10 +02:00
Thomas Haller
6c4428324e clients: implement proxy.pac-script as string property
... with separate validation function.
2017-05-23 13:37:10 +02:00
Thomas Haller
df388ea7d5 clients/trivial: rename nmc_vlan_parse_priority_maps function 2017-05-23 13:37:10 +02:00
Thomas Haller
14aefa1d7f clients: implement dcb priorities as int property 2017-05-23 13:37:10 +02:00
Thomas Haller
e086cf1887 clients: add value_infos for int getter
This allows to implement a pretty alias for numbers,
like "default" for 0.
2017-05-23 13:37:10 +02:00
Thomas Haller
b6d9bdcee8 clients: combine int property setters
Instead of having 3 implementations for setting an int (int, uint, int64), combine
them. Also, make them more configurable by allowing to specify min/max/base, outside
of GParamSpec.
2017-05-23 13:37:10 +02:00
Thomas Haller
35d6802724 clients: add validate_fcn for string property 2017-05-23 13:37:10 +02:00
Thomas Haller
6c4b12418b clients: implement macsec.mode property as enum 2017-05-23 13:37:10 +02:00
Thomas Haller
bd180e489d clients: implement macsec.validation property as enum 2017-05-23 13:37:10 +02:00
Thomas Haller
ebdc7a6ce7 clients: implement proxy.method property as enum 2017-05-23 13:37:10 +02:00
Thomas Haller
772225f8cf clients: implement ip-tunnel.mode property as enum 2017-05-23 13:37:10 +02:00
Thomas Haller
c55561d303 clients: implement connection.autoconnect-slaves property as enum 2017-05-23 13:37:10 +02:00
Thomas Haller
8c87a4b8a8 clients: replace nmc_string_to_int() by _nm_utils_ascii_str_to_int64() 2017-05-23 13:37:10 +02:00
Thomas Haller
1e5c5bd4a6 clients: cleanup parse_ip_route 2017-05-23 13:37:10 +02:00