summaryrefslogtreecommitdiff
path: root/src/firewall.c
AgeCommit message (Collapse)AuthorFilesLines
2014-07-17Imported Upstream version 1.24upstream/1.24Zhang zhengguang1-9/+28
2013-03-25firewall: Maintain iptables rules in dedicated ConnMan chainsDaniel Wagner1-6/+174
Instead appending ConnMan iptables rules into the builtin chains we append them into chains managed by ConnMan. If a rule needs to be inserted into a bultin chain, ConnMan will create a 'connman-' prefixed builtin chain name and appends the user rules there. Then ConnMan will insert a unconditional jump rule in the builtin chain. Basically, iptables -t filter -A INPUT -m mark --mark 1 -j LOG will be translated to this: iptables -t filter -N connman-INPUT iptables -t filter -A connman-INPUT -m mark --mark 1 -j LOG iptables -t filter -I INPUT -j connman-INPUT When the last rule in a managed chain is removed, the managed chain will also be removed.
2013-03-25firewall: Add firewall APIDaniel Wagner1-0/+128
The main idea behind this API is to collect several iptables rules together and enable or disable in one go. For this a context is created via __connman_firewall_create() and the rules added to this context via __connman_firewall_add_rule(). In order to append all rules __connman_firewall_enable() has to be called. To remove all rules associated with one context __connman_firewall_disable() has to be used. If something goes awry the code tries to get back to the initial state.
2013-03-25firewall: Flush managed chainsDaniel Wagner1-0/+107
ConnMan maintains its own chain per builtin chain. The managed chain have a prefix 'connman-' and one rule in the corresponding builtin chain which jumps uncoditional to the managed chain. In case ConnMan crashed we need to cleanup first.
2013-03-25firewall: Add firewall fileDaniel Wagner1-0/+38