Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Feb 2018 11:29:53 -0700
From:      John Nielsen <lists@jnielsen.net>
To:        Maurizio Vairani <maurizio1018@gmail.com>
Cc:        freebsd-current <freebsd-current@freebsd.org>, Daisuke Aoyama <aoyama@peach.ne.jp>, Ian Lepore <ian@freebsd.org>
Subject:   Re: Fatal trap 12 booting FreeBSD-CURRENT via isboot kernel module.
Message-ID:  <7D39479C-85AB-45B2-BF39-0566AC073C5A@jnielsen.net>
In-Reply-To: <CAN0zgYXw%2BWvGJKFRV0VjSCZdFKDCuWAoUcBQ8dPXA4qtvkCtWg@mail.gmail.com>
References:  <CAN0zgYXfKjKo3CjjfbEX7oSrd2NXqU6kmSXy__OVPr0y3R2Log@mail.gmail.com> <3E242843-7D43-4A36-A448-E4B0DACB2AB4@jnielsen.net> <CAN0zgYWY0QqjHNfnVmOv%2B06H8qAvjKu0N7qvSMgcUo7vi6Bt-A@mail.gmail.com> <DC546197-0C18-4C2A-8E5D-AF6846AA94F3@jnielsen.net> <5EDB0747-41DE-4ECF-925E-EF24FAA550F3@jnielsen.net> <1517943001.1366.100.camel@freebsd.org> <1C97132B-099B-4BAA-9C39-A1BE00481CAC@jnielsen.net> <CAN0zgYXw%2BWvGJKFRV0VjSCZdFKDCuWAoUcBQ8dPXA4qtvkCtWg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
> On Feb 7, 2018, at 6:07 AM, Maurizio Vairani <maurizio1018@gmail.com> wrote:
> 
> 2018-02-06 23:02 GMT+01:00 John Nielsen <lists@jnielsen.net>:
> > On Feb 6, 2018, at 11:50 AM, Ian Lepore <ian@FreeBSD.org> wrote:
> >
> > On Tue, 2018-02-06 at 11:33 -0700, John Nielsen wrote:
> >>
> >> Apparently sending a NULL socket pointer to ifioctl hasn't worked
> >> since this commit in 2011:
> >> https://svnweb.freebsd.org/base?view=revision&revision=218757
> >>
> >> So I'm going to add this patch to the port unconditionally once it
> >> works.
> >>
> >> Unfortunately, I can't compile the port with either my patch below or
> >> your original replacement version of isboot_ifup(). :( Did you make
> >> other changes? Here's the error I'm getting:
> >>
> >> --- isboot.o ---
> >> isboot.c:425:53: error: incomplete definition of type 'struct thread'
> >>     error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td);
> >>                                                   ~~^
> >> /usr/src/sys/sys/systm.h:185:8: note: forward declaration of 'struct
> >> thread'
> >> struct thread;
> >>        ^
> >> 1 error generated.
> >>
> >
> > Try adding #include <sys/proc.h> if it's not already in the list.  It
> > may be that that file got included via pollution from some other header
> > file in the past and maybe now that has changed.
> >
> > If you're already including sys/proc.h then I'm clueless.
> 
> Thanks Ian, that appears to work.
> 
> Maurizio, can you apply the attached patch to a clean ports tree and see if isboot-kmod will build and function properly for you? This is all the changes from this thread and the previous one. If you let me know it works I'll get the port updated.
> 
> 
> Hi John, I need some help.
> 
> I am running:
>  # uname -a                    
> FreeBSD  12.0-CURRENT FreeBSD 12.0-CURRENT #0 r328383: Thu Jan 25 04:48:52 UTC 2018     root@releng3.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64
> 
> after upgrading the ports tree with:
> # portsnap fetch update
> 
> I have copied the directory /usr/ports/net/isboot-kmod/ in  /root/src/isboot-kmod and /root/src/isboot-kmod.orig
> # ls -l /root/src
> total 6
> drwxr-xr-x  3 root  wheel     6 Feb  7 13:46 isboot-kmod
> drwxr-xr-x  3 root  wheel     6 Feb  7 13:46 isboot-kmod.orig
> -rw-rw-rw-  1 root  wheel  5630 Feb  7 11:38 isboot_patch.txt
> 
> Trying to apply the patch I obtain the error:
> # cd /root/src
> # patch -sC < isboot_patch.txt
> 2 out of 2 hunks failed while patching isboot-kmod/Makefile
> 5 out of 5 hunks failed while patching isboot-kmod/files/patch-isboot.c 
> 
> What I am missing ?
> Thanks again for your work.

