Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly escape bridge in rulename #144

Merged

Conversation

duritong
Copy link
Collaborator

@duritong duritong commented Aug 24, 2022

Fixes #143

this is handled by the next - more specific - expect anyways
Copy link
Member

@smortex smortex left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -10,7 +10,7 @@
$bridges = $interfaces.filter |$items| { $items =~ $bridgenames }

$bridges.each |String $bridge| {
$bridge_rulename = regsubst($bridge, '-', '_', 'G')
$bridge_rulename = regsubst($bridge, '-|:', '_', 'G')
Copy link
Member

Choose a reason for hiding this comment

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

For single char, I trend to prefer [] to | because it feels more readable:

Suggested change
$bridge_rulename = regsubst($bridge, '-|:', '_', 'G')
$bridge_rulename = regsubst($bridge, '[-:]', '_', 'G')

That being said, a - is tricky in [] and we have two chars only so not a big deal.

@kenyon kenyon changed the title Fix 143 properly escape rulename Fix #143 properly escape rulename Aug 25, 2022
@kenyon kenyon changed the title Fix #143 properly escape rulename Properly escape rulename Aug 25, 2022
@traylenator traylenator changed the title Properly escape rulename Properly escape bridge in rulename Aug 26, 2022
@traylenator traylenator added the bug Something isn't working label Aug 26, 2022
@traylenator traylenator merged commit 9d61323 into voxpupuli:master Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nftables::bridges creates invalid rule names when bridge devices have multiple IP addresses
3 participants