Skip to contentSkip to conversation

netfilter: ebt_ip6: allow matching on ipv6-icmp types/codes

PATCH Applied Florian Westphal 3 participants 4 messages Dec 20, 2010 – Jan 18, 2011

Subsystems (3)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH v2 1/1 netfilter: ebt_ip6: allow matching on ipv6-icmp types/codes

To avoid adding a new match revision icmp type/code are stored in the sport/dport area.

---
Changes since v1:
- use u16 where appropriate
- use proper () in if condition
- renamed _ports to _pkthdr
- add comment that sizeof(_pktheader) is also ok in ICMP6 case.

 include/linux/netfilter_bridge/ebt_ip6.h |   15 ++++++++--
 net/bridge/netfilter/ebt_ip6.c           |   46 ++++++++++++++++++++++--------
 2 files changed, 46 insertions(+), 15 deletions(-)
include/linux/netfilter_bridge/ebt_ip6.h +12 -3
index e5de987..22af18a 100644
@@ -18,8 +18,11 @@
 #define EBT_IP6_PROTO 0x08
 #define EBT_IP6_SPORT 0x10
 #define EBT_IP6_DPORT 0x20
+#define EBT_IP6_ICMP6 0x40
+
 #define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\
-		      EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT)
+		      EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT | \
+		      EBT_IP6_ICMP6)
 #define EBT_IP6_MATCH "ip6"
 
 /* the same values are used for the invflags */
@@ -32,8 +35,14 @@ struct ebt_ip6_info {
 	uint8_t  protocol;
 	uint8_t  bitmask;
 	uint8_t  invflags;
-	uint16_t sport[2];
-	uint16_t dport[2];
+	union {
+		uint16_t sport[2];
+		uint8_t icmpv6_type[2];
+	};
+	union {
+		uint16_t dport[2];
+		uint8_t icmpv6_code[2];
+	};
 };
 
 #endif
net/bridge/netfilter/ebt_ip6.c +34 -12

83 lines not on this page · raw message

Signature · 1 line
1.7.2.2
Reviewed-by on v2 1/1
#1 lore raw

Op 20/12/2010 15:57, Florian Westphal schreef:

Quoted 12 lines

To avoid adding a new match revision icmp type/code are stored in the sport/dport area.

---
Changes since v1:
- use u16 where appropriate
- use proper () in if condition
- renamed _ports to _pkthdr
- add comment that sizeof(_pktheader) is also ok in ICMP6 case.

Quoted 4 lines
  include/linux/netfilter_bridge/ebt_ip6.h |   15 ++++++++--
  net/bridge/netfilter/ebt_ip6.c           |   46 ++++++++++++++++++++++--------
  2 files changed, 46 insertions(+), 15 deletions(-)

OK for me.

maintainer Applied
#2 lore raw
Quoted 13 lines · Bart De Schuymer

Op 20/12/2010 15:57, Florian Westphal schreef:

Quoted 12 lines

To avoid adding a new match revision icmp type/code are stored in the sport/dport area.

---
Changes since v1:
- use u16 where appropriate
- use proper () in if condition
- renamed _ports to _pkthdr
- add comment that sizeof(_pktheader) is also ok in ICMP6 case.

Quoted 8 lines
Quoted 5 lines
  include/linux/netfilter_bridge/ebt_ip6.h |   15 ++++++++--
  net/bridge/netfilter/ebt_ip6.c           |   46
++++++++++++++++++++++--------
  2 files changed, 46 insertions(+), 15 deletions(-)

OK for me.

Applied, thanks!

Did you already included the user-space part to ebtables?

#3 lore raw
Quoted 19 lines · Pablo Neira Ayuso
Quoted 18 lines · Bart De Schuymer

Op 20/12/2010 15:57, Florian Westphal schreef:

Quoted 17 lines

To avoid adding a new match revision icmp type/code are stored in the sport/dport area.

---
Changes since v1:
- use u16 where appropriate
- use proper () in if condition
- renamed _ports to _pkthdr
- add comment that sizeof(_pktheader) is also ok in ICMP6 case.

   include/linux/netfilter_bridge/ebt_ip6.h |   15 ++++++++--
   net/bridge/netfilter/ebt_ip6.c           |   46
++++++++++++++++++++++--------
   2 files changed, 46 insertions(+), 15 deletions(-)
Quoted 7 lines
Quoted 3 lines

OK for me.

Applied, thanks!

Did you already included the user-space part to ebtables?

I've applied the userspace patch, thanks again.

Bart

Signature · 2 lines
Bart De Schuymer
www.artinalgorithms.be