Skip to content

Commit

Permalink
Remove redundant library.
Browse files Browse the repository at this point in the history
A simple util function can be used to retrive sourceIP.

Signed-off-by: Muhammad Asim Jamshed <muhammad.jamshed@intel.com>
  • Loading branch information
ajamshed committed Jul 28, 2020
1 parent 9f58704 commit c058d7e
Show file tree
Hide file tree
Showing 167 changed files with 21 additions and 10,665 deletions.
1 change: 0 additions & 1 deletion pfcpiface/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
github.com/golang/protobuf v1.4.2
github.com/prometheus/client_golang v1.7.1
github.com/wmnsk/go-pfcp v0.0.2-0.20200705143537-99a4faec89ff
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980
google.golang.org/grpc v1.30.0
google.golang.org/protobuf v1.25.0
)
2 changes: 1 addition & 1 deletion pfcpiface/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func main() {
}
defer conn.Close()

var simInfo *SimModeInfo = nil
var simInfo *SimModeInfo
if conf.Mode == modeSim {
simInfo = &conf.SimInfo
}
Expand Down
3 changes: 3 additions & 0 deletions pfcpiface/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ func parseFAR(ie1 *ie.IE, fseid uint64, n3IP net.IP, fwdType string) *far {
ies2, err = ie1.ForwardingParameters()
} else if fwdType == "update" {
ies2, err = ie1.UpdateForwardingParameters()
} else {
log.Println("Invalid fwdType specified!")
return nil
}
if err != nil {
log.Println("Unable to find ForwardingParameters!")
Expand Down
13 changes: 4 additions & 9 deletions pfcpiface/pfcpiface.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ package main
import (
"log"
"net"
"strings"
"time"

"github.com/wmnsk/go-pfcp/ie"
"github.com/wmnsk/go-pfcp/message"
"golang.org/x/net/ipv4"
)

// PktBufSz : buffer size for incoming pkt
Expand Down Expand Up @@ -90,14 +90,9 @@ func pfcpifaceMainLoop(upf *upf, n3ip string, sourceIP string) {

// if sourceIP is not set, fetch it from the msg header
if sourceIP == "0.0.0.0" {
header, err := ipv4.ParseHeader(buf[:n])
if err == nil {
log.Println("N4 Src IP gets resolved to:", header.Dst.String())
sourceIP = header.Dst.String()
} else {
log.Println("Failed to parse message header. Skipping...")
continue
}
addrString := strings.Split(addr.String(), ":")
sourceIP = getOutboundIP(addrString[0]).String()
log.Println("Source IP address is now: ", sourceIP)
}

//log.Println("Message: ", msg)
Expand Down
17 changes: 13 additions & 4 deletions pfcpiface/upf.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ func (u *upf) simdeleteEntries(pdrDown, pdrUp pdr, farDown, farUp far, timeout t
u.delCounter(ctx, done, pdrDown.ctrID, "postDLQoSCounter")
u.delCounter(ctx, done, pdrDown.ctrID, "postULQoSCounter")

u.GRPCJoin(calls, timeout, done)
rc := u.GRPCJoin(calls, timeout, done)
if !rc {
log.Println("Unable to complete GRPC call(s)")
}
}

func (u *upf) sendMsgToUPF(method string, pdrs []pdr, fars []far) {
Expand Down Expand Up @@ -244,7 +247,10 @@ func (u *upf) sendMsgToUPF(method string, pdrs []pdr, fars []far) {
u.delFAR(ctx, done, far)
}
}
u.GRPCJoin(calls, Timeout, done)
rc := u.GRPCJoin(calls, Timeout, done)
if !rc {
log.Println("Unable to make GRPC calls")
}
err = u.resumeAll()
if err != nil {
log.Fatalln("Unable to resume BESS:", err)
Expand All @@ -268,7 +274,10 @@ func sendDeleteAllSessionsMsgtoUPF(upf *upf) {
upf.removeAllCounters(ctx, done, "postDLQoSCounter")
upf.removeAllCounters(ctx, done, "postULQoSCounter")

upf.GRPCJoin(calls, Timeout, done)
rc := upf.GRPCJoin(calls, Timeout, done)
if !rc {
log.Println("Unable to make GRPC calls")
}
err = upf.resumeAll()
if err != nil {
log.Fatalln("Unable to resume BESS:", err)
Expand Down Expand Up @@ -623,7 +632,7 @@ func (u *upf) GRPCJoin(calls int, timeout time.Duration, done chan bool) bool {
}
case <-boom:
log.Println("Timed out adding entries")
return true
return false
}
}
}
41 changes: 0 additions & 41 deletions pfcpiface/vendor/golang.org/x/net/bpf/asm.go

This file was deleted.

222 changes: 0 additions & 222 deletions pfcpiface/vendor/golang.org/x/net/bpf/constants.go

This file was deleted.

Loading

0 comments on commit c058d7e

Please sign in to comment.