]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/bridge/netfilter/ebt_arpreply.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-2.6-omap-h63xx.git] / net / bridge / netfilter / ebt_arpreply.c
index c298d3deffa460da736d571cd36d2b6ab02b7a44..76584cd72e57295ce2bbae860d78c80f9d1bd2a0 100644 (file)
 #include <linux/netfilter_bridge/ebtables.h>
 #include <linux/netfilter_bridge/ebt_arpreply.h>
 
-static int ebt_target_reply(struct sk_buff *skb, unsigned int hooknr,
-   const struct net_device *in, const struct net_device *out,
-   const void *data, unsigned int datalen)
+static unsigned int
+ebt_arpreply_tg(struct sk_buff *skb, const struct xt_target_param *par)
 {
-       struct ebt_arpreply_info *info = (void *)data;
+       const struct ebt_arpreply_info *info = par->targinfo;
        const __be32 *siptr, *diptr;
        __be32 _sip, _dip;
        const struct arphdr *ap;
@@ -52,44 +51,45 @@ static int ebt_target_reply(struct sk_buff *skb, unsigned int hooknr,
        if (diptr == NULL)
                return EBT_DROP;
 
-       arp_send(ARPOP_REPLY, ETH_P_ARP, *siptr, (struct net_device *)in,
+       arp_send(ARPOP_REPLY, ETH_P_ARP, *siptr, (struct net_device *)par->in,
                 *diptr, shp, info->mac, shp);
 
        return info->target;
 }
 
-static bool ebt_target_reply_check(const char *tablename, unsigned int hookmask,
-   const struct ebt_entry *e, void *data, unsigned int datalen)
+static bool ebt_arpreply_tg_check(const struct xt_tgchk_param *par)
 {
-       const struct ebt_arpreply_info *info = data;
+       const struct ebt_arpreply_info *info = par->targinfo;
+       const struct ebt_entry *e = par->entryinfo;
 
        if (BASE_CHAIN && info->target == EBT_RETURN)
                return false;
        if (e->ethproto != htons(ETH_P_ARP) ||
            e->invflags & EBT_IPROTO)
                return false;
-       CLEAR_BASE_CHAIN_BIT;
-       if (strcmp(tablename, "nat") || hookmask & ~(1 << NF_BR_PRE_ROUTING))
-               return false;
        return true;
 }
 
-static struct ebt_target reply_target __read_mostly = {
-       .name           = EBT_ARPREPLY_TARGET,
-       .target         = ebt_target_reply,
-       .check          = ebt_target_reply_check,
+static struct xt_target ebt_arpreply_tg_reg __read_mostly = {
+       .name           = "arpreply",
+       .revision       = 0,
+       .family         = NFPROTO_BRIDGE,
+       .table          = "nat",
+       .hooks          = (1 << NF_BR_NUMHOOKS) | (1 << NF_BR_PRE_ROUTING),
+       .target         = ebt_arpreply_tg,
+       .checkentry     = ebt_arpreply_tg_check,
        .targetsize     = XT_ALIGN(sizeof(struct ebt_arpreply_info)),
        .me             = THIS_MODULE,
 };
 
 static int __init ebt_arpreply_init(void)
 {
-       return ebt_register_target(&reply_target);
+       return xt_register_target(&ebt_arpreply_tg_reg);
 }
 
 static void __exit ebt_arpreply_fini(void)
 {
-       ebt_unregister_target(&reply_target);
+       xt_unregister_target(&ebt_arpreply_tg_reg);
 }
 
 module_init(ebt_arpreply_init);