Skip to content

Commit

Permalink
[IPV6]: Fix routing by fwmark
Browse files Browse the repository at this point in the history
Fix mark comparison, also dump the mask to userspace when the mask is
zero, but the mark is not (in which case the mark is dumped, so the
mask is needed to make sense of it).

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Sep 22, 2006
1 parent 74975d4 commit 366e4ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/ipv6/fib6_rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
return 0;

#ifdef CONFIG_IPV6_ROUTE_FWMARK
if ((r->fwmark ^ fl->fl6_fwmark) / r->fwmask)
if ((r->fwmark ^ fl->fl6_fwmark) & r->fwmask)
return 0;
#endif

Expand Down Expand Up @@ -256,7 +256,7 @@ static int fib6_rule_fill(struct fib_rule *rule, struct sk_buff *skb,
if (rule6->fwmark)
NLA_PUT_U32(skb, FRA_FWMARK, rule6->fwmark);

if (rule6->fwmask)
if (rule6->fwmask || rule6->fwmark)
NLA_PUT_U32(skb, FRA_FWMASK, rule6->fwmask);
#endif

Expand Down

0 comments on commit 366e4ad

Please sign in to comment.