Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
33585c7e
Commit
33585c7e
authored
Jul 14, 2003
by
Sridhar Samudrala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SCTP] Update API names to be compatible with draft-ietf-tsvwg-sctpsocket-07.txt.
parent
78398488
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
179 additions
and
247 deletions
+179
-247
include/net/sctp/user.h
include/net/sctp/user.h
+121
-177
net/sctp/associola.c
net/sctp/associola.c
+2
-2
net/sctp/socket.c
net/sctp/socket.c
+50
-62
net/sctp/ulpevent.c
net/sctp/ulpevent.c
+6
-6
No files found.
include/net/sctp/user.h
View file @
33585c7e
/* SCTP kernel reference Implementation
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001 International Business Machines, Corp.
* Copyright (c) 2001
-2003
International Business Machines, Corp.
*
* This file is part of the SCTP kernel reference Implementation
*
...
...
@@ -41,61 +41,61 @@
* Jon Grimm <jgrimm@us.ibm.com>
* Daisy Chang <daisyc@us.ibm.com>
* Ryan Layer <rmlayer@us.ibm.com>
*
*
Sridhar Samudrala <sri@us.ibm.com>
*
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
*/
#include <linux/types.h>
#include <linux/socket.h>
#ifndef __net_sctp_user_h__
#define __net_sctp_user_h__
#include <linux/types.h>
#include <linux/socket.h>
typedef
void
*
sctp_assoc_t
;
/* The following symbols come from the Sockets API Extensions for
* SCTP <draft-ietf-tsvwg-sctpsocket-0
4
.txt>.
* SCTP <draft-ietf-tsvwg-sctpsocket-0
7
.txt>.
*/
enum
sctp_optname
{
SCTP_RTOINFO
,
#define SCTP_RTOINFO SCTP_RTOINFO
SCTP_ASSOC
RTX
INFO
,
#define SCTP_ASSOC
RTXINFO SCTP_ASSOCRTX
INFO
SCTP_ASSOCINFO
,
#define SCTP_ASSOC
INFO SCTP_ASSOC
INFO
SCTP_INITMSG
,
#define SCTP_INITMSG SCTP_INITMSG
SCTP_
AUTO_CLOSE
,
#define SCTP_
AUTO_CLOSE SCTP_AUTO_CLOSE
SCTP_
SET_PRIMARY_ADDR
,
#define SCTP_
SET_PRIMARY_ADDR SCTP_SET_PRIMARY_ADDR
SCTP_
NODELAY
,
/* Get/set nodelay option. */
#define SCTP_
NODELAY SCTP_NODELAY
SCTP_
AUTOCLOSE
,
#define SCTP_
AUTOCLOSE SCTP_AUTOCLOSE
SCTP_SET_PEER_PRIMARY_ADDR
,
#define SCTP_SET_PEER_PRIMARY_ADDR SCTP_SET_PEER_PRIMARY_ADDR
SCTP_
SET_ADAPTATION_LAYER
,
#define SCTP_
SET_ADAPTATION_LAYER SCTP_SET_ADAPTATION_LAYE
R
SCTP_
SET_STREAM_TIMEOUTS
,
#define SCTP_
SET_STREAM_TIMEOUTS SCTP_SET_STREAM_TIMEOUTS
SCTP_
PRIMARY_ADDR
,
#define SCTP_
PRIMARY_ADDR SCTP_PRIMARY_ADD
R
SCTP_
ADAPTION_LAYER
,
#define SCTP_
ADAPTION_LAYER SCTP_ADAPTION_LAYER
SCTP_DISABLE_FRAGMENTS
,
#define SCTP_DISABLE_FRAGMENTS SCTP_DISABLE_FRAGMENTS
SCTP_SET_PEER_ADDR_PARAMS
,
#define SCTP_SET_PEER_ADDR_PARAMS SCTP_SET_PEER_ADDR_PARAMS
SCTP_GET_PEER_ADDR_PARAMS
,
#define SCTP_GET_PEER_ADDR_PARAMS SCTP_GET_PEER_ADDR_PARAMS
SCTP_PEER_ADDR_PARAMS
,
#define SCTP_PEER_ADDR_PARAMS SCTP_PEER_ADDR_PARAMS
SCTP_DEFAULT_SEND_PARAM
,
#define SCTP_DEFAULT_SEND_PARAM SCTP_DEFAULT_SEND_PARAM
SCTP_EVENTS
,
#define SCTP_EVENTS SCTP_EVENTS
SCTP_I_WANT_MAPPED_V4_ADDR
,
/* Turn on/off mapped v4 addresses */
#define SCTP_I_WANT_MAPPED_V4_ADDR SCTP_I_WANT_MAPPED_V4_ADDR
SCTP_MAXSEG
,
/* Get/set maximum fragment. */
#define SCTP_MAXSEG SCTP_MAXSEG
SCTP_STATUS
,
#define SCTP_STATUS SCTP_STATUS
SCTP_GET_PEER_ADDR_INFO
,
#define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO
SCTP_SET_EVENTS
,
#define SCTP_SET_EVENTS SCTP_SET_EVENTS
SCTP_AUTOCLOSE
,
#define SCTP_AUTOCLOSE SCTP_AUTOCLOSE
SCTP_SET_DEFAULT_SEND_PARAM
,
#define SCTP_SET_DEFAULT_SEND_PARAM SCTP_SET_DEFAULT_SEND_PARAM
SCTP_SOCKOPT_DEBUG_NAME
=
42
,
/* FIXME */
#define SCTP_SOCKOPT_DEBUG_NAME SCTP_SOCKOPT_DEBUG_NAME
SCTP_SOCKOPT_BINDX_ADD
,
/* BINDX requests for adding addresses. */
/* Internal Socket Options. Some of the sctp library functions are
* implemented using these socket options.
*/
SCTP_SOCKOPT_BINDX_ADD
=
100
,
/* BINDX requests for adding addresses. */
#define SCTP_SOCKOPT_BINDX_ADD SCTP_SOCKOPT_BINDX_ADD
SCTP_SOCKOPT_BINDX_REM
,
/* BINDX requests for removing addresses. */
#define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM
...
...
@@ -109,29 +109,8 @@ enum sctp_optname {
#define SCTP_GET_LOCAL_ADDRS_NUM SCTP_GET_LOCAL_ADDRS_NUM
SCTP_GET_LOCAL_ADDRS
,
/* Get all local addresss. */
#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS
SCTP_NODELAY
,
/* Get/set nodelay option. */
#define SCTP_NODELAY SCTP_NODELAY
SCTP_I_WANT_MAPPED_V4_ADDR
,
/* Turn on/off mapped v4 addresses */
#define SCTP_I_WANT_MAPPED_V4_ADDR SCTP_I_WANT_MAPPED_V4_ADDR
SCTP_MAXSEG
,
/* Get/set maximum fragment. */
#define SCTP_MAXSEG SCTP_MAXSEG
};
/*
* 5.2 SCTP msg_control Structures
*
* A key element of all SCTP-specific socket extensions is the use of
* ancillary data to specify and access SCTP-specific data via the
* struct msghdr's msg_control member used in sendmsg() and recvmsg().
* Fine-grained control over initialization and sending parameters are
* handled with ancillary data.
*
* Each ancillary data item is preceeded by a struct cmsghdr (see
* Section 5.1), which defines the function and purpose of the data
* contained in in the cmsg_data[] member.
*/
/*
* 5.2.1 SCTP Initiation Structure (SCTP_INIT)
*
...
...
@@ -152,7 +131,6 @@ struct sctp_initmsg {
__u16
sinit_max_init_timeo
;
};
/*
* 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV)
*
...
...
@@ -214,7 +192,6 @@ typedef enum sctp_cmsg_type {
* following format:
*
*/
struct
sctp_assoc_change
{
__u16
sac_type
;
__u16
sac_flags
;
...
...
@@ -267,11 +244,11 @@ struct sctp_paddr_change {
* event that happened to the address. They include:
*/
enum
sctp_spc_state
{
ADDRESS_AVAIL
ABLE
,
ADDRESS
_UNREACHABLE
,
ADDRESS
_REMOVED
,
ADDRESS
_ADDED
,
ADDRESS
_MADE_PRIM
,
SCTP_ADDR_REACH
ABLE
,
SCTP_ADDR
_UNREACHABLE
,
SCTP_ADDR
_REMOVED
,
SCTP_ADDR
_ADDED
,
SCTP_ADDR
_MADE_PRIM
,
};
...
...
@@ -290,7 +267,6 @@ struct sctp_remote_error {
__u16
sre_flags
;
__u32
sre_length
;
__u16
sre_error
;
__u16
sre_len
;
sctp_assoc_t
sre_assoc_id
;
__u8
sre_data
[
0
];
};
...
...
@@ -324,7 +300,6 @@ struct sctp_send_failed {
* Note that this does not necessarily mean that the
* data was (or was not) successfully delivered.
*/
enum
sctp_ssf_flags
{
SCTP_DATA_UNSENT
,
SCTP_DATA_SENT
,
...
...
@@ -336,7 +311,6 @@ enum sctp_ssf_flags {
* When a peer sends a SHUTDOWN, SCTP delivers this notification to
* inform the application that it should cease sending data.
*/
struct
sctp_shutdown_event
{
__u16
sse_type
;
__u16
sse_flags
;
...
...
@@ -355,8 +329,8 @@ struct sctp_adaption_event {
__u16
sai_type
;
__u16
sai_flags
;
__u32
sai_length
;
__u32
sai_adapt
ation_bits
;
sctp_assoc_t
s
se
_assoc_id
;
__u32
sai_adapt
ion_ind
;
sctp_assoc_t
s
ai
_assoc_id
;
};
/*
...
...
@@ -366,8 +340,7 @@ struct sctp_adaption_event {
* message this notification will be used to inidicate
* various events.
*/
struct
sctp_rcv_pdapi_event
{
struct
sctp_pdapi_event
{
__u16
pdapi_type
;
__u16
pdapi_flags
;
__u32
pdapi_length
;
...
...
@@ -404,14 +377,14 @@ union sctp_notification {
__u16
sn_type
;
/* Notification type. */
__u16
sn_flags
;
__u32
sn_length
;
}
h
;
}
sn_header
;
struct
sctp_assoc_change
sn_assoc_change
;
struct
sctp_paddr_change
sn_padr_change
;
struct
sctp_paddr_change
sn_pad
d
r_change
;
struct
sctp_remote_error
sn_remote_error
;
struct
sctp_send_failed
sn_send_failed
;
struct
sctp_shutdown_event
sn_shutdown_event
;
struct
sctp_adaption_event
sn_adaption_event
;
struct
sctp_
rcv_pdapi_event
sn_rcv
_pdapi_event
;
struct
sctp_
pdapi_event
sn
_pdapi_event
;
};
/* Section 5.3.1
...
...
@@ -447,76 +420,26 @@ typedef enum sctp_sn_error {
SCTP_PEER_FAULTY
,
}
sctp_sn_error_t
;
/*
*
* 7.1.14 Peer Address Parameters
*
* Applications can enable or disable heartbeats for any peer address
* of an association, modify an address's heartbeat interval, force a
* heartbeat to be sent immediately, and adjust the address's maximum
* number of retransmissions sent before an address is considered
* unreachable. The following structure is used to access and modify an
* address's parameters:
*/
struct
sctp_paddrparams
{
struct
sockaddr_storage
spp_address
;
__u32
spp_hbinterval
;
__u16
spp_pathmaxrxt
;
sctp_assoc_t
spp_assoc_id
;
};
/*
* 7.2.2 Peer Address Information
*
* Applications can retrieve information about a specific peer address
* of an association, including its reachability state, congestion
* window, and retransmission timer values. This information is
* read-only. The following structure is used to access this
* information:
*/
struct
sctp_paddrinfo
{
sctp_assoc_t
spinfo_assoc_id
;
struct
sockaddr_storage
spinfo_address
;
__s32
spinfo_state
;
__u32
spinfo_cwnd
;
__u32
spinfo_srtt
;
__u32
spinfo_rto
;
__u32
spinfo_mtu
;
};
/* Peer addresses's state. */
enum
sctp_spinfo_state
{
SCTP_INACTIVE
,
SCTP_ACTIVE
,
};
/*
* 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO)
*
* The protocol parameters used to initialize and bound retransmission
* timeout (RTO) are tunable. See [SCTP] for more information on how
* these parameters are used in RTO calculation. The peer address
* parameter is ignored for TCP style socket.
* these parameters are used in RTO calculation.
*/
struct
sctp_rtoinfo
{
sctp_assoc_t
srto_assoc_id
;
__u32
srto_initial
;
__u32
srto_max
;
__u32
srto_min
;
sctp_assoc_t
srto_assoc_id
;
};
/*
* 7.1.2 Association
Retransmission Parameter (SCTP_ASSOCRTX
INFO)
* 7.1.2 Association
Parameters (SCTP_ASSOC
INFO)
*
* The protocol parameter used to set the number of retransmissions
* sent before an association is considered unreachable.
* See [SCTP] for more information on how this parameter is used. The
* peer address parameter is ignored for TCP style socket.
* This option is used to both examine and set various association and
* endpoint parameters.
*/
struct
sctp_assocparams
{
sctp_assoc_t
sasoc_assoc_id
;
__u16
sasoc_asocmaxrxt
;
...
...
@@ -527,31 +450,81 @@ struct sctp_assocparams {
};
/*
* 7.1.9 Set P
rimary Address (SCTP_SET
_PRIMARY_ADDR)
* 7.1.9 Set P
eer Primary Address (SCTP_SET_PEER
_PRIMARY_ADDR)
*
* Requests that the peer mark the enclosed address as the association
* primary. The enclosed address must be one of the association's
* locally bound addresses. The following structure is used to make a
* set primary request:
*/
struct
sctp_setprim
{
struct
sockaddr_storage
ssp_addr
;
sctp_assoc_t
ssp_assoc_id
;
struct
sctp_setpeerprim
{
sctp_assoc_t
sspp_assoc_id
;
struct
sockaddr_storage
sspp_addr
;
};
/*
* 7.1.10 Set P
eer Primary Address (SCTP_SET_PEER
_PRIMARY_ADDR)
* 7.1.10 Set P
rimary Address (SCTP
_PRIMARY_ADDR)
*
* Requests that the local SCTP stack use the enclosed peer address as
* the association primary. The enclosed address must be one of the
* association peer's addresses. The following structure is used to
* make a set peer primary request:
*/
struct
sctp_prim
{
sctp_assoc_t
ssp_assoc_id
;
struct
sockaddr_storage
ssp_addr
;
};
struct
sctp_setpeerprim
{
struct
sockaddr_storage
sspp_addr
;
sctp_assoc_t
sspp_assoc_id
;
/*
* 7.1.11 Set Adaption Layer Indicator (SCTP_ADAPTION_LAYER)
*
* Requests that the local endpoint set the specified Adaption Layer
* Indication parameter for all future INIT and INIT-ACK exchanges.
*/
struct
sctp_setadaption
{
__u32
ssb_adaption_ind
;
};
/*
* 7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS)
*
* Applications can enable or disable heartbeats for any peer address
* of an association, modify an address's heartbeat interval, force a
* heartbeat to be sent immediately, and adjust the address's maximum
* number of retransmissions sent before an address is considered
* unreachable. The following structure is used to access and modify an
* address's parameters:
*/
struct
sctp_paddrparams
{
sctp_assoc_t
spp_assoc_id
;
struct
sockaddr_storage
spp_address
;
__u32
spp_hbinterval
;
__u16
spp_pathmaxrxt
;
};
/*
* 7.2.2 Peer Address Information
*
* Applications can retrieve information about a specific peer address
* of an association, including its reachability state, congestion
* window, and retransmission timer values. This information is
* read-only. The following structure is used to access this
* information:
*/
struct
sctp_paddrinfo
{
sctp_assoc_t
spinfo_assoc_id
;
struct
sockaddr_storage
spinfo_address
;
__s32
spinfo_state
;
__u32
spinfo_cwnd
;
__u32
spinfo_srtt
;
__u32
spinfo_rto
;
__u32
spinfo_mtu
;
};
/* Peer addresses's state. */
enum
sctp_spinfo_state
{
SCTP_INACTIVE
,
SCTP_ACTIVE
,
};
/*
...
...
@@ -575,34 +548,8 @@ struct sctp_status {
struct
sctp_paddrinfo
sstat_primary
;
};
/*
* 7.1.12 Set Adaption Layer Indicator
*
* Requests that the local endpoint set the specified Adaption Layer
* Indication parameter for all future
* INIT and INIT-ACK exchanges.
*/
struct
sctp_setadaption
{
__u32
ssb_adaption_ind
;
};
/*
* 7.1.12 Set default message time outs (SCTP_SET_STREAM_TIMEOUTS)
*
* This option requests that the requested stream apply a
* default time-out for messages in queue.
*/
struct
sctp_setstrm_timeout
{
sctp_assoc_t
ssto_assoc_id
;
__u32
ssto_timeout
;
__u16
ssto_streamid_start
;
__u16
ssto_streamid_end
;
};
/*
* 8.3 8.5 get all peer/local addresses on a socket
* 8.3
,
8.5 get all peer/local addresses on a socket
* This parameter struct is for getsockopt
*/
struct
sctp_getaddrs
{
...
...
@@ -624,8 +571,8 @@ enum sctp_msg_flags {
* The flags parameter is formed from the bitwise OR of zero or more of the
* following currently defined flags:
*/
#define BINDX_ADD_ADDR 0x01
#define BINDX_REM_ADDR 0x02
#define
SCTP_
BINDX_ADD_ADDR 0x01
#define
SCTP_
BINDX_REM_ADDR 0x02
/* This is the structure that is passed as an argument(optval) to
* getsockopt(SCTP_SOCKOPT_PEELOFF).
...
...
@@ -636,6 +583,3 @@ typedef struct {
}
sctp_peeloff_arg_t
;
#endif
/* __net_sctp_user_h__ */
net/sctp/associola.c
View file @
33585c7e
...
...
@@ -556,12 +556,12 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
switch
(
command
)
{
case
SCTP_TRANSPORT_UP
:
transport
->
active
=
SCTP_ACTIVE
;
spc_state
=
ADDRESS_AVAIL
ABLE
;
spc_state
=
SCTP_ADDR_REACH
ABLE
;
break
;
case
SCTP_TRANSPORT_DOWN
:
transport
->
active
=
SCTP_INACTIVE
;
spc_state
=
ADDRESS
_UNREACHABLE
;
spc_state
=
SCTP_ADDR
_UNREACHABLE
;
break
;
default:
...
...
net/sctp/socket.c
View file @
33585c7e
...
...
@@ -365,15 +365,15 @@ static int __sctp_bindx(struct sock *sk, struct sockaddr_storage *addrs,
SCTP_DEBUG_PRINTK
(
"__sctp_bindx(sk: %p, addrs: %p, addrcnt: %d, "
"flags: %s)
\n
"
,
sk
,
addrs
,
addrcnt
,
(
BINDX_ADD_ADDR
==
flags
)
?
"ADD"
:
((
BINDX_REM_ADDR
==
flags
)
?
"REM"
:
"BOGUS"
));
(
SCTP_
BINDX_ADD_ADDR
==
flags
)
?
"ADD"
:
((
SCTP_
BINDX_REM_ADDR
==
flags
)
?
"REM"
:
"BOGUS"
));
switch
(
flags
)
{
case
BINDX_ADD_ADDR
:
case
SCTP_
BINDX_ADD_ADDR
:
retval
=
sctp_bindx_add
(
sk
,
addrs
,
addrcnt
);
break
;
case
BINDX_REM_ADDR
:
case
SCTP_
BINDX_REM_ADDR
:
retval
=
sctp_bindx_rem
(
sk
,
addrs
,
addrcnt
);
break
;
...
...
@@ -1431,7 +1431,7 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char *optval,
return
0
;
}
/* 7.1.13 Peer Address Parameters (SCTP_
SET_
PEER_ADDR_PARAMS)
/* 7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS)
*
* Applications can enable or disable heartbeats for any peer address of
* an association, modify an address's heartbeat interval, force a
...
...
@@ -1581,24 +1581,25 @@ static int sctp_setsockopt_default_send_param(struct sock *sk,
return
0
;
}
/* 7.1.10 Set Peer Primary Address (SCTP_
SET_PEER_
PRIMARY_ADDR)
/* 7.1.10 Set Peer Primary Address (SCTP_PRIMARY_ADDR)
*
* Requests that the local SCTP stack use the enclosed peer address as
* the association primary. The enclosed address must be one of the
* association peer's addresses.
*/
static
int
sctp_setsockopt_peer_prim
(
struct
sock
*
sk
,
char
*
optval
,
int
optlen
)
static
int
sctp_setsockopt_primary_addr
(
struct
sock
*
sk
,
char
*
optval
,
int
optlen
)
{
struct
sctp_
setpeer
prim
prim
;
struct
sctp_prim
prim
;
struct
sctp_transport
*
trans
;
if
(
optlen
!=
sizeof
(
struct
sctp_
setpeer
prim
))
if
(
optlen
!=
sizeof
(
struct
sctp_prim
))
return
-
EINVAL
;
if
(
copy_from_user
(
&
prim
,
optval
,
sizeof
(
struct
sctp_
setpeer
prim
)))
if
(
copy_from_user
(
&
prim
,
optval
,
sizeof
(
struct
sctp_prim
)))
return
-
EFAULT
;
trans
=
sctp_addr_id2transport
(
sk
,
&
prim
.
ssp
p_addr
,
prim
.
ssp
p_assoc_id
);
trans
=
sctp_addr_id2transport
(
sk
,
&
prim
.
ssp
_addr
,
prim
.
ss
p_assoc_id
);
if
(
!
trans
)
return
-
EINVAL
;
...
...
@@ -1692,8 +1693,8 @@ static int sctp_setsockopt_rtoinfo(struct sock *sk, char *optval, int optlen) {
* See [SCTP] for more information.
*
*/
static
int
sctp_setsockopt_assoc
rtx
(
struct
sock
*
sk
,
char
*
optval
,
int
optlen
)
{
static
int
sctp_setsockopt_assoc
info
(
struct
sock
*
sk
,
char
*
optval
,
int
optlen
)
{
struct
sctp_assocparams
assocparams
;
struct
sctp_association
*
asoc
;
...
...
@@ -1804,7 +1805,6 @@ SCTP_STATIC int sctp_setsockopt(struct sock *sk, int level, int optname,
char
*
optval
,
int
optlen
)
{
int
retval
=
0
;
char
*
tmp
;
SCTP_DEBUG_PRINTK
(
"sctp_setsockopt(sk: %p... optname: %d)
\n
"
,
sk
,
optname
);
...
...
@@ -1824,38 +1824,25 @@ SCTP_STATIC int sctp_setsockopt(struct sock *sk, int level, int optname,
sctp_lock_sock
(
sk
);
switch
(
optname
)
{
case
SCTP_SOCKOPT_DEBUG_NAME
:
/* BUG! we don't ever seem to free this memory. --jgrimm */
if
(
NULL
==
(
tmp
=
kmalloc
(
optlen
+
1
,
GFP_KERNEL
)))
{
retval
=
-
ENOMEM
;
goto
out_unlock
;
}
if
(
copy_from_user
(
tmp
,
optval
,
optlen
))
{
retval
=
-
EFAULT
;
goto
out_unlock
;
}
tmp
[
optlen
]
=
'\000'
;
sctp_sk
(
sk
)
->
ep
->
debug_name
=
tmp
;
break
;
case
SCTP_SOCKOPT_BINDX_ADD
:
/* 'optlen' is the size of the addresses buffer. */
retval
=
sctp_setsockopt_bindx
(
sk
,
(
struct
sockaddr_storage
*
)
optval
,
optlen
,
BINDX_ADD_ADDR
);
optval
,
optlen
,
SCTP_BINDX_ADD_ADDR
);
break
;
case
SCTP_SOCKOPT_BINDX_REM
:
/* 'optlen' is the size of the addresses buffer. */
retval
=
sctp_setsockopt_bindx
(
sk
,
(
struct
sockaddr_storage
*
)
optval
,
optlen
,
BINDX_REM_ADDR
);
optval
,
optlen
,
SCTP_BINDX_REM_ADDR
);
break
;
case
SCTP_DISABLE_FRAGMENTS
:
retval
=
sctp_setsockopt_disable_fragments
(
sk
,
optval
,
optlen
);
break
;
case
SCTP_
SET_
EVENTS
:
case
SCTP_EVENTS
:
retval
=
sctp_setsockopt_events
(
sk
,
optval
,
optlen
);
break
;
...
...
@@ -1863,19 +1850,19 @@ SCTP_STATIC int sctp_setsockopt(struct sock *sk, int level, int optname,
retval
=
sctp_setsockopt_autoclose
(
sk
,
optval
,
optlen
);
break
;
case
SCTP_
SET_
PEER_ADDR_PARAMS
:
case
SCTP_PEER_ADDR_PARAMS
:
retval
=
sctp_setsockopt_peer_addr_params
(
sk
,
optval
,
optlen
);
break
;
case
SCTP_INITMSG
:
retval
=
sctp_setsockopt_initmsg
(
sk
,
optval
,
optlen
);
break
;
case
SCTP_
SET_
DEFAULT_SEND_PARAM
:
case
SCTP_DEFAULT_SEND_PARAM
:
retval
=
sctp_setsockopt_default_send_param
(
sk
,
optval
,
optlen
);
break
;
case
SCTP_
SET_PEER_
PRIMARY_ADDR
:
retval
=
sctp_setsockopt_p
eer_prim
(
sk
,
optval
,
optlen
);
case
SCTP_PRIMARY_ADDR
:
retval
=
sctp_setsockopt_p
rimary_addr
(
sk
,
optval
,
optlen
);
break
;
case
SCTP_NODELAY
:
retval
=
sctp_setsockopt_nodelay
(
sk
,
optval
,
optlen
);
...
...
@@ -1883,8 +1870,8 @@ SCTP_STATIC int sctp_setsockopt(struct sock *sk, int level, int optname,
case
SCTP_RTOINFO
:
retval
=
sctp_setsockopt_rtoinfo
(
sk
,
optval
,
optlen
);
break
;
case
SCTP_ASSOC
RTX
INFO
:
retval
=
sctp_setsockopt_assoc
rtx
(
sk
,
optval
,
optlen
);
case
SCTP_ASSOCINFO
:
retval
=
sctp_setsockopt_assoc
info
(
sk
,
optval
,
optlen
);
break
;
case
SCTP_I_WANT_MAPPED_V4_ADDR
:
retval
=
sctp_setsockopt_mappedv4
(
sk
,
optval
,
optlen
);
...
...
@@ -1897,7 +1884,6 @@ SCTP_STATIC int sctp_setsockopt(struct sock *sk, int level, int optname,
break
;
};
out_unlock:
sctp_release_sock
(
sk
);
out_nounlock:
...
...
@@ -2173,7 +2159,7 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk)
}
/* Default Peer Address Parameters. These defaults can
* be modified via SCTP_
SET_
PEER_ADDR_PARAMS
* be modified via SCTP_PEER_ADDR_PARAMS
*/
sp
->
paddrparam
.
spp_hbinterval
=
(
sctp_hb_interval
/
HZ
)
*
1000
;
sp
->
paddrparam
.
spp_pathmaxrxt
=
sctp_max_retrans_path
;
...
...
@@ -2418,12 +2404,13 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len,
return
0
;
}
/* 7.1.15 Set notification and ancillary events (SCTP_
SET_
EVENTS)
/* 7.1.15 Set notification and ancillary events (SCTP_EVENTS)
*
* This socket option is used to specify various notifications and
* ancillary data the user wishes to receive.
*/
static
int
sctp_getsockopt_set_events
(
struct
sock
*
sk
,
int
len
,
char
*
optval
,
int
*
optlen
)
static
int
sctp_getsockopt_events
(
struct
sock
*
sk
,
int
len
,
char
*
optval
,
int
*
optlen
)
{
if
(
len
!=
sizeof
(
struct
sctp_event_subscribe
))
return
-
EINVAL
;
...
...
@@ -2526,7 +2513,7 @@ static int sctp_getsockopt_peeloff(struct sock *sk, int len, char *optval, int *
return
retval
;
}
/* 7.1.13 Peer Address Parameters (SCTP_
SET_
PEER_ADDR_PARAMS)
/* 7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS)
*
* Applications can enable or disable heartbeats for any peer address of
* an association, modify an address's heartbeat interval, force a
...
...
@@ -2776,35 +2763,35 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
return
0
;
}
/* 7.1.10 Set P
eer Primary Address (SCTP_SET_PEER
_PRIMARY_ADDR)
/* 7.1.10 Set P
rimary Address (SCTP
_PRIMARY_ADDR)
*
* Requests that the local SCTP stack use the enclosed peer address as
* the association primary. The enclosed address must be one of the
* association peer's addresses.
*/
static
int
sctp_getsockopt_p
eer_prim
(
struct
sock
*
sk
,
int
len
,
static
int
sctp_getsockopt_p
rimary_addr
(
struct
sock
*
sk
,
int
len
,
char
*
optval
,
int
*
optlen
)
{
struct
sctp_
setpeer
prim
prim
;
struct
sctp_prim
prim
;
struct
sctp_association
*
asoc
;
if
(
len
!=
sizeof
(
struct
sctp_
setpeer
prim
))
if
(
len
!=
sizeof
(
struct
sctp_prim
))
return
-
EINVAL
;
if
(
copy_from_user
(
&
prim
,
optval
,
sizeof
(
struct
sctp_
setpeer
prim
)))
if
(
copy_from_user
(
&
prim
,
optval
,
sizeof
(
struct
sctp_prim
)))
return
-
EFAULT
;
asoc
=
sctp_id2assoc
(
sk
,
prim
.
ssp
p
_assoc_id
);
asoc
=
sctp_id2assoc
(
sk
,
prim
.
ssp_assoc_id
);
if
(
!
asoc
)
return
-
EINVAL
;
if
(
!
asoc
->
peer
.
primary_path
)
return
-
ENOTCONN
;
memcpy
(
&
prim
.
ssp
p
_addr
,
&
asoc
->
peer
.
primary_path
->
ipaddr
,
memcpy
(
&
prim
.
ssp_addr
,
&
asoc
->
peer
.
primary_path
->
ipaddr
,
sizeof
(
union
sctp_addr
));
if
(
copy_to_user
(
optval
,
&
prim
,
sizeof
(
struct
sctp_
setpeer
prim
)))
if
(
copy_to_user
(
optval
,
&
prim
,
sizeof
(
struct
sctp_prim
)))
return
-
EFAULT
;
return
0
;
...
...
@@ -2952,8 +2939,9 @@ static int sctp_getsockopt_rtoinfo(struct sock *sk, int len, char *optval,
* See [SCTP] for more information.
*
*/
static
int
sctp_getsockopt_assocrtx
(
struct
sock
*
sk
,
int
len
,
char
*
optval
,
int
*
optlen
)
{
static
int
sctp_getsockopt_associnfo
(
struct
sock
*
sk
,
int
len
,
char
*
optval
,
int
*
optlen
)
{
struct
sctp_assocparams
assocparams
;
struct
sctp_association
*
asoc
;
...
...
@@ -3101,8 +3089,8 @@ SCTP_STATIC int sctp_getsockopt(struct sock *sk, int level, int optname,
retval
=
sctp_getsockopt_disable_fragments
(
sk
,
len
,
optval
,
optlen
);
break
;
case
SCTP_
SET_
EVENTS
:
retval
=
sctp_getsockopt_
set_
events
(
sk
,
len
,
optval
,
optlen
);
case
SCTP_EVENTS
:
retval
=
sctp_getsockopt_events
(
sk
,
len
,
optval
,
optlen
);
break
;
case
SCTP_AUTOCLOSE
:
retval
=
sctp_getsockopt_autoclose
(
sk
,
len
,
optval
,
optlen
);
...
...
@@ -3110,7 +3098,7 @@ SCTP_STATIC int sctp_getsockopt(struct sock *sk, int level, int optname,
case
SCTP_SOCKOPT_PEELOFF
:
retval
=
sctp_getsockopt_peeloff
(
sk
,
len
,
optval
,
optlen
);
break
;
case
SCTP_
GET_
PEER_ADDR_PARAMS
:
case
SCTP_PEER_ADDR_PARAMS
:
retval
=
sctp_getsockopt_peer_addr_params
(
sk
,
len
,
optval
,
optlen
);
break
;
...
...
@@ -3133,12 +3121,12 @@ SCTP_STATIC int sctp_getsockopt(struct sock *sk, int level, int optname,
retval
=
sctp_getsockopt_local_addrs
(
sk
,
len
,
optval
,
optlen
);
break
;
case
SCTP_
SET_
DEFAULT_SEND_PARAM
:
case
SCTP_DEFAULT_SEND_PARAM
:
retval
=
sctp_getsockopt_default_send_param
(
sk
,
len
,
optval
,
optlen
);
break
;
case
SCTP_
SET_PEER_
PRIMARY_ADDR
:
retval
=
sctp_getsockopt_p
eer_prim
(
sk
,
len
,
optval
,
optlen
);
case
SCTP_PRIMARY_ADDR
:
retval
=
sctp_getsockopt_p
rimary_addr
(
sk
,
len
,
optval
,
optlen
);
break
;
case
SCTP_NODELAY
:
retval
=
sctp_getsockopt_nodelay
(
sk
,
len
,
optval
,
optlen
);
...
...
@@ -3146,8 +3134,8 @@ SCTP_STATIC int sctp_getsockopt(struct sock *sk, int level, int optname,
case
SCTP_RTOINFO
:
retval
=
sctp_getsockopt_rtoinfo
(
sk
,
len
,
optval
,
optlen
);
break
;
case
SCTP_ASSOC
RTX
INFO
:
retval
=
sctp_getsockopt_assoc
rtx
(
sk
,
len
,
optval
,
optlen
);
case
SCTP_ASSOCINFO
:
retval
=
sctp_getsockopt_assoc
info
(
sk
,
len
,
optval
,
optlen
);
break
;
case
SCTP_I_WANT_MAPPED_V4_ADDR
:
retval
=
sctp_getsockopt_mappedv4
(
sk
,
len
,
optval
,
optlen
);
...
...
net/sctp/ulpevent.c
View file @
33585c7e
...
...
@@ -727,7 +727,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_pdapi(
const
struct
sctp_association
*
asoc
,
__u32
indication
,
int
gfp
)
{
struct
sctp_ulpevent
*
event
;
struct
sctp_
rcv_
pdapi_event
*
pd
;
struct
sctp_pdapi_event
*
pd
;
struct
sk_buff
*
skb
;
event
=
sctp_ulpevent_new
(
sizeof
(
struct
sctp_assoc_change
),
...
...
@@ -736,8 +736,8 @@ struct sctp_ulpevent *sctp_ulpevent_make_pdapi(
goto
fail
;
skb
=
sctp_event2skb
(
event
);
pd
=
(
struct
sctp_
rcv_
pdapi_event
*
)
skb_put
(
skb
,
sizeof
(
struct
sctp_
rcv_
pdapi_event
));
pd
=
(
struct
sctp_pdapi_event
*
)
skb_put
(
skb
,
sizeof
(
struct
sctp_pdapi_event
));
/* pdapi_type
* It should be SCTP_PARTIAL_DELIVERY_EVENT
...
...
@@ -752,9 +752,9 @@ struct sctp_ulpevent *sctp_ulpevent_make_pdapi(
*
* This field is the total length of the notification data, including
* the notification header. It will generally be sizeof (struct
* sctp_
rcv_
pdapi_event).
* sctp_pdapi_event).
*/
pd
->
pdapi_length
=
sizeof
(
struct
sctp_
rcv_
pdapi_event
);
pd
->
pdapi_length
=
sizeof
(
struct
sctp_pdapi_event
);
/* pdapi_indication: 32 bits (unsigned integer)
*
...
...
@@ -784,7 +784,7 @@ __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event)
skb
=
sctp_event2skb
((
struct
sctp_ulpevent
*
)
event
);
notification
=
(
union
sctp_notification
*
)
skb
->
data
;
return
notification
->
h
.
sn_type
;
return
notification
->
sn_header
.
sn_type
;
}
/* Copy out the sndrcvinfo into a msghdr. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment