aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/ifup-eth
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig/network-scripts/ifup-eth')
-rwxr-xr-xsysconfig/network-scripts/ifup-eth88
1 files changed, 44 insertions, 44 deletions
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth
index e51fdf53..9d62adfb 100755
--- a/sysconfig/network-scripts/ifup-eth
+++ b/sysconfig/network-scripts/ifup-eth
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
PATH=/sbin:/usr/sbin:/bin:/usr/bin
TEXTDOMAIN=initscripts
@@ -78,13 +78,8 @@ if [ "${TYPE}" = "Bridge" ]; then
done
fi
-# If the device is a tap device, create it with tunctl, if available.
+# Create tap device.
if [ "${TYPE}" = "Tap" ]; then
- if [ ! -x /usr/sbin/tunctl -a ! -x /usr/bin/tunctl ]; then
- net_log $"Tap support not available: tunctl not found"
- mdv-network-event connection_failure ${DEVICE}
- exit 1
- fi
# load the correct module if necessary (#54748)
if [ ! -c /dev/net/tun ]; then
if ! modprobe tun > /dev/null 2>&1; then
@@ -94,8 +89,10 @@ if [ "${TYPE}" = "Tap" ]; then
fi
fi
- [ -n "${OWNER}" ] && OWNER="-u ${OWNER}"
- tunctl ${OWNER} -t ${DEVICE} > /dev/null
+ [ -n "${OWNER}" ] && OWNER="user ${OWNER}"
+ TUNMODE="mode tap"
+ [[ ${DEVICE} == tun* ]] && TUNMODE="mode tun"
+ ip tuntap add ${TUNMODE} ${OWNER} dev ${DEVICE} > /dev/null
fi
# now check the real state
@@ -192,38 +189,15 @@ fi
# Bonding initialization. For DHCP, we need to enslave the devices early,
# so it can actually get an IP.
if [ "$ISALIAS" = no ] && is_bonding_device ${DEVICE} ; then
-
- /sbin/ip link set dev ${DEVICE} down
-
- # add the bits to setup driver parameters here
- for arg in $BONDING_OPTS ; do
- key=${arg%%=*};
- value=${arg##*=};
- if [ "${key}" = "arp_ip_target" -a "${value:0:1}" != "+" ]; then
- OLDIFS=$IFS;
- IFS=',';
- for arp_ip in $value; do
- if ! grep -q $arp_ip /sys/class/net/${DEVICE}/bonding/$key; then
- echo +$arp_ip > /sys/class/net/${DEVICE}/bonding/$key
- fi
- done
- IFS=$OLDIFS;
- elif [ "${key}" = "arp_ip_target" ]; then
- if ! grep -q ${value#+} /sys/class/net/${DEVICE}/bonding/$key; then
- echo "$value" > /sys/class/net/${DEVICE}/bonding/$key
- fi
- elif [ "${key}" != "primary" ]; then
- echo $value > /sys/class/net/${DEVICE}/bonding/$key
- fi
- done
-
+ install_bonding_driver ${DEVICE}
/sbin/ip link set dev ${DEVICE} up
- [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
- for device in $(LANG=C egrep -l "^[[:space:]]*MASTER=\"?${DEVICE}\"?[[:space:]]*$" /etc/sysconfig/network-scripts/ifcfg-*) ; do
+ for device in $(LANG=C grep -l "^[[:space:]]*MASTER=\"\?${DEVICE}\"\?\([[:space:]#]\|$\)" /etc/sysconfig/network-scripts/ifcfg-*) ; do
is_ignored_file "$device" && continue
/sbin/ifup ${device##*/}
done
+ [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
+
# add the bits to setup the needed post enslavement parameters
for arg in $BONDING_OPTS ; do
key=${arg%%=*};
@@ -382,6 +356,7 @@ if [ -n "${DYNCONFIG}" ]; then
if $DHCP_CLIENT $DHCP_ARGS ; then
mdv-network-event dhcp_success ${DEVICE}
echo $" done."
+ dhcpipv4="good"
else
mdv-network-event dhcp_failure ${DEVICE}
# Associate a zeroconf IP address to an alias of the interface
@@ -398,8 +373,15 @@ if [ -n "${DYNCONFIG}" ]; then
fi
mdv-network-event zcip_failure ${DEVICE}
echo $" failed."
- mdv-network-event connection_failure ${DEVICE}
- exit 1
+ if [[ "${IPV4_FAILURE_FATAL}" = [Yy1]* ]] ; then
+ mdv-network-event connection_failure ${DEVICE}
+ exit 1
+ fi
+ if [[ "$IPV6INIT" = [nN0]* || "$DHCPV6C" != [yY1]* ]] ; then
+ mdv-network-event connection_failure ${DEVICE}
+ exit 1
+ fi
+ net_log "Unable to obtain IPv4 DHCP address ${DEVICE}." warning
fi
# end dynamic device configuration
else
@@ -445,11 +427,13 @@ else
fi
if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${ipaddr[$idx]}/${prefix[$idx]}" ; then
- [ "${REALDEVICE}" != "lo" ] && [ "${arpcheck[$idx]}" != "no" ] && \
- if ! /sbin/arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${ipaddr[$idx]} ; then
- net_log $"Error, some other host already uses address ${ipaddr[$idx]}."
- mdv-network-event connection_failure ${DEVICE}
- exit 1
+ if [ "${REALDEVICE}" != "lo" ] && [ "${arpcheck[$idx]}" != "no" ] ; then
+ /sbin/arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${ipaddr[$idx]}
+ if [ $? = 1 ]; then
+ net_log $"Error, some other host already uses address ${ipaddr[$idx]}."
+ mdv-network-event connection_failure ${DEVICE}
+ exit 1
+ fi
fi
if ! ip addr add ${ipaddr[$idx]}/${prefix[$idx]} \
@@ -499,12 +483,28 @@ if [ "${NOZEROCONF}" != "yes" -a "${ISALIAS}" = "no" -a "${REALDEVICE}" != "lo"
ip route add 169.254.0.0/16 dev ${REALDEVICE} metric $((1000 + $(cat /sys/class/net/${REALDEVICE}/ifindex))) scope link
fi
+# Inform firewall which network zone (empty means default) this interface belongs to
+if [ -x /usr/bin/firewall-cmd -a "${REALDEVICE}" != "lo" ]; then
+ /usr/bin/firewall-cmd --zone="${ZONE}" --change-interface="${DEVICE}" > /dev/null 2>&1
+fi
+
# IPv6 initialisation?
/etc/sysconfig/network-scripts/ifup-ipv6 ${CONFIG}
if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -x /sbin/dhclient ]; then
generate_config_file_name 6
generate_lease_file_name 6
- /sbin/dhclient -6 -1 ${DHCPV6C_OPTIONS} ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient6-${DEVICE}.pid -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${DEVICE}
+ echo
+ echo -n $"Determining IPv6 information for ${DEVICE}..."
+ if /sbin/dhclient -6 -1 ${DHCPV6C_OPTIONS} ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient6-${DEVICE}.pid -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${DEVICE} ; then
+ echo $" done."
+ else
+ echo $" failed."
+ if [ "${dhcpipv4}" = "good" -o -n "${IPADDR}" ]; then
+ net_log "Unable to obtain IPv6 DHCP address ${DEVICE}." warning
+ else
+ exit 1
+ fi
+ fi
fi
if [ "${IPX}" = yes ]; then