From d46737b201923ec3202411c6df3648f6eac43d8f4a9c5744b69c149acf5569ba Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Tue, 10 Jun 2014 11:19:53 +0000 Subject: [PATCH] . OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=663 --- 1021-udev-re-add-persistent-net-rules.patch | 39 +++++++++++++++-- systemd-mini.changes | 19 ++++++++- systemd-mini.spec | 46 +++++++++++++++++++-- systemd.changes | 19 ++++++++- systemd.spec | 46 +++++++++++++++++++-- 5 files changed, 155 insertions(+), 14 deletions(-) diff --git a/1021-udev-re-add-persistent-net-rules.patch b/1021-udev-re-add-persistent-net-rules.patch index b329e1a5..e8cd290c 100644 --- a/1021-udev-re-add-persistent-net-rules.patch +++ b/1021-udev-re-add-persistent-net-rules.patch @@ -22,12 +22,12 @@ Index: systemd-210/src/udev/rule_generator/75-persistent-net-generator.rules +# ignore the interface if a name has already been set +NAME=="?*", GOTO="persistent_net_generator_end" + -+IMPORT{cmdline}="net.ifnames" -+ENV{net.ifnames}!="0", GOTO="persistent_net_generator_end" -+ +# device name whitelist +KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end" + ++IMPORT{cmdline}="net.ifnames" ++ENV{net.ifnames}=="1", GOTO="persistent_net_generator_end" ++ +# ignore Xen virtual interfaces +SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" + @@ -405,7 +405,7 @@ Index: systemd-210/src/udev/rule_generator/76-net-sriov-names.rules +SUBSYSTEM!="net", GOTO="net-sriov-names_end" + +IMPORT{cmdline}="net.ifnames" -+ENV{net.ifnames}!="0", GOTO="net-sriov-names_end" ++ENV{net.ifnames}=="1", GOTO="net-sriov-names_end" + +SUBSYSTEM=="net", SUBSYSTEMS=="pci", ACTION=="add", NAME=="?*", ENV{INTERFACE_NEW}="$name" +SUBSYSTEM=="net", SUBSYSTEMS=="pci", ACTION=="add", IMPORT{program}="net-set-sriov-names" @@ -499,3 +499,34 @@ Index: systemd-210/src/udev/rule_generator/net-set-sriov-names + fi + fi +done +Index: systemd-210/src/udev/net/link-config.c +=================================================================== +--- systemd-210.orig/src/udev/net/link-config.c ++++ systemd-210/src/udev/net/link-config.c +@@ -193,6 +193,18 @@ static bool enable_name_policy(void) { + r = proc_cmdline(&line); + if (r < 0) + log_warning("Failed to read /proc/cmdline, ignoring: %s", strerror(-r)); ++#if defined(NET_IFNAMES) && (NET_IFNAMES == 1) ++# warning Using persistent rules as a default ++ if (r <= 0) ++ return false; ++ ++ FOREACH_WORD_QUOTED(w, l, line, state) ++ if (strneq(w, "net.ifnames=1", l)) ++ return true; ++ ++ return false; ++#else ++# warning Using predictable rules as a default + if (r <= 0) + return true; + +@@ -201,6 +213,7 @@ static bool enable_name_policy(void) { + return false; + + return true; ++#endif + } + + int link_config_load(link_config_ctx *ctx) { diff --git a/systemd-mini.changes b/systemd-mini.changes index c1fec0fe..26dbb209 100644 --- a/systemd-mini.changes +++ b/systemd-mini.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Tue Jun 10 11:11:55 UTC 2014 - werner@suse.de + +- Change 1021-udev-re-add-persistent-net-rules.patch to use persistent + rules as a default on SLES-12 and predictable rules as a default + otherwise +- Add cflags shell function to check possible flags for the compiler + as well as for the linker + ------------------------------------------------------------------- Mon Jun 9 08:38:33 UTC 2014 - rmilasan@suse.com @@ -94,11 +103,17 @@ Tue Jun 3 14:23:40 UTC 2014 - werner@suse.de 1023-udev-builtin-keyboard-do-tell-on-which-device-EVIOCS.patch 1024-udev-always-close-lock-file-descriptor.patch +------------------------------------------------------------------- +Tue Jun 3 12:55:53 UTC 2014 - rmilasan@suse.com + +- Fix enabling predictable rules when using net.ifnames=1. + update: 1021-udev-re-add-persistent-net-rules.patch + ------------------------------------------------------------------- Fri May 30 07:35:07 UTC 2014 - rmilasan@suse.com -- Re-add persistent rules to have a backup option if predictable - rules are disabled at boot time with 'net.ifnames=0' option (bnc#880732). +- Re-add persistent rules as a default and make predictable rules as + fallback (bnc#880732). add: 1021-udev-re-add-persistent-net-rules.patch - udev: remove seqnum API and all assumptions about seqnums add: 1022-udev-remove-seqnum-API-and-all-assumptions-about-seq.patch diff --git a/systemd-mini.spec b/systemd-mini.spec index 85a34e4b..9b6b5086 100644 --- a/systemd-mini.spec +++ b/systemd-mini.spec @@ -1089,10 +1089,51 @@ sed -ri 's@^([[:blank:]]+)(cmdline\[i\+\+\][[:blank:]]+=[[:blank:]]+"-l")(;)@\1/ %endif %build +cflags () +{ + local flag=$1; shift + local var=$1; shift + local gold + test -n "${flag}" -a -n "${var}" || return + case "${!var}" in + *${flag}*) return + esac + if type ld.gold > /dev/null 2>&1 ; then + gold=-Wl,-fuse-ld=gold + fi + set -o noclobber + case "$flag" in + -Wl,*) + if echo 'int main () { return 0; }' | \ + ${CC:-gcc} -Werror $gold $flag -o /dev/null -xc - > /dev/null 2>&1 ; then + eval $var=\${$var:+\$$var\ }$flag + fi + rm -f ldtest.c + ;; + *) + if ${CC:-gcc} -Werror $gold $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then + eval $var=\${$var:+\$$var\ }$flag + fi + if ${CXX:-g++} -Werror $gold $flag -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1 ; then + eval $var=\${$var:+\$$var\ }$flag + fi + esac + set +o noclobber +} autoreconf -fiv # prevent pre-generated and distributed files from re-building find . -name "*.[1-8]" -exec touch '{}' '+'; -export V=1 +export V=e +export CFLAGS="%{optflags} $(getconf LFS_CFLAGS)" +export LDFLAGS +%if 0%{?suse_version} == 1315 + CFLAGS="$CFLAGS -DNET_IFNAMES=1" +%else + CFLAGS="$CFLAGS -DNET_IFNAMES=0" +%endif +cflags -pipe CFLAGS +cflags -Wl,-O2 LDFLAGS +cflags -Wl,--hash-size=8599 LDFLAGS # keep split-usr until all packages have moved their systemd rules to /usr %configure \ --docdir=%{_docdir}/systemd \ @@ -1133,8 +1174,7 @@ export V=1 %if %{without networkd} --disable-networkd \ %endif - --disable-kdbus \ - CFLAGS="%{optflags}" + --disable-kdbus make %{?_smp_mflags} %if ! 0%{?bootstrap} make %{?_smp_mflags} update-man-list man diff --git a/systemd.changes b/systemd.changes index c1fec0fe..26dbb209 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Tue Jun 10 11:11:55 UTC 2014 - werner@suse.de + +- Change 1021-udev-re-add-persistent-net-rules.patch to use persistent + rules as a default on SLES-12 and predictable rules as a default + otherwise +- Add cflags shell function to check possible flags for the compiler + as well as for the linker + ------------------------------------------------------------------- Mon Jun 9 08:38:33 UTC 2014 - rmilasan@suse.com @@ -94,11 +103,17 @@ Tue Jun 3 14:23:40 UTC 2014 - werner@suse.de 1023-udev-builtin-keyboard-do-tell-on-which-device-EVIOCS.patch 1024-udev-always-close-lock-file-descriptor.patch +------------------------------------------------------------------- +Tue Jun 3 12:55:53 UTC 2014 - rmilasan@suse.com + +- Fix enabling predictable rules when using net.ifnames=1. + update: 1021-udev-re-add-persistent-net-rules.patch + ------------------------------------------------------------------- Fri May 30 07:35:07 UTC 2014 - rmilasan@suse.com -- Re-add persistent rules to have a backup option if predictable - rules are disabled at boot time with 'net.ifnames=0' option (bnc#880732). +- Re-add persistent rules as a default and make predictable rules as + fallback (bnc#880732). add: 1021-udev-re-add-persistent-net-rules.patch - udev: remove seqnum API and all assumptions about seqnums add: 1022-udev-remove-seqnum-API-and-all-assumptions-about-seq.patch diff --git a/systemd.spec b/systemd.spec index af5763a9..1165efc6 100644 --- a/systemd.spec +++ b/systemd.spec @@ -1084,10 +1084,51 @@ sed -ri 's@^([[:blank:]]+)(cmdline\[i\+\+\][[:blank:]]+=[[:blank:]]+"-l")(;)@\1/ %endif %build +cflags () +{ + local flag=$1; shift + local var=$1; shift + local gold + test -n "${flag}" -a -n "${var}" || return + case "${!var}" in + *${flag}*) return + esac + if type ld.gold > /dev/null 2>&1 ; then + gold=-Wl,-fuse-ld=gold + fi + set -o noclobber + case "$flag" in + -Wl,*) + if echo 'int main () { return 0; }' | \ + ${CC:-gcc} -Werror $gold $flag -o /dev/null -xc - > /dev/null 2>&1 ; then + eval $var=\${$var:+\$$var\ }$flag + fi + rm -f ldtest.c + ;; + *) + if ${CC:-gcc} -Werror $gold $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then + eval $var=\${$var:+\$$var\ }$flag + fi + if ${CXX:-g++} -Werror $gold $flag -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1 ; then + eval $var=\${$var:+\$$var\ }$flag + fi + esac + set +o noclobber +} autoreconf -fiv # prevent pre-generated and distributed files from re-building find . -name "*.[1-8]" -exec touch '{}' '+'; -export V=1 +export V=e +export CFLAGS="%{optflags} $(getconf LFS_CFLAGS)" +export LDFLAGS +%if 0%{?suse_version} == 1315 + CFLAGS="$CFLAGS -DNET_IFNAMES=1" +%else + CFLAGS="$CFLAGS -DNET_IFNAMES=0" +%endif +cflags -pipe CFLAGS +cflags -Wl,-O2 LDFLAGS +cflags -Wl,--hash-size=8599 LDFLAGS # keep split-usr until all packages have moved their systemd rules to /usr %configure \ --docdir=%{_docdir}/systemd \ @@ -1128,8 +1169,7 @@ export V=1 %if %{without networkd} --disable-networkd \ %endif - --disable-kdbus \ - CFLAGS="%{optflags}" + --disable-kdbus make %{?_smp_mflags} %if ! 0%{?bootstrap} make %{?_smp_mflags} update-man-list man