aboutsummaryrefslogtreecommitdiffstats
path: root/caputils/ws80211_utils.c
AgeCommit message (Collapse)AuthorFilesLines
2018-05-23make our version of nla_for_each_nested() publicMartin Kaiser1-21/+2
caputils/ws80211_utils.c contains a re-definition of the linux kernel's nla_for_each_nested() macro that applies the correct casts to allow compilation with a C++ compiler. Make this definition public by moving it into a new wsutil/netlink.h file. Include the kernel's original definition before we overwrite it. This way, it's not necessary for a .c file to include wsutil/netlink.h after the system includes. Use our nla_for_each_nested() version in extcap/dpauxmon.c to squelch the following compiler warning: [1664/2251] Building C object extcap/CMakeFiles/dpauxmon.dir/dpauxmon.c.o ../extcap/dpauxmon.c: In function ‘family_handler’: ../extcap/dpauxmon.c:168:13: warning: request for implicit conversion from ‘void *’ to ‘struct nlattr *’ not permitted in C++ [-Wc++-compat] nla_for_each_nested(mcgrp, tb[CTRL_ATTR_MCAST_GROUPS], rem_mcgrp) { Change-Id: I6ba40ef6343c5d168c1b0c4554f13202911ded76 Reviewed-on: https://code.wireshark.org/review/27688 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-18Older versions of Clang don't understand -Wpedantic.Guy Harris1-4/+4
Define DIAG_OFF_PEDANTIC and DIAG_ON_PEDANTIC, and have it do nothing on Clang prior to 4.0. Change-Id: Ic6b2e607659db66f3210401024bf3f2239665506 Reviewed-on: https://code.wireshark.org/review/27649 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-03-09spdx: more licenses converted.Dario Lombardo1-11/+1
Change-Id: I8f6693108c43959e54911d35b4fbf730c59add60 Reviewed-on: https://code.wireshark.org/review/26361 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-05Amend the comment with some background for the workaround.Jaap Keuter1-0/+4
The added comment only explains what the cause of the problem is, and the subsequent workaround, without going into how this could be properly addressed. Add some lines to add that information. Change-Id: I74e4df0e0c4b41fe8d52d9abf2d15335d2b327d6 Reviewed-on: https://code.wireshark.org/review/25614 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-03Add a comment explaining why err is volatile.Guy Harris1-0/+15
And also indicate that perhaps the right solution was just to close the CID as a false positive, as Coverity doesn't have a deep enough understanding of libnl to know that the loop isn't guaranteed to be infinite. Change-Id: Ieb0651c803a5939fb54f2bc68bdf8c5485dafaf2 Reviewed-on: https://code.wireshark.org/review/25582 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-08Fix the signature of the stub version of ws80211_set_freq().Guy Harris1-1/+1
Change-Id: I5f0da4fb5d8d452f3cff3d37e0749dde8e98b600 Reviewed-on: https://code.wireshark.org/review/17587 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-08dumpcap: change types.Dario Lombardo1-2/+2
Change-Id: I6520971e607623dadcb3ae392ce264bf49c621bd Reviewed-on: https://code.wireshark.org/review/17499 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-22Reapply "ws80211: Disable shorten-64-to-32."João Valverde1-0/+3
Disable shorten-64-to-32 in ws80211_create_on_demand_interface, which calls NLA_PUT_STRING, which passes the output of strlen to an int parameter. NLA_PUT_STRING is defined in netlink/attr.h so there's not much we can do to fix it directly. By Gerald in b8f90de70efa2d271274fbb48df12737f6eddd12. Change-Id: Ifb92244423fcb2cc267f8fcefb7a2700a7b7c0ea Reviewed-on: https://code.wireshark.org/review/15522 Reviewed-by: João Valverde <j@v6e.pt>
2016-05-22Revert "ws80211: Disable shorten-64-to-32."João Valverde1-3/+0
This reverts commit b8f90de70efa2d271274fbb48df12737f6eddd12. Change-Id: Ic7eaf288d1937a986c2ec85ba43a94ac20b6e12e Reviewed-on: https://code.wireshark.org/review/15520 Reviewed-by: João Valverde <j@v6e.pt>
2016-04-04Include ws_diag_control.h in config.hJoão Valverde1-2/+1
Change-Id: Ia394071710ecda3b0e6686a51fbca45a8ff20317 Reviewed-on: https://code.wireshark.org/review/14749 Petri-Dish: João Valverde <j@v6e.pt> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-03-01dumpcap: Add support for 802.11ac monitor modesMikael Kanstrup1-6/+83
Add dumpcap support for configuring 80MHz, 80+80MHz, 160MHz monitor modes via nl80211. Change-Id: I2ae8955670c2a9b5051e2223d45ce522459f2c5f Reviewed-on: https://code.wireshark.org/review/13964 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-13Fix some memory leaks in ws80211_utilsMikael Kanstrup1-0/+4
Valgrind report memleaks like these when using the wireless toolbar to create a monitor interface and/or changing channel: 4,168 (72 direct, 4,096 indirect) bytes in 1 blocks are definitely lost in loss record 31 of 32 at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5BD0742: ??? (in /lib/x86_64-linux-gnu/libnl-3.so.200.16.1) by 0x116308: ws80211_create_on_demand_interface (ws80211_utils.c:699) by 0x116308: ws80211_set_freq (ws80211_utils.c:729) by 0x10D70E: set_80211_channel (dumpcap.c:4262) by 0x10D70E: main (dumpcap.c:4935) 4,168 (72 direct, 4,096 indirect) bytes in 1 blocks are definitely lost in loss record 32 of 32 at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5BD0742: ??? (in /lib/x86_64-linux-gnu/libnl-3.so.200.16.1) by 0x116400: ws80211_set_freq (ws80211_utils.c:733) by 0x10D70E: set_80211_channel (dumpcap.c:4262) by 0x10D70E: main (dumpcap.c:4935) Change-Id: Ia1de630859d96653310fbb3efebdc439ebf107b8 Reviewed-on: https://code.wireshark.org/review/13237 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-01ws80211: Disable shorten-64-to-32.Gerald Combs1-0/+3
Disable shorten-64-to-32 in ws80211_create_on_demand_interface, which calls NLA_PUT_STRING, which passes the output of strlen to an int parameter. NLA_PUT_STRING is defined in netlink/attr.h so there's not much we can do to fix it directly. Suppress -Wpragmas before suppressing warnings in gcc so that we can use DIAG_OFF with clang-only warnings. Change-Id: I1180950edd93c056b8fbfbed164e482024aee90a Reviewed-on: https://code.wireshark.org/review/12314 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-11-05Get rid of ws80211_frequency_to_channel().Guy Harris1-16/+0
Use ieee80211_mhz_to_chan() instead. Change-Id: I1d9a3b9c3a5ad2b1a5bd3f8d10b7f8b1bbcba51d Reviewed-on: https://code.wireshark.org/review/11586 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-0580211 utils: free nl messages after useEvan Huus1-3/+14
Valgrind picked this up as a very large memory leak on systems with libnl, since the GUI polls this code regularly and was leaking several nl messages each time. Change-Id: Ie6b32e094d90183a16fb187adea430c4b43c208c Reviewed-on: https://code.wireshark.org/review/9502 Petri-Dish: Evan Huus <eapache@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com>
2015-07-02Fix Buffer overrun while writing to 'airpcap_dir_utf16': the writableAndersBroman1-2/+2
size is '520' bytes, but '1042' bytes might be written. Change-Id: Ic88bc977011eff9ae3c2a4a5ba717e78dbb1171c Reviewed-on: https://code.wireshark.org/review/9452 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-16Add the wireless toolbar.Gerald Combs1-35/+338
Add the wireless toolbar to the Qt UI. Start adding AirPcap support to ui/80211_utils. Add FCS validation routines to ws80211_utils. Move a bunch of AirPcap routines that require epan from caputils to ui/gtk. They were required for driver key management, which we'll leave to the AirPcap Control Panel in the Qt UI. Move frequency-utils to wsutil. Change-Id: I44446758046621d183f5c2ba9f6526bf01e084f1 Reviewed-on: https://code.wireshark.org/review/8910 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-19libnl: disable pedantic warning of libnl libAlexis La Goutte1-0/+2
Part 2... Change-Id: I47b74c81ee7b7cd8296ce9da5a60ad6aecef8c78 Reviewed-on: https://code.wireshark.org/review/7239 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-02-18libnl: disable pedantic warning of libnl libAlexis La Goutte1-0/+3
/usr/include/libnl3/netlink/types.h:25:15: warning: comma at end of enumerator list [-Wpedantic] /usr/include/libnl3/netlink/handlers.h:65:9: warning: comma at end of enumerator list [-Wpedantic] /usr/include/libnl3/netlink/handlers.h:81:18: warning: comma at end of enumerator list [-Wpedantic] /usr/include/libnl3/netlink/handlers.h:113:18: warning: comma at end of enumerator list [-Wpedantic] /usr/include/libnl3/netlink/utils.h:43:13: warning: comma at end of enumerator list [-Wpedantic] /usr/include/libnl3/netlink/attr.h:47:16: warning: comma at end of enumerator list [-Wpedantic] /usr/include/libnl3/netlink/route/link.h:95:23: warning: comma at end of enumerator list [-Wpedantic] ... Change-Id: I3f14e9d4887569e5d7befe1adb77561c8793437e Reviewed-on: https://code.wireshark.org/review/7201 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-13caputils/*.c: As needed: Add editor modelines & Fix indentationBill Meier1-0/+13
Change-Id: I081446fbbc242c01f8ac9dede575c3ea77421c42 Reviewed-on: https://code.wireshark.org/review/7103 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-18Add support for split wiphy dump to Wireless ToolbarMikael Kanstrup1-24/+119
To populate the Wireless Toolbar menu the NL80211_CMD_GET_WIPHY command is used. Some network interfaces must use split wiphy dump feature for this command to function properly. One such example is the D-Link DWA-160 USB adapter that does not show up when used without. Make use of split wiphy dump feature whenever kernel supports it to populate the list of monitor interfaces for the Wireless Toolbar. Bug: 10564 Change-Id: Idc28e92f91a2488fa48eeb282a0ef1e2bd40a5f0 Reviewed-on: https://code.wireshark.org/review/4611 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-10-13Split ws80211_get_phys callback handlerMikael Kanstrup1-60/+103
Split up the ws80211_get_phys parser callback handler function into separate functions for each attribute parsed. This is done in preparation for supporting split wiphy dump feature where the function logics will need modications. Change-Id: Ic0b497fc628f0e7453cd62eb8199f17f9a308a7f Reviewed-on: https://code.wireshark.org/review/4610 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-09-16Fix spelling: cant-->can't, wont-->won't, etcBill Meier1-1/+1
Change-Id: Ia6c3e7a25615bf8e052c3bacf096d76df775c9c2 Reviewed-on: https://code.wireshark.org/review/4126 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-07-04Move utility routines for capturing into a libcaputils static library.Guy Harris1-0/+748
Some of those routines are used only in dumpcap; others are used in TShark and Wireshark as well. Change-Id: I9d92483f2fcff57a7d8b6bf6bdf2870505d19fb7 Reviewed-on: https://code.wireshark.org/review/2841 Reviewed-by: Guy Harris <guy@alum.mit.edu>