aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-20 20:05:23 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:26:32 -0500
commit5f242a13e8505e0f3efd3113da6e029f6e7dfa32 (patch)
tree5c9a7de99887bde11fd16e1bfaf2543b358f8727 /net
parentc604e368a477ed1f7dd532605a8f1990d2b128ee (diff)
[SCTP]: Switch ->cmp_addr() and sctp_cmp_addr_exact() to net-endian.
instances of ->cmp_addr() are fine with switching both arguments to net-endian; callers other than in sctp_cmp_addr_exact() (both as ->cmp_addr(...) and direct calls of instances) adjusted; sctp_cmp_addr_exact() switched to net-endian itself and adjustment is done in its callers 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/associola.c9
-rw-r--r--net/sctp/bind_addr.c13
-rw-r--r--net/sctp/proc.c14
-rw-r--r--net/sctp/protocol.c4
-rw-r--r--net/sctp/sm_make_chunk.c11
-rw-r--r--net/sctp/sm_sideeffect.c6
-rw-r--r--net/sctp/sm_statefuns.c4
-rw-r--r--net/sctp/socket.c5
8 files changed, 41 insertions, 25 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 83318e727905..72199d149573 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -666,10 +666,13 @@ void sctp_assoc_del_peer(struct sctp_association *asoc,
666 struct list_head *pos; 666 struct list_head *pos;
667 struct list_head *temp; 667 struct list_head *temp;
668 struct sctp_transport *transport; 668 struct sctp_transport *transport;
669 union sctp_addr tmp;
670
671 flip_to_n(&tmp, addr);
669 672
670 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { 673 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
671 transport = list_entry(pos, struct sctp_transport, transports); 674 transport = list_entry(pos, struct sctp_transport, transports);
672 if (sctp_cmp_addr_exact(addr, &transport->ipaddr_h)) { 675 if (sctp_cmp_addr_exact(&tmp, &transport->ipaddr)) {
673 /* Do book keeping for removing the peer and free it. */ 676 /* Do book keeping for removing the peer and free it. */
674 sctp_assoc_rm_peer(asoc, transport); 677 sctp_assoc_rm_peer(asoc, transport);
675 break; 678 break;
@@ -684,12 +687,14 @@ struct sctp_transport *sctp_assoc_lookup_paddr(
684{ 687{
685 struct sctp_transport *t; 688 struct sctp_transport *t;
686 struct list_head *pos; 689 struct list_head *pos;
690 union sctp_addr tmp;
687 691
692 flip_to_n(&tmp, address);
688 /* Cycle through all transports searching for a peer address. */ 693 /* Cycle through all transports searching for a peer address. */
689 694
690 list_for_each(pos, &asoc->peer.transport_addr_list) { 695 list_for_each(pos, &asoc->peer.transport_addr_list) {
691 t = list_entry(pos, struct sctp_transport, transports); 696 t = list_entry(pos, struct sctp_transport, transports);
692 if (sctp_cmp_addr_exact(address, &t->ipaddr_h)) 697 if (sctp_cmp_addr_exact(&tmp, &t->ipaddr))
693 return t; 698 return t;
694 } 699 }
695 700
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index 2b36e4238170..9085e531d575 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -181,10 +181,13 @@ int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr)
181{ 181{
182 struct list_head *pos, *temp; 182 struct list_head *pos, *temp;
183 struct sctp_sockaddr_entry *addr; 183 struct sctp_sockaddr_entry *addr;
184 union sctp_addr tmp;
185
186 flip_to_n(&tmp, del_addr);
184 187
185 list_for_each_safe(pos, temp, &bp->address_list) { 188 list_for_each_safe(pos, temp, &bp->address_list) {
186 addr = list_entry(pos, struct sctp_sockaddr_entry, list); 189 addr = list_entry(pos, struct sctp_sockaddr_entry, list);
187 if (sctp_cmp_addr_exact(&addr->a_h, del_addr)) { 190 if (sctp_cmp_addr_exact(&addr->a, &tmp)) {
188 /* Found the exact match. */ 191 /* Found the exact match. */
189 list_del(pos); 192 list_del(pos);
190 kfree(addr); 193 kfree(addr);
@@ -304,10 +307,12 @@ int sctp_bind_addr_match(struct sctp_bind_addr *bp,
304{ 307{
305 struct sctp_sockaddr_entry *laddr; 308 struct sctp_sockaddr_entry *laddr;
306 struct list_head *pos; 309 struct list_head *pos;
310 union sctp_addr tmp;
307 311
312 flip_to_n(&tmp, addr);
308 list_for_each(pos, &bp->address_list) { 313 list_for_each(pos, &bp->address_list) {
309 laddr = list_entry(pos, struct sctp_sockaddr_entry, list); 314 laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
310 if (opt->pf->cmp_addr(&laddr->a_h, addr, opt)) 315 if (opt->pf->cmp_addr(&laddr->a, &tmp, opt))
311 return 1; 316 return 1;
312 } 317 }
313 318
@@ -334,14 +339,12 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp,
334 339
335 addr_buf = (union sctp_addr *)addrs; 340 addr_buf = (union sctp_addr *)addrs;
336 for (i = 0; i < addrcnt; i++) { 341 for (i = 0; i < addrcnt; i++) {
337 union sctp_addr tmp;
338 addr = (union sctp_addr *)addr_buf; 342 addr = (union sctp_addr *)addr_buf;
339 af = sctp_get_af_specific(addr->v4.sin_family); 343 af = sctp_get_af_specific(addr->v4.sin_family);
340 if (!af) 344 if (!af)
341 return NULL; 345 return NULL;
342 flip_to_h(&tmp, addr);
343 346
344 if (opt->pf->cmp_addr(&laddr->a_h, &tmp, opt)) 347 if (opt->pf->cmp_addr(&laddr->a, addr, opt))
345 break; 348 break;
346 349
347 addr_buf += af->sockaddr_len; 350 addr_buf += af->sockaddr_len;
diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index bf0144ed3e3a..04faa4a706d4 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -155,17 +155,17 @@ static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_commo
155 if (epb->type == SCTP_EP_TYPE_ASSOCIATION) { 155 if (epb->type == SCTP_EP_TYPE_ASSOCIATION) {
156 asoc = sctp_assoc(epb); 156 asoc = sctp_assoc(epb);
157 peer = asoc->peer.primary_path; 157 peer = asoc->peer.primary_path;
158 primary = &peer->saddr_h; 158 primary = &peer->saddr;
159 } 159 }
160 160
161 list_for_each(pos, &epb->bind_addr.address_list) { 161 list_for_each(pos, &epb->bind_addr.address_list) {
162 laddr = list_entry(pos, struct sctp_sockaddr_entry, list); 162 laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
163 addr = (union sctp_addr *)&laddr->a_h; 163 addr = &laddr->a;
164 af = sctp_get_af_specific(addr->sa.sa_family); 164 af = sctp_get_af_specific(addr->sa.sa_family);
165 if (primary && af->cmp_addr(addr, primary)) { 165 if (primary && af->cmp_addr(addr, primary)) {
166 seq_printf(seq, "*"); 166 seq_printf(seq, "*");
167 } 167 }
168 af->seq_dump_addr(seq, &laddr->a); 168 af->seq_dump_addr(seq, addr);
169 } 169 }
170} 170}
171 171
@@ -175,17 +175,19 @@ static void sctp_seq_dump_remote_addrs(struct seq_file *seq, struct sctp_associa
175 struct list_head *pos; 175 struct list_head *pos;
176 struct sctp_transport *transport; 176 struct sctp_transport *transport;
177 union sctp_addr *addr, *primary; 177 union sctp_addr *addr, *primary;
178 union sctp_addr tmp;
178 struct sctp_af *af; 179 struct sctp_af *af;
179 180
180 primary = &(assoc->peer.primary_addr); 181 primary = &(assoc->peer.primary_addr);
182 flip_to_n(&tmp, primary);
181 list_for_each(pos, &assoc->peer.transport_addr_list) { 183 list_for_each(pos, &assoc->peer.transport_addr_list) {
182 transport = list_entry(pos, struct sctp_transport, transports); 184 transport = list_entry(pos, struct sctp_transport, transports);
183 addr = (union sctp_addr *)&transport->ipaddr_h; 185 addr = &transport->ipaddr;
184 af = sctp_get_af_specific(addr->sa.sa_family); 186 af = sctp_get_af_specific(addr->sa.sa_family);
185 if (af->cmp_addr(addr, primary)) { 187 if (af->cmp_addr(addr, &tmp)) {
186 seq_printf(seq, "*"); 188 seq_printf(seq, "*");
187 } 189 }
188 af->seq_dump_addr(seq, &transport->ipaddr); 190 af->seq_dump_addr(seq, addr);
189 } 191 }
190} 192}
191 193
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 363274045032..2db140e901d0 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -478,12 +478,14 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
478 */ 478 */
479 sctp_read_lock(addr_lock); 479 sctp_read_lock(addr_lock);
480 list_for_each(pos, &bp->address_list) { 480 list_for_each(pos, &bp->address_list) {
481 union sctp_addr tmp;
481 laddr = list_entry(pos, struct sctp_sockaddr_entry, 482 laddr = list_entry(pos, struct sctp_sockaddr_entry,
482 list); 483 list);
483 if (!laddr->use_as_src) 484 if (!laddr->use_as_src)
484 continue; 485 continue;
485 sctp_v4_dst_saddr(&dst_saddr, dst, bp->port); 486 sctp_v4_dst_saddr(&dst_saddr, dst, bp->port);
486 if (sctp_v4_cmp_addr(&dst_saddr, &laddr->a_h)) 487 flip_to_n(&tmp, &dst_saddr);
488 if (sctp_v4_cmp_addr(&tmp, &laddr->a))
487 goto out_unlock; 489 goto out_unlock;
488 } 490 }
489 sctp_read_unlock(addr_lock); 491 sctp_read_unlock(addr_lock);
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index b8e0f72b319f..ee907ea7eed1 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2414,7 +2414,8 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
2414 union sctp_addr addr; 2414 union sctp_addr addr;
2415 struct list_head *pos; 2415 struct list_head *pos;
2416 union sctp_addr_param *addr_param; 2416 union sctp_addr_param *addr_param;
2417 2417 union sctp_addr tmp, tmp_addr;
2418
2418 addr_param = (union sctp_addr_param *) 2419 addr_param = (union sctp_addr_param *)
2419 ((void *)asconf_param + sizeof(sctp_addip_param_t)); 2420 ((void *)asconf_param + sizeof(sctp_addip_param_t));
2420 2421
@@ -2423,6 +2424,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
2423 return SCTP_ERROR_INV_PARAM; 2424 return SCTP_ERROR_INV_PARAM;
2424 2425
2425 af->from_addr_param(&addr, addr_param, asoc->peer.port, 0); 2426 af->from_addr_param(&addr, addr_param, asoc->peer.port, 0);
2427 flip_to_n(&tmp_addr, &addr);
2426 switch (asconf_param->param_hdr.type) { 2428 switch (asconf_param->param_hdr.type) {
2427 case SCTP_PARAM_ADD_IP: 2429 case SCTP_PARAM_ADD_IP:
2428 /* ADDIP 4.3 D9) If an endpoint receives an ADD IP address 2430 /* ADDIP 4.3 D9) If an endpoint receives an ADD IP address
@@ -2457,7 +2459,8 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
2457 * an Error Cause TLV set to the new error code 'Request to 2459 * an Error Cause TLV set to the new error code 'Request to
2458 * Delete Source IP Address' 2460 * Delete Source IP Address'
2459 */ 2461 */
2460 if (sctp_cmp_addr_exact(sctp_source(asconf), &addr)) 2462 flip_to_n(&tmp, sctp_source(asconf));
2463 if (sctp_cmp_addr_exact(&tmp, &tmp_addr))
2461 return SCTP_ERROR_DEL_SRC_IP; 2464 return SCTP_ERROR_DEL_SRC_IP;
2462 2465
2463 sctp_assoc_del_peer(asoc, &addr); 2466 sctp_assoc_del_peer(asoc, &addr);
@@ -2581,6 +2584,7 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
2581 struct sctp_transport *transport; 2584 struct sctp_transport *transport;
2582 struct sctp_sockaddr_entry *saddr; 2585 struct sctp_sockaddr_entry *saddr;
2583 int retval = 0; 2586 int retval = 0;
2587 union sctp_addr tmp;
2584 2588
2585 addr_param = (union sctp_addr_param *) 2589 addr_param = (union sctp_addr_param *)
2586 ((void *)asconf_param + sizeof(sctp_addip_param_t)); 2590 ((void *)asconf_param + sizeof(sctp_addip_param_t));
@@ -2588,6 +2592,7 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
2588 /* We have checked the packet before, so we do not check again. */ 2592 /* We have checked the packet before, so we do not check again. */
2589 af = sctp_get_af_specific(param_type2af(addr_param->v4.param_hdr.type)); 2593 af = sctp_get_af_specific(param_type2af(addr_param->v4.param_hdr.type));
2590 af->from_addr_param(&addr, addr_param, bp->port, 0); 2594 af->from_addr_param(&addr, addr_param, bp->port, 0);
2595 flip_to_n(&tmp, &addr);
2591 2596
2592 switch (asconf_param->param_hdr.type) { 2597 switch (asconf_param->param_hdr.type) {
2593 case SCTP_PARAM_ADD_IP: 2598 case SCTP_PARAM_ADD_IP:
@@ -2595,7 +2600,7 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
2595 sctp_write_lock(&asoc->base.addr_lock); 2600 sctp_write_lock(&asoc->base.addr_lock);
2596 list_for_each(pos, &bp->address_list) { 2601 list_for_each(pos, &bp->address_list) {
2597 saddr = list_entry(pos, struct sctp_sockaddr_entry, list); 2602 saddr = list_entry(pos, struct sctp_sockaddr_entry, list);
2598 if (sctp_cmp_addr_exact(&saddr->a_h, &addr)) 2603 if (sctp_cmp_addr_exact(&saddr->a, &tmp))
2599 saddr->use_as_src = 1; 2604 saddr->use_as_src = 1;
2600 } 2605 }
2601 sctp_write_unlock(&asoc->base.addr_lock); 2606 sctp_write_unlock(&asoc->base.addr_lock);
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index e1c5cddf32da..3d9213dfaa10 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -830,11 +830,13 @@ static void sctp_cmd_del_non_primary(struct sctp_association *asoc)
830 struct sctp_transport *t; 830 struct sctp_transport *t;
831 struct list_head *pos; 831 struct list_head *pos;
832 struct list_head *temp; 832 struct list_head *temp;
833 union sctp_addr tmp;
834 flip_to_n(&tmp, &asoc->peer.primary_addr);
833 835
834 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { 836 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
835 t = list_entry(pos, struct sctp_transport, transports); 837 t = list_entry(pos, struct sctp_transport, transports);
836 if (!sctp_cmp_addr_exact(&t->ipaddr_h, 838 if (!sctp_cmp_addr_exact(&t->ipaddr,
837 &asoc->peer.primary_addr)) { 839 &tmp)) {
838 sctp_assoc_del_peer(asoc, &t->ipaddr_h); 840 sctp_assoc_del_peer(asoc, &t->ipaddr_h);
839 } 841 }
840 } 842 }
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index f46072767549..ac776fd20667 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1167,8 +1167,8 @@ static int sctp_sf_check_restart_addrs(const struct sctp_association *new_asoc,
1167 list_for_each(pos2, &asoc->peer.transport_addr_list) { 1167 list_for_each(pos2, &asoc->peer.transport_addr_list) {
1168 addr = list_entry(pos2, struct sctp_transport, 1168 addr = list_entry(pos2, struct sctp_transport,
1169 transports); 1169 transports);
1170 if (sctp_cmp_addr_exact(&new_addr->ipaddr_h, 1170 if (sctp_cmp_addr_exact(&new_addr->ipaddr,
1171 &addr->ipaddr_h)) { 1171 &addr->ipaddr)) {
1172 found = 1; 1172 found = 1;
1173 break; 1173 break;
1174 } 1174 }
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 459f32c5c3ae..e03ba9055eb1 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -693,7 +693,6 @@ static int sctp_send_asconf_del_ip(struct sock *sk,
693 struct sctp_bind_addr *bp; 693 struct sctp_bind_addr *bp;
694 struct sctp_chunk *chunk; 694 struct sctp_chunk *chunk;
695 union sctp_addr *laddr; 695 union sctp_addr *laddr;
696 union sctp_addr saveaddr;
697 void *addr_buf; 696 void *addr_buf;
698 struct sctp_af *af; 697 struct sctp_af *af;
699 struct list_head *pos, *pos1; 698 struct list_head *pos, *pos1;
@@ -773,13 +772,11 @@ static int sctp_send_asconf_del_ip(struct sock *sk,
773 for (i = 0; i < addrcnt; i++) { 772 for (i = 0; i < addrcnt; i++) {
774 laddr = (union sctp_addr *)addr_buf; 773 laddr = (union sctp_addr *)addr_buf;
775 af = sctp_get_af_specific(laddr->v4.sin_family); 774 af = sctp_get_af_specific(laddr->v4.sin_family);
776 memcpy(&saveaddr, laddr, af->sockaddr_len);
777 saveaddr.v4.sin_port = ntohs(saveaddr.v4.sin_port);
778 list_for_each(pos1, &bp->address_list) { 775 list_for_each(pos1, &bp->address_list) {
779 saddr = list_entry(pos1, 776 saddr = list_entry(pos1,
780 struct sctp_sockaddr_entry, 777 struct sctp_sockaddr_entry,
781 list); 778 list);
782 if (sctp_cmp_addr_exact(&saddr->a_h, &saveaddr)) 779 if (sctp_cmp_addr_exact(&saddr->a, laddr))
783 saddr->use_as_src = 0; 780 saddr->use_as_src = 0;
784 } 781 }
785 addr_buf += af->sockaddr_len; 782 addr_buf += af->sockaddr_len;