Commit dbc16db1 authored by Al Viro's avatar Al Viro Committed by David S. Miller

[SCTP]: Trivial sctp endianness annotations.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 72f17e1c
...@@ -356,7 +356,7 @@ typedef enum { ...@@ -356,7 +356,7 @@ typedef enum {
* addresses. * addresses.
*/ */
#define IS_IPV4_UNUSABLE_ADDRESS(a) \ #define IS_IPV4_UNUSABLE_ADDRESS(a) \
((INADDR_BROADCAST == *a) || \ ((htonl(INADDR_BROADCAST) == *a) || \
(MULTICAST(*a)) || \ (MULTICAST(*a)) || \
(((unsigned char *)(a))[0] == 0) || \ (((unsigned char *)(a))[0] == 0) || \
((((unsigned char *)(a))[0] == 198) && \ ((((unsigned char *)(a))[0] == 198) && \
......
...@@ -585,7 +585,7 @@ static inline int ipver2af(__u8 ipver) ...@@ -585,7 +585,7 @@ static inline int ipver2af(__u8 ipver)
} }
/* Convert from an address parameter type to an address family. */ /* Convert from an address parameter type to an address family. */
static inline int param_type2af(__u16 type) static inline int param_type2af(__be16 type)
{ {
switch (type) { switch (type) {
case SCTP_PARAM_IPV4_ADDRESS: case SCTP_PARAM_IPV4_ADDRESS:
......
...@@ -243,7 +243,7 @@ struct sctp_chunk *sctp_make_op_error(const struct sctp_association *, ...@@ -243,7 +243,7 @@ struct sctp_chunk *sctp_make_op_error(const struct sctp_association *,
struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *, struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *,
union sctp_addr *, union sctp_addr *,
struct sockaddr *, struct sockaddr *,
int, __u16); int, __be16);
struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc, struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc,
union sctp_addr *addr); union sctp_addr *addr);
struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
......
...@@ -1482,7 +1482,7 @@ struct sctp_association { ...@@ -1482,7 +1482,7 @@ struct sctp_association {
/* This mask is used to disable sending the ASCONF chunk /* This mask is used to disable sending the ASCONF chunk
* with specified parameter to peer. * with specified parameter to peer.
*/ */
__u16 addip_disabled_mask; __be16 addip_disabled_mask;
struct sctp_inithdr i; struct sctp_inithdr i;
int cookie_len; int cookie_len;
......
...@@ -868,7 +868,7 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc, ...@@ -868,7 +868,7 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc,
struct list_head *entry, *pos; struct list_head *entry, *pos;
struct sctp_transport *transport; struct sctp_transport *transport;
struct sctp_chunk *chunk; struct sctp_chunk *chunk;
__u32 key = htonl(tsn); __be32 key = htonl(tsn);
match = NULL; match = NULL;
......
...@@ -239,7 +239,7 @@ static inline int sctp_v6_addr_match_len(union sctp_addr *s1, ...@@ -239,7 +239,7 @@ static inline int sctp_v6_addr_match_len(union sctp_addr *s1,
int i, j; int i, j;
for (i = 0; i < 4 ; i++) { for (i = 0; i < 4 ; i++) {
__u32 a1xora2; __be32 a1xora2;
a1xora2 = a1->s6_addr32[i] ^ a2->s6_addr32[i]; a1xora2 = a1->s6_addr32[i] ^ a2->s6_addr32[i];
...@@ -425,7 +425,7 @@ static int sctp_v6_to_addr_param(const union sctp_addr *addr, ...@@ -425,7 +425,7 @@ static int sctp_v6_to_addr_param(const union sctp_addr *addr,
int length = sizeof(sctp_ipv6addr_param_t); int length = sizeof(sctp_ipv6addr_param_t);
param->v6.param_hdr.type = SCTP_PARAM_IPV6_ADDRESS; param->v6.param_hdr.type = SCTP_PARAM_IPV6_ADDRESS;
param->v6.param_hdr.length = ntohs(length); param->v6.param_hdr.length = htons(length);
ipv6_addr_copy(&param->v6.addr, &addr->v6.sin6_addr); ipv6_addr_copy(&param->v6.addr, &addr->v6.sin6_addr);
return length; return length;
......
...@@ -307,7 +307,7 @@ static int sctp_v4_to_addr_param(const union sctp_addr *addr, ...@@ -307,7 +307,7 @@ static int sctp_v4_to_addr_param(const union sctp_addr *addr,
int length = sizeof(sctp_ipv4addr_param_t); int length = sizeof(sctp_ipv4addr_param_t);
param->v4.param_hdr.type = SCTP_PARAM_IPV4_ADDRESS; param->v4.param_hdr.type = SCTP_PARAM_IPV4_ADDRESS;
param->v4.param_hdr.length = ntohs(length); param->v4.param_hdr.length = htons(length);
param->v4.addr.s_addr = addr->v4.sin_addr.s_addr; param->v4.addr.s_addr = addr->v4.sin_addr.s_addr;
return length; return length;
......
...@@ -1190,7 +1190,7 @@ void sctp_chunk_assign_ssn(struct sctp_chunk *chunk) ...@@ -1190,7 +1190,7 @@ void sctp_chunk_assign_ssn(struct sctp_chunk *chunk)
if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) { if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) {
ssn = 0; ssn = 0;
} else { } else {
sid = htons(chunk->subh.data_hdr->stream); sid = ntohs(chunk->subh.data_hdr->stream);
if (chunk->chunk_hdr->flags & SCTP_DATA_LAST_FRAG) if (chunk->chunk_hdr->flags & SCTP_DATA_LAST_FRAG)
ssn = sctp_ssn_next(&chunk->asoc->ssnmap->out, sid); ssn = sctp_ssn_next(&chunk->asoc->ssnmap->out, sid);
else else
...@@ -2230,7 +2230,7 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc, ...@@ -2230,7 +2230,7 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc,
union sctp_addr *laddr, union sctp_addr *laddr,
struct sockaddr *addrs, struct sockaddr *addrs,
int addrcnt, int addrcnt,
__u16 flags) __be16 flags)
{ {
sctp_addip_param_t param; sctp_addip_param_t param;
struct sctp_chunk *retval; struct sctp_chunk *retval;
...@@ -2364,13 +2364,13 @@ static struct sctp_chunk *sctp_make_asconf_ack(const struct sctp_association *as ...@@ -2364,13 +2364,13 @@ static struct sctp_chunk *sctp_make_asconf_ack(const struct sctp_association *as
/* Add response parameters to an ASCONF_ACK chunk. */ /* Add response parameters to an ASCONF_ACK chunk. */
static void sctp_add_asconf_response(struct sctp_chunk *chunk, __u32 crr_id, static void sctp_add_asconf_response(struct sctp_chunk *chunk, __u32 crr_id,
__u16 err_code, sctp_addip_param_t *asconf_param) __be16 err_code, sctp_addip_param_t *asconf_param)
{ {
sctp_addip_param_t ack_param; sctp_addip_param_t ack_param;
sctp_errhdr_t err_param; sctp_errhdr_t err_param;
int asconf_param_len = 0; int asconf_param_len = 0;
int err_param_len = 0; int err_param_len = 0;
__u16 response_type; __be16 response_type;
if (SCTP_ERROR_NO_ERROR == err_code) { if (SCTP_ERROR_NO_ERROR == err_code) {
response_type = SCTP_PARAM_SUCCESS_REPORT; response_type = SCTP_PARAM_SUCCESS_REPORT;
...@@ -2404,7 +2404,7 @@ static void sctp_add_asconf_response(struct sctp_chunk *chunk, __u32 crr_id, ...@@ -2404,7 +2404,7 @@ static void sctp_add_asconf_response(struct sctp_chunk *chunk, __u32 crr_id,
} }
/* Process a asconf parameter. */ /* Process a asconf parameter. */
static __u16 sctp_process_asconf_param(struct sctp_association *asoc, static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
struct sctp_chunk *asconf, struct sctp_chunk *asconf,
sctp_addip_param_t *asconf_param) sctp_addip_param_t *asconf_param)
{ {
...@@ -2487,7 +2487,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, ...@@ -2487,7 +2487,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
sctp_addip_param_t *asconf_param; sctp_addip_param_t *asconf_param;
struct sctp_chunk *asconf_ack; struct sctp_chunk *asconf_ack;
__u16 err_code; __be16 err_code;
int length = 0; int length = 0;
int chunk_len = asconf->skb->len; int chunk_len = asconf->skb->len;
__u32 serial; __u32 serial;
...@@ -2630,7 +2630,7 @@ static int sctp_asconf_param_success(struct sctp_association *asoc, ...@@ -2630,7 +2630,7 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
* All TLVs after the failed response are considered unsuccessful unless a * All TLVs after the failed response are considered unsuccessful unless a
* specific success indication is present for the parameter. * specific success indication is present for the parameter.
*/ */
static __u16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack, static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack,
sctp_addip_param_t *asconf_param, sctp_addip_param_t *asconf_param,
int no_err) int no_err)
{ {
...@@ -2638,7 +2638,7 @@ static __u16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack, ...@@ -2638,7 +2638,7 @@ static __u16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack,
sctp_errhdr_t *err_param; sctp_errhdr_t *err_param;
int length; int length;
int asconf_ack_len = asconf_ack->skb->len; int asconf_ack_len = asconf_ack->skb->len;
__u16 err_code; __be16 err_code;
if (no_err) if (no_err)
err_code = SCTP_ERROR_NO_ERROR; err_code = SCTP_ERROR_NO_ERROR;
...@@ -2694,7 +2694,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc, ...@@ -2694,7 +2694,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc,
int all_param_pass = 0; int all_param_pass = 0;
int no_err = 1; int no_err = 1;
int retval = 0; int retval = 0;
__u16 err_code = SCTP_ERROR_NO_ERROR; __be16 err_code = SCTP_ERROR_NO_ERROR;
/* Skip the chunkhdr and addiphdr from the last asconf sent and store /* Skip the chunkhdr and addiphdr from the last asconf sent and store
* a pointer to address parameter. * a pointer to address parameter.
......
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