Commit 592e6a4d authored by Sridhar Samudrala's avatar Sridhar Samudrala

[SCTP] ADDIP: Add sysctl parameter to enable/disable addip.

parent 12517084
...@@ -576,6 +576,7 @@ enum { ...@@ -576,6 +576,7 @@ enum {
NET_SCTP_HB_INTERVAL = 10, NET_SCTP_HB_INTERVAL = 10,
NET_SCTP_PRESERVE_ENABLE = 11, NET_SCTP_PRESERVE_ENABLE = 11,
NET_SCTP_MAX_BURST = 12, NET_SCTP_MAX_BURST = 12,
NET_SCTP_ADDIP_ENABLE = 13,
}; };
/* CTL_PROC names: */ /* CTL_PROC names: */
......
...@@ -190,6 +190,9 @@ extern struct sctp_globals { ...@@ -190,6 +190,9 @@ extern struct sctp_globals {
*/ */
struct list_head local_addr_list; struct list_head local_addr_list;
spinlock_t local_addr_lock; spinlock_t local_addr_lock;
/* Flag to indicate if addip is enabled. */
int addip_enable;
} sctp_globals; } sctp_globals;
#define sctp_rto_initial (sctp_globals.rto_initial) #define sctp_rto_initial (sctp_globals.rto_initial)
...@@ -217,6 +220,7 @@ extern struct sctp_globals { ...@@ -217,6 +220,7 @@ extern struct sctp_globals {
#define sctp_port_hashtable (sctp_globals.port_hashtable) #define sctp_port_hashtable (sctp_globals.port_hashtable)
#define sctp_local_addr_list (sctp_globals.local_addr_list) #define sctp_local_addr_list (sctp_globals.local_addr_list)
#define sctp_local_addr_lock (sctp_globals.local_addr_lock) #define sctp_local_addr_lock (sctp_globals.local_addr_lock)
#define sctp_addip_enable (sctp_globals.addip_enable)
/* SCTP Socket type: UDP or TCP style. */ /* SCTP Socket type: UDP or TCP style. */
typedef enum { typedef enum {
......
...@@ -1115,6 +1115,9 @@ __init int sctp_init(void) ...@@ -1115,6 +1115,9 @@ __init int sctp_init(void)
"(established %d bind %d)\n", "(established %d bind %d)\n",
sctp_assoc_hashsize, sctp_port_hashsize); sctp_assoc_hashsize, sctp_port_hashsize);
/* Disable ADDIP by default. */
sctp_addip_enable = 0;
sctp_sysctl_register(); sctp_sysctl_register();
INIT_LIST_HEAD(&sctp_address_families); INIT_LIST_HEAD(&sctp_address_families);
......
...@@ -924,11 +924,13 @@ const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid, ...@@ -924,11 +924,13 @@ const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid,
if (cid >= 0 && cid <= SCTP_CID_BASE_MAX) if (cid >= 0 && cid <= SCTP_CID_BASE_MAX)
return &chunk_event_table[cid][state]; return &chunk_event_table[cid][state];
if (cid == SCTP_CID_ASCONF) if (sctp_addip_enable) {
return &addip_chunk_event_table[0][state]; if (cid == SCTP_CID_ASCONF)
return &addip_chunk_event_table[0][state];
if (cid == SCTP_CID_ASCONF_ACK) if (cid == SCTP_CID_ASCONF_ACK)
return &addip_chunk_event_table[1][state]; return &addip_chunk_event_table[1][state];
}
return &chunk_event_table_unknown[state]; return &chunk_event_table_unknown[state];
} }
...@@ -379,6 +379,9 @@ static int sctp_send_asconf_add_ip(struct sock *sk, ...@@ -379,6 +379,9 @@ static int sctp_send_asconf_add_ip(struct sock *sk,
int i; int i;
int retval = 0; int retval = 0;
if (!sctp_addip_enable)
return retval;
sp = sctp_sk(sk); sp = sctp_sk(sk);
ep = sp->ep; ep = sp->ep;
...@@ -564,6 +567,9 @@ static int sctp_send_asconf_del_ip(struct sock *sk, ...@@ -564,6 +567,9 @@ static int sctp_send_asconf_del_ip(struct sock *sk,
int i; int i;
int retval = 0; int retval = 0;
if (!sctp_addip_enable)
return retval;
sp = sctp_sk(sk); sp = sctp_sk(sk);
ep = sp->ep; ep = sp->ep;
......
...@@ -162,6 +162,14 @@ static ctl_table sctp_table[] = { ...@@ -162,6 +162,14 @@ static ctl_table sctp_table[] = {
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec .proc_handler = &proc_dointvec
}, },
{
.ctl_name = NET_SCTP_ADDIP_ENABLE,
.procname = "addip_enable",
.data = &sctp_addip_enable,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec
},
{ .ctl_name = 0 } { .ctl_name = 0 }
}; };
......
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