diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-01-27 22:05:25 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-01-27 22:05:25 +0000 |
commit | 6c19e7dc041a39463b3c894fea6ae8ccda1d7ce9 (patch) | |
tree | 84743c7172104369c45c6726e52b202fe0af94ae /sbin/dhclient/dhclient.c | |
parent | 2e9a5cd6e3a9050fccfa9a96f111f9dcf437b23e (diff) |
We only poll on the bpf fd and the routing socket fd. No need for
complex list code to keep track. So nuke it.
Also eliminate unnecessary variable ('dead') that means 'rfdesc is
closed'. Just set rfdesc to -1 when it is closed and use that.
As suggested by millert@ and claudio@, don't bother setting revents
members to zero since poll() does that.
Np functional change, just less code.
'looks good' claudio@ 'I like where this is going' henning@
Diffstat (limited to 'sbin/dhclient/dhclient.c')
-rw-r--r-- | sbin/dhclient/dhclient.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index b8da27e6e4f..117f0249e87 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.105 2007/01/25 01:21:04 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.106 2007/01/27 22:05:24 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -71,7 +71,7 @@ int privfd; int nullfd = -1; int no_daemon; int unknown_ok = 1; -int routefd; +int routefd = -1; struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } }; struct in_addr inaddr_any; @@ -85,7 +85,6 @@ struct client_config *config; int findproto(char *, int); struct sockaddr *get_ifa(char *, int); -void routehandler(struct protocol *); void usage(void); int check_option(struct client_lease *l, int option); int ipv4addrs(char * buf); @@ -151,7 +150,7 @@ struct iaddr defaddr = { 4 }; /* ARGSUSED */ void -routehandler(struct protocol *p) +routehandler(void) { char msg[2048]; struct rt_msghdr *rtm; @@ -358,8 +357,7 @@ main(int argc, char *argv[]) priv_script_write_params("alias_", client->alias); priv_script_go(); - if ((routefd = socket(PF_ROUTE, SOCK_RAW, 0)) != -1) - add_protocol("AF_ROUTE", routefd, routehandler); + routefd = socket(PF_ROUTE, SOCK_RAW, 0); /* set up the interface */ discover_interface(); |