Skip to contentSkip to conversation

nfnetlink_log: Fix some constants

PATCH In review Michał Mirosław 2 participants 2 messages Sep 21, 2007 – Sep 24, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 5/5 nfnetlink_log: Fix some constants

Fix timeout (one second is 1 * HZ) and convert max packet copy length to #defined constant.

net/netfilter/nfnetlink_log.c +4 -7
@@ -37,8 +37,9 @@
 #endif
 
 #define NFULNL_NLBUFSIZ_DEFAULT	NLMSG_GOODSIZE
-#define NFULNL_TIMEOUT_DEFAULT 	100	/* every second */
+#define NFULNL_TIMEOUT_DEFAULT 	HZ	/* every second */
 #define NFULNL_QTHRESH_DEFAULT 	100	/* 100 packets */
+#define NFULNL_COPY_RANGE_MAX	0xFFFF	/* max packet size is limited by 16-bit struct nfattr nfa_len field */
 
 #define PRINTR(x, args...)	do { if (net_ratelimit()) \
 				     printk(x, ## args); } while (0);
@@ -172,7 +173,7 @@
 	inst->flushtimeout 	= NFULNL_TIMEOUT_DEFAULT;
 	inst->nlbufsiz 		= NFULNL_NLBUFSIZ_DEFAULT;
 	inst->copy_mode 	= NFULNL_COPY_PACKET;
-	inst->copy_range 	= 0xffff;
+	inst->copy_range 	= NFULNL_COPY_RANGE_MAX;
 
 	hlist_add_head(&inst->hlist,
 		       &instance_table[instance_hashfn(group_num)]);
@@ -236,11 +237,7 @@
 
 	case NFULNL_COPY_PACKET:
 		inst->copy_mode = mode;
-		/* we're using struct nfattr which has 16bit nfa_len */
-		if (range > 0xffff)
-			inst->copy_range = 0xffff;
-		else
-			inst->copy_range = range;
+		inst->copy_range = min(range, NFULNL_COPY_RANGE_MAX);
 		break;
 
 	default:

-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw
Quoted 2 lines · Micha³ Miros³aw

Fix timeout (one second is 1 * HZ) and convert max packet copy length to #defined constant.

Another new warning:

net/netfilter/nfnetlink_log.c: In function 'nfulnl_set_mode':
net/netfilter/nfnetlink_log.c:240: warning: comparison of distinct pointer types lacks a cast

I also fixed this, but next time I might not apply something like this. Well, thanks anyway.

-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html