Magellan Linux

Annotation of /trunk/dracut/patches/dracut-034-iface_has_link-fixup.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2370 - (hide annotations) (download)
Mon Jan 20 09:52:51 2014 UTC (10 years, 4 months ago) by niro
File size: 2154 byte(s)
-added upstream patches to fix networking
1 niro 2370 From 7c8da72c11b74a1759e0ebbabe003d69a4459114 Mon Sep 17 00:00:00 2001
2     From: Harald Hoyer <harald@redhat.com>
3     Date: Mon, 02 Dec 2013 09:36:42 +0000
4     Subject: network/net-lib.sh:iface_has_link() fixup
5    
6     Just echo'ing the flags IFF_UP|IFF_RUNNING does _not_ reflect the
7     carrier state immediately. So wait for it to really show up.
8     ---
9     diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
10     index 0aa312a..7544401 100644
11     --- a/modules.d/40network/net-lib.sh
12     +++ b/modules.d/40network/net-lib.sh
13     @@ -28,30 +28,6 @@ iface_for_mac() {
14     done
15     }
16    
17     -iface_has_link() {
18     - local interface="$1" flags=""
19     - [ -n "$interface" ] || return 2
20     - interface="/sys/class/net/$interface"
21     - [ -d "$interface" ] || return 2
22     - flags=$(cat $interface/flags)
23     - echo $(($flags|0x41)) > $interface/flags # 0x41: IFF_UP|IFF_RUNNING
24     - [ "$(cat $interface/carrier)" = 1 ] || return 1
25     - # XXX Do we need to reset the flags here? anaconda never bothered..
26     -}
27     -
28     -find_iface_with_link() {
29     - local iface_path="" iface=""
30     - for iface_path in /sys/class/net/*; do
31     - iface=${iface_path##*/}
32     - str_starts "$iface" "lo" && continue
33     - if iface_has_link $iface; then
34     - echo "$iface"
35     - return 0
36     - fi
37     - done
38     - return 1
39     -}
40     -
41     # get the iface name for the given identifier - either a MAC, IP, or iface name
42     iface_name() {
43     case $1 in
44     @@ -483,3 +459,26 @@ type hostname >/dev/null 2>&1 || \
45     hostname() {
46     cat /proc/sys/kernel/hostname
47     }
48     +
49     +iface_has_link() {
50     + local interface="$1" flags=""
51     + [ -n "$interface" ] || return 2
52     + interface="/sys/class/net/$interface"
53     + [ -d "$interface" ] || return 2
54     + linkup "$1"
55     + [ "$(cat $interface/carrier)" = 1 ] || return 1
56     + # XXX Do we need to reset the flags here? anaconda never bothered..
57     +}
58     +
59     +find_iface_with_link() {
60     + local iface_path="" iface=""
61     + for iface_path in /sys/class/net/*; do
62     + iface=${iface_path##*/}
63     + str_starts "$iface" "lo" && continue
64     + if iface_has_link $iface; then
65     + echo "$iface"
66     + return 0
67     + fi
68     + done
69     + return 1
70     +}
71     --
72     cgit v0.9.2