Commit 47257bd9 authored by wangyongshou's avatar wangyongshou

resolve compile error

parents 84cee680 1de0f59c
...@@ -137,6 +137,12 @@ func handleHeartBeatMsg(msgContent message.Message) []byte { ...@@ -137,6 +137,12 @@ func handleHeartBeatMsg(msgContent message.Message) []byte {
func handleSessionEstablishmentMsg(config *conf.Config, msgContent message.Message) []byte { func handleSessionEstablishmentMsg(config *conf.Config, msgContent message.Message) []byte {
msg, ok := msgContent.(*message.SessionEstablishmentRequest) msg, ok := msgContent.(*message.SessionEstablishmentRequest)
defer func() {
err := recover()
if err != nil {
log.Error("Panicing %s\n", err)
}
}()
if !ok { if !ok {
log.Warn("got unexpected message: " + msg.MessageTypeName()) log.Warn("got unexpected message: " + msg.MessageTypeName())
...@@ -160,9 +166,9 @@ func handleSessionEstablishmentMsg(config *conf.Config, msgContent message.Messa ...@@ -160,9 +166,9 @@ func handleSessionEstablishmentMsg(config *conf.Config, msgContent message.Messa
sourceInterface, _ := pdiIEs[0].SourceInterface() sourceInterface, _ := pdiIEs[0].SourceInterface()
//fteid, _ := pdiIEs[1].FTEID() //fteid, _ := pdiIEs[1].FTEID()
ueipaddress, _ := pdiIEs[2].UEIPAddress() ueipaddress, _ := pdiIEs[2].UEIPAddress()
farid, _ := createPDR[3].FARID()
createFAR, _ := msg.CreateFAR[0].CreateFAR() createFAR, _ := msg.CreateFAR[0].CreateFAR()
farid, _ := createFAR[0].FARID()
applyAction, _ := createFAR[1].ApplyAction() applyAction, _ := createFAR[1].ApplyAction()
forwardingParameters, _ := createFAR[2].ForwardingParameters() forwardingParameters, _ := createFAR[2].ForwardingParameters()
destinationInterface, _ := forwardingParameters[0].DestinationInterface() destinationInterface, _ := forwardingParameters[0].DestinationInterface()
...@@ -193,6 +199,7 @@ func handleSessionEstablishmentMsg(config *conf.Config, msgContent message.Messa ...@@ -193,6 +199,7 @@ func handleSessionEstablishmentMsg(config *conf.Config, msgContent message.Messa
Flags: 1, Flags: 1,
Teid: ueUpTeid[ueipaddress.IPv4Address.String()], Teid: ueUpTeid[ueipaddress.IPv4Address.String()],
IP: upf.BuptNodeValueIP4(ip4ToUint(config.Gnb)), IP: upf.BuptNodeValueIP4(ip4ToUint(config.Gnb)),
//IP: upf.BuptNodeValueIP4([4]uint8{192, 168, 2, 137}),
}, },
UeAddr: upf.BuptPfcpUeIPAddress{ UeAddr: upf.BuptPfcpUeIPAddress{
Flags: 2, Flags: 2,
...@@ -244,6 +251,12 @@ func handleSessionEstablishmentMsg(config *conf.Config, msgContent message.Messa ...@@ -244,6 +251,12 @@ func handleSessionEstablishmentMsg(config *conf.Config, msgContent message.Messa
func handleSessionModificationMsg(config *conf.Config, msgContent message.Message) []byte { func handleSessionModificationMsg(config *conf.Config, msgContent message.Message) []byte {
msg, ok := msgContent.(*message.SessionModificationRequest) msg, ok := msgContent.(*message.SessionModificationRequest)
defer func() {
err := recover()
if err != nil {
log.Error("Panicing %s\n", err)
}
}()
if !ok { if !ok {
log.Warn("got unexpected message: " + msg.MessageTypeName()) log.Warn("got unexpected message: " + msg.MessageTypeName())
...@@ -258,7 +271,6 @@ func handleSessionModificationMsg(config *conf.Config, msgContent message.Messag ...@@ -258,7 +271,6 @@ func handleSessionModificationMsg(config *conf.Config, msgContent message.Messag
pdrid, _ := createPDR[0].PacketDetectionRuleID() pdrid, _ := createPDR[0].PacketDetectionRuleID()
pdiIEs, _ := createPDR[2].PDI() pdiIEs, _ := createPDR[2].PDI()
ueipaddress, _ := pdiIEs[1].UEIPAddress() ueipaddress, _ := pdiIEs[1].UEIPAddress()
modReqIP = ueipaddress.IPv4Address.String() modReqIP = ueipaddress.IPv4Address.String()
// set ueip into seid // set ueip into seid
...@@ -274,7 +286,6 @@ func handleSessionModificationMsg(config *conf.Config, msgContent message.Messag ...@@ -274,7 +286,6 @@ func handleSessionModificationMsg(config *conf.Config, msgContent message.Messag
log.Info("SEID:%d", msg.SEID()) log.Info("SEID:%d", msg.SEID())
log.Info("TEID 0x%x", outerHeaderCreation.TEID) log.Info("TEID 0x%x", outerHeaderCreation.TEID)
log.Info("UE IP: %s", ueSeid[msg.SEID()]) log.Info("UE IP: %s", ueSeid[msg.SEID()])
log.Info("PDR ID: %d", pdrid)
log.Info("FAR ID:%d", farid) log.Info("FAR ID:%d", farid)
log.Info("UE IPv4:%s", ueIP) log.Info("UE IPv4:%s", ueIP)
log.Info("GNB GTPU IP:%s", gnbIP) log.Info("GNB GTPU IP:%s", gnbIP)
...@@ -287,7 +298,7 @@ func handleSessionModificationMsg(config *conf.Config, msgContent message.Messag ...@@ -287,7 +298,7 @@ func handleSessionModificationMsg(config *conf.Config, msgContent message.Messag
Teid: outerHeaderCreation.TEID, Teid: outerHeaderCreation.TEID,
PdrID: uint32(pdrid), PdrID: uint32(pdrid),
Ueip: IPToUInt32(net.ParseIP(modReqIP)), Ueip: IPToUInt32(net.ParseIP(modReqIP)),
FarID: uint16(1), FarID: uint16(farid),
GnbIP: IPToUInt32(net.ParseIP(gnbIP)), GnbIP: IPToUInt32(net.ParseIP(gnbIP)),
Port: uint16(2152), Port: uint16(2152),
} }
...@@ -317,6 +328,7 @@ func handleSessionModificationMsg(config *conf.Config, msgContent message.Messag ...@@ -317,6 +328,7 @@ func handleSessionModificationMsg(config *conf.Config, msgContent message.Messag
log.Info("pdrid: %d", farid) log.Info("pdrid: %d", farid)
log.Info("ueip %s:index %d", ueip, updateUeIndex[ueip]) log.Info("ueip %s:index %d", ueip, updateUeIndex[ueip])
log.Info("TEID 0x%x", outerHeaderCreation.TEID) log.Info("TEID 0x%x", outerHeaderCreation.TEID)
log.Info("GNB GTPu: %s", outerHeaderCreation.IPv4Address.String())
req := &upf.UpfSsmReq{ req := &upf.UpfSsmReq{
CpSeid: msg.SEID(), CpSeid: msg.SEID(),
...@@ -332,7 +344,7 @@ func handleSessionModificationMsg(config *conf.Config, msgContent message.Messag ...@@ -332,7 +344,7 @@ func handleSessionModificationMsg(config *conf.Config, msgContent message.Messag
FTeid: upf.BuptPfcpFTeid{ FTeid: upf.BuptPfcpFTeid{
Flags: 1, Flags: 1,
Teid: outerHeaderCreation.TEID, Teid: outerHeaderCreation.TEID,
IP: upf.BuptNodeValueIP4(ip4ToUint(config.Gnb)), IP: upf.BuptNodeValueIP4(ip4ToUint(outerHeaderCreation.IPv4Address.String())),
}, },
UeAddr: upf.BuptPfcpUeIPAddress{ UeAddr: upf.BuptPfcpUeIPAddress{
Flags: 2, Flags: 2,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment