diff options
author | Christopher Koch <chrisko@google.com> | 2018-12-28 17:35:48 -0800 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2019-01-09 23:54:01 +0000 |
commit | 108ed92e1c9901936541020bc3214533acce77bb (patch) | |
tree | f1b8806daa9a4a3d3f105dda78be9afeeb756012 /dhcpv4/bsdp/bsdp.go | |
parent | 4d2cfd40eee7dd315385d320534b6c99094449e9 (diff) |
dhcpv4: export packet members; remove setters and getters.
Diffstat (limited to 'dhcpv4/bsdp/bsdp.go')
-rw-r--r-- | dhcpv4/bsdp/bsdp.go | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/dhcpv4/bsdp/bsdp.go b/dhcpv4/bsdp/bsdp.go index 8d4430a..3f97602 100644 --- a/dhcpv4/bsdp/bsdp.go +++ b/dhcpv4/bsdp/bsdp.go @@ -143,12 +143,10 @@ func InformSelectForAck(ack dhcpv4.DHCPv4, replyPort uint16, selectedImage BootI if needsReplyPort(replyPort) && replyPort >= 1024 { return nil, errors.New("replyPort must be a privileged port") } - d.SetOpcode(dhcpv4.OpcodeBootRequest) - d.SetHwType(ack.HwType()) - d.SetHwAddrLen(ack.HwAddrLen()) - clientHwAddr := ack.ClientHwAddr() - d.SetClientHwAddr(clientHwAddr[:]) - d.SetTransactionID(ack.TransactionID()) + d.OpCode = dhcpv4.OpcodeBootRequest + d.HWType = ack.HWType + d.ClientHWAddr = ack.ClientHWAddr + d.TransactionID = ack.TransactionID if ack.IsBroadcast() { d.SetBroadcast() } else { @@ -209,11 +207,10 @@ func NewReplyForInformList(inform *dhcpv4.DHCPv4, config ReplyConfig) (*dhcpv4.D if err != nil { return nil, err } - reply.SetClientIPAddr(inform.ClientIPAddr()) - reply.SetYourIPAddr(net.IPv4zero) - reply.SetGatewayIPAddr(inform.GatewayIPAddr()) - reply.SetServerIPAddr(config.ServerIP) - reply.SetServerHostName([]byte(config.ServerHostname)) + reply.ClientIPAddr = inform.ClientIPAddr + reply.GatewayIPAddr = inform.GatewayIPAddr + reply.ServerIPAddr = config.ServerIP + reply.ServerHostName = config.ServerHostname reply.AddOption(&dhcpv4.OptMessageType{MessageType: dhcpv4.MessageTypeAck}) reply.AddOption(&dhcpv4.OptServerIdentifier{ServerID: config.ServerIP}) @@ -249,12 +246,11 @@ func NewReplyForInformSelect(inform *dhcpv4.DHCPv4, config ReplyConfig) (*dhcpv4 return nil, err } - reply.SetClientIPAddr(inform.ClientIPAddr()) - reply.SetYourIPAddr(net.IPv4zero) - reply.SetGatewayIPAddr(inform.GatewayIPAddr()) - reply.SetServerIPAddr(config.ServerIP) - reply.SetServerHostName([]byte(config.ServerHostname)) - reply.SetBootFileName([]byte(config.BootFileName)) + reply.ClientIPAddr = inform.ClientIPAddr + reply.GatewayIPAddr = inform.GatewayIPAddr + reply.ServerIPAddr = config.ServerIP + reply.ServerHostName = config.ServerHostname + reply.BootFileName = config.BootFileName reply.AddOption(&dhcpv4.OptMessageType{MessageType: dhcpv4.MessageTypeAck}) reply.AddOption(&dhcpv4.OptServerIdentifier{ServerID: config.ServerIP}) |