Commit Graph

62 Commits

Author SHA1 Message Date
Denys Vlasenko
9107b63a7f udhcp: abort if we see unknown option, and show valid options if so
function                                             old     new   delta
udhcp_option_idx                                       -      77     +77
udhcp_str2optset                                     366     351     -15
udhcpc_main                                         2845    2801     -44
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 77/-59)             Total: 18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-27 23:23:41 +01:00
Denys Vlasenko
385b4562e3 udhcp: cosmetic cleanups; one case of s/full_read/xread/
function                                             old     new   delta
dumpleases_main                                      632     623      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 10:09:34 +01:00
Denys Vlasenko
7724c766bd udhcp: pass pointer to whole packet to "add option" functions
This is needed for "overflow option" support

function                                             old     new   delta
udhcp_find_option                                      -      34     +34
udhcp_add_binary_option                               94     106     +12
write_leases                                         227     223      -4
udhcp_init_header                                     86      82      -4
send_release                                         104      99      -5
init_packet                                           87      81      -6
add_client_options                                   160     154      -6
add_server_options                                   100      92      -8
udhcpd_main                                         1964    1954     -10
udhcpc_main                                         2859    2837     -22
find_option                                           34       -     -34
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/8 up/down: 46/-99)            Total: -53 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 09:32:09 +01:00
Denys Vlasenko
a8f6b99987 udhcp: move options.c to common.c; disable unused bool and s16 option code
function                                             old     new   delta
udhcp_add_binary_option                                -      94     +94
udhcp_str2nip                                          -      42     +42
len_of_option_as_string                               12      10      -2
dhcp_option_lengths                                   12      10      -2
udhcpc_main                                         2859    2851      -8
read_nip                                              42       -     -42
xmalloc_optname_optval                               590     536     -54
udhcp_str2optset                                     443     366     -77
udhcp_add_option_string                               86       -     -86
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 0/5 up/down: 136/-271)         Total: -135 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 08:35:24 +01:00
Denys Vlasenko
7e6add1dfc udhcpc: add -x OPT:VAL option
function                                             old     new   delta
udhcp_str2optset                                       -     443    +443
add_client_options                                     -     160    +160
udhcpc_main                                         2753    2857    +104
packed_usage                                       26670   26689     +19
attach_option                                        380     385      +5
udhcpd_main                                         1964    1965      +1
udhcp_add_option_string                               94      86      -8
add_param_req_option                                 128       -    -128
read_opt                                             443       -    -443
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 4/1 up/down: 732/-579)          Total: 153 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-25 20:32:38 +01:00
Denys Vlasenko
37a658c4c8 udhcp: handle errors in read_staticlease
also gets rid of ether-aton's static buffer in ether-wake:
   text   data    bss    dec    hexfilename
 838664    441   7572 846677  ceb55busybox_old
 838650    441   7564 846655  ceb3fbusybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-23 15:43:08 +01:00
Denys Vlasenko
6b61629397 udhcp: make rfc derived doc more readable (but it still is contradictory)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-22 15:22:14 +01:00
Denys Vlasenko
dde8bdcc5b udhcp: merge options.h into common.h, script.c into dhcpc.c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-22 14:29:13 +01:00
Denys Vlasenko
501e35c474 udhcp: merge clientpacket.c into dhcpc.c
function                                             old     new   delta
udhcpc_main                                         2569    2855    +286
perform_release                                      122     124      +2
client_background                                     31      32      +1
init_packet                                          156      88     -68
send_decline                                         114       -    -114
send_discover                                        121       -    -121
send_select                                          130       -    -130
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 3/1 up/down: 289/-433)         Total: -144 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-22 13:43:12 +01:00
Denys Vlasenko
6b24d5354b udhcpc: merge clientsocket.c into dhcpc.c. +4 bytes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-22 13:42:13 +01:00
Denys Vlasenko
c7dc79e71d udhcpd: untangle incredibly messy handling of DHCPREQUEST
Also fixes attacks possible via DHCPDECLINE / DHCPRELEASE

