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