summaryrefslogtreecommitdiffstats
path: root/extensions/libxt_devgroup.c
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/libxt_devgroup.c')
-rw-r--r--extensions/libxt_devgroup.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/extensions/libxt_devgroup.c b/extensions/libxt_devgroup.c
index 2ec3905c..f1352c47 100644
--- a/extensions/libxt_devgroup.c
+++ b/extensions/libxt_devgroup.c
@@ -31,17 +31,10 @@ static const struct xt_option_entry devgroup_opts[] = {
XTOPT_TABLEEND,
};
-/* array of devgroups from /etc/iproute2/group */
+static const char f_devgroups[] = "/etc/iproute2/group";
+/* array of devgroups from f_devgroups[] */
static struct xtables_lmap *devgroups;
-static void devgroup_init(struct xt_entry_match *match)
-{
- const char file[] = "/etc/iproute2/group";
- devgroups = xtables_lmap_init(file);
- if (devgroups == NULL && errno != ENOENT)
- fprintf(stderr, "Warning: %s: %s\n", file, strerror(errno));
-}
-
static void devgroup_parse_groupspec(const char *arg, unsigned int *group,
unsigned int *mask)
{
@@ -212,7 +205,6 @@ static struct xtables_match devgroup_mt_reg = {
.family = NFPROTO_UNSPEC,
.size = XT_ALIGN(sizeof(struct xt_devgroup_info)),
.userspacesize = XT_ALIGN(sizeof(struct xt_devgroup_info)),
- .init = devgroup_init,
.help = devgroup_help,
.print = devgroup_print,
.save = devgroup_save,
@@ -224,5 +216,10 @@ static struct xtables_match devgroup_mt_reg = {
void _init(void)
{
+ devgroups = xtables_lmap_init(f_devgroups);
+ if (devgroups == NULL && errno != ENOENT)
+ fprintf(stderr, "Warning: %s: %s\n", f_devgroups,
+ strerror(errno));
+
xtables_register_match(&devgroup_mt_reg);
}