]> code.ossystems Code Review - openembedded-core.git/commitdiff
ifupdown: fix issue for configuring loopback interface
authorYi Zhao <yi.zhao@windriver.com>
Wed, 17 Oct 2018 02:42:55 +0000 (10:42 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 18 Oct 2018 09:38:57 +0000 (10:38 +0100)
The patch inet-6-.defn-fix-inverted-checks-for-loopback.patch introduced
an issue that ifup/ifdown can not configure loopback interface:

$ cat /etc/network/interfaces
auto lo
iface lo inet loopback

$ 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         1      0      0 0            74      0      0 0 BMRU
lo        65536 0         2      0      0 0             2      0      0 0 LRU
$ ifdown lo
$ 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         1      0      0 0            74      0      0 0 BMRU
lo        65536 0         2      0      0 0             2      0      0 0 LRU

The original patch is for 0.7.x and the change is not needed for 0.8.x.
Update the patch to make the ifup/ifdown can configure lo interface:
$ 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         0      0      0 0            77      0      0 0 BMRU
lo        65536 0         2      0      0 0             2      0      0 0 LRU
$ ifdown lo
$ 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         0      0      0 0            80      0      0 0 BMRU
$ ifup lo
$ 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         0      0      0 0            81      0      0 0 BMRU
lo        65536 0         2      0      0 0             2      0      0 0 LRU

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/ifupdown/files/inet-6-.defn-fix-inverted-checks-for-loopback.patch

index 2013933b691e6b47a7cf068ed8984cd9f4cdd423..37a61c9bc1654c329a7c0020e1283260717aa935 100644 (file)
@@ -1,4 +1,4 @@
-From d88af5aa0312ea18aac791d66661da79b7bcd032 Mon Sep 17 00:00:00 2001
+From 7efe4676747e4e4a056b9bfb4e9424c8354e9996 Mon Sep 17 00:00:00 2001
 From: "Maxin B. John" <maxin.john@intel.com>
 Date: Wed, 21 Dec 2016 15:32:07 +0200
 Subject: [PATCH] inet[6].defn: fix inverted checks for loopback
@@ -35,12 +35,13 @@ Upstream-Status: Inappropriate [OE specific]
 
 Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
 Signed-off-by: Maxin B. John <maxin.john@intel.com>
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
 ---
- inet.defn | 148 +++++++++++++++++++++++++++++++-------------------------------
- 1 file changed, 74 insertions(+), 74 deletions(-)
+ inet.defn | 140 +++++++++++++++++++++++++++++++-------------------------------
+ 1 file changed, 70 insertions(+), 70 deletions(-)
 
 diff --git a/inet.defn b/inet.defn
-index 75e6744..b5f5da2 100644
+index 75e6744..23c7756 100644
 --- a/inet.defn
 +++ b/inet.defn
 @@ -6,10 +6,10 @@ method loopback
@@ -48,11 +49,11 @@ index 75e6744..b5f5da2 100644
  
    up
 -    /bin/ip link set dev %iface% up if (!iface_is_lo())
-+    ip link set dev %iface% up if (iface_is_lo())
++    ip link set dev %iface% up if (!iface_is_lo())
  
    down
 -    /bin/ip link set dev %iface% down if (!iface_is_lo())
-+    ip link set dev %iface% down if (iface_is_lo())
++    ip link set dev %iface% down if (!iface_is_lo())
  
  method static
    description
@@ -211,23 +212,20 @@ index 75e6744..b5f5da2 100644
  
  architecture kfreebsd
  
-@@ -211,12 +211,12 @@ method loopback
+@@ -211,11 +211,11 @@ method loopback
      This method may be used to define the IPv4 loopback interface.
  
    up
 -    /sbin/ifconfig %iface% 127.0.0.1 up \
--      if (!iface_is_lo())
 +    ifconfig %iface% 127.0.0.1 up \
-+      if (iface_is_lo())
+       if (!iface_is_lo())
  
    down
 -    /sbin/ifconfig %iface% down \
--      if (!iface_is_lo())
 +    ifconfig %iface% down \
-+      if (iface_is_lo())
+       if (!iface_is_lo())
  
  method static
-   description
 @@ -238,15 +238,15 @@ method static
      hwaddress cleanup_hwaddress
  
@@ -339,20 +337,6 @@ index 75e6744..b5f5da2 100644
  architecture hurd
  
  method loopback
-@@ -367,11 +367,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
 @@ -432,23 +432,23 @@ method dhcp
  
    up
@@ -418,5 +402,5 @@ index 75e6744..b5f5da2 100644
 -    /usr/sbin/avahi-autoipd --kill %iface%
 +    avahi-autoipd --kill %iface%
 -- 
-2.4.0
+2.7.4