[PATCH] Fix pointer handling in nm_system_set_ip6_route()



Hello,

nm_system_set_ip6_route() incorrectly takes addresses of the two in6_addr
pointers passed in (ip6_dest and ip6_gateway) and passes that to
nm_netlink_route_add(). That function takes two void* so the compiler doesn't
complain at all that in6_addr** is passed in instead of the correct in6_addr*.
The only symptom of this (except for correct v6 routes not getting added) is
these two recurring messages:

<warn> Failed to add route Netlink Error (errno = No route to host)
<error> [1328969308.177075] [nm-system.c:595] nm_system_apply_ip6_config():
(wlan0): failed to set IPv6 route: Netlink Error (errno = No route to host)

(Because nm_netlink_route_add() uses the *value of the pointer*
ip6_dest/gateway as IPv6 addresses, most often those addresses are
unreachable. However, I've seen several mystery routes getting added this
way.)

This is fixed by this one-liner (prepared and tested on the NM 0.9.2.0 in
Fedora 16; AFAICS the bug is still present in git master):

Signed-off-by: Tomáš Trnka <tomastrnka gmx com>

diff -u -r NetworkManager-0.9.2.0.orig/src/nm-system.c NetworkManager-0.9.2.0/src/nm-system.c
--- NetworkManager-0.9.2.0.orig/src/nm-system.c 2012-02-11 13:00:11.188000033 +0100
+++ NetworkManager-0.9.2.0/src/nm-system.c      2012-02-11 14:53:53.231341828 +0100
@@ -479,7 +479,7 @@
        g_return_val_if_fail (route != NULL, -1);
 
        /* Add the route */
-       err = nm_netlink_route_add(route, AF_INET6, &ip6_dest, ip6_prefix, &ip6_gateway, 0);
+       err = nm_netlink_route_add(route, AF_INET6, ip6_dest, ip6_prefix, ip6_gateway, 0);
        if (err == -NLE_OBJ_NOTFOUND && ip6_gateway) {
                /* Gateway might be over a bridge; try adding a route to gateway first */
                struct rtnl_route *route2;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]