summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qnativesocketengine_unix.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-071-1/+4
|\ | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/linux-icc/qmake.conf mkspecs/macx-icc/qmake.conf mkspecs/win32-icc/qmake.conf src/gui/painting/qgrayraster.c Change-Id: Ib08c45ea3215be05f986ecb3e1f4b37d209aa775
| * Fix GCC warning about dereferencing type-punned pointersThiago Macieira2017-04-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC is wrong. Type-punning is when you read something of a given type as something else. We're not doing that, as it's only read as integer. qnativesocketengine_unix.cpp:1011:79: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] Too bad my plan for a good C++ solution was foiled by glibc developers. Change-Id: I27b55fdf514247549455fffd14b1a27667745e94 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * Fix build without features.networkinterfaceTasuku Suzuki2017-04-041-0/+2
| | | | | | | | | | Change-Id: I9fd2a7ec402a1d2d99e30f08554d86f18c6424ff Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-03-021-4/+10
|\| | | | | | | Change-Id: I84097f8e7b3b2128028bd7693c913d6968b82bfe
| * Fix multicastMembershipHelper to not assume addresses are IPv4Edward Welbourne2017-02-221-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Make it iterate the addresses available looking for an IPv4 address, when that's what it needs, instead of just assuming the first entry in the list (when non-empty) is IPv4. Based on a suggestion by Dmitry Pankratov. Task-number: QTBUG-27641 Change-Id: I1920f68ade44a996ea5c2ed691a87ff3e686f35a Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Join two else/if lines that were left splitEdward Welbourne2017-02-211-2/+1
|/ | | | | | | Probably after-effects of some #if-ery we removed long ago ... Change-Id: I8bf7a97dc5fda615bf20c37ccd9c1de0ba9194e5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-161-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/global/qglobal.cpp src/corelib/tools/qstring.cpp src/network/socket/qabstractsocket.cpp src/network/socket/qnativesocketengine_unix.cpp src/plugins/platforms/eglfs/api/qeglfsglobal.h Change-Id: Id5dfdbd30fa996f9b4b66a0b030b7d3b8c0ef288
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-101-1/+1
| |\ | | | | | | | | | Change-Id: I1a63523de158757964b6fb5ea026cf69a6c5ddcf
| | * QNativeSocketEngine::option(): return a correct value on invalid callAlex Trotsenko2016-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Instead of 'true', it should be '-1'. Change-Id: I5e8f99153da68d34b37477ef4cedbc447fba347f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Fix some syntax issues in SCTP implementationAlex Trotsenko2016-08-031-2/+2
| | | | | | | | | | | | | | | | | | Change-Id: I718fd060e313d544a5470fa20183db04ef89b1ca Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Introduce SCTP sockets supportAlex Trotsenko2016-07-271-22/+160
|/ / | | | | | | | | | | | | Add protocol-specific code and the QSctpServer, QSctpSocket classes. Change-Id: Ie9a1d87bd1fda866a2405043d1c15c12ded5a96e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Edward Welbourne2016-07-041-4/+1
|\| | | | | | | Change-Id: Ibd81cd1df4a0650d93fcb556a57be90be2e1f569
| * Replace LLINDEX macro not present on all BSDs with the codeRalf Nolden2016-07-031-4/+1
| | | | | | | | | | | | | | | | | | | | FreeBSD < 10 doesn't have the LLINDEX macro either in net/if_dl.h, so besides OpenBSD yet another condition to declare the LLINDEX macro for systems where it isn't present does make it more complicated than replacing its usage with the actual code. Change-Id: I7e8ef3e265564526e05ec3115f9fa765d399f045 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-061-1/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf config.tests/unix/nis/nis.cpp mkspecs/unsupported/freebsd-g++/qplatformdefs.h src/corelib/tools/qdatetime.cpp src/corelib/tools/qsimd.cpp src/corelib/tools/qsimd_p.h src/network/access/access.pri src/network/access/qnetworkreplynsurlconnectionimpl.mm src/network/access/qnetworkreplynsurlconnectionimpl_p.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/printsupport/windows/qwindowsprintdevice.cpp tests/auto/corelib/kernel/qobject/tst_qobject.cpp tests/auto/network/access/qnetworkreply/BLACKLIST tests/auto/widgets/widgets/qopenglwidget/BLACKLIST Change-Id: I4b32055bbf922392ef0264fd403405416fffee57
| * Compile fix for OpenBSD using Q_OS_OPENBSD definesRalf Nolden2016-05-311-1/+5
| | | | | | | | | | | | | | | | | | OpenBSD does not have EPROTO and LLINDEX.. LLINDEX is only a macro pointing at sdl_index so use the FreeBSD macro from <net/if_dl.h> as a a workaround. Change-Id: Ic3ccecc1b671bb28d14da83ba915ec3fcad2657d Reviewed-by: Richard J. Moore <rich@kde.org>
* | QtNetwork: use const (and const APIs) moreAnton Kudryavtsev2016-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | For CoW types, prefer const methods to avoid needless detach()ing. Mark predictNextRequest() as const, because this method does not modify the object. Change-Id: Ic94e2b31445ece46ab1423bf5b5f4e66d9a5b6ca Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Adjust include file for native sockets on INTEGRITY.Rolland Dudemaine2016-03-311-0/+3
| | | | | | | | | | Change-Id: Ibe957eb510fd46d828acedd3e66fa0b49c9a42f0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | Integrate network sockets into the multichannel infrastructureAlex Trotsenko2016-03-011-3/+6
| | | | | | | | | | | | | | Change-Id: I96974a7460c29b46cae8a28aadb3e50cdcdb7beb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
* | Clean up new poll code slightlyLouai Al-Khanji2016-02-041-13/+2
| | | | | | | | | | Change-Id: I046126ff69a77a50e79efb1b6ebb0fffef67ac8e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Unix platforms: Use poll in native socket engine instead of selectLouai Al-Khanji2016-02-031-29/+29
| | | | | | | | | | Change-Id: I10fde9f446ee17c921ce9cf356a27daac396321d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix QSocketEngineBackend::nativeBytesAvaible for UDP socketsTimur Pocheptsov2016-01-291-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On OS X ioctl(... FIONREAD) on UDP socket returns more than expected: "SO_NREAD returns the amount of data in the input buffer that is available to be received For datagram oriented sockets, SO_NREAD returns the size of the first packet -- this dif- fers from the ioctl() command FIONREAD that returns the total amount of data available." (man getsockopt). On OS X bytesAvailable for UDP socket seems to include some headers also: for a datagram of size 1 - bytesAvailable == 17, 2 - bytesAvailable == 18 etc. Found in a broken tst_qudpsocket test. Change-Id: I88be827c66208835ed10b010f13d9dc70576fea4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Updated license headersJani Heikkinen2016-01-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devFrederik Gladhorn2016-01-081-1/+1
|\| | | | | | | | | | | Based on merge done by Liang Qi Change-Id: Id566e5b9f284d29bff2199f13f9417c660f5b26f
| * QNativeSocketEngine: fix undefined variable on FreeBSDDmitry Shachnev2016-01-021-1/+1
| | | | | | | | | | Change-Id: I192e20eef4db27fc19ec9a6e517ae5c8cb88897c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Remove remaining support for BlackberryLouai Al-Khanji2015-11-211-48/+0
| | | | | | | | | | | | | | | | | | The platform is no longer supported or actively maintained, and is in the way for improvements to the Unix event dispatcher and QProcess implementations. Change-Id: I3935488ca12e2139ea5f46068d7665a453e20526 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-11-181-4/+7
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qprocess.cpp src/corelib/io/qprocess_unix.cpp src/network/kernel/qnetworkinterface_winrt.cpp tools/configure/configureapp.cpp Change-Id: I47df00a01597d2e63b334b492b3b4221b29f58ea
| * QNativeSocketEngine: fix build in debug mode under UnixAlex Trotsenko2015-11-091-4/+7
| | | | | | | | | | Change-Id: I197e4853cd3ddd7543bbdb12cecc19c0ed2c9ee2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-231-1/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf configure src/corelib/global/qglobal.h src/tools/qdoc/node.cpp src/tools/qdoc/qdocdatabase.cpp tests/auto/corelib/io/qsettings/tst_qsettings.cpp tools/configure/configureapp.cpp Change-Id: I66028ae5e441a06b73ee85ba72a03a3af3e8593f
| * QNativeSocketEngine: allocate more space for the ancillary dataAlex Trotsenko2015-10-211-1/+5
| | | | | | | | | | | | | | | | | | | | As a corner case on BSD systems, we use IP_RECVIF control message to retrieve an interface index of the received datagram. Take care about sockaddr_dl structure, while calculating a size of the ancillary data buffer. Change-Id: I1c113d390a4929489c4c5858847b6262f1baa204 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add QNetworkInterface::interface{IndexFromName,NameFromIndex}Thiago Macieira2015-10-151-24/+2
|/ | | | | | | | | | These are for faster lookups between ID and name when one doesn't need the full information set about the interface. Change-Id: I7de033f80b0e4431b7f1ffff13f98d448a705c3e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-10-021-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/tools/qstring.h src/gui/image/qimagereader.cpp src/network/access/qnetworkaccessmanager.cpp src/tools/qdoc/doc/examples/examples.qdoc src/widgets/accessible/qaccessiblewidgetfactory_p.h src/widgets/doc/qtwidgets.qdocconf Change-Id: I8fae62283aebefe24e5ca4b4abd97386560c0fcb
| * QNativeSocketEngine: fix SO_REUSEPORT problems on LinuxAlexander Rössler2015-09-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit d1cd75e81af809a46fcf40cd2b39858e238a4d97 introduced the usage of the SO_REUSEPORT socket flag on Unix systems if available. However, on Linux systems this socket option behaves differently from the previously used SO_REUSEADDR socket option. This patch disables the use of the SO_REUSEPORT option to fix rebinding problems on Linux. The option was introduced to improve support on OS X and other BSDs. It is not necessary on Linux. [ChangeLog][QtNetwork][QUdpSocket] Fixed a bug that caused the QAbstractSocket::ShareAddress option not to work on Linux. Change-Id: Ice04b8b9e78400dce193e2c1d73b67e33edf8840 Reviewed-by: Richard J. Moore <rich@kde.org>
* | QNativeSocketEngine Unix: do the same as for WindowsThiago Macieira2015-08-221-88/+22
| | | | | | | | | | Change-Id: Iee8cbc07c4434ce9b560ffff13ca9d9858cf7111 Reviewed-by: Richard J. Moore <rich@kde.org>
* | QNativeSocketEngine: add code to send extra IP header dataThiago Macieira2015-08-221-0/+58
| | | | | | | | | | Change-Id: Iee8cbc07c4434ce9b560ffff13ca48c053bd88ed Reviewed-by: Richard J. Moore <rich@kde.org>
* | QNativeSocketEngine: add code to receive IP header dataThiago Macieira2015-08-221-1/+86
| | | | | | | | | | | | | | Change-Id: Iee8cbc07c4434ce9b560ffff13ca466263abcb1b Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
* | QNativeSocketEngine: use sendmsg/recvmsg instead of sendto/recvfromThiago Macieira2015-08-221-36/+50
| | | | | | | | | | | | | | | | | | | | | | | | We'll need to use these functions instead of the ones we're currently using in order to access the ancillary data. Note that on Windows the two functions aren't globals, but must be obtained via ioctl, which means they can fail. If they do, we fall back to using WSARecvFrom/WSASendTo Change-Id: Iee8cbc07c4434ce9b560ffff13ca4284acd24132 Reviewed-by: Richard J. Moore <rich@kde.org>
* | QAbstractSocketEngine: introduce QIpPacketHeader for datagramsThiago Macieira2015-08-221-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the readDatagram() and writeDatagram() virtual functions to take a QIpPacketHeader as meta data, instead of a QHostAddress/quint16 pair. As previously, the header is an "out" parameter for readDatagram() and an "in" parameter for writeDatagram(). The header pointer in readDatagram() is allowed to be null if the PacketHeaderOptions indicates WantNone. Otherwise, it must not be null. The extra options parameter is introduced because we may not always want all the metadata upon reception. For sending, we know what to include or not based on what's set in the incoming header parameter. QIpPacketHeader splits sender and destination because we'll be able to return both on datagram reception. Change-Id: Iee8cbc07c4434ce9b560ffff13ca4213255008c7 Reviewed-by: Richard J. Moore <rich@kde.org>
* | Set the socketType and socketProtocol earlyThiago Macieira2015-08-101-0/+4
|/ | | | | | | | | | The type is known (usually) right after createNewSocket, so let's just set it. They may get overwritten later (in fetchConnectionParameters), but this allows early use of setOption when we need to know the socket type. Change-Id: Iee8cbc07c4434ce9b560ffff13ca09fccb8e1662 Reviewed-by: Richard J. Moore <rich@kde.org>
* QNativeSocketEngine: merge the get/setsockopt level constantsThiago Macieira2015-03-151-112/+81
| | | | | | | No point in having them separate, as that's a recipe for mistakes. Change-Id: Iee8cbc07c4434ce9b560ffff13ca4132cd1879ed Reviewed-by: Richard J. Moore <rich@kde.org>
* IPv6 scope IDs are unsignedThiago Macieira2015-03-141-1/+1
| | | | | | | | We need to make sure that a large scope ID saved in a QString does get converted properly back to an integer. Change-Id: Iee8cbc07c4434ce9b560ffff13c9bd0e9008bd9c Reviewed-by: Richard J. Moore <rich@kde.org>
* QNativeSocketEngine: merge duplicated code for sin6_scope_idThiago Macieira2015-03-141-29/+18
| | | | | | | | Let's make sure we don't accidentally have it wrong in one of the three versions. Change-Id: Iee8cbc07c4434ce9b560ffff13c9bcf75ba66a66 Reviewed-by: Richard J. Moore <rich@kde.org>
* Make sure we also treat QAbstractSocket::AnyIPProtocol as IPv6Thiago Macieira2015-03-121-7/+7
| | | | | | | | | | | The native socket engine sets the socketProtocol to that when it means it's using IPv6 with v4 compatibility on (v6only = false). We mustn't have faced problems so far because the multicast tests set don't test v6only = false. Change-Id: Iee8cbc07c4434ce9b560ffff13ca0aff60673940 Reviewed-by: Richard J. Moore <rich@kde.org>
* Merge remote-tracking branch 'origin/5.4' into 5.5Frederik Gladhorn2015-02-241-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/xml/htmlinfo/simpleexample.html examples/xml/rsslisting/rsslisting.cpp qmake/generators/win32/msbuild_objectmodel.cpp src/3rdparty/harfbuzz-ng/src/hb-private.hh src/corelib/global/qlogging.cpp src/corelib/io/qstorageinfo_unix.cpp src/corelib/thread/qwaitcondition_unix.cpp src/gui/kernel/qguiapplication.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp src/testlib/doc/src/qt-webpages.qdoc tests/auto/other/qaccessibility/tst_qaccessibility.cpp Change-Id: Ib272ff0bc30a1a5d51275eb3cd2f201dc82c11ff
| * Save two system calls for setting a socket non-blocking on LinuxThiago Macieira2015-02-151-2/+2
| | | | | | | | | | | | | | | | Linux's socket(2) system call can take SOCK_NONBLOCK and let us avoid the extra two fcntl(2) to change the setting after it's created. Change-Id: Ie0d7a2d51acc21acd850cbee6d0f76e27b1ae859 Reviewed-by: Richard J. Moore <rich@kde.org>
* | Update copyright headersJani Heikkinen2015-02-111-7/+7
|/ | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Don't unnecessariy set localAddress in QNativeSocketEngine's nativeBindThiago Macieira2015-01-111-3/+0
| | | | | | | | | The outer QNativeSocketEngine::bind() function will call fetchConnectionParameters() as soon as nativeBind() returns, so don't bother copying localAddress. Change-Id: Ice13e507ccb9c575a7d3bdf0b41394f35230b746 Reviewed-by: Richard J. Moore <rich@kde.org>
* prevent if_nametoindex being called with empty stringTom Hirst2014-10-121-11/+22
| | | | | | | | | | | Calling if_nametoindex with an empty string will always return 0, but on ARM linux platforms this call seems to be very expensive (~30ms), adding a large overhead to calls such as QUdpSocket::writeDatagram() Task-number: QTBUG-37092 Change-Id: Iad00867585d9534af1ddaee936dd4e4dc5e03611 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Gabriel de Dietrich2014-09-291-2/+2
|\ | | | | | | | | | | | | | | Conflicts: src/network/socket/qnativesocketengine_unix.cpp src/widgets/kernel/qwidget_qpa.cpp Change-Id: I6f1aa320d5ca66cd92d601a95885aeaab0abb191
| * Fix a mishandling of the fd returned by socket(2)Giuseppe D'Angelo2014-09-221-2/+2
| | | | | | | | | | | | | | | | | | | | socket(2) is allowed to return 0, so 0 should not be included when checking for errors. Change-Id: I0454ea60347d90078d3ab3046969add8d5c37935 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>