2 * fwd - OpenWrt firewall daemon - data structures
4 * Copyright (C) 2009 Jo-Philipp Wich <xm@subsignal.org>
6 * The fwd program is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
10 * The fwd program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with the fwd program. If not, see http://www.gnu.org/licenses/.
29 #include <netinet/in.h>
57 struct fwd_portrange {
86 struct fwd_cidr *addr;
87 struct fwd_network *next;
91 enum fwd_policy input;
92 enum fwd_policy forward;
93 enum fwd_policy output;
102 struct fwd_network *networks;
103 struct fwd_data *forwardings;
104 struct fwd_data *redirects;
105 struct fwd_data *rules;
106 enum fwd_policy input;
107 enum fwd_policy forward;
108 enum fwd_policy output;
114 struct fwd_forwarding {
115 struct fwd_zone *src;
116 struct fwd_zone *dest;
117 int mtu_fix; /* legacy */
121 struct fwd_redirect {
122 struct fwd_zone *src;
123 struct fwd_cidr *src_ip;
124 struct fwd_mac *src_mac;
125 struct fwd_portrange *src_port;
126 struct fwd_portrange *src_dport;
127 struct fwd_cidr *dest_ip;
128 struct fwd_portrange *dest_port;
129 struct fwd_proto *proto;
130 int clone; /* true if rule is cloned (tcpudp -> tcp + udp) */
134 struct fwd_zone *src;
135 struct fwd_zone *dest;
136 struct fwd_cidr *src_ip;
137 struct fwd_mac *src_mac;
138 struct fwd_portrange *src_port;
139 struct fwd_cidr *dest_ip;
140 struct fwd_portrange *dest_port;
141 struct fwd_proto *proto;
142 struct fwd_icmptype *icmp_type;
143 enum fwd_policy target;
144 int clone; /* true if rule is cloned (tcpudp -> tcp + udp) */
153 struct fwd_data *next;
155 struct fwd_defaults defaults;
156 struct fwd_zone zone;
157 struct fwd_forwarding forwarding;
158 struct fwd_redirect redirect;
159 struct fwd_rule rule;
160 struct fwd_include include;
168 struct fwd_data *conf;
172 /* fwd_fatal(fmt, ...)
173 * Prints message to stderr and termintes program. */
174 #define fwd_fatal(...) do { \
175 fprintf(stderr, "ERROR: "); \
176 fprintf(stderr, __VA_ARGS__); \
177 fprintf(stderr, "\n"); \