Commit Graph

26 Commits

Author SHA1 Message Date
Guy Harris 0975bf792a Handle -k better on platforms that don't support it.
Have ws80211_init() return an indication that channel setting isn't
supported on those platforms.

In dumpcap, try to set up ws80211 before checking the channel argument
and, if it fails, report the failure, rather than failing because the
"convert channel name to channel code" routine fails.

See

    https://ask.wireshark.org/question/15535/dumpcap-k-is-not-accepting-channel-type-values/

for an example of confusion caused by the previous behavior.

Change-Id: I303f560704700bbcd4f0ecea041f8632744212f3
Reviewed-on: https://code.wireshark.org/review/36659
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-01 20:31:14 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Martin Kaiser 675e0649c0 make our version of nla_for_each_nested() public
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-23 13:18:00 +00:00
Guy Harris b1de8c87a1 Older versions of Clang don't understand -Wpedantic.
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-05-18 22:31:05 +00:00
Dario Lombardo e7ab7a907c spdx: more licenses converted.
Change-Id: I8f6693108c43959e54911d35b4fbf730c59add60
Reviewed-on: https://code.wireshark.org/review/26361
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-09 04:50:23 +00:00
Jaap Keuter e4a6383caf Amend the comment with some background for the workaround.
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-05 17:19:12 +00:00
Guy Harris 6fd1531814 Add a comment explaining why err is volatile.
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>
2018-02-03 21:34:09 +00:00
Guy Harris 83eb448dfc Fix the signature of the stub version of ws80211_set_freq().
Change-Id: I5f0da4fb5d8d452f3cff3d37e0749dde8e98b600
Reviewed-on: https://code.wireshark.org/review/17587
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-08 18:38:41 +00:00
Dario Lombardo fcb6fd3b6f dumpcap: change types.
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-09-08 18:31:14 +00:00
João Valverde 38cc4287a2 Reapply "ws80211: Disable shorten-64-to-32."
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 b8f90de70e.

Change-Id: Ifb92244423fcb2cc267f8fcefb7a2700a7b7c0ea
Reviewed-on: https://code.wireshark.org/review/15522
Reviewed-by: João Valverde <j@v6e.pt>
2016-05-22 04:56:10 +00:00
João Valverde 77fd31e60a Revert "ws80211: Disable shorten-64-to-32."
This reverts commit b8f90de70e.

Change-Id: Ic7eaf288d1937a986c2ec85ba43a94ac20b6e12e
Reviewed-on: https://code.wireshark.org/review/15520
Reviewed-by: João Valverde <j@v6e.pt>
2016-05-22 04:55:34 +00:00
João Valverde ecb4dc396e Include ws_diag_control.h in config.h
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-04-04 23:05:31 +00:00
Mikael Kanstrup 9f27e5d7d1 dumpcap: Add support for 802.11ac monitor modes
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-03-01 15:23:44 +00:00
Mikael Kanstrup fda44fa1fd Fix some memory leaks in ws80211_utils
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>
2016-01-13 07:35:19 +00:00
Gerald Combs b8f90de70e ws80211: Disable shorten-64-to-32.
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-12-01 01:19:33 +00:00
Guy Harris 2096c006aa Get rid of ws80211_frequency_to_channel().
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-11-05 22:56:07 +00:00
Evan Huus cfe7dc8bab 80211 utils: free nl messages after use
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-05 17:30:25 +00:00
AndersBroman a66714bbad Fix Buffer overrun while writing to 'airpcap_dir_utf16': the writable
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-07-02 03:54:26 +00:00
Gerald Combs ece4b01f21 Add the wireless toolbar.
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-06-16 03:45:54 +00:00
Alexis La Goutte 20e2c38b74 libnl: disable pedantic warning of libnl lib
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-19 16:15:53 +00:00
Alexis La Goutte 4342333344 libnl: disable pedantic warning of libnl lib
/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-18 12:04:33 +00:00
Bill Meier 6040bcd5f8 caputils/*.c: As needed: Add editor modelines & Fix indentation
Change-Id: I081446fbbc242c01f8ac9dede575c3ea77421c42
Reviewed-on: https://code.wireshark.org/review/7103
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-02-13 18:45:23 +00:00
Mikael Kanstrup 27e4ac85e8 Add support for split wiphy dump to Wireless Toolbar
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-18 14:26:00 +00:00
Mikael Kanstrup 74c4358740 Split ws80211_get_phys callback handler
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-10-13 19:19:56 +00:00
Bill Meier a379ac74d2 Fix spelling: cant-->can't, wont-->won't, etc
Change-Id: Ia6c3e7a25615bf8e052c3bacf096d76df775c9c2
Reviewed-on: https://code.wireshark.org/review/4126
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-16 15:31:58 +00:00
Guy Harris 9e6487f247 Move utility routines for capturing into a libcaputils static library.
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>
2014-07-04 07:25:26 +00:00