Skip to content

Commit

Permalink
use functions from the dhcp library
Browse files Browse the repository at this point in the history
Summary: use IsNetboot function from the dhcp library

Reviewed By: insomniacslk

Differential Revision: D8355501

fbshipit-source-id: cf96455a18c083bc1f7a4124a59913a9ab06dbf3
  • Loading branch information
Pablo Mazzini authored and facebook-github-bot committed Jun 12, 2018
1 parent 35e1dbd commit 1449b05
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions lib/handler.go
Expand Up @@ -279,11 +279,11 @@ func (s *serverImpl) handleRawPacketV6(buffer []byte, peer *net.UDPAddr) {
}

if s.server {
err = s.logger.LogSuccess(start, nil, packet.ToBytes(), peer)
if err != nil {
glog.Errorf("Failed to log incoming packet: %s", err)
}
reply, err := s.config.Handler.ServeDHCPv6(packet)
logErr := s.logger.LogSuccess(start, nil, packet.ToBytes(), peer)
if logErr != nil {
glog.Errorf("Failed to log incoming packet: %s", logErr)
}
if err != nil {
glog.Errorf("Error creating reply %s", err)
s.logger.LogErr(start, nil, packet.ToBytes(), peer, ErrServe, err)
Expand Down Expand Up @@ -347,16 +347,7 @@ func (s *serverImpl) handleRawPacketV6(buffer []byte, peer *net.UDPAddr) {
}
}
message.Mac = mac

optoro := msg.GetOneOption(dhcpv6.OPTION_ORO)
if optoro != nil {
for _, o := range optoro.(*dhcpv6.OptRequestedOption).RequestedOptions() {
if o == dhcpv6.OPT_BOOTFILE_URL {
message.NetBoot = true
break
}
}
}
message.NetBoot = dhcpv6.IsNetboot(msg)

server, err := selectDestinationServer(s.config, &message)
if err != nil {
Expand Down

0 comments on commit 1449b05

Please sign in to comment.