diff options
author | Sean Karlage <skarlage@fb.com> | 2018-07-29 15:21:22 -0700 |
---|---|---|
committer | Sean Karlage <skarlage@fb.com> | 2018-07-29 15:21:22 -0700 |
commit | 07d7f10958223760dd9c5393f6040b64e5e672b8 (patch) | |
tree | 4ffba70a2c43269cc5b7189a0f745f9ae025793b /dhcpv6/client.go | |
parent | 23c03c8fa262c77c68741b079e0e1d2c91397823 (diff) |
DHCPv6: Fix message type constants
Renames DHCPv6 constants for message types to CamelCase
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 } |