Skip to content

Commit

Permalink
added config options
Browse files Browse the repository at this point in the history
  • Loading branch information
wingedfox committed Apr 27, 2013
1 parent 3ae10ef commit bd5df87
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 8 deletions.
Empty file added conf/net.ext.ppp0
Empty file.
Empty file added conf/net.int.eth0
Empty file.
File renamed without changes.
23 changes: 16 additions & 7 deletions conf/20.interfaces.conf → init/20.interfaces.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,40 @@
#
##
# External
EXTIF=ppp0
EXTIP="`$IFC $EXTIF|$G 'inet '|$SED 's/.*inet \([^ ]*\).*/\1/'`"
for if in $PWD/conf/net.ext.* ; do
EXTIF=`$G -oP "[^.]+$" <<< "$if"`
EXTIP=`$IFC $EXTIF 2>/dev/null|$G 'inet '|$SED 's/.*inet \([^ ]*\).*/\1/'`
EXTBC="255.255.255.255"
EXTMSK=$(mask2cidr "`$IFC $EXTIF|$G netmask|$SED 's/.*netmask \([^ ]*\).*/\1/'`")
EXTMSK=`$IFC $EXTIF 2>/dev/null|$G netmask|$SED 's/.*netmask \([^ ]*\).*/\1/'`
EXTMSK=$(mask2cidr $EXTMSK)
EXTNET="$EXTIP/$EXTMSK"

if [ "$EXTIP" = "" ]; then
err "No $EXTIF found or it is inactive."
else
info "EXTIP =$EXTIP\tEXTBC =$EXTBC\tEXTMSK =$EXTMSK\tEXTNET =$EXTNET"
break
fi
done
#
##
# Internal
INTIF1=eth0
INTIP1="`$IFC $INTIF1|$G 'inet '|$SED 's/.*inet \([^ ]*\).*/\1/'`"
INTBC1="`$IFC $INTIF1|$G broadcast|$SED 's/.*broadcast \([^ ]*\).*/\1/'`"
INTMSK1=$(mask2cidr "`$IFC $INTIF1|$G netmask|$SED 's/.*netmask \([^ ]*\).*/\1/'`")
for if in $PWD/conf/net.int.* ; do
INTIF1=`$G -oP "[^.]+$" <<< "$if"`
INTIP1=`$IFC $INTIF1 2>/dev/null|$G 'inet '|$SED 's/.*inet \([^ ]*\).*/\1/'`
INTBC1=`$IFC $INTIF1 2>/dev/null|$G broadcast|$SED 's/.*broadcast \([^ ]*\).*/\1/'`
INTMSK1=`$IFC $INTIF1 2>/dev/null|$G netmask|$SED 's/.*netmask \([^ ]*\).*/\1/'`
INTMSK1=$(mask2cidr $INTMSK1)
INTNET1="$INTIP1/$INTMSK1"

if [ "$INTIP1" = "" ]; then
err "No $INTIF1 found or it is inactive."
else
info "INTIP1=$INTIP1\tINTBC1=$INTBC1\tINTMSK1=$INTMSK1\tINTNET1=$INTNET1"
break;
fi
done
exit
#
##
# Loopback/localhost
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ipt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ PWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#
##
# Load configs
load conf
load init
#
##
#
Expand Down

0 comments on commit bd5df87

Please sign in to comment.