netfilter: xt_NFLOG: nflog-range does not truncate packets
li->u.ulog.copy_len is currently ignored by the kernel, we should truncate the packet to either li->u.ulog.copy_len (if set) or copy_range before sending it to userspace. 0 is a valid input for copy_len, so add a new flag to indicate whether this was option was specified by the user or not. Add two flags to indicate whether nflog-size/copy_len was set or not. XT_NFLOG_F_COPY_LEN is for XT_NFLOG and NFLOG_F_COPY_LEN for nfnetlink_log On the userspace side, this was initially represented by the option nflog-range, this will be replaced by --nflog-size now. --nflog-range would still exist but does not do anything. Reported-by: Joe Dollard <jdollard@akamai.com> Reviewed-by: Josh Hunt <johunt@akamai.com> Signed-off-by: Vishwanath Pai <vpai@akamai.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:

committed by
Pablo Neira Ayuso

parent
e1dbbc5907
commit
7643507fe8
@@ -12,6 +12,9 @@
|
||||
#define NF_LOG_UID 0x08 /* Log UID owning local socket */
|
||||
#define NF_LOG_MASK 0x0f
|
||||
|
||||
/* This flag indicates that copy_len field in nf_loginfo is set */
|
||||
#define NF_LOG_F_COPY_LEN 0x1
|
||||
|
||||
enum nf_log_type {
|
||||
NF_LOG_TYPE_LOG = 0,
|
||||
NF_LOG_TYPE_ULOG,
|
||||
@@ -22,9 +25,13 @@ struct nf_loginfo {
|
||||
u_int8_t type;
|
||||
union {
|
||||
struct {
|
||||
/* copy_len will be used iff you set
|
||||
* NF_LOG_F_COPY_LEN in flags
|
||||
*/
|
||||
u_int32_t copy_len;
|
||||
u_int16_t group;
|
||||
u_int16_t qthreshold;
|
||||
u_int16_t flags;
|
||||
} ulog;
|
||||
struct {
|
||||
u_int8_t level;
|
||||
|
Reference in New Issue
Block a user