sctp: use common head of addr parameter to access member in addr-unrelated code
authorShan Wei <shanwei@cn.fujitsu.com>
Mon, 18 Apr 2011 19:11:47 +0000 (19:11 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Apr 2011 04:45:19 +0000 (21:45 -0700)
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>
net/sctp/input.c
net/sctp/sm_make_chunk.c

index 5436c69211675a25101db263660cfffc45b84e29..30cec7732e801d6f5d9f9c12f5a7753afe658579 100644 (file)
@@ -1017,7 +1017,7 @@ static struct sctp_association *__sctp_rcv_asconf_lookup(
        /* Skip over the ADDIP header and find the Address parameter */
        param = (union sctp_addr_param *)(asconf + 1);
 
-       af = sctp_get_af_specific(param_type2af(param->v4.param_hdr.type));
+       af = sctp_get_af_specific(param_type2af(param->p.type));
        if (unlikely(!af))
                return NULL;
 
index b3434cc7d0cf960dc275938054f50c13016a0a42..844adfdeb463ff7b5fda71b407b50967c67d63ac 100644 (file)
@@ -2923,7 +2923,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
            asconf_param->param_hdr.type != SCTP_PARAM_SET_PRIMARY)
                return SCTP_ERROR_UNKNOWN_PARAM;
 
-       switch (addr_param->v4.param_hdr.type) {
+       switch (addr_param->p.type) {
        case SCTP_PARAM_IPV6_ADDRESS:
                if (!asoc->peer.ipv6_address)
                        return SCTP_ERROR_DNS_FAILED;
@@ -2936,7 +2936,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
                return SCTP_ERROR_DNS_FAILED;
        }
 
-       af = sctp_get_af_specific(param_type2af(addr_param->v4.param_hdr.type));
+       af = sctp_get_af_specific(param_type2af(addr_param->p.type));
        if (unlikely(!af))
                return SCTP_ERROR_DNS_FAILED;
 
@@ -3100,7 +3100,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
        /* Skip the address parameter and store a pointer to the first
         * asconf parameter.
         */
-       length = ntohs(addr_param->v4.param_hdr.length);
+       length = ntohs(addr_param->p.length);
        asconf_param = (sctp_addip_param_t *)((void *)addr_param + length);
        chunk_len -= length;
 
@@ -3177,7 +3177,7 @@ static void sctp_asconf_param_success(struct sctp_association *asoc,
                        ((void *)asconf_param + sizeof(sctp_addip_param_t));
 
        /* We have checked the packet before, so we do not check again. */
-       af = sctp_get_af_specific(param_type2af(addr_param->v4.param_hdr.type));
+       af = sctp_get_af_specific(param_type2af(addr_param->p.type));
        af->from_addr_param(&addr, addr_param, htons(bp->port), 0);
 
        switch (asconf_param->param_hdr.type) {
@@ -3304,7 +3304,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc,
        /* Skip the address parameter in the last asconf sent and store a
         * pointer to the first asconf parameter.
         */
-       length = ntohs(addr_param->v4.param_hdr.length);
+       length = ntohs(addr_param->p.length);
        asconf_param = (sctp_addip_param_t *)((void *)addr_param + length);
        asconf_len -= length;