Commit Graph

351 Commits

Author SHA1 Message Date
Guy Harris 57a1514ac7 Cast away the return value of g_strlcpy() and g_strlcat().
Most of the time, the return value tells us nothing useful, as we've
already decided that we're perfectly willing to live with string
truncation.  Hopefully this keeps Coverity from whining that those
routines could return an error code (NARRATOR: They don't) and thus that
we're ignoring the possibility of failure (as indicated, we've already
decided that we can live with string truncation, so truncation is *NOT*
a failure).
2021-04-30 03:19:19 -07:00
Chuck Craft dde65b96cd ip: ip_ttl _ws.expert fields not set if no tree
See 'if (tree) ...' comment
Closes #17228
2021-02-15 07:33:39 +00:00
John Thacker 7654bb260d QT+epan: Set FI_BITS_OFFSET and FI_BITS_SIZE flags on [u]ints and bitmasks
Set the FI_BITS_OFFSET and FI_BITS_SIZE flags appropriately on [u]int[64]
(and thus chars and booleans) where the bitmask is passed in on the
header_field_info. Also set the flags on bitmask items by ORing the bitmasks
from the constituent fields. These flags are only used right now in the
packet diagram.

This makes the packet diagram display those types of fields correctly without
having to use proto_item_set_bits_offset_len(), so long as the bitmask is
correct and the field width of the type matches the octet length. (If it
doesn't match, that's a dissector bug.)

split bit items are a more complicated case and still not handled correctly.
2020-11-19 12:00:46 +00:00
Gerald Combs 9875011fda Update some field names to match what's in RFCs.
Update some field names and capitalization in the IPv4, IPv6, ICMPv4,
and TCP dissectors to match the names documented in their respective
RFCs. This is in no way comprehensive, but it ensures that the packet
diagram more closely matches the RFC diagrams for those protocols.

(I haven't found a document that explitly says so, but protocol field
names in IETF RFCs seem to follow Chicago Manual of Style capitalization
recommendations in section 3.4 of the RFC Style Guide[1] for the most
part.)

[1]https://tools.ietf.org/html/rfc7322#section-3.4
2020-10-07 08:01:51 +00:00
Gerald Combs 9b07412277 Qt: Add a packet diagram view.
Add a new top-level view that shows each packet as a series of diagrams
similar to what you'd find in a networking textook or an RFC.

Add proto_item_set_bits_offset_len so that we can display some diagram
fields correctly.

Bugs / to do:
  - Make this a separate dialog instead of a main window view?
  - Handle bitfields / flags

Change-Id: Iba4897a5bf1dcd73929dde6210d5483cf07f54df
Reviewed-on: https://code.wireshark.org/review/37497
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-10 18:17:50 +00:00
Martin Mathieson 1dd8bb2811 Find and fix dissectors that should be using a default tfs.
Found using tools/check_tfs.py, included in this commit.
Here are the reports that were fixed here:

Examining:
All dissector modules

