wifi: mac80211: expand __ieee80211_data_to_8023() status
[linux-2.6-microblaze.git] / net / mac80211 / rx.c
index ff98681..fb2d4a7 100644 (file)
@@ -2476,7 +2476,7 @@ static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx)
        return 0;
 }
 
-static int
+static ieee80211_rx_result
 __ieee80211_data_to_8023(struct ieee80211_rx_data *rx, bool *port_control)
 {
        struct ieee80211_sub_if_data *sdata = rx->sdata;
@@ -2488,32 +2488,31 @@ __ieee80211_data_to_8023(struct ieee80211_rx_data *rx, bool *port_control)
        *port_control = false;
        if (ieee80211_has_a4(hdr->frame_control) &&
            sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta)
-               return -1;
+               return RX_DROP_U_UNEXPECTED_VLAN_4ADDR;
 
        if (sdata->vif.type == NL80211_IFTYPE_STATION &&
            !!sdata->u.mgd.use_4addr != !!ieee80211_has_a4(hdr->frame_control)) {
-
                if (!sdata->u.mgd.use_4addr)
-                       return -1;
+                       return RX_DROP_U_UNEXPECTED_STA_4ADDR;
                else if (!ether_addr_equal(hdr->addr1, sdata->vif.addr))
                        check_port_control = true;
        }
 
        if (is_multicast_ether_addr(hdr->addr1) &&
            sdata->vif.type == NL80211_IFTYPE_AP_VLAN && sdata->u.vlan.sta)
-               return -1;
+               return RX_DROP_U_UNEXPECTED_VLAN_MCAST;
 
        ret = ieee80211_data_to_8023(rx->skb, sdata->vif.addr, sdata->vif.type);
        if (ret < 0)
-               return ret;
+               return RX_DROP_U_INVALID_8023;
 
        ehdr = (struct ethhdr *) rx->skb->data;
        if (ehdr->h_proto == rx->sdata->control_port_protocol)
                *port_control = true;
        else if (check_port_control)
-               return -1;
+               return RX_DROP_U_NOT_PORT_CONTROL;
 
-       return 0;
+       return RX_CONTINUE;
 }
 
 bool ieee80211_is_our_addr(struct ieee80211_sub_if_data *sdata,
@@ -3124,7 +3123,6 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
        __le16 fc = hdr->frame_control;
        ieee80211_rx_result res;
        bool port_control;
-       int err;
 
        if (unlikely(!ieee80211_is_data(hdr->frame_control)))
                return RX_CONTINUE;
@@ -3145,9 +3143,9 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
                return RX_DROP_MONITOR;
        }
 
-       err = __ieee80211_data_to_8023(rx, &port_control);
-       if (unlikely(err))
-               return RX_DROP_U_INVALID_8023;
+       res = __ieee80211_data_to_8023(rx, &port_control);
+       if (unlikely(res != RX_CONTINUE))
+               return res;
 
        res = ieee80211_rx_mesh_data(rx->sdata, rx->sta, rx->skb);
        if (res != RX_CONTINUE)