Finally get around to committing Bill Paul's FEC netgraph nodes.

These are really only partly netgraph nodes as they do not use the
netgraph interfaces for many of the functions for which they could
be used, however they represent important functionality.

Submitted by:	wpaul
MFC after: 2 days
This commit is contained in:
julian 2002-10-29 19:12:44 +00:00
parent 13f1045bf9
commit 9e662115ff
4 changed files with 1330 additions and 0 deletions

View File

@ -0,0 +1,11 @@
# $FreeBSD$
KMOD= ng_fec
SRCS= ng_fec.c opt_inet.h opt_inet6.h
#MAN4= ng_fec.4
NOMAN= yes
KMODDEPS= netgraph
CFLAGS += -DINET -DINET6
.include <bsd.kmod.mk>

View File

@ -0,0 +1,8 @@
# $FreeBSD$
kldload ./ng_fec.ko
ngctl mkpeer fec dummy fec
ngctl msg fec0: add_iface '"dc0"'
ngctl msg fec0: add_iface '"dc1"'
ngctl msg fec0: add_iface '"dc2"'
ngctl msg fec0: add_iface '"dc3"'
ngctl msg fec0: set_mode_inet

1200
sys/netgraph/ng_fec.c Normal file

File diff suppressed because it is too large Load Diff

111
sys/netgraph/ng_fec.h Normal file
View File

@ -0,0 +1,111 @@
/*
* ng_fec.h
*
* Copyright (c) 2000 Berkeley Software Design, Inc.
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul@osd.bsdi.com>. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Bill Paul.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD
* 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$
*/
/*
* Copyright (c) 1996-1999 Whistle Communications, Inc.
* All rights reserved.
*
* Subject to the following obligations and disclaimer of warranty, use and
* redistribution of this software, in source or object code forms, with or
* without modifications are expressly permitted by Whistle Communications;
* provided, however, that:
* 1. Any and all reproductions of the source or object code must include the
* copyright notice above and the following disclaimer of warranties; and
* 2. No rights are granted, in any manner or form, to use Whistle
* Communications, Inc. trademarks, including the mark "WHISTLE
* COMMUNICATIONS" on advertising, endorsements, or otherwise except as
* such appears in the above copyright notice or in the software.
*
* THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
* REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
* INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
* WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
* REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
* SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
* IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
* RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
* WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER 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 WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* Author: Archie Cobbs <archie@freebsd.org>
*
* $Whistle: ng_fec.h,v 1.5 1999/01/20 00:22:13 archie Exp $
*/
#ifndef _NETGRAPH_FEC_H_
#define _NETGRAPH_FEC_H_
#define NETISR_FEC 26
/* Node type name and magic cookie */
#define NG_FEC_NODE_TYPE "fec"
#define NGM_FEC_COOKIE 983566799
/* Interface base name */
#define NG_FEC_FEC_NAME "fec"
#define NG_FEC_FEC_NAME_MAX 15
/* MTU bounds */
#define NG_FEC_MTU_MIN 72
#define NG_FEC_MTU_MAX 65535
#define NG_FEC_MTU_DEFAULT 1500
/* Special flags for mbufs. */
#define M_FEC_MAC 0x2000
#define M_FEC_INET 0x4000
#define M_FEC_INET6 0x8000
/* Netgraph commands */
enum {
NGM_FEC_ADD_IFACE,
NGM_FEC_DEL_IFACE,
NGM_FEC_SET_MODE_MAC,
NGM_FEC_SET_MODE_INET,
NGM_FEC_SET_MODE_INET6
};
struct ng_fec_ifname {
char ngif_name[NG_FEC_FEC_NAME_MAX + 1];
};
#endif /* _NETGRAPH_FEC_H_ */