mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	mac802154: iface: assume big endian for af_packet
The callback "create" and "parse" from header_ops are called from netdev core upper-layer functionality, like af_packet. These callbacks assumes big endian for addresses and we should not introduce a special byteordering handling for ieee802154 over af_packet in userspace. We have an identical issue with setting the mac address which also assumes big endian byteordering. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
		
							parent
							
								
									f856f21dbc
								
							
						
					
					
						commit
						c2d5ecfaea
					
				
					 1 changed files with 3 additions and 5 deletions
				
			
		| 
						 | 
					@ -461,7 +461,7 @@ static int mac802154_header_create(struct sk_buff *skb,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	hdr.dest.pan_id = wpan_dev->pan_id;
 | 
						hdr.dest.pan_id = wpan_dev->pan_id;
 | 
				
			||||||
	hdr.dest.mode = IEEE802154_ADDR_LONG;
 | 
						hdr.dest.mode = IEEE802154_ADDR_LONG;
 | 
				
			||||||
	memcpy(&hdr.dest.extended_addr, daddr, IEEE802154_EXTENDED_ADDR_LEN);
 | 
						ieee802154_be64_to_le64(&hdr.dest.extended_addr, daddr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	hdr.source.pan_id = hdr.dest.pan_id;
 | 
						hdr.source.pan_id = hdr.dest.pan_id;
 | 
				
			||||||
	hdr.source.mode = IEEE802154_ADDR_LONG;
 | 
						hdr.source.mode = IEEE802154_ADDR_LONG;
 | 
				
			||||||
| 
						 | 
					@ -469,8 +469,7 @@ static int mac802154_header_create(struct sk_buff *skb,
 | 
				
			||||||
	if (!saddr)
 | 
						if (!saddr)
 | 
				
			||||||
		hdr.source.extended_addr = wpan_dev->extended_addr;
 | 
							hdr.source.extended_addr = wpan_dev->extended_addr;
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		memcpy(&hdr.source.extended_addr, saddr,
 | 
							ieee802154_be64_to_le64(&hdr.source.extended_addr, saddr);
 | 
				
			||||||
		       IEEE802154_EXTENDED_ADDR_LEN);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	hlen = ieee802154_hdr_push(skb, &hdr);
 | 
						hlen = ieee802154_hdr_push(skb, &hdr);
 | 
				
			||||||
	if (hlen < 0)
 | 
						if (hlen < 0)
 | 
				
			||||||
| 
						 | 
					@ -496,8 +495,7 @@ mac802154_header_parse(const struct sk_buff *skb, unsigned char *haddr)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (hdr.source.mode == IEEE802154_ADDR_LONG) {
 | 
						if (hdr.source.mode == IEEE802154_ADDR_LONG) {
 | 
				
			||||||
		memcpy(haddr, &hdr.source.extended_addr,
 | 
							ieee802154_le64_to_be64(haddr, &hdr.source.extended_addr);
 | 
				
			||||||
		       IEEE802154_EXTENDED_ADDR_LEN);
 | 
					 | 
				
			||||||
		return IEEE802154_EXTENDED_ADDR_LEN;
 | 
							return IEEE802154_EXTENDED_ADDR_LEN;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue