From abd2ad847951e79ee246e51c1f097915bee1dfd9 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Thu, 8 Jun 2023 11:34:59 +0800 Subject: [PATCH] check measurePeriod before apply URR --- internal/forwarder/gtp5g.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/forwarder/gtp5g.go b/internal/forwarder/gtp5g.go index d7616f5..87ca87e 100644 --- a/internal/forwarder/gtp5g.go +++ b/internal/forwarder/gtp5g.go @@ -1132,6 +1132,9 @@ func (g *Gtp5g) CreateURR(lSeid uint64, req *ie.IE) error { if err != nil { return err } + if measurePeriod <= 0 { + return errors.New("invalid measurement period") + } // TODO: convert time.Duration -> ? attrs = append(attrs, nl.Attr{ Type: gtp5gnl.URR_MEASUREMENT_PERIOD, @@ -1168,6 +1171,9 @@ func (g *Gtp5g) CreateURR(lSeid uint64, req *ie.IE) error { } if rptTrig.PERIO() { + if measurePeriod <= 0 { + return errors.New("invalid measurement period") + } g.ps.AddPeriodReportTimer(lSeid, urrid, measurePeriod) }