diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2014-12-09 02:27:55 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2014-12-09 02:27:55 +0000 |
commit | 0aa579b864abda30fe89f1978544d2eeb4c3d583 (patch) | |
tree | 6b0cb8272088da735609a1c4f71653e0f95a8276 /sbin/dhclient | |
parent | 67ddcb4da35750bac8a94e4a2f2ce998b91e868c (diff) |
Move the initial link status check and possible forceup back before
the routing socket initialization. Otherwise certain combinations
of UP/RUNNING/active will generate the deadly RTM_IFINFO with RTF_UP
== 0 and kill the client. Add comment to nail this section in place.
Diffstat (limited to 'sbin/dhclient')
-rw-r--r-- | sbin/dhclient/dhclient.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 1e6866dcf1c..fb9f9450ae8 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.343 2014/12/08 02:04:58 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.344 2014/12/09 02:27:54 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -559,6 +559,16 @@ main(int argc, char *argv[]) rewrite_client_leases(); close(fd); + /* + * Do the initial status check and possible force up before creating + * the routing socket. If we bounce the interface down and up while + * the routing socket is listening, the RTM_IFINFO message with the + * RTF_UP flag reset will cause premature exit. + */ + ifi->linkstat = interface_status(ifi->name); + if (ifi->linkstat == 0) + interface_link_forceup(ifi->name); + if ((routefd = socket(PF_ROUTE, SOCK_RAW, 0)) == -1) error("socket(PF_ROUTE, SOCK_RAW): %s", strerror(errno)); @@ -572,10 +582,6 @@ main(int argc, char *argv[]) sizeof(ifi->rdomain)) == -1) error("setsockopt(ROUTE_TABLEFILTER): %s", strerror(errno)); - ifi->linkstat = interface_status(ifi->name); - if (ifi->linkstat == 0) - interface_link_forceup(ifi->name); - /* Register the interface. */ if_register_receive(); if_register_send(); |