P2P: Rename the group interface name to use p2p- prefix

This may make it less likely for udev to rename the interface that
would previously have been called wlan0-p2p-# (now: p2p-wlan0-#).
In addition, add some workaround code to handle the case where the
main interface name is close to the IFNAMSIZ length limit to
avoid going over that for the P2P group interface.
This commit is contained in:
Jouni Malinen 2010-11-26 15:50:22 +02:00 committed by Jouni Malinen
parent 0f85ef5cf0
commit a1eca5cfd8

View file

@ -928,8 +928,14 @@ static int wpas_p2p_add_group_interface(struct wpa_supplicant *wpa_s,
return 0;
}
os_snprintf(ifname, sizeof(ifname), "%s-p2p-%d", wpa_s->ifname,
os_snprintf(ifname, sizeof(ifname), "p2p-%s-%d", wpa_s->ifname,
wpa_s->p2p_group_idx);
if (os_strlen(ifname) >= IFNAMSIZ &&
os_strlen(wpa_s->ifname) < IFNAMSIZ) {
/* Try to avoid going over the IFNAMSIZ length limit */
os_snprintf(ifname, sizeof(ifname), "p2p-%d",
wpa_s->p2p_group_idx);
}
force_ifname[0] = '\0';
wpa_printf(MSG_DEBUG, "P2P: Create a new interface %s for the group",