epan/dissectors/packet-assa_r3.c tfs_mortisepins_flags - could have used tfs_high_low from tfs.c instead:  {High,Low}
epan/dissectors/packet-btle.c tfs_present_bit - could have used tfs_present_not_present from tfs.c instead:  {Present,Not Present}
epan/dissectors/packet-dhcp.c tfs_fqdn_s - could have used tfs_server_client from tfs.c instead:  {Server,Client}
epan/dissectors/packet-docsis-macmgmt.c mdd_tfs_on_off - could have used tfs_on_off from tfs.c instead:  {On,Off}
epan/dissectors/packet-docsis-macmgmt.c mdd_tfs_en_dis - could have used tfs_enabled_disabled from tfs.c instead:  {Enabled,Disabled}
epan/dissectors/packet-docsis-macmgmt.c req_not_req_tfs - could have used tfs_requested_not_requested from tfs.c instead:  {Requested,Not Requested}
epan/dissectors/packet-docsis-tlv.c on_off_tfs - could have used tfs_on_off from tfs.c instead:  {On,Off}
epan/dissectors/packet-docsis-tlv.c activation_tfs - could have used tfs_active_inactive from tfs.c instead:  {Active,Inactive}
epan/dissectors/packet-docsis.c ena_dis_tfs - could have used tfs_enabled_disabled from tfs.c instead:  {Enabled,Disabled}
epan/dissectors/packet-ecmp.c tfs_not_expected_expected - could have used tfs_odd_even from tfs.c instead:  {Odd,Even}
epan/dissectors/packet-erf.c erf_link_status_tfs - could have used tfs_up_down from tfs.c instead:  {Up,Down}
epan/dissectors/packet-h263.c on_off_flg - could have used tfs_on_off from tfs.c instead:  {On,Off}
epan/dissectors/packet-h263.c cpm_flg - could have used tfs_on_off from tfs.c instead:  {On,Off}
epan/dissectors/packet-interlink.c flags_set_notset - could have used tfs_set_notset from tfs.c instead:  {Set,Not set}
epan/dissectors/packet-ip.c tos_set_low - could have used tfs_low_normal from tfs.c instead:  {Low,Normal}
epan/dissectors/packet-ip.c tos_set_high - could have used tfs_high_normal from tfs.c instead:  {High,Normal}
epan/dissectors/packet-isakmp.c flag_r - could have used tfs_response_request from tfs.c instead:  {Response,Request}
epan/dissectors/packet-isis-lsp.c tfs_metric_supported_not_supported - could have used tfs_no_yes from tfs.c instead:  {No,Yes}
epan/dissectors/packet-kerberos.c supported_tfs - could have used tfs_supported_not_supported from tfs.c instead:  {Supported,Not supported}
epan/dissectors/packet-kerberos.c set_tfs - could have used tfs_set_notset from tfs.c instead:  {Set,Not set}
epan/dissectors/packet-mac-lte.c mac_lte_scell_status_vals - could have used tfs_activated_deactivated from tfs.c instead:  {Activated,Deactivated}
epan/dissectors/packet-p_mul.c no_yes - could have used tfs_no_yes from tfs.c instead:  {No,Yes}
epan/dissectors/packet-pgm.c opts_present - could have used tfs_present_not_present from tfs.c instead:  {Present,Not Present}
epan/dissectors/packet-rsl.c rsl_ms_fpc_epc_mode_vals - could have used tfs_inuse_not_inuse from tfs.c instead:  {In use,Not in use}
epan/dissectors/packet-sita.c tfs_sita_on_off - could have used tfs_on_off from tfs.c instead:  {On,Off}
epan/dissectors/packet-vines.c tfs_vine_rtp_no_yes - could have used tfs_no_yes from tfs.c instead:  {No,Yes}
epan/dissectors/packet-vnc.c button_mask_tfs - could have used tfs_pressed_not_pressed from tfs.c instead:  {Pressed,Not pressed}
27 issues found
Change-Id: I7e53b491f20289955c9e9caa8357197d9010a5aa
Reviewed-on: https://code.wireshark.org/review/38087
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-07 21:27:26 +00:00
Guy Harris e1d9a226a2 Fix the type of arrays of pointers to hf_ values for bitfield routines.
The static arrays are supposed to be arrays of const pointers to int,
not arrays of non-const pointers to const int.

Fixing that means some bugs (scribbling on what's *supposed* to be a
const array) will be caught (see packet-ieee80211-radiotap.c for
examples, the first of which inspired this change and the second of
which was discovered while testing compiles with this change), and
removes the need for some annoying casts.

Also make some of those arrays static while we're at it.

Update documentation and dissector-generator tools.

