]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/sctp/protocol.c
[SCTP]: Eliminate some pointer attributions to the skb layer headers
[linux-2.6-omap-h63xx.git] / net / sctp / protocol.c
index 3a3db56729ce7159494b1e8a28b2cfcec39aeaeb..7c28c9b959e26bf95fd7e966df9dbc8fbce8d5b1 100644 (file)
@@ -102,11 +102,11 @@ static __init int sctp_proc_init(void)
        }
 
        if (sctp_snmp_proc_init())
-               goto out_nomem; 
+               goto out_nomem;
        if (sctp_eps_proc_init())
-               goto out_nomem; 
+               goto out_nomem;
        if (sctp_assocs_proc_init())
-               goto out_nomem; 
+               goto out_nomem;
 
        return 0;
 
@@ -114,7 +114,7 @@ out_nomem:
        return -ENOMEM;
 }
 
-/* Clean up the proc fs entry for the SCTP protocol. 
+/* Clean up the proc fs entry for the SCTP protocol.
  * Note: Do not make this __exit as it is used in the init error
  * path.
  */
@@ -235,13 +235,13 @@ static void sctp_v4_from_skb(union sctp_addr *addr, struct sk_buff *skb,
        port = &addr->v4.sin_port;
        addr->v4.sin_family = AF_INET;
 
-       sh = (struct sctphdr *) skb->h.raw;
+       sh = sctp_hdr(skb);
        if (is_saddr) {
                *port  = sh->source;
-               from = &skb->nh.iph->saddr;
+               from = &ip_hdr(skb)->saddr;
        } else {
                *port = sh->dest;
-               from = &skb->nh.iph->daddr;
+               from = &ip_hdr(skb)->daddr;
        }
        memcpy(&addr->v4.sin_addr.s_addr, from, sizeof(struct in_addr));
 }
@@ -286,7 +286,7 @@ static int sctp_v4_to_addr_param(const union sctp_addr *addr,
 
        param->v4.param_hdr.type = SCTP_PARAM_IPV4_ADDRESS;
        param->v4.param_hdr.length = htons(length);
-       param->v4.addr.s_addr = addr->v4.sin_addr.s_addr;       
+       param->v4.addr.s_addr = addr->v4.sin_addr.s_addr;
 
        return length;
 }
@@ -344,9 +344,9 @@ static int sctp_v4_addr_valid(union sctp_addr *addr,
        if (IS_IPV4_UNUSABLE_ADDRESS(&addr->v4.sin_addr.s_addr))
                return 0;
 
-       /* Is this a broadcast address? */
-       if (skb && ((struct rtable *)skb->dst)->rt_flags & RTCF_BROADCAST)
-               return 0;
+       /* Is this a broadcast address? */
+       if (skb && ((struct rtable *)skb->dst)->rt_flags & RTCF_BROADCAST)
+               return 0;
 
        return 1;
 }
@@ -494,7 +494,7 @@ out_unlock:
 out:
        if (dst)
                SCTP_DEBUG_PRINTK("rt_dst:%u.%u.%u.%u, rt_src:%u.%u.%u.%u\n",
-                                 NIPQUAD(rt->rt_dst), NIPQUAD(rt->rt_src));
+                                 NIPQUAD(rt->rt_dst), NIPQUAD(rt->rt_src));
        else
                SCTP_DEBUG_PRINTK("NO ROUTE\n");
 
@@ -517,20 +517,20 @@ static void sctp_v4_get_saddr(struct sctp_association *asoc,
        if (rt) {
                saddr->v4.sin_family = AF_INET;
                saddr->v4.sin_port = htons(asoc->base.bind_addr.port);
-               saddr->v4.sin_addr.s_addr = rt->rt_src; 
+               saddr->v4.sin_addr.s_addr = rt->rt_src;
        }
 }
 
 /* What interface did this skb arrive on? */
 static int sctp_v4_skb_iif(const struct sk_buff *skb)
 {
-       return ((struct rtable *)skb->dst)->rt_iif;
+       return ((struct rtable *)skb->dst)->rt_iif;
 }
 
 /* Was this packet marked by Explicit Congestion Notification? */
 static int sctp_v4_is_ce(const struct sk_buff *skb)
 {
-       return INET_ECN_is_ce(skb->nh.iph->tos);
+       return INET_ECN_is_ce(ip_hdr(skb)->tos);
 }
 
 /* Create and initialize a new sk for the socket returned by accept(). */
@@ -569,7 +569,7 @@ static struct sock *sctp_v4_create_accept_sk(struct sock *sk,
        newinet->dport = htons(asoc->peer.port);
        newinet->daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr;
        newinet->pmtudisc = inet->pmtudisc;
-       newinet->id = asoc->next_tsn ^ jiffies;
+       newinet->id = asoc->next_tsn ^ jiffies;
 
        newinet->uc_ttl = -1;
        newinet->mc_loop = 1;
@@ -601,8 +601,8 @@ static void sctp_v4_seq_dump_addr(struct seq_file *seq, union sctp_addr *addr)
 }
 
 /* Event handler for inet address addition/deletion events.  */
-int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
-                        void *ptr)
+static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
+                              void *ptr)
 {
        struct in_ifaddr *ifa = (struct in_ifaddr *)ptr;
        struct sctp_sockaddr_entry *addr;
@@ -731,15 +731,13 @@ static void sctp_inet_event_msgname(struct sctp_ulpevent *event, char *msgname,
 /* Initialize and copy out a msgname from an inbound skb. */
 static void sctp_inet_skb_msgname(struct sk_buff *skb, char *msgname, int *len)
 {
-       struct sctphdr *sh;
-       struct sockaddr_in *sin;
-
        if (msgname) {
+               struct sctphdr *sh = sctp_hdr(skb);
+               struct sockaddr_in *sin = (struct sockaddr_in *)msgname;
+
                sctp_inet_msgname(msgname, len);
-               sin = (struct sockaddr_in *)msgname;
-               sh = (struct sctphdr *)skb->h.raw;
                sin->sin_port = sh->source;
-               sin->sin_addr.s_addr = skb->nh.iph->saddr;
+               sin->sin_addr.s_addr = ip_hdr(skb)->saddr;
        }
 }
 
@@ -804,7 +802,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb,
                          NIPQUAD(((struct rtable *)skb->dst)->rt_dst));
 
        SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS);
-       return ip_queue_xmit(skb, skb->sk, ipfragok);
+       return ip_queue_xmit(skb, ipfragok);
 }
 
 static struct sctp_af sctp_ipv4_specific;