From: Jakub Audykowicz <jakub.audykowicz@gmail.com>
To: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Cc: Xin Long <lucien.xin@gmail.com>,
linux-sctp@vger.kernel.org, Vlad Yasevich <vyasevich@gmail.com>,
Neil Horman <nhorman@tuxdriver.com>, davem <davem@davemloft.net>,
network dev <netdev@vger.kernel.org>
Subject: Re: [PATCH net] sctp: always set frag_point on pmtu change
Date: Tue, 4 Dec 2018 20:30:22 +0100 [thread overview]
Message-ID: <84d5c4e6-0e3b-a323-48c1-0bde73a89453@gmail.com> (raw)
In-Reply-To: <20181204185832.GB10987@localhost.localdomain>
On 2018-12-04 19:58, Marcelo Ricardo Leitner wrote:
> On Tue, Dec 04, 2018 at 07:51:54PM +0100, Jakub Audykowicz wrote:
> ...
>> Thanks, I've taken your remarks into account and ended up with this
>> simple solution:
> LGTM! Thanks
>
>> diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
>> index ab9242e51d9e..3487686f2cf5 100644
>> --- a/include/net/sctp/sctp.h
>> +++ b/include/net/sctp/sctp.h
>> @@ -620,4 +620,9 @@ static inline bool sctp_transport_pmtu_check(struct sctp_transport *t)
>> return false;
>> }
>>
>> +static inline __u32 sctp_min_frag_point(struct sctp_sock *sp, __u16 datasize)
>> +{
>> + return sctp_mtu_payload(sp, SCTP_DEFAULT_MINSEGMENT, datasize);
> Not sure how final the patch is but be sure to run checkpatch.pl on
> it before submitting it officially. It flagged some issues like the
> above indentation using spaces, for example.
Should be fine now. I have checkpatch as a post-commit hook but I was
not committing when creating these quick diffs :).
>
>> +}
>> +
>> #endif /* __net_sctp_h__ */
>> diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c
>> index ce8087846f05..dc12c2ba487f 100644
>> --- a/net/sctp/chunk.c
>> +++ b/net/sctp/chunk.c
>> @@ -191,6 +191,12 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
>> * the packet
>> */
>> max_data = asoc->frag_point;
>> + if (unlikely(!max_data)) {
>> + pr_warn_ratelimited("%s: asoc:%p frag_point is zero, forcing max_data to default minimum",
>> + __func__, asoc);
>> + max_data = sctp_min_frag_point(
>> + sctp_sk(asoc->base.sk), sctp_datachk_len(&asoc->stream));
>> + }
>>
>> /* If the the peer requested that we authenticate DATA chunks
>> * we need to account for bundling of the AUTH chunks along with
>> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
>> index bf618d1b41fd..b8cebd5a87e5 100644
>> --- a/net/sctp/socket.c
>> +++ b/net/sctp/socket.c
>> @@ -3324,8 +3324,7 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, unsigned
>> __u16 datasize = asoc ? sctp_datachk_len(&asoc->stream) :
>> sizeof(struct sctp_data_chunk);
>>
>> - min_len = sctp_mtu_payload(sp, SCTP_DEFAULT_MINSEGMENT,
>> - datasize);
>> + min_len = sctp_min_frag_point(sp, datasize);
>> max_len = SCTP_MAX_CHUNK_LEN - datasize;
>>
>> if (val < min_len || val > max_len)
>>
>>
>>
>>
prev parent reply other threads:[~2018-12-04 19:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-18 20:47 [PATCH net] sctp: always set frag_point on pmtu change Jakub Audykowicz
2018-11-19 7:20 ` Xin Long
2018-11-27 22:18 ` Jakub Audykowicz
2018-11-28 2:08 ` Marcelo Ricardo Leitner
2018-11-28 11:26 ` Marcelo Ricardo Leitner
2018-12-04 17:00 ` Jakub Audykowicz
2018-12-04 17:45 ` Marcelo Ricardo Leitner
2018-12-04 18:51 ` Jakub Audykowicz
2018-12-04 18:58 ` Marcelo Ricardo Leitner
2018-12-04 19:30 ` Jakub Audykowicz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84d5c4e6-0e3b-a323-48c1-0bde73a89453@gmail.com \
--to=jakub.audykowicz@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-sctp@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=vyasevich@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).