netfilter_ipv4.h:13:47: fatal error: limits.h: No such file or directory

Bug #929715 reported by Guillaume Hain
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

I'm writing kernel module that include the file linux/netfilter_ipv4.h from linux-headers.

In order to have access to IP Hooks I'm doing a "#undef __KERNEL__" before the include.
When I do the make it complains with the error message:

$ make
make -C /lib/modules/3.2.0-15-generic/build M=/home/zedtux/Developments/kernel_module modules
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-15-generic'
  CC [M] /home/zedtux/Developments/kernel_module/test.o
In file included from /home/zedtux/Developments/kernel_module/test.c:5:0:
include/linux/netfilter_ipv4.h:13:47: fatal error: limits.h: No such file or directory
compilation terminated.
make[2]: *** [/home/zedtux/Developments/kernel_module/test.o] Error 1
make[1]: *** [_module_/home/zedtux/Developments/kernel_module] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-15-generic'
make: *** [all] Error 2

When I edit the file /usr/src/linux-headers-3.2.0-15-generic/include/linux/netfilter_ipv4.h at line 13 and I change "#include <limits.h>" to "#include <linux/limits.h>" then the make works.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: linux-image-3.2.0-15-generic 3.2.0-15.24
ProcVersionSignature: Ubuntu 3.2.0-15.24-generic 3.2.5
Uname: Linux 3.2.0-15-generic x86_64
AlsaDevices:
 total 0
 crw-rw---T 1 root audio 116, 1 Feb 9 19:25 seq
 crw-rw---T 1 root audio 116, 33 Feb 9 19:25 timer
AplayDevices: aplay: device_list:242: no soundcards found...
ApportVersion: 1.91-0ubuntu1
Architecture: amd64
ArecordDevices: arecord: device_list:242: no soundcards found...
AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/snd/seq', '/dev/snd/timer'] failed with exit code 1:
CRDA: Error: command ['iw', 'reg', 'get'] failed with exit code 1: nl80211 not found.
Date: Thu Feb 9 19:38:03 2012
HibernationDevice: RESUME=UUID=40037eaf-1f24-4190-8aa6-abc97288eb80
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Alpha amd64 (20120204)
IwConfig:
 lo no wireless extensions.

 eth0 no wireless extensions.
Lsusb:
 Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet
MachineType: innotek GmbH VirtualBox
PciMultimedia:

ProcEnviron:
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.2.0-15-generic root=UUID=60958f9c-f5db-4eb3-bd90-3c106fa6ee14 ro quiet splash vt.handoff=7
RelatedPackageVersions:
 linux-restricted-modules-3.2.0-15-generic N/A
 linux-backports-modules-3.2.0-15-generic N/A
 linux-firmware 1.68
RfKill:

SourcePackage: linux
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 12/01/2006
dmi.bios.vendor: innotek GmbH
dmi.bios.version: VirtualBox
dmi.modalias: dmi:bvninnotekGmbH:bvrVirtualBox:bd12/01/2006:svninnotekGmbH:pnVirtualBox:pvr1.2:
dmi.product.name: VirtualBox
dmi.product.version: 1.2
dmi.sys.vendor: innotek GmbH

Revision history for this message
Guillaume Hain (zedtux) wrote :
Brad Figg (brad-figg)
Changed in linux (Ubuntu):
status: New → Confirmed
Changed in linux (Ubuntu):
importance: Undecided → Medium
status: Confirmed → Triaged
Revision history for this message
Joseph Salisbury (jsalisbury) wrote :

There is a newer version of the kernel than the one you tested when this issue was found. Please test again with the newer kernel and indicate in the bug if this issue still exists or not. You can upgrade just your kernel by running the following in a terminal:

sudo apt-get update
sudo apt-get install linux

If the bug still exists in the latest kernel, please change the status back to "Confirmed". If the bug is fixed, please change the status to "Fix Released".

Thanks in advance

