summaryrefslogtreecommitdiffstats
path: root/src/network/kernel/qnetworkinterface_unix.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-261-18/+18
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java src/dbus/qdbusconnection_p.h src/dbus/qdbusintegrator.cpp src/dbus/qdbusintegrator_p.h tests/auto/corelib/io/qdir/qdir.pro tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp Change-Id: I3d3fd07aed015c74b1f545f1327aa73d5f365fcc
| * QNetworkInterface: don't add a QNetworkAddressEntry if no IP is knownThiago Macieira2016-01-211-17/+17
| | | | | | | | | | | | | | | | | | | | If SIOCGIFADDR fails, then don't bother trying to get the broadcast address or netmask, and especially don't add the empty QNetworkAddressEntry to the interface. This can happen on interfaces that have no IP address assigned (for example, inactive interfaces). Change-Id: I8de47ed6c7be4847b99bffff141c326d94ecca78 Reviewed-by: Richard J. Moore <rich@kde.org>
| * QNetworkInterface: fix handling of interfaces with no addressesThiago Macieira2016-01-211-1/+1
| | | | | | | | | | | | | | | | Certain Linux interfaces have no addresses at all (hardware or IP), like the nlmon interfaces. They weren't being reported. Change-Id: I8de47ed6c7be4847b99bffff141c2b60c2089ad3 Reviewed-by: Richard J. Moore <rich@kde.org>
* | 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 devLiang Qi2015-12-181-7/+31
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/painting/painting.pri src/plugins/platforms/xcb/qxcbconnection.cpp tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro tests/auto/corelib/tools/qlocale/test/test.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp tools/configure/environment.cpp Change-Id: I9c40f458b89b2c206de2d2c24e90b5f679c93495
| * QNetworkInterface: fix support for address labels on Linux interfacesThiago Macieira2015-12-081-7/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 64a1448d87727878d9789906b2f4f5b9e3d74e38 (Qt 5.2) caused QNetworkInterface to report address labels (a.k.a. interface aliases) as separate interfaces. This is caused by the fact that glibc, uClibc and MUSL copy the address label (netlink address attribute IFA_LABEL) to the ifa_name field, which made QNetworkInterfaceManager think that it was an interface it hadn't yet seen. Address labels are the old way to add more than one IP address to an interface on Linux, for example: ifconfig eth0:1 192.0.2.2 Those do not create a new interface, so the "eth0:1" label maps to the same interface index as the parent interface. This has been deprecated for 10 years, but there are still tools out there that add addresses in this manner. This commit restores behavior compatibility with Qt 4.2-5.1. The Qt 5.2-5.5 behavior is incorrect because it reports more than one interface with the same index. On systems configured like the above, the tst_QNetworkInterface::interfaceFromXXX test was failing. Change-Id: I8de47ed6c7be4847b99bffff141c2d9de8cf7329 Reviewed-by: Richard J. Moore <rich@kde.org>
* | Haiku: Fix compilation of network libraryTobias Koenig2015-12-081-0/+4
| | | | | | | | | | | | | | | | | | Like on some BSD systems, the member of the ifreq structure is called ifr_index and not ifr_ifindex on Haiku OS. Change-Id: I273de0c703b1c89dbac537c68e52db219d2da50e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add QNetworkInterface::interface{IndexFromName,NameFromIndex}Thiago Macieira2015-10-151-8/+50
|/ | | | | | | | | | 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>
* QNetworkInterface: Merge the two sections of code that do SIOCGIFxxxThiago Macieira2015-08-161-21/+21
| | | | | | | | The separation was accidental due to refactoring. It does not need to exist. Change-Id: I7de033f80b0e4431b7f1ffff13f988adc47d57d5 Reviewed-by: Richard J. Moore <rich@kde.org>
* QNetworkInterface: prefer SIOCGIFINDEX over if_nametoindexThiago Macieira2015-08-161-1/+6
| | | | | | | | | | On Linux (on a bad system without getifaddrs), the ioctl for SIOCGIFINDEX should be faster than if_nametoindex. The ioctl on the already open socket will require one syscall, while if_nametoindex will require at least one more (to open the socket), probably more. Change-Id: I7de033f80b0e4431b7f1ffff13f9888bf2044105 Reviewed-by: Richard J. Moore <rich@kde.org>
* Fix warning of unused variableThiago Macieira2015-08-151-2/+1
| | | | | | | | Only happens on systems without getifaddrs, which we aren't usually testing. Change-Id: I7de033f80b0e4431b7f1ffff13f9889f5cfdea5b 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>
* 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>
* Haiku: Make network module compile on HaikuTobias Koenig2015-01-141-0/+5
| | | | | | | | | Add the missing definition for IFF_RUNNING like documented on http://ports.haiku-files.org/wiki/CommonProblems Change-Id: Iea3fa224dc8e7e1e36674026efbb28289d2efa2a Reviewed-by: Augustin Cavalier <waddlesplash@gmail.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* expand tabs and related whitespace fixes in *.{cpp,h,qdoc}Oswald Buddenhagen2014-01-131-1/+1
| | | | | | | | the diff -w for this commit is empty. Started-by: Thiago Macieira <thiago.macieira@intel.com> Change-Id: I77bb84e71c63ce75e0709e5b94bee18e3ce6ab9e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix problem with QNetworkAddressEntry returning a invalid netmask.Christian Strømme2013-11-271-6/+6
| | | | | | | | | | | The ip address should be set before the netmask. The reason for this is that QNetworkAddressEntry::setNetmask() compares the protocol of the netmask and the ip, if they don't match the netmask won't be set. Task-number: QTBUG-33911 Change-Id: Ic344b3653c5dfdc5df912dee16e4dbe069d57d24 Reviewed-by: Peter Hartmann <phartmann@blackberry.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update Linux interface getting to make fewer syscallsThiago Macieira2013-08-241-29/+29
| | | | | | | | | | | Each time we call if_nametoindex, if_indextoname or somesuch, the libc needs to open a socket, make an ioctl, and close the socket. Since we've got most of the information we need anyway in the data from getifaddrs(3), let's just use it Change-Id: I572c212a27c4b9ffe57980b36f75bb04e6d5cf29 Reviewed-by: Jonas Gastal <gastal@intel.com> Reviewed-by: Richard J. Moore <rich@kde.org>
* Avoid one extra if_indextoname per address in QNetworkInterfaceThiago Macieira2013-08-061-5/+9
| | | | | | | | | | | Given an IPv6 address associated with a network interface, there's a fairly high chance (of 100%) that any scope ID found is that of the interface. Change-Id: Id7315473f39b68ee4c169207168dc2e60fd7d570 Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Peter Hartmann <phartmann@blackberry.com> Reviewed-by: Jonas Gastal <gastal@intel.com>
* Remove unused socket from QNetworkInterface Unix codeThiago Macieira2013-08-061-6/+0
| | | | | | | | | | This must be a relic from old code, before I split out the code that uses getifaddrs from the code that doesn't. Change-Id: Ia1265da6921c7c7a3dc97315d98fed50b3d2fe1c Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Peter Hartmann <phartmann@blackberry.com> Reviewed-by: Jonas Gastal <gastal@intel.com>
* Whitespace cleanup: remove trailing whitespaceAxel Waggershauser2013-03-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Remove all trailing whitespace from the following list of files: *.cpp *.h *.conf *.qdoc *.pro *.pri *.mm *.rc *.pl *.qps *.xpm *.txt *README excluding 3rdparty, test-data and auto generated code. Note A): the only non 3rdparty c++-files that still have trailing whitespace after this change are: * src/corelib/codecs/cp949codetbl_p.h * src/corelib/codecs/qjpunicode.cpp * src/corelib/codecs/qbig5codec.cpp * src/corelib/xml/qxmlstream_p.h * src/tools/qdoc/qmlparser/qqmljsgrammar.cpp * src/tools/uic/ui4.cpp * tests/auto/other/qtokenautomaton/tokenizers/* * tests/benchmarks/corelib/tools/qstring/data.cpp * util/lexgen/tokenizer.cpp Note B): in about 30 files some overlapping 'leading tab' and 'TAB character in non-leading whitespace' issues have been fixed to make the sanity bot happy. Plus some general ws-fixes here and there as asked for during review. Change-Id: Ia713113c34d82442d6ce4d93d8b1cf545075d11d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Introducing the Qt Android portPaul Olav Tvete2013-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | Based on the Necessitas project by Bogdan Vatra. Contributors to the Qt5 project: BogDan Vatra <bogdan@kde.org> Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> hjk <hjk121@nokiamail.com> Oswald Buddenhagen <oswald.buddenhagen@digia.com> Paul Olav Tvete <paul.tvete@digia.com> Robin Burchell <robin+qt@viroteck.net> Samuel Rødal <samuel.rodal@digia.com> Yoann Lopes <yoann.lopes@digia.com> The full history of the Qt5 port can be found in refs/old-heads/android, SHA-1 249ca9ca2c7d876b91b31df9434dde47f9065d0d Change-Id: Iff1a7b2dbb707c986f2639e65e39ed8f22430120 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Include scope ids in QHostAddress from QNetworkInterfaceShane Kearns2012-05-111-2/+12
| | | | | | | | | | | | The scope ID is a required part of the address for link local addresses (to solve the problem of the same link local address being created by two machines on different networks). It is required to send packets to a link local address on Mac and Windows, although Linux multicasts if scope is missing. Task-number: QTBUG-25634 Change-Id: Ie2bb09df8d261eefcb81716bafeb1475f0bed5fe Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Disable code using if_nameindex on Android.Robin Burchell2012-05-021-0/+5
| | | | | | | Android doesn't support if_nameindex. Change-Id: Idb0cbf52e6cffb19fe65e30430ef53626e0eeac7 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Build with the LSB build envHarald Fernengel2012-03-151-1/+5
| | | | | | | | LSB doesn't define some functionality that we expect on Linux, so fall back to the generic code. Change-Id: I19e09908b9e9002140535f159ae0745d7ca80b70 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Always assume IPv6 supportMarkus Goetz2011-07-041-2/+1
| | | | | | | | | | | It's 2011 baby! And until Qt5 is released probably 2012 :-) Change-Id: I397aabf25e93c8afb5f562636710985cf0c7acfa Reviewed-on: http://codereview.qt.nokia.com/1008 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com> Reviewed-by: Markus Goetz
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Fix incorrect hardware address on systems without getifaddrs()Craig Scott2011-05-201-1/+1
| | | | | | | | | | | | | | | | On unix systems for which QT_NO_GETIFADDRS is defined, the way that the hardware address field is extracted from the result of a call to qt_safe_ioctl() is incorrect. The address of the ifreq.ifr_addr struct is taken rather than the appropriate member within that struct, sa_data, resulting in a memory offset and subsequently the hardware address has garbage in the first two of six fields. This commit modifies the code to pass the sa_data member instead of the address of the struct as a whole. Task-number: QTBUG-19165 Merge-request: 2614 Reviewed-by: Martin Petersson (cherry picked from commit 004ad12669ef696eeba70fd57d1eb0c67c806d1d)
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+449
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12