aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-10-21 12:33:10 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2010-10-21 12:33:10 +0200
commit0bb35e19a73ecbb9694172300a5530dbb8156bb4 (patch)
treea6f0e38398ffaf4db6bfab8ce97584359dbc3f83 /networking/udhcp
parent08187356d7f6a79d5fb4aa83b90476997e585ad3 (diff)
downloadbusybox-0bb35e19a73ecbb9694172300a5530dbb8156bb4.tar.gz
udhcpd: reduce stack usage by ~700 bytes. +28 bytes code size
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'networking/udhcp')
-rw-r--r--networking/udhcp/dhcpc.c7
-rw-r--r--networking/udhcp/dhcpd.c12
2 files changed, 14 insertions, 5 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index cef0ab957..78aabedf2 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -432,6 +432,7 @@ static int raw_bcast_from_client_config_ifindex(struct dhcp_packet *packet)
}
/* Broadcast a DHCP discover packet to the network, with an optionally requested IP */
+/* NOINLINE: limit stack usage in caller */
static NOINLINE int send_discover(uint32_t xid, uint32_t requested)
{
struct dhcp_packet packet;
@@ -460,6 +461,7 @@ static NOINLINE int send_discover(uint32_t xid, uint32_t requested)
/* RFC 2131 3.1 paragraph 3:
* "The client _broadcasts_ a DHCPREQUEST message..."
*/
+/* NOINLINE: limit stack usage in caller */
static NOINLINE int send_select(uint32_t xid, uint32_t server, uint32_t requested)
{
struct dhcp_packet packet;
@@ -500,7 +502,8 @@ static NOINLINE int send_select(uint32_t xid, uint32_t server, uint32_t requeste
}
/* Unicast or broadcast a DHCP renew message */
-static int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr)
+/* NOINLINE: limit stack usage in caller */
+static NOINLINE int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr)
{
struct dhcp_packet packet;
@@ -543,6 +546,7 @@ static int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr)
#if ENABLE_FEATURE_UDHCPC_ARPING
/* Broadcast a DHCP decline message */
+/* NOINLINE: limit stack usage in caller */
static NOINLINE int send_decline(uint32_t xid, uint32_t server, uint32_t requested)
{
struct dhcp_packet packet;
@@ -588,6 +592,7 @@ static int send_release(uint32_t server, uint32_t ciaddr)
}
/* Returns -1 on errors that are fatal for the socket, -2 for those that aren't */
+/* NOINLINE: limit stack usage in caller */
static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
{
int bytes;
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index 043220de9..f0878652c 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -132,7 +132,8 @@ static uint32_t select_lease_time(struct dhcp_packet *packet)
}
/* We got a DHCP DISCOVER. Send an OFFER. */
-static void send_offer(struct dhcp_packet *oldpacket, uint32_t static_lease_nip, struct dyn_lease *lease)
+/* NOINLINE: limit stack usage in caller */
+static NOINLINE void send_offer(struct dhcp_packet *oldpacket, uint32_t static_lease_nip, struct dyn_lease *lease)
{
struct dhcp_packet packet;
uint32_t lease_time_sec;
@@ -202,7 +203,8 @@ static void send_offer(struct dhcp_packet *oldpacket, uint32_t static_lease_nip,
send_packet(&packet, /*force_bcast:*/ 0);
}
-static void send_NAK(struct dhcp_packet *oldpacket)
+/* NOINLINE: limit stack usage in caller */
+static NOINLINE void send_NAK(struct dhcp_packet *oldpacket)
{
struct dhcp_packet packet;
@@ -212,7 +214,8 @@ static void send_NAK(struct dhcp_packet *oldpacket)
send_packet(&packet, /*force_bcast:*/ 1);
}
-static void send_ACK(struct dhcp_packet *oldpacket, uint32_t yiaddr)
+/* NOINLINE: limit stack usage in caller */
+static NOINLINE void send_ACK(struct dhcp_packet *oldpacket, uint32_t yiaddr)
{
struct dhcp_packet packet;
uint32_t lease_time_sec;
@@ -243,7 +246,8 @@ static void send_ACK(struct dhcp_packet *oldpacket, uint32_t yiaddr)
}
}
-static void send_inform(struct dhcp_packet *oldpacket)
+/* NOINLINE: limit stack usage in caller */
+static NOINLINE void send_inform(struct dhcp_packet *oldpacket)
{
struct dhcp_packet packet;