]> err.no Git - linux-2.6/commitdiff
[SCTP]: Switch sctp_endpoint_is_match() to net-endian.
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 21 Nov 2006 01:08:09 +0000 (17:08 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:26:40 +0000 (21:26 -0800)
The only caller (__sctp_rcv_lookup_endpoint()) also switched,
its caller adjusted

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/endpointola.c
net/sctp/input.c

index 7c781d6636033a521eaeeb49b8b7325da0e9b43c..c543f3250645c432fccfb40076d529c2404f92df 100644 (file)
@@ -228,12 +228,10 @@ struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *ep,
                                               const union sctp_addr *laddr)
 {
        struct sctp_endpoint *retval;
-       union sctp_addr tmp;
-       flip_to_n(&tmp, laddr);
 
        sctp_read_lock(&ep->base.addr_lock);
-       if (ep->base.bind_addr.port == laddr->v4.sin_port) {
-               if (sctp_bind_addr_match(&ep->base.bind_addr, &tmp,
+       if (htons(ep->base.bind_addr.port) == laddr->v4.sin_port) {
+               if (sctp_bind_addr_match(&ep->base.bind_addr, laddr,
                                         sctp_sk(ep->base.sk))) {
                        retval = ep;
                        goto out;
index 6d82f400d13c47a36279f861cc2efed80d105254..1bb3f264da1f3f278e9835f6b133aa32ac7dfc7d 100644 (file)
@@ -127,6 +127,7 @@ int sctp_rcv(struct sk_buff *skb)
        struct sctphdr *sh;
        union sctp_addr src;
        union sctp_addr dest;
+       union sctp_addr tmp;
        int family;
        struct sctp_af *af;
 
@@ -180,8 +181,10 @@ int sctp_rcv(struct sk_buff *skb)
 
        asoc = __sctp_rcv_lookup(skb, &src, &dest, &transport);
 
+       flip_to_n(&tmp, &dest);
+
        if (!asoc)
-               ep = __sctp_rcv_lookup_endpoint(&dest);
+               ep = __sctp_rcv_lookup_endpoint(&tmp);
 
        /* Retrieve the common input handling substructure. */
        rcvr = asoc ? &asoc->base : &ep->base;
@@ -726,7 +729,7 @@ static struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *l
        struct sctp_endpoint *ep;
        int hash;
 
-       hash = sctp_ep_hashfn(laddr->v4.sin_port);
+       hash = sctp_ep_hashfn(ntohs(laddr->v4.sin_port));
        head = &sctp_ep_hashtable[hash];
        read_lock(&head->lock);
        for (epb = head->chain; epb; epb = epb->next) {