GNOME Bugzilla – Bug 706332
crash in update_ip6_routing if IPv6 internal gateway is missing
Last modified: 2013-11-01 10:10:35 UTC
Created attachment 252274 [details] [review] get_best_ip6_config patch NetworkManager crashes with segmentation fault at nm-policy.c:790 when connecting to a VPN which doesn't provide an IPv6 internal gateway. GDB backtrace (with git revision d9cba44e6c4fdae3593021ff3f3fb7fc6467010d):
+ Trace 232396
nm-policy.c:790 is: struct in6_addr int_gw = *nm_vpn_connection_get_ip6_internal_gateway (vpn); As nm_vpn_connection_get_ip6_internal_gateway returns NULL, there is a NULL pointer dereference here. To prevent it, I modified get_best_ip6_config to never return such VPN connection. Such configuration occurs with an OpenVPN server which doesn't provide IPv6 routing, and therefore expected behavior is to use the non-VPN gateway as default route.
Fixed by http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=19b040236ec59fe8f9730d9da6d9262921d28936
Oh, sorry, I did not see this patch :$ The approach I commited yesterday, is different in that if the vpn does not have an internal gateway, we add a route to :: over that vpn. That is also, what happens in the IPv4 case. If a VPN does not have the internal gateway and it should not get the default route, then you must configure the never-default flag for it.
No problem. This issue has been discussed on the mailing list and in August I wasn't sure OpenVPN behaves correctly with a route which next-hop is ::. On October, 1st, I bought a server with a /64 and made some tests with OpenVPN. My tests showed that such configuration works. However, NetworkManager is still crashing with a NULL pointer dereference somewhere else. In src/vpn-manager/nm-vpn-connection.c on line 1087 (http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/src/vpn-manager/nm-vpn-connection.c?id=a7bab4015ebf12714f6e7ea6303cb46df6465058#n1087): if (IN6_ARE_ADDR_EQUAL (&route.network, priv->ip6_external_gw) && route.plen == 128) This code fails if priv->ip6_external_gw is NULL, ie. when using an IPv4 VPN server which provides IPv6 internally. Is it possible to change this to: if (priv->ip6_external_gw != NULL && IN6_ARE_ADDR_EQUAL (&route.network, priv->ip6_external_gw) && route.plen == 128) I may also open a new bug for this small patch if needed. Thanks
Hi Nicolas, I pushed this change to upstream master: http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=886ca75ac33de252158a63074cc7cf9d0215c962&context=6 Thank you for your effort!! Thomas