summaryrefslogtreecommitdiff
path: root/networking/udhcp/clientpacket.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-09-26 16:29:12 +0000
committerDenis Vlasenko2008-09-26 16:29:12 +0000
commitc321b51dc61f975625a0bfc67cf159f159ee2612 (patch)
tree3a857514e6779c4c00bf157ff29cfa24d5828e1a /networking/udhcp/clientpacket.c
parent1a89133caf043d553d866cd6e707e687e914a013 (diff)
downloadbusybox-c321b51dc61f975625a0bfc67cf159f159ee2612.zip
busybox-c321b51dc61f975625a0bfc67cf159f159ee2612.tar.gz
udhcp: added some FIXMEs; code shrink. -49 bytes
Diffstat (limited to 'networking/udhcp/clientpacket.c')
-rw-r--r--networking/udhcp/clientpacket.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c
index 77331d9..1ab1732 100644
--- a/networking/udhcp/clientpacket.c
+++ b/networking/udhcp/clientpacket.c
@@ -79,8 +79,18 @@ static void add_param_req_option(struct dhcpMessage *packet)
}
+static int raw_bcast_from_client_config_ifindex(struct dhcpMessage *packet)
+{
+ return udhcp_send_raw_packet(packet,
+ /*src*/ INADDR_ANY, CLIENT_PORT,
+ /*dst*/ INADDR_BROADCAST, SERVER_PORT, MAC_BCAST_ADDR,
+ client_config.ifindex);
+}
+
+
#if ENABLE_FEATURE_UDHCPC_ARPING
-/* Unicast a DHCP decline message */
+/* Broadcast a DHCP decline message */
+//FIXME: maybe it should be unicast?
int FAST_FUNC send_decline(uint32_t xid, uint32_t server, uint32_t requested)
{
struct dhcpMessage packet;
@@ -92,8 +102,7 @@ int FAST_FUNC send_decline(uint32_t xid, uint32_t server, uint32_t requested)
bb_info_msg("Sending decline...");
- return udhcp_send_raw_packet(&packet, INADDR_ANY, CLIENT_PORT, INADDR_BROADCAST,
- SERVER_PORT, MAC_BCAST_ADDR, client_config.ifindex);
+ return raw_bcast_from_client_config_ifindex(&packet);
}
#endif
@@ -114,13 +123,13 @@ int FAST_FUNC send_discover(uint32_t xid, uint32_t requested)
add_param_req_option(&packet);
bb_info_msg("Sending discover...");
- return udhcp_send_raw_packet(&packet, INADDR_ANY, CLIENT_PORT, INADDR_BROADCAST,
- SERVER_PORT, MAC_BCAST_ADDR, client_config.ifindex);
+ return raw_bcast_from_client_config_ifindex(&packet);
}
/* Broadcasts a DHCP request message */
-int FAST_FUNC send_selecting(uint32_t xid, uint32_t server, uint32_t requested)
+//FIXME: maybe it should be unicast?
+int FAST_FUNC send_select(uint32_t xid, uint32_t server, uint32_t requested)
{
struct dhcpMessage packet;
struct in_addr addr;
@@ -134,8 +143,7 @@ int FAST_FUNC send_selecting(uint32_t xid, uint32_t server, uint32_t requested)
addr.s_addr = requested;
bb_info_msg("Sending select for %s...", inet_ntoa(addr));
- return udhcp_send_raw_packet(&packet, INADDR_ANY, CLIENT_PORT, INADDR_BROADCAST,
- SERVER_PORT, MAC_BCAST_ADDR, client_config.ifindex);
+ return raw_bcast_from_client_config_ifindex(&packet);
}
@@ -151,10 +159,11 @@ int FAST_FUNC send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr)
add_param_req_option(&packet);
bb_info_msg("Sending renew...");
if (server)
- return udhcp_send_kernel_packet(&packet, ciaddr, CLIENT_PORT, server, SERVER_PORT);
+ return udhcp_send_kernel_packet(&packet,
+ ciaddr, CLIENT_PORT,
+ server, SERVER_PORT);
- return udhcp_send_raw_packet(&packet, INADDR_ANY, CLIENT_PORT, INADDR_BROADCAST,
- SERVER_PORT, MAC_BCAST_ADDR, client_config.ifindex);
+ return raw_bcast_from_client_config_ifindex(&packet);
}