er->wps = wps;
os_get_random((unsigned char *) &er->event_id, sizeof(er->event_id));
- if (get_netif_info(ifname,
- &er->ip_addr, &er->ip_addr_text,
- er->mac_addr, &er->mac_addr_text)) {
+ if (get_netif_info(ifname, &er->ip_addr, &er->ip_addr_text,
+ er->mac_addr)) {
wpa_printf(MSG_INFO, "WPS UPnP: Could not get IP/MAC address "
"for %s. Does it have IP address?", ifname);
wps_er_deinit(er, NULL, NULL);
}
er->http_port = http_server_get_port(er->http_srv);
- wpa_printf(MSG_DEBUG, "WPS ER: Start (ifname=%s ip_addr=%s "
- "mac_addr=%s)",
- er->ifname, er->ip_addr_text, er->mac_addr_text);
+ wpa_printf(MSG_DEBUG, "WPS ER: Start (ifname=%s ip_addr=%s)",
+ er->ifname, er->ip_addr_text);
return er;
}
deinit_done_cb = er->deinit_done_cb;
deinit_done_ctx = er->deinit_done_ctx;
os_free(er->ip_addr_text);
- os_free(er->mac_addr_text);
os_free(er);
if (deinit_done_cb)
struct wps_er {
struct wps_context *wps;
char ifname[17];
- char *mac_addr_text; /* mac addr of network i.f. we use */
u8 mac_addr[ETH_ALEN]; /* mac addr of network i.f. we use */
char *ip_addr_text; /* IP address of network i.f. we use */
unsigned ip_addr; /* IP address of network i.f. we use (host order) */
* @ip_addr: Buffer for returning IP address in network byte order
* @ip_addr_text: Buffer for returning a pointer to allocated IP address text
* @mac: Buffer for returning MAC address
- * @mac_addr_text: Buffer for returning allocated MAC address text
* Returns: 0 on success, -1 on failure
*/
int get_netif_info(const char *net_if, unsigned *ip_addr, char **ip_addr_text,
- u8 mac[ETH_ALEN], char **mac_addr_text)
+ u8 mac[ETH_ALEN])
{
struct ifreq req;
int sock = -1;
struct in_addr in_addr;
*ip_addr_text = os_zalloc(16);
- *mac_addr_text = os_zalloc(18);
- if (*ip_addr_text == NULL || *mac_addr_text == NULL)
+ if (*ip_addr_text == NULL)
goto fail;
sock = socket(AF_INET, SOCK_DGRAM, 0);
#else
#error MAC address fetch not implemented
#endif
- os_snprintf(*mac_addr_text, 18, MACSTR, MAC2STR(mac));
close(sock);
return 0;
close(sock);
os_free(*ip_addr_text);
*ip_addr_text = NULL;
- os_free(*mac_addr_text);
- *mac_addr_text = NULL;
return -1;
}
event_send_stop_all(sm);
os_free(sm->wlanevent);
sm->wlanevent = NULL;
- os_free(sm->mac_addr_text);
- sm->mac_addr_text = NULL;
os_free(sm->ip_addr_text);
sm->ip_addr_text = NULL;
if (sm->multicast_sd >= 0)
goto fail;
/* Determine which IP and mac address we're using */
- if (get_netif_info(net_if,
- &sm->ip_addr, &sm->ip_addr_text,
- sm->mac_addr, &sm->mac_addr_text)) {
+ if (get_netif_info(net_if, &sm->ip_addr, &sm->ip_addr_text,
+ sm->mac_addr)) {
wpa_printf(MSG_INFO, "WPS UPnP: Could not get IP/MAC address "
"for %s. Does it have IP address?", net_if);
goto fail;
char *root_dir;
char *desc_url;
int started; /* nonzero if we are active */
- char *mac_addr_text; /* mac addr of network i.f. we use */
u8 mac_addr[ETH_ALEN]; /* mac addr of network i.f. we use */
char *ip_addr_text; /* IP address of network i.f. we use */
unsigned ip_addr; /* IP address of network i.f. we use (host order) */
const u8 uuid[UUID_LEN]);
int send_wpabuf(int fd, struct wpabuf *buf);
int get_netif_info(const char *net_if, unsigned *ip_addr, char **ip_addr_text,
- u8 mac[ETH_ALEN], char **mac_addr_text);
+ u8 mac[ETH_ALEN]);
/* wps_upnp_ssdp.c */
void msearchreply_state_machine_stop(struct advertisement_state_machine *a);