-
Notifications
You must be signed in to change notification settings - Fork 810
Kea static route GUI validation #8742
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
Kea static route GUI validation #8742
Conversation
This implements opnsense#8738. I know it is ugly, yet I have found no easy way to use NetworkField, because the list may only contain an even number of IPv4s. Otherwise, clients will reject the whole DHCP response.
You could create a custom field type instead. E.g.:
|
I will try that later. Question: Do I need to / can I transform the output? In this case, it would be better if the single elements would be specified like 0.0.0.0,1.2.3.4 and grouped like in a NetworkField, but the output has to concatenate them together, separated by commas. BTW: The "Unifi" option is a similar case where an IP must be transformed to a binary string. |
Change to specific KeaRoutesField
Add specific KeaRoutesField type
Output separate lines as one comma-separated line
Change help text for new type
@Monviech: I think this works now - at least for me, it does. I have not really looked at migrations (if people specified multiple routes earlier, they must edit the input manually) and I found nothing in the API as a blueprint for this, either. I think that the API code misses the options altogether, right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is all I can add, custom field types are more in @AdSchellevis domain.
if (empty($entry)) { | ||
continue; | ||
} elseif (count($parts) == 2 && Util::isIpAddress($parts[0]) && Util:: | ||
isIpAddress($parts[1])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line break is weird
continue; | ||
} | ||
$messages[] = sprintf(gettext('Entry "%s" is not a valid dest-ip,route | ||
r-ip pair.'), $entry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line break is weird
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Copy&paste error. Fixed.
Sorry, copy-paste error w/r to line breaks.
This implements #8738.
I know a regex is ugly, yet I have found no easy way to use NetworkField, because the list may only contain pairs of destination/router ips. Otherwise, clients will reject the whole DHCP offer.