Commit f52a40fb authored by Xin Long's avatar Xin Long Committed by Pablo Neira Ayuso

ipvs: get sctphdr by sctphoff in sctp_csum_check

sctp_csum_check() is called by sctp_s/dnat_handler() where it calls
skb_make_writable() to ensure sctphdr to be linearized.

So there's no need to get sctphdr by calling skb_header_pointer()
in sctp_csum_check().
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Reviewed-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: default avatarJulian Anastasov <ja@ssi.bg>
Acked-by: default avatarSimon Horman <horms@verge.net.au>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 11d4dd0b
...@@ -186,7 +186,7 @@ static int ...@@ -186,7 +186,7 @@ static int
sctp_csum_check(int af, struct sk_buff *skb, struct ip_vs_protocol *pp) sctp_csum_check(int af, struct sk_buff *skb, struct ip_vs_protocol *pp)
{ {
unsigned int sctphoff; unsigned int sctphoff;
struct sctphdr *sh, _sctph; struct sctphdr *sh;
__le32 cmp, val; __le32 cmp, val;
#ifdef CONFIG_IP_VS_IPV6 #ifdef CONFIG_IP_VS_IPV6
...@@ -196,10 +196,7 @@ sctp_csum_check(int af, struct sk_buff *skb, struct ip_vs_protocol *pp) ...@@ -196,10 +196,7 @@ sctp_csum_check(int af, struct sk_buff *skb, struct ip_vs_protocol *pp)
#endif #endif
sctphoff = ip_hdrlen(skb); sctphoff = ip_hdrlen(skb);
sh = skb_header_pointer(skb, sctphoff, sizeof(_sctph), &_sctph); sh = (struct sctphdr *)(skb->data + sctphoff);
if (sh == NULL)
return 0;
cmp = sh->checksum; cmp = sh->checksum;
val = sctp_compute_cksum(skb, sctphoff); val = sctp_compute_cksum(skb, sctphoff);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment