diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-07-20 09:31:35 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-07-20 09:31:35 +0200 |
| commit | 6bdb486c5a628f7a927c2658166e3a5ef1f883e7 (patch) | |
| tree | 4b817231c6f48216bc0deff7075c91b6c3ebdf35 /drivers/net/wireguard/queueing.h | |
| parent | da6d647598a6d182eb6a0344a7b14ae005244399 (diff) | |
| parent | ba47d845d715a010f7b51f6f89bae32845e6acb7 (diff) | |
| download | lwn-6bdb486c5a628f7a927c2658166e3a5ef1f883e7.tar.gz lwn-6bdb486c5a628f7a927c2658166e3a5ef1f883e7.zip | |
Merge 5.8-rc6 into driver-core-next
We need the driver core fixes in here too.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/wireguard/queueing.h')
| -rw-r--r-- | drivers/net/wireguard/queueing.h | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/drivers/net/wireguard/queueing.h b/drivers/net/wireguard/queueing.h index c58df439dbbe..dfb674e03076 100644 --- a/drivers/net/wireguard/queueing.h +++ b/drivers/net/wireguard/queueing.h @@ -11,6 +11,7 @@ #include <linux/skbuff.h> #include <linux/ip.h> #include <linux/ipv6.h> +#include <net/ip_tunnels.h> struct wg_device; struct wg_peer; @@ -65,25 +66,9 @@ struct packet_cb { #define PACKET_CB(skb) ((struct packet_cb *)((skb)->cb)) #define PACKET_PEER(skb) (PACKET_CB(skb)->keypair->entry.peer) -/* Returns either the correct skb->protocol value, or 0 if invalid. */ -static inline __be16 wg_examine_packet_protocol(struct sk_buff *skb) -{ - if (skb_network_header(skb) >= skb->head && - (skb_network_header(skb) + sizeof(struct iphdr)) <= - skb_tail_pointer(skb) && - ip_hdr(skb)->version == 4) - return htons(ETH_P_IP); - if (skb_network_header(skb) >= skb->head && - (skb_network_header(skb) + sizeof(struct ipv6hdr)) <= - skb_tail_pointer(skb) && - ipv6_hdr(skb)->version == 6) - return htons(ETH_P_IPV6); - return 0; -} - static inline bool wg_check_packet_protocol(struct sk_buff *skb) { - __be16 real_protocol = wg_examine_packet_protocol(skb); + __be16 real_protocol = ip_tunnel_parse_protocol(skb); return real_protocol && skb->protocol == real_protocol; } |
