LARTC��hello��

����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 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
����������������������������[EMAIL PROTECTED]
����������������������������������2002-03-19
�E0�j)b�       b���™����ݳ֧�m���j)fjwl����f��f��X��)ߣ�Z��9dΆ�i��Z��(�


Reply via email to