Skip to content

Commit c56e8be

Browse files
committed
Enhance route type filter around RTA_DST address
1 parent c822ed7 commit c56e8be

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

route_linux.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,11 @@ func (h *Handle) prepareRouteReq(route *Route, req *nl.NetlinkRequest, msg *nl.R
929929
} else {
930930
dstData = route.Dst.IP.To16()
931931
}
932-
rtAttrs = append(rtAttrs, nl.NewRtAttr(unix.RTA_DST, dstData))
932+
if route.Type != unix.RTN_UNREACHABLE &&
933+
route.Type != unix.RTN_BLACKHOLE &&
934+
route.Type != unix.RTN_PROHIBIT {
935+
rtAttrs = append(rtAttrs, nl.NewRtAttr(unix.RTA_DST, dstData))
936+
}
933937
} else if route.MPLSDst != nil {
934938
family = nl.FAMILY_MPLS
935939
msg.Dst_len = uint8(20)

0 commit comments

Comments
 (0)