]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
- używamy pumpa do bootp/dhcpd
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Sun, 27 Jun 1999 14:27:50 +0000 (14:27 +0000)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Sun, 27 Jun 1999 14:27:50 +0000 (14:27 +0000)
- dodano ifup-tnl && ifdown-tnl - obsługa tuneli ipip, sit, gre (ipxip niezrobiona jeszcze)
- tunnels-ip6.conf - zbędne (tunele są konfigurowane w stylu SySV)
- drobne poprawki

svn-id: @378

13 files changed:
rc.d/rc.sysinit
sysconfig/interfaces/tnlcfg-icm
sysconfig/network-scripts/ifdown
sysconfig/network-scripts/ifdown-post
sysconfig/network-scripts/ifdown-ppp
sysconfig/network-scripts/ifdown-tnl [new file with mode: 0755]
sysconfig/network-scripts/ifup
sysconfig/network-scripts/ifup-ipx
sysconfig/network-scripts/ifup-post
sysconfig/network-scripts/ifup-ppp
sysconfig/network-scripts/ifup-sl
sysconfig/network-scripts/ifup-tnl [new file with mode: 0755]
sysconfig/tunnels-ip6.conf [deleted file]

index 3154424af1696c403c0767c1266147c75a303d63..86443b1424e51e22893f60d4c9222c854322e694 100755 (executable)
@@ -75,8 +75,8 @@ if [ ! -f /fastboot ]; then
                echo "*** Dropping you to a shell; the system will reboot"
                echo "*** when you leave the shell."
 
-               PS1="(Repair filesystem) \#"; export PS1
-               if [ "$RUN_SULOGIN_ON_ERR" = "yes"]; then
+               PS1='(Repair filesystem) #'; export PS1
+               if [ "$RUN_SULOGIN_ON_ERR" == "yes" ]; then
                        sulogin
                else
                        /bin/sh
@@ -85,7 +85,7 @@ if [ ! -f /fastboot ]; then
                run_cmd "Unmounting file systems" umount -a
                mount -n -o remount,ro /
                run_cmd "Automatic reboot in progress." reboot
-       elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
+       elif [ "$rc" == "1" -a -x /sbin/quotacheck ]; then
                _RUN_QUOTACHECK=1
        fi
 fi
@@ -116,7 +116,7 @@ fi
 run_cmd "Remounting root filesystem in rw mode" mount -n -o remount,rw /
 
 # Update quotas if fsck was run on /.
-if [ X"$_RUN_QUOTACHECK" = X1 -a -x /sbin/quotacheck ]; then
+if [ X"$_RUN_QUOTACHECK" == "X1" -a -x /sbin/quotacheck ]; then
         run_cmd "Checking root filesystem quotas"  /sbin/quotacheck -v /
 fi
 
@@ -200,8 +200,8 @@ if [ -f /proc/mdstat -a -f /etc/raidtab -a -x /sbin/raidstart ]; then
                echo "*** Dropping you to a shell; the system will reboot"
                echo "*** when you leave the shell."
 
-               PS1="(RAID Repair) \#"; export PS1
-               if [ "$RUN_SULOGIN_ON_ERR" == "yes"]; then
+               PS1='(RAID Repair) #'; export PS1
+               if [ "$RUN_SULOGIN_ON_ERR" == "yes" ]; then
                        sulogin
                else
                        /bin/sh
@@ -228,8 +228,8 @@ if [ ! -f /fastboot ]; then
                echo "*** Dropping you to a shell; the system will reboot"
                echo "*** when you leave the shell."
 
-               PS1="(Repair filesystem) \#"; export PS1
-               if [ "$RUN_SULOGIN_ON_ERR" = "yes"]; then
+               PS1='(Repair filesystem) #'; export PS1
+               if [ "$RUN_SULOGIN_ON_ERR" == "yes" ]; then
                        sulogin
                else
                        /bin/sh
