ieee80211_output.c (195618) | ieee80211_output.c (195784) |
---|---|
1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_output.c 195618 2009-07-11 15:02:45Z rpaulo $"); | 28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_output.c 195784 2009-07-20 19:12:08Z rpaulo $"); |
29 30#include "opt_inet.h" 31#include "opt_inet6.h" 32#include "opt_wlan.h" 33 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/mbuf.h> --- 200 unchanged lines hidden (view full) --- 237 vap->iv_stats.is_tx_notassoc++; 238 ifp->if_oerrors++; 239 m_freem(m); 240 ieee80211_free_node(ni); 241 continue; 242 } 243#ifdef IEEE80211_SUPPORT_MESH 244 } else { | 29 30#include "opt_inet.h" 31#include "opt_inet6.h" 32#include "opt_wlan.h" 33 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/mbuf.h> --- 200 unchanged lines hidden (view full) --- 237 vap->iv_stats.is_tx_notassoc++; 238 ifp->if_oerrors++; 239 m_freem(m); 240 ieee80211_free_node(ni); 241 continue; 242 } 243#ifdef IEEE80211_SUPPORT_MESH 244 } else { |
245 if (!IEEE80211_ADDR_EQ(eh->ether_shost, vap->iv_myaddr)) { 246 /* 247 * Proxy station only if configured. 248 */ 249 if (!ieee80211_mesh_isproxyena(vap)) { 250 IEEE80211_DISCARD_MAC(vap, 251 IEEE80211_MSG_OUTPUT | 252 IEEE80211_MSG_MESH, 253 eh->ether_dhost, NULL, 254 "%s", "proxy not enabled"); 255 vap->iv_stats.is_mesh_notproxy++; 256 ifp->if_oerrors++; 257 m_freem(m); 258 continue; 259 } 260 ieee80211_mesh_proxy_check(vap, eh->ether_shost); 261 } |
|
245 ni = ieee80211_mesh_discover(vap, eh->ether_dhost, m); 246 if (ni == NULL) { 247 /* | 262 ni = ieee80211_mesh_discover(vap, eh->ether_dhost, m); 263 if (ni == NULL) { 264 /* |
248 * NB: ieee80211_mesh_discover function 249 * holds/disposes frame 250 * (e.g. queueing on path discovery). | 265 * NB: ieee80211_mesh_discover holds/disposes 266 * frame (e.g. queueing on path discovery). |
251 */ 252 ifp->if_oerrors++; 253 continue; 254 } 255 } 256#endif | 267 */ 268 ifp->if_oerrors++; 269 continue; 270 } 271 } 272#endif |
257 | |
258 if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) && 259 (m->m_flags & M_PWR_SAV) == 0) { 260 /* 261 * Station in power save mode; pass the frame 262 * to the 802.11 layer and continue. We'll get 263 * the frame back when the time is right. 264 * XXX lose WDS vap linkage? 265 */ --- 716 unchanged lines hidden (view full) --- 982struct mbuf * 983ieee80211_encap(struct ieee80211vap *vap, struct ieee80211_node *ni, 984 struct mbuf *m) 985{ 986#define WH4(wh) ((struct ieee80211_frame_addr4 *)(wh)) 987 struct ieee80211com *ic = ni->ni_ic; 988#ifdef IEEE80211_SUPPORT_MESH 989 struct ieee80211_mesh_state *ms = vap->iv_mesh; | 273 if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) && 274 (m->m_flags & M_PWR_SAV) == 0) { 275 /* 276 * Station in power save mode; pass the frame 277 * to the 802.11 layer and continue. We'll get 278 * the frame back when the time is right. 279 * XXX lose WDS vap linkage? 280 */ --- 716 unchanged lines hidden (view full) --- 997struct mbuf * 998ieee80211_encap(struct ieee80211vap *vap, struct ieee80211_node *ni, 999 struct mbuf *m) 1000{ 1001#define WH4(wh) ((struct ieee80211_frame_addr4 *)(wh)) 1002 struct ieee80211com *ic = ni->ni_ic; 1003#ifdef IEEE80211_SUPPORT_MESH 1004 struct ieee80211_mesh_state *ms = vap->iv_mesh; |
990 struct ieee80211_meshcntl_ae11 *mc; | 1005 struct ieee80211_meshcntl_ae10 *mc; |
991#endif 992 struct ether_header eh; 993 struct ieee80211_frame *wh; 994 struct ieee80211_key *key; 995 struct llc *llc; 996 int hdrsize, hdrspace, datalen, addqos, txfrag, is4addr; 997 ieee80211_seq seqno; 998 int meshhdrsize, meshae; --- 62 unchanged lines hidden (view full) --- 1061 * at the local sta are sent w/ 4-address format and 1062 * address extension mode 00 1063 * o Group Addressed data forwarded from a non-mesh sta are 1064 * sent w/ 3-address format and address extension mode 01 1065 * o Individually Address data from another sta are sent 1066 * w/ 4-address format and address extension mode 10 1067 */ 1068 is4addr = 0; /* NB: don't use, disable */ | 1006#endif 1007 struct ether_header eh; 1008 struct ieee80211_frame *wh; 1009 struct ieee80211_key *key; 1010 struct llc *llc; 1011 int hdrsize, hdrspace, datalen, addqos, txfrag, is4addr; 1012 ieee80211_seq seqno; 1013 int meshhdrsize, meshae; --- 62 unchanged lines hidden (view full) --- 1076 * at the local sta are sent w/ 4-address format and 1077 * address extension mode 00 1078 * o Group Addressed data forwarded from a non-mesh sta are 1079 * sent w/ 3-address format and address extension mode 01 1080 * o Individually Address data from another sta are sent 1081 * w/ 4-address format and address extension mode 10 1082 */ 1083 is4addr = 0; /* NB: don't use, disable */ |
1084 if (!IEEE80211_IS_MULTICAST(eh.ether_dhost)) 1085 hdrsize += IEEE80211_ADDR_LEN; /* unicast are 4-addr */ |
|
1069 meshhdrsize = sizeof(struct ieee80211_meshcntl); 1070 /* XXX defines for AE modes */ | 1086 meshhdrsize = sizeof(struct ieee80211_meshcntl); 1087 /* XXX defines for AE modes */ |
1071 /* XXX not right, need to check if from non-mesh-sta */ | |
1072 if (IEEE80211_ADDR_EQ(eh.ether_shost, vap->iv_myaddr)) { | 1088 if (IEEE80211_ADDR_EQ(eh.ether_shost, vap->iv_myaddr)) { |
1073 if (!IEEE80211_IS_MULTICAST(eh.ether_dhost)) { 1074 hdrsize += IEEE80211_ADDR_LEN; | 1089 if (!IEEE80211_IS_MULTICAST(eh.ether_dhost)) |
1075 meshae = 0; | 1090 meshae = 0; |
1076 } else | 1091 else |
1077 meshae = 4; /* NB: pseudo */ 1078 } else if (IEEE80211_IS_MULTICAST(eh.ether_dhost)) { 1079 meshae = 1; | 1092 meshae = 4; /* NB: pseudo */ 1093 } else if (IEEE80211_IS_MULTICAST(eh.ether_dhost)) { 1094 meshae = 1; |
1080 meshhdrsize += 2*IEEE80211_ADDR_LEN; | 1095 meshhdrsize += 1*IEEE80211_ADDR_LEN; |
1081 } else { 1082 meshae = 2; | 1096 } else { 1097 meshae = 2; |
1083 meshhdrsize += 3*IEEE80211_ADDR_LEN; | 1098 meshhdrsize += 2*IEEE80211_ADDR_LEN; |
1084 } 1085 } else { 1086#endif 1087 /* 1088 * 4-address frames need to be generated for: 1089 * o packets sent through a WDS vap (IEEE80211_M_WDS) 1090 * o packets sent through a vap marked for relaying 1091 * (e.g. a station operating with dynamic WDS) --- 82 unchanged lines hidden (view full) --- 1174 wh->i_fc[1] = IEEE80211_FC1_DIR_FROMDS; 1175 IEEE80211_ADDR_COPY(wh->i_addr1, eh.ether_dhost); 1176 IEEE80211_ADDR_COPY(wh->i_addr2, ni->ni_bssid); 1177 IEEE80211_ADDR_COPY(wh->i_addr3, eh.ether_shost); 1178 break; 1179#ifdef IEEE80211_SUPPORT_MESH 1180 case IEEE80211_M_MBSS: 1181 /* NB: offset by hdrspace to deal with DATAPAD */ | 1099 } 1100 } else { 1101#endif 1102 /* 1103 * 4-address frames need to be generated for: 1104 * o packets sent through a WDS vap (IEEE80211_M_WDS) 1105 * o packets sent through a vap marked for relaying 1106 * (e.g. a station operating with dynamic WDS) --- 82 unchanged lines hidden (view full) --- 1189 wh->i_fc[1] = IEEE80211_FC1_DIR_FROMDS; 1190 IEEE80211_ADDR_COPY(wh->i_addr1, eh.ether_dhost); 1191 IEEE80211_ADDR_COPY(wh->i_addr2, ni->ni_bssid); 1192 IEEE80211_ADDR_COPY(wh->i_addr3, eh.ether_shost); 1193 break; 1194#ifdef IEEE80211_SUPPORT_MESH 1195 case IEEE80211_M_MBSS: 1196 /* NB: offset by hdrspace to deal with DATAPAD */ |
1182 mc = (struct ieee80211_meshcntl_ae11 *) | 1197 mc = (struct ieee80211_meshcntl_ae10 *) |
1183 (mtod(m, uint8_t *) + hdrspace); 1184 switch (meshae) { 1185 case 0: /* ucast, no proxy */ 1186 wh->i_fc[1] = IEEE80211_FC1_DIR_DSTODS; 1187 IEEE80211_ADDR_COPY(wh->i_addr1, ni->ni_macaddr); 1188 IEEE80211_ADDR_COPY(wh->i_addr2, vap->iv_myaddr); 1189 IEEE80211_ADDR_COPY(wh->i_addr3, eh.ether_dhost); 1190 IEEE80211_ADDR_COPY(WH4(wh)->i_addr4, eh.ether_shost); --- 7 unchanged lines hidden (view full) --- 1198 IEEE80211_ADDR_COPY(wh->i_addr3, eh.ether_shost); 1199 mc->mc_flags = 0; /* NB: AE is really 0 */ 1200 qos = ((struct ieee80211_qosframe *) wh)->i_qos; 1201 break; 1202 case 1: /* mcast, proxy */ 1203 wh->i_fc[1] = IEEE80211_FC1_DIR_FROMDS; 1204 IEEE80211_ADDR_COPY(wh->i_addr1, eh.ether_dhost); 1205 IEEE80211_ADDR_COPY(wh->i_addr2, vap->iv_myaddr); | 1198 (mtod(m, uint8_t *) + hdrspace); 1199 switch (meshae) { 1200 case 0: /* ucast, no proxy */ 1201 wh->i_fc[1] = IEEE80211_FC1_DIR_DSTODS; 1202 IEEE80211_ADDR_COPY(wh->i_addr1, ni->ni_macaddr); 1203 IEEE80211_ADDR_COPY(wh->i_addr2, vap->iv_myaddr); 1204 IEEE80211_ADDR_COPY(wh->i_addr3, eh.ether_dhost); 1205 IEEE80211_ADDR_COPY(WH4(wh)->i_addr4, eh.ether_shost); --- 7 unchanged lines hidden (view full) --- 1213 IEEE80211_ADDR_COPY(wh->i_addr3, eh.ether_shost); 1214 mc->mc_flags = 0; /* NB: AE is really 0 */ 1215 qos = ((struct ieee80211_qosframe *) wh)->i_qos; 1216 break; 1217 case 1: /* mcast, proxy */ 1218 wh->i_fc[1] = IEEE80211_FC1_DIR_FROMDS; 1219 IEEE80211_ADDR_COPY(wh->i_addr1, eh.ether_dhost); 1220 IEEE80211_ADDR_COPY(wh->i_addr2, vap->iv_myaddr); |
1206 /* XXX not right, need MeshSA */ 1207 IEEE80211_ADDR_COPY(wh->i_addr3, eh.ether_shost); | 1221 IEEE80211_ADDR_COPY(wh->i_addr3, vap->iv_myaddr); |
1208 mc->mc_flags = 1; 1209 IEEE80211_ADDR_COPY(mc->mc_addr4, eh.ether_shost); 1210 qos = ((struct ieee80211_qosframe *) wh)->i_qos; 1211 break; 1212 case 2: /* ucast, proxy */ 1213 wh->i_fc[1] = IEEE80211_FC1_DIR_DSTODS; 1214 IEEE80211_ADDR_COPY(wh->i_addr1, ni->ni_macaddr); 1215 IEEE80211_ADDR_COPY(wh->i_addr2, vap->iv_myaddr); | 1222 mc->mc_flags = 1; 1223 IEEE80211_ADDR_COPY(mc->mc_addr4, eh.ether_shost); 1224 qos = ((struct ieee80211_qosframe *) wh)->i_qos; 1225 break; 1226 case 2: /* ucast, proxy */ 1227 wh->i_fc[1] = IEEE80211_FC1_DIR_DSTODS; 1228 IEEE80211_ADDR_COPY(wh->i_addr1, ni->ni_macaddr); 1229 IEEE80211_ADDR_COPY(wh->i_addr2, vap->iv_myaddr); |
1216 /* XXX not right, need MeshDA+MeshSA */ | 1230 /* XXX not right, need MeshDA */ |
1217 IEEE80211_ADDR_COPY(wh->i_addr3, eh.ether_dhost); | 1231 IEEE80211_ADDR_COPY(wh->i_addr3, eh.ether_dhost); |
1218 IEEE80211_ADDR_COPY(WH4(wh)->i_addr4, eh.ether_shost); | 1232 /* XXX assume are MeshSA */ 1233 IEEE80211_ADDR_COPY(WH4(wh)->i_addr4, vap->iv_myaddr); |
1219 mc->mc_flags = 2; | 1234 mc->mc_flags = 2; |
1235 IEEE80211_ADDR_COPY(mc->mc_addr4, eh.ether_dhost); |
|
1220 IEEE80211_ADDR_COPY(mc->mc_addr5, eh.ether_shost); | 1236 IEEE80211_ADDR_COPY(mc->mc_addr5, eh.ether_shost); |
1221 IEEE80211_ADDR_COPY(mc->mc_addr6, eh.ether_shost); | |
1222 qos = ((struct ieee80211_qosframe_addr4 *) wh)->i_qos; 1223 break; 1224 default: 1225 KASSERT(0, ("meshae %d", meshae)); 1226 break; 1227 } 1228 mc->mc_ttl = ms->ms_ttl; 1229 ms->ms_seq++; --- 1790 unchanged lines hidden --- | 1237 qos = ((struct ieee80211_qosframe_addr4 *) wh)->i_qos; 1238 break; 1239 default: 1240 KASSERT(0, ("meshae %d", meshae)); 1241 break; 1242 } 1243 mc->mc_ttl = ms->ms_ttl; 1244 ms->ms_seq++; --- 1790 unchanged lines hidden --- |