Skip to content

Commit

Permalink
Fix sdf filter if src port & dst port not present (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
thakurajayL authored Mar 7, 2022
1 parent 7f96cfd commit 1fb4467
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions proto/server/clientEvtHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,15 @@ func fillSlice(client *clientNF, sliceName string, sliceConf *configmodels.Slice
endp = "any"
}
if ruleConfig.Protocol == int32(protos.PccFlowTos_TCP.Number()) {
if ruleConfig.StartPort != 0 && ruleConfig.EndPort != 0 {
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()) {
if ruleConfig.StartPort != 0 && ruleConfig.EndPort != 0 {
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"
Expand Down Expand Up @@ -1127,15 +1127,15 @@ func postConfigPcrf(client *clientNF) {
// permit out udp from 8.8.8.8/32 to assigned sport-dport
var desc string
if app.Protocol == 6 {
if app.StartPort != 0 && app.EndPort != 0 {
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 {
if app.StartPort != 0 && app.EndPort != 0 {
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 "
Expand Down

0 comments on commit 1fb4467

Please sign in to comment.