Deleted Added
sdiff udiff text old ( 69923 ) new ( 70159 )
full compact
1
2/*
3 * ng_base.c
4 *
5 * Copyright (c) 1996-1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

--- 23 unchanged lines hidden (view full) ---

32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Authors: Julian Elischer <julian@freebsd.org>
38 * Archie Cobbs <archie@freebsd.org>
39 *
40 * $FreeBSD: head/sys/netgraph/ng_base.c 69923 2000-12-12 18:59:09Z julian $
41 * $Whistle: ng_base.c,v 1.39 1999/01/28 23:54:53 julian Exp $
42 */
43
44/*
45 * This file implements the base netgraph code.
46 */
47
48#include <sys/param.h>

--- 802 unchanged lines hidden (view full) ---

851 * Install a new netgraph type
852 */
853int
854ng_newtype(struct ng_type *tp)
855{
856 const size_t namelen = strlen(tp->name);
857
858 /* Check version and type name fields */
859 if (tp->version != NG_VERSION || namelen == 0 || namelen > NG_TYPELEN) {
860 TRAP_ERROR;
861 return (EINVAL);
862 }
863
864 /* Check for name collision */
865 if (ng_findtype(tp->name) != NULL) {
866 TRAP_ERROR;
867 return (EEXIST);

--- 616 unchanged lines hidden (view full) ---

1484 binary = (struct ng_mesg *)msg->data;
1485 if (msg->header.arglen < sizeof(struct ng_mesg)
1486 || msg->header.arglen - sizeof(struct ng_mesg)
1487 < binary->header.arglen) {
1488 error = EINVAL;
1489 break;
1490 }
1491
1492 /* Get a response message with lots of room */
1493 NG_MKRESPONSE(rp, msg, sizeof(*ascii) + bufSize, M_NOWAIT);
1494 if (rp == NULL) {
1495 error = ENOMEM;
1496 break;
1497 }
1498 ascii = (struct ng_mesg *)rp->data;
1499

--- 60 unchanged lines hidden (view full) ---

1560 || ascii->header.arglen < 1
1561 || msg->header.arglen
1562 < sizeof(*ascii) + ascii->header.arglen) {
1563 error = EINVAL;
1564 break;
1565 }
1566 ascii->data[ascii->header.arglen - 1] = '\0';
1567
1568 /* Get a response message with lots of room */
1569 NG_MKRESPONSE(rp, msg, sizeof(*binary) + bufSize, M_NOWAIT);
1570 if (rp == NULL) {
1571 error = ENOMEM;
1572 break;
1573 }
1574 binary = (struct ng_mesg *)rp->data;
1575

--- 507 unchanged lines hidden ---