Commit 2a00d1ba authored by Yasuyuki Kozakai's avatar Yasuyuki Kozakai Committed by Patrick McHardy

[NETFILTER]: Enable ip6t_multiport.c to work without skb_linearize()

Signed-off-by: default avatarYasuyuki KOZAKAI <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
parent 2afe6f85
...@@ -56,24 +56,29 @@ match(const struct sk_buff *skb, ...@@ -56,24 +56,29 @@ match(const struct sk_buff *skb,
unsigned int protoff, unsigned int protoff,
int *hotdrop) int *hotdrop)
{ {
const struct udphdr *udp = (const struct udphdr *)(skb->data + protoff); u16 _ports[2], *pptr;
const struct ip6t_multiport *multiinfo = matchinfo; const struct ip6t_multiport *multiinfo = matchinfo;
/* Must be big enough to read ports. */ /* Must not be a fragment. */
if (offset == 0 && skb->len - protoff < sizeof(struct udphdr)) { if (offset)
return 0;
/* Must be big enough to read ports (both UDP and TCP have
them at the start). */
pptr = skb_header_pointer(skb, protoff, sizeof(_ports), &_ports[0]);
if (pptr == NULL) {
/* We've been asked to examine this packet, and we /* We've been asked to examine this packet, and we
can't. Hence, no choice but to drop. */ * can't. Hence, no choice but to drop.
duprintf("ip6t_multiport:" */
" Dropping evil offset=0 tinygram.\n"); duprintf("ip6t_multiport:"
*hotdrop = 1; " Dropping evil offset=0 tinygram.\n");
return 0; *hotdrop = 1;
return 0;
} }
/* Must not be a fragment. */ return ports_match(multiinfo->ports,
return !offset multiinfo->flags, multiinfo->count,
&& ports_match(multiinfo->ports, ntohs(pptr[0]), ntohs(pptr[1]));
multiinfo->flags, multiinfo->count,
ntohs(udp->source), ntohs(udp->dest));
} }
/* Called when user tries to insert an entry of this type. */ /* Called when user tries to insert an entry of this type. */
......
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