Skip to content

Commit

Permalink
fix: check for existence of dhcp6 FQDN first
Browse files Browse the repository at this point in the history
Check that dhcpv6.Options.FQDN() is not nil before trying to use it.

This fixes DHCPv6 on GCP.

Signed-off-by: Seán C McCord <ulexus@gmail.com>
  • Loading branch information
Ulexus committed Sep 24, 2021
1 parent 519999b commit b1b6d61
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (d *DHCP6) parseReply(reply *dhcpv6.Message) {
d.resolvers = nil
}

if len(reply.Options.FQDN().DomainName.Labels) > 0 {
if reply.Options.FQDN() != nil && len(reply.Options.FQDN().DomainName.Labels) > 0 {
d.hostname = []network.HostnameSpecSpec{
{
Hostname: reply.Options.FQDN().DomainName.Labels[0],
Expand Down

0 comments on commit b1b6d61

Please sign in to comment.