function                                             old     new   delta
udhcpd_main                                         1846    1949    +103
send_renew                                           105     142     +37
send_NAK                                              61       -     -61
send_ACK                                             180       -    -180
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 2/0 up/down: 140/-241)         Total: -101 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-21 06:15:28 +01:00
Denys Vlasenko
e5ce91b41b udhcp: code shrink; disable time and log server options
function                                             old     new   delta
add_server_options                                     -     100    +100
udhcp_add_simple_option                               92      90      -2
nobody_responds_to_arp                                88      85      -3
dhcp_options                                          66      62      -4
udhcp_add_option_string                              104      94     -10
udhcp_run_script                                     665     654     -11
dhcp_option_strings                                  203     188     -15
static.blank_chaddr                                   16       -     -16
send_ACK                                             211     180     -31
add_bootp_options                                     61       -     -61
udhcpd_main                                         1925    1846     -79
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 0/8 up/down: 100/-232)         Total: -132 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-21 00:43:11 +01:00
Denys Vlasenko
6947d2c7e1 udhcp: logging improvements, field and variable renames
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-17 13:24:03 +02:00
Denys Vlasenko
31af3d5a1d udhcp: shorten mac len from 16 to 6 in lease file
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-17 11:57:09 +02:00
Denys Vlasenko
ac906fa85e udhcp: change UDHCP_DEBUG into int, make verbosity selectable with -v
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-17 11:54:52 +02:00
Denys Vlasenko
ed8982bfc0 udhcp: add a few TODOs
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-16 12:05:21 +02:00
Denys Vlasenko
26918dd28e udhcp: rename server/client_config.arp to server_mac and client_mac
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-16 12:04:23 +02:00
Denys Vlasenko
56f2d06c64 udhcp: rename sprintip to sprint_nip, siaddr to siaddr_nip
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-16 10:25:35 +02:00
Denys Vlasenko
990a617edf udhcp: rename giaddr to gateway_nip and server to server_nip
"nip" stands for "IP in network order"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-16 10:23:55 +02:00
Denys Vlasenko
47f2d7ef7d udhcpd: don't fail ARP check if returned MAC matches client's one
Also, do not unicast replies to yiaddr.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-16 10:20:27 +02:00
Denis Vlasenko
f81e8dbc74 *: make "pragma GCC visibility push(hidden)" less ugly 2009-04-09 12:35:13 +00:00
Denis Vlasenko
35a064b67f build system: tidying up CONFIG_xxx names (suggested by Rob) 2008-11-06 00:49:59 +00:00
Denis Vlasenko
7ff85c53f1 udhcp: simplify SO_BINDTODEVICE call 2008-10-27 12:56:58 +00:00
Denis Vlasenko
739e30fbc3 udhcp: add inline docs; small code shrink
function                                             old     new   delta
send_packet                                          103      87     -16
udhcpc_main                                         2359    2323     -36
2008-09-26 23:45:20 +00:00
Denis Vlasenko
c321b51dc6 udhcp: added some FIXMEs; code shrink. -49 bytes 2008-09-26 16:29:12 +00:00
Denis Vlasenko
f1980f67d3 dhcp: add FAST_FUNC as appropriate. -160 bytes. 2008-09-26 09:34:59 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
6de8994440 udhcpc: regularize the names of receiving functions,
pause on "serious failure to receive".
Some misc fixes are also folded in here.
2008-05-21 07:05:06 +00:00
Denis Vlasenko
98636eb08c Use intra-DSO calls when we build libbusybox. No-op for normal build.
This was Bernhard Fischer' idea.

   text    data     bss     dec     hex filename
 773549    7781    9740  791070   c121e busybox.t7/0_lib/libbusybox.so.1.11.0.svn_unstripped
 769683    7397    9740  786820   c0184 busybox.t9t/0_lib/libbusybox.so.1.11.0.svn_unstripped
2008-05-09 17:59:34 +00:00
Denis Vlasenko
84da0bf475 udhcp: make paths configurable
syslogd: trivial build fix
2008-02-20 22:29:52 +00:00
Denis Vlasenko
d55fe3e595 udhcp: optional support for non-standard DHCP ports (+300 bytes when selected) 2008-02-04 13:12:16 +00:00
Denis Vlasenko
b76b9a4328 udhcpc: filter unwanted packets in kernel
(Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>)
2008-01-25 22:46:34 +00:00
Denis Vlasenko
fff145dba3 udhcp: fix oversized packet sending (introduced by "slack for bad dhcp servers" options);
slight optimizations and function renaming

