Skip to content

Commit

Permalink
xfrm: pass extack down to xfrm_type ->init_state
Browse files Browse the repository at this point in the history
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
  • Loading branch information
qsn authored and klassert committed Sep 29, 2022
1 parent 48ff45d commit e1e10b4
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion include/net/xfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ struct xfrm_type {
#define XFRM_TYPE_LOCAL_COADDR 4
#define XFRM_TYPE_REMOTE_COADDR 8

int (*init_state)(struct xfrm_state *x);
int (*init_state)(struct xfrm_state *x,
struct netlink_ext_ack *extack);
void (*destructor)(struct xfrm_state *);
int (*input)(struct xfrm_state *, struct sk_buff *skb);
int (*output)(struct xfrm_state *, struct sk_buff *pskb);
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/ah4.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ static int ah4_err(struct sk_buff *skb, u32 info)
return 0;
}

static int ah_init_state(struct xfrm_state *x)
static int ah_init_state(struct xfrm_state *x, struct netlink_ext_ack *extack)
{
struct ah_data *ahp = NULL;
struct xfrm_algo_desc *aalg_desc;
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/esp4.c
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ static int esp_init_authenc(struct xfrm_state *x)
return err;
}

static int esp_init_state(struct xfrm_state *x)
static int esp_init_state(struct xfrm_state *x, struct netlink_ext_ack *extack)
{
struct crypto_aead *aead;
u32 align;
Expand Down
3 changes: 2 additions & 1 deletion net/ipv4/ipcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ static int ipcomp_tunnel_attach(struct xfrm_state *x)
return err;
}

static int ipcomp4_init_state(struct xfrm_state *x)
static int ipcomp4_init_state(struct xfrm_state *x,
struct netlink_ext_ack *extack)
{
int err = -EINVAL;

Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/xfrm4_tunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ 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)
return -EINVAL;
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/ah6.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ static int ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
return 0;
}

static int ah6_init_state(struct xfrm_state *x)
static int ah6_init_state(struct xfrm_state *x, struct netlink_ext_ack *extack)
{
struct ah_data *ahp = NULL;
struct xfrm_algo_desc *aalg_desc;
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/esp6.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ static int esp_init_authenc(struct xfrm_state *x)
return err;
}

static int esp6_init_state(struct xfrm_state *x)
static int esp6_init_state(struct xfrm_state *x, struct netlink_ext_ack *extack)
{
struct crypto_aead *aead;
u32 align;
Expand Down
3 changes: 2 additions & 1 deletion net/ipv6/ipcomp6.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ static int ipcomp6_tunnel_attach(struct xfrm_state *x)
return err;
}

static int ipcomp6_init_state(struct xfrm_state *x)
static int ipcomp6_init_state(struct xfrm_state *x,
struct netlink_ext_ack *extack)
{
int err = -EINVAL;

Expand Down
4 changes: 2 additions & 2 deletions net/ipv6/mip6.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb,
return err;
}

static int mip6_destopt_init_state(struct xfrm_state *x)
static int mip6_destopt_init_state(struct xfrm_state *x, struct netlink_ext_ack *extack)
{
if (x->id.spi) {
pr_info("%s: spi is not 0: %u\n", __func__, x->id.spi);
Expand Down Expand Up @@ -333,7 +333,7 @@ static int mip6_rthdr_output(struct xfrm_state *x, struct sk_buff *skb)
return 0;
}

static int mip6_rthdr_init_state(struct xfrm_state *x)
static int mip6_rthdr_init_state(struct xfrm_state *x, struct netlink_ext_ack *extack)
{
if (x->id.spi) {
pr_info("%s: spi is not 0: %u\n", __func__, x->id.spi);
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/xfrm6_tunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
return 0;
}

static int xfrm6_tunnel_init_state(struct xfrm_state *x)
static int xfrm6_tunnel_init_state(struct xfrm_state *x, struct netlink_ext_ack *extack)
{
if (x->props.mode != XFRM_MODE_TUNNEL)
return -EINVAL;
Expand Down
2 changes: 1 addition & 1 deletion net/xfrm/xfrm_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -2673,7 +2673,7 @@ int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload,

x->type_offload = xfrm_get_type_offload(x->id.proto, family, offload);

err = x->type->init_state(x);
err = x->type->init_state(x, extack);
if (err)
goto error;

Expand Down

0 comments on commit e1e10b4

Please sign in to comment.