just whitespace
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
* ip - our ip
|
||||
* mac - our arp address
|
||||
* interface - interface to use
|
||||
* retn: 1 addr free
|
||||
* retn: 1 addr free
|
||||
* 0 addr used
|
||||
* -1 error
|
||||
*/
|
||||
@@ -33,7 +33,7 @@ int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface)
|
||||
{
|
||||
|
||||
int timeout = 2;
|
||||
int optval = 1;
|
||||
int optval = 1;
|
||||
int s; /* socket */
|
||||
int rv = 1; /* return value */
|
||||
struct sockaddr addr; /* for interface name */
|
||||
@@ -101,6 +101,6 @@ int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface)
|
||||
prevTime = uptime();
|
||||
}
|
||||
close(s);
|
||||
DEBUG(LOG_INFO, "%salid arp replies for this address", rv ? "No v" : "V");
|
||||
DEBUG(LOG_INFO, "%salid arp replies for this address", rv ? "No v" : "V");
|
||||
return rv;
|
||||
}
|
||||
|
@@ -205,8 +205,8 @@ int get_raw_packet(struct dhcpMessage *payload, int fd)
|
||||
packet.ip.ihl != sizeof(packet.ip) >> 2 || packet.udp.dest != htons(CLIENT_PORT) ||
|
||||
bytes > (int) sizeof(struct udp_dhcp_packet) ||
|
||||
ntohs(packet.udp.len) != (uint16_t) (bytes - sizeof(packet.ip))) {
|
||||
DEBUG(LOG_INFO, "unrelated/bogus packet");
|
||||
return -2;
|
||||
DEBUG(LOG_INFO, "unrelated/bogus packet");
|
||||
return -2;
|
||||
}
|
||||
|
||||
/* check IP checksum */
|
||||
|
@@ -43,7 +43,7 @@ long uptime(void);
|
||||
void background(const char *pidfile);
|
||||
void start_log_and_pid(const char *client_server, const char *pidfile);
|
||||
void udhcp_logging(int level, const char *fmt, ...);
|
||||
|
||||
|
||||
#define LOG(level, str, args...) udhcp_logging(level, str, ## args)
|
||||
|
||||
#ifdef UDHCP_DEBUG
|
||||
|
@@ -196,7 +196,7 @@ int main(int argc, char *argv[])
|
||||
{"hostname", required_argument, 0, 'h'},
|
||||
{"fqdn", required_argument, 0, 'F'},
|
||||
{"interface", required_argument, 0, 'i'},
|
||||
{"now", no_argument, 0, 'n'},
|
||||
{"now", no_argument, 0, 'n'},
|
||||
{"pidfile", required_argument, 0, 'p'},
|
||||
{"quit", no_argument, 0, 'q'},
|
||||
{"request", required_argument, 0, 'r'},
|
||||
@@ -314,7 +314,7 @@ int main(int argc, char *argv[])
|
||||
client_config.vendorclass[OPT_CODE] = DHCP_VENDOR;
|
||||
client_config.vendorclass[OPT_LEN] = sizeof("udhcp "VERSION) - 1;
|
||||
client_config.vendorclass[OPT_DATA] = 1;
|
||||
memcpy(&client_config.vendorclass[OPT_DATA],
|
||||
memcpy(&client_config.vendorclass[OPT_DATA],
|
||||
"udhcp "VERSION, sizeof("udhcp "VERSION) - 1);
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ int main(int argc, char *argv[])
|
||||
} else if (client_config.abort_if_no_lease) {
|
||||
LOG(LOG_INFO, "No lease, failing.");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/* wait to try again */
|
||||
packet_num = 0;
|
||||
timeout = now + 60;
|
||||
|
@@ -193,7 +193,7 @@ int main(int argc, char *argv[])
|
||||
LOG(LOG_ERR, "send OFFER failed");
|
||||
}
|
||||
break;
|
||||
case DHCPREQUEST:
|
||||
case DHCPREQUEST:
|
||||
DEBUG(LOG_INFO, "received REQUEST");
|
||||
|
||||
requested = get_option(&packet, DHCP_REQUESTED_IP);
|
||||
|
@@ -108,23 +108,23 @@ struct static_lease {
|
||||
|
||||
struct server_config_t {
|
||||
uint32_t server; /* Our IP, in network order */
|
||||
uint32_t start; /* Start address of leases, network order */
|
||||
uint32_t start; /* Start address of leases, network order */
|
||||
uint32_t end; /* End of leases, network order */
|
||||
struct option_set *options; /* List of DHCP options loaded from the config file */
|
||||
char *interface; /* The name of the interface to use */
|
||||
int ifindex; /* Index number of the interface to use */
|
||||
uint8_t arp[6]; /* Our arp address */
|
||||
uint8_t arp[6]; /* Our arp address */
|
||||
unsigned long lease; /* lease time in seconds (host order) */
|
||||
unsigned long max_leases; /* maximum number of leases (including reserved address) */
|
||||
char remaining; /* should the lease file be interpreted as lease time remaining, or
|
||||
* as the time the lease expires */
|
||||
unsigned long auto_time; /* how long should udhcpd wait before writing a config file.
|
||||
unsigned long max_leases; /* maximum number of leases (including reserved address) */
|
||||
char remaining; /* should the lease file be interpreted as lease time remaining, or
|
||||
* as the time the lease expires */
|
||||
unsigned long auto_time; /* how long should udhcpd wait before writing a config file.
|
||||
* if this is zero, it will only write one on SIGUSR1 */
|
||||
unsigned long decline_time; /* how long an address is reserved if a client returns a
|
||||
* decline message */
|
||||
unsigned long conflict_time; /* how long an arp conflict offender is leased for */
|
||||
unsigned long offer_time; /* how long an offered address is reserved */
|
||||
unsigned long min_lease; /* minimum lease a client can request*/
|
||||
unsigned long decline_time; /* how long an address is reserved if a client returns a
|
||||
* decline message */
|
||||
unsigned long conflict_time; /* how long an arp conflict offender is leased for */
|
||||
unsigned long offer_time; /* how long an offered address is reserved */
|
||||
unsigned long min_lease; /* minimum lease a client can request*/
|
||||
char *lease_file;
|
||||
char *pidfile;
|
||||
char *notify_file; /* What to run whenever leases are written */
|
||||
|
@@ -271,7 +271,7 @@ static const struct config_keyword keywords[] = {
|
||||
{"boot_file", read_str, &(server_config.boot_file), ""},
|
||||
{"static_lease",read_staticlease, &(server_config.static_leases), ""},
|
||||
/*ADDME: static lease */
|
||||
{"", NULL, NULL, ""}
|
||||
{"", NULL, NULL, ""}
|
||||
};
|
||||
|
||||
|
||||
|
@@ -148,7 +148,7 @@ uint32_t find_address(int check_expired)
|
||||
(check_expired && lease_expired(lease))) &&
|
||||
|
||||
/* and it isn't on the network */
|
||||
!check_ip(ret)) {
|
||||
!check_ip(ret)) {
|
||||
return ret;
|
||||
break;
|
||||
}
|
||||
|
@@ -29,19 +29,19 @@
|
||||
|
||||
/* make safe the exported namespace */
|
||||
/* from common.h */
|
||||
#define background udhcp_background
|
||||
#define start_log_and_pid udhcp_start_log_and_pid
|
||||
#define background udhcp_background
|
||||
#define start_log_and_pid udhcp_start_log_and_pid
|
||||
/* from script.h */
|
||||
#define run_script udhcp_run_script
|
||||
#define run_script udhcp_run_script
|
||||
/* from packet.h */
|
||||
#define init_header udhcp_init_header
|
||||
#define get_packet udhcp_get_packet
|
||||
#define checksum udhcp_checksum
|
||||
#define raw_packet udhcp_raw_packet
|
||||
#define kernel_packet udhcp_kernel_packet
|
||||
#define init_header udhcp_init_header
|
||||
#define get_packet udhcp_get_packet
|
||||
#define checksum udhcp_checksum
|
||||
#define raw_packet udhcp_raw_packet
|
||||
#define kernel_packet udhcp_kernel_packet
|
||||
/* from pidfile.h */
|
||||
#define pidfile_acquire udhcp_pidfile_acquire
|
||||
#define pidfile_write_release udhcp_pidfile_write_release
|
||||
#define pidfile_acquire udhcp_pidfile_acquire
|
||||
#define pidfile_write_release udhcp_pidfile_write_release
|
||||
/* from options.h */
|
||||
#define get_option udhcp_get_option
|
||||
#define end_option udhcp_end_option
|
||||
|
@@ -154,11 +154,11 @@ int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data)
|
||||
for (dh=dhcp_options; dh->code; dh++) {
|
||||
if (dh->code == code) {
|
||||
uint8_t option[6], len;
|
||||
|
||||
|
||||
option[OPT_CODE] = code;
|
||||
len = option_lengths[dh->flags & TYPE_MASK];
|
||||
option[OPT_LEN] = len;
|
||||
if (__BYTE_ORDER == __BIG_ENDIAN)
|
||||
if (__BYTE_ORDER == __BIG_ENDIAN)
|
||||
data <<= 8 * (4 - len);
|
||||
/* This memcpy is for broken processors which can't
|
||||
* handle a simple unaligned 32-bit assignment */
|
||||
|
@@ -71,13 +71,13 @@ int get_packet(struct dhcpMessage *packet, int fd)
|
||||
for (i = 0; broken_vendors[i][0]; i++) {
|
||||
if (vendor[OPT_LEN - 2] == (uint8_t) strlen(broken_vendors[i]) &&
|
||||
!strncmp(vendor, broken_vendors[i], vendor[OPT_LEN - 2])) {
|
||||
DEBUG(LOG_INFO, "broken client (%s), forcing broadcast",
|
||||
broken_vendors[i]);
|
||||
packet->flags |= htons(BROADCAST_FLAG);
|
||||
DEBUG(LOG_INFO, "broken client (%s), forcing broadcast",
|
||||
broken_vendors[i]);
|
||||
packet->flags |= htons(BROADCAST_FLAG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
@@ -97,7 +97,7 @@ static void fill_options(char *dest, uint8_t *option, struct dhcp_option *type_p
|
||||
optlen = 4;
|
||||
case OPTION_IP: /* Works regardless of host byte order. */
|
||||
dest += sprintip(dest, "", option);
|
||||
break;
|
||||
break;
|
||||
case OPTION_BOOLEAN:
|
||||
dest += sprintf(dest, *option ? "yes" : "no");
|
||||
break;
|
||||
|
@@ -138,11 +138,11 @@ int sendOffer(struct dhcpMessage *oldpacket)
|
||||
/* and the ip is in the lease range */
|
||||
ntohl(req_align) >= ntohl(server_config.start) &&
|
||||
ntohl(req_align) <= ntohl(server_config.end) &&
|
||||
|
||||
|
||||
!static_lease_ip && /* Check that its not a static lease */
|
||||
/* and is not already taken/offered */
|
||||
((!(lease = find_lease_by_yiaddr(req_align)) ||
|
||||
|
||||
|
||||
/* or its taken, but expired */ /* ADDME: or maybe in here */
|
||||
lease_expired(lease)))) {
|
||||
packet.yiaddr = req_align; /* FIXME: oh my, is there a host using this IP? */
|
||||
|
Reference in New Issue
Block a user