Skip to content

Commit

Permalink
Merge pull request #917 from TrekkieCoder/main
Browse files Browse the repository at this point in the history
chore: fix persist timeout args
  • Loading branch information
UltraInstinct14 authored Dec 30, 2024
2 parents aee876c + bc71e9f commit ddf7def
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/loxinet/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -1571,6 +1571,13 @@ func (R *RuleH) AddLbRule(serv cmn.LbServiceArg, servSecIPs []cmn.LbSecIPArg, al
return RuleEpCountErr, errors.New("endpoints-range error")
}

// Validate persist timeout
if serv.Sel == cmn.LbSelRrPersist {
if serv.PersistTimeout == 0 || serv.PersistTimeout > 24*60*60 {
serv.PersistTimeout = DefaultPersistTimeOut
}
}

// For ICMP service, non-zero port can't be specified
if serv.Proto == "icmp" && serv.ServPort != 0 {
return RuleUnknownServiceErr, errors.New("malformed-service error")
Expand Down Expand Up @@ -1847,14 +1854,7 @@ func (R *RuleH) AddLbRule(serv cmn.LbServiceArg, servSecIPs []cmn.LbSecIPArg, al
r.bgp = serv.Bgp
r.ci = cmn.CIDefault
r.privIP = privIP
r.pTO = 0
if serv.Sel == cmn.LbSelRrPersist {
if serv.PersistTimeout == 0 || serv.PersistTimeout > 24*60*60 {
r.pTO = DefaultPersistTimeOut
} else {
r.pTO = serv.PersistTimeout
}
}
r.pTO = serv.PersistTimeout
r.locIPs = make(map[string]struct{})

if !serv.Snat {
Expand Down

0 comments on commit ddf7def

Please sign in to comment.