SHOW:
|
|
- or go back to the newest paste.
1 | - | iff --git a/rules.c b/rules.c |
1 | + | diff --git a/rules.c b/rules.c |
2 | - | index 181c6b1..969c385 100644 |
2 | + | index 181c6b1..6dcdcef 100644 |
3 | --- a/rules.c | |
4 | +++ b/rules.c | |
5 | - | @@ -420,6 +420,7 @@ print_rule(struct fw3_ipt_handle *handle, struct fw3_state *state, |
5 | + | @@ -420,6 +420,9 @@ print_rule(struct fw3_ipt_handle *handle, struct fw3_state *state, |
6 | struct fw3_mac *mac, struct fw3_icmptype *icmptype) | |
7 | { | |
8 | struct fw3_ipt_rule *r; | |
9 | + struct fw3_device *idev, *odev; | |
10 | + struct list_head empty; | |
11 | + INIT_LIST_HEAD(&empty); | |
12 | ||
13 | - | @@ -471,6 +472,36 @@ print_rule(struct fw3_ipt_handle *handle, struct fw3_state *state, |
13 | + | |
14 | !fw3_is_family(dip, handle->family)) | |
15 | @@ -471,6 +474,36 @@ print_rule(struct fw3_ipt_handle *handle, struct fw3_state *state, | |
16 | return; | |
17 | } | |
18 | - | + fw3_foreach(idev, &rule->_src->devices) |
18 | + | |
19 | - | + fw3_foreach(odev, &rule->_dest->devices) |
19 | + | |
20 | + fw3_foreach(idev, rule->_src ? &rule->_src->devices : &empty) | |
21 | + fw3_foreach(odev, rule->_dest ? &rule->_dest->devices : &empty) | |
22 | + { | |
23 | + r = fw3_ipt_rule_create(handle, proto, idev, odev, sip, dip); | |
24 | + fw3_ipt_rule_sport_dport(r, sport, dport); | |
25 | + fw3_ipt_rule_device(r, rule->device, rule->direction_out); | |
26 | + fw3_ipt_rule_icmptype(r, icmptype); | |
27 | + fw3_ipt_rule_mac(r, mac); | |
28 | + fw3_ipt_rule_ipset(r, &rule->ipset); | |
29 | + fw3_ipt_rule_helper(r, &rule->helper); | |
30 | + fw3_ipt_rule_limit(r, &rule->limit); | |
31 | + fw3_ipt_rule_time(r, &rule->time); | |
32 | + fw3_ipt_rule_mark(r, &rule->mark); | |
33 | + fw3_ipt_rule_dscp(r, &rule->dscp); | |
34 | + set_target(r, rule); | |
35 | + fw3_ipt_rule_extra(r, rule->extra); | |
36 | - | + if (idev && odev) |
36 | + | |
37 | + | |
38 | - | + else if (odev) |
38 | + | + if ((rule->src.any || rule->_src) && (rule->dest.any || rule->_dest)) |
39 | + fw3_ipt_rule_append(r, "FORWARD"); | |
40 | - | + else /* if (idev) */ |
40 | + | + else if (rule->dest.any || rule->_dest) |
41 | + fw3_ipt_rule_append(r, "POSTROUTING"); | |
42 | + else /* if (rule->src.any || rule->_src) */ | |
43 | + fw3_ipt_rule_append(r, "PREROUTING"); | |
44 | + } | |
45 | + | |
46 | + return; | |
47 | + } | |
48 | + | |
49 | r = fw3_ipt_rule_create(handle, proto, NULL, NULL, sip, dip); | |
50 | fw3_ipt_rule_sport_dport(r, sport, dport); | |
51 | fw3_ipt_rule_device(r, rule->device, rule->direction_out); | |
52 |