-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6163da3
commit 2d0bf37
Showing
12 changed files
with
643 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
control: | ||
uri: "http://192.0.2.2:8080" | ||
bind-addr: "192.0.2.2:8080" | ||
ran: | ||
bind-addr: "198.51.100.2:1234" | ||
cp: | ||
uri: "http://192.0.2.3:8080" | ||
gtp: "198.51.100.10" | ||
|
||
logger: | ||
level: "debug" | ||
level: "trace" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2024 Louis Royer and the NextMN contributors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style license that can be | ||
// found in the LICENSE file. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package app | ||
|
||
import ( | ||
"context" | ||
"net" | ||
"net/netip" | ||
|
||
"github.com/sirupsen/logrus" | ||
"github.com/wmnsk/go-gtp/gtpv1" | ||
"github.com/wmnsk/go-gtp/gtpv1/message" | ||
) | ||
|
||
const GTPU_PORT = 2152 | ||
|
||
func (s *Setup) StartGtpUProtocolEntity(ctx context.Context, ipAddress netip.Addr) error { | ||
logrus.WithFields(logrus.Fields{"listen-addr": ipAddress}).Info("Creating new GTP-U Protocol Entity") | ||
laddr := net.UDPAddrFromAddrPort(netip.AddrPortFrom(ipAddress, GTPU_PORT)) | ||
uConn := gtpv1.NewUPlaneConn(laddr) | ||
uConn.DisableErrorIndication() | ||
uConn.AddHandler(message.MsgTypeTPDU, func(c gtpv1.Conn, senderAddr net.Addr, msg message.Message) error { | ||
return tpduHandler(c, senderAddr, msg, s.psMan, s.rDaemon) | ||
}) | ||
go func(ctx context.Context) error { | ||
defer uConn.Close() | ||
if err := uConn.ListenAndServe(ctx); err != nil { | ||
logrus.WithError(err).Trace("GTP uConn closed") | ||
return err | ||
} | ||
logrus.Trace("GTP uConn closed") | ||
return nil | ||
}(ctx) | ||
|
||
return nil | ||
} | ||
|
||
// handle GTP PDU (Downlink) | ||
func tpduHandler(c gtpv1.Conn, senderAddr net.Addr, msg message.Message, psMan *PduSessionsManager, rDaemon *RadioDaemon) error { | ||
teid := msg.TEID() | ||
ue, err := psMan.GetUECtrl(teid) | ||
if err != nil { | ||
return err | ||
} | ||
packet := msg.(*message.TPDU).Decapsulate() | ||
return rDaemon.WriteDownlink(packet, ue) | ||
} |
Oops, something went wrong.