summaryrefslogtreecommitdiffstats
path: root/rc.inet1
diff options
context:
space:
mode:
Diffstat (limited to 'rc.inet1')
-rw-r--r--rc.inet121
1 files changed, 11 insertions, 10 deletions
diff --git a/rc.inet1 b/rc.inet1
index 5b3085c..c189573 100644
--- a/rc.inet1
+++ b/rc.inet1
@@ -123,15 +123,15 @@ if_up() {
fi
fi
if grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then # interface exists
- if ! /sbin/ifconfig | grep -w "${1}" 1>/dev/null || \
- ! /sbin/ifconfig ${1} | grep -w inet 1> /dev/null ; then # interface not up or not configured
+ if ! /sbin/ip addr show ${1} 2>/dev/null | grep -wq inet || \
+ ! /sbin/ip link show ${1} 2>/dev/null ; then # interface not up or not configured
if [ ! "${HWADDR[$i]}" = "" ]; then # Set hardware address _before_ the interface goes up:
- echo "/etc/rc.d/rc.inet1: /sbin/ifconfig ${1} hw ether ${HWADDR[$i]}" | $LOGGER
- /sbin/ifconfig ${1} hw ether ${HWADDR[$i]}
+ echo "/etc/rc.d/rc.inet1: /sbin/ip link set dev ${1} address ${HWADDR[$i]}" | $LOGGER
+ /sbin/ip link set dev ${1} address ${HWADDR[$i]}
fi
if [ ! "${MTU[$i]}" = "" ]; then # Set MTU to something else than 1500
- echo "/etc/rc.d/rc.inet1: /sbin/ifconfig ${1} mtu ${MTU[$i]}" | $LOGGER
- /sbin/ifconfig ${1} mtu ${MTU[$i]}
+ echo "/etc/rc.d/rc.inet1: /sbin/ip link set dev ${1} mtu ${MTU[$i]}" | $LOGGER
+ /sbin/ip link set dev ${1} mtu ${MTU[$i]}
fi
if [ -x /etc/rc.d/rc.wireless ]; then
. /etc/rc.d/rc.wireless ${1} start # Initialize any wireless parameters
@@ -155,9 +155,9 @@ if_up() {
# This is deactivated for now since the kernel has been returning incorrect
# results concerning whether the interface carrier is detected.
#if [ "${DHCP_TIMEOUT[$i]}" = "" ]; then
- # ifconfig ${1} up && sleep 1
+ # /sbin/ip link set dev ${1} up && sleep 1
# CONNSTATUS="$(cat /sys/class/net/${1}/carrier 2> /dev/null)"
- # ifconfig ${1} down
+ # /sbin/ip link set dev ${1} down
# if [ "$CONNSTATUS" = "0" ]; then
# # The kernel has just told us the cable isn't even plugged in, but we will
# # give any DHCP server a short chance to reply anyway:
@@ -172,10 +172,11 @@ if_up() {
else # bring up interface using a static IP address
if [ ! "${IPADDR[$i]}" = "" ]; then # skip unconfigured interfaces
# Determine broadcast address from the IP address and netmask:
+ # TODO: this seems unnecessary now... --rworkman
BROADCAST[$i]=`/bin/ipmask ${NETMASK[$i]} ${IPADDR[$i]}|cut -f1 -d' '`
# Set up the network card:
- echo "/etc/rc.d/rc.inet1: /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]}" | $LOGGER
- /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]}
+ echo "/etc/rc.d/rc.inet1: /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} dev ${1}" | $LOGGER
+ /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} dev ${1}
else
if [ "$DEBUG_ETH_UP" = "yes" ]; then
echo "/etc/rc.d/rc.inet1: ${1} interface is not configured in /etc/rc.d/rc.inet1.conf" | $LOGGER