This is a second attempt at a patch for include/linux/if_vlan.h . Its purpose is to allow a user space program to use the vlan_ethhdr structure when directly handling 802.1Q packets. This can be done by using a raw socket like: int s = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); This socket should see VLAN packets from the base interface unchanged (i.e. vlan tag still in packet). Currently other user space programs that understand VLANs seem to all create their own definitions for this structure. This patch does NOT expose the defines related to the sizes of VLAN packets and their fields; it only exposes the vlan_ethhdr structure. It was determined that these sizes are not useful since the packet could be as large the MTU of the underlying physical network. Also, you can have nested VLAN headers such that the actual data offset is greater than the size of the vlan_ethhdr structure. -Dave Acker
Signed-off-by: David Acker <[EMAIL PROTECTED]> ---------------------------------------------- *** if_vlan.h.orig 2006-03-19 21:11:01.000000000 -0500 --- if_vlan.h 2006-04-07 13:51:44.000000000 -0400 *************** *** 13,18 **** --- 13,26 ---- #ifndef _LINUX_IF_VLAN_H_ #define _LINUX_IF_VLAN_H_ + struct vlan_ethhdr { + unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ + unsigned char h_source[ETH_ALEN]; /* source ether addr */ + __be16 h_vlan_proto; /* Should always be 0x8100 */ + __be16 h_vlan_TCI; /* Encapsulates priority and VLAN ID */ + unsigned short h_vlan_encapsulated_proto; /* packet type ID field (or len) */ + }; + #ifdef __KERNEL__ /* externally defined structs */ *************** *** 39,52 **** #define VLAN_ETH_DATA_LEN 1500 /* Max. octets in payload */ #define VLAN_ETH_FRAME_LEN 1518 /* Max. octets in frame sans FCS */ - struct vlan_ethhdr { - unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ - unsigned char h_source[ETH_ALEN]; /* source ether addr */ - __be16 h_vlan_proto; /* Should always be 0x8100 */ - __be16 h_vlan_TCI; /* Encapsulates priority and VLAN ID */ - unsigned short h_vlan_encapsulated_proto; /* packet type ID field (or len) */ - }; - #include <linux/skbuff.h> static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) --- 47,52 ---- - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html