Message ID | 1403260021-8732-3-git-send-email-lantw44@gmail.com |
---|---|
State | Changes Requested |
Headers | show |
On Fri, Jun 20, 2014 at 06:27:01PM +0800, lantw44@gmail.com wrote: > From: Ting-Wei Lan <lantw44@gmail.com> > > --- > src/extra/udp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/extra/udp.c b/src/extra/udp.c > index 2a17a2f..64d3db4 100644 > --- a/src/extra/udp.c > +++ b/src/extra/udp.c > @@ -76,7 +76,7 @@ EXPORT_SYMBOL(nfq_udp_get_payload); > */ > unsigned int nfq_udp_get_payload_len(struct udphdr *udph, struct pkt_buff *pktb) > { > - return pktb->tail - pktb->transport_header; > + return pktb->tail - pktb->transport_header - sizeof(struct udphdr); I agree that this should substract the UDP header size, but: 1) This underflows the unsigned int if the UDP header is truncated. 2) This breaks the current behaviour, but we don't have any client in the tree for this code yet though. Let's do it well, deprecate this interface and introduce a new one: int nfq_udp_get_payload_length(struct udphdr *udph, struct pkt_buff *pktb) Same thing for the tcp variant. The deprecation can be achieved through this: in __attribute__((deprecated) nfq_udp_get_payload_len(...) in the header file. Would you send me a patch for that, please? BTW, please Signed-off-by your userspace patches too. Thanks. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/src/extra/udp.c b/src/extra/udp.c index 2a17a2f..64d3db4 100644 --- a/src/extra/udp.c +++ b/src/extra/udp.c @@ -76,7 +76,7 @@ EXPORT_SYMBOL(nfq_udp_get_payload); */ unsigned int nfq_udp_get_payload_len(struct udphdr *udph, struct pkt_buff *pktb) { - return pktb->tail - pktb->transport_header; + return pktb->tail - pktb->transport_header - sizeof(struct udphdr); } EXPORT_SYMBOL(nfq_udp_get_payload_len);
From: Ting-Wei Lan <lantw44@gmail.com> --- src/extra/udp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)