From c3ec5b11d80923cc54d1553b394b596db28e2704 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 27 Oct 2011 12:48:29 -0400 Subject: Don't set primary before we enslave devices. (#747418, ) --- sysconfig/network-scripts/ifup-eth | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index de6add11..5d2cff5c 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -133,7 +133,7 @@ if [ "$ISALIAS" = no ] && is_bonding_device ${DEVICE} ; then if ! grep -q ${value#+} /sys/class/net/${DEVICE}/bonding/$key; then echo "$value" > /sys/class/net/${DEVICE}/bonding/$key fi - else + elif [ "${key}" != "primary" ]; then echo $value > /sys/class/net/${DEVICE}/bonding/$key fi done -- cgit v1.2.1 From b5a510d2558d333624dac456790d667e3e7f0570 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 6 Jan 2012 17:04:30 -0500 Subject: Eviscerate ifconfig uses from ip-aliases, because it's deprecated, slow (#721010), and doesn't work on infiniband (#588993) Based on a patch from Travis Gummels (). --- sysconfig/network-scripts/ifup-aliases | 128 +++++++++++++-------------------- 1 file changed, 51 insertions(+), 77 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases index fc21c7b6..7ef7ccea 100755 --- a/sysconfig/network-scripts/ifup-aliases +++ b/sysconfig/network-scripts/ifup-aliases @@ -74,43 +74,42 @@ parent_device=$device cd /etc/sysconfig/network-scripts . ./network-functions -# Grab the current configuration of any running aliases device info is placed -# into variables in the form: rdev_$DEVICE_addr, dev_$DEVICE_mb and -# rdevip_$IPGLOP. A list of all the devices is created in rdev_LIST. - -eval $(LC_ALL= LANG= /sbin/ifconfig | LC_ALL=C sed -n ' -# Alias name: store the number in TMP, ignore the following address if the -# device name does not match. This may leave a hanging ||, so dummy X=x -# comands are used to ignore a possible previous condition. -/^[^[:space:]]*:[0-9A-Za-z_]*/ { - s|^\([^:]*\):\([0-9A-Za-z_]*\).*$|X=x; TMP="\2"; [ "$device" != "\1" ] \|\| |p - b -} -# Non-alias device: always ignore the following address -/^[^[:space:]]/ { - s|^.*$|X=x; true \|\| |p - b -} -# Address: Preceded by a device name, which was converted into -# condition || -# So this triggers only for $device. -# Add a trailing || (which will be swallowed by X=x) to keep the syntax -# correct. -/inet addr:[0-9]*\.[0-9]*\.[0-9]*\.[0-9]* *Bcast:[0-9.]* *Mask:[0-9.]*/ { - s|^.*inet addr:\(\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\) *Bcast:\([0-9.]*\) *Mask:\([0-9.]*\).*$|eval "rdev_${TMP}_addr=\1; rdev_${TMP}_mb=\7_\6; rdevip_\2_\3_\4_\5=${TMP}; rdev_LIST=\\"\\$rdev_LIST \\${TMP}\\"; " \|\| |p - b -}') X=x - -if [ -z "$rdev_LIST" ]; then - no_devices_are_up=yes -fi +# Grab the current configuration of any running aliases, place device info +# into variables of the form: +# rdev__addr = +# rdev__pb = _ +# rdevip_ = +# Example: +# rdev_0_addr=192.168.1.1 +# rdev_0_pb=24_192.16.1.255 +# rdevip_192_168_1_1=0 +# +# A list of all the devices is created in rdev_LIST. + +OLDIFS=$IFS +IFS='\n' + +for RDEV_VAR in $( ip addr show $device label $device:* | \ + awk 'BEGIN { COUNT=0;LAST_DEV="" } /inet / { +# Split IP address into address/prefix + split($2,IPADDR,"/"); +# Create A_B_C_D IP address form + IP_ADDR=IPADDR[1]; + gsub(/\./,"_",IP_ADDR); +# Split device into device:index + split($NF,DEV,":"); +# Update last device + LAST_DEV=LAST_DEV " " DEV[2]; + printf("rdev_%s_addr=%s\nrdevip_%s=%s\nrdev_%s_pb=%s_%s\nrdev_LIST=\"%s\"\n", + DEV[2],IPADDR[1],IP_ADDR,DEV[2],DEV[2],IPADDR[2],$4,LAST_DEV); + } END { + if(LAST_DEV == "") print "no_devices_are_up=yes" + }' ); +do + eval $RDEV_VAR +done -##for DEVNUM in $rdev_LIST ; do -##eval " -##echo \"rdev_${DEVNUM}_addr = \$rdev_${DEVNUM}_addr\" -##echo \"rdev_${DEVNUM}_mb = \$rdev_${DEVNUM}_mb\" "; -##done -##echo ""; echo "-----"; echo "" +IFS=$OLDIFS # # Store configuration of the parent device and network @@ -130,6 +129,7 @@ eval ` ( } eval ` ( . ./$PARENTCONFIG; + echo default_PREFIX=$PREFIX\;; echo default_NETMASK=$NETMASK\;; echo default_BROADCAST=$BROADCAST\;; echo default_GATEWAY=$GATEWAY\;; @@ -141,6 +141,7 @@ function ini_env () { DEVICE="" IPADDR="" + PREFIX=$default_PREFIX NETMASK=$default_NETMASK BROADCAST=$default_BROADCAST GATEWAY=$default_GATEWAY @@ -193,37 +194,17 @@ function new_interface () return 1 fi - if [ -z "$NETMASK" ]; then - eval $(/bin/ipcalc --netmask ${IPADDR}) + if [ -z "$NETMASK" -a -z "$PREFIX" ]; then + net_log $"error iN $FILE: didn't specify netmask or prefix" fi - if [ -z "$BROADCAST" -o "$BROADCAST" = "$default_BROADCAST" ]; then - eval $(/bin/ipcalc --broadcast ${IPADDR} ${NETMASK}) - nma=$NETMASK; nmb=${nma#*.}; nmc=${nmb#*.}; - NMGLOP="${nma%%.*}_${nmb%%.*}_${nmc%%.*}_${nmc#*.}"; - if [ ${nma%%.*} -eq 0 ]; then ipnm_a=0; else ipnm_a=${ipa%%.*}; fi - if [ ${nmb%%.*} -eq 0 ]; then ipnm_b=0; else ipnm_b=${ipb%%.*}; fi - if [ ${nmc%%.*} -eq 0 ]; then ipnm_c=0; else ipnm_c=${ipc%%.*}; fi - if [ ${nmc#*.} -eq 0 ]; then ipnm_d=0; else ipnm_d=${ipc#*.}; fi - CACHENAME="${NMGLOP}_${ipnm_a}_${ipnm_b}_${ipnm_c}_${ipnm_d}" - eval " - if [ -z \"\$bcastcache_${CACHENAME}\" ]; then - eval $(/bin/ipcalc --broadcast $IPADDR $NETMASK) - bcastcache_${CACHENAME}=\$BROADCAST - else - BROADCAST=\$bcastcache_${CACHENAME} - fi - "; + if [ -z "$PREFIX" ]; then + eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK}) fi -##echo ""; -##echo "----------------------------" -##echo "device = $DEVICE" -##echo "ipaddr = $IPADDR" -##echo "netmask = $NETMASK" -##echo "broadcast = $BROADCAST" -##echo "devnum = $DEVNUM"; -##echo ""; + if [ -z "$BROADCAST" -o "$BROADCAST" = "$default_BROADCAST" ]; then + eval $(/bin/ipcalc --broadcast ${IPADDR}/${PREFIX}) + fi if [ "$no_devices_are_up" = "yes" ]; then setup_this=yes @@ -233,7 +214,7 @@ function new_interface () eval " rdev_addr=\$rdev_${DEVNUM}_addr; - rdev_mb=\$rdev_${DEVNUM}_mb; + rdev_pb=\$rdev_${DEVNUM}_pb; rdev_mark=\$rdev_${DEVNUM}_mark; rdevip=\$rdevip_${IPGLOP}; "; @@ -241,15 +222,14 @@ function new_interface () if [ -n "$rdev_addr" ]; then if [ "$rdev_addr" = "${IPADDR}" ]; then newmark=keep - if [ "$rdev_mb" != "${NETMASK}_${BROADCAST}" ]; then + if [ "$rdev_pb" != "${PREFIX}_${BROADCAST}" ]; then setup_this=freshen else setup_this=no fi else if [ "$rdev_mark" != "remove" ]; then -##echo "removing device $parent_device:${DEVNUM} (devnum conflict)" - /sbin/ifconfig $parent_device:${DEVNUM} down + /sbin/ip addr flush dev $parent_device label $parent_device:${DEVNUM} do_netreport=yes fi newmark=remove @@ -272,8 +252,7 @@ function new_interface () fi if [ "$mark_remove" != "remove" ]; then eval " rdev_${rdevip}_mark=remove "; -##echo "removing device $parent_device:$rdevip (ipaddr conflict)" - /sbin/ifconfig $parent_device:$rdevip down + /sbin/ip addr flush dev $parent_device label $parent_device:$rdevip do_netreport=yes fi fi @@ -282,15 +261,11 @@ function new_interface () if [ "$setup_this" = "freshen" ] ; then # we can do the freshen stuff right now -##echo "freshening device $DEVICE" - /sbin/ifconfig $DEVICE netmask $NETMASK broadcast $BROADCAST; + /sbin/ip addr change ${IPADDR}/${PREFIX} brd ${BROADCAST} fi if [ "$setup_this" = "yes" ] ; then - -##echo "setting up device $DEVICE" - - /sbin/ifconfig ${DEVICE} ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST} + /sbin/ip addr add ${IPADDR}/${PREFIX} brd ${BROADCAST} dev ${parent_device} label ${DEVICE} [ "$IPV6INIT" = "yes" ] && /etc/sysconfig/network-scripts/ifup-ipv6 ${DEVICE} @@ -365,8 +340,7 @@ done for DEVNUM in $rdev_LIST ; do eval " rdev_mark=\$rdev_${DEVNUM}_mark "; if [ -z "$rdev_mark" ]; then - ##echo "removing device $parent_device:${DEVNUM} (lingering)" - /sbin/ifconfig $parent_device:${DEVNUM} down + /sbin/ip addr flush dev $parent_device label $parent_device:${DEVNUM} do_netreport=yes fi done -- cgit v1.2.1 From 6f6830b700f33172e33db32f12e9bfef3a7f7989 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 6 Jan 2012 17:38:26 -0500 Subject: Remove ifconfig usage from assorted ancient device types. --- sysconfig/network-scripts/ifup-ctc | 7 ++++--- sysconfig/network-scripts/ifup-ippp | 11 +++++++---- sysconfig/network-scripts/ifup-plip | 12 ++++-------- sysconfig/network-scripts/ifup-plusb | 8 +++++--- 4 files changed, 20 insertions(+), 18 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifup-ctc b/sysconfig/network-scripts/ifup-ctc index e268d7cc..1a1aec5d 100755 --- a/sysconfig/network-scripts/ifup-ctc +++ b/sysconfig/network-scripts/ifup-ctc @@ -23,10 +23,11 @@ if [ "$2" = "boot" -a "${ONBOOT}" = "no" ] then exit fi -[ -n "${MTU}" ] && opts="${opts} mtu ${MTU}" - -ifconfig ${DEVICE} ${IPADDR} ${opts} pointopoint ${GATEWAY} netmask ${NETMASK} +[ -n "${MTU}" ] && ip link set dev ${DEVICE} mtu ${MTU} +[ -z "$PREFIX" ] && eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK}) +ip addr add ${IPADDR} peer ${GATEWAY}/${PREFIX} dev ${DEVICE} +ip link set up dev ${DEVICE} # Wait for the device to come up - the chandev'ified ctc driver can take # quite a while... timeout=0 diff --git a/sysconfig/network-scripts/ifup-ippp b/sysconfig/network-scripts/ifup-ippp index 7cfe6f39..6ab69117 100755 --- a/sysconfig/network-scripts/ifup-ippp +++ b/sysconfig/network-scripts/ifup-ippp @@ -335,11 +335,14 @@ function addprovider() [ "$DEBUG" = "yes" ] && options="-d $options" # set netmask, if available - [ -n "$NETMASK" ] && netmask="netmask $NETMASK" - + [ -n "$NETMASK" ] && { + val=$(ipcalc --prefix $IPADDR $NETMASK) + pfx=${val##PREFIX=} + } # activate ISDN device - /usr/bin/logger -p daemon.info -t ifup-ippp "ifconfig $DEVICE $IPADDR pointopoint $GATEWAY $netmask up" - ifconfig $DEVICE $IPADDR pointopoint $GATEWAY $netmask up >/dev/null 2>&1 + /usr/bin/logger -p daemon.info -t ifup-ippp "ip addr add $IPADDR peer $GATEWAY${pfx:/$pfx} dev $DEVICE" + ip addr add $IPADDR peer $GATEWAY${pfx:/$pfx} dev $DEVICE + ip link set dev $DEVICE up if [ "$ENCAP" = "syncppp" ]; then # start ipppd daemon diff --git a/sysconfig/network-scripts/ifup-plip b/sysconfig/network-scripts/ifup-plip index 48bcc2ca..7f4f521e 100755 --- a/sysconfig/network-scripts/ifup-plip +++ b/sysconfig/network-scripts/ifup-plip @@ -11,14 +11,10 @@ then exit fi -ifconfig ${DEVICE} ${IPADDR} pointopoint ${REMIP} -route add -net ${NETWORK} netmask ${NETMASK} ${DEVICE} - -# this is broken! it's only here to keep compatibility with old RH systems -if [ "${GATEWAY}" != "" -a "${GATEWAY}" != "none" ] -then - route add default gw ${GATEWAY} metric ${METRIC:-1} ${DEVICE} -fi +[ -z "$PREFIX" ] && eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK}) +ip addr add ${IPADDR} peer ${REMIP}/${PREFIX} dev ${DEVICE} +ip link set up dev ${DEVICE} +ip route add ${NETWORK} dev ${DEVICE} . /etc/sysconfig/network diff --git a/sysconfig/network-scripts/ifup-plusb b/sysconfig/network-scripts/ifup-plusb index e185e647..7f8f4649 100755 --- a/sysconfig/network-scripts/ifup-plusb +++ b/sysconfig/network-scripts/ifup-plusb @@ -22,12 +22,14 @@ then exit fi +[ -z "$PREFIX" ] && eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK}) + if [ ${BROADCAST} != "" ] ; then - ifconfig ${DEVICE} ${IPADDR} pointopoint ${REMIP} netmask ${NETMASK} -broadcast ${BROADCAST} + ip addr add ${IPADDR} peer ${REMIP}/${PREFIX} broadcast ${BROADCAST} dev ${DEVICE} else - ifconfig ${DEVICE} ${IPADDR} pointopoint ${REMIP} netmask ${NETMASK} + ip addr add ${IPADDR} peer ${REMIP}/${PREFIX} dev ${DEVICE} fi +ip link set up dev ${DEVICE} . /etc/sysconfig/network -- cgit v1.2.1 From 987cc20e486e5568031f77d04a85e3ca1b732377 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 1 Feb 2012 12:34:54 -0500 Subject: Allow for ifup-$TYPE/ifdown-$TYPE as well. This allows extending scripts without having to modifiy the case statement in network-functions each time. --- sysconfig/network-scripts/ifdown | 4 ++++ sysconfig/network-scripts/ifup | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown index db045da4..f2c13086 100755 --- a/sysconfig/network-scripts/ifdown +++ b/sysconfig/network-scripts/ifdown @@ -58,6 +58,10 @@ fi OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-${DEVICETYPE}" if [ ! -x ${OTHERSCRIPT} ]; then + OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-${TYPE}" +fi + +if [ ! - x ${OTHERSCRIPT} ]; then OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-eth" fi diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index f2980b39..62564224 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -139,6 +139,10 @@ fi OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-${DEVICETYPE}" if [ ! -x ${OTHERSCRIPT} ]; then + OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-${TYPE}" +fi + +if [ ! - x ${OTHERSCRIPT} ]; then OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-eth" fi -- cgit v1.2.1 From a93d20bb3604bed86e3d1bb74513e428b21242cd Mon Sep 17 00:00:00 2001 From: Will Woods Date: Thu, 8 Mar 2012 15:13:02 -0500 Subject: Use /run/initramfs instead of /dev/.initramfs Current dracut saves state to /run/initramfs, since /run is standard now. This patch makes rc.sysinit and fedora-readonly check for files in /run/initramfs/rwtab and /run/initramfs/state (which is where dracut writes them). It also makes ifup-eth look for lease files in /run/initramfs. --- sysconfig/network-scripts/ifup-eth | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index 5d2cff5c..3037941e 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -193,7 +193,7 @@ if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then DHCLIENTCONF=''; fi; # copy any lease obtained by the initrd - for file in /dev/.dhclient-${DEVICE}.leases /dev/.initramfs/net.${DEVICE}.lease /run/initramfs/net.${DEVICE}.lease; do + for file in /run/initramfs/net.${DEVICE}.lease; do if [ -f "${file}" ]; then mv -f $file /var/lib/dhclient/dhclient-${DEVICE}.leases [ -x /sbin/restorecon ] && restorecon /var/lib/dhclient/dhclient-${DEVICE}.leases > /dev/null 2>&1 -- cgit v1.2.1 From 2858dfa0b9b2c56dad8d46d5ff9aabe05a67c870 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 8 Mar 2012 15:44:52 -0500 Subject: Lease files are now copied at boot by a systemd service; don't copy them here. --- sysconfig/network-scripts/ifup-eth | 7 ------- 1 file changed, 7 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index 3037941e..335394f8 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -192,13 +192,6 @@ if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then else DHCLIENTCONF=''; fi; - # copy any lease obtained by the initrd - for file in /run/initramfs/net.${DEVICE}.lease; do - if [ -f "${file}" ]; then - mv -f $file /var/lib/dhclient/dhclient-${DEVICE}.leases - [ -x /sbin/restorecon ] && restorecon /var/lib/dhclient/dhclient-${DEVICE}.leases > /dev/null 2>&1 - fi - done DHCLIENTARGS="${DHCLIENTARGS} -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${ONESHOT} -q ${DHCLIENTCONF} -lf /var/lib/dhclient/dhclient-${DEVICE}.leases -pf /var/run/dhclient-${DEVICE}.pid" echo echo -n $"Determining IP information for ${DEVICE}..." -- cgit v1.2.1 From 60b84547c03ec7d82633f3c9d6939af4747a6bff Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 9 Mar 2012 11:18:10 -0500 Subject: Use NetworkManager-compatible lease file names by default. --- sysconfig/network-scripts/ifdown-eth | 3 ++- sysconfig/network-scripts/ifup-eth | 6 ++++-- sysconfig/network-scripts/network-functions | 9 +++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth index fcbae80e..e120af76 100755 --- a/sysconfig/network-scripts/ifdown-eth +++ b/sysconfig/network-scripts/ifdown-eth @@ -86,8 +86,9 @@ retcode=0 for VER in "" 6 ; do if [ -f "/var/run/dhclient$VER-${DEVICE}.pid" ]; then dhcpid=$(cat /var/run/dhclient$VER-${DEVICE}.pid) + generate_lease_file_name $VER if [[ "$DHCPRELEASE" = [yY1]* ]]; then - /sbin/dhclient -r -lf /var/lib/dhclient/dhclient$VER-${DEVICE}.leases -pf /var/run/dhclient$VER-${DEVICE}.pid ${DEVICE} >/dev/null 2>&1 + /sbin/dhclient -r -lf ${LEASEFILE} -pf /var/run/dhclient$VER-${DEVICE}.pid ${DEVICE} >/dev/null 2>&1 retcode=$? else kill $dhcpid >/dev/null 2>&1 diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index 335394f8..9d926f23 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -192,7 +192,8 @@ if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then else DHCLIENTCONF=''; fi; - DHCLIENTARGS="${DHCLIENTARGS} -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${ONESHOT} -q ${DHCLIENTCONF} -lf /var/lib/dhclient/dhclient-${DEVICE}.leases -pf /var/run/dhclient-${DEVICE}.pid" + generate_lease_file_name + DHCLIENTARGS="${DHCLIENTARGS} -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${ONESHOT} -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient-${DEVICE}.pid" echo echo -n $"Determining IP information for ${DEVICE}..." if [[ "${PERSISTENT_DHCLIENT}" != [yY1]* ]] && check_link_down ${DEVICE}; then @@ -299,7 +300,8 @@ fi # IPv6 initialisation? /etc/sysconfig/network-scripts/ifup-ipv6 ${CONFIG} if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -x /sbin/dhclient ]; then - /sbin/dhclient -6 -1 ${DHCPV6C_OPTIONS} -lf /var/lib/dhclient/dhclient6-${DEVICE}.leases -pf /var/run/dhclient6-${DEVICE}.pid -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${DEVICE} + generate_lease_file_name 6 + /sbin/dhclient -6 -1 ${DHCPV6C_OPTIONS} -lf ${LEASEFILE} -pf /var/run/dhclient6-${DEVICE}.pid -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${DEVICE} fi if [ "${IPX}" = yes ]; then diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index f6d2f05b..6402a7dc 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -59,6 +59,15 @@ get_uuid_by_config () dbus-send --system --print-reply --dest=com.redhat.ifcfgrh1 /com/redhat/ifcfgrh1 com.redhat.ifcfgrh1.GetIfcfgDetails string:"/etc/sysconfig/network-scripts/$1" 2>/dev/null | awk -F '"' '/string / { print $2 }' } +generate_lease_file_name () { + local ver=$1 + LEASEFILE="/var/lib/dhclient/dhclient$ver-${DEVICE}.leases" + if [ -f $LEASEFILE ]; then + return + fi + LEASEFILE="/var/lib/dhclient/dhclient$ver-${UUID}-${DEVICE}.lease" +} + need_config () { local nconfig -- cgit v1.2.1 From a54ce5d02861745ffcf5dbc6409950a22c7c65a2 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 12 Mar 2012 10:03:14 -0400 Subject: Fix typo. (#802055, ) --- sysconfig/network-scripts/ifdown | 2 +- sysconfig/network-scripts/ifup | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown index f2c13086..70f54720 100755 --- a/sysconfig/network-scripts/ifdown +++ b/sysconfig/network-scripts/ifdown @@ -61,7 +61,7 @@ if [ ! -x ${OTHERSCRIPT} ]; then OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-${TYPE}" fi -if [ ! - x ${OTHERSCRIPT} ]; then +if [ ! -x ${OTHERSCRIPT} ]; then OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-eth" fi diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index 62564224..f5ac0fe0 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -142,7 +142,7 @@ if [ ! -x ${OTHERSCRIPT} ]; then OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-${TYPE}" fi -if [ ! - x ${OTHERSCRIPT} ]; then +if [ ! -x ${OTHERSCRIPT} ]; then OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-eth" fi -- cgit v1.2.1 From 6ddce805ccecb7f02a31a413c501217336e3791a Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 12 Mar 2012 12:42:43 -0400 Subject: Fix IFS usage mangling device names (#802119) --- sysconfig/network-scripts/ifup-aliases | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases index 7ef7ccea..16005cbd 100755 --- a/sysconfig/network-scripts/ifup-aliases +++ b/sysconfig/network-scripts/ifup-aliases @@ -86,10 +86,7 @@ cd /etc/sysconfig/network-scripts # # A list of all the devices is created in rdev_LIST. -OLDIFS=$IFS -IFS='\n' - -for RDEV_VAR in $( ip addr show $device label $device:* | \ +eval $( ip addr show $device label $device:* | \ awk 'BEGIN { COUNT=0;LAST_DEV="" } /inet / { # Split IP address into address/prefix split($2,IPADDR,"/"); @@ -105,11 +102,6 @@ for RDEV_VAR in $( ip addr show $device label $device:* | \ } END { if(LAST_DEV == "") print "no_devices_are_up=yes" }' ); -do - eval $RDEV_VAR -done - -IFS=$OLDIFS # # Store configuration of the parent device and network -- cgit v1.2.1 From bf931d4f660af978eef8652ad275fcb7bab0e749 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 13 Mar 2012 17:26:07 -0400 Subject: Add support for firewalld zones. (#802415, from ) ZONE in an ifcfg file describes the zone an interface should belong to. Zones can be configured in the firewalld configuration file. When interfaces are brought up, tell firewalld, if running, to add them to the proper zone. Similarly, remove them when they're brought down. Modified from a patch from Jiri Popelka. --- sysconfig/network-scripts/ifdown-post | 5 +++++ sysconfig/network-scripts/ifup-post | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifdown-post b/sysconfig/network-scripts/ifdown-post index 0a1b938a..d37b59da 100755 --- a/sysconfig/network-scripts/ifdown-post +++ b/sysconfig/network-scripts/ifdown-post @@ -46,6 +46,11 @@ if ! check_default_route ; then fi fi +# Inform firewall +if [ -x /usr/bin/firewall-cmd -a "${REALDEVICE}" != "lo" ]; then + /usr/bin/firewall-cmd --remove --interface=${DEVICE} > /dev/null 2>&1 +fi + # Notify programs that have requested notification do_netreport diff --git a/sysconfig/network-scripts/ifup-post b/sysconfig/network-scripts/ifup-post index 29af56b7..fec96c88 100755 --- a/sysconfig/network-scripts/ifup-post +++ b/sysconfig/network-scripts/ifup-post @@ -93,6 +93,11 @@ if [ "$2" = "boot" -a \ fi 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 + # Notify programs that have requested notification do_netreport -- cgit v1.2.1 From 29a948d09bb453b9dab923f741f1672912e0eaac Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 16 Mar 2012 09:59:56 -0400 Subject: Add quotes to device/zone in the firewalld support. --- sysconfig/network-scripts/ifdown-post | 2 +- sysconfig/network-scripts/ifup-post | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifdown-post b/sysconfig/network-scripts/ifdown-post index d37b59da..68354dea 100755 --- a/sysconfig/network-scripts/ifdown-post +++ b/sysconfig/network-scripts/ifdown-post @@ -48,7 +48,7 @@ fi # Inform firewall if [ -x /usr/bin/firewall-cmd -a "${REALDEVICE}" != "lo" ]; then - /usr/bin/firewall-cmd --remove --interface=${DEVICE} > /dev/null 2>&1 + /usr/bin/firewall-cmd --remove --interface="${DEVICE}" > /dev/null 2>&1 fi # Notify programs that have requested notification diff --git a/sysconfig/network-scripts/ifup-post b/sysconfig/network-scripts/ifup-post index fec96c88..1ebb9c21 100755 --- a/sysconfig/network-scripts/ifup-post +++ b/sysconfig/network-scripts/ifup-post @@ -1,4 +1,4 @@ -#!/bin/sh + cd /etc/sysconfig/network-scripts . ./network-functions @@ -95,7 +95,7 @@ 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 + /usr/bin/firewall-cmd --zone="${ZONE}" --change --interface="${DEVICE}" > /dev/null 2>&1 fi # Notify programs that have requested notification -- cgit v1.2.1 From c1d21f7c44405f0fd8bf5d18e6465a49177c070b Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 20 Apr 2012 14:13:37 -0400 Subject: Remove some more uses of /sbin/route ; replace with /sbin/ip. (#682308) --- sysconfig/network-scripts/ifup-aliases | 8 +++----- sysconfig/network-scripts/ifup-ctc | 4 ++-- sysconfig/network-scripts/ifup-ippp | 7 ++----- sysconfig/network-scripts/ifup-plip | 2 +- sysconfig/network-scripts/ifup-plusb | 2 +- 5 files changed, 9 insertions(+), 14 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases index 16005cbd..a647044f 100755 --- a/sysconfig/network-scripts/ifup-aliases +++ b/sysconfig/network-scripts/ifup-aliases @@ -143,9 +143,8 @@ function ini_env () function is_default_gateway () { - LC_ALL=C /sbin/route -n \ - | awk '$1 == "0.0.0.0" && $2 == "'"$1"'" { found = 1; } - END { exit found == 0; }' + LC_ALL=C /sbin/ip route ls default scope global \ + | awk '$3 == "'"$1"'" { found = 1; } END { exit found == 0; }' } # @@ -269,8 +268,7 @@ function new_interface () \( -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${DEVICE}" \) ]; then # set up default gateway, if it isn't already there if ! is_default_gateway "$GATEWAY"; then - route add default gw ${GATEWAY} \ - ${METRIC:+metric $METRIC} ${DEVICE} + ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY} dev ${DEVICE} fi fi diff --git a/sysconfig/network-scripts/ifup-ctc b/sysconfig/network-scripts/ifup-ctc index 1a1aec5d..39d6a09c 100755 --- a/sysconfig/network-scripts/ifup-ctc +++ b/sysconfig/network-scripts/ifup-ctc @@ -40,13 +40,13 @@ while ! ping -w 30 -c 1 ${GATEWAY} &>/dev/null; do done if [ "${NETWORK}" != "" ] ; then - route add -host ${GATEWAY} metric 1 ${DEVICE} + ip route add to ${GATEWAY} metric 1 dev ${DEVICE} fi if [ "${GATEWAY}" != "" ]; then if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then # set up default gateway - route add default gw ${GATEWAY} ${METRIC:+metric $METRIC} + ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY} fi fi diff --git a/sysconfig/network-scripts/ifup-ippp b/sysconfig/network-scripts/ifup-ippp index 6ab69117..3ba93328 100755 --- a/sysconfig/network-scripts/ifup-ippp +++ b/sysconfig/network-scripts/ifup-ippp @@ -359,13 +359,10 @@ function addprovider() if [ "$DIALMODE" = "auto" ] ; then echo 1 > /proc/sys/net/ipv4/ip_dynaddr if [ "$DEFROUTE" = "yes" ] ; then - route del default >/dev/null 2>&1 if [ "$GATEWAY" = "0.0.0.0" ]; then - route add default ${METRIC:+metric $METRIC} $DEVICE \ - >/dev/null 2>&1 + ip route replace default ${METRIC:+metric $METRIC} dev ${DEVICE} >/dev/null 2>&1 else - route add default gw $GATEWAY ${METRIC:+metric $METRIC} \ - >/dev/null 2>&1 + ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY} dev ${DEVICE} >/dev/null 2>&1 fi fi fi diff --git a/sysconfig/network-scripts/ifup-plip b/sysconfig/network-scripts/ifup-plip index 7f4f521e..c3b9efa1 100755 --- a/sysconfig/network-scripts/ifup-plip +++ b/sysconfig/network-scripts/ifup-plip @@ -21,7 +21,7 @@ ip route add ${NETWORK} dev ${DEVICE} if [ "${GATEWAY}" != "" ]; then if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then # set up default gateway - route add default gw ${GATEWAY} ${METRIC:+metric $METRIC} + ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY} fi fi diff --git a/sysconfig/network-scripts/ifup-plusb b/sysconfig/network-scripts/ifup-plusb index 7f8f4649..ce5a0321 100755 --- a/sysconfig/network-scripts/ifup-plusb +++ b/sysconfig/network-scripts/ifup-plusb @@ -36,7 +36,7 @@ ip link set up dev ${DEVICE} if [ "${GATEWAY}" != "" ]; then if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then # set up default gateway - route add default gw ${GATEWAY} ${METRIC:+metric $METRIC} + ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY} fi fi -- cgit v1.2.1 From 4920ccfbb5f232488f79422943dfdcac1efc5301 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 24 Apr 2012 14:37:48 -0400 Subject: Allow dhclient configuration files for DHCPv6 as well. (#815676) --- sysconfig/network-scripts/ifup-eth | 13 +++---------- sysconfig/network-scripts/network-functions | 11 +++++++++++ 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index 9d926f23..a43d04e7 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -183,15 +183,7 @@ if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then else ONESHOT="-1"; fi; - # allow users to use generic '/etc/dhcp/dhclient.conf' (as documented in manpage!) - # if per-device file doesn't exist or is empty - if [ -s /etc/dhcp/dhclient-${DEVICE}.conf ]; then - DHCLIENTCONF="-cf /etc/dhcp/dhclient-${DEVICE}.conf"; - elif [ -s /etc/dhclient-${DEVICE}.conf ]; then - DHCLIENTCONF="-cf /etc/dhclient-${DEVICE}.conf"; - else - DHCLIENTCONF=''; - fi; + generate_config_file_name generate_lease_file_name DHCLIENTARGS="${DHCLIENTARGS} -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${ONESHOT} -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient-${DEVICE}.pid" echo @@ -300,8 +292,9 @@ 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} -lf ${LEASEFILE} -pf /var/run/dhclient6-${DEVICE}.pid -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${DEVICE} + /sbin/dhclient -6 -1 ${DHCPV6C_OPTIONS} ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient6-${DEVICE}.pid -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${DEVICE} fi if [ "${IPX}" = yes ]; then diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 6402a7dc..044f1ea1 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -68,6 +68,17 @@ generate_lease_file_name () { LEASEFILE="/var/lib/dhclient/dhclient$ver-${UUID}-${DEVICE}.lease" } +generate_config_file_name () { + local ver=$1 + if [ -s /etc/dhcp/dhclient$ver-${DEVICE}.conf ]; then + DHCLIENTCONF="-cf /etc/dhcp/dhclient$ver-${DEVICE}.conf"; + elif [ -s /etc/dhclient$ver-${DEVICE}.conf ]; then + DHCLIENTCONF="-cf /etc/dhclient$ver-${DEVICE}.conf"; + else + DHCLIENTCONF=''; + fi +} + need_config () { local nconfig -- cgit v1.2.1 From d1256a2ab6187b2c8696b25697f41a87c736de1b Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 30 Apr 2012 14:03:50 -0400 Subject: Rename internal tracking variable USE_NM to _use_nm, to more clearly state it's not for configuration use. --- sysconfig/network-scripts/ifdown | 2 +- sysconfig/network-scripts/ifup | 2 +- sysconfig/network-scripts/network-functions | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown index 70f54720..6bd1073d 100755 --- a/sysconfig/network-scripts/ifdown +++ b/sysconfig/network-scripts/ifdown @@ -41,7 +41,7 @@ then exit 0 fi -if [ "$USE_NM" = "true" ]; then +if [ "$_use_nm" = "true" ]; then if [ -n "$UUID" -a -z "$DEVICE" ]; then DEVICE=$(nmcli -t --fields uuid,devices con status | awk -F ':' "\$1 == \"$UUID\" { print \$2 }") fi diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index f5ac0fe0..6534f5a1 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -65,7 +65,7 @@ then exit 0 fi -if [ "$USE_NM" = "true" -a -n "$UUID" ]; then +if [ "$_use_nm" = "true" -a -n "$UUID" ]; then nmcli con up uuid "$UUID" exit $? fi diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 044f1ea1..89d5da5a 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -167,8 +167,8 @@ source_config () else ISALIAS=no fi - ! is_false $NM_CONTROLLED && is_nm_running && USE_NM=true - if [ -z "$UUID" -a "$USE_NM" = "true" ]; then + ! is_false $NM_CONTROLLED && is_nm_running && _use_nm=true + if [ -z "$UUID" -a "$_use_nm" = "true" ]; then UUID=$(get_uuid_by_config $CONFIG) fi } -- cgit v1.2.1 From 1d81c888eac95c3abe3ccd0d4bff7e73c57edcef Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 2 May 2012 13:41:01 -0400 Subject: check_device_down: Don't bother calling ip to check link state if the device doesn't exist. --- sysconfig/network-scripts/network-functions | 1 + 1 file changed, 1 insertion(+) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 89d5da5a..818a985d 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -341,6 +341,7 @@ set_hostname () check_device_down () { + [ ! -d /sys/class/net/$1 ] && return 0 if LC_ALL=C ip -o link show dev $1 2>/dev/null | grep -q ",UP" ; then return 1 else -- cgit v1.2.1 From 890544a5cbee7482962194e1e8bfb478aa39d8a5 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 23 May 2012 13:28:23 -0400 Subject: Don't accidentally match other bonding devices. (#824175) --- sysconfig/network-scripts/ifdown-eth | 2 +- sysconfig/network-scripts/ifup-eth | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth index e120af76..d7eb6370 100755 --- a/sysconfig/network-scripts/ifdown-eth +++ b/sysconfig/network-scripts/ifdown-eth @@ -53,7 +53,7 @@ fi fi if is_bonding_device ${DEVICE} ; then - for device in $(LANG=C egrep -l "^[[:space:]]*MASTER=\"?${DEVICE}\"?" /etc/sysconfig/network-scripts/ifcfg-*) ; do + for device in $(LANG=C egrep -l "^[[:space:]]*MASTER=\"?${DEVICE}\"?[[:space:]]*$" /etc/sysconfig/network-scripts/ifcfg-*) ; do is_ignored_file "$device" && continue /sbin/ifdown ${device##*/} done diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index a43d04e7..afea2372 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -140,7 +140,7 @@ if [ "$ISALIAS" = no ] && is_bonding_device ${DEVICE} ; then /sbin/ip link set dev ${DEVICE} up [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} - for device in $(LANG=C egrep -l "^[[:space:]]*MASTER=\"?${DEVICE}\"?" /etc/sysconfig/network-scripts/ifcfg-*) ; do + for device in $(LANG=C egrep -l "^[[:space:]]*MASTER=\"?${DEVICE}\"?[[:space:]]*$" /etc/sysconfig/network-scripts/ifcfg-*) ; do is_ignored_file "$device" && continue /sbin/ifup ${device##*/} done -- cgit v1.2.1 From 5383a660e73c066d3ceac172283328a58f6b33e5 Mon Sep 17 00:00:00 2001 From: Dan Kenigsberg Date: Sun, 3 Jun 2012 17:17:04 +0300 Subject: Allow bridge names starting with a dash Misguided people may name their bridge '-foo', with a leading dash. Let us indulge them. It is better than showing the usage string of brctl. Signed-off-by: Dan Kenigsberg --- sysconfig/network-scripts/ifdown-eth | 4 ++-- sysconfig/network-scripts/ifup-eth | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth index d7eb6370..036701c2 100755 --- a/sysconfig/network-scripts/ifdown-eth +++ b/sysconfig/network-scripts/ifdown-eth @@ -125,12 +125,12 @@ fi if [ -n "${BRIDGE}" ] && [ -x /usr/sbin/brctl ]; then /sbin/ip link set dev ${DEVICE} down - /usr/sbin/brctl delif ${BRIDGE} ${DEVICE} + /usr/sbin/brctl delif -- ${BRIDGE} ${DEVICE} # Upon removing a device from a bridge, # it's necessary to make radvd reload its config [ -r /var/run/radvd/radvd.pid ] && kill -HUP $(cat /var/run/radvd/radvd.pid) if [ -d /sys/class/net/${BRIDGE}/brif ] && [ $(ls -1 /sys/class/net/${BRIDGE}/brif | wc -l) -eq 0 ]; then - /usr/sbin/brctl delbr ${BRIDGE} + /usr/sbin/brctl delbr -- ${BRIDGE} fi fi diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index afea2372..8c8b588a 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -52,10 +52,10 @@ if [ "${TYPE}" = "Bridge" ]; then exit 1 fi if [ ! -d /sys/class/net/${DEVICE}/bridge ]; then - /usr/sbin/brctl addbr ${DEVICE} || exit 1 + /usr/sbin/brctl addbr -- ${DEVICE} || exit 1 fi - [ -n "${DELAY}" ] && /usr/sbin/brctl setfd ${DEVICE} ${DELAY} - [ -n "${STP}" ] && /usr/sbin/brctl stp ${DEVICE} ${STP} + [ -n "${DELAY}" ] && /usr/sbin/brctl setfd -- ${DEVICE} ${DELAY} + [ -n "${STP}" ] && /usr/sbin/brctl stp -- ${DEVICE} ${STP} # add the bits to setup driver parameters here for arg in $BRIDGING_OPTS ; do key=${arg%%=*}; @@ -158,13 +158,13 @@ fi # If the device is part of a bridge, add the device to the bridge if [ -n "${BRIDGE}" ] && [ -x /usr/sbin/brctl ]; then if [ ! -d /sys/class/net/${BRIDGE}/bridge ]; then - /usr/sbin/brctl addbr ${BRIDGE} 2>/dev/null + /usr/sbin/brctl addbr -- ${BRIDGE} 2>/dev/null fi /sbin/ip addr flush dev ${DEVICE} 2>/dev/null /sbin/ip link set dev ${DEVICE} up ethtool_set [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} - /usr/sbin/brctl addif ${BRIDGE} ${DEVICE} + /usr/sbin/brctl addif -- ${BRIDGE} ${DEVICE} # add the bits to setup driver parameters here for arg in $BRIDGING_OPTS ; do key=${arg%%=*}; -- cgit v1.2.1 From 69ead9bb4b8ec2e45dca84b9904bc04b03666c46 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 26 Jun 2012 10:48:04 -0400 Subject: Handle (improper) quoted HWADDR (#835372) --- sysconfig/network-scripts/network-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 818a985d..81e47a20 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -29,7 +29,7 @@ get_config_by_device () get_config_by_hwaddr () { - LANG=C grep -il "^[[:space:]]*HWADDR=${1}\([[:space:]#]\|$\)" /etc/sysconfig/network-scripts/ifcfg-* \ + LANG=C grep -il "^[[:space:]]*HWADDR=\"\?${1}\"\?\([[:space:]#]\|$\)" /etc/sysconfig/network-scripts/ifcfg-* \ | LC_ALL=C sed -e "$__sed_discard_ignored_files" } -- cgit v1.2.1 From dd9519db35ce2fefb7d583ad4a2fb67cbca24d0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 26 Jun 2012 23:54:52 +0300 Subject: Spelling fixes. --- sysconfig/readonly-root | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysconfig') diff --git a/sysconfig/readonly-root b/sysconfig/readonly-root index ac03e565..7259e89e 100644 --- a/sysconfig/readonly-root +++ b/sysconfig/readonly-root @@ -13,7 +13,7 @@ RW_OPTIONS= STATE_LABEL=stateless-state # Where to mount to the persistent data STATE_MOUNT=/var/lib/stateless/state -# Options to use for peristent mount +# Options to use for persistent mount STATE_OPTIONS= # NFS server to use for persistent data? CLIENTSTATE= -- cgit v1.2.1 From 031a9ddaf6e25fb92959d5c1d7198a69c6ea6fbd Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 6 Aug 2012 15:19:11 -0400 Subject: Drop net.hotplug --- sysconfig/network-scripts/net.hotplug | 60 ----------------------------------- 1 file changed, 60 deletions(-) delete mode 100755 sysconfig/network-scripts/net.hotplug (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/net.hotplug b/sysconfig/network-scripts/net.hotplug deleted file mode 100755 index b10131d1..00000000 --- a/sysconfig/network-scripts/net.hotplug +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh - -# Don't do anything if the network is stopped -if [ ! -f /var/lock/subsys/network ]; then - exit 0 -fi -if [ -f /dev/.in_sysinit ] ; then - exit 0 -fi - -. /etc/sysconfig/network-scripts/network-functions - -if [ "$INTERFACE" = "" ]; then - exit 1 -fi - -[ "$(cat /sys/class/net/$INTERFACE/type)" != "1" ] && exit 0 - -case $ACTION in -add|register) - - case $INTERFACE in - # interfaces that are brought up as a part of configuration - ppp*|ippp*|isdn*|plip*|lo*|irda*|dummy*|ipsec*|tun*|tap*) - exit 0 - ;; - # interfaces that are registered then brought up - *) - export IN_HOTPLUG=1 - if [ -x /sbin/ifup ]; then - addr=$(get_hwaddr ${INTERFACE}) - if [ -n "$addr" ]; then - nconfig=$(get_config_by_hwaddr ${addr}) - [ -n "$nconfig" ] && INTERFACE=$nconfig - fi - exec /sbin/ifup $INTERFACE - fi - ;; - esac - ;; - -remove|unregister) - case $INTERFACE in - # interfaces that are brought down as part of deconfiguration - ppp*|ippp*|isdn*|plip*|lo*|irda*|dummy*|ipsec*|tun*|tap*) - exit 0 - ;; - *) - export IN_HOTPLUG=1 - if [ -x /sbin/ifdown ]; then - exec /sbin/ifdown $INTERFACE - fi - ;; - esac - ;; - -*) - exit 1 ;; - -esac -- cgit v1.2.1 From d232acc90d7ebc2beba5e4ef6f9ffa6ab7f9b795 Mon Sep 17 00:00:00 2001 From: Lukas Nykryn Date: Tue, 7 Aug 2012 14:28:13 +0200 Subject: Process rule6-* for sit devices (#840009) --- sysconfig/network-scripts/ifdown-sit | 3 +++ sysconfig/network-scripts/ifup-sit | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifdown-sit b/sysconfig/network-scripts/ifdown-sit index 39e9c50f..e4d07345 100755 --- a/sysconfig/network-scripts/ifdown-sit +++ b/sysconfig/network-scripts/ifdown-sit @@ -51,5 +51,8 @@ if [ $? != 0 -a $? != 11 ]; then exit 0 fi +# Cleanup additional static routes +/etc/sysconfig/network-scripts/ifdown-routes ${REALDEVICE} + # Cleanup and shut down IPv6-in-IPv4 tunnel device ipv6_del_tunnel_device $DEVICE diff --git a/sysconfig/network-scripts/ifup-sit b/sysconfig/network-scripts/ifup-sit index 498305b7..eb77fc4d 100755 --- a/sysconfig/network-scripts/ifup-sit +++ b/sysconfig/network-scripts/ifup-sit @@ -104,9 +104,5 @@ if [ -f /etc/sysconfig/static-routes-ipv6 ]; then done fi -# Setup additional static IPv6 routes (newer config style) -if [ -f "/etc/sysconfig/network-scripts/route6-$REALDEVICE" ]; then - sed -ne 's/#.*//' -e '/[^[:space:]]/p' "/etc/sysconfig/network-scripts/route6-$REALDEVICE" | while read line; do - /sbin/ip -6 route add $line - done -fi +# Setup static routes +/etc/sysconfig/network-scripts/ifup-routes ${REALDEVICE} -- cgit v1.2.1 From 6b51ac2eb4581c5ec50d6771fd5ebf335bd634f4 Mon Sep 17 00:00:00 2001 From: Lukas Nykryn Date: Tue, 7 Aug 2012 14:41:38 +0200 Subject: Fix typo in help message in ifdown-routes --- sysconfig/network-scripts/ifdown-routes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifdown-routes b/sysconfig/network-scripts/ifdown-routes index 3c62498a..0109404f 100755 --- a/sysconfig/network-scripts/ifdown-routes +++ b/sysconfig/network-scripts/ifdown-routes @@ -2,7 +2,7 @@ # # Drops static routes which go through device $1 if [ -z "$1" ]; then - echo $"usage: ifup-routes []" + echo $"usage: ifdown-routes []" exit 1 fi -- cgit v1.2.1 From 06cdd94e805e1c6d0faf3e9ece0dc71f301831ef Mon Sep 17 00:00:00 2001 From: Benjamin Coddington Date: Mon, 23 Apr 2012 11:19:43 -0400 Subject: Allow duplicate address dectection to be disabled --- sysconfig/network-scripts/ifup-eth | 2 +- sysconfig/network-scripts/network-functions | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index 8c8b588a..4692f63e 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -243,7 +243,7 @@ else fi if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${ipaddr[$idx]}/${prefix[$idx]}" ; then - [ "${REALDEVICE}" != "lo" ] && \ + [ "${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]}." exit 1 diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 81e47a20..5b2f30ac 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -201,6 +201,7 @@ expand_config () prefix[$i]=$(eval echo '$'PREFIX$idx) netmask[$i]=$(eval echo '$'NETMASK$idx) broadcast[$i]=$(eval echo '$'BROADCAST$idx) + arpcheck[$i]=$(eval echo '$'ARPCHECK$idx) if [ "${prefix[$i]}x" != "x" ]; then val=$(/bin/ipcalc --netmask "${ipaddr[$i]}/${prefix[$i]}") @@ -221,6 +222,12 @@ expand_config () val=$(/bin/ipcalc --broadcast ${ipaddr[$i]} ${netmask[$i]}) broadcast[$i]=${val##BROADCAST=} fi + + if [ "${arpcheck[$i]}x" != "x" ]; then + arpcheck[$i]=${arpcheck[$i]##ARPCHECK=} + arpcheck[$i]=${arpcheck[$i],,*} + fi + i=$((i+1)) done -- cgit v1.2.1 From 02ca71f53ca1fe26a416b20a8a6b392565f74b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= Date: Wed, 5 Sep 2012 13:32:12 +0200 Subject: Be less strict about VLAN name (#505314) --- sysconfig/network-scripts/ifdown-eth | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth index 036701c2..9c78d4fe 100755 --- a/sysconfig/network-scripts/ifdown-eth +++ b/sysconfig/network-scripts/ifdown-eth @@ -158,11 +158,8 @@ fi if [ -n "$VLAN" ]; then # 802.1q VLAN - if echo ${DEVICE} | LANG=C grep -Ev '(:)' | LANG=C grep -Eq '(eth|bond)[0-9][0-9]*\.[0-9][0-9]?[0-9]?[0-9]?' \ - || echo ${DEVICE} | LANG=C grep -Eq 'vlan[0-9][0-9]?[0-9]?[0-9]?' ; then - [ -f /proc/net/vlan/${DEVICE} ] && { + if [ -f /proc/net/vlan/${DEVICE} ]; then ip link delete ${DEVICE} type vlan - } fi fi -- cgit v1.2.1 From 06c22e76d45a5f8f2fd15fea6a8e7c9efa80962f Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 25 Sep 2012 01:22:01 -0400 Subject: MALLOC_CHECK_ is not thread safe. Don't enable it by default even in debug mode. (#853175) --- sysconfig/debug | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sysconfig') diff --git a/sysconfig/debug b/sysconfig/debug index 3a251fd4..4ae4e7b5 100644 --- a/sysconfig/debug +++ b/sysconfig/debug @@ -4,7 +4,8 @@ # 0: silently ignore errors # 1: print diagnostics on stderr when an error is detected # 2: call abort when an error is detected -export MALLOC_CHECK_=1 +# Note: MALLOC_CHECK_ is not thread safe, enable at your own risk. +# export MALLOC_CHECK_=1 # MALLOC_PERTURB_: initialize cleared memory to the specified value export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) -- cgit v1.2.1