Revision 4a5b83c0
Added by Ohad Levy about 13 years ago
- ID 4a5b83c0a84a7ebdac1caf59e922db7c6533bed4
lib/proxy/dhcp/server/native_ms.rb | ||
---|---|---|
end
|
||
|
||
def addRecord options={}
|
||
ip = validate_ip options[:ip]
|
||
mac = validate_mac options[:mac]
|
||
name = options[:hostname] || raise(Proxy::DHCP::Error, "Must provide hostname")
|
||
raise Proxy::DHCP::Error, "Already exists" if find_record(ip)
|
||
raise Proxy::DHCP::Error, "Unknown subnet for #{ip}" unless subnet = find_subnet(IPAddr.new(ip))
|
||
super(options)
|
||
|
||
msg = "Added DHCP reservation for #{name} => #{ip} - #{mac}"
|
||
cmd = "scope #{subnet.network} add reservedip #{ip} #{mac.gsub(/:/,"")} #{name}"
|
||
... | ... | |
execute(cmd, msg, true)
|
||
|
||
record = Proxy::DHCP::Reservation.new subnet, ip, mac, options
|
||
true
|
||
end
|
||
|
||
def loadSubnetData subnet
|
Also available in: Unified diff
Fixes #781 - DHCP create attempted when mac already used
includes fixes for both ISC and MS implementations.
Signed-off-by: Paul kelly <paul.ian.kelly@googlemail.com>