diff options
Diffstat (limited to 'net/sctp/sm_make_chunk.c')
-rw-r--r-- | net/sctp/sm_make_chunk.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index f87ccb11a520..a7b65e9e44b3 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -2242,14 +2242,17 @@ int sctp_verify_init(const struct sctp_association *asoc, | |||
2242 | * Returns 0 on failure, else success. | 2242 | * Returns 0 on failure, else success. |
2243 | * FIXME: This is an association method. | 2243 | * FIXME: This is an association method. |
2244 | */ | 2244 | */ |
2245 | int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid, | 2245 | int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk, |
2246 | const union sctp_addr *peer_addr, | 2246 | const union sctp_addr *peer_addr, |
2247 | sctp_init_chunk_t *peer_init, gfp_t gfp) | 2247 | sctp_init_chunk_t *peer_init, gfp_t gfp) |
2248 | { | 2248 | { |
2249 | union sctp_params param; | 2249 | union sctp_params param; |
2250 | struct sctp_transport *transport; | 2250 | struct sctp_transport *transport; |
2251 | struct list_head *pos, *temp; | 2251 | struct list_head *pos, *temp; |
2252 | struct sctp_af *af; | ||
2253 | union sctp_addr addr; | ||
2252 | char *cookie; | 2254 | char *cookie; |
2255 | int src_match = 0; | ||
2253 | 2256 | ||
2254 | /* We must include the address that the INIT packet came from. | 2257 | /* We must include the address that the INIT packet came from. |
2255 | * This is the only address that matters for an INIT packet. | 2258 | * This is the only address that matters for an INIT packet. |
@@ -2261,18 +2264,31 @@ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid, | |||
2261 | * added as the primary transport. The source address seems to | 2264 | * added as the primary transport. The source address seems to |
2262 | * be a a better choice than any of the embedded addresses. | 2265 | * be a a better choice than any of the embedded addresses. |
2263 | */ | 2266 | */ |
2264 | if (peer_addr) { | 2267 | if(!sctp_assoc_add_peer(asoc, peer_addr, gfp, SCTP_ACTIVE)) |
2265 | if(!sctp_assoc_add_peer(asoc, peer_addr, gfp, SCTP_ACTIVE)) | 2268 | goto nomem; |
2266 | goto nomem; | 2269 | |
2267 | } | 2270 | if (sctp_cmp_addr_exact(sctp_source(chunk), peer_addr)) |
2271 | src_match = 1; | ||
2268 | 2272 | ||
2269 | /* Process the initialization parameters. */ | 2273 | /* Process the initialization parameters. */ |
2270 | sctp_walk_params(param, peer_init, init_hdr.params) { | 2274 | sctp_walk_params(param, peer_init, init_hdr.params) { |
2275 | if (!src_match && (param.p->type == SCTP_PARAM_IPV4_ADDRESS || | ||
2276 | param.p->type == SCTP_PARAM_IPV6_ADDRESS)) { | ||
2277 | af = sctp_get_af_specific(param_type2af(param.p->type)); | ||
2278 | af->from_addr_param(&addr, param.addr, | ||
2279 | chunk->sctp_hdr->source, 0); | ||
2280 | if (sctp_cmp_addr_exact(sctp_source(chunk), &addr)) | ||
2281 | src_match = 1; | ||
2282 | } | ||
2271 | 2283 | ||
2272 | if (!sctp_process_param(asoc, param, peer_addr, gfp)) | 2284 | if (!sctp_process_param(asoc, param, peer_addr, gfp)) |
2273 | goto clean_up; | 2285 | goto clean_up; |
2274 | } | 2286 | } |
2275 | 2287 | ||
2288 | /* source address of chunk may not match any valid address */ | ||
2289 | if (!src_match) | ||
2290 | goto clean_up; | ||
2291 | |||
2276 | /* AUTH: After processing the parameters, make sure that we | 2292 | /* AUTH: After processing the parameters, make sure that we |
2277 | * have all the required info to potentially do authentications. | 2293 | * have all the required info to potentially do authentications. |
2278 | */ | 2294 | */ |