Commit Graph

333 Commits

Author SHA1 Message Date
Beniamino Galvani
1f2319dcb9 clients: change nm_meta_abstract_info_get() to report defaults
Return a boolean to indicate whether the value is the default one, so
that the caller can choose to hide it.
2018-04-13 17:02:55 +02:00
Beniamino Galvani
defe869ee3 clients: meta: consolidate wep-key get functions 2018-04-13 17:02:55 +02:00
Beniamino Galvani
350345fff4 clients: meta: use enum setter for secret flags 2018-04-13 17:02:55 +02:00
Beniamino Galvani
ae54a75298 clients: meta: define ipv6.ip6-privacy as an enum type
Reuse the existing enum type for ipv6.ip6-privacy instead of defining
custom get and set functions. It is now possible to set the enum to
"unknown".
2018-04-13 17:02:55 +02:00
Beniamino Galvani
8b4bb725d7 clients: meta: add enum getter-only nicks
Add a new a new field to enum type descriptors that specify a list of
nicks valid only for getter functions. It is useful when the get
function must return a string different from the enum nick and that
string can't be used to set a value.
2018-04-13 17:02:55 +02:00
Beniamino Galvani
627107d640 cli: accept string values for secret flags
I find very annoying to have to remember the numeric value of secret
flags or have to look them up in the manual every time. Accept the
textual version as well and add support for auto-completion.

 $ nmcli con modify c 802-11-wireless-security.psk-flags not-required

 $ nmcli con modify c 802-11-wireless-security.psk-flags <TAB>
   agent-owned   none          not-required  not-saved
2018-02-16 14:25:25 +01:00
Francesco Giudici
fd5b3f802e nmcli: team: do strict checking on runner-tx-hashes
Substrings matching the heading of valid values were allowed if not
ambiguous (e.g.: "et" for "eth"). Moreover, upper case variants were
accepted too.
Do a plain string comparison check against the valid values.
Improve also the error message: give a list of valid tx-hashes.
2018-02-12 11:20:12 +01:00
Francesco Giudici
350dbb55ab nmcli: team: clear runner-tx-hash before adding new hashes
https://bugzilla.redhat.com/show_bug.cgi?id=1541922
2018-02-12 10:42:58 +01:00
Francesco Giudici
31d9a9de14 libnm-core: team: add support to runner "random"
https://bugzilla.redhat.com/show_bug.cgi?id=1538699
2018-02-05 15:24:36 +01:00
Francesco Giudici
d7f3c79881 doc: fix describe message for team link watchers 2018-01-22 19:21:42 +01:00
Francesco Giudici
ff16252a71 nmcli: clear link-watchers before adding the new ones we want to set 2018-01-22 19:21:42 +01:00
Masashi Honma
7711d7c87b cli: add support for FILS
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2018-01-16 15:01:59 +01:00
Francesco Giudici
c6448f724b cli: get team defaults from setting header files
this allows centralizing default values definition and allows quicker
and safer update of default values.
2018-01-15 18:27:10 +01:00
Iñigo Martínez
7b34c3cf3e build: Rename settings-docs.c file
The `settings-docs.c` file is generated by processing the
`nm-property-docs.xml` file. Although this works in autotools,
the `.c` extension makes meson not to handle it properly.

Given the fact that it only contains a number of defines it
makes sense to change its extension to `.h` an use it as a header.
This also makes meson to handle it properly and build it before
its used.

https://mail.gnome.org/archives/networkmanager-list/2018-January/msg00057.html
2018-01-12 09:39:06 +01:00
Ismo Puustinen
2e2ff6f27a mdns: add new connection property.
Add support for mDNS as a connection-level property. Update ifcfg-rh and
keyfile plugins to support it.
2018-01-09 14:24:53 +01:00
Thomas Haller
52baa8c52b clients: drop redundant #include "NetworkManager.h"
This header is already included by "nm-default.h".
2018-01-08 12:38:54 +01:00
Beniamino Galvani
da4c9e51a0 ip-tunnel: add support for tunnel flags
Implement support for IP tunnel flags. Currently only some IPv6 tunnel
flags are supported. Example:

 # nmcli connection add type ip-tunnel mode ip6ip6 \
   ip-tunnel.flags ip6-ign-encap-limit,ip6-use-orig-tclass \
   ifname abc ip-tunnel.parent ens8 ipv4.method disabled \
   ipv6.method manual ipv6.address ::8888 remote ::42

 # ip -d l
  61: abc@ens8: <NOARP,UP,LOWER_UP> mtu 1460 qdisc noqueue ...
    link/tunnel6 :: brd ::42 promiscuity 0
    ip6tnl ip6ip6 remote ::42 local :: dev ens8 encaplimit none
    hoplimit 0 tclass inherit ...

https://bugzilla.gnome.org/show_bug.cgi?id=791846
2018-01-05 18:25:08 +01:00
Thomas Haller
5d3736ac65 cli: drop nmc_strsplit_set()
In most cases, it copies the entire strv needlessly.
We can do better.

Also, the max_tokens argument is handled wrongly (albeit
not used anywhere anymore).
2017-12-12 15:19:43 +01:00
Thomas Haller
97acd737bb cli: rework DEFINE_SETTER_PRIV_KEY()
nmc_strsplit_set()'s max_token argument is broken,
because it *first* calls g_strsplit_set() and then removes
empty tokens. It wasn't an issue, because DEFINE_SETTER_PRIV_KEY()
would first already remove leading spaces, and who uses multiple
spaces anyway...

Anyway, refactor DEFINE_SETTER_PRIV_KEY() to not use it.
2017-12-12 15:19:43 +01:00
Lubomir Rintel
3261820004 clients: add tc tfilter support
What works:

  nmcli c add con-name dum0 ifname dum0 type dummy \
      tc.tfilters 'parent 1234: matchall action drop, parent ffff: matchall action drop'
  nmcli c modify dum0 -tc.tfilters 'parent ffff: matchall action drop'
  nmcli c modify dum0 +tc.tfilters 'parent ffff: matchall action simple sdata Hello'
2017-12-11 11:02:04 +01:00
Lubomir Rintel
92f8f30d47 clients: add tc qdisc support
What works:

  nmcli c add con-name dum0 ifname dum0 type dummy \
      tc.qdiscs 'ingress, root pfifo_fast'
  nmcli c modify dum0 -tc.qdiscs 'root pfifo_fast'
  nmcli c modify dum0 +tc.qdiscs 'root handle 666: fq_codel'
2017-12-11 10:52:23 +01:00
Thomas Haller
e7d18548b9 cli: fix integer types in get-functions to match libnm origin
The num/i variables are initialized from libnm API and used
back at them. The integer types should match.
2017-12-08 16:31:28 +01:00
Francesco Giudici
c5228b8a83 cli: add support to TeamPort link watchers 2017-12-08 00:46:26 +01:00
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