diff --git a/Makefile b/Makefile index 1813bc5..fda0ea1 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,6 @@ LDFLAGS = -X github.com/free5gc/version.BUILD_TIME=$(BUILD_TIME) \ n3iwue: clean @echo "Start building $(@F)...." - go mod tidy CGO_ENABLED=0 go build -gcflags "$(GCFLAGS)" -ldflags "$(LDFLAGS)" -o $(ROOT_PATH)/$@ $(@F).go debug: GCFLAGS += -N -l diff --git a/config/n3ue.yaml b/config/n3ue.yaml index 2abe8ca..0fda7eb 100644 --- a/config/n3ue.yaml +++ b/config/n3ue.yaml @@ -35,7 +35,7 @@ configuration: SQN: 16f3b3f71005 AMF: 8000 OP: b672047e003bb952dca6cb8af0e5b779 - OPC: df0c67868fa25f748b7044c6e7c245b8 + OPC: df0c67868fa25f748b7044c6e7c245b8 # not support logger: N3UE: # the kind of log output debugLevel: trace # how detailed to output, value: trace, debug, info, warn, error, fatal, panic diff --git a/internal/gre/gre.go b/internal/gre/gre.go index 5dc07c9..dfe513f 100644 --- a/internal/gre/gre.go +++ b/internal/gre/gre.go @@ -21,7 +21,7 @@ func SetupGreTunnel(greIfaceName, parentIfaceName string, ueTunnelAddr, n3iwfTun ) if qoSInfo != nil { - greKeyField |= (uint32(qoSInfo.QfiList[0]) & 0x3F) << 24 + greKeyField |= (uint32(qoSInfo.MaxQFI()) & 0x3F) << 24 } if parent, err = netlink.LinkByName(parentIfaceName); err != nil { diff --git a/internal/qos/qos.go b/internal/qos/qos.go index 2242cc7..1924d1a 100644 --- a/internal/qos/qos.go +++ b/internal/qos/qos.go @@ -35,3 +35,11 @@ func Parse5GQoSInfoNotify(n *message.Notification) (info *PDUQoSInfo, err error) return } + +func (pduQosInfo PDUQoSInfo) MaxQFI() uint8 { + var maxQfi uint8 = 0 + for _, qfi := range pduQosInfo.QfiList { + maxQfi = max(maxQfi, qfi) + } + return maxQfi +} diff --git a/pkg/procedure/Procedure.go b/pkg/procedure/Procedure.go index d9ef801..4ca0b68 100644 --- a/pkg/procedure/Procedure.go +++ b/pkg/procedure/Procedure.go @@ -65,13 +65,20 @@ func StartProcedure() { } case context.PduSessionCreated: AppLog.Info("PduSession Created") - if err := TestConnectivity("8.8.8.8"); err != nil { - AppLog.Errorf("ping fail : %+v", err) + + pingDest := "1.1.1.1" + if err := TestConnectivity(pingDest); err != nil { + AppLog.Errorf("ping fail %s: %+v", pingDest, err) } else { - logger.NASLog.Infof("ULCount=%x, DLCount=%x", - n3ueSelf.RanUeContext.ULCount.Get(), - n3ueSelf.RanUeContext.DLCount.Get()) - AppLog.Info("Keep connection with N3IWF until receive SIGINT or SIGTERM") + pingDest = "8.8.8.8" + if err := TestConnectivity(pingDest); err != nil { + AppLog.Errorf("ping fail %s: %+v", pingDest, err) + } else { + logger.NASLog.Infof("ULCount=%x, DLCount=%x", + n3ueSelf.RanUeContext.ULCount.Get(), + n3ueSelf.RanUeContext.DLCount.Get()) + AppLog.Info("Keep connection with N3IWF until receive SIGINT or SIGTERM") + } } } }