mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-08 16:54:10 +01:00
Add find_interface_by_mac()
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@2516 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
d871e1f163
commit
f9f3fadd56
@ -7,6 +7,8 @@ Changes in 2.5.3
|
||||
|
||||
3) Set COMMAND=restore in restore-base.
|
||||
|
||||
4) Implement find_interface_by_mac()
|
||||
|
||||
Changes in 2.5.2
|
||||
|
||||
1) Allow port lists in /etc/sorewall/accounting.
|
||||
|
@ -798,6 +798,27 @@ find_interface_by_address() {
|
||||
[ -n "$dev" ] && echo $dev
|
||||
}
|
||||
|
||||
#
|
||||
# Find the interface with the passed MAC address
|
||||
#
|
||||
|
||||
find_interface_by_mac() {
|
||||
local mac=$1 first second rest dev
|
||||
|
||||
ip link ls | while read first second rest; do
|
||||
case $first in
|
||||
*:)
|
||||
dev=$second
|
||||
;;
|
||||
*)
|
||||
if [ "$second" = $mac ]; then
|
||||
echo ${dev%:}
|
||||
return
|
||||
fi
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Find interface addresses--returns the set of addresses assigned to the passed
|
||||
# device
|
||||
|
@ -16,6 +16,23 @@ New Features in Shorewall 2.5.3
|
||||
scripts. The value of this variable is sometimes of interest to
|
||||
programmers providing custom /etc/shorewall/tcstart scripts.
|
||||
|
||||
4) If you have problems with ethernet interfaces switching names when
|
||||
your system is rebooted, you can now work around the problem. For
|
||||
each interface, select a shell variable name and set the variable
|
||||
to the value echoed by the 'find_interface_by_mac' function.
|
||||
|
||||
Example: To set EXT_IF to the interface with MAC address
|
||||
00:02:e3:08:55:fa, in /etc/shorewall/params:
|
||||
|
||||
EXT_IF=$(find_interface_by_mac 00:02:e3:08:55:fa)
|
||||
|
||||
Now simple use $EXT_IF any time that you wish to refer to that
|
||||
interface.
|
||||
|
||||
WARNING: If you have this problem, you will not wish to use the
|
||||
"-f" option in the Shorewall SysV init script (usually named
|
||||
/etc/init.d/shorewall).
|
||||
|
||||
Problems Corrected in 2.5.2:
|
||||
|
||||
1) You may now include port lists in in the /etc/shorewall/accounting
|
||||
|
Loading…
Reference in New Issue
Block a user