summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-08 12:53:50 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-08 12:56:57 +0200
commitde79f906ab614dd0d53129c4d4aa18a964864f39 (patch)
tree2d74175061231fbbf9000ad69c97e40dbc65af6b
parent431c3b6bab9ceb54cd144d8df24d764a8a5f8fcc (diff)
sd-rtnl: properly size attribute array if IFA_FLAGS was missing
-rw-r--r--src/libsystemd/sd-rtnl/rtnl-types.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c
index 5ae47900a3..49784bf6c6 100644
--- a/src/libsystemd/sd-rtnl/rtnl-types.c
+++ b/src/libsystemd/sd-rtnl/rtnl-types.c
@@ -348,7 +348,9 @@ static const NLTypeSystem rtnl_link_type_system = {
.types = rtnl_link_types,
};
-static const NLType rtnl_address_types[IFA_MAX + 1] = {
+/* IFA_FLAGS was defined in kernel 3.14, but we still support older
+ * kernels where IFA_MAX is lower. */
+static const NLType rtnl_address_types[CONST_MAX(IFA_MAX, IFA_FLAGS) + 1] = {
[IFA_ADDRESS] = { .type = NLA_IN_ADDR },
[IFA_LOCAL] = { .type = NLA_IN_ADDR },
[IFA_LABEL] = { .type = NLA_STRING, .size = IFNAMSIZ - 1 },