• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/iptables/0006-fix-connlabel-conf-warning.patch
Thomas De SchampheleireThomas De Schampheleire committed 228bdab434419 Oct 2015
Raw file
Source viewDiff to previous
xxxxxxxxxx
 
1
From 825fbda5482a7d5ec5a6619c81fe07ff865c7d6e Mon Sep 17 00:00:00 2001
2
From: Florian Westphal <fw@strlen.de>
3
Date: Fri, 5 Sep 2014 20:45:56 +0200
4
Subject: extensions: libxt_connlabel: do not open config file from _init hook
5
​
6
else, static builds will print this for every iptables invocation,
7
even 'iptables -L'.  Delay open until we need to translate a mapping.
8
​
9
Reported-by: Thomas De Schampheleire <patrickdepinguin@gmail.com>
10
Signed-off-by: Florian Westphal <fw@strlen.de>
11
[Thomas De Schampheleire: import unchanged into Buildroot]
12
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
13
​
14
diff --git a/extensions/libxt_connlabel.c b/extensions/libxt_connlabel.c
15
index c84a167..1f83095 100644
16
--- a/extensions/libxt_connlabel.c
17
+++ b/extensions/libxt_connlabel.c
18
@@ -29,11 +29,26 @@ static const struct xt_option_entry connlabel_mt_opts[] = {
19
    XTOPT_TABLEEND,
20
 };
21
 
22
+/* cannot do this via _init, else static builds might spew error message
23
+ * for every iptables invocation.
24
+ */
25
+static void connlabel_open(void)
26
+{
27
+   if (map)
28
+       return;
29
+
30
+   map = nfct_labelmap_new(NULL);
31
+   if (!map && errno)
32
+       xtables_error(RESOURCE_PROBLEM, "cannot open connlabel.conf: %s\n",
33
+           strerror(errno));
34
+}
35
+
36
 static void connlabel_mt_parse(struct xt_option_call *cb)
37
 {
38
    struct xt_connlabel_mtinfo *info = cb->data;
39
    int tmp;
40
 
41
+   connlabel_open();
42
    xtables_option_parse(cb);
43
 
44
    switch (cb->entry->id) {
45
@@ -54,7 +69,11 @@ static void connlabel_mt_parse(struct xt_option_call *cb)
46
 
47
 static const char *connlabel_get_name(int b)
48
 {
49
-   const char *name = nfct_labelmap_get_name(map, b);
50
+   const char *name;
51
+
52
+   connlabel_open();
53
+
54
+   name = nfct_labelmap_get_name(map, b);
55
    if (name && strcmp(name, ""))
56
        return name;
57
    return NULL;
58
@@ -114,11 +133,5 @@ static struct xtables_match connlabel_mt_reg = {
59
 
60
 void _init(void)
61
 {
62
-   map = nfct_labelmap_new(NULL);
63
-   if (!map) {
64
-       fprintf(stderr, "cannot open connlabel.conf, not registering '%s' match: %s\n",
65
-           connlabel_mt_reg.name, strerror(errno));
66
-       return;
67
-   }
68
    xtables_register_match(&connlabel_mt_reg);
69
 }
70
-- 
71
cgit v0.10.1
72
​
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.