starter: Allow %any also for protocol in left|rightprotoport

This commit is contained in:
Tobias Brunner
2012-09-12 16:53:45 +02:00
parent ab2c989c32
commit 23b4d3a52f
+15 -9
View File
@@ -268,22 +268,28 @@ static void kw_end(starter_conn_t *conn, starter_end_t *end, kw_token_t token,
port = sep + 1; port = sep + 1;
} }
proto = getprotobyname(value); if (streq(value, "%any"))
if (proto)
{ {
end->protocol = proto->p_proto; end->protocol = 0;
} }
else else
{ {
p = strtol(value, &endptr, 0); proto = getprotobyname(value);
if ((*value && *endptr) || p < 0 || p > 0xff) if (proto)
{ {
DBG1(DBG_APP, "# bad protocol: %s=%s", name, value); end->protocol = proto->p_proto;
goto err; }
else
{
p = strtol(value, &endptr, 0);
if ((*value && *endptr) || p < 0 || p > 0xff)
{
DBG1(DBG_APP, "# bad protocol: %s=%s", name, value);
goto err;
}
end->protocol = (u_int8_t)p;
} }
end->protocol = (u_int8_t)p;
} }
if (streq(port, "%any")) if (streq(port, "%any"))
{ {
end->port = 0; end->port = 0;