@@ -130,8 +130,6 @@ static inline u16 vlan_dev_vlan_id(const struct net_device *dev)
static inline bool vlan_do_receive(struct sk_buff **skb)
{
- if ((*skb)->vlan_tci & VLAN_VID_MASK)
- (*skb)->pkt_type = PACKET_OTHERHOST;
return false;
}
@@ -141,6 +139,14 @@ static inline struct sk_buff *vlan_untag(struct sk_buff *skb)
}
#endif
+static inline void vlan_handle_leftover(struct sk_buff *skb)
+{
+ u16 vlan_id = skb->vlan_tci & VLAN_VID_MASK;
+
+ if (vlan_id)
+ skb->pkt_type = PACKET_OTHERHOST;
+}
+
/**
* vlan_insert_tag - regular VLAN tag inserting
* @skb: skbuff to tag
@@ -12,11 +12,8 @@ bool vlan_do_receive(struct sk_buff **skbp)
struct vlan_pcpu_stats *rx_stats;
vlan_dev = vlan_find_dev(skb->dev, vlan_id);
- if (!vlan_dev) {
- if (vlan_id)
- skb->pkt_type = PACKET_OTHERHOST;
+ if (!vlan_dev)
return false;
- }
skb = *skbp = skb_share_check(skb, GFP_ATOMIC);
if (unlikely(!skb))
@@ -3314,6 +3314,14 @@ ncls:
}
}
+ if (vlan_tx_tag_present(skb)) {
+ /*
+ * Tag is still present here. That means there's no device
+ * set up for this vlan id. So handle these leftovers here.
+ */
+ vlan_handle_leftover(skb);
+ }
+
/* deliver only exact match when indicated */
null_or_dev = deliver_exact ? skb->dev : NULL;