Skip to content

Commit

Permalink
fix: period server query multi URRs issue, rollback query report one …
Browse files Browse the repository at this point in the history
…by one for URRs
  • Loading branch information
Roy-Hu authored and tim-ywliu committed Mar 25, 2023
1 parent 385b405 commit 0742cb1
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion internal/forwarder/gtp5g.go
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,20 @@ func (g *Gtp5g) QueryURR(lSeid uint64, urrid uint32) ([]report.USAReport, error)
}

func (g *Gtp5g) psQueryURR(lSeidUrridsMap map[uint64][]uint32) (map[uint64][]report.USAReport, error) {
return g.queryMultiURR(lSeidUrridsMap, true)
seidUsars := make(map[uint64][]report.USAReport)

for lSeid, urrids := range lSeidUrridsMap {
for _, urrid := range urrids {
usars, err := g.queryURR(lSeid, urrid, true)
if err != nil {
return nil, err
}
if len(usars) > 0 {
seidUsars[lSeid] = append(seidUsars[lSeid], usars...)
}
}
}
return seidUsars, nil
}

func (g *Gtp5g) queryURR(lSeid uint64, urrid uint32, ps bool) ([]report.USAReport, error) {
Expand Down Expand Up @@ -1478,6 +1491,13 @@ func (g *Gtp5g) queryURR(lSeid uint64, urrid uint32, ps bool) ([]report.USARepor
return usars, err
}

// Note: the max size of netlink msg is 16k,
// the number of reports from gtp5g is limited
// depending on the size of report
func (g *Gtp5g) QueryMultiURR(lSeidUrridsMap map[uint64][]uint32) (map[uint64][]report.USAReport, error) {
return g.queryMultiURR(lSeidUrridsMap, false)
}

func (g *Gtp5g) queryMultiURR(lSeidUrridsMap map[uint64][]uint32, ps bool) (map[uint64][]report.USAReport, error) {
var oids []gtp5gnl.OID
for seid, urrIds := range lSeidUrridsMap {
Expand Down

0 comments on commit 0742cb1

Please sign in to comment.