mirror of
https://github.com/sheumann/hush.git
synced 2024-09-12 15:54:56 +00:00
udhcp: convert old-style logging in print_static_leases
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
6947d2c7e1
commit
799d00e84c
@ -5,17 +5,14 @@
|
|||||||
|
|
||||||
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
|
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
|
||||||
|
|
||||||
/************************************/
|
/* Defaults you may want to tweak */
|
||||||
/* Defaults _you_ may want to tweak */
|
/* Default max_lease_sec */
|
||||||
/************************************/
|
#define LEASE_TIME (60*60*24 * 10)
|
||||||
|
#define LEASES_FILE CONFIG_DHCPD_LEASES_FILE
|
||||||
/* the period of time the client is allowed to use that address */
|
/* Where to find the DHCP server configuration file */
|
||||||
#define LEASE_TIME (60*60*24*10) /* 10 days of seconds */
|
|
||||||
#define LEASES_FILE CONFIG_DHCPD_LEASES_FILE
|
|
||||||
|
|
||||||
/* where to find the DHCP server configuration file */
|
|
||||||
#define DHCPD_CONF_FILE "/etc/udhcpd.conf"
|
#define DHCPD_CONF_FILE "/etc/udhcpd.conf"
|
||||||
|
|
||||||
|
|
||||||
struct option_set {
|
struct option_set {
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
struct option_set *next;
|
struct option_set *next;
|
||||||
@ -119,7 +116,11 @@ uint32_t get_static_nip_by_mac(struct static_lease *st_lease, void *arg) FAST_FU
|
|||||||
/* Check to see if an IP is reserved as a static IP */
|
/* Check to see if an IP is reserved as a static IP */
|
||||||
int is_nip_reserved(struct static_lease *st_lease, uint32_t nip) FAST_FUNC;
|
int is_nip_reserved(struct static_lease *st_lease, uint32_t nip) FAST_FUNC;
|
||||||
/* Print out static leases just to check what's going on (debug code) */
|
/* Print out static leases just to check what's going on (debug code) */
|
||||||
void print_static_leases(struct static_lease **st_lease_pp) FAST_FUNC;
|
#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 2
|
||||||
|
void log_static_leases(struct static_lease **st_lease_pp) FAST_FUNC;
|
||||||
|
#else
|
||||||
|
# define log_static_leases(st_lease_pp) ((void)0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*** serverpacket.h ***/
|
/*** serverpacket.h ***/
|
||||||
|
@ -270,7 +270,7 @@ static int FAST_FUNC read_staticlease(const char *const_line, void *arg)
|
|||||||
|
|
||||||
add_static_lease(arg, (uint8_t*) &mac_bytes, ip);
|
add_static_lease(arg, (uint8_t*) &mac_bytes, ip);
|
||||||
|
|
||||||
if (ENABLE_UDHCP_DEBUG) print_static_leases(arg);
|
log_static_leases(arg);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -57,19 +57,23 @@ int FAST_FUNC is_nip_reserved(struct static_lease *st_lease, uint32_t nip)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_UDHCP_DEBUG
|
#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 2
|
||||||
/* Print out static leases just to check what's going on */
|
/* Print out static leases just to check what's going on */
|
||||||
/* Takes the address of the pointer to the static_leases linked list */
|
/* Takes the address of the pointer to the static_leases linked list */
|
||||||
void FAST_FUNC print_static_leases(struct static_lease **st_lease_pp)
|
void FAST_FUNC log_static_leases(struct static_lease **st_lease_pp)
|
||||||
{
|
{
|
||||||
struct static_lease *cur = *st_lease_pp;
|
struct static_lease *cur;
|
||||||
|
|
||||||
|
if (dhcp_verbose < 2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
cur = *st_lease_pp;
|
||||||
while (cur) {
|
while (cur) {
|
||||||
printf("PrintStaticLeases: lease mac: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
bb_info_msg("static lease: mac:%02x:%02x:%02x:%02x:%02x:%02x nip:%x",
|
||||||
cur->mac[0], cur->mac[1], cur->mac[2],
|
cur->mac[0], cur->mac[1], cur->mac[2],
|
||||||
cur->mac[3], cur->mac[4], cur->mac[5]
|
cur->mac[3], cur->mac[4], cur->mac[5],
|
||||||
|
cur->nip
|
||||||
);
|
);
|
||||||
printf("PrintStaticLeases: lease ip: %x\n", cur->nip);
|
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user