QNetworkInterface/Linux: fix support for P-t-P tunnels
The kernel stores the local address in IFA_LOCAL and the peer's address in IFA_ADDRESS. My testing with loopback, Ethernet, WiFi, OpenVPN TAP and TUN and Openconnect shows IFA_LOCAL is always passed and always correct, so we could have used just that, but let's leave the use of IFA_ADDRESS because that's also what all libcs' getifaddrs() do. [ChangeLog][QtNetwork][QNetworkInterface] Fixed a regression in reporting the local address of a point-to-point tunnel network interface. Task-number: QTBUG-67226 Change-Id: I04a43ee94975482f9e32fffd151eb393d1775580 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
dbc983a513
commit
411a4cb67c
@ -382,7 +382,14 @@ static void getAddresses(int sock, char *buf, QList<QNetworkInterfacePrivate *>
|
||||
auto payloadPtr = reinterpret_cast<uchar *>(RTA_DATA(rta));
|
||||
|
||||
switch (rta->rta_type) {
|
||||
case IFA_ADDRESS: // address
|
||||
case IFA_ADDRESS:
|
||||
// Local address (all interfaces except for point-to-point)
|
||||
if (entry.ip().isNull())
|
||||
entry.setIp(makeAddress(payloadPtr, payloadLen));
|
||||
break;
|
||||
|
||||
case IFA_LOCAL:
|
||||
// Override the local address (point-to-point interfaces)
|
||||
entry.setIp(makeAddress(payloadPtr, payloadLen));
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user