1 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ 2 /* Header file for kernel module to match connection tracking information. 3 * GPL (C) 2001 Marc Boucher (marc@mbsi.ca). 4 */ 5 6 #ifndef _XT_CONNTRACK_H 7 #define _XT_CONNTRACK_H 8 9 #include <linux/types.h> 10 #include <linux/netfilter.h> 11 #include <linux/netfilter/nf_conntrack_tuple_common.h> 12 13 #define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) 14 #define XT_CONNTRACK_STATE_INVALID (1 << 0) 15 16 #define XT_CONNTRACK_STATE_SNAT (1 << (IP_CT_NUMBER + 1)) 17 #define XT_CONNTRACK_STATE_DNAT (1 << (IP_CT_NUMBER + 2)) 18 #define XT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3)) 19 20 /* flags, invflags: */ 21 enum { 22 XT_CONNTRACK_STATE = 1 << 0, 23 XT_CONNTRACK_PROTO = 1 << 1, 24 XT_CONNTRACK_ORIGSRC = 1 << 2, 25 XT_CONNTRACK_ORIGDST = 1 << 3, 26 XT_CONNTRACK_REPLSRC = 1 << 4, 27 XT_CONNTRACK_REPLDST = 1 << 5, 28 XT_CONNTRACK_STATUS = 1 << 6, 29 XT_CONNTRACK_EXPIRES = 1 << 7, 30 XT_CONNTRACK_ORIGSRC_PORT = 1 << 8, 31 XT_CONNTRACK_ORIGDST_PORT = 1 << 9, 32 XT_CONNTRACK_REPLSRC_PORT = 1 << 10, 33 XT_CONNTRACK_REPLDST_PORT = 1 << 11, 34 XT_CONNTRACK_DIRECTION = 1 << 12, 35 XT_CONNTRACK_STATE_ALIAS = 1 << 13, 36 }; 37 38 struct xt_conntrack_mtinfo1 { 39 union nf_inet_addr origsrc_addr, origsrc_mask; 40 union nf_inet_addr origdst_addr, origdst_mask; 41 union nf_inet_addr replsrc_addr, replsrc_mask; 42 union nf_inet_addr repldst_addr, repldst_mask; 43 __u32 expires_min, expires_max; 44 __u16 l4proto; 45 __be16 origsrc_port, origdst_port; 46 __be16 replsrc_port, repldst_port; 47 __u16 match_flags, invert_flags; 48 __u8 state_mask, status_mask; 49 }; 50 51 struct xt_conntrack_mtinfo2 { 52 union nf_inet_addr origsrc_addr, origsrc_mask; 53 union nf_inet_addr origdst_addr, origdst_mask; 54 union nf_inet_addr replsrc_addr, replsrc_mask; 55 union nf_inet_addr repldst_addr, repldst_mask; 56 __u32 expires_min, expires_max; 57 __u16 l4proto; 58 __be16 origsrc_port, origdst_port; 59 __be16 replsrc_port, repldst_port; 60 __u16 match_flags, invert_flags; 61 __u16 state_mask, status_mask; 62 }; 63 64 struct xt_conntrack_mtinfo3 { 65 union nf_inet_addr origsrc_addr, origsrc_mask; 66 union nf_inet_addr origdst_addr, origdst_mask; 67 union nf_inet_addr replsrc_addr, replsrc_mask; 68 union nf_inet_addr repldst_addr, repldst_mask; 69 __u32 expires_min, expires_max; 70 __u16 l4proto; 71 __u16 origsrc_port, origdst_port; 72 __u16 replsrc_port, repldst_port; 73 __u16 match_flags, invert_flags; 74 __u16 state_mask, status_mask; 75 __u16 origsrc_port_high, origdst_port_high; 76 __u16 replsrc_port_high, repldst_port_high; 77 }; 78 79 #endif /*_XT_CONNTRACK_H*/ 80