X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=lib%2Fnetdev-windows.c;h=093175f5a1e30721073ebdba4084cdae45e2a3b1;hb=8f79bb4d3999d993424e9578342b4130d10a556c;hp=51d088ad0d6a0dbfa5af37ea02ed6c0847a1903e;hpb=74ff3298c8806bb09d0c7e40a25b889ab7564769;p=cascardo%2Fovs.git diff --git a/lib/netdev-windows.c b/lib/netdev-windows.c index 51d088ad0..093175f5a 100644 --- a/lib/netdev-windows.c +++ b/lib/netdev-windows.c @@ -1,5 +1,5 @@ /* - * 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. @@ -224,18 +224,14 @@ netdev_windows_netdev_from_ofpbuf(struct netdev_windows_netdev_info *info, [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, @@ -248,7 +244,7 @@ netdev_windows_netdev_from_ofpbuf(struct netdev_windows_netdev_info *info, 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]);