Skip to content

DHCP: Boot reply contains an unknown byte #8

Description

@simar7

While testing DHCP boot replies with ServeDHCP(), the responses received contain an unknown byte in the header. See below:

Relevant Test:


func TestServeDHCP(t *testing.T) {
	dhcpServer := newDHCPServer()
	p := dhcp.NewPacket(dhcp.BootReply)

	expected := dhcp.ReplyPacket(p, dhcp.Offer, dhcpServer.ip,
		dhcp.IPAdd(dhcpServer.start, dhcpServer.freeLease()),
		dhcpServer.leaseDuration, dhcpServer.options.SelectOrderOrAll(nil))
	actual := dhcpServer.ServeDHCP(p, dhcp.Discover, nil)

	//TODO: Need a strong assertion
	assert.ObjectsAreEqual(actual, expected)
}

Output:

			Diff:
			--- Expected
			+++ Actual
			@@ -2,3 +2,3 @@
			  00000000  02 01 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
			- 00000010  ac 0a 00 27 00 00 00 00  00 00 00 00 00 00 00 00  |...'............|
			+ 00000010  ac 0a 00 31 00 00 00 00  00 00 00 00 00 00 00 00  |...1............|
			  00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions