AP: Warn about VLAN interface name truncations
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
This commit is contained in:
parent
d577f7f3d5
commit
68500d8159
1 changed files with 12 additions and 2 deletions
|
@ -138,6 +138,8 @@ int vlan_init(struct hostapd_data *hapd)
|
|||
!hapd->conf->vlan) {
|
||||
/* dynamic vlans enabled but no (or empty) vlan_file given */
|
||||
struct hostapd_vlan *vlan;
|
||||
int ret;
|
||||
|
||||
vlan = os_zalloc(sizeof(*vlan));
|
||||
if (vlan == NULL) {
|
||||
wpa_printf(MSG_ERROR, "Out of memory while assigning "
|
||||
|
@ -146,8 +148,16 @@ int vlan_init(struct hostapd_data *hapd)
|
|||
}
|
||||
|
||||
vlan->vlan_id = VLAN_ID_WILDCARD;
|
||||
os_snprintf(vlan->ifname, sizeof(vlan->ifname), "%s.#",
|
||||
hapd->conf->iface);
|
||||
ret = os_snprintf(vlan->ifname, sizeof(vlan->ifname), "%s.#",
|
||||
hapd->conf->iface);
|
||||
if (ret >= (int) sizeof(vlan->ifname)) {
|
||||
wpa_printf(MSG_WARNING,
|
||||
"VLAN: Interface name was truncated to %s",
|
||||
vlan->ifname);
|
||||
} else if (ret < 0) {
|
||||
os_free(vlan);
|
||||
return ret;
|
||||
}
|
||||
vlan->next = hapd->conf->vlan;
|
||||
hapd->conf->vlan = vlan;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue