-/* $OpenBSD: dhclient.c,v 1.419 2017/06/13 15:49:32 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.420 2017/06/14 15:39:55 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
goto done;
if ((rtm->rtm_flags & RTF_PROTO3) != 0) {
if (rtm->rtm_seq == (int32_t)client->xid) {
- client->flags |= IN_CHARGE;
- } else if ((client->flags & IN_CHARGE) != 0) {
+ ifi->flags |= IFI_IN_CHARGE;
+ } else if ((ifi->flags & IFI_IN_CHARGE) != 0) {
rslt = asprintf(&errmsg, "yielding "
"responsibility for %s",
ifi->name);
inet_ntoa(client->active->address),
(long long)(client->active->renewal -
time(NULL)));
- client->flags |= IS_RESPONSIBLE;
+ ifi->flags |= IFI_IS_RESPONSIBLE;
go_daemon();
break;
}
- if ((client->flags & IS_RESPONSIBLE) == 0)
+ if ((ifi->flags & IFI_IS_RESPONSIBLE) == 0)
/* We're not responsible yet! */
break;
if (adding.s_addr != INADDR_ANY) {
deleting.s_addr = INADDR_ANY;
break;
}
- if ((client->flags & IS_RESPONSIBLE) == 0)
+ if ((ifi->flags & IFI_IS_RESPONSIBLE) == 0)
/* We're not responsible yet! */
break;
if (adding.s_addr == INADDR_ANY && client->active &&
memset(&b, 0, sizeof(b));
add_address(b, b);
/* No need to write resolv.conf now. */
- client->flags &= ~IS_RESPONSIBLE;
+ ifi->flags &= ~IFI_IS_RESPONSIBLE;
quit = INTERNALSIG;
break;
}
/* Something has happened. Try to write out the resolv.conf. */
if (client->active && client->active->resolv_conf &&
- client->flags & IS_RESPONSIBLE)
+ ifi->flags & IFI_IS_RESPONSIBLE)
write_resolv_conf(client->active->resolv_conf,
strlen(client->active->resolv_conf));
* A duplicate lease once we are responsible & S_RENEWING means we
* don't need to change the interface, routing table or resolv.conf.
*/
- if ((client->flags & IS_RESPONSIBLE) && client->state == S_RENEWING &&
+ if ((ifi->flags & IFI_IS_RESPONSIBLE) && client->state == S_RENEWING &&
compare_lease(client->active, client->new) == 0) {
client->new->resolv_conf = client->active->resolv_conf;
client->active->resolv_conf = NULL;
rtm.rtm_flags = RTF_UP | RTF_PROTO3;
retries = 0;
- while ((ifi->client->flags & IN_CHARGE) == 0) {
+ while ((ifi->flags & IFI_IN_CHARGE) == 0) {
if (write(routefd, &rtm, sizeof(rtm)) == -1)
fatal("tried to take charge");
time(&cur_time);
-/* $OpenBSD: dhcpd.h,v 1.175 2017/06/13 16:02:46 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.176 2017/06/14 15:39:55 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
TAILQ_HEAD(_leases, client_lease) leases;
enum dhcp_state state;
struct in_addr destination;
- int flags;
-#define IS_RESPONSIBLE 0x1
-#define IN_CHARGE 0x2
u_int32_t xid;
u_int16_t secs;
time_t first_sending;
};
struct interface_info {
- struct ether_addr hw_address;
- char name[IFNAMSIZ];
- char ssid[32];
- uint8_t ssid_len;
+ struct ether_addr hw_address;
+ char name[IFNAMSIZ];
+ char ssid[32];
+ uint8_t ssid_len;
struct client_state *client;
- int bfdesc; /* bpf - reading & broadcast writing*/
- int ufdesc; /* udp - unicast writing */
- unsigned char *rbuf;
- size_t rbuf_max;
- size_t rbuf_offset;
- size_t rbuf_len;
- int errors;
- u_int16_t index;
- int linkstat;
- int rdomain;
- int flags;
-#define IFI_VALID_LLADDR 0x00000001
-#define IFI_NEW_LLADDR 0x00000002
-#define IFI_HUP 0x00000003
+ int bfdesc; /* bpf - reading & broadcast writing*/
+ int ufdesc; /* udp - unicast writing */
+ unsigned char *rbuf;
+ size_t rbuf_max;
+ size_t rbuf_offset;
+ size_t rbuf_len;
+ int errors;
+ u_int16_t index;
+ int linkstat;
+ int rdomain;
+ int flags;
+#define IFI_VALID_LLADDR 0x01
+#define IFI_NEW_LLADDR 0x02
+#define IFI_HUP 0x04
+#define IFI_IS_RESPONSIBLE 0x08
+#define IFI_IN_CHARGE 0x10
};
struct dhcp_timeout {