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

Add handler for /size/<number> #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anfernee
Copy link

This handler will send an output of bytes (all xs) back to
the client. This can be used to test return path of fragmented packets.

Signed-off-by: Yongkun Gui ygui@google.com

This handler will send an output of <number> bytes (all `x`s) back to
the client. This can be used to test return path of fragmented packets.

Signed-off-by: Yongkun Gui <ygui@google.com>
Copy link
Member

@pchaigno pchaigno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay to review. Few people receive notifications for pull requests opened on these small repositories, so it's best to ping us via Slack.

It seems some additional filtering could be useful on input values:

2021/07/09 14:09:55 Listening on: ":69"
2021/07/09 14:10:12 Read "size/-1" requested from 127.0.0.1:42234
panic: strings: negative Repeat count

goroutine 8 [running]:
strings.Repeat(0x5e034a, 0x1, 0xffffffffffffffff, 0x0, 0x0)
	/usr/local/go/src/strings/strings.go:533 +0x5aa
main.echoHandler(0x61d960, 0xc00000e100)
	/go/src/app/main.go:64 +0x2b5
pack.ag/tftp.ReadHandlerFunc.ServeTFTP(0x5ebd98, 0x61d960, 0xc00000e100)
	/go/pkg/mod/pack.ag/tftp@v1.0.0/handlers.go:201 +0x3a
pack.ag/tftp.(*Server).dispatchReadRequest(0xc0000da000, 0xc00000e0a0, 0xc0000561e0)
	/go/pkg/mod/pack.ag/tftp@v1.0.0/server.go:220 +0x384
created by pack.ag/tftp.(*Server).connManager
	/go/pkg/mod/pack.ag/tftp@v1.0.0/server.go:147 +0x1ef

Also:

$ curl tftp://127.0.0.1:69/size/0
curl: (71) invalid tsize -:0:- value in OACK packet

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

Successfully merging this pull request may close these issues.

2 participants