Skip to content
Commit ccc12b11 authored by Mathieu Xhonneux's avatar Mathieu Xhonneux Committed by David S. Miller
Browse files

ipv6: sr: fix TLVs not being copied using setsockopt

Function ipv6_push_rthdr4 allows to add an IPv6 Segment Routing Header
to a socket through setsockopt, but the current implementation doesn't
copy possible TLVs at the end of the SRH received from userspace.

Therefore, the execution of the following branch if (sr_has_hmac(sr_phdr))
{ ... } will never complete since the len and type fields of a possible
HMAC TLV are not copied, hence seg6_get_tlv_hmac will return an error,
and the HMAC will not be computed.

This commit adds a memcpy in case TLVs have been appended to the SRH.

Fixes: a149e7c7

 ("ipv6: sr: add support for SRH injection through setsockopt")
Acked-by: default avatarDavid Lebrun <dlebrun@google.com>
Signed-off-by: default avatarMathieu Xhonneux <m.xhonneux@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 862c03ee
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment