Commit Graph

51 Commits

Author SHA1 Message Date
Evan Huus 8b194a924f osi: avoid global memory scopes
Add scope arguments to the OSI helper methods which allocate buffers to
avoid the use of the global wmem_packet_scope().
2021-09-14 19:05:11 +00:00
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
Guy Harris 101b692569 Fix incorrect formatting of NSAP area addresses/address prefixes.
If the area address/address prefix is 13 octets long, use the 13th
octet, not the 21st octet; the latter is *not* part of the area
address/address prefix, and might either not be in the packet or might
be some random other part of the packet.

Add/expand comments while we're at it.

Bug: 14744
Change-Id: I7b90318a72a49b67d8ec17952add528185fd064b
Reviewed-on: https://code.wireshark.org/review/27848
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-27 18:56:41 +00:00
Dario Lombardo 55c68ee69c epan: use SPDX indentifiers.
Skipping dissectors dir for now.

Change-Id: I717b66bfbc7cc81b83f8c2cbc011fcad643796aa
Reviewed-on: https://code.wireshark.org/review/25694
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 19:29:45 +00:00
Alexis La Goutte 4c555c6b57 osi-utils: Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
Change-Id: I48121b5e73501a39ff5fb7986ab58242ee32af53
Reviewed-on: https://code.wireshark.org/review/20902
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-04 17:00:49 +00:00
Guy Harris 02f74e47ed Fix some dissection errors.
"XXX supported" for a metric type is a Boolean, not an int; add it as
such.

Add the value of the item without the extra bits.

The length of an address prefix is in semi-octets (nibbles/hex digits),
not in octets.

Change-Id: I642f0dab5030f7609e89f45cf2cff15cd74dfbda
Reviewed-on: https://code.wireshark.org/review/20819
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-03-31 21:48:25 +00:00
Guy Harris aa6dcf9cd3 Add a bunch of #defines for OSI NSAP AFI values, and use them.
Have the ISUP value_string for those AFI values show "decimal" and
"binary" indicators.

Update some references.

Change-Id: I07797455f5ffa5fa9cd4e0702a6f5db831054937
Reviewed-on: https://code.wireshark.org/review/20798
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-03-30 22:00:53 +00:00
Guy Harris 8bf0a57ce1 Make some routines static.
Change-Id: I04860f058345cb633ab379c83dcfc24b6cf1a846
Reviewed-on: https://code.wireshark.org/review/20797
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-03-30 19:41:13 +00:00
Michael Mann 0bf1cb2342 Add address_to_bytes API.
This will copy an address's "byte format" into a buffer.  The original
intended design is for export_pdu functionality, which tries to do
this "manually" for many address types (and creates undesired dependencies)

The default functionality if a "byte format function" isn't provided
(currently the case for all address types) is a memcpy of the address
data.  Providing "address to byte" functions to aid export PDU
functionality will be provided later.

Change-Id: I3703f9e617a8cef09165ad53a0f98c6372676b9b
Reviewed-on: https://code.wireshark.org/review/16070
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-22 07:47:39 +00:00
Michael Mann 14697b8aee Pass tvb and offset into print_nsap_net() and print_area() to "hide" the tvb_get_ptr call that dissectors are using.
Change-Id: Ibc5a51be462d431b85b34cac7a358d736ec7b9db
Reviewed-on: https://code.wireshark.org/review/7422
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-27 07:37:40 +00:00
AndersBroman ca68a7adc3 Add some casts to satisfy the various compilers.
Change-Id: I7687fc0b433774fe447757af00bdaa2fc44ac59d
Reviewed-on: https://code.wireshark.org/review/7254
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-19 14:23:03 +00:00
Michael Mann 8d16ac46d5 Add name resolution support to address type.
Add address_with_resolution_to_str API that returns address string + name resolution in the format %s (%s), first string is resolved name (if available) and second string is raw address string.

Convert AT_FCWWN to using proper name resolution format

First use of address_with_resolution_to_str with field types in proto.c

Change-Id: I2ae77c29a4ffc30bb919fbec00f06629830898c2
Reviewed-on: https://code.wireshark.org/review/7196
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-19 13:09:41 +00:00
Michael Mann 8ff944d4ab Add fixed length function for address types.
This allows for even more cleanup with respect to how address types are handled, including removing address_to_str.c.  Most of the functionality was folded into address_types.c, but the remainder was just dispersed because it didn't make sense to keep the file.

