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

chore: fix persist timeout args #917

Merged
merged 1 commit into from
Dec 30, 2024
Merged
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
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
Loading