unsigned short get_vlan_id(struct sk_buff *skb){ struct vlan_hdr *hdr; unsigned short tci; unsigned short id = 0; if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) { hdr = (struct vlan_hdr *)(skb->data); tci = hdr->h_vlan_TCI; id = (tci & VLAN_VID_MASK) >> 8; } return id;}
/* This function will return Vlan id of a skb. */
沒有留言:
張貼留言