-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Should the portrange
data type accept a single port?
#7242
Comments
I would suggest that the ubox verify here also tries a 'port' type if the 'portrange' type check fails or ping @jow- @robimarko @Ansuel from e.g. static bool
dt_type_port(struct dt_state *s, int nargs)
{
int n;
char *e;
n = strtoul(s->value, &e, 10);
return (e > s->value && *e == 0 && n <= 65535);
}
static bool
dt_type_portrange(struct dt_state *s, int nargs)
{
int n, m;
char *e;
n = strtoul(s->value, &e, 10);
if (e == s->value || *e != '-')
return false;
m = strtoul(e + 1, &e, 10);
return (*e == 0 && n <= 65535 && m <= 65535 && n <= m);
} to static bool
dt_type_portrange(struct dt_state *s, int nargs)
{
int n, m;
char *e;
n = strtoul(s->value, &e, 10);
- if (e == s->value || *e != '-')
- return false;
+ if (e == s->value || *e != '-') {
+ // If parsing as portrange fails, try parsing as a single port
+ return dt_type_port(s, nargs);
+ }
m = strtoul(e + 1, &e, 10);
return (*e == 0 && n <= 65535 && m <= 65535 && n <= m);
} |
systemcrash
changed the title
Should the
Should the Aug 17, 2024
portrange
data type accept a signle port?portrange
data type accept a single port?
Sent a patch to the dev mailing list... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm confused because, In
natmap.js
, theportrange
data type accepts both a port range and a single port. However, Innatmap.init
,portrange
does not accept a single port.luci/applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js
Lines 93 to 95 in ca57a08
https://github.com/openwrt/packages/blob/1019631a5a81a4b44035133364de2293bcc75d9d/net/natmap/files/natmap.init#L18-L33
Should the
portrange
data type accept a single port?The text was updated successfully, but these errors were encountered: