diff options
author | insomniac <insomniacslk@users.noreply.github.com> | 2018-07-31 03:16:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-31 03:16:35 +0100 |
commit | c6894ea160d82b4a326ebab94faaebd090192a7b (patch) | |
tree | b5527e778427f508a5e6a9a447d12722316fe4ae /dhcpv6/client.go | |
parent | facfa9601a11655d6a7fc064f01d6f41d5a1f780 (diff) | |
parent | b57d4fdd4144e8935756273a4524ee3cd952bd00 (diff) |
DHCPv6: Fix message type constants (#105)
Diffstat (limited to 'dhcpv6/client.go')
-rw-r--r-- | dhcpv6/client.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/dhcpv6/client.go b/dhcpv6/client.go index 8431482..3492a47 100644 --- a/dhcpv6/client.go +++ b/dhcpv6/client.go @@ -81,16 +81,16 @@ func (c *Client) sendReceive(ifname string, packet DHCPv6, expectedType MessageT if packet == nil { return nil, fmt.Errorf("Packet to send cannot be nil") } - if expectedType == MSGTYPE_NONE { + if expectedType == MessageTypeNone { // infer the expected type from the packet being sent - if packet.Type() == SOLICIT { - expectedType = ADVERTISE - } else if packet.Type() == REQUEST { - expectedType = REPLY - } else if packet.Type() == RELAY_FORW { - expectedType = RELAY_REPL - } else if packet.Type() == LEASEQUERY { - expectedType = LEASEQUERY_REPLY + if packet.Type() == MessageTypeSolicit { + expectedType = MessageTypeAdvertise + } else if packet.Type() == MessageTypeRequest { + expectedType = MessageTypeReply + } else if packet.Type() == MessageTypeRelayForward { + expectedType = MessageTypeRelayReply + } else if packet.Type() == MessageTypeLeaseQuery { + expectedType = MessageTypeLeaseQueryReply } // and probably more } // if no LocalAddr is specified, get the interface's link-local address @@ -167,7 +167,7 @@ func (c *Client) sendReceive(ifname string, packet DHCPv6, expectedType MessageT continue } } - if expectedType == MSGTYPE_NONE { + if expectedType == MessageTypeNone { // just take whatever arrived break } else if adv.Type() == expectedType { @@ -190,7 +190,7 @@ func (c *Client) Solicit(ifname string, solicit DHCPv6, modifiers ...Modifier) ( for _, mod := range modifiers { solicit = mod(solicit) } - advertise, err := c.sendReceive(ifname, solicit, MSGTYPE_NONE) + advertise, err := c.sendReceive(ifname, solicit, MessageTypeNone) return solicit, advertise, err } @@ -207,6 +207,6 @@ func (c *Client) Request(ifname string, advertise, request DHCPv6, modifiers ... for _, mod := range modifiers { request = mod(request) } - reply, err := c.sendReceive(ifname, request, MSGTYPE_NONE) + reply, err := c.sendReceive(ifname, request, MessageTypeNone) return request, reply, err } |