summaryrefslogtreecommitdiffstats
path: root/net/ipv6/exthdrs.c
diff options
context:
space:
mode:
authorDavid Lebrun <david.lebrun@uclouvain.be>2016-11-08 14:59:19 +0100
committerDavid S. Miller <davem@davemloft.net>2016-11-10 02:40:06 +0100
commit9baee83406d6a4b02222f5ee21511c3f4c19e39d (patch)
tree2a048ee6d143496156dbfe71402f84971cf41ec3 /net/ipv6/exthdrs.c
parentipv6: sr: implement API to control SR HMAC structure (diff)
downloadlinux-9baee83406d6a4b02222f5ee21511c3f4c19e39d.tar.xz
linux-9baee83406d6a4b02222f5ee21511c3f4c19e39d.zip
ipv6: sr: add calls to verify and insert HMAC signatures
This patch enables the verification of the HMAC signature for transiting SR-enabled packets, and its insertion on encapsulated/injected SRH. Signed-off-by: David Lebrun <david.lebrun@uclouvain.be> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/exthdrs.c')
-rw-r--r--net/ipv6/exthdrs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index b8ba3961ff8a..541cfa6345e5 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -49,6 +49,9 @@
#endif
#include <linux/seg6.h>
#include <net/seg6.h>
+#ifdef CONFIG_IPV6_SEG6_HMAC
+#include <net/seg6_hmac.h>
+#endif
#include <linux/uaccess.h>
@@ -340,6 +343,13 @@ static int ipv6_srh_rcv(struct sk_buff *skb)
return -1;
}
+#ifdef CONFIG_IPV6_SEG6_HMAC
+ if (!seg6_hmac_validate_skb(skb)) {
+ kfree_skb(skb);
+ return -1;
+ }
+#endif
+
looped_back:
if (hdr->segments_left > 0) {
if (hdr->nexthdr != NEXTHDR_IPV6 && hdr->segments_left == 1 &&