Commit b6d53725 authored by Jon Grimm's avatar Jon Grimm

[SCTP] More typedef & name cleanup.

parent 76cb7f3a
......@@ -84,7 +84,7 @@ typedef sctp_disposition_t (sctp_state_fn_t) (const struct sctp_endpoint *,
typedef void (sctp_timer_event_t) (unsigned long);
typedef struct {
sctp_state_fn_t *fn;
char *name;
const char *name;
} sctp_sm_table_entry_t;
/* A naming convention of "sctp_sf_xxx" applies to all the state functions
......@@ -176,9 +176,6 @@ sctp_state_fn_t sctp_sf_do_9_2_reshutack;
sctp_state_fn_t sctp_sf_do_9_2_reshut;
sctp_state_fn_t sctp_sf_do_9_2_shutack;
sctp_state_fn_t lucky;
sctp_state_fn_t other_stupid;
/* Prototypes for timeout event state functions. Not in use. */
sctp_state_fn_t sctp_do_4_2_reinit;
sctp_state_fn_t sctp_do_4_3_reecho;
......@@ -193,9 +190,9 @@ sctp_state_fn_t sctp_addip_do_asconf_ack;
/* Prototypes for utility support functions. */
__u8 sctp_get_chunk_type(struct sctp_chunk *chunk);
sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
sctp_state_t state,
sctp_subtype_t event_subtype);
const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t,
sctp_state_t,
sctp_subtype_t);
int sctp_chunk_iif(const struct sctp_chunk *);
struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *,
struct sctp_chunk *,
......@@ -284,20 +281,13 @@ int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
int gfp);
/* 2nd level prototypes */
int
sctp_cmd_interpreter(sctp_event_t event_type, sctp_subtype_t subtype,
sctp_state_t state,
struct sctp_endpoint *ep,
struct sctp_association *asoc,
void *event_arg,
sctp_disposition_t status,
sctp_cmd_seq_t *retval,
int gfp);
int sctp_cmd_interpreter(sctp_event_t, sctp_subtype_t, sctp_state_t,
struct sctp_endpoint *, struct sctp_association *,
void *event_arg, sctp_disposition_t,
sctp_cmd_seq_t *retval, int gfp);
int sctp_gen_sack(struct sctp_association *, int force, sctp_cmd_seq_t *);
void sctp_do_TSNdup(struct sctp_association *, struct sctp_chunk *, long gap);
void sctp_generate_t3_rtx_event(unsigned long peer);
void sctp_generate_heartbeat_event(unsigned long peer);
......@@ -311,7 +301,7 @@ struct sctp_packet *sctp_ootb_pkt_new(const struct sctp_association *,
const struct sctp_chunk *);
void sctp_ootb_pkt_free(struct sctp_packet *);
sctp_cookie_param_t *
struct sctp_cookie_param *
sctp_pack_cookie(const struct sctp_endpoint *, const struct sctp_association *,
const struct sctp_chunk *, int *cookie_len,
const __u8 *, int addrs_len);
......@@ -332,18 +322,18 @@ __u32 sctp_generate_tag(const struct sctp_endpoint *);
__u32 sctp_generate_tsn(const struct sctp_endpoint *);
/* 4th level prototypes */
void sctp_param2sockaddr(union sctp_addr *addr, sctp_addr_param_t *,
void sctp_param2sockaddr(union sctp_addr *addr, union sctp_addr_param *,
__u16 port, int iif);
int sctp_addr2sockaddr(const union sctp_params, union sctp_addr *);
int sockaddr2sctp_addr(const union sctp_addr *, sctp_addr_param_t *);
int sockaddr2sctp_addr(const union sctp_addr *, union sctp_addr_param *);
/* Extern declarations for major data structures. */
sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t, sctp_state_t);
extern sctp_sm_table_entry_t
const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t, sctp_state_t);
extern const sctp_sm_table_entry_t
primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES];
extern sctp_sm_table_entry_t
extern const sctp_sm_table_entry_t
other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES];
extern sctp_sm_table_entry_t
extern const sctp_sm_table_entry_t
timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES];
extern sctp_timer_event_t *sctp_timer_events[SCTP_NUM_TIMEOUT_TYPES];
......
......@@ -185,7 +185,7 @@ extern struct sctp_globals {
* We actively maintain this complete list of interfaces on
* the system by catching routing events.
*
* It is a list of struct sockaddr_storage_list.
* It is a list of sctp_sockaddr_entry.
*/
struct list_head local_addr_list;
spinlock_t local_addr_lock;
......@@ -409,10 +409,10 @@ struct sctp_signed_cookie {
* params for the maximum size and pass such structures around
* internally.
*/
typedef union {
union sctp_addr_param {
struct sctp_ipv4addr_param v4;
struct sctp_ipv6addr_param v6;
} sctp_addr_param_t;
};
/* A convenience type to allow walking through the various
* parameters and avoid casting all over the place.
......@@ -426,7 +426,7 @@ union sctp_params {
struct sctp_supported_addrs_param *sat;
struct sctp_ipv4addr_param *v4;
struct sctp_ipv6addr_param *v6;
struct sctp_addr_param *addr;
union sctp_addr_param *addr;
};
/* RFC 2960. Section 3.3.5 Heartbeat.
......@@ -633,7 +633,7 @@ const union sctp_addr *sctp_source(const struct sctp_chunk *chunk);
* sin_port -- ordinary port number
* sin_addr -- cast to either (struct in_addr) or (struct in6_addr)
*/
struct sockaddr_storage_list {
struct sctp_sockaddr_entry {
struct list_head list;
union sctp_addr a;
};
......@@ -1401,9 +1401,6 @@ struct sctp_association {
*/
sctp_state_t state;
/* When did we enter this state? */
int state_timestamp;
/* The cookie life I award for any cookie. */
struct timeval cookie_life;
......
......@@ -126,7 +126,6 @@ struct sctp_association *sctp_association_init(struct sctp_association *asoc,
asoc->base.addr_lock = RW_LOCK_UNLOCKED;
asoc->state = SCTP_STATE_CLOSED;
asoc->state_timestamp = jiffies;
/* Set these values from the socket values, a conversion between
* millsecons to seconds/microseconds must also be done.
......
......@@ -65,7 +65,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
const struct sctp_bind_addr *src,
sctp_scope_t scope, int gfp, int flags)
{
struct sockaddr_storage_list *addr;
struct sctp_sockaddr_entry *addr;
struct list_head *pos;
int error = 0;
......@@ -74,7 +74,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
/* Extract the addresses which are relevant for this scope. */
list_for_each(pos, &src->address_list) {
addr = list_entry(pos, struct sockaddr_storage_list, list);
addr = list_entry(pos, struct sctp_sockaddr_entry, list);
error = sctp_copy_one_addr(dest, &addr->a, scope,
gfp, flags);
if (error < 0)
......@@ -87,7 +87,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
*/
if (list_empty(&dest->address_list) && (SCTP_SCOPE_GLOBAL == scope)) {
list_for_each(pos, &src->address_list) {
addr = list_entry(pos, struct sockaddr_storage_list,
addr = list_entry(pos, struct sctp_sockaddr_entry,
list);
error = sctp_copy_one_addr(dest, &addr->a,
SCTP_SCOPE_LINK, gfp,
......@@ -135,12 +135,12 @@ void sctp_bind_addr_init(struct sctp_bind_addr *bp, __u16 port)
/* Dispose of the address list. */
static void sctp_bind_addr_clean(struct sctp_bind_addr *bp)
{
struct sockaddr_storage_list *addr;
struct sctp_sockaddr_entry *addr;
struct list_head *pos, *temp;
/* Empty the bind address list. */
list_for_each_safe(pos, temp, &bp->address_list) {
addr = list_entry(pos, struct sockaddr_storage_list, list);
addr = list_entry(pos, struct sctp_sockaddr_entry, list);
list_del(pos);
kfree(addr);
SCTP_DBG_OBJCNT_DEC(addr);
......@@ -163,10 +163,10 @@ void sctp_bind_addr_free(struct sctp_bind_addr *bp)
int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new,
int gfp)
{
struct sockaddr_storage_list *addr;
struct sctp_sockaddr_entry *addr;
/* Add the address to the bind address list. */
addr = t_new(struct sockaddr_storage_list, gfp);
addr = t_new(struct sctp_sockaddr_entry, gfp);
if (!addr)
return -ENOMEM;
......@@ -191,10 +191,10 @@ int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new,
int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr)
{
struct list_head *pos, *temp;
struct sockaddr_storage_list *addr;
struct sctp_sockaddr_entry *addr;
list_for_each_safe(pos, temp, &bp->address_list) {
addr = list_entry(pos, struct sockaddr_storage_list, list);
addr = list_entry(pos, struct sctp_sockaddr_entry, list);
if (sctp_cmp_addr_exact(&addr->a, del_addr)) {
/* Found the exact match. */
list_del(pos);
......@@ -219,22 +219,22 @@ union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp,
union sctp_params addrparms;
union sctp_params retval;
int addrparms_len;
sctp_addr_param_t rawaddr;
union sctp_addr_param rawaddr;
int len;
struct sockaddr_storage_list *addr;
struct sctp_sockaddr_entry *addr;
struct list_head *pos;
addrparms_len = 0;
len = 0;
/* Allocate enough memory at once. */
list_for_each(pos, &bp->address_list) {
len += sizeof(sctp_addr_param_t);
len += sizeof(union sctp_addr_param);
}
/* Don't even bother embedding an address if there
* is only one.
*/
if (len == sizeof(sctp_addr_param_t)) {
if (len == sizeof(union sctp_addr_param)) {
retval.v = NULL;
goto end_raw;
}
......@@ -246,7 +246,7 @@ union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp,
addrparms = retval;
list_for_each(pos, &bp->address_list) {
addr = list_entry(pos, struct sockaddr_storage_list, list);
addr = list_entry(pos, struct sctp_sockaddr_entry, list);
len = sockaddr2sctp_addr(&addr->a, &rawaddr);
memcpy(addrparms.v, &rawaddr, len);
addrparms.v += len;
......@@ -265,16 +265,16 @@ union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp,
int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list,
int addrs_len, __u16 port, int gfp)
{
sctp_addr_param_t *rawaddr;
sctp_paramhdr_t *param;
union sctp_addr_param *rawaddr;
struct sctp_paramhdr *param;
union sctp_addr addr;
int retval = 0;
int len;
/* Convert the raw address to standard address format */
while (addrs_len) {
param = (sctp_paramhdr_t *)raw_addr_list;
rawaddr = (sctp_addr_param_t *)raw_addr_list;
param = (struct sctp_paramhdr *)raw_addr_list;
rawaddr = (union sctp_addr_param *)raw_addr_list;
switch (param->type) {
case SCTP_PARAM_IPV4_ADDRESS:
......@@ -312,11 +312,11 @@ int sctp_bind_addr_match(struct sctp_bind_addr *bp,
const union sctp_addr *addr,
struct sctp_opt *opt)
{
struct sockaddr_storage_list *laddr;
struct sctp_sockaddr_entry *laddr;
struct list_head *pos;
list_for_each(pos, &bp->address_list) {
laddr = list_entry(pos, struct sockaddr_storage_list, list);
laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
if (opt->pf->cmp_addr(&laddr->a, addr, opt))
return 1;
}
......
......@@ -313,13 +313,13 @@ int sctp_endpoint_is_peeled_off(struct sctp_endpoint *ep,
const union sctp_addr *paddr)
{
struct list_head *pos;
struct sockaddr_storage_list *addr;
struct sctp_sockaddr_entry *addr;
struct sctp_bind_addr *bp;
sctp_read_lock(&ep->base.addr_lock);
bp = &ep->base.bind_addr;
list_for_each(pos, &bp->address_list) {
addr = list_entry(pos, struct sockaddr_storage_list, list);
addr = list_entry(pos, struct sctp_sockaddr_entry, list);
if (sctp_has_association(&addr->a, paddr)) {
sctp_read_unlock(&ep->base.addr_lock);
return 1;
......
......@@ -248,7 +248,7 @@ void sctp_v6_get_saddr(struct sctp_association *asoc, struct dst_entry *dst,
{
struct sctp_bind_addr *bp;
rwlock_t *addr_lock;
struct sockaddr_storage_list *laddr;
struct sctp_sockaddr_entry *laddr;
struct list_head *pos;
sctp_scope_t scope;
union sctp_addr *baddr = NULL;
......@@ -277,7 +277,7 @@ void sctp_v6_get_saddr(struct sctp_association *asoc, struct dst_entry *dst,
*/
sctp_read_lock(addr_lock);
list_for_each(pos, &bp->address_list) {
laddr = list_entry(pos, struct sockaddr_storage_list, list);
laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
if ((laddr->a.sa.sa_family == AF_INET6) &&
(scope <= sctp_scope(&laddr->a))) {
bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a);
......@@ -309,7 +309,7 @@ static void sctp_v6_copy_addrlist(struct list_head *addrlist,
{
struct inet6_dev *in6_dev;
struct inet6_ifaddr *ifp;
struct sockaddr_storage_list *addr;
struct sctp_sockaddr_entry *addr;
read_lock(&addrconf_lock);
if ((in6_dev = __in6_dev_get(dev)) == NULL) {
......@@ -320,7 +320,7 @@ static void sctp_v6_copy_addrlist(struct list_head *addrlist,
read_lock(&in6_dev->lock);
for (ifp = in6_dev->addr_list; ifp; ifp = ifp->if_next) {
/* Add the address to the local list. */
addr = t_new(struct sockaddr_storage_list, GFP_ATOMIC);
addr = t_new(struct sctp_sockaddr_entry, GFP_ATOMIC);
if (addr) {
addr->a.v6.sin6_family = AF_INET6;
addr->a.v6.sin6_port = 0;
......
......@@ -133,12 +133,12 @@ void sctp_snmp_proc_exit(void)
static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_common *epb)
{
struct list_head *pos;
struct sockaddr_storage_list *laddr;
struct sctp_sockaddr_entry *laddr;
union sctp_addr *addr;
struct sctp_af *af;
list_for_each(pos, &epb->bind_addr.address_list) {
laddr = list_entry(pos, struct sockaddr_storage_list, list);
laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
addr = (union sctp_addr *)&laddr->a;
af = sctp_get_af_specific(addr->sa.sa_family);
af->seq_dump_addr(seq, addr);
......
......@@ -143,7 +143,7 @@ static void sctp_v4_copy_addrlist(struct list_head *addrlist,
{
struct in_device *in_dev;
struct in_ifaddr *ifa;
struct sockaddr_storage_list *addr;
struct sctp_sockaddr_entry *addr;
read_lock(&inetdev_lock);
if ((in_dev = __in_dev_get(dev)) == NULL) {
......@@ -154,7 +154,7 @@ static void sctp_v4_copy_addrlist(struct list_head *addrlist,
read_lock(&in_dev->lock);
for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
/* Add the address to the local list. */
addr = t_new(struct sockaddr_storage_list, GFP_ATOMIC);
addr = t_new(struct sctp_sockaddr_entry, GFP_ATOMIC);
if (addr) {
addr->a.v4.sin_family = AF_INET;
addr->a.v4.sin_port = 0;
......@@ -198,11 +198,11 @@ static void sctp_get_local_addr_list(void)
/* Free the existing local addresses. */
static void __sctp_free_local_addr_list(void)
{
struct sockaddr_storage_list *addr;
struct sctp_sockaddr_entry *addr;
struct list_head *pos, *temp;
list_for_each_safe(pos, temp, &sctp_local_addr_list) {
addr = list_entry(pos, struct sockaddr_storage_list, list);
addr = list_entry(pos, struct sctp_sockaddr_entry, list);
list_del(pos);
kfree(addr);
}
......@@ -222,14 +222,14 @@ static void sctp_free_local_addr_list(void)
int sctp_copy_local_addr_list(struct sctp_bind_addr *bp, sctp_scope_t scope,
int gfp, int copy_flags)
{
struct sockaddr_storage_list *addr;
struct sctp_sockaddr_entry *addr;
int error = 0;
struct list_head *pos;
unsigned long flags;
sctp_spin_lock_irqsave(&sctp_local_addr_lock, flags);
list_for_each(pos, &sctp_local_addr_list) {
addr = list_entry(pos, struct sockaddr_storage_list, list);
addr = list_entry(pos, struct sctp_sockaddr_entry, list);
if (sctp_in_scope(&addr->a, scope)) {
/* Now that the address is in scope, check to see if
* the address type is really supported by the local
......@@ -412,7 +412,7 @@ struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
struct flowi fl;
struct sctp_bind_addr *bp;
rwlock_t *addr_lock;
struct sockaddr_storage_list *laddr;
struct sctp_sockaddr_entry *laddr;
struct list_head *pos;
struct dst_entry *dst = NULL;
union sctp_addr dst_saddr;
......@@ -447,7 +447,7 @@ struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
*/
sctp_read_lock(addr_lock);
list_for_each(pos, &bp->address_list) {
laddr = list_entry(pos, struct sockaddr_storage_list,
laddr = list_entry(pos, struct sctp_sockaddr_entry,
list);
sctp_v4_dst_saddr(&dst_saddr, dst, bp->port);
if (sctp_v4_cmp_addr(&dst_saddr, &laddr->a))
......@@ -467,7 +467,7 @@ struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
*/
sctp_read_lock(addr_lock);
list_for_each(pos, &bp->address_list) {
laddr = list_entry(pos, struct sockaddr_storage_list, list);
laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
if (AF_INET == laddr->a.sa.sa_family) {
fl.fl4_src = laddr->a.v4.sin_addr.s_addr;
......
......@@ -2022,7 +2022,7 @@ __u32 sctp_generate_tsn(const struct sctp_endpoint *ep)
********************************************************************/
/* Convert from an SCTP IP parameter to a union sctp_addr. */
void sctp_param2sockaddr(union sctp_addr *addr, sctp_addr_param_t *param,
void sctp_param2sockaddr(union sctp_addr *addr, union sctp_addr_param *param,
__u16 port, int iif)
{
switch(param->v4.param_hdr.type) {
......@@ -2073,7 +2073,7 @@ int sctp_addr2sockaddr(union sctp_params p, union sctp_addr *sa)
/* Convert a sockaddr_in to an IP address in an SCTP param.
* Returns len if a valid conversion was possible.
*/
int sockaddr2sctp_addr(const union sctp_addr *sa, sctp_addr_param_t *p)
int sockaddr2sctp_addr(const union sctp_addr *sa, union sctp_addr_param *p)
{
int len = 0;
......
......@@ -608,13 +608,13 @@ static void sctp_cmd_setup_t2(sctp_cmd_seq_t *cmds,
}
/* Helper function to change the state of an association. */
static void sctp_cmd_new_state(sctp_cmd_seq_t *cmds, struct sctp_association *asoc,
static void sctp_cmd_new_state(sctp_cmd_seq_t *cmds,
struct sctp_association *asoc,
sctp_state_t state)
{
struct sock *sk = asoc->base.sk;
asoc->state = state;
asoc->state_timestamp = jiffies;
if (sctp_style(sk, TCP)) {
/* Change the sk->sk_state of a TCP-style socket that has
......@@ -702,7 +702,7 @@ int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype,
int gfp)
{
sctp_cmd_seq_t commands;
sctp_sm_table_entry_t *state_fn;
const sctp_sm_table_entry_t *state_fn;
sctp_disposition_t status;
int error = 0;
typedef const char *(printfn_t)(sctp_subtype_t);
......
......@@ -925,16 +925,16 @@ static int sctp_sf_send_restart_abort(union sctp_addr *ssa,
{
int len;
struct sctp_packet *pkt;
sctp_addr_param_t *addrparm;
sctp_errhdr_t *errhdr;
union sctp_addr_param *addrparm;
struct sctp_errhdr *errhdr;
struct sctp_endpoint *ep;
char buffer[sizeof(sctp_errhdr_t) + sizeof(sctp_addr_param_t)];
char buffer[sizeof(struct sctp_errhdr)+sizeof(union sctp_addr_param)];
/* Build the error on the stack. We are way to malloc crazy
* throughout the code today.
*/
errhdr = (sctp_errhdr_t *)buffer;
addrparm = (sctp_addr_param_t *)errhdr->variable;
errhdr = (struct sctp_errhdr *)buffer;
addrparm = (union sctp_addr_param *)errhdr->variable;
/* Copy into a parm format. */
len = sockaddr2sctp_addr(ssa, addrparm);
......@@ -3204,82 +3204,6 @@ sctp_disposition_t sctp_sf_pdiscard(const struct sctp_endpoint *ep,
return SCTP_DISPOSITION_CONSUME;
}
#if 0
/*
* We did something stupid but got lucky. Namely, we sent a HEARTBEAT
* before the association was all the way up and we did NOT get an
* ABORT.
*
* Log the fact and then process normally.
*
* Section: Not specified
* Verification Tag: 8.5 Verification Tag [Normal verification]
* Inputs
* (endpoint, asoc, chunk)
*
* Outputs
* (asoc, reply_msg, msg_up, timers, counters)
*
* The return value is the disposition of the chunk.
*/
sctp_disposition_t lucky(const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands)
{
struct sctp_chunk *chunk = arg;
/* 8.5 When receiving an SCTP packet, the endpoint MUST ensure
* that the value in the Verification Tag field of the
* received SCTP packet matches its own Tag. ...
*/
if (chunk->sctp_hdr->vtag != asoc->c.my_vtag)
return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
return SCTP_DISPOSITION_CONSUME;
nomem:
return SCTP_DISPOSITION_NOMEM;
}
#endif /* 0 */
#if 0
/*
* The other end is doing something very stupid. We'll ignore them
* after logging their idiocy. :-)
*
* Section: Not specified
* Verification Tag: 8.5 Verification Tag [Normal verification]
* Inputs
* (endpoint, asoc, chunk)
*
* Outputs
* (asoc, reply_msg, msg_up, timers, counters)
*
* The return value is the disposition of the chunk.
*/
sctp_disposition_t other_stupid(const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands)
{
struct sctp_chunk *chunk = arg;
/* 8.5 When receiving an SCTP packet, the endpoint MUST ensure
* that the value in the Verification Tag field of the
* received SCTP packet matches its own Tag. ...
*/
if (chunk->sctp_hdr->vtag != asoc->c.my_vtag)
return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
return SCTP_DISPOSITION_CONSUME;
nomem:
return SCTP_DISPOSITION_NOMEM;
}
#endif /* 0 */
/*
* The other end is violating protocol.
......
......@@ -49,7 +49,7 @@
#include <net/sctp/sctp.h>
#include <net/sctp/sm.h>
static sctp_sm_table_entry_t bug = {
static const sctp_sm_table_entry_t bug = {
.fn = sctp_sf_bug,
.name = "sctp_sf_bug"
};
......@@ -64,7 +64,7 @@ static sctp_sm_table_entry_t bug = {
} \
return &_table[event_subtype._type][(int)state];
sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
sctp_state_t state,
sctp_subtype_t event_subtype)
{
......@@ -418,7 +418,7 @@ sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
*
* For base protocol (RFC 2960).
*/
sctp_sm_table_entry_t chunk_event_table[SCTP_NUM_BASE_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
const sctp_sm_table_entry_t chunk_event_table[SCTP_NUM_BASE_CHUNK_TYPES][SCTP_STATE_NUM_STATES] = {
TYPE_SCTP_DATA,
TYPE_SCTP_INIT,
TYPE_SCTP_INIT_ACK,
......@@ -437,7 +437,7 @@ sctp_sm_table_entry_t chunk_event_table[SCTP_NUM_BASE_CHUNK_TYPES][SCTP_STATE_NU
}; /* state_fn_t chunk_event_table[][] */
static sctp_sm_table_entry_t
static const sctp_sm_table_entry_t
chunk_event_table_unknown[SCTP_STATE_NUM_STATES] = {
/* SCTP_STATE_EMPTY */
{.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"},
......@@ -586,7 +586,7 @@ chunk_event_table_unknown[SCTP_STATE_NUM_STATES] = {
/* The primary index for this table is the primitive type.
* The secondary index for this table is the state.
*/
sctp_sm_table_entry_t primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES] = {
const sctp_sm_table_entry_t primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE_NUM_STATES] = {
TYPE_SCTP_PRIMITIVE_ASSOCIATE,
TYPE_SCTP_PRIMITIVE_SHUTDOWN,
TYPE_SCTP_PRIMITIVE_ABORT,
......@@ -617,7 +617,7 @@ sctp_sm_table_entry_t primitive_event_table[SCTP_NUM_PRIMITIVE_TYPES][SCTP_STATE
{.fn = sctp_sf_ignore_other, .name = "sctp_sf_ignore_other"}, \
}
sctp_sm_table_entry_t other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES] = {
const sctp_sm_table_entry_t other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES] = {
TYPE_SCTP_OTHER_NO_PENDING_TSN,
};
......@@ -811,7 +811,7 @@ sctp_sm_table_entry_t other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STA
{.fn = sctp_sf_timer_ignore, .name = "sctp_sf_timer_ignore"}, \
}
sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES] = {
const sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES] = {
TYPE_SCTP_EVENT_TIMEOUT_NONE,
TYPE_SCTP_EVENT_TIMEOUT_T1_COOKIE,
TYPE_SCTP_EVENT_TIMEOUT_T1_INIT,
......@@ -823,7 +823,8 @@ sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM
TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE,
};
sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid, sctp_state_t state)
const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid,
sctp_state_t state)
{
if (state > SCTP_STATE_MAX)
return &bug;
......
......@@ -2724,7 +2724,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
struct list_head *pos;
int cnt = 0;
struct sctp_getaddrs getaddrs;
struct sockaddr_storage_list *from;
struct sctp_sockaddr_entry *from;
struct sockaddr_storage *to;
if (len != sizeof(struct sctp_getaddrs))
......@@ -2752,7 +2752,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
to = getaddrs.addrs;
list_for_each(pos, &bp->address_list) {
from = list_entry(pos,
struct sockaddr_storage_list,
struct sctp_sockaddr_entry,
list);
if (copy_to_user(to, &from->a, sizeof(from->a)))
return -EFAULT;
......
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