iptables: Introduce IPv6 iptables management.
This commit adds iptables management for IPv6 addresses. Existing src/iptables.c is used as base and the functionality to support IPv6 iptables is included into existing code for the most part. Managing iptables using IPv6 addresses does not differ much from IPv4 use, only new structures of setting/getting rules have to be adapted into use. For each existing __connman_iptables_*() a type variable (int) has been added to indicate which address family (AF_INET/AF_INET6) is to be used. Functionality remains the same as with iptables.c, only the function parse_ipv6_and_mask() is rewritten comply with IPv6 address structures. Functions is_same_ipt_entry() and iptables_blob() are copied to use ip6t_* type structures. The internal structures connman_iptables_entry and connman_iptables were amended to include the iptables IPv6 structures and the address family type. In order to avoid copying of large amounts of existing code and to be able to use both IPv4 and IPv6 structures many existing functions are changed from using struct ipt_entry/ipt_ip/ipt_replace into using structures that contain pointers to both IPv4 and IPv6 structures. Two new structures are introduced to act as containers for the IPv4 and IPv6 types of iptables structures: - struct iptables_ip contains ipt_ip and ip6t_ip + type - struct iptables_replace contains ipt_replace and ip6t_replace + type - struct connman_iptables_entry is used as container for ipt_entry and ip6t_entry Helper functions for getting content from struct connman_iptables were added to keep the code cleaner. Similarly for the struct iptables_replace helper functions were added. Helper functions were also added for getting content out of connman_iptables_entry struct. In order to operate both IPv4 and IPv6 iptables the initialization has to be done before each operation is executed if the IP type changes. For this setup_xtables() function was added to change the iptables type and to keep track of the current IP type to avoid unnecessary changes.
Showing with 1804 additions and 417 deletions