wireguard: Trim IP list before submitting to NM
ClosedPublic

Authored by hexchain on Feb 25 2020, 7:56 PM.

Details

Summary

The SimpleIpListValidator validates each trimmed item in a comma-separated
list, but WireGuardPeerWidget sets peerData without trimming each item.
Untrimmed items are not accepted by NetworkManager, so the user might see NM
rejecting values that are valid in the peer settings dialog.

Fix this discrepancy by trimming each item before setting peerData.

Test Plan
  1. Type a comma-separated list of IP addresses, with spaces around comma, into

the "Allowed IPs" field of the WireGuard peer settings dialog.

  1. Save the connection. No error should be reported by NM.

Diff Detail

Repository
R116 Plasma Network Management Applet
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
hexchain created this revision.Feb 25 2020, 7:56 PM
Restricted Application added a project: Plasma. · View Herald TranscriptFeb 25 2020, 7:56 PM
Restricted Application added a reviewer: jgrulich. · View Herald Transcript
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
hexchain requested review of this revision.Feb 25 2020, 7:56 PM
usta added a subscriber: usta.Feb 25 2020, 8:03 PM
usta added inline comments.
libs/editor/settings/wireguardpeerwidget.cpp
197

const

hexchain updated this revision to Diff 76417.Feb 25 2020, 8:09 PM

Updated according to comments.

hexchain updated this revision to Diff 76418.Feb 25 2020, 8:17 PM
hexchain edited the summary of this revision. (Show Details)
hexchain edited the test plan for this revision. (Show Details)

Edited summary according to guidelines

jgrulich accepted this revision.Feb 26 2020, 6:36 AM
This revision is now accepted and ready to land.Feb 26 2020, 6:36 AM
Closed by commit R116:b7daee75ee0e: wireguard: Trim IP list before submitting to NM (authored by Haochen Tong <i@hexchain.org>, committed by jgrulich). · Explain WhyFeb 27 2020, 6:52 AM
This revision was automatically updated to reflect the committed changes.