Commit 9ba62f95 authored by David S. Miller's avatar David S. Miller

Merge branch 'sctp-align'

Marcelo Ricardo Leitner says:

====================
Rename WORD_TRUNC/ROUND macros and use them

This patchset aims to rename these macros to a non-confusing name, as
reported by David Laight and David Miller, and to update all remaining
places to make use of it, which was 1 last remaining spot.

v3:
- Name it SCTP_PAD4 instead of SCTP_ALIGN4, as suggested by David Laight
v2:
- fixed 2nd patch summary

Details on the specific changelogs.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents b80b8d7a 4a225ce3
...@@ -83,9 +83,9 @@ ...@@ -83,9 +83,9 @@
#endif #endif
/* Round an int up to the next multiple of 4. */ /* Round an int up to the next multiple of 4. */
#define WORD_ROUND(s) (((s)+3)&~3) #define SCTP_PAD4(s) (((s)+3)&~3)
/* Truncate to the previous multiple of 4. */ /* Truncate to the previous multiple of 4. */
#define WORD_TRUNC(s) ((s)&~3) #define SCTP_TRUNC4(s) ((s)&~3)
/* /*
* Function declarations. * Function declarations.
...@@ -433,7 +433,7 @@ static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu) ...@@ -433,7 +433,7 @@ static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu)
if (asoc->user_frag) if (asoc->user_frag)
frag = min_t(int, frag, asoc->user_frag); frag = min_t(int, frag, asoc->user_frag);
frag = WORD_TRUNC(min_t(int, frag, SCTP_MAX_CHUNK_LEN)); frag = SCTP_TRUNC4(min_t(int, frag, SCTP_MAX_CHUNK_LEN));
return frag; return frag;
} }
...@@ -462,7 +462,7 @@ _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member) ...@@ -462,7 +462,7 @@ _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member)
for (pos.v = chunk->member;\ for (pos.v = chunk->member;\
pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\
ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\ ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\
pos.v += WORD_ROUND(ntohs(pos.p->length))) pos.v += SCTP_PAD4(ntohs(pos.p->length)))
#define sctp_walk_errors(err, chunk_hdr)\ #define sctp_walk_errors(err, chunk_hdr)\
_sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length)) _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length))
...@@ -472,7 +472,7 @@ for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ ...@@ -472,7 +472,7 @@ for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \
sizeof(sctp_chunkhdr_t));\ sizeof(sctp_chunkhdr_t));\
(void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\
ntohs(err->length) >= sizeof(sctp_errhdr_t); \ ntohs(err->length) >= sizeof(sctp_errhdr_t); \
err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length)))) err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length))))
#define sctp_walk_fwdtsn(pos, chunk)\ #define sctp_walk_fwdtsn(pos, chunk)\
_sctp_walk_fwdtsn((pos), (chunk), ntohs((chunk)->chunk_hdr->length) - sizeof(struct sctp_fwdtsn_chunk)) _sctp_walk_fwdtsn((pos), (chunk), ntohs((chunk)->chunk_hdr->length) - sizeof(struct sctp_fwdtsn_chunk))
......
...@@ -68,7 +68,7 @@ match_packet(const struct sk_buff *skb, ...@@ -68,7 +68,7 @@ match_packet(const struct sk_buff *skb,
++i, offset, sch->type, htons(sch->length), ++i, offset, sch->type, htons(sch->length),
sch->flags); sch->flags);
#endif #endif
offset += WORD_ROUND(ntohs(sch->length)); offset += SCTP_PAD4(ntohs(sch->length));
pr_debug("skb->len: %d\toffset: %d\n", skb->len, offset); pr_debug("skb->len: %d\toffset: %d\n", skb->len, offset);
......
...@@ -1408,7 +1408,7 @@ void sctp_assoc_sync_pmtu(struct sock *sk, struct sctp_association *asoc) ...@@ -1408,7 +1408,7 @@ void sctp_assoc_sync_pmtu(struct sock *sk, struct sctp_association *asoc)
transports) { transports) {
if (t->pmtu_pending && t->dst) { if (t->pmtu_pending && t->dst) {
sctp_transport_update_pmtu(sk, t, sctp_transport_update_pmtu(sk, t,
WORD_TRUNC(dst_mtu(t->dst))); SCTP_TRUNC4(dst_mtu(t->dst)));
t->pmtu_pending = 0; t->pmtu_pending = 0;
} }
if (!pmtu || (t->pathmtu < pmtu)) if (!pmtu || (t->pathmtu < pmtu))
......
...@@ -195,9 +195,10 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, ...@@ -195,9 +195,10 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
/* This is the biggest possible DATA chunk that can fit into /* This is the biggest possible DATA chunk that can fit into
* the packet * the packet
*/ */
max_data = (asoc->pathmtu - max_data = asoc->pathmtu -
sctp_sk(asoc->base.sk)->pf->af->net_header_len - sctp_sk(asoc->base.sk)->pf->af->net_header_len -
sizeof(struct sctphdr) - sizeof(struct sctp_data_chunk)) & ~3; sizeof(struct sctphdr) - sizeof(struct sctp_data_chunk);
max_data = SCTP_TRUNC4(max_data);
max = asoc->frag_point; max = asoc->frag_point;
/* If the the peer requested that we authenticate DATA chunks /* If the the peer requested that we authenticate DATA chunks
...@@ -208,8 +209,8 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, ...@@ -208,8 +209,8 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
struct sctp_hmac *hmac_desc = sctp_auth_asoc_get_hmac(asoc); struct sctp_hmac *hmac_desc = sctp_auth_asoc_get_hmac(asoc);
if (hmac_desc) if (hmac_desc)
max_data -= WORD_ROUND(sizeof(sctp_auth_chunk_t) + max_data -= SCTP_PAD4(sizeof(sctp_auth_chunk_t) +
hmac_desc->hmac_len); hmac_desc->hmac_len);
} }
/* Now, check if we need to reduce our max */ /* Now, check if we need to reduce our max */
...@@ -229,7 +230,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, ...@@ -229,7 +230,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
asoc->outqueue.out_qlen == 0 && asoc->outqueue.out_qlen == 0 &&
list_empty(&asoc->outqueue.retransmit) && list_empty(&asoc->outqueue.retransmit) &&
msg_len > max) msg_len > max)
max_data -= WORD_ROUND(sizeof(sctp_sack_chunk_t)); max_data -= SCTP_PAD4(sizeof(sctp_sack_chunk_t));
/* Encourage Cookie-ECHO bundling. */ /* Encourage Cookie-ECHO bundling. */
if (asoc->state < SCTP_STATE_COOKIE_ECHOED) if (asoc->state < SCTP_STATE_COOKIE_ECHOED)
......
...@@ -605,7 +605,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info) ...@@ -605,7 +605,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
/* PMTU discovery (RFC1191) */ /* PMTU discovery (RFC1191) */
if (ICMP_FRAG_NEEDED == code) { if (ICMP_FRAG_NEEDED == code) {
sctp_icmp_frag_needed(sk, asoc, transport, sctp_icmp_frag_needed(sk, asoc, transport,
WORD_TRUNC(info)); SCTP_TRUNC4(info));
goto out_unlock; goto out_unlock;
} else { } else {
if (ICMP_PROT_UNREACH == code) { if (ICMP_PROT_UNREACH == code) {
...@@ -673,7 +673,7 @@ static int sctp_rcv_ootb(struct sk_buff *skb) ...@@ -673,7 +673,7 @@ static int sctp_rcv_ootb(struct sk_buff *skb)
if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t)) if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t))
break; break;
ch_end = offset + WORD_ROUND(ntohs(ch->length)); ch_end = offset + SCTP_PAD4(ntohs(ch->length));
if (ch_end > skb->len) if (ch_end > skb->len)
break; break;
...@@ -1121,7 +1121,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net, ...@@ -1121,7 +1121,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net,
if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t)) if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t))
break; break;
ch_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length)); ch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length));
if (ch_end > skb_tail_pointer(skb)) if (ch_end > skb_tail_pointer(skb))
break; break;
...@@ -1190,7 +1190,7 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net, ...@@ -1190,7 +1190,7 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net,
* that the chunk length doesn't cause overflow. Otherwise, we'll * that the chunk length doesn't cause overflow. Otherwise, we'll
* walk off the end. * walk off the end.
*/ */
if (WORD_ROUND(ntohs(ch->length)) > skb->len) if (SCTP_PAD4(ntohs(ch->length)) > skb->len)
return NULL; return NULL;
/* If this is INIT/INIT-ACK look inside the chunk too. */ /* If this is INIT/INIT-ACK look inside the chunk too. */
......
...@@ -213,7 +213,7 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) ...@@ -213,7 +213,7 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
} }
chunk->chunk_hdr = ch; chunk->chunk_hdr = ch;
chunk->chunk_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length)); chunk->chunk_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length));
skb_pull(chunk->skb, sizeof(sctp_chunkhdr_t)); skb_pull(chunk->skb, sizeof(sctp_chunkhdr_t));
chunk->subh.v = NULL; /* Subheader is no longer valid. */ chunk->subh.v = NULL; /* Subheader is no longer valid. */
......
...@@ -297,7 +297,7 @@ static sctp_xmit_t __sctp_packet_append_chunk(struct sctp_packet *packet, ...@@ -297,7 +297,7 @@ static sctp_xmit_t __sctp_packet_append_chunk(struct sctp_packet *packet,
struct sctp_chunk *chunk) struct sctp_chunk *chunk)
{ {
sctp_xmit_t retval = SCTP_XMIT_OK; sctp_xmit_t retval = SCTP_XMIT_OK;
__u16 chunk_len = WORD_ROUND(ntohs(chunk->chunk_hdr->length)); __u16 chunk_len = SCTP_PAD4(ntohs(chunk->chunk_hdr->length));
/* Check to see if this chunk will fit into the packet */ /* Check to see if this chunk will fit into the packet */
retval = sctp_packet_will_fit(packet, chunk, chunk_len); retval = sctp_packet_will_fit(packet, chunk, chunk_len);
...@@ -508,7 +508,7 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) ...@@ -508,7 +508,7 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)
if (gso) { if (gso) {
pkt_size = packet->overhead; pkt_size = packet->overhead;
list_for_each_entry(chunk, &packet->chunk_list, list) { list_for_each_entry(chunk, &packet->chunk_list, list) {
int padded = WORD_ROUND(chunk->skb->len); int padded = SCTP_PAD4(chunk->skb->len);
if (pkt_size + padded > tp->pathmtu) if (pkt_size + padded > tp->pathmtu)
break; break;
...@@ -538,7 +538,7 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) ...@@ -538,7 +538,7 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)
* included in the chunk length field. The sender should * included in the chunk length field. The sender should
* never pad with more than 3 bytes. * never pad with more than 3 bytes.
* *
* [This whole comment explains WORD_ROUND() below.] * [This whole comment explains SCTP_PAD4() below.]
*/ */
pkt_size -= packet->overhead; pkt_size -= packet->overhead;
...@@ -560,7 +560,7 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) ...@@ -560,7 +560,7 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)
has_data = 1; has_data = 1;
} }
padding = WORD_ROUND(chunk->skb->len) - chunk->skb->len; padding = SCTP_PAD4(chunk->skb->len) - chunk->skb->len;
if (padding) if (padding)
memset(skb_put(chunk->skb, padding), 0, padding); memset(skb_put(chunk->skb, padding), 0, padding);
...@@ -587,7 +587,7 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) ...@@ -587,7 +587,7 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)
* acknowledged or have failed. * acknowledged or have failed.
* Re-queue auth chunks if needed. * Re-queue auth chunks if needed.
*/ */
pkt_size -= WORD_ROUND(chunk->skb->len); pkt_size -= SCTP_PAD4(chunk->skb->len);
if (!sctp_chunk_is_data(chunk) && chunk != packet->auth) if (!sctp_chunk_is_data(chunk) && chunk != packet->auth)
sctp_chunk_free(chunk); sctp_chunk_free(chunk);
...@@ -911,7 +911,7 @@ static sctp_xmit_t sctp_packet_will_fit(struct sctp_packet *packet, ...@@ -911,7 +911,7 @@ static sctp_xmit_t sctp_packet_will_fit(struct sctp_packet *packet,
*/ */
maxsize = pmtu - packet->overhead; maxsize = pmtu - packet->overhead;
if (packet->auth) if (packet->auth)
maxsize -= WORD_ROUND(packet->auth->skb->len); maxsize -= SCTP_PAD4(packet->auth->skb->len);
if (chunk_len > maxsize) if (chunk_len > maxsize)
retval = SCTP_XMIT_PMTU_FULL; retval = SCTP_XMIT_PMTU_FULL;
......
...@@ -253,7 +253,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, ...@@ -253,7 +253,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
num_types = sp->pf->supported_addrs(sp, types); num_types = sp->pf->supported_addrs(sp, types);
chunksize = sizeof(init) + addrs_len; chunksize = sizeof(init) + addrs_len;
chunksize += WORD_ROUND(SCTP_SAT_LEN(num_types)); chunksize += SCTP_PAD4(SCTP_SAT_LEN(num_types));
chunksize += sizeof(ecap_param); chunksize += sizeof(ecap_param);
if (asoc->prsctp_enable) if (asoc->prsctp_enable)
...@@ -283,14 +283,14 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, ...@@ -283,14 +283,14 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
/* Add HMACS parameter length if any were defined */ /* Add HMACS parameter length if any were defined */
auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs; auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs;
if (auth_hmacs->length) if (auth_hmacs->length)
chunksize += WORD_ROUND(ntohs(auth_hmacs->length)); chunksize += SCTP_PAD4(ntohs(auth_hmacs->length));
else else
auth_hmacs = NULL; auth_hmacs = NULL;
/* Add CHUNKS parameter length */ /* Add CHUNKS parameter length */
auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks; auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks;
if (auth_chunks->length) if (auth_chunks->length)
chunksize += WORD_ROUND(ntohs(auth_chunks->length)); chunksize += SCTP_PAD4(ntohs(auth_chunks->length));
else else
auth_chunks = NULL; auth_chunks = NULL;
...@@ -300,8 +300,8 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, ...@@ -300,8 +300,8 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
/* If we have any extensions to report, account for that */ /* If we have any extensions to report, account for that */
if (num_ext) if (num_ext)
chunksize += WORD_ROUND(sizeof(sctp_supported_ext_param_t) + chunksize += SCTP_PAD4(sizeof(sctp_supported_ext_param_t) +
num_ext); num_ext);
/* RFC 2960 3.3.2 Initiation (INIT) (1) /* RFC 2960 3.3.2 Initiation (INIT) (1)
* *
...@@ -443,13 +443,13 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, ...@@ -443,13 +443,13 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs; auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs;
if (auth_hmacs->length) if (auth_hmacs->length)
chunksize += WORD_ROUND(ntohs(auth_hmacs->length)); chunksize += SCTP_PAD4(ntohs(auth_hmacs->length));
else else
auth_hmacs = NULL; auth_hmacs = NULL;
auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks; auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks;
if (auth_chunks->length) if (auth_chunks->length)
chunksize += WORD_ROUND(ntohs(auth_chunks->length)); chunksize += SCTP_PAD4(ntohs(auth_chunks->length));
else else
auth_chunks = NULL; auth_chunks = NULL;
...@@ -458,8 +458,8 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, ...@@ -458,8 +458,8 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
} }
if (num_ext) if (num_ext)
chunksize += WORD_ROUND(sizeof(sctp_supported_ext_param_t) + chunksize += SCTP_PAD4(sizeof(sctp_supported_ext_param_t) +
num_ext); num_ext);
/* Now allocate and fill out the chunk. */ /* Now allocate and fill out the chunk. */
retval = sctp_make_control(asoc, SCTP_CID_INIT_ACK, 0, chunksize, gfp); retval = sctp_make_control(asoc, SCTP_CID_INIT_ACK, 0, chunksize, gfp);
...@@ -1390,7 +1390,7 @@ static struct sctp_chunk *_sctp_make_chunk(const struct sctp_association *asoc, ...@@ -1390,7 +1390,7 @@ static struct sctp_chunk *_sctp_make_chunk(const struct sctp_association *asoc,
struct sock *sk; struct sock *sk;
/* No need to allocate LL here, as this is only a chunk. */ /* No need to allocate LL here, as this is only a chunk. */
skb = alloc_skb(WORD_ROUND(sizeof(sctp_chunkhdr_t) + paylen), gfp); skb = alloc_skb(SCTP_PAD4(sizeof(sctp_chunkhdr_t) + paylen), gfp);
if (!skb) if (!skb)
goto nodata; goto nodata;
...@@ -1482,7 +1482,7 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data) ...@@ -1482,7 +1482,7 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data)
void *target; void *target;
void *padding; void *padding;
int chunklen = ntohs(chunk->chunk_hdr->length); int chunklen = ntohs(chunk->chunk_hdr->length);
int padlen = WORD_ROUND(chunklen) - chunklen; int padlen = SCTP_PAD4(chunklen) - chunklen;
padding = skb_put(chunk->skb, padlen); padding = skb_put(chunk->skb, padlen);
target = skb_put(chunk->skb, len); target = skb_put(chunk->skb, len);
...@@ -1900,7 +1900,7 @@ static int sctp_process_missing_param(const struct sctp_association *asoc, ...@@ -1900,7 +1900,7 @@ static int sctp_process_missing_param(const struct sctp_association *asoc,
struct __sctp_missing report; struct __sctp_missing report;
__u16 len; __u16 len;
len = WORD_ROUND(sizeof(report)); len = SCTP_PAD4(sizeof(report));
/* Make an ERROR chunk, preparing enough room for /* Make an ERROR chunk, preparing enough room for
* returning multiple unknown parameters. * returning multiple unknown parameters.
...@@ -2098,9 +2098,9 @@ static sctp_ierror_t sctp_process_unk_param(const struct sctp_association *asoc, ...@@ -2098,9 +2098,9 @@ static sctp_ierror_t sctp_process_unk_param(const struct sctp_association *asoc,
if (*errp) { if (*errp) {
if (!sctp_init_cause_fixed(*errp, SCTP_ERROR_UNKNOWN_PARAM, if (!sctp_init_cause_fixed(*errp, SCTP_ERROR_UNKNOWN_PARAM,
WORD_ROUND(ntohs(param.p->length)))) SCTP_PAD4(ntohs(param.p->length))))
sctp_addto_chunk_fixed(*errp, sctp_addto_chunk_fixed(*errp,
WORD_ROUND(ntohs(param.p->length)), SCTP_PAD4(ntohs(param.p->length)),
param.v); param.v);
} else { } else {
/* If there is no memory for generating the ERROR /* If there is no memory for generating the ERROR
......
...@@ -3454,7 +3454,7 @@ sctp_disposition_t sctp_sf_ootb(struct net *net, ...@@ -3454,7 +3454,7 @@ sctp_disposition_t sctp_sf_ootb(struct net *net,
} }
/* Report violation if chunk len overflows */ /* Report violation if chunk len overflows */
ch_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length)); ch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length));
if (ch_end > skb_tail_pointer(skb)) if (ch_end > skb_tail_pointer(skb))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands); commands);
...@@ -4185,7 +4185,7 @@ sctp_disposition_t sctp_sf_unk_chunk(struct net *net, ...@@ -4185,7 +4185,7 @@ sctp_disposition_t sctp_sf_unk_chunk(struct net *net,
hdr = unk_chunk->chunk_hdr; hdr = unk_chunk->chunk_hdr;
err_chunk = sctp_make_op_error(asoc, unk_chunk, err_chunk = sctp_make_op_error(asoc, unk_chunk,
SCTP_ERROR_UNKNOWN_CHUNK, hdr, SCTP_ERROR_UNKNOWN_CHUNK, hdr,
WORD_ROUND(ntohs(hdr->length)), SCTP_PAD4(ntohs(hdr->length)),
0); 0);
if (err_chunk) { if (err_chunk) {
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
...@@ -4203,7 +4203,7 @@ sctp_disposition_t sctp_sf_unk_chunk(struct net *net, ...@@ -4203,7 +4203,7 @@ sctp_disposition_t sctp_sf_unk_chunk(struct net *net,
hdr = unk_chunk->chunk_hdr; hdr = unk_chunk->chunk_hdr;
err_chunk = sctp_make_op_error(asoc, unk_chunk, err_chunk = sctp_make_op_error(asoc, unk_chunk,
SCTP_ERROR_UNKNOWN_CHUNK, hdr, SCTP_ERROR_UNKNOWN_CHUNK, hdr,
WORD_ROUND(ntohs(hdr->length)), SCTP_PAD4(ntohs(hdr->length)),
0); 0);
if (err_chunk) { if (err_chunk) {
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
......
...@@ -233,7 +233,7 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk) ...@@ -233,7 +233,7 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk)
} }
if (transport->dst) { if (transport->dst) {
transport->pathmtu = WORD_TRUNC(dst_mtu(transport->dst)); transport->pathmtu = SCTP_TRUNC4(dst_mtu(transport->dst));
} else } else
transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT; transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
} }
...@@ -287,7 +287,7 @@ void sctp_transport_route(struct sctp_transport *transport, ...@@ -287,7 +287,7 @@ void sctp_transport_route(struct sctp_transport *transport,
return; return;
} }
if (transport->dst) { if (transport->dst) {
transport->pathmtu = WORD_TRUNC(dst_mtu(transport->dst)); transport->pathmtu = SCTP_TRUNC4(dst_mtu(transport->dst));
/* Initialize sk->sk_rcv_saddr, if the transport is the /* Initialize sk->sk_rcv_saddr, if the transport is the
* association's active path for getsockname(). * association's active path for getsockname().
......
...@@ -383,7 +383,7 @@ sctp_ulpevent_make_remote_error(const struct sctp_association *asoc, ...@@ -383,7 +383,7 @@ sctp_ulpevent_make_remote_error(const struct sctp_association *asoc,
ch = (sctp_errhdr_t *)(chunk->skb->data); ch = (sctp_errhdr_t *)(chunk->skb->data);
cause = ch->cause; cause = ch->cause;
elen = WORD_ROUND(ntohs(ch->length)) - sizeof(sctp_errhdr_t); elen = SCTP_PAD4(ntohs(ch->length)) - sizeof(sctp_errhdr_t);
/* Pull off the ERROR header. */ /* Pull off the ERROR header. */
skb_pull(chunk->skb, sizeof(sctp_errhdr_t)); skb_pull(chunk->skb, sizeof(sctp_errhdr_t));
...@@ -688,7 +688,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc, ...@@ -688,7 +688,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
* MUST ignore the padding bytes. * MUST ignore the padding bytes.
*/ */
len = ntohs(chunk->chunk_hdr->length); len = ntohs(chunk->chunk_hdr->length);
padding = WORD_ROUND(len) - len; padding = SCTP_PAD4(len) - len;
/* Fixup cloned skb with just this chunks data. */ /* Fixup cloned skb with just this chunks data. */
skb_trim(skb, chunk->chunk_end - padding - skb->data); skb_trim(skb, chunk->chunk_end - padding - skb->data);
......
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