networkd: add support to configure ip rule port range and protocol.

Please see:

iprule: support for ip_proto, sport and dport match options
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=f686f764682745daf6a93b0a6330ba42a961f858

Closes 10622
This commit is contained in:
Susant Sahani
2018-11-28 20:06:28 +05:30
parent 59a2a18e27
commit 926062f083
17 changed files with 359 additions and 17 deletions
+20
View File
@@ -710,6 +710,26 @@ int parse_ip_port(const char *s, uint16_t *ret) {
return 0;
}
int parse_ip_port_range(const char *s, uint16_t *low, uint16_t *high) {
unsigned l, h;
int r;
r = parse_range(s, &l, &h);
if (r < 0)
return r;
if (l <= 0 || l > 65535 || h <= 0 || h > 65535)
return -EINVAL;
if (h < l)
return -EINVAL;
*low = l;
*high = h;
return 0;
}
int parse_dev(const char *s, dev_t *ret) {
unsigned x, y;
dev_t d;