~ubuntu-branches/ubuntu/trusty/linux-armadaxp/trusty

« back to all changes in this revision

Viewing changes to include/linux/netfilter/ipset/ip_set.h

  • Committer: Package Import Robot
  • Author(s): Michael Casadevall, Bryan Wu, Dann Frazier, Michael Casadeall
  • Date: 2012-03-10 15:00:54 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120310150054-flugb39zon8vvgwe
Tags: 3.2.0-1600.1
[ Bryan Wu ]
* UBUNTU: import debian/debian.env and debian.armadaxp

[ Dann Frazier ]
* ARM: Armada XP: remove trailing '/' in dirnames in mvRules.mk

[ Michael Casadeall ]
* tools: add some tools for Marvell Armada XP processor
* kernel: timer tick hacking from Marvell
* kernel: Sheeva Errata: add delay on Sheeva when powering down
* net: add Marvell NFP netfilter
* net: socket and skb modifications made by Marvell
* miscdevice: add minor IDs for some Marvell Armada drivers
* fs: introduce memory pool for splice()
* video: EDID detection updates from Marvell Armada XP patchset
* video: backlight: add Marvell Dove LCD backlight driver
* video: display: add THS8200 display driver
* video: framebuffer: add Marvell Dove and Armada XP processor onchip LCD controller driver
* usbtest: add Interrupt transfer testing by Marvell Armada XP code
* usb: ehci: add support for Marvell EHCI controler
* tty/serial: 8250: add support for Marvell Armada XP processor and DeviceTree work
* rtc: add support for Marvell Armada XP onchip RTC controller
* net: pppoe: add Marvell ethernet NFP hook in PPPoE networking driver
* mtd: nand: add support for Marvell Armada XP Nand Flash Controller
* mtd: maps: add Marvell Armada XP specific map driver
* mmc: add support for Marvell Armada XP MMC/SD host controller
* i2c: add support for Marvell Armada XP onchip i2c bus controller
* hwmon: add Kconfig option for Armada XP onchip thermal sensor driver
* dmaengine: add Net DMA support for splice and update Marvell XOR DMA engine driver
* ata: add support for Marvell Armada XP SATA controller and update some quirks
* ARM: add Marvell Armada XP machine to mach-types
* ARM: oprofile: add support for Marvell PJ4B core
* ARM: mm: more ARMv6 switches for Marvell Armada XP
* ARM: remove static declaration to allow compilation
* ARM: alignment access fault trick
* ARM: mm: skip some fault fixing when run on NONE SMP ARMv6 mode during early abort event
* ARM: mm: add Marvell Sheeva CPU Architecture for PJ4B
* ARM: introduce optimized copy operation for Marvell Armada XP
* ARM: SAUCE: hardware breakpoint trick for Marvell Armada XP
* ARM: big endian and little endian tricks for Marvell Armada XP
* ARM: SAUCE: Add Marvell Armada XP build rules to arch/arm/kernel/Makefile
* ARM: vfp: add special handling for Marvell Armada XP
* ARM: add support for Marvell U-Boot
* ARM: add mv_controller_num for ARM PCI drivers
* ARM: add support for local PMUs, general SMP tweaks and cache flushing
* ARM: add Marvell device identifies in glue-proc.h
* ARM: add IPC driver support for Marvell platforms
* ARM: add DMA mapping for Marvell platforms
* ARM: add Sheeva errata and PJ4B code for booting
* ARM: update Kconfig and Makefile to include Marvell Armada XP platforms
* ARM: Armada XP: import LSP from Marvell for Armada XP 3.2 kernel enablement

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
        IPSET_ATTR_NAMEREF,
105
105
        IPSET_ATTR_IP2,
106
106
        IPSET_ATTR_CIDR2,
 
107
        IPSET_ATTR_IP2_TO,
 
108
        IPSET_ATTR_IFACE,
107
109
        __IPSET_ATTR_ADT_MAX,
108
110
};
109
111
#define IPSET_ATTR_ADT_MAX      (__IPSET_ATTR_ADT_MAX - 1)
142
144
enum ipset_cmd_flags {
143
145
        IPSET_FLAG_BIT_EXIST    = 0,
144
146
        IPSET_FLAG_EXIST        = (1 << IPSET_FLAG_BIT_EXIST),
 
147
        IPSET_FLAG_BIT_LIST_SETNAME = 1,
 
148
        IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME),
 
149
        IPSET_FLAG_BIT_LIST_HEADER = 2,
 
150
        IPSET_FLAG_LIST_HEADER  = (1 << IPSET_FLAG_BIT_LIST_HEADER),
145
151
};
146
152
 
147
153
/* Flags at CADT attribute level */
148
154
enum ipset_cadt_flags {
149
155
        IPSET_FLAG_BIT_BEFORE   = 0,
150
156
        IPSET_FLAG_BEFORE       = (1 << IPSET_FLAG_BIT_BEFORE),
 
157
        IPSET_FLAG_BIT_PHYSDEV  = 1,
 
158
        IPSET_FLAG_PHYSDEV      = (1 << IPSET_FLAG_BIT_PHYSDEV),
151
159
};
152
160
 
