diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/sctp/sm_make_chunk.c | 39 |
1 files changed, 20 insertions, 19 deletions
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 | */ | ||
845 | static 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. */ |
843 | struct sctp_chunk *sctp_make_abort_violation( | 863 | struct 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 | */ | ||
1152 | void *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. |