Change-Id: I789da5fc60aadc15797cefecfd9a9fbe9a130ccc
Reviewed-on: https://code.wireshark.org/review/37517
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-19 11:32:26 +00:00
Guy Harris 05b2804cb4 ip: explain why we don't worry about ip_checksum_tvb() returning 0xFFFF.
Change-Id: I0040fedc743759eed604a6a0464d59de5c5261a2
Reviewed-on: https://code.wireshark.org/review/37426
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-06-10 04:56:47 +00:00
Martin Mathieson a5703f22cb More changes arising from PVS-Studio output.
/opt/SourceCode/wireshark/epan/dissectors/packet-ip.c	1556	err	V547 Expression 'opt == (1 | 0x00)' is always true.
/opt/SourceCode/wireshark/epan/dissectors/packet-ipdc.c	739	warn	V547 Expression 'payload_len < 4' is always false.
/opt/SourceCode/wireshark/ui/text_import.c	1049	err	V547 Expression 'info->offset_type == OFFSET_DEC' is always true.

None of these are actual bugfixes.

Bug: 16335
Change-Id: I6d0d3bb92c70ea625fc8b559e7a2bc5ba4e29e25
Reviewed-on: https://code.wireshark.org/review/37136
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2020-05-06 08:35:11 +00:00
Guy Harris 7d95c27de2 ERF: split wiretap/erf.h into three files.
wiretap/erf_record.h has declarations for records in ERF files and in
LINKTYPE_ERF packets in pcap and pcapng files.

wiretap/erf-common.h has declarations of routines to be called by
pcap/pcapng reader code when processing LINKTYPE_ERF packets.

wiretap/erf.h is what's left, for use by wiretap/erf.c and the code with
the tables of file readers and writers.

Change-Id: Ia982e79b14a025a80dcbc7c812fb3b2cdb9c6aaa
Reviewed-on: https://code.wireshark.org/review/37021
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-02 04:24:08 +00:00
Martin Mathieson d70a4a9321 Standardise IETF RFC and Draft URLs in dissectors.
Prefer:
- html (rather than txt)
- https

Also includes the script check_dissector_urls.py,
that can be used to find links in code and test them.

Change-Id: Iafd8bb8948674a38ad5232bf5b5432ffb2b1251b
Reviewed-on: https://code.wireshark.org/review/36821
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2020-04-13 14:58:48 +00:00
João Valverde 967c0f2c93 IPv4: Use FT_UINT8 for the 3 bits flags field
XXX comment reworded to be more informative and reflect lack of
consensus on removing RFC 3514.

Change-Id: If15b8f5d7c450192b1b6ebbfa463b19f27de177c
Reviewed-on: https://code.wireshark.org/review/35934
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2020-01-24 18:56:09 +00:00
João Valverde f1e2d36ffa IPv4: Rename variable
Change-Id: I3aa4161bb6be9990cca038d5a4df131f5c6ad365
Reviewed-on: https://code.wireshark.org/review/35933
Reviewed-by: João Valverde <j@v6e.pt>
2020-01-24 15:31:28 +00:00
João Valverde 3a8215827d IPv4: Remove unnecessary macros
Change-Id: Idde00ef452feeef94edf071964b2ab3767ce21c6
Reviewed-on: https://code.wireshark.org/review/35924
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-24 05:06:57 +00:00
João Valverde 89beba7ea6 IPv4: Fix display of Fragment Offset field
Bug: 16344
Change-Id: I0fe0bec606a103e0cb96c6b6da0f98f9b12097b7
Fixes: v3.1.0rc0-916-g237ec1349f ("IP: Make dissection of ip.frag_offset RFC 791 compliant")
Reviewed-on: https://code.wireshark.org/review/35918
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-24 05:06:07 +00:00
Joerg Mayer 5c0042a2f6 packet-ip.c: The return value is already calculated and returned by the previous call.
Change-Id: I9471e4f823d82d31d41ccd21728358ab363854cd
Reviewed-on: https://code.wireshark.org/review/35719
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2020-01-09 15:26:51 +00:00
João Valverde 376d877012 IPv4: Fix incorrect expert info for IGMP TTL
IGMP uses TTL = 1 for the network control block. The code assumes
a certain registered multicast destination address always carries
traffic for that protocol, which isn't true. For example mDNS
usually uses a TTL of 255 but IGMP Membership reports use a TTL
of 1 for the same destination address.

