Skip to contentSkip to conversation

Building iptables from source with kernel source

DISCUSSION Arif Hossain 2 participants 4 messages Jul 30, 2012 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,

I'm trying to build iptables from git tree.

The extension i've written resides in extensions/libxt_mymatch.c

Now the header is in <kernel_source>/include/linux/netfilter/xt_mymatch.h

But when i'm trying to build iptables, its not finding xt_mymatch.h.

I've tried these configure options

$./configure --with-ksource=<kernel_source_path> and
$./configure --with-ksource=<kernel_source_path>/include

But both failed.

On the side not I want to prevent the build process to look up for declarations in "kernel-devel" that is /usr/src/linux. I want the build to be dependent only to the kernel_source i'm supplying. (Its because i'm using a modified kernel source, so i don't want to take any declaration from distribution's kernel package.

Signature · 4 lines
Cheers

aft
[email protected]
#1 lore raw
Quoted 8 lines · Arif Hossain

Hi,

I'm trying to build iptables from git tree.

The extension i've written resides in extensions/libxt_mymatch.c

Now the header is in <kernel_source>/include/linux/netfilter/xt_mymatch.h

iptables is independent of any particular kernel tree. Copy (or symlink) your file into <iptables>/include/linux/netfilter, that is easiest.

Quoted 10 lines

But when i'm trying to build iptables, its not finding xt_mymatch.h.

I've tried these configure options

$./configure --with-ksource=<kernel_source_path> and
$./configure --with-ksource=<kernel_source_path>/include

But both failed.

That is too unspecified to derive any cause.
(Also note that ksource uses the source dir, not the include dir.)

#2 lore raw
Quoted 2 lines · Jan Engelhardt

On Monday 2012-07-30 13:01, Arif Hossain wrote:

<snip>

Quoted 4 lines

iptables is independent of any particular kernel tree. Copy (or symlink) your file into <iptables>/include/linux/netfilter, that is easiest.

I've thought this easy way out actually. But i just hate the manual copying of same file. If i update something in one, i will have to remember to copy it before building it,because build will be ok with old file. That may lead to undefined behavior.

Not a great fan of symlinks either.

<snip>

Quoted 2 lines

That is too unspecified to derive any cause.
(Also note that ksource uses the source dir, not the include dir.)

Error message is trivial, "can not find file <xt_mymatch.h>.

Signature · 4 lines
Cheers

aft
[email protected]
#3 lore raw
Quoted 14 lines · Arif Hossain
Quoted 2 lines · Jan Engelhardt

On Monday 2012-07-30 13:01, Arif Hossain wrote:

<snip>

Quoted 4 lines

iptables is independent of any particular kernel tree. Copy (or symlink) your file into <iptables>/include/linux/netfilter, that is easiest.

I've thought this easy way out actually. But i just hate the manual copying of same file. If i update something in one, i will have to remember to copy it before building it,because build will be ok with old file. That may lead to undefined behavior.

Quoted 8 lines

Not a great fan of symlinks either.

<snip>

Quoted 2 lines

That is too unspecified to derive any cause.
(Also note that ksource uses the source dir, not the include dir.)

Error message is trivial, "can not find file <xt_mymatch.h>.

That is because you are supposed to

  #include  <linux/netfilter/xt_mymatch.h>

provided the file is in

$kerneldir/include/linux/netfilter/ or
$iptablesinclude/include/linux/netfilter/

Looking at the existing extensions can help ;)