Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Pkg Iptables
Commits
7e95a8db
Commit
7e95a8db
authored
Dec 21, 2015
by
Arturo Borrero Gonzalez
Browse files
Imported Upstream version 1.4.21
parents
Changes
395
Hide whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
395 of 395+
files are displayed.
Plain diff
Email patch
include/linux/netfilter/xt_pkttype.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_PKTTYPE_H
#define _XT_PKTTYPE_H
struct
xt_pkttype_info
{
int
pkttype
;
int
invert
;
};
#endif
/*_XT_PKTTYPE_H*/
include/linux/netfilter/xt_policy.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_POLICY_H
#define _XT_POLICY_H
#include <linux/types.h>
#define XT_POLICY_MAX_ELEM 4
enum
xt_policy_flags
{
XT_POLICY_MATCH_IN
=
0x1
,
XT_POLICY_MATCH_OUT
=
0x2
,
XT_POLICY_MATCH_NONE
=
0x4
,
XT_POLICY_MATCH_STRICT
=
0x8
,
};
enum
xt_policy_modes
{
XT_POLICY_MODE_TRANSPORT
,
XT_POLICY_MODE_TUNNEL
};
struct
xt_policy_spec
{
__u8
saddr
:
1
,
daddr:
1
,
proto:
1
,
mode:
1
,
spi:
1
,
reqid:
1
;
};
union
xt_policy_addr
{
struct
in_addr
a4
;
struct
in6_addr
a6
;
};
struct
xt_policy_elem
{
union
{
struct
{
union
xt_policy_addr
saddr
;
union
xt_policy_addr
smask
;
union
xt_policy_addr
daddr
;
union
xt_policy_addr
dmask
;
};
};
__be32
spi
;
__u32
reqid
;
__u8
proto
;
__u8
mode
;
struct
xt_policy_spec
match
;
struct
xt_policy_spec
invert
;
};
struct
xt_policy_info
{
struct
xt_policy_elem
pol
[
XT_POLICY_MAX_ELEM
];
__u16
flags
;
__u16
len
;
};
#endif
/* _XT_POLICY_H */
include/linux/netfilter/xt_quota.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_QUOTA_H
#define _XT_QUOTA_H
#include <linux/types.h>
enum
xt_quota_flags
{
XT_QUOTA_INVERT
=
0x1
,
};
#define XT_QUOTA_MASK 0x1
struct
xt_quota_priv
;
struct
xt_quota_info
{
__u32
flags
;
__u32
pad
;
__aligned_u64
quota
;
/* Used internally by the kernel */
struct
xt_quota_priv
*
master
;
};
#endif
/* _XT_QUOTA_H */
include/linux/netfilter/xt_rateest.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_RATEEST_MATCH_H
#define _XT_RATEEST_MATCH_H
#include <linux/types.h>
enum
xt_rateest_match_flags
{
XT_RATEEST_MATCH_INVERT
=
1
<<
0
,
XT_RATEEST_MATCH_ABS
=
1
<<
1
,
XT_RATEEST_MATCH_REL
=
1
<<
2
,
XT_RATEEST_MATCH_DELTA
=
1
<<
3
,
XT_RATEEST_MATCH_BPS
=
1
<<
4
,
XT_RATEEST_MATCH_PPS
=
1
<<
5
,
};
enum
xt_rateest_match_mode
{
XT_RATEEST_MATCH_NONE
,
XT_RATEEST_MATCH_EQ
,
XT_RATEEST_MATCH_LT
,
XT_RATEEST_MATCH_GT
,
};
struct
xt_rateest_match_info
{
char
name1
[
IFNAMSIZ
];
char
name2
[
IFNAMSIZ
];
__u16
flags
;
__u16
mode
;
__u32
bps1
;
__u32
pps1
;
__u32
bps2
;
__u32
pps2
;
/* Used internally by the kernel */
struct
xt_rateest
*
est1
__attribute__
((
aligned
(
8
)));
struct
xt_rateest
*
est2
__attribute__
((
aligned
(
8
)));
};
#endif
/* _XT_RATEEST_MATCH_H */
include/linux/netfilter/xt_realm.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_REALM_H
#define _XT_REALM_H
#include <linux/types.h>
struct
xt_realm_info
{
__u32
id
;
__u32
mask
;
__u8
invert
;
};
#endif
/* _XT_REALM_H */
include/linux/netfilter/xt_recent.h
0 → 100644
View file @
7e95a8db
#ifndef _LINUX_NETFILTER_XT_RECENT_H
#define _LINUX_NETFILTER_XT_RECENT_H 1
#include <linux/types.h>
enum
{
XT_RECENT_CHECK
=
1
<<
0
,
XT_RECENT_SET
=
1
<<
1
,
XT_RECENT_UPDATE
=
1
<<
2
,
XT_RECENT_REMOVE
=
1
<<
3
,
XT_RECENT_TTL
=
1
<<
4
,
XT_RECENT_REAP
=
1
<<
5
,
XT_RECENT_SOURCE
=
0
,
XT_RECENT_DEST
=
1
,
XT_RECENT_NAME_LEN
=
200
,
};
/* Only allowed with --rcheck and --update */
#define XT_RECENT_MODIFIERS (XT_RECENT_TTL|XT_RECENT_REAP)
#define XT_RECENT_VALID_FLAGS (XT_RECENT_CHECK|XT_RECENT_SET|XT_RECENT_UPDATE|\
XT_RECENT_REMOVE|XT_RECENT_TTL|XT_RECENT_REAP)
struct
xt_recent_mtinfo
{
__u32
seconds
;
__u32
hit_count
;
__u8
check_set
;
__u8
invert
;
char
name
[
XT_RECENT_NAME_LEN
];
__u8
side
;
};
struct
xt_recent_mtinfo_v1
{
__u32
seconds
;
__u32
hit_count
;
__u8
check_set
;
__u8
invert
;
char
name
[
XT_RECENT_NAME_LEN
];
__u8
side
;
union
nf_inet_addr
mask
;
};
#endif
/* _LINUX_NETFILTER_XT_RECENT_H */
include/linux/netfilter/xt_rpfilter.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_RPATH_H
#define _XT_RPATH_H
#include <linux/types.h>
enum
{
XT_RPFILTER_LOOSE
=
1
<<
0
,
XT_RPFILTER_VALID_MARK
=
1
<<
1
,
XT_RPFILTER_ACCEPT_LOCAL
=
1
<<
2
,
XT_RPFILTER_INVERT
=
1
<<
3
,
};
struct
xt_rpfilter_info
{
__u8
flags
;
};
#endif
include/linux/netfilter/xt_sctp.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_SCTP_H_
#define _XT_SCTP_H_
#include <linux/types.h>
#define XT_SCTP_SRC_PORTS 0x01
#define XT_SCTP_DEST_PORTS 0x02
#define XT_SCTP_CHUNK_TYPES 0x04
#define XT_SCTP_VALID_FLAGS 0x07
struct
xt_sctp_flag_info
{
__u8
chunktype
;
__u8
flag
;
__u8
flag_mask
;
};
#define XT_NUM_SCTP_FLAGS 4
struct
xt_sctp_info
{
__u16
dpts
[
2
];
/* Min, Max */
__u16
spts
[
2
];
/* Min, Max */
__u32
chunkmap
[
256
/
sizeof
(
__u32
)];
/* Bit mask of chunks to be matched according to RFC 2960 */
#define SCTP_CHUNK_MATCH_ANY 0x01
/* Match if any of the chunk types are present */
#define SCTP_CHUNK_MATCH_ALL 0x02
/* Match if all of the chunk types are present */
#define SCTP_CHUNK_MATCH_ONLY 0x04
/* Match if these are the only chunk types present */
__u32
chunk_match_type
;
struct
xt_sctp_flag_info
flag_info
[
XT_NUM_SCTP_FLAGS
];
int
flag_count
;
__u32
flags
;
__u32
invflags
;
};
#define bytes(type) (sizeof(type) * 8)
#define SCTP_CHUNKMAP_SET(chunkmap, type) \
do { \
(chunkmap)[type / bytes(__u32)] |= \
1 << (type % bytes(__u32)); \
} while (0)
#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
do { \
(chunkmap)[type / bytes(__u32)] &= \
~(1 << (type % bytes(__u32))); \
} while (0)
#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
({ \
((chunkmap)[type / bytes (__u32)] & \
(1 << (type % bytes (__u32)))) ? 1: 0; \
})
#define SCTP_CHUNKMAP_RESET(chunkmap) \
memset((chunkmap), 0, sizeof(chunkmap))
#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
memset((chunkmap), ~0U, sizeof(chunkmap))
#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
memcpy((destmap), (srcmap), sizeof(srcmap))
#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
__sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap))
static
__inline__
bool
__sctp_chunkmap_is_clear
(
const
__u32
*
chunkmap
,
unsigned
int
n
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
n
;
++
i
)
if
(
chunkmap
[
i
])
return
false
;
return
true
;
}
#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
__sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap))
static
__inline__
bool
__sctp_chunkmap_is_all_set
(
const
__u32
*
chunkmap
,
unsigned
int
n
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
n
;
++
i
)
if
(
chunkmap
[
i
]
!=
~
0U
)
return
false
;
return
true
;
}
#endif
/* _XT_SCTP_H_ */
include/linux/netfilter/xt_set.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_SET_H
#define _XT_SET_H
#include <linux/types.h>
#include <linux/netfilter/ipset/ip_set.h>
/* Revision 0 interface: backward compatible with netfilter/iptables */
/*
* Option flags for kernel operations (xt_set_info_v0)
*/
#define IPSET_SRC 0x01
/* Source match/add */
#define IPSET_DST 0x02
/* Destination match/add */
#define IPSET_MATCH_INV 0x04
/* Inverse matching */
struct
xt_set_info_v0
{
ip_set_id_t
index
;
union
{
__u32
flags
[
IPSET_DIM_MAX
+
1
];
struct
{
__u32
__flags
[
IPSET_DIM_MAX
];
__u8
dim
;
__u8
flags
;
}
compat
;
}
u
;
};
/* match and target infos */
struct
xt_set_info_match_v0
{
struct
xt_set_info_v0
match_set
;
};
struct
xt_set_info_target_v0
{
struct
xt_set_info_v0
add_set
;
struct
xt_set_info_v0
del_set
;
};
/* Revision 1 match and target */
struct
xt_set_info
{
ip_set_id_t
index
;
__u8
dim
;
__u8
flags
;
};
/* match and target infos */
struct
xt_set_info_match_v1
{
struct
xt_set_info
match_set
;
};
struct
xt_set_info_target_v1
{
struct
xt_set_info
add_set
;
struct
xt_set_info
del_set
;
};
/* Revision 2 target */
struct
xt_set_info_target_v2
{
struct
xt_set_info
add_set
;
struct
xt_set_info
del_set
;
__u32
flags
;
__u32
timeout
;
};
/* Revision 3 match */
struct
xt_set_info_match_v3
{
struct
xt_set_info
match_set
;
struct
ip_set_counter_match
packets
;
struct
ip_set_counter_match
bytes
;
__u32
flags
;
};
#endif
/*_XT_SET_H*/
include/linux/netfilter/xt_socket.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_SOCKET_H
#define _XT_SOCKET_H
#include <linux/types.h>
enum
{
XT_SOCKET_TRANSPARENT
=
1
<<
0
,
XT_SOCKET_NOWILDCARD
=
1
<<
1
,
};
struct
xt_socket_mtinfo1
{
__u8
flags
;
};
#define XT_SOCKET_FLAGS_V1 XT_SOCKET_TRANSPARENT
struct
xt_socket_mtinfo2
{
__u8
flags
;
};
#define XT_SOCKET_FLAGS_V2 (XT_SOCKET_TRANSPARENT | XT_SOCKET_NOWILDCARD)
#endif
/* _XT_SOCKET_H */
include/linux/netfilter/xt_state.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_STATE_H
#define _XT_STATE_H
#define XT_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
#define XT_STATE_INVALID (1 << 0)
#define XT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1))
struct
xt_state_info
{
unsigned
int
statemask
;
};
#endif
/*_XT_STATE_H*/
include/linux/netfilter/xt_statistic.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_STATISTIC_H
#define _XT_STATISTIC_H
#include <linux/types.h>
enum
xt_statistic_mode
{
XT_STATISTIC_MODE_RANDOM
,
XT_STATISTIC_MODE_NTH
,
__XT_STATISTIC_MODE_MAX
};
#define XT_STATISTIC_MODE_MAX (__XT_STATISTIC_MODE_MAX - 1)
enum
xt_statistic_flags
{
XT_STATISTIC_INVERT
=
0x1
,
};
#define XT_STATISTIC_MASK 0x1
struct
xt_statistic_priv
;
struct
xt_statistic_info
{
__u16
mode
;
__u16
flags
;
union
{
struct
{
__u32
probability
;
}
random
;
struct
{
__u32
every
;
__u32
packet
;
__u32
count
;
/* unused */
}
nth
;
}
u
;
struct
xt_statistic_priv
*
master
__attribute__
((
aligned
(
8
)));
};
#endif
/* _XT_STATISTIC_H */
include/linux/netfilter/xt_string.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_STRING_H
#define _XT_STRING_H
#include <linux/types.h>
#define XT_STRING_MAX_PATTERN_SIZE 128
#define XT_STRING_MAX_ALGO_NAME_SIZE 16
enum
{
XT_STRING_FLAG_INVERT
=
0x01
,
XT_STRING_FLAG_IGNORECASE
=
0x02
};
struct
xt_string_info
{
__u16
from_offset
;
__u16
to_offset
;
char
algo
[
XT_STRING_MAX_ALGO_NAME_SIZE
];
char
pattern
[
XT_STRING_MAX_PATTERN_SIZE
];
__u8
patlen
;
union
{
struct
{
__u8
invert
;
}
v0
;
struct
{
__u8
flags
;
}
v1
;
}
u
;
/* Used internally by the kernel */
struct
ts_config
__attribute__
((
aligned
(
8
)))
*
config
;
};
#endif
/*_XT_STRING_H*/
include/linux/netfilter/xt_tcpmss.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_TCPMSS_MATCH_H
#define _XT_TCPMSS_MATCH_H
#include <linux/types.h>
struct
xt_tcpmss_match_info
{
__u16
mss_min
,
mss_max
;
__u8
invert
;
};
#endif
/*_XT_TCPMSS_MATCH_H*/
include/linux/netfilter/xt_tcpudp.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_TCPUDP_H
#define _XT_TCPUDP_H
#include <linux/types.h>
/* TCP matching stuff */
struct
xt_tcp
{
__u16
spts
[
2
];
/* Source port range. */
__u16
dpts
[
2
];
/* Destination port range. */
__u8
option
;
/* TCP Option iff non-zero*/
__u8
flg_mask
;
/* TCP flags mask byte */
__u8
flg_cmp
;
/* TCP flags compare byte */
__u8
invflags
;
/* Inverse flags */
};
/* Values for "inv" field in struct ipt_tcp. */
#define XT_TCP_INV_SRCPT 0x01
/* Invert the sense of source ports. */
#define XT_TCP_INV_DSTPT 0x02
/* Invert the sense of dest ports. */
#define XT_TCP_INV_FLAGS 0x04
/* Invert the sense of TCP flags. */
#define XT_TCP_INV_OPTION 0x08
/* Invert the sense of option test. */
#define XT_TCP_INV_MASK 0x0F
/* All possible flags. */
/* UDP matching stuff */
struct
xt_udp
{
__u16
spts
[
2
];
/* Source port range. */
__u16
dpts
[
2
];
/* Destination port range. */
__u8
invflags
;
/* Inverse flags */
};
/* Values for "invflags" field in struct ipt_udp. */
#define XT_UDP_INV_SRCPT 0x01
/* Invert the sense of source ports. */
#define XT_UDP_INV_DSTPT 0x02
/* Invert the sense of dest ports. */
#define XT_UDP_INV_MASK 0x03
/* All possible flags. */
#endif
include/linux/netfilter/xt_time.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_TIME_H
#define _XT_TIME_H 1
#include <linux/types.h>
struct
xt_time_info
{
__u32
date_start
;
__u32
date_stop
;
__u32
daytime_start
;
__u32
daytime_stop
;
__u32
monthdays_match
;
__u8
weekdays_match
;
__u8
flags
;
};
enum
{
/* Match against local time (instead of UTC) */
XT_TIME_LOCAL_TZ
=
1
<<
0
,
XT_TIME_CONTIGUOUS
=
1
<<
1
,
/* Shortcuts */
XT_TIME_ALL_MONTHDAYS
=
0xFFFFFFFE
,
XT_TIME_ALL_WEEKDAYS
=
0xFE
,
XT_TIME_MIN_DAYTIME
=
0
,
XT_TIME_MAX_DAYTIME
=
24
*
60
*
60
-
1
,
};
#endif
/* _XT_TIME_H */
include/linux/netfilter/xt_u32.h
0 → 100644
View file @
7e95a8db
#ifndef _XT_U32_H
#define _XT_U32_H 1
#include <linux/types.h>
enum
xt_u32_ops
{
XT_U32_AND
,
XT_U32_LEFTSH
,
XT_U32_RIGHTSH
,
XT_U32_AT
,
};
struct
xt_u32_location_element
{
__u32
number
;
__u8
nextop
;
};
struct
xt_u32_value_element
{
__u32
min
;
__u32
max
;
};
/*
* Any way to allow for an arbitrary number of elements?
* For now, I settle with a limit of 10 each.
*/
#define XT_U32_MAXSIZE 10
struct
xt_u32_test
{
struct
xt_u32_location_element
location
[
XT_U32_MAXSIZE
+
1
];
struct
xt_u32_value_element
value
[
XT_U32_MAXSIZE
+
1
];
__u8
nnums
;
__u8
nvalues
;
};
struct
xt_u32
{
struct
xt_u32_test
tests
[
XT_U32_MAXSIZE
+
1
];
__u8
ntests
;
__u8
invert
;
};
#endif
/* _XT_U32_H */
include/linux/netfilter_ipv4.h
0 → 100644
View file @
7e95a8db
#ifndef __LINUX_IP_NETFILTER_H
#define __LINUX_IP_NETFILTER_H
/* IPv4-specific defines for netfilter.
* (C)1998 Rusty Russell -- This code is GPL.
*/
#include <linux/netfilter.h>
/* only for userspace compatibility */
/* IP Cache bits. */
/* Src IP address. */
#define NFC_IP_SRC 0x0001
/* Dest IP address. */
#define NFC_IP_DST 0x0002
/* Input device. */
#define NFC_IP_IF_IN 0x0004
/* Output device. */
#define NFC_IP_IF_OUT 0x0008
/* TOS. */
#define NFC_IP_TOS 0x0010
/* Protocol. */
#define NFC_IP_PROTO 0x0020
/* IP options. */
#define NFC_IP_OPTIONS 0x0040
/* Frag & flags. */
#define NFC_IP_FRAG 0x0080
/* Per-protocol information: only matters if proto match. */
/* TCP flags. */
#define NFC_IP_TCPFLAGS 0x0100
/* Source port. */
#define NFC_IP_SRC_PT 0x0200
/* Dest port. */
#define NFC_IP_DST_PT 0x0400
/* Something else about the proto */
#define NFC_IP_PROTO_UNKNOWN 0x2000
/* IP Hooks */
/* After promisc drops, checksum checks. */
#define NF_IP_PRE_ROUTING 0
/* If the packet is destined for this box. */
#define NF_IP_LOCAL_IN 1
/* If the packet is destined for another interface. */
#define NF_IP_FORWARD 2
/* Packets coming from a local process. */
#define NF_IP_LOCAL_OUT 3
/* Packets about to hit the wire. */
#define NF_IP_POST_ROUTING 4
#define NF_IP_NUMHOOKS 5
enum
nf_ip_hook_priorities
{
NF_IP_PRI_FIRST
=
INT_MIN
,
NF_IP_PRI_CONNTRACK_DEFRAG
=
-
400
,
NF_IP_PRI_RAW
=
-
300
,
NF_IP_PRI_SELINUX_FIRST
=
-
225
,
NF_IP_PRI_CONNTRACK
=
-
200
,
NF_IP_PRI_MANGLE
=
-
150
,
NF_IP_PRI_NAT_DST
=
-
100
,
NF_IP_PRI_FILTER
=
0
,
NF_IP_PRI_SECURITY
=
50
,
NF_IP_PRI_NAT_SRC
=
100
,
NF_IP_PRI_SELINUX_LAST
=
225
,
NF_IP_PRI_CONNTRACK_CONFIRM
=
INT_MAX
,
NF_IP_PRI_LAST
=
INT_MAX
,
};
/* Arguments for setsockopt SOL_IP: */
/* 2.0 firewalling went from 64 through 71 (and +256, +512, etc). */
/* 2.2 firewalling (+ masq) went from 64 through 76 */
/* 2.4 firewalling went 64 through 67. */
#define SO_ORIGINAL_DST 80
#endif
/*__LINUX_IP_NETFILTER_H*/
include/linux/netfilter_ipv4/ip_queue.h
0 → 100644
View file @
7e95a8db
/*
* This is a module which is used for queueing IPv4 packets and
* communicating with userspace via netlink.
*
* (C) 2000 James Morris, this code is GPL.
*/
#ifndef _IP_QUEUE_H
#define _IP_QUEUE_H
#ifdef __KERNEL__
#ifdef DEBUG_IPQ
#define QDEBUG(x...) printk(KERN_DEBUG ## x)
#else
#define QDEBUG(x...)
#endif
/* DEBUG_IPQ */
#else
#include <net/if.h>
#endif
/* ! __KERNEL__ */
/* Messages sent from kernel */
typedef
struct
ipq_packet_msg
{
unsigned
long
packet_id
;
/* ID of queued packet */
unsigned
long
mark
;
/* Netfilter mark value */
long
timestamp_sec
;
/* Packet arrival time (seconds) */
long
timestamp_usec
;
/* Packet arrvial time (+useconds) */
unsigned
int
hook
;
/* Netfilter hook we rode in on */
char
indev_name
[
IFNAMSIZ
];
/* Name of incoming interface */
char
outdev_name
[
IFNAMSIZ
];
/* Name of outgoing interface */
__be16
hw_protocol
;
/* Hardware protocol (network order) */
unsigned
short
hw_type
;
/* Hardware type */
unsigned
char
hw_addrlen
;
/* Hardware address length */
unsigned
char
hw_addr
[
8
];
/* Hardware address */
size_t
data_len
;
/* Length of packet data */
unsigned
char
payload
[
0
];
/* Optional packet data */
}
ipq_packet_msg_t
;
/* Messages sent from userspace */
typedef
struct
ipq_mode_msg
{
unsigned
char
value
;
/* Requested mode */
size_t
range
;
/* Optional range of packet requested */
}
ipq_mode_msg_t
;
typedef
struct
ipq_verdict_msg
{
unsigned
int
value
;
/* Verdict to hand to netfilter */
unsigned
long
id
;
/* Packet ID for this verdict */
size_t
data_len
;
/* Length of replacement data */
unsigned
char
payload
[
0
];
/* Optional replacement packet */
}
ipq_verdict_msg_t
;
typedef
struct
ipq_peer_msg
{
union
{
ipq_verdict_msg_t
verdict
;
ipq_mode_msg_t
mode
;
}
msg
;
}
ipq_peer_msg_t
;
/* Packet delivery modes */
enum
{
IPQ_COPY_NONE
,
/* Initial mode, packets are dropped */
IPQ_COPY_META
,
/* Copy metadata */
IPQ_COPY_PACKET
/* Copy metadata + packet (range) */
};
#define IPQ_COPY_MAX IPQ_COPY_PACKET
/* Types of messages */
#define IPQM_BASE 0x10
/* standard netlink messages below this */
#define IPQM_MODE (IPQM_BASE + 1)
/* Mode request from peer */
#define IPQM_VERDICT (IPQM_BASE + 2)
/* Verdict from peer */
#define IPQM_PACKET (IPQM_BASE + 3)
/* Packet from kernel */
#define IPQM_MAX (IPQM_BASE + 4)
#endif
/*_IP_QUEUE_H*/
include/linux/netfilter_ipv4/ip_tables.h
0 → 100644
View file @
7e95a8db
/*
* 25-Jul-1998 Major changes to allow for ip chain table
*
* 3-Jan-2000 Named tables to allow packet selection for different uses.
*/
/*
* Format of an IP firewall descriptor
*
* src, dst, src_mask, dst_mask are always stored in network byte order.
* flags are stored in host byte order (of course).
* Port numbers are stored in HOST byte order.
*/
#ifndef _IPTABLES_H
#define _IPTABLES_H
#include <linux/types.h>
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter/x_tables.h>
#define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
#define IPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
#define ipt_match xt_match
#define ipt_target xt_target
#define ipt_table xt_table
#define ipt_get_revision xt_get_revision
#define ipt_entry_match xt_entry_match
#define ipt_entry_target xt_entry_target
#define ipt_standard_target xt_standard_target
#define ipt_error_target xt_error_target
#define ipt_counters xt_counters
#define IPT_CONTINUE XT_CONTINUE
#define IPT_RETURN XT_RETURN
/* This group is older than old (iptables < v1.4.0-rc1~89) */
#include <linux/netfilter/xt_tcpudp.h>
#define ipt_udp xt_udp
#define ipt_tcp xt_tcp
#define IPT_TCP_INV_SRCPT XT_TCP_INV_SRCPT
#define IPT_TCP_INV_DSTPT XT_TCP_INV_DSTPT
#define IPT_TCP_INV_FLAGS XT_TCP_INV_FLAGS
#define IPT_TCP_INV_OPTION XT_TCP_INV_OPTION
#define IPT_TCP_INV_MASK XT_TCP_INV_MASK
#define IPT_UDP_INV_SRCPT XT_UDP_INV_SRCPT
#define IPT_UDP_INV_DSTPT XT_UDP_INV_DSTPT
#define IPT_UDP_INV_MASK XT_UDP_INV_MASK
/* The argument to IPT_SO_ADD_COUNTERS. */
#define ipt_counters_info xt_counters_info
/* Standard return verdict, or do jump. */
#define IPT_STANDARD_TARGET XT_STANDARD_TARGET
/* Error verdict. */
#define IPT_ERROR_TARGET XT_ERROR_TARGET
/* fn returns 0 to continue iteration */
#define IPT_MATCH_ITERATE(e, fn, args...) \
XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args)
/* fn returns 0 to continue iteration */
#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \
XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args)
/* Yes, Virginia, you have to zero the padding. */
struct
ipt_ip
{
/* Source and destination IP addr */
struct
in_addr
src
,
dst
;
/* Mask for src and dest IP addr */
struct
in_addr
smsk
,
dmsk
;
char
iniface
[
IFNAMSIZ
],
outiface
[
IFNAMSIZ
];
unsigned
char
iniface_mask
[
IFNAMSIZ
],
outiface_mask
[
IFNAMSIZ
];
/* Protocol, 0 = ANY */
u_int16_t
proto
;
/* Flags word */
u_int8_t
flags
;
/* Inverse flags */
u_int8_t
invflags
;
};
/* Values for "flag" field in struct ipt_ip (general ip structure). */
#define IPT_F_FRAG 0x01
/* Set if rule is a fragment rule */
#define IPT_F_GOTO 0x02
/* Set if jump is a goto */
#define IPT_F_MASK 0x03
/* All possible flag bits mask. */
/* Values for "inv" field in struct ipt_ip. */
#define IPT_INV_VIA_IN 0x01
/* Invert the sense of IN IFACE. */
#define IPT_INV_VIA_OUT 0x02
/* Invert the sense of OUT IFACE */
#define IPT_INV_TOS 0x04
/* Invert the sense of TOS. */
#define IPT_INV_SRCIP 0x08
/* Invert the sense of SRC IP. */
#define IPT_INV_DSTIP 0x10
/* Invert the sense of DST OP. */
#define IPT_INV_FRAG 0x20
/* Invert the sense of FRAG. */
#define IPT_INV_PROTO XT_INV_PROTO
#define IPT_INV_MASK 0x7F
/* All possible flag bits mask. */
/* This structure defines each of the firewall rules. Consists of 3
parts which are 1) general IP header stuff 2) match specific
stuff 3) the target to perform if the rule matches */
struct
ipt_entry
{
struct
ipt_ip
ip
;
/* Mark with fields that we care about. */
unsigned
int
nfcache
;
/* Size of ipt_entry + matches */
u_int16_t
target_offset
;
/* Size of ipt_entry + matches + target */
u_int16_t
next_offset
;
/* Back pointer */
unsigned
int
comefrom
;
/* Packet and byte counters. */
struct
xt_counters
counters
;
/* The matches (if any), then the target. */
unsigned
char
elems
[
0
];
};
/*
* New IP firewall options for [gs]etsockopt at the RAW IP level.
* Unlike BSD Linux inherits IP options so you don't have to use a raw
* socket for this. Instead we check rights in the calls.
*
* ATTENTION: check linux/in.h before adding new number here.
*/
#define IPT_BASE_CTL 64
#define IPT_SO_SET_REPLACE (IPT_BASE_CTL)
#define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1)
#define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS
#define IPT_SO_GET_INFO (IPT_BASE_CTL)
#define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1)
#define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2)
#define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3)
#define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET
/* ICMP matching stuff */
struct
ipt_icmp
{
u_int8_t
type
;
/* type to match */
u_int8_t
code
[
2
];
/* range of code */
u_int8_t
invflags
;
/* Inverse flags */
};
/* Values for "inv" field for struct ipt_icmp. */
#define IPT_ICMP_INV 0x01
/* Invert the sense of type/code test */
/* The argument to IPT_SO_GET_INFO */
struct
ipt_getinfo
{
/* Which table: caller fills this in. */
char
name
[
XT_TABLE_MAXNAMELEN
];
/* Kernel fills these in. */
/* Which hook entry points are valid: bitmask */
unsigned
int
valid_hooks
;
/* Hook entry points: one per netfilter hook. */
unsigned
int
hook_entry
[
NF_INET_NUMHOOKS
];
/* Underflow points. */
unsigned
int
underflow
[
NF_INET_NUMHOOKS
];
/* Number of entries */
unsigned
int
num_entries
;
/* Size of entries. */
unsigned
int
size
;
};
/* The argument to IPT_SO_SET_REPLACE. */
struct
ipt_replace
{
/* Which table. */
char
name
[
XT_TABLE_MAXNAMELEN
];
/* Which hook entry points are valid: bitmask. You can't
change this. */
unsigned
int
valid_hooks
;
/* Number of entries */
unsigned
int
num_entries
;
/* Total size of new entries */
unsigned
int
size
;
/* Hook entry points. */
unsigned
int
hook_entry
[
NF_INET_NUMHOOKS
];
/* Underflow points. */
unsigned
int
underflow
[
NF_INET_NUMHOOKS
];
/* Information about old entries: */
/* Number of counters (must be equal to current number of entries). */
unsigned
int
num_counters
;
/* The old entries' counters. */
struct
xt_counters
*
counters
;
/* The entries (hang off end: not really an array). */
struct
ipt_entry
entries
[
0
];
};
/* The argument to IPT_SO_GET_ENTRIES. */
struct
ipt_get_entries
{
/* Which table: user fills this in. */
char
name
[
XT_TABLE_MAXNAMELEN
];
/* User fills this in: total entry size. */
unsigned
int
size
;
/* The entries. */
struct
ipt_entry
entrytable
[
0
];
};
/* Helper functions */
static
__inline__
struct
xt_entry_target
*
ipt_get_target
(
struct
ipt_entry
*
e
)
{
return
(
void
*
)
e
+
e
->
target_offset
;
}
/*
* Main firewall chains definitions and global var's definitions.
*/
#endif
/* _IPTABLES_H */
Prev
1
…
12
13
14
15
16
17
18
19
20
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment