]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix carrier handling on BSD for interfaces that don't support link status
authorRoy Marples <roy@marples.name>
Tue, 31 Jan 2012 16:32:10 +0000 (16:32 +0000)
committerRoy Marples <roy@marples.name>
Tue, 31 Jan 2012 16:32:10 +0000 (16:32 +0000)
if-bsd.c

index 881b37c275e4d7afe8949792f3ae5b1c8d524849..c959b5e41bad31fb725e1b1fd5929b40e2dc73f7 100644 (file)
--- a/if-bsd.c
+++ b/if-bsd.c
@@ -356,9 +356,18 @@ manage_link(int fd)
                                case LINK_STATE_DOWN:
                                        len = -1;
                                        break;
+                               case LINK_STATE_UP:
+                                       len = 1;
+                                       break;
                                default:
-                                       len = ~ifm->ifm_flags &
-                                           (IFF_UP | IFF_RUNNING) ? -1 : 1;
+                                       /* handle_carrier will re-load
+                                        * the interface flags and check for
+                                        * IFF_RUNNING as some drivers that
+                                        * don't handle link state also don't
+                                        * set IFF_RUNNING when this routing
+                                        * message is generated.
+                                        * As such, it is a race ...*/
+                                       len = 0;
                                        break;
                                }
                                handle_carrier(len, ifm->ifm_flags, ifname);