[Interest] QNetworkInterface working differently on Qt5?

Thiago Macieira thiago.macieira at intel.com
Wed Dec 2 17:02:16 CET 2015


On Wednesday 02 December 2015 08:09:26 Tom Isaacson wrote:
> >ifconfig has been deprecated for 10 years. Please show me the output of ip
> >addr
> # ip addr
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
>     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>     inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
>        valid_lft forever preferred_lft forever
> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
> UP qlen 1000 link/ether 00:0e:c2:26:82:76 brd ff:ff:ff:ff:ff:ff
>     inet 169.254.142.146/16 brd 169.254.255.255 scope global eth0
>        valid_lft forever preferred_lft forever
>     inet 192.168.0.11/16 brd 192.168.255.255 scope global eth0:dhcp
>        valid_lft forever preferred_lft forever

Hmm... The way that your system sets up this secondary address makes it show 
up in QNetworkInterface as a separate interface:

 Interface:      "wlp2s0" 
     index:      2
     flags:      Up,Running,Broadcast,Multicast
     hw address: 5C:51:4F:7C:49:F8
     address  0: 10.0.0.108/24 (255.255.255.0) broadcast 10.0.0.255
     address  1: fd2d:2122:f24:0:65d8:a47f:c825:2fe5/64 
(ffff:ffff:ffff:ffff::)
     address  2: fd2d:2122:f24:0:5e51:4fff:fe7c:49f8/64 
(ffff:ffff:ffff:ffff::)
     address  3: 2601:1c0:5803:81c9:65d8:a47f:c825:2fe5/64 
(ffff:ffff:ffff:ffff::)
     address  4: 2601:1c0:5803:81c9:5e51:4fff:fe7c:49f8/64 
(ffff:ffff:ffff:ffff::)
     address  5: fd2d:2122:f24::9bd/128 
(ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff)
     address  6: fe80::5e51:4fff:fe7c:49f8%wlp2s0/64 (ffff:ffff:ffff:ffff::)
 Interface:      "wlp2s0:foo" 
     index:      2
     flags:      Up,Running,Broadcast,Multicast
     hw address: 5C:51:4F:7C:49:F8
     address  0: 10.0.1.108/8 (255.0.0.0) broadcast 10.255.255.255

Both interfaces have the same interface index, which is bad for multiple 
reasons.

I did some changes for QNetworkInterface for Qt 5.2 that may have caused this 
problem. I will look into changing it so that the information is merged. The 
extra interface name will be lost (good riddance!).
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list