git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sunrpc/cache: fix off-by-one in qword_get()
[pandora-kernel.git]
/
net
/
ipv4
/
raw.c
diff --git
a/net/ipv4/raw.c
b/net/ipv4/raw.c
index
007e2eb
..
063bcd5
100644
(file)
--- a/
net/ipv4/raw.c
+++ b/
net/ipv4/raw.c
@@
-131,18
+131,20
@@
found:
* 0 - deliver
* 1 - block
*/
* 0 - deliver
* 1 - block
*/
-static
__inline__ int icmp_filter(struct sock *sk,
struct sk_buff *skb)
+static
int icmp_filter(const struct sock *sk, const
struct sk_buff *skb)
{
{
- int type;
+ struct icmphdr _hdr;
+ const struct icmphdr *hdr;
- if (!pskb_may_pull(skb, sizeof(struct icmphdr)))
+ hdr = skb_header_pointer(skb, skb_transport_offset(skb),
+ sizeof(_hdr), &_hdr);
+ if (!hdr)
return 1;
return 1;
- type = icmp_hdr(skb)->type;
- if (type < 32) {
+ if (hdr->type < 32) {
__u32 data = raw_sk(sk)->filter.data;
__u32 data = raw_sk(sk)->filter.data;
- return ((1
<<
type) & data) != 0;
+ return ((1
U << hdr->
type) & data) != 0;
}
/* Do not block unknown ICMP types */
}
/* Do not block unknown ICMP types */
@@
-327,6
+329,7
@@
static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
unsigned int iphlen;
int err;
struct rtable *rt = *rtp;
unsigned int iphlen;
int err;
struct rtable *rt = *rtp;
+ int hlen, tlen;
if (length > rt->dst.dev->mtu) {
ip_local_error(sk, EMSGSIZE, fl4->daddr, inet->inet_dport,
if (length > rt->dst.dev->mtu) {
ip_local_error(sk, EMSGSIZE, fl4->daddr, inet->inet_dport,
@@
-336,12
+339,14
@@
static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
if (flags&MSG_PROBE)
goto out;
if (flags&MSG_PROBE)
goto out;
+ hlen = LL_RESERVED_SPACE(rt->dst.dev);
+ tlen = rt->dst.dev->needed_tailroom;
skb = sock_alloc_send_skb(sk,
skb = sock_alloc_send_skb(sk,
- length +
LL_ALLOCATED_SPACE(rt->dst.dev)
+ 15,
+ length +
hlen + tlen
+ 15,
flags & MSG_DONTWAIT, &err);
if (skb == NULL)
goto error;
flags & MSG_DONTWAIT, &err);
if (skb == NULL)
goto error;
- skb_reserve(skb,
LL_RESERVED_SPACE(rt->dst.dev)
);
+ skb_reserve(skb,
hlen
);
skb->priority = sk->sk_priority;
skb->mark = sk->sk_mark;
skb->priority = sk->sk_priority;
skb->mark = sk->sk_mark;
@@
-378,7
+383,7
@@
static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
iph->check = 0;
iph->tot_len = htons(length);
if (!iph->id)
iph->check = 0;
iph->tot_len = htons(length);
if (!iph->id)
- ip_select_ident(
iph, &rt->dst
, NULL);
+ ip_select_ident(
skb
, NULL);
iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
}
iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
}
@@
-684,11
+689,8
@@
static int raw_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
if (flags & MSG_OOB)
goto out;
if (flags & MSG_OOB)
goto out;
- if (addr_len)
- *addr_len = sizeof(*sin);
-
if (flags & MSG_ERRQUEUE) {
if (flags & MSG_ERRQUEUE) {
- err = ip_recv_error(sk, msg, len);
+ err = ip_recv_error(sk, msg, len
, addr_len
);
goto out;
}
goto out;
}
@@
-714,6
+716,7
@@
static int raw_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
sin->sin_addr.s_addr = ip_hdr(skb)->saddr;
sin->sin_port = 0;
memset(&sin->sin_zero, 0, sizeof(sin->sin_zero));
sin->sin_addr.s_addr = ip_hdr(skb)->saddr;
sin->sin_port = 0;
memset(&sin->sin_zero, 0, sizeof(sin->sin_zero));
+ *addr_len = sizeof(*sin);
}
if (inet->cmsg_flags)
ip_cmsg_recv(msg, skb);
}
if (inet->cmsg_flags)
ip_cmsg_recv(msg, skb);