mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-09 17:43:40 +00:00
wgengine/magicsock: packet/bytes metrics should not count disco
Updates #13420 Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
225d8f5a88
commit
caba123008
@ -1267,7 +1267,7 @@ func (c *Conn) sendUDPBatch(addr netip.AddrPort, buffs [][]byte) (sent bool, err
|
|||||||
|
|
||||||
// sendUDP sends UDP packet b to ipp.
|
// sendUDP sends UDP packet b to ipp.
|
||||||
// See sendAddr's docs on the return value meanings.
|
// See sendAddr's docs on the return value meanings.
|
||||||
func (c *Conn) sendUDP(ipp netip.AddrPort, b []byte) (sent bool, err error) {
|
func (c *Conn) sendUDP(ipp netip.AddrPort, b []byte, isDisco bool) (sent bool, err error) {
|
||||||
if runtime.GOOS == "js" {
|
if runtime.GOOS == "js" {
|
||||||
return false, errNoUDP
|
return false, errNoUDP
|
||||||
}
|
}
|
||||||
@ -1276,7 +1276,7 @@ func (c *Conn) sendUDP(ipp netip.AddrPort, b []byte) (sent bool, err error) {
|
|||||||
metricSendUDPError.Add(1)
|
metricSendUDPError.Add(1)
|
||||||
_ = c.maybeRebindOnError(runtime.GOOS, err)
|
_ = c.maybeRebindOnError(runtime.GOOS, err)
|
||||||
} else {
|
} else {
|
||||||
if sent {
|
if sent && !isDisco {
|
||||||
switch {
|
switch {
|
||||||
case ipp.Addr().Is4():
|
case ipp.Addr().Is4():
|
||||||
c.metrics.outboundPacketsIPv4Total.Add(1)
|
c.metrics.outboundPacketsIPv4Total.Add(1)
|
||||||
@ -1371,7 +1371,7 @@ func (c *Conn) sendUDPStd(addr netip.AddrPort, b []byte) (sent bool, err error)
|
|||||||
// returns (false, nil); it's not an error, but nothing was sent.
|
// returns (false, nil); it's not an error, but nothing was sent.
|
||||||
func (c *Conn) sendAddr(addr netip.AddrPort, pubKey key.NodePublic, b []byte, isDisco bool) (sent bool, err error) {
|
func (c *Conn) sendAddr(addr netip.AddrPort, pubKey key.NodePublic, b []byte, isDisco bool) (sent bool, err error) {
|
||||||
if addr.Addr() != tailcfg.DerpMagicIPAddr {
|
if addr.Addr() != tailcfg.DerpMagicIPAddr {
|
||||||
return c.sendUDP(addr, b)
|
return c.sendUDP(addr, b, isDisco)
|
||||||
}
|
}
|
||||||
|
|
||||||
regionID := int(addr.Port())
|
regionID := int(addr.Port())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user