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