Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

6lowpan: iphc: override l2 packet information

The skb->pkt_type need to be set by L2, but on 6LoWPAN there exists L2
e.g. BTLE which doesn't has multicast addressing. If it's a multicast or
not is detected by IPHC headers multicast bit. The IPv6 layer will
evaluate this pkt_type, so we force set this type while uncompressing.
Should be okay for 802.15.4 as well.

Signed-off-by: Alexander Aring <aar@pengutronix.de>
Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

authored by

Alexander Aring and committed by
Marcel Holtmann
94e4a680 be054fc8

+8
+8
net/6lowpan/iphc.c
··· 666 666 667 667 switch (iphc1 & (LOWPAN_IPHC_M | LOWPAN_IPHC_DAC)) { 668 668 case LOWPAN_IPHC_M | LOWPAN_IPHC_DAC: 669 + skb->pkt_type = PACKET_BROADCAST; 670 + 669 671 spin_lock_bh(&lowpan_dev(dev)->ctx.lock); 670 672 ci = lowpan_iphc_ctx_get_by_id(dev, LOWPAN_IPHC_CID_DCI(cid)); 671 673 if (!ci) { ··· 683 681 spin_unlock_bh(&lowpan_dev(dev)->ctx.lock); 684 682 break; 685 683 case LOWPAN_IPHC_M: 684 + skb->pkt_type = PACKET_BROADCAST; 685 + 686 686 /* multicast */ 687 687 err = lowpan_uncompress_multicast_daddr(skb, &hdr.daddr, 688 688 iphc1 & LOWPAN_IPHC_DAM_MASK); 689 689 break; 690 690 case LOWPAN_IPHC_DAC: 691 + skb->pkt_type = PACKET_HOST; 692 + 691 693 spin_lock_bh(&lowpan_dev(dev)->ctx.lock); 692 694 ci = lowpan_iphc_ctx_get_by_id(dev, LOWPAN_IPHC_CID_DCI(cid)); 693 695 if (!ci) { ··· 707 701 spin_unlock_bh(&lowpan_dev(dev)->ctx.lock); 708 702 break; 709 703 default: 704 + skb->pkt_type = PACKET_HOST; 705 + 710 706 err = lowpan_iphc_uncompress_addr(skb, dev, &hdr.daddr, 711 707 iphc1 & LOWPAN_IPHC_DAM_MASK, 712 708 daddr);