a question about q_tbf.c of TC
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
Quoted 37 lines
¡¡¡¡ 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 handlingthe 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?
Quoted 8 lines
¡¡¡¡¡¡best regards!
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Mebius Huang ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡[email protected] ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2000-02-21
,S f¢–)à–+-ü°L)šŠYš�Û=jya¶Ú~ÿùšŠYš�Û=jy™¨¥™©ÿ–+-ŠwèşV«µÁÎY3¾†Ûiûÿåj»\¢¸?
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/