~ubuntu-branches/ubuntu/hardy/iproute/hardy-proposed

« back to all changes in this revision

Viewing changes to tc/q_gred.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2006-07-06 10:23:46 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060706102346-tyd1mfjvay0nmz90
Tags: 20051007-4ubuntu1
* Merge from debian unstable, remaining changes:
  - versioned dependency on linux-kernel-headers,
  - MAX_ROUNDS patch to ip/ipaddress.c

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
                                    "defined after DPs\n");
77
77
                                return -1;
78
78
                        }
79
 
#if 0
80
 
                        if (opt.def_DP>opt.DPs-1) {
81
 
#endif
82
79
                        if (opt.def_DP>opt.DPs) {
83
80
/*
84
81
                                fprintf(stderr, "\"default DP\" must be less than %d\nNote: DP runs from 0 to %d for %d DPs\n",opt.DPs,opt.DPs-1,opt.DPs);
106
103
}
107
104
DPRINTF("TC_GRED: sending DPs=%d default=%d\n",opt.DPs,opt.def_DP);
108
105
        n->nlmsg_flags|=NLM_F_CREATE;
109
 
        tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
110
 
 
 
106
        tail = NLMSG_TAIL(n);
111
107
        addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
112
108
        addattr_l(n, 1024, TCA_GRED_DPS, &opt, sizeof(struct tc_gred_sopt));
113
 
        tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
 
109
        tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
114
110
return 0;
115
111
}
116
112
/*
169
165
                                fprintf(stderr, "GRED: only %d DPs are currently supported\n",MAX_DPs);
170
166
                                return -1;
171
167
                        }
172
 
#if 0
173
 
                                return -1;
174
 
                        }
175
 
#endif
176
168
                        ok++;
177
169
                } else if (strcmp(*argv, "burst") == 0) {
178
170
                        NEXT_ARG();
252
244
        }
253
245
        opt.Scell_log = wlog;
254
246
 
255
 
        tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
256
 
 
 
247
        tail = NLMSG_TAIL(n);
257
248
        addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
258
249
        addattr_l(n, 1024, TCA_GRED_PARMS, &opt, sizeof(opt));
259
250
        addattr_l(n, 1024, TCA_GRED_STAB, sbuf, 256);
260
 
        tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
 
251
        tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
261
252
        return 0;
262
253
}
263
254
 
275
266
        if (opt == NULL)
276
267
                return 0;
277
268
 
278
 
        memset(tb, 0, sizeof(tb));
279
 
        parse_rtattr(tb, TCA_GRED_STAB, RTA_DATA(opt), RTA_PAYLOAD(opt));
 
269
        parse_rtattr_nested(tb, TCA_GRED_STAB, opt);
280
270
 
281
271
        if (tb[TCA_GRED_PARMS] == NULL)
282
272
                return -1;
283
 
#if 0
284
 
        sopt = RTA_DATA(tb[TCA_GRED_DPS]);
285
 
        if (RTA_PAYLOAD(tb[TCA_GRED_DPS])  < sizeof(*sopt)) {
286
 
                printf("\n GRED DPs message smaller than expected\n");
287
 
                return -1;
288
 
                }
289
 
         
290
 
        DPRINTF(f, "\n\tDPs:%d Default DP %d\n ",
291
 
                sopt->DPs, sopt->def_DP);
292
 
#endif
 
273
 
293
274
        qopt = RTA_DATA(tb[TCA_GRED_PARMS]);
294
275
        if (RTA_PAYLOAD(tb[TCA_GRED_PARMS])  < sizeof(*qopt)*MAX_DPs) {
295
276
                fprintf(f,"\n GRED received message smaller than expected\n");
296
277
                return -1;
297
278
                }
298
279
         
299
 
 
300
 
#if 0
301
 
 
302
 
        for (i=0;i<sopt->DPs;i++)
303
 
#endif
304
280
/* Bad hack! should really return a proper message as shown above*/
305
281
 
306
282
        for (i=0;i<MAX_DPs;i++, qopt++) {