git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
net
/
bridge
/
netfilter
/
ebt_arp.c
diff --git
a/net/bridge/netfilter/ebt_arp.c
b/net/bridge/netfilter/ebt_arp.c
index
eb67584
..
9c59980
100644
(file)
--- a/
net/bridge/netfilter/ebt_arp.c
+++ b/
net/bridge/netfilter/ebt_arp.c
@@
-19,72
+19,79
@@
static int ebt_filter_arp(const struct sk_buff *skb, const struct net_device *in
const struct net_device *out, const void *data, unsigned int datalen)
{
struct ebt_arp_info *info = (struct ebt_arp_info *)data;
const struct net_device *out, const void *data, unsigned int datalen)
{
struct ebt_arp_info *info = (struct ebt_arp_info *)data;
- struct arphdr
arp
h;
+ struct arphdr
_arph, *a
h;
- if (skb_copy_bits(skb, 0, &arph, sizeof(arph)))
+ ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph);
+ if (ah == NULL)
return EBT_NOMATCH;
if (info->bitmask & EBT_ARP_OPCODE && FWINV(info->opcode !=
return EBT_NOMATCH;
if (info->bitmask & EBT_ARP_OPCODE && FWINV(info->opcode !=
- a
rph.
ar_op, EBT_ARP_OPCODE))
+ a
h->
ar_op, EBT_ARP_OPCODE))
return EBT_NOMATCH;
if (info->bitmask & EBT_ARP_HTYPE && FWINV(info->htype !=
return EBT_NOMATCH;
if (info->bitmask & EBT_ARP_HTYPE && FWINV(info->htype !=
- a
rph.
ar_hrd, EBT_ARP_HTYPE))
+ a
h->
ar_hrd, EBT_ARP_HTYPE))
return EBT_NOMATCH;
if (info->bitmask & EBT_ARP_PTYPE && FWINV(info->ptype !=
return EBT_NOMATCH;
if (info->bitmask & EBT_ARP_PTYPE && FWINV(info->ptype !=
- a
rph.
ar_pro, EBT_ARP_PTYPE))
+ a
h->
ar_pro, EBT_ARP_PTYPE))
return EBT_NOMATCH;
if (info->bitmask & (EBT_ARP_SRC_IP | EBT_ARP_DST_IP)) {
return EBT_NOMATCH;
if (info->bitmask & (EBT_ARP_SRC_IP | EBT_ARP_DST_IP)) {
-
uint32_t addr
;
+
__be32 _addr, *ap
;
/* IPv4 addresses are always 4 bytes */
/* IPv4 addresses are always 4 bytes */
- if (a
rph.ar_pln != sizeof(uint32_t
))
+ if (a
h->ar_pln != sizeof(__be32
))
return EBT_NOMATCH;
if (info->bitmask & EBT_ARP_SRC_IP) {
return EBT_NOMATCH;
if (info->bitmask & EBT_ARP_SRC_IP) {
- if (skb_copy_bits(skb, sizeof(struct arphdr) +
- arph.ar_hln, &addr, sizeof(addr)))
+ ap = skb_header_pointer(skb, sizeof(struct arphdr) +
+ ah->ar_hln, sizeof(_addr),
+ &_addr);
+ if (ap == NULL)
return EBT_NOMATCH;
return EBT_NOMATCH;
- if (FWINV(info->saddr != (
addr
& info->smsk),
+ if (FWINV(info->saddr != (
*ap
& info->smsk),
EBT_ARP_SRC_IP))
return EBT_NOMATCH;
}
if (info->bitmask & EBT_ARP_DST_IP) {
EBT_ARP_SRC_IP))
return EBT_NOMATCH;
}
if (info->bitmask & EBT_ARP_DST_IP) {
- if (skb_copy_bits(skb, sizeof(struct arphdr) +
- 2*arph.ar_hln + sizeof(uint32_t), &addr,
- sizeof(addr)))
+ ap = skb_header_pointer(skb, sizeof(struct arphdr) +
+ 2*ah->ar_hln+sizeof(__be32),
+ sizeof(_addr), &_addr);
+ if (ap == NULL)
return EBT_NOMATCH;
return EBT_NOMATCH;
- if (FWINV(info->daddr != (
addr
& info->dmsk),
+ if (FWINV(info->daddr != (
*ap
& info->dmsk),
EBT_ARP_DST_IP))
return EBT_NOMATCH;
}
}
if (info->bitmask & (EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC)) {
EBT_ARP_DST_IP))
return EBT_NOMATCH;
}
}
if (info->bitmask & (EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC)) {
- unsigned char
mac[ETH_ALEN]
;
+ unsigned char
_mac[ETH_ALEN], *mp
;
uint8_t verdict, i;
/* MAC addresses are 6 bytes */
uint8_t verdict, i;
/* MAC addresses are 6 bytes */
- if (a
rph.
ar_hln != ETH_ALEN)
+ if (a
h->
ar_hln != ETH_ALEN)
return EBT_NOMATCH;
if (info->bitmask & EBT_ARP_SRC_MAC) {
return EBT_NOMATCH;
if (info->bitmask & EBT_ARP_SRC_MAC) {
- if (skb_copy_bits(skb, sizeof(struct arphdr), &mac,
- ETH_ALEN))
+ mp = skb_header_pointer(skb, sizeof(struct arphdr),
+ sizeof(_mac), &_mac);
+ if (mp == NULL)
return EBT_NOMATCH;
verdict = 0;
for (i = 0; i < 6; i++)
return EBT_NOMATCH;
verdict = 0;
for (i = 0; i < 6; i++)
- verdict |= (m
ac
[i] ^ info->smaddr[i]) &
+ verdict |= (m
p
[i] ^ info->smaddr[i]) &
info->smmsk[i];
if (FWINV(verdict != 0, EBT_ARP_SRC_MAC))
return EBT_NOMATCH;
}
if (info->bitmask & EBT_ARP_DST_MAC) {
info->smmsk[i];
if (FWINV(verdict != 0, EBT_ARP_SRC_MAC))
return EBT_NOMATCH;
}
if (info->bitmask & EBT_ARP_DST_MAC) {
- if (skb_copy_bits(skb, sizeof(struct arphdr) +
- arph.ar_hln + arph.ar_pln, &mac, ETH_ALEN))
+ mp = skb_header_pointer(skb, sizeof(struct arphdr) +
+ ah->ar_hln + ah->ar_pln,
+ sizeof(_mac), &_mac);
+ if (mp == NULL)
return EBT_NOMATCH;
verdict = 0;
for (i = 0; i < 6; i++)
return EBT_NOMATCH;
verdict = 0;
for (i = 0; i < 6; i++)
- verdict |= (m
ac
[i] ^ info->dmaddr[i]) &
+ verdict |= (m
p
[i] ^ info->dmaddr[i]) &
info->dmmsk[i];
if (FWINV(verdict != 0, EBT_ARP_DST_MAC))
return EBT_NOMATCH;
info->dmmsk[i];
if (FWINV(verdict != 0, EBT_ARP_DST_MAC))
return EBT_NOMATCH;
@@
-101,8
+108,8
@@
static int ebt_arp_check(const char *tablename, unsigned int hookmask,
if (datalen != EBT_ALIGN(sizeof(struct ebt_arp_info)))
return -EINVAL;
if (datalen != EBT_ALIGN(sizeof(struct ebt_arp_info)))
return -EINVAL;
- if ((e->ethproto !=
__constant_
htons(ETH_P_ARP) &&
- e->ethproto !=
__constant_
htons(ETH_P_RARP)) ||
+ if ((e->ethproto != htons(ETH_P_ARP) &&
+ e->ethproto != htons(ETH_P_RARP)) ||
e->invflags & EBT_IPROTO)
return -EINVAL;
if (info->bitmask & ~EBT_ARP_MASK || info->invflags & ~EBT_ARP_MASK)
e->invflags & EBT_IPROTO)
return -EINVAL;
if (info->bitmask & ~EBT_ARP_MASK || info->invflags & ~EBT_ARP_MASK)
@@
-118,16
+125,16
@@
static struct ebt_match filter_arp =
.me = THIS_MODULE,
};
.me = THIS_MODULE,
};
-static int __init init(void)
+static int __init
ebt_arp_
init(void)
{
return ebt_register_match(&filter_arp);
}
{
return ebt_register_match(&filter_arp);
}
-static void __exit fini(void)
+static void __exit
ebt_arp_
fini(void)
{
ebt_unregister_match(&filter_arp);
}
{
ebt_unregister_match(&filter_arp);
}
-module_init(init);
-module_exit(fini);
+module_init(
ebt_arp_
init);
+module_exit(
ebt_arp_
fini);
MODULE_LICENSE("GPL");
MODULE_LICENSE("GPL");