153
161
/* Commands with settype-specific attributes */
165
173
#include <linux/ipv6.h>
166
174
#include <linux/netlink.h>
167
175
#include <linux/netfilter.h>
 
176
#include <linux/netfilter/x_tables.h>
168
177
#include <linux/vmalloc.h>
169
178
#include <net/netlink.h>
170
179
 
206
215
        IPSET_TYPE_IP2 = (1 << IPSET_TYPE_IP2_FLAG),
207
216
        IPSET_TYPE_NAME_FLAG = 4,
208
217
        IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG),
 
218
        IPSET_TYPE_IFACE_FLAG = 5,
 
219
        IPSET_TYPE_IFACE = (1 << IPSET_TYPE_IFACE_FLAG),
209
220
        /* Strictly speaking not a feature, but a flag for dumping:
210
221
         * this settype must be dumped last */
211
222
        IPSET_DUMP_LAST_FLAG = 7,
214
225
 
215
226
struct ip_set;
216
227
 
217
 
typedef int (*ipset_adtfn)(struct ip_set *set, void *value, u32 timeout);
 
228
typedef int (*ipset_adtfn)(struct ip_set *set, void *value,
 
229
                           u32 timeout, u32 flags);
 
230
 
 
231
/* Kernel API function options */
 
232
struct ip_set_adt_opt {
 
233
        u8 family;              /* Actual protocol family */
 
234
        u8 dim;                 /* Dimension of match/target */
 
235
        u8 flags;               /* Direction and negation flags */
 
236
        u32 cmdflags;           /* Command-like flags */
 
237
        u32 timeout;            /* Timeout value */
 
238
};
218
239
 
219
240
/* Set type, variant-specific part */
220
241
struct ip_set_type_variant {
223
244
         *                      zero for no match/success to add/delete
224
245
         *                      positive for matching element */
225
246
        int (*kadt)(struct ip_set *set, const struct sk_buff * skb,
226
 
                    enum ipset_adt adt, u8 pf, u8 dim, u8 flags);
 
247
                    const struct xt_action_param *par,
 
248
                    enum ipset_adt adt, const struct ip_set_adt_opt *opt);
227
249
 
228
250
        /* Userspace: test/add/del entries
229
251
         *              returns negative error code,
230
252
         *                      zero for no match/success to add/delete
231
253
         *                      positive for matching element */
232
254
        int (*uadt)(struct ip_set *set, struct nlattr *tb[],
233
 
                    enum ipset_adt adt, u32 *lineno, u32 flags);
 
255
                    enum ipset_adt adt, u32 *lineno, u32 flags, bool retried);
234
256
 
235
257
        /* Low level add/del/test functions */
236
258
        ipset_adtfn adt[IPSET_ADT_MAX];
268
290
        u8 dimension;
269
291
        /* Supported family: may be AF_UNSPEC for both AF_INET/AF_INET6 */
270
292
        u8 family;
271
 
        /* Type revision */
272
 
        u8 revision;
 
293
        /* Type revisions */
 
294
        u8 revision_min, revision_max;
273
295
 
274
296
        /* Create set */
275
297
        int (*create)(struct ip_set *set, struct nlattr *tb[], u32 flags);
300
322
        const struct ip_set_type_variant *variant;
301
323
        /* The actual INET family of the set */
302
324
        u8 family;
 
325
        /* The type revision */
 
326
        u8 revision;
303
327
        /* The type specific data */
304
328
        void *data;
305
329
};
307
331
/* register and unregister set references */
308
332
extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set);
309
333
extern void ip_set_put_byindex(ip_set_id_t index);
310
 
extern const char * ip_set_name_byindex(ip_set_id_t index);
 
334
extern const char *ip_set_name_byindex(ip_set_id_t index);
311
335
extern ip_set_id_t ip_set_nfnl_get(const char *name);
312
336
extern ip_set_id_t ip_set_nfnl_get_byindex(ip_set_id_t index);
313
337
extern void ip_set_nfnl_put(ip_set_id_t index);
314
338
 
315
339
/* API for iptables set match, and SET target */
 
340
 
316
341
extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb,
317
 
                      u8 family, u8 dim, u8 flags);
 
342
                      const struct xt_action_param *par,
 
343
                      const struct ip_set_adt_opt *opt);
318
344
extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb,
319
 
                      u8 family, u8 dim, u8 flags);
 
345
                      const struct xt_action_param *par,
 
346
                      const struct ip_set_adt_opt *opt);
320
347
extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb,
321
 
                       u8 family, u8 dim, u8 flags);
 
348
                       const struct xt_action_param *par,
 
349
                       const struct ip_set_adt_opt *opt);
322
350
 
323
351
/* Utility functions */
324
 
extern void * ip_set_alloc(size_t size);
 
352
extern void *ip_set_alloc(size_t size);
325
353
extern void ip_set_free(void *members);
326
354
extern int ip_set_get_ipaddr4(struct nlattr *nla,  __be32 *ipaddr);
327
355
extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr);
331
359
{
332
360
        __be32 ip;
333
361
        int ret = ip_set_get_ipaddr4(nla, &ip);
334
 
        
 
362
 
335
363
        if (ret)
336
364
                return ret;
337
365
        *ipaddr = ntohl(ip);