Commit 6b6ec99a authored by Michal Miroslaw's avatar Michal Miroslaw Committed by David S. Miller

[NETFILTER]: nfnetlink_log: fix some constants

Fix timeout (one second is 1 * HZ) and convert max packet copy length
to #defined constant.
Signed-off-by: default avatarMichal Miroslaw <mirq-linux@rere.qmqm.pl>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent aace57e0
...@@ -37,8 +37,9 @@ ...@@ -37,8 +37,9 @@
#endif #endif
#define NFULNL_NLBUFSIZ_DEFAULT NLMSG_GOODSIZE #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_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()) \ #define PRINTR(x, args...) do { if (net_ratelimit()) \
printk(x, ## args); } while (0); printk(x, ## args); } while (0);
...@@ -171,7 +172,7 @@ instance_create(u_int16_t group_num, int pid) ...@@ -171,7 +172,7 @@ instance_create(u_int16_t group_num, int pid)
inst->flushtimeout = NFULNL_TIMEOUT_DEFAULT; inst->flushtimeout = NFULNL_TIMEOUT_DEFAULT;
inst->nlbufsiz = NFULNL_NLBUFSIZ_DEFAULT; inst->nlbufsiz = NFULNL_NLBUFSIZ_DEFAULT;
inst->copy_mode = NFULNL_COPY_PACKET; inst->copy_mode = NFULNL_COPY_PACKET;
inst->copy_range = 0xffff; inst->copy_range = NFULNL_COPY_RANGE_MAX;
hlist_add_head(&inst->hlist, hlist_add_head(&inst->hlist,
&instance_table[instance_hashfn(group_num)]); &instance_table[instance_hashfn(group_num)]);
...@@ -235,11 +236,8 @@ nfulnl_set_mode(struct nfulnl_instance *inst, u_int8_t mode, ...@@ -235,11 +236,8 @@ nfulnl_set_mode(struct nfulnl_instance *inst, u_int8_t mode,
case NFULNL_COPY_PACKET: case NFULNL_COPY_PACKET:
inst->copy_mode = mode; inst->copy_mode = mode;
/* we're using struct nlattr which has 16bit nfa_len */ inst->copy_range = min_t(unsigned int,
if (range > 0xffff) range, NFULNL_COPY_RANGE_MAX);
inst->copy_range = 0xffff;
else
inst->copy_range = range;
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment