Stop processing if STA VLAN bind fails
authorJouni Malinen <j@w1.fi>
Thu, 15 Apr 2010 20:44:10 +0000 (23:44 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 15 Apr 2010 20:44:10 +0000 (23:44 +0300)
src/ap/ieee802_11.c
src/ap/ieee802_1x.c
src/ap/sta_info.c

index 4986381..6ce94b2 100644 (file)
@@ -1620,10 +1620,12 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
                 * so bind it to the selected VLAN interface now, since the
                 * interface selection is not going to change anymore.
                 */
-               ap_sta_bind_vlan(hapd, sta, 0);
+               if (ap_sta_bind_vlan(hapd, sta, 0) < 0)
+                       goto fail;
        } else if (sta->vlan_id) {
                /* VLAN ID already set (e.g., by PMKSA caching), so bind STA */
-               ap_sta_bind_vlan(hapd, sta, 0);
+               if (ap_sta_bind_vlan(hapd, sta, 0) < 0)
+                       goto fail;
        }
 
        hapd->drv.set_sta_flags(hapd, sta);
index ae407da..dd1b6d5 100644 (file)
@@ -1282,7 +1282,8 @@ ieee802_1x_receive_auth(struct radius_msg *msg, struct radius_msg *req,
                }
 #endif /* CONFIG_NO_VLAN */
 
-               ap_sta_bind_vlan(hapd, sta, old_vlanid);
+               if (ap_sta_bind_vlan(hapd, sta, old_vlanid) < 0)
+                       break;
 
                /* RFC 3580, Ch. 3.17 */
                if (session_timeout_set && termination_action ==
index b410a7b..335c9a5 100644 (file)
@@ -540,6 +540,7 @@ int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
 #ifndef CONFIG_NO_VLAN
        const char *iface;
        struct hostapd_vlan *vlan = NULL;
+       int ret;
 
        /*
         * Do not proceed furthur if the vlan id remains same. We do not want
@@ -635,7 +636,13 @@ int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
        if (wpa_auth_sta_set_vlan(sta->wpa_sm, sta->vlan_id) < 0)
                wpa_printf(MSG_INFO, "Failed to update VLAN-ID for WPA");
 
-       return hapd->drv.set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id);
+       ret = hapd->drv.set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id);
+       if (ret < 0) {
+               hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
+                              HOSTAPD_LEVEL_DEBUG, "could not bind the STA "
+                              "entry to vlan_id=%d", sta->vlan_id);
+       }
+       return ret;
 #else /* CONFIG_NO_VLAN */
        return 0;
 #endif /* CONFIG_NO_VLAN */