summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2009-06-16 12:05:21 +0200
committerDenys Vlasenko2009-06-16 12:05:21 +0200
commited8982bfc0e9895fe707a5f6152cf184e06f2052 (patch)
treeff08bef8b550e5503cf54eb8f7fdd7e5f37875f5
parent26918dd28ef6f2c6380ed23b384ddc8e98a8ad81 (diff)
downloadbusybox-ed8982bfc0e9895fe707a5f6152cf184e06f2052.zip
busybox-ed8982bfc0e9895fe707a5f6152cf184e06f2052.tar.gz
udhcp: add a few TODOs
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/udhcp/Config.in3
-rw-r--r--networking/udhcp/common.h2
-rw-r--r--networking/udhcp/dhcpd.h4
-rw-r--r--networking/udhcp/leases.c4
4 files changed, 11 insertions, 2 deletions
diff --git a/networking/udhcp/Config.in b/networking/udhcp/Config.in
index d4b76e1..495b079 100644
--- a/networking/udhcp/Config.in
+++ b/networking/udhcp/Config.in
@@ -74,6 +74,9 @@ config FEATURE_UDHCP_PORT
At the cost of ~300 bytes, enables -P port option.
This feature is typically not needed.
+# TODO: UDHCP_DEBUG is inconvenient to use.
+# Make it controllable at runtime (say, via -v, -vv, -vvv)
+
config UDHCP_DEBUG
bool "Compile udhcp with noisy debugging messages"
default n
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index 91e8ccc..0f12be0 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -23,6 +23,7 @@ extern const uint8_t MAC_BCAST_ADDR[6]; /* six all-ones */
#define DHCP_OPTIONS_BUFSIZE 308
+//TODO: rename to dhcp_packet; rename ciaddr/yiaddr/chaddr
struct dhcpMessage {
uint8_t op; /* 1 = BOOTREQUEST, 2 = BOOTREPLY */
uint8_t htype; /* hardware address type. 1 = 10mb ethernet */
@@ -44,6 +45,7 @@ struct dhcpMessage {
uint8_t options[DHCP_OPTIONS_BUFSIZE + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS];
} PACKED;
+//TODO: rename to ip_udp_dhcp_packet?
struct udp_dhcp_packet {
struct iphdr ip;
struct udphdr udp;
diff --git a/networking/udhcp/dhcpd.h b/networking/udhcp/dhcpd.h
index b233962..bb2febb 100644
--- a/networking/udhcp/dhcpd.h
+++ b/networking/udhcp/dhcpd.h
@@ -78,6 +78,10 @@ struct server_config_t {
typedef uint32_t leasetime_t;
typedef int32_t signed_leasetime_t;
+//TODO: (1) rename to dyn_lease (that's what it is. we also have static_lease).
+//(2) lease_mac16 may be shortened to lease_mac[6], since e.g. ARP probing uses
+//only 6 first bytes anyway. We can check received dhcp packets
+//that their "chaddr"s have only 6 first bytes != 0, and complain otherwise.
struct dhcpOfferedAddr {
uint8_t lease_mac16[16];
/* "nip": IP in network order */
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c
index 291ae80..06bc086 100644
--- a/networking/udhcp/leases.c
+++ b/networking/udhcp/leases.c
@@ -22,7 +22,7 @@ static struct dhcpOfferedAddr *oldest_expired_lease(void)
for (i = 0; i < server_config.max_leases; i++) {
if (leases[i].expires < oldest_time) {
oldest_time = leases[i].expires;
- oldest_lease = &(leases[i]);
+ oldest_lease = &leases[i];
}
}
return oldest_lease;
@@ -142,7 +142,7 @@ static int nobody_responds_to_arp(uint32_t addr, const uint8_t *safe_mac)
}
-/* Find a new usable (we think) address. */
+/* Find a new usable (we think) address */
uint32_t FAST_FUNC find_free_or_expired_address(const uint8_t *chaddr)
{
uint32_t addr;