diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-17 23:40:26 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-17 23:40:26 +0000 |
commit | bd7bb299c0e9ee5ff52c9d12b46fb14a907b34da (patch) | |
tree | 117a635e9457e1a932bc64941db5869e33179fc9 /networking/udhcp | |
parent | 459be35234cc24b69309eb0ee22600024c73713e (diff) | |
download | busybox-w32-bd7bb299c0e9ee5ff52c9d12b46fb14a907b34da.tar.gz busybox-w32-bd7bb299c0e9ee5ff52c9d12b46fb14a907b34da.tar.bz2 busybox-w32-bd7bb299c0e9ee5ff52c9d12b46fb14a907b34da.zip |
wget: use monotonic_sec instead of gettimeofday
zcip: use monotonic_us instead of gettimeofday
udhcpcd: simpler, shorter random_xid()
function old new delta
monotonic_sec - 41 +41
find_pair 164 180 +16
run_list_real 2018 2028 +10
cmp_main 547 555 +8
collect_ctx 112 119 +7
singlemount 4544 4549 +5
time_main 1124 1128 +4
static.start_sec - 4 +4
static.lastupdate_sec - 4 +4
sock - 4 +4
read_package_field 253 257 +4
pick 38 40 +2
get_next_line 145 147 +2
count_lines 59 61 +2
process_stdin 435 433 -2
xstrtoul_range_sfx 229 226 -3
static.initialized 4 1 -3
dhcprelay_main 1125 1122 -3
catcher 380 377 -3
arping_main 1969 1966 -3
s 8 4 -4
cfg 4 - -4
static.lastupdate 8 - -8
start 8 - -8
random_xid 95 33 -62
.rodata 129114 129050 -64
zcip_main 1731 1576 -155
progressmeter 1035 867 -168
------------------------------------------------------------------------------
(add/remove: 4/3 grow/shrink: 10/11 up/down: 113/-490) Total: -377 bytes
Diffstat (limited to 'networking/udhcp')
-rw-r--r-- | networking/udhcp/clientpacket.c | 16 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.h | 2 |
2 files changed, 6 insertions, 12 deletions
diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c index 69d7f2d38..af97962a0 100644 --- a/networking/udhcp/clientpacket.c +++ b/networking/udhcp/clientpacket.c | |||
@@ -25,19 +25,13 @@ | |||
25 | 25 | ||
26 | 26 | ||
27 | /* Create a random xid */ | 27 | /* Create a random xid */ |
28 | unsigned long random_xid(void) | 28 | unsigned random_xid(void) |
29 | { | 29 | { |
30 | static int initialized; | 30 | static smallint initialized; |
31 | |||
31 | if (!initialized) { | 32 | if (!initialized) { |
32 | unsigned long seed; | 33 | srand(monotonic_us()); |
33 | 34 | initialized = 1; | |
34 | if (open_read_close("/dev/urandom", &seed, sizeof(seed)) < 0) { | ||
35 | bb_info_msg("Cannot load seed " | ||
36 | "from /dev/urandom: %s", strerror(errno)); | ||
37 | seed = time(0); | ||
38 | } | ||
39 | srand(seed); | ||
40 | initialized++; | ||
41 | } | 35 | } |
42 | return rand(); | 36 | return rand(); |
43 | } | 37 | } |
diff --git a/networking/udhcp/dhcpc.h b/networking/udhcp/dhcpc.h index 4ddd12120..fa091bf72 100644 --- a/networking/udhcp/dhcpc.h +++ b/networking/udhcp/dhcpc.h | |||
@@ -38,7 +38,7 @@ extern struct client_config_t client_config; | |||
38 | 38 | ||
39 | /*** clientpacket.h ***/ | 39 | /*** clientpacket.h ***/ |
40 | 40 | ||
41 | unsigned long random_xid(void); | 41 | unsigned random_xid(void); |
42 | int send_discover(unsigned long xid, unsigned long requested); | 42 | int send_discover(unsigned long xid, unsigned long requested); |
43 | int send_selecting(unsigned long xid, unsigned long server, unsigned long requested); | 43 | int send_selecting(unsigned long xid, unsigned long server, unsigned long requested); |
44 | int send_renew(unsigned long xid, unsigned long server, unsigned long ciaddr); | 44 | int send_renew(unsigned long xid, unsigned long server, unsigned long ciaddr); |