diff options
author | Shan Wei <shanwei@cn.fujitsu.com> | 2011-04-18 15:11:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-20 00:45:19 -0400 |
commit | 6a435732accd9e3f4a8d9c320fabe578b1bf5add (patch) | |
tree | 35492d5afc59dabb41361c5a6dec015b89303fe6 /net/sctp | |
parent | 33c7cfdbb0d2bc021979e4947c7030c30d572532 (diff) |
sctp: use common head of addr parameter to access member in addr-unrelated code
The 'p' member of struct sctp_paramhdr is common part for
IPv4 addr parameter and IPv6 addr parameter in union sctp_addr_param.
For addr-related code, use specified addr parameter.
Otherwise, use common header to access type/length member.
Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/input.c | 2 | ||||
-rw-r--r-- | net/sctp/sm_make_chunk.c | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/net/sctp/input.c b/net/sctp/input.c index 5436c6921167..30cec7732e80 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -1017,7 +1017,7 @@ static struct sctp_association *__sctp_rcv_asconf_lookup( | |||
1017 | /* Skip over the ADDIP header and find the Address parameter */ | 1017 | /* Skip over the ADDIP header and find the Address parameter */ |
1018 | param = (union sctp_addr_param *)(asconf + 1); | 1018 | param = (union sctp_addr_param *)(asconf + 1); |
1019 | 1019 | ||
1020 | af = sctp_get_af_specific(param_type2af(param->v4.param_hdr.type)); | 1020 | af = sctp_get_af_specific(param_type2af(param->p.type)); |
1021 | if (unlikely(!af)) | 1021 | if (unlikely(!af)) |
1022 | return NULL; | 1022 | return NULL; |
1023 | 1023 | ||
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index b3434cc7d0cf..844adfdeb463 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -2923,7 +2923,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc, | |||
2923 | asconf_param->param_hdr.type != SCTP_PARAM_SET_PRIMARY) | 2923 | asconf_param->param_hdr.type != SCTP_PARAM_SET_PRIMARY) |
2924 | return SCTP_ERROR_UNKNOWN_PARAM; | 2924 | return SCTP_ERROR_UNKNOWN_PARAM; |
2925 | 2925 | ||
2926 | switch (addr_param->v4.param_hdr.type) { | 2926 | switch (addr_param->p.type) { |
2927 | case SCTP_PARAM_IPV6_ADDRESS: | 2927 | case SCTP_PARAM_IPV6_ADDRESS: |
2928 | if (!asoc->peer.ipv6_address) | 2928 | if (!asoc->peer.ipv6_address) |
2929 | return SCTP_ERROR_DNS_FAILED; | 2929 | return SCTP_ERROR_DNS_FAILED; |
@@ -2936,7 +2936,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc, | |||
2936 | return SCTP_ERROR_DNS_FAILED; | 2936 | return SCTP_ERROR_DNS_FAILED; |
2937 | } | 2937 | } |
2938 | 2938 | ||
2939 | af = sctp_get_af_specific(param_type2af(addr_param->v4.param_hdr.type)); | 2939 | af = sctp_get_af_specific(param_type2af(addr_param->p.type)); |
2940 | if (unlikely(!af)) | 2940 | if (unlikely(!af)) |
2941 | return SCTP_ERROR_DNS_FAILED; | 2941 | return SCTP_ERROR_DNS_FAILED; |
2942 | 2942 | ||
@@ -3100,7 +3100,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, | |||
3100 | /* Skip the address parameter and store a pointer to the first | 3100 | /* Skip the address parameter and store a pointer to the first |
3101 | * asconf parameter. | 3101 | * asconf parameter. |
3102 | */ | 3102 | */ |
3103 | length = ntohs(addr_param->v4.param_hdr.length); | 3103 | length = ntohs(addr_param->p.length); |
3104 | asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); | 3104 | asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); |
3105 | chunk_len -= length; | 3105 | chunk_len -= length; |
3106 | 3106 | ||
@@ -3177,7 +3177,7 @@ static void sctp_asconf_param_success(struct sctp_association *asoc, | |||
3177 | ((void *)asconf_param + sizeof(sctp_addip_param_t)); | 3177 | ((void *)asconf_param + sizeof(sctp_addip_param_t)); |
3178 | 3178 | ||
3179 | /* We have checked the packet before, so we do not check again. */ | 3179 | /* We have checked the packet before, so we do not check again. */ |
3180 | af = sctp_get_af_specific(param_type2af(addr_param->v4.param_hdr.type)); | 3180 | af = sctp_get_af_specific(param_type2af(addr_param->p.type)); |
3181 | af->from_addr_param(&addr, addr_param, htons(bp->port), 0); | 3181 | af->from_addr_param(&addr, addr_param, htons(bp->port), 0); |
3182 | 3182 | ||
3183 | switch (asconf_param->param_hdr.type) { | 3183 | switch (asconf_param->param_hdr.type) { |
@@ -3304,7 +3304,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc, | |||
3304 | /* Skip the address parameter in the last asconf sent and store a | 3304 | /* Skip the address parameter in the last asconf sent and store a |
3305 | * pointer to the first asconf parameter. | 3305 | * pointer to the first asconf parameter. |
3306 | */ | 3306 | */ |
3307 | length = ntohs(addr_param->v4.param_hdr.length); | 3307 | length = ntohs(addr_param->p.length); |
3308 | asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); | 3308 | asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); |
3309 | asconf_len -= length; | 3309 | asconf_len -= length; |
3310 | 3310 | ||