Commit f236218b authored by Vlad Yasevich's avatar Vlad Yasevich Committed by David S. Miller

[SCTP]: Do not timestamp every SCTP packet.

We only need the timestamp on COOKIE-ECHO chunks, so instead of always
timestamping every SCTP packet, let common code timestamp if the socket
option is set.  For COOKIE-ECHO, simply get the time of day if we don't
have a timestamp.  This introduces a small possibility that the cookie
may be considered expired, but it will be renegotiated.
Signed-off-by: default avatarVlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: default avatarSridhar Samudrala <sri@us.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b56bab46
...@@ -218,12 +218,6 @@ int sctp_rcv(struct sk_buff *skb) ...@@ -218,12 +218,6 @@ int sctp_rcv(struct sk_buff *skb)
} }
} }
/* SCTP seems to always need a timestamp right now (FIXME) */
if (skb->tstamp.off_sec == 0) {
__net_timestamp(skb);
sock_enable_timestamp(sk);
}
if (!xfrm_policy_check(sk, XFRM_POLICY_IN, skb, family)) if (!xfrm_policy_check(sk, XFRM_POLICY_IN, skb, family))
goto discard_release; goto discard_release;
nf_reset(skb); nf_reset(skb);
......
...@@ -1447,8 +1447,16 @@ struct sctp_association *sctp_unpack_cookie( ...@@ -1447,8 +1447,16 @@ struct sctp_association *sctp_unpack_cookie(
/* Check to see if the cookie is stale. If there is already /* Check to see if the cookie is stale. If there is already
* an association, there is no need to check cookie's expiration * an association, there is no need to check cookie's expiration
* for init collision case of lost COOKIE ACK. * for init collision case of lost COOKIE ACK.
* If skb has been timestamped, then use the stamp, otherwise
* use current time. This introduces a small possibility that
* that a cookie may be considered expired, but his would only slow
* down the new association establishment instead of every packet.
*/ */
if (sock_flag(ep->base.sk, SOCK_TIMESTAMP))
skb_get_timestamp(skb, &tv); skb_get_timestamp(skb, &tv);
else
do_gettimeofday(&tv);
if (!asoc && tv_lt(bear_cookie->expiration, tv)) { if (!asoc && tv_lt(bear_cookie->expiration, tv)) {
__u16 len; __u16 len;
/* /*
......
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