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

Add support for ARP/ND Timestamps when retriving neighbors #1039

Open
wants to merge 1 commit into
base: main
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
8 changes: 8 additions & 0 deletions neigh.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ type Neigh struct {
Vlan int
VNI int
MasterIndex int

// These values are expressed as "clock ticks ago". To
// convert these clock ticks to seconds divide by sysconf(_SC_CLK_TCK).
// When _SC_CLK_TCK is 100, for example, the ndm_* times are expressed
// in centiseconds.
Confirmed uint32 // The last time ARP/ND succeeded OR higher layer confirmation was received
Used uint32 // The last time ARP/ND took place for this neighbor
Updated uint32 // The time when the current NUD state was entered
}

// String returns $ip/$hwaddr $label
Expand Down
4 changes: 4 additions & 0 deletions neigh_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ func NeighDeserialize(m []byte) (*Neigh, error) {
neigh.VNI = int(native.Uint32(attr.Value[0:4]))
case NDA_MASTER:
neigh.MasterIndex = int(native.Uint32(attr.Value[0:4]))
case NDA_CACHEINFO:
neigh.Confirmed = native.Uint32(attr.Value[0:4])
neigh.Used = native.Uint32(attr.Value[4:8])
neigh.Updated = native.Uint32(attr.Value[8:12])
}
}

Expand Down
Loading