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

Feature: support destination persistent connections attribute #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
21 changes: 11 additions & 10 deletions ipvs.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,17 @@ type SvcStats struct {
// Destination defines an IPVS destination (real server) in its
// entirety.
type Destination struct {
Address net.IP
Port uint16
Weight int
ConnectionFlags uint32
AddressFamily uint16
UpperThreshold uint32
LowerThreshold uint32
ActiveConnections int
InactiveConnections int
Stats DstStats
Address net.IP
Port uint16
Weight int
ConnectionFlags uint32
AddressFamily uint16
UpperThreshold uint32
LowerThreshold uint32
ActiveConnections int
InactiveConnections int
PersistentConnections int
Stats DstStats
}

// DstStats defines IPVS destination (real server) statistics
Expand Down
2 changes: 2 additions & 0 deletions netlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,8 @@ func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error)
d.ActiveConnections = int(native.Uint16(attr.Value))
case ipvsDestAttrInactiveConnections:
d.InactiveConnections = int(native.Uint16(attr.Value))
case ipvsDestAttrPersistentConnections:
d.PersistentConnections = int(native.Uint16(attr.Value))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the kernel implementation this should be uint32?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeap, the connection attributes ActiveConnections InactiveConnections PersistentConnections also should be uint32. Unified could be better.

case ipvsDestAttrStats:
stats, err := assembleStats(attr.Value)
if err != nil {
Expand Down