aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-05-17 22:26:53 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-05-18 00:35:23 -0400
commitf0218b3e9974f06014b61be8987159f4a20e011e (patch)
tree29a593c4d71ab18cb0c450a34e79bf6bea66877e /net
parent1eaa4787a774c4896518c81f24e8bccaa2244924 (diff)
parent9d192e118a094087494997ea1c8a2faf39af38c5 (diff)
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip into trace/tip/tracing/core-6
Conflicts: include/trace/ftrace.h kernel/trace/trace_kprobe.c Acked-by: Masami Hiramatsu <mhiramat@redhat.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/af_inet6.c2
-rw-r--r--net/sctp/sm_make_chunk.c62
2 files changed, 58 insertions, 6 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 3192aa02ba5d..3f9e86b15e0d 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -200,7 +200,7 @@ lookup_protocol:
200 200
201 inet_sk(sk)->pinet6 = np = inet6_sk_generic(sk); 201 inet_sk(sk)->pinet6 = np = inet6_sk_generic(sk);
202 np->hop_limit = -1; 202 np->hop_limit = -1;
203 np->mcast_hops = -1; 203 np->mcast_hops = IPV6_DEFAULT_MCASTHOPS;
204 np->mc_loop = 1; 204 np->mc_loop = 1;
205 np->pmtudisc = IPV6_PMTUDISC_WANT; 205 np->pmtudisc = IPV6_PMTUDISC_WANT;
206 np->ipv6only = net->ipv6.sysctl.bindv6only; 206 np->ipv6only = net->ipv6.sysctl.bindv6only;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 0fd5b4c88358..30c1767186b8 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -108,7 +108,7 @@ static const struct sctp_paramhdr prsctp_param = {
108 cpu_to_be16(sizeof(struct sctp_paramhdr)), 108 cpu_to_be16(sizeof(struct sctp_paramhdr)),
109}; 109};
110 110
111/* A helper to initialize to initialize an op error inside a 111/* A helper to initialize an op error inside a
112 * provided chunk, as most cause codes will be embedded inside an 112 * provided chunk, as most cause codes will be embedded inside an
113 * abort chunk. 113 * abort chunk.
114 */ 114 */
@@ -125,6 +125,29 @@ void sctp_init_cause(struct sctp_chunk *chunk, __be16 cause_code,
125 chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), &err); 125 chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), &err);
126} 126}
127 127
128/* A helper to initialize an op error inside a
129 * provided chunk, as most cause codes will be embedded inside an
130 * abort chunk. Differs from sctp_init_cause in that it won't oops
131 * if there isn't enough space in the op error chunk
132 */
133int sctp_init_cause_fixed(struct sctp_chunk *chunk, __be16 cause_code,
134 size_t paylen)
135{
136 sctp_errhdr_t err;
137 __u16 len;
138
139 /* Cause code constants are now defined in network order. */
140 err.cause = cause_code;
141 len = sizeof(sctp_errhdr_t) + paylen;
142 err.length = htons(len);
143
144 if (skb_tailroom(chunk->skb) > len)
145 return -ENOSPC;
146 chunk->subh.err_hdr = sctp_addto_chunk_fixed(chunk,
147 sizeof(sctp_errhdr_t),
148 &err);
149 return 0;
150}
128/* 3.3.2 Initiation (INIT) (1) 151/* 3.3.2 Initiation (INIT) (1)
129 * 152 *
130 * This chunk is used to initiate a SCTP association between two 153 * This chunk is used to initiate a SCTP association between two
@@ -1132,6 +1155,24 @@ nodata:
1132 return retval; 1155 return retval;
1133} 1156}
1134 1157
1158/* Create an Operation Error chunk of a fixed size,
1159 * specifically, max(asoc->pathmtu, SCTP_DEFAULT_MAXSEGMENT)
1160 * This is a helper function to allocate an error chunk for
1161 * for those invalid parameter codes in which we may not want
1162 * to report all the errors, if the incomming chunk is large
1163 */
1164static inline struct sctp_chunk *sctp_make_op_error_fixed(
1165 const struct sctp_association *asoc,
1166 const struct sctp_chunk *chunk)
1167{
1168 size_t size = asoc ? asoc->pathmtu : 0;
1169
1170 if (!size)
1171 size = SCTP_DEFAULT_MAXSEGMENT;
1172
1173 return sctp_make_op_error_space(asoc, chunk, size);
1174}
1175
1135/* Create an Operation Error chunk. */ 1176/* Create an Operation Error chunk. */
1136struct sctp_chunk *sctp_make_op_error(const struct sctp_association *asoc, 1177struct sctp_chunk *sctp_make_op_error(const struct sctp_association *asoc,
1137 const struct sctp_chunk *chunk, 1178 const struct sctp_chunk *chunk,
@@ -1374,6 +1415,18 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data)
1374 return target; 1415 return target;
1375} 1416}
1376 1417
1418/* Append bytes to the end of a chunk. Returns NULL if there isn't sufficient
1419 * space in the chunk
1420 */
1421void *sctp_addto_chunk_fixed(struct sctp_chunk *chunk,
1422 int len, const void *data)
1423{
1424 if (skb_tailroom(chunk->skb) > len)
1425 return sctp_addto_chunk(chunk, len, data);
1426 else
1427 return NULL;
1428}
1429
1377/* Append bytes from user space to the end of a chunk. Will panic if 1430/* Append bytes from user space to the end of a chunk. Will panic if
1378 * chunk is not big enough. 1431 * chunk is not big enough.
1379 * Returns a kernel err value. 1432 * Returns a kernel err value.
@@ -1977,13 +2030,12 @@ static sctp_ierror_t sctp_process_unk_param(const struct sctp_association *asoc,
1977 * returning multiple unknown parameters. 2030 * returning multiple unknown parameters.
1978 */ 2031 */
1979 if (NULL == *errp) 2032 if (NULL == *errp)
1980 *errp = sctp_make_op_error_space(asoc, chunk, 2033 *errp = sctp_make_op_error_fixed(asoc, chunk);
1981 ntohs(chunk->chunk_hdr->length));
1982 2034
1983 if (*errp) { 2035 if (*errp) {
1984 sctp_init_cause(*errp, SCTP_ERROR_UNKNOWN_PARAM, 2036 sctp_init_cause_fixed(*errp, SCTP_ERROR_UNKNOWN_PARAM,
1985 WORD_ROUND(ntohs(param.p->length))); 2037 WORD_ROUND(ntohs(param.p->length)));
1986 sctp_addto_chunk(*errp, 2038 sctp_addto_chunk_fixed(*errp,
1987 WORD_ROUND(ntohs(param.p->length)), 2039 WORD_ROUND(ntohs(param.p->length)),
1988 param.v); 2040 param.v);
1989 } else { 2041 } else {