-
Notifications
You must be signed in to change notification settings - Fork 124
Description
When attempting to provision devices using TFTP, the operation fails if it involves sending empty TFTP options.
2024-04-04 13:57:24,068,provisioning,Thread-1,ERROR - Fatal exception thrown from session 192.168.1.10:34679: Invalid options in buffer
This behavior is observed when utilizing the tftpy server as the TFTP server implementation. According to TFTP protocol extensions (RFC 2347 and others), options are conveyed using name-value pairs, and while the RFCs do not explicitly address the handling of empty option values, practical usage and interoperability considerations suggest that servers should gracefully handle such cases.
The tftpy server's current implementation appears to reject TFTP requests that include options with empty values, leading to provisioning failures for devices that rely on such options for configuration or operational purposes.
Steps to reproduce:
>>> import tftpy
>>> client = tftpy.TftpClient('192.168.1,10', 69, options={'blksize': 8, 'grandstream_option':''})
>>> client.download('cfggxw4232v2.xml', 'grandstream.xml')
The actual request from the phone:
b'\x00\x01customise/gxv3450cust\x00octet\x00blksize\x001024\x00tsize\x000\x00grandstream_MODEL\x00GXV3450 V1.3A\x00grandstream_ID\x00c074ada3f960\x00grandstream_REV_BOOT\x001.0.1.2\x00grandstream_REV_CORE\x001.0.1.4\x00grandstream_REV_RECOVERY\x00\x00grandstream_REV_SYSTEM\x001.0.1.12\x00'