<html>
    <head>
      <base href="https://bugzilla.netfilter.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - The include guards on the include/libipset/linux_ip_set*.h are wrong"
   href="https://bugzilla.netfilter.org/show_bug.cgi?id=1139">1139</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>The include guards on the include/libipset/linux_ip_set*.h are wrong
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>ipset
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86_64
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P5
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>default
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>netfilter-buglog@lists.netfilter.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>quentin@armitage.org.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The header files include/libipset/linux_ip_set*.h are copies of the kernel
headers, which are be installed if kernel headers are installed. Since the two
sets of headers define the same things, it is necessary that the include guards
are the same so that including one stops the definitions etc from the other
being included. In some cases it is not possible to exclusively use either one
set of header files or the other, since it can be necessary, for example, to
include both libipset/session.h and linux/netfilter/xt_set.h and the former
includes libipset/linux_ip_set.h and the latter includes
linux/netfilter/ipset/ip_set.h.

Although in the kernel source code the headers include '_UAPI' as part of the
include guard define, it is removed as part of the processing by
scripts/headers_install.sh in the kernel source, which at aroundabout line 39
has the following:

-e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \

which removes the _UAPI string prefix from the guard.

In order to resolve this, in the ipset top level Makefile.am, in
update_includes section, it needs to be changed from:

update_includes:
    for x in ip_set.h ip_set_bitmap.h ip_set_hash.h ip_set_list.h; do \
        cp kernel/include/uapi/linux/netfilter/ipset/$$x \
        include/libipset/linux_$$x; \
    done

to

update_includes:
    for x in ip_set.h ip_set_bitmap.h ip_set_hash.h ip_set_list.h; do \
        sed -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \
                     kernel/include/uapi/linux/netfilter/ipset/$$x \
             >include/libipset/linux_$$x; \
    done

It is possible that the whole sed command from scripts/headers_install.sh
should be replicated in the ipset Makefile.am, viz:
        sed -r \
                -e 's/([ \t(])(__user|__force|__iomem)[ \t]/\1/g' \
                -e 's/__attribute_const__([ \t]|$)/\1/g' \
                -e 's@^#include <linux/compiler.h>@@' \
                -e
's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
                -e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \
                -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \

but I think none of the other substitutions actually apply.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are watching all bug changes.</li>
      </ul>
    </body>
</html>