diff options
author | Willem de Bruijn <willemb@google.com> | 2019-02-07 14:54:16 -0500 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-02-10 19:57:34 -0800 |
commit | b90efd2258749e04e1b3f71ef0d716f2ac2337e0 (patch) | |
tree | 80309f233c9c0c374e9c8b9832f21fc44b8590c4 /include/linux/skbuff.h | |
parent | d623876646be119439999a229a2c3ce30fd197fb (diff) | |
download | linux-b90efd2258749e04e1b3f71ef0d716f2ac2337e0.tar.gz linux-b90efd2258749e04e1b3f71ef0d716f2ac2337e0.tar.bz2 linux-b90efd2258749e04e1b3f71ef0d716f2ac2337e0.zip |
bpf: only adjust gso_size on bytestream protocols
bpf_skb_change_proto and bpf_skb_adjust_room change skb header length.
For GSO packets they adjust gso_size to maintain the same MTU.
The gso size can only be safely adjusted on bytestream protocols.
Commit d02f51cbcf12 ("bpf: fix bpf_skb_adjust_net/bpf_skb_proto_xlat
to deal with gso sctp skbs") excluded SKB_GSO_SCTP.
Since then type SKB_GSO_UDP_L4 has been added, whose contents are one
gso_size unit per datagram. Also exclude these.
Move from a blacklist to a whitelist check to future proof against
additional such new GSO types, e.g., for fraglist based GRO.
Fixes: bec1f6f69736 ("udp: generate gso with UDP_SEGMENT")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 95d25b010a25..5a7a8b93a5ab 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -4212,6 +4212,12 @@ static inline bool skb_is_gso_sctp(const struct sk_buff *skb) return skb_shinfo(skb)->gso_type & SKB_GSO_SCTP; } +static inline bool skb_is_gso_tcp(const struct sk_buff *skb) +{ + return skb_is_gso(skb) && + skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6); +} + static inline void skb_gso_reset(struct sk_buff *skb) { skb_shinfo(skb)->gso_size = 0; |