udhcp_send_raw_packet                                  -     391    +391
udhcp_send_kernel_packet                               -     197    +197
udhcp_recv_packet                                      -     134    +134
get_raw_packet                                       353     326     -27
udhcp_get_packet                                     134       -    -134
udhcp_kernel_packet                                  197       -    -197
udhcp_raw_packet                                     391       -    -391
------------------------------------------------------------------------------
(add/remove: 3/3 grow/shrink: 0/1 up/down: 722/-749)          Total: -27 bytes
2007-12-20 21:11:38 +00:00
Denis Vlasenko
b539c8452f dhcp: heed TODO item - divorced options from their string descriptions
code shrink while at it.

function                                             old     new   delta
dhcp_option_strings                                    -     258    +258
udhcp_run_script                                    1135    1174     +39
dhcp_option_lengths                                    -      11     +11
udhcp_add_simple_option                               93      92      -1
packet_num                                             4       -      -4
read_opt                                             746     739      -7
udhcp_option_lengths                                  11       -     -11
udhcpc_main                                         2590    2494     -96
dhcp_options                                         490      70    -420
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 1/4 up/down: 308/-539)         Total: -231 bytes
   text    data     bss     dec     hex filename
 775309     929    9100  785338   bfbba busybox_old
 775098     929    9084  785111   bfad7 busybox_unstripped
2007-11-29 08:17:45 +00:00
Denis Vlasenko
72e76044cf dhcpc: cope with buggy DHCP servers which send oversized packets
(Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>)
2007-11-25 03:15:24 +00:00
Denis Vlasenko
6884f665bd dhcp: stop using magic constants; use (htonl(CONST) != a) - it's smaller
function                                             old     new   delta
udhcp_get_packet                                     146     134     -12
get_raw_packet                                       368     353     -15
2007-11-23 00:08:54 +00:00
Denis Vlasenko
223bc97f61 udhcpc: an option to perform ARP check (Jonas Danielsson <jonas.danielsson@axis.com>)
configurable, ~+300 bytes when on.
2007-11-22 00:58:49 +00:00
Denis Vlasenko
deabacdf91 move udhcp_{client/server}_config to common_bufsiz1
udhcp_run_script                                    1108    1151     +43
init_packet                                          209     210      +1
udhcpc_main                                         2395    2393      -2
udhcp_client_config                                   56       -     -56
udhcp_server_config                                   88       -     -88
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 2/1 up/down: 44/-146)          Total: -102 bytes
   text    data     bss     dec     hex filename
 771326    1029    9696  782051   beee3 busybox_old
 771383    1029    9552  781964   bee8c busybox_unstripped
2007-09-30 17:55:43 +00:00
Denis Vlasenko
a27a11bb2c introduce and use xdup2(int, int)
stop checking whether setsockopt_reuseaddr(int fd) was successful (it always is)
remove second parameter (sockllen) from xmalloc_sockaddr2xxxxx functions

sockaddr2str                                         142     156     +14
collect_blk                                          467     474      +7
xdup2                                                 28      33      +5
singlemount                                         4456    4454      -2
print_host                                           214     212      -2
nslookup_main                                        139     137      -2
ftpgetput_main                                       414     412      -2
udhcpd_main                                         1258    1255      -3
udhcpc_main                                         2405    2402      -3
traceroute_main                                     4125    4122      -3
nc_main                                             1072    1069      -3
buffer_fill_and_print                                 76      73      -3
xmalloc_sockaddr2hostonly_noport                      18      14      -4
xmalloc_sockaddr2host_noport                          18      14      -4
xmalloc_sockaddr2host                                 15      11      -4
xmalloc_sockaddr2dotted_noport                        18      14      -4
xmalloc_sockaddr2dotted                               18      14      -4
wget_main                                           2618    2614      -4
ping_main                                            393     389      -4
ip_port_str                                          120     115      -5
dhcprelay_main                                      1146    1141      -5
dnsd_main                                           1531    1525      -6
passwd_main                                         1110    1102      -8
udhcp_kernel_packet                                  206     197      -9
udhcp_listen_socket                                  154     144     -10
getty_main                                          2576    2566     -10
setup                                                655     640     -15
xmove_fd                                              51      34     -17
dolisten                                             759     742     -17
tcpudpsvd_main                                      1866    1836     -30
startservice                                         339     299     -40
2007-08-18 14:16:39 +00:00
Denis Vlasenko
80edead5ea 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
2007-08-02 22:31:05 +00:00
Denis Vlasenko
42b3dea9bf udhcp: many small fixes:
* arpping(): smaller and even probably fixed
* lots of variables/params converted: ulong -> uint32_t
* uptime() nuked in favor of monotonic_sec()
* udhcp_get_packet(): only one "bad vendor", simplify

