OPNsense Forum

Archive => 23.7 Legacy Series => Topic started by: that_kid on October 05, 2023, 07:48:47 PM

Title: Can only add host to alias via api if I use letter A-F or IP
Post by: that_kid on October 05, 2023, 07:48:47 PM
I'm not sure if I'm going crazy or not so I wanted to post here in hopes someone else can try this and see if it works.  I have an alias and I would like to add a FQDN to the alias via the "alias_util/add" api but whenever I get an error  "status": "not_an_address".  I can add IP's without issues and any FQDN that is not past letter F, so aaa.aaa works, aaa.aaf works but aaa.aag does not.  Looking at the code on GH and it looks like the regex only includes letters A-F 

            if (preg_match("/[^0-9a-f\:\.\/_]/", $address)) {
               return array("status" => "not_an_address");


I just wanted to make sure I was on the correct track before submitting a Github issue.
Title: Re: Can only add host to alias via api if I use letter A-F or IP
Post by: Maurice on October 06, 2023, 03:12:05 PM
The regex is supposed to only allow IP addresses. a-f and ':' are required for IPv6.

Whether that's intentional I don't know.

Cheers
Maurice