ip6_tables.h
001:
002:
003:
004:
005:
006:
007:
008:
009:
010:
011:
012:
013:
014:
015: #ifndef _IP6_TABLES_H
016: #define _IP6_TABLES_H
017:
018: #include <linux/types.h>
019:
020: #include <linux/netfilter_ipv6.h>
021:
022: #include <linux/netfilter/x_tables.h>
023:
024: #define IP6T_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
025: #define IP6T_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
026: #define ip6t_match xt_match
027: #define ip6t_target xt_target
028: #define ip6t_table xt_table
029: #define ip6t_get_revision xt_get_revision
030: #define ip6t_entry_match xt_entry_match
031: #define ip6t_entry_target xt_entry_target
032: #define ip6t_standard_target xt_standard_target
033: #define ip6t_error_target xt_error_target
034: #define ip6t_counters xt_counters
035: #define IP6T_CONTINUE XT_CONTINUE
036: #define IP6T_RETURN XT_RETURN
037:
038:
039: #include <linux/netfilter/xt_tcpudp.h>
040: #define ip6t_tcp xt_tcp
041: #define ip6t_udp xt_udp
042: #define IP6T_TCP_INV_SRCPT XT_TCP_INV_SRCPT
043: #define IP6T_TCP_INV_DSTPT XT_TCP_INV_DSTPT
044: #define IP6T_TCP_INV_FLAGS XT_TCP_INV_FLAGS
045: #define IP6T_TCP_INV_OPTION XT_TCP_INV_OPTION
046: #define IP6T_TCP_INV_MASK XT_TCP_INV_MASK
047: #define IP6T_UDP_INV_SRCPT XT_UDP_INV_SRCPT
048: #define IP6T_UDP_INV_DSTPT XT_UDP_INV_DSTPT
049: #define IP6T_UDP_INV_MASK XT_UDP_INV_MASK
050:
051: #define ip6t_counters_info xt_counters_info
052: #define IP6T_STANDARD_TARGET XT_STANDARD_TARGET
053: #define IP6T_ERROR_TARGET XT_ERROR_TARGET
054: #define IP6T_MATCH_ITERATE(e, fn, args...) \
055: XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args)
056: #define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \
057: XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args)
058:
059:
060: struct ip6t_ip6 {
061:
062: struct in6_addr src, dst;
063:
064: struct in6_addr smsk, dmsk;
065: char iniface[IFNAMSIZ], outiface[IFNAMSIZ];
066: unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
067:
068:
069:
070:
071:
072:
073:
074:
075:
076: __u16 proto;
077:
078: __u8 tos;
079:
080:
081: __u8 flags;
082:
083: __u8 invflags;
084: };
085:
086:
087: #define IP6T_F_PROTO 0x01
088:
089: #define IP6T_F_TOS 0x02
090: #define IP6T_F_GOTO 0x04
091: #define IP6T_F_MASK 0x07
092:
093:
094: #define IP6T_INV_VIA_IN 0x01
095: #define IP6T_INV_VIA_OUT 0x02
096: #define IP6T_INV_TOS 0x04
097: #define IP6T_INV_SRCIP 0x08
098: #define IP6T_INV_DSTIP 0x10
099: #define IP6T_INV_FRAG 0x20
100: #define IP6T_INV_PROTO XT_INV_PROTO
101: #define IP6T_INV_MASK 0x7F
102:
103:
104:
105:
106: struct ip6t_entry {
107: struct ip6t_ip6 ipv6;
108:
109:
110: unsigned int nfcache;
111:
112:
113: __u16 target_offset;
114:
115: __u16 next_offset;
116:
117:
118: unsigned int comefrom;
119:
120:
121: struct xt_counters counters;
122:
123:
124: unsigned char elems[0];
125: };
126:
127:
128: struct ip6t_standard {
129: struct ip6t_entry entry;
130: struct xt_standard_target target;
131: };
132:
133: struct ip6t_error {
134: struct ip6t_entry entry;
135: struct xt_error_target target;
136: };
137:
138: #define IP6T_ENTRY_INIT(__size) \
139: { \
140: .target_offset = sizeof(struct ip6t_entry), \
141: .next_offset = (__size), \
142: }
143:
144: #define IP6T_STANDARD_INIT(__verdict) \
145: { \
146: .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_standard)), \
147: .target = XT_TARGET_INIT(XT_STANDARD_TARGET, \
148: sizeof(struct xt_standard_target)), \
149: .target.verdict = -(__verdict) - 1, \
150: }
151:
152: #define IP6T_ERROR_INIT \
153: { \
154: .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_error)), \
155: .target = XT_TARGET_INIT(XT_ERROR_TARGET, \
156: sizeof(struct xt_error_target)), \
157: .target.errorname = "ERROR", \
158: }
159:
160:
161:
162:
163:
164:
165:
166:
167: #define IP6T_BASE_CTL 64
168:
169: #define IP6T_SO_SET_REPLACE (IP6T_BASE_CTL)
170: #define IP6T_SO_SET_ADD_COUNTERS (IP6T_BASE_CTL + 1)
171: #define IP6T_SO_SET_MAX IP6T_SO_SET_ADD_COUNTERS
172:
173: #define IP6T_SO_GET_INFO (IP6T_BASE_CTL)
174: #define IP6T_SO_GET_ENTRIES (IP6T_BASE_CTL + 1)
175: #define IP6T_SO_GET_REVISION_MATCH (IP6T_BASE_CTL + 4)
176: #define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5)
177: #define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET
178:
179:
180: struct ip6t_icmp {
181: __u8 type;
182: __u8 code[2];
183: __u8 invflags;
184: };
185:
186:
187: #define IP6T_ICMP_INV 0x01
188:
189:
190: struct ip6t_getinfo {
191:
192: char name[XT_TABLE_MAXNAMELEN];
193:
194:
195:
196: unsigned int valid_hooks;
197:
198:
199: unsigned int hook_entry[NF_INET_NUMHOOKS];
200:
201:
202: unsigned int underflow[NF_INET_NUMHOOKS];
203:
204:
205: unsigned int num_entries;
206:
207:
208: unsigned int size;
209: };
210:
211:
212: struct ip6t_replace {
213:
214: char name[XT_TABLE_MAXNAMELEN];
215:
216:
217:
218: unsigned int valid_hooks;
219:
220:
221: unsigned int num_entries;
222:
223:
224: unsigned int size;
225:
226:
227: unsigned int hook_entry[NF_INET_NUMHOOKS];
228:
229:
230: unsigned int underflow[NF_INET_NUMHOOKS];
231:
232:
233:
234: unsigned int num_counters;
235:
236: struct xt_counters *counters;
237:
238:
239: struct ip6t_entry entries[0];
240: };
241:
242:
243: struct ip6t_get_entries {
244:
245: char name[XT_TABLE_MAXNAMELEN];
246:
247:
248: unsigned int size;
249:
250:
251: struct ip6t_entry entrytable[0];
252: };
253:
254:
255: static __inline__ struct xt_entry_target *
256: ip6t_get_target(struct ip6t_entry *e)
257: {
258: return (void *)e + e->target_offset;
259: }
260:
261:
262:
263:
264:
265: #endif
266:
© Andrew Scott 2006 -
2025,
All Rights Reserved