summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark J. Titorenko <nospam-github.com@titorenko.net>2011-12-06 01:48:42 -0800
committerMark J. Titorenko <nospam-github.com@titorenko.net>2011-12-06 01:48:42 -0800
commit955a3e7b093075680d8b448a24057137d9b29afe (patch)
treeb2e92f0fce02ac9c8c929bcc28b0cd5304d9b23d
parenta4e1f43b715d11cab4a3f35977caa2f79525aace (diff)
parent2f22e10410a120e0a0f26e9cddc385ea8ea3b2b3 (diff)
downloadnet-dhcp-ruby-955a3e7b093075680d8b448a24057137d9b29afe.tar.gz
Merge pull request #1 from rakshasa/fix_chaddr
Ensure chaddr is packed to the correct size (thanks @rakshasa)
-rw-r--r--lib/net/dhcp/core.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/net/dhcp/core.rb b/lib/net/dhcp/core.rb
index 5ed844c..bb42e52 100644
--- a/lib/net/dhcp/core.rb
+++ b/lib/net/dhcp/core.rb
@@ -157,8 +157,11 @@ module DHCP
self.giaddr
].pack('C4Nn2N4')
- out << self.chaddr.pack('C*')
-
+ if self.chaddr.size >= 16
+ out << self.chaddr.pack('C16')
+ else
+ out << (self.chaddr + [0x00]*(16-self.chaddr.size)).pack('C16')
+ end
# sname and file
out << ([0x00]*192).pack('C192')
@@ -319,4 +322,4 @@ module DHCP
}
-end \ No newline at end of file
+end