aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile10
-rwxr-xr-xsysconfig/network-scripts/ifdown5
-rwxr-xr-xsysconfig/network-scripts/ifup35
-rwxr-xr-xsysconfig/network-scripts/ifup-post3
-rwxr-xr-xsysconfig/network-scripts/ifup-routes37
-rw-r--r--sysconfig/network-scripts/network-functions9
6 files changed, 49 insertions, 50 deletions
diff --git a/Makefile b/Makefile
index 31926b1d..aea26ec5 100644
--- a/Makefile
+++ b/Makefile
@@ -39,10 +39,12 @@ install:
chmod 755 $(ROOT)/etc/ppp/ip*
mkdir -p $(ROOT)/etc/sysconfig/networking/devices
mkdir -p $(ROOT)/etc/sysconfig/networking/profiles/default
- mv $(ROOT)/etc/sysconfig/network-scripts/ifcfg-lo \
- $(ROOT)/etc/sysconfig/networking
- ln -s ../networking/ifcfg-lo \
- $(ROOT)/etc/sysconfig/network-scripts/ifcfg-lo
+ #mv $(ROOT)/etc/sysconfig/network-scripts/ifcfg-lo \
+ # $(ROOT)/etc/sysconfig/networking/devices
+ #ln -s ../networking/devices/ifcfg-lo \
+ # $(ROOT)/etc/sysconfig/network-scripts/ifcfg-lo
+ #ln -s ../networking/devices/ifcfg-lo \
+ # $(ROOT)/etc/sysconfig/networking/profiles/default/ifcfg-lo
mkdir -p $(ROOT)/etc/sysconfig/console
if uname -m | grep -q s390 ; then \
install -m644 sysconfig/init.s390 $(ROOT)/etc/sysconfig/init ; \
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown
index 6f1be524..9493a24c 100755
--- a/sysconfig/network-scripts/ifdown
+++ b/sysconfig/network-scripts/ifdown
@@ -6,7 +6,6 @@ cd /etc/sysconfig/network-scripts
. network-functions
[ -f ../network ] && . ../network
-[ -f ../networking/network ] && . ../networking/network
CONFIG=$1
@@ -25,8 +24,8 @@ need_config $CONFIG
if [ $UID != 0 ]; then
if [ -x /usr/sbin/usernetctl ]; then
source_config
- if /usr/sbin/usernetctl ${DEVICE} report ; then
- exec /usr/sbin/usernetctl ${DEVICE} down
+ if /usr/sbin/usernetctl ${CONFIG} report ; then
+ exec /usr/sbin/usernetctl ${CONFIG} down
fi
fi
echo $"Users cannot control this device." >&2
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index e1d655b3..4cb7fd67 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -15,7 +15,6 @@ cd /etc/sysconfig/network-scripts
. network-functions
[ -f ../network ] && . ../network
-[ -f ../networking/network ] && . ../networking/network
CONFIG=${1}
@@ -35,8 +34,8 @@ need_config ${CONFIG}
if [ ${UID} != 0 ]; then
if [ -x /usr/sbin/usernetctl ]; then
source_config
- if /usr/sbin/usernetctl ${DEVICE} report ; then
- exec /usr/sbin/usernetctl ${DEVICE} up
+ if /usr/sbin/usernetctl ${CONFIG} report ; then
+ exec /usr/sbin/usernetctl ${CONFIG} up
fi
fi
echo $"Users cannot control this device." >&2
@@ -135,7 +134,7 @@ if [ "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ]; then
fi
if [ -x /sbin/ifup-pre-local ]; then
- /sbin/ifup-pre-local ${DEVICE}
+ /sbin/ifup-pre-local ${CONFIG} $2
fi
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-${DEVICETYPE}"
@@ -144,6 +143,24 @@ if [ -x ${OTHERSCRIPT} ]; then
exec ${OTHERSCRIPT} ${CONFIG} $2
fi
+# load the module associated with that device
+# /sbin/modprobe ${REALDEVICE}
+is_available ${REALDEVICE}
+
+# remap, if the device is bound with a MAC address and not the right device num
+# bail out, if the MAC does not fit
+if [ -n "${HWADDR}" ]; then
+ FOUNDMACADDR=`LC_ALL= LANG= ip -o link show ${REALDEVICE} | \
+ sed 's/.*link\/ether \([[:alnum:]:]*\).*/\1/'`
+ if [ "${FOUNDMACADDR}" != "${HWADDR}" ]; then
+ /sbin/nameif "${REALDEVICE}" "${HWADDR}" || {
+ echo $"Device ${DEVICE} has different MAC address than expected, ignoring."
+ exit 1
+ }
+ fi
+fi
+
+# now check the real state
is_available ${REALDEVICE} || {
if [ "$?" = "1" ] ; then
echo $"$alias device ${DEVICE} does not seem to be present, delaying initialization."
@@ -152,16 +169,6 @@ is_available ${REALDEVICE} || {
exit 0
fi
}
-if [ -n "${HWADDR}" ]; then
- FOUNDMACADDR=`LC_ALL= LANG= ip -o link show ${REALDEVICE} | \
- sed 's/.*link\/ether \([[:alnum:]:]*\).*/\1/'`
- if [ "${FOUNDMACADDR}" != "${HWADDR}" ]; then
- /sbin/nameif "${REALDEVICE}" "${HWADDR}" || {
- echo $"Device ${DEVICE} has different MAC address than expected, ignoring."
- exit 1
- }
- fi
-fi
# is the device wireless? If so, configure wireless device specifics
is_wireless_device ${DEVICE} && . ./ifup-wireless
diff --git a/sysconfig/network-scripts/ifup-post b/sysconfig/network-scripts/ifup-post
index 2fbafbfb..c6e9062b 100755
--- a/sysconfig/network-scripts/ifup-post
+++ b/sysconfig/network-scripts/ifup-post
@@ -4,7 +4,6 @@ cd /etc/sysconfig/network-scripts
. network-functions
[ -f ../network ] && . ../network
-[ -f ../networking/network ] && . ../networking/network
CONFIG=$1
source_config
@@ -21,7 +20,7 @@ if [ "$ISALIAS" = no ] ; then
/etc/sysconfig/network-scripts/ifup-aliases ${DEVICE} ${CONFIG}
fi
-/etc/sysconfig/network-scripts/ifup-routes ${DEVICE} ${NAME}
+/etc/sysconfig/network-scripts/ifup-routes ${DEVICE} ${DEVNAME}
if [ "$PEERDNS" != "no" -o -n "$RESOLV_MODS" -a "$RESOLV_MODS" != "no" ]; then
diff --git a/sysconfig/network-scripts/ifup-routes b/sysconfig/network-scripts/ifup-routes
index a1d1ae3b..5a11f4a7 100755
--- a/sysconfig/network-scripts/ifup-routes
+++ b/sysconfig/network-scripts/ifup-routes
@@ -2,7 +2,7 @@
#
# adds static routes which go through device $1
if [ -z "$1" ]; then
- echo $"usage: ifup-routes <net-device>"
+ echo $"usage: ifup-routes <net-device> [<nickname>]"
exit 1
fi
@@ -22,22 +22,19 @@ if [ -n "$2" -a "$2" != "$1" ]; then
fi
# Red Hat network configuration format
-
-CONFIG="/etc/sysconfig/networking/devices/$1.route"
-[ -f $CONFIG ] || CONFIG="/etc/sysconfig/networking/devices/$2.route"
-[ -f $CONFIG ] || exit 0
-
-. $CONFIG
-
-routenum=0
-while [ "x$(eval echo '$'ADDRESS$routenum)x" != "xx" ]; do
- eval `ipcalc -p $(eval echo '$'ADDRESS$routenum) $(eval echo '$'NETMASK$routenum)`
- line="$(eval echo '$'ADDRESS$routenum)/$PREFIX"
- if [ "x$(eval echo '$'GATEWAY$routenum)x" != "xx" ]; then
- line="$line via $(eval echo '$'GATEWAY$routenum)"
- fi
- line="$line dev $1"
- /sbin/ip route add $line
- routenum=$(($routenum+1))
-done
-
+NICK=${2:-$1}
+CONFIG="/etc/sysconfig/network-scripts/$NICK.route"
+if [ -f $CONFIG ]; then
+ . $CONFIG
+ routenum=0
+ while [ "x$(eval echo '$'ADDRESS$routenum)x" != "xx" ]; do
+ eval `ipcalc -p $(eval echo '$'ADDRESS$routenum) $(eval echo '$'NETMASK$routenum)`
+ line="$(eval echo '$'ADDRESS$routenum)/$PREFIX"
+ if [ "x$(eval echo '$'GATEWAY$routenum)x" != "xx" ]; then
+ line="$line via $(eval echo '$'GATEWAY$routenum)"
+ fi
+ line="$line dev $1"
+ /sbin/ip route add $line
+ routenum=$(($routenum+1))
+ done
+fi
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index d6deb549..d8c03a6e 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -9,13 +9,7 @@ export PATH
need_config ()
{
- CURRENT_PROFILE=${CURRENT_PROFILE:-default}
- CURRENT_PROFILE=${CURRENT_PROFILE##*/}
- CONFIG=../networking/profiles/$CURRENT_PROFILE/ifcfg-${1}
- [ -f "${CONFIG}" ] && return || CONFIG=../networking/profiles/$CURRENT_PROFILE/${1}
- [ -f "${CONFIG}" ] && return || CONFIG=../networking/default/ifcfg-${1}
- [ -f "${CONFIG}" ] && return || CONFIG=../networking/default/${1}
- [ -f "${CONFIG}" ] && return || CONFIG="ifcfg-${1}"
+ CONFIG="ifcfg-${1}"
[ -f "${CONFIG}" ] && return || CONFIG="${1}"
}
@@ -93,6 +87,7 @@ is_available ()
return 2
fi
modprobe $1 > /dev/null 2>&1 || return 1
+
LC_ALL= LANG= ip -o link | grep -q $1
return $?
}