Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

upgrading from tarball in FreeBSD

0 views
Skip to first unread message

Cy Schubert - ITSD Open Systems Group

unread,
Apr 11, 2001, 9:55:31 AM4/11/01
to
In message <200104061916...@ns1.unixathome.org>, "Dan
Langille" write
s:
> In the past I've upgraded ipf sucessfully using the tarball from the ftp
> server (e.g. ftp://coombs.anu.edu.au/pub/net/ip-filter/ip_fil3.4.17.tar.gz).
>
> But because ipf is also part of the base system, you wind up with
> duplicated binaries and man pages. When you later cvsup and build
> world, you again have duplicate binaries...
>
> Is there a way to use the tarball to upgrade so that conflicts with later
> cvsups/build worlds are avoided? i.e. make the tarball install at the
> same locations as the build world?

Yes. I do this. It also makes for a buildworld that won't fail
because of one version of IPF in the kernel sources and another version
in bin.

I assume you're talking about FreeBSD, as I believe you're the
owner/operator of freebsddiary.org.

What I do is replace IP Filter in the FreeBSD src/contrib directory.
My procedure is generally:

1. Extract IP Filter into src/contrib.

2. Rename src/contrib/ipfilter to ipfilter.orig.

3. Point a symlink named src/contrib/ipfilter to the newly
created IP Filter directory, e.g. ln -s ip_fil3.4.17 ipfilter.

4. Cd to the IP Filter directory, e.g. src/contrib/ipfilter, and apply
the following patch. This patch only works on and is only required
on FreeBSD-4.3-RC. The patch is not required for
FreeBSD-4.2-RELEASE
and earlier. FreeBSD-3.x required different patches. As you've
gathered by now, the patch depends on the evolution of the FreeBSD
source tree. Here's the patch for FreeBSD-4.3:

--- fils.c.orig Fri Dec 1 16:13:56 2000
+++ fils.c Fri Apr 6 15:03:50 2001
@@ -5,9 +5,6 @@
* provided that this notice is preserved and due credit is given
* to the original author and the contributors.
*/
-#ifdef __FreeBSD__
-# include <osreldate.h>
-#endif
#include <stdio.h>
#include <string.h>
#if !defined(__SVR4) && !defined(__svr4__)
--- ip_compat.h.orig Tue Apr 3 07:13:35 2001
+++ ip_compat.h Fri Apr 6 15:05:29 2001
@@ -264,10 +264,10 @@

#if defined(__FreeBSD__) && (defined(KERNEL) || defined(_KERNEL))
# ifdef IPFILTER_LKM
-# include <osreldate.h>
+# include <sys/param.h>
# define ACTUALLY_LKM_NOT_KERNEL
# else
-# include <sys/osreldate.h>
+# include <sys/param.h>
# endif
# if __FreeBSD__ < 3
# include <machine/spl.h>
--- ip_fil.c.orig Tue Apr 3 07:13:37 2001
+++ ip_fil.c Fri Apr 6 15:06:02 2001
@@ -26,11 +26,6 @@
defined(_KERNEL)
# include "opt_ipfilter_log.h"
#endif
-#if defined(__FreeBSD__) && !defined(__FreeBSD_version)
-# if !defined(_KERNEL) || defined(IPFILTER_LKM)
-# include <osreldate.h>
-# endif
-#endif
#ifndef _KERNEL
# include <stdio.h>
# include <string.h>
--- ip_log.c.orig Tue Apr 3 08:45:49 2001
+++ ip_log.c Fri Apr 6 15:06:38 2001
@@ -19,10 +19,6 @@
# if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000)
# include "opt_ipfilter.h"
# endif
-# else
-# ifdef KLD_MODULE
-# include <osreldate.h>
-# endif
# endif
#endif
#ifdef IPFILTER_LOG
--- ipf.c.orig Wed Oct 25 03:37:11 2000
+++ ipf.c Fri Apr 6 15:06:56 2001
@@ -5,9 +5,6 @@
* provided that this notice is preserved and due credit is given
* to the original author and the contributors.
*/
-#ifdef __FreeBSD__
-# include <osreldate.h>
-#endif
#include <stdio.h>
#include <unistd.h>
#include <string.h>

5. Run ./FreeBSD-4.0/kinstall from the IP Filter directory. This will
copy the kernel bits into the appropriate FreeBSD kernel
directories.

6. Buildworld as usual or if you don't care to buildworld, run the
following script to just build IP Filter:

#!/bin/sh -
# DIRS='/usr/src/sbin/ipf /usr/src/sbin/ipfstat /usr/src/sbin/ipmon
/usr/src/sbin/ipnat /usr/src/usr.sbin/ipftest /usr/src/usr.sbin/ipresend
/usr/src/usr.sbin/ipsend /usr/src/usr.sbin/iptest
/sys/modules/ipfilter'
DIRS='/usr/src/sbin/ipf /usr/src/sbin/ipfstat /usr/src/sbin/ipmon
/usr/src/sbin/ipnat /usr/src/usr.sbin/ipftest /usr/src/usr.sbin/ipresend
/usr/src/usr.sbin/ipsend /usr/src/usr.sbin/iptest'

error() {
echo $@
echo terminating abnormally
exit 1
}

echo
for I in $DIRS; do
echo "***** $I *****"
echo
cd $I || error cannot cd to $I
make cleandir || error make clean failed
# we do this twice in case there is any cruft in /usr/src itself
make cleandir || error make clean failed
make obj || error make obj failed
make || error make failed
make install cleandir || error make install failed
echo
done

echo `basename $0` finished successfully

7. Finally build & install a new kernel and reboot.


Regards, Phone: (250)387-8437
Cy Schubert Fax: (250)387-5766
Team Leader, Sun/Alpha Team Internet: Cy.Sc...@osg.gov.bc.ca
Open Systems Group, ITSD, ISTA
Province of BC

Darren Reed

unread,
Apr 12, 2001, 6:10:36 AM4/12/01
to
Can you please fix these patches for the correct values of __FreeBSD__ ?

Thanks,
Darren

Frank Volf

unread,
Apr 12, 2001, 6:46:04 AM4/12/01
to
Darren Reed wrote:
> Can you please fix these patches for the correct values of __FreeBSD__ ?

I use the following (recent 4-STABLE do no longer allow to include
osreldate.h in kernel mode). As far, as I could trace, any __FreeBSD__ 4
system, has this in sys/param.h as well.

However, I haven't test this on any older FreeBSD versions, so I might
have overlooked something....

Frank


diff -ru ip_fil3.4.17.dist/ip_compat.h ip_fil3.4.17.osreldate/ip_compat.h
--- ip_fil3.4.17.dist/ip_compat.h Tue Apr 3 16:13:35 2001
+++ ip_fil3.4.17.osreldate/ip_compat.h Sat Apr 7 20:13:59 2001
@@ -263,11 +263,17 @@




#if defined(__FreeBSD__) && (defined(KERNEL) || defined(_KERNEL))

-# ifdef IPFILTER_LKM
-# include <osreldate.h>
-# define ACTUALLY_LKM_NOT_KERNEL
+# if __FreeBSD__ >= 4
+# include <sys/param.h>


# else
-# include <sys/osreldate.h>

+# ifdef IPFILTER_LKM
+# include <osreldate.h>
+# else
+# include <sys/osreldate.h>
+# endif
+# endif
+# ifdef IPFILTER_LKM
+# define ACTUALLY_LKM_NOT_KERNEL


# endif
# if __FreeBSD__ < 3
# include <machine/spl.h>

diff -ru ip_fil3.4.17.dist/ip_log.c ip_fil3.4.17.osreldate/ip_log.c
--- ip_fil3.4.17.dist/ip_log.c Tue Apr 3 17:45:49 2001
+++ ip_fil3.4.17.osreldate/ip_log.c Sat Apr 7 20:15:16 2001
@@ -21,7 +21,11 @@
# endif
# else


# ifdef KLD_MODULE
-# include <osreldate.h>

+# if __FreeBSD__ >= 4
+# include <sys/param.h>
+# else
+# include <osreldate.h>
+# endif
# endif
# endif
#endif


Frank Volf

unread,
Apr 12, 2001, 6:52:10 AM4/12/01
to
Darren Reed wrote:
> Can you please fix these patches for the correct values of __FreeBSD__ ?

And will we are at FreeBSD 4, issue you might want to copy

2 -rw-r--r-- 1 volf volf 1553 Oct 19 16:23 ipv6-patch-4.1

to

2 -rw-r--r-- 1 root volf 1553 Apr 8 10:46 ipv6-patch-4.2
2 -rw-r--r-- 1 root volf 1553 Apr 8 10:46 ipv6-patch-4.3

in the FreeBSD-4.0 directory , so the kinstall script finds these patches as
well for system releases > 4.1

Frank

Frank Volf

unread,
Apr 12, 2001, 12:52:05 PM4/12/01
to
Frank Volf wrote:
> Darren Reed wrote:
> > Can you please fix these patches for the correct values of __FreeBSD__ ?
>
> And will we are at FreeBSD 4, issue you might want to copy

Doing something fast is never I good idea. This sentence should read:

"And while we are at FreeBSD 4, another issue is that you might want to copy"

Sorry about that.

Frank

Cy Schubert - ITSD Open Systems Group

unread,
Apr 13, 2001, 11:32:29 PM4/13/01
to
In message <2001041209...@avalon.reed.wattle.id.au>, Darren
Reed writes

:
> Can you please fix these patches for the correct values of __FreeBSD__ ?

--- fils.c.orig Fri Dec 1 16:13:56 2000
+++ fils.c Fri Apr 13 07:26:14 2001
@@ -5,8 +5,14 @@


* provided that this notice is preserved and due credit is given
* to the original author and the contributors.
*/
-#ifdef __FreeBSD__
-# include <osreldate.h>

+#ifdef __FreeBSD__
+# ifndef __FreeBSD_cc_version


+# include <osreldate.h>
+# else

+# if __FreeBSD_cc_version < 430000


+# include <osreldate.h>
+# endif

+# endif
#endif
#include <stdio.h>
#include <string.h>


--- ip_compat.h.orig Tue Apr 3 07:13:35 2001

+++ ip_compat.h Fri Apr 13 09:07:00 2001
@@ -264,10 +264,26 @@



#if defined(__FreeBSD__) && (defined(KERNEL) || defined(_KERNEL))

# ifdef IPFILTER_LKM
-# include <osreldate.h>

+# ifndef __FreeBSD_cc_version


+# include <osreldate.h>
+# else

+# if __FreeBSD_cc_version < 430000


+# include <osreldate.h>
+# else

+# include <sys/param.h>
+# endif
+# endif
# define ACTUALLY_LKM_NOT_KERNEL


# else
-# include <sys/osreldate.h>

+# ifndef __FreeBSD_cc_version
+# include <sys/osreldate.h>
+# else
+# if __FreeBSD_cc_version < 430000
+# include <sys/osreldate.h>
+# else
+# include <sys/param.h>
+# endif
+# endif
# endif


# if __FreeBSD__ < 3
# include <machine/spl.h>

--- ip_fil.c.orig Tue Apr 3 07:13:37 2001

+++ ip_fil.c Fri Apr 13 09:07:10 2001
@@ -28,7 +28,13 @@
#endif
#if defined(__FreeBSD__) && !defined(__FreeBSD_version)


# if !defined(_KERNEL) || defined(IPFILTER_LKM)
-# include <osreldate.h>

+# ifndef __FreeBSD_cc_version


+# include <osreldate.h>
+# else

+# if __FreeBSD_cc_version < 430000


+# include <osreldate.h>
+# endif

+# endif
# endif
#endif
#ifndef _KERNEL


--- ip_log.c.orig Tue Apr 3 08:45:49 2001

+++ ip_log.c Fri Apr 13 09:07:18 2001
@@ -21,7 +21,13 @@


# endif
# else
# ifdef KLD_MODULE
-# include <osreldate.h>

+# ifndef __FreeBSD_cc_version


+# include <osreldate.h>
+# else

+# if __FreeBSD_cc_version < 430000


+# include <osreldate.h>
+# endif
+# endif
# endif
# endif
#endif

--- ipf.c.orig Wed Oct 25 03:37:11 2000

+++ ipf.c Fri Apr 13 09:05:05 2001
@@ -6,7 +6,13 @@


* to the original author and the contributors.
*/

#ifdef __FreeBSD__
-# include <osreldate.h>
+# ifndef __FreeBSD_cc_version


+# include <osreldate.h>
+# else

+# if __FreeBSD_cc_version < 430000


+# include <osreldate.h>
+# endif

+# endif
#endif
#include <stdio.h>
#include <unistd.h>
--- ipfs.c.orig Tue Apr 3 07:14:09 2001
+++ ipfs.c Fri Apr 13 09:07:33 2001
@@ -6,7 +6,13 @@


* to the original author and the contributors.
*/

#ifdef __FreeBSD__
-# include <osreldate.h>
+# ifndef __FreeBSD_cc_version


+# include <osreldate.h>
+# else

+# if __FreeBSD_cc_version < 430000


+# include <osreldate.h>
+# endif

+# endif
#endif
#include <stdio.h>
#include <unistd.h>
--- ipt.c.orig Mon Mar 13 14:10:25 2000
+++ ipt.c Fri Apr 13 09:07:39 2001
@@ -6,7 +6,13 @@


* to the original author and the contributors.
*/

#ifdef __FreeBSD__
-# include <osreldate.h>
+# ifndef __FreeBSD_cc_version


+# include <osreldate.h>
+# else

+# if __FreeBSD_cc_version < 430000


+# include <osreldate.h>
+# endif

+# endif
#endif
#include <stdio.h>
#include <assert.h>
--- mlf_ipl.c.orig Mon Nov 27 02:44:46 2000
+++ mlf_ipl.c Fri Apr 13 09:07:49 2001
@@ -15,10 +15,22 @@

#if defined(__FreeBSD__) && (__FreeBSD__ > 1)


# ifdef IPFILTER_LKM
-# include <osreldate.h>

+# ifndef __FreeBSD_cc_version


+# include <osreldate.h>
+# else

+# if __FreeBSD_cc_version < 430000


+# include <osreldate.h>
+# endif

+# endif
# define ACTUALLY_LKM_NOT_KERNEL


# else
-# include <sys/osreldate.h>

+# ifndef __FreeBSD_cc_version
+# include <sys/osreldate.h>
+# else
+# if __FreeBSD_cc_version < 430000


+# include <sys/osreldate.h>
+# endif
+# endif

# endif
#endif
#include <sys/systm.h>

0 new messages