2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

packets: Fix misaligned access to ip6_hdr.

The ip6_hdr is aligned to 4 bytes, but the pointer
from dp_packet_l3 is aligned to 2 bytes. Use
ovs_16aligned_ip6_hdr instead to get 2 bytes alignment.

Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Ales Musil
2022-07-25 16:08:14 +02:00
committed by Ilya Maximets
parent 16193fe730
commit 39364e11dd

View File

@@ -1709,7 +1709,7 @@ compose_ipv6(struct dp_packet *packet, uint8_t proto,
const struct in6_addr *src, const struct in6_addr *dst, const struct in6_addr *src, const struct in6_addr *dst,
uint8_t key_tc, ovs_be32 key_fl, uint8_t key_hl, int size) uint8_t key_tc, ovs_be32 key_fl, uint8_t key_hl, int size)
{ {
struct ip6_hdr *nh; struct ovs_16aligned_ip6_hdr *nh;
void *data; void *data;
nh = dp_packet_l3(packet); nh = dp_packet_l3(packet);
@@ -1847,7 +1847,7 @@ packet_put_ra_prefix_opt(struct dp_packet *b,
const ovs_be128 prefix) const ovs_be128 prefix)
{ {
size_t prev_l4_size = dp_packet_l4_size(b); size_t prev_l4_size = dp_packet_l4_size(b);
struct ip6_hdr *nh = dp_packet_l3(b); struct ovs_16aligned_ip6_hdr *nh = dp_packet_l3(b);
nh->ip6_plen = htons(prev_l4_size + ND_PREFIX_OPT_LEN); nh->ip6_plen = htons(prev_l4_size + ND_PREFIX_OPT_LEN);
struct ovs_nd_prefix_opt *prefix_opt = struct ovs_nd_prefix_opt *prefix_opt =