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

Use minus (-) character in alias name #1434

Closed
Tragen opened this issue Feb 27, 2017 · 10 comments
Closed

Use minus (-) character in alias name #1434

Tragen opened this issue Feb 27, 2017 · 10 comments
Labels
help wanted Contributor missing / timeout

Comments

@Tragen
Copy link

Tragen commented Feb 27, 2017

Please allow the minus character in alias names as requested here:
https://forum.opnsense.org/index.php?topic=4626.msg17839#msg17839

@fichtner
Copy link
Member

fichtner commented Feb 27, 2017

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

@scalfitura
Copy link

@fichtner so if I understood correctly this request is technical, not possible, at least not in the never future, right?

@fichtner
Copy link
Member

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.

@scalfitura
Copy link

@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!

@fichtner fichtner self-assigned this Feb 28, 2017
@fichtner fichtner added the feature Adding new functionality label Feb 28, 2017
@fichtner fichtner added this to the 17.7 milestone Feb 28, 2017
@fichtner
Copy link
Member

I'll see what we can do, thank you for the feedback :)

@fichtner fichtner modified the milestones: 18.1, 17.7 Jul 21, 2017
@fichtner fichtner modified the milestones: 18.1, 18.7 Dec 18, 2017
@fichtner fichtner added the help wanted Contributor missing / timeout label Dec 18, 2017
@reaby
Copy link

reaby commented Dec 19, 2017

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.

@fichtner
Copy link
Member

fichtner commented Dec 19, 2017

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.

@fichtner fichtner removed this from the 18.7 milestone Feb 27, 2018
@fichtner fichtner removed their assignment Jul 15, 2018
@fichtner fichtner added this to the Future milestone Jul 15, 2018
@fichtner fichtner removed the feature Adding new functionality label Jul 15, 2018
@fichtner fichtner removed this from the Future milestone Jul 30, 2018
@AdSchellevis
Copy link
Member

timeout

@Tragen
Copy link
Author

Tragen commented Mar 3, 2019

Why was this closed?
It's still not fixed.

@fabianfrz
Copy link
Member

@Tragen because nobody worked on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Contributor missing / timeout
Development

No branches or pull requests

6 participants