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

wg-quick: linux: use sed for trimming config lines #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kkartaltepe
Copy link

Bash's longest matching operators combined with extended globs is
extremely slow for very large lines. There are probably very few people
for which this is noticable but in a file with 800 AllowIPs on a single
line it keeps wg-quick from stalling for 5s when performing operations.

I'm not sure about the portability of this to other platforms beyond gnu linux.
My understanding is the multiple -e flag style is the most portable and available
on non-gnu systems but I have not tested.

I didnt see any performance regression but perhaps shelling out to sed is slower
if your config has thousands of lines. I suspect its not.

@kkartaltepe
Copy link
Author

Ah sorry right after I sent this i noticed there was a typo and that the non-greedy match in sed was not working...

@kkartaltepe kkartaltepe marked this pull request as draft August 18, 2021 03:49
@kkartaltepe kkartaltepe marked this pull request as ready for review August 18, 2021 04:01
@kkartaltepe
Copy link
Author

Fixed up.

Bash's longest matching operators combined with extended globs is
extremely slow for very large lines. There are probably very few people
for which this is noticable but in a file with 800 AllowIPs on a single
line it keeps wg-quick from stalling for 5s when performing operations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant