summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/ifupdown/files/inet-6-.defn-fix-inverted-checks-for-loopback.patch
blob: bff352e3af2ae714b0cb494a131dc03a5025829e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
From 74152ac74a3e1ea0f3be292aa1eeca5ad1fe69c0 Mon Sep 17 00:00:00 2001
From: Paul Gortmaker <paul.gortmaker@windriver.com>
Date: Wed, 6 Aug 2014 15:12:11 -0400
Subject: [PATCH 2/2] inet[6].defn: fix inverted checks for loopback

Compared to the hurd link.defn for loopback, we see these
are inverted, meaning that you would only be able to configure
a loopback device that was _not_ named "lo" (unlikely to exist).

The result was that we'd update /run/network/ifstate for "lo"
but never actually do anything for up/down, as shown below:

root@localhost:~# ifconfig -s
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0   7736329      0   2016 0       5289422      0      0      0 BMRU
lo        65536 0        18      0      0 0            18      0      0      0 LRU
root@localhost:~# ifdown lo
root@localhost:~# echo $?
0
root@localhost:~# ifconfig -s
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0   7736406      0   2016 0       5289455      0      0      0 BMRU
lo        65536 0        18      0      0 0            18      0      0      0 LRU
root@localhost:~# ifconfig lo down
root@localhost:~# ifconfig -s
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0   7736474      0   2016 0       5289481      0      0      0 BMRU
root@localhost:~#

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 inet.defn  | 12 ++++++------
 inet6.defn |  8 ++++----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/inet.defn b/inet.defn
index b176ab4ed03e..5fdfb14a0e1c 100644
--- a/inet.defn
+++ b/inet.defn
@@ -6,10 +6,10 @@ method loopback
     This method may be used to define the IPv4 loopback interface.
 
   up
-    ip link set dev %iface% up if (!iface_is_lo())
+    ip link set dev %iface% up if (iface_is_lo())
 
   down
-    ip link set dev %iface% down if (!iface_is_lo())
+    ip link set dev %iface% down if (iface_is_lo())
 
 method static
   description
@@ -212,11 +212,11 @@ method loopback
 
   up
     ifconfig %iface% 127.0.0.1 up \
-	if (!iface_is_lo())
+	if (iface_is_lo())
 
   down
     ifconfig %iface% down \
-	if (!iface_is_lo())
+	if (iface_is_lo())
 
 method static
   description
@@ -371,11 +371,11 @@ method loopback
 
   up
     inetutils-ifconfig --interface %iface% --address 127.0.0.1 --up \
-	if (!iface_is_lo())
+	if (iface_is_lo())
 
   down
     inetutils-ifconfig --interface %iface% --down \
-	if (!iface_is_lo())
+	if (iface_is_lo())
 
 method static
   description
diff --git a/inet6.defn b/inet6.defn
index 09325539cd01..4df64aff38cc 100644
--- a/inet6.defn
+++ b/inet6.defn
@@ -33,11 +33,11 @@ method loopback
   description
     This method may be used to define the IPv6 loopback interface.
   up
-    -ip link set dev %iface% up 2>/dev/null if (!iface_is_lo())
-    -ip addr add dev %iface% ::1 2>/dev/null if (!iface_is_lo())
+    -ip link set dev %iface% up 2>/dev/null if (iface_is_lo())
+    -ip addr add dev %iface% ::1 2>/dev/null if (iface_is_lo())
   down
-    -ip addr del dev %iface% ::1 2>/dev/null if (!iface_is_lo())
-    -ip link set dev %iface% down 2>/dev/null if (!iface_is_lo())
+    -ip addr del dev %iface% ::1 2>/dev/null if (iface_is_lo())
+    -ip link set dev %iface% down 2>/dev/null if (iface_is_lo())
 
 method static
   description
-- 
1.9.1