WPS: Remove unused mac_addr_text parameter from get_netif_info()
This commit is contained in:
parent
8e5568f874
commit
612162430f
4 changed files with 9 additions and 22 deletions
|
@ -1156,9 +1156,8 @@ wps_er_init(struct wps_context *wps, const char *ifname)
|
||||||
er->wps = wps;
|
er->wps = wps;
|
||||||
os_get_random((unsigned char *) &er->event_id, sizeof(er->event_id));
|
os_get_random((unsigned char *) &er->event_id, sizeof(er->event_id));
|
||||||
|
|
||||||
if (get_netif_info(ifname,
|
if (get_netif_info(ifname, &er->ip_addr, &er->ip_addr_text,
|
||||||
&er->ip_addr, &er->ip_addr_text,
|
er->mac_addr)) {
|
||||||
er->mac_addr, &er->mac_addr_text)) {
|
|
||||||
wpa_printf(MSG_INFO, "WPS UPnP: Could not get IP/MAC address "
|
wpa_printf(MSG_INFO, "WPS UPnP: Could not get IP/MAC address "
|
||||||
"for %s. Does it have IP address?", ifname);
|
"for %s. Does it have IP address?", ifname);
|
||||||
wps_er_deinit(er, NULL, NULL);
|
wps_er_deinit(er, NULL, NULL);
|
||||||
|
@ -1178,9 +1177,8 @@ wps_er_init(struct wps_context *wps, const char *ifname)
|
||||||
}
|
}
|
||||||
er->http_port = http_server_get_port(er->http_srv);
|
er->http_port = http_server_get_port(er->http_srv);
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "WPS ER: Start (ifname=%s ip_addr=%s "
|
wpa_printf(MSG_DEBUG, "WPS ER: Start (ifname=%s ip_addr=%s)",
|
||||||
"mac_addr=%s)",
|
er->ifname, er->ip_addr_text);
|
||||||
er->ifname, er->ip_addr_text, er->mac_addr_text);
|
|
||||||
|
|
||||||
return er;
|
return er;
|
||||||
}
|
}
|
||||||
|
@ -1212,7 +1210,6 @@ static void wps_er_deinit_finish(void *eloop_data, void *user_ctx)
|
||||||
deinit_done_cb = er->deinit_done_cb;
|
deinit_done_cb = er->deinit_done_cb;
|
||||||
deinit_done_ctx = er->deinit_done_ctx;
|
deinit_done_ctx = er->deinit_done_ctx;
|
||||||
os_free(er->ip_addr_text);
|
os_free(er->ip_addr_text);
|
||||||
os_free(er->mac_addr_text);
|
|
||||||
os_free(er);
|
os_free(er);
|
||||||
|
|
||||||
if (deinit_done_cb)
|
if (deinit_done_cb)
|
||||||
|
|
|
@ -75,7 +75,6 @@ struct wps_er_ap {
|
||||||
struct wps_er {
|
struct wps_er {
|
||||||
struct wps_context *wps;
|
struct wps_context *wps;
|
||||||
char ifname[17];
|
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 */
|
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 */
|
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) */
|
unsigned ip_addr; /* IP address of network i.f. we use (host order) */
|
||||||
|
|
|
@ -844,11 +844,10 @@ static int eth_get(const char *device, u8 ea[ETH_ALEN])
|
||||||
* @ip_addr: Buffer for returning IP address in network byte 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
|
* @ip_addr_text: Buffer for returning a pointer to allocated IP address text
|
||||||
* @mac: Buffer for returning MAC address
|
* @mac: Buffer for returning MAC address
|
||||||
* @mac_addr_text: Buffer for returning allocated MAC address text
|
|
||||||
* Returns: 0 on success, -1 on failure
|
* Returns: 0 on success, -1 on failure
|
||||||
*/
|
*/
|
||||||
int get_netif_info(const char *net_if, unsigned *ip_addr, char **ip_addr_text,
|
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;
|
struct ifreq req;
|
||||||
int sock = -1;
|
int sock = -1;
|
||||||
|
@ -856,8 +855,7 @@ int get_netif_info(const char *net_if, unsigned *ip_addr, char **ip_addr_text,
|
||||||
struct in_addr in_addr;
|
struct in_addr in_addr;
|
||||||
|
|
||||||
*ip_addr_text = os_zalloc(16);
|
*ip_addr_text = os_zalloc(16);
|
||||||
*mac_addr_text = os_zalloc(18);
|
if (*ip_addr_text == NULL)
|
||||||
if (*ip_addr_text == NULL || *mac_addr_text == NULL)
|
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
@ -891,7 +889,6 @@ int get_netif_info(const char *net_if, unsigned *ip_addr, char **ip_addr_text,
|
||||||
#else
|
#else
|
||||||
#error MAC address fetch not implemented
|
#error MAC address fetch not implemented
|
||||||
#endif
|
#endif
|
||||||
os_snprintf(*mac_addr_text, 18, MACSTR, MAC2STR(mac));
|
|
||||||
|
|
||||||
close(sock);
|
close(sock);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -901,8 +898,6 @@ fail:
|
||||||
close(sock);
|
close(sock);
|
||||||
os_free(*ip_addr_text);
|
os_free(*ip_addr_text);
|
||||||
*ip_addr_text = NULL;
|
*ip_addr_text = NULL;
|
||||||
os_free(*mac_addr_text);
|
|
||||||
*mac_addr_text = NULL;
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -945,8 +940,6 @@ void upnp_wps_device_stop(struct upnp_wps_device_sm *sm)
|
||||||
event_send_stop_all(sm);
|
event_send_stop_all(sm);
|
||||||
os_free(sm->wlanevent);
|
os_free(sm->wlanevent);
|
||||||
sm->wlanevent = NULL;
|
sm->wlanevent = NULL;
|
||||||
os_free(sm->mac_addr_text);
|
|
||||||
sm->mac_addr_text = NULL;
|
|
||||||
os_free(sm->ip_addr_text);
|
os_free(sm->ip_addr_text);
|
||||||
sm->ip_addr_text = NULL;
|
sm->ip_addr_text = NULL;
|
||||||
if (sm->multicast_sd >= 0)
|
if (sm->multicast_sd >= 0)
|
||||||
|
@ -982,9 +975,8 @@ int upnp_wps_device_start(struct upnp_wps_device_sm *sm, char *net_if)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* Determine which IP and mac address we're using */
|
/* Determine which IP and mac address we're using */
|
||||||
if (get_netif_info(net_if,
|
if (get_netif_info(net_if, &sm->ip_addr, &sm->ip_addr_text,
|
||||||
&sm->ip_addr, &sm->ip_addr_text,
|
sm->mac_addr)) {
|
||||||
sm->mac_addr, &sm->mac_addr_text)) {
|
|
||||||
wpa_printf(MSG_INFO, "WPS UPnP: Could not get IP/MAC address "
|
wpa_printf(MSG_INFO, "WPS UPnP: Could not get IP/MAC address "
|
||||||
"for %s. Does it have IP address?", net_if);
|
"for %s. Does it have IP address?", net_if);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
|
@ -113,7 +113,6 @@ struct upnp_wps_device_sm {
|
||||||
char *root_dir;
|
char *root_dir;
|
||||||
char *desc_url;
|
char *desc_url;
|
||||||
int started; /* nonzero if we are active */
|
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 */
|
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 */
|
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) */
|
unsigned ip_addr; /* IP address of network i.f. we use (host order) */
|
||||||
|
@ -147,7 +146,7 @@ struct subscription * subscription_find(struct upnp_wps_device_sm *sm,
|
||||||
const u8 uuid[UUID_LEN]);
|
const u8 uuid[UUID_LEN]);
|
||||||
int send_wpabuf(int fd, struct wpabuf *buf);
|
int send_wpabuf(int fd, struct wpabuf *buf);
|
||||||
int get_netif_info(const char *net_if, unsigned *ip_addr, char **ip_addr_text,
|
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 */
|
/* wps_upnp_ssdp.c */
|
||||||
void msearchreply_state_machine_stop(struct advertisement_state_machine *a);
|
void msearchreply_state_machine_stop(struct advertisement_state_machine *a);
|
||||||
|
|
Loading…
Reference in a new issue