summaryrefslogtreecommitdiff
path: root/networking/udhcp/dhcprelay.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-08-02 22:31:05 +0000
committerDenis Vlasenko2007-08-02 22:31:05 +0000
commit80edead5ea731c0c144def4d249eb88fb16001ef (patch)
tree1aca5341f9b412edd03f9edf32ea5f649a2bf242 /networking/udhcp/dhcprelay.c
parentc01af95c398b21203cd991917101e29b21821284 (diff)
downloadbusybox-80edead5ea731c0c144def4d249eb88fb16001ef.zip
busybox-80edead5ea731c0c144def4d249eb88fb16001ef.tar.gz
udhcp: slight shrink
udhcpd_main 1171 1208 +37 udhcpc_main 2363 2387 +24 dhcprelay_main 1145 1146 +1 dhcprelay_stopflag 4 1 -3 dhcprelay_signal_handler 11 8 -3 client_background 46 42 -4 udhcp_read_interface 230 211 -19 udhcp_make_pidfile 76 - -76 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 3/4 up/down: 62/-105) Total: -43 bytes text data bss dec hex filename 770052 1096 11228 782376 bf028 busybox_old 769980 1096 11228 782304 befe0 busybox_unstripped
Diffstat (limited to 'networking/udhcp/dhcprelay.c')
-rw-r--r--networking/udhcp/dhcprelay.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c
index 9bb7aea..4ed65a2 100644
--- a/networking/udhcp/dhcprelay.c
+++ b/networking/udhcp/dhcprelay.c
@@ -30,7 +30,7 @@ static struct xid_item {
} dhcprelay_xid_list = {0, {0}, 0, 0, NULL};
-static struct xid_item * xid_add(uint32_t xid, struct sockaddr_in *ip, int client)
+static struct xid_item *xid_add(uint32_t xid, struct sockaddr_in *ip, int client)
{
struct xid_item *item;
@@ -48,7 +48,6 @@ static struct xid_item * xid_add(uint32_t xid, struct sockaddr_in *ip, int clien
return item;
}
-
static void xid_expire(void)
{
struct xid_item *item = dhcprelay_xid_list.next;
@@ -56,7 +55,7 @@ static void xid_expire(void)
time_t current_time = time(NULL);
while (item != NULL) {
- if ((current_time-item->timestamp) > MAX_LIFETIME) {
+ if ((current_time - item->timestamp) > MAX_LIFETIME) {
last->next = item->next;
free(item);
item = last->next;
@@ -67,7 +66,7 @@ static void xid_expire(void)
}
}
-static struct xid_item * xid_find(uint32_t xid)
+static struct xid_item *xid_find(uint32_t xid)
{
struct xid_item *item = dhcprelay_xid_list.next;
while (item != NULL) {
@@ -95,7 +94,6 @@ static void xid_del(uint32_t xid)
}
}
-
/**
* get_dhcp_packet_type - gets the message type of a dhcp packet
* p - pointer to the dhcp packet
@@ -119,7 +117,8 @@ static int get_dhcp_packet_type(struct dhcpMessage *p)
* signal_handler - handles signals ;-)
* sig - sent signal
*/
-static int dhcprelay_stopflag;
+static smallint dhcprelay_stopflag;
+
static void dhcprelay_signal_handler(int sig)
{
dhcprelay_stopflag = 1;
@@ -130,7 +129,7 @@ static void dhcprelay_signal_handler(int sig)
* dev_list - comma separated list of devices
* returns array
*/
-static char ** get_client_devices(char *dev_list, int *client_number)
+static char **get_client_devices(char *dev_list, int *client_number)
{
char *s, *list, **client_dev;
int i, cn;
@@ -286,7 +285,7 @@ static void dhcprelay_loop(int *fds, int num_sockets, int max_socket, char **cli
(struct sockaddr *)(&client_addr), &addr_size);
if (packlen <= 0)
continue;
- if (read_interface(clients[i-1], NULL, &dhcp_msg.giaddr, NULL) < 0)
+ if (read_interface(clients[i-1], NULL, &dhcp_msg.giaddr, NULL))
dhcp_msg.giaddr = gw_ip;
pass_on(&dhcp_msg, packlen, i, fds, &client_addr, server_addr);
}
@@ -322,7 +321,7 @@ int dhcprelay_main(int argc, char **argv)
num_sockets = init_sockets(clients, num_sockets, argv[2], fds, &max_socket);
- if (read_interface(argv[2], NULL, &gw_ip, NULL) == -1)
+ if (read_interface(argv[2], NULL, &gw_ip, NULL))
return 1;
dhcprelay_loop(fds, num_sockets, max_socket, clients, &server_addr, gw_ip);