diff options
Diffstat (limited to 'net/mac802154/wpan.c')
-rw-r--r-- | net/mac802154/wpan.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c index 051ed46ffca9..b61426662867 100644 --- a/net/mac802154/wpan.c +++ b/net/mac802154/wpan.c | |||
@@ -251,18 +251,18 @@ static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb) | |||
251 | static int | 251 | static int |
252 | mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb) | 252 | mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb) |
253 | { | 253 | { |
254 | u16 span, sshort; | 254 | __le16 span, sshort; |
255 | 255 | ||
256 | pr_debug("getting packet via slave interface %s\n", sdata->dev->name); | 256 | pr_debug("getting packet via slave interface %s\n", sdata->dev->name); |
257 | 257 | ||
258 | spin_lock_bh(&sdata->mib_lock); | 258 | spin_lock_bh(&sdata->mib_lock); |
259 | 259 | ||
260 | span = le16_to_cpu(sdata->pan_id); | 260 | span = sdata->pan_id; |
261 | sshort = le16_to_cpu(sdata->short_addr); | 261 | sshort = sdata->short_addr; |
262 | 262 | ||
263 | switch (mac_cb(skb)->da.addr_type) { | 263 | switch (mac_cb(skb)->dest.mode) { |
264 | case IEEE802154_ADDR_NONE: | 264 | case IEEE802154_ADDR_NONE: |
265 | if (mac_cb(skb)->sa.addr_type != IEEE802154_ADDR_NONE) | 265 | if (mac_cb(skb)->dest.mode != IEEE802154_ADDR_NONE) |
266 | /* FIXME: check if we are PAN coordinator */ | 266 | /* FIXME: check if we are PAN coordinator */ |
267 | skb->pkt_type = PACKET_OTHERHOST; | 267 | skb->pkt_type = PACKET_OTHERHOST; |
268 | else | 268 | else |
@@ -270,23 +270,22 @@ mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb) | |||
270 | skb->pkt_type = PACKET_HOST; | 270 | skb->pkt_type = PACKET_HOST; |
271 | break; | 271 | break; |
272 | case IEEE802154_ADDR_LONG: | 272 | case IEEE802154_ADDR_LONG: |
273 | if (mac_cb(skb)->da.pan_id != span && | 273 | if (mac_cb(skb)->dest.pan_id != span && |
274 | mac_cb(skb)->da.pan_id != IEEE802154_PANID_BROADCAST) | 274 | mac_cb(skb)->dest.pan_id != cpu_to_le16(IEEE802154_PANID_BROADCAST)) |
275 | skb->pkt_type = PACKET_OTHERHOST; | 275 | skb->pkt_type = PACKET_OTHERHOST; |
276 | else if (!memcmp(mac_cb(skb)->da.hwaddr, sdata->dev->dev_addr, | 276 | else if (mac_cb(skb)->dest.extended_addr == sdata->extended_addr) |
277 | IEEE802154_ADDR_LEN)) | ||
278 | skb->pkt_type = PACKET_HOST; | 277 | skb->pkt_type = PACKET_HOST; |
279 | else | 278 | else |
280 | skb->pkt_type = PACKET_OTHERHOST; | 279 | skb->pkt_type = PACKET_OTHERHOST; |
281 | break; | 280 | break; |
282 | case IEEE802154_ADDR_SHORT: | 281 | case IEEE802154_ADDR_SHORT: |
283 | if (mac_cb(skb)->da.pan_id != span && | 282 | if (mac_cb(skb)->dest.pan_id != span && |
284 | mac_cb(skb)->da.pan_id != IEEE802154_PANID_BROADCAST) | 283 | mac_cb(skb)->dest.pan_id != cpu_to_le16(IEEE802154_PANID_BROADCAST)) |
285 | skb->pkt_type = PACKET_OTHERHOST; | 284 | skb->pkt_type = PACKET_OTHERHOST; |
286 | else if (mac_cb(skb)->da.short_addr == sshort) | 285 | else if (mac_cb(skb)->dest.short_addr == sshort) |
287 | skb->pkt_type = PACKET_HOST; | 286 | skb->pkt_type = PACKET_HOST; |
288 | else if (mac_cb(skb)->da.short_addr == | 287 | else if (mac_cb(skb)->dest.short_addr == |
289 | IEEE802154_ADDR_BROADCAST) | 288 | cpu_to_le16(IEEE802154_ADDR_BROADCAST)) |
290 | skb->pkt_type = PACKET_BROADCAST; | 289 | skb->pkt_type = PACKET_BROADCAST; |
291 | else | 290 | else |
292 | skb->pkt_type = PACKET_OTHERHOST; | 291 | skb->pkt_type = PACKET_OTHERHOST; |
@@ -332,8 +331,8 @@ static void mac802154_print_addr(const char *name, | |||
332 | 331 | ||
333 | static int mac802154_parse_frame_start(struct sk_buff *skb) | 332 | static int mac802154_parse_frame_start(struct sk_buff *skb) |
334 | { | 333 | { |
335 | struct ieee802154_hdr hdr; | ||
336 | int hlen; | 334 | int hlen; |
335 | struct ieee802154_hdr hdr; | ||
337 | 336 | ||
338 | hlen = ieee802154_hdr_pull(skb, &hdr); | 337 | hlen = ieee802154_hdr_pull(skb, &hdr); |
339 | if (hlen < 0) | 338 | if (hlen < 0) |
@@ -346,9 +345,6 @@ static int mac802154_parse_frame_start(struct sk_buff *skb) | |||
346 | 345 | ||
347 | mac_cb(skb)->flags = hdr.fc.type; | 346 | mac_cb(skb)->flags = hdr.fc.type; |
348 | 347 | ||
349 | ieee802154_addr_to_sa(&mac_cb(skb)->sa, &hdr.source); | ||
350 | ieee802154_addr_to_sa(&mac_cb(skb)->da, &hdr.dest); | ||
351 | |||
352 | if (hdr.fc.ack_request) | 348 | if (hdr.fc.ack_request) |
353 | mac_cb(skb)->flags |= MAC_CB_FLAG_ACKREQ; | 349 | mac_cb(skb)->flags |= MAC_CB_FLAG_ACKREQ; |
354 | if (hdr.fc.security_enabled) | 350 | if (hdr.fc.security_enabled) |
@@ -357,6 +353,9 @@ static int mac802154_parse_frame_start(struct sk_buff *skb) | |||
357 | mac802154_print_addr("destination", &hdr.dest); | 353 | mac802154_print_addr("destination", &hdr.dest); |
358 | mac802154_print_addr("source", &hdr.source); | 354 | mac802154_print_addr("source", &hdr.source); |
359 | 355 | ||
356 | mac_cb(skb)->source = hdr.source; | ||
357 | mac_cb(skb)->dest = hdr.dest; | ||
358 | |||
360 | if (hdr.fc.security_enabled) { | 359 | if (hdr.fc.security_enabled) { |
361 | u64 key; | 360 | u64 key; |
362 | 361 | ||