git-svn-id: http://svn.code.sf.net/p/netboot65/code@135 93682198-c243-4bdb-bd91-e943c89aac3b

This commit is contained in:
jonnosan 2009-05-14 03:12:40 +00:00
parent 6e6137c60d
commit eade2778dd

View File

@ -59,15 +59,21 @@ end
option_length=offsets[1] option_length=offsets[1]
if option_length==6 then if option_length==6 then
split_values=value.split(":") if value.downcase=="auto" then
if (split_values.length!=6) || (split_values[5].nil?) then require 'digest/md5'
puts "'#{value}' is not a valid MAC address. (e.g. 12:34:56:78:ab:cd)" digest = Digest::MD5.digest(Time.now.to_s)
exit mac=[0x00,0x80,0x10,digest[0],digest[1],Kernel.rand(255)]
end else
mac=[] split_values=value.split(":")
6.times do |j| if (split_values.length!=6) || (split_values[5].nil?) then
mac[j]=split_values[j].hex puts "'#{value}' is not a valid MAC address. (e.g. 12:34:56:78:ab:cd)"
# puts "#{split_values[j]}->#{"%02X" % mac[j]}" exit
end
mac=[]
6.times do |j|
mac[j]=split_values[j].hex
# puts "#{split_values[j]}->#{"%02X" % mac[j]}"
end
end end
packed_option=mac.pack("cccccc") packed_option=mac.pack("cccccc")
else #it must be an IP else #it must be an IP