Commit 72590782 authored by David S. Miller's avatar David S. Miller

Merge branch 'sctp_csum'

Vlad Yasevich says:

====================
sctp: Use software checksum under certain circumstances.

There are some cards that support SCTP checksum offloading.  When using
these cards with IPSec or forcing IP fragmentation of SCTP traffic,
the checksum is computed incorrectly due to the fact that xfrm and IP/IPv6
fragmentation code do not know that this is SCTP traffic and do not
know that checksum has to be computed differently.

To fix this, we let SCTP detect these conditions and perform software
checksum calculation.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 6f93ac74 d2dbbba7
...@@ -479,10 +479,22 @@ static inline struct dst_entry *xfrm_lookup(struct net *net, ...@@ -479,10 +479,22 @@ static inline struct dst_entry *xfrm_lookup(struct net *net,
{ {
return dst_orig; return dst_orig;
} }
static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
{
return NULL;
}
#else #else
extern struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, extern struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
const struct flowi *fl, struct sock *sk, const struct flowi *fl, struct sock *sk,
int flags); int flags);
/* skb attached with this dst needs transformation if dst->xfrm is valid */
static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
{
return dst->xfrm;
}
#endif #endif
#endif /* _NET_DST_H */ #endif /* _NET_DST_H */
...@@ -536,7 +536,8 @@ int sctp_packet_transmit(struct sctp_packet *packet) ...@@ -536,7 +536,8 @@ int sctp_packet_transmit(struct sctp_packet *packet)
* by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>. * by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>.
*/ */
if (!sctp_checksum_disable) { if (!sctp_checksum_disable) {
if (!(dst->dev->features & NETIF_F_SCTP_CSUM)) { if (!(dst->dev->features & NETIF_F_SCTP_CSUM) ||
(dst_xfrm(dst) != NULL) || packet->ipfragok) {
__u32 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len); __u32 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len);
/* 3) Put the resultant value into the checksum field in the /* 3) Put the resultant value into the checksum field in the
......
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