-/* $OpenBSD: bpf.c,v 1.51 2017/06/13 15:49:32 krw Exp $ */
+/* $OpenBSD: bpf.c,v 1.52 2017/06/14 15:57:25 krw Exp $ */
/* BPF socket interface code, originally contributed by Archie Cobbs. */
struct udphdr udp;
struct iovec iov[4];
struct msghdr msg;
- struct dhcp_packet *packet = &ifi->client->sent_packet;
+ struct dhcp_packet *packet = &ifi->sent_packet;
ssize_t result;
- int iovcnt = 0, len = ifi->client->sent_packet_length;
+ int iovcnt = 0, len = ifi->sent_packet_length;
memset(&dest, 0, sizeof(dest));
dest.sin_family = AF_INET;
receive_packet(struct interface_info *ifi, struct sockaddr_in *from,
struct ether_addr *hfrom)
{
- struct dhcp_packet *packet = &ifi->client->recv_packet;
+ struct dhcp_packet *packet = &ifi->recv_packet;
int length = 0, offset = 0;
struct bpf_hdr hdr;
-/* $OpenBSD: dhclient.c,v 1.420 2017/06/14 15:39:55 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.421 2017/06/14 15:57:25 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
struct option_data *options, char *info)
{
struct client_state *client = ifi->client;
- struct dhcp_packet *packet = &client->recv_packet;
+ struct dhcp_packet *packet = &ifi->recv_packet;
struct client_lease *lease, *lp;
time_t stop_selecting;
packet_to_lease(struct interface_info *ifi, struct in_addr client_addr,
struct option_data *options)
{
- struct client_state *client = ifi->client;
- struct dhcp_packet *packet = &client->recv_packet;
+ struct dhcp_packet *packet = &ifi->recv_packet;
char ifname[IF_NAMESIZE];
struct client_lease *lease;
char *pretty, *buf;
{
struct interface_info *ifi = xifi;
struct client_state *client = ifi->client;
- struct dhcp_packet *packet = &client->sent_packet;
+ struct dhcp_packet *packet = &ifi->sent_packet;
time_t cur_time;
ssize_t rslt;
int interval;
{
struct interface_info *ifi = xifi;
struct client_state *client = ifi->client;
- struct dhcp_packet *packet = &client->sent_packet;
+ struct dhcp_packet *packet = &ifi->sent_packet;
struct sockaddr_in destination;
struct in_addr from;
time_t cur_time;
{
struct client_state *client = ifi->client;
struct option_data options[256];
- struct dhcp_packet *packet = &client->sent_packet;
+ struct dhcp_packet *packet = &ifi->sent_packet;
unsigned char discover = DHCPDISCOVER;
int i;
i = cons_options(ifi, options);
if (i == -1 || packet->options[i] != DHO_END)
fatalx("options do not fit in DHCPDISCOVER packet.");
- client->sent_packet_length = DHCP_FIXED_NON_UDP+i+1;
- if (client->sent_packet_length < BOOTP_MIN_LEN)
- client->sent_packet_length = BOOTP_MIN_LEN;
+ ifi->sent_packet_length = DHCP_FIXED_NON_UDP+i+1;
+ if (ifi->sent_packet_length < BOOTP_MIN_LEN)
+ ifi->sent_packet_length = BOOTP_MIN_LEN;
packet->op = BOOTREQUEST;
packet->htype = HTYPE_ETHER ;
{
struct client_state *client = ifi->client;
struct option_data options[256];
- struct dhcp_packet *packet = &client->sent_packet;
+ struct dhcp_packet *packet = &ifi->sent_packet;
unsigned char request = DHCPREQUEST;
int i;
i = cons_options(ifi, options);
if (i == -1 || packet->options[i] != DHO_END)
fatalx("options do not fit in DHCPREQUEST packet.");
- client->sent_packet_length = DHCP_FIXED_NON_UDP+i+1;
- if (client->sent_packet_length < BOOTP_MIN_LEN)
- client->sent_packet_length = BOOTP_MIN_LEN;
+ ifi->sent_packet_length = DHCP_FIXED_NON_UDP+i+1;
+ if (ifi->sent_packet_length < BOOTP_MIN_LEN)
+ ifi->sent_packet_length = BOOTP_MIN_LEN;
packet->op = BOOTREQUEST;
packet->htype = HTYPE_ETHER ;
{
struct client_state *client = ifi->client;
struct option_data options[256];
- struct dhcp_packet *packet = &client->sent_packet;
+ struct dhcp_packet *packet = &ifi->sent_packet;
unsigned char decline = DHCPDECLINE;
int i;
i = cons_options(ifi, options);
if (i == -1 || packet->options[i] != DHO_END)
fatalx("options do not fit in DHCPDECLINE packet.");
- client->sent_packet_length = DHCP_FIXED_NON_UDP+i+1;
- if (client->sent_packet_length < BOOTP_MIN_LEN)
- client->sent_packet_length = BOOTP_MIN_LEN;
+ ifi->sent_packet_length = DHCP_FIXED_NON_UDP+i+1;
+ if (ifi->sent_packet_length < BOOTP_MIN_LEN)
+ ifi->sent_packet_length = BOOTP_MIN_LEN;
packet->op = BOOTREQUEST;
packet->htype = HTYPE_ETHER ;
-/* $OpenBSD: options.c,v 1.89 2017/06/13 15:49:32 krw Exp $ */
+/* $OpenBSD: options.c,v 1.90 2017/06/14 15:57:25 krw Exp $ */
/* DHCP options parsing and reassembly. */
int
cons_options(struct interface_info *ifi, struct option_data *options)
{
- struct client_state *client = ifi->client;
- unsigned char *buf = client->sent_packet.options;
+ unsigned char *buf = ifi->sent_packet.options;
int buflen = 576 - DHCP_FIXED_LEN;
int ix, incr, length, bufix, code, lastopt = -1;
struct in_addr from, struct ether_addr *hfrom)
{
struct client_state *client = ifi->client;
- struct dhcp_packet *packet = &client->recv_packet;
+ struct dhcp_packet *packet = &ifi->recv_packet;
struct option_data options[256];
struct reject_elem *ap;
void (*handler)(struct interface_info *, struct in_addr,