netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter/nflog: nflog-range does not truncate packets
@ 2016-06-02  0:23 Vishwanath Pai
  2016-06-06 22:31 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 11+ messages in thread
From: Vishwanath Pai @ 2016-06-02  0:23 UTC (permalink / raw)
  To: pablo, kaber, kadlec, netfilter-devel
  Cc: coreteam, johunt, netdev, pai.vishwain

netfilter/nflog: nflog-range does not truncate packets

The --nflog-range parameter from userspace is ignored in the kernel and
the entire packet is sent to the userspace. The per-instance parameter
copy_range still works, with this change --nflog-range will have
preference over copy_range.

Signed-off-by: Vishwanath Pai <vpai@akamai.com>
Reviewed-by: Joshua Hunt <johunt@akamai.com>

diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 4ef1fae..f40ddba 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -680,7 +680,6 @@ nfulnl_log_packet(struct net *net,
 		if (qthreshold > li->u.ulog.qthreshold)
 			qthreshold = li->u.ulog.qthreshold;
 
-
 	switch (inst->copy_mode) {
 	case NFULNL_COPY_META:
 	case NFULNL_COPY_NONE:
@@ -688,10 +687,12 @@ nfulnl_log_packet(struct net *net,
 		break;
 
 	case NFULNL_COPY_PACKET:
-		if (inst->copy_range > skb->len)
+		data_len = inst->copy_range;
+		if (li->u.ulog.copy_len < data_len)
+			data_len = li->u.ulog.copy_len;
+
+		if (data_len > skb->len)
 			data_len = skb->len;
-		else
-			data_len = inst->copy_range;
 
 		size += nla_total_size(data_len);
 		break;

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

end of thread, other threads:[~2016-06-17 15:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-02  0:23 [PATCH] netfilter/nflog: nflog-range does not truncate packets Vishwanath Pai
2016-06-06 22:31 ` Pablo Neira Ayuso
2016-06-07 23:06   ` Vishwanath Pai
2016-06-08 12:16     ` Pablo Neira Ayuso
2016-06-09 17:57       ` Vishwanath Pai
2016-06-13  3:40         ` Vishwanath Pai
2016-06-15 12:39           ` Pablo Neira Ayuso
2016-06-15 14:55             ` Vishwanath Pai
2016-06-15 15:13               ` Lubashev, Igor
2016-06-17 11:22                 ` Pablo Neira Ayuso
2016-06-17 15:43                   ` Vishwanath Pai

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).