The end result is that IGMP traffic to mDNS multicast destination
shows a confusing and incorrect "TTL != 255 for the Local Network
Control Block" expert info.

Rename the "ttl" variable for clarity.

Change-Id: I693306cd6531aa250a6f5884a6731a2ea254bf2a
Reviewed-on: https://code.wireshark.org/review/35639
Reviewed-by: João Valverde <j@v6e.pt>
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2020-01-05 09:11:11 +00:00
João Valverde 9ca39e1c56 IPv4: Fix indentation (use spaces)
Change-Id: Ie89c3c958567182c1f5fe66cff23522e797a3e78
Reviewed-on: https://code.wireshark.org/review/35640
Reviewed-by: João Valverde <j@v6e.pt>
2020-01-04 18:22:25 +00:00
Stig Bjørlykke a673a50ad8 epan: Rename dissector_filters.c to conversation_filter.c
For the same reason as in g89c9d909.

Change-Id: I5e344ebdf8ba05d169484aa32b409d84edc6124f
Reviewed-on: https://code.wireshark.org/review/34943
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-11-04 10:17:16 +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 f155601d66 decode_as: remove the "title" member from decode_as_t
The title of a decode_as_t was used by the GTK UI. It's no
longer required for Qt.

Change-Id: Ibd9d4acbe9cad2c1af520340d04e550326a97ebe
Reviewed-on: https://code.wireshark.org/review/33557
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-06-11 18:50:32 +00:00
Sake Blok 237ec1349f IP: Make dissection of ip.frag_offset RFC 791 compliant
The v2.5.0rc0-478-g558fe23226, the dissection of ip.frag_offset changed
to be listed under "Flags", this is not correct. The Fragmentation
Offset is a separate field according to the RFC. This change corrects
that behavior. Also, the raw value from the header was shown instead of
the real byte offset, this is also corrected.

Change-Id: I1d6dfc4314091eb6f3eef418c5a17ed37f7a1200
Fixes: v2.5.0rc0-478-g558fe23226 ("[IP] Simplify paring of flags field by using proto_tree_add_bitmask_with_flags().")
Reviewed-on: https://code.wireshark.org/review/33422
Petri-Dish: Sake Blok <sake.blok@SYN-bit.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Sake Blok <sake.blok@SYN-bit.nl>
2019-05-30 21:47:19 +00:00
Gerald Combs 8d3ac3af86 epan: Convert our PROTO_ITEM_ macros to inline functions.
Convert our various PROTO_ITEM_ macros to inline functions and document
them.

Change-Id: I070b15d4f70d2189217a177ee8ba2740be36327c
Reviewed-on: https://code.wireshark.org/review/32706
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-04 04:03:38 +00:00
Loganaden Velvindron d98d221865 packet-ip: Add codepoint LE as per draft-ietf-tsvwg-le-phb.
From the I-D:
This document defines a Differentiated Services per-hop behavior
   [RFC2474] called "Lower Effort" (LE), which is intended for traffic
   of sufficiently low urgency that all other traffic takes precedence
   over the LE traffic in consumption of network link bandwidth
[snip]
Example uses for the LE PHB:

   o  For traffic caused by world-wide web search engines while they
      gather information from web servers.

   o  For software updates or dissemination of new releases of operating
      systems.

   o  For reporting errors or telemetry data from operating systems or
      applications.
o  For backup traffic or non-time critical synchronization or
      mirroring traffic.

   o  For content distribution transfers between caches.

   o  For preloading or prefetching objects from web sites.

   o  For network news and other "bulk mail" of the Internet.

   o  For "downgraded" traffic from some other PHB when this does not
      violate the operational objectives of the other PHB.

   o  For multicast traffic from untrusted (e.g., non-local) sources.

