Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d55c41b1 authored by Al Viro's avatar Al Viro Committed by David S. Miller
Browse files

[SCTP]: Switch ->from_skb() to net-endian.



All instances switched, callers updated.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9b1dfad0
Loading
Loading
Loading
Loading
+4 −11
Original line number Original line Diff line number Diff line
@@ -127,7 +127,6 @@ int sctp_rcv(struct sk_buff *skb)
	struct sctphdr *sh;
	struct sctphdr *sh;
	union sctp_addr src;
	union sctp_addr src;
	union sctp_addr dest;
	union sctp_addr dest;
	union sctp_addr tmp, tmp2;
	int family;
	int family;
	struct sctp_af *af;
	struct sctp_af *af;


@@ -179,13 +178,10 @@ int sctp_rcv(struct sk_buff *skb)
	    !af->addr_valid(&dest, NULL, skb))
	    !af->addr_valid(&dest, NULL, skb))
		goto discard_it;
		goto discard_it;


	flip_to_n(&tmp, &dest);
	asoc = __sctp_rcv_lookup(skb, &src, &dest, &transport);
	flip_to_n(&tmp2, &src);

	asoc = __sctp_rcv_lookup(skb, &tmp2, &tmp, &transport);


	if (!asoc)
	if (!asoc)
		ep = __sctp_rcv_lookup_endpoint(&tmp);
		ep = __sctp_rcv_lookup_endpoint(&dest);


	/* Retrieve the common input handling substructure. */
	/* Retrieve the common input handling substructure. */
	rcvr = asoc ? &asoc->base : &ep->base;
	rcvr = asoc ? &asoc->base : &ep->base;
@@ -245,7 +241,7 @@ int sctp_rcv(struct sk_buff *skb)
	chunk->sctp_hdr = sh;
	chunk->sctp_hdr = sh;


	/* Set the source and destination addresses of the incoming chunk.  */
	/* Set the source and destination addresses of the incoming chunk.  */
	sctp_init_addrs(chunk, &tmp2, &tmp);
	sctp_init_addrs(chunk, &src, &dest);


	/* Remember where we came from.  */
	/* Remember where we came from.  */
	chunk->transport = transport;
	chunk->transport = transport;
@@ -444,7 +440,6 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb,
	struct sock *sk = NULL;
	struct sock *sk = NULL;
	struct sctp_association *asoc;
	struct sctp_association *asoc;
	struct sctp_transport *transport = NULL;
	struct sctp_transport *transport = NULL;
	union sctp_addr tmp, tmp2;


	*app = NULL; *tpp = NULL;
	*app = NULL; *tpp = NULL;


@@ -456,13 +451,11 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb,
	/* Initialize local addresses for lookups. */
	/* Initialize local addresses for lookups. */
	af->from_skb(&saddr, skb, 1);
	af->from_skb(&saddr, skb, 1);
	af->from_skb(&daddr, skb, 0);
	af->from_skb(&daddr, skb, 0);
	flip_to_n(&tmp, &saddr);
	flip_to_n(&tmp2, &daddr);


	/* Look for an association that matches the incoming ICMP error
	/* Look for an association that matches the incoming ICMP error
	 * packet.
	 * packet.
	 */
	 */
	asoc = __sctp_lookup_association(&tmp, &tmp2, &transport);
	asoc = __sctp_lookup_association(&saddr, &daddr, &transport);
	if (!asoc)
	if (!asoc)
		return NULL;
		return NULL;


+3 −3
Original line number Original line Diff line number Diff line
@@ -351,7 +351,7 @@ static void sctp_v6_from_skb(union sctp_addr *addr,struct sk_buff *skb,
			     int is_saddr)
			     int is_saddr)
{
{
	void *from;
	void *from;
	__u16 *port;
	__be16 *port;
	struct sctphdr *sh;
	struct sctphdr *sh;


	port = &addr->v6.sin6_port;
	port = &addr->v6.sin6_port;
@@ -361,10 +361,10 @@ static void sctp_v6_from_skb(union sctp_addr *addr,struct sk_buff *skb,


	sh = (struct sctphdr *) skb->h.raw;
	sh = (struct sctphdr *) skb->h.raw;
	if (is_saddr) {
	if (is_saddr) {
		*port  = ntohs(sh->source);
		*port  = sh->source;
		from = &skb->nh.ipv6h->saddr;
		from = &skb->nh.ipv6h->saddr;
	} else {
	} else {
		*port = ntohs(sh->dest);
		*port = sh->dest;
		from = &skb->nh.ipv6h->daddr;
		from = &skb->nh.ipv6h->daddr;
	}
	}
	ipv6_addr_copy(&addr->v6.sin6_addr, from);
	ipv6_addr_copy(&addr->v6.sin6_addr, from);
+3 −3
Original line number Original line Diff line number Diff line
@@ -252,7 +252,7 @@ static void sctp_v4_from_skb(union sctp_addr *addr, struct sk_buff *skb,
			     int is_saddr)
			     int is_saddr)
{
{
	void *from;
	void *from;
	__u16 *port;
	__be16 *port;
	struct sctphdr *sh;
	struct sctphdr *sh;


	port = &addr->v4.sin_port;
	port = &addr->v4.sin_port;
@@ -260,10 +260,10 @@ static void sctp_v4_from_skb(union sctp_addr *addr, struct sk_buff *skb,


	sh = (struct sctphdr *) skb->h.raw;
	sh = (struct sctphdr *) skb->h.raw;
	if (is_saddr) {
	if (is_saddr) {
		*port  = ntohs(sh->source);
		*port  = sh->source;
		from = &skb->nh.iph->saddr;
		from = &skb->nh.iph->saddr;
	} else {
	} else {
		*port = ntohs(sh->dest);
		*port = sh->dest;
		from = &skb->nh.iph->daddr;
		from = &skb->nh.iph->daddr;
	}
	}
	memcpy(&addr->v4.sin_addr.s_addr, from, sizeof(struct in_addr));
	memcpy(&addr->v4.sin_addr.s_addr, from, sizeof(struct in_addr));
+1 −3
Original line number Original line Diff line number Diff line
@@ -1227,7 +1227,6 @@ struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *ep,
	struct sk_buff *skb;
	struct sk_buff *skb;
	sctp_scope_t scope;
	sctp_scope_t scope;
	struct sctp_af *af;
	struct sctp_af *af;
	union sctp_addr tmp;


	/* Create the bare association.  */
	/* Create the bare association.  */
	scope = sctp_scope(sctp_source(chunk));
	scope = sctp_scope(sctp_source(chunk));
@@ -1240,8 +1239,7 @@ struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *ep,
	af = sctp_get_af_specific(ipver2af(skb->nh.iph->version));
	af = sctp_get_af_specific(ipver2af(skb->nh.iph->version));
	if (unlikely(!af))
	if (unlikely(!af))
		goto fail;
		goto fail;
	af->from_skb(&tmp, skb, 1);
	af->from_skb(&asoc->c.peer_addr, skb, 1);
	flip_to_n(&asoc->c.peer_addr, &tmp);
nodata:
nodata:
	return asoc;
	return asoc;