aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/clientpacket.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/clientpacket.c')
-rw-r--r--networking/udhcp/clientpacket.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c
index 1ab17321d..3f9522ff8 100644
--- a/networking/udhcp/clientpacket.c
+++ b/networking/udhcp/clientpacket.c
@@ -78,6 +78,23 @@ static void add_param_req_option(struct dhcpMessage *packet)
78 } 78 }
79} 79}
80 80
81/* RFC 2131
82 * 4.4.4 Use of broadcast and unicast
83 *
84 * The DHCP client broadcasts DHCPDISCOVER, DHCPREQUEST and DHCPINFORM
85 * messages, unless the client knows the address of a DHCP server.
86 * The client unicasts DHCPRELEASE messages to the server. Because
87 * the client is declining the use of the IP address supplied by the server,
88 * the client broadcasts DHCPDECLINE messages.
89 *
90 * When the DHCP client knows the address of a DHCP server, in either
91 * INIT or REBOOTING state, the client may use that address
92 * in the DHCPDISCOVER or DHCPREQUEST rather than the IP broadcast address.
93 * The client may also use unicast to send DHCPINFORM messages
94 * to a known DHCP server. If the client receives no response to DHCP
95 * messages sent to the IP address of a known DHCP server, the DHCP
96 * client reverts to using the IP broadcast address.
97 */
81 98
82static int raw_bcast_from_client_config_ifindex(struct dhcpMessage *packet) 99static int raw_bcast_from_client_config_ifindex(struct dhcpMessage *packet)
83{ 100{
@@ -90,7 +107,6 @@ static int raw_bcast_from_client_config_ifindex(struct dhcpMessage *packet)
90 107
91#if ENABLE_FEATURE_UDHCPC_ARPING 108#if ENABLE_FEATURE_UDHCPC_ARPING
92/* Broadcast a DHCP decline message */ 109/* Broadcast a DHCP decline message */
93//FIXME: maybe it should be unicast?
94int FAST_FUNC send_decline(uint32_t xid, uint32_t server, uint32_t requested) 110int FAST_FUNC send_decline(uint32_t xid, uint32_t server, uint32_t requested)
95{ 111{
96 struct dhcpMessage packet; 112 struct dhcpMessage packet;
@@ -128,7 +144,9 @@ int FAST_FUNC send_discover(uint32_t xid, uint32_t requested)
128 144
129 145
130/* Broadcasts a DHCP request message */ 146/* Broadcasts a DHCP request message */
131//FIXME: maybe it should be unicast? 147/* RFC 2131 3.1 paragraph 3:
148 * "The client _broadcasts_ a DHCPREQUEST message..."
149 */
132int FAST_FUNC send_select(uint32_t xid, uint32_t server, uint32_t requested) 150int FAST_FUNC send_select(uint32_t xid, uint32_t server, uint32_t requested)
133{ 151{
134 struct dhcpMessage packet; 152 struct dhcpMessage packet;