Skip to content

Commit

Permalink
Update libs & fix segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
louisroyer committed Jan 13, 2025
1 parent d2eabb5 commit a55465a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/adrg/xdg v0.5.3
github.com/gin-gonic/gin v1.10.0
github.com/gofrs/uuid v4.4.0+incompatible
github.com/nextmn/go-pfcp-networking v0.0.41
github.com/nextmn/go-pfcp-networking v0.0.42
github.com/nextmn/json-api v0.0.15
github.com/nextmn/logrus-formatter v0.0.1
github.com/nextmn/rfc9433 v0.0.2
Expand All @@ -25,7 +25,7 @@ require (
github.com/gin-contrib/sse v1.0.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.23.0 // indirect
github.com/go-playground/validator/v10 v10.24.0 // indirect
github.com/goccy/go-json v0.10.4 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.23.0 h1:/PwmTwZhS0dPkav3cdK9kV1FsAmrL8sThn8IHr/sO+o=
github.com/go-playground/validator/v10 v10.23.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
github.com/go-playground/validator/v10 v10.24.0 h1:KHQckvo8G6hlWnrPX4NJJ+aBfWNAE/HH+qdL2cBpCmg=
github.com/go-playground/validator/v10 v10.24.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus=
github.com/goccy/go-json v0.10.4 h1:JSwxQzIqKfmFX1swYPpUThQZp/Ka4wzJdK0LWVytLPM=
github.com/goccy/go-json v0.10.4/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA=
Expand All @@ -49,8 +49,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/nextmn/go-pfcp-networking v0.0.41 h1:vA8TfjlxZMxZIZiJ3eEdllwYjmBurvZvD9J4xcCPheo=
github.com/nextmn/go-pfcp-networking v0.0.41/go.mod h1:KYoKLiltDmHL2YMU5mz2k/E1xMoz4TpmzTz6Nr5u5gA=
github.com/nextmn/go-pfcp-networking v0.0.42 h1:kYcGyIUMe/RVt3DpvDOKJt4+UbScIewDBMSQWLruusE=
github.com/nextmn/go-pfcp-networking v0.0.42/go.mod h1:KYoKLiltDmHL2YMU5mz2k/E1xMoz4TpmzTz6Nr5u5gA=
github.com/nextmn/json-api v0.0.15 h1:ZSFr06omGsXtTHT6SWCy7Sc9csNQgwpOibkkdUm0pEA=
github.com/nextmn/json-api v0.0.15/go.mod h1:CQXeNPj9MDGsEExtnqJFIGjLgZAKsmOoO2fy+mep7Ak=
github.com/nextmn/logrus-formatter v0.0.1 h1:Bsf78jjiEESc+rV8xE6IyKj4frDPGMwXFNrLQzm6A1E=
Expand Down
2 changes: 1 addition & 1 deletion internal/app/rules-pusher.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (pusher *RulesPusher) updateRoutersRules(ctx context.Context, msgType pfcpu
logrus.Debug("Into updateRoutersRules")
var wg0 sync.WaitGroup
for _, session := range e.GetPFCPSessions() {
logrus.Debug("In for loop…")
logrus.Trace("In for loop…")
wg0.Add(1)
go func() error {
defer wg0.Done()
Expand Down
5 changes: 1 addition & 4 deletions internal/app/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ import (
"context"
"time"

pfcp_networking "github.com/nextmn/go-pfcp-networking/pfcp"

"github.com/nextmn/srv6-ctrl/internal/config"
)

type Setup struct {
HTTPServer *HttpServerEntity
Upf *Upf
PFCPServer *pfcp_networking.PFCPEntityUP
RulesPusher *RulesPusher
}

Expand All @@ -31,7 +28,7 @@ func NewSetup(conf *config.CtrlConfig) Setup {
}

func (s Setup) Run(ctx context.Context) error {
if err := PFCPServerAddHooks(s.PFCPServer, s.RulesPusher); err != nil {
if err := s.Upf.PFCPServerAddHooks(s.RulesPusher); err != nil {
return err
}
if err := s.Upf.Start(ctx); err != nil {
Expand Down
14 changes: 7 additions & 7 deletions internal/app/upf.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ func NewUpf(conf *config.CtrlConfig) *Upf {
closed: make(chan struct{}),
}
}
func PFCPServerAddHooks(s *pfcp_networking.PFCPEntityUP, pusher *RulesPusher) error {
if err := s.AddHandler(message.MsgTypeSessionEstablishmentRequest, func(ctx context.Context, msg pfcp_networking.ReceivedMessage) (*pfcp_networking.OutcomingMessage, error) {
func (upf *Upf) PFCPServerAddHooks(pusher *RulesPusher) error {
if err := upf.pfcpentity.AddHandler(message.MsgTypeSessionEstablishmentRequest, func(ctx context.Context, msg pfcp_networking.ReceivedMessage) (*pfcp_networking.OutcomingMessage, error) {
out, err := pfcp_networking.DefaultSessionEstablishmentRequestHandler(ctx, msg)
if err == nil {
go s.LogPFCPRules()
pusher.updateRoutersRules(ctx, message.MsgTypeSessionEstablishmentRequest, msg, s)
go upf.pfcpentity.LogPFCPRules()
pusher.updateRoutersRules(ctx, message.MsgTypeSessionEstablishmentRequest, msg, upf.pfcpentity)
}
return out, err
}); err != nil {
return err
}
if err := s.AddHandler(message.MsgTypeSessionModificationRequest, func(ctx context.Context, msg pfcp_networking.ReceivedMessage) (*pfcp_networking.OutcomingMessage, error) {
if err := upf.pfcpentity.AddHandler(message.MsgTypeSessionModificationRequest, func(ctx context.Context, msg pfcp_networking.ReceivedMessage) (*pfcp_networking.OutcomingMessage, error) {
out, err := pfcp_networking.DefaultSessionModificationRequestHandler(ctx, msg)
if err == nil {
go s.LogPFCPRules()
pusher.updateRoutersRules(ctx, message.MsgTypeSessionModificationRequest, msg, s)
go upf.pfcpentity.LogPFCPRules()
pusher.updateRoutersRules(ctx, message.MsgTypeSessionModificationRequest, msg, upf.pfcpentity)
}
return out, err
}); err != nil {
Expand Down

0 comments on commit a55465a

Please sign in to comment.