mirror of
https://github.com/status-im/miniupnp.git
synced 2025-01-11 06:35:39 +00:00
miniupnpd/netfilter/iptables_*.sh: less usage of deprecated net-tools. Use iproute2 instead.
This commit is contained in:
parent
67c28e7f8b
commit
9e3547cdec
@ -1,10 +1,13 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# $Id: iptables_init.sh,v 1.5 2011/05/16 12:11:37 nanard Exp $
|
# $Id: iptables_init.sh,v 1.5 2011/05/16 12:11:37 nanard Exp $
|
||||||
IPTABLES=/sbin/iptables
|
IPTABLES="`which iptables`" || exit 1
|
||||||
|
IP="`which ip`" || exit 1
|
||||||
|
|
||||||
#change this parameters :
|
#change this parameters :
|
||||||
EXTIF=eth0
|
#EXTIF=eth0
|
||||||
EXTIP="`LC_ALL=C /sbin/ifconfig $EXTIF | grep 'inet ' | awk '{print $2}' | sed -e 's/.*://'`"
|
EXTIF="`LC_ALL=C $IP -4 route | grep 'default' | sed -e 's/.*dev[[:space:]]*//' -e 's/[[:space:]].*//'`" || exit 1
|
||||||
|
EXTIP="`LC_ALL=C $IP -4 addr show $EXTIF | awk '/inet/ { print $2 }' | cut -d "/" -f 1`"
|
||||||
|
|
||||||
echo "External IP = $EXTIP"
|
echo "External IP = $EXTIP"
|
||||||
|
|
||||||
#adding the MINIUPNPD chain for nat
|
#adding the MINIUPNPD chain for nat
|
||||||
|
@ -3,11 +3,15 @@
|
|||||||
# Improved Miniupnpd iptables init script.
|
# Improved Miniupnpd iptables init script.
|
||||||
# Checks for state of filter before doing anything..
|
# Checks for state of filter before doing anything..
|
||||||
|
|
||||||
EXTIF=eth0
|
IPTABLES="`which iptables`" || exit 1
|
||||||
IPTABLES=/sbin/iptables
|
IP="`which ip`" || exit 1
|
||||||
EXTIP="`LC_ALL=C /sbin/ifconfig $EXTIF | grep 'inet ' | awk '{print $2}' | sed -e 's/.*://'`"
|
|
||||||
NDIRTY="`LC_ALL=C /sbin/iptables -t nat -L -n | grep 'MINIUPNPD' | awk '{printf $1}'`"
|
#EXTIF=eth0
|
||||||
FDIRTY="`LC_ALL=C /sbin/iptables -t filter -L -n | grep 'MINIUPNPD' | awk '{printf $1}'`"
|
EXTIF="`LC_ALL=C $IP -4 route | grep 'default' | sed -e 's/.*dev[[:space:]]*//' -e 's/[[:space:]].*//'`" || exit 1
|
||||||
|
EXTIP="`LC_ALL=C $IP -4 addr show $EXTIF | awk '/inet/ { print $2 }' | cut -d "/" -f 1`"
|
||||||
|
|
||||||
|
NDIRTY="`LC_ALL=C $IPTABLES -t nat -L -n | awk '/MINIUPNPD/ {printf $1}'`"
|
||||||
|
FDIRTY="`LC_ALL=C $IPTABLES -t filter -L -n | awk '/MINIUPNPD/ {printf $1}'`"
|
||||||
echo "External IP = $EXTIP"
|
echo "External IP = $EXTIP"
|
||||||
|
|
||||||
if [[ $NDIRTY = "MINIUPNPDChain" ]]; then
|
if [[ $NDIRTY = "MINIUPNPDChain" ]]; then
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# $Id: iptables_removeall.sh,v 1.5 2011/05/16 12:11:37 nanard Exp $
|
# $Id: iptables_removeall.sh,v 1.5 2011/05/16 12:11:37 nanard Exp $
|
||||||
IPTABLES=/sbin/iptables
|
IPTABLES="`which iptables`" || exit 1
|
||||||
|
IP="`which ip`" || exit 1
|
||||||
|
|
||||||
#change this parameters :
|
#change this parameters :
|
||||||
EXTIF=eth0
|
#EXTIF=eth0
|
||||||
EXTIP="`LC_ALL=C /sbin/ifconfig $EXTIF | grep 'inet ' | awk '{print $2}' | sed -e 's/.*://'`"
|
EXTIF="`LC_ALL=C $IP -4 route | grep 'default' | sed -e 's/.*dev[[:space:]]*//' -e 's/[[:space:]].*//'`" || exit 1
|
||||||
|
EXTIP="`LC_ALL=C $IP -4 addr show $EXTIF | awk '/inet/ { print $2 }' | cut -d "/" -f 1`"
|
||||||
|
|
||||||
#removing the MINIUPNPD chain for nat
|
#removing the MINIUPNPD chain for nat
|
||||||
$IPTABLES -t nat -F MINIUPNPD
|
$IPTABLES -t nat -F MINIUPNPD
|
||||||
|
Loading…
x
Reference in New Issue
Block a user