Date: Mon, 20 Jun 2016 05:40:15 +0000 (UTC) From: Nomad Esst <noname.esst@yahoo.com> To: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Using netgraph in kernel modules Message-ID: <820876206.1145906.1466401215430.JavaMail.yahoo@mail.yahoo.com> References: <820876206.1145906.1466401215430.JavaMail.yahoo.ref@mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi I included the two files in my kernel module : #include <netgraph/netgraph.h>#include <netgraph/ng_message.h> And here is contents of Makefile: =C2=A0 KMOD=3D echo=C2=A0=C2=A0 SRCS=3D char_dev.c =C2=A0 .include <bsd.kmod.mk> When I try to run make I face the following errors: @/netgraph/ng_message.h:59: error: expected specifier-qualifier-list before= 'u_char' @/netgraph/ng_message.h:227: error: expected specifier-qualifier-list befor= e 'uint32_t' @/netgraph/ng_message.h:269: error: expected specifier-qualifier-list befor= e 'u_int32_t' @/netgraph/ng_message.h:283: error: expected specifier-qualifier-list befor= e 'u_int32_t' @/netgraph/ng_message.h:294: error: expected specifier-qualifier-list befor= e 'u_int32_t' @/netgraph/ng_message.h:306: error: expected specifier-qualifier-list befor= e 'u_int64_t' @/netgraph/ng_message.h:332: error: expected specifier-qualifier-list befor= e 'u_int' @/netgraph/ng_message.h:352: error: expected specifier-qualifier-list befor= e 'uint32_t' In file included from @/sys/lock.h:36, =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0from @/netgra= ph/netgraph.h:52, =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0from char_dev= .c:2: @/sys/_lock.h:36: error: expected specifier-qualifier-list before 'u_int' In file included from @/netgraph/netgraph.h:52, =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0from char_dev= .c:2: @/sys/lock.h:60: error: expected specifier-qualifier-list before 'u_int' In file included from char_dev.c:2: @/netgraph/netgraph.h:1187: error: field 'tag' has incomplete type *** [char_dev.o] Error code 1 Stop in /extra/char-dev. What's the problem?? From owner-freebsd-hackers@freebsd.org Mon Jun 20 06:27:06 2016 Return-Path: <owner-freebsd-hackers@freebsd.org> Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A68CA7B034 for <freebsd-hackers@mailman.ysv.freebsd.org>; Mon, 20 Jun 2016 06:27:06 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E9CF32CB9 for <freebsd-hackers@freebsd.org>; Mon, 20 Jun 2016 06:27:05 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-242-176.lns20.per4.internode.on.net [121.45.242.176]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id u5K6R0eK086341 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sun, 19 Jun 2016 23:27:02 -0700 (PDT) (envelope-from julian@freebsd.org) Subject: Re: Using netgraph in kernel modules To: noname.esst@yahoo.com References: <820876206.1145906.1466401215430.JavaMail.yahoo.ref@mail.yahoo.com> <820876206.1145906.1466401215430.JavaMail.yahoo@mail.yahoo.com> From: Julian Elischer <julian@freebsd.org> Cc: freebsd-hackers@freebsd.org Message-ID: <d91bcfdf-5c00-b0c9-3e83-4bb0276db99b@freebsd.org> Date: Mon, 20 Jun 2016 14:26:54 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <820876206.1145906.1466401215430.JavaMail.yahoo@mail.yahoo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Technical Discussions relating to FreeBSD <freebsd-hackers.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-hackers>, <mailto:freebsd-hackers-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/freebsd-hackers/> List-Post: <mailto:freebsd-hackers@freebsd.org> List-Help: <mailto:freebsd-hackers-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-hackers>, <mailto:freebsd-hackers-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 20 Jun 2016 06:27:06 -0000 On 20/06/2016 1:40 PM, Nomad Esst via freebsd-hackers wrote: > Hi > > I included the two files in my kernel module : > > #include <netgraph/netgraph.h>#include <netgraph/ng_message.h> did you start with /usr/src/sys/netgraph/ng_sample.c? My suggestion is to start with that and add in your code a bit at a time To see it compile, go to /usr/src/sys/modules/netgraph/sample and type "make to make your own module, copy the build directory to /usr/src/sys/modules/netgraph/mymodule copy the source files to /usr/src/sys/netgraph/ng_mymodule.h /usr/src/sys/netgraph/ng_mymodule.c and replace all instances of 'sample' in all the files and the Makefile with 'mymodule' Then go to /usr/src/sys/modules/netgraph/mymodule and make sure it still compiles then add all your own code, adding include files as you need them recompile it every time you have the oportunity while you are working on it. > > And here is contents of Makefile: > > KMOD= echo SRCS= char_dev.c > > .include <bsd.kmod.mk> > > When I try to run make I face the following errors: > > > @/netgraph/ng_message.h:59: error: expected specifier-qualifier-list before 'u_char' > @/netgraph/ng_message.h:227: error: expected specifier-qualifier-list before 'uint32_t' > @/netgraph/ng_message.h:269: error: expected specifier-qualifier-list before 'u_int32_t' > @/netgraph/ng_message.h:283: error: expected specifier-qualifier-list before 'u_int32_t' > @/netgraph/ng_message.h:294: error: expected specifier-qualifier-list before 'u_int32_t' > @/netgraph/ng_message.h:306: error: expected specifier-qualifier-list before 'u_int64_t' > @/netgraph/ng_message.h:332: error: expected specifier-qualifier-list before 'u_int' > @/netgraph/ng_message.h:352: error: expected specifier-qualifier-list before 'uint32_t' > In file included from @/sys/lock.h:36, > from @/netgraph/netgraph.h:52, > from char_dev.c:2: > @/sys/_lock.h:36: error: expected specifier-qualifier-list before 'u_int' > In file included from @/netgraph/netgraph.h:52, > from char_dev.c:2: > @/sys/lock.h:60: error: expected specifier-qualifier-list before 'u_int' > In file included from char_dev.c:2: > @/netgraph/netgraph.h:1187: error: field 'tag' has incomplete type > *** [char_dev.o] Error code 1 > > > Stop in /extra/char-dev. > > > What's the problem?? > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?820876206.1145906.1466401215430.JavaMail.yahoo>