diff options
author | Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> | 2018-04-26 15:58:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-04-27 14:35:23 -0400 |
commit | 2f5e3c9df6938b823664869ec87af3da8df272f6 (patch) | |
tree | 22be567d684b1c89bc40f433099a2909fdbbfb2e /net/sctp/chunk.c | |
parent | feddd6c1af30ab11d73ce0e4e76b40dfc899dbda (diff) |
sctp: introduce sctp_assoc_update_frag_point
and avoid the open-coded versions of it.
Now sctp_datamsg_from_user can just re-use asoc->frag_point as it will
always be updated.
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/chunk.c')
-rw-r--r-- | net/sctp/chunk.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c index be296d633e95..79daa98208c3 100644 --- a/net/sctp/chunk.c +++ b/net/sctp/chunk.c | |||
@@ -172,8 +172,6 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, | |||
172 | struct list_head *pos, *temp; | 172 | struct list_head *pos, *temp; |
173 | struct sctp_chunk *chunk; | 173 | struct sctp_chunk *chunk; |
174 | struct sctp_datamsg *msg; | 174 | struct sctp_datamsg *msg; |
175 | struct sctp_sock *sp; | ||
176 | struct sctp_af *af; | ||
177 | int err; | 175 | int err; |
178 | 176 | ||
179 | msg = sctp_datamsg_new(GFP_KERNEL); | 177 | msg = sctp_datamsg_new(GFP_KERNEL); |
@@ -192,12 +190,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, | |||
192 | /* This is the biggest possible DATA chunk that can fit into | 190 | /* This is the biggest possible DATA chunk that can fit into |
193 | * the packet | 191 | * the packet |
194 | */ | 192 | */ |
195 | sp = sctp_sk(asoc->base.sk); | 193 | max_data = asoc->frag_point; |
196 | af = sp->pf->af; | ||
197 | max_data = asoc->pathmtu - af->net_header_len - | ||
198 | sizeof(struct sctphdr) - sctp_datachk_len(&asoc->stream) - | ||
199 | af->ip_options_len(asoc->base.sk); | ||
200 | max_data = SCTP_TRUNC4(max_data); | ||
201 | 194 | ||
202 | /* If the the peer requested that we authenticate DATA chunks | 195 | /* If the the peer requested that we authenticate DATA chunks |
203 | * we need to account for bundling of the AUTH chunks along with | 196 | * we need to account for bundling of the AUTH chunks along with |
@@ -222,9 +215,6 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, | |||
222 | } | 215 | } |
223 | } | 216 | } |
224 | 217 | ||
225 | /* Check what's our max considering the above */ | ||
226 | max_data = min_t(size_t, max_data, asoc->frag_point); | ||
227 | |||
228 | /* Set first_len and then account for possible bundles on first frag */ | 218 | /* Set first_len and then account for possible bundles on first frag */ |
229 | first_len = max_data; | 219 | first_len = max_data; |
230 | 220 | ||