* Re: [LARTC] a question about q_tbf.c of TC
@ 2002-03-21 8:57 Martin Devera
0 siblings, 0 replies; 2+ messages in thread
From: Martin Devera @ 2002-03-21 8:57 UTC (permalink / raw)
To: lartc
[-- 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/
^ permalink raw reply [flat|nested] 2+ messages in thread* [LARTC] a question about q_tbf.c of TC
@ 2000-02-21 2:32 Mebius Huang
0 siblings, 0 replies; 2+ messages in thread
From: Mebius Huang @ 2000-02-21 2:32 UTC (permalink / raw)
To: lartc
TEFSVEOjrGhlbGxvo6ENCg0KoaGhoSBJIHdhbnQgdG8gc2VuZCBhIGNvbW1hbmQgInRjIHFkaXNj
IGFkZCBkZXYgZXRoMCByb290IHRiZiByYXRlIDIyMGtiaXQgbGF0ZW5jeSA1MG1zIGJ1cnN0IDE1
NDAiIGZyb20gVEMsDQpJIGZvdW5kIHRoYXQgYSBhdHRyaWJ1dGUgd2l0aCB0eXBlIG9mIDEgaXMg
YWRkZWQgdG8gdGhlIG5sbXNnIHR3aWNlOg0KDQogICAgZmlyc3QgdGltZSBpbiB0aGUgZnVuY3Rp
b24gb2YgdGNfcWRpc2NfbW9kaWZ5KCkgaW4gZmlsZSBvZiB0Y19xZGlzYy5jOg0KCSJpZiAoa1sw
XSkNCgkJYWRkYXR0cl9sKCZy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V9O
RVhUKGF0dHIsIGF0dHJsZW4pOw0KCQl9DQoJfSINCg0KCWF0IHRoZSBiZWdpbmluZyBvZiB0aGVz
ZSBsaW5lcywgdGhlIGZpcnN0IGF0dHJpYnV0ZShUQ0FfS0lORCkgY2FuIGJlIHN0b3JlZCBpbiBy
dGFbMV0sIGJ1dCB3aGVuIGhhbmRsaW5nDQp0aGUgc2Vjb25kIGF0dHJpYnV0ZSwgaXQgaXMgc3Rv
cmVkIGluIHRoZSBzYW1lIHJ0YVsxXSEgc28gdGhlIGZpcnN0IGF0dHJpYnV0ZSBkaXNhcHBlYXJl
ZCEhDQogICAgb2YgY291cnNlIHRoZSB0cmVhdG1lbnQgZm9sbG93ZWQgd2lsbCBtYWtlIGEgbWlz
dGFrZS4NCiAgICB3aG8gY2FuIHRlbGwgbWUgd2h5Pw0KDQoNCqGhoaGhoWJlc3QgcmVnYXJkcyEN
Cg0KIAkJCQkNCqGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaFNZWJpdXMgSHVhbmcNCqGhoaGh
oaGhoaGhoaGhoaGhoaGhoaGhoaGhoaFoeGdhbmdAY3NuZXQ0LmNzLnRzaW5naHVhLmVkdS5jbg0K
oaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoTIwMDAtMDItMjENCg=
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-03-21 8:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-21 8:57 [LARTC] a question about q_tbf.c of TC Martin Devera
-- strict thread matches above, loose matches on Subject: below --
2000-02-21 2:32 Mebius Huang
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.