aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--initscripts.spec7
-rw-r--r--src/Makefile1
-rwxr-xr-xsrc/ccw_init42
-rwxr-xr-xsysconfig/network-scripts/ifup-ctc2
-rw-r--r--sysconfig/network-scripts/network-functions37
-rw-r--r--udev/rules.d/55-ccw.rules1
6 files changed, 56 insertions, 34 deletions
diff --git a/initscripts.spec b/initscripts.spec
index f3e47f8c..b7efe818 100644
--- a/initscripts.spec
+++ b/initscripts.spec
@@ -48,7 +48,9 @@ make ROOT=$RPM_BUILD_ROOT SUPERUSER=`id -un` SUPERGROUP=`id -gn` mandir=%{_mandi
%ifnarch s390 s390x
rm -f \
$RPM_BUILD_ROOT/etc/sysconfig/network-scripts/ifup-ctc \
- $RPM_BUILD_ROOT/etc/sysconfig/network-scripts/ifup-iucv
+ $RPM_BUILD_ROOT/etc/sysconfig/network-scripts/ifup-iucv \
+ $RPM_BUILD_ROOT/etc/udev/rules.d/55-ccw.rules \
+ $RPM_BUILD_ROOT/lib/udev/ccw_init
%else
rm -f \
$RPM_BUILD_ROOT/etc/rc.d/rc.sysinit.s390init \
@@ -174,6 +176,9 @@ rm -rf $RPM_BUILD_ROOT
%attr(2755,root,root) /sbin/netreport
/sbin/initlog
/lib/udev/rename_device
+%ifarch s390 s390x
+/lib/udev/ccw_init
+%endif
/sbin/service
/sbin/ppp-watch
%{_mandir}/man*/*
diff --git a/src/Makefile b/src/Makefile
index 8228d6c3..5a6e171f 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -27,6 +27,7 @@ install:
install -m 755 ppp-watch $(ROOT)/sbin/ppp-watch
install -m 755 consoletype $(ROOT)/sbin/consoletype
install -m 755 rename_device $(ROOT)/lib/udev/rename_device
+ install -m 755 ccw_init $(ROOT)/lib/udev/ccw_init
install -m 644 initlog.1 $(ROOT)$(mandir)/man1
install -m 644 genhostid.1 $(ROOT)$(mandir)/man1
install -m 644 doexec.1 $(ROOT)$(mandir)/man1
diff --git a/src/ccw_init b/src/ccw_init
new file mode 100755
index 00000000..707ae009
--- /dev/null
+++ b/src/ccw_init
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+[ -z "$DEVPATH" ] && exit 0
+[ "$SUBSYSTEM" != "ccw" ] && exit 0
+
+. /etc/init.d/functions
+
+. /etc/sysconfig/network-scripts/network-functions
+
+# First, determine our channel
+
+CHANNEL=${DEVPATH##*/}
+
+CONFIG=$(get_config_by_subchannel $CHANNEL)
+
+cd /etc/sysconfig/network-scripts
+
+source_config
+
+# SUBCHANNELS is only set on mainframe ccwgroup devices
+[ -z "$SUBCHANNELS" -o -z "$NETTYPE" ] && return
+DIR="/sys/bus/ccwgroup/drivers/$NETTYPE"
+SYSDIR="$DIR/${SUBCHANNELS//,*/}"
+[ ! -e $DIR/group ] && return
+echo "$SUBCHANNELS" > $DIR/group
+if [ -n "$PORTNAME" ]; then
+ if [ "$NETTYPE" = "lcs" ]; then
+ [ -e $SYSDIR/portno ] && echo "$PORTNAME" > $SYSDIR/portno
+ else
+ [ -e $SYSDIR/portname ] && echo "$PORTNAME" > $SYSDIR/portname
+ fi
+fi
+if [ "$NETTYPE" = "ctc" -a -n "$CTCPROT" ]; then
+ echo "$CTCPROT" > $SYSDIR/protocol
+fi
+if [ -n "$OPTIONS" ]; then
+
+ for i in $OPTIONS; do
+ echo "${i//*=/}" > "$SYSDIR/${i//=*/}"
+ done
+fi
+[ -e $SYSDIR/online ] && echo 1 > $SYSDIR/online
diff --git a/sysconfig/network-scripts/ifup-ctc b/sysconfig/network-scripts/ifup-ctc
index 8c0317b1..514c102b 100755
--- a/sysconfig/network-scripts/ifup-ctc
+++ b/sysconfig/network-scripts/ifup-ctc
@@ -25,8 +25,6 @@ then
fi
[ -n "${MTU}" ] && opts="${opts} mtu ${MTU}"
-configure_ccwgroup_device
-
ifconfig ${DEVICE} ${IPADDR} ${opts} pointopoint ${GATEWAY} netmask ${NETMASK}
# Wait for the device to come up - the chandev'ified ctc driver can take
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index dacf1d22..5e1fa2a5 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -26,6 +26,12 @@ get_config_by_hwaddr ()
| LC_ALL=C sed -e "$__sed_discard_ignored_files"
}
+get_config_by_subchannel ()
+{
+ LANG=C grep -il "^[[:space:]]*SUBCHANNELS=${1}\([[:space:]#]\|$\|,\)" /etc/sysconfig/network-scripts/ifcfg-* \
+ | LC_ALL=C sed -e "$__sed_discard_ignored_files"
+}
+
get_device_by_hwaddr ()
{
LANG=C ip -o link | grep -v link/ieee802.11 | awk -F ': ' -vIGNORECASE=1 "/$1/ { print \$2 }"
@@ -227,9 +233,6 @@ END {
modprobe $1 > /dev/null 2>&1 || {
return 1
}
- # if it is a mainframe ccwgroup device, configure it before
- # trying to rename it:
- configure_ccwgroup_device
if [ -n "$HWADDR" ]; then
local curdev=`get_device_by_hwaddr "$HWADDR"`
if [ -z "$curdev" ]; then
@@ -387,34 +390,6 @@ is_bonding_device ()
return 1
}
-# Mainframe devices:
-configure_ccwgroup_device ()
-{
- local DIR SYSDIR
- # SUBCHANNELS is only set on mainframe ccwgroup devices
- [ -z "$SUBCHANNELS" -o -z "$NETTYPE" ] && return
- DIR="/sys/bus/ccwgroup/drivers/$NETTYPE"
- SYSDIR="$DIR/${SUBCHANNELS//,*/}"
- [ ! -e $DIR/group ] && return
- echo "$SUBCHANNELS" > $DIR/group
- if [ -n "$PORTNAME" ]; then
- if [ "$NETTYPE" = "lcs" ]; then
- [ -e $SYSDIR/portno ] && echo "$PORTNAME" > $SYSDIR/portno
- else
- [ -e $SYSDIR/portname ] && echo "$PORTNAME" > $SYSDIR/portname
- fi
- fi
- if [ "$NETTYPE" = "ctc" -a -n "$CTCPROT" ]; then
- echo "$CTCPROT" > $SYSDIR/protocol
- fi
- if [ -n "$OPTIONS" ]; then
- for i in $OPTIONS; do
- echo "${i//*=/}" > "$SYSDIR/${i//=*/}"
- done
- fi
- [ -e $SYSDIR/online ] && echo 1 > $SYSDIR/online
-}
-
# Invoke this when /etc/resolv.conf has changed:
change_resolv_conf ()
{
diff --git a/udev/rules.d/55-ccw.rules b/udev/rules.d/55-ccw.rules
new file mode 100644
index 00000000..d32f125a
--- /dev/null
+++ b/udev/rules.d/55-ccw.rules
@@ -0,0 +1 @@
+ACTION=="add", SUBSYSTEM=="ccw", RUN+="/lib/udev/ccw_init"