sd-rtnl: properly size attribute array if IFA_FLAGS was missing

This commit is contained in:
Lennart Poettering 2015-04-08 12:53:50 +02:00
parent 431c3b6bab
commit de79f906ab
1 changed files with 3 additions and 1 deletions

View File

@ -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 },