summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/libipt_realm.c18
-rw-r--r--extensions/libxt_devgroup.c17
2 files changed, 14 insertions, 21 deletions
diff --git a/extensions/libipt_realm.c b/extensions/libipt_realm.c
index 8eea7874..75009105 100644
--- a/extensions/libipt_realm.c
+++ b/extensions/libipt_realm.c
@@ -28,18 +28,10 @@ static const struct xt_option_entry realm_opts[] = {
XTOPT_TABLEEND,
};
-/* array of realms from /etc/iproute2/rt_realms */
+static const char f_realms[] = "/etc/iproute2/rt_realms";
+/* array of realms from f_realms[] */
static struct xtables_lmap *realms;
-static void realm_init(struct xt_entry_match *m)
-{
- const char file[] = "/etc/iproute2/rt_realms";
-
- realms = xtables_lmap_init(file);
- if (realms == NULL && errno != ENOENT)
- fprintf(stderr, "Warning: %s: %s\n", file, strerror(errno));
-}
-
static void realm_parse(struct xt_option_call *cb)
{
struct xt_realm_info *realminfo = cb->data;
@@ -151,7 +143,6 @@ static struct xtables_match realm_mt_reg = {
.size = XT_ALIGN(sizeof(struct xt_realm_info)),
.userspacesize = XT_ALIGN(sizeof(struct xt_realm_info)),
.help = realm_help,
- .init = realm_init,
.print = realm_print,
.save = realm_save,
.x6_parse = realm_parse,
@@ -161,5 +152,10 @@ static struct xtables_match realm_mt_reg = {
void _init(void)
{
+ realms = xtables_lmap_init(f_realms);
+ if (realms == NULL && errno != ENOENT)
+ fprintf(stderr, "Warning: %s: %s\n", f_realms,
+ strerror(errno));
+
xtables_register_match(&realm_mt_reg);
}
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);
}