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
Kirill Smelkov
linux
Commits
6701f01b
Commit
6701f01b
authored
Oct 02, 2002
by
Daisy Chang
Committed by
Jon Grimm
Oct 02, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove excessive spaces.
parent
a4cae070
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
135 deletions
+119
-135
net/sctp/sm_make_chunk.c
net/sctp/sm_make_chunk.c
+46
-52
net/sctp/sm_statefuns.c
net/sctp/sm_statefuns.c
+73
-83
No files found.
net/sctp/sm_make_chunk.c
View file @
6701f01b
...
...
@@ -889,19 +889,19 @@ sctp_chunk_t *sctp_make_heartbeat_ack(const sctp_association_t *asoc,
/* Create an Operation Error chunk with the specified space reserved.
* This routine can be used for containing multiple causes in the chunk.
*/
sctp_chunk_t
*
sctp_make_op_error_space
(
const
sctp_association_t
*
asoc
,
const
sctp_chunk_t
*
chunk
,
sctp_chunk_t
*
sctp_make_op_error_space
(
const
sctp_association_t
*
asoc
,
const
sctp_chunk_t
*
chunk
,
size_t
size
)
{
sctp_chunk_t
*
retval
;
retval
=
sctp_make_chunk
(
asoc
,
SCTP_CID_ERROR
,
0
,
sctp_chunk_t
*
retval
;
retval
=
sctp_make_chunk
(
asoc
,
SCTP_CID_ERROR
,
0
,
sizeof
(
sctp_errhdr_t
)
+
size
);
if
(
!
retval
)
goto
nodata
;
/* RFC 2960 6.4 Multi-homed SCTP Endpoints
*
/* RFC 2960 6.4 Multi-homed SCTP Endpoints
*
* An endpoint SHOULD transmit reply chunks (e.g., SACK,
* HEARTBEAT ACK, etc.) to the same destination transport
* address from which it received the DATA or control chunk
...
...
@@ -911,10 +911,9 @@ sctp_chunk_t *sctp_make_op_error_space(const sctp_association_t *asoc,
if
(
chunk
)
retval
->
transport
=
chunk
->
transport
;
nodata:
return
retval
;
}
nodata:
return
retval
;
}
/* Create an Operation Error chunk. */
sctp_chunk_t
*
sctp_make_op_error
(
const
sctp_association_t
*
asoc
,
...
...
@@ -1430,62 +1429,59 @@ sctp_association_t *sctp_unpack_cookie(const sctp_endpoint_t *ep,
/* Verify the INIT packet before we process it. */
int
sctp_verify_init
(
const
sctp_association_t
*
asoc
,
sctp_cid_t
cid
,
sctp_init_chunk_t
*
peer_init
,
sctp_chunk_t
*
chunk
,
sctp_cid_t
cid
,
sctp_init_chunk_t
*
peer_init
,
sctp_chunk_t
*
chunk
,
sctp_chunk_t
**
err_chk_p
)
{
sctpParam_t
param
;
uint8_t
*
end
;
/* FIXME - Verify the fixed fields of the INIT chunk. Also, verify
* the mandatory parameters somewhere here and generate either the
* the mandatory parameters somewhere here and generate either the
* "Missing mandatory parameter" error or the "Invalid mandatory
* parameter" error. */
/* Find unrecognized parameters. */
end
=
((
uint8_t
*
)
peer_init
+
ntohs
(
peer_init
->
chunk_hdr
.
length
));
end
=
((
uint8_t
*
)
peer_init
+
ntohs
(
peer_init
->
chunk_hdr
.
length
));
for
(
param
.
v
=
peer_init
->
init_hdr
.
params
;
param
.
v
<
end
;
param
.
v
+=
WORD_ROUND
(
ntohs
(
param
.
p
->
length
)))
{
for
(
param
.
v
=
peer_init
->
init_hdr
.
params
;
param
.
v
<
end
;
param
.
v
+=
WORD_ROUND
(
ntohs
(
param
.
p
->
length
)))
{
if
(
!
sctp_verify_param
(
asoc
,
param
,
cid
,
chunk
,
err_chk_p
))
return
0
;
return
0
;
}
/* for (loop through all parameters) */
}
/* for (loop through all parameters) */
return
1
;
}
/* Find unrecognized parameters in the chunk.
/* Find unrecognized parameters in the chunk.
* Return values:
* 0 - discard the chunk
* 1 - continue with the chunk
* 1 - continue with the chunk
*/
int
sctp_verify_param
(
const
sctp_association_t
*
asoc
,
sctpParam_t
param
,
sctp_cid_t
cid
,
sctp_chunk_t
*
chunk
,
sctpParam_t
param
,
sctp_cid_t
cid
,
sctp_chunk_t
*
chunk
,
sctp_chunk_t
**
err_chk_p
)
{
int
retval
=
1
;
/* FIXME - This routine is not looking at each parameter per the
* chunk type, i.e., unrecognized parameters should be further
/* FIXME - This routine is not looking at each parameter per the
* chunk type, i.e., unrecognized parameters should be further
* identified based on the chunk id.
*/
*/
switch
(
param
.
p
->
type
)
{
case
SCTP_PARAM_IPV4_ADDRESS
:
case
SCTP_PARAM_IPV6_ADDRESS
:
case
SCTP_PARAM_COOKIE_PRESERVATIVE
:
/* FIXME - If we don't support the host name parameter, we should
/* FIXME - If we don't support the host name parameter, we should
* generate an error for this - Unresolvable address.
*/
case
SCTP_PARAM_HOST_NAME_ADDRESS
:
...
...
@@ -1503,29 +1499,28 @@ int sctp_verify_param(const sctp_association_t *asoc,
break
;
}
return
retval
;
}
/* RFC 3.2.1 & the Implementers Guide 2.2.
*
* The Parameter Types are encoded such that the
* highest-order two bits specify the action that must be
* taken if the processing endpoint does not recognize the
* The Parameter Types are encoded such that the
* highest-order two bits specify the action that must be
* taken if the processing endpoint does not recognize the
* Parameter Type.
*
* 00 - Stop processing this SCTP chunk and discard it,
* 00 - Stop processing this SCTP chunk and discard it,
* do not process any further chunks within it.
*
* 01 - Stop processing this SCTP chunk and discard it,
* do not process any further chunks within it, and report
* the unrecognized parameter in an 'Unrecognized
* do not process any further chunks within it, and report
* the unrecognized parameter in an 'Unrecognized
* Parameter Type' (in either an ERROR or in the INIT ACK).
*
* 10 - Skip this parameter and continue processing.
*
* 11 - Skip this parameter and continue processing but
* report the unrecognized parameter in an
* 'Unrecognized Parameter Type' (in either an ERROR or in
* 11 - Skip this parameter and continue processing but
* report the unrecognized parameter in an
* 'Unrecognized Parameter Type' (in either an ERROR or in
* the INIT ACK).
*
* Return value:
...
...
@@ -1533,7 +1528,7 @@ int sctp_verify_param(const sctp_association_t *asoc,
* 1 - continue with the chunk
*/
int
sctp_process_unk_param
(
const
sctp_association_t
*
asoc
,
sctpParam_t
param
,
sctpParam_t
param
,
sctp_chunk_t
*
chunk
,
sctp_chunk_t
**
err_chk_p
)
{
...
...
@@ -1550,7 +1545,7 @@ int sctp_process_unk_param(const sctp_association_t *asoc,
*/
if
(
NULL
==
*
err_chk_p
)
*
err_chk_p
=
sctp_make_op_error_space
(
asoc
,
chunk
,
ntohs
(
chunk
->
chunk_hdr
->
length
));
ntohs
(
chunk
->
chunk_hdr
->
length
));
if
(
*
err_chk_p
)
sctp_init_cause
(
*
err_chk_p
,
SCTP_ERROR_UNKNOWN_PARAM
,
...
...
@@ -1566,15 +1561,15 @@ int sctp_process_unk_param(const sctp_association_t *asoc,
*/
if
(
NULL
==
*
err_chk_p
)
*
err_chk_p
=
sctp_make_op_error_space
(
asoc
,
chunk
,
ntohs
(
chunk
->
chunk_hdr
->
length
));
ntohs
(
chunk
->
chunk_hdr
->
length
));
if
(
*
err_chk_p
)
{
sctp_init_cause
(
*
err_chk_p
,
SCTP_ERROR_UNKNOWN_PARAM
,
(
const
void
*
)
param
.
p
,
(
const
void
*
)
param
.
p
,
WORD_ROUND
(
ntohs
(
param
.
p
->
length
)));
}
else
{
/* If there is no memory for generating the ERROR
* report as specified, an ABORT will be triggered
/* If there is no memory for generating the ERROR
* report as specified, an ABORT will be triggered
* to the peer and the association won't be established.
*/
retval
=
0
;
...
...
@@ -1586,7 +1581,6 @@ int sctp_process_unk_param(const sctp_association_t *asoc,
}
return
retval
;
}
/* Unpack the parameters in an INIT packet.
...
...
@@ -1812,7 +1806,7 @@ int sctp_process_param(sctp_association_t *asoc, sctpParam_t param,
* and handled by sctp_verify_param() which should be
* called prior to this routine. Simply log the error
* here.
*/
*/
SCTP_DEBUG_PRINTK
(
"Ignoring param: %d for association %p.
\n
"
,
ntohs
(
param
.
p
->
type
),
asoc
);
break
;
...
...
net/sctp/sm_statefuns.c
View file @
6701f01b
...
...
@@ -217,13 +217,13 @@ sctp_disposition_t sctp_sf_do_5_1B_init(const sctp_endpoint_t *ep,
if
(
!
sctp_verify_init
(
asoc
,
chunk
->
chunk_hdr
->
type
,
(
sctp_init_chunk_t
*
)
chunk
->
chunk_hdr
,
chunk
,
&
err_chunk
))
{
/* This chunk contains fatal error. It is to be discarded.
* Send an ABORT, with causes if there is any.
/* This chunk contains fatal error. It is to be discarded.
* Send an ABORT, with causes if there is any.
*/
if
(
err_chunk
)
{
packet
=
sctp_abort_pkt_new
(
ep
,
asoc
,
arg
,
(
__u8
*
)(
err_chunk
->
chunk_hdr
)
+
sizeof
(
sctp_chunkhdr_t
),
sizeof
(
sctp_chunkhdr_t
),
ntohs
(
err_chunk
->
chunk_hdr
->
length
)
-
sizeof
(
sctp_chunkhdr_t
));
...
...
@@ -240,7 +240,6 @@ sctp_disposition_t sctp_sf_do_5_1B_init(const sctp_endpoint_t *ep,
return
sctp_sf_tabort_8_4_8
(
ep
,
asoc
,
type
,
arg
,
commands
);
}
}
/* Grab the INIT header. */
...
...
@@ -270,24 +269,24 @@ sctp_disposition_t sctp_sf_do_5_1B_init(const sctp_endpoint_t *ep,
* make sure to reserve enough room in the INIT ACK for them.
*/
len
=
0
;
if
(
err_chunk
)
len
=
ntohs
(
err_chunk
->
chunk_hdr
->
length
)
-
if
(
err_chunk
)
len
=
ntohs
(
err_chunk
->
chunk_hdr
->
length
)
-
sizeof
(
sctp_chunkhdr_t
);
repl
=
sctp_make_init_ack
(
new_asoc
,
chunk
,
GFP_ATOMIC
,
len
);
if
(
!
repl
)
goto
nomem_ack
;
/* If there are errors need to be reported for unknown parameters,
* include them in the outgoing INIT ACK as "Unrecognized parameter"
/* If there are errors need to be reported for unknown parameters,
* include them in the outgoing INIT ACK as "Unrecognized parameter"
* parameter.
*/
if
(
err_chunk
)
{
if
(
err_chunk
)
{
/* Get the "Unrecognized parameter" parameter(s) out of the
* ERROR chunk generated by sctp_verify_init(). Since the
* error cause code for "unknown parameter" and the
* "Unrecognized parameter" type is the same, we can
* construct the parameters in INIT ACK by copying the
* error cause code for "unknown parameter" and the
* "Unrecognized parameter" type is the same, we can
* construct the parameters in INIT ACK by copying the
* ERROR causes over.
*/
unk_param
=
(
sctp_unrecognized_param_t
*
)
...
...
@@ -299,7 +298,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(const sctp_endpoint_t *ep,
sctp_addto_chunk
(
repl
,
len
,
unk_param
);
sctp_free_chunk
(
err_chunk
);
}
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_REPLY
,
SCTP_CHUNK
(
repl
));
/*
...
...
@@ -397,8 +396,8 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const sctp_endpoint_t *ep,
if
(
!
sctp_verify_init
(
asoc
,
chunk
->
chunk_hdr
->
type
,
(
sctp_init_chunk_t
*
)
chunk
->
chunk_hdr
,
chunk
,
&
err_chunk
))
{
/* This chunk contains fatal error. It is to be discarded.
* Send an ABORT, with causes if there is any.
/* This chunk contains fatal error. It is to be discarded.
* Send an ABORT, with causes if there is any.
*/
if
(
err_chunk
)
{
packet
=
sctp_abort_pkt_new
(
ep
,
asoc
,
arg
,
...
...
@@ -410,15 +409,15 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const sctp_endpoint_t *ep,
sctp_free_chunk
(
err_chunk
);
if
(
packet
)
{
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_SEND_PKT
,
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_SEND_PKT
,
SCTP_PACKET
(
packet
));
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_NEW_STATE
,
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_NEW_STATE
,
SCTP_STATE
(
SCTP_STATE_CLOSED
));
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_DELETE_TCB
,
SCTP_NULL
());
return
SCTP_DISPOSITION_CONSUME
;
}
else
{
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_NEW_STATE
,
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_NEW_STATE
,
SCTP_STATE
(
SCTP_STATE_CLOSED
));
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_DELETE_TCB
,
SCTP_NULL
());
...
...
@@ -427,7 +426,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const sctp_endpoint_t *ep,
}
else
{
ret
=
sctp_sf_tabort_8_4_8
(
ep
,
asoc
,
type
,
arg
,
commands
);
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_NEW_STATE
,
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_NEW_STATE
,
SCTP_STATE
(
SCTP_STATE_CLOSED
));
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_DELETE_TCB
,
SCTP_NULL
());
...
...
@@ -464,7 +463,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const sctp_endpoint_t *ep,
/* If there is any errors to report, send the ERROR chunk generated
* for unknown parameters as well.
*/
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_GEN_COOKIE_ECHO
,
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_GEN_COOKIE_ECHO
,
SCTP_CHUNK
(
err_chunk
));
return
SCTP_DISPOSITION_CONSUME
;
...
...
@@ -997,8 +996,8 @@ static sctp_disposition_t sctp_sf_do_unexpected_init(
if
(
!
sctp_verify_init
(
asoc
,
chunk
->
chunk_hdr
->
type
,
(
sctp_init_chunk_t
*
)
chunk
->
chunk_hdr
,
chunk
,
&
err_chunk
))
{
/* This chunk contains fatal error. It is to be discarded.
* Send an ABORT, with causes if there is any.
/* This chunk contains fatal error. It is to be discarded.
* Send an ABORT, with causes if there is any.
*/
if
(
err_chunk
)
{
packet
=
sctp_abort_pkt_new
(
ep
,
asoc
,
arg
,
...
...
@@ -1010,14 +1009,14 @@ static sctp_disposition_t sctp_sf_do_unexpected_init(
sctp_free_chunk
(
err_chunk
);
if
(
packet
)
{
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_SEND_PKT
,
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_SEND_PKT
,
SCTP_PACKET
(
packet
));
return
SCTP_DISPOSITION_CONSUME
;
}
else
{
return
SCTP_DISPOSITION_NOMEM
;
}
}
else
{
return
sctp_sf_tabort_8_4_8
(
ep
,
asoc
,
type
,
arg
,
return
sctp_sf_tabort_8_4_8
(
ep
,
asoc
,
type
,
arg
,
commands
);
}
}
...
...
@@ -1049,27 +1048,27 @@ static sctp_disposition_t sctp_sf_do_unexpected_init(
*/
len
=
0
;
if
(
err_chunk
)
{
len
=
ntohs
(
err_chunk
->
chunk_hdr
->
length
)
-
len
=
ntohs
(
err_chunk
->
chunk_hdr
->
length
)
-
sizeof
(
sctp_chunkhdr_t
);
}
}
repl
=
sctp_make_init_ack
(
new_asoc
,
chunk
,
GFP_ATOMIC
,
len
);
if
(
!
repl
)
goto
nomem
;
/* If there are errors need to be reported for unknown parameters,
* include them in the outgoing INIT ACK as "Unrecognized parameter"
/* If there are errors need to be reported for unknown parameters,
* include them in the outgoing INIT ACK as "Unrecognized parameter"
* parameter.
*/
if
(
err_chunk
)
{
if
(
err_chunk
)
{
/* Get the "Unrecognized parameter" parameter(s) out of the
* ERROR chunk generated by sctp_verify_init(). Since the
* error cause code for "unknown parameter" and the
* "Unrecognized parameter" type is the same, we can
* construct the parameters in INIT ACK by copying the
* error cause code for "unknown parameter" and the
* "Unrecognized parameter" type is the same, we can
* construct the parameters in INIT ACK by copying the
* ERROR causes over.
*/
unk_param
=
(
sctp_unrecognized_param_t
*
)
((
__u8
*
)(
err_chunk
->
chunk_hdr
)
+
((
__u8
*
)(
err_chunk
->
chunk_hdr
)
+
sizeof
(
sctp_chunkhdr_t
));
/* Replace the cause code with the "Unrecognized parameter"
* parameter type.
...
...
@@ -2523,7 +2522,6 @@ sctp_disposition_t sctp_sf_tabort_8_4_8(const sctp_endpoint_t *ep,
sctp_chunk_t
*
chunk
=
arg
;
sctp_chunk_t
*
abort
;
packet
=
sctp_ootb_pkt_new
(
asoc
,
chunk
);
if
(
packet
)
{
...
...
@@ -2531,24 +2529,23 @@ sctp_disposition_t sctp_sf_tabort_8_4_8(const sctp_endpoint_t *ep,
* is NULL.
*/
abort
=
sctp_make_abort
(
asoc
,
chunk
,
0
);
if
(
!
abort
)
{
if
(
!
abort
)
{
sctp_ootb_pkt_free
(
packet
);
return
SCTP_DISPOSITION_NOMEM
;
}
/* Set the skb to the belonging sock for accounting. */
abort
->
skb
->
sk
=
ep
->
base
.
sk
;
/* Set the skb to the belonging sock for accounting. */
abort
->
skb
->
sk
=
ep
->
base
.
sk
;
sctp_packet_append_chunk
(
packet
,
abort
);
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_SEND_PKT
,
sctp_packet_append_chunk
(
packet
,
abort
);
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_SEND_PKT
,
SCTP_PACKET
(
packet
));
return
SCTP_DISPOSITION_CONSUME
;
}
return
SCTP_DISPOSITION_NOMEM
;
}
/*
...
...
@@ -2728,7 +2725,6 @@ sctp_disposition_t sctp_sf_shut_8_4_5(const sctp_endpoint_t *ep,
sctp_chunk_t
*
chunk
=
arg
;
sctp_chunk_t
*
shut
;
packet
=
sctp_ootb_pkt_new
(
asoc
,
chunk
);
if
(
packet
)
{
...
...
@@ -2736,25 +2732,25 @@ sctp_disposition_t sctp_sf_shut_8_4_5(const sctp_endpoint_t *ep,
* The T bit will be set if the asoc is NULL.
*/
shut
=
sctp_make_shutdown_complete
(
asoc
,
chunk
);
if
(
!
shut
)
{
if
(
!
shut
)
{
sctp_ootb_pkt_free
(
packet
);
return
SCTP_DISPOSITION_NOMEM
;
}
/* Set the skb to the belonging sock for accounting. */
shut
->
skb
->
sk
=
ep
->
base
.
sk
;
/* Set the skb to the belonging sock for accounting. */
shut
->
skb
->
sk
=
ep
->
base
.
sk
;
sctp_packet_append_chunk
(
packet
,
shut
);
sctp_packet_append_chunk
(
packet
,
shut
);
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_SEND_PKT
,
sctp_add_cmd_sf
(
commands
,
SCTP_CMD_SEND_PKT
,
SCTP_PACKET
(
packet
));
return
SCTP_DISPOSITION_CONSUME
;
}
return
SCTP_DISPOSITION_NOMEM
;
}
/*
* Process an unknown chunk.
*
...
...
@@ -4091,27 +4087,26 @@ sctp_sackhdr_t *sctp_sm_pull_sack(sctp_chunk_t *chunk)
return
sack
;
}
/* Create an ABORT packet to be sent as a response, with the specified
* error causes.
/* Create an ABORT packet to be sent as a response, with the specified
* error causes.
*/
sctp_packet_t
*
sctp_abort_pkt_new
(
const
sctp_endpoint_t
*
ep
,
const
sctp_association_t
*
asoc
,
sctp_chunk_t
*
chunk
,
const
void
*
payload
,
size_t
paylen
)
{
sctp_packet_t
*
packet
;
sctp_chunk_t
*
abort
;
{
sctp_packet_t
*
packet
;
sctp_chunk_t
*
abort
;
packet
=
sctp_ootb_pkt_new
(
asoc
,
chunk
);
if
(
packet
)
{
/* Make an ABORT.
* The T bit will be set if the asoc is NULL.
*/
abort
=
sctp_make_abort
(
asoc
,
chunk
,
paylen
);
if
(
!
abort
)
{
* The T bit will be set if the asoc is NULL.
*/
abort
=
sctp_make_abort
(
asoc
,
chunk
,
paylen
);
if
(
!
abort
)
{
sctp_ootb_pkt_free
(
packet
);
return
NULL
;
}
...
...
@@ -4120,34 +4115,32 @@ sctp_packet_t *sctp_abort_pkt_new(const sctp_endpoint_t *ep,
*/
sctp_addto_chunk
(
abort
,
paylen
,
payload
);
/* Set the skb to the belonging sock for accounting. */
abort
->
skb
->
sk
=
ep
->
base
.
sk
;
/* Set the skb to the belonging sock for accounting. */
abort
->
skb
->
sk
=
ep
->
base
.
sk
;
sctp_packet_append_chunk
(
packet
,
abort
);
sctp_packet_append_chunk
(
packet
,
abort
);
}
return
packet
;
}
/* Allocate a packet for responding in the OOTB conditions. */
sctp_packet_t
*
sctp_ootb_pkt_new
(
const
sctp_association_t
*
asoc
,
sctp_packet_t
*
sctp_ootb_pkt_new
(
const
sctp_association_t
*
asoc
,
const
sctp_chunk_t
*
chunk
)
{
sctp_packet_t
*
packet
;
sctp_transport_t
*
transport
;
__u16
sport
;
__u16
dport
;
__u32
vtag
;
{
sctp_packet_t
*
packet
;
sctp_transport_t
*
transport
;
__u16
sport
;
__u16
dport
;
__u32
vtag
;
/* Get the source and destination port from the inbound packet. */
sport
=
ntohs
(
chunk
->
sctp_hdr
->
dest
);
dport
=
ntohs
(
chunk
->
sctp_hdr
->
source
);
/* The V-tag is going to be the same as the inbound packet if no
* association exists, otherwise, use the peer's vtag.
/* The V-tag is going to be the same as the inbound packet if no
* association exists, otherwise, use the peer's vtag.
*/
if
(
asoc
)
{
vtag
=
asoc
->
peer
.
i
.
init_tag
;
...
...
@@ -4155,18 +4148,18 @@ sctp_packet_t *sctp_ootb_pkt_new(const sctp_association_t *asoc,
vtag
=
ntohl
(
chunk
->
sctp_hdr
->
vtag
);
}
/* Make a transport for the bucket, Eliza... */
transport
=
sctp_transport_new
(
sctp_source
(
chunk
),
GFP_ATOMIC
);
/* Make a transport for the bucket, Eliza... */
transport
=
sctp_transport_new
(
sctp_source
(
chunk
),
GFP_ATOMIC
);
if
(
!
transport
)
goto
nomem
;
goto
nomem
;
/* Allocate a new packet for sending the response. */
packet
=
t_new
(
sctp_packet_t
,
GFP_ATOMIC
);
/* Allocate a new packet for sending the response. */
packet
=
t_new
(
sctp_packet_t
,
GFP_ATOMIC
);
if
(
!
packet
)
goto
nomem_packet
;
packet
=
sctp_packet_init
(
packet
,
transport
,
sport
,
dport
);
packet
=
sctp_packet_init
(
packet
,
transport
,
sport
,
dport
);
packet
=
sctp_packet_config
(
packet
,
vtag
,
0
,
NULL
);
return
packet
;
...
...
@@ -4175,14 +4168,11 @@ sctp_packet_t *sctp_ootb_pkt_new(const sctp_association_t *asoc,
sctp_transport_free
(
transport
);
nomem:
return
NULL
;
}
/* Free the packet allocated earlier for responding in the OOTB condition. */
void
sctp_ootb_pkt_free
(
sctp_packet_t
*
packet
)
{
{
sctp_transport_free
(
packet
->
transport
);
sctp_packet_free
(
packet
);
}
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