blob: bff352e3af2ae714b0cb494a131dc03a5025829e [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001From 74152ac74a3e1ea0f3be292aa1eeca5ad1fe69c0 Mon Sep 17 00:00:00 2001
2From: Paul Gortmaker <paul.gortmaker@windriver.com>
3Date: Wed, 6 Aug 2014 15:12:11 -0400
4Subject: [PATCH 2/2] inet[6].defn: fix inverted checks for loopback
5
6Compared to the hurd link.defn for loopback, we see these
7are inverted, meaning that you would only be able to configure
8a loopback device that was _not_ named "lo" (unlikely to exist).
9
10The result was that we'd update /run/network/ifstate for "lo"
11but never actually do anything for up/down, as shown below:
12
13root@localhost:~# ifconfig -s
14Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
15eth0 1500 0 7736329 0 2016 0 5289422 0 0 0 BMRU
16lo 65536 0 18 0 0 0 18 0 0 0 LRU
17root@localhost:~# ifdown lo
18root@localhost:~# echo $?
190
20root@localhost:~# ifconfig -s
21Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
22eth0 1500 0 7736406 0 2016 0 5289455 0 0 0 BMRU
23lo 65536 0 18 0 0 0 18 0 0 0 LRU
24root@localhost:~# ifconfig lo down
25root@localhost:~# ifconfig -s
26Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
27eth0 1500 0 7736474 0 2016 0 5289481 0 0 0 BMRU
28root@localhost:~#
29
30Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
31---
32 inet.defn | 12 ++++++------
33 inet6.defn | 8 ++++----
34 2 files changed, 10 insertions(+), 10 deletions(-)
35
36diff --git a/inet.defn b/inet.defn
37index b176ab4ed03e..5fdfb14a0e1c 100644
38--- a/inet.defn
39+++ b/inet.defn
40@@ -6,10 +6,10 @@ method loopback
41 This method may be used to define the IPv4 loopback interface.
42
43 up
44- ip link set dev %iface% up if (!iface_is_lo())
45+ ip link set dev %iface% up if (iface_is_lo())
46
47 down
48- ip link set dev %iface% down if (!iface_is_lo())
49+ ip link set dev %iface% down if (iface_is_lo())
50
51 method static
52 description
53@@ -212,11 +212,11 @@ method loopback
54
55 up
56 ifconfig %iface% 127.0.0.1 up \
57- if (!iface_is_lo())
58+ if (iface_is_lo())
59
60 down
61 ifconfig %iface% down \
62- if (!iface_is_lo())
63+ if (iface_is_lo())
64
65 method static
66 description
67@@ -371,11 +371,11 @@ method loopback
68
69 up
70 inetutils-ifconfig --interface %iface% --address 127.0.0.1 --up \
71- if (!iface_is_lo())
72+ if (iface_is_lo())
73
74 down
75 inetutils-ifconfig --interface %iface% --down \
76- if (!iface_is_lo())
77+ if (iface_is_lo())
78
79 method static
80 description
81diff --git a/inet6.defn b/inet6.defn
82index 09325539cd01..4df64aff38cc 100644
83--- a/inet6.defn
84+++ b/inet6.defn
85@@ -33,11 +33,11 @@ method loopback
86 description
87 This method may be used to define the IPv6 loopback interface.
88 up
89- -ip link set dev %iface% up 2>/dev/null if (!iface_is_lo())
90- -ip addr add dev %iface% ::1 2>/dev/null if (!iface_is_lo())
91+ -ip link set dev %iface% up 2>/dev/null if (iface_is_lo())
92+ -ip addr add dev %iface% ::1 2>/dev/null if (iface_is_lo())
93 down
94- -ip addr del dev %iface% ::1 2>/dev/null if (!iface_is_lo())
95- -ip link set dev %iface% down 2>/dev/null if (!iface_is_lo())
96+ -ip addr del dev %iface% ::1 2>/dev/null if (iface_is_lo())
97+ -ip link set dev %iface% down 2>/dev/null if (iface_is_lo())
98
99 method static
100 description
101--
1021.9.1
103