sctp: Fix SCTP_MAXSEG socket option to comply to spec.
We had a bug that we never stored the user-defined value for MAXSEG when setting the value on an association. Thus future PMTU events ended up re-writing the frag point and increasing it past user limit. Additionally, when setting the option on the socket/endpoint, we effect all current associations, which is against spec. Now, we store the user 'maxseg' value along with the computed 'frag_point'. We inherit 'maxseg' from the socket at association creation and use it as an upper limit for 'frag_point' when its set. Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
This commit is contained in:
@@ -486,15 +486,16 @@ static inline __s32 sctp_jitter(__u32 rto)
|
||||
}
|
||||
|
||||
/* Break down data chunks at this point. */
|
||||
static inline int sctp_frag_point(const struct sctp_sock *sp, int pmtu)
|
||||
static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu)
|
||||
{
|
||||
struct sctp_sock *sp = sctp_sk(asoc->base.sk);
|
||||
int frag = pmtu;
|
||||
|
||||
frag -= sp->pf->af->net_header_len;
|
||||
frag -= sizeof(struct sctphdr) + sizeof(struct sctp_data_chunk);
|
||||
|
||||
if (sp->user_frag)
|
||||
frag = min_t(int, frag, sp->user_frag);
|
||||
if (asoc->user_frag)
|
||||
frag = min_t(int, frag, asoc->user_frag);
|
||||
|
||||
frag = min_t(int, frag, SCTP_MAX_CHUNK_LEN);
|
||||
|
||||
|
Reference in New Issue
Block a user