summaryrefslogtreecommitdiff
path: root/net/ipv4/xfrm4_tunnel.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2022-10-03 09:46:08 +0300
committerDavid S. Miller <davem@davemloft.net>2022-10-03 09:52:13 +0300
commit42e8e6d906dabb58a0e0ea53443b0e0a0821f1d5 (patch)
tree280af8d01082af883dc757f8ff4a27a7700e75b2 /net/ipv4/xfrm4_tunnel.c
parent9d43507319cc256c8383e3e2dcc394b458b7aa37 (diff)
parentc39596f6ad1bfe65fc2d926e0703cf26e3fae90a (diff)
downloadlinux-42e8e6d906dabb58a0e0ea53443b0e0a0821f1d5.tar.xz
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next
Steffen Klassert says: ==================== 1) Refactor selftests to use an array of structs in xfrm_fill_key(). From Gautam Menghani. 2) Drop an unused argument from xfrm_policy_match. From Hongbin Wang. 3) Support collect metadata mode for xfrm interfaces. From Eyal Birger. 4) Add netlink extack support to xfrm. From Sabrina Dubroca. Please note, there is a merge conflict in: include/net/dst_metadata.h between commit: 0a28bfd4971f ("net/macsec: Add MACsec skb_metadata_dst Tx Data path support") from the net-next tree and commit: 5182a5d48c3d ("net: allow storing xfrm interface metadata in metadata_dst") from the ipsec-next tree. Can be solved as done in linux-next. Please pull or let me know if there are problems. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/xfrm4_tunnel.c')
-rw-r--r--net/ipv4/xfrm4_tunnel.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c
index 9d4f418f1bf8..8489fa106583 100644
--- a/net/ipv4/xfrm4_tunnel.c
+++ b/net/ipv4/xfrm4_tunnel.c
@@ -22,13 +22,17 @@ static int ipip_xfrm_rcv(struct xfrm_state *x, struct sk_buff *skb)
return ip_hdr(skb)->protocol;
}
-static int ipip_init_state(struct xfrm_state *x)
+static int ipip_init_state(struct xfrm_state *x, struct netlink_ext_ack *extack)
{
- if (x->props.mode != XFRM_MODE_TUNNEL)
+ if (x->props.mode != XFRM_MODE_TUNNEL) {
+ NL_SET_ERR_MSG(extack, "IPv4 tunnel can only be used with tunnel mode");
return -EINVAL;
+ }
- if (x->encap)
+ if (x->encap) {
+ NL_SET_ERR_MSG(extack, "IPv4 tunnel is not compatible with encapsulation");
return -EINVAL;
+ }
x->props.header_len = sizeof(struct iphdr);