@@ -238,7 +238,7 @@ if [ ! -f /fastboot ]; then
                run_cmd "Unmounting file systems" umount -a
                run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
                run_cmd "Automatic reboot in progress." reboot
-       elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
+       elif [ "$rc" == "1" -a -x /sbin/quotacheck ]; then
                run_cmd "Checking filesystem quotas"/sbin/quotacheck -v -R -a
        fi
 fi
@@ -299,9 +299,9 @@ if [ -f /etc/sysconfig/clock ]; then
        . /etc/sysconfig/clock
 
        # convert old style clock config to new values
-       if [ "${CLOCKMODE}" = "GMT" ]; then
+       if [ "${CLOCKMODE}" == "GMT" ]; then
                UTC=true
-       elif [ "${CLOCKMODE}" = "ARC" ]; then
+       elif [ "${CLOCKMODE}" == "ARC" ]; then
            ARC=true
        fi
 fi
index d54c7789337654b76f10c92115f9ae6df56f8863..d90a3691aad1550defca69002ff80ca7bcafb9c3 100644 (file)
@@ -6,7 +6,8 @@ else    MODE=ipip || MODE=gre || MODE=sit ; then
 
        REMOTEADDR=<IPv4 addres>
        [ LOCALADDR=<IPv4 addres> ]
