diff options
author | Harald Welte <laforge@netfilter.org> | 2005-08-09 23:26:55 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-08-29 18:54:28 -0400 |
commit | 1d3de414eb20d937d82c5219fd13ee4cedc499cb (patch) | |
tree | 3e249fc3ecd33bdec336208a29f0a8fdea062439 /include/linux | |
parent | e2e268665f6c01686b477a6b0cc5a70bab689d54 (diff) |
[NETFILTER]: New iptables DCCP protocol header match
Using this new iptables DCCP protocol header match, it is possible to
create simplistic stateless packet filtering rules for DCCP. It
permits matching of port numbers, packet type and options.
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/dccp.h | 16 | ||||
-rw-r--r-- | include/linux/netfilter_ipv4/ipt_dccp.h | 23 |
2 files changed, 36 insertions, 3 deletions
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index fd1412ddb3ff..431d58923ba9 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -242,10 +242,15 @@ static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb) | |||
242 | return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr)); | 242 | return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr)); |
243 | } | 243 | } |
244 | 244 | ||
245 | static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh) | ||
246 | { | ||
247 | return sizeof(*dh) + (dh->dccph_x ? sizeof(struct dccp_hdr_ext) : 0); | ||
248 | } | ||
249 | |||
245 | static inline unsigned int dccp_basic_hdr_len(const struct sk_buff *skb) | 250 | static inline unsigned int dccp_basic_hdr_len(const struct sk_buff *skb) |
246 | { | 251 | { |
247 | const struct dccp_hdr *dh = dccp_hdr(skb); | 252 | const struct dccp_hdr *dh = dccp_hdr(skb); |
248 | return sizeof(*dh) + (dh->dccph_x ? sizeof(struct dccp_hdr_ext) : 0); | 253 | return __dccp_basic_hdr_len(dh); |
249 | } | 254 | } |
250 | 255 | ||
251 | static inline __u64 dccp_hdr_seq(const struct sk_buff *skb) | 256 | static inline __u64 dccp_hdr_seq(const struct sk_buff *skb) |
@@ -297,10 +302,15 @@ static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb) | |||
297 | return (struct dccp_hdr_reset *)(skb->h.raw + dccp_basic_hdr_len(skb)); | 302 | return (struct dccp_hdr_reset *)(skb->h.raw + dccp_basic_hdr_len(skb)); |
298 | } | 303 | } |
299 | 304 | ||
305 | static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh) | ||
306 | { | ||
307 | return __dccp_basic_hdr_len(dh) + | ||
308 | dccp_packet_hdr_len(dh->dccph_type); | ||
309 | } | ||
310 | |||
300 | static inline unsigned int dccp_hdr_len(const struct sk_buff *skb) | 311 | static inline unsigned int dccp_hdr_len(const struct sk_buff *skb) |
301 | { | 312 | { |
302 | return dccp_basic_hdr_len(skb) + | 313 | return __dccp_hdr_len(dccp_hdr(skb)); |
303 | dccp_packet_hdr_len(dccp_hdr(skb)->dccph_type); | ||
304 | } | 314 | } |
305 | 315 | ||
306 | 316 | ||
diff --git a/include/linux/netfilter_ipv4/ipt_dccp.h b/include/linux/netfilter_ipv4/ipt_dccp.h new file mode 100644 index 000000000000..3cb3a522e62b --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_dccp.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef _IPT_DCCP_H_ | ||
2 | #define _IPT_DCCP_H_ | ||
3 | |||
4 | #define IPT_DCCP_SRC_PORTS 0x01 | ||
5 | #define IPT_DCCP_DEST_PORTS 0x02 | ||
6 | #define IPT_DCCP_TYPE 0x04 | ||
7 | #define IPT_DCCP_OPTION 0x08 | ||
8 | |||
9 | #define IPT_DCCP_VALID_FLAGS 0x0f | ||
10 | |||
11 | struct ipt_dccp_info { | ||
12 | u_int16_t dpts[2]; /* Min, Max */ | ||
13 | u_int16_t spts[2]; /* Min, Max */ | ||
14 | |||
15 | u_int16_t flags; | ||
16 | u_int16_t invflags; | ||
17 | |||
18 | u_int16_t typemask; | ||
19 | u_int8_t option; | ||
20 | }; | ||
21 | |||
22 | #endif /* _IPT_DCCP_H_ */ | ||
23 | |||