systemd: merge branch systemd into master

This commit is contained in:
Thomas Haller
2020-03-23 17:27:34 +01:00
41 changed files with 1216 additions and 585 deletions

View File

@@ -82,11 +82,10 @@ int parse_mode(const char *s, mode_t *ret) {
return 0;
}
int parse_ifindex(const char *s, int *ret) {
int parse_ifindex(const char *s) {
int ifi, r;
assert(s);
assert(ret);
r = safe_atoi(s, &ifi);
if (r < 0)
@@ -94,26 +93,7 @@ int parse_ifindex(const char *s, int *ret) {
if (ifi <= 0)
return -EINVAL;
*ret = ifi;
return 0;
}
int parse_ifindex_or_ifname(const char *s, int *ret) {
int r;
assert(s);
assert(ret);
r = parse_ifindex(s, ret);
if (r >= 0)
return r;
r = (int) if_nametoindex(s);
if (r <= 0)
return -errno;
*ret = r;
return 0;
return ifi;
}
int parse_mtu(int family, const char *s, uint32_t *ret) {
@@ -723,6 +703,22 @@ int parse_ip_port_range(const char *s, uint16_t *low, uint16_t *high) {
return 0;
}
int parse_ip_prefix_length(const char *s, int *ret) {
unsigned l;
int r;
r = safe_atou(s, &l);
if (r < 0)
return r;
if (l > 128)
return -ERANGE;
*ret = (int) l;
return 0;
}
int parse_dev(const char *s, dev_t *ret) {
const char *major;
unsigned x, y;