summaryrefslogtreecommitdiff
path: root/print-udp.c
Commit message (Collapse)AuthorAgeFilesLines
* Put "}" at beginning of line with "else" to keep a consistent styleFrancois-Xavier Le Bail2023-04-211-2/+1
| | | | [skip ci]
* Geneve: Fix the Geneve UDP port testFrancois-Xavier Le Bail2023-02-171-1/+1
| | | | GENEVE_PORT (6081) is a destination port.
* Fix spaces before tabs in indentationFrancois-Xavier Le Bail2023-02-151-8/+8
|
* Update the ND_LCHECK*() macros to ND_ICHECK*() macrosFrancois-Xavier Le Bail2021-12-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | ICHECK like Invalid-Check. Reminder: If the checked expression is true an error message is printed and a 'goto invalid' is executed. This change adds the parameter 'operator'. Before this change, '<' comparison was hard coded. We can do now: ND_ICHECK_U(length, <, HEADER_LEN); ND_ICHECK_U(length, ==, 24); ND_ICHECK_U(length, !=, 8); ND_ICHECK_ZU(length, <, sizeof(struct my_struct)); ND_ICHECKMSG_U("message length", msg_tlen, <, 4); ... (Any comparison operator) Remark: The change of names from ND_LCHECK*() to ND_ICHECK*() is because something else than a length(L) can be checked. Moreover: Place the 'message' parameter at the beginning of ND_ICHECKMSG_U() and ND_ICHECKMSG_ZU() paramaters lists.
* Initial support to parse QUIC packets.Rui Paulo2021-11-091-0/+6
|
* BFD: add SBFD support (RFC7880 and RFC7881)Bill Fenner2021-02-141-0/+3
| | | | | | | | Add support for SBFD on UDP port 7784. SBFD is different in that packets from the reflector will be sent with *source* port 7784; in all other BFD mechanisms, it is only the destination port that matters. For SBFD print-udp.c has to check both source and destination port.
* Try the new ND_LCHECK*() macros. [skip ci]Denis Ovsienko2021-01-171-8/+2
|
* UDP: Modernize packet parsing style.Denis Ovsienko2021-01-131-38/+20
| | | | | | Remove all ND_TCHECK_*() instances as redundant. Remove or convert a few improvised snapshot end guards. Reduce arity of rtcp_print(). Test the AppleTalk LAP type after testing the UDP port numbers, not before.
* UDP: Clean up address and port printing.Denis Ovsienko2021-01-131-68/+36
| | | | | | | | udp_print() always knows whether UDP port numbers are available or not, so split udpipaddr_print() into two functions to lose some arity, much branching and all type casting. In the new functions test for IPv4 explicitly. In udp_print() convert duplicate code into a conditional call to udpipaddr_print().
* UDP: Use GET_IPADDR_STRING()/GET_IP6ADDR_STRING() callsFrancois-Xavier Le Bail2020-09-231-8/+8
| | | | | | Replace the calls to ipaddr_string()/ip6addr_string() with calls to GET_IPADDR_STRING()/GET_IP6ADDR_STRING() macros performing bounds checking.
* Remove 96 assorted ND_TCHECK calls.Denis Ovsienko2020-09-081-5/+0
| | | | | | | Remove a number of instances that do not match common patterns and have the only substantial effect on the code flow that a truncated packet triggers "goto trunc" instead of longjmp(). (In a few cases this change can increase the number of fields printed before giving up.)
* Remove many (762) now redundant ND_TCHECK_n() callsFrancois-Xavier Le Bail2020-09-061-15/+0
| | | | | | | | | | | ND_TCHECK_n(e), n in { 1, 2, 3, 4, 8 }. They are redundant because they are followed by a GET_.*_n(e) call, same n, same e, which do the bounds check. Remove unused 'trunc' labels and most associated codes. Update the outputs of some tests accordingly.
* UDP: Harmonize some function callsFrancois-Xavier Le Bail2020-07-311-3/+3
| | | | | | | | Some calls use '(const u_char *)(up+1)'. Other calls use 'cp' (same value). Update the calls to only use 'cp'. (follow-up to ea0f25cc7765554e521bf7ea44d94f77500749f5)
* Define FMAXINT only once and use it properly.Denis Ovsienko2020-07-281-1/+1
| | | | [skip ci]
* DNS: Do the 'over TCP' processing in the printerFrancois-Xavier Le Bail2020-06-101-3/+6
| | | | | | | | Add the parameter 'over_tcp'. Move the shift by 2 bytes from the TCP printer to the DNS printer. Move adding a prepended space from the TCP printer to the DNS printer. Add a length check. Add some comments about 'over_tcp' and 'is_mdns' call values.
* UDP: Harmonize some function callsFrancois-Xavier Le Bail2020-06-091-58/+58
| | | | | | | | | | Some calls use '(const u_char *)(up + 1)' or '(const void *)(up + 1)'. Other calls use 'cp' (same value). Update the calls to only use 'cp'. Moreover: Update some other casted 'up + 1' uses to 'cp'. Update some pointers to packet bytes from 'void *' to 'u_char *'.
* Merge branch 'master' into fix_udp_frag_badlenGuy Harris2020-05-241-216/+258
|\
| * udp: clean up indentation.Guy Harris2020-05-241-27/+27
| | | | | | | | | | | | Consistently use tabs. [skip ci]
| * add support for Broadcom LI headerHannes Gredler2020-04-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (pull request #843) fix build break for Broadcom LI printer on BSD platforms incorporate review comments: make bcm_li_print() void, add a sample capture incorporate review comments: remove trailing tabs add BCM LI outputs to testset incorporate review comment: return after printing update verbose output for bcm-li
| * Add "domain" as an option for -TFrancois-Xavier Le Bail2020-03-021-0/+4
| | | | | | | | | | | | This allows tcpdump to handle DNS running on non-standard ports. Add two test files with DNS over TCP and DNS over UDP, port 8053.
| * Autosar SOME/IP protocol supportFrancesco Fondelli2020-02-191-1/+7
| |
| * Print MPLS-over-UDP.simonov-d2020-02-091-0/+2
| |
| * The ptp (precision time protocol) with UDP as the transport protocol.Partha Ghosh2019-11-221-1/+8
| | | | | | | | | | | | | | | | | | - the print routines for ptp different ptp messages - test completed for sync message, announce message, delay request message, delay response message and follow up message. - integration of the ptp v2 code with the tcpdump code. Signed-off-by: Partha S. Ghosh <psglinux@gmail.com>
| * Handle the IPv6 Jumbo Payload option.Guy Harris2019-05-021-1/+9
| | | | | | | | | | | | | | | | | | If we see one when processing the hop-by-hop extension header, use it to set the payload length. In UDP, if we have a zero length field in the UDP header, and the length of the data handed to us is > 65535, treat that as a Jumbo Payload packet.
| * Remove the IPv6 payload length checks for checksumming.Guy Harris2019-05-011-1/+1
| | | | | | | | | | | | If there isn't an IPv6 payload, there isn't any TCP or UDP packet, and there's no TCP or UDP header to checksum, so there's no need for the check (it's not there for IPv4).
| * UDP: Fix fetching the header payload lengthFrancois-Xavier Le Bail2019-04-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | ... and a Clang warning. The warning was: ./print-udp.c:574:104: warning: address of array 'ip6->ip6_ctlun.ip6_un1.ip6_un1_plen' will always evaluate to 'true' [-Wpointer-bool-conversion] ...& 0xf0) >> 4) == 6 && ip6->ip6_ctlun.ip6_un1.ip6_un1_plen) { ~~ ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
| * Add BFD multihop and lag decodingBill Fenner2019-04-261-0/+2
| | | | | | | | | | | | | | Put back the bfd_port_values, and use it to distinguish between destination ports for RFC5883 multihop and RFC7310 lag sessions. (The destination port is the only difference between these messages.)
| * Squelch more warnings.Guy Harris2019-04-171-2/+2
| |
| * Clean up types to squelch narrowing warnings.Guy Harris2019-04-171-6/+6
| |
| * Put IPv4/IPv6 protocol demultiplexing into a common routine.Guy Harris2019-03-271-2/+2
| | | | | | | | | | | | | | That means less duplication of functionality - and less chance that XXX-over-IPv4 will be handled but XXX-over-IPv6 won't be handled, or *vice versa*. (CARP and VRRP were being handled over IPv4 but not over IPv6; this fixes that.)
| * Use the new GET_ macros instead of the EXTRACT_ onesFrancois-Xavier Le Bail2019-03-261-37/+37
| | | | | | | | | | | | | | The exceptions are currently: Some EXTRACT_ in print-juniper.c, not used on packet buffer pointer. An EXTRACT_BE_U_3 in addrtoname.c, not always used on packet buffer pointer.
| * Merge branch 'master' of https://github.com/kivinen/tcpdump into kivinen-masterMichael Richardson2019-03-241-0/+2
| |\
| | * Updated 802.15.4 codeTero Kivinen2018-11-181-185/+194
| | |\
| | * | IEEE 802.15.4 printer which understands frame version 2 frames, and also ↵Tero Kivinen2017-03-261-0/+2
| | | | | | | | | | | | | | | | knows how to print some mac commands and IE contents. Also includes the zep printer to decode ZigBee Encapsulation Protocol frames
| * | | Have all Internet-checksum computing routines return a uint16_t.Guy Harris2018-12-111-2/+2
| | |/ | |/| | | | | | | | | | Those checksums are 16-bit; change the return types of those routines appropriately.
| * | Pointers to packet bytes should be u_char *, not void *Francois-Xavier Le Bail2018-07-101-4/+4
| | |
| * | UDP: Add two bounds checksFrancois-Xavier Le Bail2018-06-041-0/+2
| | |
| * | UDP: Add a bounds checkFrancois-Xavier Le Bail2018-06-021-0/+1
| | |
| * | UDP: Add two missing returnFrancois-Xavier Le Bail2018-05-251-0/+2
| | |
| * | Print truncations with nd_print_trunc() instead of tstr[] stringsFrancois-Xavier Le Bail2018-05-041-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | Remove the tstr[] strings. Update the output of some tests accordingly. Moreover: Add or update some ndo_protocol fields.
| * | Remove useless commentsFrancois-Xavier Le Bail2018-03-191-8/+0
| | |
| * | Add the ndo_protocol field in the netdissect_options structureFrancois-Xavier Le Bail2018-03-161-0/+1
| | | | | | | | | | | | | | | Update this field in printer entry functions. It will be used for some printings.
| * | UDP: Fix the uses of the pointer to the end of current packetFrancois-Xavier Le Bail2018-03-011-3/+1
| | | | | | | | | | | | Must be based on packet header caplen.
| * | Have ip{6}addr_string take a u_char * as the second argument.Guy Harris2018-01-311-8/+8
| | | | | | | | | | | | Fix warnings that introduces.
| * | Always include <config.h> rather than "config.h".Guy Harris2018-01-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This can prevent bizarre failures if, for example, you've done a configuration in the top-level source directory, leaving behind one config.h file, and then do an out-of-tree build in another directory, with different configuration options. This way, we always pick up the same config.h, in the build directory.
| * | Use quoted include netdissect-stdinc.h instead of angle-bracketed oneFrancois-Xavier Le Bail2018-01-211-1/+1
| | |
| * | Use more ND_TCHECK_n()/ND_TTEST_n() macrosFrancois-Xavier Le Bail2018-01-121-6/+6
| | |
| * | Remove unneeded '&' when getting a pointer to an nd_uintN_t typeFrancois-Xavier Le Bail2018-01-111-4/+6
| | |
| * | Clean up signed vs. unsigned, add more length checks.Guy Harris2018-01-111-27/+40
| | |
| * | Update ND_PRINT() as a variadic macroFrancois-Xavier Le Bail2018-01-071-63/+63
| | |