aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
AgeCommit message (Collapse)AuthorFilesLines
2018-05-14Free g_array_free-related memory leaksPeter Wu2-9/+3
g_array_free(a, FALSE) returns "a->data". Callers that do not handle this will leak memory. Convert other users to use the return value instead of direct access to "a->data". Change-Id: I0a29864e8106c0bf09e9573ef29e4474179c4171 Reviewed-on: https://code.wireshark.org/review/27438 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-05-14Free g_ptr_array_free-related memory leaksPeter Wu1-1/+1
g_ptr_array_free(a, FALSE) returns "a->pdata". Callers that do not handle this will leak memory (e.g. "tshark -G plugins"). Convert other users to use the return value instead of direct access to "a->pdata". Change-Id: I29835477d587f5f54bf0d94cdae9f375e3da3ce3 Reviewed-on: https://code.wireshark.org/review/27437 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-05-10wslua: fix memleak in Dir.remove_all on error pathPeter Wu1-3/+2
While at it, use g_build_filename. Found by Clang Static Analyzer. Change-Id: I5c50f50abb8c16a553586c548ccd1ae6c3cdd8c1 Reviewed-on: https://code.wireshark.org/review/27439 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-04Get rid of more autotoolsisms.Guy Harris2-30/+1
Change-Id: I124732adf3c3da511c206932544b4d533404cfc5 Reviewed-on: https://code.wireshark.org/review/27332 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-04-30Lua: Remove autotools specific code for build pathJoão Valverde1-12/+1
Change-Id: I541bd728c159e95c2d5daa8ce0bfea3961ff1db9 Reviewed-on: https://code.wireshark.org/review/27203 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2018-04-30Lua: ensure that DATA_DIR and USER_DIR have trailing slashesPeter Wu2-4/+4
These directories have had trailing slashes for years and users seem to rely on it, so restore this assumption for backwards compatibility. The underlying API function (Dir.persconffile_path()) is not changed because trailing slashes were not documented for that function. For consistency, ensure that all Lua Dir functions return paths without trailing slashes. Bug: 14619 Change-Id: Ia299864999578884b1ad1cd48f1bd883bce6879d Fixes: v2.5.0rc0-579-gfb052a637f ("Use g_build_filename() instead, fix indentation") Reviewed-on: https://code.wireshark.org/review/27166 Reviewed-by: João Valverde <j@v6e.pt> Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-04-18Remove autotools build system.Dario Lombardo2-150/+0
It has been replaced by cmake. Change-Id: I83a5eddb8645dbbf6bca9f026066d2e995d8e87a Reviewed-on: https://code.wireshark.org/review/26969 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-10Add, and use, "fetch signed value" for lengths < 40 bits.Guy Harris1-24/+24
Add 8-bit, 16-bit, 24-bit, and 32-bit "fetch signed value" routines, and use them rather than casting the result of the 8/16/24/32-bit "fetch unsigned value" routines to a signed type (which, BTW, isn't sufficient for 24-bit values, so this appears to fix a bug in epan/dissectors/packet-zbee-zcl.c). Use numbers rather than sizeof()s in various tvb_get_ routines. Change-Id: I0e48a57fac9f70fe42de815c3fa915f1592548bd Reviewed-on: https://code.wireshark.org/review/26844 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-24wslua: Fix loggingPeter Wu1-1/+2
Always display Lua messages (to match tshark), do not send them to qDebug as they will not be visible with the default log options. Change-Id: I660a3877355891d45881b26735596ea6dc8a8b29 Fixes: v2.5.0rc0-2037-gc9b6887d84 ("wslua: Fix logger after g6a5e90f2") Reviewed-on: https://code.wireshark.org/review/26599 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-15wslua: use Filehandler.extensions for controlling output filesPeter Wu1-5/+18
Allow FileHandlers to specify the extension that is used for saved files. Implementation note: previously "fh->extensions" was unused; memory is not freed anywhere because registered file handlers can currently not be destroyed. Bug: 14386 Change-Id: I65509c10a678fc6af0cf6a4c5c8aed56e79ea34a Reviewed-on: https://code.wireshark.org/review/26399 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-03-09spdx: more licenses converted.Dario Lombardo7-137/+7
Change-Id: I8f6693108c43959e54911d35b4fbf730c59add60 Reviewed-on: https://code.wireshark.org/review/26361 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-08Squelch some casting-away-constness warnings.Guy Harris1-16/+18
In true_false_string_from_table(), keep the pointers to the "true" and "false" strings in local non-const pointer variables, so we can free them without a complaint. Only when we're finished, and have valid "true" and "false" strings, do we allocate the true_false_string structure and fill it in with those pointers. Change-Id: I6eb3ee46bdc47bf42d6e913c72884f0eac22997e Reviewed-on: https://code.wireshark.org/review/26353 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-03-07spdx: more licenses converted.Dario Lombardo6-86/+6
Change-Id: I3861061ec261e63b23621799e020e811ed78a343 Reviewed-on: https://code.wireshark.org/review/26333 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-07More licenses converted to SPDX.Dario Lombardo1-13/+1
Change-Id: Id4f987dcdacf06622d70263f4659a4400e30dc39 Reviewed-on: https://code.wireshark.org/review/26332 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-11wslua: Convert more comment markup to Asciidoctor.Gerald Combs17-45/+90
Convert links, source code blocks, and admonitions. Change-Id: I50c8daa19a115c23f7501b91dbfd904779a609c9 Reviewed-on: https://code.wireshark.org/review/25720 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-02-09epan: more SPDX convertions.Dario Lombardo3-39/+3
Change-Id: I3c9ba4542c50321ce60cba68696d99575a735392 Reviewed-on: https://code.wireshark.org/review/25708 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-09wslua: use SPDX identifiers.Dario Lombardo27-351/+27
Change-Id: I80d9d4e3ffc25eebf09e6ef693c378b77554e1b8 Reviewed-on: https://code.wireshark.org/review/25693 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-09Generalize wtap_pkthdr into a structure for packet and non-packet records.Guy Harris6-87/+95
Separate the stuff that any record could have from the stuff that only particular record types have; put the latter into a union, and put all that into a wtap_rec structure. Add some record-type checks as necessary. Change-Id: Id6b3486858f826fce4b096c59231f463e44bfaa2 Reviewed-on: https://code.wireshark.org/review/25696 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-08replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.Dario Lombardo2-2/+2
The first is deprecated, as per https://spdx.org/licenses/. Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed Reviewed-on: https://code.wireshark.org/review/25661 Petri-Dish: Anders Broman <a.broman58@gmail.com> Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-06Get rid of the pkt_encap field in struct packet_info.Guy Harris1-2/+2
pinfo->pkt_encap is jsut a copy of pinfo->phdr->pkt_encap; no need for the copy. Expand a comment while we're at it. Change-Id: I5fcfe694ecba42507f1d629d01440da0a0989501 Reviewed-on: https://code.wireshark.org/review/25643 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-03Clean up addition of FT_IPv{4,6} fields.Guy Harris1-2/+10
The data for an address is *not* guaranteed to be aligned on any particular boundary, so, for IPv4 addresses, don't assume it's aligned on a 32-bit boundary - copy it with memcpy() and use the result of the copy. For IPv6 addresses, cast the data pointer to a pointer to a *const* ws_in6_addr, so we don't throw away constness. Change-Id: I0e00263f594d7778c3bd9b98e4336cb201c1f3d5 Reviewed-on: https://code.wireshark.org/review/25580 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-01-31Qt: About dialog updates.Gerald Combs2-27/+8
Open lua scripts when double-clicked. Behavior depends on your system configuration. Add tooltips accordingly. Let Qt wrap the "Wireshark" tab information. Set column widths by eyeballing their contents. Elide the Folders and Plugins strings in the middle. Fixup placeholder text capitalization. Draw links using the palette link color. Change-Id: Ic141eae05541480ec1e254c55fd81728d04713d9 Reviewed-on: https://code.wireshark.org/review/25510 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>
2018-01-24wslua: fix nstime memory leak after passing unknown encoding to ↵Jakub Zawadzki1-3/+5
TvbRange_nstime() Move checking of encoding before allocating nstime. Found by clang. Change-Id: I3c1de5fae6fcf52393cc38302359f21f17808087 Reviewed-on: https://code.wireshark.org/review/25442 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-26potential buffer underflow in File_read_line function in epan/wslua/wslua_file.cMartin Mathieson1-1/+1
Putting up for review, though I am not completely convinced that file_gets() can return an empty line. Bug: 14295 Change-Id: If36761ea511b66c01a9f167809a218a7eadbfcc5 Reviewed-on: https://code.wireshark.org/review/24997 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-19wslua: Fix logger after g6a5e90f2Stig Bjørlykke3-10/+8
The Qt log output changes in g6a5e90f2 changed the Qt message handler to use g_log. Lua logging already used g_log. The Qt variant of funnel logger, which is used by Lua as g_log backend, is currently using qDebug and this gives recursive calls to g_log and thus an assert. Rewrite the lua logging to not use g_log. Change-Id: Icf4f0022a11cb32d2b4f413f76d946f2506e283d Reviewed-on: https://code.wireshark.org/review/24888 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-16wslua: Fix crash in Dir.open()Stig Bjørlykke2-7/+3
Do not give an uninitialised error pointer to g_dir_open(), this will give a crash if g_dir_open() fails. Remove wslua_dir.dummy because it is not used by anyone. Change-Id: I044eee021393f2ea2aa022138bbf6fd099eb0908 Reviewed-on: https://code.wireshark.org/review/24840 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-16wslua: Fix memory leakagesStig Bjørlykke4-1/+7
Free some variables in error handling. Change-Id: I0d0653962b11f760c31872aa7e5b5f1d20c54dcb Reviewed-on: https://code.wireshark.org/review/24842 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-14epan: Make expert info summary text mandatoryStig Bjørlykke2-5/+5
This will make the code easier and removes the use of a generic "Expert Info" as name. Change-Id: I57ad2adb851726106ddc5009f3c6ca61721f647a Reviewed-on: https://code.wireshark.org/review/24792 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-13epan: Use expert info summary text as field nameStig Bjørlykke1-2/+4
Change the expert info registry to use summary text as field name instead of blurb to show the correct column header tooltip in custom columns. Preserve backward compability by not use empty summary text. Change-Id: Ibbaf142165be0d9f42d1e2476f39f8d251ea0593 Reviewed-on: https://code.wireshark.org/review/24788 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-21Move the protocol registration routines back into libwiresharkJoão Valverde1-1/+1
Follow-up to b695b3e2f72998d66ca4b7a6826d4ce1688060c8. Change-Id: I7e36519f2c3806c1205d05437671325080974257 Reviewed-on: https://code.wireshark.org/review/24524 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2017-11-18autotools: Library build products don't need explicit cleaningJoão Valverde1-3/+0
Change-Id: I5d68c05f2844d6c9ae486531b189dbf10bc09cff Reviewed-on: https://code.wireshark.org/review/24484 Reviewed-by: João Valverde <j@v6e.pt>
2017-11-13Remove circuit APIMichael Mann1-5/+0
Replace with conversation API that limits the "endpoint" to a single uint32 value. The intention is to eventually have "layered" endpoints, because circuit_id was used in cases where src/dest port have already been populated (and are used for layers above). Those src/dest ports should just be treated as just another endpoint, but we currently only have support for one. Change-Id: Ic6aa7ef0241275aa4dfde9459194369b48c72960 Reviewed-on: https://code.wireshark.org/review/24369 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-26Add a ws_in6_addr typedef for struct e_in6_addr.Guy Harris3-3/+3
That allows a parallel typedef of ws_in4_addr for guint32. Change-Id: I03b230247065e0e3840eb87635315a8e523ef562 Reviewed-on: https://code.wireshark.org/review/24073 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-15autotools: make maintainer-clean should allow rerunning 'configure'João Valverde1-5/+0
Change-Id: Iedae94ffefe27b13b1967d69cacb757b5aa4576d Reviewed-on: https://code.wireshark.org/review/23928 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-10-15Remove superfluous null-checks before strdup/freeAhmad Fatoum6-17/+9
NULL checks were removed for following free functions: - g_free "If mem is NULL it simply returns" https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-free - g_slist_free(_full)? "NULL is considered to be the empty list" https://developer.gnome.org/glib/stable/glib-Singly-Linked-Lists.html - g_strfreev "If str_array is NULL, this function simply returns." https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strfreev - g_slice_free "If mem is NULL, this macro does nothing." https://developer.gnome.org/glib/stable/glib-Memory-Slices.html#g-slice-free - g_match_info_free "not NULL... otherwise does nothing" https://developer.gnome.org/glib/stable/glib-Perl-compatible-regular-expressions.html#g-match-info-free - dfilter_free defined in Wireshark code. Returns early when passed NULL epan/dfilter/dfilter.c They were also removed around calls to g_strdup where applicable: - g_strdup "If str is NULL it returns NULL." https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strdup Change-Id: Ie80c2db89bef531edc3aed7b7c9f654e1d654d04 Reviewed-on: https://code.wireshark.org/review/23406 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-10-13CMake: Allow user build flags to override default build flagsJoão Valverde1-1/+0
Autotools has the very useful feature by design of allowing the user to override the default build flags (you break it you keep it). Apparently CMake applies COMPILE_OPTIONS target property after CMAKE_{C,CXX}_FLAGS so that doesn't work here. Prepend our flags to those variables instead to make it work then. Specific target flag overrides can still be added with COMPILER_OPTIONS (e.g: generated files with -Wno-warning) but this is less effective and then we're back at the point where this overrides user flags. It's less of a concern though. Change-Id: I44761a79be4289238e02d4e781fef0099628817b Reviewed-on: https://code.wireshark.org/review/23675 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> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-09-20plugins: Add backward compatibility for personal lua scriptsJoão Valverde1-6/+44
Relax requirements for upgrades and make running side-by-side installations more convenient. Change-Id: I5299eed005a4748c54465dec90f477adb577e056 Reviewed-on: https://code.wireshark.org/review/23619 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-20Rename get_plugin_dir() for consistencyJoão Valverde2-4/+4
WS_DLL_PUBLIC const char *get_plugin_dir(void); WS_DLL_PUBLIC const char *get_plugins_pers_dir(void); Opt for the plural form consistently (for public functions at least). Change-Id: I8a5861ad7f90f9c87168bd3275bd9dbc5c83b749 Reviewed-on: https://code.wireshark.org/review/23608 Petri-Dish: João Valverde <j@v6e.pt> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-09-15wslua: Disable -Wunreachable-code in lua_bitop.cStig Bjørlykke1-0/+3
Some code is unreachable in some configurations. Change-Id: I23ff9a6032f4f7f6eb8e6607c6473a77a8bb6ac6 Reviewed-on: https://code.wireshark.org/review/23561 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-09-15wslua: Avoid possible misuse of comma operator warningStig Bjørlykke3-12/+24
Change-Id: I441359741332aa49fb91ded438cf2ec3d70b5e0f Reviewed-on: https://code.wireshark.org/review/23560 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-09-11wsutil: Initialize and store plugin personal dirJoão Valverde2-13/+4
Obviate allocation on every call to get_plugins_pers_dir(). Change-Id: I089ae499f93739d490d4552f59b5db5996f7d26f Reviewed-on: https://code.wireshark.org/review/23495 Petri-Dish: João Valverde <j@v6e.pt> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: João Valverde <j@v6e.pt>
2017-09-02Have a single IPv6 tapJoão Valverde1-1/+1
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-08-27Lua: fix crash on invalid Dissector.list("food") invocationPeter Wu3-3/+3
The Dissector.list, Listener.list and Field.list functions do not accept a parameter. Passing one however results in a crash because the first element is not the expected table, but the first function parameter. Change-Id: I8483d0aa20716045472f30f5b41a449bed549b05 Reviewed-on: https://code.wireshark.org/review/23209 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-08-08Check for errors running the Lua scripts.Guy Harris1-5/+5
Also, fix error messages reported for lua_load() to speak of precompilation, not execution (the script isn't *executed* until lua_pcall() is called). Change-Id: I7ac9ee6e5df7612f9af141e51958fbfad38a4083 Reviewed-on: https://code.wireshark.org/review/23023 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-08-05Lua: Check for PseudoHeader.noneStig Bjørlykke1-1/+3
Don't dereference pointer when using PseudoHeader.none. Bug: 13944 Change-Id: I4e509269ac4983531912f3f9b2cc6b7cf00fbeae Reviewed-on: https://code.wireshark.org/review/22945 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-08-05Lua: Fix error message in Dumper:dump()Stig Bjørlykke1-1/+1
Change-Id: I9cdf8ecaf5129a30091b9b4d109f70cfdd7fca1b Reviewed-on: https://code.wireshark.org/review/22946 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-07-17ERF_TYPE_META write and comment supportAnthony Coddington1-2/+4
Support per-packet comments in ERF_TYPE_META through a new Anchor ID extension header with per-Host unique 48-bit Anchor ID which links an ERF_TYPE_META record with a packet record. There may be more than one Anchor ID associated with a packet, where they are grouped by Host ID extension header in the extension header list. Like other ERF_TYPE_META existing comments should not be overwritten and instead a new record generated. See erf_write_anchor_meta_update_phdr() for detailed comments on the extension header stack required. As Wireshark only supports one comment currently, use the one one with the latest metadata generation time (gen_time). Do this for capture comment too. Write various wtap metadata in periodic per-second ERF_TYPE_META records if non-WTAP_ENCAP_ERF or we have an updated capture comment. Refactor erf_dump to create fake ERF header first then follow common pseudoheadr and payload write code rather than two separate code paths. Support an ERF_HOST_ID environment variable to define Wireshark's Host ID when writing. Defaults to 0 for now. ERF dissector updates to support Anchor ID extension header with basic frame linking. Update ERF_TYPE_META naming and descriptions to official name (Provenance) Core changes: Add has_comment_changed to wtap_pkthdr, TRUE when a packet opt_comment has unsaved changes by the user. Add needs_reload to wtap_dumper which forces a full reload of the file on save, otherwise wireshark gets confused by additional packets being written. Change-Id: I0bb04411548c7bcd2d6ed82af689fbeed104546c Ping-Bug: 12303 Reviewed-on: https://code.wireshark.org/review/21873 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stephen Donnelly <stephen.donnelly@endace.com> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-21Lua: Add "tonumber" method to NSTimeSilvio Gissi2-3/+15
Absolute and Relative time fields could not be converted to seconds without converting to string and parsing to number. Fixed conversion in generated code that was subject to precision loss Usage: f=Field.new("frame.delta_time") delta=f().value:tonumber() Change-Id: I6ef91c6238a6c2ed9adf6cae03f8913f0a09332e Reviewed-on: https://code.wireshark.org/review/22316 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-21cmake: allow building from a UNC source directoryMartin Kaiser1-2/+0
Make two minor adjustments to allow building on Windows when the source directory is specified in UNC notation (\\server\volume\directory) instead of mapping such a directory to a drive letter. Cmake's add_custom_command() calls "cd <work_dir>" if a working directory is define as part of the rule. However, cd \\server\volume\directory is not allowed. Modify the two occassions where the working directory is derived from CMAKE_SOURCE_DIR. For copying some install files, we can get away with using the absolute path for each source file to be copied. The perl script that creates the tap listing for lua does not depend on a working directory at all. We can simply remove the WORKING_DIRECTORY parameter. Change-Id: Iac8e0addc44650692c1263fdca11f68315f50c63 Reviewed-on: https://code.wireshark.org/review/22236 Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-06-05Allow bigger snapshot lengths for D-Bus captures.Guy Harris1-1/+1
Use WTAP_MAX_PACKET_SIZE_STANDARD, set to 256KB, for everything except for D-Bus captures. Use WTAP_MAX_PACKET_SIZE_DBUS, set to 128MB, for them, because that's the largest possible D-Bus message size. See https://bugs.freedesktop.org/show_bug.cgi?id=100220 for an example of the problems caused by limiting the snapshot length to 256KB for D-Bus. Have a snapshot length of 0 in a capture_file structure mean "there is no snapshot length for the file"; we don't need the has_snap field in that case, a value of 0 mean "no, we don't have a snapshot length". In dumpcap, start out with a pipe buffer size of 2KB, and grow it as necessary. When checking for a too-big packet from a pipe, check against the appropriate maximum - 128MB for DLT_DBUS, 256KB for everything else. Change-Id: Ib2ce7a0cf37b971fbc0318024fd011e18add8b20 Reviewed-on: https://code.wireshark.org/review/21952 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>