diff --git a/extensions/libxt_iface.c b/extensions/libxt_iface.c index 10e093f..2bf4533 100644 --- a/extensions/libxt_iface.c +++ b/extensions/libxt_iface.c @@ -39,7 +39,6 @@ static struct option iface_mt_opts[] = { static void iface_print_opt(const struct xt_iface_mtinfo *info, const unsigned int option, const char *command) { - DEBUGP("print_option... %s", command); if (info->flags & option) printf(" %s", command); if (info->invflags & option) @@ -49,7 +48,6 @@ static void iface_print_opt(const struct xt_iface_mtinfo *info, static void iface_setflag(struct xt_iface_mtinfo *info, unsigned int *flags, int invert, u_int16_t flag, const char *command) { - DEBUGP("setflag... %s", command); if (*flags & flag) xtables_error(PARAMETER_PROBLEM, "iface: \"--%s\" flag already specified", command); @@ -64,7 +62,6 @@ static bool iface_valid_name(const char *name) { char invalid_chars[] = ".+!*"; - DEBUGP("valid_interface_name... %d %d", strcspn(name, invalid_chars), strlen(name)); return !((strlen(name) >= IFNAMSIZ) || (strcspn(name, invalid_chars) != strlen(name))); } @@ -94,7 +91,6 @@ static void iface_mt_help(void) static int iface_mt_parse(int c, char **argv, int invert, unsigned int *flags, const void *entry, struct xt_entry_match **match) { - DEBUGP("parse... c:%c invert:%x", c, invert); struct xt_iface_mtinfo *info = (void *)(*match)->data; switch (c) { @@ -159,7 +155,6 @@ static int iface_mt_parse(int c, char **argv, int invert, unsigned int *flags, static void iface_mt_check(unsigned int flags) { - DEBUGP("final_check..."); if (!(flags & XT_IFACE_IFACE)) xtables_error(PARAMETER_PROBLEM, "iface: You must specify an interface"); @@ -171,7 +166,6 @@ static void iface_mt_check(unsigned int flags) static void iface_mt_print(const void *ip, const struct xt_entry_match *match, int numeric) { - DEBUGP("print..."); const struct xt_iface_mtinfo *info = (const void *)match->data; printf("iface: \"%s\" [state:", info->ifname); @@ -191,7 +185,6 @@ static void iface_mt_print(const void *ip, const struct xt_entry_match *match, static void iface_mt_save(const void *ip, const struct xt_entry_match *match) { - DEBUGP("save..."); const struct xt_iface_mtinfo *info = (const void *)match->data; printf(" --iface %s", info->ifname); @@ -241,7 +234,6 @@ static struct xtables_match iface_mt6_reg = { static void _init(void) { - DEBUGP("_init..."); xtables_register_match(&iface_mt_reg); xtables_register_match(&iface_mt6_reg); } diff --git a/extensions/xt_iface.c b/extensions/xt_iface.c index c7511d9..6d4b2fc 100644 --- a/extensions/xt_iface.c +++ b/extensions/xt_iface.c @@ -4,8 +4,6 @@ * Original author: Gáspár Lajos */ -#define _KERNEL 1 - #include #include #include @@ -43,36 +41,10 @@ static bool xt_iface_mt(const struct sk_buff *skb, struct net_device *dev; bool retval; int i; - DEBUGP("match..."); - DEBUGP("Interface: %s", info->ifname); + retval = ((dev = dev_get_by_name(&init_net, info->ifname)) != NULL); if (retval) { -#if DEBUG - DEBUGP("dev->flags: %#8x", dev->flags); - if (dev->flags & IFF_UP) - DEBUGP(" %#8x (UP)", IFF_UP); - if (dev->flags & IFF_BROADCAST) - DEBUGP(" %#8x (BROADCAST)", IFF_BROADCAST); - if (dev->flags & IFF_LOOPBACK) - DEBUGP(" %#8x (LOOPBACK)", IFF_LOOPBACK); - if (dev->flags & IFF_POINTOPOINT) - DEBUGP(" %#8x (POINTOPOINT)", IFF_POINTOPOINT); - if (dev->flags & IFF_RUNNING) - DEBUGP(" %#8x (RUNNING)", IFF_RUNNING); - if (dev->flags & IFF_NOARP) - DEBUGP(" %#8x (NOARP)", IFF_NOARP); - if (dev->flags & IFF_PROMISC) - DEBUGP(" %#8x (PROMISC)", IFF_PROMISC); - if (dev->flags & IFF_MULTICAST) - DEBUGP(" %#8x (MULTICAST)", IFF_MULTICAST); - if (dev->flags & IFF_DYNAMIC) - DEBUGP(" %#8x (DYNAMIC)", IFF_DYNAMIC); - if (dev->flags & IFF_LOWER_UP) - DEBUGP(" %#8x (LOWER_UP)", IFF_LOWER_UP); - if (dev->flags & IFF_DORMANT) - DEBUGP(" %#8x (DORMANT)", IFF_DORMANT); -#endif for (i=0; (iflags & xt_iface_lookup[i].iface_flag) @@ -108,14 +80,12 @@ static struct xt_match xt_iface_mt_reg[] __read_mostly = { static int __init xt_iface_match_init(void) { - DEBUGP("init...\n"); return xt_register_matches(xt_iface_mt_reg, ARRAY_SIZE(xt_iface_mt_reg)); } static void __exit xt_iface_match_exit(void) { - DEBUGP("exit...\n"); xt_unregister_matches(xt_iface_mt_reg, ARRAY_SIZE(xt_iface_mt_reg)); } diff --git a/extensions/xt_iface.h b/extensions/xt_iface.h index 1eed85f..97ac4eb 100644 --- a/extensions/xt_iface.h +++ b/extensions/xt_iface.h @@ -1,20 +1,9 @@ #ifndef _LINUX_NETFILTER_XT_IFACE_H #define _LINUX_NETFILTER_XT_IFACE_H 1 -#define DEBUG 0 #define _MODULE_NAME "iface" #define _MODULE_REVISION 0 -#if DEBUG -#if _KERNEL -#define DEBUGP(format, args...) printk(KERN_INFO "xt_"_MODULE_NAME": "format"\n", ##args) -#else -#define DEBUGP(format, args...) printf("# DEBUG: libxt_"_MODULE_NAME": "format"\n", ##args) -#endif -#else -#define DEBUGP(format, args...) -#endif - #define XT_IFACE_FLAGCOUNT 11 enum {