Change-Id: I90b2a08332943daf8349826eaa0862f0c12d6a05
Reviewed-on: https://code.wireshark.org/review/32427
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-03-21 16:35:16 +00:00
Peter Wu 5c4458345c Change maxmind_db_lookup_ipv4 to look more like maxmind_db_lookup_ipv6
Both functions accept an address in network byte order, but
maxmind_db_lookup_ipv4 does not accept a pointer. Add an indirection and
remove unnecessary memcpy calls. This removes some confusion for me.

Change-Id: I291c54c8c55bc8048ca011b84918c8a5d3ed1398
Reviewed-on: https://code.wireshark.org/review/31951
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-02-11 05:13:37 +00:00
Guy Harris 2d41b15495 Add a "failed" return for tap packet routines.
This allows taps that can fail to report an error and fail; a failed
tap's packet routine won't be called again, so they don't have to keep
track of whether they've failed themselves.

We make the return value from the packet routine an enum.

Don't have a separate type for the per-packet routine for "follow" taps;
they're expected to act like tap packet routines, so just use the type
for tap packet routines.

One tap packet routine returned -1; that's not a valid return value, and
wasn't one before this change (the return value was a boolean), so
presume the intent was "don't redraw".

Another tap routine's early return, without doing any work, returned
TRUE; this is presumably an error (no work done, no need to redraw), so
presumably it should be "don't redraw".

Clean up some white space while we're at it.

Change-Id: Ia7d2b717b2cace4b13c2b886e699aa4d79cc82c8
Reviewed-on: https://code.wireshark.org/review/31283
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-01-01 05:03:42 +00:00
Nardi Ivan 5feb326312 ip, tcp: add expert info for invalid header length
Change-Id: I58c1b20304aabcff144667cfbbcc774010fc2a16
Reviewed-on: https://code.wireshark.org/review/31148
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-21 06:31:12 +00:00
Guy Harris 8beab04229 Fix expert info message for wrong option length.
Bug: 15290
Change-Id: Id5b4f6a899fea542f5d50e8be991d7cca623fd46
Reviewed-on: https://code.wireshark.org/review/30744
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-20 18:27:17 +00:00
Christoph Portner 1539e455d7 MPLS: add dissector for Management Communication Channel
Management communication channel described in RFC 5718

Change-Id: I5ed95d0d6f25754c50a97457679d08b99db6f527
Reviewed-on: https://code.wireshark.org/review/29920
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-09-30 19:24:54 +00:00
João Valverde 3b17e66b78 Revert "IP: Use pinfo for session IP addresses"
This reverts commit bb25d64a2a.

Change-Id: I8b790ee8371a7257696a21fe99ed483c892b8baf
Reviewed-on: https://code.wireshark.org/review/29251
Reviewed-by: João Valverde <j@v6e.pt>
2018-08-22 18:10:22 +00:00
João Valverde bb25d64a2a IP: Use pinfo for session IP addresses
The pinfo structure is sufficent for providing the src/dst address.
The pinfo address data is strictly the same as the tap data, even for
IP over IP.

Besides the trivial code simplification we prioritize the use of pinfo
over a tap, for increased type-safety and on the presumption of having
a more stable implementation (in the mutability sense).

Change-Id: Idcfc8c762f9af934e4612522b7472b35a01042ca
Reviewed-on: https://code.wireshark.org/review/29238
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-22 05:01:43 +00:00
Guy Harris 1834cda2ee The maximum offset in an IP option dissector is the length of the option.
It's *not* the sum of the length of the option and the length of the
option header.

