sysctl-util: make sysctl_write_ip_property() a wrapper around sysctl_write()
It does the same stuff, let's use the same codepaths as much as we can. And while we are at it, let's generate good error codes in case we are called with unsupported parameters/let's validate stuff more that might originate from user input.
This commit is contained in:
@@ -135,9 +135,10 @@ int ip_tos_to_string_alloc(int i, char **s);
|
||||
int ip_tos_from_string(const char *s);
|
||||
|
||||
typedef enum {
|
||||
IFNAME_VALID_ALTERNATIVE = 1 << 0,
|
||||
IFNAME_VALID_NUMERIC = 1 << 1,
|
||||
_IFNAME_VALID_ALL = IFNAME_VALID_ALTERNATIVE | IFNAME_VALID_NUMERIC,
|
||||
IFNAME_VALID_ALTERNATIVE = 1 << 0, /* Allow "altnames" too */
|
||||
IFNAME_VALID_NUMERIC = 1 << 1, /* Allow decimal formatted ifindexes too */
|
||||
IFNAME_VALID_SPECIAL = 1 << 2, /* Allow the special names "all" and "default" */
|
||||
_IFNAME_VALID_ALL = IFNAME_VALID_ALTERNATIVE | IFNAME_VALID_NUMERIC | IFNAME_VALID_SPECIAL,
|
||||
} IfnameValidFlags;
|
||||
bool ifname_valid_char(char a);
|
||||
bool ifname_valid_full(const char *p, IfnameValidFlags flags);
|
||||
|
||||
Reference in New Issue
Block a user