udhcp: add inline docs; small code shrink

function                                             old     new   delta
send_packet                                          103      87     -16
udhcpc_main                                         2359    2323     -36
This commit is contained in:
Denis Vlasenko
2008-09-26 23:45:20 +00:00
parent 7d9399e8dc
commit 739e30fbc3
6 changed files with 64 additions and 41 deletions

View File

@@ -18,12 +18,12 @@
void FAST_FUNC udhcp_init_header(struct dhcpMessage *packet, char type)
{
memset(packet, 0, sizeof(struct dhcpMessage));
packet->op = BOOTREQUEST;
packet->op = BOOTREQUEST; /* if client to a server */
switch (type) {
case DHCPOFFER:
case DHCPACK:
case DHCPNAK:
packet->op = BOOTREPLY;
packet->op = BOOTREPLY; /* if server to client */
}
packet->htype = ETH_10MB;
packet->hlen = ETH_10MB_LEN;
@@ -65,7 +65,7 @@ int FAST_FUNC udhcp_recv_kernel_packet(struct dhcpMessage *packet, int fd)
if (vendor[OPT_LEN - 2] == (uint8_t)strlen(broken_vendors[i])
&& !strncmp((char*)vendor, broken_vendors[i], vendor[OPT_LEN - 2])
) {
DEBUG("broken client (%s), forcing broadcast",
DEBUG("broken client (%s), forcing broadcast replies",
broken_vendors[i]);
packet->flags |= htons(BROADCAST_FLAG);
}
@@ -74,7 +74,7 @@ int FAST_FUNC udhcp_recv_kernel_packet(struct dhcpMessage *packet, int fd)
if (vendor[OPT_LEN - 2] == (uint8_t)(sizeof("MSFT 98")-1)
&& memcmp(vendor, "MSFT 98", sizeof("MSFT 98")-1) == 0
) {
DEBUG("broken client (%s), forcing broadcast", "MSFT 98");
DEBUG("broken client (%s), forcing broadcast replies", "MSFT 98");
packet->flags |= htons(BROADCAST_FLAG);
}
#endif