Filter RouteListFiltered response by requested IP family in

This commit is contained in:
foyerunix 2024-03-26 06:44:06 +01:00 committed by Alessandro Boch
parent 0e685ffcfc
commit aafe841692

View File

@ -1148,6 +1148,10 @@ func (h *Handle) RouteListFiltered(family int, filter *Route, filterMask uint64)
var res []Route
for _, m := range msgs {
msg := nl.DeserializeRtMsg(m)
if msg.Family != uint8(family) {
// Ignore routes not matching requested family
continue
}
if msg.Flags&unix.RTM_F_CLONED != 0 {
// Ignore cloned routes
continue