Skip to content

Commit

Permalink
fix neighbor flag handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Cellebyte committed Jan 18, 2024
1 parent e4c0fe4 commit ab6f52e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/monitoring/nl.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewNetlinkCollector() (Collector, error) {
desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "netlink", "neighbors"),
"The number of neighbors currently in the Linux Dataplane.",
[]string{"interface", "address_family", "status"},
[]string{"interface", "address_family", "flags", "status"},
nil,
),
valueType: prometheus.GaugeValue,
Expand Down Expand Up @@ -64,7 +64,7 @@ func (c *netlinkCollector) updateNeighbors(ch chan<- prometheus.Metric) {
c.logger.Error(err, "Cannot get neighbors from netlink")
}
for _, neighbor := range neighbors {
ch <- c.neighborsDesc.mustNewConstMetric(neighbor.Quantity, neighbor.Interface, neighbor.Family, neighbor.State)
ch <- c.neighborsDesc.mustNewConstMetric(neighbor.Quantity, neighbor.Interface, neighbor.Family, neighbor.Flag, neighbor.State)
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/nl/layer2.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type NeighborInformation struct {
Quantity float64
}
type NeighborKey struct {
InterfaceIndex, State, Family int
InterfaceIndex, State, Flags, Family int
}

func getNeighborState(state int) (string, error) {
Expand Down Expand Up @@ -469,7 +469,7 @@ func (n *NetlinkManager) ListNeighborInformation() ([]NeighborInformation, error
strings.HasPrefix(interfaceName, macvlanPrefix) ||
strings.HasPrefix(interfaceName, layer2Prefix) ||
linkInfo.Attrs().Vfs != nil {
neighborKey := NeighborKey{InterfaceIndex: netlinkNeighbors[index].LinkIndex, State: netlinkNeighbors[index].State, Family: netlinkNeighbors[index].Family}
neighborKey := NeighborKey{InterfaceIndex: netlinkNeighbors[index].LinkIndex, State: netlinkNeighbors[index].State, Flags: netlinkNeighbors[index].Flags, Family: netlinkNeighbors[index].Family}
neighborInformation, ok := neighbors[neighborKey]
if ok {
neighborInformation.Quantity++
Expand Down

0 comments on commit ab6f52e

Please sign in to comment.