summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/net/icmp.h15
-rw-r--r--net/ipv4/raw.c11
2 files changed, 13 insertions, 13 deletions
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 32b159f7ae22..3fc192478aa2 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -46,16 +46,15 @@ extern void icmp_init(struct net_proto_family *ops);
/* Move into dst.h ? */
extern int xrlim_allow(struct dst_entry *dst, int timeout);
-struct raw_opt {
- struct icmp_filter filter;
-};
-
-/* WARNING: don't change the layout of the members in raw_sock! */
struct raw_sock {
- struct inet_sock inet;
- struct raw_opt raw4;
+ /* inet_sock has to be the first member */
+ struct inet_sock inet;
+ struct icmp_filter filter;
};
-#define raw4_sk(__sk) (&((struct raw_sock *)__sk)->raw4)
+static inline struct raw_sock *raw_sk(const struct sock *sk)
+{
+ return (struct raw_sock *)sk;
+}
#endif /* _ICMP_H */
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index c6294ee6f42e..b14d5fec06df 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -135,7 +135,7 @@ static __inline__ int icmp_filter(struct sock *sk, struct sk_buff *skb)
type = skb->h.icmph->type;
if (type < 32) {
- __u32 data = raw4_sk(sk)->filter.data;
+ __u32 data = raw_sk(sk)->filter.data;
return ((1 << type) & data) != 0;
}
@@ -615,9 +615,10 @@ out: return err ? err : copied;
static int raw_init(struct sock *sk)
{
- struct raw_opt *tp = raw4_sk(sk);
+ struct raw_sock *rp = raw_sk(sk);
+
if (inet_sk(sk)->num == IPPROTO_ICMP)
- memset(&tp->filter, 0, sizeof(tp->filter));
+ memset(&rp->filter, 0, sizeof(rp->filter));
return 0;
}
@@ -625,7 +626,7 @@ static int raw_seticmpfilter(struct sock *sk, char __user *optval, int optlen)
{
if (optlen > sizeof(struct icmp_filter))
optlen = sizeof(struct icmp_filter);
- if (copy_from_user(&raw4_sk(sk)->filter, optval, optlen))
+ if (copy_from_user(&raw_sk(sk)->filter, optval, optlen))
return -EFAULT;
return 0;
}
@@ -643,7 +644,7 @@ static int raw_geticmpfilter(struct sock *sk, char __user *optval, int __user *o
len = sizeof(struct icmp_filter);
ret = -EFAULT;
if (put_user(len, optlen) ||
- copy_to_user(optval, &raw4_sk(sk)->filter, len))
+ copy_to_user(optval, &raw_sk(sk)->filter, len))
goto out;
ret = 0;
out: return ret;