Commit 25ec92cd authored by Sabrina Dubroca's avatar Sabrina Dubroca Committed by Steffen Klassert
Browse files

xfrm: tunnel: add extack to ipip_init_state, xfrm6_tunnel_init_state

parent 67c44f93
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -24,11 +24,15 @@ static int ipip_xfrm_rcv(struct xfrm_state *x, struct sk_buff *skb)

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);

+6 −2
Original line number Diff line number Diff line
@@ -272,11 +272,15 @@ static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt,

static int xfrm6_tunnel_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, "IPv6 tunnel can only be used with tunnel mode");
		return -EINVAL;
	}

	if (x->encap)
	if (x->encap) {
		NL_SET_ERR_MSG(extack, "IPv6 tunnel is not compatible with encapsulation");
		return -EINVAL;
	}

	x->props.header_len = sizeof(struct ipv6hdr);