Change-Id: I0b5ab0e35ca33dc02a0bc2501e0f0f531ec3f376
Reviewed-on: https://code.wireshark.org/review/28701
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-14 21:44:34 +00:00
Gerald Combs bbe5fc1028 Epan+Qt: Invalidate cached column strings.
Add col_data_changed, which checks to see if we have updated column
info. Add col_append_frame_number, which adds a frame number and sets
col_data_changed. Call col_append_frame_number instead of
col_append_fstr from some dissectors.

Add PacketListRecord::invalidateAllRecords, which invalidates any cached
record data. Add PacketListModel::invalidateAllColumnStrings which calls
invalidateAllRecords and signals that our data has changed. Call
invalidateAllColumnStrings when we have new name resolution or column
information.

Bug: 11414
Bug: 11468
Change-Id: I2671594a722f4f9436fe1df84d43489a148e0cee
Reviewed-on: https://code.wireshark.org/review/26373
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-03-15 12:19:23 +00:00
Gerald Combs 6a819d9950 MaxMindDB: Add country ISO codes.
Add and dissect country ISO codes. Prefer them when printing summary
information.

Change-Id: I3ce2bde88fa5ca2604c8bb745c42f239660252ff
Reviewed-on: https://code.wireshark.org/review/26415
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-03-10 19:21:42 +00:00
Gerald Combs a1da75c554 Transition from GeoIP Legacy to MaxMindDB.
MaxMind is discontinuing its legacy databases in April in favor of
GeoIP2, which use a newer database format (MaxMind DB). The reference C
library (libmaxminddb) is available under the Apache 2.0 license which
isn't quite compatible with ours.

Add mmdbresolve, a utility that reads IPv4 and IPv6 addresses on stdin
and prints resolved information on stdout. Place it under a liberal
license (MIT) so that we can keep libmaxminddb at arm's length. Add
epan/maxmind_db.[ch], which spawns mmdbresolve and communicates with it
via stdio.

Migrate the preferences and documentation to MaxMindDB.

Change the IPv4 and IPv6 asnum fields to FT_UINT32s. Change the
geographic coordinate fields to FT_DOUBLEs.

Bug: 10658
Change-Id: I24aeed637bea1b41d173270bda413af230f4425f
Reviewed-on: https://code.wireshark.org/review/26214
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-03-06 18:02:21 +00:00
Dario Lombardo fe219637a6 dissectors: use SPDX identifiers.
Change-Id: I92c94448e6641716d03158a5f332c8b53709423a
Reviewed-on: https://code.wireshark.org/review/25756
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-12 16:49:58 +00:00
Kenneth Soerensen b3394a76ab ZigBee: Enable heuristic dissection of Tunneling cluster payload
The Smart Energy Tunneling cluster can carry various payloads.
The type of payload is determined when the tunnel is established.
However, we cannot be sure to capture the tunnel establishment and
therefore heuristics are used to determine the payload type.

