FreeBSD 5.4 and IPF 4.1.14, Kernel compile problem

This is a discussion on FreeBSD 5.4 and IPF 4.1.14, Kernel compile problem within the IPFilter forums, part of the System Security and Security Related category; This is a multi-part message in MIME format. --------------080300050500020201060705 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-...


Go Back   Usenet Forums > System Security and Security Related > IPFilter

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-26-2006
N. Ersen SISECI
 
Posts: n/a
Default FreeBSD 5.4 and IPF 4.1.14, Kernel compile problem

This is a multi-part message in MIME format.
--------------080300050500020201060705
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit


Hi,

After applying Andrey's patch, ipfilter binaries compiled. But kernel
didn't.

I got the following error:

cc -c -O -pipe -Wall -Wredundant-decls -Wnested-externs
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline
-Wcast-qual -fformat-extensions -std=c99 -nostdinc -I- -I.
-I/usr/src/sys -I/usr/src/sys/contrib/dev/acpica
-I/usr/src/sys/contrib/altq -I/usr/src/sys/contrib/ipfilter
-I/usr/src/sys/contrib/pf -I/usr/src/sys/contrib/dev/ath
-I/usr/src/sys/contrib/dev/ath/freebsd -I/usr/src/sys/contrib/ngatm
-D_KERNEL -include opt_global.h -fno-common -finline-limit=8000 --param
inline-unit-growth=100 --param large-function-growth=1000
-mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx
-mno-3dnow -mno-sse -mno-sse2 -ffreestanding -Werror
/usr/src/sys/contrib/ipfilter/netinet/fil.c
/usr/src/sys/contrib/ipfilter/netinet/fil.c: In function `ipf_genericiter':
/usr/src/sys/contrib/ipfilter/netinet/fil.c:6796: warning: type of "uid"
defaults to "int"
*** Error code 1


ipf_genericiter's code is below

/*
------------------------------------------------------------------------ */
/* Function:
fr_genericiter */
/* Returns: int - 0 = success, else
error */
/* Parameters: data(I) - the token type to
match */
/* uid(I) - uid owning the
token */
/* ptr(I) - context pointer for the
token */
/*
*/
/*
------------------------------------------------------------------------ */
int ipf_genericiter(data, uid, ctx)
void *data, *ctx;
{
ipftoken_t *token;
ipfgeniter_t iter;


ip_fil.h says uid is integer.
extern int ipf_genericiter __P((void *, int, void *));

And adding
int uid;
line after declaration of data and ctx will solve this compile problem.

After that, trying to make buildkernel gives the following error

linking kernel
fil.o(.text+0x4b7f): In function `ipf_freetoken':
: undefined reference to `ip_lookup_iterderef'
*** Error code 1

Kernel Conf:

options IPFILTER
options IPFILTER_LOG



--
Necati Ersen SISECI
EnderUnix Core Team Member
EnderUnix SDT ~ Turkey
http://www.enderunix.org





-------- Orijinal Mesaj --------
Konu: FreeBSD 5.4 and IPF 4.1.14 compile problem
Tarih: Fri, 13 Oct 2006 14:23:22 +0300
Kimden: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
Kime: N. Ersen SISECI <siseci@gmail.com>



Merhaba,

The same problem with FreeBSD 6.x. I sent description of this
and other problems to Darren. Using the following patch I can
compile it on FreeBSD 6.x and 5.5, but on 6.x I got one panic
(I will try to reproduce it again).

--- ip_fil_freebsd.c.orig Mon Sep 25 13:21:35 2006
+++ ip_fil_freebsd.c Fri Oct 13 10:39:49 2006
@@ -65,6 +65,9 @@
# endif
#endif
#include <net/route.h>
+#if (__FreeBSD_version >= 501000)
+# include <net/netisr.h>
+#endif
#include <netinet/in.h>
#include <netinet/in_var.h>
#include <netinet/in_systm.h>
@@ -441,7 +444,7 @@
, p)
# if (__FreeBSD_version >= 500024)
struct thread *p;
-# define p_uid t_proc->p_cred->p_ruid
+# define p_uid td_ucred->cr_ruid
# else
struct proc *p;
# define p_uid p_cred->p_ruid
@@ -1600,13 +1603,13 @@
return ip;
}

+extern struct ifqueue ipintrq;

int ipf_inject(fin, m)
fr_info_t *fin;
mb_t *m;
{
int error;
- mb_t *m;

if (fin->fin_out == 0) {
struct ifqueue *ifq;
@@ -1615,6 +1618,7 @@

#if (__FreeBSD_version >= 501000)
netisr_dispatch(NETISR_IP, m);
+ error = 0;
#else

if (IF_QFULL(ifq)) {



--------------080300050500020201060705
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<tt><br>
Hi,<br>
<br>
After applying Andrey's patch, ipfilter binaries compiled. But kernel
didn't.<br>
<br>
I got the following error:<br>
<br>
cc -c -O -pipe&nbsp; -Wall -Wredundant-decls -Wnested-externs
-Wstrict-prototypes&nbsp; -Wmissing-prototypes -Wpointer-arith -Winline
-Wcast-qual&nbsp; -fformat-extensions -std=c99&nbsp; -nostdinc -I-&nbsp; -I.
-I/usr/src/sys -I/usr/src/sys/contrib/dev/acpica
-I/usr/src/sys/contrib/altq -I/usr/src/sys/contrib/ipfilter
-I/usr/src/sys/contrib/pf -I/usr/src/sys/contrib/dev/ath
-I/usr/src/sys/contrib/dev/ath/freebsd -I/usr/src/sys/contrib/ngatm
-D_KERNEL -include opt_global.h -fno-common -finline-limit=8000 --param
inline-unit-growth=100 --param large-function-growth=1000&nbsp;
-mno-align-long-strings -mpreferred-stack-boundary=2&nbsp; -mno-mmx
-mno-3dnow -mno-sse -mno-sse2 -ffreestanding -Werror&nbsp;
/usr/src/sys/contrib/ipfilter/netinet/fil.c<br>
/usr/src/sys/contrib/ipfilter/netinet/fil.c: In function
`ipf_genericiter':<br>
/usr/src/sys/contrib/ipfilter/netinet/fil.c:6796: warning: type of
"uid" defaults to "int"<br>
*** Error code 1<br>
<br>
<br>
ipf_genericiter's code is below<br>
<br>
/*
------------------------------------------------------------------------
*/<br>
/* Function:&nbsp;&nbsp;&nbsp;
fr_genericiter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br>
/* Returns:&nbsp;&nbsp;&nbsp;&nbsp; int - 0 = success, else
error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br>
/* Parameters:&nbsp; data(I) - the token type to
match&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp; */<br>
/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uid(I)&nbsp; - uid owning the
token&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br>
/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ptr(I)&nbsp; - context pointer for the
token&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp; */<br>
/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
*/<br>
/*
------------------------------------------------------------------------
*/<br>
int ipf_genericiter(data, uid, ctx)<br>
void *data, *ctx;<br>
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ipftoken_t *token;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ipfgeniter_t iter;<br>
<br>
<br>
</tt><tt>ip_fil.h says uid is integer.<br>
extern int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp; ipf_genericiter __P((void *, int, void *));<br>
<br>
</tt><tt>And adding <br>
int uid;<br>
line after declaration of data and ctx will solve this compile problem.<br>
<br>
After that, trying to make buildkernel gives the following error<br>
<br>
linking kernel<br>
fil.o(.text+0x4b7f): In function `ipf_freetoken':<br>
: undefined reference to `ip_lookup_iterderef'<br>
*** Error code 1<br>
<br>
Kernel Conf:<br>
<br>
options IPFILTER<br>
options IPFILTER_LOG<br>
<br>
<br>
<br>
-- <br>
Necati Ersen SISECI<br>
EnderUnix Core Team Member<br>
EnderUnix SDT ~ Turkey <br>
<a class="moz-txt-link-freetext" href="http://www.enderunix.org">http://www.enderunix.org</a><br>
<br>
</tt><tt><br>
<br>
<br>
<br>
-------- Orijinal Mesaj --------</tt>
<table class="moz-email-headers-table" border="0" cellpadding="0"
cellspacing="0">
<tbody>
<tr>
<th align="right" nowrap="nowrap" valign="baseline"><tt>Konu: </tt></th>
<td><tt>FreeBSD 5.4 and IPF 4.1.14 compile problem</tt></td>
</tr>
<tr>
<th align="right" nowrap="nowrap" valign="baseline"><tt>Tarih: </tt></th>
<td><tt>Fri, 13 Oct 2006 14:23:22 +0300</tt></td>
</tr>
<tr>
<th align="right" nowrap="nowrap" valign="baseline"><tt>Kimden: </tt></th>
<td><tt>Andrey Simonenko <a class="moz-txt-link-rfc2396E" href="mailto:simon@comsys.ntu-kpi.kiev.ua">&lt;simon@comsys.ntu-kpi.kiev.ua&gt;</a></tt></td>
</tr>
<tr>
<th align="right" nowrap="nowrap" valign="baseline"><tt>Kime: </tt></th>
<td><tt>N. Ersen SISECI <a class="moz-txt-link-rfc2396E" href="mailto:siseci@gmail.com">&lt;siseci@gmail.co m&gt;</a></tt></td>
</tr>
</tbody>
</table>
<tt><br>
<br>
</tt>
<pre><tt>Merhaba,

