Skip to content

Commit

Permalink
iptables: Set protocol family in xtables setup.
Browse files Browse the repository at this point in the history
This commit fixes the issue of not being able to set some IPv6 rules
after IPv4 rules with matches have been set (or the other way around).

The family for the matches has to be also updated when changing between
IP protocols.
  • Loading branch information
LaakkonenJussi committed Nov 30, 2018
1 parent 97d9631 commit 6a62b7f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions connman/src/iptables.c
Expand Up @@ -3311,6 +3311,7 @@ static int current_type = -1;
static int setup_xtables(int type)
{
int err;
struct xtables_match *xt_m;

DBG("%d", type);

Expand All @@ -3332,6 +3333,13 @@ static int setup_xtables(int type)
}

if (!err) {
/*
* Set the match type, otherwise loading of matches in xtables
* will fail.
*/
for (xt_m = xtables_matches; xt_m; xt_m = xt_m->next)
xt_m->family = type;

current_type = type;
} else {
connman_error("error initializing xtables");
Expand Down

0 comments on commit 6a62b7f

Please sign in to comment.