Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 276959
b: refs/heads/master
c: 2692ba6
h: refs/heads/master
i:
  276957: 0fe9fe5
  276955: 52066c3
  276951: 9c61334
  276943: 26237fd
  276927: 1e4ff69
v: v3
  • Loading branch information
Xi Wang authored and David S. Miller committed Dec 19, 2011
1 parent ca81e3a commit 1281ed2
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2ca6cf06d988fea21e812a86be79353352677c9c
refs/heads/master: 2692ba61a82203404abd7dd2a027bda962861f74
4 changes: 4 additions & 0 deletions trunk/include/net/sctp/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ extern struct sctp_globals {
* bits is an indicator of when to send and window update SACK.
*/
int rwnd_update_shift;

/* Threshold for autoclose timeout, in seconds. */
unsigned long max_autoclose;
} sctp_globals;

#define sctp_rto_initial (sctp_globals.rto_initial)
Expand Down Expand Up @@ -281,6 +284,7 @@ extern struct sctp_globals {
#define sctp_auth_enable (sctp_globals.auth_enable)
#define sctp_checksum_disable (sctp_globals.checksum_disable)
#define sctp_rwnd_upd_shift (sctp_globals.rwnd_update_shift)
#define sctp_max_autoclose (sctp_globals.max_autoclose)

/* SCTP Socket type: UDP or TCP style. */
typedef enum {
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/sctp/associola.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
asoc->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0;
asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay;
asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] =
(unsigned long)sp->autoclose * HZ;
min_t(unsigned long, sp->autoclose, sctp_max_autoclose) * HZ;

/* Initializes the timers */
for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i)
Expand Down
3 changes: 3 additions & 0 deletions trunk/net/sctp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,9 @@ SCTP_STATIC __init int sctp_init(void)
sctp_max_instreams = SCTP_DEFAULT_INSTREAMS;
sctp_max_outstreams = SCTP_DEFAULT_OUTSTREAMS;

/* Initialize maximum autoclose timeout. */
sctp_max_autoclose = INT_MAX / HZ;

/* Initialize handle used for association ids. */
idr_init(&sctp_assocs_id);

Expand Down
2 changes: 0 additions & 2 deletions trunk/net/sctp/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -2200,8 +2200,6 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval,
return -EINVAL;
if (copy_from_user(&sp->autoclose, optval, optlen))
return -EFAULT;
/* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */
sp->autoclose = min_t(long, sp->autoclose, MAX_SCHEDULE_TIMEOUT / HZ);

return 0;
}
Expand Down
13 changes: 13 additions & 0 deletions trunk/net/sctp/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ static int sack_timer_min = 1;
static int sack_timer_max = 500;
static int addr_scope_max = 3; /* check sctp_scope_policy_t in include/net/sctp/constants.h for max entries */
static int rwnd_scale_max = 16;
static unsigned long max_autoclose_min = 0;
static unsigned long max_autoclose_max =
(MAX_SCHEDULE_TIMEOUT / HZ > UINT_MAX)
? UINT_MAX : MAX_SCHEDULE_TIMEOUT / HZ;

extern long sysctl_sctp_mem[3];
extern int sysctl_sctp_rmem[3];
Expand Down Expand Up @@ -258,6 +262,15 @@ static ctl_table sctp_table[] = {
.extra1 = &one,
.extra2 = &rwnd_scale_max,
},
{
.procname = "max_autoclose",
.data = &sctp_max_autoclose,
.maxlen = sizeof(unsigned long),
.mode = 0644,
.proc_handler = &proc_doulongvec_minmax,
.extra1 = &max_autoclose_min,
.extra2 = &max_autoclose_max,
},

{ /* sentinel */ }
};
Expand Down

0 comments on commit 1281ed2

Please sign in to comment.