Skip to content

fix(#334): use zvariant::Dict for vpn.data and vpn.secrets dbus types#337

Merged
cachebag merged 1 commit intodev-openvpnfrom
dbus-type
Apr 10, 2026
Merged

fix(#334): use zvariant::Dict for vpn.data and vpn.secrets dbus types#337
cachebag merged 1 commit intodev-openvpnfrom
dbus-type

Conversation

@cachebag
Copy link
Copy Markdown
Owner

build_openvpn_connection was encoding vpn.data and vpn.secrets as Vec<(String, String)>, which Value::from serializes as a(ss) (array of struct pairs). NetworkManager expects a{ss} (dict of string to string) and silently rejects or fails activation with the wrong type. Replaced both with a zvariant::Dict helper that produces the correct a{ss} signature.

Closes #334.

@cachebag cachebag self-assigned this Apr 10, 2026
@cachebag cachebag added bug Something isn't working nmrs Changes to nmrs refactor Change or improve code vpn Changes to VPN surface labels Apr 10, 2026
@cachebag cachebag requested a review from Copilot April 10, 2026 20:57
@cachebag cachebag changed the title fix(#334): use zvariant::Dict for vpn.data and vpn.secrets dbus types fix(#334): use zvariant::Dict for vpn.data and vpn.secrets dbus types Apr 10, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes OpenVPN settings encoding so vpn.data and vpn.secrets are sent over D-Bus with the a{ss} (dict string→string) signature required by NetworkManager, preventing silent rejection/activation failures.

Changes:

  • Added a helper to convert Vec<(String, String)> into a zvariant::Dict with a{ss} signature.
  • Updated build_openvpn_connection to serialize both vpn.data and vpn.secrets using that dict representation.
  • Added a unit test checking the produced dict signature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread nmrs/src/api/builders/vpn.rs Outdated
Comment thread nmrs/src/api/builders/vpn.rs
@cachebag cachebag merged commit 781aa65 into dev-openvpn Apr 10, 2026
1 of 6 checks passed
@cachebag cachebag deleted the dbus-type branch April 10, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working nmrs Changes to nmrs refactor Change or improve code vpn Changes to VPN surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants