ifup-pvc i ifup-hdlc (fwd)
Arkadiusz Chomicki
chomar w wla.pl
Nie, 26 Maj 2002, 22:10:33 CEST
witam
wysylam skrypty
narazie nadaja sie one do kernela serji 2.2
uzywaja one programu sethdlc i pc300cfg z pakietu pc300-345.tgz
sciagniete z ftp://ftp.cyclades.com/pub/cyclades/pc300
skrypty sa w zalączniku
proszę o odpowiedz
czy ktoś je odebral i czy nadaj sie do publikacji
chętnie popracuje jeszcze nad nimi
zeby tez pasowaly do jadra 2.4.*
programy ktorych potrzebuje trzeba skompilowac na konkretne jadro tzn
przynajmniej na kakretna serje jadra
Pozdrawiam
ChomAr
--
+-----------------------------------------------------+
Arkadiusz Chomicki ICQ: 96876099
84-120 Władysławowo GG: 420515
woj. pomorskie e-mail:chomar w wla.pl
http://www.chomar.wla.pl
+-----------------------------------------------------+
-------------- następna część ---------
#!/bin/sh
#
# $Id: ifup-hdlc,v 0.01 2002/05/25 19:07:00 $
#
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /etc/sysconfig/network
. /etc/rc.d/init.d/functions
. /etc/sysconfig/network-scripts/.functions
CONFIG=$1
source_config
if [ "foo$2" = "fooboot" ] && is_no "${ONBOOT}"; then
exit
fi
# dla kompatybilnosci ze starą wersja ifcfg-hdlcN
if [ -z "${REMIP}" ]; then
if [ -n "${POINTOPOINT}" ]; then
REMIP=${POINTOPOINT}
fi
fi
# set all major variables
setup_ip_param
# Try to load hdlc module
if is_module "hdlc"; then
/sbin/modprobe -s -k hdlc
fi
if [ "$BOARD" = "pc300" ]; then
SETHDLC_PARAMS=""
PC300CFG_PARAMS=""
if [ -n "${CLOCK}" ]; then
PC300CFG_PARAMS="$PC300CFG_PARAMS clock ${CLOCK}"
if [ "${MEDIA}" != "t1" -a "${MEDIA}" != "e1" ]; then
if [ "${CLOCK}" = "int" -o "${CLOCK}" = "txint" ]; then
if [ -n "${CLOCK_RATE}" ]; then
PC300CFG_PARAMS="$PC300CFG_PARAMS ${CLOCK_RATE}"
else
echo "${DEVICE}: error configuring PC300 parameters. Please set the clock rate."
exit 1
fi
fi
fi
fi
if [ -n "${MEDIA}" ]; then
if [ ${MEDIA} = "t1" -o ${MEDIA} = "e1" ]; then
TE_PARAMS=""
if [ -n "${LCODE}" ]; then
TE_PARAMS="$TE_PARAMS lcode ${LCODE}"
fi
if [ -n "${FRAME}" ]; then
TE_PARAMS="$TE_PARAMS frame ${FRAME}"
fi
if [ ! -z "${LBO}" ]; then
TE_PARAMS="$TE_PARAMS lbo ${LBO}"
fi
if [ -n "${RX_SENS}" ]; then
TE_PARAMS="$TE_PARAMS rx_sens ${RX_SENS}"
fi
if [ -n "${ACTIVE_CH}" ]; then
TE_PARAMS="$TE_PARAMS active_ch ${ACTIVE_CH}"
fi
[ -x /usr/local/sbin/pc300cfg ] || {
nls "%s does not exist or is not executable" "/usr/local/sbin/pc300cfg"
nls "%s for %s exiting" "ifup-hdlc" "$DEVICE"
logger -p daemon.info -t ifup-hdlc \
"$(nls '%s does not exist or is not executable for %s' "/usr/local/sbin/pc300cfg" "$DEVICE")"
exit 1
}
/usr/local/sbin/pc300cfg ${DEVICE} $TE_PARAMS
if [ "$?" != "0" ]; then
echo "${DEVICE}: error configuring PC300 parameters."
exit 1
fi
fi
SETHDLC_PARAMS="$SETHDLC_PARAMS ${MEDIA}"
fi
if [ -n "${PROTO}" ]; then
if [ "$PROTO" = "monitor" ]; then
[ -x /usr/local/sbin/pc300cfg ] || {
nls "%s does not exist or is not executable" "/usr/local/sbin/pc300cfg"
nls "%s for %s exiting" "ifup-hdlc" "$DEVICE"
logger -p daemon.info -t ifup-hdlc \
"$(nls '%s does not exist or is not executable for %s' "/usr/local/sbin/pc300cfg" "$DEVICE")"
exit 1
}
/usr/local/sbin/pc300cfg ${DEVICE} proto monitor
elif [ "$PROTO" = "hdlc" ]; then
SETHDLC_PARAMS="$SETHDLC_PARAMS mode hdlc"
if [ -n "${ENCODING}" ]; then
PC300CFG_PARAMS="$PC300CFG_PARAMS enc ${ENCODING}"
fi
if [ -n "${ERRORCHK}" ]; then
PC300CFG_PARAMS="$PC300CFG_PARAMS crc ${ERRORCHK}"
fi
else
SETHDLC_PARAMS="$SETHDLC_PARAMS mode soft"
if [ ${PROTO} = "fr_ansi" -o ${PROTO} = "fr_ccitt" ]; then
LMI=cho ${PROTO} | cut -f2 -d '_'
CFG_PARAMS1="$CFG_PARAMS1 fr lmi ${LMI}"
if is_yes "${DCE}"; then
SETHDLC_PARAMS="$SETHDLC_PARAMS dce"
fi
fi
SETHDLC_PARAMS="$SETHDLC_PARAMS ${PROTO}"
fi
fi
if [ -n "$SETHDLC_PARAMS" ]; then
[ -x /usr/local/sbin/sethdlc ] || {
nls "%s does not exist or is not executable" "/usr/local/sbin/sethdlc"
nls "%s for %s exiting" "ifup-hdlc" "$DEVICE"
logger -p daemon.info -t ifup-hdlc \
"$(nls '%s does not exist or is not executable for %s' "/usr/local/sbin/sethdlc" "$DEVICE")"
exit 1
}
/usr/local/sbin/sethdlc ${DEVICE} $SETHDLC_PARAMS
fi
if [ -n "$PC300CFG_PARAMS" ]; then
[ -x /usr/local/sbin/pc300cfg ] || {
nls "%s does not exist or is not executable" "/usr/local/sbin/pc300cfg"
nls "%s for %s exiting" "ifup-hdlc" "$DEVICE"
logger -p daemon.info -t ifup-hdlc \
"$(nls '%s does not exist or is not executable for %s' "/usr/local/sbin/pc300cfg" "$DEVICE")"
exit 1
}
/usr/local/sbin/pc300cfg ${DEVICE} $PC300CFG_PARAMS
fi
fi
# HDLC interfaces can have IP addresses on them if PPP
# is running directly on them. However for X25 and Frame Relay
# interfaces, the hdlc i/f is a base which other PVCs
# are built on. In this case they have no IP address.
## This will need changing if someone puts something other than
## IP on a hdlc.
if is_yes "$IPV4_NETWORKING"; then
if [ -n "${IP4ADDR}" ]; then
if [ -n "${REMIP}" ]; then
ip -4 addr add ${IP4ADDR} peer ${REMIP} dev ${DEVICE}
else
ip -4 addr add ${IP4ADDR} dev ${DEVICE}
fi
else
ip -4 addr add 0.0.0.0 dev ${DEVICE}
fi
fi
if is_yes "$IPV6_NETWORKING"; then
if [ -n "$IP6ADDR" ]; then
if [ -n "${REMIP}" ]; then
ip -6 addr add ${IP6ADDR} peer ${REMIP} dev ${DEVICE}
else
ip -6 addr add ${IP6ADDR} dev ${DEVICE}
fi
else
ip -6 addr add :0 dev ${DEVICE}
fi
fi
if [ -n "$MTU" ]; then
ip link set ${DEVICE} mtu ${MTU} up
else
ip link set dev ${DEVICE} up
fi
# IPv4/6 gateways and default routes
setup_ip_gw_ro
#echo /etc/sysconfig/network-scripts/ifup-post $1
/etc/sysconfig/network-scripts/ifup-post $1
# This must be last line !
# vi:syntax=sh:tw=78:ts=8:sw=4
-------------- następna część ---------
#!/bin/sh
#
# $Id: ifdown-pvc,v 0.001 2002/05/23 22:10:00 $
#
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /etc/sysconfig/network
. /etc/rc.d/init.d/functions
. /etc/sysconfig/network-scripts/.functions
CONFIG=$1
source_config
if [ "foo$2" = "fooboot" ] && is_no "${ONBOOT}"; then
exit
fi
# set all major variables
setup_ip_param
ip link set dev ${DEVICE} down
[ -x /usr/local/sbin/sethdlc ] || {
nls "%s does not exist or is not executable" "/usr/local/sbin/sethdlc"
nls "%s for %s exiting" "ifup-pvc" "$DEVICE"
logger -p daemon.info -t ifup-pvc \
"$(nls '%s does not exist or is not executable for %s' "/usr/local/sbin/sethdlc" "$DEVICE")"
exit 1
}
/usr/local/sbin/sethdlc ${MASTERDEV} delete ${DLCI}
#echo /etc/sysconfig/network-scripts/ifup-post $1
/etc/sysconfig/network-scripts/ifdown-post $1
# This must be last line !
# vi:syntax=sh:tw=78:ts=8:sw=4
-------------- następna część ---------
#!/bin/sh
#
# $Id: ifup-pvc,v 1.0 2002/05/24 01:21:00 $
#
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /etc/sysconfig/network
. /etc/rc.d/init.d/functions
. /etc/sysconfig/network-scripts/.functions
CONFIG=$1
source_config
if [ "foo$2" = "fooboot" ] && is_no "${ONBOOT}"; then
exit
fi
# dla kompatybilnosci ze starą wersja ifcfg-pvcN
[ -z "${REMIP}" -a -n "${POINTOPOINT}" ] && REMIP=$POINTOPOINT
# set all major variables
setup_ip_param
# Try to load pvc module
#if is_module "pvc"; then
# /sbin/modprobe -s -k pvc
#fi
[ -x /usr/local/sbin/sethdlc ] || {
nls "%s does not exist or is not executable" "/usr/local/sbin/sethdlc"
nls "%s for %s exiting" "ifup-pvc" "$DEVICE"
logger -p daemon.info -t ifup-pvc \
"$(nls '%s does not exist or is not executable for %s' "/usr/local/sbin/sethdlc" "$DEVICE")"
exit 1
}
/usr/local/sbin/sethdlc ${MASTERDEV} create ${DLCI}
if is_yes "$IPV4_NETWORKING"; then
if [ -n "$IP4ADDR" ]; then
ip -4 addr add ${IP4ADDR} peer ${REMIP} dev ${DEVICE}
fi
fi
if is_yes "$IPV6_NETWORKING"; then
if [ -n "$IP6ADDR" ]; then
ip -6 addr add ${IP6ADDR} dev ${DEVICE}
fi
fi
# koncowka skryptu
if [ -n "$MTU" ]; then
ip link set ${DEVICE} mtu ${MTU} up
else
ip link set dev ${DEVICE} up
fi
# IPv4/6 gateways and default routes
setup_ip_gw_ro
#echo /etc/sysconfig/network-scripts/ifup-post $1
/etc/sysconfig/network-scripts/ifup-post $1
# This must be last line !
# vi:syntax=sh:tw=78:ts=8:sw=4
Więcej informacji o liście dyskusyjnej pld-rc-scripts