netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch net-next 1/2] net: introduce skb_network_header_was_set()
@ 2018-11-21  2:13 Cong Wang
  2018-11-21  2:13 ` [Patch net-next 2/2] net: dump whole skb data in netdev_rx_csum_fault() Cong Wang
  0 siblings, 1 reply; 11+ messages in thread
From: Cong Wang @ 2018-11-21  2:13 UTC (permalink / raw)
  To: netdev; +Cc: Cong Wang

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 include/linux/skbuff.h | 5 +++++
 net/core/skbuff.c      | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index a2e8297a5b00..afddb5c17ce5 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2444,6 +2444,11 @@ static inline u32 skb_network_header_len(const struct sk_buff *skb)
 	return skb->transport_header - skb->network_header;
 }
 
+static inline int skb_network_header_was_set(const struct sk_buff *skb)
+{
+	return skb->network_header != (typeof(skb->network_header))~0U;
+}
+
 static inline u32 skb_inner_network_header_len(const struct sk_buff *skb)
 {
 	return skb->inner_transport_header - skb->inner_network_header;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 9a8a72cefe9b..b6ba923e7dc7 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -227,6 +227,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
 	skb_reset_tail_pointer(skb);
 	skb->end = skb->tail + size;
 	skb->mac_header = (typeof(skb->mac_header))~0U;
+	skb->network_header = (typeof(skb->network_header))~0U;
 	skb->transport_header = (typeof(skb->transport_header))~0U;
 
 	/* make sure we initialize shinfo sequentially */
@@ -292,6 +293,7 @@ struct sk_buff *__build_skb(void *data, unsigned int frag_size)
 	skb_reset_tail_pointer(skb);
 	skb->end = skb->tail + size;
 	skb->mac_header = (typeof(skb->mac_header))~0U;
+	skb->network_header = (typeof(skb->network_header))~0U;
 	skb->transport_header = (typeof(skb->transport_header))~0U;
 
 	/* make sure we initialize shinfo sequentially */
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-01-11  0:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-21  2:13 [Patch net-next 1/2] net: introduce skb_network_header_was_set() Cong Wang
2018-11-21  2:13 ` [Patch net-next 2/2] net: dump whole skb data in netdev_rx_csum_fault() Cong Wang
2018-11-21 13:05   ` Eric Dumazet
2018-11-21 18:17     ` Cong Wang
2018-11-21 18:26       ` Eric Dumazet
2018-11-21 19:33         ` Saeed Mahameed
2018-11-23  1:45           ` Cong Wang
2018-11-30 20:12             ` Saeed Mahameed
2018-12-05 17:30               ` Peter Oskolkov
2019-01-11  0:20                 ` Willem de Bruijn
2018-11-23  1:43         ` Cong Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).