diff options
author | David S. Miller <davem@davemloft.net> | 2019-07-05 18:01:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-07-05 18:01:15 -0400 |
commit | e3b60ffbc16feeb007d07b2b7d1da4304e98c1a3 (patch) | |
tree | 2de159d2ed3f637bc5423e82a31b7e34da032e76 /net/ipv4/esp4.c | |
parent | c4cde5804d512a2f8934017dbf7df642dfbdf2ad (diff) | |
parent | c7b37c769d2a5e711106a3c793140a4f46768e04 (diff) |
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 2019-07-05
1) A lot of work to remove indirections from the xfrm code.
From Florian Westphal.
2) Fix a WARN_ON with ipv6 that triggered because of a
forgotten break statement. From Florian Westphal.
3) Remove xfrmi_init_net, it is not needed.
From Li RongQing.
Please pull or let me know if there are problems.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/esp4.c')
-rw-r--r-- | net/ipv4/esp4.c | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index b9ae95576084..5c967764041f 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -33,8 +33,6 @@ struct esp_output_extra { | |||
33 | 33 | ||
34 | #define ESP_SKB_CB(__skb) ((struct esp_skb_cb *)&((__skb)->cb[0])) | 34 | #define ESP_SKB_CB(__skb) ((struct esp_skb_cb *)&((__skb)->cb[0])) |
35 | 35 | ||
36 | static u32 esp4_get_mtu(struct xfrm_state *x, int mtu); | ||
37 | |||
38 | /* | 36 | /* |
39 | * Allocate an AEAD request structure with extra space for SG and IV. | 37 | * Allocate an AEAD request structure with extra space for SG and IV. |
40 | * | 38 | * |
@@ -506,7 +504,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) | |||
506 | struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst(skb); | 504 | struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst(skb); |
507 | u32 padto; | 505 | u32 padto; |
508 | 506 | ||
509 | padto = min(x->tfcpad, esp4_get_mtu(x, dst->child_mtu_cached)); | 507 | padto = min(x->tfcpad, xfrm_state_mtu(x, dst->child_mtu_cached)); |
510 | if (skb->len < padto) | 508 | if (skb->len < padto) |
511 | esp.tfclen = padto - skb->len; | 509 | esp.tfclen = padto - skb->len; |
512 | } | 510 | } |
@@ -788,28 +786,6 @@ out: | |||
788 | return err; | 786 | return err; |
789 | } | 787 | } |
790 | 788 | ||
791 | static u32 esp4_get_mtu(struct xfrm_state *x, int mtu) | ||
792 | { | ||
793 | struct crypto_aead *aead = x->data; | ||
794 | u32 blksize = ALIGN(crypto_aead_blocksize(aead), 4); | ||
795 | unsigned int net_adj; | ||
796 | |||
797 | switch (x->props.mode) { | ||
798 | case XFRM_MODE_TRANSPORT: | ||
799 | case XFRM_MODE_BEET: | ||
800 | net_adj = sizeof(struct iphdr); | ||
801 | break; | ||
802 | case XFRM_MODE_TUNNEL: | ||
803 | net_adj = 0; | ||
804 | break; | ||
805 | default: | ||
806 | BUG(); | ||
807 | } | ||
808 | |||
809 | return ((mtu - x->props.header_len - crypto_aead_authsize(aead) - | ||
810 | net_adj) & ~(blksize - 1)) + net_adj - 2; | ||
811 | } | ||
812 | |||
813 | static int esp4_err(struct sk_buff *skb, u32 info) | 789 | static int esp4_err(struct sk_buff *skb, u32 info) |
814 | { | 790 | { |
815 | struct net *net = dev_net(skb->dev); | 791 | struct net *net = dev_net(skb->dev); |
@@ -1035,7 +1011,6 @@ static const struct xfrm_type esp_type = | |||
1035 | .flags = XFRM_TYPE_REPLAY_PROT, | 1011 | .flags = XFRM_TYPE_REPLAY_PROT, |
1036 | .init_state = esp_init_state, | 1012 | .init_state = esp_init_state, |
1037 | .destructor = esp_destroy, | 1013 | .destructor = esp_destroy, |
1038 | .get_mtu = esp4_get_mtu, | ||
1039 | .input = esp_input, | 1014 | .input = esp_input, |
1040 | .output = esp_output, | 1015 | .output = esp_output, |
1041 | }; | 1016 | }; |
@@ -1066,8 +1041,7 @@ static void __exit esp4_fini(void) | |||
1066 | { | 1041 | { |
1067 | if (xfrm4_protocol_deregister(&esp4_protocol, IPPROTO_ESP) < 0) | 1042 | if (xfrm4_protocol_deregister(&esp4_protocol, IPPROTO_ESP) < 0) |
1068 | pr_info("%s: can't remove protocol\n", __func__); | 1043 | pr_info("%s: can't remove protocol\n", __func__); |
1069 | if (xfrm_unregister_type(&esp_type, AF_INET) < 0) | 1044 | xfrm_unregister_type(&esp_type, AF_INET); |
1070 | pr_info("%s: can't remove xfrm type\n", __func__); | ||
1071 | } | 1045 | } |
1072 | 1046 | ||
1073 | module_init(esp4_init); | 1047 | module_init(esp4_init); |