Change-Id: Id4e9391f0c3c26eff8c27b362e4f7a1970d718b4
Reviewed-on: https://code.wireshark.org/review/7038
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-09 03:49:13 +00:00
Michael Mann 2042385ac9 Add "column filter string" support to address types.
Information about dissector (filter) fields should be kept in a dissector as much as possible. Supporting "column filter string" also allows other dissectors to create their own "address types" with different column filters (because AT_ETHER isn't always an "Ethernet" address).

This feature also allowed a few "dissector specific" address types to be moved to their own dissector.

Change-Id: Ie9024af4db62bc2ee4f8c9d28a1d807f706f45bf
Ping-Bug:7728
Reviewed-on: https://code.wireshark.org/review/7029
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-09 01:13:28 +00:00
Michael Mann 4497bb48fd Add address type registration.
Now address types are setup just like field types and must be registered with a structure that provides its string representation (and more things in the future).  Address types that are limited to a single dissector are registered by the dissector.  More "common" ones are globally registered.  There are still a few that really belong in a dissector, but have other dependencies currently not accounted for in the address type support.

Many of the "address to string" conversions that involved g_sprintf have be changed to use more "performance friendly" methods (some at the cost of needing to_str-int.h)

Leaving all comments regarding this "solution" in address_to_str.c in until all have been implemented

Change-Id: I494f413e016b22859c44675def11135f228796e0
Reviewed-on: https://code.wireshark.org/review/7019
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-09 01:12:01 +00:00
Guy Harris 44e7ce54ff Remove some apparently-unnecessary includes of emem.h.
Change-Id: Ib7d1b587b439ff21ec6b7f1756ce6ccf25b66f80
Reviewed-on: https://code.wireshark.org/review/6635
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18 20:19:05 +00:00
Michael Mann 0ad15f88cc Replace the last of ep_alloc and ep_alloc0 with wmem equivalent.
Change-Id: I0338d0acda5e4b9957aad4825ca2cfd6fa506ead
Reviewed-on: https://code.wireshark.org/review/6596
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-17 23:23:06 +00:00
Michael Mann 20414ebf4b Replace some ep_alloc and ep_alloc0 with its wmem equivalent.
These cases were pretty easy to identify.  Also replaced some comments that referenced ep_alloced memory, when it's now in fact wmem_alloced.

Change-Id: I07d2f390a9c0b34aa2956880476755d1acf5db0a
Reviewed-on: https://code.wireshark.org/review/6392
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-08 07:24:15 +00:00
Alexis La Goutte cf3b238a6b OSI util: Add modelines info
Change-Id: I15e44f2f10b80b7c7ce78ce84b748ce8ec7a2eff
Reviewed-on: https://code.wireshark.org/review/3890
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-08-28 11:34:19 +00:00
Guy Harris 16b26b8e5f Put the system ID in the top-level items for neighbors.
Add a tvb_print_system_id() routine, and use that in various ISIS
dissectors, while we're at it.

Change-Id: I31b6b9ea8faf2b4849f974ec7ed27fbdd14b91ef
Reviewed-on: https://code.wireshark.org/review/1145
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-14 22:43:25 +00:00
Alexis La Goutte abc6fb24fa Fix some code remove by 296591399f
(Copyright or info about file...)

Change-Id: I90ba8b1c3ec8406b0c3365a69a8555837fc4bbb1
Reviewed-on: https://code.wireshark.org/review/515
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-03-05 09:25:47 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Bill Meier 0df5a9390d From beroset:
remove C++ incompatibilities
 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10397

svn path=/trunk/; revision=48438
2013-03-20 01:18:10 +00:00
Guy Harris a9f4da4549 Clean up white space.
Add a return where I presume it was intended to be - a 4-octet address
is completely handled in that if clause, so there's no reason to fall
through.

Fix a comment.

svn path=/trunk/; revision=46646
2012-12-21 00:43:00 +00:00
Evan Huus e43dba76e0 Fix some valgrind warnings from the capture attached to
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8110

I can't reproduce the actual reported crash on trunk.

svn path=/trunk/; revision=46645
2012-12-21 00:19:16 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Gerald Combs a6bbdaa849 Fix some dead code and zero division issues found by Clang scan-build.
In convert_string_case() use g_utf8_strup() instead of converting each
character by hand. Hopefully this won't cause any unexpected changes in
behavior.

svn path=/trunk/; revision=36006
2011-02-18 22:43:48 +00:00
Anders Broman e8042d8eec From gonzalocas:
GSSE message dissector.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4370

svn path=/trunk/; revision=31442
2010-01-04 23:17:37 +00:00
Gerald Combs 844af38e54 size_t fixes.
svn path=/trunk/; revision=27990
2009-04-08 05:25:14 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Gilbert Ramirez 853b929df0 Remove dead code. Due the to if() test that checks for specific
values of 'length', the code in question can never run.
This fixes Coverity bug ID #1.

svn path=/trunk/; revision=17514
2006-03-07 22:38:51 +00:00
Guy Harris 346e5e211c The previous checkin for packet-isup.c was accidentally checked in along
with some unrelated changes; it got rid of some calls to get IPv4/IPv6
addresses and add them to the protocol tree, replacing them with
proto_tree_add_item() calls, and fixed up the length of one protocol
tree item.

Note that we have (at least) three count 'em three different routines
for dissecting/displaying NSAPs (there might be more - I might have
missed some), and suggest that we might want to reduce that to one.

Update the URL for ICP values for IPv{4,6} addresses inside NSAPs.

Fix the offset in the call to add the IPv6 address part of an NSAP
containing such an address, and the length in the call adding the DSP
for an NSAP containing an IPv4 address.

Fix up indentation a bit.

svn path=/trunk/; revision=15766
2005-09-12 07:44:11 +00:00
Guy Harris 393366d5dd The order in which arguments to a function are evaluated isn't defined
by C.  Do decrements of arguments before passing them to a function.

svn path=/trunk/; revision=15463
2005-08-20 09:35:55 +00:00
Ronnie Sahlberg a34e7e3d03 removal of even more sprintf
svn path=/trunk/; revision=15457
2005-08-20 02:33:33 +00:00
Ronnie Sahlberg d4267d1272 replace some more silly rotating buffers with ep_alloc() calls
svn path=/trunk/; revision=15386
2005-08-17 09:36:20 +00:00
Guy Harris 8a8b883450 Set the svn:eol-style property on all text files to "native", so that
they have LF at the end of the line on UN*X and CR/LF on Windows;
hopefully this means that if a CR/LF version is checked in on Windows,
the CRs will be stripped so that they show up only when checked out on
Windows, not on UN*X.

svn path=/trunk/; revision=11400
2004-07-18 00:24:25 +00:00
Guy Harris f42de5c9b2 From Hannes Gredler: "print_system_id()" should call
"print_system_id_buf()", not "print_nsap_net_buf()".  (What idiot made
*that* mistake? :-))

