diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-01-14 04:54:47 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-01-14 04:54:47 +0000 |
commit | 90039b9cc261286416188fdaffb0de63f325dbc1 (patch) | |
tree | 99efe7d4ed228f4d15f690f08f046b7f506361f0 /sbin | |
parent | 6ca3de237184ec8f8cc312fec804310efd1a381c (diff) |
Make apply_ignore_list(), set_default_hostname(),
set_default_client_identifier() and read_resolv_conf_tail() local to
clparse.c and just call them from read_conf().
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dhclient/clparse.c | 14 | ||||
-rw-r--r-- | sbin/dhclient/dhclient.c | 18 | ||||
-rw-r--r-- | sbin/dhclient/dhcpd.h | 8 |
3 files changed, 16 insertions, 24 deletions
diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index ee70cc4ab80..578e4f5511f 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clparse.c,v 1.175 2019/01/14 04:05:42 krw Exp $ */ +/* $OpenBSD: clparse.c,v 1.176 2019/01/14 04:54:46 krw Exp $ */ /* Parser for dhclient config and lease files. */ @@ -76,6 +76,11 @@ void parse_lease_decl(FILE *, struct client_lease *, char *); int parse_option(FILE *, int *, struct option_data *); int parse_reject_statement(FILE *); +void apply_ignore_list(char *); +void set_default_client_identifier(struct ether_addr *); +void set_default_hostname(void); +void read_resolv_conf_tail(void); + void init_config(void) { @@ -147,7 +152,7 @@ init_config(void) * | conf-decls conf-decl */ void -read_conf(char *name) +read_conf(char *name, char *ignore_list, struct ether_addr *hwaddr) { FILE *cfile; int token; @@ -165,6 +170,11 @@ read_conf(char *name) } fclose(cfile); } + + set_default_client_identifier(hwaddr); + set_default_hostname(); + apply_ignore_list(ignore_list); + read_resolv_conf_tail(); } /* diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index d56dce6a024..5e98c795c62 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.606 2019/01/14 04:05:42 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.607 2019/01/14 04:54:46 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -574,21 +574,10 @@ main(int argc, char *argv[]) fatal("unpriv_ibuf"); imsg_init(unpriv_ibuf, socket_fd[1]); - read_conf(ifi->name); + read_conf(ifi->name, ignore_list, &ifi->hw_address); if ((cmd_opts & OPT_NOACTION) != 0) return 0; - /* - * Set default client identifier, if needed, *before* reading - * the leases file! Changes to the lladdr will trigger a restart - * and go through here again. - */ - set_default_client_identifier(&ifi->hw_address); - - /* - * Set default hostname, if needed. */ - set_default_hostname(); - if ((pw = getpwnam("_dhcp")) == NULL) fatalx("no such user: _dhcp"); @@ -596,9 +585,6 @@ main(int argc, char *argv[]) _PATH_LEASE_DB, ifi->name) == -1) fatal("path_lease_db"); - apply_ignore_list(ignore_list); - read_resolv_conf_tail(); - interface_state(ifi); if (!LINK_STATE_IS_UP(ifi->link_state)) interface_link_forceup(ifi->name, ioctlfd); diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index a1af70e9a70..f640b454896 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.267 2019/01/14 04:05:42 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.268 2019/01/14 04:54:46 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer <henning@openbsd.org> @@ -234,12 +234,8 @@ uint32_t wrapsum(uint32_t); /* clparse.c */ void init_config(void); -void read_conf(char *); +void read_conf(char *, char *, struct ether_addr *); void read_lease_db(char *, struct client_lease_tq *); -void apply_ignore_list(char *); -void set_default_client_identifier(struct ether_addr *); -void set_default_hostname(void); -void read_resolv_conf_tail(void); /* kroute.c */ unsigned int extract_classless_route(uint8_t *, unsigned int, |