[mpls-linux-general] Re: MPLS-Diffserv Instructions + Counters
Status: Beta
Brought to you by:
jleu
From: Stefano A. <avi...@li...> - 2002-02-25 16:28:04
|
Hi Paul and all, On Friday 22 February 2002 14:31, ncc49a wrote: > Hi Stefano, James and all, > > Stefano, when I put executed the "pop" before the exp2ds, it worked!! > Thanks! > > However, I encountered another problem. > 1) The exp->ds mapping is sometimes reflected incorrectly in the > "/proc/mpls_*" files. Could you provide any example ? > 2) To test the exp2ds function, I have set up a couple of MPLS routers > in serial, with non-MPLS hosts/routers at each ends. I then ping an end > host from the other end. The non-Mpls host/router which is the origin will > mark a packet's DSCP. The edge MPLS router will mark the EXP bits based on > the DSCP value. The edge MPLS router at the end will re-mark the DSCP of > the incoming packet, based on its EXP. As the packet returns, it will mark > the outgoing EXP bits based on the new DSCP. The origin MPLS edge router > will then remark the DSCP (again) based on the incoming new EXP bits. > > I monitor at the origin MPLS router's interfaces. I find that the > new EXP bits on the shim of the returned incoming ping packet is correct. > However,the returning packet on the outgoing interface of the origin MPLS > edge (connected to the origin non-MPLS host/router) has its DSCP bits > marked wrongly. > > Anyone knows what could be a possible reason? > It seems strange to me. Have you checked that /proc/net/mpls_* content reflects what you want to do ? Anyway, you should provide more information (e.g. the commands you typed and what instead you obtain) to let someone help you. > I have also tried the exp2tc.. function. I ran the following script. I > think dsmark works like that: NEW_DS_FIELD = (tc_index & MASK) | VALUE. So > with a MASK of 0xff and a VALUE of 0, I can check exp2tc function by > setting the tc_index to the required DS field value, such that I get the > desired DSCP value right? No, this is right : New_DS_field = (Old_DS_field & Mask) | Value. > > -----------------------------------SCRIPT > STARTS-------------------------------------------------------- > #!/bin/sh > TC=tc > ITF=eth1 > DEST=192.168.0.1 > # NEW_DS_FIELD = (tc_index & MASK) | VALUE > # EF -> DSCP:0x2e DS:0xb8 > # AF31-> DSCP: 0x1a DS:0x68 > # AF21 -> DSCP:0x12 DS:0x48 > MASK1=0xff > VALUE1=0x0 > $TC qdisc del dev $ITF root > $TC qdisc add dev $ITF handle 1:0 root dsmark indices 64 > $TC class change dev $ITF classid 1:1 dsmark mask $MASK1 value $VALUE1 > $TC filter add dev $ITF parent 1:0 protocol ip prio 4 handle 1: u32 divisor > 1 > $TC filter add dev $ITF parent 1:0 prio 4 u32 \ > match ip dst $DEST \ > police rate 3Mbit burst 2K continue \ > flowid 1:1 > ------------------------------SCRIPT > ENDS---------------------------------------------------- > > I have an incoming packet with label 199 and its EXP bit marked > accordingly, to say 2. I execute the following command to set an incoming > label. > > mplsadm2 -v -A -I gen:199:0 > mplsadm2 -v -I gen:199:0 -i pop:exp2tc:2:184:peek > > As 184 is 0xb8, I should get a DS field of 0xb8 and a DSCP of 0x2e > (EF), right? But, I don't. The whole DS field remains unmarked. I expected this, since mask=0xff and value=0 means that DS field will be left unchanged. > I have tried : > > mplsadm2 -v -I gen:199:0 -i exp2tc:2:184:pop:peek > > But I dun think that worked either. > > Stefano, have u tried out the exp2tc function? I may have missed out > things or did things wrongly... Do please correct me.. I will appreciate it > greatly! > You could try this way: you use a tcindex filter (which classify packets based on skb->tc_index) to select a dsmark class which sets the desired DSCP value. For example: mplsadm2 -v -A -I gen:199:0 mplsadm2 -v -I gen:199:0 -i pop:exp2tc:2:184:peek tc qdisc add dev $ITF handle 1:0 root dsmark indices 64 tc class change dev $ITF classid 1:1 dsmark mask 0x0 value 0xb8 tc filter add dev $ITF parent 1:0 protocol ip prio 1 tcindex mask 0xff tc filter add dev $ITF parent 1:0 protocol ip prio 1 handle 184 tcindex classid 1:1 Thus packets arriving with label 199 and Exp 2 will leave with DS field 0xb8 (DSCP 0x2e). Let me know if this works. If you want more details on dsmark qdisc and tcindex classifier you can get the Linux Advanced Routing & Traffic Control HOWTO at http://lartc.org and see section "DSMARK". Stefano |