diff options
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | man/hostnamectl.xml | 1 | ||||
-rw-r--r-- | man/machine-info.xml | 1 | ||||
-rw-r--r-- | shell-completion/bash/hostnamectl | 2 | ||||
-rw-r--r-- | shell-completion/zsh/_hostnamectl | 2 | ||||
-rw-r--r-- | src/basic/socket-util.c | 20 | ||||
-rw-r--r-- | src/basic/socket-util.h | 1 | ||||
-rw-r--r-- | src/hostname/hostnamed.c | 4 | ||||
-rw-r--r-- | src/network/networkd-address.c | 4 |
9 files changed, 35 insertions, 4 deletions
@@ -42,6 +42,10 @@ Features: quickly exiting processes which log as long as they had their own stream connection... +* hostnamed: populate form factor data from a new hwdb database, so that old + yogas can be recognized as "convertible" too, even if they predate the DMI + "convertible" form factor + * Maybe add a small tool invoked early at boot, that adds in or resizes partitions automatically, to be used when the media used is actually larger than the image written onto it is. diff --git a/man/hostnamectl.xml b/man/hostnamectl.xml index 9e1b593e6d..81bce2da6a 100644 --- a/man/hostnamectl.xml +++ b/man/hostnamectl.xml @@ -173,6 +173,7 @@ defined: <literal>desktop</literal>, <literal>laptop</literal>, + <literal>convertible</literal>, <literal>server</literal>, <literal>tablet</literal>, <literal>handset</literal>, diff --git a/man/machine-info.xml b/man/machine-info.xml index 351133670b..cd5997d4e2 100644 --- a/man/machine-info.xml +++ b/man/machine-info.xml @@ -120,6 +120,7 @@ chassis types are defined: <literal>desktop</literal>, <literal>laptop</literal>, + <literal>convertible</literal>, <literal>server</literal>, <literal>tablet</literal>, <literal>handset</literal>, diff --git a/shell-completion/bash/hostnamectl b/shell-completion/bash/hostnamectl index 6a252188ea..7cf8b6f631 100644 --- a/shell-completion/bash/hostnamectl +++ b/shell-completion/bash/hostnamectl @@ -52,7 +52,7 @@ _hostnamectl() { if [[ -z $verb ]]; then comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[CHASSIS]}; then - comps='desktop laptop server tablet handset watch embedded vm container' + comps='desktop laptop convertible server tablet handset watch embedded vm container' elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[ICONS]} ${VERBS[NAME]}; then comps='' fi diff --git a/shell-completion/zsh/_hostnamectl b/shell-completion/zsh/_hostnamectl index 7528e0649d..8c4a354af2 100644 --- a/shell-completion/zsh/_hostnamectl +++ b/shell-completion/zsh/_hostnamectl @@ -18,7 +18,7 @@ _hostnamectl_set-icon-name() { _hostnamectl_set-chassis() { if (( CURRENT <= 3 )); then - _chassis=( desktop laptop server tablet handset watch embedded vm container ) + _chassis=( desktop laptop convertible server tablet handset watch embedded vm container ) _describe chassis _chassis else _message "no more options" diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c index 17e90a8994..e5847dce00 100644 --- a/src/basic/socket-util.c +++ b/src/basic/socket-util.c @@ -900,6 +900,26 @@ bool ifname_valid(const char *p) { return true; } +bool address_label_valid(const char *p) { + + if (isempty(p)) + return false; + + if (strlen(p) >= IFNAMSIZ) + return false; + + while (*p) { + if ((uint8_t) *p >= 127U) + return false; + + if ((uint8_t) *p <= 31U) + return false; + p++; + } + + return true; +} + int getpeercred(int fd, struct ucred *ucred) { socklen_t n = sizeof(struct ucred); struct ucred u; diff --git a/src/basic/socket-util.h b/src/basic/socket-util.h index 3c42e220e5..73c3a339fc 100644 --- a/src/basic/socket-util.h +++ b/src/basic/socket-util.h @@ -126,6 +126,7 @@ int ip_tos_to_string_alloc(int i, char **s); int ip_tos_from_string(const char *s); bool ifname_valid(const char *p); +bool address_label_valid(const char *p); int getpeercred(int fd, struct ucred *ucred); int getpeersec(int fd, char **ret); diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index 4657cf8c77..a8df3dd2ed 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -133,6 +133,7 @@ static bool valid_chassis(const char *chassis) { "container\0" "desktop\0" "laptop\0" + "convertible\0" "server\0" "tablet\0" "handset\0" @@ -199,6 +200,9 @@ static const char* fallback_chassis(void) { case 0x1E: /* Tablet */ return "tablet"; + + case 0x1F: /* Convertible */ + return "convertible"; } try_acpi: diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index e34793e50b..2e6c763aba 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -821,8 +821,8 @@ int config_parse_label( if (r < 0) return r; - if (strlen(rvalue) >= IFNAMSIZ) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Interface label is too long, ignoring assignment: %s", rvalue); + if (!address_label_valid(rvalue)) { + log_syntax(unit, LOG_ERR, filename, line, 0, "Interface label is too long or invalid, ignoring assignment: %s", rvalue); return 0; } |