[PATCH libnetfilter_queue 3/3] pktbuff: add pktb_reset_network_header() and pktb_set_network_header()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
 include/libnetfilter_queue/pktbuff.h |  3 +++
 src/extra/pktbuff.c                  | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/libnetfilter_queue/pktbuff.h b/include/libnetfilter_queue/pktbuff.h
index f9bddaf072fb..875157922c81 100644
--- a/include/libnetfilter_queue/pktbuff.h
+++ b/include/libnetfilter_queue/pktbuff.h
@@ -9,6 +9,9 @@ void pktb_free(struct pkt_buff *pktb);
 
 void pktb_build_data(struct pkt_buff *pktb, uint8_t *payload, uint32_t len);
 
+void pktb_reset_network_header(struct pkt_buff *pktb);
+void pktb_set_network_header(struct pkt_buff *pktb, const int offset);
+
 uint8_t *pktb_data(struct pkt_buff *pktb);
 uint32_t pktb_len(struct pkt_buff *pktb);
 
diff --git a/src/extra/pktbuff.c b/src/extra/pktbuff.c
index a93e72ac7795..3ff287e57315 100644
--- a/src/extra/pktbuff.c
+++ b/src/extra/pktbuff.c
@@ -267,6 +267,19 @@ uint8_t *pktb_network_header(struct pkt_buff *pktb)
 	return pktb->network_header;
 }
 
+EXPORT_SYMBOL
+void pktb_reset_network_header(struct pkt_buff *pktb)
+{
+	pktb->network_header = pktb->data;
+}
+
+EXPORT_SYMBOL
+void pktb_set_network_header(struct pkt_buff *pktb, const int offset)
+{
+	pktb_reset_network_header(pktb);
+	pktb->network_header += offset;
+}
+
 /**
  * pktb_transport_header - get address of layer 4 header (if known)
  * \param pktb Pointer to userspace packet buffer
-- 
2.20.1




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux