Skip to content
Snippets Groups Projects
  1. Sep 15, 2020
  2. Sep 14, 2020
  3. Sep 13, 2020
    • Ian Wienand's avatar
      network: Only check kernel added routes in virNetDevIPCheckIPv6Forwarding · d9ee51ef
      Ian Wienand authored and Laine Stump's avatar Laine Stump committed
      
      The original motivation for adding virNetDevIPCheckIPv6Forwarding
      (commit 00d28a78) was that networking routes would disappear when
      ipv6 forwarding was enabled for an interface.
      
      This is a fairly undocumented side-effect of the "accept_ra" sysctl
      for an interface.  1 means the interface will accept_ra's if not
      forwarding, 2 means always accept_RAs; but it is not explained that
      enabling forwarding when accept_ra==1 will also clear any kernel RA
      assigned routes, very likely breaking your networking.
      
      The check to warn about this currently uses netlink to go through all
      the routes and then look at the accept_ra status of the interfaces.
      
      However, it has been noticed that this problem does not affect systems
      where IPv6 RA configuration is handled in userspace, e.g. via tools
      such as NetworkManager.  In this case, the error message from libvirt
      is spurious, and modifying the forwarding state will not affect the RA
      state or disable your networking.
      
      If you refer to the function rt6_purge_dflt_routers() in the kernel,
      we can see that the routes being purged are only those with the
      kernel's RTF_ADDRCONF flag set; that is, routes added by the kernel's
      RA handling.  Why does it do this?  I think this is a Linux
      implementation decision; it has always been like that and there are
      some comments suggesting that it is because a router should be
      statically configured, rather than accepting external configurations.
      
      The solution implemented here is to convert the existing check into a
      walk of /proc/net/ipv6_route (because RTF_ADDRCONF is apparently not
      exposed in netlink) and look for routes with this flag set.  We then
      check the accept_ra status for the interface, and if enabling
      forwarding would break things raise an error.
      
      This should hopefully avoid "interactive" users, who are likely to be
      using NetworkManager and the like, having false warnings when enabling
      IPv6, but retain the error check for users relying on kernel-based
      IPv6 interface auto-configuration.
      
      Signed-off-by: Ian Wienand's avatarIan Wienand <iwienand@redhat.com>
      Reviewed-by: default avatarLaine Stump <laine@redhat.com>
      Reviewed-by: default avatarCedric Bosdonnat <CBosdonnat@suse.com>
      d9ee51ef
  4. Sep 12, 2020
Loading