Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provisioning Devices Over TFTP Fails Due to tftpy Server Rejecting Empty TFTP Options #141

Open
alexandrina opened this issue Apr 4, 2024 · 1 comment

Comments

@alexandrina
Copy link

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'

9001 added a commit to 9001/partftpy that referenced this issue Jun 14, 2024
@msoulier
Copy link
Owner

i don't see the point of sending an empty options packet, but handling it gracefully would certainly be better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants