Commit 922dbc5b authored by Xin Long's avatar Xin Long Committed by David S. Miller

sctp: remove the typedef sctp_chunkhdr_t

This patch is to remove the typedef sctp_chunkhdr_t, and replace
with struct sctp_chunkhdr in the places where it's using this
typedef.

It is also to fix some indents and use sizeof(variable) instead
of sizeof(type)., especially in sctp_new.
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ae146d9b
...@@ -70,11 +70,11 @@ static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb) ...@@ -70,11 +70,11 @@ static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
} }
/* Section 3.2. Chunk Field Descriptions. */ /* Section 3.2. Chunk Field Descriptions. */
typedef struct sctp_chunkhdr { struct sctp_chunkhdr {
__u8 type; __u8 type;
__u8 flags; __u8 flags;
__be16 length; __be16 length;
} sctp_chunkhdr_t; };
/* Section 3.2. Chunk Type Values. /* Section 3.2. Chunk Type Values.
...@@ -236,7 +236,7 @@ typedef struct sctp_datahdr { ...@@ -236,7 +236,7 @@ typedef struct sctp_datahdr {
} sctp_datahdr_t; } sctp_datahdr_t;
typedef struct sctp_data_chunk { typedef struct sctp_data_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_datahdr_t data_hdr; sctp_datahdr_t data_hdr;
} sctp_data_chunk_t; } sctp_data_chunk_t;
...@@ -267,7 +267,7 @@ typedef struct sctp_inithdr { ...@@ -267,7 +267,7 @@ typedef struct sctp_inithdr {
} sctp_inithdr_t; } sctp_inithdr_t;
typedef struct sctp_init_chunk { typedef struct sctp_init_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_inithdr_t init_hdr; sctp_inithdr_t init_hdr;
} sctp_init_chunk_t; } sctp_init_chunk_t;
...@@ -386,7 +386,7 @@ typedef struct sctp_sackhdr { ...@@ -386,7 +386,7 @@ typedef struct sctp_sackhdr {
} sctp_sackhdr_t; } sctp_sackhdr_t;
typedef struct sctp_sack_chunk { typedef struct sctp_sack_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_sackhdr_t sack_hdr; sctp_sackhdr_t sack_hdr;
} sctp_sack_chunk_t; } sctp_sack_chunk_t;
...@@ -403,7 +403,7 @@ typedef struct sctp_heartbeathdr { ...@@ -403,7 +403,7 @@ typedef struct sctp_heartbeathdr {
} sctp_heartbeathdr_t; } sctp_heartbeathdr_t;
typedef struct sctp_heartbeat_chunk { typedef struct sctp_heartbeat_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_heartbeathdr_t hb_hdr; sctp_heartbeathdr_t hb_hdr;
} sctp_heartbeat_chunk_t; } sctp_heartbeat_chunk_t;
...@@ -413,7 +413,7 @@ typedef struct sctp_heartbeat_chunk { ...@@ -413,7 +413,7 @@ typedef struct sctp_heartbeat_chunk {
* chunk descriptor. * chunk descriptor.
*/ */
typedef struct sctp_abort_chunk { typedef struct sctp_abort_chunk {
sctp_chunkhdr_t uh; struct sctp_chunkhdr uh;
} sctp_abort_chunk_t; } sctp_abort_chunk_t;
...@@ -425,7 +425,7 @@ typedef struct sctp_shutdownhdr { ...@@ -425,7 +425,7 @@ typedef struct sctp_shutdownhdr {
} sctp_shutdownhdr_t; } sctp_shutdownhdr_t;
struct sctp_shutdown_chunk_t { struct sctp_shutdown_chunk_t {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_shutdownhdr_t shutdown_hdr; sctp_shutdownhdr_t shutdown_hdr;
}; };
...@@ -438,7 +438,7 @@ typedef struct sctp_errhdr { ...@@ -438,7 +438,7 @@ typedef struct sctp_errhdr {
} sctp_errhdr_t; } sctp_errhdr_t;
typedef struct sctp_operr_chunk { typedef struct sctp_operr_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_errhdr_t err_hdr; sctp_errhdr_t err_hdr;
} sctp_operr_chunk_t; } sctp_operr_chunk_t;
...@@ -528,7 +528,7 @@ typedef struct sctp_ecnehdr { ...@@ -528,7 +528,7 @@ typedef struct sctp_ecnehdr {
} sctp_ecnehdr_t; } sctp_ecnehdr_t;
typedef struct sctp_ecne_chunk { typedef struct sctp_ecne_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_ecnehdr_t ence_hdr; sctp_ecnehdr_t ence_hdr;
} sctp_ecne_chunk_t; } sctp_ecne_chunk_t;
...@@ -540,7 +540,7 @@ typedef struct sctp_cwrhdr { ...@@ -540,7 +540,7 @@ typedef struct sctp_cwrhdr {
} sctp_cwrhdr_t; } sctp_cwrhdr_t;
typedef struct sctp_cwr_chunk { typedef struct sctp_cwr_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_cwrhdr_t cwr_hdr; sctp_cwrhdr_t cwr_hdr;
} sctp_cwr_chunk_t; } sctp_cwr_chunk_t;
...@@ -649,7 +649,7 @@ typedef struct sctp_addiphdr { ...@@ -649,7 +649,7 @@ typedef struct sctp_addiphdr {
} sctp_addiphdr_t; } sctp_addiphdr_t;
typedef struct sctp_addip_chunk { typedef struct sctp_addip_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_addiphdr_t addip_hdr; sctp_addiphdr_t addip_hdr;
} sctp_addip_chunk_t; } sctp_addip_chunk_t;
...@@ -709,7 +709,7 @@ typedef struct sctp_authhdr { ...@@ -709,7 +709,7 @@ typedef struct sctp_authhdr {
} sctp_authhdr_t; } sctp_authhdr_t;
typedef struct sctp_auth_chunk { typedef struct sctp_auth_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
sctp_authhdr_t auth_hdr; sctp_authhdr_t auth_hdr;
} sctp_auth_chunk_t; } sctp_auth_chunk_t;
...@@ -719,7 +719,7 @@ struct sctp_infox { ...@@ -719,7 +719,7 @@ struct sctp_infox {
}; };
struct sctp_reconf_chunk { struct sctp_reconf_chunk {
sctp_chunkhdr_t chunk_hdr; struct sctp_chunkhdr chunk_hdr;
__u8 params[0]; __u8 params[0];
}; };
......
...@@ -478,7 +478,7 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length)) ...@@ -478,7 +478,7 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length))
#define _sctp_walk_errors(err, chunk_hdr, end)\ #define _sctp_walk_errors(err, chunk_hdr, end)\
for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \
sizeof(sctp_chunkhdr_t));\ sizeof(struct sctp_chunkhdr));\
(void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\
ntohs(err->length) >= sizeof(sctp_errhdr_t); \ ntohs(err->length) >= sizeof(sctp_errhdr_t); \
err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length)))) err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length))))
......
...@@ -1037,7 +1037,7 @@ static int ip_vs_out_icmp_v6(struct netns_ipvs *ipvs, struct sk_buff *skb, ...@@ -1037,7 +1037,7 @@ static int ip_vs_out_icmp_v6(struct netns_ipvs *ipvs, struct sk_buff *skb,
*/ */
static inline int is_sctp_abort(const struct sk_buff *skb, int nh_len) static inline int is_sctp_abort(const struct sk_buff *skb, int nh_len)
{ {
sctp_chunkhdr_t *sch, schunk; struct sctp_chunkhdr *sch, schunk;
sch = skb_header_pointer(skb, nh_len + sizeof(struct sctphdr), sch = skb_header_pointer(skb, nh_len + sizeof(struct sctphdr),
sizeof(schunk), &schunk); sizeof(schunk), &schunk);
if (sch == NULL) if (sch == NULL)
...@@ -1070,7 +1070,7 @@ static inline bool is_new_conn(const struct sk_buff *skb, ...@@ -1070,7 +1070,7 @@ static inline bool is_new_conn(const struct sk_buff *skb,
return th->syn; return th->syn;
} }
case IPPROTO_SCTP: { case IPPROTO_SCTP: {
sctp_chunkhdr_t *sch, schunk; struct sctp_chunkhdr *sch, schunk;
sch = skb_header_pointer(skb, iph->len + sizeof(struct sctphdr), sch = skb_header_pointer(skb, iph->len + sizeof(struct sctphdr),
sizeof(schunk), &schunk); sizeof(schunk), &schunk);
......
...@@ -15,7 +15,7 @@ sctp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb, ...@@ -15,7 +15,7 @@ sctp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb,
struct ip_vs_iphdr *iph) struct ip_vs_iphdr *iph)
{ {
struct ip_vs_service *svc; struct ip_vs_service *svc;
sctp_chunkhdr_t _schunkh, *sch; struct sctp_chunkhdr _schunkh, *sch;
struct sctphdr *sh, _sctph; struct sctphdr *sh, _sctph;
__be16 _ports[2], *ports = NULL; __be16 _ports[2], *ports = NULL;
...@@ -377,7 +377,7 @@ static inline void ...@@ -377,7 +377,7 @@ static inline void
set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp, set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
int direction, const struct sk_buff *skb) int direction, const struct sk_buff *skb)
{ {
sctp_chunkhdr_t _sctpch, *sch; struct sctp_chunkhdr _sctpch, *sch;
unsigned char chunk_type; unsigned char chunk_type;
int event, next_state; int event, next_state;
int ihl, cofs; int ihl, cofs;
...@@ -409,7 +409,7 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp, ...@@ -409,7 +409,7 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
(sch->type == SCTP_CID_COOKIE_ACK)) { (sch->type == SCTP_CID_COOKIE_ACK)) {
int clen = ntohs(sch->length); int clen = ntohs(sch->length);
if (clen >= sizeof(sctp_chunkhdr_t)) { if (clen >= sizeof(_sctpch)) {
sch = skb_header_pointer(skb, cofs + ALIGN(clen, 4), sch = skb_header_pointer(skb, cofs + ALIGN(clen, 4),
sizeof(_sctpch), &_sctpch); sizeof(_sctpch), &_sctpch);
if (sch && sch->type == SCTP_CID_ABORT) if (sch && sch->type == SCTP_CID_ABORT)
......
...@@ -202,7 +202,7 @@ static int do_basic_checks(struct nf_conn *ct, ...@@ -202,7 +202,7 @@ static int do_basic_checks(struct nf_conn *ct,
unsigned long *map) unsigned long *map)
{ {
u_int32_t offset, count; u_int32_t offset, count;
sctp_chunkhdr_t _sch, *sch; struct sctp_chunkhdr _sch, *sch;
int flag; int flag;
flag = 0; flag = 0;
...@@ -397,7 +397,7 @@ static int sctp_packet(struct nf_conn *ct, ...@@ -397,7 +397,7 @@ static int sctp_packet(struct nf_conn *ct,
sch->type == SCTP_CID_INIT_ACK) { sch->type == SCTP_CID_INIT_ACK) {
sctp_inithdr_t _inithdr, *ih; sctp_inithdr_t _inithdr, *ih;
ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t), ih = skb_header_pointer(skb, offset + sizeof(_sch),
sizeof(_inithdr), &_inithdr); sizeof(_inithdr), &_inithdr);
if (ih == NULL) if (ih == NULL)
goto out_unlock; goto out_unlock;
...@@ -471,23 +471,20 @@ static bool sctp_new(struct nf_conn *ct, const struct sk_buff *skb, ...@@ -471,23 +471,20 @@ static bool sctp_new(struct nf_conn *ct, const struct sk_buff *skb,
/* Copy the vtag into the state info */ /* Copy the vtag into the state info */
if (sch->type == SCTP_CID_INIT) { if (sch->type == SCTP_CID_INIT) {
if (sh->vtag == 0) {
sctp_inithdr_t _inithdr, *ih; sctp_inithdr_t _inithdr, *ih;
/* Sec 8.5.1 (A) */
if (sh->vtag)
return false;
ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t), ih = skb_header_pointer(skb, offset + sizeof(_sch),
sizeof(_inithdr), &_inithdr); sizeof(_inithdr), &_inithdr);
if (ih == NULL) if (!ih)
return false; return false;
pr_debug("Setting vtag %x for new conn\n", pr_debug("Setting vtag %x for new conn\n",
ih->init_tag); ih->init_tag);
ct->proto.sctp.vtag[IP_CT_DIR_REPLY] = ct->proto.sctp.vtag[IP_CT_DIR_REPLY] = ih->init_tag;
ih->init_tag;
} else {
/* Sec 8.5.1 (A) */
return false;
}
} else if (sch->type == SCTP_CID_HEARTBEAT) { } else if (sch->type == SCTP_CID_HEARTBEAT) {
pr_debug("Setting vtag %x for secondary conntrack\n", pr_debug("Setting vtag %x for secondary conntrack\n",
sh->vtag); sh->vtag);
......
...@@ -42,8 +42,8 @@ match_packet(const struct sk_buff *skb, ...@@ -42,8 +42,8 @@ match_packet(const struct sk_buff *skb,
bool *hotdrop) bool *hotdrop)
{ {
u_int32_t chunkmapcopy[256 / sizeof (u_int32_t)]; u_int32_t chunkmapcopy[256 / sizeof (u_int32_t)];
const sctp_chunkhdr_t *sch; const struct sctp_chunkhdr *sch;
sctp_chunkhdr_t _sch; struct sctp_chunkhdr _sch;
int chunk_match_type = info->chunk_match_type; int chunk_match_type = info->chunk_match_type;
const struct xt_sctp_flag_info *flag_info = info->flag_info; const struct xt_sctp_flag_info *flag_info = info->flag_info;
int flag_count = info->flag_count; int flag_count = info->flag_count;
......
...@@ -663,19 +663,19 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info) ...@@ -663,19 +663,19 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
*/ */
static int sctp_rcv_ootb(struct sk_buff *skb) static int sctp_rcv_ootb(struct sk_buff *skb)
{ {
sctp_chunkhdr_t *ch, _ch; struct sctp_chunkhdr *ch, _ch;
int ch_end, offset = 0; int ch_end, offset = 0;
/* Scan through all the chunks in the packet. */ /* Scan through all the chunks in the packet. */
do { do {
/* Make sure we have at least the header there */ /* Make sure we have at least the header there */
if (offset + sizeof(sctp_chunkhdr_t) > skb->len) if (offset + sizeof(_ch) > skb->len)
break; break;
ch = skb_header_pointer(skb, offset, sizeof(*ch), &_ch); ch = skb_header_pointer(skb, offset, sizeof(*ch), &_ch);
/* Break out if chunk length is less then minimal. */ /* Break out if chunk length is less then minimal. */
if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t)) if (ntohs(ch->length) < sizeof(_ch))
break; break;
ch_end = offset + SCTP_PAD4(ntohs(ch->length)); ch_end = offset + SCTP_PAD4(ntohs(ch->length));
...@@ -1106,7 +1106,7 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct net *net, ...@@ -1106,7 +1106,7 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct net *net,
*/ */
static struct sctp_association *__sctp_rcv_asconf_lookup( static struct sctp_association *__sctp_rcv_asconf_lookup(
struct net *net, struct net *net,
sctp_chunkhdr_t *ch, struct sctp_chunkhdr *ch,
const union sctp_addr *laddr, const union sctp_addr *laddr,
__be16 peer_port, __be16 peer_port,
struct sctp_transport **transportp) struct sctp_transport **transportp)
...@@ -1144,7 +1144,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net, ...@@ -1144,7 +1144,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net,
struct sctp_transport **transportp) struct sctp_transport **transportp)
{ {
struct sctp_association *asoc = NULL; struct sctp_association *asoc = NULL;
sctp_chunkhdr_t *ch; struct sctp_chunkhdr *ch;
int have_auth = 0; int have_auth = 0;
unsigned int chunk_num = 1; unsigned int chunk_num = 1;
__u8 *ch_end; __u8 *ch_end;
...@@ -1152,10 +1152,10 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net, ...@@ -1152,10 +1152,10 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net,
/* Walk through the chunks looking for AUTH or ASCONF chunks /* Walk through the chunks looking for AUTH or ASCONF chunks
* to help us find the association. * to help us find the association.
*/ */
ch = (sctp_chunkhdr_t *) skb->data; ch = (struct sctp_chunkhdr *)skb->data;
do { do {
/* Break out if chunk length is less then minimal. */ /* Break out if chunk length is less then minimal. */
if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t)) if (ntohs(ch->length) < sizeof(*ch))
break; break;
ch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length)); ch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length));
...@@ -1192,7 +1192,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net, ...@@ -1192,7 +1192,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net,
if (asoc) if (asoc)
break; break;
ch = (sctp_chunkhdr_t *) ch_end; ch = (struct sctp_chunkhdr *)ch_end;
chunk_num++; chunk_num++;
} while (ch_end < skb_tail_pointer(skb)); } while (ch_end < skb_tail_pointer(skb));
...@@ -1210,7 +1210,7 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net, ...@@ -1210,7 +1210,7 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net,
const union sctp_addr *laddr, const union sctp_addr *laddr,
struct sctp_transport **transportp) struct sctp_transport **transportp)
{ {
sctp_chunkhdr_t *ch; struct sctp_chunkhdr *ch;
/* We do not allow GSO frames here as we need to linearize and /* We do not allow GSO frames here as we need to linearize and
* then cannot guarantee frame boundaries. This shouldn't be an * then cannot guarantee frame boundaries. This shouldn't be an
...@@ -1220,7 +1220,7 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net, ...@@ -1220,7 +1220,7 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net,
if ((skb_shinfo(skb)->gso_type & SKB_GSO_SCTP) == SKB_GSO_SCTP) if ((skb_shinfo(skb)->gso_type & SKB_GSO_SCTP) == SKB_GSO_SCTP)
return NULL; return NULL;
ch = (sctp_chunkhdr_t *) skb->data; ch = (struct sctp_chunkhdr *)skb->data;
/* The code below will attempt to walk the chunk and extract /* The code below will attempt to walk the chunk and extract
* parameter information. Before we do that, we need to verify * parameter information. Before we do that, we need to verify
......
...@@ -99,7 +99,7 @@ void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *chunk) ...@@ -99,7 +99,7 @@ void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *chunk)
struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue) struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue)
{ {
struct sctp_chunk *chunk; struct sctp_chunk *chunk;
sctp_chunkhdr_t *ch = NULL; struct sctp_chunkhdr *ch = NULL;
chunk = queue->in_progress; chunk = queue->in_progress;
/* If there is no more chunks in this packet, say so */ /* If there is no more chunks in this packet, say so */
...@@ -108,7 +108,7 @@ struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue) ...@@ -108,7 +108,7 @@ struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue)
chunk->pdiscard) chunk->pdiscard)
return NULL; return NULL;
ch = (sctp_chunkhdr_t *)chunk->chunk_end; ch = (struct sctp_chunkhdr *)chunk->chunk_end;
return ch; return ch;
} }
...@@ -122,7 +122,7 @@ struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue) ...@@ -122,7 +122,7 @@ struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue)
struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
{ {
struct sctp_chunk *chunk; struct sctp_chunk *chunk;
sctp_chunkhdr_t *ch = NULL; struct sctp_chunkhdr *ch = NULL;
/* The assumption is that we are safe to process the chunks /* The assumption is that we are safe to process the chunks
* at this time. * at this time.
...@@ -151,7 +151,7 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) ...@@ -151,7 +151,7 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
chunk = queue->in_progress = NULL; chunk = queue->in_progress = NULL;
} else { } else {
/* Nothing to do. Next chunk in the packet, please. */ /* Nothing to do. Next chunk in the packet, please. */
ch = (sctp_chunkhdr_t *) chunk->chunk_end; ch = (struct sctp_chunkhdr *)chunk->chunk_end;
/* Force chunk->skb->data to chunk->chunk_end. */ /* Force chunk->skb->data to chunk->chunk_end. */
skb_pull(chunk->skb, chunk->chunk_end - chunk->skb->data); skb_pull(chunk->skb, chunk->chunk_end - chunk->skb->data);
/* We are guaranteed to pull a SCTP header. */ /* We are guaranteed to pull a SCTP header. */
...@@ -195,7 +195,7 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) ...@@ -195,7 +195,7 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
new_skb: new_skb:
/* This is the first chunk in the packet. */ /* This is the first chunk in the packet. */
ch = (sctp_chunkhdr_t *) chunk->skb->data; ch = (struct sctp_chunkhdr *)chunk->skb->data;
chunk->singleton = 1; chunk->singleton = 1;
chunk->data_accepted = 0; chunk->data_accepted = 0;
chunk->pdiscard = 0; chunk->pdiscard = 0;
...@@ -214,11 +214,10 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) ...@@ -214,11 +214,10 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
chunk->chunk_hdr = ch; chunk->chunk_hdr = ch;
chunk->chunk_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length)); chunk->chunk_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length));
skb_pull(chunk->skb, sizeof(sctp_chunkhdr_t)); skb_pull(chunk->skb, sizeof(*ch));
chunk->subh.v = NULL; /* Subheader is no longer valid. */ chunk->subh.v = NULL; /* Subheader is no longer valid. */
if (chunk->chunk_end + sizeof(sctp_chunkhdr_t) < if (chunk->chunk_end + sizeof(*ch) < skb_tail_pointer(chunk->skb)) {
skb_tail_pointer(chunk->skb)) {
/* This is not a singleton */ /* This is not a singleton */
chunk->singleton = 0; chunk->singleton = 0;
} else if (chunk->chunk_end > skb_tail_pointer(chunk->skb)) { } else if (chunk->chunk_end > skb_tail_pointer(chunk->skb)) {
......
...@@ -1379,20 +1379,20 @@ static struct sctp_chunk *_sctp_make_chunk(const struct sctp_association *asoc, ...@@ -1379,20 +1379,20 @@ static struct sctp_chunk *_sctp_make_chunk(const struct sctp_association *asoc,
gfp_t gfp) gfp_t gfp)
{ {
struct sctp_chunk *retval; struct sctp_chunk *retval;
sctp_chunkhdr_t *chunk_hdr; struct sctp_chunkhdr *chunk_hdr;
struct sk_buff *skb; struct sk_buff *skb;
struct sock *sk; struct sock *sk;
/* No need to allocate LL here, as this is only a chunk. */ /* No need to allocate LL here, as this is only a chunk. */
skb = alloc_skb(SCTP_PAD4(sizeof(sctp_chunkhdr_t) + paylen), gfp); skb = alloc_skb(SCTP_PAD4(sizeof(*chunk_hdr) + paylen), gfp);
if (!skb) if (!skb)
goto nodata; goto nodata;
/* Make room for the chunk header. */ /* Make room for the chunk header. */
chunk_hdr = skb_put(skb, sizeof(sctp_chunkhdr_t)); chunk_hdr = (struct sctp_chunkhdr *)skb_put(skb, sizeof(*chunk_hdr));
chunk_hdr->type = type; chunk_hdr->type = type;
chunk_hdr->flags = flags; chunk_hdr->flags = flags;
chunk_hdr->length = htons(sizeof(sctp_chunkhdr_t)); chunk_hdr->length = htons(sizeof(*chunk_hdr));
sk = asoc ? asoc->base.sk : NULL; sk = asoc ? asoc->base.sk : NULL;
retval = sctp_chunkify(skb, asoc, sk, gfp); retval = sctp_chunkify(skb, asoc, sk, gfp);
...@@ -1402,7 +1402,7 @@ static struct sctp_chunk *_sctp_make_chunk(const struct sctp_association *asoc, ...@@ -1402,7 +1402,7 @@ static struct sctp_chunk *_sctp_make_chunk(const struct sctp_association *asoc,
} }
retval->chunk_hdr = chunk_hdr; retval->chunk_hdr = chunk_hdr;
retval->chunk_end = ((__u8 *)chunk_hdr) + sizeof(struct sctp_chunkhdr); retval->chunk_end = ((__u8 *)chunk_hdr) + sizeof(*chunk_hdr);
/* Determine if the chunk needs to be authenticated */ /* Determine if the chunk needs to be authenticated */
if (sctp_auth_send_cid(type, asoc)) if (sctp_auth_send_cid(type, asoc))
...@@ -1710,7 +1710,7 @@ struct sctp_association *sctp_unpack_cookie( ...@@ -1710,7 +1710,7 @@ struct sctp_association *sctp_unpack_cookie(
/* Header size is static data prior to the actual cookie, including /* Header size is static data prior to the actual cookie, including
* any padding. * any padding.
*/ */
headersize = sizeof(sctp_chunkhdr_t) + headersize = sizeof(struct sctp_chunkhdr) +
(sizeof(struct sctp_signed_cookie) - (sizeof(struct sctp_signed_cookie) -
sizeof(struct sctp_cookie)); sizeof(struct sctp_cookie));
bodysize = ntohs(chunk->chunk_hdr->length) - headersize; bodysize = ntohs(chunk->chunk_hdr->length) - headersize;
...@@ -3218,7 +3218,8 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, ...@@ -3218,7 +3218,8 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
int chunk_len; int chunk_len;
__u32 serial; __u32 serial;
chunk_len = ntohs(asconf->chunk_hdr->length) - sizeof(sctp_chunkhdr_t); chunk_len = ntohs(asconf->chunk_hdr->length) -
sizeof(struct sctp_chunkhdr);
hdr = (sctp_addiphdr_t *)asconf->skb->data; hdr = (sctp_addiphdr_t *)asconf->skb->data;
serial = ntohl(hdr->serial); serial = ntohl(hdr->serial);
...@@ -3364,7 +3365,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack, ...@@ -3364,7 +3365,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack,
err_code = SCTP_ERROR_REQ_REFUSED; err_code = SCTP_ERROR_REQ_REFUSED;
asconf_ack_len = ntohs(asconf_ack->chunk_hdr->length) - asconf_ack_len = ntohs(asconf_ack->chunk_hdr->length) -
sizeof(sctp_chunkhdr_t); sizeof(struct sctp_chunkhdr);
/* Skip the addiphdr from the asconf_ack chunk and store a pointer to /* Skip the addiphdr from the asconf_ack chunk and store a pointer to
* the first asconf_ack parameter. * the first asconf_ack parameter.
......
...@@ -955,9 +955,10 @@ static void sctp_cmd_process_operr(sctp_cmd_seq_t *cmds, ...@@ -955,9 +955,10 @@ static void sctp_cmd_process_operr(sctp_cmd_seq_t *cmds,
switch (err_hdr->cause) { switch (err_hdr->cause) {
case SCTP_ERROR_UNKNOWN_CHUNK: case SCTP_ERROR_UNKNOWN_CHUNK:
{ {
sctp_chunkhdr_t *unk_chunk_hdr; struct sctp_chunkhdr *unk_chunk_hdr;
unk_chunk_hdr = (sctp_chunkhdr_t *)err_hdr->variable; unk_chunk_hdr = (struct sctp_chunkhdr *)
err_hdr->variable;
switch (unk_chunk_hdr->type) { switch (unk_chunk_hdr->type) {
/* ADDIP 4.1 A9) If the peer responds to an ASCONF with /* ADDIP 4.1 A9) If the peer responds to an ASCONF with
* an ERROR chunk reporting that it did not recognized * an ERROR chunk reporting that it did not recognized
......
...@@ -235,7 +235,7 @@ sctp_disposition_t sctp_sf_do_4_C(struct net *net, ...@@ -235,7 +235,7 @@ sctp_disposition_t sctp_sf_do_4_C(struct net *net,
return sctp_sf_violation_chunk(net, ep, asoc, type, arg, commands); return sctp_sf_violation_chunk(net, ep, asoc, type, arg, commands);
/* Make sure that the SHUTDOWN_COMPLETE chunk has a valid length. */ /* Make sure that the SHUTDOWN_COMPLETE chunk has a valid length. */
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr)))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands); commands);
...@@ -368,9 +368,9 @@ sctp_disposition_t sctp_sf_do_5_1B_init(struct net *net, ...@@ -368,9 +368,9 @@ sctp_disposition_t sctp_sf_do_5_1B_init(struct net *net,
if (err_chunk) { if (err_chunk) {
packet = sctp_abort_pkt_new(net, ep, asoc, arg, packet = sctp_abort_pkt_new(net, ep, asoc, arg,
(__u8 *)(err_chunk->chunk_hdr) + (__u8 *)(err_chunk->chunk_hdr) +
sizeof(sctp_chunkhdr_t), sizeof(struct sctp_chunkhdr),
ntohs(err_chunk->chunk_hdr->length) - ntohs(err_chunk->chunk_hdr->length) -
sizeof(sctp_chunkhdr_t)); sizeof(struct sctp_chunkhdr));
sctp_chunk_free(err_chunk); sctp_chunk_free(err_chunk);
...@@ -417,7 +417,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(struct net *net, ...@@ -417,7 +417,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(struct net *net,
len = 0; len = 0;
if (err_chunk) if (err_chunk)
len = ntohs(err_chunk->chunk_hdr->length) - len = ntohs(err_chunk->chunk_hdr->length) -
sizeof(sctp_chunkhdr_t); sizeof(struct sctp_chunkhdr);
repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len); repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len);
if (!repl) if (!repl)
...@@ -437,7 +437,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(struct net *net, ...@@ -437,7 +437,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(struct net *net,
*/ */
unk_param = (sctp_unrecognized_param_t *) unk_param = (sctp_unrecognized_param_t *)
((__u8 *)(err_chunk->chunk_hdr) + ((__u8 *)(err_chunk->chunk_hdr) +
sizeof(sctp_chunkhdr_t)); sizeof(struct sctp_chunkhdr));
/* Replace the cause code with the "Unrecognized parameter" /* Replace the cause code with the "Unrecognized parameter"
* parameter type. * parameter type.
*/ */
...@@ -540,9 +540,9 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(struct net *net, ...@@ -540,9 +540,9 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(struct net *net,
if (err_chunk) { if (err_chunk) {
packet = sctp_abort_pkt_new(net, ep, asoc, arg, packet = sctp_abort_pkt_new(net, ep, asoc, arg,
(__u8 *)(err_chunk->chunk_hdr) + (__u8 *)(err_chunk->chunk_hdr) +
sizeof(sctp_chunkhdr_t), sizeof(struct sctp_chunkhdr),
ntohs(err_chunk->chunk_hdr->length) - ntohs(err_chunk->chunk_hdr->length) -
sizeof(sctp_chunkhdr_t)); sizeof(struct sctp_chunkhdr));
sctp_chunk_free(err_chunk); sctp_chunk_free(err_chunk);
...@@ -673,7 +673,7 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net, ...@@ -673,7 +673,7 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net,
* chunk header. More detailed verification is done * chunk header. More detailed verification is done
* in sctp_unpack_cookie(). * in sctp_unpack_cookie().
*/ */
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr)))
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
/* If the endpoint is not listening or if the number of associations /* If the endpoint is not listening or if the number of associations
...@@ -691,7 +691,7 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net, ...@@ -691,7 +691,7 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net,
chunk->subh.cookie_hdr = chunk->subh.cookie_hdr =
(struct sctp_signed_cookie *)chunk->skb->data; (struct sctp_signed_cookie *)chunk->skb->data;
if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) -
sizeof(sctp_chunkhdr_t))) sizeof(struct sctp_chunkhdr)))
goto nomem; goto nomem;
/* 5.1 D) Upon reception of the COOKIE ECHO chunk, Endpoint /* 5.1 D) Upon reception of the COOKIE ECHO chunk, Endpoint
...@@ -770,9 +770,10 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net, ...@@ -770,9 +770,10 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net,
auth.skb = chunk->auth_chunk; auth.skb = chunk->auth_chunk;
auth.asoc = chunk->asoc; auth.asoc = chunk->asoc;
auth.sctp_hdr = chunk->sctp_hdr; auth.sctp_hdr = chunk->sctp_hdr;
auth.chunk_hdr = skb_push(chunk->auth_chunk, auth.chunk_hdr = (struct sctp_chunkhdr *)
sizeof(sctp_chunkhdr_t)); skb_push(chunk->auth_chunk,
skb_pull(chunk->auth_chunk, sizeof(sctp_chunkhdr_t)); sizeof(struct sctp_chunkhdr));
skb_pull(chunk->auth_chunk, sizeof(struct sctp_chunkhdr));
auth.transport = chunk->transport; auth.transport = chunk->transport;
ret = sctp_sf_authenticate(net, ep, new_asoc, type, &auth); ret = sctp_sf_authenticate(net, ep, new_asoc, type, &auth);
...@@ -886,7 +887,7 @@ sctp_disposition_t sctp_sf_do_5_1E_ca(struct net *net, ...@@ -886,7 +887,7 @@ sctp_disposition_t sctp_sf_do_5_1E_ca(struct net *net,
/* Verify that the chunk length for the COOKIE-ACK is OK. /* Verify that the chunk length for the COOKIE-ACK is OK.
* If we don't do this, any bundled chunks may be junked. * If we don't do this, any bundled chunks may be junked.
*/ */
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr)))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands); commands);
...@@ -1099,7 +1100,7 @@ sctp_disposition_t sctp_sf_beat_8_3(struct net *net, ...@@ -1099,7 +1100,7 @@ sctp_disposition_t sctp_sf_beat_8_3(struct net *net,
*/ */
chunk->subh.hb_hdr = (sctp_heartbeathdr_t *) chunk->skb->data; chunk->subh.hb_hdr = (sctp_heartbeathdr_t *) chunk->skb->data;
param_hdr = (sctp_paramhdr_t *) chunk->subh.hb_hdr; param_hdr = (sctp_paramhdr_t *) chunk->subh.hb_hdr;
paylen = ntohs(chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t); paylen = ntohs(chunk->chunk_hdr->length) - sizeof(struct sctp_chunkhdr);
if (ntohs(param_hdr->length) > paylen) if (ntohs(param_hdr->length) > paylen)
return sctp_sf_violation_paramlen(net, ep, asoc, type, arg, return sctp_sf_violation_paramlen(net, ep, asoc, type, arg,
...@@ -1164,7 +1165,7 @@ sctp_disposition_t sctp_sf_backbeat_8_3(struct net *net, ...@@ -1164,7 +1165,7 @@ sctp_disposition_t sctp_sf_backbeat_8_3(struct net *net,
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
/* Make sure that the HEARTBEAT-ACK chunk has a valid length. */ /* Make sure that the HEARTBEAT-ACK chunk has a valid length. */
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t) + if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr) +
sizeof(sctp_sender_hb_info_t))) sizeof(sctp_sender_hb_info_t)))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands); commands);
...@@ -1469,9 +1470,9 @@ static sctp_disposition_t sctp_sf_do_unexpected_init( ...@@ -1469,9 +1470,9 @@ static sctp_disposition_t sctp_sf_do_unexpected_init(
if (err_chunk) { if (err_chunk) {
packet = sctp_abort_pkt_new(net, ep, asoc, arg, packet = sctp_abort_pkt_new(net, ep, asoc, arg,
(__u8 *)(err_chunk->chunk_hdr) + (__u8 *)(err_chunk->chunk_hdr) +
sizeof(sctp_chunkhdr_t), sizeof(struct sctp_chunkhdr),
ntohs(err_chunk->chunk_hdr->length) - ntohs(err_chunk->chunk_hdr->length) -
sizeof(sctp_chunkhdr_t)); sizeof(struct sctp_chunkhdr));
if (packet) { if (packet) {
sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT, sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT,
...@@ -1535,7 +1536,7 @@ static sctp_disposition_t sctp_sf_do_unexpected_init( ...@@ -1535,7 +1536,7 @@ static sctp_disposition_t sctp_sf_do_unexpected_init(
len = 0; len = 0;
if (err_chunk) { if (err_chunk) {
len = ntohs(err_chunk->chunk_hdr->length) - len = ntohs(err_chunk->chunk_hdr->length) -
sizeof(sctp_chunkhdr_t); sizeof(struct sctp_chunkhdr);
} }
repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len); repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len);
...@@ -1556,7 +1557,7 @@ static sctp_disposition_t sctp_sf_do_unexpected_init( ...@@ -1556,7 +1557,7 @@ static sctp_disposition_t sctp_sf_do_unexpected_init(
*/ */
unk_param = (sctp_unrecognized_param_t *) unk_param = (sctp_unrecognized_param_t *)
((__u8 *)(err_chunk->chunk_hdr) + ((__u8 *)(err_chunk->chunk_hdr) +
sizeof(sctp_chunkhdr_t)); sizeof(struct sctp_chunkhdr));
/* Replace the cause code with the "Unrecognized parameter" /* Replace the cause code with the "Unrecognized parameter"
* parameter type. * parameter type.
*/ */
...@@ -2044,7 +2045,7 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(struct net *net, ...@@ -2044,7 +2045,7 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(struct net *net,
* enough for the chunk header. Cookie length verification is * enough for the chunk header. Cookie length verification is
* done later. * done later.
*/ */
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr)))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands); commands);
...@@ -2053,7 +2054,7 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(struct net *net, ...@@ -2053,7 +2054,7 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(struct net *net,
*/ */
chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data; chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data;
if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) -
sizeof(sctp_chunkhdr_t))) sizeof(struct sctp_chunkhdr)))
goto nomem; goto nomem;
/* In RFC 2960 5.2.4 3, if both Verification Tags in the State Cookie /* In RFC 2960 5.2.4 3, if both Verification Tags in the State Cookie
...@@ -2806,7 +2807,7 @@ sctp_disposition_t sctp_sf_do_9_2_reshutack(struct net *net, ...@@ -2806,7 +2807,7 @@ sctp_disposition_t sctp_sf_do_9_2_reshutack(struct net *net,
struct sctp_chunk *reply; struct sctp_chunk *reply;
/* Make sure that the chunk has a valid length */ /* Make sure that the chunk has a valid length */
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr)))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands); commands);
...@@ -3358,7 +3359,7 @@ sctp_disposition_t sctp_sf_do_9_2_final(struct net *net, ...@@ -3358,7 +3359,7 @@ sctp_disposition_t sctp_sf_do_9_2_final(struct net *net,
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
/* Make sure that the SHUTDOWN_ACK chunk has a valid length. */ /* Make sure that the SHUTDOWN_ACK chunk has a valid length. */
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr)))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands); commands);
/* 10.2 H) SHUTDOWN COMPLETE notification /* 10.2 H) SHUTDOWN COMPLETE notification
...@@ -3435,7 +3436,7 @@ sctp_disposition_t sctp_sf_ootb(struct net *net, ...@@ -3435,7 +3436,7 @@ sctp_disposition_t sctp_sf_ootb(struct net *net,
{ {
struct sctp_chunk *chunk = arg; struct sctp_chunk *chunk = arg;
struct sk_buff *skb = chunk->skb; struct sk_buff *skb = chunk->skb;
sctp_chunkhdr_t *ch; struct sctp_chunkhdr *ch;
sctp_errhdr_t *err; sctp_errhdr_t *err;
__u8 *ch_end; __u8 *ch_end;
int ootb_shut_ack = 0; int ootb_shut_ack = 0;
...@@ -3443,10 +3444,10 @@ sctp_disposition_t sctp_sf_ootb(struct net *net, ...@@ -3443,10 +3444,10 @@ sctp_disposition_t sctp_sf_ootb(struct net *net,
SCTP_INC_STATS(net, SCTP_MIB_OUTOFBLUES); SCTP_INC_STATS(net, SCTP_MIB_OUTOFBLUES);
ch = (sctp_chunkhdr_t *) chunk->chunk_hdr; ch = (struct sctp_chunkhdr *)chunk->chunk_hdr;
do { do {
/* Report violation if the chunk is less then minimal */ /* Report violation if the chunk is less then minimal */
if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t)) if (ntohs(ch->length) < sizeof(*ch))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands); commands);
...@@ -3487,7 +3488,7 @@ sctp_disposition_t sctp_sf_ootb(struct net *net, ...@@ -3487,7 +3488,7 @@ sctp_disposition_t sctp_sf_ootb(struct net *net,
} }
} }
ch = (sctp_chunkhdr_t *) ch_end; ch = (struct sctp_chunkhdr *)ch_end;
} while (ch_end < skb_tail_pointer(skb)); } while (ch_end < skb_tail_pointer(skb));
if (ootb_shut_ack) if (ootb_shut_ack)
...@@ -3560,7 +3561,7 @@ static sctp_disposition_t sctp_sf_shut_8_4_5(struct net *net, ...@@ -3560,7 +3561,7 @@ static sctp_disposition_t sctp_sf_shut_8_4_5(struct net *net,
/* If the chunk length is invalid, we don't want to process /* If the chunk length is invalid, we don't want to process
* the reset of the packet. * the reset of the packet.
*/ */
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr)))
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
/* We need to discard the rest of the packet to prevent /* We need to discard the rest of the packet to prevent
...@@ -3591,7 +3592,7 @@ sctp_disposition_t sctp_sf_do_8_5_1_E_sa(struct net *net, ...@@ -3591,7 +3592,7 @@ sctp_disposition_t sctp_sf_do_8_5_1_E_sa(struct net *net,
struct sctp_chunk *chunk = arg; struct sctp_chunk *chunk = arg;
/* Make sure that the SHUTDOWN_ACK chunk has a valid length. */ /* Make sure that the SHUTDOWN_ACK chunk has a valid length. */
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr)))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands); commands);
...@@ -4256,7 +4257,7 @@ sctp_disposition_t sctp_sf_unk_chunk(struct net *net, ...@@ -4256,7 +4257,7 @@ sctp_disposition_t sctp_sf_unk_chunk(struct net *net,
{ {
struct sctp_chunk *unk_chunk = arg; struct sctp_chunk *unk_chunk = arg;
struct sctp_chunk *err_chunk; struct sctp_chunk *err_chunk;
sctp_chunkhdr_t *hdr; struct sctp_chunkhdr *hdr;
pr_debug("%s: processing unknown chunk id:%d\n", __func__, type.chunk); pr_debug("%s: processing unknown chunk id:%d\n", __func__, type.chunk);
...@@ -4267,7 +4268,7 @@ sctp_disposition_t sctp_sf_unk_chunk(struct net *net, ...@@ -4267,7 +4268,7 @@ sctp_disposition_t sctp_sf_unk_chunk(struct net *net,
* Since we don't know the chunk type, we use a general * Since we don't know the chunk type, we use a general
* chunkhdr structure to make a comparison. * chunkhdr structure to make a comparison.
*/ */
if (!sctp_chunk_length_valid(unk_chunk, sizeof(sctp_chunkhdr_t))) if (!sctp_chunk_length_valid(unk_chunk, sizeof(*hdr)))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands); commands);
...@@ -4340,7 +4341,7 @@ sctp_disposition_t sctp_sf_discard_chunk(struct net *net, ...@@ -4340,7 +4341,7 @@ sctp_disposition_t sctp_sf_discard_chunk(struct net *net,
* Since we don't know the chunk type, we use a general * Since we don't know the chunk type, we use a general
* chunkhdr structure to make a comparison. * chunkhdr structure to make a comparison.
*/ */
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr)))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands); commands);
...@@ -4405,7 +4406,7 @@ sctp_disposition_t sctp_sf_violation(struct net *net, ...@@ -4405,7 +4406,7 @@ sctp_disposition_t sctp_sf_violation(struct net *net,
struct sctp_chunk *chunk = arg; struct sctp_chunk *chunk = arg;
/* Make sure that the chunk has a valid length. */ /* Make sure that the chunk has a valid length. */
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr)))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands); commands);
......
...@@ -158,7 +158,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( ...@@ -158,7 +158,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
/* Trim the buffer to the right length. */ /* Trim the buffer to the right length. */
skb_trim(skb, sizeof(struct sctp_assoc_change) + skb_trim(skb, sizeof(struct sctp_assoc_change) +
ntohs(chunk->chunk_hdr->length) - ntohs(chunk->chunk_hdr->length) -
sizeof(sctp_chunkhdr_t)); sizeof(struct sctp_chunkhdr));
} else { } else {
event = sctp_ulpevent_new(sizeof(struct sctp_assoc_change), event = sctp_ulpevent_new(sizeof(struct sctp_assoc_change),
MSG_NOTIFICATION, gfp); MSG_NOTIFICATION, gfp);
......
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