Skip to content

Commit

Permalink
netfilter: ipt_ecn: fix inversion for IP header ECN match
Browse files Browse the repository at this point in the history
Userspace allows to specify inversion for IP header ECN matches, the
kernel silently accepts it, but doesn't invert the match result.

Signed-off-by: Patrick McHardy <[email protected]>
  • Loading branch information
kaber committed Jun 16, 2011
1 parent 58d5a02 commit db898aa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/ipv4/netfilter/ipt_ecn.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ MODULE_LICENSE("GPL");
static inline bool match_ip(const struct sk_buff *skb,
const struct ipt_ecn_info *einfo)
{
return (ip_hdr(skb)->tos & IPT_ECN_IP_MASK) == einfo->ip_ect;
return ((ip_hdr(skb)->tos & IPT_ECN_IP_MASK) == einfo->ip_ect) ^
!!(einfo->invert & IPT_ECN_OP_MATCH_IP);
}

static inline bool match_tcp(const struct sk_buff *skb,
Expand Down

0 comments on commit db898aa

Please sign in to comment.