Home | History | Annotate | Download | only in netfilter_arp
      1 /****************************************************************************
      2  ****************************************************************************
      3  ***
      4  ***   This header was automatically generated from a Linux kernel header
      5  ***   of the same name, to make information necessary for userspace to
      6  ***   call into the kernel available to libc.  It contains only constants,
      7  ***   structures, and macros generated from the original header, and thus,
      8  ***   contains no copyrightable information.
      9  ***
     10  ****************************************************************************
     11  ****************************************************************************/
     12 #ifndef _ARPTABLES_H
     13 #define _ARPTABLES_H
     14 
     15 #include <linux/compiler.h>
     16 #include <linux/netfilter_arp.h>
     17 
     18 #include <linux/netfilter/x_tables.h>
     19 
     20 #define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
     21 #define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
     22 #define arpt_target xt_target
     23 #define arpt_table xt_table
     24 
     25 #define ARPT_DEV_ADDR_LEN_MAX 16
     26 
     27 struct arpt_devaddr_info {
     28  char addr[ARPT_DEV_ADDR_LEN_MAX];
     29  char mask[ARPT_DEV_ADDR_LEN_MAX];
     30 };
     31 
     32 struct arpt_arp {
     33 
     34  struct in_addr src, tgt;
     35 
     36  struct in_addr smsk, tmsk;
     37 
     38  u_int8_t arhln, arhln_mask;
     39  struct arpt_devaddr_info src_devaddr;
     40  struct arpt_devaddr_info tgt_devaddr;
     41 
     42  u_int16_t arpop, arpop_mask;
     43 
     44  u_int16_t arhrd, arhrd_mask;
     45  u_int16_t arpro, arpro_mask;
     46 
     47  char iniface[IFNAMSIZ], outiface[IFNAMSIZ];
     48  unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
     49 
     50  u_int8_t flags;
     51 
     52  u_int16_t invflags;
     53 };
     54 
     55 #define arpt_entry_target xt_entry_target
     56 #define arpt_standard_target xt_standard_target
     57 
     58 #define ARPT_F_MASK 0x00
     59 
     60 #define ARPT_INV_VIA_IN 0x0001
     61 #define ARPT_INV_VIA_OUT 0x0002
     62 #define ARPT_INV_SRCIP 0x0004
     63 #define ARPT_INV_TGTIP 0x0008
     64 #define ARPT_INV_SRCDEVADDR 0x0010
     65 #define ARPT_INV_TGTDEVADDR 0x0020
     66 #define ARPT_INV_ARPOP 0x0040
     67 #define ARPT_INV_ARPHRD 0x0080
     68 #define ARPT_INV_ARPPRO 0x0100
     69 #define ARPT_INV_ARPHLN 0x0200
     70 #define ARPT_INV_MASK 0x03FF
     71 
     72 struct arpt_entry
     73 {
     74  struct arpt_arp arp;
     75 
     76  u_int16_t target_offset;
     77 
     78  u_int16_t next_offset;
     79 
     80  unsigned int comefrom;
     81 
     82  struct xt_counters counters;
     83 
     84  unsigned char elems[0];
     85 };
     86 
     87 #define ARPT_CTL_OFFSET 32
     88 #define ARPT_BASE_CTL (XT_BASE_CTL+ARPT_CTL_OFFSET)
     89 
     90 #define ARPT_SO_SET_REPLACE (XT_SO_SET_REPLACE+ARPT_CTL_OFFSET)
     91 #define ARPT_SO_SET_ADD_COUNTERS (XT_SO_SET_ADD_COUNTERS+ARPT_CTL_OFFSET)
     92 #define ARPT_SO_SET_MAX (XT_SO_SET_MAX+ARPT_CTL_OFFSET)
     93 
     94 #define ARPT_SO_GET_INFO (XT_SO_GET_INFO+ARPT_CTL_OFFSET)
     95 #define ARPT_SO_GET_ENTRIES (XT_SO_GET_ENTRIES+ARPT_CTL_OFFSET)
     96 
     97 #define ARPT_SO_GET_REVISION_TARGET (XT_SO_GET_REVISION_TARGET+ARPT_CTL_OFFSET)
     98 #define ARPT_SO_GET_MAX (XT_SO_GET_REVISION_TARGET+ARPT_CTL_OFFSET)
     99 
    100 #define ARPT_CONTINUE XT_CONTINUE
    101 
    102 #define ARPT_RETURN XT_RETURN
    103 
    104 struct arpt_getinfo
    105 {
    106 
    107  char name[ARPT_TABLE_MAXNAMELEN];
    108 
    109  unsigned int valid_hooks;
    110 
    111  unsigned int hook_entry[NF_ARP_NUMHOOKS];
    112 
    113  unsigned int underflow[NF_ARP_NUMHOOKS];
    114 
    115  unsigned int num_entries;
    116 
    117  unsigned int size;
    118 };
    119 
    120 struct arpt_replace
    121 {
    122 
    123  char name[ARPT_TABLE_MAXNAMELEN];
    124 
    125  unsigned int valid_hooks;
    126 
    127  unsigned int num_entries;
    128 
    129  unsigned int size;
    130 
    131  unsigned int hook_entry[NF_ARP_NUMHOOKS];
    132 
    133  unsigned int underflow[NF_ARP_NUMHOOKS];
    134 
    135  unsigned int num_counters;
    136 
    137  struct xt_counters __user *counters;
    138 
    139  struct arpt_entry entries[0];
    140 };
    141 
    142 #define arpt_counters_info xt_counters_info
    143 
    144 struct arpt_get_entries
    145 {
    146 
    147  char name[ARPT_TABLE_MAXNAMELEN];
    148 
    149  unsigned int size;
    150 
    151  struct arpt_entry entrytable[0];
    152 };
    153 
    154 #define ARPT_STANDARD_TARGET XT_STANDARD_TARGET
    155 
    156 #define ARPT_ERROR_TARGET XT_ERROR_TARGET
    157 
    158 #define ARPT_ENTRY_ITERATE(entries, size, fn, args...)  ({   unsigned int __i;   int __ret = 0;   struct arpt_entry *__entry;     for (__i = 0; __i < (size); __i += __entry->next_offset) {   __entry = (void *)(entries) + __i;     __ret = fn(__entry , ## args);   if (__ret != 0)   break;   }   __ret;  })
    159 #endif
    160