From owner-freebsd-current@freebsd.org Tue Feb 6 22:02:26 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E411EF0B357 for ; Tue, 6 Feb 2018 22:02:25 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from webmail5.jnielsen.net (webmail5.jnielsen.net [69.87.218.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "webmail2.jnielsen.net", Issuer "freebsdsolutions.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F5C584657; Tue, 6 Feb 2018 22:02:24 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from [10.3.135.23] (50-207-240-162-static.hfc.comcastbusiness.net [50.207.240.162]) (authenticated bits=0) by webmail5.jnielsen.net (8.15.2/8.15.2) with ESMTPSA id w16M2COk002223 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 6 Feb 2018 15:02:14 -0700 (MST) (envelope-from lists@jnielsen.net) X-Authentication-Warning: webmail5.jnielsen.net: Host 50-207-240-162-static.hfc.comcastbusiness.net [50.207.240.162] claimed to be [10.3.135.23] From: John Nielsen Message-Id: <1C97132B-099B-4BAA-9C39-A1BE00481CAC@jnielsen.net> Content-Type: multipart/mixed; boundary="Apple-Mail=_B7DB8F21-4A50-46D9-ABF3-A6D79284F287" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: Fatal trap 12 booting FreeBSD-CURRENT via isboot kernel module. Date: Tue, 6 Feb 2018 15:02:10 -0700 In-Reply-To: <1517943001.1366.100.camel@freebsd.org> Cc: freebsd-current , Daisuke Aoyama , Ian Lepore To: Maurizio Vairani References: <3E242843-7D43-4A36-A448-E4B0DACB2AB4@jnielsen.net> <5EDB0747-41DE-4ECF-925E-EF24FAA550F3@jnielsen.net> <1517943001.1366.100.camel@freebsd.org> X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Feb 2018 22:02:26 -0000 --Apple-Mail=_B7DB8F21-4A50-46D9-ABF3-A6D79284F287 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Feb 6, 2018, at 11:50 AM, Ian Lepore wrote: >=20 > On Tue, 2018-02-06 at 11:33 -0700, John Nielsen wrote: >>=20 >> Apparently sending a NULL socket pointer to ifioctl hasn't worked >> since this commit in 2011: >> https://svnweb.freebsd.org/base?view=3Drevision&revision=3D218757 >>=20 >> So I'm going to add this patch to the port unconditionally once it >> works. >>=20 >> 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: >>=20 >> --- isboot.o --- >> isboot.c:425:53: error: incomplete definition of type 'struct thread' >> error =3D 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. >>=20 >=20 > Try adding #include 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. >=20 > 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. --Apple-Mail=_B7DB8F21-4A50-46D9-ABF3-A6D79284F287 Content-Disposition: attachment; filename=isboot_patch.txt Content-Type: text/plain; x-unix-mode=0644; name="isboot_patch.txt" Content-Transfer-Encoding: quoted-printable diff -uPr isboot-kmod.orig/Makefile isboot-kmod/Makefile --- isboot-kmod.orig/Makefile 2018-01-11 07:18:01.000000000 -0700 +++ isboot-kmod/Makefile 2018-02-06 14:56:23.654737000 -0700 @@ -2,7 +2,7 @@ =20 PORTNAME=3D isboot-kmod PORTVERSION=3D 0.2.13 -PORTREVISION=3D 1 +PORTREVISION=3D 2 CATEGORIES=3D net MASTER_SITES=3D http://www.peach.ne.jp/archives/isboot/ DISTNAME=3D isboot-${PORTVERSION} @@ -12,9 +12,7 @@ =20 LICENSE=3D BSD2CLAUSE =20 -BROKEN_aarch64=3D fails to compile: = /usr/src/sys/sys/bus.h:724:10: fatal error: 'device_if.h' file not found BROKEN_armv6=3D fails to compile: implicit declaration of = function 'cp15_pmccntr_get' is invalid in C99 -BROKEN_armv7=3D fails to compile: = /usr/src/sys/sys/bus.h:724:10: fatal error: 'device_if.h' file not found BROKEN_powerpc64=3D fails to compile: pcpu.h: size of array = '__assert_0' is negative =20 USES=3D kmod uidfix diff -uPr isboot-kmod.orig/files/patch-Makefile = isboot-kmod/files/patch-Makefile --- isboot-kmod.orig/files/patch-Makefile 1969-12-31 = 17:00:00.000000000 -0700 +++ isboot-kmod/files/patch-Makefile 2018-01-29 10:24:27.372206000 = -0700 @@ -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=3D isboot.c ibft.c iscsi.c + SRCS+=3D isboot.h ibft.h iscsi_compat.h + SRCS+=3D opt_cam.h ++SRCS+=3D device_if.h bus_if.h + #CFLAGS+=3D -DVIMAGE + #CFLAGS+=3D -DIBFT_VERBOSE + #CFLAGS+=3D -DDEBUG diff -uPr isboot-kmod.orig/files/patch-isboot.c = isboot-kmod/files/patch-isboot.c --- isboot-kmod.orig/files/patch-isboot.c 2016-05-06 = 08:34:57.000000000 -0600 +++ isboot-kmod/files/patch-isboot.c 2018-02-06 14:24:47.447244000 = -0700 @@ -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 + #include + #include ++#include + #include + #include + #include +@@ -347,9 +348,9 @@ netmask.sin_addr.s_addr =3D htonl(0); =20 /* delete gateway if exists */ @@ -12,7 +20,7 @@ if (error) { if (error !=3D ESRCH) { printf("rtrequest RTM_DELETE error %d\n", -@@ -359,9 +359,9 @@ isboot_set_v4gw(struct sockaddr_in *gate +@@ -359,9 +360,9 @@ } =20 /* 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); =20 /* delete gateway if exists */ @@ -36,7 +44,7 @@ if (error) { if (error !=3D ESRCH) { printf("rtrequest RTM_DELETE error %d\n", -@@ -403,9 +403,9 @@ isboot_set_v6gw(struct sockaddr_in6 *gat +@@ -403,9 +404,9 @@ } =20 /* 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; +=20 + memset(&ifr, 0, sizeof(ifr)); + td =3D curthread; +=20 ++ error =3D socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, = td); ++ if (error) { ++ printf("%s: socreate, error=3D%d\n", __func__, error); ++ return (error); ++ } ++ + /* boot NIC */ + strlcpy(ifr.ifr_name, ifp->if_xname, sizeof(ifr.ifr_name)); +=20 + /* set IFF_UP */ +- error =3D ifioctl(NULL, SIOCGIFFLAGS, (caddr_t)&ifr, td); ++ error =3D ifioctl(so, SIOCGIFFLAGS, (caddr_t)&ifr, td); + if (error) { + printf("ifioctl SIOCGIFFLAGS\n"); + return (error); + } + ifr.ifr_flags |=3D IFF_UP; +- error =3D ifioctl(NULL, SIOCSIFFLAGS, (caddr_t)&ifr, td); ++ error =3D ifioctl(so, SIOCSIFFLAGS, (caddr_t)&ifr, td); + if (error) { + printf("ifioctl SIOCSIFFLAGS\n"); + return (error); + } +=20 ++ soclose(so); + return (0); + } +=20 diff -uPr isboot-kmod.orig/files/patch-iscsi.c = isboot-kmod/files/patch-iscsi.c --- isboot-kmod.orig/files/patch-iscsi.c 1969-12-31 = 17:00:00.000000000 -0700 +++ isboot-kmod/files/patch-iscsi.c 2018-01-29 10:24:54.854580000 = -0700 @@ -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); + } +=20 +- +-#if __FreeBSD_version >=3D 1100000 ++#if __FreeBSD_version >=3D 1200051 + static void ++isboot_free_mbufext(struct mbuf *m) ++#elif __FreeBSD_version >=3D 1100000 ++static void + isboot_free_mbufext(struct mbuf *m, void *p, void *optarg) + #elif __FreeBSD_version >=3D 1000050 && __FreeBSD_version < 1100000 + static int +@@ -1082,7 +1084,9 @@ + isboot_free_mbufext(void *p, void *optarg) + #endif + { +- ++#if __FreeBSD_version >=3D 1200051 ++ void *p =3D m->m_ext.ext_arg1; ++#endif + ISBOOT_TRACE("isboot_free_mbufext\n"); + if (p =3D=3D NULL) + #if __FreeBSD_version >=3D 1000050 && __FreeBSD_version < 1100000 --Apple-Mail=_B7DB8F21-4A50-46D9-ABF3-A6D79284F287 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_B7DB8F21-4A50-46D9-ABF3-A6D79284F287--