WPS: Remove unused mac_addr_text parameter from get_netif_info()

This commit is contained in:
Jouni Malinen 2010-01-09 16:57:15 +02:00
parent 8e5568f874
commit 612162430f
4 changed files with 9 additions and 22 deletions

View File

@ -1156,9 +1156,8 @@ wps_er_init(struct wps_context *wps, const char *ifname)
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);
@ -1178,9 +1177,8 @@ wps_er_init(struct wps_context *wps, const char *ifname)
}
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;
}
@ -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_ctx = er->deinit_done_ctx;
os_free(er->ip_addr_text);
os_free(er->mac_addr_text);
os_free(er);
if (deinit_done_cb)

View File

@ -75,7 +75,6 @@ struct wps_er_ap {
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) */

View File

@ -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_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;
@ -856,8 +855,7 @@ int get_netif_info(const char *net_if, unsigned *ip_addr, char **ip_addr_text,
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);
@ -891,7 +889,6 @@ int get_netif_info(const char *net_if, unsigned *ip_addr, char **ip_addr_text,
#else
#error MAC address fetch not implemented
#endif
os_snprintf(*mac_addr_text, 18, MACSTR, MAC2STR(mac));
close(sock);
return 0;
@ -901,8 +898,6 @@ fail:
close(sock);
os_free(*ip_addr_text);
*ip_addr_text = NULL;
os_free(*mac_addr_text);
*mac_addr_text = NULL;
return -1;
}
@ -945,8 +940,6 @@ void upnp_wps_device_stop(struct upnp_wps_device_sm *sm)
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)
@ -982,9 +975,8 @@ int upnp_wps_device_start(struct upnp_wps_device_sm *sm, char *net_if)
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;

View File

@ -113,7 +113,6 @@ struct upnp_wps_device_sm {
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) */
@ -147,7 +146,7 @@ struct subscription * subscription_find(struct upnp_wps_device_sm *sm,
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);