The same problem with FreeBSD 6.x. I sent description of this
and other problems to Darren. Using the following patch I can
compile it on FreeBSD 6.x and 5.5, but on 6.x I got one panic
(I will try to reproduce it again).

--- ip_fil_freebsd.c.orig Mon Sep 25 13:21:35 2006
+++ ip_fil_freebsd.c Fri Oct 13 10:39:49 2006
@@ -65,6 +65,9 @@
# endif
#endif
#include &lt;net/route.h&gt;
+#if (__FreeBSD_version &gt;= 501000)
+# include &lt;net/netisr.h&gt;
+#endif
#include &lt;netinet/in.h&gt;
#include &lt;netinet/in_var.h&gt;
#include &lt;netinet/in_systm.h&gt;
@@ -441,7 +444,7 @@
, p)
# if (__FreeBSD_version &gt;= 500024)
struct thread *p;
-# define p_uid t_proc-&gt;p_cred-&gt;p_ruid
+# define p_uid td_ucred-&gt;cr_ruid
# else
struct proc *p;
# define p_uid p_cred-&gt;p_ruid
@@ -1600,13 +1603,13 @@
return ip;
}

+extern struct ifqueue ipintrq;

int ipf_inject(fin, m)
fr_info_t *fin;
mb_t *m;
{
int error;
- mb_t *m;

if (fin-&gt;fin_out == 0) {
struct ifqueue *ifq;
@@ -1615,6 +1618,7 @@

#if (__FreeBSD_version &gt;= 501000)
netisr_dispatch(NETISR_IP, m);
+ error = 0;
#else

if (IF_QFULL(ifq)) {

</tt></pre>
</body>
</html>

--------------080300050500020201060705--
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:46 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0