summaryrefslogtreecommitdiff
path: root/drivers/net/wireguard/queueing.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-05-11 22:54:30 +0200
committerThomas Gleixner <tglx@linutronix.de>2020-05-11 22:54:30 +0200
commit3a3bf3592c067aa869ee36e30aba526a4e40d70c (patch)
treec98689eac846cb02798c8e0b92e117b720b03a1f /drivers/net/wireguard/queueing.h
parent105ba8ae51e0178462b4cdf2f82c6e98fac19c04 (diff)
parentb67bd6847a9659bc02db01b82b2b79841fbbc159 (diff)
downloadwireguard-linux-trimmed-3a3bf3592c067aa869ee36e30aba526a4e40d70c.tar.gz
wireguard-linux-trimmed-3a3bf3592c067aa869ee36e30aba526a4e40d70c.zip
Merge branch 'for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu into core/rcu
Pull RCU updates from Paul McKenney: 1. Miscellaneous fixes. 2. kfree_rcu() updates. 3. Remove scheduler locking restriction 4. RCU-tasks update, including addition of RCU Tasks Trace for BPF use and RCU Tasks Rude. (This branch is on top of #3 due to overlap of changed code.) 5. RCU CPU stall warning updates. 6. Torture-test updates.
Diffstat (limited to 'drivers/net/wireguard/queueing.h')
-rw-r--r--drivers/net/wireguard/queueing.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/wireguard/queueing.h b/drivers/net/wireguard/queueing.h
index fecb559..3432232 100644
--- a/drivers/net/wireguard/queueing.h
+++ b/drivers/net/wireguard/queueing.h
@@ -66,7 +66,7 @@ struct packet_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_skb_examine_untrusted_ip_hdr(struct sk_buff *skb)
+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)) <=
@@ -81,6 +81,12 @@ static inline __be16 wg_skb_examine_untrusted_ip_hdr(struct sk_buff *skb)
return 0;
}
+static inline bool wg_check_packet_protocol(struct sk_buff *skb)
+{
+ __be16 real_protocol = wg_examine_packet_protocol(skb);
+ return real_protocol && skb->protocol == real_protocol;
+}
+
static inline void wg_reset_packet(struct sk_buff *skb)
{
skb_scrub_packet(skb, true);
@@ -94,8 +100,8 @@ static inline void wg_reset_packet(struct sk_buff *skb)
skb->dev = NULL;
#ifdef CONFIG_NET_SCHED
skb->tc_index = 0;
- skb_reset_tc(skb);
#endif
+ skb_reset_redirect(skb);
skb->hdr_len = skb_headroom(skb);
skb_reset_mac_header(skb);
skb_reset_network_header(skb);