Skip to content

Commit

Permalink
fw4: when ipset matches mac, allow set family to 'any'
Browse files Browse the repository at this point in the history
Fixes: openwrt#16
  • Loading branch information
zsien committed Jul 27, 2024
1 parent dfbcc1c commit ad583a0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions root/usr/share/ucode/fw4.uc
Original file line number Diff line number Diff line change
Expand Up @@ -2571,7 +2571,7 @@ return {

/* check if there's no AF specific bits, in this case we can do an AF agnostic rule */
if (!family && rule.target != "dscp" && !has_ipv4_specifics && !has_ipv6_specifics) {
add_rule(0, proto, [], [], sports, dports, null, null, null, rule);
add_rule(0, proto, [], [], sports, dports, null, null, ipset, rule);
}

/* we need to emit one or two AF specific rules */
Expand Down Expand Up @@ -3305,11 +3305,7 @@ return {
return;
}

if (ipset.family == 0) {
this.warn_section(data, "must not specify family 'any'");
return;
}
else if (!length(ipset.match)) {
if (!length(ipset.match)) {
this.warn_section(data, "has no datatypes assigned");
return;
}
Expand All @@ -3318,6 +3314,11 @@ return {
types = map(ipset.match, m => m[1]),
interval = false;

if (("ip" in types || "net" in types) && ipset.family == 0) {
this.warn_section(data, "must not specify family 'any' when matching type 'ip' or 'net'");
return;
}

if ("set" in types) {
this.warn_section(data, "match type 'set' is not supported");
return;
Expand Down

0 comments on commit ad583a0

Please sign in to comment.