Not sure but I ran in to similar issues testing here as well. Here's the "svn diff" patch which does work for me. Note that this one should be applied from within the isboot-kmod directory.


[-- Attachment #2 --]
Index: Makefile
===================================================================
--- Makefile	(revision 461112)
+++ Makefile	(working copy)
@@ -2,7 +2,7 @@
 
 PORTNAME=	isboot-kmod
 PORTVERSION=	0.2.13
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	net
 MASTER_SITES=	http://www.peach.ne.jp/archives/isboot/
 DISTNAME=	isboot-${PORTVERSION}
@@ -12,9 +12,7 @@
 
 LICENSE=	BSD2CLAUSE
 
-BROKEN_aarch64=		fails to compile: /usr/src/sys/sys/bus.h:724:10: fatal error: 'device_if.h' file not found
 BROKEN_armv6=		fails to compile: implicit declaration of function 'cp15_pmccntr_get' is invalid in C99
-BROKEN_armv7=		fails to compile: /usr/src/sys/sys/bus.h:724:10: fatal error: 'device_if.h' file not found
 BROKEN_powerpc64=	fails to compile: pcpu.h: size of array '__assert_0' is negative
 
 USES=		kmod uidfix
Index: files/patch-Makefile
===================================================================
--- files/patch-Makefile	(nonexistent)
+++ files/patch-Makefile	(working copy)
@@ -0,0 +1,10 @@
+--- Makefile.orig	2015-09-23 22:33:04.000000000 -0600
++++ Makefile	2018-01-29 10:20:10.453188000 -0700
+@@ -6,6 +6,7 @@
+ SRCS=	isboot.c ibft.c iscsi.c
+ SRCS+=	isboot.h ibft.h iscsi_compat.h
+ SRCS+=	opt_cam.h
++SRCS+=	device_if.h bus_if.h
+ #CFLAGS+= -DVIMAGE
+ #CFLAGS+= -DIBFT_VERBOSE
+ #CFLAGS+= -DDEBUG

Property changes on: files/patch-Makefile
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: files/patch-isboot.c
===================================================================
--- files/patch-isboot.c	(revision 461112)
+++ files/patch-isboot.c	(working copy)
@@ -1,6 +1,14 @@
---- isboot.c.orig	2015-11-05 16:50:51 UTC
-+++ isboot.c
-@@ -347,9 +347,9 @@ isboot_set_v4gw(struct sockaddr_in *gate
+--- isboot.c.orig	2015-11-05 09:50:51.000000000 -0700
++++ isboot.c	2018-02-06 14:23:24.479249000 -0700
+@@ -38,6 +38,7 @@
+ #include <sys/socketvar.h>
+ #include <sys/sockio.h>
+ #include <sys/sysctl.h>
++#include <sys/proc.h>
+ #include <net/if.h>
+ #include <net/if_dl.h>
+ #include <net/if_types.h>
+@@ -347,9 +348,9 @@
  	netmask.sin_addr.s_addr = htonl(0);
  
  	/* delete gateway if exists */
@@ -12,7 +20,7 @@
  	if (error) {
  		if (error != ESRCH) {
  			printf("rtrequest RTM_DELETE error %d\n",
-@@ -359,9 +359,9 @@ isboot_set_v4gw(struct sockaddr_in *gate
+@@ -359,9 +360,9 @@
  	}
  
  	/* set new default gateway */
@@ -24,7 +32,7 @@
  	if (error) {
  		printf("rtrequest RTM_ADD error %d\n", error);
  		return (error);
-@@ -391,9 +391,9 @@ isboot_set_v6gw(struct sockaddr_in6 *gat
+@@ -391,9 +392,9 @@
  	memset(&netmask.sin6_addr, 0, 16);
  
  	/* delete gateway if exists */
@@ -36,7 +44,7 @@
  	if (error) {
  		if (error != ESRCH) {
  			printf("rtrequest RTM_DELETE error %d\n",
-@@ -403,9 +403,9 @@ isboot_set_v6gw(struct sockaddr_in6 *gat
+@@ -403,9 +404,9 @@
  	}
  
  	/* set new default gateway */
@@ -48,3 +56,42 @@
  	if (error) {
  		printf("rtrequest RTM_ADD error %d\n", error);
  		return (error);
+@@ -417,28 +418,36 @@
+ isboot_ifup(struct ifnet *ifp)
+ {
+ 	struct ifreq ifr;
++	struct socket *so;
+ 	struct thread *td;
+ 	int error;
+ 
+ 	memset(&ifr, 0, sizeof(ifr));
+ 	td = curthread;
+ 
++	error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td);
++	if (error) {
++		printf("%s: socreate, error=%d\n", __func__, error);
++		return (error);
++	}
++
+ 	/* boot NIC */
+ 	strlcpy(ifr.ifr_name, ifp->if_xname, sizeof(ifr.ifr_name));
+ 
+ 	/* set IFF_UP */
+-	error = ifioctl(NULL, SIOCGIFFLAGS, (caddr_t)&ifr, td);
++	error = ifioctl(so, SIOCGIFFLAGS, (caddr_t)&ifr, td);
+ 	if (error) {
+ 		printf("ifioctl SIOCGIFFLAGS\n");
+ 		return (error);
+ 	}
+ 	ifr.ifr_flags |= IFF_UP;
+-	error = ifioctl(NULL, SIOCSIFFLAGS, (caddr_t)&ifr, td);
++	error = ifioctl(so, SIOCSIFFLAGS, (caddr_t)&ifr, td);
+ 	if (error) {
+ 		printf("ifioctl SIOCSIFFLAGS\n");
+ 		return (error);
+ 	}
+ 
++	soclose(so);
+ 	return (0);
+ }
+ 
Index: files/patch-iscsi.c
===================================================================
--- files/patch-iscsi.c	(nonexistent)
+++ files/patch-iscsi.c	(working copy)
@@ -0,0 +1,27 @@
+--- iscsi.c.orig	2015-11-05 09:50:51.000000000 -0700
++++ iscsi.c	2018-01-29 10:20:00.586277000 -0700
+@@ -1070,9 +1070,11 @@
+ 	return (n);
+ }
+ 
+-
+-#if __FreeBSD_version >= 1100000
++#if __FreeBSD_version >= 1200051
+ static void
++isboot_free_mbufext(struct mbuf *m)
++#elif __FreeBSD_version >= 1100000
++static void
+ isboot_free_mbufext(struct mbuf *m, void *p, void *optarg)
+ #elif __FreeBSD_version >= 1000050 && __FreeBSD_version < 1100000
+ static int
+@@ -1082,7 +1084,9 @@
+ isboot_free_mbufext(void *p, void *optarg)
+ #endif
+ {
+-
++#if __FreeBSD_version >= 1200051
++	void *p = m->m_ext.ext_arg1;
++#endif
+ 	ISBOOT_TRACE("isboot_free_mbufext\n");
+ 	if (p == NULL)
+ #if __FreeBSD_version >= 1000050 && __FreeBSD_version < 1100000

Property changes on: files/patch-iscsi.c
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7D39479C-85AB-45B2-BF39-0566AC073C5A>