diff options
author | Denys Vlasenko | 2023-06-12 13:12:23 +0200 |
---|---|---|
committer | Denys Vlasenko | 2023-06-12 13:22:47 +0200 |
commit | 8f0e4c42c630126daafd834175b86d2b28f5b798 (patch) | |
tree | d75f761222980bf52a954be41cb7a05b3d4b71ff /coreutils/realpath.c | |
parent | 4bd70463c7e7511aea9de58876f0beacbcec1779 (diff) | |
download | busybox-8f0e4c42c630126daafd834175b86d2b28f5b798.zip busybox-8f0e4c42c630126daafd834175b86d2b28f5b798.tar.gz |
udhcpd: optional BOOTP support
from Adam Goldman <adamg@pobox.com>
This patch makes udhcpd respond correctly to queries from BOOTP clients.
It contains the following changes:
The end field, or DHCP_END option, is required in DHCP requests but
optional in BOOTP requests. However, we still send an end
field in all replies, because some BOOTP clients expect one in replies
even if they didn't send one in the request.
Requests without a DHCP_MESSAGE_TYPE are recognized as BOOTP requests
and handled appropriately, instead of being discarded. We still require
an RFC 1048 options field, but we allow it to be empty.
Since a BOOTP client will keep using the assigned IP forever, we only
send a BOOTP reply if a static lease exists for that client.
BOOTP replies shouldn't contain DHCP_* options, so we omit them if there
was no DHCP_MESSAGE_TYPE in the request. Options other than DHCP_*
options are still sent.
The options field of a BOOTP reply must be exactly 64 bytes. If we
construct a reply with more than 64 bytes of options, we give up and log
an error instead of sending it. udhcp_send_raw_packet already pads the
options field to 64 bytes if it is too short.
This implementation has been tested against an HP PA-RISC client.
function old new delta
.rodata 105247 105321 +74
udhcpd_main 1520 1591 +71
send_offer 419 470 +51
init_packet 81 97 +16
udhcp_init_header 75 88 +13
udhcp_scan_options 192 203 +11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/0 up/down: 236/0) Total: 236 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/realpath.c')
0 files changed, 0 insertions, 0 deletions