Revision history for this message
Guillaume Hain (zedtux) wrote :

Sorry for the very long delay...

I'm coming back to the development, and so worked on linux kernel 3.5 and still have to remove the include.

Changed in linux (Ubuntu):
status: Triaged → Confirmed
Revision history for this message
Guillaume Hain (zedtux) wrote :

Any news regarding this issue ?

Revision history for this message
Guillaume Hain (zedtux) wrote :

Today upgraded my kernel to 3.5.0-22 and the bug is still there.

Removing the include still fix that issue.

Revision history for this message
Guillaume Hain (zedtux) wrote :

Again today upgraded my kernel 3.5.0-23 and the bug is still there.

Removing the include still fix that issue.

Revision history for this message
Guillaume Hain (zedtux) wrote :

New kernel 3.5.0-24 and the bug is still there.

Removing the include still fix that issue.

Revision history for this message
Guillaume Hain (zedtux) wrote :

Today brand new version of the kernel: 3.5.0-25 and still this bug.

Removing the include still fix that issue.

Revision history for this message
Guillaume Hain (zedtux) wrote :

In my Virtual Machine Ubuntu 12.04 has the same bug.

I have updated the kernel to 3.2.0-38 and make failed.
Removing the line still fix that issue.

Revision history for this message
Guillaume Hain (zedtux) wrote :

Today new update of the kernel (3.5.0-26) and still the same issue.

Removing the include fix the issue.

Revision history for this message
Guillaume Hain (zedtux) wrote :

Again new update of the kernel (3.5.0-27) and same issue and again fixed by removing the include of limits.h file.

Revision history for this message
Guillaume Hain (zedtux) wrote :

Upgrading to Ubuntu 13.04 doesn't solved the issue with kernel version 3.8.0-19.

And of course removing the usual include solve the issue.

Revision history for this message
Guillaume Hain (zedtux) wrote :

I will write a very small example of this issue and the procedure to reproduce it.

Revision history for this message
Guillaume Hain (zedtux) wrote :

I have just upgraded to kernel 3.8.0-19 and I still have the issue.

I have created a small project with the code that reproduce the issue: https://github.com/zedtux/launchpad_bug_929715.

Revision history for this message
Guillaume Hain (zedtux) wrote :

Since kernel 3.8.0-21 the path of netfilter_ipv4.h file changed:

   include/uapi/linux/netfilter_ipv4.h:13:47: fatal error: limits.h: No such file or directory

Revision history for this message
Guillaume Hain (zedtux) wrote :

Still the same issue with the kernel 3.8.0-22...

Revision history for this message
Guillaume Hain (zedtux) wrote :

Having spent more time on this I found a fix on my machine (right now with kernel version 3.8.0-29).

Updating the line 13 of include/uapi/linux/netfilter_ipv4.h from:

#include <limits.h> /* for INT_MIN, INT_MAX */

to:

#include <linux/limits.h> /* for INT_MIN, INT_MAX */

fixed the issue.

Revision history for this message
Guillaume Hain (zedtux) wrote :

Well now I have a DKMS package, trying to compile on a fresh Ubuntu installation that fail, due to this error.
So the package is not able to install correctly my module.

Could someone give an update regarding this issue?
Is it possible do find a workaround until this issue is fixed?

Revision history for this message
Guillaume Hain (zedtux) wrote :

Any news regarding this issue ?

Revision history for this message
kappen (kappen) wrote :

still an issue !

more /usr/src/linux-headers-3.13.0-35-generic/include/uapi/linux/netfilter_ipv4.h
/* IPv4-specific defines for netfilter.
 * (C)1998 Rusty Russell -- This code is GPL.
 */
#ifndef _UAPI__LINUX_IP_NETFILTER_H
#define _UAPI__LINUX_IP_NETFILTER_H

#include <linux/netfilter.h>

/* only for userspace compatibility */
#ifndef __KERNEL__

#include <limits.h> /* for INT_MIN, INT_MAX */

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.