Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ip6_tables.h
Go to the documentation of this file.
1 /*
2  * 25-Jul-1998 Major changes to allow for ip chain table
3  *
4  * 3-Jan-2000 Named tables to allow packet selection for different uses.
5  */
6 
7 /*
8  * Format of an IP6 firewall descriptor
9  *
10  * src, dst, src_mask, dst_mask are always stored in network byte order.
11  * flags are stored in host byte order (of course).
12  * Port numbers are stored in HOST byte order.
13  */
14 #ifndef _IP6_TABLES_H
15 #define _IP6_TABLES_H
16 
17 #include <linux/if.h>
18 #include <linux/in6.h>
19 #include <linux/ipv6.h>
20 #include <linux/skbuff.h>
21 
22 #include <linux/init.h>
24 
25 extern void ip6t_init(void) __init;
26 
28 extern struct xt_table *ip6t_register_table(struct net *net,
29  const struct xt_table *table,
30  const struct ip6t_replace *repl);
31 extern void ip6t_unregister_table(struct net *net, struct xt_table *table);
32 extern unsigned int ip6t_do_table(struct sk_buff *skb,
33  unsigned int hook,
36  struct xt_table *table);
37 
38 /* Check for an extension */
39 static inline int
40 ip6t_ext_hdr(u8 nexthdr)
41 { return (nexthdr == IPPROTO_HOPOPTS) ||
42  (nexthdr == IPPROTO_ROUTING) ||
43  (nexthdr == IPPROTO_FRAGMENT) ||
44  (nexthdr == IPPROTO_ESP) ||
45  (nexthdr == IPPROTO_AH) ||
46  (nexthdr == IPPROTO_NONE) ||
47  (nexthdr == IPPROTO_DSTOPTS);
48 }
49 
50 enum {
51  IP6T_FH_F_FRAG = (1 << 0),
52  IP6T_FH_F_AUTH = (1 << 1),
53 };
54 
55 /* find specified header and get offset to it */
56 extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
57  int target, unsigned short *fragoff, int *fragflg);
58 
59 #ifdef CONFIG_COMPAT
60 #include <net/compat.h>
61 
62 struct compat_ip6t_entry {
63  struct ip6t_ip6 ipv6;
64  compat_uint_t nfcache;
65  __u16 target_offset;
66  __u16 next_offset;
67  compat_uint_t comefrom;
68  struct compat_xt_counters counters;
69  unsigned char elems[0];
70 };
71 
72 static inline struct xt_entry_target *
73 compat_ip6t_get_target(struct compat_ip6t_entry *e)
74 {
75  return (void *)e + e->target_offset;
76 }
77 
78 #endif /* CONFIG_COMPAT */
79 #endif /* _IP6_TABLES_H */