All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Devera <devik@cdi.cz>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] a question about q_tbf.c of TC
Date: Thu, 21 Mar 2002 08:57:20 +0000	[thread overview]
Message-ID: <marc-lartc-101670749506548@msgid-missing> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1254", Size: 2346 bytes --]

Hello,

IIRC it is ok. The TCA_KIND is used as upper level ID. TCA_TBF_PARAMS
is in second level, it is contained as data of TBF kind. Take dump
of whole NL message and study carefully.
It is like:
TCA_KIND  "TBF"
TCA_XXXX {
  TCA_TBF_PARAMS ....
  TCA_TBF_XXXX .....
}
TCA_YYY ...

So that when rtnetlink_rev_msg parses message first time it skips
all occurences of TCA_TBF_*. q_tbf is given data part of TCA_XXXX
(can't remember name) and it calls rt parse function again on the
data.
devik

> ¡¡¡¡ I want to send a command "tc qdisc add dev eth0 root tbf rate 220kbit latency 50ms burst 1540" from TC,
> I found that a attribute with type of 1 is added to the nlmsg twice:
> 
>     first time in the function of tc_qdisc_modify() in file of tc_qdisc.c:
> 	"if (k[0])
> 		addattr_l(&req.n, sizeof(req), TCA_KIND, k, strlen(k)+1);"
> 
> 	second time in the function of tbf_parse_opt() in file of q_tbf.c:
>     "addattr_l(n, 2024, TCA_TBF_PARMS, &opt, sizeof(opt));"
> 
> 	the value of TCA_KIND and TCA_TBF_PARAMS is both 1,so the nlmsg consists two attribute with type of 1.
> 
>     when this nlmsg is dealed with in the kernel,I found a problem:
> 
>     in the net/core/rtnetlink.c, function rtnetlink_rev_msg(),when:
> 
> 	"if (nlh->nlmsg_len > min_len) {
> 		int attrlen = nlh->nlmsg_len - NLMSG_ALIGN(min_len);
> 		struct rtattr *attr = (void*)nlh + NLMSG_ALIGN(min_len);
> 
> 		while (RTA_OK(attr, attrlen)) {
> 			unsigned flavor = attr->rta_type;
> 			if (flavor) {
> 				if (flavor > rta_max[sz_idx])
> 					goto err_inval;
> 				rta[flavor-1] = attr;
> 			}
> 			attr = RTA_NEXT(attr, attrlen);
> 		}
> 	}"
> 
> 	at the begining of these lines, the first attribute(TCA_KIND) can be stored in rta[1], but when handling
> the second attribute, it is stored in the same rta[1]! so the first attribute disappeared!!
>     of course the treatment followed will make a mistake.
>     who can tell me why?
> 
> 
> ¡¡¡¡¡¡best regards!
> 
>  				
> ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Mebius Huang
> ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡hxgang@csnet4.cs.tsinghua.edu.cn
> ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2000-02-21
> ,\x04S
> f¢–)à–+-ü°\x11L)šŠYšÛ=jya¶Ú~ÿùšŠYšÛ=jy\x7f™¨¥™©ÿ–+-ŠwèþV«µÁÎY3¾†Ûiûÿåj»\¢¸?

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

             reply	other threads:[~2002-03-21  8:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-21  8:57 Martin Devera [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-02-21  2:32 [LARTC] a question about q_tbf.c of TC Mebius Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-lartc-101670749506548@msgid-missing \
    --to=devik@cdi.cz \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.