-       [ REALDEVICE=<name of physic device>
+        [ BIND_DEV= ] do jakiego device przybindowaæ (ma zwi±zek z routingiem itp)
+
        [ TTL= ]
        [ TOS= ]
        [ SEQ={no|yes} ]
@@ -18,6 +19,6 @@ else  MODE=ipip || MODE=gre || MODE=sit ; then
        [ CSUM={no|yes} ]
        [ ICSUM={no|yes} ]
        [ OCSUM={no|yes} ]
-       [ NOPMTUDISC={no|yes} ]
+       [ PMTUDISC={no|yes} ]
 fi
        
index ff1329aeff2026cf2309fb0334918d0ff24b7f3f..1f1f5010ac6fb5a581c069620e023538709ec696 100755 (executable)
@@ -41,15 +41,6 @@ else
     ISALIAS=no
 fi
 
-if [ "$BOOTPROTO" = dhcp -a "$ISALIAS" = no ]; then
-       if [ -f /var/run/dhcpcd-${DEVICE}.pid ]; then
-               kill `cat /var/run/dhcpcd-${DEVICE}.pid`
-               rm -f /var/run/dhcpcd-${DEVICE}.pid
-               exit 0
-       fi
-       exit 1
-fi
-
 #ifconfig ${DEVICE} down
 ip link set ${DEVICE} down
 
index 2e2a07c371c7c053716fffe6f932ecf4f99139c9..b106cd486d6b6c2c801dbc6ed89abe38d9d70762 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # This should be called whenever an interface goes down, not just when
 # it is brought down explicitly.
 
index 22770a0d74d1f472ac9d694e71b748c92211147e..91fc3ee678da064221f8908f8685eaaa297188d3 100755 (executable)
@@ -30,7 +30,7 @@ fi
 # pppd might have chat as a child; remember chat's pid to kill after pppd.
 # (After, not before, so that pppd doesn't just restart it).
 
-CHATPID=`ps axl | awk '$4 ~ $PID {print $3}' 2>/dev/null`
+CHATPID=`ps axl | awk '$4 ~ /^'"$PID"'$/ {print $3}' 2>/dev/null`
 
 kill $PID > /dev/null 2>&1
 [ -n "$CHATPID" ] && kill $CHATPID > /dev/null 2>&1
diff --git a/sysconfig/network-scripts/ifdown-tnl b/sysconfig/network-scripts/ifdown-tnl
new file mode 100755 (executable)
index 0000000..70fb90c
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# Author: Arkadiusz Mi¶kiewicz <misiek@pld.org.pl>
+#
+# Uwagi:
+# - przy dodawaniu routingu w ifup pamiêtac o "onlink" (patrz dokumentacja do iproute)
+# - gdzie¶ trzeba umie¶ciæ modprobe ipip && modprobe ip_gre
+#
+
+cd /etc/sysconfig/network-scripts
+. /etc/rc.d/init.d/functions.network
+
+CONFIG=$1
+source_config
+
+if [ "foo$2" = "fooboot" -a "${ONBOOT}" = "no" ]
+then
+        exit
+fi
+
+if [ "${MODE}" == "ipip" ] || [ "${MODE}" == "sit" ] || [ "${MODE}" == "gre" ]; then
+
+       ip tunnel del ${DEVICE}
+
+elif [ "${MODE}" == "ipxip" ] || [ "${MODE}" == "ipipx" ]; then
+
+echo "obs³uga ipxip jeszcze nie zrobiona"
+
+fi
index 0512291faf41b7cb027f27975421871e054fcbd6..6f8aa852d1b92a05c710fadcb4b5b90dd892d513 100755 (executable)
@@ -55,6 +55,10 @@ if [ "$BOOTP" = "yes" ]; then
     BOOTPROTO=bootp
 fi
 
+if [ "$BOOTPROTO" = bootp -o "$BOOTPROTO" = dhcp ]; then
+    PUMP=true
+fi
+
 OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-${DEVICETYPE}"
 
 if [ -x $OTHERSCRIPT ]; then
@@ -62,7 +66,7 @@ if [ -x $OTHERSCRIPT ]; then
 fi
 
 # is this device available? (this catches PCMCIA devices for us)
-/sbin/ifconfig ${REALDEVICE} 2>&1 | grep -s "unknown interface" > /dev/null
+/sbin/ifconfig ${REALDEVICE} 2>&1 | grep -s "not found" > /dev/null
 if [ "$?" = "0" ]; then
     echo "Delaying ${DEVICE} initialization."
     exit 0
@@ -74,56 +78,25 @@ if [ "$SLAVE" = yes -a "$ISALIAS" = no -a "$MASTER" != "" -a \
 
     ifconfig ${DEVICE} down
     echo "Enslaving $DEVICE to $MASTER"
-    ifenslave $RFLAG "$DEVICE" "$MASTER"
+    ifenslave $RFLAG "$MASTER" "$DEVICE"
 
     exit 0
 fi
 
-if [ "$BOOTPROTO" = bootp -a "$ISALIAS" = no ]; then
-#   ifconfig ${DEVICE} down
-    ip link set ${DEVICE} down
-#   ifconfig ${DEVICE} 0.0.0.0 broadcast 255.255.255.255 netmask 0.0.0.0
-    ip addr add 0.0.0.0/0 broadcast 255.255.255.255 dev ${DEVICE}
-#   route add default ${DEVICE}
-    ip route add 0.0.0.0/0 dev ${DEVICE}
-    echo "Sending bootp request"
-    TMPFILE=`/bin/mktemp /tmp/bootp-${DEVICE}.XXXXXX` || {
-#      ifconfig ${DEVICE} down
-       ip link set ${DEVICE} down
-       echo 'mktemp failed'
-       exit 1
-    }
-    bootpc --returniffail --timeoutwait 6 --dev ${DEVICE} 2>/dev/null > ${TMPFILE}
-    if [ "$?" = "0" ]; then
-       . ${TMPFILE}
-       BOOTPHOSTNAME="$HOSTNAME"
-       echo "bootp response received -- using IP ${IPADDR}"
-    elif [ -z "$IPADDR" ]; then
-#      ifconfig ${DEVICE} down
-       ip link set ${DEVICE} down
-       echo "No bootp response recieved -- not configuring device ${DEVICE}."
-       rm -f ${TMPFILE}
-       exit 1
-    else 
-       echo "No bootp response recieved -- using default configuration for device ${DEVICE}."
-    fi
-
-    rm -f ${TMPFILE}
-elif [ "$BOOTPROTO" = dhcp -a "$ISALIAS" = no ]; then
-    echo -n "Using DHCP for ${DEVICE}... "
-    IFNAME=${DEVICE} \
-       /sbin/dhcpcd -c /etc/sysconfig/network-scripts/ifdhcpc-done ${DEVICE} 
-    echo "echo \$$ > /var/run/dhcp-wait-${DEVICE}.pid; exec sleep 30" | sh
+if [ -n "$MACADDR" ]; then
+   ifconfig ${DEVICE} hw ether ${MACADDR}
+fi
 
-    if [ -f /var/run/dhcp-wait-${DEVICE}.pid ]; then
-       echo "failed."
-       exit 1
+if [ -n "$PUMP" ]; then
+    echo -n "Determining IP information for $DEVICE..."
+    if /sbin/pump -i $DEVICE ; then
+       echo " done."
     else
-       rm -f /var/run/dhcp-wait-${DEVICE}.pid
-       echo "done."
-       IPSETUP=yes
+       echo " failed."
+       exit 1
     fi
-fi
+
+else
 
 if [ "$IPSETUP" != yes ]; then
     if [ -z "$NETMASK" ]; then
@@ -138,16 +111,16 @@ if [ "$IPSETUP" != yes ]; then
        eval `/bin/ipcalc --network ${IPADDR} ${NETMASK}`
     fi
 
-    ifconfig ${DEVICE} ${MACADDR:+hw ether $MACADDR} ${IPADDR} \
-      netmask ${NETMASK} broadcast ${BROADCAST}
+    ifconfig ${DEVICE} ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}
 
     if [ "${IP6VNETWORKING}" = "yes" ] ; then 
       for ADDR in ${IP6VADDRS} ; do
         ip addr add ${ADDR} dev ${DEVICE}
       done  
     fi
-    
-    if [ "$ISALIAS" = no ] ; then
+
+# hack for 2.2 kernels
+    if [ "$ISALIAS" = no ] && [ -z "`route -n | sed "s/ .*//" | grep ${NETWORK}`" ]; then
 # potrzebna zamiana netmaski z postaci np. 255.255.255.255 -> 32
        route add -net ${NETWORK} netmask ${NETMASK} ${DEVICE}
     else
index e705d894fef3f76cf78860cb7dfb4a00b2a254f8..8a0eaff7ad6270a09d4a8850a1d6209c3d019c06 100755 (executable)
@@ -24,18 +24,19 @@ CONFIG=$1
 [ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
 source_config
 
-for frametype in 802_2 802_3 ETHERII SNAP ; do
+for frametype in 802.2 802.3 ETHERII SNAP ; do
     # Yes, this kind of evaluation is really necessary to do this.
     # Welcome to shell programming...  No, we were not smoking some
     # particularly good floppies while we wrote this.  :-)
-    case $(eval echo $(echo \$`echo IPXACTIVE_$frametype`)) in
+    framename=$(echo $frametype | sed 's/\./_/')
+    case $(eval echo $(echo \$`echo IPXACTIVE_$framename`)) in
        yes|true)
-               case $(eval echo $(echo \$`echo IPXPRIMARY_$frametype`)) in
+               case $(eval echo $(echo \$`echo IPXPRIMARY_$framename`)) in
                    yes|true) primary=-p ;;
                    *) primary= ;;
                esac
                /usr/bin/ipx_interface add $1 $primary $frametype \