The IP protocol is added as a heuristic dissector because the
specification allows IP in the tunnel payload. However, the only
real life payload type I am aware of is GBCS messages in
UK Smart Metering (https://smartenergycodecompany.co.uk).

Finally, if a heuristic dissector cannot be found, the Data
dissector is used.

Change-Id: I4942bf00d0d0efe7047db6494cd4f8a9d19c96b6
Reviewed-on: https://code.wireshark.org/review/25181
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Boye Petersen <martinboyepetersen@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-07 16:08:01 +00:00
Guy Harris 39ba9d4e7f Add wsutil/inet_ipv4.h.
It defines a ws_in4_addr type, which is intended to hold IPv4 addresses
in network byte order, and some macros to test for IPv4 addresses in the
local network control block and multicast IPv4 addresses.

Use those macros in places where dissectors had their own code for that
purpose.

Change-Id: I4252b410e37207157be85119a332e2a6913b332f
Reviewed-on: https://code.wireshark.org/review/24178
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-30 02:11:22 +00:00
Michael Mann 63966ec5d5 Use endpoint_type in conversation tables and hostlists
Follow up to having conversions use endpoint_type instead of
port_type.

Change-Id: Ifd59a33bd8b9a013c242bce5fcceb09533f02c17
Reviewed-on: https://code.wireshark.org/review/24172
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-29 20:17:03 +00:00
João Valverde 692b1175e4 Have a single IPv6 tap
Optimize code and open possibility for enriching IPv6 tap data.

Change-Id: I5a204d7464cde32123d5bfe664cc9b6bcf08dbe1
Reviewed-on: https://code.wireshark.org/review/23340
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-09-02 16:06:42 +00:00
João Valverde f16f6a3ef2 Avoid use of global protocol variables
Change-Id: I006d872a83649e72a6c83abac68cbae064457162
Reviewed-on: https://code.wireshark.org/review/23346
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-09-01 03:29:39 +00:00
Michael Mann ff1bdfa0bc Verify IP checksum even if in ICMP error packet
Bug: 10579
Change-Id: I18cac02f81465598451e0cf8f6729a26faf8c176
Reviewed-on: https://code.wireshark.org/review/22849
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-07-30 01:09:43 +00:00
Michael Mann e3b46bc48a Fix IP Security option dissection
"offset" no longer needed (since using dissector table for options),
and since it should always be 0, just remove it.

Change-Id: Icc2802b76bc99a17d60d1deff75e1dc65761e8ed
Reviewed-on: https://code.wireshark.org/review/22848
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-07-30 00:32:56 +00:00
Arjen Zonneveld 168065dad7 Add initial RFC2780 IP Version lookup support
Add support for https://www.iana.org/assignments/version-numbers/version-numbers.xhtml IP Version lookups.

Change-Id: I58a330ab9acba17356344df3ffeb94cc1b2b1443
Reviewed-on: https://code.wireshark.org/review/22821
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-07-29 14:11:10 +00:00
AndersBroman 558fe23226 [IP] Simplify paring of flags field by using
proto_tree_add_bitmask_with_flags().

Change-Id: If8e9f9956543f253f4f59d8204c9536f444dbcd5
Reviewed-on: https://code.wireshark.org/review/22728
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-07-20 15:40:56 +00:00
Gerald Combs b370c02a02 TCP: Make the header length display consistent with IPv4.
Format tcp.hdr_len in the tree similar to ip.hdr_len. Add comments
noting that they should be consistent.

Change-Id: Ic64282d8386c8ed339811bc9c22b5962c707d292
Reviewed-on: https://code.wireshark.org/review/22314
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-22 02:42:30 +00:00
Pascal Quantin e6883c15ac IP: ensure that fragment contains payload before adding it for reassembly
Solves a UBSan runtime error null pointer passed as argument 1, which is
declared to never be null.
It can be reproduced with the pcap from bug 13603

Change-Id: I0d6fdddcccc892b3141855d59be372887afcaca5
Reviewed-on: https://code.wireshark.org/review/22272
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-20 20:17:48 +00:00
Michael Mann 2273cf0e7b packet-nsh.c: Create dissector table for next protocol
Change-Id: Id8be2a37f99f4ac9d531a694273c7d5d3f843cc1
Reviewed-on: https://code.wireshark.org/review/21163
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2017-04-17 20:22:45 +00:00
Michael Mann 26512328ae Make IP options into a dissector table.
This provides external access for dissectors and plugins to provide their
own implementation of IP options.

Change-Id: I40ce17ce408217769e3b86e364f372a5181888e1
Reviewed-on: https://code.wireshark.org/review/20163
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-23 03:34:30 +00:00
Michael Mann af54b292e6 Register reassembly tables
Register all reassembly tables with a central unit, allowing the
central unit to have the callback that initializes and destroys
the reassembly tables, rather than have dissectors do it individually.

Change-Id: Ic92619c06fb5ba6f1c3012f613cae14982e101d4
Reviewed-on: https://code.wireshark.org/review/19834
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-29 13:29:04 +00:00