neigh.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package netlink
  2. import (
  3. "fmt"
  4. "net"
  5. )
  6. // Neigh represents a link layer neighbor from netlink.
  7. type Neigh struct {
  8. LinkIndex int
  9. Family int
  10. State int
  11. Type int
  12. Flags int
  13. FlagsExt int
  14. IP net.IP
  15. HardwareAddr net.HardwareAddr
  16. LLIPAddr net.IP //Used in the case of NHRP
  17. Vlan int
  18. VNI int
  19. MasterIndex int
  20. // These values are expressed as "clock ticks ago". To
  21. // convert these clock ticks to seconds divide by sysconf(_SC_CLK_TCK).
  22. // When _SC_CLK_TCK is 100, for example, the ndm_* times are expressed
  23. // in centiseconds.
  24. Confirmed uint32 // The last time ARP/ND succeeded OR higher layer confirmation was received
  25. Used uint32 // The last time ARP/ND took place for this neighbor
  26. Updated uint32 // The time when the current NUD state was entered
  27. }
  28. // String returns $ip/$hwaddr $label
  29. func (neigh *Neigh) String() string {
  30. return fmt.Sprintf("%s %s", neigh.IP, neigh.HardwareAddr)
  31. }
  32. // NeighUpdate is sent when a neighbor changes - type is RTM_NEWNEIGH or RTM_DELNEIGH.
  33. type NeighUpdate struct {
  34. Type uint16
  35. Neigh
  36. }