function                                             old     new   delta
reservedIp                                            36      35      -1
udhcpc_main                                         2462    2460      -2
addStaticLease                                        64      62      -2
static.broken_vendors                                 16       -     -16
uptime                                                19       -     -19
udhcpd_main                                         1273    1238     -35
udhcp_get_packet                                     223     184     -39
.rodata                                           144162  144106     -56
arpping                                              690     609     -81
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/7 up/down: 0/-251)           Total: -251 bytes
   text    data     bss     dec     hex filename
 734241    3028   14400  751669   b7835 busybox_old
 734005    3028   14400  751433   b7749 busybox_unstripped
2007-07-03 15:47:50 +00:00
Denis Vlasenko
b6adbf1be2 usage.c: remove reference to busybox.h
*: s/include "busybox.h"/include "libbb.h"
2007-05-26 19:00:18 +00:00
Denis Vlasenko
fbd2918f5c udhcp: MAC_BCAST_ADDR and blank_chaddr are in fact constant, move to rodata.
a few global variables reduced to smallints
function                                             old     new   delta
add_lease                                             75     227    +152
static.blank_chaddr                                    -      16     +16
MAC_BCAST_ADDR                                         -       6      +6
sockfd                                                 4       8      +4
udhcp_run_script                                    1153    1155      +2
state                                                  8       5      -3
listen_mode                                            4       1      -3
perform_release                                      152     148      -4
fd                                                     8       4      -4
blank_chaddr                                          16       -     -16
udhcpc_main                                         2518    2497     -21
.rodata                                           131864  131832     -32
oldest_expired_lease                                  61       -     -61
clear_lease                                          127       -    -127
------------------------------------------------------------------------------
(add/remove: 2/3 grow/shrink: 3/6 up/down: 180/-271)          Total: -91 bytes
2007-04-07 01:05:47 +00:00
Denis Vlasenko
af1c84360f Move udhcp to new NOMMU helpers.
Fix server part to compile under NOMMU.
Client is not compilable yet.
On MMU everything compiles (and maybe even works :)
2007-03-26 13:22:35 +00:00
Denis Vlasenko
b6aae0f381 preparatory patch for -Wwrite-strings #2 2007-01-29 22:51:25 +00:00
Denis Vlasenko
1d14e6f48c Always use /usr/share/udhcpc/default.script ([/usr] was depending on CONFIG_xx) 2006-12-22 11:47:19 +00:00
Denis Vlasenko
5a3395bc01 udhcp: fix indentation and style.
Eliminate (group) a lot of smallish *.h files
Remove lots of unneeded #includes
2006-11-18 19:51:32 +00:00
Denis Vlasenko
3538b9a882 Implement optional syslog logging using ordinary
bb_xx_msg calls, and convert networking/* to it.
The rest of bbox will be converted gradually.
2006-09-06 18:36:50 +00:00
"Robert P. J. Day"
63fc1a9e08 Standardize on the vi editing directives being on the first line. 2006-07-02 19:47:05 +00:00
Rob Landley
3f78561d63 My first bout of untangling udhcp. Make lots of gratuitous #defines go
away, substitutie BB_VER for an external VERSION, use busybox CONFIG symbols
rather than checking for them then defining others, etc.  Lots more cleanup
to do...
2006-05-28 01:06:36 +00:00