From: <kr...@us...> - 2007-09-20 18:49:19
|
Revision: 1261 http://astlinux.svn.sourceforge.net/astlinux/?rev=1261&view=rev Author: krisk84 Date: 2007-09-20 11:49:15 -0700 (Thu, 20 Sep 2007) Log Message: ----------- Pretty significant update to AstLinux behavior. - You can now specify INT2IF, INT3IF, etc even if you don't have an INTIF defined. Makes sense... - Add new variables - NODHCP, DHCPRANGE - Got rid (sort of) of NOINTDNS variables - Various improvements to sanity checks for variables, etc. Modified Paths: -------------- trunk/package/dnsmasq/dnsmasq.init trunk/package/iproute2/astshape.init trunk/package/iptables/astfw trunk/package/iptables/iptables.init trunk/target/generic/target_skeleton/stat/etc/rc.conf Modified: trunk/package/dnsmasq/dnsmasq.init =================================================================== --- trunk/package/dnsmasq/dnsmasq.init 2007-09-19 14:50:29 UTC (rev 1260) +++ trunk/package/dnsmasq/dnsmasq.init 2007-09-20 18:49:15 UTC (rev 1261) @@ -8,7 +8,7 @@ fi init () { -if [ "$INTIF" ] +if [ "$INTIF" -o "$INT2IF" -o "$INT3IF" ] then if [ -f /mnt/kd/dnsmasq.leases ] @@ -18,18 +18,62 @@ touch /var/db/dnsmasq.leases fi +if [ "$INTIF" -a "$INTIP" ] +then LANIPBASE=`echo $INTIP | cut -d. -f1-3` +fi -if [ "$INT2IF" ] +if [ "$INT2IF" -a "$INT2IP" ] then LAN2IPBASE=`echo $INT2IP | cut -d. -f1-3` fi -if [ "$INT3IF" ] +if [ "$INT3IF" -a "$INT3IP" ] then LAN3IPBASE=`echo $INT3IP | cut -d. -f1-3` fi +rm -f /tmp/etc/dnsmasq.conf + +if [ "$DHCPRANGE" ] +then +DSTART=`echo $DHCPRANGE | cut -d: -f1` +DEND=`echo $DHCPRANGE | cut -d: -f2` +else +DSTART=100 +DEND=252 +fi + +if [ "$INTIFDNS" -o "$INT2IFDNS" -o "$INT3IFDNS" ] +then +echo "WARNING: The INTIFDNS variables are now INTIFDHCP +but you should probably use the newer NODHCP instead. +Please see the sample rc.conf" +fi + +if [ "$NODHCP" ] +then +for i in $NODHCP +do + +if [ "$i" = "$INTIF" ] +then +INTIFDHCP=off +fi + +if [ "$i" = "$INT2IF" ] +then +INT2IFDHCP=off +fi + +if [ "$i" = "$INT3IF" ] +then +INT3IFDHCP=off +fi + +done +fi + if [ "$LOCALDNS" ] then RCONF="/tmp/etc/resolv-up.conf" @@ -44,19 +88,11 @@ local=/$DOMAIN/ expand-hosts domain=$DOMAIN -dhcp-range=lan,$LANIPBASE.100,$LANIPBASE.252,24h read-ethers - -dhcp-option=lan,3,$INTIP -dhcp-option=lan,6,$INTIP -dhcp-option=lan,42,$INTIP -dhcp-option=lan,66,$HOSTNAME.$DOMAIN -dhcp-option=lan,150,$INTIP - # dhcp-lease-max=153 resolv-file=$RCONF dhcp-leasefile=/var/db/dnsmasq.leases -cache-size=150" > /tmp/etc/dnsmasq.conf +cache-size=150" >> /tmp/etc/dnsmasq.conf if [ "$NFSDROOTPATH" ] then @@ -68,14 +104,30 @@ echo "dhcp-boot=$BOOTPFILE,$HOSTNAME.$DOMAIN,$INTIP" >> /tmp/etc/dnsmasq.conf fi -if [ "$INT2IFDNS" -a "$INT2IFDNS" = "off" ] +if [ "$INTIFDHCP" -a "$INTIFDHCP" = "off" ] then -echo "# DNS disabled on INT2IF" >> /tmp/etc/dnsmasq.conf +echo "# DHCP disabled on $INTIF" >> /tmp/etc/dnsmasq.conf else -if [ "$INT2IF" ] +if [ "$INTIF" -a "$LANIPBASE" ] then echo " -dhcp-range=lan2,$LAN2IPBASE.100,$LAN2IPBASE.252,24h +dhcp-range=lan,$LANIPBASE.$DSTART,$LANIPBASE.$DEND,24h +dhcp-option=lan,3,$INTIP +dhcp-option=lan,6,$INTIP +dhcp-option=lan,42,$INTIP +dhcp-option=lan,66,$HOSTNAME.$DOMAIN +dhcp-option=lan,150,$INTIP" >> /tmp/etc/dnsmasq.conf +fi +fi + +if [ "$INT2IFDHCP" -a "$INT2IFDHCP" = "off" ] +then +echo "# DHCP disabled on $INT2IF" >> /tmp/etc/dnsmasq.conf +else +if [ "$INT2IF" -a "$LAN2IPBASE" ] +then +echo " +dhcp-range=lan2,$LAN2IPBASE.$DSTART,$LAN2IPBASE.$DEND,24h dhcp-option=lan2,3,$INT2IP dhcp-option=lan2,6,$INT2IP dhcp-option=lan2,42,$INT2IP @@ -84,13 +136,13 @@ fi fi -if [ "$INT3IFDNS" -a "$INT3IFDNS" = "off" ] +if [ "$INT3IFDHCP" -a "$INT3IFDHCP" = "off" ] then -echo "# DNS disabled on INT3IF" >> /tmp/etc/dnsmasq.conf -if [ "$INT3IF" ] +echo "# DHCP disabled on $INT3IF" >> /tmp/etc/dnsmasq.conf +if [ "$INT3IF" -a "$LAN3IPBASE" ] then echo " -dhcp-range=lan3,$LAN3IPBASE.100,$LAN3IPBASE.252,24h +dhcp-range=lan3,$LAN3IPBASE.$DSTART,$LAN3IPBASE.$DEND,24h dhcp-option=lan3,3,$INT3IP dhcp-option=lan3,6,$INT3IP dhcp-option=lan3,42,$INT3IP @@ -111,7 +163,7 @@ } start () { -if [ "$INTIF" ] +if [ "$INTIF" -o "$INT2IF" -o "$INT3IF" ] then if [ -r /etc/dnsmasq.conf ] then Modified: trunk/package/iproute2/astshape.init =================================================================== --- trunk/package/iproute2/astshape.init 2007-09-19 14:50:29 UTC (rev 1260) +++ trunk/package/iproute2/astshape.init 2007-09-20 18:49:15 UTC (rev 1261) @@ -12,7 +12,7 @@ fi done -if [ "$INTIF" ] +if [ "$INTIF" -o "$INT2IF" -o "$INT3IF" ] then RUN=0 else @@ -47,7 +47,7 @@ } stop () { -if [ ! "$INTIF" ] +if [ ! "$INTIF" -o "$INT2IF" -o "$INT3IF" ] then exit fi Modified: trunk/package/iptables/astfw =================================================================== --- trunk/package/iptables/astfw 2007-09-19 14:50:29 UTC (rev 1260) +++ trunk/package/iptables/astfw 2007-09-20 18:49:15 UTC (rev 1261) @@ -55,7 +55,11 @@ iptables -A INPUT -i lo -j ACCEPT #Allow INPUT from INTIF + +if [ "$INTIF" ] +then iptables -A INPUT -i $INTIF -j ACCEPT +fi if [ "$INT2IF" ] then @@ -154,7 +158,11 @@ #allow forwarding from each interface to the internet... for i in $EXTIFS do + +if [ "$INTIF" ] +then iptables -A FORWARD -i $INTIF -o $i -j ACCEPT +fi if [ "$INT2IF" ] then Modified: trunk/package/iptables/iptables.init =================================================================== --- trunk/package/iptables/iptables.init 2007-09-19 14:50:29 UTC (rev 1260) +++ trunk/package/iptables/iptables.init 2007-09-20 18:49:15 UTC (rev 1261) @@ -3,7 +3,7 @@ . /etc/rc.conf start () { -if [ "$INTIF" ] +if [ "$INTIF" -o "$INT2IF" -o "$INT3IF" ] then if [ ! -x /usr/sbin/iptables ] @@ -40,7 +40,7 @@ } stop () { -if [ "$INTIF" ] +if [ "$INTIF" -o "$INT2IF" -o "$INT3IF" ] then if [ ! -x /usr/sbin/iptables ] Modified: trunk/target/generic/target_skeleton/stat/etc/rc.conf =================================================================== --- trunk/target/generic/target_skeleton/stat/etc/rc.conf 2007-09-19 14:50:29 UTC (rev 1260) +++ trunk/target/generic/target_skeleton/stat/etc/rc.conf 2007-09-20 18:49:15 UTC (rev 1261) @@ -156,12 +156,22 @@ ##for DNS resolution on THIS machine. #LOCALDNS=yes -##Disable DHCP on INT2 or INT3 -#INT2IFDNS=off -#INT3IFDNS=off +##You don't have to use DHCP + DNS with all of your internal interfaces. +##Here you can specify a list of interfaces that will not have a DHCP range +##associated with them. You can use real interface names or variables. +##I recommend variables. Seperate multiple IFs with spaces. +#NODHCP="$INT2IF" +##DHCP Range +##Here you can define the range of IP addresses for your local networks. +##This value will apply to all of your INTIFs. We will automatically calculate +##the first three octets. Just tell me which range I should give out leases for. +##In this example, if INTIP=192.168.0.1, we will give out leases for +##192.168.0.100 - 192.168.0.252 +#DHCPRANGE="100:252" + ##If you do not define the INTIF, I will not try to start one. -##If you do not define the INTIF, I will also not start the following services: +##If you do not define any INTIF(s), I will also not start the following services: ##dnsmasq iptables astshape (PBX only mode) ##PBX Only mode is enabled by default from 0.2.8.10 #INTIF=eth1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |