summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/option_string_test.go
diff options
context:
space:
mode:
authorLoic Prylli <lprylli@netflix.com>2019-04-19 17:01:53 -0700
committerinsomniac <insomniacslk@users.noreply.github.com>2019-05-14 12:03:36 +0100
commitfcbde74dab23754aa33fbcd409327c0a1409f2a7 (patch)
tree8d4bfd185aa370da5f75f6788a11523d6cd86ed7 /dhcpv4/option_string_test.go
parent4ddd05e566105742df7c109ebf3af307b344441c (diff)
Improve compatibility with some ipv4 networks.
- dnsmasq has been seen to null-terminate the bootfile option, similar treament can occur for tftp-servername (although tftp-servername option usage is less common). - for the gateway information to be present in final packet, the Router option should be queried again in request as in discover (which matches behavior of udhcpc/dhclient). Tested: pxeboot with u-root on dnsmask/ipv4 client. Signed-off-by: Loic Prylli <lprylli@netflix.com>
Diffstat (limited to 'dhcpv4/option_string_test.go')
-rw-r--r--dhcpv4/option_string_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/dhcpv4/option_string_test.go b/dhcpv4/option_string_test.go
index 768d0fe..9778134 100644
--- a/dhcpv4/option_string_test.go
+++ b/dhcpv4/option_string_test.go
@@ -64,6 +64,9 @@ func TestParseOptBootFileName(t *testing.T) {
m, _ = New()
require.Equal(t, "", m.BootFileNameOption())
+
+ m, _ = New(WithGeneric(OptionBootfileName, []byte{'t', 'e', 's', 't', 0}))
+ require.Equal(t, "test", m.BootFileNameOption())
}
func TestOptTFTPServerName(t *testing.T) {
@@ -79,6 +82,9 @@ func TestParseOptTFTPServerName(t *testing.T) {
m, _ = New()
require.Equal(t, "", m.TFTPServerName())
+
+ m, _ = New(WithGeneric(OptionTFTPServerName, []byte{'t', 'e', 's', 't', 0}))
+ require.Equal(t, "test", m.TFTPServerName())
}
func TestOptClassIdentifier(t *testing.T) {