From ae8cfee61650aa8c9e4b3dff03c9d9af68d40720 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 2 Jul 2020 22:06:55 +0200 Subject: [PATCH] dhcp6: inspect server advertisment IAPD and report error, if any The fiber7 DHCPv6 servers (sometimes?) use this field for reporting errors. --- internal/dhcp6/dhcp6.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/dhcp6/dhcp6.go b/internal/dhcp6/dhcp6.go index 739e73a..3403661 100644 --- a/internal/dhcp6/dhcp6.go +++ b/internal/dhcp6/dhcp6.go @@ -266,6 +266,14 @@ func (c *Client) ObtainOrRenew() bool { } c.advertise = advertise + + if iapd := advertise.Options.OneIAPD(); iapd != nil { + if status := iapd.Options.Status(); status != nil && status.StatusCode != iana.StatusSuccess { + c.err = fmt.Errorf("IAPD error: %v (%v)", status.StatusCode, status.StatusMessage) + return false + } + } + _, reply, err := c.request(advertise) if err != nil { c.err = err