Rather than open-coding access to netlink attribute pointers in put_exclude_packet_type(), make use of the netlink attribute helpers. This simplifies the following bugfix.
Signed-off-by: Joe Stringer <[email protected]> --- lib/dpif-netlink.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index 562f6134c3a5..63ef3de5c7d1 100644 --- a/lib/dpif-netlink.c +++ b/lib/dpif-netlink.c @@ -3452,13 +3452,13 @@ put_exclude_packet_type(struct ofpbuf *buf, uint16_t type, size_t first_chunk_size = (uint8_t *)packet_type - (uint8_t *)data; size_t second_chunk_size = data_len - first_chunk_size - packet_type_len; - uint8_t *first_attr = NULL; struct nlattr *next_attr = nl_attr_next(packet_type); + size_t ofs; - first_attr = nl_msg_put_unspec_uninit(buf, type, - data_len - packet_type_len); - memcpy(first_attr, data, first_chunk_size); - memcpy(first_attr + first_chunk_size, next_attr, second_chunk_size); + ofs = nl_msg_start_nested(buf, type); + nl_msg_put(buf, data, first_chunk_size); + nl_msg_put(buf, next_attr, second_chunk_size); + nl_msg_end_nested(buf, ofs); } else { nl_msg_put_unspec(buf, type, data, data_len); } -- 2.11.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
