Commit a27ef749 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[SCTP]: Eliminate some pointer attributions to the skb layer headers

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bd82393c
...@@ -506,7 +506,7 @@ void sctp_err_finish(struct sock *sk, struct sctp_association *asoc) ...@@ -506,7 +506,7 @@ void sctp_err_finish(struct sock *sk, struct sctp_association *asoc)
void sctp_v4_err(struct sk_buff *skb, __u32 info) void sctp_v4_err(struct sk_buff *skb, __u32 info)
{ {
struct iphdr *iph = (struct iphdr *)skb->data; struct iphdr *iph = (struct iphdr *)skb->data;
struct sctphdr *sh = (struct sctphdr *)(skb->data + (iph->ihl <<2)); const int ihlen = iph->ihl * 4;
const int type = icmp_hdr(skb)->type; const int type = icmp_hdr(skb)->type;
const int code = icmp_hdr(skb)->code; const int code = icmp_hdr(skb)->code;
struct sock *sk; struct sock *sk;
...@@ -516,7 +516,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info) ...@@ -516,7 +516,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
char *saveip, *savesctp; char *saveip, *savesctp;
int err; int err;
if (skb->len < ((iph->ihl << 2) + 8)) { if (skb->len < ihlen + 8) {
ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
return; return;
} }
...@@ -525,8 +525,8 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info) ...@@ -525,8 +525,8 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
saveip = skb->nh.raw; saveip = skb->nh.raw;
savesctp = skb->h.raw; savesctp = skb->h.raw;
skb_reset_network_header(skb); skb_reset_network_header(skb);
skb->h.raw = (char *)sh; skb_set_transport_header(skb, ihlen);
sk = sctp_err_lookup(AF_INET, skb, sh, &asoc, &transport); sk = sctp_err_lookup(AF_INET, skb, sctp_hdr(skb), &asoc, &transport);
/* Put back, the original pointers. */ /* Put back, the original pointers. */
skb->nh.raw = saveip; skb->nh.raw = saveip;
skb->h.raw = savesctp; skb->h.raw = savesctp;
......
...@@ -122,7 +122,6 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -122,7 +122,6 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
int type, int code, int offset, __be32 info) int type, int code, int offset, __be32 info)
{ {
struct inet6_dev *idev; struct inet6_dev *idev;
struct sctphdr *sh = (struct sctphdr *)(skb->data + offset);
struct sock *sk; struct sock *sk;
struct sctp_association *asoc; struct sctp_association *asoc;
struct sctp_transport *transport; struct sctp_transport *transport;
...@@ -136,8 +135,8 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -136,8 +135,8 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
saveip = skb->nh.raw; saveip = skb->nh.raw;
savesctp = skb->h.raw; savesctp = skb->h.raw;
skb_reset_network_header(skb); skb_reset_network_header(skb);
skb->h.raw = (char *)sh; skb_set_transport_header(skb, offset);
sk = sctp_err_lookup(AF_INET6, skb, sh, &asoc, &transport); sk = sctp_err_lookup(AF_INET6, skb, sctp_hdr(skb), &asoc, &transport);
/* Put back, the original pointers. */ /* Put back, the original pointers. */
skb->nh.raw = saveip; skb->nh.raw = saveip;
skb->h.raw = savesctp; skb->h.raw = savesctp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment