diff options
author | Nicolas Lécureuil <neoclust@mageia.org> | 2016-02-12 13:41:11 +0100 |
---|---|---|
committer | Nicolas Lécureuil <neoclust@mageia.org> | 2016-02-12 13:41:11 +0100 |
commit | b91d741cab5facd8f2bb87b2d6a1d172459ae606 (patch) | |
tree | a0f1d55f9a2f61a22a9d590a05877dc885340eac | |
parent | 052f95ee56dcc8cb8e815b7dadb2056caf484128 (diff) | |
parent | 3cc6e647008a06a13fac1e0c8885807a1e0b661b (diff) | |
download | initscripts-b91d741cab5facd8f2bb87b2d6a1d172459ae606.tar initscripts-b91d741cab5facd8f2bb87b2d6a1d172459ae606.tar.gz initscripts-b91d741cab5facd8f2bb87b2d6a1d172459ae606.tar.bz2 initscripts-b91d741cab5facd8f2bb87b2d6a1d172459ae606.tar.xz initscripts-b91d741cab5facd8f2bb87b2d6a1d172459ae606.zip |
Merge tag 'initscripts-9.56-1' into distro/mga
Tag as initscripts-9.56-1
-rw-r--r-- | examples/networking/ifcfg-bond-802.3ad | 16 | ||||
-rw-r--r-- | examples/networking/ifcfg-bond-activebackup-arpmon | 17 | ||||
-rw-r--r-- | examples/networking/ifcfg-bond-activebackup-miimon | 16 | ||||
-rw-r--r-- | examples/networking/ifcfg-bond-slave | 12 | ||||
-rw-r--r-- | examples/networking/ifcfg-bridge | 12 | ||||
-rw-r--r-- | examples/networking/ifcfg-bridge-port | 9 | ||||
-rw-r--r-- | examples/networking/ifcfg-eth-alias | 12 | ||||
-rw-r--r-- | examples/networking/ifcfg-eth-dhcp | 11 | ||||
-rw-r--r-- | examples/networking/ifcfg-vlan | 13 | ||||
-rw-r--r-- | initscripts.spec | 29 | ||||
-rw-r--r-- | po/vi.po | 2 | ||||
-rwxr-xr-x | rc.d/init.d/network | 9 | ||||
-rw-r--r-- | src/Makefile | 14 | ||||
-rw-r--r-- | src/rename_device.c | 19 | ||||
-rw-r--r-- | sys-unconfig | 2 | ||||
-rw-r--r-- | sys-unconfig.8 | 21 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup | 77 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-aliases | 15 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-eth | 4 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-tunnel | 3 | ||||
-rw-r--r--[-rwxr-xr-x] | sysconfig/network-scripts/ifup-wireless | 0 | ||||
-rw-r--r-- | sysconfig/network-scripts/network-functions | 60 | ||||
-rwxr-xr-x | systemd/fedora-import-state | 7 |
23 files changed, 284 insertions, 96 deletions
diff --git a/examples/networking/ifcfg-bond-802.3ad b/examples/networking/ifcfg-bond-802.3ad new file mode 100644 index 00000000..973f181d --- /dev/null +++ b/examples/networking/ifcfg-bond-802.3ad @@ -0,0 +1,16 @@ +# ifcfg sample for bond in mode 4/802.3ad +# with static networking configuration +# lacp_rate=1 for fast LACPDU rx rate (optional) +# +# Please read /usr/share/doc/initscripts-*/sysconfig.txt +# for the documentation of these parameters. + +DEVICE=bond0 +ONBOOT=yes +USERCTL=no +TYPE=Ethernet +BOOTPROTO=none +BONDING_OPTS="mode=4 lacp_rate=1" +IPADDR=192.168.1.4 +NETMASK=255.255.255.0 +GATEWAY=192.168.1.1 diff --git a/examples/networking/ifcfg-bond-activebackup-arpmon b/examples/networking/ifcfg-bond-activebackup-arpmon new file mode 100644 index 00000000..01acebac --- /dev/null +++ b/examples/networking/ifcfg-bond-activebackup-arpmon @@ -0,0 +1,17 @@ +# ifcfg sample for bond in active-backup mode using +# ARP monitoring. The ARP probes frequency (arp_interval) +# is 500ms and the target IP address (arp_ip_target) +# is 192.168.1.1 +# +# Please read /usr/share/doc/initscripts-*/sysconfig.txt +# for the documentation of these parameters. + +DEVICE=bond0 +ONBOOT=yes +USERCTL=no +TYPE=Ethernet +BOOTPROTO=none +BONDING_OPTS="mode=1 arp_interval=500 arp_ip_target=192.168.1.1" +IPADDR=192.168.1.4 +NETMASK=255.255.255.0 +GATEWAY=192.168.1.1 diff --git a/examples/networking/ifcfg-bond-activebackup-miimon b/examples/networking/ifcfg-bond-activebackup-miimon new file mode 100644 index 00000000..befa2de3 --- /dev/null +++ b/examples/networking/ifcfg-bond-activebackup-miimon @@ -0,0 +1,16 @@ +# ifcfg sample for bond in active-backup mode using +# MII link monitoring. The MII status polling frequency +# (miimon) is 500ms. +# +# Please read /usr/share/doc/initscripts-*/sysconfig.txt +# for the documentation of these parameters. + +DEVICE=bond0 +ONBOOT=yes +USERCTL=no +TYPE=Ethernet +BOOTPROTO=none +BONDING_OPTS="mode=1 miimon=500" +IPADDR=192.168.1.4 +NETMASK=255.255.255.0 +GATEWAY=192.168.1.1 diff --git a/examples/networking/ifcfg-bond-slave b/examples/networking/ifcfg-bond-slave new file mode 100644 index 00000000..7ae54793 --- /dev/null +++ b/examples/networking/ifcfg-bond-slave @@ -0,0 +1,12 @@ +# ifcfg sample for bond slave device +# +# Please read /usr/share/doc/initscripts-*/sysconfig.txt +# for the documentation of these parameters. + +DEVICE=eth0 +TYPE=Ethernet +USERCTL=no +SLAVE=yes +MASTER=bond0 +BOOTPROTO=none +HWADDR=AA:BB:CC:DD:EE:FF diff --git a/examples/networking/ifcfg-bridge b/examples/networking/ifcfg-bridge new file mode 100644 index 00000000..6086b310 --- /dev/null +++ b/examples/networking/ifcfg-bridge @@ -0,0 +1,12 @@ +# ifcfg sample for linux bridge device with IP address. +# +# Please read /usr/share/doc/initscripts-*/sysconfig.txt +# for the documentation of these parameters. + +DEVICE=br0 +TYPE=Bridge +IPADDR=192.168.1.1 +NETMASK=255.255.255.0 +ONBOOT=yes +BOOTPROTO=static +DELAY=0 diff --git a/examples/networking/ifcfg-bridge-port b/examples/networking/ifcfg-bridge-port new file mode 100644 index 00000000..0de4778c --- /dev/null +++ b/examples/networking/ifcfg-bridge-port @@ -0,0 +1,9 @@ +# ifcfg sample for a device that is a linux bridge port +# +# Please read /usr/share/doc/initscripts-*/sysconfig.txt +# for the documentation of these parameters. + +DEVICE=eth1 +HWADDR=00:11:22:33:44:55 +ONBOOT=yes +BRIDGE=br0 diff --git a/examples/networking/ifcfg-eth-alias b/examples/networking/ifcfg-eth-alias new file mode 100644 index 00000000..60dc1d71 --- /dev/null +++ b/examples/networking/ifcfg-eth-alias @@ -0,0 +1,12 @@ +# ifcfg sample for alias interface on top of eth0 +# +# Please read /usr/share/doc/initscripts-*/sysconfig.txt +# for the documentation of these parameters. + +DEVICE=eth0:0 +BOOTPROTO=none +IPADDR=192.168.1.1 +NETMASK=255.255.255.0 +ONBOOT=yes +USERCTL=no + diff --git a/examples/networking/ifcfg-eth-dhcp b/examples/networking/ifcfg-eth-dhcp new file mode 100644 index 00000000..2dd687ab --- /dev/null +++ b/examples/networking/ifcfg-eth-dhcp @@ -0,0 +1,11 @@ +# ifcfg sample for common ethernet interfaces using DHCP +# +# Please read /usr/share/doc/initscripts-*/sysconfig.txt +# for the documentation of these parameters. + +DEVICE=eth0 +BOOTPROTO=dhcp +HWADDR=00:11:22:33:44:55 +ONBOOT=yes +DHCP_HOSTNAME=host1 + diff --git a/examples/networking/ifcfg-vlan b/examples/networking/ifcfg-vlan new file mode 100644 index 00000000..d090aab0 --- /dev/null +++ b/examples/networking/ifcfg-vlan @@ -0,0 +1,13 @@ +# ifcfg sample for a VLAN device (vlanid=122) on top of +# eth0 device using static IP configuration +# +# Please read /usr/share/doc/initscripts-*/sysconfig.txt +# for the documentation of these parameters. + +TYPE=Ethernet +DEVICE=eth0.122 +VLAN=yes +BOOTPROTO=none +NETMASK=255.255.255.0 +IPADDR=192.168.1.1 + diff --git a/initscripts.spec b/initscripts.spec index 983a55b4..3ca25bf1 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -1,6 +1,6 @@ Summary: The inittab file and the /etc/init.d scripts Name: initscripts -Version: 9.55 +Version: 9.56 License: GPLv2 Group: System Environment/Base Release: 1%{?dist} @@ -190,6 +190,7 @@ rm -rf $RPM_BUILD_ROOT %dir /etc/NetworkManager/dispatcher.d /etc/NetworkManager/dispatcher.d/00-netreport %doc sysconfig.txt sysvinitfiles static-routes-ipv6 ipv6-tunnel.howto ipv6-6to4.howto changes.ipv6 +%doc examples %{!?_licensedir:%global license %%doc} %license COPYING /var/lib/stateless @@ -208,6 +209,32 @@ rm -rf $RPM_BUILD_ROOT /etc/profile.d/debug* %changelog +* Tue Oct 07 2014 Lukáš Nykrýn <lnykryn@redhat.com> - 9.56-1 +- network_function: return immediately when device is pres +ent +- add configurable DEVTIMEOUT +- fedora-import-state: do not clobber / +- network-functions: grep->fgrep in bonding masters matchi +ng +- man: update sys-unconfig.8 +- rename_devices: comments need to have a blank before them +- add example ifcfg files +- network-functions: improve bonding_masters grep +- ifup: if we were unable to determine DEVICE always call nmcli up +- ifup-tunnel: call ifup-ipv6 in the end +- ifup: also set multicast_snooping after the bridge is up +- network-functions: ETHTOOL_DELAY introduction patch +- use pie and relro by default +- custom naming for VLAN devices +- vi.po: fix parentheses +- ifup-wireless: add support for wowlan +- ifup-wireless: add support for wowlan (second part) +- ifup-aliases: do not bring up ipv6 for range files +- sys-unconfig: use poweroff instead of halt +- ifup-aliases: improve duplicate address detection +- network-functions: handle BONDING_OPTS better +- network: tell nm to wake the slaves + * Tue Jul 22 2014 Lukáš Nykrýn <lnykryn@redhat.com> - 9.55-1 - fix license handling - ipcalc: -c allow netmask @@ -196,7 +196,7 @@ msgstr "Đang xác định thông tin IP cho ${DEVICE}..." #: ../rc.d/init.d/functions:422 msgid "${base} is stopped" -msgstr "$(base} đã dừng" +msgstr "${base} đã dừng" #: ../rc.d/init.d/functions:151 ../rc.d/init.d/functions:187 msgid "$0: Usage: daemon [+/-nicelevel] {program}" diff --git a/rc.d/init.d/network b/rc.d/init.d/network index 9cfd6c46..1cbdeb91 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -105,13 +105,14 @@ case "$1" in # bring up all other interfaces configured to come up at boot time for i in $interfaces; do unset DEVICE TYPE SLAVE - eval $(LANG=C grep -F "DEVICE=" "ifcfg-$i") - eval $(LANG=C grep -F "TYPE=" "ifcfg-$i") - eval $(LANG=C grep -F "SLAVE=" "ifcfg-$i") + eval $(LANG=C grep -F "DEVICE=" ifcfg-$i) + eval $(LANG=C grep -F "TYPE=" ifcfg-$i) + eval $(LANG=C grep -F "SLAVE=" ifcfg-$i) + eval $(LANG=C grep -F "NM_CONTROLLED=" ifcfg-$i) if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi - if [ "$SLAVE" = "yes" ]; then + if [ "$SLAVE" = "yes" ] && ( ! is_nm_running || is_false $NM_CONTROLLED ) ; then continue fi if [ "$TYPE" = "Wireless" ]; then diff --git a/src/Makefile b/src/Makefile index 7875abc5..aa9daa24 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,5 @@ -CFLAGS+=$(RPM_OPT_FLAGS) -Wall -D_GNU_SOURCE -LDFLAGS+=$(RPM_LD_FLAGS) +CFLAGS+=$(RPM_OPT_FLAGS) -Wall -D_GNU_SOURCE -fPIE +LDFLAGS+=$(RPM_LD_FLAGS) -pie -z relro -z now PROGS=usernetctl netreport usleep ipcalc \ consoletype genhostid rename_device @@ -43,20 +43,20 @@ usleep: $(USLEEP_OBJS) $(CC) $(LDFLAGS) -o $@ $(USLEEP_OBJS) -lpopt usernetctl.o: usernetctl.c - $(CC) $(CFLAGS) -fPIE -c usernetctl.c -o usernetctl.o + $(CC) $(CFLAGS) -c usernetctl.c -o usernetctl.o usernetctl: usernetctl.c usernetctl.o - $(CC) $(LDFLAGS) -pie -z relro -z now -o $@ $@.o + $(CC) $(LDFLAGS) -o $@ $@.o netreport.o: netreport.c - $(CC) $(CFLAGS) -fPIE -c netreport.c -o netreport.o + $(CC) $(CFLAGS) -c netreport.c -o netreport.o netreport: netreport.o - $(CC) $(LDFLAGS) -pie -z relro -z now -o $@ $@.o + $(CC) $(LDFLAGS) -o $@ $@.o shvar.o: shvar.c $(CC) $(CFLAGS) `pkg-config glib-2.0 --cflags` -c shvar.c -o shvar.o rename_device: rename_device.c - $(CC) $(CFLAGS) `pkg-config glib-2.0 --cflags` -o $@ $< `pkg-config glib-2.0 --libs` + $(CC) $(CFLAGS) `pkg-config glib-2.0 --cflags` -o $@ $< $(LDFLAGS) `pkg-config glib-2.0 --libs` diff --git a/src/rename_device.c b/src/rename_device.c index bb5e6b8f..f45e996c 100644 --- a/src/rename_device.c +++ b/src/rename_device.c @@ -27,6 +27,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <ctype.h> #include <sys/ioctl.h> #include <sys/time.h> @@ -120,13 +121,19 @@ int isCfg(const struct dirent *dent) { } static inline char *dequote(char *start, char *end) { - char *c; - //remove comments and trailing whitespace - c = strchr(start, '#'); - if (c!=NULL) - *c='\0'; + char *c; + //remove comments and trailing whitespace + for (c = start; c && *c; c++) { + c = strchr(c, '#'); + if (!c) + break; + if (c > start && isblank(*(c-1))) { + *c = '\0'; + break; + } + } - g_strchomp(start); + g_strchomp(start); if (end==NULL) { end=start; diff --git a/sys-unconfig b/sys-unconfig index 0c9e5531..8eb8d894 100644 --- a/sys-unconfig +++ b/sys-unconfig @@ -9,4 +9,4 @@ fi touch /.unconfigured rm -f /etc/udev/rules.d/*-persistent-*.rules -halt +poweroff diff --git a/sys-unconfig.8 b/sys-unconfig.8 index dc55fed9..9edc1068 100644 --- a/sys-unconfig.8 +++ b/sys-unconfig.8 @@ -5,26 +5,23 @@ sys-unconfig \- shell script to reconfigure the system upon next boot \fBsys-unconfig\fR .SH DESCRIPTION \fBsys-unconfig\fR provides a simple method of reconfiguring a system -in a new environment. Upon executing sys-unconfig will halt your -system, and run the following configuration programs at boot: -passwd (to change the root password), netconfig, timeconfig, -kbdconfig, authconfig, and ntsysv. +in a new environment. Upon executing sys-unconfig will poweroff your +system, and run firstboot at next boot. .SH FILES .PD 0 .TP 20 \fI/.unconfigured\fR -The presence of this file will cause /etc/rc.d/rc.sysinit to run -the programs mentioned above. +The presence of this file will trigger firsboot. + +.SH NOTES +.PD +This utility should not be used for creating cloud or virtual machine images. +For that use please see \fBvirt-sysprep\fP. .PD .SH "SEE ALSO" -.BR passwd (1), -.BR netconfig (8), -.BR timeconfig (8), -.BR kbdconfig (8), -.BR authconfig (8), -.BR ntsysv(8) +.BR virt-sysprep(1) .SH AUTHORS .nf diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index d146ca48..2b826e2d 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -PATH=/sbin:/usr/sbin:/bin:/usr/bin -TEXTDOMAIN=initscripts - unset WINDOW # defined by screen, conflicts with our usage . /etc/init.d/functions @@ -25,7 +22,7 @@ unset WINDOW # defined by screen, conflicts with our usage cd /etc/sysconfig/network-scripts . ./network-functions -[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network +[ -f ../network ] && . ../network CONFIG=${1} @@ -68,53 +65,38 @@ then exit 0 fi -if [ "$_use_nm" = "true" ]; then - if [ -z "$UUID" ]; then - # OK, so we are using NM but we have no UUID... not much we can do but - # leaving it for now and hoping NM brings it up later - echo -n "deferring to NetworkManager " >&2 - exit 0 - fi +if [ "$_use_nm" = "true" -a -n "$UUID" -a "$DEVICE" != "lo" ]; then if [ "foo$2" = "fooboot" ] && [ "${TYPE}" = "Wireless" ]; then - echo -n "deferring boot-time wireless device to NetworkManager " >&2 - exit 0 - fi - - # If we don't have a device, this is typically due to removable interface - # (e.g. USB ethernet adapters) - # This check may apply to non-NM devices too, but I cannot test if this is - # valid in all cases so only dealing gracefully with it here. - if [ -z "${DEVICE}" ]; then - echo -n "no device found: deferring to NetworkManager " >&2 - exit 0 - fi - - if is_nm_handling ${DEVICE}; then - echo -n "deferred to NetworkManager " >&2 exit 0 fi - - unset OVERRIDEEXIT - nmcli con up uuid "$UUID" 2>&1 | grep -q "no device found for connection" && echo -n "no device found - deferring to NetworkManager " && OVERRIDEEXIT=y; ( [ "y" = "$OVERRIDEEXIT" ] && exit 0; exit ${PIPESTATUS[0]} ) + [ -n "${DEVICE}" ] && is_nm_handling ${DEVICE} && exit 0 + nmcli con up uuid "$UUID" exit $? fi # Ethernet 802.1Q VLAN support -if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ]; then - VID="" - MATCH='^.+\.[0-9]{1,4}$' - if [[ "${DEVICE}" =~ $MATCH ]]; then - VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^.*\.\([0-9]\+\)/\1/') - PHYSDEV=${DEVICE%.*} - fi - MATCH='^vlan[0-9]{1,4}?' - if [[ "${DEVICE}" =~ $MATCH ]]; then - VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^vlan0*//') - # PHYSDEV should be set in ifcfg-vlan* file - if test -z "$PHYSDEV"; then - net_log $"PHYSDEV should be set for device ${DEVICE}" - exit 1 - fi +if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ] && [ -n "$DEVICE" ]; then + if [ -n "${VID}" ]; then + if test -z "$PHYSDEV"; then + net_log $"PHYSDEV should be set for device ${DEVICE}" + exit 1 + fi + else + VID="" + MATCH='^.+\.[0-9]{1,4}$' + if [[ "${DEVICE}" =~ $MATCH ]]; then + VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^.*\.\([0-9]\+\)/\1/') + PHYSDEV=${DEVICE%.*} + fi + MATCH='^vlan[0-9]{1,4}?' + if [[ "${DEVICE}" =~ $MATCH ]]; then + VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^vlan0*//') + # PHYSDEV should be set in ifcfg-vlan* file + if test -z "$PHYSDEV"; then + net_log $"PHYSDEV should be set for device ${DEVICE}" + exit 1 + fi + fi fi if [ -n "$VID" ]; then if [ ! -d /proc/net/vlan ]; then @@ -124,7 +106,7 @@ if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ]; then fi fi - is_available ${PHYSDEV} || { + is_available_wait ${PHYSDEV} ${DEVTIMEOUT} || { if [ "$?" = "1" ] ; then net_log $"$alias device ${DEVICE} does not seem to be present, delaying initialization." exit 1 @@ -159,8 +141,9 @@ if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ]; then /usr/lib/systemd/systemd-sysctl --prefix "/proc/sys/net/ipv4/conf/${DEVICE}" --prefix "/proc/sys/net/ipv6/conf/${DEVICE}" fi -# signalling the start of connection -mdv-network-event connection_start ${DEVICE} +if [ "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ]; then + DYNCONFIG=true +fi if [ -x /sbin/ifup-pre-local ]; then /sbin/ifup-pre-local ${CONFIG} $2 diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases index c92a431d..b3d045df 100755 --- a/sysconfig/network-scripts/ifup-aliases +++ b/sysconfig/network-scripts/ifup-aliases @@ -257,13 +257,15 @@ function new_interface () fi if [ "$setup_this" = "yes" ] ; then - [ "${parent_device}" != "lo" ] && [ "${ARPCHECK}" != "no" ] && \ + if [ "${parent_device}" != "lo" ] && [ "${ARPCHECK}" != "no" ] && \ is_available ${parent_device} && \ - grep -qswi "up" /sys/class/net/${parent_device}/operstate && \ - if ! /sbin/arping -q -c 2 -w ${ARPING_WAIT:-3} -D -I ${parent_device} ${IPADDR} ; then - net_log $"Error, some other host already uses address ${IPADDR}." - return 1 - fi + ( grep -qswi "up" /sys/class/net/${parent_device}/operstate || grep -qswi "1" /sys/class/net/${parent_device}/carrier ) ; then + echo $"Determining if ip address ${IPADDR} is already in use for device ${parent_device}..." + if ! /sbin/arping -q -c 2 -w ${ARPING_WAIT:-3} -D -I ${parent_device} ${IPADDR} ; then + net_log $"Error, some other host already uses address ${IPADDR}." + return 1 + fi + fi /sbin/ip addr add ${IPADDR}/${PREFIX} brd ${BROADCAST} dev ${parent_device} label ${DEVICE} @@ -326,6 +328,7 @@ for FILE in ifcfg-${parent_device}-range* ; do while [ $ipaddr_num -le $ipaddr_endnum ]; do IPADDR="$ipaddr_prefix.$ipaddr_num" DEVICE="$parent_device:$ipaddr_clonenum" + IPV6INIT="no" [ "$ONPARENT" != "no" -a "$ONPARENT" != "NO" ] && new_interface; ipaddr_num=$(($ipaddr_num+1)) ipaddr_clonenum=$(($ipaddr_clonenum+1)) diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index 573003b9..49a7d503 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -94,7 +94,7 @@ if [ -n "${TEAM_CONFIG}" ] && [ ! "${DEVICETYPE}" = "Team" ] && [ -x ./ifup-Team fi # now check the real state -is_available ${REALDEVICE} || { +is_available_wait ${REALDEVICE} ${DEVTIMEOUT} || { if [ -n "$alias" ]; then net_log $"$alias device ${DEVICE} does not seem to be present, delaying initialization." else @@ -497,7 +497,7 @@ if [ "${TYPE}" = "Bridge" ]; then for arg in $BRIDGING_OPTS ; do key=${arg%%=*}; value=${arg##*=}; - if [ "${key}" = "multicast_router" -o "${key}" = "hash_max" ]; then + if [ "${key}" = "multicast_router" -o "${key}" = "hash_max" -o "${key}" = "multicast_snooping" ]; then echo $value > /sys/class/net/${DEVICE}/bridge/$key fi done diff --git a/sysconfig/network-scripts/ifup-tunnel b/sysconfig/network-scripts/ifup-tunnel index a4762127..6e4228bc 100755 --- a/sysconfig/network-scripts/ifup-tunnel +++ b/sysconfig/network-scripts/ifup-tunnel @@ -85,4 +85,7 @@ fi /sbin/ip link set dev "$DEVICE" up +# IPv6 initialisation? +/etc/sysconfig/network-scripts/ifup-ipv6 ${CONFIG} + exec /etc/sysconfig/network-scripts/ifup-post "$CONFIG" "$2" diff --git a/sysconfig/network-scripts/ifup-wireless b/sysconfig/network-scripts/ifup-wireless index 5fdceadf..5fdceadf 100755..100644 --- a/sysconfig/network-scripts/ifup-wireless +++ b/sysconfig/network-scripts/ifup-wireless diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index a1239872..ffc23238 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -183,6 +183,7 @@ ethtool_set() { oldifs=$IFS; IFS=';'; + [ -n "${ETHTOOL_DELAY}" ] && /bin/usleep ${ETHTOOL_DELAY} for opts in $ETHTOOL_OPTS ; do IFS=$oldifs; if [[ "${opts}" =~ [[:space:]]*- ]]; then @@ -341,6 +342,26 @@ END { [ -d "/sys/class/net/$1" ] && return 0 || return 1 } +is_available_wait () +{ + [ -z "$1" ] && return 1 + + local retry=${2##*[!0-9]*} + + is_available $1 + ret=$? + + [ 0"$ret" -ne 1 ] && return $ret + + while [ 0"$retry" -gt 0 ]; do + sleep 1 + [ -d "/sys/class/net/$1" ] && return 0 + retry=$(($retry -1)) + done + + return 1 +} + need_hostname () { CHECK_HOSTNAME=$(hostname) @@ -448,10 +469,15 @@ is_wireless_device () [ -d "/sys/class/net/$1/wireless" -o -d "/sys/class/net/$1/phy80211" ] } +phy_wireless_device () +{ + cat /sys/class/net/$1/phy80211/name +} + install_bonding_driver () { [ ! -f /sys/class/net/bonding_masters ] && ( modprobe bonding || return 1 ) - if ! grep -sqw "$1" /sys/class/net/bonding_masters; then + if ! fgrep -sqx "$1" /sys/class/net/bonding_masters; then echo "+$1" > /sys/class/net/bonding_masters 2>/dev/null fi ( @@ -461,10 +487,36 @@ install_bonding_driver () if [ -f /sys/class/net/${DEVICE}/bonding/slaves -a $(wc -l < /sys/class/net/${DEVICE}/bonding/slaves) -eq 0 ]; then /sbin/ip link set dev ${DEVICE} down - # add the bits to setup driver parameters here + # parse options and put them to arrays for arg in $BONDING_OPTS ; do - key=${arg%%=*}; - value=${arg##*=}; + bopts_keys[${#bopts_keys[*]}]=${arg%%=*} + bopts_vals[${#bopts_vals[*]}]=${arg##*=} + done + + # add the bits to setup driver parameters here + # first set mode, miimon + for (( idx=0; idx < ${#bopts_keys[*]}; idx++ )) ; do + key=${bopts_keys[$idx]} + value=${bopts_vals[$idx]} + + if [ "${key}" = "mode" ] ; then + echo "${value}" > /sys/class/net/${DEVICE}/bonding/$key + bopts_keys[$idx]="" + fi + if [ "${key}" = "miimon" ] ; then + echo "${value}" > /sys/class/net/${DEVICE}/bonding/$key + bopts_keys[$idx]="" + fi + done + + # set all other remaining options + for (( idx=0; idx < ${#bopts_keys[*]}; idx++ )) ; do + key=${bopts_keys[$idx]} + value=${bopts_vals[$idx]} + + # option already set; take next + [[ -z "$key" ]] && continue + if [ "${key}" = "arp_ip_target" -a "${value:0:1}" != "+" ]; then OLDIFS=$IFS; IFS=','; diff --git a/systemd/fedora-import-state b/systemd/fedora-import-state index a853ab9c..7809ca81 100755 --- a/systemd/fedora-import-state +++ b/systemd/fedora-import-state @@ -1,14 +1,11 @@ #!/bin/bash # fedora-import-state: import state files from initramfs (e.g. network config) -# exit early if root isn't writeable -[ -w / ] || exit 0 - # copy state into root cd /run/initramfs/state -cp -a -t / . +find . -mindepth 1 -maxdepth 1 -exec cp -av -t / {} \; # run restorecon on the copied files if [ -e /sys/fs/selinux/enforce ]; then - find . | ( cd /; restorecon -i -f -; ) || : + find . -mindepth 1 -print0 | { cd / && xargs --null restorecon -i; } fi |