0001-core-fix-failure-to-configure-routes-due-to-wrong-de.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From 11aa07ed939193e85516c287a57dee1837242972 Mon Sep 17 00:00:00 2001
  2. From: Thomas Haller <thaller@redhat.com>
  3. Date: Mon, 4 Jan 2016 18:54:26 +0100
  4. Subject: [PATCH] core: fix failure to configure routes due to wrong
  5. device-route for IPv4 peer-addresses
  6. As in the case of a OpenVPN connection, we might add an address like:
  7. 10.8.0.58/32 ptp 10.8.0.57
  8. In this case, kernel would automatically add a device-route like:
  9. 10.8.0.57/32 via 0.0.0.0 dev 32 metric 0 mss 0 src rtprot-kernel scope link pref-src 10.8.0.58
  10. nm_ip4_config_commit() checks all IP addresses to figure out
  11. the present device-routes. Then the routes are synced by NMRouteManager.
  12. Due to a bug, we would not consider the peer-address, but the local-address
  13. and configure a route 10.8.0.58/32, instead of 10.8.0.57/32.
  14. That stays mostly unnoticed, because usually the peer and the local-address are
  15. in the same subnet, so that there is no difference (/32 is an example of the
  16. peer-address being in a different subnet).
  17. It also seems that due to a bug fixed by df4e5357521 this issue didn't surface.
  18. Probably because we would not notice the 10.8.0.57/32 right away and thus
  19. nm_route_manager_ip4_route_sync() would not wrongly delete it.
  20. https://bugzilla.gnome.org/show_bug.cgi?id=759892
  21. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809195
  22. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809494
  23. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809526
  24. https://bugs.archlinux.org/task/47535
  25. https://bugzilla.redhat.com/show_bug.cgi?id=1294309
  26. https://mail.gnome.org/archives/networkmanager-list/2015-December/msg00059.html
  27. ---
  28. src/nm-ip4-config.c | 3 ++-
  29. 1 file changed, 2 insertions(+), 1 deletion(-)
  30. diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
  31. index f625d35..61e29af 100644
  32. --- a/src/nm-ip4-config.c
  33. +++ b/src/nm-ip4-config.c
  34. @@ -298,7 +298,8 @@ nm_ip4_config_commit (const NMIP4Config *config, int ifindex, gboolean routes_fu
  35. route.ifindex = ifindex;
  36. route.source = NM_IP_CONFIG_SOURCE_KERNEL;
  37. - route.network = nm_utils_ip4_address_clear_host_address (addr->address, addr->plen);
  38. + route.network = nm_utils_ip4_address_clear_host_address (addr->peer_address ? : addr->address,
  39. + addr->plen);
  40. route.plen = addr->plen;
  41. route.pref_src = addr->address;
  42. route.metric = default_route_metric;
  43. --
  44. 2.6.4