Commit 3ca44042 authored by Julien Muchembled's avatar Julien Muchembled

Remove src-prefix when ipv6_subtrees is disabled

Note that the previous auto-detection is wrong. IPV6_SUBTREES exists
since (at least?) Linux 2.6.32. On the other side, a recent kernel may
be built without source-based routing.

Our use of this patch is safe because we control entirely with
re6stnet which routes babeld is going to install.
parent 053b7bfa
...@@ -196,9 +196,8 @@ equivalent to the command-line option ...@@ -196,9 +196,8 @@ equivalent to the command-line option
.BR \-r . .BR \-r .
.TP .TP
.BR ipv6-subtrees " {" true | false } .BR ipv6-subtrees " {" true | false }
This specifies whether to use native source-specific IPv6 forwarding Linux IPv6 only, default is true. If false, source prefix is cleared when the
rather than multiple routing tables. The default is chosen automatically route is installed. Do not use unless you know what you're doing.
depending on the kernel version.
.TP .TP
.BI debug " level" .BI debug " level"
This specifies the debugging level, and is equivalent to the command-line This specifies the debugging level, and is equivalent to the command-line
......
...@@ -999,7 +999,7 @@ kernel_interface_channel(const char *ifname, int ifindex) ...@@ -999,7 +999,7 @@ kernel_interface_channel(const char *ifname, int ifindex)
int int
kernel_has_ipv6_subtrees(void) kernel_has_ipv6_subtrees(void)
{ {
return (kernel_older_than("Linux", 3, 11) == 0); return 1;
} }
int int
...@@ -1095,10 +1095,15 @@ kernel_route(int operation, int table, ...@@ -1095,10 +1095,15 @@ kernel_route(int operation, int table,
is_v4_over_v6 = ipv4 && !v4mapped(gate); is_v4_over_v6 = ipv4 && !v4mapped(gate);
use_src = !is_default(src, src_plen); use_src = !is_default(src, src_plen);
if(use_src) { if(use_src) {
if(ipv4 || !has_ipv6_subtrees) { if(ipv4) {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
} }
/* WARNING: There's no autodetection for the calculation of
* has_ipv6_subtrees: it's 1 unless explicitly configured
* with 'ipv6-subtrees false', which should only be used
* if it's safe to ignore the source prefix. */
use_src = has_ipv6_subtrees;
} }
kdebugf("kernel_route: %s %s from %s " kdebugf("kernel_route: %s %s from %s "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment