Re: [Development] Qt5 Bearer: broken PPP support

2016-09-22 Thread Alexander Smirnov

On 09/22/2016 05:07 AM, Thiago Macieira wrote:

On quarta-feira, 21 de setembro de 2016 07:57:42 PDT Thiago Macieira wrote:

I'll fix it when I'm back home tonight.


https://codereview.qt-project.org/171756


This works for me!



It was quite simple.



--
With best regards,
Alexander Smirnov

ilbers GmbH
Baierbrunner Str. 28c
D-81379 München
+49 (89) 122 67 24-0
http://ilbers.de/
Commercial register Munich, HRB 214197
General manager: Baurzhan Ismagulov
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Qt5 Bearer: broken PPP support

2016-09-21 Thread Thiago Macieira
On quarta-feira, 21 de setembro de 2016 07:57:42 PDT Thiago Macieira wrote:
> I'll fix it when I'm back home tonight.

https://codereview.qt-project.org/171756

It was quite simple.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Qt5 Bearer: broken PPP support

2016-09-21 Thread Thiago Macieira
On quarta-feira, 21 de setembro de 2016 10:11:00 PDT Alexander Smirnov wrote:
> ppp0 interface is created by typical Linux pppd daemon.
> tun2 interface is created by openvpn.
> 
> > I'll fix it.
> 
> Please let me know, if you need additional information.

I thought I'd fixed the tun case, as I do have an openvpn VPN...

Anyway, that means it's that much easier for me to reproduce and fix. I've got 
this with tst_qnetworkinterface dump, for an openconnect VPN:

Interface:  "vpn0" 
index:  15
flags:  Up,Running,PointToPoint,Multicast
type:   QNetworkInterface::InterfaceType(Virtual)
hw address: 00:00:00:00:00:00
address  0: 10.255.92.115/19 (255.255.224.0) broadcast 10.255.95.255
Interface:  "vpn0" 
index:  15
flags:  Up,Running,PointToPoint,Multicast
type:   QNetworkInterface::InterfaceType(Virtual)
hw address: 00:00:00:00:00:00

I'll fix it when I'm back home tonight.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Qt5 Bearer: broken PPP support

2016-09-21 Thread Alexander Smirnov

Hi Thiago,


On terça-feira, 20 de setembro de 2016 22:48:42 PDT Alexander Smirnov wrote:

After debugging I figured out, that the problem is in commit:

043f5d3eb52587831f643bc52c95079c36d984c7

This commit allows to add to list:

QList interfaces;

interfaces with no address field (ifa_addr == NULL).

Then, I've checked the output from 'getifaddrs()' syscall on my board,
and it returns 2! instances of ppp0:

   - one with AF_INET family
   - one with ifa_addr == NULL

[cut]

So, is it a bug? :-)


Probably. Can you give me a full dump of what getifaddrs gave you along with

ip -d link show dev ppp0
ip -d addr show dev ppp0



So, I've attached the following:

[ifconfig.log] - output from 'ifconfig -a'

[getifaddrs.c] - test app to show getifaddrs() output, derived from man 
page, but fixed to not to skip null addresses


[getifaddrs.log] - output from test app

[ip.log] - output from ip command as you requested

NOTE: I've also observed the same behavior for tun devices.

ppp0 interface is created by typical Linux pppd daemon.
tun2 interface is created by openvpn.


I'll fix it.



Please let me know, if you need additional information.

--
With best regards,
Alexander Smirnov

ilbers GmbH
Baierbrunner Str. 28c
D-81379 München
+49 (89) 122 67 24-0
http://ilbers.de/
Commercial register Munich, HRB 214197
General manager: Baurzhan Ismagulov
#include 
#include 
#include 
#include 
#include 
#include 
#include 

int main(int argc, char** argv)
{
struct ifaddrs *ifaddr, *ifa;
int family, s;
char host[NI_MAXHOST];

if (getifaddrs() == -1) {
perror("getifaddrs");
exit(EXIT_FAILURE);
}

/* Walk through linked list, maintaining head pointer so we
 * can free list later
 */
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
if (ifa->ifa_addr == NULL) {
printf("%s \taddress: NULL\n", ifa->ifa_name);
continue;
}

family = ifa->ifa_addr->sa_family;

/* Display interface name and family (including symbolic
 * form of the latter for the common families)
 */
printf("%s \tfamily: %d%s\n",
   ifa->ifa_name, family,
   (family == AF_PACKET) ? " (AF_PACKET)" :
   (family == AF_INET) ?   " (AF_INET)" :
   (family == AF_INET6) ?  " (AF_INET6)" : "");

/* For an AF_INET* interface address, display the address */

if (family == AF_INET || family == AF_INET6) {
s = getnameinfo(ifa->ifa_addr,
(family == AF_INET) ? sizeof(struct sockaddr_in) :
sizeof(struct sockaddr_in6),
host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
if (s != 0) {
printf("getnameinfo() failed: %s\n", gai_strerror(s));
exit(EXIT_FAILURE);
}

printf("\taddress: <%s>\n", host);
}
}

freeifaddrs(ifaddr);
exit(EXIT_SUCCESS);
}
# getifaddrs
 
