From d448388bdaca946aa2b07973cb72a9b834e530bf Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 20 Nov 2006 17:13:21 -0800 Subject: [SCTP]: sctp_transport_route() switched to net-endian. Signed-off-by: Al Viro Signed-off-by: David S. Miller --- net/sctp/sm_statefuns.c | 4 +++- net/sctp/transport.c | 14 +++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'net/sctp') diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 0848309773a..42377f75ee1 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c @@ -5103,6 +5103,7 @@ static struct sctp_packet *sctp_ootb_pkt_new(const struct sctp_association *asoc __u16 sport; __u16 dport; __u32 vtag; + union sctp_addr tmp; /* Get the source and destination port from the inbound packet. */ sport = ntohs(chunk->sctp_hdr->dest); @@ -5140,7 +5141,8 @@ static struct sctp_packet *sctp_ootb_pkt_new(const struct sctp_association *asoc /* Cache a route for the transport with the chunk's destination as * the source address. */ - sctp_transport_route(transport, (union sctp_addr *)&chunk->dest, + flip_to_n(&tmp, &chunk->dest); + sctp_transport_route(transport, &tmp, sctp_sk(sctp_get_ctl_sock())); packet = sctp_packet_init(&transport->packet, transport, sport, dport); diff --git a/net/sctp/transport.c b/net/sctp/transport.c index 33e7d85f111..d1b6834a3a4 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c @@ -253,19 +253,15 @@ void sctp_transport_route(struct sctp_transport *transport, struct sctp_af *af = transport->af_specific; union sctp_addr *daddr = &transport->ipaddr; struct dst_entry *dst; - union sctp_addr tmp; - flip_to_n(&tmp, saddr); - dst = af->get_dst(asoc, daddr, &tmp); + dst = af->get_dst(asoc, daddr, saddr); - if (saddr) { - memcpy(&transport->saddr_h, saddr, sizeof(union sctp_addr)); - flip_to_n(&transport->saddr, &transport->saddr_h); - } else { + if (saddr) + memcpy(&transport->saddr, saddr, sizeof(union sctp_addr)); + else af->get_saddr(asoc, dst, daddr, &transport->saddr); - flip_to_h(&transport->saddr_h, &transport->saddr); - } + flip_to_h(&transport->saddr_h, &transport->saddr); transport->dst = dst; if ((transport->param_flags & SPP_PMTUD_DISABLE) && transport->pathmtu) { return; -- cgit v1.2.3