From 7dab44e559289532295b64a8014a7fd934ea7345 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sun, 17 Jun 2007 20:33:14 +0000 Subject: [PATCH] * Add a missing KMODDEP to ng_eiface and hook it into the build. [*] * Add a ng_eiface(4) manual page from FreeBSD-4 [*] and add a reference to it in netgraph(4). * Add a NETGRAPH_EIFACE kernel config option. * Sync libnetgraph with our node types. [*] Submitted-by: Nuno-Antunes --- lib/libnetgraph/debug.c | 20 ++++-- share/man/man4/Makefile | 3 +- share/man/man4/netgraph.4 | 3 +- share/man/man4/ng_eiface.4 | 123 +++++++++++++++++++++++++++++++++++ sys/conf/files | 3 +- sys/conf/options | 3 +- sys/config/LINT | 3 +- sys/netgraph/Makefile | 3 +- sys/netgraph/eiface/Makefile | 7 +- 9 files changed, 154 insertions(+), 14 deletions(-) create mode 100644 share/man/man4/ng_eiface.4 diff --git a/lib/libnetgraph/debug.c b/lib/libnetgraph/debug.c index e1c92e3395..64b7a6afd1 100644 --- a/lib/libnetgraph/debug.c +++ b/lib/libnetgraph/debug.c @@ -37,7 +37,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/lib/libnetgraph/debug.c,v 1.5.2.1 2000/05/01 18:09:54 archie Exp $ - * $DragonFly: src/lib/libnetgraph/debug.c,v 1.3 2003/08/08 04:18:34 dillon Exp $ + * $DragonFly: src/lib/libnetgraph/debug.c,v 1.4 2007/06/17 20:33:14 swildner Exp $ * $Whistle: debug.c,v 1.24 1999/01/24 01:15:33 archie Exp $ */ @@ -60,16 +60,23 @@ #include #include #include +#include #include #include +#include +#include #include #include #include #include #include +#include #include +#include +#include #include #include +#include #include #include #include @@ -81,8 +88,6 @@ #include #include #include -#include -#include #include #endif @@ -109,17 +114,24 @@ static const struct ng_cookie cookies[] = { COOKIE(UI), COOKIE(ASYNC), COOKIE(BPF), + COOKIE(BRIDGE), COOKIE(CISCO), COOKIE(ECHO), + COOKIE(EIFACE), + COOKIE(ETF), COOKIE(ETHER), COOKIE(FRAMERELAY), COOKIE(GENERIC), COOKIE(HOLE), COOKIE(IFACE), COOKIE(KSOCKET), + COOKIE(L2TP), COOKIE(LMI), + COOKIE(MPPC), + COOKIE(ONE2MANY), COOKIE(PPP), COOKIE(PPPOE), + COOKIE(PPTPGRE), COOKIE(RFC1490), COOKIE(SOCKET), COOKIE(TEE), @@ -128,8 +140,6 @@ static const struct ng_cookie cookies[] = { #ifdef WHISTLE COOKIE(DF), COOKIE(IPAC), - COOKIE(MPPC), - COOKIE(PPTPGRE), COOKIE(TN), COOKIE(WFRA), #endif diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 4c86b54461..0a9ca90c3a 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -1,6 +1,6 @@ # @(#)Makefile 8.1 (Berkeley) 6/18/93 # $FreeBSD: src/share/man/man4/Makefile,v 1.83.2.66 2003/06/04 17:10:30 sam Exp $ -# $DragonFly: src/share/man/man4/Makefile,v 1.56 2007/06/16 18:48:18 swildner Exp $ +# $DragonFly: src/share/man/man4/Makefile,v 1.57 2007/06/17 20:33:14 swildner Exp $ MAN= aac.4 \ acpi.4 \ @@ -133,6 +133,7 @@ MAN= aac.4 \ ng_cisco.4 \ nge.4 \ ng_echo.4 \ + ng_eiface.4 \ ng_etf.4 \ ng_ether.4 \ ng_frame_relay.4 \ diff --git a/share/man/man4/netgraph.4 b/share/man/man4/netgraph.4 index 3b050918c5..c25f2b15ea 100644 --- a/share/man/man4/netgraph.4 +++ b/share/man/man4/netgraph.4 @@ -34,7 +34,7 @@ .\" Archie Cobbs .\" .\" $FreeBSD: src/share/man/man4/netgraph.4,v 1.39.2.1 2001/12/21 09:00:50 ru Exp $ -.\" $DragonFly: src/share/man/man4/netgraph.4,v 1.10 2007/06/04 00:40:31 swildner Exp $ +.\" $DragonFly: src/share/man/man4/netgraph.4,v 1.11 2007/06/17 20:33:14 swildner Exp $ .\" $Whistle: netgraph.4,v 1.7 1999/01/28 23:54:52 julian Exp $ .\" .Dd January 19, 1999 @@ -1022,6 +1022,7 @@ and .Xr ng_bridge 4 , .Xr ng_cisco 4 , .Xr ng_echo 4 , +.Xr ng_eiface 4 , .Xr ng_etf 4 , .Xr ng_ether 4 , .Xr ng_frame_relay 4 , diff --git a/share/man/man4/ng_eiface.4 b/share/man/man4/ng_eiface.4 new file mode 100644 index 0000000000..e1a5ef5b1d --- /dev/null +++ b/share/man/man4/ng_eiface.4 @@ -0,0 +1,123 @@ +.\" Copyright (c) 2004 Gleb Smirnoff +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD: src/share/man/man4/ng_eiface.4,v 1.3.2.1 2005/02/03 13:49:18 ru Exp $ +.\" $DragonFly: src/share/man/man4/ng_eiface.4,v 1.1 2007/06/17 20:33:14 swildner Exp $ +.\" +.Dd February 3, 2005 +.Dt NG_EIFACE 4 +.Os +.Sh NAME +.Nm ng_eiface +.Nd "generic Ethernet interface netgraph node type" +.Sh SYNOPSIS +.In netgraph/ng_eiface.h +.Sh DESCRIPTION +The +.Vt eiface +netgraph node implements the generic Ethernet interface. +When +.Vt eiface +node is created, a new interface appears which is accessible via +.Xr ifconfig 8 . +These interfaces are named +.Dq Li ngeth0 , +.Dq Li ngeth1 , +etc. +When a node is shut down, the corresponding interface is removed, +and the interface name becomes available for reuse by future +.Vt eiface +nodes. +New nodes always take the first unused interface. +.Sh HOOKS +An +.Vt eiface +node has a single hook named +.Va ether , +which should be connected to the +Ethernet downstream, for example, to the +.Xr ng_vlan 4 +node. +Packets transmitted via the interface flow out this hook. +Similarly, packets received on the hook go to the protocol stack as +packets received by any real Ethernet interface. +.Sh CONTROL MESSAGES +This node type supports the generic control messages, plus the following: +.Bl -tag -width indent +.It Dv NGM_EIFACE_SET Pq Li set +Set link-level address of the interface. +Requires +.Vt "struct ether_addr" +as an argument. +This message also has an +.Tn ASCII +version, called +.Dq Li set , +which requires as an argument an +.Tn ASCII +string consisting of 6 colon-separated hex digits. +.It Dv NGM_EIFACE_GET_IFNAME Pq Li getifname +Return the name of the associated interface as a +.Dv NUL Ns -terminated +.Tn ASCII +string. +.It Dv NGM_EIFACE_GET_IFADDRS +Return the list of link-level addresses associated with the node. +.El +.Sh SHUTDOWN +This node shuts down upon receipt of a +.Dv NGM_SHUTDOWN +control message. +The associated interface is removed and its name becomes +available for reuse by future +.Vt eiface +nodes. +.Pp +Unlike most other node types, an +.Vt eiface +node does +.Em not +go away when all hooks have been disconnected; rather, and explicit +.Dv NGM_SHUTDOWN +control message is required. +.Sh SEE ALSO +.Xr netgraph 4 , +.Xr ng_ether 4 , +.Xr ng_iface 4 , +.Xr ng_vlan 4 , +.Xr ifconfig 8 , +.Xr ngctl 8 +.Sh HISTORY +The +.Vt eiface +node type was implemented in +.Fx 4.6 . +.Sh AUTHORS +.An -nosplit +The +.Vt eiface +node type was written by +.An Vitaly V Belekhov . +This manual page was written by +.An Gleb Smirnoff . diff --git a/sys/conf/files b/sys/conf/files index 455d244ff4..903fb18b23 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,5 +1,5 @@ # $FreeBSD: src/sys/conf/files,v 1.340.2.137 2003/06/04 17:10:30 sam Exp $ -# $DragonFly: src/sys/conf/files,v 1.162 2007/06/16 19:48:04 hasso Exp $ +# $DragonFly: src/sys/conf/files,v 1.163 2007/06/17 20:33:14 swildner Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -855,6 +855,7 @@ net/bpf_filter.c optional netgraph_bpf netgraph/bridge/ng_bridge.c optional netgraph_bridge netgraph/cisco/ng_cisco.c optional netgraph_cisco netgraph/echo/ng_echo.c optional netgraph_echo +netgraph/eiface/ng_eiface.c optional netgraph_eiface netgraph/ether/ng_ether.c optional netgraph_ether netgraph/frame_relay/ng_frame_relay.c optional netgraph_frame_relay netgraph/hole/ng_hole.c optional netgraph_hole diff --git a/sys/conf/options b/sys/conf/options index 655625b1a6..5662b5ff56 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -1,5 +1,5 @@ # $FreeBSD: src/sys/conf/options,v 1.191.2.53 2003/06/04 17:56:58 sam Exp $ -# $DragonFly: src/sys/conf/options,v 1.65 2007/05/26 08:50:49 sephe Exp $ +# $DragonFly: src/sys/conf/options,v 1.66 2007/06/17 20:33:14 swildner Exp $ # # On the handling of kernel options # @@ -320,6 +320,7 @@ NETGRAPH_BPF opt_netgraph.h NETGRAPH_BRIDGE opt_netgraph.h NETGRAPH_CISCO opt_netgraph.h NETGRAPH_ECHO opt_netgraph.h +NETGRAPH_EIFACE opt_netgraph.h NETGRAPH_ETHER opt_netgraph.h NETGRAPH_FRAME_RELAY opt_netgraph.h NETGRAPH_HOLE opt_netgraph.h diff --git a/sys/config/LINT b/sys/config/LINT index bc081676ec..5c12c7369e 100644 --- a/sys/config/LINT +++ b/sys/config/LINT @@ -3,7 +3,7 @@ # as much of the source tree as it can. # # $FreeBSD: src/sys/i386/conf/LINT,v 1.749.2.144 2003/06/04 17:56:59 sam Exp $ -# $DragonFly: src/sys/config/LINT,v 1.118 2007/06/09 18:21:18 swildner Exp $ +# $DragonFly: src/sys/config/LINT,v 1.119 2007/06/17 20:33:14 swildner Exp $ # # NB: You probably don't want to try running a kernel built from this # file. Instead, you should start from GENERIC, and add options from @@ -484,6 +484,7 @@ options NETGRAPH_BPF options NETGRAPH_BRIDGE options NETGRAPH_CISCO options NETGRAPH_ECHO +options NETGRAPH_EIFACE options NETGRAPH_ETHER options NETGRAPH_FRAME_RELAY options NETGRAPH_HOLE diff --git a/sys/netgraph/Makefile b/sys/netgraph/Makefile index 4cb11a6bb3..40495328d2 100644 --- a/sys/netgraph/Makefile +++ b/sys/netgraph/Makefile @@ -1,6 +1,6 @@ # $Whistle: Makefile,v 1.5 1999/01/24 06:48:37 archie Exp $ # $FreeBSD: src/sys/modules/netgraph/Makefile,v 1.8.2.8 2002/08/20 23:48:15 archie Exp $ -# $DragonFly: src/sys/netgraph/Makefile,v 1.4 2006/09/16 18:39:13 swildner Exp $ +# $DragonFly: src/sys/netgraph/Makefile,v 1.5 2007/06/17 20:33:14 swildner Exp $ SUBDIR= UI \ async \ @@ -8,6 +8,7 @@ SUBDIR= UI \ bridge \ cisco \ echo \ + eiface \ etf \ ether \ frame_relay \ diff --git a/sys/netgraph/eiface/Makefile b/sys/netgraph/eiface/Makefile index e845886abd..69901d0db6 100644 --- a/sys/netgraph/eiface/Makefile +++ b/sys/netgraph/eiface/Makefile @@ -1,7 +1,8 @@ # $FreeBSD: src/sys/modules/netgraph/eiface/Makefile,v 1.2.2.1 2002/04/15 00:12:57 julian Exp $ -# $DragonFly: src/sys/netgraph/eiface/Makefile,v 1.2 2003/06/17 04:28:46 dillon Exp $ +# $DragonFly: src/sys/netgraph/eiface/Makefile,v 1.3 2007/06/17 20:33:14 swildner Exp $ -KMOD= ng_eiface -SRCS= ng_eiface.c +KMOD= ng_eiface +SRCS= ng_eiface.c +KMODDEPS= netgraph .include -- 2.41.0