summaryrefslogtreecommitdiff
path: root/sysdep/linux/netlink/netlink.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2010-04-04 15:41:31 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2010-04-04 15:41:31 +0200
commitc429d4a4ba2cc8778634461e8adea33e0f0ae022 (patch)
tree5cc8102345bf3ce872da92aca84fa63cf67c4e20 /sysdep/linux/netlink/netlink.c
parentd2d2b5d2ae43f608d03304d280367b658650138b (diff)
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.
Diffstat (limited to 'sysdep/linux/netlink/netlink.c')
-rw-r--r--sysdep/linux/netlink/netlink.c10
1 files changed, 2 insertions, 8 deletions
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: