summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2013-11-11 21:00:01 +0000
committerkrw <krw@openbsd.org>2013-11-11 21:00:01 +0000
commita6561481376b23273bd94c740103db2a54133f3f (patch)
tree25c7ea0fb889ca95f4f64d944c42eed0f9bca154
parentincorrect %lld for an int (diff)
downloadwireguard-openbsd-a6561481376b23273bd94c740103db2a54133f3f.tar.xz
wireguard-openbsd-a6561481376b23273bd94c740103db2a54133f3f.zip
Shuffle function prototypes and extern declarations around to
put local functions prototypes and variables in their .c files, and cross-file functions into .h files. Prompted by deraadt@.
-rw-r--r--sbin/dhclient/bpf.c4
-rw-r--r--sbin/dhclient/clparse.c11
-rw-r--r--sbin/dhclient/dhclient.c26
-rw-r--r--sbin/dhclient/dhcpd.h42
-rw-r--r--sbin/dhclient/dispatch.c4
-rw-r--r--sbin/dhclient/parse.c4
6 files changed, 48 insertions, 43 deletions
diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c
index 9e54dc3668d..992e2b3b1e8 100644
--- a/sbin/dhclient/bpf.c
+++ b/sbin/dhclient/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.28 2013/05/02 16:35:27 krw Exp $ */
+/* $OpenBSD: bpf.c,v 1.29 2013/11/11 21:00:01 krw Exp $ */
/* BPF socket interface code, originally contributed by Archie Cobbs. */
@@ -51,6 +51,8 @@
#define BPF_FORMAT "/dev/bpf%d"
+int if_register_bpf(void);
+
/*
* Called by get_interface_list for each interface that's discovered.
* Opens a packet filter for each interface and adds it to the select
diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c
index 275dfbf5040..11ae622561c 100644
--- a/sbin/dhclient/clparse.c
+++ b/sbin/dhclient/clparse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clparse.c,v 1.61 2013/10/22 18:15:58 krw Exp $ */
+/* $OpenBSD: clparse.c,v 1.62 2013/11/11 21:00:01 krw Exp $ */
/* Parser for dhclient config and lease files. */
@@ -43,6 +43,15 @@
#include "dhcpd.h"
#include "dhctoken.h"
+void parse_client_statement(FILE *);
+int parse_X(FILE *, u_int8_t *, int);
+int parse_option_list(FILE *, u_int8_t *, size_t);
+void parse_interface_declaration(FILE *);
+void parse_client_lease_statement(FILE *, int);
+void parse_client_lease_declaration(FILE *, struct client_lease *);
+int parse_option_decl(FILE *, struct option_data *);
+void parse_reject_statement(FILE *);
+
/*
* client-conf-file :== client-declarations EOF
* client-declarations :== <nil>
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 47f2286dd75..6abdb1d6430 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.266 2013/11/11 18:43:45 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.267 2013/11/11 21:00:01 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -93,7 +93,6 @@ struct imsgbuf *unpriv_ibuf;
void sighdlr(int);
int findproto(char *, int);
struct sockaddr *get_ifa(char *, int);
-int resolv_conf_priority(int);
void usage(void);
int res_hnok(const char *dn);
char *option_as_string(unsigned int code, unsigned char *data, int len);
@@ -114,6 +113,29 @@ void add_classless_static_routes(int, struct option_data *);
int compare_lease(struct client_lease *, struct client_lease *);
+void state_reboot(void);
+void state_init(void);
+void state_selecting(void);
+void state_bound(void);
+void state_panic(void);
+
+void send_discover(void);
+void send_request(void);
+void send_decline(void);
+
+void bind_lease(void);
+
+void make_discover(struct client_lease *);
+void make_request(struct client_lease *);
+void make_decline(struct client_lease *);
+
+void rewrite_client_leases(void);
+void rewrite_option_db(struct client_lease *, struct client_lease *);
+char *lease_as_string(char *, struct client_lease *);
+
+struct client_lease *packet_to_lease(struct in_addr, struct option_data *);
+void go_daemon(void);
+
#define ROUNDUP(a) \
((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h
index 3b7eb556044..53625fb9597 100644
--- a/sbin/dhclient/dhcpd.h
+++ b/sbin/dhclient/dhcpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpd.h,v 1.122 2013/10/22 18:15:58 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.123 2013/11/11 21:00:01 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
@@ -241,12 +241,10 @@ char *parse_string(FILE *);
int parse_ip_addr(FILE *, struct in_addr *);
void parse_hardware_param(FILE *, struct hardware *);
void parse_lease_time(FILE *, time_t *);
-int parse_numeric_aggregate(FILE *, unsigned char *, int, int, int);
void convert_num(unsigned char *, char *, int, int);
time_t parse_date(FILE *);
/* bpf.c */
-int if_register_bpf(void);
void if_register_send(void);
void if_register_receive(void);
ssize_t send_packet(struct in_addr, struct sockaddr_in *, struct hardware *);
@@ -255,7 +253,6 @@ ssize_t receive_packet(struct sockaddr_in *, struct hardware *);
/* dispatch.c */
void discover_interface(void);
void dispatch(void);
-void got_one(void);
void set_timeout(time_t, void (*)(void));
void set_timeout_interval(time_t, void (*)(void));
void cancel_timeout(void);
@@ -280,7 +277,6 @@ void putShort(unsigned char *, int);
/* dhclient.c */
extern char *path_dhclient_conf;
extern char *path_dhclient_db;
-extern char path_option_db[MAXPATHLEN];
extern int log_perror;
extern int routefd;
@@ -288,34 +284,10 @@ void dhcpoffer(struct in_addr, struct option_data *, char *);
void dhcpack(struct in_addr, struct option_data *, char *);
void dhcpnak(struct in_addr, struct option_data *, char *);
-void send_discover(void);
-void send_request(void);
-void send_decline(void);
-
-void state_reboot(void);
-void state_init(void);
-void state_selecting(void);
-void state_bound(void);
-void state_panic(void);
-
-void bind_lease(void);
-
-void make_discover(struct client_lease *);
-void make_request(struct client_lease *);
-void make_decline(struct client_lease *);
-
void free_client_lease(struct client_lease *);
-void rewrite_client_leases(void);
-void rewrite_option_db(struct client_lease *, struct client_lease *);
-char *lease_as_string(char *, struct client_lease *);
-
-struct client_lease *packet_to_lease(struct in_addr, struct option_data *);
-void go_daemon(void);
void routehandler(void);
-void sendhup(struct client_lease *);
-
/* packet.c */
void assemble_hw_header(unsigned char *, int *, struct hardware *);
void assemble_udp_ip_header(unsigned char *, int *, u_int32_t, u_int32_t,
@@ -327,14 +299,6 @@ ssize_t decode_udp_ip_header(unsigned char *, int, struct sockaddr_in *,
/* clparse.c */
int read_client_conf(void);
void read_client_leases(void);
-void parse_client_statement(FILE *);
-int parse_X(FILE *, u_int8_t *, int);
-int parse_option_list(FILE *, u_int8_t *, size_t);
-void parse_interface_declaration(FILE *);
-void parse_client_lease_statement(FILE *, int);
-void parse_client_lease_declaration(FILE *, struct client_lease *);
-int parse_option_decl(FILE *, struct option_data *);
-void parse_reject_statement(FILE *);
/* kroute.c */
void delete_addresses(char *, int);
@@ -345,3 +309,7 @@ void add_address(char *, int, struct in_addr, struct in_addr);
void flush_routes(char *, int);
void add_route(int, struct in_addr, struct in_addr, struct in_addr, int, int);
+
+void sendhup(struct client_lease *);
+
+int resolv_conf_priority(int);
diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c
index d822f217b38..958b0b9fcff 100644
--- a/sbin/dhclient/dispatch.c
+++ b/sbin/dhclient/dispatch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dispatch.c,v 1.81 2013/07/06 01:12:20 krw Exp $ */
+/* $OpenBSD: dispatch.c,v 1.82 2013/11/11 21:00:01 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -50,6 +50,8 @@
struct dhcp_timeout timeout;
+void got_one(void);
+
/*
* Use getifaddrs() to get a list of all the attached interfaces. Find
* our interface on the list and store the interesting information about it.
diff --git a/sbin/dhclient/parse.c b/sbin/dhclient/parse.c
index 215d9cb795e..7004ed6b5be 100644
--- a/sbin/dhclient/parse.c
+++ b/sbin/dhclient/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.24 2013/05/02 16:35:27 krw Exp $ */
+/* $OpenBSD: parse.c,v 1.25 2013/11/11 21:00:01 krw Exp $ */
/* Common parser code for dhcpd and dhclient. */
@@ -43,6 +43,8 @@
#include "dhcpd.h"
#include "dhctoken.h"
+int parse_numeric_aggregate(FILE *, unsigned char *, int, int, int);
+
/*
* Skip to the semicolon ending the current statement. If we encounter
* braces, the matching closing brace terminates the statement. If we