diff options
author | Patrick McHardy <kaber@trash.net> | 2005-06-21 17:03:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-06-21 17:03:46 -0400 |
commit | 6150bacfec95c7042678667561664efcf10d4508 (patch) | |
tree | 6a415a742dca3ea44cc035c8e2a7e523df92e4e9 | |
parent | e3be8ba79294df5de96692411e122506b40c5aa4 (diff) |
[NETFILTER]: Check TCP checksum in ipt_REJECT
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/netfilter/ipt_REJECT.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c index 266d64979286..915696446020 100644 --- a/net/ipv4/netfilter/ipt_REJECT.c +++ b/net/ipv4/netfilter/ipt_REJECT.c | |||
@@ -104,10 +104,12 @@ static inline struct rtable *route_reverse(struct sk_buff *skb, | |||
104 | static void send_reset(struct sk_buff *oldskb, int hook) | 104 | static void send_reset(struct sk_buff *oldskb, int hook) |
105 | { | 105 | { |
106 | struct sk_buff *nskb; | 106 | struct sk_buff *nskb; |
107 | struct iphdr *iph = oldskb->nh.iph; | ||
107 | struct tcphdr _otcph, *oth, *tcph; | 108 | struct tcphdr _otcph, *oth, *tcph; |
108 | struct rtable *rt; | 109 | struct rtable *rt; |
109 | u_int16_t tmp_port; | 110 | u_int16_t tmp_port; |
110 | u_int32_t tmp_addr; | 111 | u_int32_t tmp_addr; |
112 | unsigned int tcplen; | ||
111 | int needs_ack; | 113 | int needs_ack; |
112 | int hh_len; | 114 | int hh_len; |
113 | 115 | ||
@@ -124,7 +126,16 @@ static void send_reset(struct sk_buff *oldskb, int hook) | |||
124 | if (oth->rst) | 126 | if (oth->rst) |
125 | return; | 127 | return; |
126 | 128 | ||
127 | /* FIXME: Check checksum --RR */ | 129 | /* Check checksum */ |
130 | tcplen = oldskb->len - iph->ihl * 4; | ||
131 | if (((hook != NF_IP_LOCAL_IN && oldskb->ip_summed != CHECKSUM_HW) || | ||
132 | (hook == NF_IP_LOCAL_IN && | ||
133 | oldskb->ip_summed != CHECKSUM_UNNECESSARY)) && | ||
134 | csum_tcpudp_magic(iph->saddr, iph->daddr, tcplen, IPPROTO_TCP, | ||
135 | oldskb->ip_summed == CHECKSUM_HW ? oldskb->csum : | ||
136 | skb_checksum(oldskb, iph->ihl * 4, tcplen, 0))) | ||
137 | return; | ||
138 | |||
128 | if ((rt = route_reverse(oldskb, oth, hook)) == NULL) | 139 | if ((rt = route_reverse(oldskb, oth, hook)) == NULL) |
129 | return; | 140 | return; |
130 | 141 | ||