Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 558234
Collapse All | Expand All

(-)a/extensions/libxt_connlabel.c (-7 / +20 lines)
Lines 29-39 static const struct xt_option_entry connlabel_mt_opts[] = { Link Here
29
	XTOPT_TABLEEND,
29
	XTOPT_TABLEEND,
30
};
30
};
31
31
32
/* cannot do this via _init, else static builds might spew error message
33
 * for every iptables invocation.
34
 */
35
static void connlabel_open(void)
36
{
37
	if (map)
38
		return;
39
40
	map = nfct_labelmap_new(NULL);
41
	if (!map && errno)
42
		xtables_error(RESOURCE_PROBLEM, "cannot open connlabel.conf: %s\n",
43
			strerror(errno));
44
}
45
32
static void connlabel_mt_parse(struct xt_option_call *cb)
46
static void connlabel_mt_parse(struct xt_option_call *cb)
33
{
47
{
34
	struct xt_connlabel_mtinfo *info = cb->data;
48
	struct xt_connlabel_mtinfo *info = cb->data;
35
	int tmp;
49
	int tmp;
36
50
51
	connlabel_open();
37
	xtables_option_parse(cb);
52
	xtables_option_parse(cb);
38
53
39
	switch (cb->entry->id) {
54
	switch (cb->entry->id) {
Lines 54-60 static void connlabel_mt_parse(struct xt_option_call *cb) Link Here
54
69
55
static const char *connlabel_get_name(int b)
70
static const char *connlabel_get_name(int b)
56
{
71
{
57
	const char *name = nfct_labelmap_get_name(map, b);
72
	const char *name;
73
74
	connlabel_open();
75
76
	name = nfct_labelmap_get_name(map, b);
58
	if (name && strcmp(name, ""))
77
	if (name && strcmp(name, ""))
59
		return name;
78
		return name;
60
	return NULL;
79
	return NULL;
Lines 114-124 static struct xtables_match connlabel_mt_reg = { Link Here
114
133
115
void _init(void)
134
void _init(void)
116
{
135
{
117
	map = nfct_labelmap_new(NULL);
118
	if (!map) {
119
		fprintf(stderr, "cannot open connlabel.conf, not registering '%s' match: %s\n",
120
			connlabel_mt_reg.name, strerror(errno));
121
		return;
122
	}
123
	xtables_register_match(&connlabel_mt_reg);
136
	xtables_register_match(&connlabel_mt_reg);
124
}
137
}

Return to bug 558234