Skip to content

Commit c28445c

Browse files
lxindavem330
authored andcommitted
sctp: add reconf_enable in asoc ep and netns
This patch is to add reconf_enable field in all of asoc ep and netns to indicate if they support stream reset. When initializing, asoc reconf_enable get the default value from ep reconf_enable which is from netns netns reconf_enable by default. It is also to add reconf_capable in asoc peer part to know if peer supports reconf_enable, the value is set if ext params have reconf chunk support when processing init chunk, just as rfc6525 section 5.1.1 demands. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7a090b0 commit c28445c

File tree

6 files changed

+28
-2
lines changed

6 files changed

+28
-2
lines changed

include/net/netns/sctp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ struct netns_sctp {
118118
/* Flag to indicate if PR-SCTP is enabled. */
119119
int prsctp_enable;
120120

121+
/* Flag to indicate if PR-CONFIG is enabled. */
122+
int reconf_enable;
123+
121124
/* Flag to idicate if SCTP-AUTH is enabled */
122125
int auth_enable;
123126

include/net/sctp/structs.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,8 @@ struct sctp_endpoint {
12551255
struct list_head endpoint_shared_keys;
12561256
__u16 active_key_id;
12571257
__u8 auth_enable:1,
1258-
prsctp_enable:1;
1258+
prsctp_enable:1,
1259+
reconf_enable:1;
12591260
};
12601261

12611262
/* Recover the outter endpoint structure. */
@@ -1508,6 +1509,7 @@ struct sctp_association {
15081509
hostname_address:1, /* Peer understands DNS addresses? */
15091510
asconf_capable:1, /* Does peer support ADDIP? */
15101511
prsctp_capable:1, /* Can peer do PR-SCTP? */
1512+
reconf_capable:1, /* Can peer do RE-CONFIG? */
15111513
auth_capable:1; /* Is peer doing SCTP-AUTH? */
15121514

15131515
/* sack_needed : This flag indicates if the next received
@@ -1867,7 +1869,8 @@ struct sctp_association {
18671869

18681870
__u8 need_ecne:1, /* Need to send an ECNE Chunk? */
18691871
temp:1, /* Is it a temporary association? */
1870-
prsctp_enable:1;
1872+
prsctp_enable:1,
1873+
reconf_enable:1;
18711874

18721875
__u32 strreset_outseq; /* Update after receiving response */
18731876
__u32 strreset_inseq; /* Update after receiving request */

net/sctp/associola.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
270270

271271
asoc->active_key_id = ep->active_key_id;
272272
asoc->prsctp_enable = ep->prsctp_enable;
273+
asoc->reconf_enable = ep->reconf_enable;
273274

274275
/* Save the hmacs and chunks list into this association */
275276
if (ep->auth_hmacs_list)

net/sctp/endpointola.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
164164
ep->auth_hmacs_list = auth_hmacs;
165165
ep->auth_chunk_list = auth_chunks;
166166
ep->prsctp_enable = net->sctp.prsctp_enable;
167+
ep->reconf_enable = net->sctp.reconf_enable;
167168

168169
return ep;
169170

net/sctp/protocol.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,9 @@ static int __net_init sctp_defaults_init(struct net *net)
12581258
/* Enable PR-SCTP by default. */
12591259
net->sctp.prsctp_enable = 1;
12601260

1261+
/* Disable RECONF by default. */
1262+
net->sctp.reconf_enable = 0;
1263+
12611264
/* Disable AUTH by default. */
12621265
net->sctp.auth_enable = 0;
12631266

net/sctp/sm_make_chunk.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
270270
num_ext += 2;
271271
}
272272

273+
if (asoc->reconf_enable) {
274+
extensions[num_ext] = SCTP_CID_RECONF;
275+
num_ext += 1;
276+
}
277+
273278
if (sp->adaptation_ind)
274279
chunksize += sizeof(aiparam);
275280

@@ -434,6 +439,11 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
434439
num_ext += 2;
435440
}
436441

442+
if (asoc->peer.reconf_capable) {
443+
extensions[num_ext] = SCTP_CID_RECONF;
444+
num_ext += 1;
445+
}
446+
437447
if (sp->adaptation_ind)
438448
chunksize += sizeof(aiparam);
439449

@@ -2012,6 +2022,11 @@ static void sctp_process_ext_param(struct sctp_association *asoc,
20122022

20132023
for (i = 0; i < num_ext; i++) {
20142024
switch (param.ext->chunks[i]) {
2025+
case SCTP_CID_RECONF:
2026+
if (asoc->reconf_enable &&
2027+
!asoc->peer.reconf_capable)
2028+
asoc->peer.reconf_capable = 1;
2029+
break;
20152030
case SCTP_CID_FWD_TSN:
20162031
if (asoc->prsctp_enable && !asoc->peer.prsctp_capable)
20172032
asoc->peer.prsctp_capable = 1;

0 commit comments

Comments
 (0)