summaryrefslogtreecommitdiff
path: root/print-bootp.c
Commit message (Collapse)AuthorAgeFilesLines
* bootp/dhcp6: DHCPv4/v6 ZTP and SZTP option supportEamon Doyle2023-04-101-0/+37
| | | | | | | | DHCPv4: RFC8572 specifies the SZTP redirect tag. DHCPv6: RFC5970 specifies the boot file URL, used for ZTP, and RFC8572 specifies the SZTP redirect tag The base DHCPv6 RFC3315 specifies the user class option.
* Fix spaces before tabs in indentationFrancois-Xavier Le Bail2023-02-151-4/+4
|
* Replace the (void)nd_printn(..., NULL) calls by nd_printjn() callsFrancois-Xavier Le Bail2021-01-081-5/+5
| | | | | Moreover: Remove a now useless comment.
* BOOTP: Modernize packet parsing style.Denis Ovsienko2021-01-081-55/+23
| | | | | | Enable ND_LONGJMP_FROM_TCHECK. Report invalid packets as invalid. Have nd_printn() and nd_printztn() guard the snapshot end. Replace client_fqdn_flags() with bittok2str_nosep().
* Spell most remaining MAC_ADDR_LEN instances. [skip ci]Denis Ovsienko2020-10-041-3/+3
|
* Update for messages and TLVs defined in RFC4388Bill Fenner2020-09-231-13/+23
|
* Remove some now redundant ND_TCHECK_4() callsFrancois-Xavier Le Bail2020-09-081-4/+0
| | | | | | | | | | | ND_TCHECK_4(e). They are redundant because they are followed by a GET_IPADDR_STRING(e) call, same e, which do the bounds check. Remove unused 'trunc' labels and associated codes. Update the output of a test accordingly.
* Remove 96 assorted ND_TCHECK calls.Denis Ovsienko2020-09-081-2/+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-8/+2
| | | | | | | | | | | 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.
* DHCP: Make option printing format more consistent.Denis Ovsienko2020-08-071-5/+5
| | | | | | | | | | | | | | | rfc1048_print() used to print DHCP options in a few different formats depending on the context (see GH issue #866): * at the top of an RFC 1048 block: * known options: [string] name and [decimal] tag * unknown options: tag twice * inside a Parameter Request (55) block: * known options: name * unknown options: tag Change it to use the "Name (tag)" format (as in TCP, BGP, etc) in all contexts. Update output for 8 tests.
* DHCP: Remove a few options that are unassigned now.Denis Ovsienko2020-08-071-39/+1
| | | | | | | | | | | | | | | | | Commit e89bfcd in December 2000 among other things had introduced the following code points from the IANA "BOOTP Vendor Extensions and DHCP Options" registry: * TAG_AGENT_MASK (84) * TAG_6OVER4 (96) * TAG_IPX_COMPAT (110) * TAG_FAILOVER (115) * TAG_EXTENDED_REQUEST (126) * TAG_EXTENDED_OPTION (127) The current revision of the registry lists every code above as "Removed/Unassigned" with a reference to RFC 3679 published in January 2004. Remove the code points and any associated code.
* DHCP: Harmonize error messages printingFrancois-Xavier Le Bail2020-05-141-8/+8
|
* DHCP: Fix the option 81 flags field printingFrancois-Xavier Le Bail2020-05-141-1/+5
| | | | | | | | | | | | | | | | | | | | | | The first nibble of the option 81 flags field must be zero. The current flags are in the second nibble. From RFC 4702: 2.1. The Flags Field The format of the 1-octet Flags field is: 0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ | MBZ |N|E|O|S| +-+-+-+-+-+-+-+-+ [...] The remaining bits in the Flags field are reserved for future assignment. DHCP clients and servers that send the Client FQDN option MUST clear the MBZ bits, and they MUST ignore these bits.
* More bounds checking when fetching addresses and converting to strings.Guy Harris2020-01-191-11/+11
| | | | | | | | | | | | | | Replace more calls to ipaddr_string()/ip6addr_string() with calls to GET_IPADDR_STRING()/GET_IP6ADDR_STRING() macros performing bounds checking. Add similar bounds-checking inline functions and macros to wrap linkaddr_string(), etheraddr_string(), and isonsap_string() and convert calls to them to use the macros as well. Shuffle the inline functions in addrtoname.h around a bit, so that the inline functions, external declarations, and macros are all in the same order.
* Use more HTTPS in URLsFrancois-Xavier Le Bail2019-08-191-1/+1
| | | | [skip ci]
* Remove some unneeded '&' when getting a pointer to a nd_ typeFrancois-Xavier Le Bail2019-04-211-1/+1
| | | | | Moreover: Remove some unneeded casts.
* Use the new GET_ macros instead of the EXTRACT_ onesFrancois-Xavier Le Bail2019-03-261-46/+52
| | | | | | | 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.
* Fix some spelling in comments.Denis Ovsienko2018-08-011-2/+2
| | | | [skip ci]
* Fix test for truncated sname and file.Guy Harris2018-06-211-2/+2
| | | | | | | nd_printztn() returns 0 if the string is truncated; check for it returning zero, not for returning a non-zero value. This fix was supplied in GitHub issue #685.
* Add a nd_print_trunc() callFrancois-Xavier Le Bail2018-05-181-5/+2
| | | | | Moreover: Replace a ND_TTEST_*() with ND_TCHECK_*().
* Print truncations with nd_print_trunc() instead of tstr[] stringsFrancois-Xavier Le Bail2018-05-041-5/+4
| | | | | | | | Remove the tstr[] strings. Update the output of some tests accordingly. Moreover: Add or update some ndo_protocol fields.
* Rename the fn_printX() functions to nd_printX()Francois-Xavier Le Bail2018-04-301-9/+9
| | | | | | | The functions are: nd_print, nd_printztn, nd_printn and nd_printzp. Trying to make it clearer that they currently have to be used only on part of the packet buffer. Update some comments.
* 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.
* Get rid of ND_UNALIGNED.Guy Harris2018-02-141-2/+2
| | | | | | | Structures that describe packet formats now all use nd_ types, none of which require more than 1-byte alignment, so compilers shouldn't assume that anything in those structures is aligned on any particular boundary, even without a "this is unaligned" hint.
* BOOTP: Use more ND_TCHECK_n() macrosFrancois-Xavier Le Bail2018-02-121-3/+3
|
* Style updateFrancois-Xavier Le Bail2018-02-061-2/+2
| | | | Use parens around the sizeof argument, to match the style used elsewhere.
* Use nd_ipv4 rather than struct in_addr.Guy Harris2018-01-301-23/+23
| | | | | | This ensures that we have no purportedly-aligned-but-not-necessarily- unaligned values that we access; we have to use EXTRACT_ macros/functions to get at IPv4 address values.
* BOOTP: Use more ND_TCHECK_n() macrosFrancois-Xavier Le Bail2018-01-221-5/+5
|
* Don't test for __attribute__ in the configure script.Guy Harris2018-01-211-2/+2
| | | | | | | | | Instead, use compiler test macros to check whether *particular* attributes are supported, and set various #defines appropriately, in header files. Rename the UNALIGNED structure attribute to ND_UNALIGNED, and ask whether we still need it.
* 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
|
* Clean up signed vs. unsigned.Guy Harris2018-01-111-45/+36
|
* BOOTP: Use more ND_TCHECK_n() macrosFrancois-Xavier Le Bail2018-01-071-5/+5
|
* Update ND_PRINT() as a variadic macroFrancois-Xavier Le Bail2018-01-071-107/+107
|
* BOOTP: Fix parentheses errorsFrancois-Xavier Le Bail2018-01-061-2/+2
| | | | | These errors were not previously detected because of the use of the single argument, double parentheses ND_PRINT() macro.
* BOOTP: Move macro define/undef outsite functionsFrancois-Xavier Le Bail2018-01-041-5/+6
| | | | | | | | This avoid some Coccinelle warnings: CPP-DEFINE: inside function, I treat it as comment CPP-UNDEF: inside function, I treat it as comment This also makes the code a bit clearer.
* Use nd_ types, add EXTRACT_, fix a bounds check.Guy Harris2017-12-291-40/+45
|
* Remove all storage class specifier 'register'Francois-Xavier Le Bail2017-12-131-9/+9
| | | | | | Let the compiler do the optimizations (or not) based on build options. Avoid 'value has been optimized out' messages in gdb using '-O0'.
* Replace ND_TTEST2()/ND_TCHECK2() macros by macros using pointers (1/n)Francois-Xavier Le Bail2017-12-111-3/+3
| | | | | ND_TTEST2(var, l) -> ND_TTEST_LEN(p, l) ND_TCHECK2(var, l) -> ND_TCHECK_LEN(p, l)
* Rename EXTRACT_ macrosFrancois-Xavier Le Bail2017-11-221-38/+38
| | | | | | | | | | | | | | | | Now all the macros have a name meaning a count in bytes. With _S_: signed, _U_: unsigned e.g.: EXTRACT_BE_32BITS -> EXTRACT_BE_U_4 EXTRACT_LE_32BITS -> EXTRACT_LE_U_4 ... EXTRACT_BE_INT32 -> EXTRACT_BE_S_4 and have: EXTRACT_8BITS -> EXTRACT_U_1 EXTRACT_INT8 -> EXTRACT_S_1
* Rename ND_TCHECK_/ND_TTEST_ macrosFrancois-Xavier Le Bail2017-11-221-7/+7
| | | | | | | | Now all the macros have a name meaning a count in bytes. e.g.: ND_TCHECK_32BITS -> ND_TCHECK_4 ND_TTEST_32BITS -> ND_TTEST_4
* More EXTRACT_8BITS() changes. Use ND_CHECK_nBITS() more as well.Guy Harris2017-11-191-28/+44
|
* Use more the EXTRACT_8BITS() macro to fetch a one-byte value (4/n)Francois-Xavier Le Bail2017-11-191-1/+1
| | | | In client_fqdn_flags() call.
* Rename EXTRACT_nBITS() macros to EXTRACT_BE_nBITS()Francois-Xavier Le Bail2017-11-181-16/+16
| | | | | It indicates clearly that these macros are used to extract big-endian integral values.
* CVE-2017-13028/BOOTP: Add a bounds check before fetching dataFrancois-Xavier Le Bail2017-09-131-0/+1
| | | | | | | | This fixes a buffer over-read discovered by Bhargava Shastry, SecT/TU Berlin. Add a test using the capture file supplied by the reporter(s), modified so the capture file won't cause 'tcpdump: pcap_loop: truncated dump file'
* spell ASCII in uppercaseDenis Ovsienko2017-08-101-3/+3
|
* CVE-2017-5203/BOOTP: Add a bounds checkFrancois-Xavier Le Bail2017-01-181-0/+1
| | | | This fix GitHub issue #557
* CVE-2016-7983,7984/Don't use strchr() to scan packet data.Guy Harris2017-01-181-2/+4
| | | | | | | | | | | It can't be told to stop at the end of the packet data. Add a fn_printztn() that prints null-terminated strings, with a length check, and which returns the number of bytes processed, or 0 if we ran out of data. That means it does the scanning we need, but safely. Use it in the TFTP and BOOTP printers. Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
* Updated print-bootp.c with corrected options for TZ and added option for MUDURL.Eliot Lear2016-12-081-4/+7
| | | | Updated print-dhcpv6.c to process TZ options as well as MUDURL.
* Add a summary comment in all other printersFrancois-Xavier Le Bail2016-08-151-2/+0
| | | | | | | Moreover: Remove some redundant comments Update some summary comments Update the specification URL for ATA over Ethernet (AoE) protocol