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.

38 lines
1.5 KiB

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