The old Linux IGD

I love me some iptables and I also like having upnp running on my linux box, but the problem is my favorite linux upnp service is not maintained anymore.

When attempting to compile on a recent CentOS 6.5 os you are plagued with undeclared errors:

gcc -m32 -Wall -g -O2 -I/usr/include -I../include -c main.c main.c: In function ‘main’: main.c:39: warning: implicit declaration of function ‘strcmp’ main.c:45: warning: implicit declaration of function ‘strncpy’ main.c:45: warning: incompatible implicit declaration of built-in function ‘strncpy’ gcc -m32 -Wall -g -O2 -I/usr/include -I../include -c gatedevice.c gatedevice.c: In function ‘GetConnectionTypeInfo’: gatedevice.c:208: warning: implicit declaration of function ‘snprintf’ gatedevice.c:208: warning: incompatible implicit declaration of built-in function ‘snprintf’ gatedevice.c: In function ‘GetNATRSIPStatus’: gatedevice.c:237: warning: incompatible implicit declaration of built-in function ‘snprintf’ gatedevice.c: In function ‘GetCommonLinkProperties’: gatedevice.c:302: warning: incompatible implicit declaration of built-in function ‘snprintf’ gatedevice.c: In function ‘GetTotal’: gatedevice.c:333: error: ‘FILE’ undeclared (first use in this function) gatedevice.c:333: error: (Each undeclared identifier is reported only once gatedevice.c:333: error: for each function it appears in.) gatedevice.c:333: error: ‘proc’ undeclared (first use in this function) gatedevice.c:337: warning: implicit declaration of function ‘fopen’ gatedevice.c:340: warning: implicit declaration of function ‘fprintf’ gatedevice.c:340: warning: incompatible implicit declaration of built-in function ‘fprintf’ gatedevice.c:340: error: ‘stderr’ undeclared (first use in this function) gatedevice.c:345: warning: implicit declaration of function ‘fscanf’ gatedevice.c:345: warning: incompatible implicit declaration of built-in function ‘fscanf’ gatedevice.c:350: error: ‘EOF’ undeclared (first use in this function) gatedevice.c:352: warning: implicit declaration of function ‘fclose’ gatedevice.c:354: warning: incompatible implicit declaration of built-in function ‘snprintf’ gatedevice.c: In function ‘GetStatusInfo’: gatedevice.c:385: warning: incompatible implicit declaration of built-in function ‘snprintf’ gatedevice.c: In function ‘AddPortMapping’: gatedevice.c:451: warning: implicit declaration of function ‘sprintf’ gatedevice.c:451: warning: incompatible implicit declaration of built-in function ‘sprintf’ gatedevice.c:485: warning: incompatible implicit declaration of built-in function ‘snprintf’ gatedevice.c: In function ‘GetGenericPortMappingEntry’: gatedevice.c:514: warning: incompatible implicit declaration of built-in function ‘snprintf’ gatedevice.c:520: warning: incompatible implicit declaration of built-in function ‘snprintf’ gatedevice.c: In function ‘GetSpecificPortMappingEntry’: gatedevice.c:560: warning: incompatible implicit declaration of built-in function ‘snprintf’ gatedevice.c:571: warning: incompatible implicit declaration of built-in function ‘snprintf’ gatedevice.c: In function ‘GetExternalIPAddress’: gatedevice.c:610: warning: incompatible implicit declaration of built-in function ‘snprintf’ gatedevice.c: In function ‘DeletePortMapping’: gatedevice.c:653: warning: incompatible implicit declaration of built-in function ‘sprintf’ gatedevice.c:686: warning: incompatible implicit declaration of built-in function ‘snprintf’ gatedevice.c: In function ‘ExpireMapping’: gatedevice.c:776: warning: incompatible implicit declaration of built-in function ‘sprintf’ make: *** [gatedevice.o] Error 1  

To fix this you only have to modify ONE file. Simply add

#include <stdio.h>

to the very first line of gatedevice.c. Good luck and enjoy!