Commit Graph

246 Commits

Author SHA1 Message Date
Thomas Haller
ba350a3495 cli: add additional user-data argument to get_fcn()
The function nmc_print() receives a list of "targets". These are essentially
the rows that should be printed (while the "fields" list represents the columns).

When filling the cells with values, it calles repeatedly get_fcn() on the
column descriptors (fields), by passing each row (target).

The caller must be well aware that the fields and targets are
compatible. For example, in some cases the targets are NMDevice
instances and the target type must correspond to what get_fcn()
expects.

Add another user-data pointer that is passed on along with the
targets. That is useful, if we have a list of targets/rows, but
pass in additional data that applies to all rows alike.

It is still unused.
2018-07-09 15:43:55 +02:00
Beniamino Galvani
fc99aad378 ip-tunnel: allow wired setting for some tunnel modes
gretap and ip6gretap ip-tunnel interfaces encapsulate L2 packets over
IP. Allow adding a wired setting for such connections so that users
can change the interface MAC.
2018-07-02 17:55:14 +02:00
Lubomir Rintel
29636535b2 client: support 6lowpan setting 2018-06-26 16:21:55 +02:00
Lubomir Rintel
5da77c0e2c client: support wpan setting 2018-06-26 16:21:55 +02:00
Lubomir Rintel
8901193816 clients/meta: allow formatting 16-bit values formatted as 0x%04x
This is the preferred way to format WPAN short addresses and PAN IDs.
2018-06-26 16:21:55 +02:00
Alfonso Sánchez-Beato
cb8003c40d cli: add support for wake-on-wlan properties 2018-06-15 09:46:26 +02:00
Beniamino Galvani
bb20f2eb61 macsec: enable send-sci by default and make the option configurable
It is safer to enable send-sci by default because, at the cost of
8-byte overhead, it makes MACsec work over bridges (note that kernel
also enables it by default). While at it, also make the option
configurable.

https://bugzilla.redhat.com/show_bug.cgi?id=1588041
2018-06-14 15:13:11 +02:00
Francesco Giudici
02c4b2c9a8 cli: add dhcp-duid support 2018-06-09 22:20:39 +02:00
Lubomir Rintel
e69d386975 all: use the elvis operator wherever possible
Coccinelle:

  @@
  expression a, b;
  @@
  -a ? a : b
  +a ?: b

Applied with:

  spatch --sp-file ternary.cocci --in-place --smpl-spacing --dir .

With some manual adjustments on spots that Cocci didn't catch for
reasons unknown.

Thanks to the marvelous effort of the GNU compiler developer we can now
spare a couple of bits that could be used for more important things,
like this commit message. Standards commitees yet have to catch up.
2018-05-10 14:36:58 +02:00
Lubomir Rintel
f0c1efbf42 all: add and utilize nm_utils_is_separator()
It is meant to be rather similar in nature to isblank() or
g_ascii_isspace().

Sadly, isblank() is locale dependent while g_ascii_isspace() also considers
vertical whitespace as a space. That's no good for configuration files that
are strucutured into lines, which happens to be a pretty common case.
2018-05-10 14:35:52 +02:00
Beniamino Galvani
1b5925ce88 all: remove consecutive empty lines
Normalize coding style by removing consecutive empty lines from C
sources and headers.

https://github.com/NetworkManager/NetworkManager/pull/108
2018-04-30 16:24:52 +02:00
Thomas Haller
c9a574f12f clients: use nm_utils_strv_make_deep_copied() to deep copy const strv array 2018-04-13 17:02:55 +02:00
Beniamino Galvani
50414353e1 clients: set @out_is_default in property getters 2018-04-13 17:02:55 +02:00
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