1 /* SPDX-License-Identifier: LGPL-2.1-only */ 2 /* 3 * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> 4 * Copyright (c) 2013 Sassano Systems LLC <joe@sassanosystems.com> 5 */ 6 7 #ifndef __LIB_NETFILTER_NL_NETFILTER_H__ 8 #define __LIB_NETFILTER_NL_NETFILTER_H__ 9 10 #include <netlink/netfilter/ct.h> 11 12 #include "nl-priv-dynamic-core/object-api.h" 13 14 union nfnl_ct_proto { 15 struct { 16 uint16_t src; 17 uint16_t dst; 18 } port; 19 struct { 20 uint16_t id; 21 uint8_t type; 22 uint8_t code; 23 } icmp; 24 }; 25 26 struct nfnl_ct_dir { 27 struct nl_addr *src; 28 struct nl_addr *dst; 29 union nfnl_ct_proto proto; 30 uint64_t packets; 31 uint64_t bytes; 32 }; 33 34 union nfnl_ct_protoinfo { 35 struct { 36 uint8_t state; 37 } tcp; 38 }; 39 40 struct nfnl_ct { 41 NLHDR_COMMON 42 43 uint8_t ct_family; 44 uint8_t ct_proto; 45 union nfnl_ct_protoinfo ct_protoinfo; 46 47 uint32_t ct_status; 48 uint32_t ct_status_mask; 49 uint32_t ct_timeout; 50 uint32_t ct_mark; 51 uint32_t ct_use; 52 uint32_t ct_id; 53 uint16_t ct_zone; 54 55 struct nfnl_ct_dir ct_orig; 56 struct nfnl_ct_dir ct_repl; 57 58 struct nfnl_ct_timestamp ct_tstamp; 59 }; 60 61 union nfnl_exp_protodata { 62 struct { 63 uint16_t src; 64 uint16_t dst; 65 } port; 66 struct { 67 uint16_t id; 68 uint8_t type; 69 uint8_t code; 70 } icmp; 71 }; 72 73 // Allow for different master/expect l4 protocols 74 struct nfnl_exp_proto { 75 uint8_t l4protonum; 76 union nfnl_exp_protodata l4protodata; 77 }; 78 79 struct nfnl_exp_dir { 80 struct nl_addr *src; 81 struct nl_addr *dst; 82 struct nfnl_exp_proto proto; 83 }; 84 85 struct nfnl_exp { 86 NLHDR_COMMON 87 88 uint8_t exp_family; 89 uint32_t exp_timeout; 90 uint32_t exp_id; 91 uint16_t exp_zone; 92 uint32_t exp_class; 93 uint32_t exp_flags; 94 char *exp_helper_name; 95 char *exp_fn; 96 uint8_t exp_nat_dir; 97 98 struct nfnl_exp_dir exp_expect; 99 struct nfnl_exp_dir exp_master; 100 struct nfnl_exp_dir exp_mask; 101 struct nfnl_exp_dir exp_nat; 102 }; 103 104 struct nfnl_log_msg { 105 NLHDR_COMMON 106 107 uint8_t log_msg_family; 108 uint8_t log_msg_hook; 109 uint16_t log_msg_hwproto; 110 uint32_t log_msg_mark; 111 struct timeval log_msg_timestamp; 112 uint32_t log_msg_indev; 113 uint32_t log_msg_outdev; 114 uint32_t log_msg_physindev; 115 uint32_t log_msg_physoutdev; 116 uint8_t log_msg_hwaddr[8]; 117 int log_msg_hwaddr_len; 118 void *log_msg_payload; 119 int log_msg_payload_len; 120 char *log_msg_prefix; 121 uint32_t log_msg_uid; 122 uint32_t log_msg_gid; 123 uint32_t log_msg_seq; 124 uint32_t log_msg_seq_global; 125 uint16_t log_msg_hwtype; 126 uint16_t log_msg_hwlen; 127 void *log_msg_hwheader; 128 int log_msg_hwheader_len; 129 uint16_t log_msg_vlan_tag; 130 uint16_t log_msg_vlan_proto; 131 uint32_t log_msg_ct_info; 132 struct nfnl_ct *log_msg_ct; 133 }; 134 135 struct nfnl_queue_msg { 136 NLHDR_COMMON 137 138 uint16_t queue_msg_group; 139 uint8_t queue_msg_family; 140 uint8_t queue_msg_hook; 141 uint16_t queue_msg_hwproto; 142 uint32_t queue_msg_packetid; 143 uint32_t queue_msg_mark; 144 struct timeval queue_msg_timestamp; 145 uint32_t queue_msg_indev; 146 uint32_t queue_msg_outdev; 147 uint32_t queue_msg_physindev; 148 uint32_t queue_msg_physoutdev; 149 uint8_t queue_msg_hwaddr[8]; 150 int queue_msg_hwaddr_len; 151 void *queue_msg_payload; 152 int queue_msg_payload_len; 153 uint32_t queue_msg_verdict; 154 }; 155 156 #endif /* __LIB_NETFILTER_NL_NETFILTER_H__*/ 157