From 336d4b9bd652b2bf0bc1bd0feae3f2f51009c13f Mon Sep 17 00:00:00 2001 From: Chris Koch Date: Sat, 18 Feb 2023 20:31:32 -0800 Subject: dhcpv6: convert every Parse function to FromBytes Signed-off-by: Chris Koch --- dhcpv6/option_dhcpv4_o_dhcpv6_server.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'dhcpv6/option_dhcpv4_o_dhcpv6_server.go') diff --git a/dhcpv6/option_dhcpv4_o_dhcpv6_server.go b/dhcpv6/option_dhcpv4_o_dhcpv6_server.go index f1f2d27..1bd60af 100644 --- a/dhcpv6/option_dhcpv4_o_dhcpv6_server.go +++ b/dhcpv6/option_dhcpv4_o_dhcpv6_server.go @@ -33,14 +33,12 @@ func (op *OptDHCP4oDHCP6Server) String() string { return fmt.Sprintf("%s: %v", op.Code(), op.DHCP4oDHCP6Servers) } -// ParseOptDHCP4oDHCP6Server builds an OptDHCP4oDHCP6Server structure -// from a sequence of bytes. The input data does not include option code and length -// bytes. -func ParseOptDHCP4oDHCP6Server(data []byte) (*OptDHCP4oDHCP6Server, error) { - var opt OptDHCP4oDHCP6Server +// FromBytes builds an OptDHCP4oDHCP6Server structure from a sequence of bytes. +// The input data does not include option code and length bytes. +func (op *OptDHCP4oDHCP6Server) FromBytes(data []byte) error { buf := uio.NewBigEndianBuffer(data) for buf.Has(net.IPv6len) { - opt.DHCP4oDHCP6Servers = append(opt.DHCP4oDHCP6Servers, buf.CopyN(net.IPv6len)) + op.DHCP4oDHCP6Servers = append(op.DHCP4oDHCP6Servers, buf.CopyN(net.IPv6len)) } - return &opt, buf.FinError() + return buf.FinError() } -- cgit v1.2.3