aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/eth.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/net/eth.c b/net/eth.c
index 6db943d4b3..b2704fbf2d 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -405,17 +405,20 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int pkt_frags,
struct ip6_ext_hdr *ext_hdr,
struct in6_address *dst_addr)
{
- struct ip6_ext_hdr_routing *rthdr = (struct ip6_ext_hdr_routing *) ext_hdr;
+ struct ip6_ext_hdr_routing rt_hdr;
size_t input_size = iov_size(pkt, pkt_frags);
size_t bytes_read;
- if (input_size < ext_hdr_offset + sizeof(*rthdr) + sizeof(*dst_addr)) {
+ if (input_size < ext_hdr_offset + sizeof(rt_hdr) + sizeof(*dst_addr)) {
return false;
}
- if ((rthdr->rtype == 2) && (rthdr->segleft == 1)) {
- bytes_read = iov_to_buf(pkt, pkt_frags,
- ext_hdr_offset + sizeof(*rthdr),
+ bytes_read = iov_to_buf(pkt, pkt_frags, ext_hdr_offset,
+ &rt_hdr, sizeof(rt_hdr));
+ assert(bytes_read == sizeof(rt_hdr));
+
+ if ((rt_hdr.rtype == 2) && (rt_hdr.segleft == 1)) {
+ bytes_read = iov_to_buf(pkt, pkt_frags, ext_hdr_offset + sizeof(rt_hdr),
dst_addr, sizeof(*dst_addr));
return bytes_read == sizeof(*dst_addr);