summaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2020-05-18 13:35:19 +0800
committerSteffen Klassert <steffen.klassert@secunet.com>2020-05-18 09:55:19 +0200
commit3ffb93ba326f40b47b17a4e8b3399c0fa2e8cee6 (patch)
tree5a2b7ecae818bb43b0cd1ccbf8bd55f13f39f1c2 /net/ipv4
parent56b1b7c667fbb9ee395f7506dfef3c04571e024a (diff)
downloadlinux-3ffb93ba326f40b47b17a4e8b3399c0fa2e8cee6.tar.gz
linux-3ffb93ba326f40b47b17a4e8b3399c0fa2e8cee6.tar.bz2
linux-3ffb93ba326f40b47b17a4e8b3399c0fa2e8cee6.zip
esp4: improve xfrm4_beet_gso_segment() to be more readable
This patch is to improve the code to make xfrm4_beet_gso_segment() more readable, and keep consistent with xfrm6_beet_gso_segment(). Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/esp4_offload.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c
index 9b1d451edae0..d14133eac476 100644
--- a/net/ipv4/esp4_offload.c
+++ b/net/ipv4/esp4_offload.c
@@ -141,20 +141,23 @@ static struct sk_buff *xfrm4_beet_gso_segment(struct xfrm_state *x,
skb->transport_header += x->props.header_len;
- if (proto == IPPROTO_BEETPH) {
- struct ip_beet_phdr *ph = (struct ip_beet_phdr *)skb->data;
-
- skb->transport_header += ph->hdrlen * 8;
- proto = ph->nexthdr;
- } else if (x->sel.family == AF_INET6) {
+ if (x->sel.family != AF_INET6) {
+ if (proto == IPPROTO_BEETPH) {
+ struct ip_beet_phdr *ph =
+ (struct ip_beet_phdr *)skb->data;
+
+ skb->transport_header += ph->hdrlen * 8;
+ proto = ph->nexthdr;
+ } else {
+ skb->transport_header -= IPV4_BEET_PHMAXLEN;
+ }
+ } else {
__be16 frag;
skb->transport_header +=
ipv6_skip_exthdr(skb, 0, &proto, &frag);
if (proto == IPPROTO_TCP)
skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4;
- } else {
- skb->transport_header -= IPV4_BEET_PHMAXLEN;
}
__skb_pull(skb, skb_transport_offset(skb));