Commit 5d326e99 authored by Jon Grimm's avatar Jon Grimm Committed by Jon Grimm

Support MSG_ABORT (the abort primitive) to do a non-graceful shutdown of an association.

parent 08707d54
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* This file is part of the SCTP kernel reference Implementation * This file is part of the SCTP kernel reference Implementation
* *
* $Id: sctp.h,v 1.39 2002/08/16 19:30:49 jgrimm Exp $ * $Id: sctp.h,v 1.40 2002/08/21 18:34:03 jgrimm Exp $
* *
* The base lksctp header. * The base lksctp header.
* *
...@@ -133,6 +133,7 @@ extern unsigned int sctp_poll(struct file *file, struct socket *sock, ...@@ -133,6 +133,7 @@ extern unsigned int sctp_poll(struct file *file, struct socket *sock,
*/ */
extern int sctp_primitive_ASSOCIATE(sctp_association_t *, void *arg); extern int sctp_primitive_ASSOCIATE(sctp_association_t *, void *arg);
extern int sctp_primitive_SHUTDOWN(sctp_association_t *, void *arg); extern int sctp_primitive_SHUTDOWN(sctp_association_t *, void *arg);
extern int sctp_primitive_ABORT(sctp_association_t *, void *arg);
extern int sctp_primitive_SEND(sctp_association_t *, void *arg); extern int sctp_primitive_SEND(sctp_association_t *, void *arg);
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* based on <draft-ietf-tsvwg-addip-sctp-02.txt> June 29, 2001, * based on <draft-ietf-tsvwg-addip-sctp-02.txt> June 29, 2001,
* for the SCTP kernel reference Implementation. * for the SCTP kernel reference Implementation.
* *
* $Header: /cvsroot/lksctp/lksctp/sctp_cvs/include/net/sctp/sctp_sm.h,v 1.33 2002/08/16 19:30:49 jgrimm Exp $ * $Header: /cvsroot/lksctp/lksctp/sctp_cvs/include/net/sctp/sctp_sm.h,v 1.34 2002/08/21 18:34:04 jgrimm Exp $
* *
* These are definitions needed by the state machine. * These are definitions needed by the state machine.
* *
...@@ -144,6 +144,9 @@ sctp_state_fn_t sctp_sf_do_prm_send; ...@@ -144,6 +144,9 @@ sctp_state_fn_t sctp_sf_do_prm_send;
sctp_state_fn_t sctp_sf_do_9_2_prm_shutdown; sctp_state_fn_t sctp_sf_do_9_2_prm_shutdown;
sctp_state_fn_t sctp_sf_cookie_wait_prm_shutdown; sctp_state_fn_t sctp_sf_cookie_wait_prm_shutdown;
sctp_state_fn_t sctp_sf_cookie_echoed_prm_shutdown; sctp_state_fn_t sctp_sf_cookie_echoed_prm_shutdown;
sctp_state_fn_t sctp_sf_do_9_1_prm_abort;
sctp_state_fn_t sctp_sf_cookie_wait_prm_abort;
sctp_state_fn_t sctp_sf_cookie_echoed_prm_abort;
sctp_state_fn_t sctp_sf_error_closed; sctp_state_fn_t sctp_sf_error_closed;
sctp_state_fn_t sctp_sf_error_shutdown; sctp_state_fn_t sctp_sf_error_shutdown;
sctp_state_fn_t sctp_sf_ignore_primitive; sctp_state_fn_t sctp_sf_ignore_primitive;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* *
* This file is part of the SCTP kernel reference Implementation * This file is part of the SCTP kernel reference Implementation
* *
* $Header: /cvsroot/lksctp/lksctp/sctp_cvs/net/sctp/sctp_primitive.c,v 1.5 2002/04/24 16:33:39 jgrimm Exp $ * $Header: /cvsroot/lksctp/lksctp/sctp_cvs/net/sctp/sctp_primitive.c,v 1.6 2002/08/21 18:34:04 jgrimm Exp $
* *
* These functions implement the SCTP primitive functions from Section 10. * These functions implement the SCTP primitive functions from Section 10.
* *
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
* Any bugs reported given to us we will try to fix... any fixes shared will * Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
static char *cvs_id __attribute__ ((unused)) = "$Id: sctp_primitive.c,v 1.5 2002/04/24 16:33:39 jgrimm Exp $"; static char *cvs_id __attribute__ ((unused)) = "$Id: sctp_primitive.c,v 1.6 2002/08/21 18:34:04 jgrimm Exp $";
#include <linux/config.h> #include <linux/config.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -73,7 +73,7 @@ sctp_primitive_ ## name(sctp_association_t *asoc, \ ...@@ -73,7 +73,7 @@ sctp_primitive_ ## name(sctp_association_t *asoc, \
ep = asoc ? asoc->ep : NULL; \ ep = asoc ? asoc->ep : NULL; \
\ \
error = sctp_do_sm(event_type, subtype, state, ep, asoc, arg, GFP_KERNEL); \ error = sctp_do_sm(event_type, subtype, state, ep, asoc, arg, GFP_KERNEL); \
return(error); \ return error; \
} /* sctp_primitive_ ## name() */ } /* sctp_primitive_ ## name() */
/* 10.1 ULP-to-SCTP /* 10.1 ULP-to-SCTP
...@@ -112,6 +112,21 @@ DECLARE_PRIMITIVE(ASSOCIATE) ...@@ -112,6 +112,21 @@ DECLARE_PRIMITIVE(ASSOCIATE)
DECLARE_PRIMITIVE(SHUTDOWN); DECLARE_PRIMITIVE(SHUTDOWN);
/* 10.1 ULP-to-SCTP
* C) Abort
*
* Format: Abort(association id [, cause code])
* -> result
*
* Ungracefully closes an association. Any locally queued user data
* will be discarded and an ABORT chunk is sent to the peer. A success
* code will be returned on successful abortion of the association. If
* attempting to abort the association results in a failure, an error
* code shall be returned.
*/
DECLARE_PRIMITIVE(ABORT);
/* 10.1 ULP-to-SCTP /* 10.1 ULP-to-SCTP
* E) Send * E) Send
* *
...@@ -190,6 +205,7 @@ sctp_other_icmp_unreachfrag(sctp_association_t *asoc, void *arg) ...@@ -190,6 +205,7 @@ sctp_other_icmp_unreachfrag(sctp_association_t *asoc, void *arg)
error = sctp_do_sm(event_type, subtype, state, ep, asoc, arg, error = sctp_do_sm(event_type, subtype, state, ep, asoc, arg,
GFP_ATOMIC); GFP_ATOMIC);
return(error); return error;
} /* sctp_other_icmp_unreachfrag() */ } /* sctp_other_icmp_unreachfrag() */
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* This file is part of the SCTP kernel reference Implementation * This file is part of the SCTP kernel reference Implementation
* *
* $Header: /cvsroot/lksctp/lksctp/sctp_cvs/net/sctp/sctp_sm_statefuns.c,v 1.48 2002/08/16 19:30:50 jgrimm Exp $ * $Header: /cvsroot/lksctp/lksctp/sctp_cvs/net/sctp/sctp_sm_statefuns.c,v 1.49 2002/08/21 18:34:04 jgrimm Exp $
* *
* This is part of the SCTP Linux Kernel Reference Implementation. * This is part of the SCTP Linux Kernel Reference Implementation.
* *
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
* Any bugs reported given to us we will try to fix... any fixes shared will * Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
static char *cvs_id __attribute__ ((unused)) = "$Id: sctp_sm_statefuns.c,v 1.48 2002/08/16 19:30:50 jgrimm Exp $"; static char *cvs_id __attribute__ ((unused)) = "$Id: sctp_sm_statefuns.c,v 1.49 2002/08/21 18:34:04 jgrimm Exp $";
#include <linux/config.h> #include <linux/config.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -213,7 +213,7 @@ sctp_sf_pdiscard(const sctp_endpoint_t *ep, ...@@ -213,7 +213,7 @@ sctp_sf_pdiscard(const sctp_endpoint_t *ep,
* We are the side that is being asked for an association. * We are the side that is being asked for an association.
* *
* Section: 5.1 Normal Establishment of an Association, B * Section: 5.1 Normal Establishment of an Association, B
* B) "Z" shall respond immediately with an INIT ACK chunk. The * B) "Z" shall respond immediately with an INIT ACK chunk. The
* destination IP address of the INIT ACK MUST be set to the source * destination IP address of the INIT ACK MUST be set to the source
* IP address of the INIT to which this INIT ACK is responding. In * IP address of the INIT to which this INIT ACK is responding. In
* the response, besides filling in other parameters, "Z" must set the * the response, besides filling in other parameters, "Z" must set the
...@@ -3182,7 +3182,80 @@ sctp_sf_do_9_2_prm_shutdown(const sctp_endpoint_t *ep, ...@@ -3182,7 +3182,80 @@ sctp_sf_do_9_2_prm_shutdown(const sctp_endpoint_t *ep,
return disposition; return disposition;
} /* sctp_sf_do_9_2_prm_shutdown() */ } /* sctp_sf_do_9_2_prm_shutdown() */
/*
* Process the ABORT primitive.
*
* Section: 10.1:
* C) Abort
*
* Format: Abort(association id [, cause code])
* -> result
*
* Ungracefully closes an association. Any locally queued user data
* will be discarded and an ABORT chunk is sent to the peer. A success code
* will be returned on successful abortion of the association. If
* attempting to abort the association results in a failure, an error
* code shall be returned.
*
* Mandatory attributes:
*
* o association id - local handle to the SCTP association
*
* Optional attributes:
*
* o cause code - reason of the abort to be passed to the peer
*
* None.
*
* The return value is the disposition.
*/
sctp_disposition_t
sctp_sf_do_9_1_prm_abort(const sctp_endpoint_t *ep,
const sctp_association_t *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands)
{
/* From 9.1 Abort of an Association
* Upon receipt of the ABORT primitive from its upper
* layer, the endpoint enters CLOSED state and
* discard all outstanding data has been
* acknowledged by its peer. The endpoint accepts no new data
* from its upper layer, but retransmits data to the far end
* if necessary to fill gaps.
*/
sctp_chunk_t *abort;
sctp_disposition_t retval;
retval = SCTP_DISPOSITION_CONSUME;
/* Generate ABORT chunk to send the peer */
abort = sctp_make_abort(asoc, NULL, 0);
if (!abort) {
retval = SCTP_DISPOSITION_NOMEM;
} else {
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
}
/* Even if we can't send the ABORT due to low memory delete the
* TCB. This is a departure from our typical NOMEM handling.
*/
/* Change to CLOSED state */
sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
SCTP_STATE(SCTP_STATE_CLOSED));
/* Delete the established association */
sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL());
return retval;
} /* sctp_sf_do_9_1_prm_abort() */
/* We tried an illegal operation on an association which is closed. */ /* We tried an illegal operation on an association which is closed. */
sctp_disposition_t sctp_disposition_t
sctp_sf_error_closed(const sctp_endpoint_t *ep, sctp_sf_error_closed(const sctp_endpoint_t *ep,
...@@ -3277,6 +3350,64 @@ sctp_sf_cookie_echoed_prm_shutdown(const sctp_endpoint_t *ep, ...@@ -3277,6 +3350,64 @@ sctp_sf_cookie_echoed_prm_shutdown(const sctp_endpoint_t *ep,
} /* sctp_sf_cookie_echoed_prm_shutdown() */ } /* sctp_sf_cookie_echoed_prm_shutdown() */
/*
* sctp_cookie_wait_prm_abort
*
* Section: 4 Note: 2
* Verification Tag:
* Inputs
* (endpoint, asoc)
*
* The RFC does not explicitly address this issue, but is the route through the
* state table when someone issues an abort while in COOKIE_WAIT state.
*
* Outputs
* (timers)
*/
sctp_disposition_t
sctp_sf_cookie_wait_prm_abort(const sctp_endpoint_t *ep,
const sctp_association_t *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands){
/* Stop T1-init timer */
sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT));
return sctp_sf_do_9_1_prm_abort(ep, asoc, type, arg, commands);
} /* sctp_sf_cookie_wait_prm_abort() */
/*
* sctp_cookie_echoed_prm_abort
*
* Section: 4 Note: 3
* Verification Tag:
* Inputs
* (endpoint, asoc)
*
* The RFC does not explcitly address this issue, but is the route through the
* state table when someone issues an abort while in COOKIE_ECHOED state.
*
* Outputs
* (timers)
*/
sctp_disposition_t
sctp_sf_cookie_echoed_prm_abort(const sctp_endpoint_t *ep,
const sctp_association_t *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands)
{
/* There is a single T1 timer, so we should be able to use
* common function with the COOKIE-WAIT state.
*/
return sctp_sf_cookie_wait_prm_abort(ep, asoc, type, arg, commands);
} /* sctp_sf_cookie_echoed_prm_abort() */
/* /*
* Ignore the primitive event * Ignore the primitive event
* *
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* This file is part of the SCTP kernel reference Implementation * This file is part of the SCTP kernel reference Implementation
* *
* $Header: /cvsroot/lksctp/lksctp/sctp_cvs/net/sctp/sctp_sm_statetable.c,v 1.19 2002/08/16 19:30:50 jgrimm Exp $ * $Header: /cvsroot/lksctp/lksctp/sctp_cvs/net/sctp/sctp_sm_statetable.c,v 1.20 2002/08/21 18:34:04 jgrimm Exp $
* *
* These are the state tables for the SCTP state machine. * These are the state tables for the SCTP state machine.
* *
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
* Any bugs reported given to us we will try to fix... any fixes shared will * Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
static char *cvs_id __attribute__ ((unused)) = "$Id: sctp_sm_statetable.c,v 1.19 2002/08/16 19:30:50 jgrimm Exp $"; static char *cvs_id __attribute__ ((unused)) = "$Id: sctp_sm_statetable.c,v 1.20 2002/08/21 18:34:04 jgrimm Exp $";
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <net/sctp/sctp.h> #include <net/sctp/sctp.h>
...@@ -721,25 +721,32 @@ chunk_event_table_asconf_ack[SCTP_STATE_NUM_STATES] = { ...@@ -721,25 +721,32 @@ chunk_event_table_asconf_ack[SCTP_STATE_NUM_STATES] = {
{fn: sctp_sf_not_impl, name: "sctp_sf_not_impl"}, \ {fn: sctp_sf_not_impl, name: "sctp_sf_not_impl"}, \
\ \
/* SCTP_STATE_COOKIE_WAIT */ \ /* SCTP_STATE_COOKIE_WAIT */ \
{fn: sctp_sf_not_impl, name: "sctp_sf_not_impl"}, \ {fn: sctp_sf_cookie_wait_prm_abort, \
name: "sctp_sf_cookie_wait_prm_abort"}, \
\ \
/* SCTP_STATE_COOKIE_ECHOED */ \ /* SCTP_STATE_COOKIE_ECHOED */ \
{fn: sctp_sf_not_impl, name: "sctp_sf_not_impl"}, \ {fn: sctp_sf_cookie_echoed_prm_abort, \
name: "sctp_sf_cookie_echoed_prm_abort"}, \
\ \
/* SCTP_STATE_ESTABLISHED */ \ /* SCTP_STATE_ESTABLISHED */ \
{fn: sctp_sf_not_impl, name: "sctp_sf_not_impl"}, \ {fn: sctp_sf_do_9_1_prm_abort, \
name: "sctp_sf_do_9_1_prm_abort"}, \
\ \
/* SCTP_STATE_SHUTDOWN_PENDING */ \ /* SCTP_STATE_SHUTDOWN_PENDING */ \
{fn: sctp_sf_not_impl, name: "sctp_sf_not_impl"}, \ {fn: sctp_sf_do_9_1_prm_abort, \
name: "sctp_sf_do_9_1_prm_abort"}, \
\ \
/* SCTP_STATE_SHUTDOWN_SENT */ \ /* SCTP_STATE_SHUTDOWN_SENT */ \
{fn: sctp_sf_not_impl, name: "sctp_sf_not_impl"}, \ {fn: sctp_sf_do_9_1_prm_abort, \
name: "sctp_sf_do_9_1_prm_abort"}, \
\ \
/* SCTP_STATE_SHUTDOWN_RECEIVED */ \ /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
{fn: sctp_sf_not_impl, name: "sctp_sf_not_impl"}, \ {fn: sctp_sf_do_9_1_prm_abort, \
name: "sctp_sf_do_9_1_prm_abort"}, \
\ \
/* SCTP_STATE_SHUTDOWN_ACK_SENT */ \ /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
{fn: sctp_sf_not_impl, name: "sctp_sf_not_impl"}, \ {fn: sctp_sf_do_9_1_prm_abort, \
name: "sctp_sf_do_9_1_prm_abort"}, \
\ \
} /* TYPE_SCTP_PRIMITIVE_ABORT */ } /* TYPE_SCTP_PRIMITIVE_ABORT */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* This file is part of the SCTP kernel reference Implementation * This file is part of the SCTP kernel reference Implementation
* *
* $Header: /cvsroot/lksctp/lksctp/sctp_cvs/net/sctp/sctp_socket.c,v 1.62 2002/08/16 19:30:50 jgrimm Exp $ * $Header: /cvsroot/lksctp/lksctp/sctp_cvs/net/sctp/sctp_socket.c,v 1.63 2002/08/21 18:34:04 jgrimm Exp $
* *
* These functions interface with the sockets layer to implement the * These functions interface with the sockets layer to implement the
* SCTP Extensions for the Sockets API. * SCTP Extensions for the Sockets API.
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
* Any bugs reported given to us we will try to fix... any fixes shared will * Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
static char *cvs_id __attribute__ ((unused)) = "$Id: sctp_socket.c,v 1.62 2002/08/16 19:30:50 jgrimm Exp $"; static char *cvs_id __attribute__ ((unused)) = "$Id: sctp_socket.c,v 1.63 2002/08/21 18:34:04 jgrimm Exp $";
#include <linux/config.h> #include <linux/config.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -838,12 +838,11 @@ sctp_sendmsg(struct sock *sk, struct msghdr *msg, int size) ...@@ -838,12 +838,11 @@ sctp_sendmsg(struct sock *sk, struct msghdr *msg, int size)
msg_len, sinfo_flags); msg_len, sinfo_flags);
/* FIXME: Support MSG_ABORT. */ /* FIXME: Support MSG_ABORT. */
/* If MSG_EOF is set, no data can be sent. Disallow sending 0-length /* If MSG_EOF|MSG_ABORT is set, no data can be sent. Disallow sending 0-length
* messages when MSG_EOF is not set. * messages when MSG_EOF|MSG_ABORT is not set.
*/ */
if ((sinfo_flags & MSG_ABORT) if (((sinfo_flags & (MSG_EOF|MSG_ABORT)) && (msg_len > 0))
|| ((sinfo_flags & MSG_EOF) && (msg_len > 0)) || (!(sinfo_flags & (MSG_EOF|MSG_ABORT)) && (msg_len == 0))) {
|| (!(sinfo_flags & MSG_EOF) && (msg_len == 0))) {
err = -EINVAL; err = -EINVAL;
goto out_nounlock; goto out_nounlock;
} }
...@@ -886,7 +885,13 @@ sctp_sendmsg(struct sock *sk, struct msghdr *msg, int size) ...@@ -886,7 +885,13 @@ sctp_sendmsg(struct sock *sk, struct msghdr *msg, int size)
sctp_primitive_SHUTDOWN(asoc, NULL); sctp_primitive_SHUTDOWN(asoc, NULL);
err = 0; err = 0;
goto out_unlock; goto out_unlock;
} }
if (sinfo_flags & MSG_ABORT) {
SCTP_DEBUG_PRINTK("Aborting association: %p\n",asoc);
sctp_primitive_ABORT(asoc, NULL);
err = 0;
goto out_unlock;
}
} }
...@@ -1394,7 +1399,7 @@ sctp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -1394,7 +1399,7 @@ sctp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
int int
sctp_disconnect(struct sock *sk, int flags) sctp_disconnect(struct sock *sk, int flags)
{ {
return(-EOPNOTSUPP); /* STUB */ return -EOPNOTSUPP; /* STUB */
} /* sctp_disconnect() */ } /* sctp_disconnect() */
...@@ -1414,7 +1419,7 @@ sctp_accept(struct sock *sk, int flags, int *err) ...@@ -1414,7 +1419,7 @@ sctp_accept(struct sock *sk, int flags, int *err)
int int
sctp_ioctl(struct sock *sk, int cmd, unsigned long arg) sctp_ioctl(struct sock *sk, int cmd, unsigned long arg)
{ {
return(-EOPNOTSUPP); /* STUB */ return -EOPNOTSUPP; /* STUB */
} /* sctp_ioctl() */ } /* sctp_ioctl() */
...@@ -1505,7 +1510,7 @@ sctp_init_sock(struct sock *sk) ...@@ -1505,7 +1510,7 @@ sctp_init_sock(struct sock *sk)
sp->autoclose = 0; sp->autoclose = 0;
SCTP_DBG_OBJCNT_INC(sock); SCTP_DBG_OBJCNT_INC(sock);
return(0); return 0;
} /* sctp_init_sock() */ } /* sctp_init_sock() */
...@@ -1522,7 +1527,7 @@ sctp_destroy_sock(struct sock *sk) ...@@ -1522,7 +1527,7 @@ sctp_destroy_sock(struct sock *sk)
ep = sctp_sk(sk)->ep; ep = sctp_sk(sk)->ep;
sctp_endpoint_free(ep); sctp_endpoint_free(ep);
return(0); return 0;
} /* sctp_destroy_sock() */ } /* sctp_destroy_sock() */
...@@ -1621,7 +1626,7 @@ sctp_getsockopt_disable_fragments(struct sock *sk, int len, ...@@ -1621,7 +1626,7 @@ sctp_getsockopt_disable_fragments(struct sock *sk, int len,
int val; int val;
if (len < sizeof(int)) { if (len < sizeof(int)) {
return(-EINVAL); return -EINVAL;
} }
len = sizeof(int); len = sizeof(int);
...@@ -2218,7 +2223,7 @@ sctp_bucket_create(sctp_bind_hashbucket_t *head, unsigned short snum) ...@@ -2218,7 +2223,7 @@ sctp_bucket_create(sctp_bind_hashbucket_t *head, unsigned short snum)
pp->pprev = &head->chain; pp->pprev = &head->chain;
} }
SCTP_DEBUG_PRINTK("sctp_bucket_create() ends, pp=%p\n", pp); SCTP_DEBUG_PRINTK("sctp_bucket_create() ends, pp=%p\n", pp);
return(pp); return pp;
} /* sctp_bucket_create() */ } /* sctp_bucket_create() */
...@@ -2290,7 +2295,7 @@ sctp_autobind(struct sock *sk) ...@@ -2290,7 +2295,7 @@ sctp_autobind(struct sock *sk)
break; break;
} /* switch(family) */ } /* switch(family) */
return(sctp_do_bind(sk, &autoaddr, addr_len)); return sctp_do_bind(sk, &autoaddr, addr_len);
} /* sctp_autobind() */ } /* sctp_autobind() */
...@@ -2652,32 +2657,32 @@ sctp_sendmsg_verify_name(struct sock *sk, struct msghdr *msg) ...@@ -2652,32 +2657,32 @@ sctp_sendmsg_verify_name(struct sock *sk, struct msghdr *msg)
sockaddr_storage_t *sa; sockaddr_storage_t *sa;
if (msg->msg_namelen < sizeof (struct sockaddr) ) { if (msg->msg_namelen < sizeof (struct sockaddr) ) {
return (-EINVAL); return -EINVAL;
} }
sa = (sockaddr_storage_t *)(msg->msg_name); sa = (sockaddr_storage_t *)(msg->msg_name);
switch (sa->sa.sa_family) { switch (sa->sa.sa_family) {
case AF_INET: case AF_INET:
if (msg->msg_namelen < sizeof(struct sockaddr_in)) { if (msg->msg_namelen < sizeof(struct sockaddr_in)) {
return(-EINVAL); return -EINVAL;
} }
break; break;
case AF_INET6: case AF_INET6:
if (PF_INET == sk->family) { if (PF_INET == sk->family) {
return(-EINVAL); return -EINVAL;
} }
SCTP_V6( SCTP_V6(
if (msg->msg_namelen < sizeof(struct sockaddr_in6)) { if (msg->msg_namelen < sizeof(struct sockaddr_in6)) {
return(-EINVAL); return -EINVAL;
} }
break; break;
); );
default: default:
return (-EINVAL); return -EINVAL;
} }
/* Disallow any illegal addresses to be used as destinations. */ /* Disallow any illegal addresses to be used as destinations. */
if (!sctp_addr_is_valid(sa)) { if (!sctp_addr_is_valid(sa)) {
return(-EINVAL); return -EINVAL;
} }
return 0; return 0;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Copyright (c) 2001 Nokia, Inc. * Copyright (c) 2001 Nokia, Inc.
* Copyright (c) 2001 La Monte H.P. Yarroll * Copyright (c) 2001 La Monte H.P. Yarroll
* *
* $Header: /cvsroot/lksctp/lksctp/sctp_cvs/net/sctp/sctp_ulpevent.c,v 1.15 2002/07/12 14:50:26 jgrimm Exp $ * $Header: /cvsroot/lksctp/lksctp/sctp_cvs/net/sctp/sctp_ulpevent.c,v 1.16 2002/08/21 18:34:04 jgrimm Exp $
* *
* These functions manipulate an sctp event. The sctp_ulpevent_t is used * These functions manipulate an sctp event. The sctp_ulpevent_t is used
* to carry notifications and data to the ULP (sockets). * to carry notifications and data to the ULP (sockets).
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
* Any bugs reported given to us we will try to fix... any fixes shared will * Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
static char *cvs_id __attribute__ ((unused)) = "$Id: sctp_ulpevent.c,v 1.15 2002/07/12 14:50:26 jgrimm Exp $"; static char *cvs_id __attribute__ ((unused)) = "$Id: sctp_ulpevent.c,v 1.16 2002/08/21 18:34:04 jgrimm Exp $";
#include <linux/config.h> #include <linux/config.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -79,7 +79,7 @@ sctp_ulpevent_new(int size, int msg_flags, int priority) ...@@ -79,7 +79,7 @@ sctp_ulpevent_new(int size, int msg_flags, int priority)
} }
event->malloced = 1; event->malloced = 1;
return(event); return event;
fail_init: fail_init:
kfree_skb(event->parent); kfree_skb(event->parent);
...@@ -99,7 +99,7 @@ sctp_ulpevent_init(sctp_ulpevent_t *event, ...@@ -99,7 +99,7 @@ sctp_ulpevent_init(sctp_ulpevent_t *event,
event->msg_flags = msg_flags; event->msg_flags = msg_flags;
event->parent = parent; event->parent = parent;
event->malloced = 0; event->malloced = 0;
return(event); return event;
} /* sctp_ulpevent_init() */ } /* sctp_ulpevent_init() */
...@@ -119,7 +119,7 @@ sctp_ulpevent_free(sctp_ulpevent_t *event) ...@@ -119,7 +119,7 @@ sctp_ulpevent_free(sctp_ulpevent_t *event)
int int
sctp_ulpevent_is_notification(const sctp_ulpevent_t *event) sctp_ulpevent_is_notification(const sctp_ulpevent_t *event)
{ {
return(event->msg_flags & MSG_NOTIFICATION); return event->msg_flags & MSG_NOTIFICATION;
} /* sctp_ulpevent_is_notification() */ } /* sctp_ulpevent_is_notification() */
...@@ -237,9 +237,9 @@ sctp_ulpevent_make_assoc_change(const sctp_association_t *asoc, ...@@ -237,9 +237,9 @@ sctp_ulpevent_make_assoc_change(const sctp_association_t *asoc,
*/ */
sac->sac_assoc_id = sctp_assoc2id(asoc); sac->sac_assoc_id = sctp_assoc2id(asoc);
return(event); return event;
fail: fail:
return(NULL); return NULL;
} /* sctp_ulpevent_make_assoc_change() */ } /* sctp_ulpevent_make_assoc_change() */
...@@ -346,9 +346,9 @@ sctp_ulpevent_make_peer_addr_change(const sctp_association_t *asoc, ...@@ -346,9 +346,9 @@ sctp_ulpevent_make_peer_addr_change(const sctp_association_t *asoc,
memcpy(&spc->spc_aaddr, aaddr, sizeof(struct sockaddr_storage)); memcpy(&spc->spc_aaddr, aaddr, sizeof(struct sockaddr_storage));
return(event); return event;
fail: fail:
return(NULL); return NULL;
} /* sctp_ulpevent_make_peer_addr_change() */ } /* sctp_ulpevent_make_peer_addr_change() */
...@@ -472,9 +472,9 @@ sctp_ulpevent_make_remote_error(const sctp_association_t *asoc, ...@@ -472,9 +472,9 @@ sctp_ulpevent_make_remote_error(const sctp_association_t *asoc,
sre->sre_assoc_id = sctp_assoc2id(asoc); sre->sre_assoc_id = sctp_assoc2id(asoc);
return(event); return event;
fail: fail:
return(NULL); return NULL;
} /* sctp_ulpevent_make_remote_error () */ } /* sctp_ulpevent_make_remote_error () */
...@@ -585,9 +585,9 @@ sctp_ulpevent_make_send_failed(const sctp_association_t *asoc, ...@@ -585,9 +585,9 @@ sctp_ulpevent_make_send_failed(const sctp_association_t *asoc,
ssf->ssf_assoc_id = sctp_assoc2id(asoc); ssf->ssf_assoc_id = sctp_assoc2id(asoc);
return(event); return event;
fail: fail:
return(NULL); return NULL;
} /* sctp_ulpevent_make_send_failed () */ } /* sctp_ulpevent_make_send_failed () */
...@@ -651,9 +651,9 @@ sctp_ulpevent_make_shutdown_event(const sctp_association_t *asoc, ...@@ -651,9 +651,9 @@ sctp_ulpevent_make_shutdown_event(const sctp_association_t *asoc,
*/ */
sse->sse_assoc_id = sctp_assoc2id(asoc); sse->sse_assoc_id = sctp_assoc2id(asoc);
return(event); return event;
fail: fail:
return(NULL); return NULL;
} /* sctp_ulpevent_make_shutdown_event () */ } /* sctp_ulpevent_make_shutdown_event () */
...@@ -802,12 +802,12 @@ sctp_ulpevent_make_rcvmsg(sctp_association_t *asoc, ...@@ -802,12 +802,12 @@ sctp_ulpevent_make_rcvmsg(sctp_association_t *asoc,
info->sinfo_assoc_id = sctp_assoc2id(asoc); info->sinfo_assoc_id = sctp_assoc2id(asoc);
return(event); return event;
fail_init: fail_init:
kfree_skb(skb); kfree_skb(skb);
fail: fail:
return(NULL); return NULL;
} /* sctp_ulpevent_make_rcvmsg() */ } /* sctp_ulpevent_make_rcvmsg() */
...@@ -821,7 +821,7 @@ sctp_ulpevent_get_notification_type(const sctp_ulpevent_t *event) ...@@ -821,7 +821,7 @@ sctp_ulpevent_get_notification_type(const sctp_ulpevent_t *event)
notification = (union sctp_notification *)event->parent->data; notification = (union sctp_notification *)event->parent->data;
return(notification->h.sn_type); return notification->h.sn_type;
} /* sctp_ulpevent_get_notification_type() */ } /* sctp_ulpevent_get_notification_type() */
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Copyright (c) 2001 Nokia, Inc. * Copyright (c) 2001 Nokia, Inc.
* Copyright (c) 2001 La Monte H.P. Yarroll * Copyright (c) 2001 La Monte H.P. Yarroll
* *
* $Header: /cvsroot/lksctp/lksctp/sctp_cvs/net/sctp/sctp_ulpqueue.c,v 1.13 2002/07/12 14:50:26 jgrimm Exp $ * $Header: /cvsroot/lksctp/lksctp/sctp_cvs/net/sctp/sctp_ulpqueue.c,v 1.14 2002/08/21 18:34:04 jgrimm Exp $
* *
* This abstraction carries sctp events to the ULP (sockets). * This abstraction carries sctp events to the ULP (sockets).
* *
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
* Any bugs reported given to us we will try to fix... any fixes shared will * Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
static char *cvs_id __attribute__ ((unused)) = "$Id: sctp_ulpqueue.c,v 1.13 2002/07/12 14:50:26 jgrimm Exp $"; static char *cvs_id __attribute__ ((unused)) = "$Id: sctp_ulpqueue.c,v 1.14 2002/08/21 18:34:04 jgrimm Exp $";
#include <linux/config.h> #include <linux/config.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -85,7 +85,7 @@ sctp_ulpqueue_new(sctp_association_t *asoc, uint16_t inbound, int priority) ...@@ -85,7 +85,7 @@ sctp_ulpqueue_new(sctp_association_t *asoc, uint16_t inbound, int priority)
} }
ulpq->malloced = 1; ulpq->malloced = 1;
return(ulpq); return ulpq;
fail_init: fail_init:
kfree(ulpq); kfree(ulpq);
...@@ -109,7 +109,7 @@ sctp_ulpqueue_init(sctp_ulpqueue_t *ulpq, sctp_association_t *asoc, ...@@ -109,7 +109,7 @@ sctp_ulpqueue_init(sctp_ulpqueue_t *ulpq, sctp_association_t *asoc,
skb_queue_head_init(&ulpq->lobby); skb_queue_head_init(&ulpq->lobby);
ulpq->malloced = 0; ulpq->malloced = 0;
return(ulpq); return ulpq;
} /* sctp_ulpqueue_init() */ } /* sctp_ulpqueue_init() */
...@@ -187,7 +187,7 @@ sctp_ulpqueue_tail_data(sctp_ulpqueue_t *ulpq, sctp_chunk_t *chunk, ...@@ -187,7 +187,7 @@ sctp_ulpqueue_tail_data(sctp_ulpqueue_t *ulpq, sctp_chunk_t *chunk,
sctp_ulpqueue_tail_event(ulpq, event); sctp_ulpqueue_tail_event(ulpq, event);
} }
return(0); return 0;
} /* sctp_ulpqueue_tail_data() */ } /* sctp_ulpqueue_tail_data() */
...@@ -391,13 +391,13 @@ sctp_ulpqueue_reasm(sctp_ulpqueue_t *ulpq, sctp_ulpevent_t *event) ...@@ -391,13 +391,13 @@ sctp_ulpqueue_reasm(sctp_ulpqueue_t *ulpq, sctp_ulpevent_t *event)
/* Check if this is part of a fragmented message. */ /* Check if this is part of a fragmented message. */
if (SCTP_DATA_NOT_FRAG == (event->chunk_flags & SCTP_DATA_FRAG_MASK)) { if (SCTP_DATA_NOT_FRAG == (event->chunk_flags & SCTP_DATA_FRAG_MASK)) {
return(event); return event;
} }
sctp_ulpqueue_store_reasm(ulpq, event); sctp_ulpqueue_store_reasm(ulpq, event);
retval = sctp_ulpqueue_retrieve_reassembled(ulpq); retval = sctp_ulpqueue_retrieve_reassembled(ulpq);
return(retval); return retval;
} /* sctp_ulpqueue_reasm() */ } /* sctp_ulpqueue_reasm() */
...@@ -504,7 +504,7 @@ sctp_ulpqueue_order(sctp_ulpqueue_t *ulpq, sctp_ulpevent_t *event) ...@@ -504,7 +504,7 @@ sctp_ulpqueue_order(sctp_ulpqueue_t *ulpq, sctp_ulpevent_t *event)
/* Check if this message needs ordering. */ /* Check if this message needs ordering. */
if (SCTP_DATA_UNORDERED & event->chunk_flags) { if (SCTP_DATA_UNORDERED & event->chunk_flags) {
return(event); return event;
} }
/* Note: The stream ID must be verified before this routine. */ /* Note: The stream ID must be verified before this routine. */
...@@ -521,7 +521,7 @@ sctp_ulpqueue_order(sctp_ulpqueue_t *ulpq, sctp_ulpevent_t *event) ...@@ -521,7 +521,7 @@ sctp_ulpqueue_order(sctp_ulpqueue_t *ulpq, sctp_ulpevent_t *event)
sctp_ulpqueue_store_ordered(ulpq, event); sctp_ulpqueue_store_ordered(ulpq, event);
return(NULL); return NULL;
} }
/* Mark that the next chunk has been found. */ /* Mark that the next chunk has been found. */
...@@ -533,7 +533,7 @@ sctp_ulpqueue_order(sctp_ulpqueue_t *ulpq, sctp_ulpevent_t *event) ...@@ -533,7 +533,7 @@ sctp_ulpqueue_order(sctp_ulpqueue_t *ulpq, sctp_ulpevent_t *event)
sctp_ulpqueue_retrieve_ordered(ulpq, event); sctp_ulpqueue_retrieve_ordered(ulpq, event);
return(event); return event;
} /* sctp_ulpqueue_order() */ } /* sctp_ulpqueue_order() */
......
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