-                 $(eval echo $(echo \$`echo IPXNETNUM_$frametype`))
+                 $(eval echo $(echo \$`echo IPXNETNUM_$framename`))
                ;;
     esac
 done
index b7ff42bef3b643ad658fb205eda1cdb4445f04eb..77b1961a2e7c7b4bb2c41a75c07fc978b47894e4 100755 (executable)
@@ -21,7 +21,8 @@ if [ "$ISALIAS" = no ] ; then
     /etc/sysconfig/network-scripts/ifup-aliases ${DEVICE}
 fi
 
-if [ -n "$NEEDHOSTNAME" -a ${DEVICE} != lo ]; then
+# don't set hostname on ppp/slip connections
+if [ -n "$NEEDHOSTNAME" -a "${DEVICE}" != lo -a "${DEVICETYPE}" != "ppp" -a "${DEVICETYPE}" != "slip" ]; then
 # przy zastêpowaniu ifconfiga iproutem trzeba uwa¿aæ na aliasy eth0:1
     IPADDR=`ifconfig ${DEVICE} | grep 'inet addr' | 
            awk -F: '{ print $2 } ' | awk '{ print $1 }'`
index f889041ea9183a68e4426de50e093c741dc207dd..70e90d7ba390d2b7e14aad4e0ba71f5a3721e404 100755 (executable)
@@ -19,7 +19,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
 if [ "$1" != daemon ] ; then
   # disconnect stdin, out, err to disassociate from controlling tty
   # so that no HUPs will get through.
