Skip to content

Commit

Permalink
ndp: error message tidying
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Layher <mdlayher@gmail.com>
  • Loading branch information
mdlayher committed May 11, 2022
1 parent fa26dac commit 2e03295
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion message.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ func (rs *RouterSolicitation) unmarshal(b []byte) error {
// checkIPv6 verifies that ip is an IPv6 address.
func checkIPv6(ip netip.Addr) error {
if !ip.Is6() || ip.Is4In6() {
return fmt.Errorf("ndp: invalid IPv6 address: %q", ip.String())
return fmt.Errorf("ndp: invalid IPv6 address: %q", ip)
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions option.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (lla *LinkLayerAddress) marshal() ([]byte, error) {
}

if len(lla.Addr) != ethAddrLen {
return nil, fmt.Errorf("ndp: invalid link-layer address: %q", lla.Addr.String())
return nil, fmt.Errorf("ndp: invalid link-layer address: %q", lla.Addr)
}

raw := &RawOption{
Expand Down Expand Up @@ -286,7 +286,7 @@ func (ri *RouteInformation) marshal() ([]byte, error) {
//
// Therefore, any prefix, when masked with its specified length, should be
// identical to the prefix itself for it to be valid.
err := fmt.Errorf("ndp: invalid route information: %s/%d", ri.Prefix.String(), ri.PrefixLength)
err := fmt.Errorf("ndp: invalid route information: %s/%d", ri.Prefix, ri.PrefixLength)
p := netip.PrefixFrom(ri.Prefix, int(ri.PrefixLength))
if masked := p.Masked(); ri.Prefix != masked.Addr() {
return nil, err
Expand Down

0 comments on commit 2e03295

Please sign in to comment.