GNOME Bugzilla – Bug 698113
cli: iface-independent physical connections should be explicit
Last modified: 2013-06-13 08:31:49 UTC
You can add an ethernet connection that is not bound to a specific interface either by mac address or by name (not yet implemented, AFAIK). nmcli connection add type ethernet But that makes it easy to do that by mistake, e.g. assuming that name is the interface name: nmcli connection add type ethernet name eth0 This may lead to unexpected behaviour and it *might* be worth forcing the user to explicitly state that this is what he needs. There is a number of possibilities I can think of: * nmcli --force connection add type ethernet name eth0 (the --force/-f being suggested by the unsuccessful command) * nmcli connection add type ethernet independent * nmcli connection add type ethernet mac any * nmcli connection add type ethernet interface-name any I'm not suggesting any particular way, the list here is only to express myself better.
Actually, there was 'ifname any', but after some discussions the special value 'any' was trashed in the end. Also 'name is now 'con-name', so it should not be confusing.
(In reply to comment #1) > Actually, there was 'ifname any', but after some discussions the special value > 'any' was trashed in the end. Could be also for example 'ifname "*"' or 'any-ifname' or maybe the best would be 'unbound' or 'floating' or something along that line. > Also 'name is now 'con-name', so it should not be confusing. I don't see this as so much related (though maybe others do) and I don't think 'con-name' is a good name. It's both long and weird. Plain old 'name' was good enough in my opinion.
Putting here a bunch of notes I had to prepare anyway: * The context is 'nmcli connection add', so we're adding the connection and 'name' with 'connection' in the context suggests a connection name. * "name" is shorter. * "name" is in English, "con-name" or "conn-name" isn't, while "connection-name" is even longer. * Even if we choose "connection-name", we're just duplicating the 'connection': nmcli *connection* add *connection*-name something. * The user should be warned if he forgets "ifname" anyway. Then the original problem doesn't exist. Still this is a minor issue and can be solved backwards complatibly at any time, so no need to be stressed about it.
ifname * would work; the kernel does allow that character in an interface name, but I can't imagine why anyone would ever name an interface simply "*".
NM bugzilla reorganization... sorry for the bug spam.
(In reply to comment #1) > Actually, there was 'ifname any', but after some discussions the special value > 'any' was trashed in the end. Also 'name is now 'con-name', so it should not be > confusing. (In reply to comment #4) > ifname * would work; the kernel does allow that character in an interface name, > but I can't imagine why anyone would ever name an interface simply "*". Well, after some feedback and discussions I re-implemented it in jklimes/cli-ifname-bgo698113. 'ifname' will be mandatory for all connection types (expect bond,bridge,vlan). If a user required "unbound" connection he has to explicitly express that via ifname "*" (nmcli con add con-name "My any ethernet" type eth ifname "*"). A small drawback of using * is that it has to be quoted to suppress the shell expansion. (I put the quotes to docs and stress it in man).
looks right
Pushed to master: a91eafdf95bcbcc1bd2ba5aa991ac6a8f0d14446