For some reason GCC 4.8 doesn't like this style of initialization,
complaining that nla_type is missing in the initializer:
tests/test-netlink-policy.c: In function 'test_nl_policy_parse_ll_addr':
tests/test-netlink-policy.c:60:9:
error: missing initializer for field 'nla_type' of 'struct nlattr'
[-Werror=missing-field-initializers]
.nlattr.nla_type = TEST_POLICY_ATTR,
^
Let's use a normal designated initializer for the nested structure
to avoid this issue.
Fixes: 2f2ae5b6bdef ("tests: Fix endianness in netlink policy test fixtures.")
Signed-off-by: Ilya Maximets <[email protected]>
---
tests/test-netlink-policy.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/tests/test-netlink-policy.c b/tests/test-netlink-policy.c
index 55083935a..fee65fc30 100644
--- a/tests/test-netlink-policy.c
+++ b/tests/test-netlink-policy.c
@@ -48,35 +48,30 @@ test_nl_policy_parse_ll_addr(struct ovs_cmdl_context *ctx
OVS_UNUSED) {
struct nlattr *attrs[ARRAY_SIZE(policy)];
struct nlattr_fixture fixture_nl_data_policy_short = {
/* too short according to policy */
- .nlattr.nla_len = 5,
- .nlattr.nla_type = TEST_POLICY_ATTR,
+ .nlattr = { .nla_len = 5, .nla_type = TEST_POLICY_ATTR },
.data = { 0x00 },
};
struct nlattr_fixture fixture_nl_data_policy_long = {
/* too long according to policy */
- .nlattr.nla_len = 25,
- .nlattr.nla_type = TEST_POLICY_ATTR,
+ .nlattr = { .nla_len = 25, .nla_type = TEST_POLICY_ATTR },
.data = { 0x00, 0x00, 0x67, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xe4, 0x1d, 0x2d, 0x03, 0x00, 0xa5, 0xf0, 0x2f, 0x00,
0x00 },
};
struct nlattr_fixture fixture_nl_data_eth = {
/* valid policy and eth_addr length */
- .nlattr.nla_len = 10,
- .nlattr.nla_type = TEST_POLICY_ATTR,
+ .nlattr = { .nla_len = 10, .nla_type = TEST_POLICY_ATTR },
.data = { 0x00, 0x53, 0x00, 0x00, 0x00, 0x2a },
};
struct nlattr_fixture fixture_nl_data_ib = {
/* valid policy and ib_addr length */
- .nlattr.nla_len = 24,
- .nlattr.nla_type = TEST_POLICY_ATTR,
+ .nlattr = { .nla_len = 24, .nla_type = TEST_POLICY_ATTR },
.data = { 0x00, 0x00, 0x00, 0x67, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xe4, 0x1d, 0x2d, 0x03, 0x00, 0xa5, 0xf0, 0x2f },
};
struct nlattr_fixture fixture_nl_data_invalid = {
/* valid policy but data neither eth_addr nor ib_addr */
- .nlattr.nla_len = 11,
- .nlattr.nla_type = TEST_POLICY_ATTR,
+ .nlattr = { .nla_len = 11, .nla_type = TEST_POLICY_ATTR },
.data = { 0x00, 0x53, 0x00, 0x00, 0x00, 0x2a, 0x00 },
};
struct ofpbuf *buf;
--
2.51.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev