Skip to contentSkip to conversation

Miscellaneous fixes

PATCH Applied Duncan Roe 2 participants 4 messages Nov 11, 2019 – Nov 12, 2019 netfilter

lore
Share & tools
lore

Duncan Roe

author
#0 lore raw

cover Miscellaneous fixes

I came across these while updating documentation.
So, I haven't actually exercised the code.

Duncan Roe (2):
src: pktb_trim() was not updating tail after updating len
src: Make sure pktb_alloc() works for AF_INET6 since we document that
it does

 src/extra/pktbuff.c | 2 ++
 1 file changed, 2 insertions(+)
Signature · 1 line
2.14.5
author
#1 lore raw

PATCH 1/2 src: pktb_trim() was not updating tail after updating len

skb->tail is used in many places, so it's important to keep it up to date.

Updated:

src/extra/pktbuff.c: Fix pktb_trim()

---
 src/extra/pktbuff.c | 1 +
 1 file changed, 1 insertion(+)
src/extra/pktbuff.c +1 -0
index 00af037..3a08d49 100644
@@ -156,6 +156,7 @@ EXPORT_SYMBOL
 void pktb_trim(struct pkt_buff *pktb, unsigned int len)
 {
 	pktb->len = len;
+	pktb->tail = pktb->head + len;
 }
 
 /**
Signature · 1 line
2.14.5
author
#2 lore raw

PATCH 2/2 src: Make sure pktb_alloc() works for AF_INET6 since we document that it does

In reply to Duncan Roe

Without this patch, AF_INET6 pktb_alloc() creates a pktb with NULL network_header. But in src/extra/ipv6.c, nfq_ip6_get_hdr() assumes that pktb->network_header is valid.

Updated:

src/extra/pktbuff.c: Treat AF_INET6 the same as AF_INET.

---
 src/extra/pktbuff.c | 1 +
 1 file changed, 1 insertion(+)
src/extra/pktbuff.c +1 -0
index 3a08d49..c52b674 100644
@@ -63,6 +63,7 @@ struct pkt_buff *pktb_alloc(int family, void *data, size_t len, size_t extra)
 
 	switch(family) {
 	case AF_INET:
+	case AF_INET6:
 		pktb->network_header = pktb->data;
 		break;
 	case AF_BRIDGE: {
Signature · 1 line
2.14.5