Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fw4: when ipset matches MAC, allow set family to 'any' #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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