Skip to content

Commit

Permalink
net/garp: fix GID rbtree ordering
Browse files Browse the repository at this point in the history
The comparison operators were backwards in both garp_attr_lookup and
garp_attr_create, so the entire GID rbtree was in reverse order.
(There was no practical side effect to this though, except that PDUs
were sent with attributes listed in reverse order, which is still
valid by the protocol. This change is only for clarity.)

Signed-off-by: David Ward <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
dpward authored and davem330 committed Apr 13, 2012
1 parent 9d02daf commit 6f66cdc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/802/garp.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ static struct garp_attr *garp_attr_lookup(const struct garp_applicant *app,
while (parent) {
attr = rb_entry(parent, struct garp_attr, node);
d = garp_attr_cmp(attr, data, len, type);
if (d < 0)
if (d > 0)
parent = parent->rb_left;
else if (d > 0)
else if (d < 0)
parent = parent->rb_right;
else
return attr;
Expand All @@ -178,9 +178,9 @@ static struct garp_attr *garp_attr_create(struct garp_applicant *app,
parent = *p;
attr = rb_entry(parent, struct garp_attr, node);
d = garp_attr_cmp(attr, data, len, type);
if (d < 0)
if (d > 0)
p = &parent->rb_left;
else if (d > 0)
else if (d < 0)
p = &parent->rb_right;
else {
/* The attribute already exists; re-use it. */
Expand Down

0 comments on commit 6f66cdc

Please sign in to comment.