Skip to content
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
9 changes: 6 additions & 3 deletions iptmon/src/usr/sbin/iptmon
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ reverse_lookup() {
if [[ "${host}x" = "x" ]] ; then
host=$(nslookup ${ip} | grep 'name = ' | sed -E 's/^.*name = ([a-zA-Z0-9-]+).*$/\1/')
fi
if [[ "${host}" = "\*" ]] ; then
host=${ip}
fi
printf "%s" ${host}
}

Expand Down Expand Up @@ -142,7 +145,7 @@ dnsmasq_add() {
IFS=$'\n'; for rule in $EXISTING; do eval "$IPTABLES -t mangle $rule"; done
IFS=$OLD_IFS
fi
$IPTABLES -t mangle -A $chain $SRC_DST $ip -j RETURN -m comment --comment "${PREFIX}_${host}"
$IPTABLES -t mangle -A $chain $SRC_DST $ip -j RETURN -m comment --comment "${host}"
done

printf "added iptmon entry for %s %s\n" "${ip}" "${host}"
Expand Down Expand Up @@ -174,7 +177,7 @@ dnsmasq_del() {
esac

if $IPTABLES -t mangle -nL $chain | grep -q "${ip}" ; then
$IPTABLES -t mangle -D $chain $SRC_DST "${ip}" -j RETURN -m comment --comment "${PREFIX}_${host}"
$IPTABLES -t mangle -D $chain $SRC_DST "${ip}" -j RETURN -m comment --comment "${host}"
printf "deleted IPv%d %s entry for %s %s\n" $FAMILY $PREFIX "${ip}" "${host}"
fi
done
Expand Down Expand Up @@ -252,4 +255,4 @@ case $1 in
*)
usage
;;
esac
esac