aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/socket.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-20 20:04:10 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:26:29 -0500
commit09ef7fecea40c5e4c0dfe35bed3f0ed8da554cf5 (patch)
treeb293f6aa012265dcb413d7dd6c0b68b1f2676b9f /net/sctp/socket.c
parent30330ee00ce077de9d459c17125573ff618bd7a9 (diff)
[SCTP]: Beginning of conversion to net-endian for embedded sctp_addr.
Part 1: rename sctp_chunk->source, sctp_sockaddr_entry->a, sctp_transport->ipaddr and sctp_transport->saddr (to ..._h) The next patch will reintroduce these fields and keep them as net-endian mirrors of the original (renamed) ones. Split in two patches to make sure that we hadn't forgotten any instanes. Later in the series we'll eliminate uses of host-endian variants (basically switching users to net-endian counterparts as we progress through that mess). Then host-endian ones will die. Other embedded host-endian sctp_addr will be easier to switch directly, so we leave them alone for now. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r--net/sctp/socket.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index b6e038a387c2..459f32c5c3ae 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -551,7 +551,7 @@ static int sctp_send_asconf_add_ip(struct sock *sk,
551 laddr = list_entry(p, struct sctp_sockaddr_entry, list); 551 laddr = list_entry(p, struct sctp_sockaddr_entry, list);
552 sctp_read_unlock(&asoc->base.addr_lock); 552 sctp_read_unlock(&asoc->base.addr_lock);
553 553
554 chunk = sctp_make_asconf_update_ip(asoc, &laddr->a, addrs, 554 chunk = sctp_make_asconf_update_ip(asoc, &laddr->a_h, addrs,
555 addrcnt, SCTP_PARAM_ADD_IP); 555 addrcnt, SCTP_PARAM_ADD_IP);
556 if (!chunk) { 556 if (!chunk) {
557 retval = -ENOMEM; 557 retval = -ENOMEM;
@@ -779,7 +779,7 @@ static int sctp_send_asconf_del_ip(struct sock *sk,
779 saddr = list_entry(pos1, 779 saddr = list_entry(pos1,
780 struct sctp_sockaddr_entry, 780 struct sctp_sockaddr_entry,
781 list); 781 list);
782 if (sctp_cmp_addr_exact(&saddr->a, &saveaddr)) 782 if (sctp_cmp_addr_exact(&saddr->a_h, &saveaddr))
783 saddr->use_as_src = 0; 783 saddr->use_as_src = 0;
784 } 784 }
785 addr_buf += af->sockaddr_len; 785 addr_buf += af->sockaddr_len;
@@ -3218,7 +3218,7 @@ static int sctp_getsockopt_sctp_status(struct sock *sk, int len,
3218 status.sstat_fragmentation_point = asoc->frag_point; 3218 status.sstat_fragmentation_point = asoc->frag_point;
3219 status.sstat_primary.spinfo_assoc_id = sctp_assoc2id(transport->asoc); 3219 status.sstat_primary.spinfo_assoc_id = sctp_assoc2id(transport->asoc);
3220 flip_to_n((union sctp_addr *)&status.sstat_primary.spinfo_address, 3220 flip_to_n((union sctp_addr *)&status.sstat_primary.spinfo_address,
3221 &transport->ipaddr); 3221 &transport->ipaddr_h);
3222 /* Map ipv4 address into v4-mapped-on-v6 address. */ 3222 /* Map ipv4 address into v4-mapped-on-v6 address. */
3223 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk), 3223 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk),
3224 (union sctp_addr *)&status.sstat_primary.spinfo_address); 3224 (union sctp_addr *)&status.sstat_primary.spinfo_address);
@@ -3767,7 +3767,7 @@ static int sctp_getsockopt_peer_addrs_old(struct sock *sk, int len,
3767 to = (void __user *)getaddrs.addrs; 3767 to = (void __user *)getaddrs.addrs;
3768 list_for_each(pos, &asoc->peer.transport_addr_list) { 3768 list_for_each(pos, &asoc->peer.transport_addr_list) {
3769 from = list_entry(pos, struct sctp_transport, transports); 3769 from = list_entry(pos, struct sctp_transport, transports);
3770 memcpy(&temp, &from->ipaddr, sizeof(temp)); 3770 memcpy(&temp, &from->ipaddr_h, sizeof(temp));
3771 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); 3771 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
3772 addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len; 3772 addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len;
3773 temp.v4.sin_port = htons(temp.v4.sin_port); 3773 temp.v4.sin_port = htons(temp.v4.sin_port);
@@ -3816,7 +3816,7 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
3816 3816
3817 list_for_each(pos, &asoc->peer.transport_addr_list) { 3817 list_for_each(pos, &asoc->peer.transport_addr_list) {
3818 from = list_entry(pos, struct sctp_transport, transports); 3818 from = list_entry(pos, struct sctp_transport, transports);
3819 memcpy(&temp, &from->ipaddr, sizeof(temp)); 3819 memcpy(&temp, &from->ipaddr_h, sizeof(temp));
3820 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); 3820 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
3821 addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len; 3821 addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len;
3822 if(space_left < addrlen) 3822 if(space_left < addrlen)
@@ -3882,14 +3882,14 @@ static int sctp_getsockopt_local_addrs_num_old(struct sock *sk, int len,
3882 if (sctp_list_single_entry(&bp->address_list)) { 3882 if (sctp_list_single_entry(&bp->address_list)) {
3883 addr = list_entry(bp->address_list.next, 3883 addr = list_entry(bp->address_list.next,
3884 struct sctp_sockaddr_entry, list); 3884 struct sctp_sockaddr_entry, list);
3885 if (sctp_is_any(&addr->a)) { 3885 if (sctp_is_any(&addr->a_h)) {
3886 sctp_spin_lock_irqsave(&sctp_local_addr_lock, flags); 3886 sctp_spin_lock_irqsave(&sctp_local_addr_lock, flags);
3887 list_for_each(pos, &sctp_local_addr_list) { 3887 list_for_each(pos, &sctp_local_addr_list) {
3888 addr = list_entry(pos, 3888 addr = list_entry(pos,
3889 struct sctp_sockaddr_entry, 3889 struct sctp_sockaddr_entry,
3890 list); 3890 list);
3891 if ((PF_INET == sk->sk_family) && 3891 if ((PF_INET == sk->sk_family) &&
3892 (AF_INET6 == addr->a.sa.sa_family)) 3892 (AF_INET6 == addr->a_h.sa.sa_family))
3893 continue; 3893 continue;
3894 cnt++; 3894 cnt++;
3895 } 3895 }
@@ -3927,9 +3927,9 @@ static int sctp_copy_laddrs_to_user_old(struct sock *sk, __u16 port, int max_add
3927 list_for_each(pos, &sctp_local_addr_list) { 3927 list_for_each(pos, &sctp_local_addr_list) {
3928 addr = list_entry(pos, struct sctp_sockaddr_entry, list); 3928 addr = list_entry(pos, struct sctp_sockaddr_entry, list);
3929 if ((PF_INET == sk->sk_family) && 3929 if ((PF_INET == sk->sk_family) &&
3930 (AF_INET6 == addr->a.sa.sa_family)) 3930 (AF_INET6 == addr->a_h.sa.sa_family))
3931 continue; 3931 continue;
3932 memcpy(&temp, &addr->a, sizeof(temp)); 3932 memcpy(&temp, &addr->a_h, sizeof(temp));
3933 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk), 3933 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk),
3934 &temp); 3934 &temp);
3935 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; 3935 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
@@ -3962,9 +3962,9 @@ static int sctp_copy_laddrs_to_user(struct sock *sk, __u16 port,
3962 list_for_each(pos, &sctp_local_addr_list) { 3962 list_for_each(pos, &sctp_local_addr_list) {
3963 addr = list_entry(pos, struct sctp_sockaddr_entry, list); 3963 addr = list_entry(pos, struct sctp_sockaddr_entry, list);
3964 if ((PF_INET == sk->sk_family) && 3964 if ((PF_INET == sk->sk_family) &&
3965 (AF_INET6 == addr->a.sa.sa_family)) 3965 (AF_INET6 == addr->a_h.sa.sa_family))
3966 continue; 3966 continue;
3967 memcpy(&temp, &addr->a, sizeof(temp)); 3967 memcpy(&temp, &addr->a_h, sizeof(temp));
3968 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk), 3968 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk),
3969 &temp); 3969 &temp);
3970 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; 3970 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
@@ -4038,7 +4038,7 @@ static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len,
4038 if (sctp_list_single_entry(&bp->address_list)) { 4038 if (sctp_list_single_entry(&bp->address_list)) {
4039 addr = list_entry(bp->address_list.next, 4039 addr = list_entry(bp->address_list.next,
4040 struct sctp_sockaddr_entry, list); 4040 struct sctp_sockaddr_entry, list);
4041 if (sctp_is_any(&addr->a)) { 4041 if (sctp_is_any(&addr->a_h)) {
4042 cnt = sctp_copy_laddrs_to_user_old(sk, bp->port, 4042 cnt = sctp_copy_laddrs_to_user_old(sk, bp->port,
4043 getaddrs.addr_num, 4043 getaddrs.addr_num,
4044 to); 4044 to);
@@ -4052,7 +4052,7 @@ static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len,
4052 4052
4053 list_for_each(pos, &bp->address_list) { 4053 list_for_each(pos, &bp->address_list) {
4054 addr = list_entry(pos, struct sctp_sockaddr_entry, list); 4054 addr = list_entry(pos, struct sctp_sockaddr_entry, list);
4055 memcpy(&temp, &addr->a, sizeof(temp)); 4055 memcpy(&temp, &addr->a_h, sizeof(temp));
4056 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); 4056 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
4057 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; 4057 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
4058 temp.v4.sin_port = htons(temp.v4.sin_port); 4058 temp.v4.sin_port = htons(temp.v4.sin_port);
@@ -4128,7 +4128,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
4128 if (sctp_list_single_entry(&bp->address_list)) { 4128 if (sctp_list_single_entry(&bp->address_list)) {
4129 addr = list_entry(bp->address_list.next, 4129 addr = list_entry(bp->address_list.next,
4130 struct sctp_sockaddr_entry, list); 4130 struct sctp_sockaddr_entry, list);
4131 if (sctp_is_any(&addr->a)) { 4131 if (sctp_is_any(&addr->a_h)) {
4132 cnt = sctp_copy_laddrs_to_user(sk, bp->port, 4132 cnt = sctp_copy_laddrs_to_user(sk, bp->port,
4133 &to, space_left); 4133 &to, space_left);
4134 if (cnt < 0) { 4134 if (cnt < 0) {
@@ -4141,7 +4141,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
4141 4141
4142 list_for_each(pos, &bp->address_list) { 4142 list_for_each(pos, &bp->address_list) {
4143 addr = list_entry(pos, struct sctp_sockaddr_entry, list); 4143 addr = list_entry(pos, struct sctp_sockaddr_entry, list);
4144 memcpy(&temp, &addr->a, sizeof(temp)); 4144 memcpy(&temp, &addr->a_h, sizeof(temp));
4145 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); 4145 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
4146 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; 4146 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
4147 if(space_left < addrlen) 4147 if(space_left < addrlen)
@@ -4195,7 +4195,7 @@ static int sctp_getsockopt_primary_addr(struct sock *sk, int len,
4195 return -ENOTCONN; 4195 return -ENOTCONN;
4196 4196
4197 flip_to_n((union sctp_addr *)&prim.ssp_addr, 4197 flip_to_n((union sctp_addr *)&prim.ssp_addr,
4198 &asoc->peer.primary_path->ipaddr); 4198 &asoc->peer.primary_path->ipaddr_h);
4199 4199
4200 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, 4200 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp,
4201 (union sctp_addr *)&prim.ssp_addr); 4201 (union sctp_addr *)&prim.ssp_addr);