From 294866952502786e8c860a0c2cb3c3ee15482450 Mon Sep 17 00:00:00 2001 From: krw Date: Wed, 5 Apr 2017 18:22:30 +0000 Subject: [PATCH] Shuffle sendhup() into dispatch.c, the only place it is used. --- sbin/dhclient/dhcpd.h | 4 +--- sbin/dhclient/dispatch.c | 25 ++++++++++++++++++++++++- sbin/dhclient/kroute.c | 24 +----------------------- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 1aae45d1a2f..9b98f9b36cf 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.164 2017/04/04 15:15:48 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.165 2017/04/05 18:22:30 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer @@ -279,6 +279,4 @@ void add_route(struct in_addr, struct in_addr, struct in_addr, struct in_addr, int resolv_conf_priority(struct interface_info *); -void sendhup(struct client_lease *); - void flush_unpriv_ibuf(const char *); diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c index 2165c0f19f2..0361c3de511 100644 --- a/sbin/dhclient/dispatch.c +++ b/sbin/dhclient/dispatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dispatch.c,v 1.118 2017/04/04 15:15:48 krw Exp $ */ +/* $OpenBSD: dispatch.c,v 1.119 2017/04/05 18:22:30 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -73,6 +73,7 @@ struct dhcp_timeout timeout; void packethandler(struct interface_info *ifi); +void sendhup(struct client_lease *); void get_hw_address(struct interface_info *ifi) @@ -338,3 +339,25 @@ get_rdomain(char *name) close(s); return rv; } + +/* + * Inform the [priv] process a HUP was received and it should restart. + */ +void +sendhup(struct client_lease *active) +{ + struct imsg_hup imsg; + int rslt; + + if (active) + imsg.addr = active->address; + else + imsg.addr.s_addr = INADDR_ANY; + + rslt = imsg_compose(unpriv_ibuf, IMSG_HUP, 0, 0, -1, + &imsg, sizeof(imsg)); + if (rslt == -1) + log_warn("sendhup: imsg_compose"); + + flush_unpriv_ibuf("sendhup"); +} diff --git a/sbin/dhclient/kroute.c b/sbin/dhclient/kroute.c index d93c164b666..1d53f814b51 100644 --- a/sbin/dhclient/kroute.c +++ b/sbin/dhclient/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.85 2017/03/08 15:07:32 krw Exp $ */ +/* $OpenBSD: kroute.c,v 1.86 2017/04/05 18:22:31 krw Exp $ */ /* * Copyright 2012 Kenneth R Westerback @@ -512,28 +512,6 @@ priv_add_address(struct interface_info *ifi, struct imsg_add_address *imsg) active_addr = imsg->addr; } -/* - * Inform the [priv] process a HUP was received and it should restart. - */ -void -sendhup(struct client_lease *active) -{ - struct imsg_hup imsg; - int rslt; - - if (active) - imsg.addr = active->address; - else - imsg.addr.s_addr = INADDR_ANY; - - rslt = imsg_compose(unpriv_ibuf, IMSG_HUP, 0, 0, -1, - &imsg, sizeof(imsg)); - if (rslt == -1) - log_warn("sendhup: imsg_compose"); - - flush_unpriv_ibuf("sendhup"); -} - /* * priv_cleanup removes dhclient installed routes and address. */ -- 2.20.1