Commit 2240c12d authored by David S. Miller's avatar David S. Miller

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next

Steffen Klassert says:

====================
pull request (net-next): ipsec-next 2018-10-01

1) Make xfrmi_get_link_net() static to silence a sparse warning.
   From Wei Yongjun.

2) Remove a unused esph pointer definition in esp_input().
   From Haishuang Yan.

3) Allow the NIC driver to quietly refuse xfrm offload
   in case it does not support it, the SA is created
   without offload in this case.
   From Shannon Nelson.

Please pull or let me know if there are problems.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 3bd09b05 4a132095
...@@ -68,6 +68,10 @@ and an indication of whether it is for Rx or Tx. The driver should ...@@ -68,6 +68,10 @@ and an indication of whether it is for Rx or Tx. The driver should
- verify the algorithm is supported for offloads - verify the algorithm is supported for offloads
- store the SA information (key, salt, target-ip, protocol, etc) - store the SA information (key, salt, target-ip, protocol, etc)
- enable the HW offload of the SA - enable the HW offload of the SA
- return status value:
0 success
-EOPNETSUPP offload not supported, try SW IPsec
other fail the request
The driver can also set an offload_handle in the SA, an opaque void pointer The driver can also set an offload_handle in the SA, an opaque void pointer
that can be used to convey context into the fast-path offload requests. that can be used to convey context into the fast-path offload requests.
......
...@@ -683,12 +683,11 @@ static void esp_input_done_esn(struct crypto_async_request *base, int err) ...@@ -683,12 +683,11 @@ static void esp_input_done_esn(struct crypto_async_request *base, int err)
*/ */
static int esp_input(struct xfrm_state *x, struct sk_buff *skb) static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
{ {
struct ip_esp_hdr *esph;
struct crypto_aead *aead = x->data; struct crypto_aead *aead = x->data;
struct aead_request *req; struct aead_request *req;
struct sk_buff *trailer; struct sk_buff *trailer;
int ivlen = crypto_aead_ivsize(aead); int ivlen = crypto_aead_ivsize(aead);
int elen = skb->len - sizeof(*esph) - ivlen; int elen = skb->len - sizeof(struct ip_esp_hdr) - ivlen;
int nfrags; int nfrags;
int assoclen; int assoclen;
int seqhilen; int seqhilen;
...@@ -698,13 +697,13 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -698,13 +697,13 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
struct scatterlist *sg; struct scatterlist *sg;
int err = -EINVAL; int err = -EINVAL;
if (!pskb_may_pull(skb, sizeof(*esph) + ivlen)) if (!pskb_may_pull(skb, sizeof(struct ip_esp_hdr) + ivlen))
goto out; goto out;
if (elen <= 0) if (elen <= 0)
goto out; goto out;
assoclen = sizeof(*esph); assoclen = sizeof(struct ip_esp_hdr);
seqhilen = 0; seqhilen = 0;
if (x->props.flags & XFRM_STATE_ESN) { if (x->props.flags & XFRM_STATE_ESN) {
......
...@@ -601,12 +601,11 @@ static void esp_input_done_esn(struct crypto_async_request *base, int err) ...@@ -601,12 +601,11 @@ static void esp_input_done_esn(struct crypto_async_request *base, int err)
static int esp6_input(struct xfrm_state *x, struct sk_buff *skb) static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
{ {
struct ip_esp_hdr *esph;
struct crypto_aead *aead = x->data; struct crypto_aead *aead = x->data;
struct aead_request *req; struct aead_request *req;
struct sk_buff *trailer; struct sk_buff *trailer;
int ivlen = crypto_aead_ivsize(aead); int ivlen = crypto_aead_ivsize(aead);
int elen = skb->len - sizeof(*esph) - ivlen; int elen = skb->len - sizeof(struct ip_esp_hdr) - ivlen;
int nfrags; int nfrags;
int assoclen; int assoclen;
int seqhilen; int seqhilen;
...@@ -616,7 +615,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -616,7 +615,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
u8 *iv; u8 *iv;
struct scatterlist *sg; struct scatterlist *sg;
if (!pskb_may_pull(skb, sizeof(*esph) + ivlen)) { if (!pskb_may_pull(skb, sizeof(struct ip_esp_hdr) + ivlen)) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -626,7 +625,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -626,7 +625,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
goto out; goto out;
} }
assoclen = sizeof(*esph); assoclen = sizeof(struct ip_esp_hdr);
seqhilen = 0; seqhilen = 0;
if (x->props.flags & XFRM_STATE_ESN) { if (x->props.flags & XFRM_STATE_ESN) {
......
...@@ -192,8 +192,12 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x, ...@@ -192,8 +192,12 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
err = dev->xfrmdev_ops->xdo_dev_state_add(x); err = dev->xfrmdev_ops->xdo_dev_state_add(x);
if (err) { if (err) {
xso->num_exthdrs = 0;
xso->flags = 0;
xso->dev = NULL; xso->dev = NULL;
dev_put(dev); dev_put(dev);
if (err != -EOPNOTSUPP)
return err; return err;
} }
......
...@@ -742,7 +742,7 @@ static int xfrmi_fill_info(struct sk_buff *skb, const struct net_device *dev) ...@@ -742,7 +742,7 @@ static int xfrmi_fill_info(struct sk_buff *skb, const struct net_device *dev)
return -EMSGSIZE; return -EMSGSIZE;
} }
struct net *xfrmi_get_link_net(const struct net_device *dev) static struct net *xfrmi_get_link_net(const struct net_device *dev)
{ {
struct xfrm_if *xi = netdev_priv(dev); struct xfrm_if *xi = netdev_priv(dev);
......
Markdown is supported
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