You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.4 KiB

  1. From 66f96259c596f8f303bd98e5323a447cd60adbb2 Mon Sep 17 00:00:00 2001
  2. From: Helmut Schaa <helmut.schaa@googlemail.com>
  3. Date: Wed, 8 Jan 2014 13:48:49 +0100
  4. Subject: [PATCH] netdev-linux: Let interface flag survive internal port setup
  5. Due to a race condition when bringing up an internal port on Linux
  6. some interface flags (e.g. IFF_MULTICAST) are falsely reset. This
  7. happens because netlink events may be processed after the according
  8. netdev has been brought up (which sets interface flags).
  9. Fix this by reading the interface flags just before updating them
  10. if they have not been updated by from the kernel yet.
  11. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
  12. ---
  13. lib/netdev-linux.c | 8 +++++++-
  14. 1 file changed, 7 insertions(+), 1 deletion(-)
  15. diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
  16. index c6f3d2740..136668b1d 100644
  17. --- a/lib/netdev-linux.c
  18. +++ b/lib/netdev-linux.c
  19. @@ -3461,7 +3461,13 @@ update_flags(struct netdev_linux *netdev, enum netdev_flags off,
  20. unsigned int old_flags, new_flags;
  21. int error = 0;
  22. - old_flags = netdev->ifi_flags;
  23. + if (!(netdev->cache_valid & VALID_DRVINFO)) {
  24. + /* Most likely the debvice flags are not in sync yet, fetch them now */
  25. + get_flags(&netdev->up, &old_flags);
  26. + } else {
  27. + old_flags = netdev->ifi_flags;
  28. + }
  29. +
  30. *old_flagsp = iff_to_nd_flags(old_flags);
  31. new_flags = (old_flags & ~nd_to_iff_flags(off)) | nd_to_iff_flags(on);
  32. if (new_flags != old_flags) {