After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 683345 - keyfile: uuid and id fields should be optional for configuration files created by people
keyfile: uuid and id fields should be optional for configuration files create...
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: general
0.9.x
Other Linux
: Normal enhancement
: ---
Assigned To: Jiri Klimes
NetworkManager maintainer(s)
: 696939 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-09-04 16:21 UTC by nathanael
Modified: 2014-06-25 14:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] keyfile: allow missing id and uuid in connection files (2.82 KB, patch)
2012-09-10 12:57 UTC, Jiri Klimes
accepted-commit_now Details | Review

Description nathanael 2012-09-04 16:21:39 UTC
When the NMSettingConnection/id property is missing from a connection file. NM fails to load it. It would be nice to consider the id the filename if the id is missing.
Comment 1 Pavel Simerda 2012-09-04 22:23:33 UTC
Confirming. And the UUID should be auto-generated and not required from the beginning.
Comment 2 Jiri Klimes 2012-09-10 12:54:24 UTC
Nathanael, I guess you are talking about keyfile configuration files in /etc/NetworkManager/system-connections/. Indeed, they don't allow missing id or uuid for now.
(ifcfg-rh plugin's /etc/sysconfig/network-scripts/ifcfg-* allow missing NAME and UUID)
Comment 3 Jiri Klimes 2012-09-10 12:57:14 UTC
Created attachment 223908 [details] [review]
[PATCH] keyfile: allow missing id and uuid in connection files

If 'id' is missing, basename of the file path is used as connection name. If 'uuid' is missing, the file path is hashed to generate an UUID.
Comment 4 Pavel Simerda 2013-05-06 14:20:53 UTC
I don't know why we didn't merge this...

From duplicate bug report:

Pavel Simerda [reporter] [NetworkManager developer] 2013-03-31 00:36:18 UTC

The minimal [connection] section of keyfile connection configuration looks
like:

[connection]
id=...
uuid=...
type=...

The only significant item there is the 'type'. Others are just NetworkManager
boilerplate.

The 'id' attribute should default to the filename. Unless a specific 'id' is
used, filenames in /etc/NetworkManager/system-connections are unique and
there's no reason not to use them as the default value. Of course it can be
overriden by something fancy and pretty like "Ethernet connection 1".

Administrators should never be asked to generate 'uuid' for new connections.
There is a bunch of possibilites what could be done for connection keyfiles
without uuid:

1) It could be written there whenever the connection is read. Simple but ugly.

2) It could be stored in a separate file that would link the file name to the
uuid.

3) It could be a hash of the filename. Probably the most elegant way.

This bug report specifically applies to administrators who prefer writing
configuration files by hand.

[reply] [-] Comment 1 Dan Williams [NetworkManager developer] 2013-04-03 13:25:54 UTC

This is likely fine, we'd need to do what the ifcfg-rh plugin does for creating
the ID and UUID dynamically, which is to create a UUID from the filename since
filenames must be unique.  The ID comes from the filename too.

Note that if you then renamed the file, the UUID changes, and then all sorts of
stuff gets reset, like your saved DHCP leases are gone, last-connected
timestamp is reset to 0, and seen-bssids are cleared, because all of this is
based on the UUID.

I have no problem with the administrator not being required to write an ID or
UUID, but we should at least write the UUID (and maybe the ID, maybe not) out
to the file whenever it gets modified.

[reply] [-] Comment 2 Pavel Simerda [reporter] [NetworkManager developer] 2013-04-03 13:38:38 UTC

Agreed.
Comment 5 Pavel Simerda 2013-05-06 14:21:10 UTC
*** Bug 696939 has been marked as a duplicate of this bug. ***
Comment 6 Dan Winship 2014-04-25 16:15:34 UTC
Comment on attachment 223908 [details] [review]
[PATCH] keyfile: allow missing id and uuid in connection files

yes, we should do this
Comment 7 Jiri Klimes 2014-06-19 14:35:49 UTC
I have modified the patch to apply and added a testcase:
jk/keyfile-bgo683345
Comment 8 Thomas Haller 2014-06-23 13:46:34 UTC
(In reply to comment #7)
> I have modified the patch to apply and added a testcase:
> jk/keyfile-bgo683345

Pushed one white space fixup!

Patch looks good to me.
Comment 9 Thomas Haller 2014-06-23 13:51:36 UTC
(In reply to comment #7)
> I have modified the patch to apply and added a testcase:
> jk/keyfile-bgo683345

Hm, maybe it'd be worth getting rid of the @id and @uuid variables:

-         id = nm_setting_connection_get_id (s_con);
-         if (!id) {
+         if (!nm_setting_connection_get_id (s_con)) {

@uuid likewise.
Comment 10 Jiri Klimes 2014-06-24 10:36:43 UTC
(In reply to comment #9)
> (In reply to comment #7)
> > I have modified the patch to apply and added a testcase:
> > jk/keyfile-bgo683345
> 
> Hm, maybe it'd be worth getting rid of the @id and @uuid variables:
> 
> -         id = nm_setting_connection_get_id (s_con);
> -         if (!id) {
> +         if (!nm_setting_connection_get_id (s_con)) {
> 
> @uuid likewise.

Fixed.

Squashed and rebased to master branch.
Comment 11 Thomas Haller 2014-06-24 15:55:23 UTC
Looks good to me now
Comment 12 Jiri Klimes 2014-06-25 14:36:22 UTC
c88b832 keyfile: allow missing 'id' and 'uuid' in [connection] section (bgo #683345)