[Click] VLAN and Click

Frederic Van Quickenborne frederic.vanquickenborne at intec.ugent.be
Thu Feb 2 07:58:57 EST 2006


Junhe Jian wrote:

>Hi Frederic and other click user,
>
>thank you for the fast answer @ frederic!
>if i understand u mean only with the filter of classifier does it works!
>so i have a little question:
>what does it mean the number before "/" and after "/", is the bit
>position of the complete ethernet frame with VLAN tag?
>i found something in ehter.h:
>
>struct click_arp {		/* Offsets relative to ARP (Ethernet) header */
>    uint16_t	ar_hrd;		/* 0-1 (14-15)  hardware address format      */
>#define ARPHRD_ETHER    1       /*		  Ethernet 10Mbps	     */
>    uint16_t	ar_pro;		/* 2-3 (16-17)  protocol address format      */
>    uint8_t	ar_hln;		/* 4   (18)     hardware address length      */
>    uint8_t	ar_pln;		/* 5   (19)     protocol address length      */
>    uint16_t	ar_op;		/* 6-7 (20-21)  opcode (command)	     */
>#define ARPOP_REQUEST   1       /*		  ARP request		     */
>#define ARPOP_REPLY	2       /*		  ARP reply		     */
>};
>
>struct click_ether_arp {
>struct click_arp ea_hdr;	/* 0-7 (14-21) fixed-size ARP header	 */
>    uint8_t	arp_sha[6];	/* 8-13  (22-27)  sender hardware address    */
>    uint8_t	arp_spa[4];	/* 14-17 (28-31)  sender protocol address    */
>    uint8_t	arp_tha[6];	/* 18-23 (32-37)  target hardware address    */
>    uint8_t	arp_tpa[4];	/* 24-27 (38-41)  target protocol address    */
>};
>
>
>/* Ethernet with VLAN (802.1q) */
>
>CLICK_SIZE_PACKED_STRUCTURE(
>struct click_ether_vlan {,
>uint8_t ether_dhost[6];		/* 0-5 Ethernet source address */
>uint8_t ether_shost[6];		/* 6-11 Ethernet destination address */
>    uint16_t    ether_vlan_proto;	/* 12-13 == ETHERTYPE_8021Q	      */
>uint16_t ether_vlan_tci;		/* 14-15 tag control information */
>uint16_t ether_vlan_encap_proto;	/* 16-17 Ethernet protocol	 */
>does the number of offsets ar the number before "/" and what does the
>number in "()" in ehter.h mean???
>
>if i understand "14/" is the position where VLAN packet tag control are,
>and "0002" mean the 3 priority bits of the VLAN Tag packet, but i dont
>understand the number after "%"OFFF??
>  
>
This is the mask: it means that only the bits of the mask equals 1 will 
be considered, it is a kind of a binary AND: for example
0002%0FFF, in binary
0000 0000 0000 0010 && 0000 1111 1111 1111, thus only the twelve bits on 
the right side of the 0002 will be taken into account, and not the 4 at 
the left side.

I hope this helps you a little further.

Best regards,
Frederic.

>
>anyhelp welcome!
>
>besr regards
>jian
>
>
>Am Sa 28.01.2006 09:06 schrieb Frederic Van Quickenborne
><frederic.vanquickenborne at intec2.ugent.be>:
>
>  
>
>>Hi Jian,
>>
>>you can use smart filtering in the classifier to filter your packets:
>>e.g. if you want to filter out the packets on VLAN 2 use this filer:  
>>14/0002%0FFF, if you want to map the priority, you can use one like  
>>this: 14/40%D0 (this one is for priority class 2). The hex code after
>>the '%' works as a mask for the bits you are looking for (hex code  
>>between '/' and '%') in the packet on place (given by the number  
>>before the '/'). (I'm not sure the place to look (14) is correct, it  
>>could be 13 also, if the classifier starts searching from byte 0.)
>>
>>Kind regards,
>>Frederic.
>>
>>Op 26-jan-06, om 15:33 heeft Junhe Jian het volgende geschreven:
>>
>>    
>>
>>>hi Click User!
>>>
>>>i need your help!
>>>in a project i should to do Click with VLAN support!
>>>example: a video stream server send a videostream over VLAN and use
>>>User
>>>Priority Bit from VLAN TAG for identification. and the user must
>>>have
>>>the same User Priority bit to receive the video-stream.
>>>
>>>my question:
>>>how can i use Click to mapping the User Prority Bit from VLAN TAG
>>>and
>>>redirect the packet to the user!
>>>i know i can use Classifier 12/8100 redirect the packet to a device
>>>but
>>>don't know how i can mapping the User-Priority! or i don't need to
>>>mapping coz with the right MAC-address and VLAN ID the user get
>>>their
>>>packet?
>>>any help welcome!
>>>
>>>regards
>>>jian
>>>
>>>      
>>>
>
>  
>

-- 
Frederic Van Quickenborne
Department of Information Technology (INTEC)
Ghent University - IBBT - IMEC
Gaston Crommenlaan 8 (Bus 201), B-9050 Gent, Belgium
tel.: +32-9331 4974; tel. secr.: +32-9331 4900
fax: +32-9331 4899
Frederic.VanQuickenborne at intec.ugent.be
http://www.ibcn.intec.ugent.be

The contents of this e-mail are intended for the named addressee(s) only. It contains information which may be confidential and which may also be privileged. Unless you are the named addressee (or authorised to receive for the addressee) you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. Further, we make every effort to keep our network free from viruses. However, you do need to check this e-mail and any attachments to it for viruses as we can take no responsibility for any computer virus which might be transferred by way of this e-mail.




More information about the click mailing list