Discussion:
[strongSwan-dev] [PATCH] kernel-netlink: Fix get_route() interface determination
Christophe Gouault
2016-10-12 16:12:08 UTC
Permalink
A wrong variable is used (route instead of best), so much that the
returned interface belongs to the last seen route instead of the best
choice route.

get_route() may therefore return mismatching interface and gateway.

Fixes: 66e9165bc686 ("kernel-netlink: Return outbound interface in get_nexthop()")

Signed-off-by: Christophe Gouault <***@6wind.com>
---
src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c b/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c
index b9d3269415e3..0132f7269f67 100644
--- a/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c
+++ b/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c
@@ -1995,9 +1995,9 @@ static host_t *get_route(private_kernel_netlink_net_t *this, host_t *dest,
if (best || routes->get_first(routes, (void**)&best) == SUCCESS)
{
addr = host_create_from_chunk(msg->rtm_family, best->gtw, 0);
- if (iface && route->oif)
+ if (iface && best->oif)
{
- *iface = get_interface_name_by_index(this, route->oif);
+ *iface = get_interface_name_by_index(this, best->oif);
}
}
if (!addr && !match_net)
--
2.1.4
Tobias Brunner
2016-10-12 17:25:38 UTC
Permalink
Hi Christophe,
Post by Christophe Gouault
A wrong variable is used (route instead of best), so much that the
returned interface belongs to the last seen route instead of the best
choice route.
Applied, thanks!

Regards,
Tobias
zhen chen
2016-10-12 17:32:54 UTC
Permalink
Could you remove me from this list?

thanks!
Post by Tobias Brunner
Hi Christophe,
Post by Christophe Gouault
A wrong variable is used (route instead of best), so much that the
returned interface belongs to the last seen route instead of the best
choice route.
Applied, thanks!
Regards,
Tobias
_______________________________________________
Dev mailing list
https://lists.strongswan.org/mailman/listinfo/dev
Christophe Gouault
2016-10-13 07:39:54 UTC
Permalink
Post by Tobias Brunner
Hi Christophe,
Post by Christophe Gouault
A wrong variable is used (route instead of best), so much that the
returned interface belongs to the last seen route instead of the best
choice route.
Hi Tobias,

Thanks!

Christophe
Post by Tobias Brunner
Applied, thanks!
Regards,
Tobias
Loading...