#include "../ctx.h"
#include "../file.h"
#include "../source.h"
+#include "../string.h"
#include "hostapd.h"
typedef struct hostapd_station {
static int hostapd_submit_station(td_ctx* ctx, hostapd_station* station) {
char address[ETHER_MAX_LEN];
- char* p = NULL;
+ int r;
// Skip if we don't have a MAC address
if (ether_is_zero(&station->address))
return 0;
// Format the address
- p = ether_ntoa_r(&station->address, address);
- if (!p) {
- DEBUG(ctx, "Failed to format MAC address: %m\n");
- return -errno;
+ r = td_string_format(address, "%02x:%02x:%02x:%02x:%02x:%02x",
+ station->address.ether_addr_octet[0], station->address.ether_addr_octet[1],
+ station->address.ether_addr_octet[2], station->address.ether_addr_octet[3],
+ station->address.ether_addr_octet[4], station->address.ether_addr_octet[5]);
+ if (r < 0) {
+ DEBUG(ctx, "Failed to format MAC address: %s\n", strerror(-r));
+ return r;
}
// Submit the station