summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/netlink_manager.cpp4
-rw-r--r--tests/nl80211_attribute_unittest.cpp12
2 files changed, 9 insertions, 7 deletions
diff --git a/net/netlink_manager.cpp b/net/netlink_manager.cpp
index 74b156c..b612514 100644
--- a/net/netlink_manager.cpp
+++ b/net/netlink_manager.cpp
@@ -179,12 +179,14 @@ void NetlinkManager::OnNewFamily(unique_ptr<const NL80211Packet> packet) {
179 } 179 }
180 for (auto& group : groups) { 180 for (auto& group : groups) {
181 string group_name; 181 string group_name;
182 uint32_t group_id; 182 uint32_t group_id = 0;
183 if (!group.GetAttributeValue(CTRL_ATTR_MCAST_GRP_NAME, &group_name)) { 183 if (!group.GetAttributeValue(CTRL_ATTR_MCAST_GRP_NAME, &group_name)) {
184 LOG(ERROR) << "Failed to get group name"; 184 LOG(ERROR) << "Failed to get group name";
185 continue;
185 } 186 }
186 if (!group.GetAttributeValue(CTRL_ATTR_MCAST_GRP_ID, &group_id)) { 187 if (!group.GetAttributeValue(CTRL_ATTR_MCAST_GRP_ID, &group_id)) {
187 LOG(ERROR) << "Failed to get group id"; 188 LOG(ERROR) << "Failed to get group id";
189 continue;
188 } 190 }
189 message_types_[family_name].groups[group_name] = group_id; 191 message_types_[family_name].groups[group_name] = group_id;
190 } 192 }
diff --git a/tests/nl80211_attribute_unittest.cpp b/tests/nl80211_attribute_unittest.cpp
index dccde57..24ec92e 100644
--- a/tests/nl80211_attribute_unittest.cpp
+++ b/tests/nl80211_attribute_unittest.cpp
@@ -271,12 +271,12 @@ TEST(NL80211AttributeTest, GetListOfNestedAttributesFromBuffer) {
271 NL80211NestedAttr attr(buffer); 271 NL80211NestedAttr attr(buffer);
272 EXPECT_TRUE(attr.GetListOfNestedAttributes(&nested_attrs)); 272 EXPECT_TRUE(attr.GetListOfNestedAttributes(&nested_attrs));
273 EXPECT_TRUE(nested_attrs.size() == 3); 273 EXPECT_TRUE(nested_attrs.size() == 3);
274 uint16_t value1; 274 uint16_t value1 = 0;
275 uint32_t value2; 275 uint32_t value2 = 0;
276 uint8_t value3; 276 uint8_t value3 = 0;
277 EXPECT_TRUE(nested_attrs[0].GetAttributeValue(1, &value1)); 277 ASSERT_TRUE(nested_attrs[0].GetAttributeValue(1, &value1));
278 EXPECT_TRUE(nested_attrs[1].GetAttributeValue(1, &value2)); 278 ASSERT_TRUE(nested_attrs[1].GetAttributeValue(1, &value2));
279 EXPECT_TRUE(nested_attrs[2].GetAttributeValue(1, &value3)); 279 ASSERT_TRUE(nested_attrs[2].GetAttributeValue(1, &value3));
280 EXPECT_TRUE(value1 == 5); 280 EXPECT_TRUE(value1 == 5);
281 EXPECT_TRUE(value2 == 10); 281 EXPECT_TRUE(value2 == 10);
282 EXPECT_TRUE(value3 == 8); 282 EXPECT_TRUE(value3 == 8);