arp_tables.h
001:
002:
003:
004:
005:
006:
007:
008:
009: #ifndef _ARPTABLES_H
010: #define _ARPTABLES_H
011:
012: #include <linux/types.h>
013:
014: #include <linux/netfilter_arp.h>
015:
016: #include <linux/netfilter/x_tables.h>
017:
018: #define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
019: #define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
020: #define arpt_entry_target xt_entry_target
021: #define arpt_standard_target xt_standard_target
022: #define arpt_error_target xt_error_target
023: #define ARPT_CONTINUE XT_CONTINUE
024: #define ARPT_RETURN XT_RETURN
025: #define arpt_counters_info xt_counters_info
026: #define arpt_counters xt_counters
027: #define ARPT_STANDARD_TARGET XT_STANDARD_TARGET
028: #define ARPT_ERROR_TARGET XT_ERROR_TARGET
029: #define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \
030: XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args)
031:
032: #define ARPT_DEV_ADDR_LEN_MAX 16
033:
034: struct arpt_devaddr_info {
035: char addr[ARPT_DEV_ADDR_LEN_MAX];
036: char mask[ARPT_DEV_ADDR_LEN_MAX];
037: };
038:
039:
040: struct arpt_arp {
041:
042: struct in_addr src, tgt;
043:
044: struct in_addr smsk, tmsk;
045:
046:
047: __u8 arhln, arhln_mask;
048: struct arpt_devaddr_info src_devaddr;
049: struct arpt_devaddr_info tgt_devaddr;
050:
051:
052: __be16 arpop, arpop_mask;
053:
054:
055: __be16 arhrd, arhrd_mask;
056: __be16 arpro, arpro_mask;
057:
058:
059:
060:
061:
062: char iniface[IFNAMSIZ], outiface[IFNAMSIZ];
063: unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
064:
065:
066: __u8 flags;
067:
068: __u16 invflags;
069: };
070:
071:
072:
073:
074: #define ARPT_F_MASK 0x00
075:
076:
077: #define ARPT_INV_VIA_IN 0x0001
078: #define ARPT_INV_VIA_OUT 0x0002
079: #define ARPT_INV_SRCIP 0x0004
080: #define ARPT_INV_TGTIP 0x0008
081: #define ARPT_INV_SRCDEVADDR 0x0010
082: #define ARPT_INV_TGTDEVADDR 0x0020
083: #define ARPT_INV_ARPOP 0x0040
084: #define ARPT_INV_ARPHRD 0x0080
085: #define ARPT_INV_ARPPRO 0x0100
086: #define ARPT_INV_ARPHLN 0x0200
087: #define ARPT_INV_MASK 0x03FF
088:
089:
090:
091:
092: struct arpt_entry
093: {
094: struct arpt_arp arp;
095:
096:
097: __u16 target_offset;
098:
099: __u16 next_offset;
100:
101:
102: unsigned int comefrom;
103:
104:
105: struct xt_counters counters;
106:
107:
108: unsigned char elems[0];
109: };
110:
111:
112:
113:
114:
115:
116:
117:
118: #define ARPT_BASE_CTL 96
119:
120: #define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL)
121: #define ARPT_SO_SET_ADD_COUNTERS (ARPT_BASE_CTL + 1)
122: #define ARPT_SO_SET_MAX ARPT_SO_SET_ADD_COUNTERS
123:
124: #define ARPT_SO_GET_INFO (ARPT_BASE_CTL)
125: #define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1)
126:
127: #define ARPT_SO_GET_REVISION_TARGET (ARPT_BASE_CTL + 3)
128: #define ARPT_SO_GET_MAX (ARPT_SO_GET_REVISION_TARGET)
129:
130:
131: struct arpt_getinfo {
132:
133: char name[XT_TABLE_MAXNAMELEN];
134:
135:
136:
137: unsigned int valid_hooks;
138:
139:
140: unsigned int hook_entry[NF_ARP_NUMHOOKS];
141:
142:
143: unsigned int underflow[NF_ARP_NUMHOOKS];
144:
145:
146: unsigned int num_entries;
147:
148:
149: unsigned int size;
150: };
151:
152:
153: struct arpt_replace {
154:
155: char name[XT_TABLE_MAXNAMELEN];
156:
157:
158:
159: unsigned int valid_hooks;
160:
161:
162: unsigned int num_entries;
163:
164:
165: unsigned int size;
166:
167:
168: unsigned int hook_entry[NF_ARP_NUMHOOKS];
169:
170:
171: unsigned int underflow[NF_ARP_NUMHOOKS];
172:
173:
174:
175: unsigned int num_counters;
176:
177: struct xt_counters *counters;
178:
179:
180: struct arpt_entry entries[0];
181: };
182:
183:
184: struct arpt_get_entries {
185:
186: char name[XT_TABLE_MAXNAMELEN];
187:
188:
189: unsigned int size;
190:
191:
192: struct arpt_entry entrytable[0];
193: };
194:
195:
196: static __inline__ struct xt_entry_target *arpt_get_target(struct arpt_entry *e)
197: {
198: return (void *)e + e->target_offset;
199: }
200:
201:
202:
203:
204: #endif
205:
© Andrew Scott 2006 -
2025,
All Rights Reserved