--mac-source [!] address
Match source MAC address. It must be of the form XX:XX:XX:XX:XX:XX. Note that this only makes sense for packets coming from an Ethernet device and entering the PREROUTING, FORWARD or INPUT chains.
What am I missing??
Can you help someone else get Gargoyle up and running? TL-WDR3600 : Gargoyle 1.9.0 : NBN FixedWireless
TL-WR1043ND-V2 : Gargoyle 1.8.0 : 3G Huawei E160E
jh@rpi01-jh:~ $man iptables-extensions
.
.
mac
[!] --mac-source address
Match source MAC address. It must be of the form XX:XX:XX:XX:XX:XX. Note that this only makes sense for packets coming from an Ethernet device and entering the PREROUTING, FORWARD or INPUT chains.
.
.
Strange, because die.net is usually the reference.
iptables -t filter -A lease_mismatch_check -s "$ip" -m mac ! --mac-source "$mac" -j REJECT
Is the only syntax discussed above that does not raise an error from iptables after /etc/init.d/firewall restart
So let's work with this going forward and keep an eye out for errors on other platforms (just in case).
well done @roadhawk
Can you help someone else get Gargoyle up and running? TL-WDR3600 : Gargoyle 1.9.0 : NBN FixedWireless
TL-WR1043ND-V2 : Gargoyle 1.8.0 : 3G Huawei E160E
block_static_ip_mismatches()
{
block_mismatches=$(uci get firewall.@defaults[0].block_static_ip_mismatches 2> /dev/null)
delete_chain_from_table static_mismatch_check filter
if [ "$block_mismatches" = "1" ] && [ -e /etc/ethers ] ; then
local pairs
pairs=$(cat /etc/ethers | sed '/^[ \t]*$/d' | awk ' { print $1"^"$2"\n" ; } ' )
if [ -n "$pairs" ] ; then
iptables -t filter -N static_mismatch_check
local p
for p in $pairs ; do
local mac
local ip
mac=$(echo $p | sed 's/\^.*$//g')
ip=$(echo $p | sed 's/^.*\^//g')
if [ -n "$ip" ] && [ -n "$mac" ] ; then
iptables -t filter -A static_mismatch_check ! -s "$ip" -m mac --mac-source "$mac" -j REJECT
fi
done
iptables -t filter -I delegate_forward -j static_mismatch_check
fi
fi
}
Edit:
I really appreciate your efforts, so thank you.
for p in $pairs ; do
local mac
local ip
mac=$(echo $p | sed 's/\^.*$//g')
ip=$(echo $p | sed 's/^.*\^//g')
if [ -n "$ip" ] && [ -n "$mac" ] ; then
iptables -t filter -A lease_mismatch_check ! -s "$ip" -m mac --mac-source "$mac" -j REJECT
iptables -t filter -A lease_mismatch_check -s "$ip" -m mac ! --mac-source "$mac" -j REJECT
fi
done
Can you help someone else get Gargoyle up and running? TL-WDR3600 : Gargoyle 1.9.0 : NBN FixedWireless
TL-WR1043ND-V2 : Gargoyle 1.8.0 : 3G Huawei E160E
for p in $pairs ; do
local mac
local ip
mac=$(echo $p | sed 's/\^.*$//g')
ip=$(echo $p | sed 's/^.*\^//g')
if [ -n "$ip" ] && [ -n "$mac" ] ; then
iptables -t filter -A lease_mismatch_check ! -s "$ip" -m mac --mac-source "$mac" -j REJECT
iptables -t filter -A lease_mismatch_check -s "$ip" -m mac ! --mac-source "$mac" -j REJECT
fi
done
This code no longer works in the new update 1.10.0 .
What evidence do you have to say it doesn't work? What exactly are you trying to do and what error are you encountering?
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.
Lantis wrote:What evidence do you have to say it doesn't work? What exactly are you trying to do and what error are you encountering?
I'm sorry, it is really work fine without that code.
I have files that I have customized for myself, and when i copied it to new version, i had a problem because i replaced "gargoyle_firewall_ultil.sh" file.