diff options
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/input.c | 14 | ||||
-rw-r--r-- | net/sctp/ipv6.c | 4 | ||||
-rw-r--r-- | net/sctp/protocol.c | 10 |
3 files changed, 11 insertions, 17 deletions
diff --git a/net/sctp/input.c b/net/sctp/input.c index 9311b5ddf5c0..3a322c584c74 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -79,14 +79,10 @@ static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb); | |||
79 | /* Calculate the SCTP checksum of an SCTP packet. */ | 79 | /* Calculate the SCTP checksum of an SCTP packet. */ |
80 | static inline int sctp_rcv_checksum(struct sk_buff *skb) | 80 | static inline int sctp_rcv_checksum(struct sk_buff *skb) |
81 | { | 81 | { |
82 | struct sctphdr *sh; | ||
83 | __u32 cmp, val; | ||
84 | struct sk_buff *list = skb_shinfo(skb)->frag_list; | 82 | struct sk_buff *list = skb_shinfo(skb)->frag_list; |
85 | 83 | struct sctphdr *sh = sctp_hdr(skb); | |
86 | sh = (struct sctphdr *) skb->h.raw; | 84 | __u32 cmp = ntohl(sh->checksum); |
87 | cmp = ntohl(sh->checksum); | 85 | __u32 val = sctp_start_cksum((__u8 *)sh, skb_headlen(skb)); |
88 | |||
89 | val = sctp_start_cksum((__u8 *)sh, skb_headlen(skb)); | ||
90 | 86 | ||
91 | for (; list; list = list->next) | 87 | for (; list; list = list->next) |
92 | val = sctp_update_cksum((__u8 *)list->data, skb_headlen(list), | 88 | val = sctp_update_cksum((__u8 *)list->data, skb_headlen(list), |
@@ -138,7 +134,7 @@ int sctp_rcv(struct sk_buff *skb) | |||
138 | if (skb_linearize(skb)) | 134 | if (skb_linearize(skb)) |
139 | goto discard_it; | 135 | goto discard_it; |
140 | 136 | ||
141 | sh = (struct sctphdr *) skb->h.raw; | 137 | sh = sctp_hdr(skb); |
142 | 138 | ||
143 | /* Pull up the IP and SCTP headers. */ | 139 | /* Pull up the IP and SCTP headers. */ |
144 | __skb_pull(skb, skb_transport_offset(skb)); | 140 | __skb_pull(skb, skb_transport_offset(skb)); |
@@ -905,7 +901,7 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct sk_buff *skb, | |||
905 | struct sctp_association *asoc; | 901 | struct sctp_association *asoc; |
906 | union sctp_addr addr; | 902 | union sctp_addr addr; |
907 | union sctp_addr *paddr = &addr; | 903 | union sctp_addr *paddr = &addr; |
908 | struct sctphdr *sh = (struct sctphdr *) skb->h.raw; | 904 | struct sctphdr *sh = sctp_hdr(skb); |
909 | sctp_chunkhdr_t *ch; | 905 | sctp_chunkhdr_t *ch; |
910 | union sctp_params params; | 906 | union sctp_params params; |
911 | sctp_init_chunk_t *init; | 907 | sctp_init_chunk_t *init; |
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 001be2de0b3c..0992bc5bb528 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -390,7 +390,7 @@ static void sctp_v6_from_skb(union sctp_addr *addr,struct sk_buff *skb, | |||
390 | addr->v6.sin6_flowinfo = 0; /* FIXME */ | 390 | addr->v6.sin6_flowinfo = 0; /* FIXME */ |
391 | addr->v6.sin6_scope_id = ((struct inet6_skb_parm *)skb->cb)->iif; | 391 | addr->v6.sin6_scope_id = ((struct inet6_skb_parm *)skb->cb)->iif; |
392 | 392 | ||
393 | sh = (struct sctphdr *) skb->h.raw; | 393 | sh = sctp_hdr(skb); |
394 | if (is_saddr) { | 394 | if (is_saddr) { |
395 | *port = sh->source; | 395 | *port = sh->source; |
396 | from = &ipv6_hdr(skb)->saddr; | 396 | from = &ipv6_hdr(skb)->saddr; |
@@ -765,7 +765,7 @@ static void sctp_inet6_skb_msgname(struct sk_buff *skb, char *msgname, | |||
765 | if (msgname) { | 765 | if (msgname) { |
766 | sctp_inet6_msgname(msgname, addr_len); | 766 | sctp_inet6_msgname(msgname, addr_len); |
767 | sin6 = (struct sockaddr_in6 *)msgname; | 767 | sin6 = (struct sockaddr_in6 *)msgname; |
768 | sh = (struct sctphdr *)skb->h.raw; | 768 | sh = sctp_hdr(skb); |
769 | sin6->sin6_port = sh->source; | 769 | sin6->sin6_port = sh->source; |
770 | 770 | ||
771 | /* Map ipv4 address into v4-mapped-on-v6 address. */ | 771 | /* Map ipv4 address into v4-mapped-on-v6 address. */ |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 08f92ba4ebd7..7c28c9b959e2 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -235,7 +235,7 @@ static void sctp_v4_from_skb(union sctp_addr *addr, struct sk_buff *skb, | |||
235 | port = &addr->v4.sin_port; | 235 | port = &addr->v4.sin_port; |
236 | addr->v4.sin_family = AF_INET; | 236 | addr->v4.sin_family = AF_INET; |
237 | 237 | ||
238 | sh = (struct sctphdr *) skb->h.raw; | 238 | sh = sctp_hdr(skb); |
239 | if (is_saddr) { | 239 | if (is_saddr) { |
240 | *port = sh->source; | 240 | *port = sh->source; |
241 | from = &ip_hdr(skb)->saddr; | 241 | from = &ip_hdr(skb)->saddr; |
@@ -731,13 +731,11 @@ static void sctp_inet_event_msgname(struct sctp_ulpevent *event, char *msgname, | |||
731 | /* Initialize and copy out a msgname from an inbound skb. */ | 731 | /* Initialize and copy out a msgname from an inbound skb. */ |
732 | static void sctp_inet_skb_msgname(struct sk_buff *skb, char *msgname, int *len) | 732 | static void sctp_inet_skb_msgname(struct sk_buff *skb, char *msgname, int *len) |
733 | { | 733 | { |
734 | struct sctphdr *sh; | ||
735 | struct sockaddr_in *sin; | ||
736 | |||
737 | if (msgname) { | 734 | if (msgname) { |
735 | struct sctphdr *sh = sctp_hdr(skb); | ||
736 | struct sockaddr_in *sin = (struct sockaddr_in *)msgname; | ||
737 | |||
738 | sctp_inet_msgname(msgname, len); | 738 | sctp_inet_msgname(msgname, len); |
739 | sin = (struct sockaddr_in *)msgname; | ||
740 | sh = (struct sctphdr *)skb->h.raw; | ||
741 | sin->sin_port = sh->source; | 739 | sin->sin_port = sh->source; |
742 | sin->sin_addr.s_addr = ip_hdr(skb)->saddr; | 740 | sin->sin_addr.s_addr = ip_hdr(skb)->saddr; |
743 | } | 741 | } |