code: func (ep *endpoint) finishWrite(payload tcpip.Payload, route *stack.Route) (uintptr, <-chan struct{}, *tcpip.Error) {
  	// We may need to resolve the route (match a link layer address to the
  	// network address). If that requires blocking (e.g. to use ARP),
  	// return a channel on which the caller can wait.
  	if route.IsResolutionRequired() {
  		waker := &sleep.Waker{}
  		if ch, err := route.Resolve(waker); err != nil {
  			if err == tcpip.ErrWouldBlock {
  				// Link address needs to be resolved.
  				// Resolution was triggered the background.
  				// Better luck next time.
  				route.RemoveWaker(waker)
  				return 0, ch, tcpip.ErrNoLinkAddress
  			}
  			return 0, nil, err
  		}
  	}
  
  	payloadBytes, err := payload.Get(payload.Size())
  	if err != nil {
  		return 0, nil, err
  	}
  
  	switch ep.netProto {
  	case header.IPv4ProtocolNumber:
  		hdr := buffer.NewPrependable(len(payloadBytes) + int(route.MaxHeaderLength()))
  		if err := route.WritePacket(nil /* gso */, hdr, buffer.View(payloadBytes).ToVectorisedView(), header.ICMPv4ProtocolNumber, route.DefaultTTL()); err != nil {
  			return 0, nil, err
  		}
  
  	default:
  		return 0, nil, tcpip.ErrUnknownProtocol
  	}
  
  	return uintptr(len(payloadBytes)), nil, nil
  }
docs: // finishWrite writes the payload to a route. It resolves the route if
  // necessary. It's really just a helper to make defer unnecessary in Write.