]>
git.ipfire.org Git - thirdparty/hostap.git/blob - hostapd/dump_state.c
3 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
9 #include "utils/includes.h"
12 #include "utils/common.h"
13 #include "eapol_auth/eapol_auth_sm.h"
14 #include "eapol_auth/eapol_auth_sm_i.h"
15 #include "eap_server/eap.h"
16 #include "ap/hostapd.h"
17 #include "ap/ap_config.h"
18 #include "ap/sta_info.h"
19 #include "dump_state.h"
20 #include "ap/ap_drv_ops.h"
23 static void ieee802_1x_dump_state(FILE *f
, struct sta_info
*sta
)
25 struct eapol_state_machine
*sm
= sta
->eapol_sm
;
31 res
= eapol_auth_dump_state(sm
, buf
, sizeof(buf
));
33 fprintf(f
, "%s", buf
);
38 * hostapd_dump_state - SIGUSR1 handler to dump hostapd state to a text file
40 static void hostapd_dump_state(struct hostapd_data
*hapd
)
46 if (!hapd
->conf
->dump_log_name
) {
47 wpa_printf(MSG_DEBUG
, "Dump file not defined - ignoring dump "
52 wpa_printf(MSG_DEBUG
, "Dumping hostapd state to '%s'",
53 hapd
->conf
->dump_log_name
);
54 f
= fopen(hapd
->conf
->dump_log_name
, "w");
56 wpa_printf(MSG_WARNING
, "Could not open dump file '%s' for "
57 "writing.", hapd
->conf
->dump_log_name
);
62 fprintf(f
, "hostapd state dump - %s", ctime(&now
));
64 for (sta
= hapd
->sta_list
; sta
!= NULL
; sta
= sta
->next
) {
65 fprintf(f
, "\nSTA=" MACSTR
"\n", MAC2STR(sta
->addr
));
66 ieee802_1x_dump_state(f
, sta
);
73 int handle_dump_state_iface(struct hostapd_iface
*iface
, void *ctx
)
77 for (i
= 0; i
< iface
->num_bss
; i
++)
78 hostapd_dump_state(iface
->bss
[i
]);