Skip to content

Commit 3ffb93b

Browse files
lxinklassert
authored andcommitted
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 <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent 56b1b7c commit 3ffb93b

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

net/ipv4/esp4_offload.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,20 +141,23 @@ static struct sk_buff *xfrm4_beet_gso_segment(struct xfrm_state *x,
141141

142142
skb->transport_header += x->props.header_len;
143143

144-
if (proto == IPPROTO_BEETPH) {
145-
struct ip_beet_phdr *ph = (struct ip_beet_phdr *)skb->data;
146-
147-
skb->transport_header += ph->hdrlen * 8;
148-
proto = ph->nexthdr;
149-
} else if (x->sel.family == AF_INET6) {
144+
if (x->sel.family != AF_INET6) {
145+
if (proto == IPPROTO_BEETPH) {
146+
struct ip_beet_phdr *ph =
147+
(struct ip_beet_phdr *)skb->data;
148+
149+
skb->transport_header += ph->hdrlen * 8;
150+
proto = ph->nexthdr;
151+
} else {
152+
skb->transport_header -= IPV4_BEET_PHMAXLEN;
153+
}
154+
} else {
150155
__be16 frag;
151156

152157
skb->transport_header +=
153158
ipv6_skip_exthdr(skb, 0, &proto, &frag);
154159
if (proto == IPPROTO_TCP)
155160
skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4;
156-
} else {
157-
skb->transport_header -= IPV4_BEET_PHMAXLEN;
158161
}
159162

160163
__skb_pull(skb, skb_transport_offset(skb));

0 commit comments

Comments
 (0)