lo  family: 17 (AF_PACKET)
can0address: NULL
eth0family: 17 (AF_PACKET)
wlan0   family: 17 (AF_PACKET)
sit0family: 17 (AF_PACKET)
ppp0address: NULL
tun2address: NULL
lo  family: 2 (AF_INET)
address: <127.0.0.1>
eth0family: 2 (AF_INET)
address: <192.168.178.110>
ppp0family: 2 (AF_INET)
address: <10.142.173.66>
tun2family: 2 (AF_INET)
address: <10.0.0.1>
lo  family: 10 (AF_INET6)
address: <::1>
eth0family: 10 (AF_INET6)
address: 
# ifconfig -a
can0  Link encap:UNSPEC  HWaddr 
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
  NOARP  MTU:16  Metric:1
  RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:10 
  RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
  Interrupt:30 

eth0  Link encap:Ethernet  HWaddr 00:01:C0:19:6C:24  
  inet addr:192.168.178.110  Bcast:192.168.178.255  Mask:255.255.255.0
  inet6 addr: fe80::201:c0ff:fe19:6c24%1996412624/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:361871 errors:9529 dropped:60 overruns:9529 frame:9529
  TX packets:169960 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000 
  RX bytes:511238273 (487.5 MiB)  TX bytes:11817634 (11.2 MiB)

loLink encap:Local Loopback  
  inet addr:127.0.0.1  Mask:255.0.0.0
  inet6 addr: ::1%1996412624/128 Scope:Host
  UP LOOPBACK RUNNING  MTU:65536  Metric:1
  RX packets:8 errors:0 dropped:0 overruns:0 frame:0
  TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0 
  RX bytes:512 (512.0 B)  TX bytes:512 (512.0 B)

ppp0  Link encap:Point-to-Point Protocol  
  inet addr:10.142.173.66  P-t-P:10.142.173.66  

Re: [Development] Qt5 Bearer: broken PPP support

2016-09-20 Thread Thiago Macieira
On terça-feira, 20 de setembro de 2016 22:48:42 PDT Alexander Smirnov wrote:
> After debugging I figured out, that the problem is in commit:
> 
>043f5d3eb52587831f643bc52c95079c36d984c7
> 
> This commit allows to add to list:
> 
>QList interfaces;
> 
> interfaces with no address field (ifa_addr == NULL).
> 
> Then, I've checked the output from 'getifaddrs()' syscall on my board,
> and it returns 2! instances of ppp0:
> 
>   - one with AF_INET family
>   - one with ifa_addr == NULL
[cut]
> So, is it a bug? :-)

Probably. Can you give me a full dump of what getifaddrs gave you along with

ip -d link show dev ppp0
ip -d addr show dev ppp0

I'll fix it.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


[Development] Qt5 Bearer: broken PPP support

2016-09-20 Thread Alexander Smirnov

Dear all,

I've faced with the following problem. I use the Linux-based board, in 
which I start PPP daemon to have GPRS networking. After upgrading from 
Qt5.4 to Qt5.6 my ppp0 interface is always in 
QNetworkConfiguration::Defined state, so it's unusable.


After debugging I figured out, that the problem is in commit:

  043f5d3eb52587831f643bc52c95079c36d984c7

This commit allows to add to list:

  QList interfaces;

interfaces with no address field (ifa_addr == NULL).

Then, I've checked the output from 'getifaddrs()' syscall on my board, 
and it returns 2! instances of ppp0:


 - one with AF_INET family
 - one with ifa_addr == NULL

So, with the commit mentioned above, there are 2 ppp0 interfaces now in 
the list, one - correct, second - incorrect.


Due to this mix, eventually in

  QGenericEngine::doRequestUpdate()

ppp0 is always set to QNetworkConfiguration::Defined, because:

  interface.addressEntries().isEmpty()


Reverting the patch helps to get ppp0 in QNetworkConfiguration::Active 
state.


So, is it a bug? :-)

--
With best regards,
Alexander Smirnov

ilbers GmbH
Baierbrunner Str. 28c
D-81379 München
+49 (89) 122 67 24-0
http://ilbers.de/
Commercial register Munich, HRB 214197
General manager: Baurzhan Ismagulov
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development