Skip to content

Commit

Permalink
net_sched: sfq: always randomize hash perturbation
Browse files Browse the repository at this point in the history
SFQ q->perturbation is used in sfq_hash() as an input to Jenkins hash.

We currently randomize this 32bit value only if a perturbation timer is
setup.

Its much better to always initialize it to defeat attackers, or else
they can predict very well what kind of packets they have to forge to
hit a particular flow.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jan 4, 2012
1 parent bd16a6c commit 02a9098
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions net/sched/sch_sfq.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,12 +591,12 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt)
q->cur_depth = 0;
q->tail = NULL;
q->divisor = SFQ_DEFAULT_HASH_DIVISOR;
if (opt == NULL) {
q->quantum = psched_mtu(qdisc_dev(sch));
q->scaled_quantum = SFQ_ALLOT_SIZE(q->quantum);
q->perturb_period = 0;
q->perturbation = net_random();
} else {
q->quantum = psched_mtu(qdisc_dev(sch));
q->scaled_quantum = SFQ_ALLOT_SIZE(q->quantum);
q->perturb_period = 0;
q->perturbation = net_random();

if (opt) {
int err = sfq_change(sch, opt);
if (err)
return err;
Expand Down

0 comments on commit 02a9098

Please sign in to comment.