From c429d4a4ba2cc8778634461e8adea33e0f0ae022 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Sun, 4 Apr 2010 15:41:31 +0200 Subject: Restrict export of device routes to the kernel protocol. In usual configuration, such export is already restricted with the aid of the direct protocol but there are some races that can circumvent it. This makes it harder to break kernel device routes. Also adds an option to disable this restriction. --- sysdep/linux/netlink/netlink.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'sysdep/linux') diff --git a/sysdep/linux/netlink/netlink.c b/sysdep/linux/netlink/netlink.c index b59b32f3..f31ef9f7 100644 --- a/sysdep/linux/netlink/netlink.c +++ b/sysdep/linux/netlink/netlink.c @@ -460,20 +460,14 @@ krt_capable(rte *e) { rta *a = e->attrs; - if (a->cast != RTC_UNICAST -#if 0 - && a->cast != RTC_ANYCAST -#endif - ) - return 0; - if (a->source == RTS_DEVICE) /* Kernel takes care of device routes itself */ + if (a->cast != RTC_UNICAST) return 0; + switch (a->dest) { case RTD_ROUTER: if (ipa_has_link_scope(a->gw) && (a->iface == NULL)) return 0; - case RTD_DEVICE: case RTD_BLACKHOLE: case RTD_UNREACHABLE: -- cgit v1.2.3