Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From 74152ac74a3e1ea0f3be292aa1eeca5ad1fe69c0 Mon Sep 17 00:00:00 2001 |
| 2 | From: Paul Gortmaker <paul.gortmaker@windriver.com> |
| 3 | Date: Wed, 6 Aug 2014 15:12:11 -0400 |
| 4 | Subject: [PATCH 2/2] inet[6].defn: fix inverted checks for loopback |
| 5 | |
| 6 | Compared to the hurd link.defn for loopback, we see these |
| 7 | are inverted, meaning that you would only be able to configure |
| 8 | a loopback device that was _not_ named "lo" (unlikely to exist). |
| 9 | |
| 10 | The result was that we'd update /run/network/ifstate for "lo" |
| 11 | but never actually do anything for up/down, as shown below: |
| 12 | |
| 13 | root@localhost:~# ifconfig -s |
| 14 | Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg |
| 15 | eth0 1500 0 7736329 0 2016 0 5289422 0 0 0 BMRU |
| 16 | lo 65536 0 18 0 0 0 18 0 0 0 LRU |
| 17 | root@localhost:~# ifdown lo |
| 18 | root@localhost:~# echo $? |
| 19 | 0 |
| 20 | root@localhost:~# ifconfig -s |
| 21 | Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg |
| 22 | eth0 1500 0 7736406 0 2016 0 5289455 0 0 0 BMRU |
| 23 | lo 65536 0 18 0 0 0 18 0 0 0 LRU |
| 24 | root@localhost:~# ifconfig lo down |
| 25 | root@localhost:~# ifconfig -s |
| 26 | Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg |
| 27 | eth0 1500 0 7736474 0 2016 0 5289481 0 0 0 BMRU |
| 28 | root@localhost:~# |
| 29 | |
| 30 | Signed-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 | |
| 36 | diff --git a/inet.defn b/inet.defn |
| 37 | index 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 |
| 81 | diff --git a/inet6.defn b/inet6.defn |
| 82 | index 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 | -- |
| 102 | 1.9.1 |
| 103 | |