svn path=/trunk/; revision=9046
2003-11-20 19:05:40 +00:00
Guy Harris 0de9c67adf Void functions don't return values.
svn path=/trunk/; revision=8442
2003-09-10 06:48:55 +00:00
Guy Harris d9c401c74c Create an "address_to_str_buf()" routine, called by "address_to_str()",
which fills in a caller-supplied buffer.

Create "_buf()" versions of various "to_str" routines for various
address types, and create a routine to map SNA FIDs to strings, and use
them to finish up "address_to_str_buf()".

Get rid of the declaration of "sna_fid_type_4_addr_to_str()" in
"packet-sna.h", as that routine has been swallowed up in
"sna_fid_to_str()".

svn path=/trunk/; revision=8260
2003-08-26 01:00:30 +00:00
Laurent Deniel 1a66f9aec9 Update my email address in various places since my old one no longer works
svn path=/trunk/; revision=7003
2003-01-26 19:35:31 +00:00
Guy Harris 46ac8aa4bd From Hannes Gredler:
open up a new subtree for dissecting the lsp-entry TLV;

	remove the isis_lsp_decode_lsp_id() routine, as the same
	functionality is better served using print_system_id();

	fix a small bug in print_system_id().

svn path=/trunk/; revision=6169
2002-09-02 22:10:17 +00:00
Guy Harris 79195136aa From Hannes Gredler: make the IS-IS dissector more verbose in the INFO
field - specifically for

	IIHs  the System-ID of the Hello;
	LSPs  the LSP-ID, Sequence #, Lifetime;
	CSNPs the LAN-ID, Start LSP-ID, End LSP-ID.

and change the display of some IDs.

Clean up white space.

svn path=/trunk/; revision=6128
2002-08-29 18:52:54 +00:00
Jörg Mayer 48be4e530d Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6116
2002-08-28 20:41:00 +00:00
Jörg Mayer 3105ee542f Replace the types from sys/types.h and netinet/in.h by their glib.h
equivalents for the epan/ directory but leave winsock2.h in inet_pton.c
and inet_ntop.c for now (can't estimate the consequences).

svn path=/trunk/; revision=5928
2002-08-02 21:29:45 +00:00
Guy Harris 77fa06b899 From Joerg Mayer:
dftest.c:
	     Remove #if-0-ed includes

	packet-ieee80211.c, packet-wtls.c, packet-afp.c, packet-wsp.c,
        packet-wtp.c, ethereal_gen.py:
	     Remove redundant include varargs (already in snprintf.h,
	     and required only for snprintf.h)

	Remove unused include of snprintf.h from files not using
	"snprintf()".

svn path=/trunk/; revision=5889
2002-07-17 00:43:03 +00:00
Guy Harris 96fad4b20a From Hannes Gredler: fix display of OSI system IDs to use a dot rather
than a dash before the PSN byte; the dash is typically
only used to demarcate the fragment.

svn path=/trunk/; revision=5785
2002-06-28 22:43:49 +00:00
Guy Harris 951f325eca Stop depending on the order in which operations are performed by
generated code, as per Chris Foulds' note.

Also, when constructing the system ID or area string, always append the
four-octet groups, rather than overwriting them, as we had been doing.

svn path=/trunk/; revision=3414
2001-05-15 18:58:15 +00:00
Guy Harris 77789be82e Assorted ISIS enhancements from Hannes Gredler.
When dissecting the ISIS NLPID CLV, use the "nlpid_vals" array to
convert NLPID values to protocol names.

svn path=/trunk/; revision=3308
2001-04-16 10:04:33 +00:00
Guy Harris 393b1b3e8d Don't use "u_int" and "u_char", as they're not defined in <sys/types.h>
on Windows, so we'd have to drag in <winsock.h> to define them.

svn path=/trunk/; revision=3246
2001-04-02 10:41:19 +00:00