-  $0 daemon $*& </dev/null >/dev/null 2>/dev/null
+  $0 daemon $* </dev/null >/dev/null 2>/dev/null &
   exit 0
 fi
 shift
@@ -60,6 +60,8 @@ if [ "${HARDFLOWCTL}" = yes ] ; then
   opts="$opts modem crtscts"
 fi
 if [ "${ESCAPECHARS}" = yes ] ; then
+  opts="$opts asyncmap FFFFFFFF"
+elif [ "${ESCAPECHARS}" = no ] ; then
   opts="$opts asyncmap 00000000"
 fi
 if [ "${DEFROUTE}" = yes ] ; then
index 2760add57bb495391bd50444944161397dea4c2a..491f64d71b47ec08427d2f976d5bc83e9e32bdba 100755 (executable)
@@ -86,8 +86,9 @@ else
 
        # Check if slattach (or other process) is using $MODEMPORT
        # if not - execute slattach
-        if fuser -s $MODEMPORT; then
+        if [ -x /usr/sbin/fuser ] && fuser -s $MODEMPORT; then
         logger -p daemon.info -t ifup-sl "some process is currently using $MODEMPORT"
+       echo "some process is currently using $MODEMPORT - aborting..."
         else
         slattach -p $PROTOCOL -s $LINESPEED $MODEMPORT &
         usleep 500
