From a01e13532d73ac4a845e919f912f8b37eb41f979 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Fri, 20 Dec 2024 09:12:37 +0100 Subject: [PATCH] net/tstun: add back outgoing drop metric Using new labels returned from the filter Updates #14280 Signed-off-by: Kristoffer Dalby --- net/tstun/wrap.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/net/tstun/wrap.go b/net/tstun/wrap.go index deb8bc094..694cba830 100644 --- a/net/tstun/wrap.go +++ b/net/tstun/wrap.go @@ -874,12 +874,13 @@ func (t *Wrapper) filterPacketOutboundToWireGuard(p *packet.Parsed, pc *peerConf return filter.Drop, gro } - if filt.RunOut(p, t.filterFlags) != filter.Accept { + if resp, reason := filt.RunOut(p, t.filterFlags); resp != filter.Accept { metricPacketOutDropFilter.Add(1) - // TODO(#14280): increment a t.metrics.outboundDroppedPacketsTotal here - // once we figure out & document what labels to use for multicast, - // link-local-unicast, IP fragments, etc. But they're not - // usermetric.ReasonACL. + if reason != "" { + t.metrics.outboundDroppedPacketsTotal.Add(usermetric.DropLabels{ + Reason: reason, + }, 1) + } return filter.Drop, gro }