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