diff --git a/sysconfig/network-scripts/ifup-tnl b/sysconfig/network-scripts/ifup-tnl
new file mode 100755 (executable)
index 0000000..1139004
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/sh
+#
+# Author: Arkadiusz Mi¶kiewicz <misiek@pld.org.pl>
+#
+# Uwagi:
+# - przy dodawaniu routingu w ifup pamiêtac o "onlink" (patrz dokumentacja do iproute)
+# - gdzie¶ trzeba umie¶ciæ modprobe ipip && modprobe ip_gre
+#
+
+cd /etc/sysconfig/network-scripts
+. /etc/rc.d/init.d/functions.network
+
+CONFIG=$1
+source_config
+
+if [ "foo$2" = "fooboot" -a "${ONBOOT}" = "no" ]
+then
+        exit
+fi
+
+[ -z "${TTL}" ] && TTL=inherit
+[ -z "${TOS}" ] && TOS=inherit
+[ -z "${LOCALADDR}" ] && LOCALADDR=any
+[ -z "${REMOTEADDR}" ] && REMOTEADDR=any
+[ -n "${BIND_DEV}" ] && BIND_DEV="dev $BIND_DEV"
+
+if [ "${SEQ}" == "yes" ]; then
+       SEQ=seq
+else
+       [ "${ISEQ}" == "yes" ] && SEQ=iseq
+       [ "${OSEQ}" == "yes" ] && SEQ="$SEQ oseq"
+fi
+
+if [ "${CSUM}" == "yes" ]; then
+       CSUM=csum
+else
+        [ "${ICSUM}" == "yes" ] && CSUM=icsum
+        [ "${ICSUM}" == "yes" ] && CSUM="$SEQ ocsum"
+fi
+
+[ "${ISEQ}" == "yes" ] && ISEQ=iseq
+[ "${ISEQ}" == "yes" ] && ISEQ=iseq
+[ "${ISEQ}" == "yes" ] && ISEQ=iseq
+[ "${ISEQ}" == "yes" ] && ISEQ=iseq
+
+[ "${TTL}" != "0" -a "${TTL}" != "inherit" ] && PMTUDISC=yes
+
+if [ "${PMTUDISC}" == "yes" ]; then
+       PMTUDISC=pmtudisc
+else
+       PMTUDISC=nopmtudisc
+fi
+
+if [ -n "${KEY}" ]; then
+IKEY=""
+OKEY=""
+fi
+
+if [ "${MODE}" == "ipip" ] || [ "${MODE}" == "sit" ]; then
+       
+       ip tunnel add ${DEVICE} mode ${MODE} local ${LOCALADDR} remote ${REMOTEADDR} ttl ${TTL} tos ${TOS} ${PMTUDISC} $BIND_DEV
+
+elif [ "${MODE}" == "gre" ]; then
+
+       ip tunnel add ${DEVICE} mode ${MODE} local ${LOCALADDR} remote ${REMOTEADDR} ttl ${TTL} tos
+${TOS} ${PMTUDISC} $BIND_DEV $CSUM $ISEQ ${KEY} ${IKEY} ${OKEY}
+
+elif [ "${MODE}" == "ipxip" ] || [ "${MODE}" == "ipipx" ]; then
+
+echo "obs³uga ipxip jeszcze nie zrobiona"
+
+fi
diff --git a/sysconfig/tunnels-ip6.conf b/sysconfig/tunnels-ip6.conf
deleted file mode 100644 (file)
index 1b71f70..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#!F:tunnels-ip6.conf
-#
-#!P:/etc/sysconfig
-#
-#!S:root:root 440
-#
-#!D:IPv6 configuration file
-#
-#!C:Copyright 1997-1998 Peter Bieringer <pb@bieringer.de>
-#!C:changes (versions X.XXa) by Grzegorz Stanislawski <stangrze@open.net.pl>
-#
-#!V:Version 2.12a 10.11.1998
-
-# Changes to 
-#  2.11: nothing important
-#  2.12: NBMA tunnel configuration ready
-#  2.12a:
-#    - this file contains data which was moved from network-ip6.conf
-#    - Support for verbose interface names (see network-ip6.conf for info)
-#    - removed nbma suppport (since i cannot imagine what is this for - (stangrze))
-# This file is needed by 'functions-ip6' version 2.41a
-
-### The order in the file is only for a good overview, it is not really
-### necessary. The important values are 'device' and 'key'!
-
-
-################# Tunnel section 
-
-## Here you can configure tunnel endpoints. Be sure, that you set the device
-## entry in a right way like 'sit1', 'sit2' and so on, otherwise you will get
-## an error information from 'functions-ip6'
-
-#Device        Key     local           remote          ttl     realdev
-icm-pl tunnel  195.136.100.3   193.219.28.246  64      eth0
-ceti   tunnel  195.136.100.3   195.116.211.16  64      eth0
-ckm    tunnel  195.136.100.3   195.136.5.6     64      eth0
-wiget  tunnel  195.136.100.3   156.17.210.110  64      eth0
-#sit2  tunnel                          IPv4-Address
-#sit3  tunnel                          IPv4-Address
-
-
-# Tunnel route section 
-# Here you can specify several routes to your configured tunnels.
-# More than one are possible!
-
-#Device        Key                             Network
-icm-pl route                           3ffe:902::/32
-ceti   route                           3ffe:902:3::/48
-ckm    route                           3ffe:902:10::1:0/112
-wiget  route                           3ffe:902:11::/48
-#sit2  route                           IPv6-Network/Prefix
-#sit3  route                           IPv6-Network/Prefix
-
This page took 0.055509 seconds and 4 git commands to generate.