aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/sctp/structs.h1
-rw-r--r--net/sctp/sm_make_chunk.c39
2 files changed, 20 insertions, 20 deletions
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index baff49dfcdbd..67c91d01b635 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -731,7 +731,6 @@ int sctp_user_addto_chunk(struct sctp_chunk *chunk, int off, int len,
731 struct iovec *data); 731 struct iovec *data);
732void sctp_chunk_free(struct sctp_chunk *); 732void sctp_chunk_free(struct sctp_chunk *);
733void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); 733void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data);
734void *sctp_addto_param(struct sctp_chunk *, int len, const void *data);
735struct sctp_chunk *sctp_chunkify(struct sk_buff *, 734struct sctp_chunk *sctp_chunkify(struct sk_buff *,
736 const struct sctp_association *, 735 const struct sctp_association *,
737 struct sock *); 736 struct sock *);
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 23ae37ec8711..d84e575f7409 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -839,6 +839,26 @@ err_chunk:
839 return retval; 839 return retval;
840} 840}
841 841
842/* Append bytes to the end of a parameter. Will panic if chunk is not big
843 * enough.
844 */
845static void *sctp_addto_param(struct sctp_chunk *chunk, int len,
846 const void *data)
847{
848 void *target;
849 int chunklen = ntohs(chunk->chunk_hdr->length);
850
851 target = skb_put(chunk->skb, len);
852
853 memcpy(target, data, len);
854
855 /* Adjust the chunk length field. */
856 chunk->chunk_hdr->length = htons(chunklen + len);
857 chunk->chunk_end = skb_tail_pointer(chunk->skb);
858
859 return target;
860}
861
842/* Make an ABORT chunk with a PROTOCOL VIOLATION cause code. */ 862/* Make an ABORT chunk with a PROTOCOL VIOLATION cause code. */
843struct sctp_chunk *sctp_make_abort_violation( 863struct sctp_chunk *sctp_make_abort_violation(
844 const struct sctp_association *asoc, 864 const struct sctp_association *asoc,
@@ -1146,25 +1166,6 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data)
1146 return target; 1166 return target;
1147} 1167}
1148 1168
1149/* Append bytes to the end of a parameter. Will panic if chunk is not big
1150 * enough.
1151 */
1152void *sctp_addto_param(struct sctp_chunk *chunk, int len, const void *data)
1153{
1154 void *target;
1155 int chunklen = ntohs(chunk->chunk_hdr->length);
1156
1157 target = skb_put(chunk->skb, len);
1158
1159 memcpy(target, data, len);
1160
1161 /* Adjust the chunk length field. */
1162 chunk->chunk_hdr->length = htons(chunklen + len);
1163 chunk->chunk_end = skb_tail_pointer(chunk->skb);
1164
1165 return target;
1166}
1167
1168/* Append bytes from user space to the end of a chunk. Will panic if 1169/* Append bytes from user space to the end of a chunk. Will panic if
1169 * chunk is not big enough. 1170 * chunk is not big enough.
1170 * Returns a kernel err value. 1171 * Returns a kernel err value.