[PATCH libnetfilter_queue] src: pktb_mangle has signed offset arg so can mangle MAC header with -ve one

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

 



- Update prototype
- Update doxygen documentation
- Update declaration

Signed-off-by: Duncan Roe <duncan_roe@xxxxxxxxxxxxxxx>
---
 include/libnetfilter_queue/pktbuff.h | 2 +-
 src/extra/pktbuff.c                  | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/libnetfilter_queue/pktbuff.h b/include/libnetfilter_queue/pktbuff.h
index b15ee1e..5bcc3e5 100644
--- a/include/libnetfilter_queue/pktbuff.h
+++ b/include/libnetfilter_queue/pktbuff.h
@@ -19,7 +19,7 @@ uint8_t *pktb_mac_header(struct pkt_buff *pktb);
 uint8_t *pktb_network_header(struct pkt_buff *pktb);
 uint8_t *pktb_transport_header(struct pkt_buff *pktb);
 
-int pktb_mangle(struct pkt_buff *pkt, unsigned int dataoff, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len);
+int pktb_mangle(struct pkt_buff *pkt, int dataoff, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len);
 
 bool pktb_mangled(const struct pkt_buff *pktb);
 
diff --git a/src/extra/pktbuff.c b/src/extra/pktbuff.c
index c4f3da3..6250fbf 100644
--- a/src/extra/pktbuff.c
+++ b/src/extra/pktbuff.c
@@ -299,8 +299,10 @@ static int enlarge_pkt(struct pkt_buff *pkt, unsigned int extra)
 /**
  * pktb_mangle - adjust contents of a packet
  * \param pktb Pointer to userspace packet buffer
- * \param dataoff Offset to layer 4 header. Specify zero to access layer 3 (IP)
- * header (layer 2 for family \b AF_BRIDGE)
+ * \param dataoff Supplementary offset, usually offset from layer 3 (IP) header
+ * to the layer 4 (TCP or UDP) header. Specify zero to access the layer 3
+ * header. If \b pktb was created in family \b AF_BRIDGE, specify
+ * \b -ETH_HLEN (a negative offset) to access the layer 2 (MAC) header.
  * \param match_offset Further offset to content that you want to mangle
  * \param match_len Length of the existing content you want to mangle
  * \param rep_buffer Pointer to data you want to use to replace current content
@@ -316,7 +318,7 @@ static int enlarge_pkt(struct pkt_buff *pkt, unsigned int extra)
  */
 EXPORT_SYMBOL
 int pktb_mangle(struct pkt_buff *pktb,
-		unsigned int dataoff,
+		int dataoff,
 		unsigned int match_offset,
 		unsigned int match_len,
 		const char *rep_buffer,
-- 
2.14.5




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

  Powered by Linux