]> code.ossystems Code Review - openembedded-core.git/commit
net-tools: backport a patch from upstream to use the same ifconfig format as debian...
authorMartin Jansa <Martin.Jansa@gmail.com>
Tue, 16 Jun 2020 18:12:42 +0000 (20:12 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 17 Jun 2020 10:09:28 +0000 (11:09 +0100)
commitdacfd695061b186240a85f8ffc43e6636c56e1fb
treefa91e9ed8e5b8bf4a8a620e675691a501c833edf
parent41fac86156bfddfa604a604c6dc0d98b886a7586
net-tools: backport a patch from upstream to use the same ifconfig format as debian/ubuntu

* this is needed for python3-ifcfg to parse it correctly
  https://github.com/ftao/python-ifcfg/issues/43
* backport this single patch, so it can be backported to dunfell
  then for master we should upgrade to new snapshot from debian
  which includes other fixes and improvements as well
* this is already part of net-tools_1.60-26.diff from debian we're using
  but it's first added there and then removed
  $ grep 'sprintf(flags' net-tools_1.60-26.diff
  ++    sprintf(flags, "flags=%d<", ptr->flags);
  +-    sprintf(flags, "flags=%d<", ptr->flags);

* before:
root@qemux86-64:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 52:54:00:12:34:02
          inet addr:192.168.7.2  Bcast:192.168.7.255  Mask:255.255.255.0
          inet6 addr: fe80::5054:ff:fe12:3402/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:106 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:496 (496.0 B)  TX bytes:42832 (41.8 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:846 errors:0 dropped:0 overruns:0 frame:0
          TX packets:846 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:53364 (52.1 KiB)  TX bytes:53364 (52.1 KiB)

* after:

root@qemux86-64:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 192.168.7.2  netmask 255.255.255.0  broadcast 192.168.7.255
        inet6 fe80::5054:ff:fe12:3402  prefixlen 64  scopeid 0x20<link>
        ether 52:54:00:12:34:02  txqueuelen 1000  (Ethernet)
        RX packets 6  bytes 496 (496.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 14  bytes 2140 (2.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536  metric 1
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 80  bytes 6080 (5.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 80  bytes 6080 (5.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

* for comparison ubuntu-20.04 in docker:

root@dafcbbf25ff2:/# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.2  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:ac:11:00:02  txqueuelen 0  (Ethernet)
        RX packets 39299  bytes 89614740 (89.6 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 33767  bytes 3807354 (3.8 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 5658  bytes 1294220 (1.2 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5658  bytes 1294220 (1.2 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

* python3-ifcfg now parses flags correctly:
root@qemux86-64:~# python3 -m ifcfg.cli | python3 -m json.tool
{
    "eth0": {
        "inet": "192.168.7.2",
        "inet4": [
            "192.168.7.2"
        ],
        "ether": "52:54:00:12:34:02",
        "inet6": [
            "fe80::5054:ff:fe12:3402"
        ],
        "netmask": "255.255.255.0",
        "device": "eth0",
        "flags": "4163<UP,BROADCAST,RUNNING,MULTICAST> ",
        "mtu": "1500",
        "broadcast": "192.168.7.255"
    },
    "lo": {
        "inet": "127.0.0.1",
        "inet4": [
            "127.0.0.1"
        ],
        "ether": null,
        "inet6": [
            "::1"
        ],
        "netmask": "255.0.0.0",
        "device": "lo",
        "flags": "73<UP,LOOPBACK,RUNNING> ",
        "mtu": "65536"
    },
    "sit0": {
        "inet": null,
        "inet4": [],
        "ether": null,
        "inet6": [],
        "netmask": null,
        "device": "sit0",
        "flags": "128<NOARP> ",
        "mtu": "1480"
    }
}

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-extended/net-tools/net-tools/0001-added-ull-prefix-to-unsigned-long-long-constants-to-.patch [new file with mode: 0644]
meta/recipes-extended/net-tools/net-tools_1.60-26.bb