Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41806
b: refs/heads/master
c: 5f242a1
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro authored and David S. Miller committed Dec 3, 2006
1 parent 686b479 commit a1e4411
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c604e368a477ed1f7dd532605a8f1990d2b128ee
refs/heads/master: 5f242a13e8505e0f3efd3113da6e029f6e7dfa32
9 changes: 7 additions & 2 deletions trunk/net/sctp/associola.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,10 +666,13 @@ void sctp_assoc_del_peer(struct sctp_association *asoc,
struct list_head *pos;
struct list_head *temp;
struct sctp_transport *transport;
union sctp_addr tmp;

flip_to_n(&tmp, addr);

list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
transport = list_entry(pos, struct sctp_transport, transports);
if (sctp_cmp_addr_exact(addr, &transport->ipaddr_h)) {
if (sctp_cmp_addr_exact(&tmp, &transport->ipaddr)) {
/* Do book keeping for removing the peer and free it. */
sctp_assoc_rm_peer(asoc, transport);
break;
Expand All @@ -684,12 +687,14 @@ struct sctp_transport *sctp_assoc_lookup_paddr(
{
struct sctp_transport *t;
struct list_head *pos;
union sctp_addr tmp;

flip_to_n(&tmp, address);
/* Cycle through all transports searching for a peer address. */

list_for_each(pos, &asoc->peer.transport_addr_list) {
t = list_entry(pos, struct sctp_transport, transports);
if (sctp_cmp_addr_exact(address, &t->ipaddr_h))
if (sctp_cmp_addr_exact(&tmp, &t->ipaddr))
return t;
}

Expand Down
13 changes: 8 additions & 5 deletions trunk/net/sctp/bind_addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,13 @@ int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr)
{
struct list_head *pos, *temp;
struct sctp_sockaddr_entry *addr;
union sctp_addr tmp;

flip_to_n(&tmp, del_addr);

list_for_each_safe(pos, temp, &bp->address_list) {
addr = list_entry(pos, struct sctp_sockaddr_entry, list);
if (sctp_cmp_addr_exact(&addr->a_h, del_addr)) {
if (sctp_cmp_addr_exact(&addr->a, &tmp)) {
/* Found the exact match. */
list_del(pos);
kfree(addr);
Expand Down Expand Up @@ -304,10 +307,12 @@ int sctp_bind_addr_match(struct sctp_bind_addr *bp,
{
struct sctp_sockaddr_entry *laddr;
struct list_head *pos;
union sctp_addr tmp;

flip_to_n(&tmp, addr);
list_for_each(pos, &bp->address_list) {
laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
if (opt->pf->cmp_addr(&laddr->a_h, addr, opt))
if (opt->pf->cmp_addr(&laddr->a, &tmp, opt))
return 1;
}

Expand All @@ -334,14 +339,12 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp,

addr_buf = (union sctp_addr *)addrs;
for (i = 0; i < addrcnt; i++) {
union sctp_addr tmp;
addr = (union sctp_addr *)addr_buf;
af = sctp_get_af_specific(addr->v4.sin_family);
if (!af)
return NULL;
flip_to_h(&tmp, addr);

if (opt->pf->cmp_addr(&laddr->a_h, &tmp, opt))
if (opt->pf->cmp_addr(&laddr->a, addr, opt))
break;

addr_buf += af->sockaddr_len;
Expand Down
14 changes: 8 additions & 6 deletions trunk/net/sctp/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,17 @@ static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_commo
if (epb->type == SCTP_EP_TYPE_ASSOCIATION) {
asoc = sctp_assoc(epb);
peer = asoc->peer.primary_path;
primary = &peer->saddr_h;
primary = &peer->saddr;
}

list_for_each(pos, &epb->bind_addr.address_list) {
laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
addr = (union sctp_addr *)&laddr->a_h;
addr = &laddr->a;
af = sctp_get_af_specific(addr->sa.sa_family);
if (primary && af->cmp_addr(addr, primary)) {
seq_printf(seq, "*");
}
af->seq_dump_addr(seq, &laddr->a);
af->seq_dump_addr(seq, addr);
}
}

Expand All @@ -175,17 +175,19 @@ static void sctp_seq_dump_remote_addrs(struct seq_file *seq, struct sctp_associa
struct list_head *pos;
struct sctp_transport *transport;
union sctp_addr *addr, *primary;
union sctp_addr tmp;
struct sctp_af *af;

primary = &(assoc->peer.primary_addr);
flip_to_n(&tmp, primary);
list_for_each(pos, &assoc->peer.transport_addr_list) {
transport = list_entry(pos, struct sctp_transport, transports);
addr = (union sctp_addr *)&transport->ipaddr_h;
addr = &transport->ipaddr;
af = sctp_get_af_specific(addr->sa.sa_family);
if (af->cmp_addr(addr, primary)) {
if (af->cmp_addr(addr, &tmp)) {
seq_printf(seq, "*");
}
af->seq_dump_addr(seq, &transport->ipaddr);
af->seq_dump_addr(seq, addr);
}
}

Expand Down
4 changes: 3 additions & 1 deletion trunk/net/sctp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,12 +478,14 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
*/
sctp_read_lock(addr_lock);
list_for_each(pos, &bp->address_list) {
union sctp_addr tmp;
laddr = list_entry(pos, struct sctp_sockaddr_entry,
list);
if (!laddr->use_as_src)
continue;
sctp_v4_dst_saddr(&dst_saddr, dst, bp->port);
if (sctp_v4_cmp_addr(&dst_saddr, &laddr->a_h))
flip_to_n(&tmp, &dst_saddr);
if (sctp_v4_cmp_addr(&tmp, &laddr->a))
goto out_unlock;
}
sctp_read_unlock(addr_lock);
Expand Down
11 changes: 8 additions & 3 deletions trunk/net/sctp/sm_make_chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2414,7 +2414,8 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
union sctp_addr addr;
struct list_head *pos;
union sctp_addr_param *addr_param;

union sctp_addr tmp, tmp_addr;

addr_param = (union sctp_addr_param *)
((void *)asconf_param + sizeof(sctp_addip_param_t));

Expand All @@ -2423,6 +2424,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
return SCTP_ERROR_INV_PARAM;

af->from_addr_param(&addr, addr_param, asoc->peer.port, 0);
flip_to_n(&tmp_addr, &addr);
switch (asconf_param->param_hdr.type) {
case SCTP_PARAM_ADD_IP:
/* ADDIP 4.3 D9) If an endpoint receives an ADD IP address
Expand Down Expand Up @@ -2457,7 +2459,8 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
* an Error Cause TLV set to the new error code 'Request to
* Delete Source IP Address'
*/
if (sctp_cmp_addr_exact(sctp_source(asconf), &addr))
flip_to_n(&tmp, sctp_source(asconf));
if (sctp_cmp_addr_exact(&tmp, &tmp_addr))
return SCTP_ERROR_DEL_SRC_IP;

sctp_assoc_del_peer(asoc, &addr);
Expand Down Expand Up @@ -2581,21 +2584,23 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
struct sctp_transport *transport;
struct sctp_sockaddr_entry *saddr;
int retval = 0;
union sctp_addr tmp;

addr_param = (union sctp_addr_param *)
((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->from_addr_param(&addr, addr_param, bp->port, 0);
flip_to_n(&tmp, &addr);

switch (asconf_param->param_hdr.type) {
case SCTP_PARAM_ADD_IP:
sctp_local_bh_disable();
sctp_write_lock(&asoc->base.addr_lock);
list_for_each(pos, &bp->address_list) {
saddr = list_entry(pos, struct sctp_sockaddr_entry, list);
if (sctp_cmp_addr_exact(&saddr->a_h, &addr))
if (sctp_cmp_addr_exact(&saddr->a, &tmp))
saddr->use_as_src = 1;
}
sctp_write_unlock(&asoc->base.addr_lock);
Expand Down
6 changes: 4 additions & 2 deletions trunk/net/sctp/sm_sideeffect.c
Original file line number Diff line number Diff line change
Expand Up @@ -830,11 +830,13 @@ static void sctp_cmd_del_non_primary(struct sctp_association *asoc)
struct sctp_transport *t;
struct list_head *pos;
struct list_head *temp;
union sctp_addr tmp;
flip_to_n(&tmp, &asoc->peer.primary_addr);

list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
t = list_entry(pos, struct sctp_transport, transports);
if (!sctp_cmp_addr_exact(&t->ipaddr_h,
&asoc->peer.primary_addr)) {
if (!sctp_cmp_addr_exact(&t->ipaddr,
&tmp)) {
sctp_assoc_del_peer(asoc, &t->ipaddr_h);
}
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/sctp/sm_statefuns.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,8 +1167,8 @@ static int sctp_sf_check_restart_addrs(const struct sctp_association *new_asoc,
list_for_each(pos2, &asoc->peer.transport_addr_list) {
addr = list_entry(pos2, struct sctp_transport,
transports);
if (sctp_cmp_addr_exact(&new_addr->ipaddr_h,
&addr->ipaddr_h)) {
if (sctp_cmp_addr_exact(&new_addr->ipaddr,
&addr->ipaddr)) {
found = 1;
break;
}
Expand Down
5 changes: 1 addition & 4 deletions trunk/net/sctp/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,6 @@ static int sctp_send_asconf_del_ip(struct sock *sk,
struct sctp_bind_addr *bp;
struct sctp_chunk *chunk;
union sctp_addr *laddr;
union sctp_addr saveaddr;
void *addr_buf;
struct sctp_af *af;
struct list_head *pos, *pos1;
Expand Down Expand Up @@ -773,13 +772,11 @@ static int sctp_send_asconf_del_ip(struct sock *sk,
for (i = 0; i < addrcnt; i++) {
laddr = (union sctp_addr *)addr_buf;
af = sctp_get_af_specific(laddr->v4.sin_family);
memcpy(&saveaddr, laddr, af->sockaddr_len);
saveaddr.v4.sin_port = ntohs(saveaddr.v4.sin_port);
list_for_each(pos1, &bp->address_list) {
saddr = list_entry(pos1,
struct sctp_sockaddr_entry,
list);
if (sctp_cmp_addr_exact(&saddr->a_h, &saveaddr))
if (sctp_cmp_addr_exact(&saddr->a, laddr))
saddr->use_as_src = 0;
}
addr_buf += af->sockaddr_len;
Expand Down

0 comments on commit a1e4411

Please sign in to comment.