Commit 6d727be7 authored by Sridhar Samudrala's avatar Sridhar Samudrala

Merge dyn9-47-18-140.beaverton.ibm.com:/home/sridhar/BK/linux-2.5.41

into dyn9-47-18-140.beaverton.ibm.com:/home/sridhar/BK/lksctp-2.5.41
parents 2005ca71 b06ce00b
......@@ -1228,13 +1228,13 @@ static sctp_disposition_t sctp_sf_do_dupcook_a(const sctp_endpoint_t *ep,
new_addr = NULL;
list_for_each(pos, &new_asoc->peer.transport_addr_list) {
new_addr = list_entry(pos, sctp_transport_t, transports);
found = 1;
found = 0;
list_for_each_safe(pos2, temp,
&asoc->peer.transport_addr_list) {
addr = list_entry(pos2, sctp_transport_t, transports);
if (!sctp_cmp_addr_exact(&new_addr->ipaddr,
&addr->ipaddr)) {
found = 0;
if (sctp_cmp_addr_exact(&new_addr->ipaddr,
&addr->ipaddr)) {
found = 1;
break;
}
}
......@@ -1264,6 +1264,9 @@ static sctp_disposition_t sctp_sf_do_dupcook_a(const sctp_endpoint_t *ep,
goto nomem_abort;
sctp_init_cause(repl, SCTP_ERROR_RESTART, rawaddr.v, len);
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));
/* Discard the rest of the packet too. */
sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,
SCTP_NULL());
return SCTP_DISPOSITION_CONSUME;
nomem_abort:
......@@ -2881,12 +2884,11 @@ sctp_disposition_t sctp_sf_discard_chunk(const sctp_endpoint_t *ep,
*
* The return value is the disposition of the chunk.
*/
sctp_disposition_t
sctp_sf_pdiscard(const sctp_endpoint_t *ep,
const sctp_association_t *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands)
sctp_disposition_t sctp_sf_pdiscard(const sctp_endpoint_t *ep,
const sctp_association_t *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands)
{
sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET, SCTP_NULL());
......
......@@ -726,9 +726,9 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
* flags - flags sent or received with the user message, see Section
* 5 for complete description of the flags.
*
* NB: The argument 'msg' is a user space address.
* Note: This function could use a rewrite especially when explicit
* connect support comes in.
*/
/* BUG: We do not implement timeouts. */
/* BUG: We do not implement the equivalent of wait_for_tcp_memory(). */
SCTP_STATIC int sctp_msghdr_parse(const struct msghdr *, sctp_cmsgs_t *);
......@@ -737,7 +737,7 @@ SCTP_STATIC int sctp_sendmsg(struct sock *sk, struct msghdr *msg, int size)
{
sctp_opt_t *sp;
sctp_endpoint_t *ep;
sctp_association_t *asoc = NULL;
sctp_association_t *new_asoc=NULL, *asoc=NULL;
sctp_transport_t *transport;
sctp_chunk_t *chunk = NULL;
sockaddr_storage_t to;
......@@ -906,11 +906,12 @@ SCTP_STATIC int sctp_sendmsg(struct sock *sk, struct msghdr *msg, int size)
}
scope = sctp_scope(&to);
asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL);
if (!asoc) {
new_asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL);
if (!new_asoc) {
err = -ENOMEM;
goto out_unlock;
}
asoc = new_asoc;
/* If the SCTP_INIT ancillary data is specified, set all
* the association init values accordingly.
......@@ -945,7 +946,7 @@ SCTP_STATIC int sctp_sendmsg(struct sock *sk, struct msghdr *msg, int size)
}
/* ASSERT: we have a valid association at this point. */
SCTP_DEBUG_PRINTK("We have a valid association. \n");
SCTP_DEBUG_PRINTK("We have a valid association.\n");
/* API 7.1.7, the sndbuf size per association bounds the
* maximum size of data that can be sent in a single send call.
......@@ -1053,10 +1054,16 @@ SCTP_STATIC int sctp_sendmsg(struct sock *sk, struct msghdr *msg, int size)
err = msg_len;
goto out_unlock;
}
/* If we are already past ASSOCIATE, the lower
* layers are responsible for its cleanup.
*/
goto out_free_chunk;
out_free:
if (SCTP_STATE_CLOSED == asoc->state)
if (new_asoc)
sctp_association_free(asoc);
out_free_chunk:
if (chunk)
sctp_free_chunk(chunk);
......
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