patch-2.4.21 linux-2.4.21/net/sched/sch_gred.c
Next file: linux-2.4.21/net/sched/sch_htb.c
Previous file: linux-2.4.21/net/sched/sch_csz.c
Back to the patch index
Back to the overall index
- Lines: 55
- Date:
2003-06-13 07:51:39.000000000 -0700
- Orig file:
linux-2.4.20/net/sched/sch_gred.c
- Orig date:
2002-08-02 17:39:46.000000000 -0700
diff -urN linux-2.4.20/net/sched/sch_gred.c linux-2.4.21/net/sched/sch_gred.c
@@ -116,7 +116,7 @@
}
- if ( ((skb->tc_index&0xf) > t->DPs) || !(q=t->tab[skb->tc_index&0xf])) {
+ if ( ((skb->tc_index&0xf) > (t->DPs -1)) || !(q=t->tab[skb->tc_index&0xf])) {
printk("GRED: setting to default (%d)\n ",t->def);
if (!(q=t->tab[t->def])) {
DPRINTK("GRED: setting to default FAILED! dropping!! "
@@ -328,18 +328,20 @@
struct tc_gred_qopt *ctl;
struct tc_gred_sopt *sopt;
struct rtattr *tb[TCA_GRED_STAB];
- struct rtattr *tb2[TCA_GRED_STAB];
+ struct rtattr *tb2[TCA_GRED_DPS];
int i;
if (opt == NULL ||
rtattr_parse(tb, TCA_GRED_STAB, RTA_DATA(opt), RTA_PAYLOAD(opt)) )
return -EINVAL;
- if (tb[TCA_GRED_PARMS-1] == 0 && tb[TCA_GRED_STAB-1] == 0 &&
- tb[TCA_GRED_DPS-1] != 0) {
+ if (tb[TCA_GRED_PARMS-1] == 0 && tb[TCA_GRED_STAB-1] == 0) {
rtattr_parse(tb2, TCA_GRED_DPS, RTA_DATA(opt),
RTA_PAYLOAD(opt));
+ if (tb2[TCA_GRED_DPS-1] == 0)
+ return -EINVAL;
+
sopt = RTA_DATA(tb2[TCA_GRED_DPS-1]);
table->DPs=sopt->DPs;
table->def=sopt->def_DP;
@@ -471,16 +473,18 @@
struct gred_sched *table = (struct gred_sched *)sch->data;
struct tc_gred_sopt *sopt;
struct rtattr *tb[TCA_GRED_STAB];
- struct rtattr *tb2[TCA_GRED_STAB];
+ struct rtattr *tb2[TCA_GRED_DPS];
if (opt == NULL ||
rtattr_parse(tb, TCA_GRED_STAB, RTA_DATA(opt), RTA_PAYLOAD(opt)) )
return -EINVAL;
- if (tb[TCA_GRED_PARMS-1] == 0 && tb[TCA_GRED_STAB-1] == 0 &&
- tb[TCA_GRED_DPS-1] != 0) {
+ if (tb[TCA_GRED_PARMS-1] == 0 && tb[TCA_GRED_STAB-1] == 0 ) {
rtattr_parse(tb2, TCA_GRED_DPS, RTA_DATA(opt),RTA_PAYLOAD(opt));
+ if (tb2[TCA_GRED_DPS-1] == 0)
+ return -EINVAL;
+
sopt = RTA_DATA(tb2[TCA_GRED_DPS-1]);
table->DPs=sopt->DPs;
table->def=sopt->def_DP;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)