Skip to content

Commit db898aa

Browse files
committed
netfilter: ipt_ecn: fix inversion for IP header ECN match
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 <kaber@trash.net>
1 parent 58d5a02 commit db898aa

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎net/ipv4/netfilter/ipt_ecn.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ MODULE_LICENSE("GPL");
2525
static inline bool match_ip(const struct sk_buff *skb,
2626
const struct ipt_ecn_info *einfo)
2727
{
28-
return (ip_hdr(skb)->tos & IPT_ECN_IP_MASK) == einfo->ip_ect;
28+
return ((ip_hdr(skb)->tos & IPT_ECN_IP_MASK) == einfo->ip_ect) ^
29+
!!(einfo->invert & IPT_ECN_OP_MATCH_IP);
2930
}
3031

3132
static inline bool match_tcp(const struct sk_buff *skb,

0 commit comments

Comments
 (0)