Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sdf filter based on the sdf compliance cfg #73

Merged
merged 1 commit into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/factory/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type Configuration struct {
Mongodb *Mongodb `yaml:"mongodb"`
RocEnd *RocEndpt `yaml:"managedByConfigPod,omitempty"` // fetch config during bootup
LteEnd []*LteEndpt `yaml:"endpoints,omitempty"` //LTE endpoints are configured and not auto-detected
SdfComp bool `yaml:"spec-compliant-sdf"`
}

type WebServer struct {
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ require (
github.com/urfave/cli v1.22.5
go.mongodb.org/mongo-driver v1.4.4
google.golang.org/grpc v1.39.0
google.golang.org/protobuf v1.27.1
gopkg.in/yaml.v2 v2.4.0
)

Expand Down
32 changes: 28 additions & 4 deletions proto/server/clientEvtHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,21 @@ func fillSlice(client *clientNF, sliceName string, sliceConf *configmodels.Slice
endp = "any"
}
if ruleConfig.Protocol == int32(protos.PccFlowTos_TCP.Number()) {
desc = "permit out tcp from " + endp + " to assigned " + strconv.FormatInt(int64(ruleConfig.StartPort), 10) + "-" + strconv.FormatInt(int64(ruleConfig.EndPort), 10)
if ruleConfig.StartPort != 0 && ruleConfig.EndPort != 0 {
desc = "permit out tcp from " + endp + " to assigned"
} else if factory.WebUIConfig.Configuration.SdfComp {
desc = "permit out tcp from " + endp + " " + strconv.FormatInt(int64(ruleConfig.StartPort), 10) + "-" + strconv.FormatInt(int64(ruleConfig.EndPort), 10) + " to assigned"
} else {
desc = "permit out tcp from " + endp + " to assigned " + strconv.FormatInt(int64(ruleConfig.StartPort), 10) + "-" + strconv.FormatInt(int64(ruleConfig.EndPort), 10)
}
} else if ruleConfig.Protocol == int32(protos.PccFlowTos_UDP.Number()) {
desc = "permit out udp from " + endp + " to assigned " + strconv.FormatInt(int64(ruleConfig.StartPort), 10) + "-" + strconv.FormatInt(int64(ruleConfig.EndPort), 10)
if ruleConfig.StartPort != 0 && ruleConfig.EndPort != 0 {
desc = "permit out udp from " + endp + " to assigned"
} else if factory.WebUIConfig.Configuration.SdfComp {
desc = "permit out udp from " + endp + " " + strconv.FormatInt(int64(ruleConfig.StartPort), 10) + "-" + strconv.FormatInt(int64(ruleConfig.EndPort), 10) + " to assigned"
} else {
desc = "permit out udp from " + endp + " to assigned " + strconv.FormatInt(int64(ruleConfig.StartPort), 10) + "-" + strconv.FormatInt(int64(ruleConfig.EndPort), 10)
}
} else {
desc = "permit out ip from " + endp + " to assigned"
}
Expand Down Expand Up @@ -1115,9 +1127,21 @@ func postConfigPcrf(client *clientNF) {
// permit out udp from 8.8.8.8/32 to assigned sport-dport
var desc string
if app.Protocol == 6 {
desc = "permit out tcp from " + app.Endpoint + " to assigned " + strconv.FormatInt(int64(app.StartPort), 10) + "-" + strconv.FormatInt(int64(app.EndPort), 10)
if app.StartPort != 0 && app.EndPort != 0 {
desc = "permit out tcp from " + app.Endpoint + " to assigned"
} else if factory.WebUIConfig.Configuration.SdfComp {
desc = "permit out tcp from " + app.Endpoint + " " + strconv.FormatInt(int64(app.StartPort), 10) + "-" + strconv.FormatInt(int64(app.EndPort), 10) + " to assigned "
} else {
desc = "permit out tcp from " + app.Endpoint + " to assigned " + strconv.FormatInt(int64(app.StartPort), 10) + "-" + strconv.FormatInt(int64(app.EndPort), 10)
}
} else if app.Protocol == 17 {
desc = "permit out udp from " + app.Endpoint + " to assigned " + strconv.FormatInt(int64(app.StartPort), 10) + "-" + strconv.FormatInt(int64(app.EndPort), 10)
if app.StartPort != 0 && app.EndPort != 0 {
desc = "permit out udp from " + app.Endpoint + " to assigned"
} else if factory.WebUIConfig.Configuration.SdfComp {
desc = "permit out udp from " + app.Endpoint + " " + strconv.FormatInt(int64(app.StartPort), 10) + "-" + strconv.FormatInt(int64(app.EndPort), 10) + " to assigned "
} else {
desc = "permit out udp from " + app.Endpoint + " to assigned " + strconv.FormatInt(int64(app.StartPort), 10) + "-" + strconv.FormatInt(int64(app.EndPort), 10)
}
} else {
desc = "permit out ip from " + app.Endpoint + " to assigned"
}
Expand Down