[SCTP]: ->get_saddr() switched to net-endian.
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 21 Nov 2006 01:12:41 +0000 (17:12 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:26:52 +0000 (21:26 -0800)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/ipv6.c
net/sctp/protocol.c
net/sctp/transport.c

index 566cdc9977c48878c7621db43b9141c14d1ee34b..7f4c5bafea14baed0fe29487940e7193690112ec 100644 (file)
@@ -292,9 +292,9 @@ static void sctp_v6_get_saddr(struct sctp_association *asoc,
                if ((laddr->use_as_src) &&
                    (laddr->a_h.sa.sa_family == AF_INET6) &&
                    (scope <= sctp_scope(&laddr->a_h))) {
-                       bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a_h);
+                       bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a);
                        if (!baddr || (matchlen < bmatchlen)) {
-                               baddr = &laddr->a_h;
+                               baddr = &laddr->a;
                                matchlen = bmatchlen;
                        }
                }
index 87d36f440d1daff283681080748147365461dff3..5b8b7f3598e09f1ce200de50050548f9304bf47a 100644 (file)
@@ -539,7 +539,7 @@ static void sctp_v4_get_saddr(struct sctp_association *asoc,
 
        if (rt) {
                saddr->v4.sin_family = AF_INET;
-               saddr->v4.sin_port = asoc->base.bind_addr.port;  
+               saddr->v4.sin_port = htons(asoc->base.bind_addr.port);
                saddr->v4.sin_addr.s_addr = rt->rt_src; 
        }
 }
index e1448addcd93877118c34e10259086aa416b183f..74faa1b6dbfe3572b397eccdce4d19b3cf82a400 100644 (file)
@@ -256,11 +256,13 @@ void sctp_transport_route(struct sctp_transport *transport,
 
        dst = af->get_dst(asoc, daddr, saddr);
 
-       if (saddr)
+       if (saddr) {
                memcpy(&transport->saddr_h, saddr, sizeof(union sctp_addr));
-       else
-               af->get_saddr(asoc, dst, daddr, &transport->saddr_h);
-       flip_to_n(&transport->saddr, &transport->saddr_h);
+               flip_to_n(&transport->saddr, &transport->saddr_h);
+       } else {
+               af->get_saddr(asoc, dst, &transport->ipaddr, &transport->saddr);
+               flip_to_h(&transport->saddr_h, &transport->saddr);
+       }
 
        transport->dst = dst;
        if ((transport->param_flags & SPP_PMTUD_DISABLE) && transport->pathmtu) {