OPNsense Forum

Archive => 22.1 Legacy Series => Topic started by: Karl_MCS on April 19, 2022, 03:55:37 PM

Title: Unable to set host alias to an IP range
Post by: Karl_MCS on April 19, 2022, 03:55:37 PM
Good morning,

As shown in the documentation here: https://docs.opnsense.org/manual/aliases.html#hosts (https://docs.opnsense.org/manual/aliases.html#hosts)

It should be possible to set a Host(s) alias to an IP range.  After installing from OPNsense-22.1.2-OpenSSL-dvd-amd64.iso I was able to do so.  However since updating OPNsense to version 22.1.6, it will no longer let me do this.  When I enter an IP range, it says:

Quote"Entry "xx.xx.xx.xx-xx.xx.xx.xx" is not a valid hostname or IP address."

Even if I go to the alias I had previously configured, remove and re-enter the exact IP range, and hit save, I get this error now.
Title: Re: Unable to set host alias to an IP range
Post by: meyergru on April 19, 2022, 07:09:36 PM
It works when you enter 192.168.7.1-8, but not for 192.168.7.1-192.168.7.8.

You should open an issue on github.
Title: Re: Unable to set host alias to an IP range
Post by: franco on April 20, 2022, 08:33:11 AM
Seems to be a bug, probably from having to extend host validation to accommodate for Unbound implementation quirks. Taking a closer look now.


Cheers,
Franco
Title: Re: Unable to set host alias to an IP range
Post by: franco on April 20, 2022, 08:41:37 AM
It works for network(s) and nothing was changed there in a long time. I wonder if the documentation is wrong and nobody caught it?


Cheers,
Franco
Title: Re: Unable to set host alias to an IP range
Post by: zerwes on April 20, 2022, 08:57:28 AM
I can confirm it works for hosts and networks on
21.7.8
for Hosts and Networks
   test   Host(s)       10.0.0.1-10.0.0.10   5   2022-04-20T08:52:26.845698   
   test2   Network(s)       10.0.0.1-10.0.0.10   5   2022-04-20T08:52:53.563361
Title: Re: Unable to set host alias to an IP range
Post by: zerwes on April 20, 2022, 09:09:58 AM
on 22.1.6
I get the error for a host alias w/ range
Entry "10.0.0.1-10.0.0.10" is not a valid hostname or IP address.
Network alias works as expected ...
Title: Re: Unable to set host alias to an IP range
Post by: zerwes on April 20, 2022, 09:13:08 AM
https://docs.opnsense.org/manual/aliases.html#hosts
QuoteHosts can be entered as a single IP address, a range (separated with a minus sign, e.g. 10.0.0.1-10.0.0.10) or a fully qualified domain name.
https://docs.opnsense.org/manual/aliases.html#networks
Here the range syntax using a minus sign is not documented.
Title: Re: Unable to set host alias to an IP range
Post by: franco on April 20, 2022, 09:33:43 AM
Please raise an issue on GitHub so it's not forgotten. The file in question holding the validation hasn't been changed since December 2021:

https://github.com/opnsense/core/commits/master/src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/AliasContentField.php

Currently the assumption is 22.1.2 - 22.1.6. If that could be narrowed down further that would be helpful.


Cheers,
Franco
Title: Re: Unable to set host alias to an IP range
Post by: zerwes on April 20, 2022, 09:37:34 AM
QuoteCurrently the assumption is 22.1.2 - 22.1.6. If that could be narrowed down further that would be helpful.
I'll try to do some kind of "version bisecting" ...
Title: Re: Unable to set host alias to an IP range
Post by: zerwes on April 20, 2022, 09:48:03 AM
github issue:
https://github.com/opnsense/core/issues/5723
Title: Re: Unable to set host alias to an IP range
Post by: zerwes on April 20, 2022, 10:34:04 AM
Versions and test results:






22.1.2_1OK
22.1.3OK
22.1.4_1ERROR
22.1.5ERROR
22.1.6ERROR
Title: Re: Unable to set host alias to an IP range
Post by: zerwes on April 20, 2022, 11:40:58 AM
just for the record here ...
code in question identified by the opnsense team.
see: https://github.com/opnsense/core/issues/5723#issuecomment-1103627045
Title: Re: Unable to set host alias to an IP range
Post by: inorx on March 04, 2023, 01:21:33 PM
-
Title: Re: Unable to set host alias to an IP range
Post by: inorx on March 04, 2023, 01:32:20 PM
-