diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-20 20:21:44 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:26:58 -0500 |
commit | 6244be4e063075f6077f05e70f8fa1bf7f4a968e (patch) | |
tree | 618083b6a1fe5cee3e46d3e75746d81c6ad2d39e /net | |
parent | 80f15d62418040e78849f5fc3a4a5af9c9d1fec7 (diff) |
[SCTP]: Trivial parts of a_h -> a switch.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/sctp/bind_addr.c | 4 | ||||
-rw-r--r-- | net/sctp/ipv6.c | 4 | ||||
-rw-r--r-- | net/sctp/protocol.c | 10 | ||||
-rw-r--r-- | net/sctp/socket.c | 24 |
4 files changed, 19 insertions, 23 deletions
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c index 50f3697625fd..f201df66180d 100644 --- a/net/sctp/bind_addr.c +++ b/net/sctp/bind_addr.c | |||
@@ -239,8 +239,8 @@ union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp, | |||
239 | 239 | ||
240 | list_for_each(pos, &bp->address_list) { | 240 | list_for_each(pos, &bp->address_list) { |
241 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); | 241 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); |
242 | af = sctp_get_af_specific(addr->a_h.v4.sin_family); | 242 | af = sctp_get_af_specific(addr->a.v4.sin_family); |
243 | len = af->to_addr_param(&addr->a_h, &rawaddr); | 243 | len = af->to_addr_param(&addr->a, &rawaddr); |
244 | memcpy(addrparms.v, &rawaddr, len); | 244 | memcpy(addrparms.v, &rawaddr, len); |
245 | addrparms.v += len; | 245 | addrparms.v += len; |
246 | addrparms_len += len; | 246 | addrparms_len += len; |
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 3dc8ed143521..b3fa426bd1dc 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -290,8 +290,8 @@ static void sctp_v6_get_saddr(struct sctp_association *asoc, | |||
290 | list_for_each(pos, &bp->address_list) { | 290 | list_for_each(pos, &bp->address_list) { |
291 | laddr = list_entry(pos, struct sctp_sockaddr_entry, list); | 291 | laddr = list_entry(pos, struct sctp_sockaddr_entry, list); |
292 | if ((laddr->use_as_src) && | 292 | if ((laddr->use_as_src) && |
293 | (laddr->a_h.sa.sa_family == AF_INET6) && | 293 | (laddr->a.sa.sa_family == AF_INET6) && |
294 | (scope <= sctp_scope(&laddr->a_h))) { | 294 | (scope <= sctp_scope(&laddr->a))) { |
295 | bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a); | 295 | bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a); |
296 | if (!baddr || (matchlen < bmatchlen)) { | 296 | if (!baddr || (matchlen < bmatchlen)) { |
297 | baddr = &laddr->a; | 297 | baddr = &laddr->a; |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 5b8b7f3598e0..c20f05b3308f 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -224,14 +224,14 @@ int sctp_copy_local_addr_list(struct sctp_bind_addr *bp, sctp_scope_t scope, | |||
224 | sctp_spin_lock_irqsave(&sctp_local_addr_lock, flags); | 224 | sctp_spin_lock_irqsave(&sctp_local_addr_lock, flags); |
225 | list_for_each(pos, &sctp_local_addr_list) { | 225 | list_for_each(pos, &sctp_local_addr_list) { |
226 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); | 226 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); |
227 | if (sctp_in_scope(&addr->a_h, scope)) { | 227 | if (sctp_in_scope(&addr->a, scope)) { |
228 | /* Now that the address is in scope, check to see if | 228 | /* Now that the address is in scope, check to see if |
229 | * the address type is really supported by the local | 229 | * the address type is really supported by the local |
230 | * sock as well as the remote peer. | 230 | * sock as well as the remote peer. |
231 | */ | 231 | */ |
232 | if ((((AF_INET == addr->a_h.sa.sa_family) && | 232 | if ((((AF_INET == addr->a.sa.sa_family) && |
233 | (copy_flags & SCTP_ADDR4_PEERSUPP))) || | 233 | (copy_flags & SCTP_ADDR4_PEERSUPP))) || |
234 | (((AF_INET6 == addr->a_h.sa.sa_family) && | 234 | (((AF_INET6 == addr->a.sa.sa_family) && |
235 | (copy_flags & SCTP_ADDR6_ALLOWED) && | 235 | (copy_flags & SCTP_ADDR6_ALLOWED) && |
236 | (copy_flags & SCTP_ADDR6_PEERSUPP)))) { | 236 | (copy_flags & SCTP_ADDR6_PEERSUPP)))) { |
237 | error = sctp_add_bind_addr(bp, &addr->a, 1, | 237 | error = sctp_add_bind_addr(bp, &addr->a, 1, |
@@ -503,8 +503,8 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc, | |||
503 | laddr = list_entry(pos, struct sctp_sockaddr_entry, list); | 503 | laddr = list_entry(pos, struct sctp_sockaddr_entry, list); |
504 | 504 | ||
505 | if ((laddr->use_as_src) && | 505 | if ((laddr->use_as_src) && |
506 | (AF_INET == laddr->a_h.sa.sa_family)) { | 506 | (AF_INET == laddr->a.sa.sa_family)) { |
507 | fl.fl4_src = laddr->a_h.v4.sin_addr.s_addr; | 507 | fl.fl4_src = laddr->a.v4.sin_addr.s_addr; |
508 | if (!ip_route_output_key(&rt, &fl)) { | 508 | if (!ip_route_output_key(&rt, &fl)) { |
509 | dst = &rt->u.dst; | 509 | dst = &rt->u.dst; |
510 | goto out_unlock; | 510 | goto out_unlock; |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index e118e3c1285e..a3e1ca2c3cb7 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -3867,14 +3867,14 @@ static int sctp_getsockopt_local_addrs_num_old(struct sock *sk, int len, | |||
3867 | if (sctp_list_single_entry(&bp->address_list)) { | 3867 | if (sctp_list_single_entry(&bp->address_list)) { |
3868 | addr = list_entry(bp->address_list.next, | 3868 | addr = list_entry(bp->address_list.next, |
3869 | struct sctp_sockaddr_entry, list); | 3869 | struct sctp_sockaddr_entry, list); |
3870 | if (sctp_is_any(&addr->a_h)) { | 3870 | if (sctp_is_any(&addr->a)) { |
3871 | sctp_spin_lock_irqsave(&sctp_local_addr_lock, flags); | 3871 | sctp_spin_lock_irqsave(&sctp_local_addr_lock, flags); |
3872 | list_for_each(pos, &sctp_local_addr_list) { | 3872 | list_for_each(pos, &sctp_local_addr_list) { |
3873 | addr = list_entry(pos, | 3873 | addr = list_entry(pos, |
3874 | struct sctp_sockaddr_entry, | 3874 | struct sctp_sockaddr_entry, |
3875 | list); | 3875 | list); |
3876 | if ((PF_INET == sk->sk_family) && | 3876 | if ((PF_INET == sk->sk_family) && |
3877 | (AF_INET6 == addr->a_h.sa.sa_family)) | 3877 | (AF_INET6 == addr->a.sa.sa_family)) |
3878 | continue; | 3878 | continue; |
3879 | cnt++; | 3879 | cnt++; |
3880 | } | 3880 | } |
@@ -3912,13 +3912,12 @@ static int sctp_copy_laddrs_to_user_old(struct sock *sk, __u16 port, int max_add | |||
3912 | list_for_each(pos, &sctp_local_addr_list) { | 3912 | list_for_each(pos, &sctp_local_addr_list) { |
3913 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); | 3913 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); |
3914 | if ((PF_INET == sk->sk_family) && | 3914 | if ((PF_INET == sk->sk_family) && |
3915 | (AF_INET6 == addr->a_h.sa.sa_family)) | 3915 | (AF_INET6 == addr->a.sa.sa_family)) |
3916 | continue; | 3916 | continue; |
3917 | memcpy(&temp, &addr->a_h, sizeof(temp)); | 3917 | memcpy(&temp, &addr->a, sizeof(temp)); |
3918 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk), | 3918 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk), |
3919 | &temp); | 3919 | &temp); |
3920 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; | 3920 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; |
3921 | temp.v4.sin_port = htons(port); | ||
3922 | if (copy_to_user(to, &temp, addrlen)) { | 3921 | if (copy_to_user(to, &temp, addrlen)) { |
3923 | sctp_spin_unlock_irqrestore(&sctp_local_addr_lock, | 3922 | sctp_spin_unlock_irqrestore(&sctp_local_addr_lock, |
3924 | flags); | 3923 | flags); |
@@ -3947,15 +3946,14 @@ static int sctp_copy_laddrs_to_user(struct sock *sk, __u16 port, | |||
3947 | list_for_each(pos, &sctp_local_addr_list) { | 3946 | list_for_each(pos, &sctp_local_addr_list) { |
3948 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); | 3947 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); |
3949 | if ((PF_INET == sk->sk_family) && | 3948 | if ((PF_INET == sk->sk_family) && |
3950 | (AF_INET6 == addr->a_h.sa.sa_family)) | 3949 | (AF_INET6 == addr->a.sa.sa_family)) |
3951 | continue; | 3950 | continue; |
3952 | memcpy(&temp, &addr->a_h, sizeof(temp)); | 3951 | memcpy(&temp, &addr->a, sizeof(temp)); |
3953 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk), | 3952 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk), |
3954 | &temp); | 3953 | &temp); |
3955 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; | 3954 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; |
3956 | if(space_left<addrlen) | 3955 | if(space_left<addrlen) |
3957 | return -ENOMEM; | 3956 | return -ENOMEM; |
3958 | temp.v4.sin_port = htons(port); | ||
3959 | if (copy_to_user(*to, &temp, addrlen)) { | 3957 | if (copy_to_user(*to, &temp, addrlen)) { |
3960 | sctp_spin_unlock_irqrestore(&sctp_local_addr_lock, | 3958 | sctp_spin_unlock_irqrestore(&sctp_local_addr_lock, |
3961 | flags); | 3959 | flags); |
@@ -4023,7 +4021,7 @@ static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len, | |||
4023 | if (sctp_list_single_entry(&bp->address_list)) { | 4021 | if (sctp_list_single_entry(&bp->address_list)) { |
4024 | addr = list_entry(bp->address_list.next, | 4022 | addr = list_entry(bp->address_list.next, |
4025 | struct sctp_sockaddr_entry, list); | 4023 | struct sctp_sockaddr_entry, list); |
4026 | if (sctp_is_any(&addr->a_h)) { | 4024 | if (sctp_is_any(&addr->a)) { |
4027 | cnt = sctp_copy_laddrs_to_user_old(sk, bp->port, | 4025 | cnt = sctp_copy_laddrs_to_user_old(sk, bp->port, |
4028 | getaddrs.addr_num, | 4026 | getaddrs.addr_num, |
4029 | to); | 4027 | to); |
@@ -4037,10 +4035,9 @@ static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len, | |||
4037 | 4035 | ||
4038 | list_for_each(pos, &bp->address_list) { | 4036 | list_for_each(pos, &bp->address_list) { |
4039 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); | 4037 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); |
4040 | memcpy(&temp, &addr->a_h, sizeof(temp)); | 4038 | memcpy(&temp, &addr->a, sizeof(temp)); |
4041 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); | 4039 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); |
4042 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; | 4040 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; |
4043 | temp.v4.sin_port = htons(temp.v4.sin_port); | ||
4044 | if (copy_to_user(to, &temp, addrlen)) { | 4041 | if (copy_to_user(to, &temp, addrlen)) { |
4045 | err = -EFAULT; | 4042 | err = -EFAULT; |
4046 | goto unlock; | 4043 | goto unlock; |
@@ -4113,7 +4110,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, | |||
4113 | if (sctp_list_single_entry(&bp->address_list)) { | 4110 | if (sctp_list_single_entry(&bp->address_list)) { |
4114 | addr = list_entry(bp->address_list.next, | 4111 | addr = list_entry(bp->address_list.next, |
4115 | struct sctp_sockaddr_entry, list); | 4112 | struct sctp_sockaddr_entry, list); |
4116 | if (sctp_is_any(&addr->a_h)) { | 4113 | if (sctp_is_any(&addr->a)) { |
4117 | cnt = sctp_copy_laddrs_to_user(sk, bp->port, | 4114 | cnt = sctp_copy_laddrs_to_user(sk, bp->port, |
4118 | &to, space_left); | 4115 | &to, space_left); |
4119 | if (cnt < 0) { | 4116 | if (cnt < 0) { |
@@ -4126,12 +4123,11 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, | |||
4126 | 4123 | ||
4127 | list_for_each(pos, &bp->address_list) { | 4124 | list_for_each(pos, &bp->address_list) { |
4128 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); | 4125 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); |
4129 | memcpy(&temp, &addr->a_h, sizeof(temp)); | 4126 | memcpy(&temp, &addr->a, sizeof(temp)); |
4130 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); | 4127 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); |
4131 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; | 4128 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; |
4132 | if(space_left < addrlen) | 4129 | if(space_left < addrlen) |
4133 | return -ENOMEM; /*fixme: right error?*/ | 4130 | return -ENOMEM; /*fixme: right error?*/ |
4134 | temp.v4.sin_port = htons(temp.v4.sin_port); | ||
4135 | if (copy_to_user(to, &temp, addrlen)) { | 4131 | if (copy_to_user(to, &temp, addrlen)) { |
4136 | err = -EFAULT; | 4132 | err = -EFAULT; |
4137 | goto unlock; | 4133 | goto unlock; |