/*
- * Copyright (c) 2014 VMware, Inc.
+ * Copyright (c) 2014, 2016 VMware, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
[OVS_WIN_NETDEV_ATTR_IF_FLAGS] = { .type = NL_A_U32 },
};
- struct nlattr *a[ARRAY_SIZE(ovs_netdev_policy)];
- struct ovs_header *ovs_header;
- struct nlmsghdr *nlmsg;
- struct genlmsghdr *genl;
- struct ofpbuf b;
-
netdev_windows_info_init(info);
- ofpbuf_use_const(&b, buf->data, buf->size);
- nlmsg = ofpbuf_try_pull(&b, sizeof *nlmsg);
- genl = ofpbuf_try_pull(&b, sizeof *genl);
- ovs_header = ofpbuf_try_pull(&b, sizeof *ovs_header);
+ struct ofpbuf b = ofpbuf_const_initializer(&b, buf->data, buf->size);
+ struct nlmsghdr *nlmsg = ofpbuf_try_pull(&b, sizeof *nlmsg);
+ struct genlmsghdr *genl = ofpbuf_try_pull(&b, sizeof *genl);
+ struct ovs_header *ovs_header = ofpbuf_try_pull(&b, sizeof *ovs_header);
+
+ struct nlattr *a[ARRAY_SIZE(ovs_netdev_policy)];
if (!nlmsg || !genl || !ovs_header
|| nlmsg->nlmsg_type != ovs_win_netdev_family
|| !nl_policy_parse(&b, 0, ovs_netdev_policy, a,
info->port_no = nl_attr_get_odp_port(a[OVS_WIN_NETDEV_ATTR_PORT_NO]);
info->ovs_type = nl_attr_get_u32(a[OVS_WIN_NETDEV_ATTR_TYPE]);
info->name = nl_attr_get_string(a[OVS_WIN_NETDEV_ATTR_NAME]);
- memcpy(info->mac_address, nl_attr_get_unspec(a[OVS_WIN_NETDEV_ATTR_MAC_ADDR],
+ memcpy(&info->mac_address, nl_attr_get_unspec(a[OVS_WIN_NETDEV_ATTR_MAC_ADDR],
sizeof(info->mac_address)), sizeof(info->mac_address));
info->mtu = nl_attr_get_u32(a[OVS_WIN_NETDEV_ATTR_MTU]);
info->ifi_flags = nl_attr_get_u32(a[OVS_WIN_NETDEV_ATTR_IF_FLAGS]);