-
Notifications
You must be signed in to change notification settings - Fork 759
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
Use minus (-) character in alias name #1434
Comments
|
I'm late to the party, sorry. Aliases are macros in pf.conf, the parsing of macro expansion can only match alphanumeric characters and the underscore character. During macro expansion the minus character is used as a breaking delimiter, e.g. for ranges. The relevant code line is this: https://github.com/opnsense/src/blob/master/sbin/pfctl/parse.y#L5702 |
|
@fichtner so if I understood correctly this request is technical, not possible, at least not in the never future, right? |
|
Yes and no. There's no easy fix here, but we could use a double underscore to encode the minus in the rules, but it takes a bit of work and care that "__" is not used in an alias already, maybe even deny using this combination. |
|
@fichtner, Ok, thanks for the explanation. I think it will be really handy if this will be included future (major) releases, the minus is really often used in (server) hostnames, maybe this becomes handy for a lot of people. but again, only if possible of course. Thanks anyway! |
|
I'll see what we can do, thank you for the feedback :) |
|
In case you use UTF-8 systemwide, it's maybe possible to do something like str_replace("-", "‑", $string) which would change the normal "minus-sign" to"non-breaking hyphen". They look graphically same, but are different glyphs in UTF-8 charset. |
|
but that still won't allow use in pf.conf ASCII syntax :( the best solution is stuffing, e.g. replacing "_" (one) by "__" (two) internally and using "-" as "_". that still requires audit of validation and code paths, also readings and mapping it back. |
|
timeout |
|
Why was this closed? |
|
@Tragen because nobody worked on it. |
Please allow the minus character in alias names as requested here:
https://forum.opnsense.org/index.php?topic=4626.msg17839#msg17839
The text was updated successfully, but these errors were encountered: