summaryrefslogtreecommitdiff
path: root/plugins/mate/mate_runtime.c
AgeCommit message (Collapse)AuthorFilesLines
2017-04-17Make the current MATE config pointer static only to packet-mate.c.Guy Harris1-11/+10
Pass it as an argument to everything else, so only packet-mate.c has the notion of there being *a* configuration, and everything else takes the configuration as an argument. Change-Id: Ia92c1539586d3e71580fd822cf07bd3d79a6f093 Reviewed-on: https://code.wireshark.org/review/21151 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-23mate: fix Match edge cases, improve documentationPeter Wu1-7/+7
Use strcmp to sort AVPs in an AVPL and for matching instead of comparing pointer addresses. Pointers can only be used for (in)equality, there is no ordering in them. Matching of attributes however requires a better ordering to know whether the operator (condition) or whether the operand (data) can be skipped. Otherwise it is possible that condition (b) randomly fails to match data (a,b). User-visible changes (mainly edge cases): - Loose (a=1, a?) on data (a=0, a=1) would previously fail to return (a=0,a=1) because the a? condition is not tried for data a=0. Now it tries all compatible conditions for a data AVP. - Any Match condition like (a=1, a^1) would previously be treated the same as (a=1) while (a^1, a=1) would still be seen as (a^1, a=1). The first case is now fixed to match (a=1, a^1). (Via a fix in insert_avp to ensure that (a=1) is not considered the same as (a^1).) - Every (a=1, a=2) on data (a=1, b=1) previously failed, but the comment "it will not create a list if there is not a match for every attribute in op" suggests that it should return (a=1). - Every (a=1) on data (a=2) previously succeeded (bug) while it would fail on (a=2, b=1). This is fixed now by checking whether any of the conditions really have matching data for the attribute. Other changes: optimize merge_avpl and new_avpl_*_match to insert in linear time instead of quadratic, rewrite and add comments in an attempt to make it easier to understand. Merge the new_avpl_every_match and new_avpl_exact_match functions and rename it to new_avpl_pairs_match to reflects its actual implemented functionality. Not addressed in this patch is the quasi-randomness of the returned data AVPL. AVPLs are unordered, so the condition Strict (a?) on data (a=1, a=2) could in theory return either (a=1) or (a=2). In practice this returns (a=1) because of alphabetical ordering, but this cannot really be relied on. It gets worse for conditions like Strict (a?, a>1), these are considered undefined behavior (without warnings for now). Ping-Bug: 12184 Change-Id: I0008448ffcb96183f106cb937c4f488e26a82f92 Reviewed-on: https://code.wireshark.org/review/17777 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-14Fix format string warnings [-Wformat=]João Valverde1-1/+1
Change-Id: I266c7d422f6ade965b42a4e2e8dc01966f8eb5f8 Reviewed-on: https://code.wireshark.org/review/13932 Reviewed-by: João Valverde <j@v6e.pt>
2016-01-24Add the packet number to the packet_info structure, and use it.Guy Harris1-4/+4
That removes most of the uses of the frame number field in the frame_data structure. Change-Id: Ie22e4533e87f8360d7c0a61ca6ffb796cc233f22 Reviewed-on: https://code.wireshark.org/review/13509 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-29plugins/mate: fix some memleaksPeter Wu1-1/+2
Fixes about 5kB leaks in 500+ allocations. There are still some other remaining (and not fixed in this patch because it is hard to track them): - The g_strdup'ed memory via MATE_PARSE for some types (cannot simply g_free after use, it is still needed in some cases). - cfg->transforms and cfg->transport_ranges as used in pdu_decl (mate_grammar.lemon). Tested on a http capture with: tshark -o mate.config:tcp.mate -r ... where tcp.mate is from https://wiki.wireshark.org/Mate/GettingStarted?action=AttachFile&do=get&target=tcp.mate Change-Id: I4c06f948136fc30dfcdb56f7ac8a32a2326ae30d Reviewed-on: https://code.wireshark.org/review/9221 Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2014-10-06plugins: Add editor modelines; Adjust whitespace as needed.Bill Meier1-2/+12
Change-Id: I36124f6021d46a228721bdc976f6b9fef1c8c088 Reviewed-on: https://code.wireshark.org/review/4488 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-07-06Add printf-format annotations, fix garbagePeter Wu1-1/+1
The WRETH dissector showed up some garbage in the column display. Upon further inspection, it turns out that the format string had a trailing percent sign which caused (unsigned)-1 to be returned by g_printf_string_upper_bound (in emem_strdup_vprintf). Then ep_alloc is called with (unsigned)-1 + 1 = 0 memory, no wonder that garbage shows up. ASAN could not even catch this error because EP is in charge of this. So, start adding G_GNUC_PRINTF annotations in each header that uses the "fmt" or "format" paramters (grepped + awk). This revealed some other errors. The NCP2222 dissector was missing a format string (not a security vuln though). Many dissectors used val_to_str with a constant (but empty) string, these have been replaced by val_to_str_const. ASN.1 dissectors were regenerated for this. Minor: the mate plugin used "%X" instead of "%p" for a pointer type. The ncp2222 dissector and wimax plugin gained modelines. Change-Id: I7f3f6a3136116f9b251719830a39a7b21646f622 Reviewed-on: https://code.wireshark.org/review/2881 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-31Continue to remove $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^\* \$Id\$/,+1 d') (no space before star) Change-Id: I318968db2b8512ba1303b5fc5c624c66441658f0 Reviewed-on: https://code.wireshark.org/review/879 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2013-09-02Fix some Dead Store (Dead assignement/Dead increment) Warning found by ClangAlexis La Goutte1-2/+0
svn path=/trunk/; revision=51678
2013-07-21Update plugins/ with recent change.Jakub Zawadzki1-1/+1
svn path=/trunk/; revision=50774
2013-03-21From beroset:Bill Meier1-18/+18
remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10409 svn path=/trunk/; revision=48449
2012-12-26Fix a bunch of warnings.Guy Harris1-9/+9
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of sizeof. Cast away some implicit 64-bit-to-32-bit conversion errors due to use of strtol() and strtoul(). Change some data types to avoid those implicit conversion warnings. When assigning a constant to a float, make sure the constant isn't a double, by appending "f" to the constant. Constify a bunch of variables, parameters, and return values to eliminate warnings due to strings being given const qualifiers. Cast away those warnings in some cases where an API we don't control forces us to do so. Enable a bunch of additional warnings by default. Note why at least some of the other warnings aren't enabled. randpkt.c and text2pcap.c are used to build programs, so they don't need to be in EXTRA_DIST. If the user specifies --enable-warnings-as-errors, add -Werror *even if the user specified --enable-extra-gcc-flags; assume they know what they're doing and are willing to have the compile fail due to the extra GCC warnings being treated as errors. svn path=/trunk/; revision=46748
2012-06-28Update FSF address - part II.Jakub Zawadzki1-1/+1
svn path=/trunk/; revision=43538
2012-01-16Use GSlice API instead of GMemChunk API for some memory allocation.Bill Meier1-10/+8
svn path=/trunk/; revision=40547
2011-05-19Don't assign a value to a variable which is then never used: Coverity 1160 ↵Bill Meier1-4/+4
[UNUSED] svn path=/trunk/; revision=37290
2011-04-21Fix Dead Store (Dead nested assignment) Warning found by Clang Alexis La Goutte1-1/+1
svn path=/trunk/; revision=36756
2011-03-22Allocate correct size of range.Stig Bjørlykke1-2/+2
Coverity 718. svn path=/trunk/; revision=36262
2011-03-22Coverity 420Ronnie Sahlberg1-7/+4
Remove dead code and add a g_assert_not_reached() at a spot we can definitely never reach. change a if(x)g_free(x) to a g_free(x) since g_free(NULL) is just a nop. svn path=/trunk/; revision=36238
2011-01-30Add a comment about some "unreachable code" indicating possible incorrect ↵Bill Meier1-230/+230
code someplace. Fix some spelling.. svn path=/trunk/; revision=35710
2010-01-28Fix some gcc -Wshadow warnings.Bill Meier1-5/+5
svn path=/trunk/; revision=31722
2009-07-18From Kovarththanan Rajaratnam via bug 3719:Stig Bjørlykke1-9/+9
This patch optimizes proto_tree_prime_hfid() + friends and plugs a memleak in the process. From me: Removed unused hfindex in proto_tree_new_item() Fixed ref_count entry in struct header_field_info. svn path=/trunk/; revision=29137
2008-12-22Fix some typos and spelling (mostly in text strings)Bill Meier1-1/+1
svn path=/trunk/; revision=27085
2008-09-06Use GINT_TO_POINTER() to cast integral values to gpointer inGuy Harris1-2/+2
g_hash_table_lookup() calls, in the hopes of suppressing warnings on platforms with 32-bit ints and 64-bit pointers. svn path=/trunk/; revision=26149
2008-08-05luis.ontanon@gmail.com => luis@ontanon.orgLuis Ontanon1-1/+1
svn path=/trunk/; revision=25937
2007-04-03Fix warnings on Linux/gcc 4.1.1Stephen Fisher1-1/+1
svn path=/trunk/; revision=21330
2007-03-30revert back (void*) -> (void**) which will stop free-warning compilation withSebastien Tandel1-1/+1
gcc-4.1.2 svn path=/trunk/; revision=21282
2007-03-29strict aliasing warnings fix : replace (void**) by (void*)Sebastien Tandel1-1/+1
svn path=/trunk/; revision=21274
2006-05-21name changeRonnie Sahlberg1-2/+2
svn path=/trunk/; revision=18197
2005-12-12- add Debug and Default declarations.Luis Ontanon1-1/+5
- supress unwanted console printouts. svn path=/trunk/; revision=16769
2005-08-24EVERYTHING IN THE BUILDBOT IS GOING TO BE RED!!! Sorry! Ulf Lamping1-1/+1
I've done more than a day to change the timestamp resolution from microseconds to nanoseconds. As I really don't want to loose those changes, I'm going to check in the changes I've done so far. Hopefully someone else will give me a helping hand with the things left ... What's done: I've changed the timestamp resolution from usec to nsec in almost any place in the sources. I've changed parts of the implementation in nstime.s/.h and a lot of places elsewhere. As I don't understand the editcap source (well, I'm maybe just too tired right now), hopefully someone else might be able to fix this soon. Doing all those changes, we get native nanosecond timestamp resolution in Ethereal. After fixing all the remaining issues, I'll take a look how to display this in a convenient way... As I've also changed the wiretap timestamp resolution from usec to nsec we might want to change the wiretap version number... svn path=/trunk/; revision=15520
2005-05-22at this point mate should be working as it did before the grammarLuis Ontanon1-1/+3
- pdu transports were upside down (ip/tcp vs tcp/ip) - the gop to gog index was not being populated - tell svn to ignore generated c files svn path=/trunk/; revision=14416
2005-05-16Transforms and Pdus are working already, Gops start to work.Luis Ontanon1-14/+27
svn path=/trunk/; revision=14376
2005-05-16MATE has a grammar.Luis Ontanon1-220/+200
Although not yet fully implemented I want this version as a reference. svn path=/trunk/; revision=14373
2005-02-18Adds Payload AVP to PduDef AVPLs simmetric to the Transport AVPLuis Ontanon1-2/+43
allows to fetch fields also from ranges that are the payload of the Proto svn path=/trunk/; revision=13427
2005-02-11avoid freeing the gop_key more than once and do not reregister the tap at ↵Luis Ontanon1-0/+1
every reload svn path=/trunk/; revision=13382
2005-02-07From LEGO:Anders Broman1-8/+12
- fixes a leak in analize_pdu() - fixes a typo in analize_pdu() - fixes a crash in scs_unsubscribe() - save a malloc and a free in get_pdu_fields() svn path=/trunk/; revision=13335
2005-02-06From: LEGOAnders Broman1-102/+150
- fix a bug at gog reinit that disabled gogs after reload of a file. - fix some crashes when Debug_GoG>0 - cleanup the debug output (no CR at the end is needed) - Gops start when no GopStart is given and match an existing GogKey svn path=/trunk/; revision=13318
2005-01-28A new patch for mate from Luis Ontanon:Lars Roland1-8/+4
- move mate_packet into packet-mate.c and remove it frome mate.h - supressed some warnings svn path=/trunk/; revision=13190
2005-01-21From Luis Ontanon for Mate:Lars Roland1-3/+19
- supress some solaris compiler warnings - adds GopExpiration, GopIdleTimeout and GopLifetime parameters svn path=/trunk/; revision=13154
2005-01-10One more patch for mate:Lars Roland1-1/+1
- renamed analyze_frame() into mate_analyze_frame(). - prepare mate to be statically linked - use report_open_failure() , report_read_failure() and report_failure() in case there's an error while loading the config - some cleanup in mate_util.c - some fixes and cleanup in examples and matelib svn path=/trunk/; revision=13001
2005-01-06From Luis Ontanon:Lars Roland1-1/+1
Fix some MSVC warnings in MATE svn path=/trunk/; revision=12969
2005-01-06From Luis Ontanon:Lars Roland1-5/+6
Another patch for mate: - adds a "GopTree={TRUE|FALSE}" attribute to Gogs - changes "ShowPduTree={NoTree|PduTree|FrameTree}" - adds "implicit stop" to Gops with no Stop declared svn path=/trunk/; revision=12968
2004-12-31From Luis Ontanon for Mate:Lars Roland1-52/+129
- moved gop and gog indexes into gopcfgs, which is a propedeutic change for upcoming changes in the way gops are to be grouped - changed the way gog-keys are kept in memory - every gopkey attribute is copied into the gop->extras to avoid redundancy in the configuration - added timers to gogs mate.gog_type.StartTime and mate.gog_type.Time - fixed a bug in scs_subscribe that mangled some strings - minor interface improvement to scs propedeutic to having types avp values in a future - changed medium and large into mate_medium and mate_large in the scs_collection - fixed Mode=Replace in Transforms, now it works - fixed a crash at reinit due to impropper initialization of mate_items svn path=/trunk/; revision=12902
2004-12-23Fixes for Mate from Luis Ontanon:Lars Roland1-36/+29
- fixes crash at reinit when DiscardPduData=TRUE: check if there's an avpl before deleting it. - mate.pdu_type.RelativeTime had a dual use, add mate.pdu_type.TimeInGop and leave the other alone. - other fixes related to times (they now seem to be right) - scs_subscribe doesn't use g_malloc anymore. it uses GMemChunks (I had to rename two GMemChunks to make MSVC happy) - fixes crash at reinit when DiscardPduData=TRUE: check if there's an avpl before deleting it. - mate.pdu_type.RelativeTime had a dual use, add mate.pdu_type.TimeInGop and leave the other alone. - other fixes related to times (they now seem to be right) - fixed few things at reinit: - reset last_id - remove the nodes in the items hash tables svn path=/trunk/; revision=12820
2004-12-16Patch for Mate Plugin.Lars Roland1-45/+39
From Luis Ontanon: - moves mate configuration from proto_register to proto_register_handoff - add the config file protocol preference - every item (gop,gog,pdu) has it's own ett - the tap doesn't do nothing, it just primes the tree - analyze_frame() what once was the tap now is called by the dissector - should work with tethereal now (to be tested) svn path=/trunk/; revision=12763
2004-12-12Update for Mate from Luis Ontanon:Lars Roland1-14/+33
- make rd static (no purpose for it to be global) - remove outdated comments - add "PduCriteria" feature (as already stated in the wiki) - add "DiscardUnassignedPdu" feature (as already stated in the wiki) - removed ".Id" from abbrev for "mate.item_name" - in radius.mate: Don't use the port to determine the Gop key. svn path=/trunk/; revision=12735
2004-12-12Fixes for Mate Plugin:Lars Roland1-20/+24
As suggested by Martin Regner: - Use strtod() instead of strtof() From Luis Ontanon: - changes the id of mate items to be integer (the old string ID imposed a lenght limit and as mate fileds had become dynamic it makes no more sense anymore) - fixes a huge avp leak on reinit (every avp object was leaked when a new file was loaded) - adds the "Lib" AVP to the Action=Include AVPL to include definitions >from matelib - rename mate.[dll/so] to zzmate.[dll/so] so it gets initialized as the very last protocol (so that fields from every dissector can be used). svn path=/trunk/; revision=12728
2004-12-11New Plugin from Luis Ontanon:Lars Roland1-0/+742
MATE -- Meta Analysis and Tracing Engine Won't be compiled by default. It is still not possible to link the plugin on Win32. svn path=/trunk/; revision=12716