From ea9edc1f9961b0cd0fb5a6968a79f8d1b1493e14 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Tue, 14 Mar 2017 00:51:17 +0100 Subject: [PATCH] hwsim: Fix netlink attribute size calculation The name attribute in the NEW RADIO command needs at least 4 bytes for the attribute header (struct nlattr), all the characters of the name string and a NUL byte, and up to 3 bytes of alignment padding. Otherwise, depending on the name length and whether the NO_VIF attribute was the last, that attribute could end up being dropped and we were ending up with too many interfaces inside test-runner. --- tools/hwsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/hwsim.c b/tools/hwsim.c index c28144c6..22799fc9 100644 --- a/tools/hwsim.c +++ b/tools/hwsim.c @@ -2090,7 +2090,7 @@ static void hwsim_ready(void *user_data) msg_size += 4; if (radio_name_attr) - msg_size += strlen(radio_name_attr) + 1; + msg_size += strlen(radio_name_attr) + 8; if (no_vif_attr) msg_size += 4;