Skip to content

Conversation

@jcronenberg
Copy link
Contributor

Problem

With #2356 I unfortunately missed the changes from #2258 where slave-type was changed to port-type which only NM >= 1.46.0 supports.

Solution

Send port-type only for NM >= 1.46.0, otherwise slave-type is used.
Also since I was already adding a test for this, I also added two additional test for connection_to_dbus with bridge and bond connections.

Testing

  • Added a new unit test
  • Tested manually

Comment on lines 91 to 98
} else {
connection_dbus.insert("port-type", "".into());
if VersionReq::parse(">=1.46.0").unwrap().matches(&nm_version) {
connection_dbus.insert("port-type", "".into());
} else {
connection_dbus.insert("slave-type", "".into());
}
connection_dbus.insert("master", "".into());
}
Copy link
Contributor Author

@jcronenberg jcronenberg Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, I might be missing something but isn't this nonsensical to have, because it seems to me to get cleaned up later by cleanup_dbus_connection() anyway? So should I maybe just remove this part completely?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhm maybe it's relevant for merging connections? Though if the empty value then gets cleaned up before it's sent to NM, NM will just keep the value as is anyway so it will also not be unset/updated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have the same impression. That value will be cleaned-up later. I guess we need to have a closer look to this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some issue when working on this exactly because of the merge and also when for example moving a port from a bond to a bridge. It was reading the port-type but setting the slave-type or something like that..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay so I tested it a bit, indeed the merging seems to be a problem because for whatever reason NM still seems to send slave-type over port-type to agama and then the merging gets difficult, so I have now added a bit in cleanup_dbus_connection() that prefers the port-type of agama so that it takes precedence. And also deleting the section I mentioned here does not work because then the merge wouldn't overwrite the values/cleanup_dbus_connection() wouldn't see a change. But also what I mentioned previously

Though if the empty value then gets cleaned up before it's sent to NM, NM will just keep the value as is anyway so it will also not be unset/updated.

isn't correct in this case, if nothing is sent to NM it will actually unset this property, so cleanup_dbus_connection() is working as intended.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking it. Then I guess we can proceed.

@jcronenberg jcronenberg force-pushed the slave_type_nm_compat branch from 81fdb9d to 39b35b1 Compare June 5, 2025 11:59
@jcronenberg jcronenberg force-pushed the slave_type_nm_compat branch from 39b35b1 to 77b12ad Compare June 5, 2025 14:30
@imobachgs imobachgs merged commit 26451bd into agama-project:master Jun 6, 2025
@jcronenberg jcronenberg deleted the slave_type_nm_compat branch June 6, 2025 08:10
@imobachgs imobachgs mentioned this pull request Jun 30, 2025
imobachgs added a commit that referenced this pull request Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants