History

sk_buff: drop all skb extensions on free and skb scrubbing

Now that we have a 3rd extension, add a new helper that drops the extension space and use it when we need to scrub an sk_buff. At this time, scrubbing clears secpath and bridge netfilter data, but retains the tc skb extension, after this patch all three get cleared. NAPI reuse/free assumes we can only have a secpath attached to skb, but it seems better to clear all extensions there as well. v2: add unlikely hint (Eric Dumazet)

Florian Westphal committed 7 years ago

Commit 174e2381 parent 6b3656a3 files · +12 −3Browse files

Showing the changes to include/linux (1 of 3 files). Show all

Unified · Split

include/linux/skbuff.h+9−0
@@ -4144,8 +4144,17 @@ static inline void *skb_ext_find(const struct sk_buff *skb, enum skb_ext_id id) · 4143 unmodified lines
41444144
41454145 return NULL;
41464146 }
4147+
4148+static inline void skb_ext_reset(struct sk_buff *skb)
4149+{
4150+ if (unlikely(skb->active_extensions)) {
4151+ __skb_ext_put(skb->extensions);
4152+ skb->active_extensions = 0;
4153+ }
4154+}
41474155 #else
41484156 static inline void skb_ext_put(struct sk_buff *skb) {}
4157+static inline void skb_ext_reset(struct sk_buff *skb) {}
41494158 static inline void skb_ext_del(struct sk_buff *skb, int unused) {}
41504159 static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff *s) {}
41514160 static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t