Bonding options are related and some combinations don't make sense. Basically,
MIIMON and ARP monitoring mode (and related options) are mutually exclusive.
When nmcli set arp_interval of "0" (the default value),
nm_setting_bond_add_option() cleared the MIIMON options (miimon, updelay and
downdelay).
This commit works around libnm-util's nm_setting_bond_add_option() that clears
miimon options when arp_interval is being set and vice versa, but doesn't
take into account the value of "0" that should be regarded as 'disable'.
https://bugzilla.redhat.com/show_bug.cgi?id=1007355
The commands performing actions without an output only printed a successfull
message for --pretty mode. Some users don't like this silent operation.
This commit makes nmcli print operation success unconditionally. I think that
doesn't hurt; scripts/users can ignore the message if not interested.
https://bugzilla.redhat.com/show_bug.cgi?id=1006444
Also allow leading/trailing white spaces, and more white spaces between IP and
gateway. (Spaces in values and around / are not allowed).
All of these are accepted:
' 1.2.3.4/11 1.2.3.254 '
' 1.2.3.4 '
' fe80::215:ff:fe93:ffff/128 ::1 '
...
https://bugzilla.redhat.com/show_bug.cgi?id=1007368
The format of property values that nmcli prints is not the same (for some
properties) as the format nmcli editor accepts as input from user. The reasons
are that (a) output format is more descriptive and not much suitable to be
typed, (b) it comes in most cases from libnm-util.
'change' command displays current property value and allows users to edit it.
So we convert the output into input format, before presenting it to the user.
https://bugzilla.redhat.com/show_bug.cgi?id=998929
readline() makes changes to terminal and when it doesn't receive unix signals,
it has no chance to perform cleanups on exit. So we have to call its cleanup
functions manually on exit.
https://bugzilla.gnome.org/show_bug.cgi?id=706118
- the ifname argument for "connection add" is not mandatory
- support the long names for connection types ("802-*")
Signed-off-by: Thomas Haller <thaller@redhat.com>
nmc_setting_reset_property() function checks whether we allow changing the property
(set_func != NULL) and if so, the property value is reset to default.
remove <setting>[.property] | <property>
It entirely removes given setting from edited connection. If a property is given,
the command instead resets the property to its default value.
https://bugzilla.gnome.org/show_bug.cgi?id=707576
Synopsis: nmcli --ask connection add
When '--ask' is used, nmcli will ask not only for mandatory arguments but also
for the optional ones, with a series of questions.
Before, when specifying a setting.property with missing property name,
the following happened:
nmcli> set connection.
Error: invalid property: '' not among [...
Reword this special error case of a missing property to make it more
clear.
Signed-off-by: Thomas Haller <thaller@redhat.com>
readline_x returns NULL for empty input, so it is wrong
to call g_strstrip without checking for NULL first.
Signed-off-by: Thomas Haller <thaller@redhat.com>
Bash completion does now parse the command line from left to right and
only suggests options that make sense at the current cursor position.
If the cursor is not at the end of the line, the words right from the
cursor are ignored for completion. The reason is, that it would be much
more difficult to figure out the valid options when also looking at
options right from the cursor. However, it should still work nicely
even in this case.
There is still an unsolved issue when completing words with space or
other special characters. However, this issue was present before.
Signed-off-by: Thomas Haller <thaller@redhat.com>
Setting the logging level fails for normal users due to missing dbus
permissions as configured in src/org.freedesktop.NetworkManager.conf.
In that case, nmcli simply fails showing the dbus error. This error
is however not very clear, so this commit shows a different error
text for the particular case of ACCESS_DENIED.
Signed-off-by: Thomas Haller <thaller@redhat.com>
The handlers detecting changes of IP addresses/method in nmcli interactive
editor were connected only for newly created connection. That's why the
automagic feature of setting 'method' when 'addresses' are changed and vice
versa worked just for new connections, but not while editing existing
connections.
Before the change if an alias for a setting name existed, it was used instead of
the real name and TAB-completion for the real name didn't work.
before:
nmcli> goto 802<TAB>
no output
now:
nmcli> goto 802<TAB>
nmcli> goto 802-11-wireless
802-11-wireless 802-11-wireless-security
nmcli> goto <TAB>
802-11-wireless-security (wifi-sec) connection ipv6
802-11-wireless (wifi) ipv4
The properties are not implemented in NM core, nor in ifcfg-rh plugin. Thus
they are not preserved over re-reading from ifcfg-* file. Moreover they are
highly dependent on drivers.
When we allowed editing them, the connection changed after re-reading and
was marked as dirty (and users were puzzled).
Before, whereever a connection id is accepted, the completion only
offered 'id', 'uuid', 'path', etc. With this change, it will additionally
suggest the id of existing connections.
https://bugzilla.redhat.com/show_bug.cgi?id=997997
Signed-off-by: Thomas Haller <thaller@redhat.com>
To support optimal completion, more context must be considered.
Especially the OPTIONS, which must appear before the OBJECT.
Modify bash completion to try parsing first the options.
Before, whenever you had options, completion did not work
anymore (because the object was expected as first argument).
Moreover, options were also suggested after specifying the
object. This is now mitigated by parsing the command line
in two steps.
Signed-off-by: Thomas Haller <thaller@redhat.com>
Unfortunately, $(AM_CPPFLAGS) gets overridden by per-target _CPPFLAGS
variables, which $(INCLUDES) did not, so this requires some additional
changes.
In most places, I have just gotten rid of the per-target _CPPFLAGS
variables; in directories with a single target, the per-target
variable is unnecessary, and in directories with multiple targets, the
per-target variable is often undesirable, since it forces some files
to be compiled twice, even though there ends up being no difference
between the two files.
When reading the property name in edit mode, any white space should be
striped from the entered value. Especially, because tab completion will
add a trailing whitespace.
Example:
$ nmcli connection edit
Enter connection type: ethernet
nmcli> goto connection
nmcli connection> describe
Property name? u<TAB>
The <TAB> will complete 'u' to 'uuid '.
This whitespace should be allowed and striped.
Signed-off-by: Thomas Haller <thaller@redhat.com>