client_data.vendorclass, .hostname and .fqdn probably need the same treatment: just insert them into the list of -x opts, get rid of if (client_data.vendorclass) udhcp_add_binary_option(packet, client_data.vendorclass); if (client_data.hostname) udhcp_add_binary_option(packet, client_data.hostname); if (client_data.fqdn) udhcp_add_binary_option(packet, client_data.fqdn); function old new delta udhcp_insert_new_option - 166 +166 perform_release 171 207 +36 perform_d6_release 227 259 +32 udhcpc6_main 2558 2580 +22 init_d6_packet 103 84 -19 udhcpc_main 2585 2564 -21 attach_option 397 253 -144 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 3/3 up/down: 256/-184) Total: 72 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
48 lines
1.7 KiB
C
48 lines
1.7 KiB
C
/* vi: set sw=4 ts=4: */
|
|
/*
|
|
* Licensed under GPLv2, see file LICENSE in this source tree.
|
|
*/
|
|
#ifndef UDHCP_DHCPC_H
|
|
#define UDHCP_DHCPC_H 1
|
|
|
|
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
|
|
|
|
struct client_data_t {
|
|
uint8_t clientid[2+2 + 6]; /* Our mac address (prefixed by padding used for client-id) */
|
|
#define client_data_client_mac (client_data.clientid + 2+2)
|
|
IF_FEATURE_UDHCP_PORT(uint16_t port;)
|
|
int ifindex; /* Index number of the interface to use */
|
|
uint8_t opt_mask[256 / 8]; /* Bitmask of options to send (-O option) */
|
|
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TODO: DHCPv6 has 16-bit option numbers
|
|
const char *interface; /* The name of the interface to use */
|
|
char *pidfile; /* Optionally store the process ID */
|
|
const char *script; /* User script to run at dhcp events */
|
|
struct option_set *options; /* list of DHCP options to send to server */
|
|
uint8_t *vendorclass; /* Optional vendor class-id to use */
|
|
uint8_t *hostname; /* Optional hostname to use */
|
|
uint8_t *fqdn; /* Optional fully qualified domain name to use */
|
|
llist_t *envp; /* list of DHCP options used for env vars */
|
|
|
|
unsigned first_secs;
|
|
unsigned last_secs;
|
|
|
|
int sockfd;
|
|
smallint listen_mode;
|
|
smallint state;
|
|
} FIX_ALIASING;
|
|
|
|
/* server_config sits in 1st half of bb_common_bufsiz1 */
|
|
#define client_data (*(struct client_data_t*)(&bb_common_bufsiz1[COMMON_BUFSIZE / 2]))
|
|
|
|
#if ENABLE_FEATURE_UDHCP_PORT
|
|
#define CLIENT_PORT (client_data.port)
|
|
#define CLIENT_PORT6 (client_data.port)
|
|
#else
|
|
#define CLIENT_PORT 68
|
|
#define CLIENT_PORT6 546
|
|
#endif
|
|
|
|
POP_SAVED_FUNCTION_VISIBILITY
|
|
|
|
#endif
|