/usr/sbin/fiaif-getdev is in fiaif 1.23.1-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | #!/bin/bash
# FIAIF is an Intelligent firewall
# Startup script to add firewall functionality.
#
# Script Author: Anders Fugmann <afu at fugmann dot net>
#
# FIAIF is an Intelligent firewall
# Copyright (C) 2002-2011 Anders Peter Fugmann
# This package comes with ABSOLUTELY NO WARRANTY
# Use strictly at your own risk.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
shopt -s extglob
source /usr/share/fiaif/functions.sh
function get_settings ()
{
DEV=$1
# Test if the interface is up.
LINE=$(ifconfig ${DEV} | grep "inet addr")
if [[ -n "${LINE}" ]];then
IP=$(echo ${LINE} | cut -d : -f 2 | cut -d \ -f1)
BCAST=$(echo ${LINE} | cut -d : -f 3 | cut -d \ -f1)
MASK=$(echo ${LINE} | cut -d : -f 4 | cut -d \ -f1)
NET=${IP}/${MASK}
return 0
fi
return 1
}
if [[ -z "$1" ]]; then
echo "Use: $0 <interface name>"
exit 1
else
if get_settings $1; then
echo "DEV=${DEV}"
echo "IP=${IP}"
echo "BCAST=${BCAST}"
echo "MASK=${MASK}"
echo "NET=${NET}"
INTERFACES=$(ifconfig | grep "$1" | cut -f1 -d" ")
for IFACE in ${INTERFACES}; do
if [[ "${IFACE}" == "$1" ]]; then
continue
else
if get_settings ${IFACE}; then
# Do not add the same value twice.
VAR="${IP}"
for VAR in ${IP_EXTRA}; do
if [[ "${VAR}" == "${IP}" ]]; then
VAR="EMPTY"
break
fi
done
if [[ "${VAR}" != "EMPTY" ]]; then
IP_EXTRA="${IP_EXTRA} ${IP}"
fi
VAR="${IP}"
for VAR in ${NET_EXTRA}; do
if ip_in_network ${VAR%/*} ${VAR#*/} ${IP}; then
VAR="EMPTY"
break
fi
done
if [[ "${VAR}" != "EMPTY" ]]; then
NET_EXTRA="${NET_EXTRA} ${NET}"
fi
fi
fi
done
echo "IP_EXTRA=\"${IP_EXTRA# *}\""
echo "NET_EXTRA=\"${NET_EXTRA# *}\""
else
echo "Unable to read interface ${1}"
fi
fi
|