add mark target
v3 cover add mark target
v1:
add mark target for arptables
v2:
add --and-mark
add --or-mark
add revision for common api
v3:
fold 2/4, 3/4 and 4/4 patch into one single patch use C99 initialization
change some format
Zhang Chunyu (2):
Add MARK target for arptables
arptables.8 | 17 ++++ arptables.c | 2 + extensions/Makefile | 2 +- extensions/arpt_CLASSIFY.c | 1 + extensions/arpt_MARK.c | 151 +++++++++++++++++++++++++++++++ extensions/arpt_mangle.c | 1 + extensions/arpt_standard.c | 1 + include/arptables.h | 6 ++ include/linux/netfilter_arp/arp_tables.h | 3 +- 9 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 extensions/arpt_MARK.c
Signature · 1 line
1.7.12.4
PATCH v3 1/2 Add revision field for xt_entry_target
From: zhangcy <[email protected]>
This filed is useful if we want to add TARGET which has revision for arptables rules.
Also make sure xt_entry_target is consistent with the definition in kernel.
--- arptables.c | 2 ++ extensions/arpt_CLASSIFY.c | 1 + extensions/arpt_mangle.c | 1 + extensions/arpt_standard.c | 1 + include/arptables.h | 6 ++++++ include/linux/netfilter_arp/arp_tables.h | 3 ++- 6 files changed, 13 insertions(+), 1 deletion(-)
arptables.c +2 -0
@@ -2067,6 +2067,7 @@ int do_command(int argc, char *argv[], char **table, arptc_handle_t *handle) target->t->u.target_size = size;strncpy (target->t->u.user.name, jumpto,sizeof (target->t->u.user.name)); target->t->u.user.name[sizeof (target->t->u.user.name)-1 ] ='\0' ; + target->t->u.user.revision = target->revision;/* target->init(target->t, &fw.nfcache); */
@@ -2391,6 +2392,7 @@ int do_command(int argc, char *argv[], char **table, arptc_handle_t *handle) target->t =fw_calloc (1 , size); target->t->u.target_size = size;strcpy (target->t->u.user.name, jumpto); + target->t->u.user.revision = target->revision; target->init (target->t); }
extensions/arpt_CLASSIFY.c +1 -0
@@ -105,6 +105,7 @@ struct arptables_target classifyARPTABLES_VERSION ,ARPT_ALIGN (sizeof (struct xt_classify_target_info )),ARPT_ALIGN (sizeof (struct xt_classify_target_info )), +0 , &help, &init, &parse,
extensions/arpt_mangle.c +1 -0
@@ -199,6 +199,7 @@ struct arptables_target changeARPTABLES_VERSION ,ARPT_ALIGN (sizeof (struct arpt_mangle )),ARPT_ALIGN (sizeof (struct arpt_mangle )), +0 , &help, &init, &parse,
extensions/arpt_standard.c +1 -0
@@ -54,6 +54,7 @@ struct arptables_target standardARPTABLES_VERSION ,ARPT_ALIGN (sizeof (int )),ARPT_ALIGN (sizeof (int )), +0 , &help, &init, &parse,
include/arptables.h +6 -0
@@ -32,6 +32,9 @@ struct arptables_match/* Size of match data relevent for userspace comparison purposes */ size_t userspacesize; +/* Revision of target (0 by default). */ +u_int8_t revision; +/* Function which prints out usage message. */ void (*help)(void );
@@ -81,6 +84,9 @@ struct arptables_target/* Size of target data relevent for userspace comparison purposes */ size_t userspacesize; +/* Revision of target (0 by default). */ +u_int8_t revision; +/* Function which prints out usage message. */ void (*help)(void );
include/linux/netfilter_arp/arp_tables.h +2 -1
@@ -19,7 +19,7 @@#include <linux/netfilter_arp.h> -#define ARPT_FUNCTION_MAXNAMELEN 30 +#define ARPT_FUNCTION_MAXNAMELEN 29#define ARPT_TABLE_MAXNAMELEN 32#define ARPT_DEV_ADDR_LEN_MAX 16
@@ -69,6 +69,7 @@ struct arpt_entry_target/* Used by userspace */ char name[ARPT_FUNCTION_MAXNAMELEN ]; +u_int8_t revision; } user;struct {u_int16_t target_size;
Signature · 1 line
1.7.12.4
Pablo Neira Ayuso
maintainerRe: [PATCH V3 1/2] Add revision field for xt_entry_target
Quoted 9 lines · Zhang Chunyu
--- arptables.c | 2 ++ extensions/arpt_CLASSIFY.c | 1 + extensions/arpt_mangle.c | 1 + extensions/arpt_standard.c | 1 + include/arptables.h | 6 ++++++ include/linux/netfilter_arp/arp_tables.h | 3 ++- 6 files changed, 13 insertions(+), 1 deletion(-)
[...]
Quoted 14 lines
include/linux/netfilter_arp/arp_tables.h +1
-1@@ -19,7 +19,7 @@#include <linux/netfilter_arp.h> -#define ARPT_FUNCTION_MAXNAMELEN 30 +#define ARPT_FUNCTION_MAXNAMELEN 29#define ARPT_TABLE_MAXNAMELEN 32#define ARPT_DEV_ADDR_LEN_MAX 16
include/linux/netfilter_arp/arp_tables.h struct arpt_entry_target · line 75
Quoted 7 lines
include/linux/netfilter_arp/arp_tables.h +1
-0@@ -69,6 +69,7 @@ struct arpt_entry_target/* Used by userspace */ char name[ARPT_FUNCTION_MAXNAMELEN ]; +u_int8_t revision; } user;struct {u_int16_t target_size;
Could you also resubmit the kernel patch to adds this? Please, no need to resend the full userspace series, just send the kernel patch as a follow up.
Re: Re: [PATCH V3 1/2] Add revision field for xt_entry_target
hi pablo
Quoted 31 lines
From: Pablo Neira Ayuso
Date: 2015-03-26
To: Zhang, Chunyu/章 春宇
Subject: Re: [PATCH V3 1/2] Add revision field forxt_entry_targetQuoted 9 lines · Zhang Chunyu
--- arptables.c | 2 ++ extensions/arpt_CLASSIFY.c | 1 + extensions/arpt_mangle.c | 1 + extensions/arpt_standard.c | 1 + include/arptables.h | 6 ++++++ include/linux/netfilter_arp/arp_tables.h | 3 ++- 6 files changed, 13 insertions(+), 1 deletion(-)[...]
Quoted 15 lines
include/linux/netfilter_arp/arp_tables.h +1
-1@@ -19,7 +19,7 @@#include <linux/netfilter_arp.h> -#define ARPT_FUNCTION_MAXNAMELEN 30 +#define ARPT_FUNCTION_MAXNAMELEN 29#define ARPT_TABLE_MAXNAMELEN 32#define ARPT_DEV_ADDR_LEN_MAX 16@@ -69,6 +69,7 @@ struct arpt_entry_target
Quoted 10 lines
include/linux/netfilter_arp/arp_tables.h struct arpt_entry_target · line 75
Quoted 6 lines
include/linux/netfilter_arp/arp_tables.h +1
-0/* Used by userspace */ char name[ARPT_FUNCTION_MAXNAMELEN ]; +u_int8_t revision; } user;struct {u_int16_t target_size;Could you also resubmit the kernel patch to adds this? Please, no need to resend the full userspace series, just send the kernel patch as a follow up.
do you mean:
include/linux/netfilter_arp/arp_tables.h
Quoted 3 lines
include/linux/netfilter_arp/arp_tables.h +1
-1-#define ARPT_FUNCTION_MAXNAMELEN 30 +#define ARPT_FUNCTION_MAXNAMELEN 29
do this in another patch , like this ?
patch1: change ARPT_FUNCTION_MAXNAMELEN patch2: add revision patch3: add arp mark
Pablo Neira Ayuso
maintainerRe: Re: [PATCH V3 1/2] Add revision field for xt_entry_target
Quoted 9 lines · Chunyu
Quoted 8 lines
From: Pablo Neira Ayuso
Date: 2015-03-26
To: Zhang, Chunyu/章 春宇
Subject: Re: [PATCH V3 1/2] Add revision field forxt_entry_targetCould you also resubmit the kernel patch to adds this? Please, no need to resend the full userspace series, just send the kernel patch as a follow up.
Quoted 5 lines
do you mean:
include/linux/netfilter_arp/arp_tables.h
Quoted 3 lines
include/linux/netfilter_arp/arp_tables.h +1
-1-#define ARPT_FUNCTION_MAXNAMELEN 30 +#define ARPT_FUNCTION_MAXNAMELEN 29do this in another patch , like this ?
I mean this:
http://patchwork.ozlabs.org/patch/437065/
but never mind, I'll take that original patch. Thanks.
--
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
Re: Re: [PATCH V3 1/2] Add revision field for xt_entry_target
Quoted 18 lines
From: netfilter-devel-owner
Date: 2015-03-27
To: Zhang, Chunyu/章 春宇
Subject: Re: Re: [PATCH V3 1/2] Add revision field forxt_entry_targetQuoted 10 lines · Chunyu
Quoted 8 lines
From: Pablo Neira Ayuso
Date: 2015-03-26
To: Zhang, Chunyu/章 春宇
Subject: Re: [PATCH V3 1/2] Add revision field forxt_entry_targetCould you also resubmit the kernel patch to adds this? Please, no need to resend the full userspace series, just send the kernel patch as a follow up.
do you mean:
Quoted 8 lines
Quoted 4 lines
include/linux/netfilter_arp/arp_tables.h
Quoted 3 lines
include/linux/netfilter_arp/arp_tables.h +1
-1-#define ARPT_FUNCTION_MAXNAMELEN 30 +#define ARPT_FUNCTION_MAXNAMELEN 29do this in another patch , like this ?
I mean this:
ok. get it.
will do
Quoted 6 lines
but never mind, I'll take that original patch. Thanks.
--
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
PATCH v3 2/2 Add MARK target for arptables
In reply to Zhang ChunyuWe can use MARK target to set make value for arp packet.
--- arptables.8 | 17 ++++++ extensions/Makefile | 2 +- extensions/arpt_MARK.c | 151 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 extensions/arpt_MARK.c
arptables.8 +17 -0
@@ -315,6 +315,23 @@ sify the packet into a specific CBQ class). Set the major and minor class value. The values are always interpreted as hexadecimal even if no 0x prefix is given. +.SS MARK +This module allows you to set the skb->mark value (and thus classify +the packet by the mark in u32) + +.TP +.BR "--set-mark mark" +Set the mark value. The values are always +interpreted as hexadecimal even if no 0x prefix is given + +.TP +.BR "--and-mark mark" +Binary AND the mark with bits. + +.TP +.BR "--or-mark mark" +Binary OR the mark with bits. + .SH MAILINGLISTS .BR "" "See " http://netfilter.org/mailinglists.html .SH SEE ALSO
extensions/Makefile +1 -1
@@ -1,6 +1,6 @@ #! /usr/bin/make -EXT_FUNC+=standard mangle CLASSIFY +EXT_FUNC+=standard mangle CLASSIFY MARK EXT_OBJS+=$(foreach T,$(EXT_FUNC), extensions/arpt_$(T).o) extensions/ebt_%.o: extensions/arpt_%.c include/arptables.h include/arptables_common.h
extensions/arpt_MARK.c new file +151 -0
151 lines not on this page · raw message
Signature · 1 line
1.7.12.4