-/* $OpenBSD: dhclient.c,v 1.458 2017/07/07 15:39:30 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.459 2017/07/07 16:58:45 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
}
/* Copy the lease options. */
- for (i = 0; i < 256; i++) {
+ for (i = 0; i < DHO_COUNT; i++) {
if (options[i].len == 0)
continue;
if (!unknown_ok && strncmp("option-",
void
make_discover(struct interface_info *ifi, struct client_lease *lease)
{
- struct option_data options[256];
+ struct option_data options[DHO_COUNT];
struct dhcp_packet *packet = &ifi->sent_packet;
unsigned char discover = DHCPDISCOVER;
int i;
ifi->requested_address.s_addr = INADDR_ANY;
/* Send any options requested in the config file. */
- for (i = 0; i < 256; i++)
+ for (i = 0; i < DHO_COUNT; i++)
if (!options[i].data &&
config->send_options[i].data) {
options[i].data = config->send_options[i].data;
void
make_request(struct interface_info *ifi, struct client_lease * lease)
{
- struct option_data options[256];
+ struct option_data options[DHO_COUNT];
struct dhcp_packet *packet = &ifi->sent_packet;
unsigned char request = DHCPREQUEST;
int i;
}
/* Send any options requested in the config file. */
- for (i = 0; i < 256; i++)
+ for (i = 0; i < DHO_COUNT; i++)
if (!options[i].data && config->send_options[i].data) {
options[i].data = config->send_options[i].data;
options[i].len = config->send_options[i].len;
void
make_decline(struct interface_info *ifi, struct client_lease *lease)
{
- struct option_data options[256];
+ struct option_data options[DHO_COUNT];
struct dhcp_packet *packet = &ifi->sent_packet;
unsigned char decline = DHCPDECLINE;
int i;
free(lease->server_name);
free(lease->filename);
free(lease->resolv_conf);
- for (i = 0; i < 256; i++)
+ for (i = 0; i < DHO_COUNT; i++)
free(lease->options[i].data);
free(lease);
append_statement(string, sizeof(string), " ssid ", buf);
}
- for (i = 0; i < 256; i++) {
+ for (i = 0; i < DHO_COUNT; i++) {
opt = &lease->options[i];
if (opt->len == 0)
continue;
if (config->next_server.s_addr != INADDR_ANY)
newlease->next_server.s_addr = config->next_server.s_addr;
- for (i = 0; i < 256; i++) {
+ for (i = 0; i < DHO_COUNT; i++) {
for (j = 0; j < config->ignored_option_count; j++) {
if (config->ignored_options[j] == i) {
free(newlease->options[i].data);
goto cleanup;
}
- for (i = 0; i < 256; i++) {
+ for (i = 0; i < DHO_COUNT; i++) {
if (oldlease->options[i].len == 0)
continue;
newlease->options[i].len = oldlease->options[i].len;
void
apply_ignore_list(char *ignore_list)
{
- u_int8_t list[256];
+ u_int8_t list[DHO_COUNT];
char *p;
int ix, i, j;
return (1);
}
- for (i = 0; i < 256; i++) {
+ for (i = 0; i < DHO_COUNT; i++) {
if (active->options[i].len != new->options[i].len)
return (1);
if (memcmp(active->options[i].data, new->options[i].data,
-/* $OpenBSD: dhcpd.h,v 1.206 2017/07/07 15:14:47 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.207 2017/07/07 16:58:45 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
char ssid[32];
uint8_t ssid_len;
unsigned int is_static;
- struct option_data options[256];
+ struct option_data options[DHO_COUNT];
};
#define BOOTP_LEASE(l) ((l)->options[DHO_DHCP_MESSAGE_TYPE].len == 0)
TAILQ_HEAD(client_lease_tq, client_lease);
struct client_config {
- struct option_data defaults[256];
+ struct option_data defaults[DHO_COUNT];
enum {
ACTION_DEFAULT,
ACTION_SUPERSEDE,
ACTION_PREPEND,
ACTION_APPEND
- } default_actions[256];
+ } default_actions[DHO_COUNT];
struct in_addr address;
struct in_addr next_server;
- struct option_data send_options[256];
- u_int8_t required_options[256];
- u_int8_t requested_options[256];
- u_int8_t ignored_options[256];
+ struct option_data send_options[DHO_COUNT];
+ u_int8_t required_options[DHO_COUNT];
+ u_int8_t requested_options[DHO_COUNT];
+ u_int8_t ignored_options[DHO_COUNT];
int requested_option_count;
int required_option_count;
int ignored_option_count;
void sendhup(void);
/* tables.c */
-extern const struct option dhcp_options[256];
+extern const struct option dhcp_options[DHO_COUNT];
/* dhclient.c */
extern char *path_dhclient_conf;