diff --git a/shared/systemd/src/basic/fd-util.c b/shared/systemd/src/basic/fd-util.c index 219abd808..8ca1711b5 100644 --- a/shared/systemd/src/basic/fd-util.c +++ b/shared/systemd/src/basic/fd-util.c @@ -72,7 +72,7 @@ int safe_close(int fd) { return -1; } -void safe_close_pair(int p[]) { +void safe_close_pair(int p[static 2]) { assert(p); if (p[0] == p[1]) { diff --git a/shared/systemd/src/basic/fd-util.h b/shared/systemd/src/basic/fd-util.h index 00303a7e4..4085a244d 100644 --- a/shared/systemd/src/basic/fd-util.h +++ b/shared/systemd/src/basic/fd-util.h @@ -14,7 +14,7 @@ int close_nointr(int fd); int safe_close(int fd); -void safe_close_pair(int p[]); +void safe_close_pair(int p[static 2]); static inline int safe_close_above_stdio(int fd) { if (fd < 3) /* Don't close stdin/stdout/stderr, but still invalidate the fd by returning -1 */ diff --git a/shared/systemd/src/basic/siphash24.h b/shared/systemd/src/basic/siphash24.h index 42a4ec0a4..be1d3e009 100644 --- a/shared/systemd/src/basic/siphash24.h +++ b/shared/systemd/src/basic/siphash24.h @@ -45,14 +45,14 @@ siphash24 (const void *in, size_t inlen, const uint8_t k[16]) } #endif /* NM_IGNORED */ -void siphash24_init(struct siphash *state, const uint8_t k[16]); +void siphash24_init(struct siphash *state, const uint8_t k[static 16]); void siphash24_compress(const void *in, size_t inlen, struct siphash *state); #define siphash24_compress_byte(byte, state) siphash24_compress((const uint8_t[]) { (byte) }, 1, (state)) uint64_t siphash24_finalize(struct siphash *state); -uint64_t siphash24(const void *in, size_t inlen, const uint8_t k[16]); +uint64_t siphash24(const void *in, size_t inlen, const uint8_t k[static 16]); -static inline uint64_t siphash24_string(const char *s, const uint8_t k[16]) { +static inline uint64_t siphash24_string(const char *s, const uint8_t k[static 16]) { return siphash24(s, strlen(s) + 1, k); } diff --git a/shared/systemd/src/basic/string-util.c b/shared/systemd/src/basic/string-util.c index de35c1809..0e9619276 100644 --- a/shared/systemd/src/basic/string-util.c +++ b/shared/systemd/src/basic/string-util.c @@ -748,7 +748,7 @@ char *strreplace(const char *text, const char *old_string, const char *new_strin return ret; } -static void advance_offsets(ssize_t diff, size_t offsets[2], size_t shift[2], size_t size) { +static void advance_offsets(ssize_t diff, size_t offsets[static 2], size_t shift[static 2], size_t size) { if (!offsets) return; diff --git a/shared/systemd/src/basic/time-util.c b/shared/systemd/src/basic/time-util.c index 0f00c4a77..4e609a647 100644 --- a/shared/systemd/src/basic/time-util.c +++ b/shared/systemd/src/basic/time-util.c @@ -26,9 +26,6 @@ #include "parse-util.h" #include "path-util.h" #include "process-util.h" -#if 0 /* NM_IGNORED */ -#include "serialize.h" -#endif /* NM_IGNORED */ #include "stat-util.h" #include "string-util.h" #include "strv.h" diff --git a/shared/systemd/src/basic/util.c b/shared/systemd/src/basic/util.c index 50986cfb9..7686ecd21 100644 --- a/shared/systemd/src/basic/util.c +++ b/shared/systemd/src/basic/util.c @@ -562,7 +562,7 @@ uint64_t system_tasks_max_scale(uint64_t v, uint64_t max) { } int version(void) { - puts(PACKAGE_STRING "\n" + puts("systemd " STRINGIFY(PROJECT_VERSION) " (" GIT_VERSION ")\n" SYSTEMD_FEATURES); return 0; } diff --git a/src/systemd/src/libsystemd-network/lldp-neighbor.c b/src/systemd/src/libsystemd-network/lldp-neighbor.c index 0b4929af3..bbe7bf9d0 100644 --- a/src/systemd/src/libsystemd-network/lldp-neighbor.c +++ b/src/systemd/src/libsystemd-network/lldp-neighbor.c @@ -693,7 +693,7 @@ _public_ int sd_lldp_neighbor_tlv_is_type(sd_lldp_neighbor *n, uint8_t type) { return type == k; } -_public_ int sd_lldp_neighbor_tlv_get_oui(sd_lldp_neighbor *n, uint8_t oui[3], uint8_t *subtype) { +_public_ int sd_lldp_neighbor_tlv_get_oui(sd_lldp_neighbor *n, uint8_t oui[_SD_ARRAY_STATIC 3], uint8_t *subtype) { const uint8_t *d; size_t length; int r; @@ -722,7 +722,7 @@ _public_ int sd_lldp_neighbor_tlv_get_oui(sd_lldp_neighbor *n, uint8_t oui[3], u return 0; } -_public_ int sd_lldp_neighbor_tlv_is_oui(sd_lldp_neighbor *n, const uint8_t oui[3], uint8_t subtype) { +_public_ int sd_lldp_neighbor_tlv_is_oui(sd_lldp_neighbor *n, const uint8_t oui[_SD_ARRAY_STATIC 3], uint8_t subtype) { uint8_t k[3], st; int r; diff --git a/src/systemd/src/libsystemd-network/sd-dhcp-client.c b/src/systemd/src/libsystemd-network/sd-dhcp-client.c index 4fb068806..2f9244d87 100644 --- a/src/systemd/src/libsystemd-network/sd-dhcp-client.c +++ b/src/systemd/src/libsystemd-network/sd-dhcp-client.c @@ -120,19 +120,19 @@ static const uint8_t default_req_opts[] = { */ /* NOTE: using PRL options that Windows 10 RFC7844 implementation uses */ static const uint8_t default_req_opts_anonymize[] = { - SD_DHCP_OPTION_SUBNET_MASK, /* 1 */ - SD_DHCP_OPTION_ROUTER, /* 3 */ - SD_DHCP_OPTION_DOMAIN_NAME_SERVER, /* 6 */ - SD_DHCP_OPTION_DOMAIN_NAME, /* 15 */ - SD_DHCP_OPTION_ROUTER_DISCOVER, /* 31 */ - SD_DHCP_OPTION_STATIC_ROUTE, /* 33 */ - SD_DHCP_OPTION_VENDOR_SPECIFIC, /* 43 */ - SD_DHCP_OPTION_NETBIOS_NAMESERVER, /* 44 */ - SD_DHCP_OPTION_NETBIOS_NODETYPE, /* 46 */ - SD_DHCP_OPTION_NETBIOS_SCOPE, /* 47 */ - SD_DHCP_OPTION_CLASSLESS_STATIC_ROUTE, /* 121 */ - SD_DHCP_OPTION_PRIVATE_CLASSLESS_STATIC_ROUTE, /* 249 */ - SD_DHCP_OPTION_PRIVATE_PROXY_AUTODISCOVERY, /* 252 */ + SD_DHCP_OPTION_SUBNET_MASK, /* 1 */ + SD_DHCP_OPTION_ROUTER, /* 3 */ + SD_DHCP_OPTION_DOMAIN_NAME_SERVER, /* 6 */ + SD_DHCP_OPTION_DOMAIN_NAME, /* 15 */ + SD_DHCP_OPTION_ROUTER_DISCOVER, /* 31 */ + SD_DHCP_OPTION_STATIC_ROUTE, /* 33 */ + SD_DHCP_OPTION_VENDOR_SPECIFIC, /* 43 */ + SD_DHCP_OPTION_NETBIOS_NAMESERVER, /* 44 */ + SD_DHCP_OPTION_NETBIOS_NODETYPE, /* 46 */ + SD_DHCP_OPTION_NETBIOS_SCOPE, /* 47 */ + SD_DHCP_OPTION_CLASSLESS_STATIC_ROUTE, /* 121 */ + SD_DHCP_OPTION_PRIVATE_CLASSLESS_STATIC_ROUTE, /* 249 */ + SD_DHCP_OPTION_PRIVATE_PROXY_AUTODISCOVERY, /* 252 */ }; static int client_receive_message_raw( @@ -357,9 +357,9 @@ static int dhcp_client_set_iaid_duid_internal( size_t len; assert_return(client, -EINVAL); - assert_return(duid_len == 0 || duid != NULL, -EINVAL); + assert_return(duid_len == 0 || duid, -EINVAL); - if (duid != NULL) { + if (duid) { r = dhcp_validate_duid_len(duid_type, duid_len, true); if (r < 0) return r; @@ -381,7 +381,7 @@ static int dhcp_client_set_iaid_duid_internal( } } - if (duid != NULL) { + if (duid) { client->client_id.ns.duid.type = htobe16(duid_type); memcpy(&client->client_id.ns.duid.raw.data, duid, duid_len); len = sizeof(client->client_id.ns.duid.type) + duid_len; @@ -1800,7 +1800,7 @@ static int client_receive_message_raw( } else if ((size_t)len < sizeof(DHCPPacket)) return 0; - CMSG_FOREACH(cmsg, &msg) { + CMSG_FOREACH(cmsg, &msg) if (cmsg->cmsg_level == SOL_PACKET && cmsg->cmsg_type == PACKET_AUXDATA && cmsg->cmsg_len == CMSG_LEN(sizeof(struct tpacket_auxdata))) { @@ -1809,7 +1809,6 @@ static int client_receive_message_raw( checksum = !(aux->tp_status & TP_STATUS_CSUMNOTREADY); break; } - } r = dhcp_packet_verify_headers(packet, len, checksum, client->port); if (r < 0) diff --git a/src/systemd/src/libsystemd/sd-id128/sd-id128.c b/src/systemd/src/libsystemd/sd-id128/sd-id128.c index 4a57b82fb..a476017b3 100644 --- a/src/systemd/src/libsystemd/sd-id128/sd-id128.c +++ b/src/systemd/src/libsystemd/sd-id128/sd-id128.c @@ -21,7 +21,7 @@ #include "util.h" #if 0 /* NM_IGNORED */ -_public_ char *sd_id128_to_string(sd_id128_t id, char s[SD_ID128_STRING_MAX]) { +_public_ char *sd_id128_to_string(sd_id128_t id, char s[_SD_ARRAY_STATIC SD_ID128_STRING_MAX]) { unsigned n; assert_return(s, NULL); diff --git a/src/systemd/src/systemd/_sd-common.h b/src/systemd/src/systemd/_sd-common.h index 05c38008c..b3ee7bbc2 100644 --- a/src/systemd/src/systemd/_sd-common.h +++ b/src/systemd/src/systemd/_sd-common.h @@ -72,6 +72,14 @@ typedef void (*_sd_destroy_t)(void *userdata); # endif #endif +#ifndef _SD_ARRAY_STATIC +# if __STDC_VERSION__ >= 199901L +# define _SD_ARRAY_STATIC static +# else +# define _SD_ARRAY_STATIC +# endif +#endif + #define _SD_DEFINE_POINTER_CLEANUP_FUNC(type, func) \ static __inline__ void func##p(type **p) { \ if (*p) \ diff --git a/src/systemd/src/systemd/sd-id128.h b/src/systemd/src/systemd/sd-id128.h index f4c05a368..bdf88ed53 100644 --- a/src/systemd/src/systemd/sd-id128.h +++ b/src/systemd/src/systemd/sd-id128.h @@ -35,7 +35,7 @@ union sd_id128 { #define SD_ID128_STRING_MAX 33 -char *sd_id128_to_string(sd_id128_t id, char s[SD_ID128_STRING_MAX]); +char *sd_id128_to_string(sd_id128_t id, char s[_SD_ARRAY_STATIC SD_ID128_STRING_MAX]); int sd_id128_from_string(const char *s, sd_id128_t *ret); int sd_id128_randomize(sd_id128_t *ret); diff --git a/src/systemd/src/systemd/sd-lldp.h b/src/systemd/src/systemd/sd-lldp.h index a3e5cd6be..bf3afadce 100644 --- a/src/systemd/src/systemd/sd-lldp.h +++ b/src/systemd/src/systemd/sd-lldp.h @@ -27,7 +27,7 @@ _SD_BEGIN_DECLARATIONS; -/* IEEE 802.3AB Clause 9: TLV Types */ +/* IEEE 802.1AB-2009 Clause 8: TLV Types */ enum { SD_LLDP_TYPE_END = 0, SD_LLDP_TYPE_CHASSIS_ID = 1, @@ -41,7 +41,7 @@ enum { SD_LLDP_TYPE_PRIVATE = 127, }; -/* IEEE 802.3AB Clause 9.5.2: Chassis subtypes */ +/* IEEE 802.1AB-2009 Clause 8.5.2: Chassis subtypes */ enum { SD_LLDP_CHASSIS_SUBTYPE_RESERVED = 0, SD_LLDP_CHASSIS_SUBTYPE_CHASSIS_COMPONENT = 1, @@ -53,7 +53,7 @@ enum { SD_LLDP_CHASSIS_SUBTYPE_LOCALLY_ASSIGNED = 7, }; -/* IEEE 802.3AB Clause 9.5.3: Port subtype */ +/* IEEE 802.1AB-2009 Clause 8.5.3: Port subtype */ enum { SD_LLDP_PORT_SUBTYPE_RESERVED = 0, SD_LLDP_PORT_SUBTYPE_INTERFACE_ALIAS = 1, @@ -65,6 +65,7 @@ enum { SD_LLDP_PORT_SUBTYPE_LOCALLY_ASSIGNED = 7, }; +/* IEEE 802.1AB-2009 Clause 8.5.8: System capabilities */ enum { SD_LLDP_SYSTEM_CAPABILITIES_OTHER = 1 << 0, SD_LLDP_SYSTEM_CAPABILITIES_REPEATER = 1 << 1, @@ -95,6 +96,7 @@ enum { #define SD_LLDP_OUI_802_1 (uint8_t[]) { 0x00, 0x80, 0xc2 } #define SD_LLDP_OUI_802_3 (uint8_t[]) { 0x00, 0x12, 0x0f } +/* IEEE 802.1AB-2009 Annex E */ enum { SD_LLDP_OUI_802_1_SUBTYPE_PORT_VLAN_ID = 1, SD_LLDP_OUI_802_1_SUBTYPE_PORT_PROTOCOL_VLAN_ID = 2, @@ -105,6 +107,14 @@ enum { SD_LLDP_OUI_802_1_SUBTYPE_LINK_AGGREGATION = 7, }; +/* IEEE 802.1AB-2009 Annex F */ +enum { + SD_LLDP_OUI_802_3_SUBTYPE_MAC_PHY_CONFIG_STATUS = 1, + SD_LLDP_OUI_802_3_SUBTYPE_POWER_VIA_MDI = 2, + SD_LLDP_OUI_802_3_SUBTYPE_LINK_AGGREGATION = 3, + SD_LLDP_OUI_802_3_SUBTYPE_MAXIMUM_FRAME_SIZE = 4, +}; + typedef struct sd_lldp sd_lldp; typedef struct sd_lldp_neighbor sd_lldp_neighbor; @@ -168,8 +178,8 @@ int sd_lldp_neighbor_tlv_rewind(sd_lldp_neighbor *n); int sd_lldp_neighbor_tlv_next(sd_lldp_neighbor *n); int sd_lldp_neighbor_tlv_get_type(sd_lldp_neighbor *n, uint8_t *type); int sd_lldp_neighbor_tlv_is_type(sd_lldp_neighbor *n, uint8_t type); -int sd_lldp_neighbor_tlv_get_oui(sd_lldp_neighbor *n, uint8_t oui[3], uint8_t *subtype); -int sd_lldp_neighbor_tlv_is_oui(sd_lldp_neighbor *n, const uint8_t oui[3], uint8_t subtype); +int sd_lldp_neighbor_tlv_get_oui(sd_lldp_neighbor *n, uint8_t oui[_SD_ARRAY_STATIC 3], uint8_t *subtype); +int sd_lldp_neighbor_tlv_is_oui(sd_lldp_neighbor *n, const uint8_t oui[_SD_ARRAY_STATIC 3], uint8_t subtype); int sd_lldp_neighbor_tlv_get_raw(sd_lldp_neighbor *n, const void **ret, size_t *size); _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_lldp, sd_lldp_unref);